aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/alpha/Kconfig2
-rw-r--r--arch/alpha/include/asm/fcntl.h2
-rw-r--r--arch/alpha/kernel/srm_env.c5
-rw-r--r--arch/arm/Kconfig38
-rw-r--r--arch/arm/Kconfig.debug91
-rw-r--r--arch/arm/boot/Makefile9
-rw-r--r--arch/arm/boot/compressed/Makefile8
-rw-r--r--arch/arm/boot/dts/tegra-harmony.dts12
-rw-r--r--arch/arm/boot/dts/tegra-seaboard.dts6
-rw-r--r--arch/arm/common/gic.c26
-rw-r--r--arch/arm/common/pl330.c2
-rw-r--r--arch/arm/common/sa1111.c9
-rw-r--r--arch/arm/common/scoop.c2
-rw-r--r--arch/arm/common/timer-sp.c9
-rw-r--r--arch/arm/common/vic.c4
-rw-r--r--arch/arm/configs/integrator_defconfig19
-rw-r--r--arch/arm/include/asm/Kbuild17
-rw-r--r--arch/arm/include/asm/auxvec.h4
-rw-r--r--arch/arm/include/asm/bitsperlong.h1
-rw-r--r--arch/arm/include/asm/bug.h55
-rw-r--r--arch/arm/include/asm/cachetype.h5
-rw-r--r--arch/arm/include/asm/cputime.h6
-rw-r--r--arch/arm/include/asm/device.h3
-rw-r--r--arch/arm/include/asm/dma-mapping.h2
-rw-r--r--arch/arm/include/asm/dma.h6
-rw-r--r--arch/arm/include/asm/ecard.h1
-rw-r--r--arch/arm/include/asm/emergency-restart.h6
-rw-r--r--arch/arm/include/asm/errno.h6
-rw-r--r--arch/arm/include/asm/futex.h34
-rw-r--r--arch/arm/include/asm/gpio.h19
-rw-r--r--arch/arm/include/asm/hardware/cache-l2x0.h42
-rw-r--r--arch/arm/include/asm/hardware/iop3xx-gpio.h2
-rw-r--r--arch/arm/include/asm/io.h40
-rw-r--r--arch/arm/include/asm/ioctl.h1
-rw-r--r--arch/arm/include/asm/irq_regs.h1
-rw-r--r--arch/arm/include/asm/kdebug.h1
-rw-r--r--arch/arm/include/asm/local.h1
-rw-r--r--arch/arm/include/asm/local64.h1
-rw-r--r--arch/arm/include/asm/localtimer.h1
-rw-r--r--arch/arm/include/asm/mach/arch.h3
-rw-r--r--arch/arm/include/asm/mmu.h4
-rw-r--r--arch/arm/include/asm/outercache.h7
-rw-r--r--arch/arm/include/asm/page.h42
-rw-r--r--arch/arm/include/asm/percpu.h6
-rw-r--r--arch/arm/include/asm/pgalloc.h4
-rw-r--r--arch/arm/include/asm/pgtable-2level-hwdef.h93
-rw-r--r--arch/arm/include/asm/pgtable-2level-types.h67
-rw-r--r--arch/arm/include/asm/pgtable-2level.h143
-rw-r--r--arch/arm/include/asm/pgtable-hwdef.h77
-rw-r--r--arch/arm/include/asm/pgtable.h141
-rw-r--r--arch/arm/include/asm/poll.h1
-rw-r--r--arch/arm/include/asm/resource.h6
-rw-r--r--arch/arm/include/asm/sections.h1
-rw-r--r--arch/arm/include/asm/siginfo.h6
-rw-r--r--arch/arm/include/asm/sizes.h21
-rw-r--r--arch/arm/include/asm/system.h4
-rw-r--r--arch/arm/include/asm/tlbflush.h4
-rw-r--r--arch/arm/include/asm/unistd.h4
-rw-r--r--arch/arm/kernel/Makefile2
-rw-r--r--arch/arm/kernel/armksyms.c3
-rw-r--r--arch/arm/kernel/asm-offsets.c12
-rw-r--r--arch/arm/kernel/bios32.c9
-rw-r--r--arch/arm/kernel/debug.S4
-rw-r--r--arch/arm/kernel/dma.c2
-rw-r--r--arch/arm/kernel/ecard.c36
-rw-r--r--arch/arm/kernel/entry-armv.S44
-rw-r--r--arch/arm/kernel/head.S74
-rw-r--r--arch/arm/kernel/machine_kexec.c35
-rw-r--r--arch/arm/kernel/module.c2
-rw-r--r--arch/arm/kernel/perf_event_v7.c4
-rw-r--r--arch/arm/kernel/process.c2
-rw-r--r--arch/arm/kernel/setup.c37
-rw-r--r--arch/arm/kernel/smp.c29
-rw-r--r--arch/arm/kernel/smp_scu.c10
-rw-r--r--arch/arm/kernel/time.c6
-rw-r--r--arch/arm/kernel/traps.c51
-rw-r--r--arch/arm/kernel/vmlinux.lds.S18
-rw-r--r--arch/arm/lib/backtrace.S6
-rw-r--r--arch/arm/lib/div64.S8
-rw-r--r--arch/arm/lib/uaccess_with_memcpy.c1
-rw-r--r--arch/arm/mach-at91/Makefile.boot6
-rw-r--r--arch/arm/mach-at91/at91cap9_devices.c2
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9g45_devices.c2
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c2
-rw-r--r--arch/arm/mach-at91/board-1arm.c2
-rw-r--r--arch/arm/mach-at91/board-afeb-9260v1.c2
-rw-r--r--arch/arm/mach-at91/board-cam60.c2
-rw-r--r--arch/arm/mach-at91/board-cap9adk.c2
-rw-r--r--arch/arm/mach-at91/board-carmeva.c2
-rw-r--r--arch/arm/mach-at91/board-cpu9krea.c2
-rw-r--r--arch/arm/mach-at91/board-cpuat91.c2
-rw-r--r--arch/arm/mach-at91/board-csb337.c2
-rw-r--r--arch/arm/mach-at91/board-csb637.c2
-rw-r--r--arch/arm/mach-at91/board-eb9200.c2
-rw-r--r--arch/arm/mach-at91/board-ecbat91.c2
-rw-r--r--arch/arm/mach-at91/board-kafa.c2
-rw-r--r--arch/arm/mach-at91/board-kb9202.c2
-rw-r--r--arch/arm/mach-at91/board-neocore926.c2
-rw-r--r--arch/arm/mach-at91/board-picotux200.c2
-rw-r--r--arch/arm/mach-at91/board-qil-a9260.c2
-rw-r--r--arch/arm/mach-at91/board-rm9200dk.c2
-rw-r--r--arch/arm/mach-at91/board-rm9200ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9-l9260.c2
-rw-r--r--arch/arm/mach-at91/board-sam9260ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9263ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9m10g45ek.c2
-rw-r--r--arch/arm/mach-at91/board-sam9rlek.c2
-rw-r--r--arch/arm/mach-at91/board-usb-a9260.c2
-rw-r--r--arch/arm/mach-at91/board-usb-a9263.c2
-rw-r--r--arch/arm/mach-at91/board-yl-9200.c2
-rw-r--r--arch/arm/mach-at91/gpio.c4
-rw-r--r--arch/arm/mach-at91/include/mach/gpio.h5
-rw-r--r--arch/arm/mach-at91/leds.c2
-rw-r--r--arch/arm/mach-at91/pm.c2
-rw-r--r--arch/arm/mach-bcmring/Kconfig2
-rw-r--r--arch/arm/mach-bcmring/Makefile.boot2
-rw-r--r--arch/arm/mach-bcmring/arch.c4
-rw-r--r--arch/arm/mach-bcmring/irq.c1
-rw-r--r--arch/arm/mach-bcmring/timer.c1
-rw-r--r--arch/arm/mach-clps711x/Makefile.boot2
-rw-r--r--arch/arm/mach-clps711x/clep7312.c3
-rw-r--r--arch/arm/mach-clps711x/edb7211-arch.c3
-rw-r--r--arch/arm/mach-clps711x/fortunet.c3
-rw-r--r--arch/arm/mach-clps711x/p720t.c3
-rw-r--r--arch/arm/mach-cns3xxx/Makefile.boot2
-rw-r--r--arch/arm/mach-davinci/Makefile3
-rw-r--r--arch/arm/mach-davinci/Makefile.boot4
-rw-r--r--arch/arm/mach-davinci/da830.c3
-rw-r--r--arch/arm/mach-davinci/da850.c3
-rw-r--r--arch/arm/mach-davinci/dm355.c2
-rw-r--r--arch/arm/mach-davinci/dm365.c3
-rw-r--r--arch/arm/mach-davinci/dm644x.c2
-rw-r--r--arch/arm/mach-davinci/dm646x.c2
-rw-r--r--arch/arm/mach-davinci/gpio-tnetv107x.c205
-rw-r--r--arch/arm/mach-davinci/gpio.c460
-rw-r--r--arch/arm/mach-davinci/include/mach/gpio-davinci.h91
-rw-r--r--arch/arm/mach-davinci/include/mach/gpio.h79
-rw-r--r--arch/arm/mach-davinci/tnetv107x.c3
-rw-r--r--arch/arm/mach-dove/Makefile.boot2
-rw-r--r--arch/arm/mach-dove/common.c2
-rw-r--r--arch/arm/mach-ebsa110/Makefile.boot2
-rw-r--r--arch/arm/mach-ebsa110/include/mach/io.h2
-rw-r--r--arch/arm/mach-ep93xx/Makefile.boot10
-rw-r--r--arch/arm/mach-ep93xx/core.c1
-rw-r--r--arch/arm/mach-ep93xx/edb93xx.c1
-rw-r--r--arch/arm/mach-ep93xx/include/mach/gpio-ep93xx.h100
-rw-r--r--arch/arm/mach-ep93xx/include/mach/gpio.h121
-rw-r--r--arch/arm/mach-ep93xx/simone.c2
-rw-r--r--arch/arm/mach-ep93xx/snappercl15.c2
-rw-r--r--arch/arm/mach-exynos4/Kconfig1
-rw-r--r--arch/arm/mach-exynos4/Makefile.boot2
-rw-r--r--arch/arm/mach-exynos4/clock.c8
-rw-r--r--arch/arm/mach-exynos4/include/mach/gpio.h7
-rw-r--r--arch/arm/mach-exynos4/mct.c10
-rw-r--r--arch/arm/mach-exynos4/platsmp.c2
-rw-r--r--arch/arm/mach-exynos4/setup-keypad.c11
-rw-r--r--arch/arm/mach-footbridge/Kconfig4
-rw-r--r--arch/arm/mach-footbridge/Makefile.boot2
-rw-r--r--arch/arm/mach-footbridge/cats-hw.c3
-rw-r--r--arch/arm/mach-footbridge/include/mach/hardware.h2
-rw-r--r--arch/arm/mach-footbridge/include/mach/io.h2
-rw-r--r--arch/arm/mach-footbridge/netwinder-hw.c17
-rw-r--r--arch/arm/mach-footbridge/netwinder-leds.c10
-rw-r--r--arch/arm/mach-gemini/Makefile.boot4
-rw-r--r--arch/arm/mach-gemini/include/mach/gpio.h5
-rw-r--r--arch/arm/mach-h720x/Makefile.boot2
-rw-r--r--arch/arm/mach-imx/Makefile.boot10
-rw-r--r--arch/arm/mach-imx/iomux-imx31.c3
-rw-r--r--arch/arm/mach-imx/mach-mx27ads.c3
-rw-r--r--arch/arm/mach-integrator/Makefile.boot2
-rw-r--r--arch/arm/mach-integrator/core.c10
-rw-r--r--arch/arm/mach-integrator/include/mach/io.h2
-rw-r--r--arch/arm/mach-integrator/include/mach/platform.h12
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c88
-rw-r--r--arch/arm/mach-integrator/pci_v3.c16
-rw-r--r--arch/arm/mach-iop13xx/Makefile.boot2
-rw-r--r--arch/arm/mach-iop32x/Makefile.boot2
-rw-r--r--arch/arm/mach-iop33x/Makefile.boot2
-rw-r--r--arch/arm/mach-ixp2000/Makefile.boot2
-rw-r--r--arch/arm/mach-ixp2000/core.c4
-rw-r--r--arch/arm/mach-ixp2000/include/mach/gpio-ixp2000.h (renamed from arch/arm/mach-ixp2000/include/mach/gpio.h)4
-rw-r--r--arch/arm/mach-ixp2000/ixdp2x00.c4
-rw-r--r--arch/arm/mach-ixp23xx/Makefile.boot2
-rw-r--r--arch/arm/mach-ixp4xx/Makefile.boot2
-rw-r--r--arch/arm/mach-ixp4xx/common-pci.c25
-rw-r--r--arch/arm/mach-ixp4xx/dsmg600-setup.c3
-rw-r--r--arch/arm/mach-ixp4xx/fsg-setup.c3
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/gpio.h3
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/io.h2
-rw-r--r--arch/arm/mach-ixp4xx/nas100d-setup.c3
-rw-r--r--arch/arm/mach-ixp4xx/nslu2-setup.c3
-rw-r--r--arch/arm/mach-kirkwood/Makefile.boot2
-rw-r--r--arch/arm/mach-kirkwood/irq.c3
-rw-r--r--arch/arm/mach-kirkwood/mpp.c3
-rw-r--r--arch/arm/mach-ks8695/Makefile2
-rw-r--r--arch/arm/mach-ks8695/Makefile.boot2
-rw-r--r--arch/arm/mach-ks8695/board-acs5k.c4
-rw-r--r--arch/arm/mach-ks8695/board-dsm320.c4
-rw-r--r--arch/arm/mach-ks8695/board-micrel.c4
-rw-r--r--arch/arm/mach-ks8695/devices.c1
-rw-r--r--arch/arm/mach-ks8695/gpio.c319
-rw-r--r--arch/arm/mach-ks8695/include/mach/gpio-ks8695.h39
-rw-r--r--arch/arm/mach-ks8695/include/mach/gpio.h38
-rw-r--r--arch/arm/mach-ks8695/leds.c4
-rw-r--r--arch/arm/mach-lpc32xx/Makefile2
-rw-r--r--arch/arm/mach-lpc32xx/Makefile.boot2
-rw-r--r--arch/arm/mach-lpc32xx/gpiolib.c446
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/gpio-lpc32xx.h50
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/gpio.h74
-rw-r--r--arch/arm/mach-lpc32xx/phy3250.c1
-rw-r--r--arch/arm/mach-mmp/Makefile.boot2
-rw-r--r--arch/arm/mach-mmp/aspenite.c6
-rw-r--r--arch/arm/mach-mmp/brownstone.c1
-rw-r--r--arch/arm/mach-mmp/gplugd.c2
-rw-r--r--arch/arm/mach-mmp/include/mach/gpio-pxa.h30
-rw-r--r--arch/arm/mach-mmp/include/mach/gpio.h23
-rw-r--r--arch/arm/mach-mmp/include/mach/pxa168.h7
-rw-r--r--arch/arm/mach-mmp/jasper.c1
-rw-r--r--arch/arm/mach-mmp/mmp2.c3
-rw-r--r--arch/arm/mach-mmp/pxa168.c49
-rw-r--r--arch/arm/mach-mmp/pxa910.c3
-rw-r--r--arch/arm/mach-mmp/tavorevb.c4
-rw-r--r--arch/arm/mach-mmp/ttc_dkb.c2
-rw-r--r--arch/arm/mach-msm/Makefile.boot2
-rw-r--r--arch/arm/mach-msm/board-halibut.c4
-rw-r--r--arch/arm/mach-msm/board-mahimahi.c4
-rw-r--r--arch/arm/mach-msm/board-msm7x27.c3
-rw-r--r--arch/arm/mach-msm/board-msm7x30.c3
-rw-r--r--arch/arm/mach-msm/board-qsd8x50.c3
-rw-r--r--arch/arm/mach-msm/board-sapphire.c7
-rw-r--r--arch/arm/mach-msm/board-trout-mmc.c3
-rw-r--r--arch/arm/mach-msm/board-trout-panel.c3
-rw-r--r--arch/arm/mach-msm/board-trout.c4
-rw-r--r--arch/arm/mach-msm/clock.c2
-rw-r--r--arch/arm/mach-msm/include/mach/gpio.h27
-rw-r--r--arch/arm/mach-mv78xx0/Makefile.boot2
-rw-r--r--arch/arm/mach-mv78xx0/irq.c3
-rw-r--r--arch/arm/mach-mv78xx0/mpp.c3
-rw-r--r--arch/arm/mach-mx5/Makefile.boot6
-rw-r--r--arch/arm/mach-mxs/Makefile.boot2
-rw-r--r--arch/arm/mach-mxs/include/mach/gpio.h8
-rw-r--r--arch/arm/mach-netx/Makefile.boot2
-rw-r--r--arch/arm/mach-nomadik/Makefile.boot2
-rw-r--r--arch/arm/mach-nomadik/board-nhk8815.c1
-rw-r--r--arch/arm/mach-nomadik/cpu-8815.c2
-rw-r--r--arch/arm/mach-nomadik/i2c-8815nhk.c2
-rw-r--r--arch/arm/mach-nomadik/include/mach/gpio.h2
-rw-r--r--arch/arm/mach-nuc93x/Makefile.boot2
-rw-r--r--arch/arm/mach-nuc93x/time.c2
-rw-r--r--arch/arm/mach-omap1/Makefile.boot2
-rw-r--r--arch/arm/mach-omap1/board-ams-delta.c3
-rw-r--r--arch/arm/mach-omap1/board-fsample.c3
-rw-r--r--arch/arm/mach-omap1/board-generic.c3
-rw-r--r--arch/arm/mach-omap1/board-h2-mmc.c3
-rw-r--r--arch/arm/mach-omap1/board-h2.c3
-rw-r--r--arch/arm/mach-omap1/board-h3-mmc.c3
-rw-r--r--arch/arm/mach-omap1/board-h3.c3
-rw-r--r--arch/arm/mach-omap1/board-htcherald.c1
-rw-r--r--arch/arm/mach-omap1/board-innovator.c3
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c3
-rw-r--r--arch/arm/mach-omap1/board-osk.c3
-rw-r--r--arch/arm/mach-omap1/board-palmte.c3
-rw-r--r--arch/arm/mach-omap1/board-palmtt.c2
-rw-r--r--arch/arm/mach-omap1/board-palmz71.c2
-rw-r--r--arch/arm/mach-omap1/board-perseus2.c3
-rw-r--r--arch/arm/mach-omap1/board-sx1-mmc.c2
-rw-r--r--arch/arm/mach-omap1/board-sx1.c3
-rw-r--r--arch/arm/mach-omap1/board-voiceblue.c2
-rw-r--r--arch/arm/mach-omap1/devices.c2
-rw-r--r--arch/arm/mach-omap1/fpga.c2
-rw-r--r--arch/arm/mach-omap1/irq.c3
-rw-r--r--arch/arm/mach-omap1/leds-h2p2-debug.c2
-rw-r--r--arch/arm/mach-omap1/leds-osk.c3
-rw-r--r--arch/arm/mach-omap1/leds.c2
-rw-r--r--arch/arm/mach-omap1/pm_bus.c1
-rw-r--r--arch/arm/mach-omap1/serial.c3
-rw-r--r--arch/arm/mach-omap2/Kconfig2
-rw-r--r--arch/arm/mach-omap2/Makefile11
-rw-r--r--arch/arm/mach-omap2/Makefile.boot2
-rw-r--r--arch/arm/mach-omap2/board-2430sdp.c3
-rw-r--r--arch/arm/mach-omap2/board-generic.c3
-rw-r--r--arch/arm/mach-omap2/board-h4.c3
-rw-r--r--arch/arm/mach-omap2/board-ldp.c3
-rw-r--r--arch/arm/mach-omap2/devices.c3
-rw-r--r--arch/arm/mach-omap2/hsmmc.c12
-rw-r--r--arch/arm/mach-omap2/smartreflex.c2
-rw-r--r--arch/arm/mach-omap2/usb-musb.c3
-rw-r--r--arch/arm/mach-orion5x/Makefile.boot2
-rw-r--r--arch/arm/mach-orion5x/common.c4
-rw-r--r--arch/arm/mach-orion5x/common.h4
-rw-r--r--arch/arm/mach-orion5x/db88f5281-setup.c3
-rw-r--r--arch/arm/mach-orion5x/dns323-setup.c3
-rw-r--r--arch/arm/mach-orion5x/irq.c3
-rw-r--r--arch/arm/mach-orion5x/kurobox_pro-setup.c3
-rw-r--r--arch/arm/mach-orion5x/mv2120-setup.c3
-rw-r--r--arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c3
-rw-r--r--arch/arm/mach-orion5x/rd88f5181l-ge-setup.c3
-rw-r--r--arch/arm/mach-orion5x/rd88f5182-setup.c3
-rw-r--r--arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c3
-rw-r--r--arch/arm/mach-orion5x/terastation_pro2-setup.c3
-rw-r--r--arch/arm/mach-orion5x/ts209-setup.c3
-rw-r--r--arch/arm/mach-orion5x/ts409-setup.c3
-rw-r--r--arch/arm/mach-orion5x/wnr854t-setup.c3
-rw-r--r--arch/arm/mach-orion5x/wrt350n-v2-setup.c3
-rw-r--r--arch/arm/mach-pnx4008/Makefile.boot2
-rw-r--r--arch/arm/mach-pnx4008/gpio.c3
-rw-r--r--arch/arm/mach-pnx4008/include/mach/gpio-pnx4008.h (renamed from arch/arm/mach-pnx4008/include/mach/gpio.h)2
-rw-r--r--arch/arm/mach-pnx4008/serial.c3
-rw-r--r--arch/arm/mach-prima2/Makefile.boot2
-rw-r--r--arch/arm/mach-pxa/Makefile.boot2
-rw-r--r--arch/arm/mach-pxa/cm-x255.c1
-rw-r--r--arch/arm/mach-pxa/cm-x300.c4
-rw-r--r--arch/arm/mach-pxa/corgi.c4
-rw-r--r--arch/arm/mach-pxa/eseries.c3
-rw-r--r--arch/arm/mach-pxa/eseries.h3
-rw-r--r--arch/arm/mach-pxa/generic.c2
-rw-r--r--arch/arm/mach-pxa/include/mach/gpio-pxa.h133
-rw-r--r--arch/arm/mach-pxa/include/mach/gpio.h110
-rw-r--r--arch/arm/mach-pxa/include/mach/littleton.h2
-rw-r--r--arch/arm/mach-pxa/irq.c3
-rw-r--r--arch/arm/mach-pxa/lpd270.c3
-rw-r--r--arch/arm/mach-pxa/lubbock.c2
-rw-r--r--arch/arm/mach-pxa/mainstone.c3
-rw-r--r--arch/arm/mach-pxa/mfp-pxa2xx.c4
-rw-r--r--arch/arm/mach-pxa/pcm990-baseboard.c3
-rw-r--r--arch/arm/mach-pxa/poodle.c4
-rw-r--r--arch/arm/mach-pxa/pxa25x.c3
-rw-r--r--arch/arm/mach-pxa/pxa27x.c3
-rw-r--r--arch/arm/mach-pxa/pxa3xx.c3
-rw-r--r--arch/arm/mach-pxa/pxa95x.c3
-rw-r--r--arch/arm/mach-pxa/saar.c2
-rw-r--r--arch/arm/mach-pxa/saarb.c4
-rw-r--r--arch/arm/mach-pxa/spitz.c4
-rw-r--r--arch/arm/mach-pxa/tosa.c4
-rw-r--r--arch/arm/mach-pxa/xcep.c3
-rw-r--r--arch/arm/mach-realview/Makefile.boot4
-rw-r--r--arch/arm/mach-realview/core.c3
-rw-r--r--arch/arm/mach-realview/core.h4
-rw-r--r--arch/arm/mach-realview/include/mach/board-pb1176.h1
-rw-r--r--arch/arm/mach-realview/include/mach/gpio.h7
-rw-r--r--arch/arm/mach-realview/realview_pb1176.c48
-rw-r--r--arch/arm/mach-realview/realview_pbx.c6
-rw-r--r--arch/arm/mach-rpc/Makefile.boot2
-rw-r--r--arch/arm/mach-rpc/include/mach/hardware.h25
-rw-r--r--arch/arm/mach-rpc/include/mach/io.h193
-rw-r--r--arch/arm/mach-rpc/riscpc.c2
-rw-r--r--arch/arm/mach-s3c2410/Makefile.boot4
-rw-r--r--arch/arm/mach-s3c2410/include/mach/gpio.h6
-rw-r--r--arch/arm/mach-s3c2410/include/mach/h1940-latch.h2
-rw-r--r--arch/arm/mach-s3c2410/include/mach/io.h2
-rw-r--r--arch/arm/mach-s3c2410/s3c2410.c2
-rw-r--r--arch/arm/mach-s3c2412/mach-smdk2413.c3
-rw-r--r--arch/arm/mach-s3c2412/mach-vstms.c5
-rw-r--r--arch/arm/mach-s3c2412/s3c2412.c2
-rw-r--r--arch/arm/mach-s3c2416/s3c2416.c2
-rw-r--r--arch/arm/mach-s3c2440/s3c2440.c2
-rw-r--r--arch/arm/mach-s3c2440/s3c2442.c2
-rw-r--r--arch/arm/mach-s3c2443/clock.c2
-rw-r--r--arch/arm/mach-s3c64xx/Makefile.boot2
-rw-r--r--arch/arm/mach-s3c64xx/dev-uart.c60
-rw-r--r--arch/arm/mach-s3c64xx/include/mach/gpio.h7
-rw-r--r--arch/arm/mach-s3c64xx/include/mach/irqs.h30
-rw-r--r--arch/arm/mach-s3c64xx/irq.c25
-rw-r--r--arch/arm/mach-s3c64xx/mach-smdk6410.c39
-rw-r--r--arch/arm/mach-s5p64x0/Makefile.boot2
-rw-r--r--arch/arm/mach-s5p64x0/include/mach/gpio.h7
-rw-r--r--arch/arm/mach-s5pc100/Makefile.boot2
-rw-r--r--arch/arm/mach-s5pc100/include/mach/gpio.h7
-rw-r--r--arch/arm/mach-s5pv210/Makefile.boot2
-rw-r--r--arch/arm/mach-s5pv210/clock.c6
-rw-r--r--arch/arm/mach-s5pv210/include/mach/gpio.h7
-rw-r--r--arch/arm/mach-sa1100/Makefile3
-rw-r--r--arch/arm/mach-sa1100/Makefile.boot5
-rw-r--r--arch/arm/mach-sa1100/assabet.c3
-rw-r--r--arch/arm/mach-sa1100/generic.c2
-rw-r--r--arch/arm/mach-sa1100/gpio.c65
-rw-r--r--arch/arm/mach-sa1100/include/mach/gpio.h4
-rw-r--r--arch/arm/mach-sa1100/include/mach/io.h6
-rw-r--r--arch/arm/mach-sa1100/include/mach/simpad.h94
-rw-r--r--arch/arm/mach-sa1100/leds-simpad.c100
-rw-r--r--arch/arm/mach-sa1100/leds.c2
-rw-r--r--arch/arm/mach-sa1100/leds.h1
-rw-r--r--arch/arm/mach-sa1100/simpad.c213
-rw-r--r--arch/arm/mach-shark/Makefile.boot2
-rw-r--r--arch/arm/mach-shark/leds.c6
-rw-r--r--arch/arm/mach-shmobile/Makefile.boot2
-rw-r--r--arch/arm/mach-shmobile/board-ap4evb.c6
-rw-r--r--arch/arm/mach-shmobile/board-mackerel.c12
-rw-r--r--arch/arm/mach-shmobile/include/mach/common.h4
-rw-r--r--arch/arm/mach-shmobile/include/mach/gpio.h24
-rw-r--r--arch/arm/mach-shmobile/include/mach/sh7372.h13
-rw-r--r--arch/arm/mach-shmobile/intc-sh7372.c52
-rw-r--r--arch/arm/mach-shmobile/pm-sh7372.c342
-rw-r--r--arch/arm/mach-shmobile/pm_runtime.c1
-rw-r--r--arch/arm/mach-shmobile/setup-sh7372.c25
-rw-r--r--arch/arm/mach-shmobile/sleep-sh7372.S221
-rw-r--r--arch/arm/mach-spear3xx/Makefile.boot2
-rw-r--r--arch/arm/mach-spear6xx/Makefile.boot2
-rw-r--r--arch/arm/mach-tcc8k/Makefile.boot2
-rw-r--r--arch/arm/mach-tegra/Makefile.boot2
-rw-r--r--arch/arm/mach-tegra/board-harmony-pcie.c10
-rw-r--r--arch/arm/mach-tegra/board-harmony.c4
-rw-r--r--arch/arm/mach-tegra/board-harmony.h3
-rw-r--r--arch/arm/mach-tegra/board-paz00.c4
-rw-r--r--arch/arm/mach-tegra/board-paz00.h2
-rw-r--r--arch/arm/mach-tegra/board-seaboard.h2
-rw-r--r--arch/arm/mach-tegra/board-trimslice-pinmux.c3
-rw-r--r--arch/arm/mach-tegra/board-trimslice.c4
-rw-r--r--arch/arm/mach-tegra/board-trimslice.h2
-rw-r--r--arch/arm/mach-tegra/cpu-tegra.c1
-rw-r--r--arch/arm/mach-tegra/include/mach/gpio-tegra.h39
-rw-r--r--arch/arm/mach-tegra/include/mach/gpio.h60
-rw-r--r--arch/arm/mach-tegra/usb_phy.c1
-rw-r--r--arch/arm/mach-u300/Kconfig3
-rw-r--r--arch/arm/mach-u300/Makefile2
-rw-r--r--arch/arm/mach-u300/Makefile.boot4
-rw-r--r--arch/arm/mach-u300/core.c115
-rw-r--r--arch/arm/mach-u300/include/mach/gpio-u300.h150
-rw-r--r--arch/arm/mach-u300/include/mach/gpio.h294
-rw-r--r--arch/arm/mach-u300/include/mach/irqs.h25
-rw-r--r--arch/arm/mach-u300/include/mach/syscon.h136
-rw-r--r--arch/arm/mach-u300/mmc.c18
-rw-r--r--arch/arm/mach-u300/padmux.c367
-rw-r--r--arch/arm/mach-u300/padmux.h39
-rw-r--r--arch/arm/mach-u300/spi.c20
-rw-r--r--arch/arm/mach-ux500/Kconfig1
-rw-r--r--arch/arm/mach-ux500/Makefile.boot2
-rw-r--r--arch/arm/mach-ux500/board-mop500-pins.c2
-rw-r--r--arch/arm/mach-ux500/board-mop500-u8500uib.c3
-rw-r--r--arch/arm/mach-ux500/board-mop500.c1
-rw-r--r--arch/arm/mach-ux500/board-u5500-sdi.c2
-rw-r--r--arch/arm/mach-ux500/board-u5500.c2
-rw-r--r--arch/arm/mach-ux500/cpu-db5500.c2
-rw-r--r--arch/arm/mach-ux500/cpu-db8500.c2
-rw-r--r--arch/arm/mach-ux500/devices-common.c2
-rw-r--r--arch/arm/mach-ux500/include/mach/gpio.h2
-rw-r--r--arch/arm/mach-versatile/Makefile.boot2
-rw-r--r--arch/arm/mach-versatile/include/mach/gpio.h7
-rw-r--r--arch/arm/mach-vexpress/Makefile.boot2
-rw-r--r--arch/arm/mach-vexpress/hotplug.c9
-rw-r--r--arch/arm/mach-vexpress/include/mach/io.h2
-rw-r--r--arch/arm/mach-vt8500/Makefile.boot2
-rw-r--r--arch/arm/mach-vt8500/include/mach/gpio.h7
-rw-r--r--arch/arm/mach-vt8500/include/mach/io.h2
-rw-r--r--arch/arm/mach-w90x900/Makefile.boot2
-rw-r--r--arch/arm/mach-w90x900/cpu.c2
-rw-r--r--arch/arm/mach-w90x900/include/mach/gpio.h6
-rw-r--r--arch/arm/mach-zynq/Makefile.boot2
-rw-r--r--arch/arm/mm/alignment.c20
-rw-r--r--arch/arm/mm/cache-l2x0.c262
-rw-r--r--arch/arm/mm/cache-v7.S20
-rw-r--r--arch/arm/mm/context.c14
-rw-r--r--arch/arm/mm/copypage-v4mc.c6
-rw-r--r--arch/arm/mm/copypage-v6.c10
-rw-r--r--arch/arm/mm/copypage-xscale.c6
-rw-r--r--arch/arm/mm/dma-mapping.c7
-rw-r--r--arch/arm/mm/init.c7
-rw-r--r--arch/arm/mm/ioremap.c21
-rw-r--r--arch/arm/mm/mm.h4
-rw-r--r--arch/arm/mm/mmu.c18
-rw-r--r--arch/arm/mm/proc-v7.S2
-rw-r--r--arch/arm/plat-mxc/Kconfig2
-rw-r--r--arch/arm/plat-mxc/devices.c53
-rw-r--r--arch/arm/plat-mxc/include/mach/devices-common.h16
-rw-r--r--arch/arm/plat-mxc/include/mach/gpio.h6
-rw-r--r--arch/arm/plat-nomadik/include/plat/gpio-nomadik.h (renamed from arch/arm/plat-nomadik/include/plat/gpio.h)17
-rw-r--r--arch/arm/plat-omap/Kconfig1
-rw-r--r--arch/arm/plat-omap/debug-devices.c3
-rw-r--r--arch/arm/plat-omap/debug-leds.c3
-rw-r--r--arch/arm/plat-omap/devices.c3
-rw-r--r--arch/arm/plat-omap/include/plat/gpio.h20
-rw-r--r--arch/arm/plat-orion/include/plat/gpio.h10
-rw-r--r--arch/arm/plat-pxa/Makefile1
-rw-r--r--arch/arm/plat-pxa/gpio.c338
-rw-r--r--arch/arm/plat-pxa/include/plat/gpio-pxa.h44
-rw-r--r--arch/arm/plat-pxa/include/plat/gpio.h40
-rw-r--r--arch/arm/plat-s5p/Kconfig1
-rw-r--r--arch/arm/plat-s5p/dev-uart.c84
-rw-r--r--arch/arm/plat-s5p/include/plat/irqs.h35
-rw-r--r--arch/arm/plat-s5p/irq-gpioint.c15
-rw-r--r--arch/arm/plat-s5p/irq.c34
-rw-r--r--arch/arm/plat-samsung/Kconfig5
-rw-r--r--arch/arm/plat-samsung/Makefile1
-rw-r--r--arch/arm/plat-samsung/clock.c11
-rw-r--r--arch/arm/plat-samsung/include/plat/clock.h8
-rw-r--r--arch/arm/plat-samsung/include/plat/regs-serial.h5
-rw-r--r--arch/arm/plat-samsung/include/plat/watchdog-reset.h10
-rw-r--r--arch/arm/plat-samsung/irq-uart.c96
-rw-r--r--arch/arm/plat-spear/include/plat/gpio.h25
-rw-r--r--arch/arm/tools/mach-types20
-rw-r--r--arch/arm/vfp/Makefile2
-rw-r--r--arch/blackfin/Kconfig4
-rw-r--r--arch/blackfin/configs/BF548-EZKIT_defconfig13
-rw-r--r--arch/blackfin/include/asm/Kbuild1
-rw-r--r--arch/blackfin/include/asm/atomic.h104
-rw-r--r--arch/blackfin/include/asm/mutex.h1
-rw-r--r--arch/blackfin/include/asm/uaccess.h6
-rw-r--r--arch/blackfin/kernel/Makefile2
-rw-r--r--arch/blackfin/kernel/kgdb_test.c3
-rw-r--r--arch/blackfin/kernel/time-ts.c6
-rw-r--r--arch/blackfin/kernel/time.c1
-rw-r--r--arch/blackfin/mach-bf533/boards/H8606.c3
-rw-r--r--arch/blackfin/mach-bf537/boards/cm_bf537e.c2
-rw-r--r--arch/blackfin/mach-bf537/boards/cm_bf537u.c2
-rw-r--r--arch/blackfin/mach-bf537/boards/stamp.c88
-rw-r--r--arch/blackfin/mach-bf537/boards/tcm_bf537.c2
-rw-r--r--arch/blackfin/mach-bf561/boards/cm_bf561.c2
-rw-r--r--arch/blackfin/mach-bf561/smp.c2
-rw-r--r--arch/blackfin/mach-common/smp.c7
-rw-r--r--arch/cris/Kconfig4
-rw-r--r--arch/cris/arch-v10/Kconfig12
-rw-r--r--arch/cris/arch-v10/drivers/Kconfig1
-rw-r--r--arch/cris/arch-v32/drivers/Kconfig1
-rw-r--r--arch/cris/arch-v32/lib/nand_init.S178
-rw-r--r--arch/h8300/Kconfig4
-rw-r--r--arch/ia64/configs/generic_defconfig2
-rw-r--r--arch/ia64/dig/Makefile2
-rw-r--r--arch/ia64/hp/common/sba_iommu.c12
-rw-r--r--arch/ia64/hp/sim/simeth.c2
-rw-r--r--arch/ia64/include/asm/device.h2
-rw-r--r--arch/ia64/include/asm/iommu.h6
-rw-r--r--arch/ia64/include/asm/pci.h2
-rw-r--r--arch/ia64/kernel/Makefile2
-rw-r--r--arch/ia64/kernel/acpi.c4
-rw-r--r--arch/ia64/kernel/msi_ia64.c4
-rw-r--r--arch/ia64/kernel/pci-dma.c2
-rw-r--r--arch/m32r/Kconfig1
-rw-r--r--arch/m68k/Kconfig195
-rw-r--r--arch/m68k/Kconfig.bus55
-rw-r--r--arch/m68k/Kconfig.cpu429
-rw-r--r--arch/m68k/Kconfig.devices123
-rw-r--r--arch/m68k/Kconfig.machine (renamed from arch/m68k/Kconfig.nommu)562
-rw-r--r--arch/m68k/Kconfig.mmu411
-rw-r--r--arch/m68k/Makefile168
-rw-r--r--arch/m68k/Makefile_mm121
-rw-r--r--arch/m68k/Makefile_no124
-rw-r--r--arch/m68k/include/asm/entry.h255
-rw-r--r--arch/m68k/include/asm/entry_mm.h128
-rw-r--r--arch/m68k/include/asm/entry_no.h181
-rw-r--r--arch/m68k/include/asm/m520xsim.h26
-rw-r--r--arch/m68k/include/asm/mcfqspi.h8
-rw-r--r--arch/m68k/include/asm/page_no.h3
-rw-r--r--arch/m68k/include/asm/processor.h6
-rw-r--r--arch/m68k/include/asm/sections.h2
-rw-r--r--arch/m68k/kernel/Makefile24
-rw-r--r--arch/m68k/kernel/Makefile_mm17
-rw-r--r--arch/m68k/kernel/Makefile_no10
-rw-r--r--arch/m68k/kernel/entry_no.S6
-rw-r--r--arch/m68k/kernel/setup_no.c4
-rw-r--r--arch/m68k/kernel/traps.c1108
-rw-r--r--arch/m68k/kernel/traps_mm.c1207
-rw-r--r--arch/m68k/kernel/traps_no.c361
-rw-r--r--arch/m68k/kernel/vectors.c145
-rw-r--r--arch/m68k/kernel/vmlinux.lds_no.S1
-rw-r--r--arch/m68k/lib/memcpy.c9
-rw-r--r--arch/m68k/mac/macints.c2
-rw-r--r--arch/m68k/mac/misc.c40
-rw-r--r--arch/m68k/mm/init_no.c21
-rw-r--r--arch/m68k/platform/520x/config.c6
-rw-r--r--arch/m68k/platform/520x/gpio.c50
-rw-r--r--arch/m68k/platform/68328/Makefile5
-rw-r--r--arch/m68k/platform/68328/entry.S18
-rw-r--r--arch/m68k/platform/68360/Makefile6
-rw-r--r--arch/m68k/platform/68360/entry.S4
-rw-r--r--arch/m68k/platform/coldfire/entry.S6
-rw-r--r--arch/m68k/q40/README2
-rw-r--r--arch/microblaze/include/asm/dma-mapping.h2
-rw-r--r--arch/microblaze/mm/init.c6
-rw-r--r--arch/mips/Kconfig14
-rw-r--r--arch/mips/alchemy/common/platform.c2
-rw-r--r--arch/mips/alchemy/common/power.c22
-rw-r--r--arch/mips/alchemy/devboards/bcsr.c4
-rw-r--r--arch/mips/alchemy/devboards/db1200/setup.c7
-rw-r--r--arch/mips/ar7/irq.c3
-rw-r--r--arch/mips/bcm47xx/Kconfig31
-rw-r--r--arch/mips/bcm47xx/Makefile3
-rw-r--r--arch/mips/bcm47xx/gpio.c82
-rw-r--r--arch/mips/bcm47xx/irq.c12
-rw-r--r--arch/mips/bcm47xx/nvram.c29
-rw-r--r--arch/mips/bcm47xx/serial.c46
-rw-r--r--arch/mips/bcm47xx/setup.c90
-rw-r--r--arch/mips/bcm47xx/time.c16
-rw-r--r--arch/mips/bcm47xx/wgt634u.c14
-rw-r--r--arch/mips/bcm63xx/irq.c1
-rw-r--r--arch/mips/cobalt/irq.c1
-rw-r--r--arch/mips/dec/setup.c4
-rw-r--r--arch/mips/emma/markeins/irq.c2
-rw-r--r--arch/mips/include/asm/compat.h3
-rw-r--r--arch/mips/include/asm/lasat/lasat.h6
-rw-r--r--arch/mips/include/asm/mach-bcm47xx/bcm47xx.h26
-rw-r--r--arch/mips/include/asm/mach-bcm47xx/gpio.h108
-rw-r--r--arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h1
-rw-r--r--arch/mips/include/asm/mach-powertv/dma-coherence.h1
-rw-r--r--arch/mips/include/asm/stackframe.h4
-rw-r--r--arch/mips/jz4740/gpio.c52
-rw-r--r--arch/mips/kernel/ftrace.c39
-rw-r--r--arch/mips/kernel/i8259.c3
-rw-r--r--arch/mips/kernel/linux32.c7
-rw-r--r--arch/mips/kernel/scall64-n32.S2
-rw-r--r--arch/mips/kernel/scall64-o32.S2
-rw-r--r--arch/mips/kernel/signal.c3
-rw-r--r--arch/mips/kernel/traps.c16
-rw-r--r--arch/mips/kernel/vpe.c2
-rw-r--r--arch/mips/lantiq/irq.c6
-rw-r--r--arch/mips/lantiq/xway/ebu.c1
-rw-r--r--arch/mips/lantiq/xway/pmu.c1
-rw-r--r--arch/mips/lasat/interrupt.c1
-rw-r--r--arch/mips/loongson/fuloong-2e/irq.c1
-rw-r--r--arch/mips/loongson/lemote-2f/irq.c3
-rw-r--r--arch/mips/mm/mmap.c48
-rw-r--r--arch/mips/mm/tlbex.c6
-rw-r--r--arch/mips/mti-malta/malta-int.c6
-rw-r--r--arch/mips/netlogic/xlr/Makefile2
-rw-r--r--arch/mips/pci/pci-bcm47xx.c6
-rw-r--r--arch/mips/pci/pci-lantiq.c9
-rw-r--r--arch/mips/pci/pci-rc32434.c2
-rw-r--r--arch/mips/pmc-sierra/msp71xx/msp_irq.c6
-rw-r--r--arch/mips/pmc-sierra/msp71xx/msp_serial.c73
-rw-r--r--arch/mips/pnx8550/common/int.c2
-rw-r--r--arch/mips/sgi-ip22/ip22-int.c10
-rw-r--r--arch/mips/sni/rm200.c1
-rw-r--r--arch/mips/txx9/generic/setup_tx4939.c2
-rw-r--r--arch/mips/vr41xx/common/irq.c1
-rw-r--r--arch/mn10300/Kconfig5
-rw-r--r--arch/mn10300/kernel/irq.c1
-rw-r--r--arch/openrisc/Kconfig2
-rw-r--r--arch/openrisc/include/asm/dma-mapping.h2
-rw-r--r--arch/parisc/Kconfig4
-rw-r--r--arch/parisc/include/asm/compat.h3
-rw-r--r--arch/parisc/include/asm/dma-mapping.h2
-rw-r--r--arch/parisc/kernel/pci-dma.c2
-rw-r--r--arch/powerpc/Kconfig2
-rw-r--r--arch/powerpc/boot/dts/p1010rdb.dts10
-rw-r--r--arch/powerpc/boot/dts/p1010si.dtsi10
-rw-r--r--arch/powerpc/configs/40x/acadia_defconfig11
-rw-r--r--arch/powerpc/configs/40x/ep405_defconfig5
-rw-r--r--arch/powerpc/configs/40x/hcu4_defconfig5
-rw-r--r--arch/powerpc/configs/40x/kilauea_defconfig9
-rw-r--r--arch/powerpc/configs/40x/makalu_defconfig9
-rw-r--r--arch/powerpc/configs/40x/walnut_defconfig5
-rw-r--r--arch/powerpc/configs/44x/arches_defconfig9
-rw-r--r--arch/powerpc/configs/44x/bamboo_defconfig5
-rw-r--r--arch/powerpc/configs/44x/bluestone_defconfig9
-rw-r--r--arch/powerpc/configs/44x/canyonlands_defconfig9
-rw-r--r--arch/powerpc/configs/44x/ebony_defconfig5
-rw-r--r--arch/powerpc/configs/44x/eiger_defconfig9
-rw-r--r--arch/powerpc/configs/44x/icon_defconfig5
-rw-r--r--arch/powerpc/configs/44x/katmai_defconfig5
-rw-r--r--arch/powerpc/configs/44x/redwood_defconfig11
-rw-r--r--arch/powerpc/configs/44x/sam440ep_defconfig5
-rw-r--r--arch/powerpc/configs/44x/sequoia_defconfig5
-rw-r--r--arch/powerpc/configs/44x/taishan_defconfig5
-rw-r--r--arch/powerpc/configs/44x/warp_defconfig5
-rw-r--r--arch/powerpc/configs/ppc40x_defconfig5
-rw-r--r--arch/powerpc/configs/ppc44x_defconfig5
-rw-r--r--arch/powerpc/include/asm/compat.h3
-rw-r--r--arch/powerpc/include/asm/qe.h2
-rw-r--r--arch/powerpc/include/asm/udbg.h1
-rw-r--r--arch/powerpc/kernel/udbg.c2
-rw-r--r--arch/powerpc/platforms/40x/Kconfig12
-rw-r--r--arch/powerpc/platforms/44x/Kconfig54
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig2
-rw-r--r--arch/powerpc/platforms/cell/Kconfig8
-rw-r--r--arch/powerpc/platforms/embedded6xx/storcenter.c2
-rw-r--r--arch/powerpc/platforms/powermac/pci.c14
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe.c2
-rw-r--r--arch/powerpc/sysdev/uic.c24
-rw-r--r--arch/s390/Kconfig1
-rw-r--r--arch/s390/hypfs/hypfs_diag.c3
-rw-r--r--arch/s390/include/asm/compat.h3
-rw-r--r--arch/s390/include/asm/elf.h3
-rw-r--r--arch/s390/include/asm/pgtable.h2
-rw-r--r--arch/s390/include/asm/qdio.h78
-rw-r--r--arch/s390/kernel/asm-offsets.c3
-rw-r--r--arch/s390/kernel/entry64.S6
-rw-r--r--arch/s390/kernel/suspend.c118
-rw-r--r--arch/s390/kernel/swsusp_asm64.S3
-rw-r--r--arch/s390/kernel/time.c13
-rw-r--r--arch/s390/kvm/kvm-s390.c5
-rw-r--r--arch/s390/mm/pgtable.c17
-rw-r--r--arch/sh/include/asm/sh_eth.h25
-rw-r--r--arch/sparc/include/asm/compat.h3
-rw-r--r--arch/sparc/include/asm/pgtsrmmu.h2
-rw-r--r--arch/sparc/include/asm/spitfire.h2
-rw-r--r--arch/sparc/include/asm/xor_64.h4
-rw-r--r--arch/sparc/kernel/cpu.c12
-rw-r--r--arch/sparc/kernel/cpumap.c2
-rw-r--r--arch/sparc/kernel/head_64.S25
-rw-r--r--arch/sparc/kernel/pci.c3
-rw-r--r--arch/sparc/kernel/process_32.c3
-rw-r--r--arch/sparc/kernel/process_64.c3
-rw-r--r--arch/sparc/kernel/setup_32.c2
-rw-r--r--arch/sparc/kernel/setup_64.c18
-rw-r--r--arch/sparc/kernel/signal32.c21
-rw-r--r--arch/sparc/kernel/signal_32.c32
-rw-r--r--arch/sparc/kernel/signal_64.c32
-rw-r--r--arch/sparc/mm/init_64.c5
-rw-r--r--arch/sparc/mm/leon_mm.c2
-rw-r--r--arch/tile/Kconfig3
-rw-r--r--arch/tile/configs/tilegx_defconfig1
-rw-r--r--arch/tile/configs/tilepro_defconfig1
-rw-r--r--arch/tile/kernel/intvec_32.S2
-rw-r--r--arch/tile/lib/atomic_asm_32.S2
-rw-r--r--arch/um/Kconfig.x864
-rw-r--r--arch/um/Makefile2
-rw-r--r--arch/um/defconfig1
-rw-r--r--arch/um/drivers/line.c61
-rw-r--r--arch/um/drivers/net_kern.c2
-rw-r--r--arch/um/drivers/xterm.c1
-rw-r--r--arch/um/include/asm/ptrace-generic.h4
-rw-r--r--arch/um/include/shared/line.h1
-rw-r--r--arch/um/include/shared/registers.h2
-rw-r--r--arch/um/kernel/process.c2
-rw-r--r--arch/um/kernel/ptrace.c28
-rw-r--r--arch/um/os-Linux/registers.c9
-rw-r--r--arch/um/os-Linux/skas/mem.c2
-rw-r--r--arch/um/os-Linux/skas/process.c19
-rw-r--r--arch/um/sys-i386/asm/ptrace.h5
-rw-r--r--arch/um/sys-i386/ptrace.c28
-rw-r--r--arch/um/sys-i386/shared/sysdep/ptrace.h1
-rw-r--r--arch/um/sys-x86_64/ptrace.c12
-rw-r--r--arch/um/sys-x86_64/shared/sysdep/ptrace.h1
-rw-r--r--arch/unicore32/include/asm/io.h2
-rw-r--r--arch/x86/Kconfig33
-rw-r--r--arch/x86/Kconfig.debug2
-rw-r--r--arch/x86/boot/header.S2
-rw-r--r--arch/x86/configs/x86_64_defconfig4
-rw-r--r--arch/x86/include/asm/alternative-asm.h1
-rw-r--r--arch/x86/include/asm/alternative.h4
-rw-r--r--arch/x86/include/asm/amd_nb.h6
-rw-r--r--arch/x86/include/asm/apic.h2
-rw-r--r--arch/x86/include/asm/archrandom.h75
-rw-r--r--arch/x86/include/asm/atomic.h8
-rw-r--r--arch/x86/include/asm/atomic64_64.h6
-rw-r--r--arch/x86/include/asm/cmpxchg.h205
-rw-r--r--arch/x86/include/asm/cmpxchg_32.h114
-rw-r--r--arch/x86/include/asm/cmpxchg_64.h131
-rw-r--r--arch/x86/include/asm/compat.h3
-rw-r--r--arch/x86/include/asm/cpufeature.h3
-rw-r--r--arch/x86/include/asm/device.h2
-rw-r--r--arch/x86/include/asm/dma-mapping.h2
-rw-r--r--arch/x86/include/asm/dwarf2.h2
-rw-r--r--arch/x86/include/asm/elf.h31
-rw-r--r--arch/x86/include/asm/hw_irq.h2
-rw-r--r--arch/x86/include/asm/hyperv.h1
-rw-r--r--arch/x86/include/asm/irq_remapping.h6
-rw-r--r--arch/x86/include/asm/irq_vectors.h12
-rw-r--r--arch/x86/include/asm/nmi.h37
-rw-r--r--arch/x86/include/asm/perf_event.h55
-rw-r--r--arch/x86/include/asm/processor.h4
-rw-r--r--arch/x86/include/asm/reboot.h2
-rw-r--r--arch/x86/include/asm/rwsem.h8
-rw-r--r--arch/x86/include/asm/spinlock.h114
-rw-r--r--arch/x86/include/asm/spinlock_types.h22
-rw-r--r--arch/x86/include/asm/unistd_64.h1
-rw-r--r--arch/x86/include/asm/uv/uv_bau.h7
-rw-r--r--arch/x86/include/asm/uv/uv_hub.h37
-rw-r--r--arch/x86/include/asm/xen/page.h6
-rw-r--r--arch/x86/kernel/Makefile2
-rw-r--r--arch/x86/kernel/amd_gart_64.c2
-rw-r--r--arch/x86/kernel/apic/apic.c33
-rw-r--r--arch/x86/kernel/apic/bigsmp_32.c20
-rw-r--r--arch/x86/kernel/apic/hw_nmi.c27
-rw-r--r--arch/x86/kernel/apic/io_apic.c678
-rw-r--r--arch/x86/kernel/apic/probe_32.c10
-rw-r--r--arch/x86/kernel/apic/x2apic_uv_x.c27
-rw-r--r--arch/x86/kernel/apm_32.c2
-rw-r--r--arch/x86/kernel/cpu/Makefile8
-rw-r--r--arch/x86/kernel/cpu/amd.c49
-rw-r--r--arch/x86/kernel/cpu/common.c5
-rw-r--r--arch/x86/kernel/cpu/cpu.h1
-rw-r--r--arch/x86/kernel/cpu/intel.c24
-rw-r--r--arch/x86/kernel/cpu/intel_cacheinfo.c127
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce-inject.c20
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c32
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_intel.c10
-rw-r--r--arch/x86/kernel/cpu/mshyperv.c23
-rw-r--r--arch/x86/kernel/cpu/perf_event.c442
-rw-r--r--arch/x86/kernel/cpu/perf_event.h505
-rw-r--r--arch/x86/kernel/cpu/perf_event_amd.c38
-rw-r--r--arch/x86/kernel/cpu/perf_event_amd_ibs.c294
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel.c146
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_ds.c79
-rw-r--r--arch/x86/kernel/cpu/perf_event_intel_lbr.c28
-rw-r--r--arch/x86/kernel/cpu/perf_event_p4.c10
-rw-r--r--arch/x86/kernel/cpu/perf_event_p6.c9
-rw-r--r--arch/x86/kernel/cpu/proc.c2
-rw-r--r--arch/x86/kernel/cpu/rdrand.c73
-rw-r--r--arch/x86/kernel/crash.c5
-rw-r--r--arch/x86/kernel/entry_64.S14
-rw-r--r--arch/x86/kernel/jump_label.c2
-rw-r--r--arch/x86/kernel/kgdb.c60
-rw-r--r--arch/x86/kernel/kprobes.c5
-rw-r--r--arch/x86/kernel/microcode_amd.c5
-rw-r--r--arch/x86/kernel/microcode_core.c8
-rw-r--r--arch/x86/kernel/microcode_intel.c14
-rw-r--r--arch/x86/kernel/nmi.c433
-rw-r--r--arch/x86/kernel/pci-dma.c4
-rw-r--r--arch/x86/kernel/process.c2
-rw-r--r--arch/x86/kernel/process_32.c4
-rw-r--r--arch/x86/kernel/process_64.c2
-rw-r--r--arch/x86/kernel/reboot.c23
-rw-r--r--arch/x86/kernel/rtc.c23
-rw-r--r--arch/x86/kernel/sys_x86_64.c78
-rw-r--r--arch/x86/kernel/traps.c155
-rw-r--r--arch/x86/kernel/vsyscall_64.c2
-rw-r--r--arch/x86/kvm/emulate.c2
-rw-r--r--arch/x86/kvm/mmu.c3
-rw-r--r--arch/x86/lib/insn.c48
-rw-r--r--arch/x86/mm/fault.c10
-rw-r--r--arch/x86/mm/init.c3
-rw-r--r--arch/x86/mm/mmap.c20
-rw-r--r--arch/x86/mm/mmio-mod.c1
-rw-r--r--arch/x86/oprofile/nmi_int.c44
-rw-r--r--arch/x86/oprofile/nmi_timer_int.c28
-rw-r--r--arch/x86/oprofile/op_model_amd.c234
-rw-r--r--arch/x86/oprofile/op_model_ppro.c27
-rw-r--r--arch/x86/oprofile/op_x86_model.h1
-rw-r--r--arch/x86/pci/acpi.c11
-rw-r--r--arch/x86/pci/xen.c32
-rw-r--r--arch/x86/platform/Makefile1
-rw-r--r--arch/x86/platform/geode/Makefile1
-rw-r--r--arch/x86/platform/geode/alix.c142
-rw-r--r--arch/x86/platform/mrst/mrst.c25
-rw-r--r--arch/x86/platform/mrst/vrtc.c9
-rw-r--r--arch/x86/platform/uv/tlb_uv.c17
-rw-r--r--arch/x86/vdso/vma.c9
-rw-r--r--arch/x86/xen/Kconfig11
-rw-r--r--arch/x86/xen/enlighten.c1
-rw-r--r--arch/x86/xen/mmu.c58
-rw-r--r--arch/x86/xen/p2m.c128
-rw-r--r--arch/x86/xen/setup.c282
-rw-r--r--arch/x86/xen/smp.c1
-rw-r--r--arch/x86/xen/time.c5
-rw-r--r--arch/xtensa/configs/iss_defconfig1
-rw-r--r--arch/xtensa/configs/s6105_defconfig1
-rw-r--r--arch/xtensa/platforms/iss/network.c2
843 files changed, 10759 insertions, 12267 deletions
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 60cde53d266c..8bb936226dee 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -51,7 +51,7 @@ config GENERIC_CMOS_UPDATE
51 def_bool y 51 def_bool y
52 52
53config GENERIC_GPIO 53config GENERIC_GPIO
54 def_bool y 54 bool
55 55
56config ZONE_DMA 56config ZONE_DMA
57 bool 57 bool
diff --git a/arch/alpha/include/asm/fcntl.h b/arch/alpha/include/asm/fcntl.h
index 1b71ca70c9f6..6d9e805f18a7 100644
--- a/arch/alpha/include/asm/fcntl.h
+++ b/arch/alpha/include/asm/fcntl.h
@@ -51,8 +51,6 @@
51#define F_EXLCK 16 /* or 3 */ 51#define F_EXLCK 16 /* or 3 */
52#define F_SHLCK 32 /* or 4 */ 52#define F_SHLCK 32 /* or 4 */
53 53
54#define F_INPROGRESS 64
55
56#include <asm-generic/fcntl.h> 54#include <asm-generic/fcntl.h>
57 55
58#endif 56#endif
diff --git a/arch/alpha/kernel/srm_env.c b/arch/alpha/kernel/srm_env.c
index f0df3fbd8402..b9fc6c309d2e 100644
--- a/arch/alpha/kernel/srm_env.c
+++ b/arch/alpha/kernel/srm_env.c
@@ -4,9 +4,8 @@
4 * 4 *
5 * (C) 2001,2002,2006 by Jan-Benedict Glaw <jbglaw@lug-owl.de> 5 * (C) 2001,2002,2006 by Jan-Benedict Glaw <jbglaw@lug-owl.de>
6 * 6 *
7 * This driver is at all a modified version of Erik Mouw's 7 * This driver is a modified version of Erik Mouw's example proc
8 * Documentation/DocBook/procfs_example.c, so: thank 8 * interface, so: thank you, Erik! He can be reached via email at
9 * you, Erik! He can be reached via email at
10 * <J.A.K.Mouw@its.tudelft.nl>. It is based on an idea 9 * <J.A.K.Mouw@its.tudelft.nl>. It is based on an idea
11 * provided by DEC^WCompaq^WIntel's "Jumpstart" CD. They 10 * provided by DEC^WCompaq^WIntel's "Jumpstart" CD. They
12 * included a patch like this as well. Thanks for idea! 11 * included a patch like this as well. Thanks for idea!
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 2686959319a0..5ca86e7ab66d 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -3,7 +3,7 @@ config ARM
3 default y 3 default y
4 select HAVE_AOUT 4 select HAVE_AOUT
5 select HAVE_DMA_API_DEBUG 5 select HAVE_DMA_API_DEBUG
6 select HAVE_IDE 6 select HAVE_IDE if PCI || ISA || PCMCIA
7 select HAVE_MEMBLOCK 7 select HAVE_MEMBLOCK
8 select RTC_LIB 8 select RTC_LIB
9 select SYS_SUPPORTS_APM_EMULATION 9 select SYS_SUPPORTS_APM_EMULATION
@@ -226,6 +226,10 @@ config PHYS_OFFSET
226 Please provide the physical address corresponding to the 226 Please provide the physical address corresponding to the
227 location of main memory in your system. 227 location of main memory in your system.
228 228
229config GENERIC_BUG
230 def_bool y
231 depends on BUG
232
229source "init/Kconfig" 233source "init/Kconfig"
230 234
231source "kernel/Kconfig.freezer" 235source "kernel/Kconfig.freezer"
@@ -359,7 +363,6 @@ config ARCH_GEMINI
359config ARCH_PRIMA2 363config ARCH_PRIMA2
360 bool "CSR SiRFSoC PRIMA2 ARM Cortex A9 Platform" 364 bool "CSR SiRFSoC PRIMA2 ARM Cortex A9 Platform"
361 select CPU_V7 365 select CPU_V7
362 select GENERIC_TIME
363 select NO_IOPORT 366 select NO_IOPORT
364 select GENERIC_CLOCKEVENTS 367 select GENERIC_CLOCKEVENTS
365 select CLKDEV_LOOKUP 368 select CLKDEV_LOOKUP
@@ -400,6 +403,7 @@ config ARCH_FOOTBRIDGE
400 select CPU_SA110 403 select CPU_SA110
401 select FOOTBRIDGE 404 select FOOTBRIDGE
402 select GENERIC_CLOCKEVENTS 405 select GENERIC_CLOCKEVENTS
406 select HAVE_IDE
403 select NEED_MACH_MEMORY_H 407 select NEED_MACH_MEMORY_H
404 help 408 help
405 Support for systems based on the DC21285 companion chip 409 Support for systems based on the DC21285 companion chip
@@ -538,7 +542,6 @@ config ARCH_LPC32XX
538 select ARM_AMBA 542 select ARM_AMBA
539 select USB_ARCH_HAS_OHCI 543 select USB_ARCH_HAS_OHCI
540 select CLKDEV_LOOKUP 544 select CLKDEV_LOOKUP
541 select GENERIC_TIME
542 select GENERIC_CLOCKEVENTS 545 select GENERIC_CLOCKEVENTS
543 help 546 help
544 Support for the NXP LPC32XX family of processors 547 Support for the NXP LPC32XX family of processors
@@ -618,7 +621,6 @@ config ARCH_TEGRA
618 bool "NVIDIA Tegra" 621 bool "NVIDIA Tegra"
619 select CLKDEV_LOOKUP 622 select CLKDEV_LOOKUP
620 select CLKSRC_MMIO 623 select CLKSRC_MMIO
621 select GENERIC_TIME
622 select GENERIC_CLOCKEVENTS 624 select GENERIC_CLOCKEVENTS
623 select GENERIC_GPIO 625 select GENERIC_GPIO
624 select HAVE_CLK 626 select HAVE_CLK
@@ -651,6 +653,8 @@ config ARCH_PXA
651 select SPARSE_IRQ 653 select SPARSE_IRQ
652 select AUTO_ZRELADDR 654 select AUTO_ZRELADDR
653 select MULTI_IRQ_HANDLER 655 select MULTI_IRQ_HANDLER
656 select ARM_CPU_SUSPEND if PM
657 select HAVE_IDE
654 help 658 help
655 Support for Intel/Marvell's PXA2xx/PXA3xx processor line. 659 Support for Intel/Marvell's PXA2xx/PXA3xx processor line.
656 660
@@ -692,6 +696,7 @@ config ARCH_RPC
692 select NO_IOPORT 696 select NO_IOPORT
693 select ARCH_SPARSEMEM_ENABLE 697 select ARCH_SPARSEMEM_ENABLE
694 select ARCH_USES_GETTIMEOFFSET 698 select ARCH_USES_GETTIMEOFFSET
699 select HAVE_IDE
695 select NEED_MACH_MEMORY_H 700 select NEED_MACH_MEMORY_H
696 help 701 help
697 On the Acorn Risc-PC, Linux can support the internal IDE disk and 702 On the Acorn Risc-PC, Linux can support the internal IDE disk and
@@ -711,6 +716,7 @@ config ARCH_SA1100
711 select HAVE_SCHED_CLOCK 716 select HAVE_SCHED_CLOCK
712 select TICK_ONESHOT 717 select TICK_ONESHOT
713 select ARCH_REQUIRE_GPIOLIB 718 select ARCH_REQUIRE_GPIOLIB
719 select HAVE_IDE
714 select NEED_MACH_MEMORY_H 720 select NEED_MACH_MEMORY_H
715 help 721 help
716 Support for StrongARM 11x0 based boards. 722 Support for StrongARM 11x0 based boards.
@@ -745,7 +751,6 @@ config ARCH_S3C64XX
745 select ARCH_REQUIRE_GPIOLIB 751 select ARCH_REQUIRE_GPIOLIB
746 select SAMSUNG_CLKSRC 752 select SAMSUNG_CLKSRC
747 select SAMSUNG_IRQ_VIC_TIMER 753 select SAMSUNG_IRQ_VIC_TIMER
748 select SAMSUNG_IRQ_UART
749 select S3C_GPIO_TRACK 754 select S3C_GPIO_TRACK
750 select S3C_GPIO_PULL_UPDOWN 755 select S3C_GPIO_PULL_UPDOWN
751 select S3C_GPIO_CFG_S3C24XX 756 select S3C_GPIO_CFG_S3C24XX
@@ -861,6 +866,7 @@ config ARCH_U300
861 select CLKDEV_LOOKUP 866 select CLKDEV_LOOKUP
862 select HAVE_MACH_CLKDEV 867 select HAVE_MACH_CLKDEV
863 select GENERIC_GPIO 868 select GENERIC_GPIO
869 select ARCH_REQUIRE_GPIOLIB
864 select NEED_MACH_MEMORY_H 870 select NEED_MACH_MEMORY_H
865 help 871 help
866 Support for ST-Ericsson U300 series mobile platforms. 872 Support for ST-Ericsson U300 series mobile platforms.
@@ -937,7 +943,6 @@ config ARCH_VT8500
937config ARCH_ZYNQ 943config ARCH_ZYNQ
938 bool "Xilinx Zynq ARM Cortex A9 Platform" 944 bool "Xilinx Zynq ARM Cortex A9 Platform"
939 select CPU_V7 945 select CPU_V7
940 select GENERIC_TIME
941 select GENERIC_CLOCKEVENTS 946 select GENERIC_CLOCKEVENTS
942 select CLKDEV_LOOKUP 947 select CLKDEV_LOOKUP
943 select ARM_GIC 948 select ARM_GIC
@@ -1310,6 +1315,20 @@ config ARM_ERRATA_364296
1310 processor into full low interrupt latency mode. ARM11MPCore 1315 processor into full low interrupt latency mode. ARM11MPCore
1311 is not affected. 1316 is not affected.
1312 1317
1318config ARM_ERRATA_764369
1319 bool "ARM errata: Data cache line maintenance operation by MVA may not succeed"
1320 depends on CPU_V7 && SMP
1321 help
1322 This option enables the workaround for erratum 764369
1323 affecting Cortex-A9 MPCore with two or more processors (all
1324 current revisions). Under certain timing circumstances, a data
1325 cache line maintenance operation by MVA targeting an Inner
1326 Shareable memory region may fail to proceed up to either the
1327 Point of Coherency or to the Point of Unification of the
1328 system. This workaround adds a DSB instruction before the
1329 relevant cache maintenance functions and sets a specific bit
1330 in the diagnostic control register of the SCU.
1331
1313endmenu 1332endmenu
1314 1333
1315source "arch/arm/common/Kconfig" 1334source "arch/arm/common/Kconfig"
@@ -1388,6 +1407,7 @@ config SMP
1388 MACH_REALVIEW_PB11MP || MACH_REALVIEW_PBX || ARCH_OMAP4 || \ 1407 MACH_REALVIEW_PB11MP || MACH_REALVIEW_PBX || ARCH_OMAP4 || \
1389 ARCH_EXYNOS4 || ARCH_TEGRA || ARCH_U8500 || ARCH_VEXPRESS_CA9X4 || \ 1408 ARCH_EXYNOS4 || ARCH_TEGRA || ARCH_U8500 || ARCH_VEXPRESS_CA9X4 || \
1390 ARCH_MSM_SCORPIONMP || ARCH_SHMOBILE 1409 ARCH_MSM_SCORPIONMP || ARCH_SHMOBILE
1410 depends on MMU
1391 select USE_GENERIC_SMP_HELPERS 1411 select USE_GENERIC_SMP_HELPERS
1392 select HAVE_ARM_SCU if !ARCH_MSM_SCORPIONMP 1412 select HAVE_ARM_SCU if !ARCH_MSM_SCORPIONMP
1393 help 1413 help
@@ -1401,7 +1421,7 @@ config SMP
1401 processor machines. On a single processor machine, the kernel will 1421 processor machines. On a single processor machine, the kernel will
1402 run faster if you say N here. 1422 run faster if you say N here.
1403 1423
1404 See also <file:Documentation/i386/IO-APIC.txt>, 1424 See also <file:Documentation/x86/i386/IO-APIC.txt>,
1405 <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at 1425 <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at
1406 <http://tldp.org/HOWTO/SMP-HOWTO.html>. 1426 <http://tldp.org/HOWTO/SMP-HOWTO.html>.
1407 1427
@@ -1520,6 +1540,7 @@ config THUMB2_KERNEL
1520 depends on CPU_V7 && !CPU_V6 && !CPU_V6K && EXPERIMENTAL 1540 depends on CPU_V7 && !CPU_V6 && !CPU_V6K && EXPERIMENTAL
1521 select AEABI 1541 select AEABI
1522 select ARM_ASM_UNIFIED 1542 select ARM_ASM_UNIFIED
1543 select ARM_UNWIND
1523 help 1544 help
1524 By enabling this option, the kernel will be compiled in 1545 By enabling this option, the kernel will be compiled in
1525 Thumb-2 mode. A compiler/assembler that understand the unified 1546 Thumb-2 mode. A compiler/assembler that understand the unified
@@ -2171,6 +2192,9 @@ config ARCH_SUSPEND_POSSIBLE
2171 CPU_V6 || CPU_V6K || CPU_V7 || CPU_XSC3 || CPU_XSCALE 2192 CPU_V6 || CPU_V6K || CPU_V7 || CPU_XSC3 || CPU_XSCALE
2172 def_bool y 2193 def_bool y
2173 2194
2195config ARM_CPU_SUSPEND
2196 def_bool PM_SLEEP
2197
2174endmenu 2198endmenu
2175 2199
2176source "net/Kconfig" 2200source "net/Kconfig"
diff --git a/arch/arm/Kconfig.debug b/arch/arm/Kconfig.debug
index be3a0f78d915..f283938c2fc7 100644
--- a/arch/arm/Kconfig.debug
+++ b/arch/arm/Kconfig.debug
@@ -65,13 +65,71 @@ config DEBUG_USER
65 65
66# These options are only for real kernel hackers who want to get their hands dirty. 66# These options are only for real kernel hackers who want to get their hands dirty.
67config DEBUG_LL 67config DEBUG_LL
68 bool "Kernel low-level debugging functions" 68 bool "Kernel low-level debugging functions (read help!)"
69 depends on DEBUG_KERNEL 69 depends on DEBUG_KERNEL
70 help 70 help
71 Say Y here to include definitions of printascii, printch, printhex 71 Say Y here to include definitions of printascii, printch, printhex
72 in the kernel. This is helpful if you are debugging code that 72 in the kernel. This is helpful if you are debugging code that
73 executes before the console is initialized. 73 executes before the console is initialized.
74 74
75 Note that selecting this option will limit the kernel to a single
76 UART definition, as specified below. Attempting to boot the kernel
77 image on a different platform *will not work*, so this option should
78 not be enabled for kernels that are intended to be portable.
79
80choice
81 prompt "Kernel low-level debugging port"
82 depends on DEBUG_LL
83
84 config DEBUG_LL_UART_NONE
85 bool "No low-level debugging UART"
86 help
87 Say Y here if your platform doesn't provide a UART option
88 below. This relies on your platform choosing the right UART
89 definition internally in order for low-level debugging to
90 work.
91
92 config DEBUG_ICEDCC
93 bool "Kernel low-level debugging via EmbeddedICE DCC channel"
94 help
95 Say Y here if you want the debug print routines to direct
96 their output to the EmbeddedICE macrocell's DCC channel using
97 co-processor 14. This is known to work on the ARM9 style ICE
98 channel and on the XScale with the PEEDI.
99
100 Note that the system will appear to hang during boot if there
101 is nothing connected to read from the DCC.
102
103 config DEBUG_FOOTBRIDGE_COM1
104 bool "Kernel low-level debugging messages via footbridge 8250 at PCI COM1"
105 depends on FOOTBRIDGE
106 help
107 Say Y here if you want the debug print routines to direct
108 their output to the 8250 at PCI COM1.
109
110 config DEBUG_DC21285_PORT
111 bool "Kernel low-level debugging messages via footbridge serial port"
112 depends on FOOTBRIDGE
113 help
114 Say Y here if you want the debug print routines to direct
115 their output to the serial port in the DC21285 (Footbridge).
116
117 config DEBUG_CLPS711X_UART1
118 bool "Kernel low-level debugging messages via UART1"
119 depends on ARCH_CLPS711X
120 help
121 Say Y here if you want the debug print routines to direct
122 their output to the first serial port on these devices.
123
124 config DEBUG_CLPS711X_UART2
125 bool "Kernel low-level debugging messages via UART2"
126 depends on ARCH_CLPS711X
127 help
128 Say Y here if you want the debug print routines to direct
129 their output to the second serial port on these devices.
130
131endchoice
132
75config EARLY_PRINTK 133config EARLY_PRINTK
76 bool "Early printk" 134 bool "Early printk"
77 depends on DEBUG_LL 135 depends on DEBUG_LL
@@ -80,43 +138,14 @@ config EARLY_PRINTK
80 kernel low-level debugging functions. Add earlyprintk to your 138 kernel low-level debugging functions. Add earlyprintk to your
81 kernel parameters to enable this console. 139 kernel parameters to enable this console.
82 140
83config DEBUG_ICEDCC
84 bool "Kernel low-level debugging via EmbeddedICE DCC channel"
85 depends on DEBUG_LL
86 help
87 Say Y here if you want the debug print routines to direct their
88 output to the EmbeddedICE macrocell's DCC channel using
89 co-processor 14. This is known to work on the ARM9 style ICE
90 channel and on the XScale with the PEEDI.
91
92 It does include a timeout to ensure that the system does not
93 totally freeze when there is nothing connected to read.
94
95config OC_ETM 141config OC_ETM
96 bool "On-chip ETM and ETB" 142 bool "On-chip ETM and ETB"
97 select ARM_AMBA 143 depends on ARM_AMBA
98 help 144 help
99 Enables the on-chip embedded trace macrocell and embedded trace 145 Enables the on-chip embedded trace macrocell and embedded trace
100 buffer driver that will allow you to collect traces of the 146 buffer driver that will allow you to collect traces of the
101 kernel code. 147 kernel code.
102 148
103config DEBUG_DC21285_PORT
104 bool "Kernel low-level debugging messages via footbridge serial port"
105 depends on DEBUG_LL && FOOTBRIDGE
106 help
107 Say Y here if you want the debug print routines to direct their
108 output to the serial port in the DC21285 (Footbridge). Saying N
109 will cause the debug messages to appear on the first 16550
110 serial port.
111
112config DEBUG_CLPS711X_UART2
113 bool "Kernel low-level debugging messages via UART2"
114 depends on DEBUG_LL && ARCH_CLPS711X
115 help
116 Say Y here if you want the debug print routines to direct their
117 output to the second serial port on these devices. Saying N will
118 cause the debug messages to appear on the first serial port.
119
120config DEBUG_S3C_UART 149config DEBUG_S3C_UART
121 depends on PLAT_SAMSUNG 150 depends on PLAT_SAMSUNG
122 int "S3C UART to use for low-level debug" 151 int "S3C UART to use for low-level debug"
diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile
index a1edfd5a129a..176062ac7f07 100644
--- a/arch/arm/boot/Makefile
+++ b/arch/arm/boot/Makefile
@@ -78,7 +78,16 @@ endif
78 78
79$(obj)/uImage: STARTADDR=$(LOADADDR) 79$(obj)/uImage: STARTADDR=$(LOADADDR)
80 80
81check_for_multiple_loadaddr = \
82if [ $(words $(LOADADDR)) -gt 1 ]; then \
83 echo 'multiple load addresses: $(LOADADDR)'; \
84 echo 'This is incompatible with uImages'; \
85 echo 'Specify LOADADDR on the commandline to build an uImage'; \
86 false; \
87fi
88
81$(obj)/uImage: $(obj)/zImage FORCE 89$(obj)/uImage: $(obj)/zImage FORCE
90 @$(check_for_multiple_loadaddr)
82 $(call if_changed,uimage) 91 $(call if_changed,uimage)
83 @echo ' Image $@ is ready' 92 @echo ' Image $@ is ready'
84 93
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index e4f32a8e002a..21f56ff32797 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -163,8 +163,16 @@ bad_syms=$$($(CROSS_COMPILE)nm $@ | sed -n 's/^.\{8\} [bc] \(.*\)/\1/p') && \
163 ( echo "following symbols must have non local/private scope:" >&2; \ 163 ( echo "following symbols must have non local/private scope:" >&2; \
164 echo "$$bad_syms" >&2; rm -f $@; false ) 164 echo "$$bad_syms" >&2; rm -f $@; false )
165 165
166check_for_multiple_zreladdr = \
167if [ $(words $(ZRELADDR)) -gt 1 -a "$(CONFIG_AUTO_ZRELADDR)" = "" ]; then \
168 echo 'multiple zreladdrs: $(ZRELADDR)'; \
169 echo 'This needs CONFIG_AUTO_ZRELADDR to be set'; \
170 false; \
171fi
172
166$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \ 173$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.$(suffix_y).o \
167 $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) FORCE 174 $(addprefix $(obj)/, $(OBJS)) $(lib1funcs) FORCE
175 @$(check_for_multiple_zreladdr)
168 $(call if_changed,ld) 176 $(call if_changed,ld)
169 @$(check_for_bad_syms) 177 @$(check_for_bad_syms)
170 178
diff --git a/arch/arm/boot/dts/tegra-harmony.dts b/arch/arm/boot/dts/tegra-harmony.dts
index 4c053340ce33..e5818668d091 100644
--- a/arch/arm/boot/dts/tegra-harmony.dts
+++ b/arch/arm/boot/dts/tegra-harmony.dts
@@ -57,14 +57,14 @@
57 }; 57 };
58 58
59 sdhci@c8000200 { 59 sdhci@c8000200 {
60 gpios = <&gpio 69 0>, /* cd, gpio PI5 */ 60 cd-gpios = <&gpio 69 0>; /* gpio PI5 */
61 <&gpio 57 0>, /* wp, gpio PH1 */ 61 wp-gpios = <&gpio 57 0>; /* gpio PH1 */
62 <&gpio 155 0>; /* power, gpio PT3 */ 62 power-gpios = <&gpio 155 0>; /* gpio PT3 */
63 }; 63 };
64 64
65 sdhci@c8000600 { 65 sdhci@c8000600 {
66 gpios = <&gpio 58 0>, /* cd, gpio PH2 */ 66 cd-gpios = <&gpio 58 0>; /* gpio PH2 */
67 <&gpio 59 0>, /* wp, gpio PH3 */ 67 wp-gpios = <&gpio 59 0>; /* gpio PH3 */
68 <&gpio 70 0>; /* power, gpio PI6 */ 68 power-gpios = <&gpio 70 0>; /* gpio PI6 */
69 }; 69 };
70}; 70};
diff --git a/arch/arm/boot/dts/tegra-seaboard.dts b/arch/arm/boot/dts/tegra-seaboard.dts
index 1940cae00748..64cedca6fc79 100644
--- a/arch/arm/boot/dts/tegra-seaboard.dts
+++ b/arch/arm/boot/dts/tegra-seaboard.dts
@@ -21,8 +21,8 @@
21 }; 21 };
22 22
23 sdhci@c8000400 { 23 sdhci@c8000400 {
24 gpios = <&gpio 69 0>, /* cd, gpio PI5 */ 24 cd-gpios = <&gpio 69 0>; /* gpio PI5 */
25 <&gpio 57 0>, /* wp, gpio PH1 */ 25 wp-gpios = <&gpio 57 0>; /* gpio PH1 */
26 <&gpio 70 0>; /* power, gpio PI6 */ 26 power-gpios = <&gpio 70 0>; /* gpio PI6 */
27 }; 27 };
28}; 28};
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
index 016c1aeb847c..a8fc6b237592 100644
--- a/arch/arm/common/gic.c
+++ b/arch/arm/common/gic.c
@@ -37,7 +37,7 @@
37#include <asm/mach/irq.h> 37#include <asm/mach/irq.h>
38#include <asm/hardware/gic.h> 38#include <asm/hardware/gic.h>
39 39
40static DEFINE_SPINLOCK(irq_controller_lock); 40static DEFINE_RAW_SPINLOCK(irq_controller_lock);
41 41
42/* Address of GIC 0 CPU interface */ 42/* Address of GIC 0 CPU interface */
43void __iomem *gic_cpu_base_addr __read_mostly; 43void __iomem *gic_cpu_base_addr __read_mostly;
@@ -86,30 +86,30 @@ static void gic_mask_irq(struct irq_data *d)
86{ 86{
87 u32 mask = 1 << (d->irq % 32); 87 u32 mask = 1 << (d->irq % 32);
88 88
89 spin_lock(&irq_controller_lock); 89 raw_spin_lock(&irq_controller_lock);
90 writel_relaxed(mask, gic_dist_base(d) + GIC_DIST_ENABLE_CLEAR + (gic_irq(d) / 32) * 4); 90 writel_relaxed(mask, gic_dist_base(d) + GIC_DIST_ENABLE_CLEAR + (gic_irq(d) / 32) * 4);
91 if (gic_arch_extn.irq_mask) 91 if (gic_arch_extn.irq_mask)
92 gic_arch_extn.irq_mask(d); 92 gic_arch_extn.irq_mask(d);
93 spin_unlock(&irq_controller_lock); 93 raw_spin_unlock(&irq_controller_lock);
94} 94}
95 95
96static void gic_unmask_irq(struct irq_data *d) 96static void gic_unmask_irq(struct irq_data *d)
97{ 97{
98 u32 mask = 1 << (d->irq % 32); 98 u32 mask = 1 << (d->irq % 32);
99 99
100 spin_lock(&irq_controller_lock); 100 raw_spin_lock(&irq_controller_lock);
101 if (gic_arch_extn.irq_unmask) 101 if (gic_arch_extn.irq_unmask)
102 gic_arch_extn.irq_unmask(d); 102 gic_arch_extn.irq_unmask(d);
103 writel_relaxed(mask, gic_dist_base(d) + GIC_DIST_ENABLE_SET + (gic_irq(d) / 32) * 4); 103 writel_relaxed(mask, gic_dist_base(d) + GIC_DIST_ENABLE_SET + (gic_irq(d) / 32) * 4);
104 spin_unlock(&irq_controller_lock); 104 raw_spin_unlock(&irq_controller_lock);
105} 105}
106 106
107static void gic_eoi_irq(struct irq_data *d) 107static void gic_eoi_irq(struct irq_data *d)
108{ 108{
109 if (gic_arch_extn.irq_eoi) { 109 if (gic_arch_extn.irq_eoi) {
110 spin_lock(&irq_controller_lock); 110 raw_spin_lock(&irq_controller_lock);
111 gic_arch_extn.irq_eoi(d); 111 gic_arch_extn.irq_eoi(d);
112 spin_unlock(&irq_controller_lock); 112 raw_spin_unlock(&irq_controller_lock);
113 } 113 }
114 114
115 writel_relaxed(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI); 115 writel_relaxed(gic_irq(d), gic_cpu_base(d) + GIC_CPU_EOI);
@@ -133,7 +133,7 @@ static int gic_set_type(struct irq_data *d, unsigned int type)
133 if (type != IRQ_TYPE_LEVEL_HIGH && type != IRQ_TYPE_EDGE_RISING) 133 if (type != IRQ_TYPE_LEVEL_HIGH && type != IRQ_TYPE_EDGE_RISING)
134 return -EINVAL; 134 return -EINVAL;
135 135
136 spin_lock(&irq_controller_lock); 136 raw_spin_lock(&irq_controller_lock);
137 137
138 if (gic_arch_extn.irq_set_type) 138 if (gic_arch_extn.irq_set_type)
139 gic_arch_extn.irq_set_type(d, type); 139 gic_arch_extn.irq_set_type(d, type);
@@ -158,7 +158,7 @@ static int gic_set_type(struct irq_data *d, unsigned int type)
158 if (enabled) 158 if (enabled)
159 writel_relaxed(enablemask, base + GIC_DIST_ENABLE_SET + enableoff); 159 writel_relaxed(enablemask, base + GIC_DIST_ENABLE_SET + enableoff);
160 160
161 spin_unlock(&irq_controller_lock); 161 raw_spin_unlock(&irq_controller_lock);
162 162
163 return 0; 163 return 0;
164} 164}
@@ -186,10 +186,10 @@ static int gic_set_affinity(struct irq_data *d, const struct cpumask *mask_val,
186 mask = 0xff << shift; 186 mask = 0xff << shift;
187 bit = 1 << (cpu_logical_map(cpu) + shift); 187 bit = 1 << (cpu_logical_map(cpu) + shift);
188 188
189 spin_lock(&irq_controller_lock); 189 raw_spin_lock(&irq_controller_lock);
190 val = readl_relaxed(reg) & ~mask; 190 val = readl_relaxed(reg) & ~mask;
191 writel_relaxed(val | bit, reg); 191 writel_relaxed(val | bit, reg);
192 spin_unlock(&irq_controller_lock); 192 raw_spin_unlock(&irq_controller_lock);
193 193
194 return IRQ_SET_MASK_OK; 194 return IRQ_SET_MASK_OK;
195} 195}
@@ -219,9 +219,9 @@ static void gic_handle_cascade_irq(unsigned int irq, struct irq_desc *desc)
219 219
220 chained_irq_enter(chip, desc); 220 chained_irq_enter(chip, desc);
221 221
222 spin_lock(&irq_controller_lock); 222 raw_spin_lock(&irq_controller_lock);
223 status = readl_relaxed(chip_data->cpu_base + GIC_CPU_INTACK); 223 status = readl_relaxed(chip_data->cpu_base + GIC_CPU_INTACK);
224 spin_unlock(&irq_controller_lock); 224 raw_spin_unlock(&irq_controller_lock);
225 225
226 gic_irq = (status & 0x3ff); 226 gic_irq = (status & 0x3ff);
227 if (gic_irq == 1023) 227 if (gic_irq == 1023)
diff --git a/arch/arm/common/pl330.c b/arch/arm/common/pl330.c
index 97912fa48782..7129cfbdacd6 100644
--- a/arch/arm/common/pl330.c
+++ b/arch/arm/common/pl330.c
@@ -1546,7 +1546,7 @@ int pl330_chan_ctrl(void *ch_id, enum pl330_chan_op op)
1546 1546
1547 /* Start the next */ 1547 /* Start the next */
1548 case PL330_OP_START: 1548 case PL330_OP_START:
1549 if (!_start(thrd)) 1549 if (!_thrd_active(thrd) && !_start(thrd))
1550 ret = -EIO; 1550 ret = -EIO;
1551 break; 1551 break;
1552 1552
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
index 0569de6acfba..61691cdbdcf2 100644
--- a/arch/arm/common/sa1111.c
+++ b/arch/arm/common/sa1111.c
@@ -718,6 +718,10 @@ __sa1111_probe(struct device *me, struct resource *mem, int irq)
718 goto err_free; 718 goto err_free;
719 } 719 }
720 720
721 ret = clk_prepare(sachip->clk);
722 if (ret)
723 goto err_clkput;
724
721 spin_lock_init(&sachip->lock); 725 spin_lock_init(&sachip->lock);
722 726
723 sachip->dev = me; 727 sachip->dev = me;
@@ -733,7 +737,7 @@ __sa1111_probe(struct device *me, struct resource *mem, int irq)
733 sachip->base = ioremap(mem->start, PAGE_SIZE * 2); 737 sachip->base = ioremap(mem->start, PAGE_SIZE * 2);
734 if (!sachip->base) { 738 if (!sachip->base) {
735 ret = -ENOMEM; 739 ret = -ENOMEM;
736 goto err_clkput; 740 goto err_clk_unprep;
737 } 741 }
738 742
739 /* 743 /*
@@ -809,6 +813,8 @@ __sa1111_probe(struct device *me, struct resource *mem, int irq)
809 813
810 err_unmap: 814 err_unmap:
811 iounmap(sachip->base); 815 iounmap(sachip->base);
816 err_clk_unprep:
817 clk_unprepare(sachip->clk);
812 err_clkput: 818 err_clkput:
813 clk_put(sachip->clk); 819 clk_put(sachip->clk);
814 err_free: 820 err_free:
@@ -835,6 +841,7 @@ static void __sa1111_remove(struct sa1111 *sachip)
835 sa1111_writel(0, irqbase + SA1111_WAKEEN1); 841 sa1111_writel(0, irqbase + SA1111_WAKEEN1);
836 842
837 clk_disable(sachip->clk); 843 clk_disable(sachip->clk);
844 clk_unprepare(sachip->clk);
838 845
839 if (sachip->irq != NO_IRQ) { 846 if (sachip->irq != NO_IRQ) {
840 irq_set_chained_handler(sachip->irq, NULL); 847 irq_set_chained_handler(sachip->irq, NULL);
diff --git a/arch/arm/common/scoop.c b/arch/arm/common/scoop.c
index a07b0e763a80..1cde34a080d7 100644
--- a/arch/arm/common/scoop.c
+++ b/arch/arm/common/scoop.c
@@ -12,11 +12,11 @@
12 */ 12 */
13 13
14#include <linux/device.h> 14#include <linux/device.h>
15#include <linux/gpio.h>
15#include <linux/string.h> 16#include <linux/string.h>
16#include <linux/slab.h> 17#include <linux/slab.h>
17#include <linux/platform_device.h> 18#include <linux/platform_device.h>
18#include <linux/io.h> 19#include <linux/io.h>
19#include <asm/gpio.h>
20#include <asm/hardware/scoop.h> 20#include <asm/hardware/scoop.h>
21 21
22/* PCMCIA to Scoop linkage 22/* PCMCIA to Scoop linkage
diff --git a/arch/arm/common/timer-sp.c b/arch/arm/common/timer-sp.c
index 41df47875122..2393b5bc96fa 100644
--- a/arch/arm/common/timer-sp.c
+++ b/arch/arm/common/timer-sp.c
@@ -41,9 +41,17 @@ static long __init sp804_get_clock_rate(const char *name)
41 return PTR_ERR(clk); 41 return PTR_ERR(clk);
42 } 42 }
43 43
44 err = clk_prepare(clk);
45 if (err) {
46 pr_err("sp804: %s clock failed to prepare: %d\n", name, err);
47 clk_put(clk);
48 return err;
49 }
50
44 err = clk_enable(clk); 51 err = clk_enable(clk);
45 if (err) { 52 if (err) {
46 pr_err("sp804: %s clock failed to enable: %d\n", name, err); 53 pr_err("sp804: %s clock failed to enable: %d\n", name, err);
54 clk_unprepare(clk);
47 clk_put(clk); 55 clk_put(clk);
48 return err; 56 return err;
49 } 57 }
@@ -52,6 +60,7 @@ static long __init sp804_get_clock_rate(const char *name)
52 if (rate < 0) { 60 if (rate < 0) {
53 pr_err("sp804: %s clock failed to get rate: %ld\n", name, rate); 61 pr_err("sp804: %s clock failed to get rate: %ld\n", name, rate);
54 clk_disable(clk); 62 clk_disable(clk);
63 clk_unprepare(clk);
55 clk_put(clk); 64 clk_put(clk);
56 } 65 }
57 66
diff --git a/arch/arm/common/vic.c b/arch/arm/common/vic.c
index 7aa4262ada7a..01f18a421b17 100644
--- a/arch/arm/common/vic.c
+++ b/arch/arm/common/vic.c
@@ -259,7 +259,6 @@ static void __init vic_disable(void __iomem *base)
259 writel(0, base + VIC_INT_SELECT); 259 writel(0, base + VIC_INT_SELECT);
260 writel(0, base + VIC_INT_ENABLE); 260 writel(0, base + VIC_INT_ENABLE);
261 writel(~0, base + VIC_INT_ENABLE_CLEAR); 261 writel(~0, base + VIC_INT_ENABLE_CLEAR);
262 writel(0, base + VIC_IRQ_STATUS);
263 writel(0, base + VIC_ITCR); 262 writel(0, base + VIC_ITCR);
264 writel(~0, base + VIC_INT_SOFT_CLEAR); 263 writel(~0, base + VIC_INT_SOFT_CLEAR);
265} 264}
@@ -347,7 +346,8 @@ void __init vic_init(void __iomem *base, unsigned int irq_start,
347 346
348 /* Identify which VIC cell this one is, by reading the ID */ 347 /* Identify which VIC cell this one is, by reading the ID */
349 for (i = 0; i < 4; i++) { 348 for (i = 0; i < 4; i++) {
350 u32 addr = ((u32)base & PAGE_MASK) + 0xfe0 + (i * 4); 349 void __iomem *addr;
350 addr = (void __iomem *)((u32)base & PAGE_MASK) + 0xfe0 + (i * 4);
351 cellid |= (readl(addr) & 0xff) << (8 * i); 351 cellid |= (readl(addr) & 0xff) << (8 * i);
352 } 352 }
353 vendor = (cellid >> 12) & 0xff; 353 vendor = (cellid >> 12) & 0xff;
diff --git a/arch/arm/configs/integrator_defconfig b/arch/arm/configs/integrator_defconfig
index 7196ade07e27..1103f62a1964 100644
--- a/arch/arm/configs/integrator_defconfig
+++ b/arch/arm/configs/integrator_defconfig
@@ -1,5 +1,6 @@
1CONFIG_EXPERIMENTAL=y 1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y 2CONFIG_SYSVIPC=y
3CONFIG_TINY_RCU=y
3CONFIG_IKCONFIG=y 4CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 5CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 6CONFIG_LOG_BUF_SHIFT=14
@@ -8,20 +9,29 @@ CONFIG_MODULES=y
8CONFIG_MODULE_UNLOAD=y 9CONFIG_MODULE_UNLOAD=y
9CONFIG_ARCH_INTEGRATOR=y 10CONFIG_ARCH_INTEGRATOR=y
10CONFIG_ARCH_INTEGRATOR_AP=y 11CONFIG_ARCH_INTEGRATOR_AP=y
12CONFIG_ARCH_INTEGRATOR_CP=y
11CONFIG_CPU_ARM720T=y 13CONFIG_CPU_ARM720T=y
12CONFIG_CPU_ARM920T=y 14CONFIG_CPU_ARM920T=y
15CONFIG_CPU_ARM922T=y
16CONFIG_CPU_ARM926T=y
17CONFIG_CPU_ARM1020=y
18CONFIG_CPU_ARM1022=y
19CONFIG_CPU_ARM1026=y
13CONFIG_PCI=y 20CONFIG_PCI=y
21CONFIG_NO_HZ=y
22CONFIG_HIGH_RES_TIMERS=y
23CONFIG_PREEMPT=y
24CONFIG_AEABI=y
14CONFIG_LEDS=y 25CONFIG_LEDS=y
15CONFIG_LEDS_CPU=y 26CONFIG_LEDS_CPU=y
16CONFIG_ZBOOT_ROM_TEXT=0x0 27CONFIG_ZBOOT_ROM_TEXT=0x0
17CONFIG_ZBOOT_ROM_BSS=0x0 28CONFIG_ZBOOT_ROM_BSS=0x0
18CONFIG_CMDLINE="console=ttyAM0,38400n8 root=/dev/nfs ip=bootp mem=32M" 29CONFIG_CMDLINE="console=ttyAM0,38400n8 root=/dev/nfs ip=bootp"
19CONFIG_CPU_FREQ=y 30CONFIG_CPU_FREQ=y
20CONFIG_CPU_FREQ_GOV_POWERSAVE=y 31CONFIG_CPU_FREQ_GOV_POWERSAVE=y
21CONFIG_CPU_FREQ_GOV_USERSPACE=y 32CONFIG_CPU_FREQ_GOV_USERSPACE=y
22CONFIG_CPU_FREQ_GOV_ONDEMAND=y 33CONFIG_CPU_FREQ_GOV_ONDEMAND=y
23CONFIG_FPE_NWFPE=y 34CONFIG_FPE_NWFPE=y
24CONFIG_PM=y
25CONFIG_NET=y 35CONFIG_NET=y
26CONFIG_PACKET=y 36CONFIG_PACKET=y
27CONFIG_UNIX=y 37CONFIG_UNIX=y
@@ -32,7 +42,6 @@ CONFIG_IP_PNP_DHCP=y
32CONFIG_IP_PNP_BOOTP=y 42CONFIG_IP_PNP_BOOTP=y
33# CONFIG_IPV6 is not set 43# CONFIG_IPV6 is not set
34CONFIG_MTD=y 44CONFIG_MTD=y
35CONFIG_MTD_PARTITIONS=y
36CONFIG_MTD_CMDLINE_PARTS=y 45CONFIG_MTD_CMDLINE_PARTS=y
37CONFIG_MTD_AFS_PARTS=y 46CONFIG_MTD_AFS_PARTS=y
38CONFIG_MTD_CHAR=y 47CONFIG_MTD_CHAR=y
@@ -40,6 +49,7 @@ CONFIG_MTD_BLOCK=y
40CONFIG_MTD_CFI=y 49CONFIG_MTD_CFI=y
41CONFIG_MTD_CFI_ADV_OPTIONS=y 50CONFIG_MTD_CFI_ADV_OPTIONS=y
42CONFIG_MTD_CFI_INTELEXT=y 51CONFIG_MTD_CFI_INTELEXT=y
52CONFIG_MTD_PHYSMAP=y
43CONFIG_BLK_DEV_LOOP=y 53CONFIG_BLK_DEV_LOOP=y
44CONFIG_BLK_DEV_RAM=y 54CONFIG_BLK_DEV_RAM=y
45CONFIG_BLK_DEV_RAM_SIZE=8192 55CONFIG_BLK_DEV_RAM_SIZE=8192
@@ -56,6 +66,8 @@ CONFIG_FB_MODE_HELPERS=y
56CONFIG_FB_MATROX=y 66CONFIG_FB_MATROX=y
57CONFIG_FB_MATROX_MILLENIUM=y 67CONFIG_FB_MATROX_MILLENIUM=y
58CONFIG_FB_MATROX_MYSTIQUE=y 68CONFIG_FB_MATROX_MYSTIQUE=y
69CONFIG_RTC_CLASS=y
70CONFIG_RTC_DRV_PL030=y
59CONFIG_EXT2_FS=y 71CONFIG_EXT2_FS=y
60CONFIG_TMPFS=y 72CONFIG_TMPFS=y
61CONFIG_JFFS2_FS=y 73CONFIG_JFFS2_FS=y
@@ -68,4 +80,3 @@ CONFIG_NFSD_V3=y
68CONFIG_PARTITION_ADVANCED=y 80CONFIG_PARTITION_ADVANCED=y
69CONFIG_MAGIC_SYSRQ=y 81CONFIG_MAGIC_SYSRQ=y
70CONFIG_DEBUG_KERNEL=y 82CONFIG_DEBUG_KERNEL=y
71CONFIG_DEBUG_ERRORS=y
diff --git a/arch/arm/include/asm/Kbuild b/arch/arm/include/asm/Kbuild
index 6550db3aa5c7..960abceb8e14 100644
--- a/arch/arm/include/asm/Kbuild
+++ b/arch/arm/include/asm/Kbuild
@@ -1,3 +1,20 @@
1include include/asm-generic/Kbuild.asm 1include include/asm-generic/Kbuild.asm
2 2
3header-y += hwcap.h 3header-y += hwcap.h
4
5generic-y += auxvec.h
6generic-y += bitsperlong.h
7generic-y += cputime.h
8generic-y += emergency-restart.h
9generic-y += errno.h
10generic-y += ioctl.h
11generic-y += irq_regs.h
12generic-y += kdebug.h
13generic-y += local.h
14generic-y += local64.h
15generic-y += percpu.h
16generic-y += poll.h
17generic-y += resource.h
18generic-y += sections.h
19generic-y += siginfo.h
20generic-y += sizes.h
diff --git a/arch/arm/include/asm/auxvec.h b/arch/arm/include/asm/auxvec.h
deleted file mode 100644
index c0536f6b29a7..000000000000
--- a/arch/arm/include/asm/auxvec.h
+++ /dev/null
@@ -1,4 +0,0 @@
1#ifndef __ASMARM_AUXVEC_H
2#define __ASMARM_AUXVEC_H
3
4#endif
diff --git a/arch/arm/include/asm/bitsperlong.h b/arch/arm/include/asm/bitsperlong.h
deleted file mode 100644
index 6dc0bb0c13b2..000000000000
--- a/arch/arm/include/asm/bitsperlong.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/bitsperlong.h>
diff --git a/arch/arm/include/asm/bug.h b/arch/arm/include/asm/bug.h
index 4d88425a4169..9abe7a07d5ac 100644
--- a/arch/arm/include/asm/bug.h
+++ b/arch/arm/include/asm/bug.h
@@ -3,21 +3,58 @@
3 3
4 4
5#ifdef CONFIG_BUG 5#ifdef CONFIG_BUG
6#ifdef CONFIG_DEBUG_BUGVERBOSE
7extern void __bug(const char *file, int line) __attribute__((noreturn));
8
9/* give file/line information */
10#define BUG() __bug(__FILE__, __LINE__)
11 6
7/*
8 * Use a suitable undefined instruction to use for ARM/Thumb2 bug handling.
9 * We need to be careful not to conflict with those used by other modules and
10 * the register_undef_hook() system.
11 */
12#ifdef CONFIG_THUMB2_KERNEL
13#define BUG_INSTR_VALUE 0xde02
14#define BUG_INSTR_TYPE ".hword "
12#else 15#else
16#define BUG_INSTR_VALUE 0xe7f001f2
17#define BUG_INSTR_TYPE ".word "
18#endif
13 19
14/* this just causes an oops */
15#define BUG() do { *(int *)0 = 0; } while (1)
16 20
17#endif 21#define BUG() _BUG(__FILE__, __LINE__, BUG_INSTR_VALUE)
22#define _BUG(file, line, value) __BUG(file, line, value)
23
24#ifdef CONFIG_DEBUG_BUGVERBOSE
25
26/*
27 * The extra indirection is to ensure that the __FILE__ string comes through
28 * OK. Many version of gcc do not support the asm %c parameter which would be
29 * preferable to this unpleasantness. We use mergeable string sections to
30 * avoid multiple copies of the string appearing in the kernel image.
31 */
32
33#define __BUG(__file, __line, __value) \
34do { \
35 BUILD_BUG_ON(sizeof(struct bug_entry) != 12); \
36 asm volatile("1:\t" BUG_INSTR_TYPE #__value "\n" \
37 ".pushsection .rodata.str, \"aMS\", %progbits, 1\n" \
38 "2:\t.asciz " #__file "\n" \
39 ".popsection\n" \
40 ".pushsection __bug_table,\"a\"\n" \
41 "3:\t.word 1b, 2b\n" \
42 "\t.hword " #__line ", 0\n" \
43 ".popsection"); \
44 unreachable(); \
45} while (0)
46
47#else /* not CONFIG_DEBUG_BUGVERBOSE */
48
49#define __BUG(__file, __line, __value) \
50do { \
51 asm volatile(BUG_INSTR_TYPE #__value); \
52 unreachable(); \
53} while (0)
54#endif /* CONFIG_DEBUG_BUGVERBOSE */
18 55
19#define HAVE_ARCH_BUG 56#define HAVE_ARCH_BUG
20#endif 57#endif /* CONFIG_BUG */
21 58
22#include <asm-generic/bug.h> 59#include <asm-generic/bug.h>
23 60
diff --git a/arch/arm/include/asm/cachetype.h b/arch/arm/include/asm/cachetype.h
index c023db09fcc1..7ea78144ae22 100644
--- a/arch/arm/include/asm/cachetype.h
+++ b/arch/arm/include/asm/cachetype.h
@@ -7,6 +7,7 @@
7#define CACHEID_VIPT (CACHEID_VIPT_ALIASING|CACHEID_VIPT_NONALIASING) 7#define CACHEID_VIPT (CACHEID_VIPT_ALIASING|CACHEID_VIPT_NONALIASING)
8#define CACHEID_ASID_TAGGED (1 << 3) 8#define CACHEID_ASID_TAGGED (1 << 3)
9#define CACHEID_VIPT_I_ALIASING (1 << 4) 9#define CACHEID_VIPT_I_ALIASING (1 << 4)
10#define CACHEID_PIPT (1 << 5)
10 11
11extern unsigned int cacheid; 12extern unsigned int cacheid;
12 13
@@ -16,6 +17,7 @@ extern unsigned int cacheid;
16#define cache_is_vipt_aliasing() cacheid_is(CACHEID_VIPT_ALIASING) 17#define cache_is_vipt_aliasing() cacheid_is(CACHEID_VIPT_ALIASING)
17#define icache_is_vivt_asid_tagged() cacheid_is(CACHEID_ASID_TAGGED) 18#define icache_is_vivt_asid_tagged() cacheid_is(CACHEID_ASID_TAGGED)
18#define icache_is_vipt_aliasing() cacheid_is(CACHEID_VIPT_I_ALIASING) 19#define icache_is_vipt_aliasing() cacheid_is(CACHEID_VIPT_I_ALIASING)
20#define icache_is_pipt() cacheid_is(CACHEID_PIPT)
19 21
20/* 22/*
21 * __LINUX_ARM_ARCH__ is the minimum supported CPU architecture 23 * __LINUX_ARM_ARCH__ is the minimum supported CPU architecture
@@ -26,7 +28,8 @@ extern unsigned int cacheid;
26#if __LINUX_ARM_ARCH__ >= 7 28#if __LINUX_ARM_ARCH__ >= 7
27#define __CACHEID_ARCH_MIN (CACHEID_VIPT_NONALIASING |\ 29#define __CACHEID_ARCH_MIN (CACHEID_VIPT_NONALIASING |\
28 CACHEID_ASID_TAGGED |\ 30 CACHEID_ASID_TAGGED |\
29 CACHEID_VIPT_I_ALIASING) 31 CACHEID_VIPT_I_ALIASING |\
32 CACHEID_PIPT)
30#elif __LINUX_ARM_ARCH__ >= 6 33#elif __LINUX_ARM_ARCH__ >= 6
31#define __CACHEID_ARCH_MIN (~CACHEID_VIVT) 34#define __CACHEID_ARCH_MIN (~CACHEID_VIVT)
32#else 35#else
diff --git a/arch/arm/include/asm/cputime.h b/arch/arm/include/asm/cputime.h
deleted file mode 100644
index 3a8002a5fec7..000000000000
--- a/arch/arm/include/asm/cputime.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ARM_CPUTIME_H
2#define __ARM_CPUTIME_H
3
4#include <asm-generic/cputime.h>
5
6#endif /* __ARM_CPUTIME_H */
diff --git a/arch/arm/include/asm/device.h b/arch/arm/include/asm/device.h
index 9f390ce335cb..6615f03f56a5 100644
--- a/arch/arm/include/asm/device.h
+++ b/arch/arm/include/asm/device.h
@@ -10,6 +10,9 @@ struct dev_archdata {
10#ifdef CONFIG_DMABOUNCE 10#ifdef CONFIG_DMABOUNCE
11 struct dmabounce_device_info *dmabounce; 11 struct dmabounce_device_info *dmabounce;
12#endif 12#endif
13#ifdef CONFIG_IOMMU_API
14 void *iommu; /* private IOMMU data */
15#endif
13}; 16};
14 17
15struct pdev_archdata { 18struct pdev_archdata {
diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h
index 7f27fab9d404..cb3b7c981c4b 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -32,7 +32,7 @@ static inline unsigned long dma_to_pfn(struct device *dev, dma_addr_t addr)
32 32
33static inline void *dma_to_virt(struct device *dev, dma_addr_t addr) 33static inline void *dma_to_virt(struct device *dev, dma_addr_t addr)
34{ 34{
35 return (void *)__bus_to_virt(addr); 35 return (void *)__bus_to_virt((unsigned long)addr);
36} 36}
37 37
38static inline dma_addr_t virt_to_dma(struct device *dev, void *addr) 38static inline dma_addr_t virt_to_dma(struct device *dev, void *addr)
diff --git a/arch/arm/include/asm/dma.h b/arch/arm/include/asm/dma.h
index 628670e9d7c9..69a5b0b6455c 100644
--- a/arch/arm/include/asm/dma.h
+++ b/arch/arm/include/asm/dma.h
@@ -34,18 +34,18 @@
34#define DMA_MODE_CASCADE 0xc0 34#define DMA_MODE_CASCADE 0xc0
35#define DMA_AUTOINIT 0x10 35#define DMA_AUTOINIT 0x10
36 36
37extern spinlock_t dma_spin_lock; 37extern raw_spinlock_t dma_spin_lock;
38 38
39static inline unsigned long claim_dma_lock(void) 39static inline unsigned long claim_dma_lock(void)
40{ 40{
41 unsigned long flags; 41 unsigned long flags;
42 spin_lock_irqsave(&dma_spin_lock, flags); 42 raw_spin_lock_irqsave(&dma_spin_lock, flags);
43 return flags; 43 return flags;
44} 44}
45 45
46static inline void release_dma_lock(unsigned long flags) 46static inline void release_dma_lock(unsigned long flags)
47{ 47{
48 spin_unlock_irqrestore(&dma_spin_lock, flags); 48 raw_spin_unlock_irqrestore(&dma_spin_lock, flags);
49} 49}
50 50
51/* Clear the 'DMA Pointer Flip Flop'. 51/* Clear the 'DMA Pointer Flip Flop'.
diff --git a/arch/arm/include/asm/ecard.h b/arch/arm/include/asm/ecard.h
index 29f2610efc70..eaea14676d57 100644
--- a/arch/arm/include/asm/ecard.h
+++ b/arch/arm/include/asm/ecard.h
@@ -161,7 +161,6 @@ struct expansion_card {
161 161
162 /* Private internal data */ 162 /* Private internal data */
163 const char *card_desc; /* Card description */ 163 const char *card_desc; /* Card description */
164 CONST unsigned int podaddr; /* Base Linux address for card */
165 CONST loader_t loader; /* loader program */ 164 CONST loader_t loader; /* loader program */
166 u64 dma_mask; 165 u64 dma_mask;
167}; 166};
diff --git a/arch/arm/include/asm/emergency-restart.h b/arch/arm/include/asm/emergency-restart.h
deleted file mode 100644
index 108d8c48e42e..000000000000
--- a/arch/arm/include/asm/emergency-restart.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASM_EMERGENCY_RESTART_H
2#define _ASM_EMERGENCY_RESTART_H
3
4#include <asm-generic/emergency-restart.h>
5
6#endif /* _ASM_EMERGENCY_RESTART_H */
diff --git a/arch/arm/include/asm/errno.h b/arch/arm/include/asm/errno.h
deleted file mode 100644
index 6e60f0612bb6..000000000000
--- a/arch/arm/include/asm/errno.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ARM_ERRNO_H
2#define _ARM_ERRNO_H
3
4#include <asm-generic/errno.h>
5
6#endif
diff --git a/arch/arm/include/asm/futex.h b/arch/arm/include/asm/futex.h
index 8c73900da9ed..253cc86318bf 100644
--- a/arch/arm/include/asm/futex.h
+++ b/arch/arm/include/asm/futex.h
@@ -25,17 +25,17 @@
25 25
26#ifdef CONFIG_SMP 26#ifdef CONFIG_SMP
27 27
28#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ 28#define __futex_atomic_op(insn, ret, oldval, tmp, uaddr, oparg) \
29 smp_mb(); \ 29 smp_mb(); \
30 __asm__ __volatile__( \ 30 __asm__ __volatile__( \
31 "1: ldrex %1, [%2]\n" \ 31 "1: ldrex %1, [%3]\n" \
32 " " insn "\n" \ 32 " " insn "\n" \
33 "2: strex %1, %0, [%2]\n" \ 33 "2: strex %2, %0, [%3]\n" \
34 " teq %1, #0\n" \ 34 " teq %2, #0\n" \
35 " bne 1b\n" \ 35 " bne 1b\n" \
36 " mov %0, #0\n" \ 36 " mov %0, #0\n" \
37 __futex_atomic_ex_table("%4") \ 37 __futex_atomic_ex_table("%5") \
38 : "=&r" (ret), "=&r" (oldval) \ 38 : "=&r" (ret), "=&r" (oldval), "=&r" (tmp) \
39 : "r" (uaddr), "r" (oparg), "Ir" (-EFAULT) \ 39 : "r" (uaddr), "r" (oparg), "Ir" (-EFAULT) \
40 : "cc", "memory") 40 : "cc", "memory")
41 41
@@ -73,14 +73,14 @@ futex_atomic_cmpxchg_inatomic(u32 *uval, u32 __user *uaddr,
73#include <linux/preempt.h> 73#include <linux/preempt.h>
74#include <asm/domain.h> 74#include <asm/domain.h>
75 75
76#define __futex_atomic_op(insn, ret, oldval, uaddr, oparg) \ 76#define __futex_atomic_op(insn, ret, oldval, tmp, uaddr, oparg) \
77 __asm__ __volatile__( \ 77 __asm__ __volatile__( \
78 "1: " T(ldr) " %1, [%2]\n" \ 78 "1: " T(ldr) " %1, [%3]\n" \
79 " " insn "\n" \ 79 " " insn "\n" \
80 "2: " T(str) " %0, [%2]\n" \ 80 "2: " T(str) " %0, [%3]\n" \
81 " mov %0, #0\n" \ 81 " mov %0, #0\n" \
82 __futex_atomic_ex_table("%4") \ 82 __futex_atomic_ex_table("%5") \
83 : "=&r" (ret), "=&r" (oldval) \ 83 : "=&r" (ret), "=&r" (oldval), "=&r" (tmp) \
84 : "r" (uaddr), "r" (oparg), "Ir" (-EFAULT) \ 84 : "r" (uaddr), "r" (oparg), "Ir" (-EFAULT) \
85 : "cc", "memory") 85 : "cc", "memory")
86 86
@@ -117,7 +117,7 @@ futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr)
117 int cmp = (encoded_op >> 24) & 15; 117 int cmp = (encoded_op >> 24) & 15;
118 int oparg = (encoded_op << 8) >> 20; 118 int oparg = (encoded_op << 8) >> 20;
119 int cmparg = (encoded_op << 20) >> 20; 119 int cmparg = (encoded_op << 20) >> 20;
120 int oldval = 0, ret; 120 int oldval = 0, ret, tmp;
121 121
122 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28)) 122 if (encoded_op & (FUTEX_OP_OPARG_SHIFT << 28))
123 oparg = 1 << oparg; 123 oparg = 1 << oparg;
@@ -129,19 +129,19 @@ futex_atomic_op_inuser (int encoded_op, u32 __user *uaddr)
129 129
130 switch (op) { 130 switch (op) {
131 case FUTEX_OP_SET: 131 case FUTEX_OP_SET:
132 __futex_atomic_op("mov %0, %3", ret, oldval, uaddr, oparg); 132 __futex_atomic_op("mov %0, %4", ret, oldval, tmp, uaddr, oparg);
133 break; 133 break;
134 case FUTEX_OP_ADD: 134 case FUTEX_OP_ADD:
135 __futex_atomic_op("add %0, %1, %3", ret, oldval, uaddr, oparg); 135 __futex_atomic_op("add %0, %1, %4", ret, oldval, tmp, uaddr, oparg);
136 break; 136 break;
137 case FUTEX_OP_OR: 137 case FUTEX_OP_OR:
138 __futex_atomic_op("orr %0, %1, %3", ret, oldval, uaddr, oparg); 138 __futex_atomic_op("orr %0, %1, %4", ret, oldval, tmp, uaddr, oparg);
139 break; 139 break;
140 case FUTEX_OP_ANDN: 140 case FUTEX_OP_ANDN:
141 __futex_atomic_op("and %0, %1, %3", ret, oldval, uaddr, ~oparg); 141 __futex_atomic_op("and %0, %1, %4", ret, oldval, tmp, uaddr, ~oparg);
142 break; 142 break;
143 case FUTEX_OP_XOR: 143 case FUTEX_OP_XOR:
144 __futex_atomic_op("eor %0, %1, %3", ret, oldval, uaddr, oparg); 144 __futex_atomic_op("eor %0, %1, %4", ret, oldval, tmp, uaddr, oparg);
145 break; 145 break;
146 default: 146 default:
147 ret = -ENOSYS; 147 ret = -ENOSYS;
diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h
index 166a7a3e2840..11ad0bfbb0ad 100644
--- a/arch/arm/include/asm/gpio.h
+++ b/arch/arm/include/asm/gpio.h
@@ -4,4 +4,23 @@
4/* not all ARM platforms necessarily support this API ... */ 4/* not all ARM platforms necessarily support this API ... */
5#include <mach/gpio.h> 5#include <mach/gpio.h>
6 6
7#ifndef __ARM_GPIOLIB_COMPLEX
8/* Note: this may rely upon the value of ARCH_NR_GPIOS set in mach/gpio.h */
9#include <asm-generic/gpio.h>
10
11/* The trivial gpiolib dispatchers */
12#define gpio_get_value __gpio_get_value
13#define gpio_set_value __gpio_set_value
14#define gpio_cansleep __gpio_cansleep
15#endif
16
17/*
18 * Provide a default gpio_to_irq() which should satisfy every case.
19 * However, some platforms want to do this differently, so allow them
20 * to override it.
21 */
22#ifndef gpio_to_irq
23#define gpio_to_irq __gpio_to_irq
24#endif
25
7#endif /* _ARCH_ARM_GPIO_H */ 26#endif /* _ARCH_ARM_GPIO_H */
diff --git a/arch/arm/include/asm/hardware/cache-l2x0.h b/arch/arm/include/asm/hardware/cache-l2x0.h
index 99a6ed7e1bfd..434edccdf7f3 100644
--- a/arch/arm/include/asm/hardware/cache-l2x0.h
+++ b/arch/arm/include/asm/hardware/cache-l2x0.h
@@ -52,6 +52,8 @@
52#define L2X0_LOCKDOWN_WAY_D_BASE 0x900 52#define L2X0_LOCKDOWN_WAY_D_BASE 0x900
53#define L2X0_LOCKDOWN_WAY_I_BASE 0x904 53#define L2X0_LOCKDOWN_WAY_I_BASE 0x904
54#define L2X0_LOCKDOWN_STRIDE 0x08 54#define L2X0_LOCKDOWN_STRIDE 0x08
55#define L2X0_ADDR_FILTER_START 0xC00
56#define L2X0_ADDR_FILTER_END 0xC04
55#define L2X0_TEST_OPERATION 0xF00 57#define L2X0_TEST_OPERATION 0xF00
56#define L2X0_LINE_DATA 0xF10 58#define L2X0_LINE_DATA 0xF10
57#define L2X0_LINE_TAG 0xF30 59#define L2X0_LINE_TAG 0xF30
@@ -65,8 +67,23 @@
65#define L2X0_CACHE_ID_PART_MASK (0xf << 6) 67#define L2X0_CACHE_ID_PART_MASK (0xf << 6)
66#define L2X0_CACHE_ID_PART_L210 (1 << 6) 68#define L2X0_CACHE_ID_PART_L210 (1 << 6)
67#define L2X0_CACHE_ID_PART_L310 (3 << 6) 69#define L2X0_CACHE_ID_PART_L310 (3 << 6)
70#define L2X0_CACHE_ID_RTL_MASK 0x3f
71#define L2X0_CACHE_ID_RTL_R0P0 0x0
72#define L2X0_CACHE_ID_RTL_R1P0 0x2
73#define L2X0_CACHE_ID_RTL_R2P0 0x4
74#define L2X0_CACHE_ID_RTL_R3P0 0x5
75#define L2X0_CACHE_ID_RTL_R3P1 0x6
76#define L2X0_CACHE_ID_RTL_R3P2 0x8
68 77
69#define L2X0_AUX_CTRL_MASK 0xc0000fff 78#define L2X0_AUX_CTRL_MASK 0xc0000fff
79#define L2X0_AUX_CTRL_DATA_RD_LATENCY_SHIFT 0
80#define L2X0_AUX_CTRL_DATA_RD_LATENCY_MASK 0x7
81#define L2X0_AUX_CTRL_DATA_WR_LATENCY_SHIFT 3
82#define L2X0_AUX_CTRL_DATA_WR_LATENCY_MASK (0x7 << 3)
83#define L2X0_AUX_CTRL_TAG_LATENCY_SHIFT 6
84#define L2X0_AUX_CTRL_TAG_LATENCY_MASK (0x7 << 6)
85#define L2X0_AUX_CTRL_DIRTY_LATENCY_SHIFT 9
86#define L2X0_AUX_CTRL_DIRTY_LATENCY_MASK (0x7 << 9)
70#define L2X0_AUX_CTRL_ASSOCIATIVITY_SHIFT 16 87#define L2X0_AUX_CTRL_ASSOCIATIVITY_SHIFT 16
71#define L2X0_AUX_CTRL_WAY_SIZE_SHIFT 17 88#define L2X0_AUX_CTRL_WAY_SIZE_SHIFT 17
72#define L2X0_AUX_CTRL_WAY_SIZE_MASK (0x7 << 17) 89#define L2X0_AUX_CTRL_WAY_SIZE_MASK (0x7 << 17)
@@ -77,8 +94,33 @@
77#define L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT 29 94#define L2X0_AUX_CTRL_INSTR_PREFETCH_SHIFT 29
78#define L2X0_AUX_CTRL_EARLY_BRESP_SHIFT 30 95#define L2X0_AUX_CTRL_EARLY_BRESP_SHIFT 30
79 96
97#define L2X0_LATENCY_CTRL_SETUP_SHIFT 0
98#define L2X0_LATENCY_CTRL_RD_SHIFT 4
99#define L2X0_LATENCY_CTRL_WR_SHIFT 8
100
101#define L2X0_ADDR_FILTER_EN 1
102
80#ifndef __ASSEMBLY__ 103#ifndef __ASSEMBLY__
81extern void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask); 104extern void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask);
105extern int l2x0_of_init(__u32 aux_val, __u32 aux_mask);
106
107struct l2x0_regs {
108 unsigned long phy_base;
109 unsigned long aux_ctrl;
110 /*
111 * Whether the following registers need to be saved/restored
112 * depends on platform
113 */
114 unsigned long tag_latency;
115 unsigned long data_latency;
116 unsigned long filter_start;
117 unsigned long filter_end;
118 unsigned long prefetch_ctrl;
119 unsigned long pwr_ctrl;
120};
121
122extern struct l2x0_regs l2x0_saved_regs;
123
82#endif 124#endif
83 125
84#endif 126#endif
diff --git a/arch/arm/include/asm/hardware/iop3xx-gpio.h b/arch/arm/include/asm/hardware/iop3xx-gpio.h
index b69d972b1f7d..9eda7dc92ad8 100644
--- a/arch/arm/include/asm/hardware/iop3xx-gpio.h
+++ b/arch/arm/include/asm/hardware/iop3xx-gpio.h
@@ -28,6 +28,8 @@
28#include <mach/hardware.h> 28#include <mach/hardware.h>
29#include <asm-generic/gpio.h> 29#include <asm-generic/gpio.h>
30 30
31#define __ARM_GPIOLIB_COMPLEX
32
31#define IOP3XX_N_GPIOS 8 33#define IOP3XX_N_GPIOS 8
32 34
33static inline int gpio_get_value(unsigned gpio) 35static inline int gpio_get_value(unsigned gpio)
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index d66605dea55a..065d100fa63e 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -80,6 +80,7 @@ extern void __iomem *__arm_ioremap_caller(unsigned long, size_t, unsigned int,
80 80
81extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, unsigned int); 81extern void __iomem *__arm_ioremap_pfn(unsigned long, unsigned long, size_t, unsigned int);
82extern void __iomem *__arm_ioremap(unsigned long, size_t, unsigned int); 82extern void __iomem *__arm_ioremap(unsigned long, size_t, unsigned int);
83extern void __iomem *__arm_ioremap_exec(unsigned long, size_t, bool cached);
83extern void __iounmap(volatile void __iomem *addr); 84extern void __iounmap(volatile void __iomem *addr);
84 85
85/* 86/*
@@ -110,6 +111,27 @@ static inline void __iomem *__typesafe_io(unsigned long addr)
110#include <mach/io.h> 111#include <mach/io.h>
111 112
112/* 113/*
114 * This is the limit of PC card/PCI/ISA IO space, which is by default
115 * 64K if we have PC card, PCI or ISA support. Otherwise, default to
116 * zero to prevent ISA/PCI drivers claiming IO space (and potentially
117 * oopsing.)
118 *
119 * Only set this larger if you really need inb() et.al. to operate over
120 * a larger address space. Note that SOC_COMMON ioremaps each sockets
121 * IO space area, and so inb() et.al. must be defined to operate as per
122 * readb() et.al. on such platforms.
123 */
124#ifndef IO_SPACE_LIMIT
125#if defined(CONFIG_PCMCIA_SOC_COMMON) || defined(CONFIG_PCMCIA_SOC_COMMON_MODULE)
126#define IO_SPACE_LIMIT ((resource_size_t)0xffffffff)
127#elif defined(CONFIG_PCI) || defined(CONFIG_ISA) || defined(CONFIG_PCCARD)
128#define IO_SPACE_LIMIT ((resource_size_t)0xffff)
129#else
130#define IO_SPACE_LIMIT ((resource_size_t)0)
131#endif
132#endif
133
134/*
113 * IO port access primitives 135 * IO port access primitives
114 * ------------------------- 136 * -------------------------
115 * 137 *
@@ -189,11 +211,11 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
189 * IO port primitives for more information. 211 * IO port primitives for more information.
190 */ 212 */
191#ifdef __mem_pci 213#ifdef __mem_pci
192#define readb_relaxed(c) ({ u8 __v = __raw_readb(__mem_pci(c)); __v; }) 214#define readb_relaxed(c) ({ u8 __r = __raw_readb(__mem_pci(c)); __r; })
193#define readw_relaxed(c) ({ u16 __v = le16_to_cpu((__force __le16) \ 215#define readw_relaxed(c) ({ u16 __r = le16_to_cpu((__force __le16) \
194 __raw_readw(__mem_pci(c))); __v; }) 216 __raw_readw(__mem_pci(c))); __r; })
195#define readl_relaxed(c) ({ u32 __v = le32_to_cpu((__force __le32) \ 217#define readl_relaxed(c) ({ u32 __r = le32_to_cpu((__force __le32) \
196 __raw_readl(__mem_pci(c))); __v; }) 218 __raw_readl(__mem_pci(c))); __r; })
197 219
198#define writeb_relaxed(v,c) ((void)__raw_writeb(v,__mem_pci(c))) 220#define writeb_relaxed(v,c) ((void)__raw_writeb(v,__mem_pci(c)))
199#define writew_relaxed(v,c) ((void)__raw_writew((__force u16) \ 221#define writew_relaxed(v,c) ((void)__raw_writew((__force u16) \
@@ -238,7 +260,7 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
238 * ioremap and friends. 260 * ioremap and friends.
239 * 261 *
240 * ioremap takes a PCI memory address, as specified in 262 * ioremap takes a PCI memory address, as specified in
241 * Documentation/IO-mapping.txt. 263 * Documentation/io-mapping.txt.
242 * 264 *
243 */ 265 */
244#ifndef __arch_ioremap 266#ifndef __arch_ioremap
@@ -260,10 +282,16 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
260#define ioread16(p) ({ unsigned int __v = le16_to_cpu((__force __le16)__raw_readw(p)); __iormb(); __v; }) 282#define ioread16(p) ({ unsigned int __v = le16_to_cpu((__force __le16)__raw_readw(p)); __iormb(); __v; })
261#define ioread32(p) ({ unsigned int __v = le32_to_cpu((__force __le32)__raw_readl(p)); __iormb(); __v; }) 283#define ioread32(p) ({ unsigned int __v = le32_to_cpu((__force __le32)__raw_readl(p)); __iormb(); __v; })
262 284
285#define ioread16be(p) ({ unsigned int __v = be16_to_cpu((__force __be16)__raw_readw(p)); __iormb(); __v; })
286#define ioread32be(p) ({ unsigned int __v = be32_to_cpu((__force __be32)__raw_readl(p)); __iormb(); __v; })
287
263#define iowrite8(v,p) ({ __iowmb(); (void)__raw_writeb(v, p); }) 288#define iowrite8(v,p) ({ __iowmb(); (void)__raw_writeb(v, p); })
264#define iowrite16(v,p) ({ __iowmb(); (void)__raw_writew((__force __u16)cpu_to_le16(v), p); }) 289#define iowrite16(v,p) ({ __iowmb(); (void)__raw_writew((__force __u16)cpu_to_le16(v), p); })
265#define iowrite32(v,p) ({ __iowmb(); (void)__raw_writel((__force __u32)cpu_to_le32(v), p); }) 290#define iowrite32(v,p) ({ __iowmb(); (void)__raw_writel((__force __u32)cpu_to_le32(v), p); })
266 291
292#define iowrite16be(v,p) ({ __iowmb(); (void)__raw_writew((__force __u16)cpu_to_be16(v), p); })
293#define iowrite32be(v,p) ({ __iowmb(); (void)__raw_writel((__force __u32)cpu_to_be32(v), p); })
294
267#define ioread8_rep(p,d,c) __raw_readsb(p,d,c) 295#define ioread8_rep(p,d,c) __raw_readsb(p,d,c)
268#define ioread16_rep(p,d,c) __raw_readsw(p,d,c) 296#define ioread16_rep(p,d,c) __raw_readsw(p,d,c)
269#define ioread32_rep(p,d,c) __raw_readsl(p,d,c) 297#define ioread32_rep(p,d,c) __raw_readsl(p,d,c)
diff --git a/arch/arm/include/asm/ioctl.h b/arch/arm/include/asm/ioctl.h
deleted file mode 100644
index b279fe06dfe5..000000000000
--- a/arch/arm/include/asm/ioctl.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/ioctl.h>
diff --git a/arch/arm/include/asm/irq_regs.h b/arch/arm/include/asm/irq_regs.h
deleted file mode 100644
index 3dd9c0b70270..000000000000
--- a/arch/arm/include/asm/irq_regs.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/irq_regs.h>
diff --git a/arch/arm/include/asm/kdebug.h b/arch/arm/include/asm/kdebug.h
deleted file mode 100644
index 6ece1b037665..000000000000
--- a/arch/arm/include/asm/kdebug.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/kdebug.h>
diff --git a/arch/arm/include/asm/local.h b/arch/arm/include/asm/local.h
deleted file mode 100644
index c11c530f74d0..000000000000
--- a/arch/arm/include/asm/local.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/local.h>
diff --git a/arch/arm/include/asm/local64.h b/arch/arm/include/asm/local64.h
deleted file mode 100644
index 36c93b5cc239..000000000000
--- a/arch/arm/include/asm/local64.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/local64.h>
diff --git a/arch/arm/include/asm/localtimer.h b/arch/arm/include/asm/localtimer.h
index f5e1cec7e35c..c6a18424888e 100644
--- a/arch/arm/include/asm/localtimer.h
+++ b/arch/arm/include/asm/localtimer.h
@@ -10,6 +10,7 @@
10#ifndef __ASM_ARM_LOCALTIMER_H 10#ifndef __ASM_ARM_LOCALTIMER_H
11#define __ASM_ARM_LOCALTIMER_H 11#define __ASM_ARM_LOCALTIMER_H
12 12
13#include <linux/errno.h>
13#include <linux/interrupt.h> 14#include <linux/interrupt.h>
14 15
15struct clock_event_device; 16struct clock_event_device;
diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h
index 727da118bcc1..7d19425dd496 100644
--- a/arch/arm/include/asm/mach/arch.h
+++ b/arch/arm/include/asm/mach/arch.h
@@ -34,8 +34,7 @@ struct machine_desc {
34 unsigned int reserve_lp1 :1; /* never has lp1 */ 34 unsigned int reserve_lp1 :1; /* never has lp1 */
35 unsigned int reserve_lp2 :1; /* never has lp2 */ 35 unsigned int reserve_lp2 :1; /* never has lp2 */
36 unsigned int soft_reboot :1; /* soft reboot */ 36 unsigned int soft_reboot :1; /* soft reboot */
37 void (*fixup)(struct machine_desc *, 37 void (*fixup)(struct tag *, char **,
38 struct tag *, char **,
39 struct meminfo *); 38 struct meminfo *);
40 void (*reserve)(void);/* reserve mem blocks */ 39 void (*reserve)(void);/* reserve mem blocks */
41 void (*map_io)(void);/* IO mapping function */ 40 void (*map_io)(void);/* IO mapping function */
diff --git a/arch/arm/include/asm/mmu.h b/arch/arm/include/asm/mmu.h
index b4ffe9d5b526..14965658a923 100644
--- a/arch/arm/include/asm/mmu.h
+++ b/arch/arm/include/asm/mmu.h
@@ -6,7 +6,7 @@
6typedef struct { 6typedef struct {
7#ifdef CONFIG_CPU_HAS_ASID 7#ifdef CONFIG_CPU_HAS_ASID
8 unsigned int id; 8 unsigned int id;
9 spinlock_t id_lock; 9 raw_spinlock_t id_lock;
10#endif 10#endif
11 unsigned int kvm_seq; 11 unsigned int kvm_seq;
12} mm_context_t; 12} mm_context_t;
@@ -16,7 +16,7 @@ typedef struct {
16 16
17/* init_mm.context.id_lock should be initialized. */ 17/* init_mm.context.id_lock should be initialized. */
18#define INIT_MM_CONTEXT(name) \ 18#define INIT_MM_CONTEXT(name) \
19 .context.id_lock = __SPIN_LOCK_UNLOCKED(name.context.id_lock), 19 .context.id_lock = __RAW_SPIN_LOCK_UNLOCKED(name.context.id_lock),
20#else 20#else
21#define ASID(mm) (0) 21#define ASID(mm) (0)
22#endif 22#endif
diff --git a/arch/arm/include/asm/outercache.h b/arch/arm/include/asm/outercache.h
index d8387437ec5a..53426c66352a 100644
--- a/arch/arm/include/asm/outercache.h
+++ b/arch/arm/include/asm/outercache.h
@@ -34,6 +34,7 @@ struct outer_cache_fns {
34 void (*sync)(void); 34 void (*sync)(void);
35#endif 35#endif
36 void (*set_debug)(unsigned long); 36 void (*set_debug)(unsigned long);
37 void (*resume)(void);
37}; 38};
38 39
39#ifdef CONFIG_OUTER_CACHE 40#ifdef CONFIG_OUTER_CACHE
@@ -74,6 +75,12 @@ static inline void outer_disable(void)
74 outer_cache.disable(); 75 outer_cache.disable();
75} 76}
76 77
78static inline void outer_resume(void)
79{
80 if (outer_cache.resume)
81 outer_cache.resume();
82}
83
77#else 84#else
78 85
79static inline void outer_inv_range(phys_addr_t start, phys_addr_t end) 86static inline void outer_inv_range(phys_addr_t start, phys_addr_t end)
diff --git a/arch/arm/include/asm/page.h b/arch/arm/include/asm/page.h
index ac75d0848889..ca94653f1ecb 100644
--- a/arch/arm/include/asm/page.h
+++ b/arch/arm/include/asm/page.h
@@ -151,47 +151,7 @@ extern void __cpu_copy_user_highpage(struct page *to, struct page *from,
151#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE) 151#define clear_page(page) memset((void *)(page), 0, PAGE_SIZE)
152extern void copy_page(void *to, const void *from); 152extern void copy_page(void *to, const void *from);
153 153
154typedef unsigned long pteval_t; 154#include <asm/pgtable-2level-types.h>
155
156#undef STRICT_MM_TYPECHECKS
157
158#ifdef STRICT_MM_TYPECHECKS
159/*
160 * These are used to make use of C type-checking..
161 */
162typedef struct { pteval_t pte; } pte_t;
163typedef struct { unsigned long pmd; } pmd_t;
164typedef struct { unsigned long pgd[2]; } pgd_t;
165typedef struct { unsigned long pgprot; } pgprot_t;
166
167#define pte_val(x) ((x).pte)
168#define pmd_val(x) ((x).pmd)
169#define pgd_val(x) ((x).pgd[0])
170#define pgprot_val(x) ((x).pgprot)
171
172#define __pte(x) ((pte_t) { (x) } )
173#define __pmd(x) ((pmd_t) { (x) } )
174#define __pgprot(x) ((pgprot_t) { (x) } )
175
176#else
177/*
178 * .. while these make it easier on the compiler
179 */
180typedef pteval_t pte_t;
181typedef unsigned long pmd_t;
182typedef unsigned long pgd_t[2];
183typedef unsigned long pgprot_t;
184
185#define pte_val(x) (x)
186#define pmd_val(x) (x)
187#define pgd_val(x) ((x)[0])
188#define pgprot_val(x) (x)
189
190#define __pte(x) (x)
191#define __pmd(x) (x)
192#define __pgprot(x) (x)
193
194#endif /* STRICT_MM_TYPECHECKS */
195 155
196#endif /* CONFIG_MMU */ 156#endif /* CONFIG_MMU */
197 157
diff --git a/arch/arm/include/asm/percpu.h b/arch/arm/include/asm/percpu.h
deleted file mode 100644
index b4e32d8ec072..000000000000
--- a/arch/arm/include/asm/percpu.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef __ARM_PERCPU
2#define __ARM_PERCPU
3
4#include <asm-generic/percpu.h>
5
6#endif
diff --git a/arch/arm/include/asm/pgalloc.h b/arch/arm/include/asm/pgalloc.h
index 22de005f159c..3e08fd3fbb6b 100644
--- a/arch/arm/include/asm/pgalloc.h
+++ b/arch/arm/include/asm/pgalloc.h
@@ -105,9 +105,9 @@ static inline void pte_free(struct mm_struct *mm, pgtable_t pte)
105} 105}
106 106
107static inline void __pmd_populate(pmd_t *pmdp, phys_addr_t pte, 107static inline void __pmd_populate(pmd_t *pmdp, phys_addr_t pte,
108 unsigned long prot) 108 pmdval_t prot)
109{ 109{
110 unsigned long pmdval = (pte + PTE_HWTABLE_OFF) | prot; 110 pmdval_t pmdval = (pte + PTE_HWTABLE_OFF) | prot;
111 pmdp[0] = __pmd(pmdval); 111 pmdp[0] = __pmd(pmdval);
112 pmdp[1] = __pmd(pmdval + 256 * sizeof(pte_t)); 112 pmdp[1] = __pmd(pmdval + 256 * sizeof(pte_t));
113 flush_pmd_entry(pmdp); 113 flush_pmd_entry(pmdp);
diff --git a/arch/arm/include/asm/pgtable-2level-hwdef.h b/arch/arm/include/asm/pgtable-2level-hwdef.h
new file mode 100644
index 000000000000..5cfba15cb401
--- /dev/null
+++ b/arch/arm/include/asm/pgtable-2level-hwdef.h
@@ -0,0 +1,93 @@
1/*
2 * arch/arm/include/asm/pgtable-2level-hwdef.h
3 *
4 * Copyright (C) 1995-2002 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef _ASM_PGTABLE_2LEVEL_HWDEF_H
11#define _ASM_PGTABLE_2LEVEL_HWDEF_H
12
13/*
14 * Hardware page table definitions.
15 *
16 * + Level 1 descriptor (PMD)
17 * - common
18 */
19#define PMD_TYPE_MASK (_AT(pmdval_t, 3) << 0)
20#define PMD_TYPE_FAULT (_AT(pmdval_t, 0) << 0)
21#define PMD_TYPE_TABLE (_AT(pmdval_t, 1) << 0)
22#define PMD_TYPE_SECT (_AT(pmdval_t, 2) << 0)
23#define PMD_BIT4 (_AT(pmdval_t, 1) << 4)
24#define PMD_DOMAIN(x) (_AT(pmdval_t, (x)) << 5)
25#define PMD_PROTECTION (_AT(pmdval_t, 1) << 9) /* v5 */
26/*
27 * - section
28 */
29#define PMD_SECT_BUFFERABLE (_AT(pmdval_t, 1) << 2)
30#define PMD_SECT_CACHEABLE (_AT(pmdval_t, 1) << 3)
31#define PMD_SECT_XN (_AT(pmdval_t, 1) << 4) /* v6 */
32#define PMD_SECT_AP_WRITE (_AT(pmdval_t, 1) << 10)
33#define PMD_SECT_AP_READ (_AT(pmdval_t, 1) << 11)
34#define PMD_SECT_TEX(x) (_AT(pmdval_t, (x)) << 12) /* v5 */
35#define PMD_SECT_APX (_AT(pmdval_t, 1) << 15) /* v6 */
36#define PMD_SECT_S (_AT(pmdval_t, 1) << 16) /* v6 */
37#define PMD_SECT_nG (_AT(pmdval_t, 1) << 17) /* v6 */
38#define PMD_SECT_SUPER (_AT(pmdval_t, 1) << 18) /* v6 */
39#define PMD_SECT_AF (_AT(pmdval_t, 0))
40
41#define PMD_SECT_UNCACHED (_AT(pmdval_t, 0))
42#define PMD_SECT_BUFFERED (PMD_SECT_BUFFERABLE)
43#define PMD_SECT_WT (PMD_SECT_CACHEABLE)
44#define PMD_SECT_WB (PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE)
45#define PMD_SECT_MINICACHE (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE)
46#define PMD_SECT_WBWA (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE)
47#define PMD_SECT_NONSHARED_DEV (PMD_SECT_TEX(2))
48
49/*
50 * - coarse table (not used)
51 */
52
53/*
54 * + Level 2 descriptor (PTE)
55 * - common
56 */
57#define PTE_TYPE_MASK (_AT(pteval_t, 3) << 0)
58#define PTE_TYPE_FAULT (_AT(pteval_t, 0) << 0)
59#define PTE_TYPE_LARGE (_AT(pteval_t, 1) << 0)
60#define PTE_TYPE_SMALL (_AT(pteval_t, 2) << 0)
61#define PTE_TYPE_EXT (_AT(pteval_t, 3) << 0) /* v5 */
62#define PTE_BUFFERABLE (_AT(pteval_t, 1) << 2)
63#define PTE_CACHEABLE (_AT(pteval_t, 1) << 3)
64
65/*
66 * - extended small page/tiny page
67 */
68#define PTE_EXT_XN (_AT(pteval_t, 1) << 0) /* v6 */
69#define PTE_EXT_AP_MASK (_AT(pteval_t, 3) << 4)
70#define PTE_EXT_AP0 (_AT(pteval_t, 1) << 4)
71#define PTE_EXT_AP1 (_AT(pteval_t, 2) << 4)
72#define PTE_EXT_AP_UNO_SRO (_AT(pteval_t, 0) << 4)
73#define PTE_EXT_AP_UNO_SRW (PTE_EXT_AP0)
74#define PTE_EXT_AP_URO_SRW (PTE_EXT_AP1)
75#define PTE_EXT_AP_URW_SRW (PTE_EXT_AP1|PTE_EXT_AP0)
76#define PTE_EXT_TEX(x) (_AT(pteval_t, (x)) << 6) /* v5 */
77#define PTE_EXT_APX (_AT(pteval_t, 1) << 9) /* v6 */
78#define PTE_EXT_COHERENT (_AT(pteval_t, 1) << 9) /* XScale3 */
79#define PTE_EXT_SHARED (_AT(pteval_t, 1) << 10) /* v6 */
80#define PTE_EXT_NG (_AT(pteval_t, 1) << 11) /* v6 */
81
82/*
83 * - small page
84 */
85#define PTE_SMALL_AP_MASK (_AT(pteval_t, 0xff) << 4)
86#define PTE_SMALL_AP_UNO_SRO (_AT(pteval_t, 0x00) << 4)
87#define PTE_SMALL_AP_UNO_SRW (_AT(pteval_t, 0x55) << 4)
88#define PTE_SMALL_AP_URO_SRW (_AT(pteval_t, 0xaa) << 4)
89#define PTE_SMALL_AP_URW_SRW (_AT(pteval_t, 0xff) << 4)
90
91#define PHYS_MASK (~0UL)
92
93#endif
diff --git a/arch/arm/include/asm/pgtable-2level-types.h b/arch/arm/include/asm/pgtable-2level-types.h
new file mode 100644
index 000000000000..66cb5b0e89c5
--- /dev/null
+++ b/arch/arm/include/asm/pgtable-2level-types.h
@@ -0,0 +1,67 @@
1/*
2 * arch/arm/include/asm/pgtable-2level-types.h
3 *
4 * Copyright (C) 1995-2003 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19#ifndef _ASM_PGTABLE_2LEVEL_TYPES_H
20#define _ASM_PGTABLE_2LEVEL_TYPES_H
21
22#include <asm/types.h>
23
24typedef u32 pteval_t;
25typedef u32 pmdval_t;
26
27#undef STRICT_MM_TYPECHECKS
28
29#ifdef STRICT_MM_TYPECHECKS
30/*
31 * These are used to make use of C type-checking..
32 */
33typedef struct { pteval_t pte; } pte_t;
34typedef struct { pmdval_t pmd; } pmd_t;
35typedef struct { pmdval_t pgd[2]; } pgd_t;
36typedef struct { pteval_t pgprot; } pgprot_t;
37
38#define pte_val(x) ((x).pte)
39#define pmd_val(x) ((x).pmd)
40#define pgd_val(x) ((x).pgd[0])
41#define pgprot_val(x) ((x).pgprot)
42
43#define __pte(x) ((pte_t) { (x) } )
44#define __pmd(x) ((pmd_t) { (x) } )
45#define __pgprot(x) ((pgprot_t) { (x) } )
46
47#else
48/*
49 * .. while these make it easier on the compiler
50 */
51typedef pteval_t pte_t;
52typedef pmdval_t pmd_t;
53typedef pmdval_t pgd_t[2];
54typedef pteval_t pgprot_t;
55
56#define pte_val(x) (x)
57#define pmd_val(x) (x)
58#define pgd_val(x) ((x)[0])
59#define pgprot_val(x) (x)
60
61#define __pte(x) (x)
62#define __pmd(x) (x)
63#define __pgprot(x) (x)
64
65#endif /* STRICT_MM_TYPECHECKS */
66
67#endif /* _ASM_PGTABLE_2LEVEL_TYPES_H */
diff --git a/arch/arm/include/asm/pgtable-2level.h b/arch/arm/include/asm/pgtable-2level.h
new file mode 100644
index 000000000000..470457e1cfc5
--- /dev/null
+++ b/arch/arm/include/asm/pgtable-2level.h
@@ -0,0 +1,143 @@
1/*
2 * arch/arm/include/asm/pgtable-2level.h
3 *
4 * Copyright (C) 1995-2002 Russell King
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10#ifndef _ASM_PGTABLE_2LEVEL_H
11#define _ASM_PGTABLE_2LEVEL_H
12
13/*
14 * Hardware-wise, we have a two level page table structure, where the first
15 * level has 4096 entries, and the second level has 256 entries. Each entry
16 * is one 32-bit word. Most of the bits in the second level entry are used
17 * by hardware, and there aren't any "accessed" and "dirty" bits.
18 *
19 * Linux on the other hand has a three level page table structure, which can
20 * be wrapped to fit a two level page table structure easily - using the PGD
21 * and PTE only. However, Linux also expects one "PTE" table per page, and
22 * at least a "dirty" bit.
23 *
24 * Therefore, we tweak the implementation slightly - we tell Linux that we
25 * have 2048 entries in the first level, each of which is 8 bytes (iow, two
26 * hardware pointers to the second level.) The second level contains two
27 * hardware PTE tables arranged contiguously, preceded by Linux versions
28 * which contain the state information Linux needs. We, therefore, end up
29 * with 512 entries in the "PTE" level.
30 *
31 * This leads to the page tables having the following layout:
32 *
33 * pgd pte
34 * | |
35 * +--------+
36 * | | +------------+ +0
37 * +- - - - + | Linux pt 0 |
38 * | | +------------+ +1024
39 * +--------+ +0 | Linux pt 1 |
40 * | |-----> +------------+ +2048
41 * +- - - - + +4 | h/w pt 0 |
42 * | |-----> +------------+ +3072
43 * +--------+ +8 | h/w pt 1 |
44 * | | +------------+ +4096
45 *
46 * See L_PTE_xxx below for definitions of bits in the "Linux pt", and
47 * PTE_xxx for definitions of bits appearing in the "h/w pt".
48 *
49 * PMD_xxx definitions refer to bits in the first level page table.
50 *
51 * The "dirty" bit is emulated by only granting hardware write permission
52 * iff the page is marked "writable" and "dirty" in the Linux PTE. This
53 * means that a write to a clean page will cause a permission fault, and
54 * the Linux MM layer will mark the page dirty via handle_pte_fault().
55 * For the hardware to notice the permission change, the TLB entry must
56 * be flushed, and ptep_set_access_flags() does that for us.
57 *
58 * The "accessed" or "young" bit is emulated by a similar method; we only
59 * allow accesses to the page if the "young" bit is set. Accesses to the
60 * page will cause a fault, and handle_pte_fault() will set the young bit
61 * for us as long as the page is marked present in the corresponding Linux
62 * PTE entry. Again, ptep_set_access_flags() will ensure that the TLB is
63 * up to date.
64 *
65 * However, when the "young" bit is cleared, we deny access to the page
66 * by clearing the hardware PTE. Currently Linux does not flush the TLB
67 * for us in this case, which means the TLB will retain the transation
68 * until either the TLB entry is evicted under pressure, or a context
69 * switch which changes the user space mapping occurs.
70 */
71#define PTRS_PER_PTE 512
72#define PTRS_PER_PMD 1
73#define PTRS_PER_PGD 2048
74
75#define PTE_HWTABLE_PTRS (PTRS_PER_PTE)
76#define PTE_HWTABLE_OFF (PTE_HWTABLE_PTRS * sizeof(pte_t))
77#define PTE_HWTABLE_SIZE (PTRS_PER_PTE * sizeof(u32))
78
79/*
80 * PMD_SHIFT determines the size of the area a second-level page table can map
81 * PGDIR_SHIFT determines what a third-level page table entry can map
82 */
83#define PMD_SHIFT 21
84#define PGDIR_SHIFT 21
85
86#define PMD_SIZE (1UL << PMD_SHIFT)
87#define PMD_MASK (~(PMD_SIZE-1))
88#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
89#define PGDIR_MASK (~(PGDIR_SIZE-1))
90
91/*
92 * section address mask and size definitions.
93 */
94#define SECTION_SHIFT 20
95#define SECTION_SIZE (1UL << SECTION_SHIFT)
96#define SECTION_MASK (~(SECTION_SIZE-1))
97
98/*
99 * ARMv6 supersection address mask and size definitions.
100 */
101#define SUPERSECTION_SHIFT 24
102#define SUPERSECTION_SIZE (1UL << SUPERSECTION_SHIFT)
103#define SUPERSECTION_MASK (~(SUPERSECTION_SIZE-1))
104
105#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE)
106
107/*
108 * "Linux" PTE definitions.
109 *
110 * We keep two sets of PTEs - the hardware and the linux version.
111 * This allows greater flexibility in the way we map the Linux bits
112 * onto the hardware tables, and allows us to have YOUNG and DIRTY
113 * bits.
114 *
115 * The PTE table pointer refers to the hardware entries; the "Linux"
116 * entries are stored 1024 bytes below.
117 */
118#define L_PTE_PRESENT (_AT(pteval_t, 1) << 0)
119#define L_PTE_YOUNG (_AT(pteval_t, 1) << 1)
120#define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */
121#define L_PTE_DIRTY (_AT(pteval_t, 1) << 6)
122#define L_PTE_RDONLY (_AT(pteval_t, 1) << 7)
123#define L_PTE_USER (_AT(pteval_t, 1) << 8)
124#define L_PTE_XN (_AT(pteval_t, 1) << 9)
125#define L_PTE_SHARED (_AT(pteval_t, 1) << 10) /* shared(v6), coherent(xsc3) */
126
127/*
128 * These are the memory types, defined to be compatible with
129 * pre-ARMv6 CPUs cacheable and bufferable bits: XXCB
130 */
131#define L_PTE_MT_UNCACHED (_AT(pteval_t, 0x00) << 2) /* 0000 */
132#define L_PTE_MT_BUFFERABLE (_AT(pteval_t, 0x01) << 2) /* 0001 */
133#define L_PTE_MT_WRITETHROUGH (_AT(pteval_t, 0x02) << 2) /* 0010 */
134#define L_PTE_MT_WRITEBACK (_AT(pteval_t, 0x03) << 2) /* 0011 */
135#define L_PTE_MT_MINICACHE (_AT(pteval_t, 0x06) << 2) /* 0110 (sa1100, xscale) */
136#define L_PTE_MT_WRITEALLOC (_AT(pteval_t, 0x07) << 2) /* 0111 */
137#define L_PTE_MT_DEV_SHARED (_AT(pteval_t, 0x04) << 2) /* 0100 */
138#define L_PTE_MT_DEV_NONSHARED (_AT(pteval_t, 0x0c) << 2) /* 1100 */
139#define L_PTE_MT_DEV_WC (_AT(pteval_t, 0x09) << 2) /* 1001 */
140#define L_PTE_MT_DEV_CACHED (_AT(pteval_t, 0x0b) << 2) /* 1011 */
141#define L_PTE_MT_MASK (_AT(pteval_t, 0x0f) << 2)
142
143#endif /* _ASM_PGTABLE_2LEVEL_H */
diff --git a/arch/arm/include/asm/pgtable-hwdef.h b/arch/arm/include/asm/pgtable-hwdef.h
index fd1521d5cb9d..183111164ce9 100644
--- a/arch/arm/include/asm/pgtable-hwdef.h
+++ b/arch/arm/include/asm/pgtable-hwdef.h
@@ -10,81 +10,6 @@
10#ifndef _ASMARM_PGTABLE_HWDEF_H 10#ifndef _ASMARM_PGTABLE_HWDEF_H
11#define _ASMARM_PGTABLE_HWDEF_H 11#define _ASMARM_PGTABLE_HWDEF_H
12 12
13/* 13#include <asm/pgtable-2level-hwdef.h>
14 * Hardware page table definitions.
15 *
16 * + Level 1 descriptor (PMD)
17 * - common
18 */
19#define PMD_TYPE_MASK (3 << 0)
20#define PMD_TYPE_FAULT (0 << 0)
21#define PMD_TYPE_TABLE (1 << 0)
22#define PMD_TYPE_SECT (2 << 0)
23#define PMD_BIT4 (1 << 4)
24#define PMD_DOMAIN(x) ((x) << 5)
25#define PMD_PROTECTION (1 << 9) /* v5 */
26/*
27 * - section
28 */
29#define PMD_SECT_BUFFERABLE (1 << 2)
30#define PMD_SECT_CACHEABLE (1 << 3)
31#define PMD_SECT_XN (1 << 4) /* v6 */
32#define PMD_SECT_AP_WRITE (1 << 10)
33#define PMD_SECT_AP_READ (1 << 11)
34#define PMD_SECT_TEX(x) ((x) << 12) /* v5 */
35#define PMD_SECT_APX (1 << 15) /* v6 */
36#define PMD_SECT_S (1 << 16) /* v6 */
37#define PMD_SECT_nG (1 << 17) /* v6 */
38#define PMD_SECT_SUPER (1 << 18) /* v6 */
39
40#define PMD_SECT_UNCACHED (0)
41#define PMD_SECT_BUFFERED (PMD_SECT_BUFFERABLE)
42#define PMD_SECT_WT (PMD_SECT_CACHEABLE)
43#define PMD_SECT_WB (PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE)
44#define PMD_SECT_MINICACHE (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE)
45#define PMD_SECT_WBWA (PMD_SECT_TEX(1) | PMD_SECT_CACHEABLE | PMD_SECT_BUFFERABLE)
46#define PMD_SECT_NONSHARED_DEV (PMD_SECT_TEX(2))
47
48/*
49 * - coarse table (not used)
50 */
51
52/*
53 * + Level 2 descriptor (PTE)
54 * - common
55 */
56#define PTE_TYPE_MASK (3 << 0)
57#define PTE_TYPE_FAULT (0 << 0)
58#define PTE_TYPE_LARGE (1 << 0)
59#define PTE_TYPE_SMALL (2 << 0)
60#define PTE_TYPE_EXT (3 << 0) /* v5 */
61#define PTE_BUFFERABLE (1 << 2)
62#define PTE_CACHEABLE (1 << 3)
63
64/*
65 * - extended small page/tiny page
66 */
67#define PTE_EXT_XN (1 << 0) /* v6 */
68#define PTE_EXT_AP_MASK (3 << 4)
69#define PTE_EXT_AP0 (1 << 4)
70#define PTE_EXT_AP1 (2 << 4)
71#define PTE_EXT_AP_UNO_SRO (0 << 4)
72#define PTE_EXT_AP_UNO_SRW (PTE_EXT_AP0)
73#define PTE_EXT_AP_URO_SRW (PTE_EXT_AP1)
74#define PTE_EXT_AP_URW_SRW (PTE_EXT_AP1|PTE_EXT_AP0)
75#define PTE_EXT_TEX(x) ((x) << 6) /* v5 */
76#define PTE_EXT_APX (1 << 9) /* v6 */
77#define PTE_EXT_COHERENT (1 << 9) /* XScale3 */
78#define PTE_EXT_SHARED (1 << 10) /* v6 */
79#define PTE_EXT_NG (1 << 11) /* v6 */
80
81/*
82 * - small page
83 */
84#define PTE_SMALL_AP_MASK (0xff << 4)
85#define PTE_SMALL_AP_UNO_SRO (0x00 << 4)
86#define PTE_SMALL_AP_UNO_SRW (0x55 << 4)
87#define PTE_SMALL_AP_URO_SRW (0xaa << 4)
88#define PTE_SMALL_AP_URW_SRW (0xff << 4)
89 14
90#endif 15#endif
diff --git a/arch/arm/include/asm/pgtable.h b/arch/arm/include/asm/pgtable.h
index f1956b27ae5a..9451dce3a553 100644
--- a/arch/arm/include/asm/pgtable.h
+++ b/arch/arm/include/asm/pgtable.h
@@ -24,6 +24,8 @@
24#include <mach/vmalloc.h> 24#include <mach/vmalloc.h>
25#include <asm/pgtable-hwdef.h> 25#include <asm/pgtable-hwdef.h>
26 26
27#include <asm/pgtable-2level.h>
28
27/* 29/*
28 * Just any arbitrary offset to the start of the vmalloc VM area: the 30 * Just any arbitrary offset to the start of the vmalloc VM area: the
29 * current 8MB value just means that there will be a 8MB "hole" after the 31 * current 8MB value just means that there will be a 8MB "hole" after the
@@ -41,79 +43,6 @@
41#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1)) 43#define VMALLOC_START (((unsigned long)high_memory + VMALLOC_OFFSET) & ~(VMALLOC_OFFSET-1))
42#endif 44#endif
43 45
44/*
45 * Hardware-wise, we have a two level page table structure, where the first
46 * level has 4096 entries, and the second level has 256 entries. Each entry
47 * is one 32-bit word. Most of the bits in the second level entry are used
48 * by hardware, and there aren't any "accessed" and "dirty" bits.
49 *
50 * Linux on the other hand has a three level page table structure, which can
51 * be wrapped to fit a two level page table structure easily - using the PGD
52 * and PTE only. However, Linux also expects one "PTE" table per page, and
53 * at least a "dirty" bit.
54 *
55 * Therefore, we tweak the implementation slightly - we tell Linux that we
56 * have 2048 entries in the first level, each of which is 8 bytes (iow, two
57 * hardware pointers to the second level.) The second level contains two
58 * hardware PTE tables arranged contiguously, preceded by Linux versions
59 * which contain the state information Linux needs. We, therefore, end up
60 * with 512 entries in the "PTE" level.
61 *
62 * This leads to the page tables having the following layout:
63 *
64 * pgd pte
65 * | |
66 * +--------+
67 * | | +------------+ +0
68 * +- - - - + | Linux pt 0 |
69 * | | +------------+ +1024
70 * +--------+ +0 | Linux pt 1 |
71 * | |-----> +------------+ +2048
72 * +- - - - + +4 | h/w pt 0 |
73 * | |-----> +------------+ +3072
74 * +--------+ +8 | h/w pt 1 |
75 * | | +------------+ +4096
76 *
77 * See L_PTE_xxx below for definitions of bits in the "Linux pt", and
78 * PTE_xxx for definitions of bits appearing in the "h/w pt".
79 *
80 * PMD_xxx definitions refer to bits in the first level page table.
81 *
82 * The "dirty" bit is emulated by only granting hardware write permission
83 * iff the page is marked "writable" and "dirty" in the Linux PTE. This
84 * means that a write to a clean page will cause a permission fault, and
85 * the Linux MM layer will mark the page dirty via handle_pte_fault().
86 * For the hardware to notice the permission change, the TLB entry must
87 * be flushed, and ptep_set_access_flags() does that for us.
88 *
89 * The "accessed" or "young" bit is emulated by a similar method; we only
90 * allow accesses to the page if the "young" bit is set. Accesses to the
91 * page will cause a fault, and handle_pte_fault() will set the young bit
92 * for us as long as the page is marked present in the corresponding Linux
93 * PTE entry. Again, ptep_set_access_flags() will ensure that the TLB is
94 * up to date.
95 *
96 * However, when the "young" bit is cleared, we deny access to the page
97 * by clearing the hardware PTE. Currently Linux does not flush the TLB
98 * for us in this case, which means the TLB will retain the transation
99 * until either the TLB entry is evicted under pressure, or a context
100 * switch which changes the user space mapping occurs.
101 */
102#define PTRS_PER_PTE 512
103#define PTRS_PER_PMD 1
104#define PTRS_PER_PGD 2048
105
106#define PTE_HWTABLE_PTRS (PTRS_PER_PTE)
107#define PTE_HWTABLE_OFF (PTE_HWTABLE_PTRS * sizeof(pte_t))
108#define PTE_HWTABLE_SIZE (PTRS_PER_PTE * sizeof(u32))
109
110/*
111 * PMD_SHIFT determines the size of the area a second-level page table can map
112 * PGDIR_SHIFT determines what a third-level page table entry can map
113 */
114#define PMD_SHIFT 21
115#define PGDIR_SHIFT 21
116
117#define LIBRARY_TEXT_START 0x0c000000 46#define LIBRARY_TEXT_START 0x0c000000
118 47
119#ifndef __ASSEMBLY__ 48#ifndef __ASSEMBLY__
@@ -124,12 +53,6 @@ extern void __pgd_error(const char *file, int line, pgd_t);
124#define pte_ERROR(pte) __pte_error(__FILE__, __LINE__, pte) 53#define pte_ERROR(pte) __pte_error(__FILE__, __LINE__, pte)
125#define pmd_ERROR(pmd) __pmd_error(__FILE__, __LINE__, pmd) 54#define pmd_ERROR(pmd) __pmd_error(__FILE__, __LINE__, pmd)
126#define pgd_ERROR(pgd) __pgd_error(__FILE__, __LINE__, pgd) 55#define pgd_ERROR(pgd) __pgd_error(__FILE__, __LINE__, pgd)
127#endif /* !__ASSEMBLY__ */
128
129#define PMD_SIZE (1UL << PMD_SHIFT)
130#define PMD_MASK (~(PMD_SIZE-1))
131#define PGDIR_SIZE (1UL << PGDIR_SHIFT)
132#define PGDIR_MASK (~(PGDIR_SIZE-1))
133 56
134/* 57/*
135 * This is the lowest virtual address we can permit any user space 58 * This is the lowest virtual address we can permit any user space
@@ -138,60 +61,6 @@ extern void __pgd_error(const char *file, int line, pgd_t);
138 */ 61 */
139#define FIRST_USER_ADDRESS PAGE_SIZE 62#define FIRST_USER_ADDRESS PAGE_SIZE
140 63
141#define USER_PTRS_PER_PGD (TASK_SIZE / PGDIR_SIZE)
142
143/*
144 * section address mask and size definitions.
145 */
146#define SECTION_SHIFT 20
147#define SECTION_SIZE (1UL << SECTION_SHIFT)
148#define SECTION_MASK (~(SECTION_SIZE-1))
149
150/*
151 * ARMv6 supersection address mask and size definitions.
152 */
153#define SUPERSECTION_SHIFT 24
154#define SUPERSECTION_SIZE (1UL << SUPERSECTION_SHIFT)
155#define SUPERSECTION_MASK (~(SUPERSECTION_SIZE-1))
156
157/*
158 * "Linux" PTE definitions.
159 *
160 * We keep two sets of PTEs - the hardware and the linux version.
161 * This allows greater flexibility in the way we map the Linux bits
162 * onto the hardware tables, and allows us to have YOUNG and DIRTY
163 * bits.
164 *
165 * The PTE table pointer refers to the hardware entries; the "Linux"
166 * entries are stored 1024 bytes below.
167 */
168#define L_PTE_PRESENT (_AT(pteval_t, 1) << 0)
169#define L_PTE_YOUNG (_AT(pteval_t, 1) << 1)
170#define L_PTE_FILE (_AT(pteval_t, 1) << 2) /* only when !PRESENT */
171#define L_PTE_DIRTY (_AT(pteval_t, 1) << 6)
172#define L_PTE_RDONLY (_AT(pteval_t, 1) << 7)
173#define L_PTE_USER (_AT(pteval_t, 1) << 8)
174#define L_PTE_XN (_AT(pteval_t, 1) << 9)
175#define L_PTE_SHARED (_AT(pteval_t, 1) << 10) /* shared(v6), coherent(xsc3) */
176
177/*
178 * These are the memory types, defined to be compatible with
179 * pre-ARMv6 CPUs cacheable and bufferable bits: XXCB
180 */
181#define L_PTE_MT_UNCACHED (_AT(pteval_t, 0x00) << 2) /* 0000 */
182#define L_PTE_MT_BUFFERABLE (_AT(pteval_t, 0x01) << 2) /* 0001 */
183#define L_PTE_MT_WRITETHROUGH (_AT(pteval_t, 0x02) << 2) /* 0010 */
184#define L_PTE_MT_WRITEBACK (_AT(pteval_t, 0x03) << 2) /* 0011 */
185#define L_PTE_MT_MINICACHE (_AT(pteval_t, 0x06) << 2) /* 0110 (sa1100, xscale) */
186#define L_PTE_MT_WRITEALLOC (_AT(pteval_t, 0x07) << 2) /* 0111 */
187#define L_PTE_MT_DEV_SHARED (_AT(pteval_t, 0x04) << 2) /* 0100 */
188#define L_PTE_MT_DEV_NONSHARED (_AT(pteval_t, 0x0c) << 2) /* 1100 */
189#define L_PTE_MT_DEV_WC (_AT(pteval_t, 0x09) << 2) /* 1001 */
190#define L_PTE_MT_DEV_CACHED (_AT(pteval_t, 0x0b) << 2) /* 1011 */
191#define L_PTE_MT_MASK (_AT(pteval_t, 0x0f) << 2)
192
193#ifndef __ASSEMBLY__
194
195/* 64/*
196 * The pgprot_* and protection_map entries will be fixed up in runtime 65 * The pgprot_* and protection_map entries will be fixed up in runtime
197 * to include the cachable and bufferable bits based on memory policy, 66 * to include the cachable and bufferable bits based on memory policy,
@@ -330,10 +199,10 @@ extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
330 199
331static inline pte_t *pmd_page_vaddr(pmd_t pmd) 200static inline pte_t *pmd_page_vaddr(pmd_t pmd)
332{ 201{
333 return __va(pmd_val(pmd) & PAGE_MASK); 202 return __va(pmd_val(pmd) & PHYS_MASK & (s32)PAGE_MASK);
334} 203}
335 204
336#define pmd_page(pmd) pfn_to_page(__phys_to_pfn(pmd_val(pmd))) 205#define pmd_page(pmd) pfn_to_page(__phys_to_pfn(pmd_val(pmd) & PHYS_MASK))
337 206
338/* we don't need complex calculations here as the pmd is folded into the pgd */ 207/* we don't need complex calculations here as the pmd is folded into the pgd */
339#define pmd_addr_end(addr,end) (end) 208#define pmd_addr_end(addr,end) (end)
@@ -354,7 +223,7 @@ static inline pte_t *pmd_page_vaddr(pmd_t pmd)
354#define pte_offset_map(pmd,addr) (__pte_map(pmd) + pte_index(addr)) 223#define pte_offset_map(pmd,addr) (__pte_map(pmd) + pte_index(addr))
355#define pte_unmap(pte) __pte_unmap(pte) 224#define pte_unmap(pte) __pte_unmap(pte)
356 225
357#define pte_pfn(pte) (pte_val(pte) >> PAGE_SHIFT) 226#define pte_pfn(pte) ((pte_val(pte) & PHYS_MASK) >> PAGE_SHIFT)
358#define pfn_pte(pfn,prot) __pte(__pfn_to_phys(pfn) | pgprot_val(prot)) 227#define pfn_pte(pfn,prot) __pte(__pfn_to_phys(pfn) | pgprot_val(prot))
359 228
360#define pte_page(pte) pfn_to_page(pte_pfn(pte)) 229#define pte_page(pte) pfn_to_page(pte_pfn(pte))
diff --git a/arch/arm/include/asm/poll.h b/arch/arm/include/asm/poll.h
deleted file mode 100644
index c98509d3149e..000000000000
--- a/arch/arm/include/asm/poll.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/poll.h>
diff --git a/arch/arm/include/asm/resource.h b/arch/arm/include/asm/resource.h
deleted file mode 100644
index 734b581b5b6a..000000000000
--- a/arch/arm/include/asm/resource.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ARM_RESOURCE_H
2#define _ARM_RESOURCE_H
3
4#include <asm-generic/resource.h>
5
6#endif
diff --git a/arch/arm/include/asm/sections.h b/arch/arm/include/asm/sections.h
deleted file mode 100644
index 2b8c5160388f..000000000000
--- a/arch/arm/include/asm/sections.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/sections.h>
diff --git a/arch/arm/include/asm/siginfo.h b/arch/arm/include/asm/siginfo.h
deleted file mode 100644
index 5e21852e6039..000000000000
--- a/arch/arm/include/asm/siginfo.h
+++ /dev/null
@@ -1,6 +0,0 @@
1#ifndef _ASMARM_SIGINFO_H
2#define _ASMARM_SIGINFO_H
3
4#include <asm-generic/siginfo.h>
5
6#endif
diff --git a/arch/arm/include/asm/sizes.h b/arch/arm/include/asm/sizes.h
deleted file mode 100644
index 154b89b81d3e..000000000000
--- a/arch/arm/include/asm/sizes.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * This program is free software; you can redistribute it and/or modify
3 * it under the terms of the GNU General Public License as published by
4 * the Free Software Foundation; either version 2 of the License, or
5 * (at your option) any later version.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 */
16/* Size definitions
17 * Copyright (C) ARM Limited 1998. All rights reserved.
18 */
19#include <asm-generic/sizes.h>
20
21#define SZ_48M (SZ_32M + SZ_16M)
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index ed6b0499a106..984014b92647 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -57,6 +57,7 @@
57 57
58#ifndef __ASSEMBLY__ 58#ifndef __ASSEMBLY__
59 59
60#include <linux/compiler.h>
60#include <linux/linkage.h> 61#include <linux/linkage.h>
61#include <linux/irqflags.h> 62#include <linux/irqflags.h>
62 63
@@ -90,14 +91,13 @@ void hook_ifault_code(int nr, int (*fn)(unsigned long, unsigned int,
90#define xchg(ptr,x) \ 91#define xchg(ptr,x) \
91 ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) 92 ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
92 93
93extern asmlinkage void __backtrace(void);
94extern asmlinkage void c_backtrace(unsigned long fp, int pmode); 94extern asmlinkage void c_backtrace(unsigned long fp, int pmode);
95 95
96struct mm_struct; 96struct mm_struct;
97extern void show_pte(struct mm_struct *mm, unsigned long addr); 97extern void show_pte(struct mm_struct *mm, unsigned long addr);
98extern void __show_regs(struct pt_regs *); 98extern void __show_regs(struct pt_regs *);
99 99
100extern int cpu_architecture(void); 100extern int __pure cpu_architecture(void);
101extern void cpu_init(void); 101extern void cpu_init(void);
102 102
103void arm_machine_restart(char mode, const char *cmd); 103void arm_machine_restart(char mode, const char *cmd);
diff --git a/arch/arm/include/asm/tlbflush.h b/arch/arm/include/asm/tlbflush.h
index 8077145698ff..02b2f8203982 100644
--- a/arch/arm/include/asm/tlbflush.h
+++ b/arch/arm/include/asm/tlbflush.h
@@ -471,7 +471,7 @@ static inline void local_flush_tlb_kernel_page(unsigned long kaddr)
471 * these operations. This is typically used when we are removing 471 * these operations. This is typically used when we are removing
472 * PMD entries. 472 * PMD entries.
473 */ 473 */
474static inline void flush_pmd_entry(pmd_t *pmd) 474static inline void flush_pmd_entry(void *pmd)
475{ 475{
476 const unsigned int __tlb_flag = __cpu_tlb_flags; 476 const unsigned int __tlb_flag = __cpu_tlb_flags;
477 477
@@ -487,7 +487,7 @@ static inline void flush_pmd_entry(pmd_t *pmd)
487 dsb(); 487 dsb();
488} 488}
489 489
490static inline void clean_pmd_entry(pmd_t *pmd) 490static inline void clean_pmd_entry(void *pmd)
491{ 491{
492 const unsigned int __tlb_flag = __cpu_tlb_flags; 492 const unsigned int __tlb_flag = __cpu_tlb_flags;
493 493
diff --git a/arch/arm/include/asm/unistd.h b/arch/arm/include/asm/unistd.h
index 2c04ed5efeb5..c60a2944f95b 100644
--- a/arch/arm/include/asm/unistd.h
+++ b/arch/arm/include/asm/unistd.h
@@ -478,8 +478,8 @@
478/* 478/*
479 * Unimplemented (or alternatively implemented) syscalls 479 * Unimplemented (or alternatively implemented) syscalls
480 */ 480 */
481#define __IGNORE_fadvise64_64 1 481#define __IGNORE_fadvise64_64
482#define __IGNORE_migrate_pages 1 482#define __IGNORE_migrate_pages
483 483
484#endif /* __KERNEL__ */ 484#endif /* __KERNEL__ */
485#endif /* __ASM_ARM_UNISTD_H */ 485#endif /* __ASM_ARM_UNISTD_H */
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index 7cac26c5f502..16eed6aebfa4 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -29,7 +29,7 @@ obj-$(CONFIG_MODULES) += armksyms.o module.o
29obj-$(CONFIG_ARTHUR) += arthur.o 29obj-$(CONFIG_ARTHUR) += arthur.o
30obj-$(CONFIG_ISA_DMA) += dma-isa.o 30obj-$(CONFIG_ISA_DMA) += dma-isa.o
31obj-$(CONFIG_PCI) += bios32.o isa.o 31obj-$(CONFIG_PCI) += bios32.o isa.o
32obj-$(CONFIG_PM_SLEEP) += sleep.o suspend.o 32obj-$(CONFIG_ARM_CPU_SUSPEND) += sleep.o suspend.o
33obj-$(CONFIG_HAVE_SCHED_CLOCK) += sched_clock.o 33obj-$(CONFIG_HAVE_SCHED_CLOCK) += sched_clock.o
34obj-$(CONFIG_SMP) += smp.o smp_tlb.o 34obj-$(CONFIG_SMP) += smp.o smp_tlb.o
35obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o 35obj-$(CONFIG_HAVE_ARM_SCU) += smp_scu.o
diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c
index aeef960ff795..8e3c6f11b0a1 100644
--- a/arch/arm/kernel/armksyms.c
+++ b/arch/arm/kernel/armksyms.c
@@ -49,9 +49,6 @@ extern void __aeabi_ulcmp(void);
49 49
50extern void fpundefinstr(void); 50extern void fpundefinstr(void);
51 51
52
53EXPORT_SYMBOL(__backtrace);
54
55 /* platform dependent support */ 52 /* platform dependent support */
56EXPORT_SYMBOL(__udelay); 53EXPORT_SYMBOL(__udelay);
57EXPORT_SYMBOL(__const_udelay); 54EXPORT_SYMBOL(__const_udelay);
diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c
index 16baba2e4369..1429d8989fb9 100644
--- a/arch/arm/kernel/asm-offsets.c
+++ b/arch/arm/kernel/asm-offsets.c
@@ -20,6 +20,7 @@
20#include <asm/thread_info.h> 20#include <asm/thread_info.h>
21#include <asm/memory.h> 21#include <asm/memory.h>
22#include <asm/procinfo.h> 22#include <asm/procinfo.h>
23#include <asm/hardware/cache-l2x0.h>
23#include <linux/kbuild.h> 24#include <linux/kbuild.h>
24 25
25/* 26/*
@@ -92,6 +93,17 @@ int main(void)
92 DEFINE(S_OLD_R0, offsetof(struct pt_regs, ARM_ORIG_r0)); 93 DEFINE(S_OLD_R0, offsetof(struct pt_regs, ARM_ORIG_r0));
93 DEFINE(S_FRAME_SIZE, sizeof(struct pt_regs)); 94 DEFINE(S_FRAME_SIZE, sizeof(struct pt_regs));
94 BLANK(); 95 BLANK();
96#ifdef CONFIG_CACHE_L2X0
97 DEFINE(L2X0_R_PHY_BASE, offsetof(struct l2x0_regs, phy_base));
98 DEFINE(L2X0_R_AUX_CTRL, offsetof(struct l2x0_regs, aux_ctrl));
99 DEFINE(L2X0_R_TAG_LATENCY, offsetof(struct l2x0_regs, tag_latency));
100 DEFINE(L2X0_R_DATA_LATENCY, offsetof(struct l2x0_regs, data_latency));
101 DEFINE(L2X0_R_FILTER_START, offsetof(struct l2x0_regs, filter_start));
102 DEFINE(L2X0_R_FILTER_END, offsetof(struct l2x0_regs, filter_end));
103 DEFINE(L2X0_R_PREFETCH_CTRL, offsetof(struct l2x0_regs, prefetch_ctrl));
104 DEFINE(L2X0_R_PWR_CTRL, offsetof(struct l2x0_regs, pwr_ctrl));
105 BLANK();
106#endif
95#ifdef CONFIG_CPU_HAS_ASID 107#ifdef CONFIG_CPU_HAS_ASID
96 DEFINE(MM_CONTEXT_ID, offsetof(struct mm_struct, context.id)); 108 DEFINE(MM_CONTEXT_ID, offsetof(struct mm_struct, context.id));
97 BLANK(); 109 BLANK();
diff --git a/arch/arm/kernel/bios32.c b/arch/arm/kernel/bios32.c
index d6df359408f0..c0d9203fc75e 100644
--- a/arch/arm/kernel/bios32.c
+++ b/arch/arm/kernel/bios32.c
@@ -412,6 +412,9 @@ void pcibios_fixup_bus(struct pci_bus *bus)
412 printk(KERN_INFO "PCI: bus%d: Fast back to back transfers %sabled\n", 412 printk(KERN_INFO "PCI: bus%d: Fast back to back transfers %sabled\n",
413 bus->number, (features & PCI_COMMAND_FAST_BACK) ? "en" : "dis"); 413 bus->number, (features & PCI_COMMAND_FAST_BACK) ? "en" : "dis");
414} 414}
415#ifdef CONFIG_HOTPLUG
416EXPORT_SYMBOL(pcibios_fixup_bus);
417#endif
415 418
416/* 419/*
417 * Convert from Linux-centric to bus-centric addresses for bridge devices. 420 * Convert from Linux-centric to bus-centric addresses for bridge devices.
@@ -431,6 +434,7 @@ pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,
431 region->start = res->start - offset; 434 region->start = res->start - offset;
432 region->end = res->end - offset; 435 region->end = res->end - offset;
433} 436}
437EXPORT_SYMBOL(pcibios_resource_to_bus);
434 438
435void __devinit 439void __devinit
436pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res, 440pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
@@ -447,12 +451,7 @@ pcibios_bus_to_resource(struct pci_dev *dev, struct resource *res,
447 res->start = region->start + offset; 451 res->start = region->start + offset;
448 res->end = region->end + offset; 452 res->end = region->end + offset;
449} 453}
450
451#ifdef CONFIG_HOTPLUG
452EXPORT_SYMBOL(pcibios_fixup_bus);
453EXPORT_SYMBOL(pcibios_resource_to_bus);
454EXPORT_SYMBOL(pcibios_bus_to_resource); 454EXPORT_SYMBOL(pcibios_bus_to_resource);
455#endif
456 455
457/* 456/*
458 * Swizzle the device pin each time we cross a bridge. 457 * Swizzle the device pin each time we cross a bridge.
diff --git a/arch/arm/kernel/debug.S b/arch/arm/kernel/debug.S
index b7685f1bb04a..204e2160cfcc 100644
--- a/arch/arm/kernel/debug.S
+++ b/arch/arm/kernel/debug.S
@@ -151,6 +151,8 @@ printhex: adr r2, hexbuf
151 b printascii 151 b printascii
152ENDPROC(printhex2) 152ENDPROC(printhex2)
153 153
154hexbuf: .space 16
155
154 .ltorg 156 .ltorg
155 157
156ENTRY(printascii) 158ENTRY(printascii)
@@ -175,5 +177,3 @@ ENTRY(printch)
175 mov r0, #0 177 mov r0, #0
176 b 1b 178 b 1b
177ENDPROC(printch) 179ENDPROC(printch)
178
179hexbuf: .space 16
diff --git a/arch/arm/kernel/dma.c b/arch/arm/kernel/dma.c
index 2c4a185f92cd..7b829d9663b1 100644
--- a/arch/arm/kernel/dma.c
+++ b/arch/arm/kernel/dma.c
@@ -23,7 +23,7 @@
23 23
24#include <asm/mach/dma.h> 24#include <asm/mach/dma.h>
25 25
26DEFINE_SPINLOCK(dma_spin_lock); 26DEFINE_RAW_SPINLOCK(dma_spin_lock);
27EXPORT_SYMBOL(dma_spin_lock); 27EXPORT_SYMBOL(dma_spin_lock);
28 28
29static dma_t *dma_chan[MAX_DMA_CHANNELS]; 29static dma_t *dma_chan[MAX_DMA_CHANNELS];
diff --git a/arch/arm/kernel/ecard.c b/arch/arm/kernel/ecard.c
index d16500110ee9..4dd0edab6a65 100644
--- a/arch/arm/kernel/ecard.c
+++ b/arch/arm/kernel/ecard.c
@@ -237,7 +237,7 @@ static void ecard_init_pgtables(struct mm_struct *mm)
237 237
238 memcpy(dst_pgd, src_pgd, sizeof(pgd_t) * (IO_SIZE / PGDIR_SIZE)); 238 memcpy(dst_pgd, src_pgd, sizeof(pgd_t) * (IO_SIZE / PGDIR_SIZE));
239 239
240 src_pgd = pgd_offset(mm, EASI_BASE); 240 src_pgd = pgd_offset(mm, (unsigned long)EASI_BASE);
241 dst_pgd = pgd_offset(mm, EASI_START); 241 dst_pgd = pgd_offset(mm, EASI_START);
242 242
243 memcpy(dst_pgd, src_pgd, sizeof(pgd_t) * (EASI_SIZE / PGDIR_SIZE)); 243 memcpy(dst_pgd, src_pgd, sizeof(pgd_t) * (EASI_SIZE / PGDIR_SIZE));
@@ -674,44 +674,37 @@ static int __init ecard_probeirqhw(void)
674#define ecard_probeirqhw() (0) 674#define ecard_probeirqhw() (0)
675#endif 675#endif
676 676
677#ifndef IO_EC_MEMC8_BASE 677static void __iomem *__ecard_address(ecard_t *ec, card_type_t type, card_speed_t speed)
678#define IO_EC_MEMC8_BASE 0
679#endif
680
681static unsigned int __ecard_address(ecard_t *ec, card_type_t type, card_speed_t speed)
682{ 678{
683 unsigned long address = 0; 679 void __iomem *address = NULL;
684 int slot = ec->slot_no; 680 int slot = ec->slot_no;
685 681
686 if (ec->slot_no == 8) 682 if (ec->slot_no == 8)
687 return IO_EC_MEMC8_BASE; 683 return ECARD_MEMC8_BASE;
688 684
689 ectcr &= ~(1 << slot); 685 ectcr &= ~(1 << slot);
690 686
691 switch (type) { 687 switch (type) {
692 case ECARD_MEMC: 688 case ECARD_MEMC:
693 if (slot < 4) 689 if (slot < 4)
694 address = IO_EC_MEMC_BASE + (slot << 12); 690 address = ECARD_MEMC_BASE + (slot << 14);
695 break; 691 break;
696 692
697 case ECARD_IOC: 693 case ECARD_IOC:
698 if (slot < 4) 694 if (slot < 4)
699 address = IO_EC_IOC_BASE + (slot << 12); 695 address = ECARD_IOC_BASE + (slot << 14);
700#ifdef IO_EC_IOC4_BASE
701 else 696 else
702 address = IO_EC_IOC4_BASE + ((slot - 4) << 12); 697 address = ECARD_IOC4_BASE + ((slot - 4) << 14);
703#endif
704 if (address) 698 if (address)
705 address += speed << 17; 699 address += speed << 19;
706 break; 700 break;
707 701
708#ifdef IO_EC_EASI_BASE
709 case ECARD_EASI: 702 case ECARD_EASI:
710 address = IO_EC_EASI_BASE + (slot << 22); 703 address = ECARD_EASI_BASE + (slot << 24);
711 if (speed == ECARD_FAST) 704 if (speed == ECARD_FAST)
712 ectcr |= 1 << slot; 705 ectcr |= 1 << slot;
713 break; 706 break;
714#endif 707
715 default: 708 default:
716 break; 709 break;
717 } 710 }
@@ -990,6 +983,7 @@ ecard_probe(int slot, card_type_t type)
990 ecard_t **ecp; 983 ecard_t **ecp;
991 ecard_t *ec; 984 ecard_t *ec;
992 struct ex_ecid cid; 985 struct ex_ecid cid;
986 void __iomem *addr;
993 int i, rc; 987 int i, rc;
994 988
995 ec = ecard_alloc_card(type, slot); 989 ec = ecard_alloc_card(type, slot);
@@ -999,7 +993,7 @@ ecard_probe(int slot, card_type_t type)
999 } 993 }
1000 994
1001 rc = -ENODEV; 995 rc = -ENODEV;
1002 if ((ec->podaddr = __ecard_address(ec, type, ECARD_SYNC)) == 0) 996 if ((addr = __ecard_address(ec, type, ECARD_SYNC)) == NULL)
1003 goto nodev; 997 goto nodev;
1004 998
1005 cid.r_zero = 1; 999 cid.r_zero = 1;
@@ -1019,7 +1013,7 @@ ecard_probe(int slot, card_type_t type)
1019 ec->cid.fiqmask = cid.r_fiqmask; 1013 ec->cid.fiqmask = cid.r_fiqmask;
1020 ec->cid.fiqoff = ecard_gets24(cid.r_fiqoff); 1014 ec->cid.fiqoff = ecard_gets24(cid.r_fiqoff);
1021 ec->fiqaddr = 1015 ec->fiqaddr =
1022 ec->irqaddr = (void __iomem *)ioaddr(ec->podaddr); 1016 ec->irqaddr = addr;
1023 1017
1024 if (ec->cid.is) { 1018 if (ec->cid.is) {
1025 ec->irqmask = ec->cid.irqmask; 1019 ec->irqmask = ec->cid.irqmask;
@@ -1048,10 +1042,8 @@ ecard_probe(int slot, card_type_t type)
1048 set_irq_flags(ec->irq, IRQF_VALID); 1042 set_irq_flags(ec->irq, IRQF_VALID);
1049 } 1043 }
1050 1044
1051#ifdef IO_EC_MEMC8_BASE
1052 if (slot == 8) 1045 if (slot == 8)
1053 ec->irq = 11; 1046 ec->irq = 11;
1054#endif
1055#ifdef CONFIG_ARCH_RPC 1047#ifdef CONFIG_ARCH_RPC
1056 /* On RiscPC, only first two slots have DMA capability */ 1048 /* On RiscPC, only first two slots have DMA capability */
1057 if (slot < 2) 1049 if (slot < 2)
@@ -1097,9 +1089,7 @@ static int __init ecard_init(void)
1097 ecard_probe(slot, ECARD_IOC); 1089 ecard_probe(slot, ECARD_IOC);
1098 } 1090 }
1099 1091
1100#ifdef IO_EC_MEMC8_BASE
1101 ecard_probe(8, ECARD_IOC); 1092 ecard_probe(8, ECARD_IOC);
1102#endif
1103 1093
1104 irqhw = ecard_probeirqhw(); 1094 irqhw = ecard_probeirqhw();
1105 1095
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index a87cbf889ff4..9ad50c4208ae 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -24,6 +24,7 @@
24#include <asm/unwind.h> 24#include <asm/unwind.h>
25#include <asm/unistd.h> 25#include <asm/unistd.h>
26#include <asm/tls.h> 26#include <asm/tls.h>
27#include <asm/system.h>
27 28
28#include "entry-header.S" 29#include "entry-header.S"
29#include <asm/entry-macro-multi.S> 30#include <asm/entry-macro-multi.S>
@@ -262,8 +263,7 @@ __und_svc:
262 ldr r0, [r4, #-4] 263 ldr r0, [r4, #-4]
263#else 264#else
264 ldrh r0, [r4, #-2] @ Thumb instruction at LR - 2 265 ldrh r0, [r4, #-2] @ Thumb instruction at LR - 2
265 and r9, r0, #0xf800 266 cmp r0, #0xe800 @ 32-bit instruction if xx >= 0
266 cmp r9, #0xe800 @ 32-bit instruction if xx >= 0
267 ldrhhs r9, [r4] @ bottom 16 bits 267 ldrhhs r9, [r4] @ bottom 16 bits
268 orrhs r0, r9, r0, lsl #16 268 orrhs r0, r9, r0, lsl #16
269#endif 269#endif
@@ -440,18 +440,46 @@ __und_usr:
440#endif 440#endif
441 beq call_fpe 441 beq call_fpe
442 @ Thumb instruction 442 @ Thumb instruction
443#if __LINUX_ARM_ARCH__ >= 7 443#if CONFIG_ARM_THUMB && __LINUX_ARM_ARCH__ >= 6 && CONFIG_CPU_V7
444/*
445 * Thumb-2 instruction handling. Note that because pre-v6 and >= v6 platforms
446 * can never be supported in a single kernel, this code is not applicable at
447 * all when __LINUX_ARM_ARCH__ < 6. This allows simplifying assumptions to be
448 * made about .arch directives.
449 */
450#if __LINUX_ARM_ARCH__ < 7
451/* If the target CPU may not be Thumb-2-capable, a run-time check is needed: */
452#define NEED_CPU_ARCHITECTURE
453 ldr r5, .LCcpu_architecture
454 ldr r5, [r5]
455 cmp r5, #CPU_ARCH_ARMv7
456 blo __und_usr_unknown
457/*
458 * The following code won't get run unless the running CPU really is v7, so
459 * coding round the lack of ldrht on older arches is pointless. Temporarily
460 * override the assembler target arch with the minimum required instead:
461 */
462 .arch armv6t2
463#endif
4442: 4642:
445 ARM( ldrht r5, [r4], #2 ) 465 ARM( ldrht r5, [r4], #2 )
446 THUMB( ldrht r5, [r4] ) 466 THUMB( ldrht r5, [r4] )
447 THUMB( add r4, r4, #2 ) 467 THUMB( add r4, r4, #2 )
448 and r0, r5, #0xf800 @ mask bits 111x x... .... .... 468 cmp r5, #0xe800 @ 32bit instruction if xx != 0
449 cmp r0, #0xe800 @ 32bit instruction if xx != 0
450 blo __und_usr_unknown 469 blo __und_usr_unknown
4513: ldrht r0, [r4] 4703: ldrht r0, [r4]
452 add r2, r2, #2 @ r2 is PC + 2, make it PC + 4 471 add r2, r2, #2 @ r2 is PC + 2, make it PC + 4
453 orr r0, r0, r5, lsl #16 472 orr r0, r0, r5, lsl #16
473
474#if __LINUX_ARM_ARCH__ < 7
475/* If the target arch was overridden, change it back: */
476#ifdef CONFIG_CPU_32v6K
477 .arch armv6k
454#else 478#else
479 .arch armv6
480#endif
481#endif /* __LINUX_ARM_ARCH__ < 7 */
482#else /* !(CONFIG_ARM_THUMB && __LINUX_ARM_ARCH__ >= 6 && CONFIG_CPU_V7) */
455 b __und_usr_unknown 483 b __und_usr_unknown
456#endif 484#endif
457 UNWIND(.fnend ) 485 UNWIND(.fnend )
@@ -578,6 +606,12 @@ call_fpe:
578 movw_pc lr @ CP#14 (Debug) 606 movw_pc lr @ CP#14 (Debug)
579 movw_pc lr @ CP#15 (Control) 607 movw_pc lr @ CP#15 (Control)
580 608
609#ifdef NEED_CPU_ARCHITECTURE
610 .align 2
611.LCcpu_architecture:
612 .word __cpu_architecture
613#endif
614
581#ifdef CONFIG_NEON 615#ifdef CONFIG_NEON
582 .align 6 616 .align 6
583 617
diff --git a/arch/arm/kernel/head.S b/arch/arm/kernel/head.S
index 673c806cc106..566c54c2a1fe 100644
--- a/arch/arm/kernel/head.S
+++ b/arch/arm/kernel/head.S
@@ -21,6 +21,7 @@
21#include <asm/memory.h> 21#include <asm/memory.h>
22#include <asm/thread_info.h> 22#include <asm/thread_info.h>
23#include <asm/system.h> 23#include <asm/system.h>
24#include <asm/pgtable.h>
24 25
25#ifdef CONFIG_DEBUG_LL 26#ifdef CONFIG_DEBUG_LL
26#include <mach/debug-macro.S> 27#include <mach/debug-macro.S>
@@ -38,11 +39,14 @@
38#error KERNEL_RAM_VADDR must start at 0xXXXX8000 39#error KERNEL_RAM_VADDR must start at 0xXXXX8000
39#endif 40#endif
40 41
42#define PG_DIR_SIZE 0x4000
43#define PMD_ORDER 2
44
41 .globl swapper_pg_dir 45 .globl swapper_pg_dir
42 .equ swapper_pg_dir, KERNEL_RAM_VADDR - 0x4000 46 .equ swapper_pg_dir, KERNEL_RAM_VADDR - PG_DIR_SIZE
43 47
44 .macro pgtbl, rd, phys 48 .macro pgtbl, rd, phys
45 add \rd, \phys, #TEXT_OFFSET - 0x4000 49 add \rd, \phys, #TEXT_OFFSET - PG_DIR_SIZE
46 .endm 50 .endm
47 51
48#ifdef CONFIG_XIP_KERNEL 52#ifdef CONFIG_XIP_KERNEL
@@ -148,11 +152,11 @@ __create_page_tables:
148 pgtbl r4, r8 @ page table address 152 pgtbl r4, r8 @ page table address
149 153
150 /* 154 /*
151 * Clear the 16K level 1 swapper page table 155 * Clear the swapper page table
152 */ 156 */
153 mov r0, r4 157 mov r0, r4
154 mov r3, #0 158 mov r3, #0
155 add r6, r0, #0x4000 159 add r6, r0, #PG_DIR_SIZE
1561: str r3, [r0], #4 1601: str r3, [r0], #4
157 str r3, [r0], #4 161 str r3, [r0], #4
158 str r3, [r0], #4 162 str r3, [r0], #4
@@ -171,30 +175,30 @@ __create_page_tables:
171 sub r0, r0, r3 @ virt->phys offset 175 sub r0, r0, r3 @ virt->phys offset
172 add r5, r5, r0 @ phys __enable_mmu 176 add r5, r5, r0 @ phys __enable_mmu
173 add r6, r6, r0 @ phys __enable_mmu_end 177 add r6, r6, r0 @ phys __enable_mmu_end
174 mov r5, r5, lsr #20 178 mov r5, r5, lsr #SECTION_SHIFT
175 mov r6, r6, lsr #20 179 mov r6, r6, lsr #SECTION_SHIFT
176 180
1771: orr r3, r7, r5, lsl #20 @ flags + kernel base 1811: orr r3, r7, r5, lsl #SECTION_SHIFT @ flags + kernel base
178 str r3, [r4, r5, lsl #2] @ identity mapping 182 str r3, [r4, r5, lsl #PMD_ORDER] @ identity mapping
179 teq r5, r6 183 cmp r5, r6
180 addne r5, r5, #1 @ next section 184 addlo r5, r5, #1 @ next section
181 bne 1b 185 blo 1b
182 186
183 /* 187 /*
184 * Now setup the pagetables for our kernel direct 188 * Now setup the pagetables for our kernel direct
185 * mapped region. 189 * mapped region.
186 */ 190 */
187 mov r3, pc 191 mov r3, pc
188 mov r3, r3, lsr #20 192 mov r3, r3, lsr #SECTION_SHIFT
189 orr r3, r7, r3, lsl #20 193 orr r3, r7, r3, lsl #SECTION_SHIFT
190 add r0, r4, #(KERNEL_START & 0xff000000) >> 18 194 add r0, r4, #(KERNEL_START & 0xff000000) >> (SECTION_SHIFT - PMD_ORDER)
191 str r3, [r0, #(KERNEL_START & 0x00f00000) >> 18]! 195 str r3, [r0, #((KERNEL_START & 0x00f00000) >> SECTION_SHIFT) << PMD_ORDER]!
192 ldr r6, =(KERNEL_END - 1) 196 ldr r6, =(KERNEL_END - 1)
193 add r0, r0, #4 197 add r0, r0, #1 << PMD_ORDER
194 add r6, r4, r6, lsr #18 198 add r6, r4, r6, lsr #(SECTION_SHIFT - PMD_ORDER)
1951: cmp r0, r6 1991: cmp r0, r6
196 add r3, r3, #1 << 20 200 add r3, r3, #1 << SECTION_SHIFT
197 strls r3, [r0], #4 201 strls r3, [r0], #1 << PMD_ORDER
198 bls 1b 202 bls 1b
199 203
200#ifdef CONFIG_XIP_KERNEL 204#ifdef CONFIG_XIP_KERNEL
@@ -203,11 +207,11 @@ __create_page_tables:
203 */ 207 */
204 add r3, r8, #TEXT_OFFSET 208 add r3, r8, #TEXT_OFFSET
205 orr r3, r3, r7 209 orr r3, r3, r7
206 add r0, r4, #(KERNEL_RAM_VADDR & 0xff000000) >> 18 210 add r0, r4, #(KERNEL_RAM_VADDR & 0xff000000) >> (SECTION_SHIFT - PMD_ORDER)
207 str r3, [r0, #(KERNEL_RAM_VADDR & 0x00f00000) >> 18]! 211 str r3, [r0, #(KERNEL_RAM_VADDR & 0x00f00000) >> (SECTION_SHIFT - PMD_ORDER)]!
208 ldr r6, =(_end - 1) 212 ldr r6, =(_end - 1)
209 add r0, r0, #4 213 add r0, r0, #4
210 add r6, r4, r6, lsr #18 214 add r6, r4, r6, lsr #(SECTION_SHIFT - PMD_ORDER)
2111: cmp r0, r6 2151: cmp r0, r6
212 add r3, r3, #1 << 20 216 add r3, r3, #1 << 20
213 strls r3, [r0], #4 217 strls r3, [r0], #4
@@ -218,12 +222,12 @@ __create_page_tables:
218 * Then map boot params address in r2 or 222 * Then map boot params address in r2 or
219 * the first 1MB of ram if boot params address is not specified. 223 * the first 1MB of ram if boot params address is not specified.
220 */ 224 */
221 mov r0, r2, lsr #20 225 mov r0, r2, lsr #SECTION_SHIFT
222 movs r0, r0, lsl #20 226 movs r0, r0, lsl #SECTION_SHIFT
223 moveq r0, r8 227 moveq r0, r8
224 sub r3, r0, r8 228 sub r3, r0, r8
225 add r3, r3, #PAGE_OFFSET 229 add r3, r3, #PAGE_OFFSET
226 add r3, r4, r3, lsr #18 230 add r3, r4, r3, lsr #(SECTION_SHIFT - PMD_ORDER)
227 orr r6, r7, r0 231 orr r6, r7, r0
228 str r6, [r3] 232 str r6, [r3]
229 233
@@ -236,21 +240,21 @@ __create_page_tables:
236 */ 240 */
237 addruart r7, r3, r0 241 addruart r7, r3, r0
238 242
239 mov r3, r3, lsr #20 243 mov r3, r3, lsr #SECTION_SHIFT
240 mov r3, r3, lsl #2 244 mov r3, r3, lsl #PMD_ORDER
241 245
242 add r0, r4, r3 246 add r0, r4, r3
243 rsb r3, r3, #0x4000 @ PTRS_PER_PGD*sizeof(long) 247 rsb r3, r3, #0x4000 @ PTRS_PER_PGD*sizeof(long)
244 cmp r3, #0x0800 @ limit to 512MB 248 cmp r3, #0x0800 @ limit to 512MB
245 movhi r3, #0x0800 249 movhi r3, #0x0800
246 add r6, r0, r3 250 add r6, r0, r3
247 mov r3, r7, lsr #20 251 mov r3, r7, lsr #SECTION_SHIFT
248 ldr r7, [r10, #PROCINFO_IO_MMUFLAGS] @ io_mmuflags 252 ldr r7, [r10, #PROCINFO_IO_MMUFLAGS] @ io_mmuflags
249 orr r3, r7, r3, lsl #20 253 orr r3, r7, r3, lsl #SECTION_SHIFT
2501: str r3, [r0], #4 2541: str r3, [r0], #4
251 add r3, r3, #1 << 20 255 add r3, r3, #1 << SECTION_SHIFT
252 teq r0, r6 256 cmp r0, r6
253 bne 1b 257 blo 1b
254 258
255#else /* CONFIG_DEBUG_ICEDCC */ 259#else /* CONFIG_DEBUG_ICEDCC */
256 /* we don't need any serial debugging mappings for ICEDCC */ 260 /* we don't need any serial debugging mappings for ICEDCC */
@@ -262,7 +266,7 @@ __create_page_tables:
262 * If we're using the NetWinder or CATS, we also need to map 266 * If we're using the NetWinder or CATS, we also need to map
263 * in the 16550-type serial port for the debug messages 267 * in the 16550-type serial port for the debug messages
264 */ 268 */
265 add r0, r4, #0xff000000 >> 18 269 add r0, r4, #0xff000000 >> (SECTION_SHIFT - PMD_ORDER)
266 orr r3, r7, #0x7c000000 270 orr r3, r7, #0x7c000000
267 str r3, [r0] 271 str r3, [r0]
268#endif 272#endif
@@ -272,10 +276,10 @@ __create_page_tables:
272 * Similar reasons here - for debug. This is 276 * Similar reasons here - for debug. This is
273 * only for Acorn RiscPC architectures. 277 * only for Acorn RiscPC architectures.
274 */ 278 */
275 add r0, r4, #0x02000000 >> 18 279 add r0, r4, #0x02000000 >> (SECTION_SHIFT - PMD_ORDER)
276 orr r3, r7, #0x02000000 280 orr r3, r7, #0x02000000
277 str r3, [r0] 281 str r3, [r0]
278 add r0, r4, #0xd8000000 >> 18 282 add r0, r4, #0xd8000000 >> (SECTION_SHIFT - PMD_ORDER)
279 str r3, [r0] 283 str r3, [r0]
280#endif 284#endif
281#endif 285#endif
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
index e59bbd496c39..c1b4463dcc83 100644
--- a/arch/arm/kernel/machine_kexec.c
+++ b/arch/arm/kernel/machine_kexec.c
@@ -32,6 +32,24 @@ static atomic_t waiting_for_crash_ipi;
32 32
33int machine_kexec_prepare(struct kimage *image) 33int machine_kexec_prepare(struct kimage *image)
34{ 34{
35 unsigned long page_list;
36 void *reboot_code_buffer;
37 page_list = image->head & PAGE_MASK;
38
39 reboot_code_buffer = page_address(image->control_code_page);
40
41 /* Prepare parameters for reboot_code_buffer*/
42 kexec_start_address = image->start;
43 kexec_indirection_page = page_list;
44 kexec_mach_type = machine_arch_type;
45 kexec_boot_atags = image->start - KEXEC_ARM_ZIMAGE_OFFSET + KEXEC_ARM_ATAGS_OFFSET;
46
47 /* copy our kernel relocation code to the control code page */
48 memcpy(reboot_code_buffer,
49 relocate_new_kernel, relocate_new_kernel_size);
50
51 flush_icache_range((unsigned long) reboot_code_buffer,
52 (unsigned long) reboot_code_buffer + KEXEC_CONTROL_PAGE_SIZE);
35 return 0; 53 return 0;
36} 54}
37 55
@@ -82,31 +100,14 @@ void (*kexec_reinit)(void);
82 100
83void machine_kexec(struct kimage *image) 101void machine_kexec(struct kimage *image)
84{ 102{
85 unsigned long page_list;
86 unsigned long reboot_code_buffer_phys; 103 unsigned long reboot_code_buffer_phys;
87 void *reboot_code_buffer; 104 void *reboot_code_buffer;
88 105
89
90 page_list = image->head & PAGE_MASK;
91
92 /* we need both effective and real address here */ 106 /* we need both effective and real address here */
93 reboot_code_buffer_phys = 107 reboot_code_buffer_phys =
94 page_to_pfn(image->control_code_page) << PAGE_SHIFT; 108 page_to_pfn(image->control_code_page) << PAGE_SHIFT;
95 reboot_code_buffer = page_address(image->control_code_page); 109 reboot_code_buffer = page_address(image->control_code_page);
96 110
97 /* Prepare parameters for reboot_code_buffer*/
98 kexec_start_address = image->start;
99 kexec_indirection_page = page_list;
100 kexec_mach_type = machine_arch_type;
101 kexec_boot_atags = image->start - KEXEC_ARM_ZIMAGE_OFFSET + KEXEC_ARM_ATAGS_OFFSET;
102
103 /* copy our kernel relocation code to the control code page */
104 memcpy(reboot_code_buffer,
105 relocate_new_kernel, relocate_new_kernel_size);
106
107
108 flush_icache_range((unsigned long) reboot_code_buffer,
109 (unsigned long) reboot_code_buffer + KEXEC_CONTROL_PAGE_SIZE);
110 printk(KERN_INFO "Bye!\n"); 111 printk(KERN_INFO "Bye!\n");
111 112
112 if (kexec_reinit) 113 if (kexec_reinit)
diff --git a/arch/arm/kernel/module.c b/arch/arm/kernel/module.c
index cc2020c2c709..1e9be5d25e56 100644
--- a/arch/arm/kernel/module.c
+++ b/arch/arm/kernel/module.c
@@ -33,7 +33,7 @@
33 * recompiling the whole kernel when CONFIG_XIP_KERNEL is turned on/off. 33 * recompiling the whole kernel when CONFIG_XIP_KERNEL is turned on/off.
34 */ 34 */
35#undef MODULES_VADDR 35#undef MODULES_VADDR
36#define MODULES_VADDR (((unsigned long)_etext + ~PGDIR_MASK) & PGDIR_MASK) 36#define MODULES_VADDR (((unsigned long)_etext + ~PMD_MASK) & PMD_MASK)
37#endif 37#endif
38 38
39#ifdef CONFIG_MMU 39#ifdef CONFIG_MMU
diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c
index 98b75738345e..1ef6d0034b85 100644
--- a/arch/arm/kernel/perf_event_v7.c
+++ b/arch/arm/kernel/perf_event_v7.c
@@ -324,8 +324,8 @@ static const unsigned armv7_a9_perf_map[PERF_COUNT_HW_MAX] = {
324 [PERF_COUNT_HW_CPU_CYCLES] = ARMV7_PERFCTR_CPU_CYCLES, 324 [PERF_COUNT_HW_CPU_CYCLES] = ARMV7_PERFCTR_CPU_CYCLES,
325 [PERF_COUNT_HW_INSTRUCTIONS] = 325 [PERF_COUNT_HW_INSTRUCTIONS] =
326 ARMV7_PERFCTR_INST_OUT_OF_RENAME_STAGE, 326 ARMV7_PERFCTR_INST_OUT_OF_RENAME_STAGE,
327 [PERF_COUNT_HW_CACHE_REFERENCES] = ARMV7_PERFCTR_COHERENT_LINE_HIT, 327 [PERF_COUNT_HW_CACHE_REFERENCES] = ARMV7_PERFCTR_DCACHE_ACCESS,
328 [PERF_COUNT_HW_CACHE_MISSES] = ARMV7_PERFCTR_COHERENT_LINE_MISS, 328 [PERF_COUNT_HW_CACHE_MISSES] = ARMV7_PERFCTR_DCACHE_REFILL,
329 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV7_PERFCTR_PC_WRITE, 329 [PERF_COUNT_HW_BRANCH_INSTRUCTIONS] = ARMV7_PERFCTR_PC_WRITE,
330 [PERF_COUNT_HW_BRANCH_MISSES] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED, 330 [PERF_COUNT_HW_BRANCH_MISSES] = ARMV7_PERFCTR_PC_BRANCH_MIS_PRED,
331 [PERF_COUNT_HW_BUS_CYCLES] = ARMV7_PERFCTR_CLOCK_CYCLES, 331 [PERF_COUNT_HW_BUS_CYCLES] = ARMV7_PERFCTR_CLOCK_CYCLES,
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index 1a347f481e5e..fd0814076ff6 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -319,7 +319,7 @@ void show_regs(struct pt_regs * regs)
319 printk("\n"); 319 printk("\n");
320 printk("Pid: %d, comm: %20s\n", task_pid_nr(current), current->comm); 320 printk("Pid: %d, comm: %20s\n", task_pid_nr(current), current->comm);
321 __show_regs(regs); 321 __show_regs(regs);
322 __backtrace(); 322 dump_stack();
323} 323}
324 324
325ATOMIC_NOTIFIER_HEAD(thread_notify_head); 325ATOMIC_NOTIFIER_HEAD(thread_notify_head);
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 6136144f8f8d..bda0a218f4a5 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -29,6 +29,8 @@
29#include <linux/fs.h> 29#include <linux/fs.h>
30#include <linux/proc_fs.h> 30#include <linux/proc_fs.h>
31#include <linux/memblock.h> 31#include <linux/memblock.h>
32#include <linux/bug.h>
33#include <linux/compiler.h>
32 34
33#include <asm/unified.h> 35#include <asm/unified.h>
34#include <asm/cpu.h> 36#include <asm/cpu.h>
@@ -42,6 +44,7 @@
42#include <asm/cacheflush.h> 44#include <asm/cacheflush.h>
43#include <asm/cachetype.h> 45#include <asm/cachetype.h>
44#include <asm/tlbflush.h> 46#include <asm/tlbflush.h>
47#include <asm/system.h>
45 48
46#include <asm/prom.h> 49#include <asm/prom.h>
47#include <asm/mach/arch.h> 50#include <asm/mach/arch.h>
@@ -115,6 +118,13 @@ struct outer_cache_fns outer_cache __read_mostly;
115EXPORT_SYMBOL(outer_cache); 118EXPORT_SYMBOL(outer_cache);
116#endif 119#endif
117 120
121/*
122 * Cached cpu_architecture() result for use by assembler code.
123 * C code should use the cpu_architecture() function instead of accessing this
124 * variable directly.
125 */
126int __cpu_architecture __read_mostly = CPU_ARCH_UNKNOWN;
127
118struct stack { 128struct stack {
119 u32 irq[3]; 129 u32 irq[3];
120 u32 abt[3]; 130 u32 abt[3];
@@ -210,7 +220,7 @@ static const char *proc_arch[] = {
210 "?(17)", 220 "?(17)",
211}; 221};
212 222
213int cpu_architecture(void) 223static int __get_cpu_architecture(void)
214{ 224{
215 int cpu_arch; 225 int cpu_arch;
216 226
@@ -243,11 +253,22 @@ int cpu_architecture(void)
243 return cpu_arch; 253 return cpu_arch;
244} 254}
245 255
256int __pure cpu_architecture(void)
257{
258 BUG_ON(__cpu_architecture == CPU_ARCH_UNKNOWN);
259
260 return __cpu_architecture;
261}
262
246static int cpu_has_aliasing_icache(unsigned int arch) 263static int cpu_has_aliasing_icache(unsigned int arch)
247{ 264{
248 int aliasing_icache; 265 int aliasing_icache;
249 unsigned int id_reg, num_sets, line_size; 266 unsigned int id_reg, num_sets, line_size;
250 267
268 /* PIPT caches never alias. */
269 if (icache_is_pipt())
270 return 0;
271
251 /* arch specifies the register format */ 272 /* arch specifies the register format */
252 switch (arch) { 273 switch (arch) {
253 case CPU_ARCH_ARMv7: 274 case CPU_ARCH_ARMv7:
@@ -282,8 +303,14 @@ static void __init cacheid_init(void)
282 /* ARMv7 register format */ 303 /* ARMv7 register format */
283 arch = CPU_ARCH_ARMv7; 304 arch = CPU_ARCH_ARMv7;
284 cacheid = CACHEID_VIPT_NONALIASING; 305 cacheid = CACHEID_VIPT_NONALIASING;
285 if ((cachetype & (3 << 14)) == 1 << 14) 306 switch (cachetype & (3 << 14)) {
307 case (1 << 14):
286 cacheid |= CACHEID_ASID_TAGGED; 308 cacheid |= CACHEID_ASID_TAGGED;
309 break;
310 case (3 << 14):
311 cacheid |= CACHEID_PIPT;
312 break;
313 }
287 } else { 314 } else {
288 arch = CPU_ARCH_ARMv6; 315 arch = CPU_ARCH_ARMv6;
289 if (cachetype & (1 << 23)) 316 if (cachetype & (1 << 23))
@@ -300,10 +327,11 @@ static void __init cacheid_init(void)
300 printk("CPU: %s data cache, %s instruction cache\n", 327 printk("CPU: %s data cache, %s instruction cache\n",
301 cache_is_vivt() ? "VIVT" : 328 cache_is_vivt() ? "VIVT" :
302 cache_is_vipt_aliasing() ? "VIPT aliasing" : 329 cache_is_vipt_aliasing() ? "VIPT aliasing" :
303 cache_is_vipt_nonaliasing() ? "VIPT nonaliasing" : "unknown", 330 cache_is_vipt_nonaliasing() ? "PIPT / VIPT nonaliasing" : "unknown",
304 cache_is_vivt() ? "VIVT" : 331 cache_is_vivt() ? "VIVT" :
305 icache_is_vivt_asid_tagged() ? "VIVT ASID tagged" : 332 icache_is_vivt_asid_tagged() ? "VIVT ASID tagged" :
306 icache_is_vipt_aliasing() ? "VIPT aliasing" : 333 icache_is_vipt_aliasing() ? "VIPT aliasing" :
334 icache_is_pipt() ? "PIPT" :
307 cache_is_vipt_nonaliasing() ? "VIPT nonaliasing" : "unknown"); 335 cache_is_vipt_nonaliasing() ? "VIPT nonaliasing" : "unknown");
308} 336}
309 337
@@ -414,6 +442,7 @@ static void __init setup_processor(void)
414 } 442 }
415 443
416 cpu_name = list->cpu_name; 444 cpu_name = list->cpu_name;
445 __cpu_architecture = __get_cpu_architecture();
417 446
418#ifdef MULTI_CPU 447#ifdef MULTI_CPU
419 processor = *list->proc; 448 processor = *list->proc;
@@ -844,7 +873,7 @@ static struct machine_desc * __init setup_machine_tags(unsigned int nr)
844 } 873 }
845 874
846 if (mdesc->fixup) 875 if (mdesc->fixup)
847 mdesc->fixup(mdesc, tags, &from, &meminfo); 876 mdesc->fixup(tags, &from, &meminfo);
848 877
849 if (tags->hdr.tag == ATAG_CORE) { 878 if (tags->hdr.tag == ATAG_CORE) {
850 if (meminfo.nr_banks != 0) 879 if (meminfo.nr_banks != 0)
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index a96c08cd6125..ef5640b9e218 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -319,17 +319,7 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
319 */ 319 */
320 platform_secondary_init(cpu); 320 platform_secondary_init(cpu);
321 321
322 /*
323 * Enable local interrupts.
324 */
325 notify_cpu_starting(cpu); 322 notify_cpu_starting(cpu);
326 local_irq_enable();
327 local_fiq_enable();
328
329 /*
330 * Setup the percpu timer for this CPU.
331 */
332 percpu_timer_setup();
333 323
334 calibrate_delay(); 324 calibrate_delay();
335 325
@@ -341,10 +331,23 @@ asmlinkage void __cpuinit secondary_start_kernel(void)
341 * before we continue. 331 * before we continue.
342 */ 332 */
343 set_cpu_online(cpu, true); 333 set_cpu_online(cpu, true);
334
335 /*
336 * Setup the percpu timer for this CPU.
337 */
338 percpu_timer_setup();
339
344 while (!cpu_active(cpu)) 340 while (!cpu_active(cpu))
345 cpu_relax(); 341 cpu_relax();
346 342
347 /* 343 /*
344 * cpu_active bit is set, so it's safe to enalbe interrupts
345 * now.
346 */
347 local_irq_enable();
348 local_fiq_enable();
349
350 /*
348 * OK, it's off to the idle thread for us 351 * OK, it's off to the idle thread for us
349 */ 352 */
350 cpu_idle(); 353 cpu_idle();
@@ -527,7 +530,7 @@ static void percpu_timer_stop(void)
527} 530}
528#endif 531#endif
529 532
530static DEFINE_SPINLOCK(stop_lock); 533static DEFINE_RAW_SPINLOCK(stop_lock);
531 534
532/* 535/*
533 * ipi_cpu_stop - handle IPI from smp_send_stop() 536 * ipi_cpu_stop - handle IPI from smp_send_stop()
@@ -536,10 +539,10 @@ static void ipi_cpu_stop(unsigned int cpu)
536{ 539{
537 if (system_state == SYSTEM_BOOTING || 540 if (system_state == SYSTEM_BOOTING ||
538 system_state == SYSTEM_RUNNING) { 541 system_state == SYSTEM_RUNNING) {
539 spin_lock(&stop_lock); 542 raw_spin_lock(&stop_lock);
540 printk(KERN_CRIT "CPU%u: stopping\n", cpu); 543 printk(KERN_CRIT "CPU%u: stopping\n", cpu);
541 dump_stack(); 544 dump_stack();
542 spin_unlock(&stop_lock); 545 raw_spin_unlock(&stop_lock);
543 } 546 }
544 547
545 set_cpu_online(cpu, false); 548 set_cpu_online(cpu, false);
diff --git a/arch/arm/kernel/smp_scu.c b/arch/arm/kernel/smp_scu.c
index 5b6d536cbfe3..8f5dd7963356 100644
--- a/arch/arm/kernel/smp_scu.c
+++ b/arch/arm/kernel/smp_scu.c
@@ -13,6 +13,7 @@
13 13
14#include <asm/smp_scu.h> 14#include <asm/smp_scu.h>
15#include <asm/cacheflush.h> 15#include <asm/cacheflush.h>
16#include <asm/cputype.h>
16 17
17#define SCU_CTRL 0x00 18#define SCU_CTRL 0x00
18#define SCU_CONFIG 0x04 19#define SCU_CONFIG 0x04
@@ -37,6 +38,15 @@ void scu_enable(void __iomem *scu_base)
37{ 38{
38 u32 scu_ctrl; 39 u32 scu_ctrl;
39 40
41#ifdef CONFIG_ARM_ERRATA_764369
42 /* Cortex-A9 only */
43 if ((read_cpuid(CPUID_ID) & 0xff0ffff0) == 0x410fc090) {
44 scu_ctrl = __raw_readl(scu_base + 0x30);
45 if (!(scu_ctrl & 1))
46 __raw_writel(scu_ctrl | 0x1, scu_base + 0x30);
47 }
48#endif
49
40 scu_ctrl = __raw_readl(scu_base + SCU_CTRL); 50 scu_ctrl = __raw_readl(scu_base + SCU_CTRL);
41 /* already enabled? */ 51 /* already enabled? */
42 if (scu_ctrl & 1) 52 if (scu_ctrl & 1)
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index cb634c3e28e9..5a54b95d6bd2 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -39,13 +39,11 @@
39 */ 39 */
40static struct sys_timer *system_timer; 40static struct sys_timer *system_timer;
41 41
42#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) 42#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) || \
43 defined(CONFIG_NVRAM) || defined(CONFIG_NVRAM_MODULE)
43/* this needs a better home */ 44/* this needs a better home */
44DEFINE_SPINLOCK(rtc_lock); 45DEFINE_SPINLOCK(rtc_lock);
45
46#ifdef CONFIG_RTC_DRV_CMOS_MODULE
47EXPORT_SYMBOL(rtc_lock); 46EXPORT_SYMBOL(rtc_lock);
48#endif
49#endif /* pc-style 'CMOS' RTC support */ 47#endif /* pc-style 'CMOS' RTC support */
50 48
51/* change this if you have some constant time drift */ 49/* change this if you have some constant time drift */
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 210382555af1..99a572702509 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -21,6 +21,7 @@
21#include <linux/kdebug.h> 21#include <linux/kdebug.h>
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/kexec.h> 23#include <linux/kexec.h>
24#include <linux/bug.h>
24#include <linux/delay.h> 25#include <linux/delay.h>
25#include <linux/init.h> 26#include <linux/init.h>
26#include <linux/sched.h> 27#include <linux/sched.h>
@@ -256,7 +257,7 @@ static int __die(const char *str, int err, struct thread_info *thread, struct pt
256 return ret; 257 return ret;
257} 258}
258 259
259static DEFINE_SPINLOCK(die_lock); 260static DEFINE_RAW_SPINLOCK(die_lock);
260 261
261/* 262/*
262 * This function is protected against re-entrancy. 263 * This function is protected against re-entrancy.
@@ -268,9 +269,11 @@ void die(const char *str, struct pt_regs *regs, int err)
268 269
269 oops_enter(); 270 oops_enter();
270 271
271 spin_lock_irq(&die_lock); 272 raw_spin_lock_irq(&die_lock);
272 console_verbose(); 273 console_verbose();
273 bust_spinlocks(1); 274 bust_spinlocks(1);
275 if (!user_mode(regs))
276 report_bug(regs->ARM_pc, regs);
274 ret = __die(str, err, thread, regs); 277 ret = __die(str, err, thread, regs);
275 278
276 if (regs && kexec_should_crash(thread->task)) 279 if (regs && kexec_should_crash(thread->task))
@@ -278,7 +281,7 @@ void die(const char *str, struct pt_regs *regs, int err)
278 281
279 bust_spinlocks(0); 282 bust_spinlocks(0);
280 add_taint(TAINT_DIE); 283 add_taint(TAINT_DIE);
281 spin_unlock_irq(&die_lock); 284 raw_spin_unlock_irq(&die_lock);
282 oops_exit(); 285 oops_exit();
283 286
284 if (in_interrupt()) 287 if (in_interrupt())
@@ -302,25 +305,43 @@ void arm_notify_die(const char *str, struct pt_regs *regs,
302 } 305 }
303} 306}
304 307
308#ifdef CONFIG_GENERIC_BUG
309
310int is_valid_bugaddr(unsigned long pc)
311{
312#ifdef CONFIG_THUMB2_KERNEL
313 unsigned short bkpt;
314#else
315 unsigned long bkpt;
316#endif
317
318 if (probe_kernel_address((unsigned *)pc, bkpt))
319 return 0;
320
321 return bkpt == BUG_INSTR_VALUE;
322}
323
324#endif
325
305static LIST_HEAD(undef_hook); 326static LIST_HEAD(undef_hook);
306static DEFINE_SPINLOCK(undef_lock); 327static DEFINE_RAW_SPINLOCK(undef_lock);
307 328
308void register_undef_hook(struct undef_hook *hook) 329void register_undef_hook(struct undef_hook *hook)
309{ 330{
310 unsigned long flags; 331 unsigned long flags;
311 332
312 spin_lock_irqsave(&undef_lock, flags); 333 raw_spin_lock_irqsave(&undef_lock, flags);
313 list_add(&hook->node, &undef_hook); 334 list_add(&hook->node, &undef_hook);
314 spin_unlock_irqrestore(&undef_lock, flags); 335 raw_spin_unlock_irqrestore(&undef_lock, flags);
315} 336}
316 337
317void unregister_undef_hook(struct undef_hook *hook) 338void unregister_undef_hook(struct undef_hook *hook)
318{ 339{
319 unsigned long flags; 340 unsigned long flags;
320 341
321 spin_lock_irqsave(&undef_lock, flags); 342 raw_spin_lock_irqsave(&undef_lock, flags);
322 list_del(&hook->node); 343 list_del(&hook->node);
323 spin_unlock_irqrestore(&undef_lock, flags); 344 raw_spin_unlock_irqrestore(&undef_lock, flags);
324} 345}
325 346
326static int call_undef_hook(struct pt_regs *regs, unsigned int instr) 347static int call_undef_hook(struct pt_regs *regs, unsigned int instr)
@@ -329,12 +350,12 @@ static int call_undef_hook(struct pt_regs *regs, unsigned int instr)
329 unsigned long flags; 350 unsigned long flags;
330 int (*fn)(struct pt_regs *regs, unsigned int instr) = NULL; 351 int (*fn)(struct pt_regs *regs, unsigned int instr) = NULL;
331 352
332 spin_lock_irqsave(&undef_lock, flags); 353 raw_spin_lock_irqsave(&undef_lock, flags);
333 list_for_each_entry(hook, &undef_hook, node) 354 list_for_each_entry(hook, &undef_hook, node)
334 if ((instr & hook->instr_mask) == hook->instr_val && 355 if ((instr & hook->instr_mask) == hook->instr_val &&
335 (regs->ARM_cpsr & hook->cpsr_mask) == hook->cpsr_val) 356 (regs->ARM_cpsr & hook->cpsr_mask) == hook->cpsr_val)
336 fn = hook->fn; 357 fn = hook->fn;
337 spin_unlock_irqrestore(&undef_lock, flags); 358 raw_spin_unlock_irqrestore(&undef_lock, flags);
338 359
339 return fn ? fn(regs, instr) : 1; 360 return fn ? fn(regs, instr) : 1;
340} 361}
@@ -707,16 +728,6 @@ baddataabort(int code, unsigned long instr, struct pt_regs *regs)
707 arm_notify_die("unknown data abort code", regs, &info, instr, 0); 728 arm_notify_die("unknown data abort code", regs, &info, instr, 0);
708} 729}
709 730
710void __attribute__((noreturn)) __bug(const char *file, int line)
711{
712 printk(KERN_CRIT"kernel BUG at %s:%d!\n", file, line);
713 *(int *)0 = 0;
714
715 /* Avoid "noreturn function does return" */
716 for (;;);
717}
718EXPORT_SYMBOL(__bug);
719
720void __readwrite_bug(const char *fn) 731void __readwrite_bug(const char *fn)
721{ 732{
722 printk("%s called, but not implemented\n", fn); 733 printk("%s called, but not implemented\n", fn);
diff --git a/arch/arm/kernel/vmlinux.lds.S b/arch/arm/kernel/vmlinux.lds.S
index bf977f8514f6..20b3041e0860 100644
--- a/arch/arm/kernel/vmlinux.lds.S
+++ b/arch/arm/kernel/vmlinux.lds.S
@@ -21,10 +21,13 @@
21#define ARM_CPU_KEEP(x) 21#define ARM_CPU_KEEP(x)
22#endif 22#endif
23 23
24#if defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK) 24#if (defined(CONFIG_SMP_ON_UP) && !defined(CONFIG_DEBUG_SPINLOCK)) || \
25 defined(CONFIG_GENERIC_BUG)
25#define ARM_EXIT_KEEP(x) x 26#define ARM_EXIT_KEEP(x) x
27#define ARM_EXIT_DISCARD(x)
26#else 28#else
27#define ARM_EXIT_KEEP(x) 29#define ARM_EXIT_KEEP(x)
30#define ARM_EXIT_DISCARD(x) x
28#endif 31#endif
29 32
30OUTPUT_ARCH(arm) 33OUTPUT_ARCH(arm)
@@ -39,6 +42,11 @@ jiffies = jiffies_64 + 4;
39SECTIONS 42SECTIONS
40{ 43{
41 /* 44 /*
45 * XXX: The linker does not define how output sections are
46 * assigned to input sections when there are multiple statements
47 * matching the same input section name. There is no documented
48 * order of matching.
49 *
42 * unwind exit sections must be discarded before the rest of the 50 * unwind exit sections must be discarded before the rest of the
43 * unwind sections get included. 51 * unwind sections get included.
44 */ 52 */
@@ -47,6 +55,9 @@ SECTIONS
47 *(.ARM.extab.exit.text) 55 *(.ARM.extab.exit.text)
48 ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text)) 56 ARM_CPU_DISCARD(*(.ARM.exidx.cpuexit.text))
49 ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text)) 57 ARM_CPU_DISCARD(*(.ARM.extab.cpuexit.text))
58 ARM_EXIT_DISCARD(EXIT_TEXT)
59 ARM_EXIT_DISCARD(EXIT_DATA)
60 EXIT_CALL
50#ifndef CONFIG_HOTPLUG 61#ifndef CONFIG_HOTPLUG
51 *(.ARM.exidx.devexit.text) 62 *(.ARM.exidx.devexit.text)
52 *(.ARM.extab.devexit.text) 63 *(.ARM.extab.devexit.text)
@@ -58,6 +69,8 @@ SECTIONS
58#ifndef CONFIG_SMP_ON_UP 69#ifndef CONFIG_SMP_ON_UP
59 *(.alt.smp.init) 70 *(.alt.smp.init)
60#endif 71#endif
72 *(.discard)
73 *(.discard.*)
61 } 74 }
62 75
63#ifdef CONFIG_XIP_KERNEL 76#ifdef CONFIG_XIP_KERNEL
@@ -279,9 +292,6 @@ SECTIONS
279 292
280 STABS_DEBUG 293 STABS_DEBUG
281 .comment 0 : { *(.comment) } 294 .comment 0 : { *(.comment) }
282
283 /* Default discards */
284 DISCARDS
285} 295}
286 296
287/* 297/*
diff --git a/arch/arm/lib/backtrace.S b/arch/arm/lib/backtrace.S
index a673297b0cf1..cd07b5814c23 100644
--- a/arch/arm/lib/backtrace.S
+++ b/arch/arm/lib/backtrace.S
@@ -22,15 +22,10 @@
22#define mask r7 22#define mask r7
23#define offset r8 23#define offset r8
24 24
25ENTRY(__backtrace)
26 mov r1, #0x10
27 mov r0, fp
28
29ENTRY(c_backtrace) 25ENTRY(c_backtrace)
30 26
31#if !defined(CONFIG_FRAME_POINTER) || !defined(CONFIG_PRINTK) 27#if !defined(CONFIG_FRAME_POINTER) || !defined(CONFIG_PRINTK)
32 mov pc, lr 28 mov pc, lr
33ENDPROC(__backtrace)
34ENDPROC(c_backtrace) 29ENDPROC(c_backtrace)
35#else 30#else
36 stmfd sp!, {r4 - r8, lr} @ Save an extra register so we have a location... 31 stmfd sp!, {r4 - r8, lr} @ Save an extra register so we have a location...
@@ -107,7 +102,6 @@ for_each_frame: tst frame, mask @ Check for address exceptions
107 mov r1, frame 102 mov r1, frame
108 bl printk 103 bl printk
109no_frame: ldmfd sp!, {r4 - r8, pc} 104no_frame: ldmfd sp!, {r4 - r8, pc}
110ENDPROC(__backtrace)
111ENDPROC(c_backtrace) 105ENDPROC(c_backtrace)
112 106
113 .pushsection __ex_table,"a" 107 .pushsection __ex_table,"a"
diff --git a/arch/arm/lib/div64.S b/arch/arm/lib/div64.S
index faa7748142da..e55c4842c290 100644
--- a/arch/arm/lib/div64.S
+++ b/arch/arm/lib/div64.S
@@ -13,6 +13,7 @@
13 */ 13 */
14 14
15#include <linux/linkage.h> 15#include <linux/linkage.h>
16#include <asm/unwind.h>
16 17
17#ifdef __ARMEB__ 18#ifdef __ARMEB__
18#define xh r0 19#define xh r0
@@ -44,6 +45,7 @@
44 */ 45 */
45 46
46ENTRY(__do_div64) 47ENTRY(__do_div64)
48UNWIND(.fnstart)
47 49
48 @ Test for easy paths first. 50 @ Test for easy paths first.
49 subs ip, r4, #1 51 subs ip, r4, #1
@@ -189,7 +191,12 @@ ENTRY(__do_div64)
189 moveq yh, xh 191 moveq yh, xh
190 moveq xh, #0 192 moveq xh, #0
191 moveq pc, lr 193 moveq pc, lr
194UNWIND(.fnend)
192 195
196UNWIND(.fnstart)
197UNWIND(.pad #4)
198UNWIND(.save {lr})
199Ldiv0_64:
193 @ Division by 0: 200 @ Division by 0:
194 str lr, [sp, #-8]! 201 str lr, [sp, #-8]!
195 bl __div0 202 bl __div0
@@ -200,4 +207,5 @@ ENTRY(__do_div64)
200 mov xh, #0 207 mov xh, #0
201 ldr pc, [sp], #8 208 ldr pc, [sp], #8
202 209
210UNWIND(.fnend)
203ENDPROC(__do_div64) 211ENDPROC(__do_div64)
diff --git a/arch/arm/lib/uaccess_with_memcpy.c b/arch/arm/lib/uaccess_with_memcpy.c
index 8b9b13649f81..025f742dd4df 100644
--- a/arch/arm/lib/uaccess_with_memcpy.c
+++ b/arch/arm/lib/uaccess_with_memcpy.c
@@ -17,6 +17,7 @@
17#include <linux/sched.h> 17#include <linux/sched.h>
18#include <linux/hardirq.h> /* for in_atomic() */ 18#include <linux/hardirq.h> /* for in_atomic() */
19#include <linux/gfp.h> 19#include <linux/gfp.h>
20#include <linux/highmem.h>
20#include <asm/current.h> 21#include <asm/current.h>
21#include <asm/page.h> 22#include <asm/page.h>
22 23
diff --git a/arch/arm/mach-at91/Makefile.boot b/arch/arm/mach-at91/Makefile.boot
index 3462b815054a..9ab5a3e5f4f1 100644
--- a/arch/arm/mach-at91/Makefile.boot
+++ b/arch/arm/mach-at91/Makefile.boot
@@ -4,15 +4,15 @@
4# INITRD_PHYS must be in RAM 4# INITRD_PHYS must be in RAM
5 5
6ifeq ($(CONFIG_ARCH_AT91CAP9),y) 6ifeq ($(CONFIG_ARCH_AT91CAP9),y)
7 zreladdr-y := 0x70008000 7 zreladdr-y += 0x70008000
8params_phys-y := 0x70000100 8params_phys-y := 0x70000100
9initrd_phys-y := 0x70410000 9initrd_phys-y := 0x70410000
10else ifeq ($(CONFIG_ARCH_AT91SAM9G45),y) 10else ifeq ($(CONFIG_ARCH_AT91SAM9G45),y)
11 zreladdr-y := 0x70008000 11 zreladdr-y += 0x70008000
12params_phys-y := 0x70000100 12params_phys-y := 0x70000100
13initrd_phys-y := 0x70410000 13initrd_phys-y := 0x70410000
14else 14else
15 zreladdr-y := 0x20008000 15 zreladdr-y += 0x20008000
16params_phys-y := 0x20000100 16params_phys-y := 0x20000100
17initrd_phys-y := 0x20410000 17initrd_phys-y := 0x20410000
18endif 18endif
diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c
index dba0d8d8a4bd..f87f5040e78e 100644
--- a/arch/arm/mach-at91/at91cap9_devices.c
+++ b/arch/arm/mach-at91/at91cap9_devices.c
@@ -16,6 +16,7 @@
16#include <asm/mach/irq.h> 16#include <asm/mach/irq.h>
17 17
18#include <linux/dma-mapping.h> 18#include <linux/dma-mapping.h>
19#include <linux/gpio.h>
19#include <linux/platform_device.h> 20#include <linux/platform_device.h>
20#include <linux/i2c-gpio.h> 21#include <linux/i2c-gpio.h>
21 22
@@ -23,7 +24,6 @@
23 24
24#include <mach/board.h> 25#include <mach/board.h>
25#include <mach/cpu.h> 26#include <mach/cpu.h>
26#include <mach/gpio.h>
27#include <mach/at91cap9.h> 27#include <mach/at91cap9.h>
28#include <mach/at91cap9_matrix.h> 28#include <mach/at91cap9_matrix.h>
29#include <mach/at91sam9_smc.h> 29#include <mach/at91sam9_smc.h>
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index 7227755ffec6..978be950035a 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -14,11 +14,11 @@
14#include <asm/mach/map.h> 14#include <asm/mach/map.h>
15 15
16#include <linux/dma-mapping.h> 16#include <linux/dma-mapping.h>
17#include <linux/gpio.h>
17#include <linux/platform_device.h> 18#include <linux/platform_device.h>
18#include <linux/i2c-gpio.h> 19#include <linux/i2c-gpio.h>
19 20
20#include <mach/board.h> 21#include <mach/board.h>
21#include <mach/gpio.h>
22#include <mach/at91rm9200.h> 22#include <mach/at91rm9200.h>
23#include <mach/at91rm9200_mc.h> 23#include <mach/at91rm9200_mc.h>
24 24
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 39f81f47b4ba..a53b3de9daa2 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -13,11 +13,11 @@
13#include <asm/mach/map.h> 13#include <asm/mach/map.h>
14 14
15#include <linux/dma-mapping.h> 15#include <linux/dma-mapping.h>
16#include <linux/gpio.h>
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
17#include <linux/i2c-gpio.h> 18#include <linux/i2c-gpio.h>
18 19
19#include <mach/board.h> 20#include <mach/board.h>
20#include <mach/gpio.h>
21#include <mach/cpu.h> 21#include <mach/cpu.h>
22#include <mach/at91sam9260.h> 22#include <mach/at91sam9260.h>
23#include <mach/at91sam9260_matrix.h> 23#include <mach/at91sam9260_matrix.h>
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 0f917928eeb7..4e647b653339 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -14,6 +14,7 @@
14#include <asm/mach/map.h> 14#include <asm/mach/map.h>
15 15
16#include <linux/dma-mapping.h> 16#include <linux/dma-mapping.h>
17#include <linux/gpio.h>
17#include <linux/platform_device.h> 18#include <linux/platform_device.h>
18#include <linux/i2c-gpio.h> 19#include <linux/i2c-gpio.h>
19 20
@@ -21,7 +22,6 @@
21#include <video/atmel_lcdc.h> 22#include <video/atmel_lcdc.h>
22 23
23#include <mach/board.h> 24#include <mach/board.h>
24#include <mach/gpio.h>
25#include <mach/at91sam9261.h> 25#include <mach/at91sam9261.h>
26#include <mach/at91sam9261_matrix.h> 26#include <mach/at91sam9261_matrix.h>
27#include <mach/at91sam9_smc.h> 27#include <mach/at91sam9_smc.h>
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index a050f41fc860..dd7662bc395f 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -13,6 +13,7 @@
13#include <asm/mach/map.h> 13#include <asm/mach/map.h>
14 14
15#include <linux/dma-mapping.h> 15#include <linux/dma-mapping.h>
16#include <linux/gpio.h>
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
17#include <linux/i2c-gpio.h> 18#include <linux/i2c-gpio.h>
18 19
@@ -20,7 +21,6 @@
20#include <video/atmel_lcdc.h> 21#include <video/atmel_lcdc.h>
21 22
22#include <mach/board.h> 23#include <mach/board.h>
23#include <mach/gpio.h>
24#include <mach/at91sam9263.h> 24#include <mach/at91sam9263.h>
25#include <mach/at91sam9263_matrix.h> 25#include <mach/at91sam9263_matrix.h>
26#include <mach/at91sam9_smc.h> 26#include <mach/at91sam9_smc.h>
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 600bffb01edb..c3dfb1b3b1e3 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -13,6 +13,7 @@
13#include <asm/mach/map.h> 13#include <asm/mach/map.h>
14 14
15#include <linux/dma-mapping.h> 15#include <linux/dma-mapping.h>
16#include <linux/gpio.h>
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
17#include <linux/i2c-gpio.h> 18#include <linux/i2c-gpio.h>
18#include <linux/atmel-mci.h> 19#include <linux/atmel-mci.h>
@@ -21,7 +22,6 @@
21#include <video/atmel_lcdc.h> 22#include <video/atmel_lcdc.h>
22 23
23#include <mach/board.h> 24#include <mach/board.h>
24#include <mach/gpio.h>
25#include <mach/at91sam9g45.h> 25#include <mach/at91sam9g45.h>
26#include <mach/at91sam9g45_matrix.h> 26#include <mach/at91sam9g45_matrix.h>
27#include <mach/at91sam9_smc.h> 27#include <mach/at91sam9_smc.h>
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index aacb19dc9225..305a851b5bff 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -10,6 +10,7 @@
10#include <asm/mach/map.h> 10#include <asm/mach/map.h>
11 11
12#include <linux/dma-mapping.h> 12#include <linux/dma-mapping.h>
13#include <linux/gpio.h>
13#include <linux/platform_device.h> 14#include <linux/platform_device.h>
14#include <linux/i2c-gpio.h> 15#include <linux/i2c-gpio.h>
15 16
@@ -17,7 +18,6 @@
17#include <video/atmel_lcdc.h> 18#include <video/atmel_lcdc.h>
18 19
19#include <mach/board.h> 20#include <mach/board.h>
20#include <mach/gpio.h>
21#include <mach/at91sam9rl.h> 21#include <mach/at91sam9rl.h>
22#include <mach/at91sam9rl_matrix.h> 22#include <mach/at91sam9rl_matrix.h>
23#include <mach/at91sam9_smc.h> 23#include <mach/at91sam9_smc.h>
diff --git a/arch/arm/mach-at91/board-1arm.c b/arch/arm/mach-at91/board-1arm.c
index 5aa58851eb39..367d5cd5e362 100644
--- a/arch/arm/mach-at91/board-1arm.c
+++ b/arch/arm/mach-at91/board-1arm.c
@@ -19,6 +19,7 @@
19 */ 19 */
20 20
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/gpio.h>
22#include <linux/init.h> 23#include <linux/init.h>
23#include <linux/mm.h> 24#include <linux/mm.h>
24#include <linux/module.h> 25#include <linux/module.h>
@@ -34,7 +35,6 @@
34#include <asm/mach/irq.h> 35#include <asm/mach/irq.h>
35 36
36#include <mach/board.h> 37#include <mach/board.h>
37#include <mach/gpio.h>
38#include <mach/cpu.h> 38#include <mach/cpu.h>
39 39
40#include "generic.h" 40#include "generic.h"
diff --git a/arch/arm/mach-at91/board-afeb-9260v1.c b/arch/arm/mach-at91/board-afeb-9260v1.c
index b0c796d42e49..0487ea10c2d6 100644
--- a/arch/arm/mach-at91/board-afeb-9260v1.c
+++ b/arch/arm/mach-at91/board-afeb-9260v1.c
@@ -25,6 +25,7 @@
25 */ 25 */
26 26
27#include <linux/types.h> 27#include <linux/types.h>
28#include <linux/gpio.h>
28#include <linux/init.h> 29#include <linux/init.h>
29#include <linux/mm.h> 30#include <linux/mm.h>
30#include <linux/module.h> 31#include <linux/module.h>
@@ -43,7 +44,6 @@
43#include <asm/mach/irq.h> 44#include <asm/mach/irq.h>
44 45
45#include <mach/board.h> 46#include <mach/board.h>
46#include <mach/gpio.h>
47 47
48#include "generic.h" 48#include "generic.h"
49 49
diff --git a/arch/arm/mach-at91/board-cam60.c b/arch/arm/mach-at91/board-cam60.c
index d1abd5898e85..747b2eaa9737 100644
--- a/arch/arm/mach-at91/board-cam60.c
+++ b/arch/arm/mach-at91/board-cam60.c
@@ -21,6 +21,7 @@
21 */ 21 */
22 22
23#include <linux/types.h> 23#include <linux/types.h>
24#include <linux/gpio.h>
24#include <linux/init.h> 25#include <linux/init.h>
25#include <linux/mm.h> 26#include <linux/mm.h>
26#include <linux/module.h> 27#include <linux/module.h>
@@ -38,7 +39,6 @@
38#include <asm/mach/irq.h> 39#include <asm/mach/irq.h>
39 40
40#include <mach/board.h> 41#include <mach/board.h>
41#include <mach/gpio.h>
42#include <mach/at91sam9_smc.h> 42#include <mach/at91sam9_smc.h>
43 43
44#include "sam9_smc.h" 44#include "sam9_smc.h"
diff --git a/arch/arm/mach-at91/board-cap9adk.c b/arch/arm/mach-at91/board-cap9adk.c
index 679b0b743e92..062670351a6a 100644
--- a/arch/arm/mach-at91/board-cap9adk.c
+++ b/arch/arm/mach-at91/board-cap9adk.c
@@ -22,6 +22,7 @@
22 */ 22 */
23 23
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/gpio.h>
25#include <linux/init.h> 26#include <linux/init.h>
26#include <linux/mm.h> 27#include <linux/mm.h>
27#include <linux/module.h> 28#include <linux/module.h>
@@ -41,7 +42,6 @@
41#include <asm/mach/map.h> 42#include <asm/mach/map.h>
42 43
43#include <mach/board.h> 44#include <mach/board.h>
44#include <mach/gpio.h>
45#include <mach/at91cap9_matrix.h> 45#include <mach/at91cap9_matrix.h>
46#include <mach/at91sam9_smc.h> 46#include <mach/at91sam9_smc.h>
47#include <mach/system_rev.h> 47#include <mach/system_rev.h>
diff --git a/arch/arm/mach-at91/board-carmeva.c b/arch/arm/mach-at91/board-carmeva.c
index c578c5d90728..774c87fcbd5b 100644
--- a/arch/arm/mach-at91/board-carmeva.c
+++ b/arch/arm/mach-at91/board-carmeva.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/gpio.h>
23#include <linux/init.h> 24#include <linux/init.h>
24#include <linux/mm.h> 25#include <linux/mm.h>
25#include <linux/module.h> 26#include <linux/module.h>
@@ -35,7 +36,6 @@
35 36
36#include <mach/hardware.h> 37#include <mach/hardware.h>
37#include <mach/board.h> 38#include <mach/board.h>
38#include <mach/gpio.h>
39 39
40#include "generic.h" 40#include "generic.h"
41 41
diff --git a/arch/arm/mach-at91/board-cpu9krea.c b/arch/arm/mach-at91/board-cpu9krea.c
index f4da8a16d5dc..fc885a4ce243 100644
--- a/arch/arm/mach-at91/board-cpu9krea.c
+++ b/arch/arm/mach-at91/board-cpu9krea.c
@@ -21,6 +21,7 @@
21 */ 21 */
22 22
23#include <linux/types.h> 23#include <linux/types.h>
24#include <linux/gpio.h>
24#include <linux/init.h> 25#include <linux/init.h>
25#include <linux/mm.h> 26#include <linux/mm.h>
26#include <linux/module.h> 27#include <linux/module.h>
@@ -40,7 +41,6 @@
40 41
41#include <mach/hardware.h> 42#include <mach/hardware.h>
42#include <mach/board.h> 43#include <mach/board.h>
43#include <mach/gpio.h>
44#include <mach/at91sam9_smc.h> 44#include <mach/at91sam9_smc.h>
45#include <mach/at91sam9260_matrix.h> 45#include <mach/at91sam9260_matrix.h>
46 46
diff --git a/arch/arm/mach-at91/board-cpuat91.c b/arch/arm/mach-at91/board-cpuat91.c
index 2d919f5a4f57..d35e65b08ccd 100644
--- a/arch/arm/mach-at91/board-cpuat91.c
+++ b/arch/arm/mach-at91/board-cpuat91.c
@@ -19,6 +19,7 @@
19 */ 19 */
20 20
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/gpio.h>
22#include <linux/init.h> 23#include <linux/init.h>
23#include <linux/mm.h> 24#include <linux/mm.h>
24#include <linux/module.h> 25#include <linux/module.h>
@@ -36,7 +37,6 @@
36#include <asm/mach/irq.h> 37#include <asm/mach/irq.h>
37 38
38#include <mach/board.h> 39#include <mach/board.h>
39#include <mach/gpio.h>
40#include <mach/at91rm9200_mc.h> 40#include <mach/at91rm9200_mc.h>
41#include <mach/cpu.h> 41#include <mach/cpu.h>
42 42
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c
index 17654d5e94e6..c3936665e645 100644
--- a/arch/arm/mach-at91/board-csb337.c
+++ b/arch/arm/mach-at91/board-csb337.c
@@ -19,6 +19,7 @@
19 */ 19 */
20 20
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/gpio.h>
22#include <linux/init.h> 23#include <linux/init.h>
23#include <linux/mm.h> 24#include <linux/mm.h>
24#include <linux/module.h> 25#include <linux/module.h>
@@ -38,7 +39,6 @@
38 39
39#include <mach/hardware.h> 40#include <mach/hardware.h>
40#include <mach/board.h> 41#include <mach/board.h>
41#include <mach/gpio.h>
42 42
43#include "generic.h" 43#include "generic.h"
44 44
diff --git a/arch/arm/mach-at91/board-csb637.c b/arch/arm/mach-at91/board-csb637.c
index 72b55674616c..586100e2acbb 100644
--- a/arch/arm/mach-at91/board-csb637.c
+++ b/arch/arm/mach-at91/board-csb637.c
@@ -20,6 +20,7 @@
20 20
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/gpio.h>
23#include <linux/mm.h> 24#include <linux/mm.h>
24#include <linux/module.h> 25#include <linux/module.h>
25#include <linux/platform_device.h> 26#include <linux/platform_device.h>
@@ -35,7 +36,6 @@
35 36
36#include <mach/hardware.h> 37#include <mach/hardware.h>
37#include <mach/board.h> 38#include <mach/board.h>
38#include <mach/gpio.h>
39 39
40#include "generic.h" 40#include "generic.h"
41 41
diff --git a/arch/arm/mach-at91/board-eb9200.c b/arch/arm/mach-at91/board-eb9200.c
index 01170a2766a8..45db7a3dbef0 100644
--- a/arch/arm/mach-at91/board-eb9200.c
+++ b/arch/arm/mach-at91/board-eb9200.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/gpio.h>
23#include <linux/init.h> 24#include <linux/init.h>
24#include <linux/mm.h> 25#include <linux/mm.h>
25#include <linux/module.h> 26#include <linux/module.h>
@@ -35,7 +36,6 @@
35#include <asm/mach/irq.h> 36#include <asm/mach/irq.h>
36 37
37#include <mach/board.h> 38#include <mach/board.h>
38#include <mach/gpio.h>
39 39
40#include "generic.h" 40#include "generic.h"
41 41
diff --git a/arch/arm/mach-at91/board-ecbat91.c b/arch/arm/mach-at91/board-ecbat91.c
index 7c0313c51f26..2f9c16d29212 100644
--- a/arch/arm/mach-at91/board-ecbat91.c
+++ b/arch/arm/mach-at91/board-ecbat91.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/gpio.h>
23#include <linux/init.h> 24#include <linux/init.h>
24#include <linux/mm.h> 25#include <linux/mm.h>
25#include <linux/module.h> 26#include <linux/module.h>
@@ -37,7 +38,6 @@
37#include <asm/mach/irq.h> 38#include <asm/mach/irq.h>
38 39
39#include <mach/board.h> 40#include <mach/board.h>
40#include <mach/gpio.h>
41#include <mach/cpu.h> 41#include <mach/cpu.h>
42 42
43#include "generic.h" 43#include "generic.h"
diff --git a/arch/arm/mach-at91/board-kafa.c b/arch/arm/mach-at91/board-kafa.c
index 4a170890b3b1..3bae73e63633 100644
--- a/arch/arm/mach-at91/board-kafa.c
+++ b/arch/arm/mach-at91/board-kafa.c
@@ -19,6 +19,7 @@
19 */ 19 */
20 20
21#include <linux/types.h> 21#include <linux/types.h>
22#include <linux/gpio.h>
22#include <linux/init.h> 23#include <linux/init.h>
23#include <linux/mm.h> 24#include <linux/mm.h>
24#include <linux/module.h> 25#include <linux/module.h>
@@ -34,7 +35,6 @@
34#include <asm/mach/irq.h> 35#include <asm/mach/irq.h>
35 36
36#include <mach/board.h> 37#include <mach/board.h>
37#include <mach/gpio.h>
38#include <mach/cpu.h> 38#include <mach/cpu.h>
39 39
40#include "generic.h" 40#include "generic.h"
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c
index 9dc8d496ead1..15a3f1a87ab0 100644
--- a/arch/arm/mach-at91/board-kb9202.c
+++ b/arch/arm/mach-at91/board-kb9202.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/gpio.h>
23#include <linux/init.h> 24#include <linux/init.h>
24#include <linux/mm.h> 25#include <linux/mm.h>
25#include <linux/module.h> 26#include <linux/module.h>
@@ -35,7 +36,6 @@
35#include <asm/mach/irq.h> 36#include <asm/mach/irq.h>
36 37
37#include <mach/board.h> 38#include <mach/board.h>
38#include <mach/gpio.h>
39#include <mach/cpu.h> 39#include <mach/cpu.h>
40#include <mach/at91rm9200_mc.h> 40#include <mach/at91rm9200_mc.h>
41 41
diff --git a/arch/arm/mach-at91/board-neocore926.c b/arch/arm/mach-at91/board-neocore926.c
index 9bc6ab32e0ac..6094496f7edb 100644
--- a/arch/arm/mach-at91/board-neocore926.c
+++ b/arch/arm/mach-at91/board-neocore926.c
@@ -21,6 +21,7 @@
21 */ 21 */
22 22
23#include <linux/types.h> 23#include <linux/types.h>
24#include <linux/gpio.h>
24#include <linux/init.h> 25#include <linux/init.h>
25#include <linux/mm.h> 26#include <linux/mm.h>
26#include <linux/module.h> 27#include <linux/module.h>
@@ -44,7 +45,6 @@
44 45
45#include <mach/hardware.h> 46#include <mach/hardware.h>
46#include <mach/board.h> 47#include <mach/board.h>
47#include <mach/gpio.h>
48#include <mach/at91sam9_smc.h> 48#include <mach/at91sam9_smc.h>
49 49
50#include "sam9_smc.h" 50#include "sam9_smc.h"
diff --git a/arch/arm/mach-at91/board-picotux200.c b/arch/arm/mach-at91/board-picotux200.c
index b7b8390e8a00..0a8fe6a1b7c8 100644
--- a/arch/arm/mach-at91/board-picotux200.c
+++ b/arch/arm/mach-at91/board-picotux200.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/gpio.h>
23#include <linux/init.h> 24#include <linux/init.h>
24#include <linux/mm.h> 25#include <linux/mm.h>
25#include <linux/module.h> 26#include <linux/module.h>
@@ -37,7 +38,6 @@
37#include <asm/mach/irq.h> 38#include <asm/mach/irq.h>
38 39
39#include <mach/board.h> 40#include <mach/board.h>
40#include <mach/gpio.h>
41#include <mach/at91rm9200_mc.h> 41#include <mach/at91rm9200_mc.h>
42 42
43#include "generic.h" 43#include "generic.h"
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c
index 81f911033681..938cc390bea3 100644
--- a/arch/arm/mach-at91/board-qil-a9260.c
+++ b/arch/arm/mach-at91/board-qil-a9260.c
@@ -21,6 +21,7 @@
21 */ 21 */
22 22
23#include <linux/types.h> 23#include <linux/types.h>
24#include <linux/gpio.h>
24#include <linux/init.h> 25#include <linux/init.h>
25#include <linux/mm.h> 26#include <linux/mm.h>
26#include <linux/module.h> 27#include <linux/module.h>
@@ -40,7 +41,6 @@
40 41
41#include <mach/hardware.h> 42#include <mach/hardware.h>
42#include <mach/board.h> 43#include <mach/board.h>
43#include <mach/gpio.h>
44#include <mach/at91sam9_smc.h> 44#include <mach/at91sam9_smc.h>
45#include <mach/at91_shdwc.h> 45#include <mach/at91_shdwc.h>
46 46
diff --git a/arch/arm/mach-at91/board-rm9200dk.c b/arch/arm/mach-at91/board-rm9200dk.c
index 6f08faadb474..b4ac30e38a9e 100644
--- a/arch/arm/mach-at91/board-rm9200dk.c
+++ b/arch/arm/mach-at91/board-rm9200dk.c
@@ -22,6 +22,7 @@
22 */ 22 */
23 23
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/gpio.h>
25#include <linux/init.h> 26#include <linux/init.h>
26#include <linux/mm.h> 27#include <linux/mm.h>
27#include <linux/module.h> 28#include <linux/module.h>
@@ -39,7 +40,6 @@
39 40
40#include <mach/hardware.h> 41#include <mach/hardware.h>
41#include <mach/board.h> 42#include <mach/board.h>
42#include <mach/gpio.h>
43#include <mach/at91rm9200_mc.h> 43#include <mach/at91rm9200_mc.h>
44 44
45#include "generic.h" 45#include "generic.h"
diff --git a/arch/arm/mach-at91/board-rm9200ek.c b/arch/arm/mach-at91/board-rm9200ek.c
index 85bcccd7b9e4..99fd7f8aee0e 100644
--- a/arch/arm/mach-at91/board-rm9200ek.c
+++ b/arch/arm/mach-at91/board-rm9200ek.c
@@ -22,6 +22,7 @@
22 */ 22 */
23 23
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/gpio.h>
25#include <linux/init.h> 26#include <linux/init.h>
26#include <linux/mm.h> 27#include <linux/mm.h>
27#include <linux/module.h> 28#include <linux/module.h>
@@ -39,7 +40,6 @@
39 40
40#include <mach/hardware.h> 41#include <mach/hardware.h>
41#include <mach/board.h> 42#include <mach/board.h>
42#include <mach/gpio.h>
43#include <mach/at91rm9200_mc.h> 43#include <mach/at91rm9200_mc.h>
44 44
45#include "generic.h" 45#include "generic.h"
diff --git a/arch/arm/mach-at91/board-sam9-l9260.c b/arch/arm/mach-at91/board-sam9-l9260.c
index 4d3a02f1289e..2a21e790250e 100644
--- a/arch/arm/mach-at91/board-sam9-l9260.c
+++ b/arch/arm/mach-at91/board-sam9-l9260.c
@@ -21,6 +21,7 @@
21 */ 21 */
22 22
23#include <linux/types.h> 23#include <linux/types.h>
24#include <linux/gpio.h>
24#include <linux/init.h> 25#include <linux/init.h>
25#include <linux/mm.h> 26#include <linux/mm.h>
26#include <linux/module.h> 27#include <linux/module.h>
@@ -37,7 +38,6 @@
37#include <asm/mach/irq.h> 38#include <asm/mach/irq.h>
38 39
39#include <mach/board.h> 40#include <mach/board.h>
40#include <mach/gpio.h>
41#include <mach/at91sam9_smc.h> 41#include <mach/at91sam9_smc.h>
42 42
43#include "sam9_smc.h" 43#include "sam9_smc.h"
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
index 8a50c3e67186..89c8b579bfda 100644
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ b/arch/arm/mach-at91/board-sam9260ek.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/gpio.h>
23#include <linux/init.h> 24#include <linux/init.h>
24#include <linux/mm.h> 25#include <linux/mm.h>
25#include <linux/module.h> 26#include <linux/module.h>
@@ -41,7 +42,6 @@
41 42
42#include <mach/hardware.h> 43#include <mach/hardware.h>
43#include <mach/board.h> 44#include <mach/board.h>
44#include <mach/gpio.h>
45#include <mach/at91sam9_smc.h> 45#include <mach/at91sam9_smc.h>
46#include <mach/at91_shdwc.h> 46#include <mach/at91_shdwc.h>
47#include <mach/system_rev.h> 47#include <mach/system_rev.h>
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index 5096a0ec50c1..3741f43cdae9 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/gpio.h>
23#include <linux/init.h> 24#include <linux/init.h>
24#include <linux/mm.h> 25#include <linux/mm.h>
25#include <linux/module.h> 26#include <linux/module.h>
@@ -45,7 +46,6 @@
45 46
46#include <mach/hardware.h> 47#include <mach/hardware.h>
47#include <mach/board.h> 48#include <mach/board.h>
48#include <mach/gpio.h>
49#include <mach/at91sam9_smc.h> 49#include <mach/at91sam9_smc.h>
50#include <mach/at91_shdwc.h> 50#include <mach/at91_shdwc.h>
51#include <mach/system_rev.h> 51#include <mach/system_rev.h>
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index ea8f185d3b9d..a580dd451a41 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/gpio.h>
23#include <linux/init.h> 24#include <linux/init.h>
24#include <linux/mm.h> 25#include <linux/mm.h>
25#include <linux/module.h> 26#include <linux/module.h>
@@ -44,7 +45,6 @@
44 45
45#include <mach/hardware.h> 46#include <mach/hardware.h>
46#include <mach/board.h> 47#include <mach/board.h>
47#include <mach/gpio.h>
48#include <mach/at91sam9_smc.h> 48#include <mach/at91sam9_smc.h>
49#include <mach/at91_shdwc.h> 49#include <mach/at91_shdwc.h>
50#include <mach/system_rev.h> 50#include <mach/system_rev.h>
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index 817f59d7251b..8d77c2ff96b2 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -18,6 +18,7 @@
18 */ 18 */
19 19
20#include <linux/types.h> 20#include <linux/types.h>
21#include <linux/gpio.h>
21#include <linux/init.h> 22#include <linux/init.h>
22#include <linux/mm.h> 23#include <linux/mm.h>
23#include <linux/module.h> 24#include <linux/module.h>
@@ -41,7 +42,6 @@
41#include <asm/mach/irq.h> 42#include <asm/mach/irq.h>
42 43
43#include <mach/board.h> 44#include <mach/board.h>
44#include <mach/gpio.h>
45#include <mach/at91sam9_smc.h> 45#include <mach/at91sam9_smc.h>
46#include <mach/system_rev.h> 46#include <mach/system_rev.h>
47 47
diff --git a/arch/arm/mach-at91/board-sam9m10g45ek.c b/arch/arm/mach-at91/board-sam9m10g45ek.c
index ad234ccbf57e..2d6203ac1a42 100644
--- a/arch/arm/mach-at91/board-sam9m10g45ek.c
+++ b/arch/arm/mach-at91/board-sam9m10g45ek.c
@@ -14,6 +14,7 @@
14 */ 14 */
15 15
16#include <linux/types.h> 16#include <linux/types.h>
17#include <linux/gpio.h>
17#include <linux/init.h> 18#include <linux/init.h>
18#include <linux/mm.h> 19#include <linux/mm.h>
19#include <linux/module.h> 20#include <linux/module.h>
@@ -38,7 +39,6 @@
38#include <asm/mach/irq.h> 39#include <asm/mach/irq.h>
39 40
40#include <mach/board.h> 41#include <mach/board.h>
41#include <mach/gpio.h>
42#include <mach/at91sam9_smc.h> 42#include <mach/at91sam9_smc.h>
43#include <mach/at91_shdwc.h> 43#include <mach/at91_shdwc.h>
44#include <mach/system_rev.h> 44#include <mach/system_rev.h>
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index 4f14b54b93a8..39a28effc3df 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -8,6 +8,7 @@
8 */ 8 */
9 9
10#include <linux/types.h> 10#include <linux/types.h>
11#include <linux/gpio.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/mm.h> 13#include <linux/mm.h>
13#include <linux/module.h> 14#include <linux/module.h>
@@ -30,7 +31,6 @@
30 31
31#include <mach/hardware.h> 32#include <mach/hardware.h>
32#include <mach/board.h> 33#include <mach/board.h>
33#include <mach/gpio.h>
34#include <mach/at91sam9_smc.h> 34#include <mach/at91sam9_smc.h>
35#include <mach/at91_shdwc.h> 35#include <mach/at91_shdwc.h>
36 36
diff --git a/arch/arm/mach-at91/board-usb-a9260.c b/arch/arm/mach-at91/board-usb-a9260.c
index 8c4c1a02c4be..bac9b65cf551 100644
--- a/arch/arm/mach-at91/board-usb-a9260.c
+++ b/arch/arm/mach-at91/board-usb-a9260.c
@@ -21,6 +21,7 @@
21 */ 21 */
22 22
23#include <linux/types.h> 23#include <linux/types.h>
24#include <linux/gpio.h>
24#include <linux/init.h> 25#include <linux/init.h>
25#include <linux/mm.h> 26#include <linux/mm.h>
26#include <linux/module.h> 27#include <linux/module.h>
@@ -40,7 +41,6 @@
40 41
41#include <mach/hardware.h> 42#include <mach/hardware.h>
42#include <mach/board.h> 43#include <mach/board.h>
43#include <mach/gpio.h>
44#include <mach/at91sam9_smc.h> 44#include <mach/at91sam9_smc.h>
45#include <mach/at91_shdwc.h> 45#include <mach/at91_shdwc.h>
46 46
diff --git a/arch/arm/mach-at91/board-usb-a9263.c b/arch/arm/mach-at91/board-usb-a9263.c
index 25e793782a4e..5bd735787d6d 100644
--- a/arch/arm/mach-at91/board-usb-a9263.c
+++ b/arch/arm/mach-at91/board-usb-a9263.c
@@ -21,6 +21,7 @@
21 */ 21 */
22 22
23#include <linux/types.h> 23#include <linux/types.h>
24#include <linux/gpio.h>
24#include <linux/init.h> 25#include <linux/init.h>
25#include <linux/mm.h> 26#include <linux/mm.h>
26#include <linux/module.h> 27#include <linux/module.h>
@@ -39,7 +40,6 @@
39 40
40#include <mach/hardware.h> 41#include <mach/hardware.h>
41#include <mach/board.h> 42#include <mach/board.h>
42#include <mach/gpio.h>
43#include <mach/at91sam9_smc.h> 43#include <mach/at91sam9_smc.h>
44#include <mach/at91_shdwc.h> 44#include <mach/at91_shdwc.h>
45 45
diff --git a/arch/arm/mach-at91/board-yl-9200.c b/arch/arm/mach-at91/board-yl-9200.c
index 95edcbd2aec6..3c288b396fc4 100644
--- a/arch/arm/mach-at91/board-yl-9200.c
+++ b/arch/arm/mach-at91/board-yl-9200.c
@@ -22,6 +22,7 @@
22 */ 22 */
23 23
24#include <linux/types.h> 24#include <linux/types.h>
25#include <linux/gpio.h>
25#include <linux/init.h> 26#include <linux/init.h>
26#include <linux/mm.h> 27#include <linux/mm.h>
27#include <linux/module.h> 28#include <linux/module.h>
@@ -43,7 +44,6 @@
43 44
44#include <mach/hardware.h> 45#include <mach/hardware.h>
45#include <mach/board.h> 46#include <mach/board.h>
46#include <mach/gpio.h>
47#include <mach/at91rm9200_mc.h> 47#include <mach/at91rm9200_mc.h>
48#include <mach/cpu.h> 48#include <mach/cpu.h>
49 49
diff --git a/arch/arm/mach-at91/gpio.c b/arch/arm/mach-at91/gpio.c
index 4615528205c8..224e9e2f8674 100644
--- a/arch/arm/mach-at91/gpio.c
+++ b/arch/arm/mach-at91/gpio.c
@@ -11,6 +11,7 @@
11 11
12#include <linux/clk.h> 12#include <linux/clk.h>
13#include <linux/errno.h> 13#include <linux/errno.h>
14#include <linux/gpio.h>
14#include <linux/interrupt.h> 15#include <linux/interrupt.h>
15#include <linux/irq.h> 16#include <linux/irq.h>
16#include <linux/debugfs.h> 17#include <linux/debugfs.h>
@@ -22,9 +23,6 @@
22 23
23#include <mach/hardware.h> 24#include <mach/hardware.h>
24#include <mach/at91_pio.h> 25#include <mach/at91_pio.h>
25#include <mach/gpio.h>
26
27#include <asm/gpio.h>
28 26
29#include "generic.h" 27#include "generic.h"
30 28
diff --git a/arch/arm/mach-at91/include/mach/gpio.h b/arch/arm/mach-at91/include/mach/gpio.h
index 056dc6674b6b..2b9a1f51210f 100644
--- a/arch/arm/mach-at91/include/mach/gpio.h
+++ b/arch/arm/mach-at91/include/mach/gpio.h
@@ -214,11 +214,6 @@ extern void at91_gpio_resume(void);
214 */ 214 */
215 215
216#include <asm/errno.h> 216#include <asm/errno.h>
217#include <asm-generic/gpio.h> /* cansleep wrappers */
218
219#define gpio_get_value __gpio_get_value
220#define gpio_set_value __gpio_set_value
221#define gpio_cansleep __gpio_cansleep
222 217
223#define gpio_to_irq(gpio) (gpio) 218#define gpio_to_irq(gpio) (gpio)
224#define irq_to_gpio(irq) (irq) 219#define irq_to_gpio(irq) (irq)
diff --git a/arch/arm/mach-at91/leds.c b/arch/arm/mach-at91/leds.c
index 0415a839e1ad..8dfafe76ffe6 100644
--- a/arch/arm/mach-at91/leds.c
+++ b/arch/arm/mach-at91/leds.c
@@ -9,13 +9,13 @@
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10*/ 10*/
11 11
12#include <linux/gpio.h>
12#include <linux/kernel.h> 13#include <linux/kernel.h>
13#include <linux/module.h> 14#include <linux/module.h>
14#include <linux/init.h> 15#include <linux/init.h>
15#include <linux/platform_device.h> 16#include <linux/platform_device.h>
16 17
17#include <mach/board.h> 18#include <mach/board.h>
18#include <mach/gpio.h>
19 19
20 20
21/* ------------------------------------------------------------------------- */ 21/* ------------------------------------------------------------------------- */
diff --git a/arch/arm/mach-at91/pm.c b/arch/arm/mach-at91/pm.c
index 4159eca78945..7046158109d7 100644
--- a/arch/arm/mach-at91/pm.c
+++ b/arch/arm/mach-at91/pm.c
@@ -10,6 +10,7 @@
10 * (at your option) any later version. 10 * (at your option) any later version.
11 */ 11 */
12 12
13#include <linux/gpio.h>
13#include <linux/suspend.h> 14#include <linux/suspend.h>
14#include <linux/sched.h> 15#include <linux/sched.h>
15#include <linux/proc_fs.h> 16#include <linux/proc_fs.h>
@@ -25,7 +26,6 @@
25#include <asm/mach/irq.h> 26#include <asm/mach/irq.h>
26 27
27#include <mach/at91_pmc.h> 28#include <mach/at91_pmc.h>
28#include <mach/gpio.h>
29#include <mach/cpu.h> 29#include <mach/cpu.h>
30 30
31#include "generic.h" 31#include "generic.h"
diff --git a/arch/arm/mach-bcmring/Kconfig b/arch/arm/mach-bcmring/Kconfig
index 457b4384913e..9170d16dca50 100644
--- a/arch/arm/mach-bcmring/Kconfig
+++ b/arch/arm/mach-bcmring/Kconfig
@@ -17,5 +17,3 @@ config BCM_ZRELADDR
17 hex "Compressed ZREL ADDR" 17 hex "Compressed ZREL ADDR"
18 18
19endmenu 19endmenu
20
21# source "drivers/char/bcmring/Kconfig"
diff --git a/arch/arm/mach-bcmring/Makefile.boot b/arch/arm/mach-bcmring/Makefile.boot
index fb53b283bebb..aef2467757fa 100644
--- a/arch/arm/mach-bcmring/Makefile.boot
+++ b/arch/arm/mach-bcmring/Makefile.boot
@@ -1,6 +1,6 @@
1# Address where decompressor will be written and eventually executed. 1# Address where decompressor will be written and eventually executed.
2# 2#
3# default to SDRAM 3# default to SDRAM
4zreladdr-y := $(CONFIG_BCM_ZRELADDR) 4zreladdr-y += $(CONFIG_BCM_ZRELADDR)
5params_phys-y := 0x00000800 5params_phys-y := 0x00000800
6 6
diff --git a/arch/arm/mach-bcmring/arch.c b/arch/arm/mach-bcmring/arch.c
index a604b9ebb501..31a143592c81 100644
--- a/arch/arm/mach-bcmring/arch.c
+++ b/arch/arm/mach-bcmring/arch.c
@@ -136,8 +136,8 @@ static void __init bcmring_init_machine(void)
136* 136*
137*****************************************************************************/ 137*****************************************************************************/
138 138
139static void __init bcmring_fixup(struct machine_desc *desc, 139static void __init bcmring_fixup(struct tag *t, char **cmdline,
140 struct tag *t, char **cmdline, struct meminfo *mi) { 140 struct meminfo *mi) {
141#ifdef CONFIG_BLK_DEV_INITRD 141#ifdef CONFIG_BLK_DEV_INITRD
142 printk(KERN_NOTICE "bcmring_fixup\n"); 142 printk(KERN_NOTICE "bcmring_fixup\n");
143 t->hdr.tag = ATAG_CORE; 143 t->hdr.tag = ATAG_CORE;
diff --git a/arch/arm/mach-bcmring/irq.c b/arch/arm/mach-bcmring/irq.c
index c48feaf4e8e9..437fa683bcb2 100644
--- a/arch/arm/mach-bcmring/irq.c
+++ b/arch/arm/mach-bcmring/irq.c
@@ -20,7 +20,6 @@
20#include <linux/stddef.h> 20#include <linux/stddef.h>
21#include <linux/list.h> 21#include <linux/list.h>
22#include <linux/timer.h> 22#include <linux/timer.h>
23#include <linux/version.h>
24#include <linux/io.h> 23#include <linux/io.h>
25 24
26#include <mach/hardware.h> 25#include <mach/hardware.h>
diff --git a/arch/arm/mach-bcmring/timer.c b/arch/arm/mach-bcmring/timer.c
index 2d415d2a8e68..af9c3d7e2a0c 100644
--- a/arch/arm/mach-bcmring/timer.c
+++ b/arch/arm/mach-bcmring/timer.c
@@ -12,7 +12,6 @@
12* consent. 12* consent.
13*****************************************************************************/ 13*****************************************************************************/
14 14
15#include <linux/version.h>
16#include <linux/types.h> 15#include <linux/types.h>
17#include <linux/module.h> 16#include <linux/module.h>
18#include <csp/tmrHw.h> 17#include <csp/tmrHw.h>
diff --git a/arch/arm/mach-clps711x/Makefile.boot b/arch/arm/mach-clps711x/Makefile.boot
index a51fcef64fe0..9398e859b5af 100644
--- a/arch/arm/mach-clps711x/Makefile.boot
+++ b/arch/arm/mach-clps711x/Makefile.boot
@@ -1,5 +1,5 @@
1# The standard locations for stuff on CLPS711x type processors 1# The standard locations for stuff on CLPS711x type processors
2 zreladdr-y := 0xc0028000 2 zreladdr-y += 0xc0028000
3params_phys-y := 0xc0000100 3params_phys-y := 0xc0000100
4# Should probably have some agreement on these... 4# Should probably have some agreement on these...
5initrd_phys-$(CONFIG_ARCH_P720T) := 0xc0400000 5initrd_phys-$(CONFIG_ARCH_P720T) := 0xc0400000
diff --git a/arch/arm/mach-clps711x/clep7312.c b/arch/arm/mach-clps711x/clep7312.c
index 06c8abd9371f..80496c09ac59 100644
--- a/arch/arm/mach-clps711x/clep7312.c
+++ b/arch/arm/mach-clps711x/clep7312.c
@@ -26,8 +26,7 @@
26#include "common.h" 26#include "common.h"
27 27
28static void __init 28static void __init
29fixup_clep7312(struct machine_desc *desc, struct tag *tags, 29fixup_clep7312(struct tag *tags, char **cmdline, struct meminfo *mi)
30 char **cmdline, struct meminfo *mi)
31{ 30{
32 mi->nr_banks=1; 31 mi->nr_banks=1;
33 mi->bank[0].start = 0xc0000000; 32 mi->bank[0].start = 0xc0000000;
diff --git a/arch/arm/mach-clps711x/edb7211-arch.c b/arch/arm/mach-clps711x/edb7211-arch.c
index abf522d1ec9b..9721f6111dc0 100644
--- a/arch/arm/mach-clps711x/edb7211-arch.c
+++ b/arch/arm/mach-clps711x/edb7211-arch.c
@@ -37,8 +37,7 @@ static void __init edb7211_reserve(void)
37} 37}
38 38
39static void __init 39static void __init
40fixup_edb7211(struct machine_desc *desc, struct tag *tags, 40fixup_edb7211(struct tag *tags, char **cmdline, struct meminfo *mi)
41 char **cmdline, struct meminfo *mi)
42{ 41{
43 /* 42 /*
44 * Bank start addresses are not present in the information 43 * Bank start addresses are not present in the information
diff --git a/arch/arm/mach-clps711x/fortunet.c b/arch/arm/mach-clps711x/fortunet.c
index b6f7d86bb1c9..d99256687298 100644
--- a/arch/arm/mach-clps711x/fortunet.c
+++ b/arch/arm/mach-clps711x/fortunet.c
@@ -57,8 +57,7 @@ typedef struct tag_IMAGE_PARAMS
57#define IMAGE_PARAMS_PHYS 0xC01F0000 57#define IMAGE_PARAMS_PHYS 0xC01F0000
58 58
59static void __init 59static void __init
60fortunet_fixup(struct machine_desc *desc, struct tag *tags, 60fortunet_fixup(struct tag *tags, char **cmdline, struct meminfo *mi)
61 char **cmdline, struct meminfo *mi)
62{ 61{
63 IMAGE_PARAMS *ip = phys_to_virt(IMAGE_PARAMS_PHYS); 62 IMAGE_PARAMS *ip = phys_to_virt(IMAGE_PARAMS_PHYS);
64 *cmdline = phys_to_virt(ip->command_line); 63 *cmdline = phys_to_virt(ip->command_line);
diff --git a/arch/arm/mach-clps711x/p720t.c b/arch/arm/mach-clps711x/p720t.c
index e7f75aeb1e5b..6ecea95f38b2 100644
--- a/arch/arm/mach-clps711x/p720t.c
+++ b/arch/arm/mach-clps711x/p720t.c
@@ -56,8 +56,7 @@ static struct map_desc p720t_io_desc[] __initdata = {
56}; 56};
57 57
58static void __init 58static void __init
59fixup_p720t(struct machine_desc *desc, struct tag *tag, 59fixup_p720t(struct tag *tag, char **cmdline, struct meminfo *mi)
60 char **cmdline, struct meminfo *mi)
61{ 60{
62 /* 61 /*
63 * Our bootloader doesn't setup any tags (yet). 62 * Our bootloader doesn't setup any tags (yet).
diff --git a/arch/arm/mach-cns3xxx/Makefile.boot b/arch/arm/mach-cns3xxx/Makefile.boot
index 777012865220..d079de0b6e3b 100644
--- a/arch/arm/mach-cns3xxx/Makefile.boot
+++ b/arch/arm/mach-cns3xxx/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00C00000 3initrd_phys-y := 0x00C00000
diff --git a/arch/arm/mach-davinci/Makefile b/arch/arm/mach-davinci/Makefile
index 0b87a1ca2bb3..495e31306fc0 100644
--- a/arch/arm/mach-davinci/Makefile
+++ b/arch/arm/mach-davinci/Makefile
@@ -5,7 +5,7 @@
5 5
6# Common objects 6# Common objects
7obj-y := time.o clock.o serial.o io.o psc.o \ 7obj-y := time.o clock.o serial.o io.o psc.o \
8 gpio.o dma.o usb.o common.o sram.o aemif.o 8 dma.o usb.o common.o sram.o aemif.o
9 9
10obj-$(CONFIG_DAVINCI_MUX) += mux.o 10obj-$(CONFIG_DAVINCI_MUX) += mux.o
11 11
@@ -17,7 +17,6 @@ obj-$(CONFIG_ARCH_DAVINCI_DM365) += dm365.o devices.o
17obj-$(CONFIG_ARCH_DAVINCI_DA830) += da830.o devices-da8xx.o 17obj-$(CONFIG_ARCH_DAVINCI_DA830) += da830.o devices-da8xx.o
18obj-$(CONFIG_ARCH_DAVINCI_DA850) += da850.o devices-da8xx.o 18obj-$(CONFIG_ARCH_DAVINCI_DA850) += da850.o devices-da8xx.o
19obj-$(CONFIG_ARCH_DAVINCI_TNETV107X) += tnetv107x.o devices-tnetv107x.o 19obj-$(CONFIG_ARCH_DAVINCI_TNETV107X) += tnetv107x.o devices-tnetv107x.o
20obj-$(CONFIG_ARCH_DAVINCI_TNETV107X) += gpio-tnetv107x.o
21 20
22obj-$(CONFIG_AINTC) += irq.o 21obj-$(CONFIG_AINTC) += irq.o
23obj-$(CONFIG_CP_INTC) += cp_intc.o 22obj-$(CONFIG_CP_INTC) += cp_intc.o
diff --git a/arch/arm/mach-davinci/Makefile.boot b/arch/arm/mach-davinci/Makefile.boot
index db97ef2c6477..04a6c4e67b14 100644
--- a/arch/arm/mach-davinci/Makefile.boot
+++ b/arch/arm/mach-davinci/Makefile.boot
@@ -2,12 +2,12 @@ ifeq ($(CONFIG_ARCH_DAVINCI_DA8XX),y)
2ifeq ($(CONFIG_ARCH_DAVINCI_DMx),y) 2ifeq ($(CONFIG_ARCH_DAVINCI_DMx),y)
3$(error Cannot enable DaVinci and DA8XX platforms concurrently) 3$(error Cannot enable DaVinci and DA8XX platforms concurrently)
4else 4else
5 zreladdr-y := 0xc0008000 5 zreladdr-y += 0xc0008000
6params_phys-y := 0xc0000100 6params_phys-y := 0xc0000100
7initrd_phys-y := 0xc0800000 7initrd_phys-y := 0xc0800000
8endif 8endif
9else 9else
10 zreladdr-y := 0x80008000 10 zreladdr-y += 0x80008000
11params_phys-y := 0x80000100 11params_phys-y := 0x80000100
12initrd_phys-y := 0x80800000 12initrd_phys-y := 0x80800000
13endif 13endif
diff --git a/arch/arm/mach-davinci/da830.c b/arch/arm/mach-davinci/da830.c
index 2ed2f822fc40..a6bf5dcaef13 100644
--- a/arch/arm/mach-davinci/da830.c
+++ b/arch/arm/mach-davinci/da830.c
@@ -8,6 +8,7 @@
8 * is licensed "as is" without any warranty of any kind, whether express 8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied. 9 * or implied.
10 */ 10 */
11#include <linux/gpio.h>
11#include <linux/init.h> 12#include <linux/init.h>
12#include <linux/clk.h> 13#include <linux/clk.h>
13 14
@@ -19,7 +20,7 @@
19#include <mach/common.h> 20#include <mach/common.h>
20#include <mach/time.h> 21#include <mach/time.h>
21#include <mach/da8xx.h> 22#include <mach/da8xx.h>
22#include <mach/gpio.h> 23#include <mach/gpio-davinci.h>
23 24
24#include "clock.h" 25#include "clock.h"
25#include "mux.h" 26#include "mux.h"
diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
index 935dbed5c541..4aae01576aab 100644
--- a/arch/arm/mach-davinci/da850.c
+++ b/arch/arm/mach-davinci/da850.c
@@ -11,6 +11,7 @@
11 * is licensed "as is" without any warranty of any kind, whether express 11 * is licensed "as is" without any warranty of any kind, whether express
12 * or implied. 12 * or implied.
13 */ 13 */
14#include <linux/gpio.h>
14#include <linux/init.h> 15#include <linux/init.h>
15#include <linux/clk.h> 16#include <linux/clk.h>
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
@@ -27,7 +28,7 @@
27#include <mach/da8xx.h> 28#include <mach/da8xx.h>
28#include <mach/cpufreq.h> 29#include <mach/cpufreq.h>
29#include <mach/pm.h> 30#include <mach/pm.h>
30#include <mach/gpio.h> 31#include <mach/gpio-davinci.h>
31 32
32#include "clock.h" 33#include "clock.h"
33#include "mux.h" 34#include "mux.h"
diff --git a/arch/arm/mach-davinci/dm355.c b/arch/arm/mach-davinci/dm355.c
index a3a94e9c9378..c143f43addcc 100644
--- a/arch/arm/mach-davinci/dm355.c
+++ b/arch/arm/mach-davinci/dm355.c
@@ -13,7 +13,6 @@
13#include <linux/serial_8250.h> 13#include <linux/serial_8250.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/dma-mapping.h> 15#include <linux/dma-mapping.h>
16#include <linux/gpio.h>
17 16
18#include <linux/spi/spi.h> 17#include <linux/spi/spi.h>
19 18
@@ -30,6 +29,7 @@
30#include <mach/common.h> 29#include <mach/common.h>
31#include <mach/asp.h> 30#include <mach/asp.h>
32#include <mach/spi.h> 31#include <mach/spi.h>
32#include <mach/gpio-davinci.h>
33 33
34#include "clock.h" 34#include "clock.h"
35#include "mux.h" 35#include "mux.h"
diff --git a/arch/arm/mach-davinci/dm365.c b/arch/arm/mach-davinci/dm365.c
index 4604e72d7d99..679e168dce34 100644
--- a/arch/arm/mach-davinci/dm365.c
+++ b/arch/arm/mach-davinci/dm365.c
@@ -17,7 +17,6 @@
17#include <linux/serial_8250.h> 17#include <linux/serial_8250.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/dma-mapping.h> 19#include <linux/dma-mapping.h>
20#include <linux/gpio.h>
21#include <linux/spi/spi.h> 20#include <linux/spi/spi.h>
22 21
23#include <asm/mach/map.h> 22#include <asm/mach/map.h>
@@ -34,7 +33,7 @@
34#include <mach/asp.h> 33#include <mach/asp.h>
35#include <mach/keyscan.h> 34#include <mach/keyscan.h>
36#include <mach/spi.h> 35#include <mach/spi.h>
37 36#include <mach/gpio-davinci.h>
38 37
39#include "clock.h" 38#include "clock.h"
40#include "mux.h" 39#include "mux.h"
diff --git a/arch/arm/mach-davinci/dm644x.c b/arch/arm/mach-davinci/dm644x.c
index 4c82c2716293..9a274665edc5 100644
--- a/arch/arm/mach-davinci/dm644x.c
+++ b/arch/arm/mach-davinci/dm644x.c
@@ -12,7 +12,6 @@
12#include <linux/clk.h> 12#include <linux/clk.h>
13#include <linux/serial_8250.h> 13#include <linux/serial_8250.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/gpio.h>
16 15
17#include <asm/mach/map.h> 16#include <asm/mach/map.h>
18 17
@@ -26,6 +25,7 @@
26#include <mach/serial.h> 25#include <mach/serial.h>
27#include <mach/common.h> 26#include <mach/common.h>
28#include <mach/asp.h> 27#include <mach/asp.h>
28#include <mach/gpio-davinci.h>
29 29
30#include "clock.h" 30#include "clock.h"
31#include "mux.h" 31#include "mux.h"
diff --git a/arch/arm/mach-davinci/dm646x.c b/arch/arm/mach-davinci/dm646x.c
index 1802e711a2b8..03e5f4931b42 100644
--- a/arch/arm/mach-davinci/dm646x.c
+++ b/arch/arm/mach-davinci/dm646x.c
@@ -13,7 +13,6 @@
13#include <linux/clk.h> 13#include <linux/clk.h>
14#include <linux/serial_8250.h> 14#include <linux/serial_8250.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16#include <linux/gpio.h>
17 16
18#include <asm/mach/map.h> 17#include <asm/mach/map.h>
19 18
@@ -27,6 +26,7 @@
27#include <mach/serial.h> 26#include <mach/serial.h>
28#include <mach/common.h> 27#include <mach/common.h>
29#include <mach/asp.h> 28#include <mach/asp.h>
29#include <mach/gpio-davinci.h>
30 30
31#include "clock.h" 31#include "clock.h"
32#include "mux.h" 32#include "mux.h"
diff --git a/arch/arm/mach-davinci/gpio-tnetv107x.c b/arch/arm/mach-davinci/gpio-tnetv107x.c
deleted file mode 100644
index 3fa3e2867e19..000000000000
--- a/arch/arm/mach-davinci/gpio-tnetv107x.c
+++ /dev/null
@@ -1,205 +0,0 @@
1/*
2 * Texas Instruments TNETV107X GPIO Controller
3 *
4 * Copyright (C) 2010 Texas Instruments
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License as
8 * published by the Free Software Foundation version 2.
9 *
10 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
11 * kind, whether express or implied; without even the implied warranty
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/gpio.h>
18
19#include <mach/common.h>
20#include <mach/tnetv107x.h>
21
22struct tnetv107x_gpio_regs {
23 u32 idver;
24 u32 data_in[3];
25 u32 data_out[3];
26 u32 direction[3];
27 u32 enable[3];
28};
29
30#define gpio_reg_index(gpio) ((gpio) >> 5)
31#define gpio_reg_bit(gpio) BIT((gpio) & 0x1f)
32
33#define gpio_reg_rmw(reg, mask, val) \
34 __raw_writel((__raw_readl(reg) & ~(mask)) | (val), (reg))
35
36#define gpio_reg_set_bit(reg, gpio) \
37 gpio_reg_rmw((reg) + gpio_reg_index(gpio), 0, gpio_reg_bit(gpio))
38
39#define gpio_reg_clear_bit(reg, gpio) \
40 gpio_reg_rmw((reg) + gpio_reg_index(gpio), gpio_reg_bit(gpio), 0)
41
42#define gpio_reg_get_bit(reg, gpio) \
43 (__raw_readl((reg) + gpio_reg_index(gpio)) & gpio_reg_bit(gpio))
44
45#define chip2controller(chip) \
46 container_of(chip, struct davinci_gpio_controller, chip)
47
48#define TNETV107X_GPIO_CTLRS DIV_ROUND_UP(TNETV107X_N_GPIO, 32)
49
50static struct davinci_gpio_controller chips[TNETV107X_GPIO_CTLRS];
51
52static int tnetv107x_gpio_request(struct gpio_chip *chip, unsigned offset)
53{
54 struct davinci_gpio_controller *ctlr = chip2controller(chip);
55 struct tnetv107x_gpio_regs __iomem *regs = ctlr->regs;
56 unsigned gpio = chip->base + offset;
57 unsigned long flags;
58
59 spin_lock_irqsave(&ctlr->lock, flags);
60
61 gpio_reg_set_bit(regs->enable, gpio);
62
63 spin_unlock_irqrestore(&ctlr->lock, flags);
64
65 return 0;
66}
67
68static void tnetv107x_gpio_free(struct gpio_chip *chip, unsigned offset)
69{
70 struct davinci_gpio_controller *ctlr = chip2controller(chip);
71 struct tnetv107x_gpio_regs __iomem *regs = ctlr->regs;
72 unsigned gpio = chip->base + offset;
73 unsigned long flags;
74
75 spin_lock_irqsave(&ctlr->lock, flags);
76
77 gpio_reg_clear_bit(regs->enable, gpio);
78
79 spin_unlock_irqrestore(&ctlr->lock, flags);
80}
81
82static int tnetv107x_gpio_dir_in(struct gpio_chip *chip, unsigned offset)
83{
84 struct davinci_gpio_controller *ctlr = chip2controller(chip);
85 struct tnetv107x_gpio_regs __iomem *regs = ctlr->regs;
86 unsigned gpio = chip->base + offset;
87 unsigned long flags;
88
89 spin_lock_irqsave(&ctlr->lock, flags);
90
91 gpio_reg_set_bit(regs->direction, gpio);
92
93 spin_unlock_irqrestore(&ctlr->lock, flags);
94
95 return 0;
96}
97
98static int tnetv107x_gpio_dir_out(struct gpio_chip *chip,
99 unsigned offset, int value)
100{
101 struct davinci_gpio_controller *ctlr = chip2controller(chip);
102 struct tnetv107x_gpio_regs __iomem *regs = ctlr->regs;
103 unsigned gpio = chip->base + offset;
104 unsigned long flags;
105
106 spin_lock_irqsave(&ctlr->lock, flags);
107
108 if (value)
109 gpio_reg_set_bit(regs->data_out, gpio);
110 else
111 gpio_reg_clear_bit(regs->data_out, gpio);
112
113 gpio_reg_clear_bit(regs->direction, gpio);
114
115 spin_unlock_irqrestore(&ctlr->lock, flags);
116
117 return 0;
118}
119
120static int tnetv107x_gpio_get(struct gpio_chip *chip, unsigned offset)
121{
122 struct davinci_gpio_controller *ctlr = chip2controller(chip);
123 struct tnetv107x_gpio_regs __iomem *regs = ctlr->regs;
124 unsigned gpio = chip->base + offset;
125 int ret;
126
127 ret = gpio_reg_get_bit(regs->data_in, gpio);
128
129 return ret ? 1 : 0;
130}
131
132static void tnetv107x_gpio_set(struct gpio_chip *chip,
133 unsigned offset, int value)
134{
135 struct davinci_gpio_controller *ctlr = chip2controller(chip);
136 struct tnetv107x_gpio_regs __iomem *regs = ctlr->regs;
137 unsigned gpio = chip->base + offset;
138 unsigned long flags;
139
140 spin_lock_irqsave(&ctlr->lock, flags);
141
142 if (value)
143 gpio_reg_set_bit(regs->data_out, gpio);
144 else
145 gpio_reg_clear_bit(regs->data_out, gpio);
146
147 spin_unlock_irqrestore(&ctlr->lock, flags);
148}
149
150static int __init tnetv107x_gpio_setup(void)
151{
152 int i, base;
153 unsigned ngpio;
154 struct davinci_soc_info *soc_info = &davinci_soc_info;
155 struct tnetv107x_gpio_regs *regs;
156 struct davinci_gpio_controller *ctlr;
157
158 if (soc_info->gpio_type != GPIO_TYPE_TNETV107X)
159 return 0;
160
161 ngpio = soc_info->gpio_num;
162 if (ngpio == 0) {
163 pr_err("GPIO setup: how many GPIOs?\n");
164 return -EINVAL;
165 }
166
167 if (WARN_ON(TNETV107X_N_GPIO < ngpio))
168 ngpio = TNETV107X_N_GPIO;
169
170 regs = ioremap(soc_info->gpio_base, SZ_4K);
171 if (WARN_ON(!regs))
172 return -EINVAL;
173
174 for (i = 0, base = 0; base < ngpio; i++, base += 32) {
175 ctlr = &chips[i];
176
177 ctlr->chip.label = "tnetv107x";
178 ctlr->chip.can_sleep = 0;
179 ctlr->chip.base = base;
180 ctlr->chip.ngpio = ngpio - base;
181 if (ctlr->chip.ngpio > 32)
182 ctlr->chip.ngpio = 32;
183
184 ctlr->chip.request = tnetv107x_gpio_request;
185 ctlr->chip.free = tnetv107x_gpio_free;
186 ctlr->chip.direction_input = tnetv107x_gpio_dir_in;
187 ctlr->chip.get = tnetv107x_gpio_get;
188 ctlr->chip.direction_output = tnetv107x_gpio_dir_out;
189 ctlr->chip.set = tnetv107x_gpio_set;
190
191 spin_lock_init(&ctlr->lock);
192
193 ctlr->regs = regs;
194 ctlr->set_data = &regs->data_out[i];
195 ctlr->clr_data = &regs->data_out[i];
196 ctlr->in_data = &regs->data_in[i];
197
198 gpiochip_add(&ctlr->chip);
199 }
200
201 soc_info->gpio_ctlrs = chips;
202 soc_info->gpio_ctlrs_num = DIV_ROUND_UP(ngpio, 32);
203 return 0;
204}
205pure_initcall(tnetv107x_gpio_setup);
diff --git a/arch/arm/mach-davinci/gpio.c b/arch/arm/mach-davinci/gpio.c
deleted file mode 100644
index cafbe13a82a5..000000000000
--- a/arch/arm/mach-davinci/gpio.c
+++ /dev/null
@@ -1,460 +0,0 @@
1/*
2 * TI DaVinci GPIO Support
3 *
4 * Copyright (c) 2006-2007 David Brownell
5 * Copyright (c) 2007, MontaVista Software, Inc. <source@mvista.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#include <linux/errno.h>
14#include <linux/kernel.h>
15#include <linux/clk.h>
16#include <linux/err.h>
17#include <linux/io.h>
18
19#include <mach/gpio.h>
20
21#include <asm/mach/irq.h>
22
23struct davinci_gpio_regs {
24 u32 dir;
25 u32 out_data;
26 u32 set_data;
27 u32 clr_data;
28 u32 in_data;
29 u32 set_rising;
30 u32 clr_rising;
31 u32 set_falling;
32 u32 clr_falling;
33 u32 intstat;
34};
35
36#define chip2controller(chip) \
37 container_of(chip, struct davinci_gpio_controller, chip)
38
39static struct davinci_gpio_controller chips[DIV_ROUND_UP(DAVINCI_N_GPIO, 32)];
40static void __iomem *gpio_base;
41
42static struct davinci_gpio_regs __iomem __init *gpio2regs(unsigned gpio)
43{
44 void __iomem *ptr;
45
46 if (gpio < 32 * 1)
47 ptr = gpio_base + 0x10;
48 else if (gpio < 32 * 2)
49 ptr = gpio_base + 0x38;
50 else if (gpio < 32 * 3)
51 ptr = gpio_base + 0x60;
52 else if (gpio < 32 * 4)
53 ptr = gpio_base + 0x88;
54 else if (gpio < 32 * 5)
55 ptr = gpio_base + 0xb0;
56 else
57 ptr = NULL;
58 return ptr;
59}
60
61static inline struct davinci_gpio_regs __iomem *irq2regs(int irq)
62{
63 struct davinci_gpio_regs __iomem *g;
64
65 g = (__force struct davinci_gpio_regs __iomem *)irq_get_chip_data(irq);
66
67 return g;
68}
69
70static int __init davinci_gpio_irq_setup(void);
71
72/*--------------------------------------------------------------------------*/
73
74/* board setup code *MUST* setup pinmux and enable the GPIO clock. */
75static inline int __davinci_direction(struct gpio_chip *chip,
76 unsigned offset, bool out, int value)
77{
78 struct davinci_gpio_controller *d = chip2controller(chip);
79 struct davinci_gpio_regs __iomem *g = d->regs;
80 unsigned long flags;
81 u32 temp;
82 u32 mask = 1 << offset;
83
84 spin_lock_irqsave(&d->lock, flags);
85 temp = __raw_readl(&g->dir);
86 if (out) {
87 temp &= ~mask;
88 __raw_writel(mask, value ? &g->set_data : &g->clr_data);
89 } else {
90 temp |= mask;
91 }
92 __raw_writel(temp, &g->dir);
93 spin_unlock_irqrestore(&d->lock, flags);
94
95 return 0;
96}
97
98static int davinci_direction_in(struct gpio_chip *chip, unsigned offset)
99{
100 return __davinci_direction(chip, offset, false, 0);
101}
102
103static int
104davinci_direction_out(struct gpio_chip *chip, unsigned offset, int value)
105{
106 return __davinci_direction(chip, offset, true, value);
107}
108
109/*
110 * Read the pin's value (works even if it's set up as output);
111 * returns zero/nonzero.
112 *
113 * Note that changes are synched to the GPIO clock, so reading values back
114 * right after you've set them may give old values.
115 */
116static int davinci_gpio_get(struct gpio_chip *chip, unsigned offset)
117{
118 struct davinci_gpio_controller *d = chip2controller(chip);
119 struct davinci_gpio_regs __iomem *g = d->regs;
120
121 return (1 << offset) & __raw_readl(&g->in_data);
122}
123
124/*
125 * Assuming the pin is muxed as a gpio output, set its output value.
126 */
127static void
128davinci_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
129{
130 struct davinci_gpio_controller *d = chip2controller(chip);
131 struct davinci_gpio_regs __iomem *g = d->regs;
132
133 __raw_writel((1 << offset), value ? &g->set_data : &g->clr_data);
134}
135
136static int __init davinci_gpio_setup(void)
137{
138 int i, base;
139 unsigned ngpio;
140 struct davinci_soc_info *soc_info = &davinci_soc_info;
141 struct davinci_gpio_regs *regs;
142
143 if (soc_info->gpio_type != GPIO_TYPE_DAVINCI)
144 return 0;
145
146 /*
147 * The gpio banks conceptually expose a segmented bitmap,
148 * and "ngpio" is one more than the largest zero-based
149 * bit index that's valid.
150 */
151 ngpio = soc_info->gpio_num;
152 if (ngpio == 0) {
153 pr_err("GPIO setup: how many GPIOs?\n");
154 return -EINVAL;
155 }
156
157 if (WARN_ON(DAVINCI_N_GPIO < ngpio))
158 ngpio = DAVINCI_N_GPIO;
159
160 gpio_base = ioremap(soc_info->gpio_base, SZ_4K);
161 if (WARN_ON(!gpio_base))
162 return -ENOMEM;
163
164 for (i = 0, base = 0; base < ngpio; i++, base += 32) {
165 chips[i].chip.label = "DaVinci";
166
167 chips[i].chip.direction_input = davinci_direction_in;
168 chips[i].chip.get = davinci_gpio_get;
169 chips[i].chip.direction_output = davinci_direction_out;
170 chips[i].chip.set = davinci_gpio_set;
171
172 chips[i].chip.base = base;
173 chips[i].chip.ngpio = ngpio - base;
174 if (chips[i].chip.ngpio > 32)
175 chips[i].chip.ngpio = 32;
176
177 spin_lock_init(&chips[i].lock);
178
179 regs = gpio2regs(base);
180 chips[i].regs = regs;
181 chips[i].set_data = &regs->set_data;
182 chips[i].clr_data = &regs->clr_data;
183 chips[i].in_data = &regs->in_data;
184
185 gpiochip_add(&chips[i].chip);
186 }
187
188 soc_info->gpio_ctlrs = chips;
189 soc_info->gpio_ctlrs_num = DIV_ROUND_UP(ngpio, 32);
190
191 davinci_gpio_irq_setup();
192 return 0;
193}
194pure_initcall(davinci_gpio_setup);
195
196/*--------------------------------------------------------------------------*/
197/*
198 * We expect irqs will normally be set up as input pins, but they can also be
199 * used as output pins ... which is convenient for testing.
200 *
201 * NOTE: The first few GPIOs also have direct INTC hookups in addition
202 * to their GPIOBNK0 irq, with a bit less overhead.
203 *
204 * All those INTC hookups (direct, plus several IRQ banks) can also
205 * serve as EDMA event triggers.
206 */
207
208static void gpio_irq_disable(struct irq_data *d)
209{
210 struct davinci_gpio_regs __iomem *g = irq2regs(d->irq);
211 u32 mask = (u32) irq_data_get_irq_handler_data(d);
212
213 __raw_writel(mask, &g->clr_falling);
214 __raw_writel(mask, &g->clr_rising);
215}
216
217static void gpio_irq_enable(struct irq_data *d)
218{
219 struct davinci_gpio_regs __iomem *g = irq2regs(d->irq);
220 u32 mask = (u32) irq_data_get_irq_handler_data(d);
221 unsigned status = irqd_get_trigger_type(d);
222
223 status &= IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING;
224 if (!status)
225 status = IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING;
226
227 if (status & IRQ_TYPE_EDGE_FALLING)
228 __raw_writel(mask, &g->set_falling);
229 if (status & IRQ_TYPE_EDGE_RISING)
230 __raw_writel(mask, &g->set_rising);
231}
232
233static int gpio_irq_type(struct irq_data *d, unsigned trigger)
234{
235 struct davinci_gpio_regs __iomem *g = irq2regs(d->irq);
236 u32 mask = (u32) irq_data_get_irq_handler_data(d);
237
238 if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
239 return -EINVAL;
240
241 return 0;
242}
243
244static struct irq_chip gpio_irqchip = {
245 .name = "GPIO",
246 .irq_enable = gpio_irq_enable,
247 .irq_disable = gpio_irq_disable,
248 .irq_set_type = gpio_irq_type,
249 .flags = IRQCHIP_SET_TYPE_MASKED,
250};
251
252static void
253gpio_irq_handler(unsigned irq, struct irq_desc *desc)
254{
255 struct davinci_gpio_regs __iomem *g;
256 u32 mask = 0xffff;
257 struct davinci_gpio_controller *d;
258
259 d = (struct davinci_gpio_controller *)irq_desc_get_handler_data(desc);
260 g = (struct davinci_gpio_regs __iomem *)d->regs;
261
262 /* we only care about one bank */
263 if (irq & 1)
264 mask <<= 16;
265
266 /* temporarily mask (level sensitive) parent IRQ */
267 desc->irq_data.chip->irq_mask(&desc->irq_data);
268 desc->irq_data.chip->irq_ack(&desc->irq_data);
269 while (1) {
270 u32 status;
271 int n;
272 int res;
273
274 /* ack any irqs */
275 status = __raw_readl(&g->intstat) & mask;
276 if (!status)
277 break;
278 __raw_writel(status, &g->intstat);
279
280 /* now demux them to the right lowlevel handler */
281 n = d->irq_base;
282 if (irq & 1) {
283 n += 16;
284 status >>= 16;
285 }
286
287 while (status) {
288 res = ffs(status);
289 n += res;
290 generic_handle_irq(n - 1);
291 status >>= res;
292 }
293 }
294 desc->irq_data.chip->irq_unmask(&desc->irq_data);
295 /* now it may re-trigger */
296}
297
298static int gpio_to_irq_banked(struct gpio_chip *chip, unsigned offset)
299{
300 struct davinci_gpio_controller *d = chip2controller(chip);
301
302 if (d->irq_base >= 0)
303 return d->irq_base + offset;
304 else
305 return -ENODEV;
306}
307
308static int gpio_to_irq_unbanked(struct gpio_chip *chip, unsigned offset)
309{
310 struct davinci_soc_info *soc_info = &davinci_soc_info;
311
312 /* NOTE: we assume for now that only irqs in the first gpio_chip
313 * can provide direct-mapped IRQs to AINTC (up to 32 GPIOs).
314 */
315 if (offset < soc_info->gpio_unbanked)
316 return soc_info->gpio_irq + offset;
317 else
318 return -ENODEV;
319}
320
321static int gpio_irq_type_unbanked(struct irq_data *d, unsigned trigger)
322{
323 struct davinci_gpio_regs __iomem *g = irq2regs(d->irq);
324 u32 mask = (u32) irq_data_get_irq_handler_data(d);
325
326 if (trigger & ~(IRQ_TYPE_EDGE_FALLING | IRQ_TYPE_EDGE_RISING))
327 return -EINVAL;
328
329 __raw_writel(mask, (trigger & IRQ_TYPE_EDGE_FALLING)
330 ? &g->set_falling : &g->clr_falling);
331 __raw_writel(mask, (trigger & IRQ_TYPE_EDGE_RISING)
332 ? &g->set_rising : &g->clr_rising);
333
334 return 0;
335}
336
337/*
338 * NOTE: for suspend/resume, probably best to make a platform_device with
339 * suspend_late/resume_resume calls hooking into results of the set_wake()
340 * calls ... so if no gpios are wakeup events the clock can be disabled,
341 * with outputs left at previously set levels, and so that VDD3P3V.IOPWDN0
342 * (dm6446) can be set appropriately for GPIOV33 pins.
343 */
344
345static int __init davinci_gpio_irq_setup(void)
346{
347 unsigned gpio, irq, bank;
348 struct clk *clk;
349 u32 binten = 0;
350 unsigned ngpio, bank_irq;
351 struct davinci_soc_info *soc_info = &davinci_soc_info;
352 struct davinci_gpio_regs __iomem *g;
353
354 ngpio = soc_info->gpio_num;
355
356 bank_irq = soc_info->gpio_irq;
357 if (bank_irq == 0) {
358 printk(KERN_ERR "Don't know first GPIO bank IRQ.\n");
359 return -EINVAL;
360 }
361
362 clk = clk_get(NULL, "gpio");
363 if (IS_ERR(clk)) {
364 printk(KERN_ERR "Error %ld getting gpio clock?\n",
365 PTR_ERR(clk));
366 return PTR_ERR(clk);
367 }
368 clk_enable(clk);
369
370 /* Arrange gpio_to_irq() support, handling either direct IRQs or
371 * banked IRQs. Having GPIOs in the first GPIO bank use direct
372 * IRQs, while the others use banked IRQs, would need some setup
373 * tweaks to recognize hardware which can do that.
374 */
375 for (gpio = 0, bank = 0; gpio < ngpio; bank++, gpio += 32) {
376 chips[bank].chip.to_irq = gpio_to_irq_banked;
377 chips[bank].irq_base = soc_info->gpio_unbanked
378 ? -EINVAL
379 : (soc_info->intc_irq_num + gpio);
380 }
381
382 /*
383 * AINTC can handle direct/unbanked IRQs for GPIOs, with the GPIO
384 * controller only handling trigger modes. We currently assume no
385 * IRQ mux conflicts; gpio_irq_type_unbanked() is only for GPIOs.
386 */
387 if (soc_info->gpio_unbanked) {
388 static struct irq_chip gpio_irqchip_unbanked;
389
390 /* pass "bank 0" GPIO IRQs to AINTC */
391 chips[0].chip.to_irq = gpio_to_irq_unbanked;
392 binten = BIT(0);
393
394 /* AINTC handles mask/unmask; GPIO handles triggering */
395 irq = bank_irq;
396 gpio_irqchip_unbanked = *irq_get_chip(irq);
397 gpio_irqchip_unbanked.name = "GPIO-AINTC";
398 gpio_irqchip_unbanked.irq_set_type = gpio_irq_type_unbanked;
399
400 /* default trigger: both edges */
401 g = gpio2regs(0);
402 __raw_writel(~0, &g->set_falling);
403 __raw_writel(~0, &g->set_rising);
404
405 /* set the direct IRQs up to use that irqchip */
406 for (gpio = 0; gpio < soc_info->gpio_unbanked; gpio++, irq++) {
407 irq_set_chip(irq, &gpio_irqchip_unbanked);
408 irq_set_handler_data(irq, (void *)__gpio_mask(gpio));
409 irq_set_chip_data(irq, (__force void *)g);
410 irq_set_status_flags(irq, IRQ_TYPE_EDGE_BOTH);
411 }
412
413 goto done;
414 }
415
416 /*
417 * Or, AINTC can handle IRQs for banks of 16 GPIO IRQs, which we
418 * then chain through our own handler.
419 */
420 for (gpio = 0, irq = gpio_to_irq(0), bank = 0;
421 gpio < ngpio;
422 bank++, bank_irq++) {
423 unsigned i;
424
425 /* disabled by default, enabled only as needed */
426 g = gpio2regs(gpio);
427 __raw_writel(~0, &g->clr_falling);
428 __raw_writel(~0, &g->clr_rising);
429
430 /* set up all irqs in this bank */
431 irq_set_chained_handler(bank_irq, gpio_irq_handler);
432
433 /*
434 * Each chip handles 32 gpios, and each irq bank consists of 16
435 * gpio irqs. Pass the irq bank's corresponding controller to
436 * the chained irq handler.
437 */
438 irq_set_handler_data(bank_irq, &chips[gpio / 32]);
439
440 for (i = 0; i < 16 && gpio < ngpio; i++, irq++, gpio++) {
441 irq_set_chip(irq, &gpio_irqchip);
442 irq_set_chip_data(irq, (__force void *)g);
443 irq_set_handler_data(irq, (void *)__gpio_mask(gpio));
444 irq_set_handler(irq, handle_simple_irq);
445 set_irq_flags(irq, IRQF_VALID);
446 }
447
448 binten |= BIT(bank);
449 }
450
451done:
452 /* BINTEN -- per-bank interrupt enable. genirq would also let these
453 * bits be set/cleared dynamically.
454 */
455 __raw_writel(binten, gpio_base + 0x08);
456
457 printk(KERN_INFO "DaVinci: %d gpio irqs\n", irq - gpio_to_irq(0));
458
459 return 0;
460}
diff --git a/arch/arm/mach-davinci/include/mach/gpio-davinci.h b/arch/arm/mach-davinci/include/mach/gpio-davinci.h
new file mode 100644
index 000000000000..1fdd1fd35448
--- /dev/null
+++ b/arch/arm/mach-davinci/include/mach/gpio-davinci.h
@@ -0,0 +1,91 @@
1/*
2 * TI DaVinci GPIO Support
3 *
4 * Copyright (c) 2006 David Brownell
5 * Copyright (c) 2007, MontaVista Software, Inc. <source@mvista.com>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 */
12
13#ifndef __DAVINCI_DAVINCI_GPIO_H
14#define __DAVINCI_DAVINCI_GPIO_H
15
16#include <linux/io.h>
17#include <linux/spinlock.h>
18
19#include <asm-generic/gpio.h>
20
21#include <mach/irqs.h>
22#include <mach/common.h>
23
24#define DAVINCI_GPIO_BASE 0x01C67000
25
26enum davinci_gpio_type {
27 GPIO_TYPE_DAVINCI = 0,
28 GPIO_TYPE_TNETV107X,
29};
30
31/*
32 * basic gpio routines
33 *
34 * board-specific init should be done by arch/.../.../board-XXX.c (maybe
35 * initializing banks together) rather than boot loaders; kexec() won't
36 * go through boot loaders.
37 *
38 * the gpio clock will be turned on when gpios are used, and you may also
39 * need to pay attention to PINMUX registers to be sure those pins are
40 * used as gpios, not with other peripherals.
41 *
42 * On-chip GPIOs are numbered 0..(DAVINCI_N_GPIO-1). For documentation,
43 * and maybe for later updates, code may write GPIO(N). These may be
44 * all 1.8V signals, all 3.3V ones, or a mix of the two. A given chip
45 * may not support all the GPIOs in that range.
46 *
47 * GPIOs can also be on external chips, numbered after the ones built-in
48 * to the DaVinci chip. For now, they won't be usable as IRQ sources.
49 */
50#define GPIO(X) (X) /* 0 <= X <= (DAVINCI_N_GPIO - 1) */
51
52/* Convert GPIO signal to GPIO pin number */
53#define GPIO_TO_PIN(bank, gpio) (16 * (bank) + (gpio))
54
55struct davinci_gpio_controller {
56 struct gpio_chip chip;
57 int irq_base;
58 spinlock_t lock;
59 void __iomem *regs;
60 void __iomem *set_data;
61 void __iomem *clr_data;
62 void __iomem *in_data;
63};
64
65/* The __gpio_to_controller() and __gpio_mask() functions inline to constants
66 * with constant parameters; or in outlined code they execute at runtime.
67 *
68 * You'd access the controller directly when reading or writing more than
69 * one gpio value at a time, and to support wired logic where the value
70 * being driven by the cpu need not match the value read back.
71 *
72 * These are NOT part of the cross-platform GPIO interface
73 */
74static inline struct davinci_gpio_controller *
75__gpio_to_controller(unsigned gpio)
76{
77 struct davinci_gpio_controller *ctlrs = davinci_soc_info.gpio_ctlrs;
78 int index = gpio / 32;
79
80 if (!ctlrs || index >= davinci_soc_info.gpio_ctlrs_num)
81 return NULL;
82
83 return ctlrs + index;
84}
85
86static inline u32 __gpio_mask(unsigned gpio)
87{
88 return 1 << (gpio % 32);
89}
90
91#endif /* __DAVINCI_DAVINCI_GPIO_H */
diff --git a/arch/arm/mach-davinci/include/mach/gpio.h b/arch/arm/mach-davinci/include/mach/gpio.h
index fbece126c2bf..fbaae4772b91 100644
--- a/arch/arm/mach-davinci/include/mach/gpio.h
+++ b/arch/arm/mach-davinci/include/mach/gpio.h
@@ -13,80 +13,10 @@
13#ifndef __DAVINCI_GPIO_H 13#ifndef __DAVINCI_GPIO_H
14#define __DAVINCI_GPIO_H 14#define __DAVINCI_GPIO_H
15 15
16#include <linux/io.h>
17#include <linux/spinlock.h>
18
19#include <asm-generic/gpio.h> 16#include <asm-generic/gpio.h>
20 17
21#include <mach/irqs.h> 18/* The inline versions use the static inlines in the driver header */
22#include <mach/common.h> 19#include "gpio-davinci.h"
23
24#define DAVINCI_GPIO_BASE 0x01C67000
25
26enum davinci_gpio_type {
27 GPIO_TYPE_DAVINCI = 0,
28 GPIO_TYPE_TNETV107X,
29};
30
31/*
32 * basic gpio routines
33 *
34 * board-specific init should be done by arch/.../.../board-XXX.c (maybe
35 * initializing banks together) rather than boot loaders; kexec() won't
36 * go through boot loaders.
37 *
38 * the gpio clock will be turned on when gpios are used, and you may also
39 * need to pay attention to PINMUX registers to be sure those pins are
40 * used as gpios, not with other peripherals.
41 *
42 * On-chip GPIOs are numbered 0..(DAVINCI_N_GPIO-1). For documentation,
43 * and maybe for later updates, code may write GPIO(N). These may be
44 * all 1.8V signals, all 3.3V ones, or a mix of the two. A given chip
45 * may not support all the GPIOs in that range.
46 *
47 * GPIOs can also be on external chips, numbered after the ones built-in
48 * to the DaVinci chip. For now, they won't be usable as IRQ sources.
49 */
50#define GPIO(X) (X) /* 0 <= X <= (DAVINCI_N_GPIO - 1) */
51
52/* Convert GPIO signal to GPIO pin number */
53#define GPIO_TO_PIN(bank, gpio) (16 * (bank) + (gpio))
54
55struct davinci_gpio_controller {
56 struct gpio_chip chip;
57 int irq_base;
58 spinlock_t lock;
59 void __iomem *regs;
60 void __iomem *set_data;
61 void __iomem *clr_data;
62 void __iomem *in_data;
63};
64
65/* The __gpio_to_controller() and __gpio_mask() functions inline to constants
66 * with constant parameters; or in outlined code they execute at runtime.
67 *
68 * You'd access the controller directly when reading or writing more than
69 * one gpio value at a time, and to support wired logic where the value
70 * being driven by the cpu need not match the value read back.
71 *
72 * These are NOT part of the cross-platform GPIO interface
73 */
74static inline struct davinci_gpio_controller *
75__gpio_to_controller(unsigned gpio)
76{
77 struct davinci_gpio_controller *ctlrs = davinci_soc_info.gpio_ctlrs;
78 int index = gpio / 32;
79
80 if (!ctlrs || index >= davinci_soc_info.gpio_ctlrs_num)
81 return NULL;
82
83 return ctlrs + index;
84}
85
86static inline u32 __gpio_mask(unsigned gpio)
87{
88 return 1 << (gpio % 32);
89}
90 20
91/* 21/*
92 * The get/set/clear functions will inline when called with constant 22 * The get/set/clear functions will inline when called with constant
@@ -147,11 +77,6 @@ static inline int gpio_cansleep(unsigned gpio)
147 return __gpio_cansleep(gpio); 77 return __gpio_cansleep(gpio);
148} 78}
149 79
150static inline int gpio_to_irq(unsigned gpio)
151{
152 return __gpio_to_irq(gpio);
153}
154
155static inline int irq_to_gpio(unsigned irq) 80static inline int irq_to_gpio(unsigned irq)
156{ 81{
157 /* don't support the reverse mapping */ 82 /* don't support the reverse mapping */
diff --git a/arch/arm/mach-davinci/tnetv107x.c b/arch/arm/mach-davinci/tnetv107x.c
index 1b28fdd892a6..409bb869c7c7 100644
--- a/arch/arm/mach-davinci/tnetv107x.c
+++ b/arch/arm/mach-davinci/tnetv107x.c
@@ -12,6 +12,7 @@
12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 */ 14 */
15#include <linux/gpio.h>
15#include <linux/kernel.h> 16#include <linux/kernel.h>
16#include <linux/init.h> 17#include <linux/init.h>
17#include <linux/clk.h> 18#include <linux/clk.h>
@@ -27,9 +28,9 @@
27#include <mach/psc.h> 28#include <mach/psc.h>
28#include <mach/cp_intc.h> 29#include <mach/cp_intc.h>
29#include <mach/irqs.h> 30#include <mach/irqs.h>
30#include <mach/gpio.h>
31#include <mach/hardware.h> 31#include <mach/hardware.h>
32#include <mach/tnetv107x.h> 32#include <mach/tnetv107x.h>
33#include <mach/gpio-davinci.h>
33 34
34#include "clock.h" 35#include "clock.h"
35#include "mux.h" 36#include "mux.h"
diff --git a/arch/arm/mach-dove/Makefile.boot b/arch/arm/mach-dove/Makefile.boot
index 67039c3e0c48..760a0efe7580 100644
--- a/arch/arm/mach-dove/Makefile.boot
+++ b/arch/arm/mach-dove/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index 83dce859886d..a9e0dae86a26 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -158,7 +158,7 @@ void __init dove_spi0_init(void)
158 158
159void __init dove_spi1_init(void) 159void __init dove_spi1_init(void)
160{ 160{
161 orion_spi_init(DOVE_SPI1_PHYS_BASE, get_tclk()); 161 orion_spi_1_init(DOVE_SPI1_PHYS_BASE, get_tclk());
162} 162}
163 163
164/***************************************************************************** 164/*****************************************************************************
diff --git a/arch/arm/mach-ebsa110/Makefile.boot b/arch/arm/mach-ebsa110/Makefile.boot
index 232126044935..83cf07c38ada 100644
--- a/arch/arm/mach-ebsa110/Makefile.boot
+++ b/arch/arm/mach-ebsa110/Makefile.boot
@@ -1,4 +1,4 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000400 2params_phys-y := 0x00000400
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
4 4
diff --git a/arch/arm/mach-ebsa110/include/mach/io.h b/arch/arm/mach-ebsa110/include/mach/io.h
index f68daa632af0..44679db672fb 100644
--- a/arch/arm/mach-ebsa110/include/mach/io.h
+++ b/arch/arm/mach-ebsa110/include/mach/io.h
@@ -13,8 +13,6 @@
13#ifndef __ASM_ARM_ARCH_IO_H 13#ifndef __ASM_ARM_ARCH_IO_H
14#define __ASM_ARM_ARCH_IO_H 14#define __ASM_ARM_ARCH_IO_H
15 15
16#define IO_SPACE_LIMIT 0xffff
17
18u8 __inb8(unsigned int port); 16u8 __inb8(unsigned int port);
19void __outb8(u8 val, unsigned int port); 17void __outb8(u8 val, unsigned int port);
20 18
diff --git a/arch/arm/mach-ep93xx/Makefile.boot b/arch/arm/mach-ep93xx/Makefile.boot
index 0ad33f15c622..d3113a71cb40 100644
--- a/arch/arm/mach-ep93xx/Makefile.boot
+++ b/arch/arm/mach-ep93xx/Makefile.boot
@@ -1,14 +1,14 @@
1 zreladdr-$(CONFIG_EP93XX_SDCE3_SYNC_PHYS_OFFSET) := 0x00008000 1 zreladdr-$(CONFIG_EP93XX_SDCE3_SYNC_PHYS_OFFSET) += 0x00008000
2params_phys-$(CONFIG_EP93XX_SDCE3_SYNC_PHYS_OFFSET) := 0x00000100 2params_phys-$(CONFIG_EP93XX_SDCE3_SYNC_PHYS_OFFSET) := 0x00000100
3 3
4 zreladdr-$(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) := 0xc0008000 4 zreladdr-$(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) += 0xc0008000
5params_phys-$(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) := 0xc0000100 5params_phys-$(CONFIG_EP93XX_SDCE0_PHYS_OFFSET) := 0xc0000100
6 6
7 zreladdr-$(CONFIG_EP93XX_SDCE1_PHYS_OFFSET) := 0xd0008000 7 zreladdr-$(CONFIG_EP93XX_SDCE1_PHYS_OFFSET) += 0xd0008000
8params_phys-$(CONFIG_EP93XX_SDCE1_PHYS_OFFSET) := 0xd0000100 8params_phys-$(CONFIG_EP93XX_SDCE1_PHYS_OFFSET) := 0xd0000100
9 9
10 zreladdr-$(CONFIG_EP93XX_SDCE2_PHYS_OFFSET) := 0xe0008000 10 zreladdr-$(CONFIG_EP93XX_SDCE2_PHYS_OFFSET) += 0xe0008000
11params_phys-$(CONFIG_EP93XX_SDCE2_PHYS_OFFSET) := 0xe0000100 11params_phys-$(CONFIG_EP93XX_SDCE2_PHYS_OFFSET) := 0xe0000100
12 12
13 zreladdr-$(CONFIG_EP93XX_SDCE3_ASYNC_PHYS_OFFSET) := 0xf0008000 13 zreladdr-$(CONFIG_EP93XX_SDCE3_ASYNC_PHYS_OFFSET) += 0xf0008000
14params_phys-$(CONFIG_EP93XX_SDCE3_ASYNC_PHYS_OFFSET) := 0xf0000100 14params_phys-$(CONFIG_EP93XX_SDCE3_ASYNC_PHYS_OFFSET) := 0xf0000100
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index c60f081e930b..94c78bc66275 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -38,6 +38,7 @@
38#include <mach/fb.h> 38#include <mach/fb.h>
39#include <mach/ep93xx_keypad.h> 39#include <mach/ep93xx_keypad.h>
40#include <mach/ep93xx_spi.h> 40#include <mach/ep93xx_spi.h>
41#include <mach/gpio-ep93xx.h>
41 42
42#include <asm/mach/map.h> 43#include <asm/mach/map.h>
43#include <asm/mach/time.h> 44#include <asm/mach/time.h>
diff --git a/arch/arm/mach-ep93xx/edb93xx.c b/arch/arm/mach-ep93xx/edb93xx.c
index 257175edc575..c63a5ec1a8e3 100644
--- a/arch/arm/mach-ep93xx/edb93xx.c
+++ b/arch/arm/mach-ep93xx/edb93xx.c
@@ -37,6 +37,7 @@
37#include <mach/hardware.h> 37#include <mach/hardware.h>
38#include <mach/fb.h> 38#include <mach/fb.h>
39#include <mach/ep93xx_spi.h> 39#include <mach/ep93xx_spi.h>
40#include <mach/gpio-ep93xx.h>
40 41
41#include <asm/mach-types.h> 42#include <asm/mach-types.h>
42#include <asm/mach/arch.h> 43#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-ep93xx/include/mach/gpio-ep93xx.h b/arch/arm/mach-ep93xx/include/mach/gpio-ep93xx.h
new file mode 100644
index 000000000000..8aff2ea35877
--- /dev/null
+++ b/arch/arm/mach-ep93xx/include/mach/gpio-ep93xx.h
@@ -0,0 +1,100 @@
1/* Include file for the EP93XX GPIO controller machine specifics */
2
3#ifndef __GPIO_EP93XX_H
4#define __GPIO_EP93XX_H
5
6/* GPIO port A. */
7#define EP93XX_GPIO_LINE_A(x) ((x) + 0)
8#define EP93XX_GPIO_LINE_EGPIO0 EP93XX_GPIO_LINE_A(0)
9#define EP93XX_GPIO_LINE_EGPIO1 EP93XX_GPIO_LINE_A(1)
10#define EP93XX_GPIO_LINE_EGPIO2 EP93XX_GPIO_LINE_A(2)
11#define EP93XX_GPIO_LINE_EGPIO3 EP93XX_GPIO_LINE_A(3)
12#define EP93XX_GPIO_LINE_EGPIO4 EP93XX_GPIO_LINE_A(4)
13#define EP93XX_GPIO_LINE_EGPIO5 EP93XX_GPIO_LINE_A(5)
14#define EP93XX_GPIO_LINE_EGPIO6 EP93XX_GPIO_LINE_A(6)
15#define EP93XX_GPIO_LINE_EGPIO7 EP93XX_GPIO_LINE_A(7)
16
17/* GPIO port B. */
18#define EP93XX_GPIO_LINE_B(x) ((x) + 8)
19#define EP93XX_GPIO_LINE_EGPIO8 EP93XX_GPIO_LINE_B(0)
20#define EP93XX_GPIO_LINE_EGPIO9 EP93XX_GPIO_LINE_B(1)
21#define EP93XX_GPIO_LINE_EGPIO10 EP93XX_GPIO_LINE_B(2)
22#define EP93XX_GPIO_LINE_EGPIO11 EP93XX_GPIO_LINE_B(3)
23#define EP93XX_GPIO_LINE_EGPIO12 EP93XX_GPIO_LINE_B(4)
24#define EP93XX_GPIO_LINE_EGPIO13 EP93XX_GPIO_LINE_B(5)
25#define EP93XX_GPIO_LINE_EGPIO14 EP93XX_GPIO_LINE_B(6)
26#define EP93XX_GPIO_LINE_EGPIO15 EP93XX_GPIO_LINE_B(7)
27
28/* GPIO port C. */
29#define EP93XX_GPIO_LINE_C(x) ((x) + 40)
30#define EP93XX_GPIO_LINE_ROW0 EP93XX_GPIO_LINE_C(0)
31#define EP93XX_GPIO_LINE_ROW1 EP93XX_GPIO_LINE_C(1)
32#define EP93XX_GPIO_LINE_ROW2 EP93XX_GPIO_LINE_C(2)
33#define EP93XX_GPIO_LINE_ROW3 EP93XX_GPIO_LINE_C(3)
34#define EP93XX_GPIO_LINE_ROW4 EP93XX_GPIO_LINE_C(4)
35#define EP93XX_GPIO_LINE_ROW5 EP93XX_GPIO_LINE_C(5)
36#define EP93XX_GPIO_LINE_ROW6 EP93XX_GPIO_LINE_C(6)
37#define EP93XX_GPIO_LINE_ROW7 EP93XX_GPIO_LINE_C(7)
38
39/* GPIO port D. */
40#define EP93XX_GPIO_LINE_D(x) ((x) + 24)
41#define EP93XX_GPIO_LINE_COL0 EP93XX_GPIO_LINE_D(0)
42#define EP93XX_GPIO_LINE_COL1 EP93XX_GPIO_LINE_D(1)
43#define EP93XX_GPIO_LINE_COL2 EP93XX_GPIO_LINE_D(2)
44#define EP93XX_GPIO_LINE_COL3 EP93XX_GPIO_LINE_D(3)
45#define EP93XX_GPIO_LINE_COL4 EP93XX_GPIO_LINE_D(4)
46#define EP93XX_GPIO_LINE_COL5 EP93XX_GPIO_LINE_D(5)
47#define EP93XX_GPIO_LINE_COL6 EP93XX_GPIO_LINE_D(6)
48#define EP93XX_GPIO_LINE_COL7 EP93XX_GPIO_LINE_D(7)
49
50/* GPIO port E. */
51#define EP93XX_GPIO_LINE_E(x) ((x) + 32)
52#define EP93XX_GPIO_LINE_GRLED EP93XX_GPIO_LINE_E(0)
53#define EP93XX_GPIO_LINE_RDLED EP93XX_GPIO_LINE_E(1)
54#define EP93XX_GPIO_LINE_DIORn EP93XX_GPIO_LINE_E(2)
55#define EP93XX_GPIO_LINE_IDECS1n EP93XX_GPIO_LINE_E(3)
56#define EP93XX_GPIO_LINE_IDECS2n EP93XX_GPIO_LINE_E(4)
57#define EP93XX_GPIO_LINE_IDEDA0 EP93XX_GPIO_LINE_E(5)
58#define EP93XX_GPIO_LINE_IDEDA1 EP93XX_GPIO_LINE_E(6)
59#define EP93XX_GPIO_LINE_IDEDA2 EP93XX_GPIO_LINE_E(7)
60
61/* GPIO port F. */
62#define EP93XX_GPIO_LINE_F(x) ((x) + 16)
63#define EP93XX_GPIO_LINE_WP EP93XX_GPIO_LINE_F(0)
64#define EP93XX_GPIO_LINE_MCCD1 EP93XX_GPIO_LINE_F(1)
65#define EP93XX_GPIO_LINE_MCCD2 EP93XX_GPIO_LINE_F(2)
66#define EP93XX_GPIO_LINE_MCBVD1 EP93XX_GPIO_LINE_F(3)
67#define EP93XX_GPIO_LINE_MCBVD2 EP93XX_GPIO_LINE_F(4)
68#define EP93XX_GPIO_LINE_VS1 EP93XX_GPIO_LINE_F(5)
69#define EP93XX_GPIO_LINE_READY EP93XX_GPIO_LINE_F(6)
70#define EP93XX_GPIO_LINE_VS2 EP93XX_GPIO_LINE_F(7)
71
72/* GPIO port G. */
73#define EP93XX_GPIO_LINE_G(x) ((x) + 48)
74#define EP93XX_GPIO_LINE_EECLK EP93XX_GPIO_LINE_G(0)
75#define EP93XX_GPIO_LINE_EEDAT EP93XX_GPIO_LINE_G(1)
76#define EP93XX_GPIO_LINE_SLA0 EP93XX_GPIO_LINE_G(2)
77#define EP93XX_GPIO_LINE_SLA1 EP93XX_GPIO_LINE_G(3)
78#define EP93XX_GPIO_LINE_DD12 EP93XX_GPIO_LINE_G(4)
79#define EP93XX_GPIO_LINE_DD13 EP93XX_GPIO_LINE_G(5)
80#define EP93XX_GPIO_LINE_DD14 EP93XX_GPIO_LINE_G(6)
81#define EP93XX_GPIO_LINE_DD15 EP93XX_GPIO_LINE_G(7)
82
83/* GPIO port H. */
84#define EP93XX_GPIO_LINE_H(x) ((x) + 56)
85#define EP93XX_GPIO_LINE_DD0 EP93XX_GPIO_LINE_H(0)
86#define EP93XX_GPIO_LINE_DD1 EP93XX_GPIO_LINE_H(1)
87#define EP93XX_GPIO_LINE_DD2 EP93XX_GPIO_LINE_H(2)
88#define EP93XX_GPIO_LINE_DD3 EP93XX_GPIO_LINE_H(3)
89#define EP93XX_GPIO_LINE_DD4 EP93XX_GPIO_LINE_H(4)
90#define EP93XX_GPIO_LINE_DD5 EP93XX_GPIO_LINE_H(5)
91#define EP93XX_GPIO_LINE_DD6 EP93XX_GPIO_LINE_H(6)
92#define EP93XX_GPIO_LINE_DD7 EP93XX_GPIO_LINE_H(7)
93
94/* maximum value for gpio line identifiers */
95#define EP93XX_GPIO_LINE_MAX EP93XX_GPIO_LINE_H(7)
96
97/* maximum value for irq capable line identifiers */
98#define EP93XX_GPIO_LINE_MAX_IRQ EP93XX_GPIO_LINE_F(7)
99
100#endif /* __GPIO_EP93XX_H */
diff --git a/arch/arm/mach-ep93xx/include/mach/gpio.h b/arch/arm/mach-ep93xx/include/mach/gpio.h
index c57152c231f1..40a8c178f10d 100644
--- a/arch/arm/mach-ep93xx/include/mach/gpio.h
+++ b/arch/arm/mach-ep93xx/include/mach/gpio.h
@@ -1,120 +1 @@
1/* /* empty */
2 * arch/arm/mach-ep93xx/include/mach/gpio.h
3 */
4
5#ifndef __ASM_ARCH_GPIO_H
6#define __ASM_ARCH_GPIO_H
7
8/* GPIO port A. */
9#define EP93XX_GPIO_LINE_A(x) ((x) + 0)
10#define EP93XX_GPIO_LINE_EGPIO0 EP93XX_GPIO_LINE_A(0)
11#define EP93XX_GPIO_LINE_EGPIO1 EP93XX_GPIO_LINE_A(1)
12#define EP93XX_GPIO_LINE_EGPIO2 EP93XX_GPIO_LINE_A(2)
13#define EP93XX_GPIO_LINE_EGPIO3 EP93XX_GPIO_LINE_A(3)
14#define EP93XX_GPIO_LINE_EGPIO4 EP93XX_GPIO_LINE_A(4)
15#define EP93XX_GPIO_LINE_EGPIO5 EP93XX_GPIO_LINE_A(5)
16#define EP93XX_GPIO_LINE_EGPIO6 EP93XX_GPIO_LINE_A(6)
17#define EP93XX_GPIO_LINE_EGPIO7 EP93XX_GPIO_LINE_A(7)
18
19/* GPIO port B. */
20#define EP93XX_GPIO_LINE_B(x) ((x) + 8)
21#define EP93XX_GPIO_LINE_EGPIO8 EP93XX_GPIO_LINE_B(0)
22#define EP93XX_GPIO_LINE_EGPIO9 EP93XX_GPIO_LINE_B(1)
23#define EP93XX_GPIO_LINE_EGPIO10 EP93XX_GPIO_LINE_B(2)
24#define EP93XX_GPIO_LINE_EGPIO11 EP93XX_GPIO_LINE_B(3)
25#define EP93XX_GPIO_LINE_EGPIO12 EP93XX_GPIO_LINE_B(4)
26#define EP93XX_GPIO_LINE_EGPIO13 EP93XX_GPIO_LINE_B(5)
27#define EP93XX_GPIO_LINE_EGPIO14 EP93XX_GPIO_LINE_B(6)
28#define EP93XX_GPIO_LINE_EGPIO15 EP93XX_GPIO_LINE_B(7)
29
30/* GPIO port C. */
31#define EP93XX_GPIO_LINE_C(x) ((x) + 40)
32#define EP93XX_GPIO_LINE_ROW0 EP93XX_GPIO_LINE_C(0)
33#define EP93XX_GPIO_LINE_ROW1 EP93XX_GPIO_LINE_C(1)
34#define EP93XX_GPIO_LINE_ROW2 EP93XX_GPIO_LINE_C(2)
35#define EP93XX_GPIO_LINE_ROW3 EP93XX_GPIO_LINE_C(3)
36#define EP93XX_GPIO_LINE_ROW4 EP93XX_GPIO_LINE_C(4)
37#define EP93XX_GPIO_LINE_ROW5 EP93XX_GPIO_LINE_C(5)
38#define EP93XX_GPIO_LINE_ROW6 EP93XX_GPIO_LINE_C(6)
39#define EP93XX_GPIO_LINE_ROW7 EP93XX_GPIO_LINE_C(7)
40
41/* GPIO port D. */
42#define EP93XX_GPIO_LINE_D(x) ((x) + 24)
43#define EP93XX_GPIO_LINE_COL0 EP93XX_GPIO_LINE_D(0)
44#define EP93XX_GPIO_LINE_COL1 EP93XX_GPIO_LINE_D(1)
45#define EP93XX_GPIO_LINE_COL2 EP93XX_GPIO_LINE_D(2)
46#define EP93XX_GPIO_LINE_COL3 EP93XX_GPIO_LINE_D(3)
47#define EP93XX_GPIO_LINE_COL4 EP93XX_GPIO_LINE_D(4)
48#define EP93XX_GPIO_LINE_COL5 EP93XX_GPIO_LINE_D(5)
49#define EP93XX_GPIO_LINE_COL6 EP93XX_GPIO_LINE_D(6)
50#define EP93XX_GPIO_LINE_COL7 EP93XX_GPIO_LINE_D(7)
51
52/* GPIO port E. */
53#define EP93XX_GPIO_LINE_E(x) ((x) + 32)
54#define EP93XX_GPIO_LINE_GRLED EP93XX_GPIO_LINE_E(0)
55#define EP93XX_GPIO_LINE_RDLED EP93XX_GPIO_LINE_E(1)
56#define EP93XX_GPIO_LINE_DIORn EP93XX_GPIO_LINE_E(2)
57#define EP93XX_GPIO_LINE_IDECS1n EP93XX_GPIO_LINE_E(3)
58#define EP93XX_GPIO_LINE_IDECS2n EP93XX_GPIO_LINE_E(4)
59#define EP93XX_GPIO_LINE_IDEDA0 EP93XX_GPIO_LINE_E(5)
60#define EP93XX_GPIO_LINE_IDEDA1 EP93XX_GPIO_LINE_E(6)
61#define EP93XX_GPIO_LINE_IDEDA2 EP93XX_GPIO_LINE_E(7)
62
63/* GPIO port F. */
64#define EP93XX_GPIO_LINE_F(x) ((x) + 16)
65#define EP93XX_GPIO_LINE_WP EP93XX_GPIO_LINE_F(0)
66#define EP93XX_GPIO_LINE_MCCD1 EP93XX_GPIO_LINE_F(1)
67#define EP93XX_GPIO_LINE_MCCD2 EP93XX_GPIO_LINE_F(2)
68#define EP93XX_GPIO_LINE_MCBVD1 EP93XX_GPIO_LINE_F(3)
69#define EP93XX_GPIO_LINE_MCBVD2 EP93XX_GPIO_LINE_F(4)
70#define EP93XX_GPIO_LINE_VS1 EP93XX_GPIO_LINE_F(5)
71#define EP93XX_GPIO_LINE_READY EP93XX_GPIO_LINE_F(6)
72#define EP93XX_GPIO_LINE_VS2 EP93XX_GPIO_LINE_F(7)
73
74/* GPIO port G. */
75#define EP93XX_GPIO_LINE_G(x) ((x) + 48)
76#define EP93XX_GPIO_LINE_EECLK EP93XX_GPIO_LINE_G(0)
77#define EP93XX_GPIO_LINE_EEDAT EP93XX_GPIO_LINE_G(1)
78#define EP93XX_GPIO_LINE_SLA0 EP93XX_GPIO_LINE_G(2)
79#define EP93XX_GPIO_LINE_SLA1 EP93XX_GPIO_LINE_G(3)
80#define EP93XX_GPIO_LINE_DD12 EP93XX_GPIO_LINE_G(4)
81#define EP93XX_GPIO_LINE_DD13 EP93XX_GPIO_LINE_G(5)
82#define EP93XX_GPIO_LINE_DD14 EP93XX_GPIO_LINE_G(6)
83#define EP93XX_GPIO_LINE_DD15 EP93XX_GPIO_LINE_G(7)
84
85/* GPIO port H. */
86#define EP93XX_GPIO_LINE_H(x) ((x) + 56)
87#define EP93XX_GPIO_LINE_DD0 EP93XX_GPIO_LINE_H(0)
88#define EP93XX_GPIO_LINE_DD1 EP93XX_GPIO_LINE_H(1)
89#define EP93XX_GPIO_LINE_DD2 EP93XX_GPIO_LINE_H(2)
90#define EP93XX_GPIO_LINE_DD3 EP93XX_GPIO_LINE_H(3)
91#define EP93XX_GPIO_LINE_DD4 EP93XX_GPIO_LINE_H(4)
92#define EP93XX_GPIO_LINE_DD5 EP93XX_GPIO_LINE_H(5)
93#define EP93XX_GPIO_LINE_DD6 EP93XX_GPIO_LINE_H(6)
94#define EP93XX_GPIO_LINE_DD7 EP93XX_GPIO_LINE_H(7)
95
96/* maximum value for gpio line identifiers */
97#define EP93XX_GPIO_LINE_MAX EP93XX_GPIO_LINE_H(7)
98
99/* maximum value for irq capable line identifiers */
100#define EP93XX_GPIO_LINE_MAX_IRQ EP93XX_GPIO_LINE_F(7)
101
102/* new generic GPIO API - see Documentation/gpio.txt */
103
104#include <asm-generic/gpio.h>
105
106#define gpio_get_value __gpio_get_value
107#define gpio_set_value __gpio_set_value
108#define gpio_cansleep __gpio_cansleep
109
110/*
111 * Map GPIO A0..A7 (0..7) to irq 64..71,
112 * B0..B7 (7..15) to irq 72..79, and
113 * F0..F7 (16..24) to irq 80..87.
114 */
115#define gpio_to_irq(gpio) \
116 (((gpio) <= EP93XX_GPIO_LINE_MAX_IRQ) ? (64 + (gpio)) : -EINVAL)
117
118#define irq_to_gpio(irq) ((irq) - gpio_to_irq(0))
119
120#endif
diff --git a/arch/arm/mach-ep93xx/simone.c b/arch/arm/mach-ep93xx/simone.c
index 238bc603da86..d6f286b4db9c 100644
--- a/arch/arm/mach-ep93xx/simone.c
+++ b/arch/arm/mach-ep93xx/simone.c
@@ -18,12 +18,12 @@
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/platform_device.h> 20#include <linux/platform_device.h>
21#include <linux/gpio.h>
22#include <linux/i2c.h> 21#include <linux/i2c.h>
23#include <linux/i2c-gpio.h> 22#include <linux/i2c-gpio.h>
24 23
25#include <mach/hardware.h> 24#include <mach/hardware.h>
26#include <mach/fb.h> 25#include <mach/fb.h>
26#include <mach/gpio-ep93xx.h>
27 27
28#include <asm/mach-types.h> 28#include <asm/mach-types.h>
29#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-ep93xx/snappercl15.c b/arch/arm/mach-ep93xx/snappercl15.c
index 3bdf3a2e5ad0..2b4d4b0201df 100644
--- a/arch/arm/mach-ep93xx/snappercl15.c
+++ b/arch/arm/mach-ep93xx/snappercl15.c
@@ -20,7 +20,6 @@
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/gpio.h>
24#include <linux/i2c.h> 23#include <linux/i2c.h>
25#include <linux/i2c-gpio.h> 24#include <linux/i2c-gpio.h>
26#include <linux/fb.h> 25#include <linux/fb.h>
@@ -30,6 +29,7 @@
30 29
31#include <mach/hardware.h> 30#include <mach/hardware.h>
32#include <mach/fb.h> 31#include <mach/fb.h>
32#include <mach/gpio-ep93xx.h>
33 33
34#include <asm/mach-types.h> 34#include <asm/mach-types.h>
35#include <asm/mach/arch.h> 35#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-exynos4/Kconfig b/arch/arm/mach-exynos4/Kconfig
index 0c77ab99fa16..fc1f92dfbea8 100644
--- a/arch/arm/mach-exynos4/Kconfig
+++ b/arch/arm/mach-exynos4/Kconfig
@@ -12,6 +12,7 @@ if ARCH_EXYNOS4
12config CPU_EXYNOS4210 12config CPU_EXYNOS4210
13 bool 13 bool
14 select S3C_PL330_DMA 14 select S3C_PL330_DMA
15 select ARM_CPU_SUSPEND if PM
15 help 16 help
16 Enable EXYNOS4210 CPU support 17 Enable EXYNOS4210 CPU support
17 18
diff --git a/arch/arm/mach-exynos4/Makefile.boot b/arch/arm/mach-exynos4/Makefile.boot
index d65956ffb43d..b9862e22bf10 100644
--- a/arch/arm/mach-exynos4/Makefile.boot
+++ b/arch/arm/mach-exynos4/Makefile.boot
@@ -1,2 +1,2 @@
1 zreladdr-y := 0x40008000 1 zreladdr-y += 0x40008000
2params_phys-y := 0x40000100 2params_phys-y := 0x40000100
diff --git a/arch/arm/mach-exynos4/clock.c b/arch/arm/mach-exynos4/clock.c
index 1561b036a9bf..86964d2e9e1b 100644
--- a/arch/arm/mach-exynos4/clock.c
+++ b/arch/arm/mach-exynos4/clock.c
@@ -899,8 +899,7 @@ static struct clksrc_clk clksrcs[] = {
899 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 28, .size = 4 }, 899 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 28, .size = 4 },
900 }, { 900 }, {
901 .clk = { 901 .clk = {
902 .name = "sclk_cam", 902 .name = "sclk_cam0",
903 .devname = "exynos4-fimc.0",
904 .enable = exynos4_clksrc_mask_cam_ctrl, 903 .enable = exynos4_clksrc_mask_cam_ctrl,
905 .ctrlbit = (1 << 16), 904 .ctrlbit = (1 << 16),
906 }, 905 },
@@ -909,8 +908,7 @@ static struct clksrc_clk clksrcs[] = {
909 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 16, .size = 4 }, 908 .reg_div = { .reg = S5P_CLKDIV_CAM, .shift = 16, .size = 4 },
910 }, { 909 }, {
911 .clk = { 910 .clk = {
912 .name = "sclk_cam", 911 .name = "sclk_cam1",
913 .devname = "exynos4-fimc.1",
914 .enable = exynos4_clksrc_mask_cam_ctrl, 912 .enable = exynos4_clksrc_mask_cam_ctrl,
915 .ctrlbit = (1 << 20), 913 .ctrlbit = (1 << 20),
916 }, 914 },
@@ -1160,7 +1158,7 @@ void __init_or_cpufreq exynos4_setup_clocks(void)
1160 1158
1161 vpllsrc = clk_get_rate(&clk_vpllsrc.clk); 1159 vpllsrc = clk_get_rate(&clk_vpllsrc.clk);
1162 vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(S5P_VPLL_CON0), 1160 vpll = s5p_get_pll46xx(vpllsrc, __raw_readl(S5P_VPLL_CON0),
1163 __raw_readl(S5P_VPLL_CON1), pll_4650); 1161 __raw_readl(S5P_VPLL_CON1), pll_4650c);
1164 1162
1165 clk_fout_apll.ops = &exynos4_fout_apll_ops; 1163 clk_fout_apll.ops = &exynos4_fout_apll_ops;
1166 clk_fout_mpll.rate = mpll; 1164 clk_fout_mpll.rate = mpll;
diff --git a/arch/arm/mach-exynos4/include/mach/gpio.h b/arch/arm/mach-exynos4/include/mach/gpio.h
index be9266b10fdb..80523ca9bb49 100644
--- a/arch/arm/mach-exynos4/include/mach/gpio.h
+++ b/arch/arm/mach-exynos4/include/mach/gpio.h
@@ -13,11 +13,6 @@
13#ifndef __ASM_ARCH_GPIO_H 13#ifndef __ASM_ARCH_GPIO_H
14#define __ASM_ARCH_GPIO_H __FILE__ 14#define __ASM_ARCH_GPIO_H __FILE__
15 15
16#define gpio_get_value __gpio_get_value
17#define gpio_set_value __gpio_set_value
18#define gpio_cansleep __gpio_cansleep
19#define gpio_to_irq __gpio_to_irq
20
21/* Practically, GPIO banks up to GPZ are the configurable gpio banks */ 16/* Practically, GPIO banks up to GPZ are the configurable gpio banks */
22 17
23/* GPIO bank sizes */ 18/* GPIO bank sizes */
@@ -151,6 +146,4 @@ enum s5p_gpio_number {
151#define ARCH_NR_GPIOS (EXYNOS4_GPZ(EXYNOS4_GPIO_Z_NR) + \ 146#define ARCH_NR_GPIOS (EXYNOS4_GPZ(EXYNOS4_GPIO_Z_NR) + \
152 CONFIG_SAMSUNG_GPIO_EXTRA + 1) 147 CONFIG_SAMSUNG_GPIO_EXTRA + 1)
153 148
154#include <asm-generic/gpio.h>
155
156#endif /* __ASM_ARCH_GPIO_H */ 149#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-exynos4/mct.c b/arch/arm/mach-exynos4/mct.c
index 85a1bb79f11c..582b874aab0e 100644
--- a/arch/arm/mach-exynos4/mct.c
+++ b/arch/arm/mach-exynos4/mct.c
@@ -132,12 +132,18 @@ static cycle_t exynos4_frc_read(struct clocksource *cs)
132 return ((cycle_t)hi << 32) | lo; 132 return ((cycle_t)hi << 32) | lo;
133} 133}
134 134
135static void exynos4_frc_resume(struct clocksource *cs)
136{
137 exynos4_mct_frc_start(0, 0);
138}
139
135struct clocksource mct_frc = { 140struct clocksource mct_frc = {
136 .name = "mct-frc", 141 .name = "mct-frc",
137 .rating = 400, 142 .rating = 400,
138 .read = exynos4_frc_read, 143 .read = exynos4_frc_read,
139 .mask = CLOCKSOURCE_MASK(64), 144 .mask = CLOCKSOURCE_MASK(64),
140 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 145 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
146 .resume = exynos4_frc_resume,
141}; 147};
142 148
143static void __init exynos4_clocksource_init(void) 149static void __init exynos4_clocksource_init(void)
@@ -391,9 +397,11 @@ static void exynos4_mct_tick_init(struct clock_event_device *evt)
391} 397}
392 398
393/* Setup the local clock events for a CPU */ 399/* Setup the local clock events for a CPU */
394void __cpuinit local_timer_setup(struct clock_event_device *evt) 400int __cpuinit local_timer_setup(struct clock_event_device *evt)
395{ 401{
396 exynos4_mct_tick_init(evt); 402 exynos4_mct_tick_init(evt);
403
404 return 0;
397} 405}
398 406
399void local_timer_stop(struct clock_event_device *evt) 407void local_timer_stop(struct clock_event_device *evt)
diff --git a/arch/arm/mach-exynos4/platsmp.c b/arch/arm/mach-exynos4/platsmp.c
index a08c536923f9..0c90896ad9a0 100644
--- a/arch/arm/mach-exynos4/platsmp.c
+++ b/arch/arm/mach-exynos4/platsmp.c
@@ -106,6 +106,8 @@ void __cpuinit platform_secondary_init(unsigned int cpu)
106 */ 106 */
107 spin_lock(&boot_lock); 107 spin_lock(&boot_lock);
108 spin_unlock(&boot_lock); 108 spin_unlock(&boot_lock);
109
110 set_cpu_online(cpu, true);
109} 111}
110 112
111int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle) 113int __cpuinit boot_secondary(unsigned int cpu, struct task_struct *idle)
diff --git a/arch/arm/mach-exynos4/setup-keypad.c b/arch/arm/mach-exynos4/setup-keypad.c
index 1ee0ebff111f..7862bfb5933d 100644
--- a/arch/arm/mach-exynos4/setup-keypad.c
+++ b/arch/arm/mach-exynos4/setup-keypad.c
@@ -19,15 +19,16 @@ void samsung_keypad_cfg_gpio(unsigned int rows, unsigned int cols)
19 19
20 if (rows > 8) { 20 if (rows > 8) {
21 /* Set all the necessary GPX2 pins: KP_ROW[0~7] */ 21 /* Set all the necessary GPX2 pins: KP_ROW[0~7] */
22 s3c_gpio_cfgrange_nopull(EXYNOS4_GPX2(0), 8, S3C_GPIO_SFN(3)); 22 s3c_gpio_cfgall_range(EXYNOS4_GPX2(0), 8, S3C_GPIO_SFN(3),
23 S3C_GPIO_PULL_UP);
23 24
24 /* Set all the necessary GPX3 pins: KP_ROW[8~] */ 25 /* Set all the necessary GPX3 pins: KP_ROW[8~] */
25 s3c_gpio_cfgrange_nopull(EXYNOS4_GPX3(0), (rows - 8), 26 s3c_gpio_cfgall_range(EXYNOS4_GPX3(0), (rows - 8),
26 S3C_GPIO_SFN(3)); 27 S3C_GPIO_SFN(3), S3C_GPIO_PULL_UP);
27 } else { 28 } else {
28 /* Set all the necessary GPX2 pins: KP_ROW[x] */ 29 /* Set all the necessary GPX2 pins: KP_ROW[x] */
29 s3c_gpio_cfgrange_nopull(EXYNOS4_GPX2(0), rows, 30 s3c_gpio_cfgall_range(EXYNOS4_GPX2(0), rows, S3C_GPIO_SFN(3),
30 S3C_GPIO_SFN(3)); 31 S3C_GPIO_PULL_UP);
31 } 32 }
32 33
33 /* Set all the necessary GPX1 pins to special-function 3: KP_COL[x] */ 34 /* Set all the necessary GPX1 pins to special-function 3: KP_COL[x] */
diff --git a/arch/arm/mach-footbridge/Kconfig b/arch/arm/mach-footbridge/Kconfig
index c8e7afcf14ec..f643ef819da6 100644
--- a/arch/arm/mach-footbridge/Kconfig
+++ b/arch/arm/mach-footbridge/Kconfig
@@ -4,8 +4,8 @@ menu "Footbridge Implementations"
4 4
5config ARCH_CATS 5config ARCH_CATS
6 bool "CATS" 6 bool "CATS"
7 select CLKSRC_I8253
8 select CLKEVT_I8253 7 select CLKEVT_I8253
8 select CLKSRC_I8253
9 select FOOTBRIDGE_HOST 9 select FOOTBRIDGE_HOST
10 select ISA 10 select ISA
11 select ISA_DMA 11 select ISA_DMA
@@ -61,8 +61,8 @@ config ARCH_EBSA285_HOST
61 61
62config ARCH_NETWINDER 62config ARCH_NETWINDER
63 bool "NetWinder" 63 bool "NetWinder"
64 select CLKSRC_I8253
65 select CLKEVT_I8253 64 select CLKEVT_I8253
65 select CLKSRC_I8253
66 select FOOTBRIDGE_HOST 66 select FOOTBRIDGE_HOST
67 select ISA 67 select ISA
68 select ISA_DMA 68 select ISA_DMA
diff --git a/arch/arm/mach-footbridge/Makefile.boot b/arch/arm/mach-footbridge/Makefile.boot
index c7e75acfe6c9..ff0a4b5b0a82 100644
--- a/arch/arm/mach-footbridge/Makefile.boot
+++ b/arch/arm/mach-footbridge/Makefile.boot
@@ -1,4 +1,4 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
4 4
diff --git a/arch/arm/mach-footbridge/cats-hw.c b/arch/arm/mach-footbridge/cats-hw.c
index a3da5d1106c2..d5f178540928 100644
--- a/arch/arm/mach-footbridge/cats-hw.c
+++ b/arch/arm/mach-footbridge/cats-hw.c
@@ -76,8 +76,7 @@ __initcall(cats_hw_init);
76 * hard reboots fail on early boards. 76 * hard reboots fail on early boards.
77 */ 77 */
78static void __init 78static void __init
79fixup_cats(struct machine_desc *desc, struct tag *tags, 79fixup_cats(struct tag *tags, char **cmdline, struct meminfo *mi)
80 char **cmdline, struct meminfo *mi)
81{ 80{
82 screen_info.orig_video_lines = 25; 81 screen_info.orig_video_lines = 25;
83 screen_info.orig_video_points = 16; 82 screen_info.orig_video_points = 16;
diff --git a/arch/arm/mach-footbridge/include/mach/hardware.h b/arch/arm/mach-footbridge/include/mach/hardware.h
index 15d54981674c..e3d6ccac2162 100644
--- a/arch/arm/mach-footbridge/include/mach/hardware.h
+++ b/arch/arm/mach-footbridge/include/mach/hardware.h
@@ -93,7 +93,7 @@
93#define CPLD_FLASH_WR_ENABLE 1 93#define CPLD_FLASH_WR_ENABLE 1
94 94
95#ifndef __ASSEMBLY__ 95#ifndef __ASSEMBLY__
96extern spinlock_t nw_gpio_lock; 96extern raw_spinlock_t nw_gpio_lock;
97extern void nw_gpio_modify_op(unsigned int mask, unsigned int set); 97extern void nw_gpio_modify_op(unsigned int mask, unsigned int set);
98extern void nw_gpio_modify_io(unsigned int mask, unsigned int in); 98extern void nw_gpio_modify_io(unsigned int mask, unsigned int in);
99extern unsigned int nw_gpio_read(void); 99extern unsigned int nw_gpio_read(void);
diff --git a/arch/arm/mach-footbridge/include/mach/io.h b/arch/arm/mach-footbridge/include/mach/io.h
index 32e4cc397c28..15a70396c27d 100644
--- a/arch/arm/mach-footbridge/include/mach/io.h
+++ b/arch/arm/mach-footbridge/include/mach/io.h
@@ -23,8 +23,6 @@
23#define PCIO_SIZE 0x00100000 23#define PCIO_SIZE 0x00100000
24#define PCIO_BASE MMU_IO(0xff000000, 0x7c000000) 24#define PCIO_BASE MMU_IO(0xff000000, 0x7c000000)
25 25
26#define IO_SPACE_LIMIT 0xffff
27
28/* 26/*
29 * Translation of various region addresses to virtual addresses 27 * Translation of various region addresses to virtual addresses
30 */ 28 */
diff --git a/arch/arm/mach-footbridge/netwinder-hw.c b/arch/arm/mach-footbridge/netwinder-hw.c
index d8c1c922e24c..0d3846f3b60d 100644
--- a/arch/arm/mach-footbridge/netwinder-hw.c
+++ b/arch/arm/mach-footbridge/netwinder-hw.c
@@ -68,7 +68,7 @@ static inline void wb977_ww(int reg, int val)
68/* 68/*
69 * This is a lock for accessing ports GP1_IO_BASE and GP2_IO_BASE 69 * This is a lock for accessing ports GP1_IO_BASE and GP2_IO_BASE
70 */ 70 */
71DEFINE_SPINLOCK(nw_gpio_lock); 71DEFINE_RAW_SPINLOCK(nw_gpio_lock);
72EXPORT_SYMBOL(nw_gpio_lock); 72EXPORT_SYMBOL(nw_gpio_lock);
73 73
74static unsigned int current_gpio_op; 74static unsigned int current_gpio_op;
@@ -327,9 +327,9 @@ static inline void wb977_init_gpio(void)
327 /* 327 /*
328 * Set Group1/Group2 outputs 328 * Set Group1/Group2 outputs
329 */ 329 */
330 spin_lock_irqsave(&nw_gpio_lock, flags); 330 raw_spin_lock_irqsave(&nw_gpio_lock, flags);
331 nw_gpio_modify_op(-1, GPIO_RED_LED | GPIO_FAN); 331 nw_gpio_modify_op(-1, GPIO_RED_LED | GPIO_FAN);
332 spin_unlock_irqrestore(&nw_gpio_lock, flags); 332 raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
333} 333}
334 334
335/* 335/*
@@ -390,9 +390,9 @@ static void __init cpld_init(void)
390{ 390{
391 unsigned long flags; 391 unsigned long flags;
392 392
393 spin_lock_irqsave(&nw_gpio_lock, flags); 393 raw_spin_lock_irqsave(&nw_gpio_lock, flags);
394 nw_cpld_modify(-1, CPLD_UNMUTE | CPLD_7111_DISABLE); 394 nw_cpld_modify(-1, CPLD_UNMUTE | CPLD_7111_DISABLE);
395 spin_unlock_irqrestore(&nw_gpio_lock, flags); 395 raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
396} 396}
397 397
398static unsigned char rwa_unlock[] __initdata = 398static unsigned char rwa_unlock[] __initdata =
@@ -616,9 +616,9 @@ static int __init nw_hw_init(void)
616 cpld_init(); 616 cpld_init();
617 rwa010_init(); 617 rwa010_init();
618 618
619 spin_lock_irqsave(&nw_gpio_lock, flags); 619 raw_spin_lock_irqsave(&nw_gpio_lock, flags);
620 nw_gpio_modify_op(GPIO_RED_LED|GPIO_GREEN_LED, DEFAULT_LEDS); 620 nw_gpio_modify_op(GPIO_RED_LED|GPIO_GREEN_LED, DEFAULT_LEDS);
621 spin_unlock_irqrestore(&nw_gpio_lock, flags); 621 raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
622 } 622 }
623 return 0; 623 return 0;
624} 624}
@@ -631,8 +631,7 @@ __initcall(nw_hw_init);
631 * the parameter page. 631 * the parameter page.
632 */ 632 */
633static void __init 633static void __init
634fixup_netwinder(struct machine_desc *desc, struct tag *tags, 634fixup_netwinder(struct tag *tags, char **cmdline, struct meminfo *mi)
635 char **cmdline, struct meminfo *mi)
636{ 635{
637#ifdef CONFIG_ISAPNP 636#ifdef CONFIG_ISAPNP
638 extern int isapnp_disable; 637 extern int isapnp_disable;
diff --git a/arch/arm/mach-footbridge/netwinder-leds.c b/arch/arm/mach-footbridge/netwinder-leds.c
index 00269fe0be8a..e57102e871fc 100644
--- a/arch/arm/mach-footbridge/netwinder-leds.c
+++ b/arch/arm/mach-footbridge/netwinder-leds.c
@@ -31,13 +31,13 @@
31static char led_state; 31static char led_state;
32static char hw_led_state; 32static char hw_led_state;
33 33
34static DEFINE_SPINLOCK(leds_lock); 34static DEFINE_RAW_SPINLOCK(leds_lock);
35 35
36static void netwinder_leds_event(led_event_t evt) 36static void netwinder_leds_event(led_event_t evt)
37{ 37{
38 unsigned long flags; 38 unsigned long flags;
39 39
40 spin_lock_irqsave(&leds_lock, flags); 40 raw_spin_lock_irqsave(&leds_lock, flags);
41 41
42 switch (evt) { 42 switch (evt) {
43 case led_start: 43 case led_start:
@@ -117,12 +117,12 @@ static void netwinder_leds_event(led_event_t evt)
117 break; 117 break;
118 } 118 }
119 119
120 spin_unlock_irqrestore(&leds_lock, flags); 120 raw_spin_unlock_irqrestore(&leds_lock, flags);
121 121
122 if (led_state & LED_STATE_ENABLED) { 122 if (led_state & LED_STATE_ENABLED) {
123 spin_lock_irqsave(&nw_gpio_lock, flags); 123 raw_spin_lock_irqsave(&nw_gpio_lock, flags);
124 nw_gpio_modify_op(GPIO_RED_LED | GPIO_GREEN_LED, hw_led_state); 124 nw_gpio_modify_op(GPIO_RED_LED | GPIO_GREEN_LED, hw_led_state);
125 spin_unlock_irqrestore(&nw_gpio_lock, flags); 125 raw_spin_unlock_irqrestore(&nw_gpio_lock, flags);
126 } 126 }
127} 127}
128 128
diff --git a/arch/arm/mach-gemini/Makefile.boot b/arch/arm/mach-gemini/Makefile.boot
index 22a52c228d93..683f52b20e3d 100644
--- a/arch/arm/mach-gemini/Makefile.boot
+++ b/arch/arm/mach-gemini/Makefile.boot
@@ -1,9 +1,9 @@
1ifeq ($(CONFIG_GEMINI_MEM_SWAP),y) 1ifeq ($(CONFIG_GEMINI_MEM_SWAP),y)
2 zreladdr-y := 0x00008000 2 zreladdr-y += 0x00008000
3params_phys-y := 0x00000100 3params_phys-y := 0x00000100
4initrd_phys-y := 0x00800000 4initrd_phys-y := 0x00800000
5else 5else
6 zreladdr-y := 0x10008000 6 zreladdr-y += 0x10008000
7params_phys-y := 0x10000100 7params_phys-y := 0x10000100
8initrd_phys-y := 0x10800000 8initrd_phys-y := 0x10800000
9endif 9endif
diff --git a/arch/arm/mach-gemini/include/mach/gpio.h b/arch/arm/mach-gemini/include/mach/gpio.h
index 3bc2c70f2989..40a0527bada7 100644
--- a/arch/arm/mach-gemini/include/mach/gpio.h
+++ b/arch/arm/mach-gemini/include/mach/gpio.h
@@ -13,11 +13,6 @@
13#define __MACH_GPIO_H__ 13#define __MACH_GPIO_H__
14 14
15#include <mach/irqs.h> 15#include <mach/irqs.h>
16#include <asm-generic/gpio.h>
17
18#define gpio_get_value __gpio_get_value
19#define gpio_set_value __gpio_set_value
20#define gpio_cansleep __gpio_cansleep
21 16
22#define gpio_to_irq(x) ((x) + GPIO_IRQ_BASE) 17#define gpio_to_irq(x) ((x) + GPIO_IRQ_BASE)
23#define irq_to_gpio(x) ((x) - GPIO_IRQ_BASE) 18#define irq_to_gpio(x) ((x) - GPIO_IRQ_BASE)
diff --git a/arch/arm/mach-h720x/Makefile.boot b/arch/arm/mach-h720x/Makefile.boot
index 52984017bd91..d875a7094dfe 100644
--- a/arch/arm/mach-h720x/Makefile.boot
+++ b/arch/arm/mach-h720x/Makefile.boot
@@ -1,2 +1,2 @@
1 zreladdr-$(CONFIG_ARCH_H720X) := 0x40008000 1 zreladdr-$(CONFIG_ARCH_H720X) += 0x40008000
2 2
diff --git a/arch/arm/mach-imx/Makefile.boot b/arch/arm/mach-imx/Makefile.boot
index ebee18b3884c..dbe61201bcd8 100644
--- a/arch/arm/mach-imx/Makefile.boot
+++ b/arch/arm/mach-imx/Makefile.boot
@@ -1,19 +1,19 @@
1zreladdr-$(CONFIG_ARCH_MX1) := 0x08008000 1zreladdr-$(CONFIG_ARCH_MX1) += 0x08008000
2params_phys-$(CONFIG_ARCH_MX1) := 0x08000100 2params_phys-$(CONFIG_ARCH_MX1) := 0x08000100
3initrd_phys-$(CONFIG_ARCH_MX1) := 0x08800000 3initrd_phys-$(CONFIG_ARCH_MX1) := 0x08800000
4 4
5zreladdr-$(CONFIG_MACH_MX21) := 0xC0008000 5zreladdr-$(CONFIG_MACH_MX21) += 0xC0008000
6params_phys-$(CONFIG_MACH_MX21) := 0xC0000100 6params_phys-$(CONFIG_MACH_MX21) := 0xC0000100
7initrd_phys-$(CONFIG_MACH_MX21) := 0xC0800000 7initrd_phys-$(CONFIG_MACH_MX21) := 0xC0800000
8 8
9zreladdr-$(CONFIG_ARCH_MX25) := 0x80008000 9zreladdr-$(CONFIG_ARCH_MX25) += 0x80008000
10params_phys-$(CONFIG_ARCH_MX25) := 0x80000100 10params_phys-$(CONFIG_ARCH_MX25) := 0x80000100
11initrd_phys-$(CONFIG_ARCH_MX25) := 0x80800000 11initrd_phys-$(CONFIG_ARCH_MX25) := 0x80800000
12 12
13zreladdr-$(CONFIG_MACH_MX27) := 0xA0008000 13zreladdr-$(CONFIG_MACH_MX27) += 0xA0008000
14params_phys-$(CONFIG_MACH_MX27) := 0xA0000100 14params_phys-$(CONFIG_MACH_MX27) := 0xA0000100
15initrd_phys-$(CONFIG_MACH_MX27) := 0xA0800000 15initrd_phys-$(CONFIG_MACH_MX27) := 0xA0800000
16 16
17zreladdr-$(CONFIG_ARCH_MX3) := 0x80008000 17zreladdr-$(CONFIG_ARCH_MX3) += 0x80008000
18params_phys-$(CONFIG_ARCH_MX3) := 0x80000100 18params_phys-$(CONFIG_ARCH_MX3) := 0x80000100
19initrd_phys-$(CONFIG_ARCH_MX3) := 0x80800000 19initrd_phys-$(CONFIG_ARCH_MX3) := 0x80800000
diff --git a/arch/arm/mach-imx/iomux-imx31.c b/arch/arm/mach-imx/iomux-imx31.c
index cf8f8099ebd7..82bd4403b450 100644
--- a/arch/arm/mach-imx/iomux-imx31.c
+++ b/arch/arm/mach-imx/iomux-imx31.c
@@ -17,13 +17,12 @@
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
18 * MA 02110-1301, USA. 18 * MA 02110-1301, USA.
19 */ 19 */
20 20#include <linux/gpio.h>
21#include <linux/module.h> 21#include <linux/module.h>
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23#include <linux/io.h> 23#include <linux/io.h>
24#include <linux/kernel.h> 24#include <linux/kernel.h>
25#include <mach/hardware.h> 25#include <mach/hardware.h>
26#include <mach/gpio.h>
27#include <mach/iomux-mx3.h> 26#include <mach/iomux-mx3.h>
28 27
29/* 28/*
diff --git a/arch/arm/mach-imx/mach-mx27ads.c b/arch/arm/mach-imx/mach-mx27ads.c
index efe6109099fd..635b0509068b 100644
--- a/arch/arm/mach-imx/mach-mx27ads.c
+++ b/arch/arm/mach-imx/mach-mx27ads.c
@@ -13,7 +13,7 @@
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details. 14 * GNU General Public License for more details.
15 */ 15 */
16 16#include <linux/gpio.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/mtd/mtd.h> 18#include <linux/mtd/mtd.h>
19#include <linux/mtd/map.h> 19#include <linux/mtd/map.h>
@@ -27,7 +27,6 @@
27#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
28#include <asm/mach/time.h> 28#include <asm/mach/time.h>
29#include <asm/mach/map.h> 29#include <asm/mach/map.h>
30#include <mach/gpio.h>
31#include <mach/iomux-mx27.h> 30#include <mach/iomux-mx27.h>
32 31
33#include "devices-imx27.h" 32#include "devices-imx27.h"
diff --git a/arch/arm/mach-integrator/Makefile.boot b/arch/arm/mach-integrator/Makefile.boot
index c7e75acfe6c9..ff0a4b5b0a82 100644
--- a/arch/arm/mach-integrator/Makefile.boot
+++ b/arch/arm/mach-integrator/Makefile.boot
@@ -1,4 +1,4 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
4 4
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index 77315b995681..4b38e13667ac 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -126,6 +126,10 @@ static struct clk_lookup lookups[] = {
126 { /* Bus clock */ 126 { /* Bus clock */
127 .con_id = "apb_pclk", 127 .con_id = "apb_pclk",
128 .clk = &dummy_apb_pclk, 128 .clk = &dummy_apb_pclk,
129 }, {
130 /* Integrator/AP timer frequency */
131 .dev_id = "ap_timer",
132 .clk = &clk24mhz,
129 }, { /* UART0 */ 133 }, { /* UART0 */
130 .dev_id = "mb:16", 134 .dev_id = "mb:16",
131 .clk = &uartclk, 135 .clk = &uartclk,
@@ -205,7 +209,7 @@ static struct amba_pl010_data integrator_uart_data = {
205 209
206#define CM_CTRL IO_ADDRESS(INTEGRATOR_HDR_CTRL) 210#define CM_CTRL IO_ADDRESS(INTEGRATOR_HDR_CTRL)
207 211
208static DEFINE_SPINLOCK(cm_lock); 212static DEFINE_RAW_SPINLOCK(cm_lock);
209 213
210/** 214/**
211 * cm_control - update the CM_CTRL register. 215 * cm_control - update the CM_CTRL register.
@@ -217,10 +221,10 @@ void cm_control(u32 mask, u32 set)
217 unsigned long flags; 221 unsigned long flags;
218 u32 val; 222 u32 val;
219 223
220 spin_lock_irqsave(&cm_lock, flags); 224 raw_spin_lock_irqsave(&cm_lock, flags);
221 val = readl(CM_CTRL) & ~mask; 225 val = readl(CM_CTRL) & ~mask;
222 writel(val | set, CM_CTRL); 226 writel(val | set, CM_CTRL);
223 spin_unlock_irqrestore(&cm_lock, flags); 227 raw_spin_unlock_irqrestore(&cm_lock, flags);
224} 228}
225 229
226EXPORT_SYMBOL(cm_control); 230EXPORT_SYMBOL(cm_control);
diff --git a/arch/arm/mach-integrator/include/mach/io.h b/arch/arm/mach-integrator/include/mach/io.h
index f21bb5493dd9..37beed3fa3ed 100644
--- a/arch/arm/mach-integrator/include/mach/io.h
+++ b/arch/arm/mach-integrator/include/mach/io.h
@@ -20,8 +20,6 @@
20#ifndef __ASM_ARM_ARCH_IO_H 20#ifndef __ASM_ARM_ARCH_IO_H
21#define __ASM_ARM_ARCH_IO_H 21#define __ASM_ARM_ARCH_IO_H
22 22
23#define IO_SPACE_LIMIT 0xffff
24
25/* 23/*
26 * WARNING: this has to mirror definitions in platform.h 24 * WARNING: this has to mirror definitions in platform.h
27 */ 25 */
diff --git a/arch/arm/mach-integrator/include/mach/platform.h b/arch/arm/mach-integrator/include/mach/platform.h
index 5e6ea5cfea6e..ec467baade09 100644
--- a/arch/arm/mach-integrator/include/mach/platform.h
+++ b/arch/arm/mach-integrator/include/mach/platform.h
@@ -13,9 +13,6 @@
13 * along with this program; if not, write to the Free Software 13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 14 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
15 */ 15 */
16/* DO NOT EDIT!! - this file automatically generated
17 * from .s file by awk -f s2h.awk
18 */
19/************************************************************************** 16/**************************************************************************
20 * * Copyright © ARM Limited 1998. All rights reserved. 17 * * Copyright © ARM Limited 1998. All rights reserved.
21 * ***********************************************************************/ 18 * ***********************************************************************/
@@ -399,15 +396,6 @@
399#define INTEGRATOR_TIMER1_BASE (INTEGRATOR_CT_BASE + 0x100) 396#define INTEGRATOR_TIMER1_BASE (INTEGRATOR_CT_BASE + 0x100)
400#define INTEGRATOR_TIMER2_BASE (INTEGRATOR_CT_BASE + 0x200) 397#define INTEGRATOR_TIMER2_BASE (INTEGRATOR_CT_BASE + 0x200)
401 398
402#define TICKS_PER_uSEC 24
403
404/*
405 * These are useconds NOT ticks.
406 *
407 */
408#define mSEC_1 1000
409#define mSEC_10 (mSEC_1 * 10)
410
411#define INTEGRATOR_CSR_BASE 0x10000000 399#define INTEGRATOR_CSR_BASE 0x10000000
412#define INTEGRATOR_CSR_SIZE 0x10000000 400#define INTEGRATOR_CSR_SIZE 0x10000000
413 401
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index b19ae1805569..a1769f35a86e 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -32,6 +32,8 @@
32#include <linux/interrupt.h> 32#include <linux/interrupt.h>
33#include <linux/io.h> 33#include <linux/io.h>
34#include <linux/mtd/physmap.h> 34#include <linux/mtd/physmap.h>
35#include <linux/clk.h>
36#include <video/vga.h>
35 37
36#include <mach/hardware.h> 38#include <mach/hardware.h>
37#include <mach/platform.h> 39#include <mach/platform.h>
@@ -154,6 +156,7 @@ static struct map_desc ap_io_desc[] __initdata = {
154static void __init ap_map_io(void) 156static void __init ap_map_io(void)
155{ 157{
156 iotable_init(ap_io_desc, ARRAY_SIZE(ap_io_desc)); 158 iotable_init(ap_io_desc, ARRAY_SIZE(ap_io_desc));
159 vga_base = PCI_MEMORY_VADDR;
157} 160}
158 161
159#define INTEGRATOR_SC_VALID_INT 0x003fffff 162#define INTEGRATOR_SC_VALID_INT 0x003fffff
@@ -320,27 +323,16 @@ static void __init ap_init(void)
320#define TIMER1_VA_BASE IO_ADDRESS(INTEGRATOR_TIMER1_BASE) 323#define TIMER1_VA_BASE IO_ADDRESS(INTEGRATOR_TIMER1_BASE)
321#define TIMER2_VA_BASE IO_ADDRESS(INTEGRATOR_TIMER2_BASE) 324#define TIMER2_VA_BASE IO_ADDRESS(INTEGRATOR_TIMER2_BASE)
322 325
323/*
324 * How long is the timer interval?
325 */
326#define TIMER_INTERVAL (TICKS_PER_uSEC * mSEC_10)
327#if TIMER_INTERVAL >= 0x100000
328#define TICKS2USECS(x) (256 * (x) / TICKS_PER_uSEC)
329#elif TIMER_INTERVAL >= 0x10000
330#define TICKS2USECS(x) (16 * (x) / TICKS_PER_uSEC)
331#else
332#define TICKS2USECS(x) ((x) / TICKS_PER_uSEC)
333#endif
334
335static unsigned long timer_reload; 326static unsigned long timer_reload;
336 327
337static void integrator_clocksource_init(u32 khz) 328static void integrator_clocksource_init(unsigned long inrate)
338{ 329{
339 void __iomem *base = (void __iomem *)TIMER2_VA_BASE; 330 void __iomem *base = (void __iomem *)TIMER2_VA_BASE;
340 u32 ctrl = TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC; 331 u32 ctrl = TIMER_CTRL_ENABLE | TIMER_CTRL_PERIODIC;
332 unsigned long rate = inrate;
341 333
342 if (khz >= 1500) { 334 if (rate >= 1500000) {
343 khz /= 16; 335 rate /= 16;
344 ctrl |= TIMER_CTRL_DIV16; 336 ctrl |= TIMER_CTRL_DIV16;
345 } 337 }
346 338
@@ -348,7 +340,7 @@ static void integrator_clocksource_init(u32 khz)
348 writel(ctrl, base + TIMER_CTRL); 340 writel(ctrl, base + TIMER_CTRL);
349 341
350 clocksource_mmio_init(base + TIMER_VALUE, "timer2", 342 clocksource_mmio_init(base + TIMER_VALUE, "timer2",
351 khz * 1000, 200, 16, clocksource_mmio_readl_down); 343 rate, 200, 16, clocksource_mmio_readl_down);
352} 344}
353 345
354static void __iomem * const clkevt_base = (void __iomem *)TIMER1_VA_BASE; 346static void __iomem * const clkevt_base = (void __iomem *)TIMER1_VA_BASE;
@@ -372,15 +364,29 @@ static void clkevt_set_mode(enum clock_event_mode mode, struct clock_event_devic
372{ 364{
373 u32 ctrl = readl(clkevt_base + TIMER_CTRL) & ~TIMER_CTRL_ENABLE; 365 u32 ctrl = readl(clkevt_base + TIMER_CTRL) & ~TIMER_CTRL_ENABLE;
374 366
375 BUG_ON(mode == CLOCK_EVT_MODE_ONESHOT); 367 /* Disable timer */
368 writel(ctrl, clkevt_base + TIMER_CTRL);
376 369
377 if (mode == CLOCK_EVT_MODE_PERIODIC) { 370 switch (mode) {
378 writel(ctrl, clkevt_base + TIMER_CTRL); 371 case CLOCK_EVT_MODE_PERIODIC:
372 /* Enable the timer and start the periodic tick */
379 writel(timer_reload, clkevt_base + TIMER_LOAD); 373 writel(timer_reload, clkevt_base + TIMER_LOAD);
380 ctrl |= TIMER_CTRL_PERIODIC | TIMER_CTRL_ENABLE; 374 ctrl |= TIMER_CTRL_PERIODIC | TIMER_CTRL_ENABLE;
375 writel(ctrl, clkevt_base + TIMER_CTRL);
376 break;
377 case CLOCK_EVT_MODE_ONESHOT:
378 /* Leave the timer disabled, .set_next_event will enable it */
379 ctrl &= ~TIMER_CTRL_PERIODIC;
380 writel(ctrl, clkevt_base + TIMER_CTRL);
381 break;
382 case CLOCK_EVT_MODE_UNUSED:
383 case CLOCK_EVT_MODE_SHUTDOWN:
384 case CLOCK_EVT_MODE_RESUME:
385 default:
386 /* Just leave in disabled state */
387 break;
381 } 388 }
382 389
383 writel(ctrl, clkevt_base + TIMER_CTRL);
384} 390}
385 391
386static int clkevt_set_next_event(unsigned long next, struct clock_event_device *evt) 392static int clkevt_set_next_event(unsigned long next, struct clock_event_device *evt)
@@ -396,12 +402,10 @@ static int clkevt_set_next_event(unsigned long next, struct clock_event_device *
396 402
397static struct clock_event_device integrator_clockevent = { 403static struct clock_event_device integrator_clockevent = {
398 .name = "timer1", 404 .name = "timer1",
399 .shift = 34, 405 .features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT,
400 .features = CLOCK_EVT_FEAT_PERIODIC,
401 .set_mode = clkevt_set_mode, 406 .set_mode = clkevt_set_mode,
402 .set_next_event = clkevt_set_next_event, 407 .set_next_event = clkevt_set_next_event,
403 .rating = 300, 408 .rating = 300,
404 .cpumask = cpu_all_mask,
405}; 409};
406 410
407static struct irqaction integrator_timer_irq = { 411static struct irqaction integrator_timer_irq = {
@@ -411,29 +415,27 @@ static struct irqaction integrator_timer_irq = {
411 .dev_id = &integrator_clockevent, 415 .dev_id = &integrator_clockevent,
412}; 416};
413 417
414static void integrator_clockevent_init(u32 khz) 418static void integrator_clockevent_init(unsigned long inrate)
415{ 419{
416 struct clock_event_device *evt = &integrator_clockevent; 420 unsigned long rate = inrate;
417 unsigned int ctrl = 0; 421 unsigned int ctrl = 0;
418 422
419 if (khz * 1000 > 0x100000 * HZ) { 423 /* Calculate and program a divisor */
420 khz /= 256; 424 if (rate > 0x100000 * HZ) {
425 rate /= 256;
421 ctrl |= TIMER_CTRL_DIV256; 426 ctrl |= TIMER_CTRL_DIV256;
422 } else if (khz * 1000 > 0x10000 * HZ) { 427 } else if (rate > 0x10000 * HZ) {
423 khz /= 16; 428 rate /= 16;
424 ctrl |= TIMER_CTRL_DIV16; 429 ctrl |= TIMER_CTRL_DIV16;
425 } 430 }
426 431 timer_reload = rate / HZ;
427 timer_reload = khz * 1000 / HZ;
428 writel(ctrl, clkevt_base + TIMER_CTRL); 432 writel(ctrl, clkevt_base + TIMER_CTRL);
429 433
430 evt->irq = IRQ_TIMERINT1;
431 evt->mult = div_sc(khz, NSEC_PER_MSEC, evt->shift);
432 evt->max_delta_ns = clockevent_delta2ns(0xffff, evt);
433 evt->min_delta_ns = clockevent_delta2ns(0xf, evt);
434
435 setup_irq(IRQ_TIMERINT1, &integrator_timer_irq); 434 setup_irq(IRQ_TIMERINT1, &integrator_timer_irq);
436 clockevents_register_device(evt); 435 clockevents_config_and_register(&integrator_clockevent,
436 rate,
437 1,
438 0xffffU);
437} 439}
438 440
439/* 441/*
@@ -441,14 +443,20 @@ static void integrator_clockevent_init(u32 khz)
441 */ 443 */
442static void __init ap_init_timer(void) 444static void __init ap_init_timer(void)
443{ 445{
444 u32 khz = TICKS_PER_uSEC * 1000; 446 struct clk *clk;
447 unsigned long rate;
448
449 clk = clk_get_sys("ap_timer", NULL);
450 BUG_ON(IS_ERR(clk));
451 clk_enable(clk);
452 rate = clk_get_rate(clk);
445 453
446 writel(0, TIMER0_VA_BASE + TIMER_CTRL); 454 writel(0, TIMER0_VA_BASE + TIMER_CTRL);
447 writel(0, TIMER1_VA_BASE + TIMER_CTRL); 455 writel(0, TIMER1_VA_BASE + TIMER_CTRL);
448 writel(0, TIMER2_VA_BASE + TIMER_CTRL); 456 writel(0, TIMER2_VA_BASE + TIMER_CTRL);
449 457
450 integrator_clocksource_init(khz); 458 integrator_clocksource_init(rate);
451 integrator_clockevent_init(khz); 459 integrator_clockevent_init(rate);
452} 460}
453 461
454static struct sys_timer ap_timer = { 462static struct sys_timer ap_timer = {
diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c
index dd56bfb351e3..b4d8f8b8a085 100644
--- a/arch/arm/mach-integrator/pci_v3.c
+++ b/arch/arm/mach-integrator/pci_v3.c
@@ -27,7 +27,6 @@
27#include <linux/spinlock.h> 27#include <linux/spinlock.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/io.h> 29#include <linux/io.h>
30#include <video/vga.h>
31 30
32#include <mach/hardware.h> 31#include <mach/hardware.h>
33#include <mach/platform.h> 32#include <mach/platform.h>
@@ -164,7 +163,7 @@
164 * 7:2 register number 163 * 7:2 register number
165 * 164 *
166 */ 165 */
167static DEFINE_SPINLOCK(v3_lock); 166static DEFINE_RAW_SPINLOCK(v3_lock);
168 167
169#define PCI_BUS_NONMEM_START 0x00000000 168#define PCI_BUS_NONMEM_START 0x00000000
170#define PCI_BUS_NONMEM_SIZE SZ_256M 169#define PCI_BUS_NONMEM_SIZE SZ_256M
@@ -285,7 +284,7 @@ static int v3_read_config(struct pci_bus *bus, unsigned int devfn, int where,
285 unsigned long flags; 284 unsigned long flags;
286 u32 v; 285 u32 v;
287 286
288 spin_lock_irqsave(&v3_lock, flags); 287 raw_spin_lock_irqsave(&v3_lock, flags);
289 addr = v3_open_config_window(bus, devfn, where); 288 addr = v3_open_config_window(bus, devfn, where);
290 289
291 switch (size) { 290 switch (size) {
@@ -303,7 +302,7 @@ static int v3_read_config(struct pci_bus *bus, unsigned int devfn, int where,
303 } 302 }
304 303
305 v3_close_config_window(); 304 v3_close_config_window();
306 spin_unlock_irqrestore(&v3_lock, flags); 305 raw_spin_unlock_irqrestore(&v3_lock, flags);
307 306
308 *val = v; 307 *val = v;
309 return PCIBIOS_SUCCESSFUL; 308 return PCIBIOS_SUCCESSFUL;
@@ -315,7 +314,7 @@ static int v3_write_config(struct pci_bus *bus, unsigned int devfn, int where,
315 unsigned long addr; 314 unsigned long addr;
316 unsigned long flags; 315 unsigned long flags;
317 316
318 spin_lock_irqsave(&v3_lock, flags); 317 raw_spin_lock_irqsave(&v3_lock, flags);
319 addr = v3_open_config_window(bus, devfn, where); 318 addr = v3_open_config_window(bus, devfn, where);
320 319
321 switch (size) { 320 switch (size) {
@@ -336,7 +335,7 @@ static int v3_write_config(struct pci_bus *bus, unsigned int devfn, int where,
336 } 335 }
337 336
338 v3_close_config_window(); 337 v3_close_config_window();
339 spin_unlock_irqrestore(&v3_lock, flags); 338 raw_spin_unlock_irqrestore(&v3_lock, flags);
340 339
341 return PCIBIOS_SUCCESSFUL; 340 return PCIBIOS_SUCCESSFUL;
342} 341}
@@ -505,7 +504,6 @@ void __init pci_v3_preinit(void)
505 504
506 pcibios_min_io = 0x6000; 505 pcibios_min_io = 0x6000;
507 pcibios_min_mem = 0x00100000; 506 pcibios_min_mem = 0x00100000;
508 vga_base = PCI_MEMORY_VADDR;
509 507
510 /* 508 /*
511 * Hook in our fault handler for PCI errors 509 * Hook in our fault handler for PCI errors
@@ -515,7 +513,7 @@ void __init pci_v3_preinit(void)
515 hook_fault_code(8, v3_pci_fault, SIGBUS, 0, "external abort on non-linefetch"); 513 hook_fault_code(8, v3_pci_fault, SIGBUS, 0, "external abort on non-linefetch");
516 hook_fault_code(10, v3_pci_fault, SIGBUS, 0, "external abort on non-linefetch"); 514 hook_fault_code(10, v3_pci_fault, SIGBUS, 0, "external abort on non-linefetch");
517 515
518 spin_lock_irqsave(&v3_lock, flags); 516 raw_spin_lock_irqsave(&v3_lock, flags);
519 517
520 /* 518 /*
521 * Unlock V3 registers, but only if they were previously locked. 519 * Unlock V3 registers, but only if they were previously locked.
@@ -588,7 +586,7 @@ void __init pci_v3_preinit(void)
588 printk(KERN_ERR "PCI: unable to grab PCI error " 586 printk(KERN_ERR "PCI: unable to grab PCI error "
589 "interrupt: %d\n", ret); 587 "interrupt: %d\n", ret);
590 588
591 spin_unlock_irqrestore(&v3_lock, flags); 589 raw_spin_unlock_irqrestore(&v3_lock, flags);
592} 590}
593 591
594void __init pci_v3_postinit(void) 592void __init pci_v3_postinit(void)
diff --git a/arch/arm/mach-iop13xx/Makefile.boot b/arch/arm/mach-iop13xx/Makefile.boot
index 0b0e19fdfe6c..3a8c38c3189c 100644
--- a/arch/arm/mach-iop13xx/Makefile.boot
+++ b/arch/arm/mach-iop13xx/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-iop32x/Makefile.boot b/arch/arm/mach-iop32x/Makefile.boot
index 47000dccd61f..0a833b11e38c 100644
--- a/arch/arm/mach-iop32x/Makefile.boot
+++ b/arch/arm/mach-iop32x/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0xa0008000 1 zreladdr-y += 0xa0008000
2params_phys-y := 0xa0000100 2params_phys-y := 0xa0000100
3initrd_phys-y := 0xa0800000 3initrd_phys-y := 0xa0800000
diff --git a/arch/arm/mach-iop33x/Makefile.boot b/arch/arm/mach-iop33x/Makefile.boot
index 67039c3e0c48..760a0efe7580 100644
--- a/arch/arm/mach-iop33x/Makefile.boot
+++ b/arch/arm/mach-iop33x/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-ixp2000/Makefile.boot b/arch/arm/mach-ixp2000/Makefile.boot
index d84c5807a43d..9c7af91d93da 100644
--- a/arch/arm/mach-ixp2000/Makefile.boot
+++ b/arch/arm/mach-ixp2000/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3 3
diff --git a/arch/arm/mach-ixp2000/core.c b/arch/arm/mach-ixp2000/core.c
index 4068166c8993..59a512672bb9 100644
--- a/arch/arm/mach-ixp2000/core.c
+++ b/arch/arm/mach-ixp2000/core.c
@@ -13,7 +13,7 @@
13 * License version 2. This program is licensed "as is" without any 13 * License version 2. This program is licensed "as is" without any
14 * warranty of any kind, whether express or implied. 14 * warranty of any kind, whether express or implied.
15 */ 15 */
16 16#include <linux/gpio.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/spinlock.h> 19#include <linux/spinlock.h>
@@ -39,7 +39,7 @@
39#include <asm/mach/time.h> 39#include <asm/mach/time.h>
40#include <asm/mach/irq.h> 40#include <asm/mach/irq.h>
41 41
42#include <mach/gpio.h> 42#include <mach/gpio-ixp2000.h>
43 43
44static DEFINE_SPINLOCK(ixp2000_slowport_lock); 44static DEFINE_SPINLOCK(ixp2000_slowport_lock);
45static unsigned long ixp2000_slowport_irq_flags; 45static unsigned long ixp2000_slowport_irq_flags;
diff --git a/arch/arm/mach-ixp2000/include/mach/gpio.h b/arch/arm/mach-ixp2000/include/mach/gpio-ixp2000.h
index 4a88d2c33dac..af836c76c3f1 100644
--- a/arch/arm/mach-ixp2000/include/mach/gpio.h
+++ b/arch/arm/mach-ixp2000/include/mach/gpio-ixp2000.h
@@ -3,7 +3,7 @@
3 * 3 *
4 * Copyright (C) 2002 Intel Corporation. 4 * Copyright (C) 2002 Intel Corporation.
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 version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
@@ -11,7 +11,7 @@
11/* 11/*
12 * IXP2000 GPIO in/out, edge/level detection for IRQs: 12 * IXP2000 GPIO in/out, edge/level detection for IRQs:
13 * IRQs are generated on Falling-edge, Rising-Edge, Level-low, Level-High 13 * IRQs are generated on Falling-edge, Rising-Edge, Level-low, Level-High
14 * or both Falling-edge and Rising-edge. 14 * or both Falling-edge and Rising-edge.
15 * This must be called *before* the corresponding IRQ is registerd. 15 * This must be called *before* the corresponding IRQ is registerd.
16 * Use this instead of directly setting the GPIO registers. 16 * Use this instead of directly setting the GPIO registers.
17 * GPIOs may also be used as GPIOs (e.g. for emulating i2c/smb) 17 * GPIOs may also be used as GPIOs (e.g. for emulating i2c/smb)
diff --git a/arch/arm/mach-ixp2000/ixdp2x00.c b/arch/arm/mach-ixp2000/ixdp2x00.c
index 235638f800e5..634b6c852f68 100644
--- a/arch/arm/mach-ixp2000/ixdp2x00.c
+++ b/arch/arm/mach-ixp2000/ixdp2x00.c
@@ -14,6 +14,7 @@
14 * Free Software Foundation; either version 2 of the License, or (at your 14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version. 15 * option) any later version.
16 */ 16 */
17#include <linux/gpio.h>
17#include <linux/kernel.h> 18#include <linux/kernel.h>
18#include <linux/init.h> 19#include <linux/init.h>
19#include <linux/mm.h> 20#include <linux/mm.h>
@@ -40,8 +41,7 @@
40#include <asm/mach/flash.h> 41#include <asm/mach/flash.h>
41#include <asm/mach/arch.h> 42#include <asm/mach/arch.h>
42 43
43#include <mach/gpio.h> 44#include <mach/gpio-ixp2000.h>
44
45 45
46/************************************************************************* 46/*************************************************************************
47 * IXDP2x00 IRQ Initialization 47 * IXDP2x00 IRQ Initialization
diff --git a/arch/arm/mach-ixp23xx/Makefile.boot b/arch/arm/mach-ixp23xx/Makefile.boot
index d5561ad15bad..44fb4a717c3f 100644
--- a/arch/arm/mach-ixp23xx/Makefile.boot
+++ b/arch/arm/mach-ixp23xx/Makefile.boot
@@ -1,2 +1,2 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
diff --git a/arch/arm/mach-ixp4xx/Makefile.boot b/arch/arm/mach-ixp4xx/Makefile.boot
index d84c5807a43d..9c7af91d93da 100644
--- a/arch/arm/mach-ixp4xx/Makefile.boot
+++ b/arch/arm/mach-ixp4xx/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3 3
diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c
index 2131832ee6ba..f72a3a893c47 100644
--- a/arch/arm/mach-ixp4xx/common-pci.c
+++ b/arch/arm/mach-ixp4xx/common-pci.c
@@ -54,7 +54,7 @@ unsigned long ixp4xx_pci_reg_base = 0;
54 * these transactions are atomic or we will end up 54 * these transactions are atomic or we will end up
55 * with corrupt data on the bus or in a driver. 55 * with corrupt data on the bus or in a driver.
56 */ 56 */
57static DEFINE_SPINLOCK(ixp4xx_pci_lock); 57static DEFINE_RAW_SPINLOCK(ixp4xx_pci_lock);
58 58
59/* 59/*
60 * Read from PCI config space 60 * Read from PCI config space
@@ -62,10 +62,10 @@ static DEFINE_SPINLOCK(ixp4xx_pci_lock);
62static void crp_read(u32 ad_cbe, u32 *data) 62static void crp_read(u32 ad_cbe, u32 *data)
63{ 63{
64 unsigned long flags; 64 unsigned long flags;
65 spin_lock_irqsave(&ixp4xx_pci_lock, flags); 65 raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);
66 *PCI_CRP_AD_CBE = ad_cbe; 66 *PCI_CRP_AD_CBE = ad_cbe;
67 *data = *PCI_CRP_RDATA; 67 *data = *PCI_CRP_RDATA;
68 spin_unlock_irqrestore(&ixp4xx_pci_lock, flags); 68 raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
69} 69}
70 70
71/* 71/*
@@ -74,10 +74,10 @@ static void crp_read(u32 ad_cbe, u32 *data)
74static void crp_write(u32 ad_cbe, u32 data) 74static void crp_write(u32 ad_cbe, u32 data)
75{ 75{
76 unsigned long flags; 76 unsigned long flags;
77 spin_lock_irqsave(&ixp4xx_pci_lock, flags); 77 raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);
78 *PCI_CRP_AD_CBE = CRP_AD_CBE_WRITE | ad_cbe; 78 *PCI_CRP_AD_CBE = CRP_AD_CBE_WRITE | ad_cbe;
79 *PCI_CRP_WDATA = data; 79 *PCI_CRP_WDATA = data;
80 spin_unlock_irqrestore(&ixp4xx_pci_lock, flags); 80 raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
81} 81}
82 82
83static inline int check_master_abort(void) 83static inline int check_master_abort(void)
@@ -101,7 +101,7 @@ int ixp4xx_pci_read_errata(u32 addr, u32 cmd, u32* data)
101 int retval = 0; 101 int retval = 0;
102 int i; 102 int i;
103 103
104 spin_lock_irqsave(&ixp4xx_pci_lock, flags); 104 raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);
105 105
106 *PCI_NP_AD = addr; 106 *PCI_NP_AD = addr;
107 107
@@ -118,7 +118,7 @@ int ixp4xx_pci_read_errata(u32 addr, u32 cmd, u32* data)
118 if(check_master_abort()) 118 if(check_master_abort())
119 retval = 1; 119 retval = 1;
120 120
121 spin_unlock_irqrestore(&ixp4xx_pci_lock, flags); 121 raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
122 return retval; 122 return retval;
123} 123}
124 124
@@ -127,7 +127,7 @@ int ixp4xx_pci_read_no_errata(u32 addr, u32 cmd, u32* data)
127 unsigned long flags; 127 unsigned long flags;
128 int retval = 0; 128 int retval = 0;
129 129
130 spin_lock_irqsave(&ixp4xx_pci_lock, flags); 130 raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);
131 131
132 *PCI_NP_AD = addr; 132 *PCI_NP_AD = addr;
133 133
@@ -140,7 +140,7 @@ int ixp4xx_pci_read_no_errata(u32 addr, u32 cmd, u32* data)
140 if(check_master_abort()) 140 if(check_master_abort())
141 retval = 1; 141 retval = 1;
142 142
143 spin_unlock_irqrestore(&ixp4xx_pci_lock, flags); 143 raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
144 return retval; 144 return retval;
145} 145}
146 146
@@ -149,7 +149,7 @@ int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data)
149 unsigned long flags; 149 unsigned long flags;
150 int retval = 0; 150 int retval = 0;
151 151
152 spin_lock_irqsave(&ixp4xx_pci_lock, flags); 152 raw_spin_lock_irqsave(&ixp4xx_pci_lock, flags);
153 153
154 *PCI_NP_AD = addr; 154 *PCI_NP_AD = addr;
155 155
@@ -162,7 +162,7 @@ int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data)
162 if(check_master_abort()) 162 if(check_master_abort())
163 retval = 1; 163 retval = 1;
164 164
165 spin_unlock_irqrestore(&ixp4xx_pci_lock, flags); 165 raw_spin_unlock_irqrestore(&ixp4xx_pci_lock, flags);
166 return retval; 166 return retval;
167} 167}
168 168
@@ -397,7 +397,8 @@ void __init ixp4xx_pci_preinit(void)
397 local_write_config(PCI_BASE_ADDRESS_0, 4, PHYS_OFFSET); 397 local_write_config(PCI_BASE_ADDRESS_0, 4, PHYS_OFFSET);
398 local_write_config(PCI_BASE_ADDRESS_1, 4, PHYS_OFFSET + SZ_16M); 398 local_write_config(PCI_BASE_ADDRESS_1, 4, PHYS_OFFSET + SZ_16M);
399 local_write_config(PCI_BASE_ADDRESS_2, 4, PHYS_OFFSET + SZ_32M); 399 local_write_config(PCI_BASE_ADDRESS_2, 4, PHYS_OFFSET + SZ_32M);
400 local_write_config(PCI_BASE_ADDRESS_3, 4, PHYS_OFFSET + SZ_48M); 400 local_write_config(PCI_BASE_ADDRESS_3, 4,
401 PHYS_OFFSET + SZ_32M + SZ_16M);
401 402
402 /* 403 /*
403 * Enable CSR window at 64 MiB to allow PCI masters 404 * Enable CSR window at 64 MiB to allow PCI masters
diff --git a/arch/arm/mach-ixp4xx/dsmg600-setup.c b/arch/arm/mach-ixp4xx/dsmg600-setup.c
index 71607a7ecc7e..8837fbca27ce 100644
--- a/arch/arm/mach-ixp4xx/dsmg600-setup.c
+++ b/arch/arm/mach-ixp4xx/dsmg600-setup.c
@@ -16,7 +16,7 @@
16 * Author: Rod Whitby <rod@whitby.id.au> 16 * Author: Rod Whitby <rod@whitby.id.au>
17 * Maintainers: http://www.nslu2-linux.org/ 17 * Maintainers: http://www.nslu2-linux.org/
18 */ 18 */
19 19#include <linux/gpio.h>
20#include <linux/irq.h> 20#include <linux/irq.h>
21#include <linux/jiffies.h> 21#include <linux/jiffies.h>
22#include <linux/timer.h> 22#include <linux/timer.h>
@@ -31,7 +31,6 @@
31#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32#include <asm/mach/flash.h> 32#include <asm/mach/flash.h>
33#include <asm/mach/time.h> 33#include <asm/mach/time.h>
34#include <asm/gpio.h>
35 34
36#define DSMG600_SDA_PIN 5 35#define DSMG600_SDA_PIN 5
37#define DSMG600_SCL_PIN 4 36#define DSMG600_SCL_PIN 4
diff --git a/arch/arm/mach-ixp4xx/fsg-setup.c b/arch/arm/mach-ixp4xx/fsg-setup.c
index a9540cd90375..2887c3578c17 100644
--- a/arch/arm/mach-ixp4xx/fsg-setup.c
+++ b/arch/arm/mach-ixp4xx/fsg-setup.c
@@ -14,7 +14,7 @@
14 * Maintainers: http://www.nslu2-linux.org/ 14 * Maintainers: http://www.nslu2-linux.org/
15 * 15 *
16 */ 16 */
17 17#include <linux/gpio.h>
18#include <linux/if_ether.h> 18#include <linux/if_ether.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20#include <linux/serial.h> 20#include <linux/serial.h>
@@ -27,7 +27,6 @@
27#include <asm/mach-types.h> 27#include <asm/mach-types.h>
28#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
29#include <asm/mach/flash.h> 29#include <asm/mach/flash.h>
30#include <asm/gpio.h>
31 30
32#define FSG_SDA_PIN 12 31#define FSG_SDA_PIN 12
33#define FSG_SCL_PIN 13 32#define FSG_SCL_PIN 13
diff --git a/arch/arm/mach-ixp4xx/include/mach/gpio.h b/arch/arm/mach-ixp4xx/include/mach/gpio.h
index a5f87ded2f28..83d6b4ed60bb 100644
--- a/arch/arm/mach-ixp4xx/include/mach/gpio.h
+++ b/arch/arm/mach-ixp4xx/include/mach/gpio.h
@@ -28,6 +28,8 @@
28#include <linux/kernel.h> 28#include <linux/kernel.h>
29#include <mach/hardware.h> 29#include <mach/hardware.h>
30 30
31#define __ARM_GPIOLIB_COMPLEX
32
31static inline int gpio_request(unsigned gpio, const char *label) 33static inline int gpio_request(unsigned gpio, const char *label)
32{ 34{
33 return 0; 35 return 0;
@@ -70,6 +72,7 @@ static inline void gpio_set_value(unsigned gpio, int value)
70#include <asm-generic/gpio.h> /* cansleep wrappers */ 72#include <asm-generic/gpio.h> /* cansleep wrappers */
71 73
72extern int gpio_to_irq(int gpio); 74extern int gpio_to_irq(int gpio);
75#define gpio_to_irq gpio_to_irq
73extern int irq_to_gpio(unsigned int irq); 76extern int irq_to_gpio(unsigned int irq);
74 77
75#endif 78#endif
diff --git a/arch/arm/mach-ixp4xx/include/mach/io.h b/arch/arm/mach-ixp4xx/include/mach/io.h
index 57b5410c31f4..ffb9d6afb89f 100644
--- a/arch/arm/mach-ixp4xx/include/mach/io.h
+++ b/arch/arm/mach-ixp4xx/include/mach/io.h
@@ -17,8 +17,6 @@
17 17
18#include <mach/hardware.h> 18#include <mach/hardware.h>
19 19
20#define IO_SPACE_LIMIT 0x0000ffff
21
22extern int (*ixp4xx_pci_read)(u32 addr, u32 cmd, u32* data); 20extern int (*ixp4xx_pci_read)(u32 addr, u32 cmd, u32* data);
23extern int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data); 21extern int ixp4xx_pci_write(u32 addr, u32 cmd, u32 data);
24 22
diff --git a/arch/arm/mach-ixp4xx/nas100d-setup.c b/arch/arm/mach-ixp4xx/nas100d-setup.c
index 9f4669260d4c..de716fa1aab6 100644
--- a/arch/arm/mach-ixp4xx/nas100d-setup.c
+++ b/arch/arm/mach-ixp4xx/nas100d-setup.c
@@ -17,7 +17,7 @@
17 * Maintainers: http://www.nslu2-linux.org/ 17 * Maintainers: http://www.nslu2-linux.org/
18 * 18 *
19 */ 19 */
20 20#include <linux/gpio.h>
21#include <linux/if_ether.h> 21#include <linux/if_ether.h>
22#include <linux/irq.h> 22#include <linux/irq.h>
23#include <linux/jiffies.h> 23#include <linux/jiffies.h>
@@ -32,7 +32,6 @@
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
33#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
34#include <asm/mach/flash.h> 34#include <asm/mach/flash.h>
35#include <asm/gpio.h>
36 35
37#define NAS100D_SDA_PIN 5 36#define NAS100D_SDA_PIN 5
38#define NAS100D_SCL_PIN 6 37#define NAS100D_SCL_PIN 6
diff --git a/arch/arm/mach-ixp4xx/nslu2-setup.c b/arch/arm/mach-ixp4xx/nslu2-setup.c
index 3676fbf6ef9c..ac81ccb26bfe 100644
--- a/arch/arm/mach-ixp4xx/nslu2-setup.c
+++ b/arch/arm/mach-ixp4xx/nslu2-setup.c
@@ -16,7 +16,7 @@
16 * Maintainers: http://www.nslu2-linux.org/ 16 * Maintainers: http://www.nslu2-linux.org/
17 * 17 *
18 */ 18 */
19 19#include <linux/gpio.h>
20#include <linux/if_ether.h> 20#include <linux/if_ether.h>
21#include <linux/irq.h> 21#include <linux/irq.h>
22#include <linux/serial.h> 22#include <linux/serial.h>
@@ -30,7 +30,6 @@
30#include <asm/mach/arch.h> 30#include <asm/mach/arch.h>
31#include <asm/mach/flash.h> 31#include <asm/mach/flash.h>
32#include <asm/mach/time.h> 32#include <asm/mach/time.h>
33#include <asm/gpio.h>
34 33
35#define NSLU2_SDA_PIN 7 34#define NSLU2_SDA_PIN 7
36#define NSLU2_SCL_PIN 6 35#define NSLU2_SCL_PIN 6
diff --git a/arch/arm/mach-kirkwood/Makefile.boot b/arch/arm/mach-kirkwood/Makefile.boot
index 67039c3e0c48..760a0efe7580 100644
--- a/arch/arm/mach-kirkwood/Makefile.boot
+++ b/arch/arm/mach-kirkwood/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-kirkwood/irq.c b/arch/arm/mach-kirkwood/irq.c
index 05d193a25b25..c4c68e5b94f1 100644
--- a/arch/arm/mach-kirkwood/irq.c
+++ b/arch/arm/mach-kirkwood/irq.c
@@ -7,14 +7,13 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/irq.h> 13#include <linux/irq.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <mach/bridge-regs.h> 15#include <mach/bridge-regs.h>
16#include <plat/irq.h> 16#include <plat/irq.h>
17#include <asm/gpio.h>
18#include "common.h" 17#include "common.h"
19 18
20static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc) 19static void gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
diff --git a/arch/arm/mach-kirkwood/mpp.c b/arch/arm/mach-kirkwood/mpp.c
index b0a7d979a8ed..cc431fa22ccb 100644
--- a/arch/arm/mach-kirkwood/mpp.c
+++ b/arch/arm/mach-kirkwood/mpp.c
@@ -7,12 +7,11 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/mbus.h> 13#include <linux/mbus.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <asm/gpio.h>
16#include <mach/hardware.h> 15#include <mach/hardware.h>
17#include <plat/mpp.h> 16#include <plat/mpp.h>
18#include "common.h" 17#include "common.h"
diff --git a/arch/arm/mach-ks8695/Makefile b/arch/arm/mach-ks8695/Makefile
index 7e3e8160ed30..853efd9133c6 100644
--- a/arch/arm/mach-ks8695/Makefile
+++ b/arch/arm/mach-ks8695/Makefile
@@ -3,7 +3,7 @@
3# Makefile for KS8695 architecture support 3# Makefile for KS8695 architecture support
4# 4#
5 5
6obj-y := cpu.o irq.o time.o gpio.o devices.o 6obj-y := cpu.o irq.o time.o devices.o
7obj-m := 7obj-m :=
8obj-n := 8obj-n :=
9obj- := 9obj- :=
diff --git a/arch/arm/mach-ks8695/Makefile.boot b/arch/arm/mach-ks8695/Makefile.boot
index 48eb2cb3ac77..c9b0bebcf237 100644
--- a/arch/arm/mach-ks8695/Makefile.boot
+++ b/arch/arm/mach-ks8695/Makefile.boot
@@ -3,6 +3,6 @@
3# PARAMS_PHYS must be within 4MB of ZRELADDR 3# PARAMS_PHYS must be within 4MB of ZRELADDR
4# INITRD_PHYS must be in RAM 4# INITRD_PHYS must be in RAM
5 5
6 zreladdr-y := 0x00008000 6 zreladdr-y += 0x00008000
7params_phys-y := 0x00000100 7params_phys-y := 0x00000100
8initrd_phys-y := 0x00800000 8initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-ks8695/board-acs5k.c b/arch/arm/mach-ks8695/board-acs5k.c
index a5fcc7c7fe18..a91f99d265aa 100644
--- a/arch/arm/mach-ks8695/board-acs5k.c
+++ b/arch/arm/mach-ks8695/board-acs5k.c
@@ -10,7 +10,7 @@
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13 13#include <linux/gpio.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
@@ -34,7 +34,7 @@
34#include <asm/mach/irq.h> 34#include <asm/mach/irq.h>
35 35
36#include <mach/devices.h> 36#include <mach/devices.h>
37#include <mach/gpio.h> 37#include <mach/gpio-ks8695.h>
38 38
39#include "generic.h" 39#include "generic.h"
40 40
diff --git a/arch/arm/mach-ks8695/board-dsm320.c b/arch/arm/mach-ks8695/board-dsm320.c
index fb91a716a7db..d24bcef2e2dd 100644
--- a/arch/arm/mach-ks8695/board-dsm320.c
+++ b/arch/arm/mach-ks8695/board-dsm320.c
@@ -10,7 +10,7 @@
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13 13#include <linux/gpio.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
@@ -29,7 +29,7 @@
29#include <asm/mach/irq.h> 29#include <asm/mach/irq.h>
30 30
31#include <mach/devices.h> 31#include <mach/devices.h>
32#include <mach/gpio.h> 32#include <mach/gpio-ks8695.h>
33 33
34#include "generic.h" 34#include "generic.h"
35 35
diff --git a/arch/arm/mach-ks8695/board-micrel.c b/arch/arm/mach-ks8695/board-micrel.c
index 8f67a750b6c7..16c95657f8fd 100644
--- a/arch/arm/mach-ks8695/board-micrel.c
+++ b/arch/arm/mach-ks8695/board-micrel.c
@@ -5,7 +5,7 @@
5 * it under the terms of the GNU General Public License version 2 as 5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
7 */ 7 */
8 8#include <linux/gpio.h>
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/types.h> 10#include <linux/types.h>
11#include <linux/interrupt.h> 11#include <linux/interrupt.h>
@@ -18,7 +18,7 @@
18#include <asm/mach/map.h> 18#include <asm/mach/map.h>
19#include <asm/mach/irq.h> 19#include <asm/mach/irq.h>
20 20
21#include <mach/gpio.h> 21#include <mach/gpio-ks8695.h>
22#include <mach/devices.h> 22#include <mach/devices.h>
23 23
24#include "generic.h" 24#include "generic.h"
diff --git a/arch/arm/mach-ks8695/devices.c b/arch/arm/mach-ks8695/devices.c
index b89fb6d46ccc..73bd63812878 100644
--- a/arch/arm/mach-ks8695/devices.c
+++ b/arch/arm/mach-ks8695/devices.c
@@ -20,6 +20,7 @@
20#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
21#include <asm/mach/map.h> 21#include <asm/mach/map.h>
22 22
23#include <linux/gpio.h>
23#include <linux/platform_device.h> 24#include <linux/platform_device.h>
24 25
25#include <mach/irqs.h> 26#include <mach/irqs.h>
diff --git a/arch/arm/mach-ks8695/gpio.c b/arch/arm/mach-ks8695/gpio.c
deleted file mode 100644
index 31e456508a6f..000000000000
--- a/arch/arm/mach-ks8695/gpio.c
+++ /dev/null
@@ -1,319 +0,0 @@
1/*
2 * arch/arm/mach-ks8695/gpio.c
3 *
4 * Copyright (C) 2006 Andrew Victor
5 * Updated to GPIOLIB, Copyright 2008 Simtec Electronics
6 * Daniel Silverstone <dsilvers@simtec.co.uk>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#include <linux/kernel.h>
23#include <linux/mm.h>
24#include <linux/init.h>
25#include <linux/debugfs.h>
26#include <linux/seq_file.h>
27#include <linux/module.h>
28#include <linux/io.h>
29
30#include <mach/hardware.h>
31#include <asm/mach/irq.h>
32
33#include <mach/regs-gpio.h>
34#include <mach/gpio.h>
35
36/*
37 * Configure a GPIO line for either GPIO function, or its internal
38 * function (Interrupt, Timer, etc).
39 */
40static void ks8695_gpio_mode(unsigned int pin, short gpio)
41{
42 unsigned int enable[] = { IOPC_IOEINT0EN, IOPC_IOEINT1EN, IOPC_IOEINT2EN, IOPC_IOEINT3EN, IOPC_IOTIM0EN, IOPC_IOTIM1EN };
43 unsigned long x, flags;
44
45 if (pin > KS8695_GPIO_5) /* only GPIO 0..5 have internal functions */
46 return;
47
48 local_irq_save(flags);
49
50 x = __raw_readl(KS8695_GPIO_VA + KS8695_IOPC);
51 if (gpio) /* GPIO: set bit to 0 */
52 x &= ~enable[pin];
53 else /* Internal function: set bit to 1 */
54 x |= enable[pin];
55 __raw_writel(x, KS8695_GPIO_VA + KS8695_IOPC);
56
57 local_irq_restore(flags);
58}
59
60
61static unsigned short gpio_irq[] = { KS8695_IRQ_EXTERN0, KS8695_IRQ_EXTERN1, KS8695_IRQ_EXTERN2, KS8695_IRQ_EXTERN3 };
62
63/*
64 * Configure GPIO pin as external interrupt source.
65 */
66int ks8695_gpio_interrupt(unsigned int pin, unsigned int type)
67{
68 unsigned long x, flags;
69
70 if (pin > KS8695_GPIO_3) /* only GPIO 0..3 can generate IRQ */
71 return -EINVAL;
72
73 local_irq_save(flags);
74
75 /* set pin as input */
76 x = __raw_readl(KS8695_GPIO_VA + KS8695_IOPM);
77 x &= ~IOPM(pin);
78 __raw_writel(x, KS8695_GPIO_VA + KS8695_IOPM);
79
80 local_irq_restore(flags);
81
82 /* Set IRQ triggering type */
83 irq_set_irq_type(gpio_irq[pin], type);
84
85 /* enable interrupt mode */
86 ks8695_gpio_mode(pin, 0);
87
88 return 0;
89}
90EXPORT_SYMBOL(ks8695_gpio_interrupt);
91
92
93
94/* .... Generic GPIO interface .............................................. */
95
96/*
97 * Configure the GPIO line as an input.
98 */
99static int ks8695_gpio_direction_input(struct gpio_chip *gc, unsigned int pin)
100{
101 unsigned long x, flags;
102
103 if (pin > KS8695_GPIO_15)
104 return -EINVAL;
105
106 /* set pin to GPIO mode */
107 ks8695_gpio_mode(pin, 1);
108
109 local_irq_save(flags);
110
111 /* set pin as input */
112 x = __raw_readl(KS8695_GPIO_VA + KS8695_IOPM);
113 x &= ~IOPM(pin);
114 __raw_writel(x, KS8695_GPIO_VA + KS8695_IOPM);
115
116 local_irq_restore(flags);
117
118 return 0;
119}
120
121
122/*
123 * Configure the GPIO line as an output, with default state.
124 */
125static int ks8695_gpio_direction_output(struct gpio_chip *gc,
126 unsigned int pin, int state)
127{
128 unsigned long x, flags;
129
130 if (pin > KS8695_GPIO_15)
131 return -EINVAL;
132
133 /* set pin to GPIO mode */
134 ks8695_gpio_mode(pin, 1);
135
136 local_irq_save(flags);
137
138 /* set line state */
139 x = __raw_readl(KS8695_GPIO_VA + KS8695_IOPD);
140 if (state)
141 x |= IOPD(pin);
142 else
143 x &= ~IOPD(pin);
144 __raw_writel(x, KS8695_GPIO_VA + KS8695_IOPD);
145
146 /* set pin as output */
147 x = __raw_readl(KS8695_GPIO_VA + KS8695_IOPM);
148 x |= IOPM(pin);
149 __raw_writel(x, KS8695_GPIO_VA + KS8695_IOPM);
150
151 local_irq_restore(flags);
152
153 return 0;
154}
155
156
157/*
158 * Set the state of an output GPIO line.
159 */
160static void ks8695_gpio_set_value(struct gpio_chip *gc,
161 unsigned int pin, int state)
162{
163 unsigned long x, flags;
164
165 if (pin > KS8695_GPIO_15)
166 return;
167
168 local_irq_save(flags);
169
170 /* set output line state */
171 x = __raw_readl(KS8695_GPIO_VA + KS8695_IOPD);
172 if (state)
173 x |= IOPD(pin);
174 else
175 x &= ~IOPD(pin);
176 __raw_writel(x, KS8695_GPIO_VA + KS8695_IOPD);
177
178 local_irq_restore(flags);
179}
180
181
182/*
183 * Read the state of a GPIO line.
184 */
185static int ks8695_gpio_get_value(struct gpio_chip *gc, unsigned int pin)
186{
187 unsigned long x;
188
189 if (pin > KS8695_GPIO_15)
190 return -EINVAL;
191
192 x = __raw_readl(KS8695_GPIO_VA + KS8695_IOPD);
193 return (x & IOPD(pin)) != 0;
194}
195
196
197/*
198 * Map GPIO line to IRQ number.
199 */
200static int ks8695_gpio_to_irq(struct gpio_chip *gc, unsigned int pin)
201{
202 if (pin > KS8695_GPIO_3) /* only GPIO 0..3 can generate IRQ */
203 return -EINVAL;
204
205 return gpio_irq[pin];
206}
207
208/*
209 * Map IRQ number to GPIO line.
210 */
211int irq_to_gpio(unsigned int irq)
212{
213 if ((irq < KS8695_IRQ_EXTERN0) || (irq > KS8695_IRQ_EXTERN3))
214 return -EINVAL;
215
216 return (irq - KS8695_IRQ_EXTERN0);
217}
218EXPORT_SYMBOL(irq_to_gpio);
219
220/* GPIOLIB interface */
221
222static struct gpio_chip ks8695_gpio_chip = {
223 .label = "KS8695",
224 .direction_input = ks8695_gpio_direction_input,
225 .direction_output = ks8695_gpio_direction_output,
226 .get = ks8695_gpio_get_value,
227 .set = ks8695_gpio_set_value,
228 .to_irq = ks8695_gpio_to_irq,
229 .base = 0,
230 .ngpio = 16,
231 .can_sleep = 0,
232};
233
234/* Register the GPIOs */
235void ks8695_register_gpios(void)
236{
237 if (gpiochip_add(&ks8695_gpio_chip))
238 printk(KERN_ERR "Unable to register core GPIOs\n");
239}
240
241/* .... Debug interface ..................................................... */
242
243#ifdef CONFIG_DEBUG_FS
244
245static int ks8695_gpio_show(struct seq_file *s, void *unused)
246{
247 unsigned int enable[] = { IOPC_IOEINT0EN, IOPC_IOEINT1EN, IOPC_IOEINT2EN, IOPC_IOEINT3EN, IOPC_IOTIM0EN, IOPC_IOTIM1EN };
248 unsigned int intmask[] = { IOPC_IOEINT0TM, IOPC_IOEINT1TM, IOPC_IOEINT2TM, IOPC_IOEINT3TM };
249 unsigned long mode, ctrl, data;
250 int i;
251
252 mode = __raw_readl(KS8695_GPIO_VA + KS8695_IOPM);
253 ctrl = __raw_readl(KS8695_GPIO_VA + KS8695_IOPC);
254 data = __raw_readl(KS8695_GPIO_VA + KS8695_IOPD);
255
256 seq_printf(s, "Pin\tI/O\tFunction\tState\n\n");
257
258 for (i = KS8695_GPIO_0; i <= KS8695_GPIO_15 ; i++) {
259 seq_printf(s, "%i:\t", i);
260
261 seq_printf(s, "%s\t", (mode & IOPM(i)) ? "Output" : "Input");
262
263 if (i <= KS8695_GPIO_3) {
264 if (ctrl & enable[i]) {
265 seq_printf(s, "EXT%i ", i);
266
267 switch ((ctrl & intmask[i]) >> (4 * i)) {
268 case IOPC_TM_LOW:
269 seq_printf(s, "(Low)"); break;
270 case IOPC_TM_HIGH:
271 seq_printf(s, "(High)"); break;
272 case IOPC_TM_RISING:
273 seq_printf(s, "(Rising)"); break;
274 case IOPC_TM_FALLING:
275 seq_printf(s, "(Falling)"); break;
276 case IOPC_TM_EDGE:
277 seq_printf(s, "(Edges)"); break;
278 }
279 }
280 else
281 seq_printf(s, "GPIO\t");
282 }
283 else if (i <= KS8695_GPIO_5) {
284 if (ctrl & enable[i])
285 seq_printf(s, "TOUT%i\t", i - KS8695_GPIO_4);
286 else
287 seq_printf(s, "GPIO\t");
288 }
289 else
290 seq_printf(s, "GPIO\t");
291
292 seq_printf(s, "\t");
293
294 seq_printf(s, "%i\n", (data & IOPD(i)) ? 1 : 0);
295 }
296 return 0;
297}
298
299static int ks8695_gpio_open(struct inode *inode, struct file *file)
300{
301 return single_open(file, ks8695_gpio_show, NULL);
302}
303
304static const struct file_operations ks8695_gpio_operations = {
305 .open = ks8695_gpio_open,
306 .read = seq_read,
307 .llseek = seq_lseek,
308 .release = single_release,
309};
310
311static int __init ks8695_gpio_debugfs_init(void)
312{
313 /* /sys/kernel/debug/ks8695_gpio */
314 (void) debugfs_create_file("ks8695_gpio", S_IFREG | S_IRUGO, NULL, NULL, &ks8695_gpio_operations);
315 return 0;
316}
317postcore_initcall(ks8695_gpio_debugfs_init);
318
319#endif
diff --git a/arch/arm/mach-ks8695/include/mach/gpio-ks8695.h b/arch/arm/mach-ks8695/include/mach/gpio-ks8695.h
new file mode 100644
index 000000000000..6eb034d60325
--- /dev/null
+++ b/arch/arm/mach-ks8695/include/mach/gpio-ks8695.h
@@ -0,0 +1,39 @@
1/*
2 * Copyright (C) 2006 Andrew Victor
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef __MACH_KS8659_GPIO_H
10#define __MACH_KS8659_GPIO_H
11
12#include <linux/kernel.h>
13
14#define KS8695_GPIO_0 0
15#define KS8695_GPIO_1 1
16#define KS8695_GPIO_2 2
17#define KS8695_GPIO_3 3
18#define KS8695_GPIO_4 4
19#define KS8695_GPIO_5 5
20#define KS8695_GPIO_6 6
21#define KS8695_GPIO_7 7
22#define KS8695_GPIO_8 8
23#define KS8695_GPIO_9 9
24#define KS8695_GPIO_10 10
25#define KS8695_GPIO_11 11
26#define KS8695_GPIO_12 12
27#define KS8695_GPIO_13 13
28#define KS8695_GPIO_14 14
29#define KS8695_GPIO_15 15
30
31/*
32 * Configure GPIO pin as external interrupt source.
33 */
34extern int ks8695_gpio_interrupt(unsigned int pin, unsigned int type);
35
36/* Register the GPIOs */
37extern void ks8695_register_gpios(void);
38
39#endif /* __MACH_KS8659_GPIO_H */
diff --git a/arch/arm/mach-ks8695/include/mach/gpio.h b/arch/arm/mach-ks8695/include/mach/gpio.h
index 86312d476bc6..f5fda36e4512 100644
--- a/arch/arm/mach-ks8695/include/mach/gpio.h
+++ b/arch/arm/mach-ks8695/include/mach/gpio.h
@@ -11,47 +11,9 @@
11#ifndef __ASM_ARCH_GPIO_H_ 11#ifndef __ASM_ARCH_GPIO_H_
12#define __ASM_ARCH_GPIO_H_ 12#define __ASM_ARCH_GPIO_H_
13 13
14#include <linux/kernel.h>
15
16#define KS8695_GPIO_0 0
17#define KS8695_GPIO_1 1
18#define KS8695_GPIO_2 2
19#define KS8695_GPIO_3 3
20#define KS8695_GPIO_4 4
21#define KS8695_GPIO_5 5
22#define KS8695_GPIO_6 6
23#define KS8695_GPIO_7 7
24#define KS8695_GPIO_8 8
25#define KS8695_GPIO_9 9
26#define KS8695_GPIO_10 10
27#define KS8695_GPIO_11 11
28#define KS8695_GPIO_12 12
29#define KS8695_GPIO_13 13
30#define KS8695_GPIO_14 14
31#define KS8695_GPIO_15 15
32
33/*
34 * Configure GPIO pin as external interrupt source.
35 */
36extern int ks8695_gpio_interrupt(unsigned int pin, unsigned int type);
37
38/* 14/*
39 * Map IRQ number to GPIO line. 15 * Map IRQ number to GPIO line.
40 */ 16 */
41extern int irq_to_gpio(unsigned int irq); 17extern int irq_to_gpio(unsigned int irq);
42 18
43#include <asm-generic/gpio.h>
44
45/* If it turns out that we need to optimise GPIO access for the
46 * Micrel's GPIOs, then these can be changed to check their argument
47 * directly as static inlines. However for now it's probably not
48 * worthwhile.
49 */
50#define gpio_get_value __gpio_get_value
51#define gpio_set_value __gpio_set_value
52#define gpio_to_irq __gpio_to_irq
53
54/* Register the GPIOs */
55extern void ks8695_register_gpios(void);
56
57#endif 19#endif
diff --git a/arch/arm/mach-ks8695/leds.c b/arch/arm/mach-ks8695/leds.c
index 184ef74e4bee..d6f6502ac9b5 100644
--- a/arch/arm/mach-ks8695/leds.c
+++ b/arch/arm/mach-ks8695/leds.c
@@ -7,14 +7,14 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/gpio.h>
14 15
15#include <asm/leds.h> 16#include <asm/leds.h>
16#include <mach/devices.h> 17#include <mach/devices.h>
17#include <mach/gpio.h>
18 18
19 19
20static inline void ks8695_led_on(unsigned int led) 20static inline void ks8695_led_on(unsigned int led)
diff --git a/arch/arm/mach-lpc32xx/Makefile b/arch/arm/mach-lpc32xx/Makefile
index a5fc5d0eeaeb..f5db805ab958 100644
--- a/arch/arm/mach-lpc32xx/Makefile
+++ b/arch/arm/mach-lpc32xx/Makefile
@@ -3,6 +3,6 @@
3# 3#
4 4
5obj-y := timer.o irq.o common.o serial.o clock.o 5obj-y := timer.o irq.o common.o serial.o clock.o
6obj-y += gpiolib.o pm.o suspend.o 6obj-y += pm.o suspend.o
7obj-y += phy3250.o 7obj-y += phy3250.o
8 8
diff --git a/arch/arm/mach-lpc32xx/Makefile.boot b/arch/arm/mach-lpc32xx/Makefile.boot
index b796b41ebf8f..2cfe0ee635c5 100644
--- a/arch/arm/mach-lpc32xx/Makefile.boot
+++ b/arch/arm/mach-lpc32xx/Makefile.boot
@@ -1,4 +1,4 @@
1 zreladdr-y := 0x80008000 1 zreladdr-y += 0x80008000
2params_phys-y := 0x80000100 2params_phys-y := 0x80000100
3initrd_phys-y := 0x82000000 3initrd_phys-y := 0x82000000
4 4
diff --git a/arch/arm/mach-lpc32xx/gpiolib.c b/arch/arm/mach-lpc32xx/gpiolib.c
deleted file mode 100644
index 69061ea8997a..000000000000
--- a/arch/arm/mach-lpc32xx/gpiolib.c
+++ /dev/null
@@ -1,446 +0,0 @@
1/*
2 * arch/arm/mach-lpc32xx/gpiolib.c
3 *
4 * Author: Kevin Wells <kevin.wells@nxp.com>
5 *
6 * Copyright (C) 2010 NXP Semiconductors
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19#include <linux/kernel.h>
20#include <linux/init.h>
21#include <linux/io.h>
22#include <linux/errno.h>
23#include <linux/gpio.h>
24
25#include <mach/hardware.h>
26#include <mach/platform.h>
27#include "common.h"
28
29#define LPC32XX_GPIO_P3_INP_STATE _GPREG(0x000)
30#define LPC32XX_GPIO_P3_OUTP_SET _GPREG(0x004)
31#define LPC32XX_GPIO_P3_OUTP_CLR _GPREG(0x008)
32#define LPC32XX_GPIO_P3_OUTP_STATE _GPREG(0x00C)
33#define LPC32XX_GPIO_P2_DIR_SET _GPREG(0x010)
34#define LPC32XX_GPIO_P2_DIR_CLR _GPREG(0x014)
35#define LPC32XX_GPIO_P2_DIR_STATE _GPREG(0x018)
36#define LPC32XX_GPIO_P2_INP_STATE _GPREG(0x01C)
37#define LPC32XX_GPIO_P2_OUTP_SET _GPREG(0x020)
38#define LPC32XX_GPIO_P2_OUTP_CLR _GPREG(0x024)
39#define LPC32XX_GPIO_P2_MUX_SET _GPREG(0x028)
40#define LPC32XX_GPIO_P2_MUX_CLR _GPREG(0x02C)
41#define LPC32XX_GPIO_P2_MUX_STATE _GPREG(0x030)
42#define LPC32XX_GPIO_P0_INP_STATE _GPREG(0x040)
43#define LPC32XX_GPIO_P0_OUTP_SET _GPREG(0x044)
44#define LPC32XX_GPIO_P0_OUTP_CLR _GPREG(0x048)
45#define LPC32XX_GPIO_P0_OUTP_STATE _GPREG(0x04C)
46#define LPC32XX_GPIO_P0_DIR_SET _GPREG(0x050)
47#define LPC32XX_GPIO_P0_DIR_CLR _GPREG(0x054)
48#define LPC32XX_GPIO_P0_DIR_STATE _GPREG(0x058)
49#define LPC32XX_GPIO_P1_INP_STATE _GPREG(0x060)
50#define LPC32XX_GPIO_P1_OUTP_SET _GPREG(0x064)
51#define LPC32XX_GPIO_P1_OUTP_CLR _GPREG(0x068)
52#define LPC32XX_GPIO_P1_OUTP_STATE _GPREG(0x06C)
53#define LPC32XX_GPIO_P1_DIR_SET _GPREG(0x070)
54#define LPC32XX_GPIO_P1_DIR_CLR _GPREG(0x074)
55#define LPC32XX_GPIO_P1_DIR_STATE _GPREG(0x078)
56
57#define GPIO012_PIN_TO_BIT(x) (1 << (x))
58#define GPIO3_PIN_TO_BIT(x) (1 << ((x) + 25))
59#define GPO3_PIN_TO_BIT(x) (1 << (x))
60#define GPIO012_PIN_IN_SEL(x, y) (((x) >> (y)) & 1)
61#define GPIO3_PIN_IN_SHIFT(x) ((x) == 5 ? 24 : 10 + (x))
62#define GPIO3_PIN_IN_SEL(x, y) ((x) >> GPIO3_PIN_IN_SHIFT(y))
63#define GPIO3_PIN5_IN_SEL(x) (((x) >> 24) & 1)
64#define GPI3_PIN_IN_SEL(x, y) (((x) >> (y)) & 1)
65
66struct gpio_regs {
67 void __iomem *inp_state;
68 void __iomem *outp_set;
69 void __iomem *outp_clr;
70 void __iomem *dir_set;
71 void __iomem *dir_clr;
72};
73
74/*
75 * GPIO names
76 */
77static const char *gpio_p0_names[LPC32XX_GPIO_P0_MAX] = {
78 "p0.0", "p0.1", "p0.2", "p0.3",
79 "p0.4", "p0.5", "p0.6", "p0.7"
80};
81
82static const char *gpio_p1_names[LPC32XX_GPIO_P1_MAX] = {
83 "p1.0", "p1.1", "p1.2", "p1.3",
84 "p1.4", "p1.5", "p1.6", "p1.7",
85 "p1.8", "p1.9", "p1.10", "p1.11",
86 "p1.12", "p1.13", "p1.14", "p1.15",
87 "p1.16", "p1.17", "p1.18", "p1.19",
88 "p1.20", "p1.21", "p1.22", "p1.23",
89};
90
91static const char *gpio_p2_names[LPC32XX_GPIO_P2_MAX] = {
92 "p2.0", "p2.1", "p2.2", "p2.3",
93 "p2.4", "p2.5", "p2.6", "p2.7",
94 "p2.8", "p2.9", "p2.10", "p2.11",
95 "p2.12"
96};
97
98static const char *gpio_p3_names[LPC32XX_GPIO_P3_MAX] = {
99 "gpi000", "gpio01", "gpio02", "gpio03",
100 "gpio04", "gpio05"
101};
102
103static const char *gpi_p3_names[LPC32XX_GPI_P3_MAX] = {
104 "gpi00", "gpi01", "gpi02", "gpi03",
105 "gpi04", "gpi05", "gpi06", "gpi07",
106 "gpi08", "gpi09", NULL, NULL,
107 NULL, NULL, NULL, "gpi15",
108 "gpi16", "gpi17", "gpi18", "gpi19",
109 "gpi20", "gpi21", "gpi22", "gpi23",
110 "gpi24", "gpi25", "gpi26", "gpi27"
111};
112
113static const char *gpo_p3_names[LPC32XX_GPO_P3_MAX] = {
114 "gpo00", "gpo01", "gpo02", "gpo03",
115 "gpo04", "gpo05", "gpo06", "gpo07",
116 "gpo08", "gpo09", "gpo10", "gpo11",
117 "gpo12", "gpo13", "gpo14", "gpo15",
118 "gpo16", "gpo17", "gpo18", "gpo19",
119 "gpo20", "gpo21", "gpo22", "gpo23"
120};
121
122static struct gpio_regs gpio_grp_regs_p0 = {
123 .inp_state = LPC32XX_GPIO_P0_INP_STATE,
124 .outp_set = LPC32XX_GPIO_P0_OUTP_SET,
125 .outp_clr = LPC32XX_GPIO_P0_OUTP_CLR,
126 .dir_set = LPC32XX_GPIO_P0_DIR_SET,
127 .dir_clr = LPC32XX_GPIO_P0_DIR_CLR,
128};
129
130static struct gpio_regs gpio_grp_regs_p1 = {
131 .inp_state = LPC32XX_GPIO_P1_INP_STATE,
132 .outp_set = LPC32XX_GPIO_P1_OUTP_SET,
133 .outp_clr = LPC32XX_GPIO_P1_OUTP_CLR,
134 .dir_set = LPC32XX_GPIO_P1_DIR_SET,
135 .dir_clr = LPC32XX_GPIO_P1_DIR_CLR,
136};
137
138static struct gpio_regs gpio_grp_regs_p2 = {
139 .inp_state = LPC32XX_GPIO_P2_INP_STATE,
140 .outp_set = LPC32XX_GPIO_P2_OUTP_SET,
141 .outp_clr = LPC32XX_GPIO_P2_OUTP_CLR,
142 .dir_set = LPC32XX_GPIO_P2_DIR_SET,
143 .dir_clr = LPC32XX_GPIO_P2_DIR_CLR,
144};
145
146static struct gpio_regs gpio_grp_regs_p3 = {
147 .inp_state = LPC32XX_GPIO_P3_INP_STATE,
148 .outp_set = LPC32XX_GPIO_P3_OUTP_SET,
149 .outp_clr = LPC32XX_GPIO_P3_OUTP_CLR,
150 .dir_set = LPC32XX_GPIO_P2_DIR_SET,
151 .dir_clr = LPC32XX_GPIO_P2_DIR_CLR,
152};
153
154struct lpc32xx_gpio_chip {
155 struct gpio_chip chip;
156 struct gpio_regs *gpio_grp;
157};
158
159static inline struct lpc32xx_gpio_chip *to_lpc32xx_gpio(
160 struct gpio_chip *gpc)
161{
162 return container_of(gpc, struct lpc32xx_gpio_chip, chip);
163}
164
165static void __set_gpio_dir_p012(struct lpc32xx_gpio_chip *group,
166 unsigned pin, int input)
167{
168 if (input)
169 __raw_writel(GPIO012_PIN_TO_BIT(pin),
170 group->gpio_grp->dir_clr);
171 else
172 __raw_writel(GPIO012_PIN_TO_BIT(pin),
173 group->gpio_grp->dir_set);
174}
175
176static void __set_gpio_dir_p3(struct lpc32xx_gpio_chip *group,
177 unsigned pin, int input)
178{
179 u32 u = GPIO3_PIN_TO_BIT(pin);
180
181 if (input)
182 __raw_writel(u, group->gpio_grp->dir_clr);
183 else
184 __raw_writel(u, group->gpio_grp->dir_set);
185}
186
187static void __set_gpio_level_p012(struct lpc32xx_gpio_chip *group,
188 unsigned pin, int high)
189{
190 if (high)
191 __raw_writel(GPIO012_PIN_TO_BIT(pin),
192 group->gpio_grp->outp_set);
193 else
194 __raw_writel(GPIO012_PIN_TO_BIT(pin),
195 group->gpio_grp->outp_clr);
196}
197
198static void __set_gpio_level_p3(struct lpc32xx_gpio_chip *group,
199 unsigned pin, int high)
200{
201 u32 u = GPIO3_PIN_TO_BIT(pin);
202
203 if (high)
204 __raw_writel(u, group->gpio_grp->outp_set);
205 else
206 __raw_writel(u, group->gpio_grp->outp_clr);
207}
208
209static void __set_gpo_level_p3(struct lpc32xx_gpio_chip *group,
210 unsigned pin, int high)
211{
212 if (high)
213 __raw_writel(GPO3_PIN_TO_BIT(pin), group->gpio_grp->outp_set);
214 else
215 __raw_writel(GPO3_PIN_TO_BIT(pin), group->gpio_grp->outp_clr);
216}
217
218static int __get_gpio_state_p012(struct lpc32xx_gpio_chip *group,
219 unsigned pin)
220{
221 return GPIO012_PIN_IN_SEL(__raw_readl(group->gpio_grp->inp_state),
222 pin);
223}
224
225static int __get_gpio_state_p3(struct lpc32xx_gpio_chip *group,
226 unsigned pin)
227{
228 int state = __raw_readl(group->gpio_grp->inp_state);
229
230 /*
231 * P3 GPIO pin input mapping is not contiguous, GPIOP3-0..4 is mapped
232 * to bits 10..14, while GPIOP3-5 is mapped to bit 24.
233 */
234 return GPIO3_PIN_IN_SEL(state, pin);
235}
236
237static int __get_gpi_state_p3(struct lpc32xx_gpio_chip *group,
238 unsigned pin)
239{
240 return GPI3_PIN_IN_SEL(__raw_readl(group->gpio_grp->inp_state), pin);
241}
242
243/*
244 * GENERIC_GPIO primitives.
245 */
246static int lpc32xx_gpio_dir_input_p012(struct gpio_chip *chip,
247 unsigned pin)
248{
249 struct lpc32xx_gpio_chip *group = to_lpc32xx_gpio(chip);
250
251 __set_gpio_dir_p012(group, pin, 1);
252
253 return 0;
254}
255
256static int lpc32xx_gpio_dir_input_p3(struct gpio_chip *chip,
257 unsigned pin)
258{
259 struct lpc32xx_gpio_chip *group = to_lpc32xx_gpio(chip);
260
261 __set_gpio_dir_p3(group, pin, 1);
262
263 return 0;
264}
265
266static int lpc32xx_gpio_dir_in_always(struct gpio_chip *chip,
267 unsigned pin)
268{
269 return 0;
270}
271
272static int lpc32xx_gpio_get_value_p012(struct gpio_chip *chip, unsigned pin)
273{
274 struct lpc32xx_gpio_chip *group = to_lpc32xx_gpio(chip);
275
276 return __get_gpio_state_p012(group, pin);
277}
278
279static int lpc32xx_gpio_get_value_p3(struct gpio_chip *chip, unsigned pin)
280{
281 struct lpc32xx_gpio_chip *group = to_lpc32xx_gpio(chip);
282
283 return __get_gpio_state_p3(group, pin);
284}
285
286static int lpc32xx_gpi_get_value(struct gpio_chip *chip, unsigned pin)
287{
288 struct lpc32xx_gpio_chip *group = to_lpc32xx_gpio(chip);
289
290 return __get_gpi_state_p3(group, pin);
291}
292
293static int lpc32xx_gpio_dir_output_p012(struct gpio_chip *chip, unsigned pin,
294 int value)
295{
296 struct lpc32xx_gpio_chip *group = to_lpc32xx_gpio(chip);
297
298 __set_gpio_dir_p012(group, pin, 0);
299
300 return 0;
301}
302
303static int lpc32xx_gpio_dir_output_p3(struct gpio_chip *chip, unsigned pin,
304 int value)
305{
306 struct lpc32xx_gpio_chip *group = to_lpc32xx_gpio(chip);
307
308 __set_gpio_dir_p3(group, pin, 0);
309
310 return 0;
311}
312
313static int lpc32xx_gpio_dir_out_always(struct gpio_chip *chip, unsigned pin,
314 int value)
315{
316 return 0;
317}
318
319static void lpc32xx_gpio_set_value_p012(struct gpio_chip *chip, unsigned pin,
320 int value)
321{
322 struct lpc32xx_gpio_chip *group = to_lpc32xx_gpio(chip);
323
324 __set_gpio_level_p012(group, pin, value);
325}
326
327static void lpc32xx_gpio_set_value_p3(struct gpio_chip *chip, unsigned pin,
328 int value)
329{
330 struct lpc32xx_gpio_chip *group = to_lpc32xx_gpio(chip);
331
332 __set_gpio_level_p3(group, pin, value);
333}
334
335static void lpc32xx_gpo_set_value(struct gpio_chip *chip, unsigned pin,
336 int value)
337{
338 struct lpc32xx_gpio_chip *group = to_lpc32xx_gpio(chip);
339
340 __set_gpo_level_p3(group, pin, value);
341}
342
343static int lpc32xx_gpio_request(struct gpio_chip *chip, unsigned pin)
344{
345 if (pin < chip->ngpio)
346 return 0;
347
348 return -EINVAL;
349}
350
351static struct lpc32xx_gpio_chip lpc32xx_gpiochip[] = {
352 {
353 .chip = {
354 .label = "gpio_p0",
355 .direction_input = lpc32xx_gpio_dir_input_p012,
356 .get = lpc32xx_gpio_get_value_p012,
357 .direction_output = lpc32xx_gpio_dir_output_p012,
358 .set = lpc32xx_gpio_set_value_p012,
359 .request = lpc32xx_gpio_request,
360 .base = LPC32XX_GPIO_P0_GRP,
361 .ngpio = LPC32XX_GPIO_P0_MAX,
362 .names = gpio_p0_names,
363 .can_sleep = 0,
364 },
365 .gpio_grp = &gpio_grp_regs_p0,
366 },
367 {
368 .chip = {
369 .label = "gpio_p1",
370 .direction_input = lpc32xx_gpio_dir_input_p012,
371 .get = lpc32xx_gpio_get_value_p012,
372 .direction_output = lpc32xx_gpio_dir_output_p012,
373 .set = lpc32xx_gpio_set_value_p012,
374 .request = lpc32xx_gpio_request,
375 .base = LPC32XX_GPIO_P1_GRP,
376 .ngpio = LPC32XX_GPIO_P1_MAX,
377 .names = gpio_p1_names,
378 .can_sleep = 0,
379 },
380 .gpio_grp = &gpio_grp_regs_p1,
381 },
382 {
383 .chip = {
384 .label = "gpio_p2",
385 .direction_input = lpc32xx_gpio_dir_input_p012,
386 .get = lpc32xx_gpio_get_value_p012,
387 .direction_output = lpc32xx_gpio_dir_output_p012,
388 .set = lpc32xx_gpio_set_value_p012,
389 .request = lpc32xx_gpio_request,
390 .base = LPC32XX_GPIO_P2_GRP,
391 .ngpio = LPC32XX_GPIO_P2_MAX,
392 .names = gpio_p2_names,
393 .can_sleep = 0,
394 },
395 .gpio_grp = &gpio_grp_regs_p2,
396 },
397 {
398 .chip = {
399 .label = "gpio_p3",
400 .direction_input = lpc32xx_gpio_dir_input_p3,
401 .get = lpc32xx_gpio_get_value_p3,
402 .direction_output = lpc32xx_gpio_dir_output_p3,
403 .set = lpc32xx_gpio_set_value_p3,
404 .request = lpc32xx_gpio_request,
405 .base = LPC32XX_GPIO_P3_GRP,
406 .ngpio = LPC32XX_GPIO_P3_MAX,
407 .names = gpio_p3_names,
408 .can_sleep = 0,
409 },
410 .gpio_grp = &gpio_grp_regs_p3,
411 },
412 {
413 .chip = {
414 .label = "gpi_p3",
415 .direction_input = lpc32xx_gpio_dir_in_always,
416 .get = lpc32xx_gpi_get_value,
417 .request = lpc32xx_gpio_request,
418 .base = LPC32XX_GPI_P3_GRP,
419 .ngpio = LPC32XX_GPI_P3_MAX,
420 .names = gpi_p3_names,
421 .can_sleep = 0,
422 },
423 .gpio_grp = &gpio_grp_regs_p3,
424 },
425 {
426 .chip = {
427 .label = "gpo_p3",
428 .direction_output = lpc32xx_gpio_dir_out_always,
429 .set = lpc32xx_gpo_set_value,
430 .request = lpc32xx_gpio_request,
431 .base = LPC32XX_GPO_P3_GRP,
432 .ngpio = LPC32XX_GPO_P3_MAX,
433 .names = gpo_p3_names,
434 .can_sleep = 0,
435 },
436 .gpio_grp = &gpio_grp_regs_p3,
437 },
438};
439
440void __init lpc32xx_gpio_init(void)
441{
442 int i;
443
444 for (i = 0; i < ARRAY_SIZE(lpc32xx_gpiochip); i++)
445 gpiochip_add(&lpc32xx_gpiochip[i].chip);
446}
diff --git a/arch/arm/mach-lpc32xx/include/mach/gpio-lpc32xx.h b/arch/arm/mach-lpc32xx/include/mach/gpio-lpc32xx.h
new file mode 100644
index 000000000000..1816e22a3479
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/include/mach/gpio-lpc32xx.h
@@ -0,0 +1,50 @@
1/*
2 * Author: Kevin Wells <kevin.wells@nxp.com>
3 *
4 * Copyright (C) 2010 NXP Semiconductors
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __MACH_GPIO_LPC32XX_H
18#define __MACH_GPIO_LPC32XX_H
19
20/*
21 * Note!
22 * Muxed GP pins need to be setup to the GP state in the board level
23 * code prior to using this driver.
24 * GPI pins : 28xP3 group
25 * GPO pins : 24xP3 group
26 * GPIO pins: 8xP0 group, 24xP1 group, 13xP2 group, 6xP3 group
27 */
28
29#define LPC32XX_GPIO_P0_MAX 8
30#define LPC32XX_GPIO_P1_MAX 24
31#define LPC32XX_GPIO_P2_MAX 13
32#define LPC32XX_GPIO_P3_MAX 6
33#define LPC32XX_GPI_P3_MAX 28
34#define LPC32XX_GPO_P3_MAX 24
35
36#define LPC32XX_GPIO_P0_GRP 0
37#define LPC32XX_GPIO_P1_GRP (LPC32XX_GPIO_P0_GRP + LPC32XX_GPIO_P0_MAX)
38#define LPC32XX_GPIO_P2_GRP (LPC32XX_GPIO_P1_GRP + LPC32XX_GPIO_P1_MAX)
39#define LPC32XX_GPIO_P3_GRP (LPC32XX_GPIO_P2_GRP + LPC32XX_GPIO_P2_MAX)
40#define LPC32XX_GPI_P3_GRP (LPC32XX_GPIO_P3_GRP + LPC32XX_GPIO_P3_MAX)
41#define LPC32XX_GPO_P3_GRP (LPC32XX_GPI_P3_GRP + LPC32XX_GPI_P3_MAX)
42
43/*
44 * A specific GPIO can be selected with this macro
45 * ie, GPIO_05 can be selected with LPC32XX_GPIO(LPC32XX_GPIO_P3_GRP, 5)
46 * See the LPC32x0 User's guide for GPIO group numbers
47 */
48#define LPC32XX_GPIO(x, y) ((x) + (y))
49
50#endif /* __MACH_GPIO_LPC32XX_H */
diff --git a/arch/arm/mach-lpc32xx/include/mach/gpio.h b/arch/arm/mach-lpc32xx/include/mach/gpio.h
index 67d03da1eee9..e69de29bb2d1 100644
--- a/arch/arm/mach-lpc32xx/include/mach/gpio.h
+++ b/arch/arm/mach-lpc32xx/include/mach/gpio.h
@@ -1,74 +0,0 @@
1/*
2 * arch/arm/mach-lpc32xx/include/mach/gpio.h
3 *
4 * Author: Kevin Wells <kevin.wells@nxp.com>
5 *
6 * Copyright (C) 2010 NXP Semiconductors
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19#ifndef __ASM_ARCH_GPIO_H
20#define __ASM_ARCH_GPIO_H
21
22#include <asm-generic/gpio.h>
23
24/*
25 * Note!
26 * Muxed GP pins need to be setup to the GP state in the board level
27 * code prior to using this driver.
28 * GPI pins : 28xP3 group
29 * GPO pins : 24xP3 group
30 * GPIO pins: 8xP0 group, 24xP1 group, 13xP2 group, 6xP3 group
31 */
32
33#define LPC32XX_GPIO_P0_MAX 8
34#define LPC32XX_GPIO_P1_MAX 24
35#define LPC32XX_GPIO_P2_MAX 13
36#define LPC32XX_GPIO_P3_MAX 6
37#define LPC32XX_GPI_P3_MAX 28
38#define LPC32XX_GPO_P3_MAX 24
39
40#define LPC32XX_GPIO_P0_GRP 0
41#define LPC32XX_GPIO_P1_GRP (LPC32XX_GPIO_P0_GRP + LPC32XX_GPIO_P0_MAX)
42#define LPC32XX_GPIO_P2_GRP (LPC32XX_GPIO_P1_GRP + LPC32XX_GPIO_P1_MAX)
43#define LPC32XX_GPIO_P3_GRP (LPC32XX_GPIO_P2_GRP + LPC32XX_GPIO_P2_MAX)
44#define LPC32XX_GPI_P3_GRP (LPC32XX_GPIO_P3_GRP + LPC32XX_GPIO_P3_MAX)
45#define LPC32XX_GPO_P3_GRP (LPC32XX_GPI_P3_GRP + LPC32XX_GPI_P3_MAX)
46
47/*
48 * A specific GPIO can be selected with this macro
49 * ie, GPIO_05 can be selected with LPC32XX_GPIO(LPC32XX_GPIO_P3_GRP, 5)
50 * See the LPC32x0 User's guide for GPIO group numbers
51 */
52#define LPC32XX_GPIO(x, y) ((x) + (y))
53
54static inline int gpio_get_value(unsigned gpio)
55{
56 return __gpio_get_value(gpio);
57}
58
59static inline void gpio_set_value(unsigned gpio, int value)
60{
61 __gpio_set_value(gpio, value);
62}
63
64static inline int gpio_cansleep(unsigned gpio)
65{
66 return __gpio_cansleep(gpio);
67}
68
69static inline int gpio_to_irq(unsigned gpio)
70{
71 return __gpio_to_irq(gpio);
72}
73
74#endif
diff --git a/arch/arm/mach-lpc32xx/phy3250.c b/arch/arm/mach-lpc32xx/phy3250.c
index 9b621e14d16a..6d2f0d1b9373 100644
--- a/arch/arm/mach-lpc32xx/phy3250.c
+++ b/arch/arm/mach-lpc32xx/phy3250.c
@@ -37,6 +37,7 @@
37 37
38#include <mach/hardware.h> 38#include <mach/hardware.h>
39#include <mach/platform.h> 39#include <mach/platform.h>
40#include <mach/gpio-lpc32xx.h>
40#include "common.h" 41#include "common.h"
41 42
42/* 43/*
diff --git a/arch/arm/mach-mmp/Makefile.boot b/arch/arm/mach-mmp/Makefile.boot
index 574a4aa8321a..5edf03e2beed 100644
--- a/arch/arm/mach-mmp/Makefile.boot
+++ b/arch/arm/mach-mmp/Makefile.boot
@@ -1 +1 @@
zreladdr-y := 0x00008000 zreladdr-y += 0x00008000
diff --git a/arch/arm/mach-mmp/aspenite.c b/arch/arm/mach-mmp/aspenite.c
index 06b5fa853c93..06b5ad774604 100644
--- a/arch/arm/mach-mmp/aspenite.c
+++ b/arch/arm/mach-mmp/aspenite.c
@@ -8,7 +8,7 @@
8 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
9 * publishhed by the Free Software Foundation. 9 * publishhed by the Free Software Foundation.
10 */ 10 */
11 11#include <linux/gpio.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
@@ -17,13 +17,13 @@
17#include <linux/mtd/partitions.h> 17#include <linux/mtd/partitions.h>
18#include <linux/mtd/nand.h> 18#include <linux/mtd/nand.h>
19#include <linux/interrupt.h> 19#include <linux/interrupt.h>
20#include <linux/gpio.h>
20 21
21#include <asm/mach-types.h> 22#include <asm/mach-types.h>
22#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
23#include <mach/addr-map.h> 24#include <mach/addr-map.h>
24#include <mach/mfp-pxa168.h> 25#include <mach/mfp-pxa168.h>
25#include <mach/pxa168.h> 26#include <mach/pxa168.h>
26#include <mach/gpio.h>
27#include <video/pxa168fb.h> 27#include <video/pxa168fb.h>
28#include <linux/input.h> 28#include <linux/input.h>
29#include <plat/pxa27x_keypad.h> 29#include <plat/pxa27x_keypad.h>
@@ -160,7 +160,7 @@ static struct mtd_partition aspenite_nand_partitions[] = {
160 }, { 160 }, {
161 .name = "filesystem", 161 .name = "filesystem",
162 .offset = MTDPART_OFS_APPEND, 162 .offset = MTDPART_OFS_APPEND,
163 .size = SZ_48M, 163 .size = SZ_32M + SZ_16M,
164 .mask_flags = 0, 164 .mask_flags = 0,
165 } 165 }
166}; 166};
diff --git a/arch/arm/mach-mmp/brownstone.c b/arch/arm/mach-mmp/brownstone.c
index c79162a50f28..e411252e3d39 100644
--- a/arch/arm/mach-mmp/brownstone.c
+++ b/arch/arm/mach-mmp/brownstone.c
@@ -14,7 +14,6 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
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/gpio.h>
18#include <linux/regulator/machine.h> 17#include <linux/regulator/machine.h>
19#include <linux/regulator/max8649.h> 18#include <linux/regulator/max8649.h>
20#include <linux/regulator/fixed.h> 19#include <linux/regulator/fixed.h>
diff --git a/arch/arm/mach-mmp/gplugd.c b/arch/arm/mach-mmp/gplugd.c
index 98e25d9aaab6..32776f3739f1 100644
--- a/arch/arm/mach-mmp/gplugd.c
+++ b/arch/arm/mach-mmp/gplugd.c
@@ -9,11 +9,11 @@
9 */ 9 */
10 10
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/gpio.h>
12 13
13#include <asm/mach/arch.h> 14#include <asm/mach/arch.h>
14#include <asm/mach-types.h> 15#include <asm/mach-types.h>
15 16
16#include <mach/gpio.h>
17#include <mach/pxa168.h> 17#include <mach/pxa168.h>
18#include <mach/mfp-pxa168.h> 18#include <mach/mfp-pxa168.h>
19 19
diff --git a/arch/arm/mach-mmp/include/mach/gpio-pxa.h b/arch/arm/mach-mmp/include/mach/gpio-pxa.h
new file mode 100644
index 000000000000..c017a983eced
--- /dev/null
+++ b/arch/arm/mach-mmp/include/mach/gpio-pxa.h
@@ -0,0 +1,30 @@
1#ifndef __ASM_MACH_GPIO_PXA_H
2#define __ASM_MACH_GPIO_PXA_H
3
4#include <mach/addr-map.h>
5#include <mach/irqs.h>
6
7#define GPIO_REGS_VIRT (APB_VIRT_BASE + 0x19000)
8
9#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
10#define GPIO_REG(x) (*((volatile u32 *)(GPIO_REGS_VIRT + (x))))
11
12#define NR_BUILTIN_GPIO IRQ_GPIO_NUM
13
14#define gpio_to_bank(gpio) ((gpio) >> 5)
15
16/* NOTE: these macros are defined here to make optimization of
17 * gpio_{get,set}_value() to work when 'gpio' is a constant.
18 * Usage of these macros otherwise is no longer recommended,
19 * use generic GPIO API whenever possible.
20 */
21#define GPIO_bit(gpio) (1 << ((gpio) & 0x1f))
22
23#define GPLR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x00)
24#define GPDR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x0c)
25#define GPSR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x18)
26#define GPCR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x24)
27
28#include <plat/gpio-pxa.h>
29
30#endif /* __ASM_MACH_GPIO_PXA_H */
diff --git a/arch/arm/mach-mmp/include/mach/gpio.h b/arch/arm/mach-mmp/include/mach/gpio.h
index 7bfb827f3fe3..681262359d1c 100644
--- a/arch/arm/mach-mmp/include/mach/gpio.h
+++ b/arch/arm/mach-mmp/include/mach/gpio.h
@@ -1,36 +1,13 @@
1#ifndef __ASM_MACH_GPIO_H 1#ifndef __ASM_MACH_GPIO_H
2#define __ASM_MACH_GPIO_H 2#define __ASM_MACH_GPIO_H
3 3
4#include <mach/addr-map.h>
5#include <mach/irqs.h>
6#include <asm-generic/gpio.h> 4#include <asm-generic/gpio.h>
7 5
8#define GPIO_REGS_VIRT (APB_VIRT_BASE + 0x19000)
9
10#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
11#define GPIO_REG(x) (*((volatile u32 *)(GPIO_REGS_VIRT + (x))))
12
13#define NR_BUILTIN_GPIO IRQ_GPIO_NUM
14
15#define gpio_to_bank(gpio) ((gpio) >> 5)
16#define gpio_to_irq(gpio) (IRQ_GPIO_START + (gpio)) 6#define gpio_to_irq(gpio) (IRQ_GPIO_START + (gpio))
17#define irq_to_gpio(irq) ((irq) - IRQ_GPIO_START) 7#define irq_to_gpio(irq) ((irq) - IRQ_GPIO_START)
18 8
19
20#define __gpio_is_inverted(gpio) (0) 9#define __gpio_is_inverted(gpio) (0)
21#define __gpio_is_occupied(gpio) (0) 10#define __gpio_is_occupied(gpio) (0)
22 11
23/* NOTE: these macros are defined here to make optimization of
24 * gpio_{get,set}_value() to work when 'gpio' is a constant.
25 * Usage of these macros otherwise is no longer recommended,
26 * use generic GPIO API whenever possible.
27 */
28#define GPIO_bit(gpio) (1 << ((gpio) & 0x1f))
29
30#define GPLR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x00)
31#define GPDR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x0c)
32#define GPSR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x18)
33#define GPCR(x) GPIO_REG(BANK_OFF(gpio_to_bank(x)) + 0x24)
34
35#include <plat/gpio.h> 12#include <plat/gpio.h>
36#endif /* __ASM_MACH_GPIO_H */ 13#endif /* __ASM_MACH_GPIO_H */
diff --git a/arch/arm/mach-mmp/include/mach/pxa168.h b/arch/arm/mach-mmp/include/mach/pxa168.h
index 7f005843a707..7fb568d2845b 100644
--- a/arch/arm/mach-mmp/include/mach/pxa168.h
+++ b/arch/arm/mach-mmp/include/mach/pxa168.h
@@ -35,6 +35,13 @@ extern struct pxa_device_desc pxa168_device_fb;
35extern struct pxa_device_desc pxa168_device_keypad; 35extern struct pxa_device_desc pxa168_device_keypad;
36extern struct pxa_device_desc pxa168_device_eth; 36extern struct pxa_device_desc pxa168_device_eth;
37 37
38struct pxa168_usb_pdata {
39 /* If NULL, default phy init routine for PXA168 would be called */
40 int (*phy_init)(void __iomem *usb_phy_reg_base);
41};
42/* pdata can be NULL */
43int __init pxa168_add_usb_host(struct pxa168_usb_pdata *pdata);
44
38static inline int pxa168_add_uart(int id) 45static inline int pxa168_add_uart(int id)
39{ 46{
40 struct pxa_device_desc *d = NULL; 47 struct pxa_device_desc *d = NULL;
diff --git a/arch/arm/mach-mmp/jasper.c b/arch/arm/mach-mmp/jasper.c
index 5d6421d63254..8bfac6612623 100644
--- a/arch/arm/mach-mmp/jasper.c
+++ b/arch/arm/mach-mmp/jasper.c
@@ -14,7 +14,6 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
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/gpio.h>
18#include <linux/regulator/machine.h> 17#include <linux/regulator/machine.h>
19#include <linux/regulator/max8649.h> 18#include <linux/regulator/max8649.h>
20#include <linux/mfd/max8925.h> 19#include <linux/mfd/max8925.h>
diff --git a/arch/arm/mach-mmp/mmp2.c b/arch/arm/mach-mmp/mmp2.c
index 079c18861d5c..65d8689e40c9 100644
--- a/arch/arm/mach-mmp/mmp2.c
+++ b/arch/arm/mach-mmp/mmp2.c
@@ -9,7 +9,6 @@
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12
13#include <linux/module.h> 12#include <linux/module.h>
14#include <linux/kernel.h> 13#include <linux/kernel.h>
15#include <linux/init.h> 14#include <linux/init.h>
@@ -25,7 +24,7 @@
25#include <mach/irqs.h> 24#include <mach/irqs.h>
26#include <mach/dma.h> 25#include <mach/dma.h>
27#include <mach/mfp.h> 26#include <mach/mfp.h>
28#include <mach/gpio.h> 27#include <mach/gpio-pxa.h>
29#include <mach/devices.h> 28#include <mach/devices.h>
30#include <mach/mmp2.h> 29#include <mach/mmp2.h>
31 30
diff --git a/arch/arm/mach-mmp/pxa168.c b/arch/arm/mach-mmp/pxa168.c
index 0156f535dae7..76ca15c00e45 100644
--- a/arch/arm/mach-mmp/pxa168.c
+++ b/arch/arm/mach-mmp/pxa168.c
@@ -7,7 +7,6 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10
11#include <linux/module.h> 10#include <linux/module.h>
12#include <linux/kernel.h> 11#include <linux/kernel.h>
13#include <linux/init.h> 12#include <linux/init.h>
@@ -21,10 +20,13 @@
21#include <mach/regs-apbc.h> 20#include <mach/regs-apbc.h>
22#include <mach/regs-apmu.h> 21#include <mach/regs-apmu.h>
23#include <mach/irqs.h> 22#include <mach/irqs.h>
24#include <mach/gpio.h> 23#include <mach/gpio-pxa.h>
25#include <mach/dma.h> 24#include <mach/dma.h>
26#include <mach/devices.h> 25#include <mach/devices.h>
27#include <mach/mfp.h> 26#include <mach/mfp.h>
27#include <linux/platform_device.h>
28#include <linux/dma-mapping.h>
29#include <mach/pxa168.h>
28 30
29#include "common.h" 31#include "common.h"
30#include "clock.h" 32#include "clock.h"
@@ -83,6 +85,7 @@ static APBC_CLK(keypad, PXA168_KPC, 0, 32000);
83static APMU_CLK(nand, NAND, 0x19b, 156000000); 85static APMU_CLK(nand, NAND, 0x19b, 156000000);
84static APMU_CLK(lcd, LCD, 0x7f, 312000000); 86static APMU_CLK(lcd, LCD, 0x7f, 312000000);
85static APMU_CLK(eth, ETH, 0x09, 0); 87static APMU_CLK(eth, ETH, 0x09, 0);
88static APMU_CLK(usb, USB, 0x12, 0);
86 89
87/* device and clock bindings */ 90/* device and clock bindings */
88static struct clk_lookup pxa168_clkregs[] = { 91static struct clk_lookup pxa168_clkregs[] = {
@@ -104,6 +107,7 @@ static struct clk_lookup pxa168_clkregs[] = {
104 INIT_CLKREG(&clk_lcd, "pxa168-fb", NULL), 107 INIT_CLKREG(&clk_lcd, "pxa168-fb", NULL),
105 INIT_CLKREG(&clk_keypad, "pxa27x-keypad", NULL), 108 INIT_CLKREG(&clk_keypad, "pxa27x-keypad", NULL),
106 INIT_CLKREG(&clk_eth, "pxa168-eth", "MFUCLK"), 109 INIT_CLKREG(&clk_eth, "pxa168-eth", "MFUCLK"),
110 INIT_CLKREG(&clk_usb, "pxa168-ehci", "PXA168-USBCLK"),
107}; 111};
108 112
109static int __init pxa168_init(void) 113static int __init pxa168_init(void)
@@ -169,3 +173,44 @@ PXA168_DEVICE(ssp5, "pxa168-ssp", 4, SSP5, 0xd4021000, 0x40, 60, 61);
169PXA168_DEVICE(fb, "pxa168-fb", -1, LCD, 0xd420b000, 0x1c8); 173PXA168_DEVICE(fb, "pxa168-fb", -1, LCD, 0xd420b000, 0x1c8);
170PXA168_DEVICE(keypad, "pxa27x-keypad", -1, KEYPAD, 0xd4012000, 0x4c); 174PXA168_DEVICE(keypad, "pxa27x-keypad", -1, KEYPAD, 0xd4012000, 0x4c);
171PXA168_DEVICE(eth, "pxa168-eth", -1, MFU, 0xc0800000, 0x0fff); 175PXA168_DEVICE(eth, "pxa168-eth", -1, MFU, 0xc0800000, 0x0fff);
176
177struct resource pxa168_usb_host_resources[] = {
178 /* USB Host conroller register base */
179 [0] = {
180 .start = 0xd4209000,
181 .end = 0xd4209000 + 0x200,
182 .flags = IORESOURCE_MEM,
183 .name = "pxa168-usb-host",
184 },
185 /* USB PHY register base */
186 [1] = {
187 .start = 0xd4206000,
188 .end = 0xd4206000 + 0xff,
189 .flags = IORESOURCE_MEM,
190 .name = "pxa168-usb-phy",
191 },
192 [2] = {
193 .start = IRQ_PXA168_USB2,
194 .end = IRQ_PXA168_USB2,
195 .flags = IORESOURCE_IRQ,
196 },
197};
198
199static u64 pxa168_usb_host_dmamask = DMA_BIT_MASK(32);
200struct platform_device pxa168_device_usb_host = {
201 .name = "pxa168-ehci",
202 .id = -1,
203 .dev = {
204 .dma_mask = &pxa168_usb_host_dmamask,
205 .coherent_dma_mask = DMA_BIT_MASK(32),
206 },
207
208 .num_resources = ARRAY_SIZE(pxa168_usb_host_resources),
209 .resource = pxa168_usb_host_resources,
210};
211
212int __init pxa168_add_usb_host(struct pxa168_usb_pdata *pdata)
213{
214 pxa168_device_usb_host.dev.platform_data = pdata;
215 return platform_device_register(&pxa168_device_usb_host);
216}
diff --git a/arch/arm/mach-mmp/pxa910.c b/arch/arm/mach-mmp/pxa910.c
index 1464607aa60d..4ebbfbba39fc 100644
--- a/arch/arm/mach-mmp/pxa910.c
+++ b/arch/arm/mach-mmp/pxa910.c
@@ -7,7 +7,6 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10
11#include <linux/module.h> 10#include <linux/module.h>
12#include <linux/kernel.h> 11#include <linux/kernel.h>
13#include <linux/init.h> 12#include <linux/init.h>
@@ -20,7 +19,7 @@
20#include <mach/regs-apmu.h> 19#include <mach/regs-apmu.h>
21#include <mach/cputype.h> 20#include <mach/cputype.h>
22#include <mach/irqs.h> 21#include <mach/irqs.h>
23#include <mach/gpio.h> 22#include <mach/gpio-pxa.h>
24#include <mach/dma.h> 23#include <mach/dma.h>
25#include <mach/mfp.h> 24#include <mach/mfp.h>
26#include <mach/devices.h> 25#include <mach/devices.h>
diff --git a/arch/arm/mach-mmp/tavorevb.c b/arch/arm/mach-mmp/tavorevb.c
index c296b75c4453..eb5be879fd8c 100644
--- a/arch/arm/mach-mmp/tavorevb.c
+++ b/arch/arm/mach-mmp/tavorevb.c
@@ -7,18 +7,18 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * publishhed by the Free Software Foundation. 8 * publishhed by the Free Software Foundation.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/smc91x.h> 14#include <linux/smc91x.h>
15#include <linux/gpio.h>
15 16
16#include <asm/mach-types.h> 17#include <asm/mach-types.h>
17#include <asm/mach/arch.h> 18#include <asm/mach/arch.h>
18#include <mach/addr-map.h> 19#include <mach/addr-map.h>
19#include <mach/mfp-pxa910.h> 20#include <mach/mfp-pxa910.h>
20#include <mach/pxa910.h> 21#include <mach/pxa910.h>
21#include <mach/gpio.h>
22 22
23#include "common.h" 23#include "common.h"
24 24
diff --git a/arch/arm/mach-mmp/ttc_dkb.c b/arch/arm/mach-mmp/ttc_dkb.c
index 6bd37a27e5fc..176515a76989 100644
--- a/arch/arm/mach-mmp/ttc_dkb.c
+++ b/arch/arm/mach-mmp/ttc_dkb.c
@@ -93,7 +93,7 @@ static struct mtd_partition ttc_dkb_onenand_partitions[] = {
93 }, { 93 }, {
94 .name = "filesystem", 94 .name = "filesystem",
95 .offset = MTDPART_OFS_APPEND, 95 .offset = MTDPART_OFS_APPEND,
96 .size = SZ_48M, 96 .size = SZ_32M + SZ_16M,
97 .mask_flags = 0, 97 .mask_flags = 0,
98 } 98 }
99}; 99};
diff --git a/arch/arm/mach-msm/Makefile.boot b/arch/arm/mach-msm/Makefile.boot
index 24dfbf8c07c4..9b803a578b4d 100644
--- a/arch/arm/mach-msm/Makefile.boot
+++ b/arch/arm/mach-msm/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x10008000 1 zreladdr-y += 0x10008000
2params_phys-y := 0x10000100 2params_phys-y := 0x10000100
3initrd_phys-y := 0x10800000 3initrd_phys-y := 0x10800000
diff --git a/arch/arm/mach-msm/board-halibut.c b/arch/arm/mach-msm/board-halibut.c
index 16c86f8b4f3f..a60ab6d04ec5 100644
--- a/arch/arm/mach-msm/board-halibut.c
+++ b/arch/arm/mach-msm/board-halibut.c
@@ -78,8 +78,8 @@ static void __init halibut_init(void)
78 platform_add_devices(devices, ARRAY_SIZE(devices)); 78 platform_add_devices(devices, ARRAY_SIZE(devices));
79} 79}
80 80
81static void __init halibut_fixup(struct machine_desc *desc, struct tag *tags, 81static void __init halibut_fixup(struct tag *tags, char **cmdline,
82 char **cmdline, struct meminfo *mi) 82 struct meminfo *mi)
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;
diff --git a/arch/arm/mach-msm/board-mahimahi.c b/arch/arm/mach-msm/board-mahimahi.c
index 8a1672ee4e4a..5a4882fc6f7a 100644
--- a/arch/arm/mach-msm/board-mahimahi.c
+++ b/arch/arm/mach-msm/board-mahimahi.c
@@ -53,8 +53,8 @@ static void __init mahimahi_init(void)
53 platform_add_devices(devices, ARRAY_SIZE(devices)); 53 platform_add_devices(devices, ARRAY_SIZE(devices));
54} 54}
55 55
56static void __init mahimahi_fixup(struct machine_desc *desc, struct tag *tags, 56static void __init mahimahi_fixup(struct tag *tags, char **cmdline,
57 char **cmdline, struct meminfo *mi) 57 struct meminfo *mi)
58{ 58{
59 mi->nr_banks = 2; 59 mi->nr_banks = 2;
60 mi->bank[0].start = PHYS_OFFSET; 60 mi->bank[0].start = PHYS_OFFSET;
diff --git a/arch/arm/mach-msm/board-msm7x27.c b/arch/arm/mach-msm/board-msm7x27.c
index a80765533f13..6d84ee740df4 100644
--- a/arch/arm/mach-msm/board-msm7x27.c
+++ b/arch/arm/mach-msm/board-msm7x27.c
@@ -13,7 +13,7 @@
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 */ 15 */
16 16#include <linux/gpio.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
@@ -34,7 +34,6 @@
34 34
35#include <mach/vreg.h> 35#include <mach/vreg.h>
36#include <mach/mpp.h> 36#include <mach/mpp.h>
37#include <mach/gpio.h>
38#include <mach/board.h> 37#include <mach/board.h>
39#include <mach/msm_iomap.h> 38#include <mach/msm_iomap.h>
40 39
diff --git a/arch/arm/mach-msm/board-msm7x30.c b/arch/arm/mach-msm/board-msm7x30.c
index bb72ea0383b7..71de5062c71e 100644
--- a/arch/arm/mach-msm/board-msm7x30.c
+++ b/arch/arm/mach-msm/board-msm7x30.c
@@ -14,7 +14,7 @@
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA. 15 * 02110-1301, USA.
16 */ 16 */
17 17#include <linux/gpio.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20#include <linux/gpio.h> 20#include <linux/gpio.h>
@@ -31,7 +31,6 @@
31#include <asm/memory.h> 31#include <asm/memory.h>
32#include <asm/setup.h> 32#include <asm/setup.h>
33 33
34#include <mach/gpio.h>
35#include <mach/board.h> 34#include <mach/board.h>
36#include <mach/msm_iomap.h> 35#include <mach/msm_iomap.h>
37#include <mach/dma.h> 36#include <mach/dma.h>
diff --git a/arch/arm/mach-msm/board-qsd8x50.c b/arch/arm/mach-msm/board-qsd8x50.c
index 51109b1f4342..7e8909c978c3 100644
--- a/arch/arm/mach-msm/board-qsd8x50.c
+++ b/arch/arm/mach-msm/board-qsd8x50.c
@@ -14,7 +14,7 @@
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA. 15 * 02110-1301, USA.
16 */ 16 */
17 17#include <linux/gpio.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20#include <linux/gpio.h> 20#include <linux/gpio.h>
@@ -32,7 +32,6 @@
32#include <mach/board.h> 32#include <mach/board.h>
33#include <mach/irqs.h> 33#include <mach/irqs.h>
34#include <mach/sirc.h> 34#include <mach/sirc.h>
35#include <mach/gpio.h>
36#include <mach/vreg.h> 35#include <mach/vreg.h>
37#include <mach/mmc.h> 36#include <mach/mmc.h>
38 37
diff --git a/arch/arm/mach-msm/board-sapphire.c b/arch/arm/mach-msm/board-sapphire.c
index dc0bcb5a6b9a..32b465763dbd 100644
--- a/arch/arm/mach-msm/board-sapphire.c
+++ b/arch/arm/mach-msm/board-sapphire.c
@@ -11,7 +11,7 @@
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 12 * GNU General Public License for more details.
13*/ 13*/
14 14#include <linux/gpio.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
@@ -22,7 +22,6 @@
22 22
23#include <linux/delay.h> 23#include <linux/delay.h>
24 24
25#include <asm/gpio.h>
26#include <mach/hardware.h> 25#include <mach/hardware.h>
27#include <asm/mach-types.h> 26#include <asm/mach-types.h>
28#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
@@ -77,8 +76,8 @@ static struct map_desc sapphire_io_desc[] __initdata = {
77 } 76 }
78}; 77};
79 78
80static void __init sapphire_fixup(struct machine_desc *desc, struct tag *tags, 79static void __init sapphire_fixup(struct tag *tags, char **cmdline,
81 char **cmdline, struct meminfo *mi) 80 struct meminfo *mi)
82{ 81{
83 int smi_sz = parse_tag_smi((const struct tag *)tags); 82 int smi_sz = parse_tag_smi((const struct tag *)tags);
84 83
diff --git a/arch/arm/mach-msm/board-trout-mmc.c b/arch/arm/mach-msm/board-trout-mmc.c
index f7a9724788b0..8650342b7493 100644
--- a/arch/arm/mach-msm/board-trout-mmc.c
+++ b/arch/arm/mach-msm/board-trout-mmc.c
@@ -1,7 +1,7 @@
1/* linux/arch/arm/mach-msm/board-trout-mmc.c 1/* linux/arch/arm/mach-msm/board-trout-mmc.c
2** Author: Brian Swetland <swetland@google.com> 2** Author: Brian Swetland <swetland@google.com>
3*/ 3*/
4 4#include <linux/gpio.h>
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/init.h> 6#include <linux/init.h>
7#include <linux/platform_device.h> 7#include <linux/platform_device.h>
@@ -11,7 +11,6 @@
11#include <linux/err.h> 11#include <linux/err.h>
12#include <linux/debugfs.h> 12#include <linux/debugfs.h>
13 13
14#include <asm/gpio.h>
15#include <asm/io.h> 14#include <asm/io.h>
16 15
17#include <mach/vreg.h> 16#include <mach/vreg.h>
diff --git a/arch/arm/mach-msm/board-trout-panel.c b/arch/arm/mach-msm/board-trout-panel.c
index 729bb49a44ca..25105c1027fe 100644
--- a/arch/arm/mach-msm/board-trout-panel.c
+++ b/arch/arm/mach-msm/board-trout-panel.c
@@ -1,7 +1,7 @@
1/* linux/arch/arm/mach-msm/board-trout-mddi.c 1/* linux/arch/arm/mach-msm/board-trout-mddi.c
2** Author: Brian Swetland <swetland@google.com> 2** Author: Brian Swetland <swetland@google.com>
3*/ 3*/
4 4#include <linux/gpio.h>
5#include <linux/kernel.h> 5#include <linux/kernel.h>
6#include <linux/init.h> 6#include <linux/init.h>
7#include <linux/platform_device.h> 7#include <linux/platform_device.h>
@@ -11,7 +11,6 @@
11#include <linux/err.h> 11#include <linux/err.h>
12 12
13#include <asm/io.h> 13#include <asm/io.h>
14#include <asm/gpio.h>
15#include <asm/mach-types.h> 14#include <asm/mach-types.h>
16 15
17#include <mach/msm_fb.h> 16#include <mach/msm_fb.h>
diff --git a/arch/arm/mach-msm/board-trout.c b/arch/arm/mach-msm/board-trout.c
index 22d5694f5fea..6b9b227c87c5 100644
--- a/arch/arm/mach-msm/board-trout.c
+++ b/arch/arm/mach-msm/board-trout.c
@@ -48,8 +48,8 @@ static void __init trout_init_irq(void)
48 msm_init_irq(); 48 msm_init_irq();
49} 49}
50 50
51static void __init trout_fixup(struct machine_desc *desc, struct tag *tags, 51static void __init trout_fixup(struct tag *tags, char **cmdline,
52 char **cmdline, struct meminfo *mi) 52 struct meminfo *mi)
53{ 53{
54 mi->nr_banks = 1; 54 mi->nr_banks = 1;
55 mi->bank[0].start = PHYS_OFFSET; 55 mi->bank[0].start = PHYS_OFFSET;
diff --git a/arch/arm/mach-msm/clock.c b/arch/arm/mach-msm/clock.c
index 22a537669624..d9145dfc2a3b 100644
--- a/arch/arm/mach-msm/clock.c
+++ b/arch/arm/mach-msm/clock.c
@@ -18,7 +18,7 @@
18#include <linux/list.h> 18#include <linux/list.h>
19#include <linux/err.h> 19#include <linux/err.h>
20#include <linux/spinlock.h> 20#include <linux/spinlock.h>
21#include <linux/pm_qos_params.h> 21#include <linux/pm_qos.h>
22#include <linux/mutex.h> 22#include <linux/mutex.h>
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/string.h> 24#include <linux/string.h>
diff --git a/arch/arm/mach-msm/include/mach/gpio.h b/arch/arm/mach-msm/include/mach/gpio.h
index 36ad50d3bfaa..40a8c178f10d 100644
--- a/arch/arm/mach-msm/include/mach/gpio.h
+++ b/arch/arm/mach-msm/include/mach/gpio.h
@@ -1,26 +1 @@
1/* /* empty */
2 * Copyright (C) 2007 Google, Inc.
3 * Copyright (c) 2009-2010, Code Aurora Forum. All rights reserved.
4 * Author: Mike Lockwood <lockwood@android.com>
5 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 */
16#ifndef __ASM_ARCH_MSM_GPIO_H
17#define __ASM_ARCH_MSM_GPIO_H
18
19#include <asm-generic/gpio.h>
20
21#define gpio_get_value __gpio_get_value
22#define gpio_set_value __gpio_set_value
23#define gpio_cansleep __gpio_cansleep
24#define gpio_to_irq __gpio_to_irq
25
26#endif /* __ASM_ARCH_MSM_GPIO_H */
diff --git a/arch/arm/mach-mv78xx0/Makefile.boot b/arch/arm/mach-mv78xx0/Makefile.boot
index 67039c3e0c48..760a0efe7580 100644
--- a/arch/arm/mach-mv78xx0/Makefile.boot
+++ b/arch/arm/mach-mv78xx0/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-mv78xx0/irq.c b/arch/arm/mach-mv78xx0/irq.c
index 3e24431bb5ea..e421b701663b 100644
--- a/arch/arm/mach-mv78xx0/irq.c
+++ b/arch/arm/mach-mv78xx0/irq.c
@@ -7,12 +7,11 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/pci.h> 13#include <linux/pci.h>
14#include <linux/irq.h> 14#include <linux/irq.h>
15#include <asm/gpio.h>
16#include <mach/bridge-regs.h> 15#include <mach/bridge-regs.h>
17#include <plat/irq.h> 16#include <plat/irq.h>
18#include "common.h" 17#include "common.h"
diff --git a/arch/arm/mach-mv78xx0/mpp.c b/arch/arm/mach-mv78xx0/mpp.c
index 59b7686b9209..cf4e494d44bf 100644
--- a/arch/arm/mach-mv78xx0/mpp.c
+++ b/arch/arm/mach-mv78xx0/mpp.c
@@ -7,13 +7,12 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/mbus.h> 13#include <linux/mbus.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <plat/mpp.h> 15#include <plat/mpp.h>
16#include <asm/gpio.h>
17#include <mach/hardware.h> 16#include <mach/hardware.h>
18#include "common.h" 17#include "common.h"
19#include "mpp.h" 18#include "mpp.h"
diff --git a/arch/arm/mach-mx5/Makefile.boot b/arch/arm/mach-mx5/Makefile.boot
index e928be1b6757..ca207ca305ec 100644
--- a/arch/arm/mach-mx5/Makefile.boot
+++ b/arch/arm/mach-mx5/Makefile.boot
@@ -1,9 +1,9 @@
1 zreladdr-$(CONFIG_ARCH_MX50) := 0x70008000 1 zreladdr-$(CONFIG_ARCH_MX50) += 0x70008000
2params_phys-$(CONFIG_ARCH_MX50) := 0x70000100 2params_phys-$(CONFIG_ARCH_MX50) := 0x70000100
3initrd_phys-$(CONFIG_ARCH_MX50) := 0x70800000 3initrd_phys-$(CONFIG_ARCH_MX50) := 0x70800000
4 zreladdr-$(CONFIG_ARCH_MX51) := 0x90008000 4 zreladdr-$(CONFIG_ARCH_MX51) += 0x90008000
5params_phys-$(CONFIG_ARCH_MX51) := 0x90000100 5params_phys-$(CONFIG_ARCH_MX51) := 0x90000100
6initrd_phys-$(CONFIG_ARCH_MX51) := 0x90800000 6initrd_phys-$(CONFIG_ARCH_MX51) := 0x90800000
7 zreladdr-$(CONFIG_ARCH_MX53) := 0x70008000 7 zreladdr-$(CONFIG_ARCH_MX53) += 0x70008000
8params_phys-$(CONFIG_ARCH_MX53) := 0x70000100 8params_phys-$(CONFIG_ARCH_MX53) := 0x70000100
9initrd_phys-$(CONFIG_ARCH_MX53) := 0x70800000 9initrd_phys-$(CONFIG_ARCH_MX53) := 0x70800000
diff --git a/arch/arm/mach-mxs/Makefile.boot b/arch/arm/mach-mxs/Makefile.boot
index eb541e0291da..07b11fe6453f 100644
--- a/arch/arm/mach-mxs/Makefile.boot
+++ b/arch/arm/mach-mxs/Makefile.boot
@@ -1 +1 @@
zreladdr-y := 0x40008000 zreladdr-y += 0x40008000
diff --git a/arch/arm/mach-mxs/include/mach/gpio.h b/arch/arm/mach-mxs/include/mach/gpio.h
index 828ccccb6aad..bb11e63261e4 100644
--- a/arch/arm/mach-mxs/include/mach/gpio.h
+++ b/arch/arm/mach-mxs/include/mach/gpio.h
@@ -20,16 +20,8 @@
20#ifndef __MACH_MXS_GPIO_H__ 20#ifndef __MACH_MXS_GPIO_H__
21#define __MACH_MXS_GPIO_H__ 21#define __MACH_MXS_GPIO_H__
22 22
23#include <asm-generic/gpio.h>
24
25#define MXS_GPIO_NR(bank, nr) ((bank) * 32 + (nr)) 23#define MXS_GPIO_NR(bank, nr) ((bank) * 32 + (nr))
26 24
27/* use gpiolib dispatchers */
28#define gpio_get_value __gpio_get_value
29#define gpio_set_value __gpio_set_value
30#define gpio_cansleep __gpio_cansleep
31#define gpio_to_irq __gpio_to_irq
32
33#define irq_to_gpio(irq) ((irq) - MXS_GPIO_IRQ_START) 25#define irq_to_gpio(irq) ((irq) - MXS_GPIO_IRQ_START)
34 26
35#endif /* __MACH_MXS_GPIO_H__ */ 27#endif /* __MACH_MXS_GPIO_H__ */
diff --git a/arch/arm/mach-netx/Makefile.boot b/arch/arm/mach-netx/Makefile.boot
index b81cf6aff0ac..534a4d27055e 100644
--- a/arch/arm/mach-netx/Makefile.boot
+++ b/arch/arm/mach-netx/Makefile.boot
@@ -1,2 +1,2 @@
1 zreladdr-y := 0x80008000 1 zreladdr-y += 0x80008000
2 2
diff --git a/arch/arm/mach-nomadik/Makefile.boot b/arch/arm/mach-nomadik/Makefile.boot
index c7e75acfe6c9..ff0a4b5b0a82 100644
--- a/arch/arm/mach-nomadik/Makefile.boot
+++ b/arch/arm/mach-nomadik/Makefile.boot
@@ -1,4 +1,4 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
4 4
diff --git a/arch/arm/mach-nomadik/board-nhk8815.c b/arch/arm/mach-nomadik/board-nhk8815.c
index 398a75f62bee..0cbb74c96ef7 100644
--- a/arch/arm/mach-nomadik/board-nhk8815.c
+++ b/arch/arm/mach-nomadik/board-nhk8815.c
@@ -27,6 +27,7 @@
27#include <asm/mach/irq.h> 27#include <asm/mach/irq.h>
28#include <asm/mach/flash.h> 28#include <asm/mach/flash.h>
29 29
30#include <plat/gpio-nomadik.h>
30#include <plat/mtu.h> 31#include <plat/mtu.h>
31 32
32#include <mach/setup.h> 33#include <mach/setup.h>
diff --git a/arch/arm/mach-nomadik/cpu-8815.c b/arch/arm/mach-nomadik/cpu-8815.c
index ac58e3b03b1a..dc67717db6f0 100644
--- a/arch/arm/mach-nomadik/cpu-8815.c
+++ b/arch/arm/mach-nomadik/cpu-8815.c
@@ -21,8 +21,8 @@
21#include <linux/device.h> 21#include <linux/device.h>
22#include <linux/amba/bus.h> 22#include <linux/amba/bus.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/gpio.h>
25 24
25#include <plat/gpio-nomadik.h>
26#include <mach/hardware.h> 26#include <mach/hardware.h>
27#include <mach/irqs.h> 27#include <mach/irqs.h>
28#include <asm/mach/map.h> 28#include <asm/mach/map.h>
diff --git a/arch/arm/mach-nomadik/i2c-8815nhk.c b/arch/arm/mach-nomadik/i2c-8815nhk.c
index abfe25a08d6b..0fc2f6f1cc97 100644
--- a/arch/arm/mach-nomadik/i2c-8815nhk.c
+++ b/arch/arm/mach-nomadik/i2c-8815nhk.c
@@ -3,8 +3,8 @@
3#include <linux/i2c.h> 3#include <linux/i2c.h>
4#include <linux/i2c-algo-bit.h> 4#include <linux/i2c-algo-bit.h>
5#include <linux/i2c-gpio.h> 5#include <linux/i2c-gpio.h>
6#include <linux/gpio.h>
7#include <linux/platform_device.h> 6#include <linux/platform_device.h>
7#include <plat/gpio-nomadik.h>
8 8
9/* 9/*
10 * There are two busses in the 8815NHK. 10 * There are two busses in the 8815NHK.
diff --git a/arch/arm/mach-nomadik/include/mach/gpio.h b/arch/arm/mach-nomadik/include/mach/gpio.h
index 7a81a0420343..efdde0ae0a4f 100644
--- a/arch/arm/mach-nomadik/include/mach/gpio.h
+++ b/arch/arm/mach-nomadik/include/mach/gpio.h
@@ -1,6 +1,4 @@
1#ifndef __ASM_ARCH_GPIO_H 1#ifndef __ASM_ARCH_GPIO_H
2#define __ASM_ARCH_GPIO_H 2#define __ASM_ARCH_GPIO_H
3 3
4#include <plat/gpio.h>
5
6#endif /* __ASM_ARCH_GPIO_H */ 4#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-nuc93x/Makefile.boot b/arch/arm/mach-nuc93x/Makefile.boot
index a057b546b6e5..6c3d421c2d11 100644
--- a/arch/arm/mach-nuc93x/Makefile.boot
+++ b/arch/arm/mach-nuc93x/Makefile.boot
@@ -1,3 +1,3 @@
1zreladdr-y := 0x00008000 1zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3 3
diff --git a/arch/arm/mach-nuc93x/time.c b/arch/arm/mach-nuc93x/time.c
index 2f90f9dc6e30..f9807c029ec5 100644
--- a/arch/arm/mach-nuc93x/time.c
+++ b/arch/arm/mach-nuc93x/time.c
@@ -82,7 +82,7 @@ static void nuc93x_timer_setup(void)
82 timer0_load = (rate / TICKS_PER_SEC); 82 timer0_load = (rate / TICKS_PER_SEC);
83 __raw_writel(timer0_load, REG_TICR0); 83 __raw_writel(timer0_load, REG_TICR0);
84 84
85 val |= (PERIOD | COUNTEN | INTEN | PRESCALE);; 85 val |= (PERIOD | COUNTEN | INTEN | PRESCALE);
86 __raw_writel(val, REG_TCSR0); 86 __raw_writel(val, REG_TCSR0);
87 87
88} 88}
diff --git a/arch/arm/mach-omap1/Makefile.boot b/arch/arm/mach-omap1/Makefile.boot
index 292d56c5a888..13bda8dbd604 100644
--- a/arch/arm/mach-omap1/Makefile.boot
+++ b/arch/arm/mach-omap1/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x10008000 1 zreladdr-y += 0x10008000
2params_phys-y := 0x10000100 2params_phys-y := 0x10000100
3initrd_phys-y := 0x10800000 3initrd_phys-y := 0x10800000
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index eb36b25450a0..4ea60e2038ea 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -11,7 +11,7 @@
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14#include <linux/gpio.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/input.h> 17#include <linux/input.h>
@@ -30,7 +30,6 @@
30 30
31#include <plat/io.h> 31#include <plat/io.h>
32#include <plat/board-ams-delta.h> 32#include <plat/board-ams-delta.h>
33#include <mach/gpio.h>
34#include <plat/keypad.h> 33#include <plat/keypad.h>
35#include <plat/mux.h> 34#include <plat/mux.h>
36#include <plat/usb.h> 35#include <plat/usb.h>
diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c
index 999789c4811d..31e089b6f03f 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -10,7 +10,7 @@
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13 13#include <linux/gpio.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
@@ -28,7 +28,6 @@
28#include <asm/mach/map.h> 28#include <asm/mach/map.h>
29 29
30#include <plat/tc.h> 30#include <plat/tc.h>
31#include <mach/gpio.h>
32#include <plat/mux.h> 31#include <plat/mux.h>
33#include <plat/flash.h> 32#include <plat/flash.h>
34#include <plat/fpga.h> 33#include <plat/fpga.h>
diff --git a/arch/arm/mach-omap1/board-generic.c b/arch/arm/mach-omap1/board-generic.c
index 23cc9e4ad50d..05c6e9d858f3 100644
--- a/arch/arm/mach-omap1/board-generic.c
+++ b/arch/arm/mach-omap1/board-generic.c
@@ -12,7 +12,7 @@
12 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation. 13 * published by the Free Software Foundation.
14 */ 14 */
15 15#include <linux/gpio.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/init.h> 17#include <linux/init.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
@@ -22,7 +22,6 @@
22#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
23#include <asm/mach/map.h> 23#include <asm/mach/map.h>
24 24
25#include <mach/gpio.h>
26#include <plat/mux.h> 25#include <plat/mux.h>
27#include <plat/usb.h> 26#include <plat/usb.h>
28#include <plat/board.h> 27#include <plat/board.h>
diff --git a/arch/arm/mach-omap1/board-h2-mmc.c b/arch/arm/mach-omap1/board-h2-mmc.c
index f2fc43d8382b..da0e37d40823 100644
--- a/arch/arm/mach-omap1/board-h2-mmc.c
+++ b/arch/arm/mach-omap1/board-h2-mmc.c
@@ -11,13 +11,12 @@
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14#include <linux/gpio.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16 16
17#include <linux/i2c/tps65010.h> 17#include <linux/i2c/tps65010.h>
18 18
19#include <plat/mmc.h> 19#include <plat/mmc.h>
20#include <mach/gpio.h>
21 20
22#include "board-h2.h" 21#include "board-h2.h"
23 22
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index 6c70c28d055c..c2e279173d42 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -18,7 +18,7 @@
18 * it under the terms of the GNU General Public License version 2 as 18 * it under the terms of the GNU General Public License version 2 as
19 * published by the Free Software Foundation. 19 * published by the Free Software Foundation.
20 */ 20 */
21 21#include <linux/gpio.h>
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/platform_device.h> 23#include <linux/platform_device.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
@@ -32,7 +32,6 @@
32#include <linux/smc91x.h> 32#include <linux/smc91x.h>
33 33
34#include <mach/hardware.h> 34#include <mach/hardware.h>
35#include <asm/gpio.h>
36 35
37#include <asm/mach-types.h> 36#include <asm/mach-types.h>
38#include <asm/mach/arch.h> 37#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-omap1/board-h3-mmc.c b/arch/arm/mach-omap1/board-h3-mmc.c
index 2098525e7cc5..f8242aa9b763 100644
--- a/arch/arm/mach-omap1/board-h3-mmc.c
+++ b/arch/arm/mach-omap1/board-h3-mmc.c
@@ -11,13 +11,12 @@
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14#include <linux/gpio.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
16 16
17#include <linux/i2c/tps65010.h> 17#include <linux/i2c/tps65010.h>
18 18
19#include <plat/mmc.h> 19#include <plat/mmc.h>
20#include <mach/gpio.h>
21 20
22#include "board-h3.h" 21#include "board-h3.h"
23 22
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index 8e2b64a46929..8f5b6af7ed59 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -13,7 +13,7 @@
13 * it under the terms of the GNU General Public License version 2 as 13 * it under the terms of the GNU General Public License version 2 as
14 * published by the Free Software Foundation. 14 * published by the Free Software Foundation.
15 */ 15 */
16 16#include <linux/gpio.h>
17#include <linux/types.h> 17#include <linux/types.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/major.h> 19#include <linux/major.h>
@@ -34,7 +34,6 @@
34#include <asm/setup.h> 34#include <asm/setup.h>
35#include <asm/page.h> 35#include <asm/page.h>
36#include <mach/hardware.h> 36#include <mach/hardware.h>
37#include <asm/gpio.h>
38 37
39#include <asm/mach-types.h> 38#include <asm/mach-types.h>
40#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-omap1/board-htcherald.c b/arch/arm/mach-omap1/board-htcherald.c
index e81ead1c89ea..fcd1a3c31896 100644
--- a/arch/arm/mach-omap1/board-htcherald.c
+++ b/arch/arm/mach-omap1/board-htcherald.c
@@ -23,7 +23,6 @@
23 * 02110-1301, USA. 23 * 02110-1301, USA.
24 * 24 *
25 */ 25 */
26
27#include <linux/kernel.h> 26#include <linux/kernel.h>
28#include <linux/init.h> 27#include <linux/init.h>
29#include <linux/platform_device.h> 28#include <linux/platform_device.h>
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index 8b034594fbc7..c2234caf8a7a 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -15,7 +15,7 @@
15 * it under the terms of the GNU General Public License version 2 as 15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation. 16 * published by the Free Software Foundation.
17 */ 17 */
18 18#include <linux/gpio.h>
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/platform_device.h> 21#include <linux/platform_device.h>
@@ -34,7 +34,6 @@
34#include <plat/mux.h> 34#include <plat/mux.h>
35#include <plat/flash.h> 35#include <plat/flash.h>
36#include <plat/fpga.h> 36#include <plat/fpga.h>
37#include <mach/gpio.h>
38#include <plat/tc.h> 37#include <plat/tc.h>
39#include <plat/usb.h> 38#include <plat/usb.h>
40#include <plat/keypad.h> 39#include <plat/keypad.h>
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 6825635ac681..02789c5d3703 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -7,7 +7,7 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/mutex.h> 13#include <linux/mutex.h>
@@ -26,7 +26,6 @@
26#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
27#include <asm/mach/map.h> 27#include <asm/mach/map.h>
28 28
29#include <mach/gpio.h>
30#include <plat/mux.h> 29#include <plat/mux.h>
31#include <plat/usb.h> 30#include <plat/usb.h>
32#include <plat/board.h> 31#include <plat/board.h>
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index 44b8e9362bf4..e4dca1deebb4 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -25,7 +25,7 @@
25 * with this program; if not, write to the Free Software Foundation, Inc., 25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 675 Mass Ave, Cambridge, MA 02139, USA. 26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 */ 27 */
28 28#include <linux/gpio.h>
29#include <linux/kernel.h> 29#include <linux/kernel.h>
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/platform_device.h> 31#include <linux/platform_device.h>
@@ -42,7 +42,6 @@
42#include <linux/i2c/tps65010.h> 42#include <linux/i2c/tps65010.h>
43 43
44#include <mach/hardware.h> 44#include <mach/hardware.h>
45#include <asm/gpio.h>
46 45
47#include <asm/mach-types.h> 46#include <asm/mach-types.h>
48#include <asm/mach/arch.h> 47#include <asm/mach/arch.h>
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index 3d8cd90b1dbb..50c4e398bcc8 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -16,7 +16,7 @@
16 * it under the terms of the GNU General Public License version 2 as 16 * it under the terms of the GNU General Public License version 2 as
17 * published by the Free Software Foundation. 17 * published by the Free Software Foundation.
18 */ 18 */
19 19#include <linux/gpio.h>
20#include <linux/kernel.h> 20#include <linux/kernel.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/input.h> 22#include <linux/input.h>
@@ -33,7 +33,6 @@
33#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
34#include <asm/mach/map.h> 34#include <asm/mach/map.h>
35 35
36#include <mach/gpio.h>
37#include <plat/flash.h> 36#include <plat/flash.h>
38#include <plat/mux.h> 37#include <plat/mux.h>
39#include <plat/usb.h> 38#include <plat/usb.h>
diff --git a/arch/arm/mach-omap1/board-palmtt.c b/arch/arm/mach-omap1/board-palmtt.c
index d0eefe81cd1b..273771cb1b61 100644
--- a/arch/arm/mach-omap1/board-palmtt.c
+++ b/arch/arm/mach-omap1/board-palmtt.c
@@ -12,6 +12,7 @@
12 */ 12 */
13 13
14#include <linux/delay.h> 14#include <linux/delay.h>
15#include <linux/gpio.h>
15#include <linux/kernel.h> 16#include <linux/kernel.h>
16#include <linux/init.h> 17#include <linux/init.h>
17#include <linux/platform_device.h> 18#include <linux/platform_device.h>
@@ -30,7 +31,6 @@
30#include <asm/mach/map.h> 31#include <asm/mach/map.h>
31 32
32#include <plat/led.h> 33#include <plat/led.h>
33#include <mach/gpio.h>
34#include <plat/flash.h> 34#include <plat/flash.h>
35#include <plat/mux.h> 35#include <plat/mux.h>
36#include <plat/usb.h> 36#include <plat/usb.h>
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
index 98e79bc09213..de36ade38ef7 100644
--- a/arch/arm/mach-omap1/board-palmz71.c
+++ b/arch/arm/mach-omap1/board-palmz71.c
@@ -15,6 +15,7 @@
15 */ 15 */
16 16
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/gpio.h>
18#include <linux/kernel.h> 19#include <linux/kernel.h>
19#include <linux/init.h> 20#include <linux/init.h>
20#include <linux/platform_device.h> 21#include <linux/platform_device.h>
@@ -32,7 +33,6 @@
32#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
33#include <asm/mach/map.h> 34#include <asm/mach/map.h>
34 35
35#include <mach/gpio.h>
36#include <plat/flash.h> 36#include <plat/flash.h>
37#include <plat/mux.h> 37#include <plat/mux.h>
38#include <plat/usb.h> 38#include <plat/usb.h>
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index ad3a1567604e..04b1befaced6 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -10,7 +10,7 @@
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13 13#include <linux/gpio.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
@@ -28,7 +28,6 @@
28#include <asm/mach/map.h> 28#include <asm/mach/map.h>
29 29
30#include <plat/tc.h> 30#include <plat/tc.h>
31#include <mach/gpio.h>
32#include <plat/mux.h> 31#include <plat/mux.h>
33#include <plat/fpga.h> 32#include <plat/fpga.h>
34#include <plat/flash.h> 33#include <plat/flash.h>
diff --git a/arch/arm/mach-omap1/board-sx1-mmc.c b/arch/arm/mach-omap1/board-sx1-mmc.c
index e8ddd86e3fda..b59f78850e69 100644
--- a/arch/arm/mach-omap1/board-sx1-mmc.c
+++ b/arch/arm/mach-omap1/board-sx1-mmc.c
@@ -12,11 +12,11 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14 14
15#include <linux/gpio.h>
15#include <linux/platform_device.h> 16#include <linux/platform_device.h>
16 17
17#include <mach/hardware.h> 18#include <mach/hardware.h>
18#include <plat/mmc.h> 19#include <plat/mmc.h>
19#include <mach/gpio.h>
20#include <plat/board-sx1.h> 20#include <plat/board-sx1.h>
21 21
22#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE) 22#if defined(CONFIG_MMC_OMAP) || defined(CONFIG_MMC_OMAP_MODULE)
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c
index 602b55c39d3d..2bea941741d5 100644
--- a/arch/arm/mach-omap1/board-sx1.c
+++ b/arch/arm/mach-omap1/board-sx1.c
@@ -14,7 +14,7 @@
14* it under the terms of the GNU General Public License version 2 as 14* it under the terms of the GNU General Public License version 2 as
15* published by the Free Software Foundation. 15* published by the Free Software Foundation.
16*/ 16*/
17 17#include <linux/gpio.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/input.h> 20#include <linux/input.h>
@@ -32,7 +32,6 @@
32#include <asm/mach/arch.h> 32#include <asm/mach/arch.h>
33#include <asm/mach/map.h> 33#include <asm/mach/map.h>
34 34
35#include <mach/gpio.h>
36#include <plat/flash.h> 35#include <plat/flash.h>
37#include <plat/mux.h> 36#include <plat/mux.h>
38#include <plat/dma.h> 37#include <plat/dma.h>
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index 80165154617a..940faed82be2 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -13,6 +13,7 @@
13 */ 13 */
14 14
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/gpio.h>
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
17#include <linux/interrupt.h> 18#include <linux/interrupt.h>
18#include <linux/irq.h> 19#include <linux/irq.h>
@@ -33,7 +34,6 @@
33 34
34#include <plat/board-voiceblue.h> 35#include <plat/board-voiceblue.h>
35#include <plat/common.h> 36#include <plat/common.h>
36#include <mach/gpio.h>
37#include <plat/flash.h> 37#include <plat/flash.h>
38#include <plat/mux.h> 38#include <plat/mux.h>
39#include <plat/tc.h> 39#include <plat/tc.h>
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c
index 36f26c3fa25e..7c50ecf68123 100644
--- a/arch/arm/mach-omap1/devices.c
+++ b/arch/arm/mach-omap1/devices.c
@@ -10,6 +10,7 @@
10 */ 10 */
11 11
12#include <linux/dma-mapping.h> 12#include <linux/dma-mapping.h>
13#include <linux/gpio.h>
13#include <linux/module.h> 14#include <linux/module.h>
14#include <linux/kernel.h> 15#include <linux/kernel.h>
15#include <linux/init.h> 16#include <linux/init.h>
@@ -24,7 +25,6 @@
24#include <plat/tc.h> 25#include <plat/tc.h>
25#include <plat/board.h> 26#include <plat/board.h>
26#include <plat/mux.h> 27#include <plat/mux.h>
27#include <mach/gpio.h>
28#include <plat/mmc.h> 28#include <plat/mmc.h>
29#include <plat/omap7xx.h> 29#include <plat/omap7xx.h>
30#include <plat/mcbsp.h> 30#include <plat/mcbsp.h>
diff --git a/arch/arm/mach-omap1/fpga.c b/arch/arm/mach-omap1/fpga.c
index cddbf8b089ce..0a17a1a7e00d 100644
--- a/arch/arm/mach-omap1/fpga.c
+++ b/arch/arm/mach-omap1/fpga.c
@@ -17,6 +17,7 @@
17 */ 17 */
18 18
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/gpio.h>
20#include <linux/init.h> 21#include <linux/init.h>
21#include <linux/kernel.h> 22#include <linux/kernel.h>
22#include <linux/device.h> 23#include <linux/device.h>
@@ -28,7 +29,6 @@
28#include <asm/mach/irq.h> 29#include <asm/mach/irq.h>
29 30
30#include <plat/fpga.h> 31#include <plat/fpga.h>
31#include <mach/gpio.h>
32 32
33static void fpga_mask_irq(struct irq_data *d) 33static void fpga_mask_irq(struct irq_data *d)
34{ 34{
diff --git a/arch/arm/mach-omap1/irq.c b/arch/arm/mach-omap1/irq.c
index e2b9c901ab67..e5b104b7fce6 100644
--- a/arch/arm/mach-omap1/irq.c
+++ b/arch/arm/mach-omap1/irq.c
@@ -35,7 +35,7 @@
35 * with this program; if not, write to the Free Software Foundation, Inc., 35 * with this program; if not, write to the Free Software Foundation, Inc.,
36 * 675 Mass Ave, Cambridge, MA 02139, USA. 36 * 675 Mass Ave, Cambridge, MA 02139, USA.
37 */ 37 */
38 38#include <linux/gpio.h>
39#include <linux/init.h> 39#include <linux/init.h>
40#include <linux/module.h> 40#include <linux/module.h>
41#include <linux/sched.h> 41#include <linux/sched.h>
@@ -45,7 +45,6 @@
45#include <mach/hardware.h> 45#include <mach/hardware.h>
46#include <asm/irq.h> 46#include <asm/irq.h>
47#include <asm/mach/irq.h> 47#include <asm/mach/irq.h>
48#include <mach/gpio.h>
49#include <plat/cpu.h> 48#include <plat/cpu.h>
50 49
51#define IRQ_BANK(irq) ((irq) >> 5) 50#define IRQ_BANK(irq) ((irq) >> 5)
diff --git a/arch/arm/mach-omap1/leds-h2p2-debug.c b/arch/arm/mach-omap1/leds-h2p2-debug.c
index b4f9be52e1e8..4b818eb9f911 100644
--- a/arch/arm/mach-omap1/leds-h2p2-debug.c
+++ b/arch/arm/mach-omap1/leds-h2p2-debug.c
@@ -9,6 +9,7 @@
9 * The "surfer" expansion board and H2 sample board also have two-color 9 * The "surfer" expansion board and H2 sample board also have two-color
10 * green+red LEDs (in parallel), used here for timer and idle indicators. 10 * green+red LEDs (in parallel), used here for timer and idle indicators.
11 */ 11 */
12#include <linux/gpio.h>
12#include <linux/init.h> 13#include <linux/init.h>
13#include <linux/kernel_stat.h> 14#include <linux/kernel_stat.h>
14#include <linux/sched.h> 15#include <linux/sched.h>
@@ -20,7 +21,6 @@
20#include <asm/mach-types.h> 21#include <asm/mach-types.h>
21 22
22#include <plat/fpga.h> 23#include <plat/fpga.h>
23#include <mach/gpio.h>
24 24
25#include "leds.h" 25#include "leds.h"
26 26
diff --git a/arch/arm/mach-omap1/leds-osk.c b/arch/arm/mach-omap1/leds-osk.c
index 499d7ad8697d..da09f4364979 100644
--- a/arch/arm/mach-omap1/leds-osk.c
+++ b/arch/arm/mach-omap1/leds-osk.c
@@ -3,14 +3,13 @@
3 * 3 *
4 * LED driver for OSK with optional Mistral QVGA board 4 * LED driver for OSK with optional Mistral QVGA board
5 */ 5 */
6#include <linux/gpio.h>
6#include <linux/init.h> 7#include <linux/init.h>
7 8
8#include <mach/hardware.h> 9#include <mach/hardware.h>
9#include <asm/leds.h> 10#include <asm/leds.h>
10#include <asm/system.h> 11#include <asm/system.h>
11 12
12#include <mach/gpio.h>
13
14#include "leds.h" 13#include "leds.h"
15 14
16 15
diff --git a/arch/arm/mach-omap1/leds.c b/arch/arm/mach-omap1/leds.c
index 22eb11dde9e7..ae6dd93b8ddc 100644
--- a/arch/arm/mach-omap1/leds.c
+++ b/arch/arm/mach-omap1/leds.c
@@ -3,13 +3,13 @@
3 * 3 *
4 * OMAP LEDs dispatcher 4 * OMAP LEDs dispatcher
5 */ 5 */
6#include <linux/gpio.h>
6#include <linux/kernel.h> 7#include <linux/kernel.h>
7#include <linux/init.h> 8#include <linux/init.h>
8 9
9#include <asm/leds.h> 10#include <asm/leds.h>
10#include <asm/mach-types.h> 11#include <asm/mach-types.h>
11 12
12#include <mach/gpio.h>
13#include <plat/mux.h> 13#include <plat/mux.h>
14 14
15#include "leds.h" 15#include "leds.h"
diff --git a/arch/arm/mach-omap1/pm_bus.c b/arch/arm/mach-omap1/pm_bus.c
index 943072d5a1d5..7868e75ad077 100644
--- a/arch/arm/mach-omap1/pm_bus.c
+++ b/arch/arm/mach-omap1/pm_bus.c
@@ -13,6 +13,7 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/io.h> 14#include <linux/io.h>
15#include <linux/pm_runtime.h> 15#include <linux/pm_runtime.h>
16#include <linux/pm_clock.h>
16#include <linux/platform_device.h> 17#include <linux/platform_device.h>
17#include <linux/mutex.h> 18#include <linux/mutex.h>
18#include <linux/clk.h> 19#include <linux/clk.h>
diff --git a/arch/arm/mach-omap1/serial.c b/arch/arm/mach-omap1/serial.c
index 550ca9d9991d..93ae8f29727e 100644
--- a/arch/arm/mach-omap1/serial.c
+++ b/arch/arm/mach-omap1/serial.c
@@ -7,7 +7,7 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/module.h> 11#include <linux/module.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/init.h> 13#include <linux/init.h>
@@ -24,7 +24,6 @@
24 24
25#include <plat/board.h> 25#include <plat/board.h>
26#include <plat/mux.h> 26#include <plat/mux.h>
27#include <mach/gpio.h>
28#include <plat/fpga.h> 27#include <plat/fpga.h>
29 28
30#include "pm.h" 29#include "pm.h"
diff --git a/arch/arm/mach-omap2/Kconfig b/arch/arm/mach-omap2/Kconfig
index 57b66d590c52..89bfb49389f2 100644
--- a/arch/arm/mach-omap2/Kconfig
+++ b/arch/arm/mach-omap2/Kconfig
@@ -36,6 +36,7 @@ config ARCH_OMAP3
36 select ARM_L1_CACHE_SHIFT_6 if !ARCH_OMAP4 36 select ARM_L1_CACHE_SHIFT_6 if !ARCH_OMAP4
37 select ARCH_HAS_OPP 37 select ARCH_HAS_OPP
38 select PM_OPP if PM 38 select PM_OPP if PM
39 select ARM_CPU_SUSPEND if PM
39 40
40config ARCH_OMAP4 41config ARCH_OMAP4
41 bool "TI OMAP4" 42 bool "TI OMAP4"
@@ -50,6 +51,7 @@ config ARCH_OMAP4
50 select ARCH_HAS_OPP 51 select ARCH_HAS_OPP
51 select PM_OPP if PM 52 select PM_OPP if PM
52 select USB_ARCH_HAS_EHCI 53 select USB_ARCH_HAS_EHCI
54 select ARM_CPU_SUSPEND if PM
53 55
54comment "OMAP Core Type" 56comment "OMAP Core Type"
55 depends on ARCH_OMAP2 57 depends on ARCH_OMAP2
diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
index f34336560437..7317a2b39dd1 100644
--- a/arch/arm/mach-omap2/Makefile
+++ b/arch/arm/mach-omap2/Makefile
@@ -242,14 +242,11 @@ obj-$(CONFIG_MACH_IGEP0020) += board-igep0020.o \
242obj-$(CONFIG_MACH_OMAP3_TOUCHBOOK) += board-omap3touchbook.o \ 242obj-$(CONFIG_MACH_OMAP3_TOUCHBOOK) += board-omap3touchbook.o \
243 hsmmc.o 243 hsmmc.o
244obj-$(CONFIG_MACH_OMAP_4430SDP) += board-4430sdp.o \ 244obj-$(CONFIG_MACH_OMAP_4430SDP) += board-4430sdp.o \
245 hsmmc.o \ 245 hsmmc.o
246 omap_phy_internal.o
247obj-$(CONFIG_MACH_OMAP4_PANDA) += board-omap4panda.o \ 246obj-$(CONFIG_MACH_OMAP4_PANDA) += board-omap4panda.o \
248 hsmmc.o \ 247 hsmmc.o
249 omap_phy_internal.o
250 248
251obj-$(CONFIG_MACH_OMAP3517EVM) += board-am3517evm.o \ 249obj-$(CONFIG_MACH_OMAP3517EVM) += board-am3517evm.o
252 omap_phy_internal.o \
253 250
254obj-$(CONFIG_MACH_CRANEBOARD) += board-am3517crane.o 251obj-$(CONFIG_MACH_CRANEBOARD) += board-am3517crane.o
255 252
@@ -260,6 +257,8 @@ obj-$(CONFIG_MACH_TI8168EVM) += board-ti8168evm.o
260usbfs-$(CONFIG_ARCH_OMAP_OTG) := usb-fs.o 257usbfs-$(CONFIG_ARCH_OMAP_OTG) := usb-fs.o
261obj-y += $(usbfs-m) $(usbfs-y) 258obj-y += $(usbfs-m) $(usbfs-y)
262obj-y += usb-musb.o 259obj-y += usb-musb.o
260obj-y += omap_phy_internal.o
261
263obj-$(CONFIG_MACH_OMAP2_TUSB6010) += usb-tusb6010.o 262obj-$(CONFIG_MACH_OMAP2_TUSB6010) += usb-tusb6010.o
264obj-y += usb-host.o 263obj-y += usb-host.o
265 264
diff --git a/arch/arm/mach-omap2/Makefile.boot b/arch/arm/mach-omap2/Makefile.boot
index 565aff7f37a9..b03e562acc60 100644
--- a/arch/arm/mach-omap2/Makefile.boot
+++ b/arch/arm/mach-omap2/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x80008000 1 zreladdr-y += 0x80008000
2params_phys-y := 0x80000100 2params_phys-y := 0x80000100
3initrd_phys-y := 0x80800000 3initrd_phys-y := 0x80800000
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
index 195157da21e6..87f43ade4405 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -193,7 +193,8 @@ static int __init omap2430_i2c_init(void)
193{ 193{
194 omap_register_i2c_bus(1, 100, sdp2430_i2c1_boardinfo, 194 omap_register_i2c_bus(1, 100, sdp2430_i2c1_boardinfo,
195 ARRAY_SIZE(sdp2430_i2c1_boardinfo)); 195 ARRAY_SIZE(sdp2430_i2c1_boardinfo));
196 omap2_pmic_init("twl4030", &sdp2430_twldata); 196 omap_pmic_init(2, 100, "twl4030", INT_24XX_SYS_NIRQ,
197 &sdp2430_twldata);
197 return 0; 198 return 0;
198} 199}
199 200
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 25642697281b..4431ad364565 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -15,7 +15,7 @@
15 * it under the terms of the GNU General Public License version 2 as 15 * it under the terms of the GNU General Public License version 2 as
16 * published by the Free Software Foundation. 16 * published by the Free Software Foundation.
17 */ 17 */
18 18#include <linux/gpio.h>
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/device.h> 21#include <linux/device.h>
@@ -25,7 +25,6 @@
25#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
26#include <asm/mach/map.h> 26#include <asm/mach/map.h>
27 27
28#include <mach/gpio.h>
29#include <plat/usb.h> 28#include <plat/usb.h>
30#include <plat/board.h> 29#include <plat/board.h>
31#include <plat/common.h> 30#include <plat/common.h>
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index a58c6ba06f7f..82421a4cfa92 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -10,7 +10,7 @@
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13 13#include <linux/gpio.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
@@ -31,7 +31,6 @@
31#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
32#include <asm/mach/map.h> 32#include <asm/mach/map.h>
33 33
34#include <mach/gpio.h>
35#include <plat/usb.h> 34#include <plat/usb.h>
36#include <plat/board.h> 35#include <plat/board.h>
37#include <plat/common.h> 36#include <plat/common.h>
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index edf752bb24b1..abe8c7e496a2 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -10,7 +10,7 @@
10 * it under the terms of the GNU General Public License version 2 as 10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 */ 12 */
13 13#include <linux/gpio.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
@@ -34,7 +34,6 @@
34#include <asm/mach/map.h> 34#include <asm/mach/map.h>
35 35
36#include <plat/mcspi.h> 36#include <plat/mcspi.h>
37#include <mach/gpio.h>
38#include <plat/board.h> 37#include <plat/board.h>
39#include <plat/common.h> 38#include <plat/common.h>
40#include <plat/gpmc.h> 39#include <plat/gpmc.h>
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 1077ad663f93..5391079c8689 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -8,7 +8,7 @@
8 * the Free Software Foundation; either version 2 of the License, or 8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version. 9 * (at your option) any later version.
10 */ 10 */
11 11#include <linux/gpio.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
@@ -26,7 +26,6 @@
26#include <plat/tc.h> 26#include <plat/tc.h>
27#include <plat/board.h> 27#include <plat/board.h>
28#include <plat/mcbsp.h> 28#include <plat/mcbsp.h>
29#include <mach/gpio.h>
30#include <plat/mmc.h> 29#include <plat/mmc.h>
31#include <plat/dma.h> 30#include <plat/dma.h>
32#include <plat/omap_hwmod.h> 31#include <plat/omap_hwmod.h>
diff --git a/arch/arm/mach-omap2/hsmmc.c b/arch/arm/mach-omap2/hsmmc.c
index a9b45c76e1d3..097a42d81e59 100644
--- a/arch/arm/mach-omap2/hsmmc.c
+++ b/arch/arm/mach-omap2/hsmmc.c
@@ -137,8 +137,7 @@ static void omap4_hsmmc1_before_set_reg(struct device *dev, int slot,
137 */ 137 */
138 reg = omap4_ctrl_pad_readl(control_pbias_offset); 138 reg = omap4_ctrl_pad_readl(control_pbias_offset);
139 reg &= ~(OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK | 139 reg &= ~(OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK |
140 OMAP4_MMC1_PWRDNZ_MASK | 140 OMAP4_MMC1_PWRDNZ_MASK);
141 OMAP4_USBC1_ICUSB_PWRDNZ_MASK);
142 omap4_ctrl_pad_writel(reg, control_pbias_offset); 141 omap4_ctrl_pad_writel(reg, control_pbias_offset);
143} 142}
144 143
@@ -156,8 +155,7 @@ static void omap4_hsmmc1_after_set_reg(struct device *dev, int slot,
156 else 155 else
157 reg |= OMAP4_MMC1_PBIASLITE_VMODE_MASK; 156 reg |= OMAP4_MMC1_PBIASLITE_VMODE_MASK;
158 reg |= (OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK | 157 reg |= (OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK |
159 OMAP4_MMC1_PWRDNZ_MASK | 158 OMAP4_MMC1_PWRDNZ_MASK);
160 OMAP4_USBC1_ICUSB_PWRDNZ_MASK);
161 omap4_ctrl_pad_writel(reg, control_pbias_offset); 159 omap4_ctrl_pad_writel(reg, control_pbias_offset);
162 160
163 timeout = jiffies + msecs_to_jiffies(5); 161 timeout = jiffies + msecs_to_jiffies(5);
@@ -171,16 +169,14 @@ static void omap4_hsmmc1_after_set_reg(struct device *dev, int slot,
171 if (reg & OMAP4_MMC1_PBIASLITE_VMODE_ERROR_MASK) { 169 if (reg & OMAP4_MMC1_PBIASLITE_VMODE_ERROR_MASK) {
172 pr_err("Pbias Voltage is not same as LDO\n"); 170 pr_err("Pbias Voltage is not same as LDO\n");
173 /* Caution : On VMODE_ERROR Power Down MMC IO */ 171 /* Caution : On VMODE_ERROR Power Down MMC IO */
174 reg &= ~(OMAP4_MMC1_PWRDNZ_MASK | 172 reg &= ~(OMAP4_MMC1_PWRDNZ_MASK);
175 OMAP4_USBC1_ICUSB_PWRDNZ_MASK);
176 omap4_ctrl_pad_writel(reg, control_pbias_offset); 173 omap4_ctrl_pad_writel(reg, control_pbias_offset);
177 } 174 }
178 } else { 175 } else {
179 reg = omap4_ctrl_pad_readl(control_pbias_offset); 176 reg = omap4_ctrl_pad_readl(control_pbias_offset);
180 reg |= (OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK | 177 reg |= (OMAP4_MMC1_PBIASLITE_PWRDNZ_MASK |
181 OMAP4_MMC1_PWRDNZ_MASK | 178 OMAP4_MMC1_PWRDNZ_MASK |
182 OMAP4_MMC1_PBIASLITE_VMODE_MASK | 179 OMAP4_MMC1_PBIASLITE_VMODE_MASK);
183 OMAP4_USBC1_ICUSB_PWRDNZ_MASK);
184 omap4_ctrl_pad_writel(reg, control_pbias_offset); 180 omap4_ctrl_pad_writel(reg, control_pbias_offset);
185 } 181 }
186} 182}
diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c
index 34c01a7de810..f49804f181d4 100644
--- a/arch/arm/mach-omap2/smartreflex.c
+++ b/arch/arm/mach-omap2/smartreflex.c
@@ -247,7 +247,7 @@ static void sr_stop_vddautocomp(struct omap_sr *sr)
247 * driver register and sr device intializtion API's. Only one call 247 * driver register and sr device intializtion API's. Only one call
248 * will ultimately succeed. 248 * will ultimately succeed.
249 * 249 *
250 * Currently this function registers interrrupt handler for a particular SR 250 * Currently this function registers interrupt handler for a particular SR
251 * if smartreflex class driver is already registered and has 251 * if smartreflex class driver is already registered and has
252 * requested for interrupts and the SR interrupt line in present. 252 * requested for interrupts and the SR interrupt line in present.
253 */ 253 */
diff --git a/arch/arm/mach-omap2/usb-musb.c b/arch/arm/mach-omap2/usb-musb.c
index a65145b02a55..19e4dac62a8c 100644
--- a/arch/arm/mach-omap2/usb-musb.c
+++ b/arch/arm/mach-omap2/usb-musb.c
@@ -137,9 +137,6 @@ void __init usb_musb_init(struct omap_musb_board_data *musb_board_data)
137 musb_plat.mode = board_data->mode; 137 musb_plat.mode = board_data->mode;
138 musb_plat.extvbus = board_data->extvbus; 138 musb_plat.extvbus = board_data->extvbus;
139 139
140 if (cpu_is_omap44xx())
141 omap4430_phy_init(dev);
142
143 if (cpu_is_omap3517() || cpu_is_omap3505()) { 140 if (cpu_is_omap3517() || cpu_is_omap3505()) {
144 oh_name = "am35x_otg_hs"; 141 oh_name = "am35x_otg_hs";
145 name = "musb-am35x"; 142 name = "musb-am35x";
diff --git a/arch/arm/mach-orion5x/Makefile.boot b/arch/arm/mach-orion5x/Makefile.boot
index 67039c3e0c48..760a0efe7580 100644
--- a/arch/arm/mach-orion5x/Makefile.boot
+++ b/arch/arm/mach-orion5x/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-orion5x/common.c b/arch/arm/mach-orion5x/common.c
index 0ab531d047fc..22ace0bf2f92 100644
--- a/arch/arm/mach-orion5x/common.c
+++ b/arch/arm/mach-orion5x/common.c
@@ -308,8 +308,8 @@ void __init orion5x_init(void)
308 * Many orion-based systems have buggy bootloader implementations. 308 * Many orion-based systems have buggy bootloader implementations.
309 * This is a common fixup for bogus memory tags. 309 * This is a common fixup for bogus memory tags.
310 */ 310 */
311void __init tag_fixup_mem32(struct machine_desc *mdesc, struct tag *t, 311void __init tag_fixup_mem32(struct tag *t, char **from,
312 char **from, struct meminfo *meminfo) 312 struct meminfo *meminfo)
313{ 313{
314 for (; t->hdr.size; t = tag_next(t)) 314 for (; t->hdr.size; t = tag_next(t))
315 if (t->hdr.tag == ATAG_MEM && 315 if (t->hdr.tag == ATAG_MEM &&
diff --git a/arch/arm/mach-orion5x/common.h b/arch/arm/mach-orion5x/common.h
index 3e5499dda49a..909489f4d23e 100644
--- a/arch/arm/mach-orion5x/common.h
+++ b/arch/arm/mach-orion5x/common.h
@@ -53,11 +53,9 @@ int orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys);
53struct pci_bus *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys); 53struct pci_bus *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys);
54int orion5x_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin); 54int orion5x_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin);
55 55
56struct machine_desc;
57struct meminfo; 56struct meminfo;
58struct tag; 57struct tag;
59extern void __init tag_fixup_mem32(struct machine_desc *, struct tag *, 58extern void __init tag_fixup_mem32(struct tag *, char **, struct meminfo *);
60 char **, struct meminfo *);
61 59
62 60
63#endif 61#endif
diff --git a/arch/arm/mach-orion5x/db88f5281-setup.c b/arch/arm/mach-orion5x/db88f5281-setup.c
index 88432aba972c..4b79a80d5e1f 100644
--- a/arch/arm/mach-orion5x/db88f5281-setup.c
+++ b/arch/arm/mach-orion5x/db88f5281-setup.c
@@ -9,7 +9,7 @@
9 * License version 2. This program is licensed "as is" without any 9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied. 10 * warranty of any kind, whether express or implied.
11 */ 11 */
12 12#include <linux/gpio.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
@@ -21,7 +21,6 @@
21#include <linux/mv643xx_eth.h> 21#include <linux/mv643xx_eth.h>
22#include <linux/i2c.h> 22#include <linux/i2c.h>
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24#include <asm/gpio.h>
25#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
26#include <asm/mach/pci.h> 25#include <asm/mach/pci.h>
27#include <mach/orion5x.h> 26#include <mach/orion5x.h>
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
index 9e5c1663fc4f..343f60e9639f 100644
--- a/arch/arm/mach-orion5x/dns323-setup.c
+++ b/arch/arm/mach-orion5x/dns323-setup.c
@@ -13,7 +13,7 @@
13 * License, or (at your option) any later version. 13 * License, or (at your option) any later version.
14 * 14 *
15 */ 15 */
16 16#include <linux/gpio.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/delay.h> 19#include <linux/delay.h>
@@ -30,7 +30,6 @@
30#include <linux/phy.h> 30#include <linux/phy.h>
31#include <linux/marvell_phy.h> 31#include <linux/marvell_phy.h>
32#include <asm/mach-types.h> 32#include <asm/mach-types.h>
33#include <asm/gpio.h>
34#include <asm/mach/arch.h> 33#include <asm/mach/arch.h>
35#include <asm/mach/pci.h> 34#include <asm/mach/pci.h>
36#include <mach/orion5x.h> 35#include <mach/orion5x.h>
diff --git a/arch/arm/mach-orion5x/irq.c b/arch/arm/mach-orion5x/irq.c
index 43cf8bc9767b..b1b45fff776e 100644
--- a/arch/arm/mach-orion5x/irq.c
+++ b/arch/arm/mach-orion5x/irq.c
@@ -9,12 +9,11 @@
9 * License version 2. This program is licensed "as is" without any 9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied. 10 * warranty of any kind, whether express or implied.
11 */ 11 */
12 12#include <linux/gpio.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/irq.h> 15#include <linux/irq.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <asm/gpio.h>
18#include <mach/bridge-regs.h> 17#include <mach/bridge-regs.h>
19#include <plat/irq.h> 18#include <plat/irq.h>
20#include "common.h" 19#include "common.h"
diff --git a/arch/arm/mach-orion5x/kurobox_pro-setup.c b/arch/arm/mach-orion5x/kurobox_pro-setup.c
index 9115511dc035..d3cd3f63258a 100644
--- a/arch/arm/mach-orion5x/kurobox_pro-setup.c
+++ b/arch/arm/mach-orion5x/kurobox_pro-setup.c
@@ -7,7 +7,7 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
@@ -21,7 +21,6 @@
21#include <linux/serial_reg.h> 21#include <linux/serial_reg.h>
22#include <linux/ata_platform.h> 22#include <linux/ata_platform.h>
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24#include <asm/gpio.h>
25#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
26#include <asm/mach/pci.h> 25#include <asm/mach/pci.h>
27#include <mach/orion5x.h> 26#include <mach/orion5x.h>
diff --git a/arch/arm/mach-orion5x/mv2120-setup.c b/arch/arm/mach-orion5x/mv2120-setup.c
index b3356ada64b9..201ae3676289 100644
--- a/arch/arm/mach-orion5x/mv2120-setup.c
+++ b/arch/arm/mach-orion5x/mv2120-setup.c
@@ -7,7 +7,7 @@
7 * published by the Free Software Foundation; either version 2 of the 7 * published by the Free Software Foundation; either version 2 of the
8 * License, or (at your option) any later version. 8 * License, or (at your option) any later version.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
@@ -20,7 +20,6 @@
20#include <linux/i2c.h> 20#include <linux/i2c.h>
21#include <linux/ata_platform.h> 21#include <linux/ata_platform.h>
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/gpio.h>
24#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
25#include <mach/orion5x.h> 24#include <mach/orion5x.h>
26#include "common.h" 25#include "common.h"
diff --git a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
index 8c876664f494..ebd6767d8e88 100644
--- a/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5181l-fxo-setup.c
@@ -7,7 +7,7 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
@@ -18,7 +18,6 @@
18#include <linux/ethtool.h> 18#include <linux/ethtool.h>
19#include <net/dsa.h> 19#include <net/dsa.h>
20#include <asm/mach-types.h> 20#include <asm/mach-types.h>
21#include <asm/gpio.h>
22#include <asm/leds.h> 21#include <asm/leds.h>
23#include <asm/mach/arch.h> 22#include <asm/mach/arch.h>
24#include <asm/mach/pci.h> 23#include <asm/mach/pci.h>
diff --git a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
index 994644f59d8d..05db2d336b08 100644
--- a/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5181l-ge-setup.c
@@ -7,7 +7,7 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
@@ -19,7 +19,6 @@
19#include <linux/i2c.h> 19#include <linux/i2c.h>
20#include <net/dsa.h> 20#include <net/dsa.h>
21#include <asm/mach-types.h> 21#include <asm/mach-types.h>
22#include <asm/gpio.h>
23#include <asm/leds.h> 22#include <asm/leds.h>
24#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
25#include <asm/mach/pci.h> 24#include <asm/mach/pci.h>
diff --git a/arch/arm/mach-orion5x/rd88f5182-setup.c b/arch/arm/mach-orion5x/rd88f5182-setup.c
index 1903d25ecae9..e47fa0578ae3 100644
--- a/arch/arm/mach-orion5x/rd88f5182-setup.c
+++ b/arch/arm/mach-orion5x/rd88f5182-setup.c
@@ -9,7 +9,7 @@
9 * License version 2. This program is licensed "as is" without any 9 * License version 2. This program is licensed "as is" without any
10 * warranty of any kind, whether express or implied. 10 * warranty of any kind, whether express or implied.
11 */ 11 */
12 12#include <linux/gpio.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
15#include <linux/platform_device.h> 15#include <linux/platform_device.h>
@@ -20,7 +20,6 @@
20#include <linux/ata_platform.h> 20#include <linux/ata_platform.h>
21#include <linux/i2c.h> 21#include <linux/i2c.h>
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/gpio.h>
24#include <asm/leds.h> 23#include <asm/leds.h>
25#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
26#include <asm/mach/pci.h> 25#include <asm/mach/pci.h>
diff --git a/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c b/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c
index e06fdae77f0a..64317251ec00 100644
--- a/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c
+++ b/arch/arm/mach-orion5x/rd88f6183ap-ge-setup.c
@@ -7,7 +7,7 @@
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied. 8 * warranty of any kind, whether express or implied.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
@@ -21,7 +21,6 @@
21#include <linux/ethtool.h> 21#include <linux/ethtool.h>
22#include <net/dsa.h> 22#include <net/dsa.h>
23#include <asm/mach-types.h> 23#include <asm/mach-types.h>
24#include <asm/gpio.h>
25#include <asm/leds.h> 24#include <asm/leds.h>
26#include <asm/mach/arch.h> 25#include <asm/mach/arch.h>
27#include <asm/mach/pci.h> 26#include <asm/mach/pci.h>
diff --git a/arch/arm/mach-orion5x/terastation_pro2-setup.c b/arch/arm/mach-orion5x/terastation_pro2-setup.c
index 306183273eb9..29f1526f7b70 100644
--- a/arch/arm/mach-orion5x/terastation_pro2-setup.c
+++ b/arch/arm/mach-orion5x/terastation_pro2-setup.c
@@ -8,7 +8,7 @@
8 * as published by the Free Software Foundation; either version 8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11#include <linux/gpio.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
@@ -20,7 +20,6 @@
20#include <linux/i2c.h> 20#include <linux/i2c.h>
21#include <linux/serial_reg.h> 21#include <linux/serial_reg.h>
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/gpio.h>
24#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
25#include <asm/mach/pci.h> 24#include <asm/mach/pci.h>
26#include <mach/orion5x.h> 25#include <mach/orion5x.h>
diff --git a/arch/arm/mach-orion5x/ts209-setup.c b/arch/arm/mach-orion5x/ts209-setup.c
index 3dbcd5ed77ef..31e51f9b4b64 100644
--- a/arch/arm/mach-orion5x/ts209-setup.c
+++ b/arch/arm/mach-orion5x/ts209-setup.c
@@ -8,7 +8,7 @@
8 * as published by the Free Software Foundation; either version 8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version. 9 * 2 of the License, or (at your option) any later version.
10 */ 10 */
11 11#include <linux/gpio.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
@@ -23,7 +23,6 @@
23#include <linux/serial_reg.h> 23#include <linux/serial_reg.h>
24#include <linux/ata_platform.h> 24#include <linux/ata_platform.h>
25#include <asm/mach-types.h> 25#include <asm/mach-types.h>
26#include <asm/gpio.h>
27#include <asm/mach/arch.h> 26#include <asm/mach/arch.h>
28#include <asm/mach/pci.h> 27#include <asm/mach/pci.h>
29#include <mach/orion5x.h> 28#include <mach/orion5x.h>
diff --git a/arch/arm/mach-orion5x/ts409-setup.c b/arch/arm/mach-orion5x/ts409-setup.c
index 23c9e2e5e550..0fbcc14e09d7 100644
--- a/arch/arm/mach-orion5x/ts409-setup.c
+++ b/arch/arm/mach-orion5x/ts409-setup.c
@@ -11,7 +11,7 @@
11 * as published by the Free Software Foundation; either version 11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version. 12 * 2 of the License, or (at your option) any later version.
13 */ 13 */
14 14#include <linux/gpio.h>
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
@@ -25,7 +25,6 @@
25#include <linux/i2c.h> 25#include <linux/i2c.h>
26#include <linux/serial_reg.h> 26#include <linux/serial_reg.h>
27#include <asm/mach-types.h> 27#include <asm/mach-types.h>
28#include <asm/gpio.h>
29#include <asm/mach/arch.h> 28#include <asm/mach/arch.h>
30#include <asm/mach/pci.h> 29#include <asm/mach/pci.h>
31#include <mach/orion5x.h> 30#include <mach/orion5x.h>
diff --git a/arch/arm/mach-orion5x/wnr854t-setup.c b/arch/arm/mach-orion5x/wnr854t-setup.c
index 1c63a76f3ca3..b8be7d8d0cf4 100644
--- a/arch/arm/mach-orion5x/wnr854t-setup.c
+++ b/arch/arm/mach-orion5x/wnr854t-setup.c
@@ -5,7 +5,7 @@
5 * License version 2. This program is licensed "as is" without any 5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied. 6 * warranty of any kind, whether express or implied.
7 */ 7 */
8 8#include <linux/gpio.h>
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/init.h> 10#include <linux/init.h>
11#include <linux/platform_device.h> 11#include <linux/platform_device.h>
@@ -17,7 +17,6 @@
17#include <linux/ethtool.h> 17#include <linux/ethtool.h>
18#include <net/dsa.h> 18#include <net/dsa.h>
19#include <asm/mach-types.h> 19#include <asm/mach-types.h>
20#include <asm/gpio.h>
21#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
22#include <asm/mach/pci.h> 21#include <asm/mach/pci.h>
23#include <mach/orion5x.h> 22#include <mach/orion5x.h>
diff --git a/arch/arm/mach-orion5x/wrt350n-v2-setup.c b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
index 4fd9f18c9d5d..faf81a039360 100644
--- a/arch/arm/mach-orion5x/wrt350n-v2-setup.c
+++ b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
@@ -5,7 +5,7 @@
5 * License version 2. This program is licensed "as is" without any 5 * License version 2. This program is licensed "as is" without any
6 * warranty of any kind, whether express or implied. 6 * warranty of any kind, whether express or implied.
7 */ 7 */
8 8#include <linux/gpio.h>
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/init.h> 10#include <linux/init.h>
11#include <linux/platform_device.h> 11#include <linux/platform_device.h>
@@ -20,7 +20,6 @@
20#include <linux/input.h> 20#include <linux/input.h>
21#include <net/dsa.h> 21#include <net/dsa.h>
22#include <asm/mach-types.h> 22#include <asm/mach-types.h>
23#include <asm/gpio.h>
24#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
25#include <asm/mach/pci.h> 24#include <asm/mach/pci.h>
26#include <mach/orion5x.h> 25#include <mach/orion5x.h>
diff --git a/arch/arm/mach-pnx4008/Makefile.boot b/arch/arm/mach-pnx4008/Makefile.boot
index 44c7117e20dd..9fa19baa7f2e 100644
--- a/arch/arm/mach-pnx4008/Makefile.boot
+++ b/arch/arm/mach-pnx4008/Makefile.boot
@@ -1,4 +1,4 @@
1 zreladdr-y := 0x80008000 1 zreladdr-y += 0x80008000
2params_phys-y := 0x80000100 2params_phys-y := 0x80000100
3initrd_phys-y := 0x80800000 3initrd_phys-y := 0x80800000
4 4
diff --git a/arch/arm/mach-pnx4008/gpio.c b/arch/arm/mach-pnx4008/gpio.c
index f219914f5b29..d3e71d3847b4 100644
--- a/arch/arm/mach-pnx4008/gpio.c
+++ b/arch/arm/mach-pnx4008/gpio.c
@@ -13,14 +13,13 @@
13 * is licensed "as is" without any warranty of any kind, whether express 13 * is licensed "as is" without any warranty of any kind, whether express
14 * or implied. 14 * or implied.
15 */ 15 */
16
17#include <linux/types.h> 16#include <linux/types.h>
18#include <linux/kernel.h> 17#include <linux/kernel.h>
19#include <linux/module.h> 18#include <linux/module.h>
20#include <linux/io.h> 19#include <linux/io.h>
21#include <mach/hardware.h> 20#include <mach/hardware.h>
22#include <mach/platform.h> 21#include <mach/platform.h>
23#include <mach/gpio.h> 22#include <mach/gpio-pnx4008.h>
24 23
25/* register definitions */ 24/* register definitions */
26#define PIO_VA_BASE IO_ADDRESS(PNX4008_PIO_BASE) 25#define PIO_VA_BASE IO_ADDRESS(PNX4008_PIO_BASE)
diff --git a/arch/arm/mach-pnx4008/include/mach/gpio.h b/arch/arm/mach-pnx4008/include/mach/gpio-pnx4008.h
index 9591467eb9ec..41027dd7cf74 100644
--- a/arch/arm/mach-pnx4008/include/mach/gpio.h
+++ b/arch/arm/mach-pnx4008/include/mach/gpio-pnx4008.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/arm/mach-pnx4008/include/mach/gpio.h 2 * arch/arm/mach-pnx4008/include/mach/gpio-pnx4008.h
3 * 3 *
4 * PNX4008 GPIO driver - header file 4 * PNX4008 GPIO driver - header file
5 * 5 *
diff --git a/arch/arm/mach-pnx4008/serial.c b/arch/arm/mach-pnx4008/serial.c
index f40961e51914..374c138ac1ac 100644
--- a/arch/arm/mach-pnx4008/serial.c
+++ b/arch/arm/mach-pnx4008/serial.c
@@ -9,7 +9,6 @@
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12
13#include <linux/kernel.h> 12#include <linux/kernel.h>
14#include <linux/types.h> 13#include <linux/types.h>
15#include <linux/io.h> 14#include <linux/io.h>
@@ -19,8 +18,8 @@
19 18
20#include <linux/serial_core.h> 19#include <linux/serial_core.h>
21#include <linux/serial_reg.h> 20#include <linux/serial_reg.h>
22#include <mach/gpio.h>
23 21
22#include <mach/gpio-pnx4008.h>
24#include <mach/clock.h> 23#include <mach/clock.h>
25 24
26#define UART_3 0 25#define UART_3 0
diff --git a/arch/arm/mach-prima2/Makefile.boot b/arch/arm/mach-prima2/Makefile.boot
index d023db3ae4ff..c77a4883a4ee 100644
--- a/arch/arm/mach-prima2/Makefile.boot
+++ b/arch/arm/mach-prima2/Makefile.boot
@@ -1,3 +1,3 @@
1zreladdr-y := 0x00008000 1zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-pxa/Makefile.boot b/arch/arm/mach-pxa/Makefile.boot
index 1ead67178eca..2c1ae92f2106 100644
--- a/arch/arm/mach-pxa/Makefile.boot
+++ b/arch/arm/mach-pxa/Makefile.boot
@@ -1,2 +1,2 @@
1 zreladdr-y := 0xa0008000 1 zreladdr-y += 0xa0008000
2 2
diff --git a/arch/arm/mach-pxa/cm-x255.c b/arch/arm/mach-pxa/cm-x255.c
index 93f59f877fc6..be751470d37b 100644
--- a/arch/arm/mach-pxa/cm-x255.c
+++ b/arch/arm/mach-pxa/cm-x255.c
@@ -11,7 +11,6 @@
11 11
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <linux/irq.h> 13#include <linux/irq.h>
14#include <linux/gpio.h>
15#include <linux/mtd/partitions.h> 14#include <linux/mtd/partitions.h>
16#include <linux/mtd/physmap.h> 15#include <linux/mtd/physmap.h>
17#include <linux/mtd/nand-gpio.h> 16#include <linux/mtd/nand-gpio.h>
diff --git a/arch/arm/mach-pxa/cm-x300.c b/arch/arm/mach-pxa/cm-x300.c
index 9ac0225cd51b..d2da301619f0 100644
--- a/arch/arm/mach-pxa/cm-x300.c
+++ b/arch/arm/mach-pxa/cm-x300.c
@@ -839,8 +839,8 @@ static void __init cm_x300_init(void)
839 cm_x300_init_bl(); 839 cm_x300_init_bl();
840} 840}
841 841
842static void __init cm_x300_fixup(struct machine_desc *mdesc, struct tag *tags, 842static void __init cm_x300_fixup(struct tag *tags, char **cmdline,
843 char **cmdline, struct meminfo *mi) 843 struct meminfo *mi)
844{ 844{
845 /* Make sure that mi->bank[0].start = PHYS_ADDR */ 845 /* Make sure that mi->bank[0].start = PHYS_ADDR */
846 for (; tags->hdr.size; tags = tag_next(tags)) 846 for (; tags->hdr.size; tags = tag_next(tags))
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index 185a37cad254..3e9483b06053 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -705,8 +705,8 @@ static void __init corgi_init(void)
705 platform_add_devices(devices, ARRAY_SIZE(devices)); 705 platform_add_devices(devices, ARRAY_SIZE(devices));
706} 706}
707 707
708static void __init fixup_corgi(struct machine_desc *desc, 708static void __init fixup_corgi(struct tag *tags, char **cmdline,
709 struct tag *tags, char **cmdline, struct meminfo *mi) 709 struct meminfo *mi)
710{ 710{
711 sharpsl_save_param(); 711 sharpsl_save_param();
712 mi->nr_banks=1; 712 mi->nr_banks=1;
diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c
index e823c54057f3..8e697dd8accd 100644
--- a/arch/arm/mach-pxa/eseries.c
+++ b/arch/arm/mach-pxa/eseries.c
@@ -41,8 +41,7 @@
41#include "clock.h" 41#include "clock.h"
42 42
43/* Only e800 has 128MB RAM */ 43/* Only e800 has 128MB RAM */
44void __init eseries_fixup(struct machine_desc *desc, 44void __init eseries_fixup(struct tag *tags, char **cmdline, struct meminfo *mi)
45 struct tag *tags, char **cmdline, struct meminfo *mi)
46{ 45{
47 mi->nr_banks=1; 46 mi->nr_banks=1;
48 mi->bank[0].start = 0xa0000000; 47 mi->bank[0].start = 0xa0000000;
diff --git a/arch/arm/mach-pxa/eseries.h b/arch/arm/mach-pxa/eseries.h
index 5930f5e2a123..be921965e91a 100644
--- a/arch/arm/mach-pxa/eseries.h
+++ b/arch/arm/mach-pxa/eseries.h
@@ -1,5 +1,4 @@
1void __init eseries_fixup(struct machine_desc *desc, 1void __init eseries_fixup(struct tag *tags, char **cmdline, struct meminfo *mi);
2 struct tag *tags, char **cmdline, struct meminfo *mi);
3 2
4extern struct pxa2xx_udc_mach_info e7xx_udc_mach_info; 3extern struct pxa2xx_udc_mach_info e7xx_udc_mach_info;
5extern struct pxaficp_platform_data e7xx_ficp_platform_data; 4extern struct pxaficp_platform_data e7xx_ficp_platform_data;
diff --git a/arch/arm/mach-pxa/generic.c b/arch/arm/mach-pxa/generic.c
index f5d91efc2965..5432ecb15def 100644
--- a/arch/arm/mach-pxa/generic.c
+++ b/arch/arm/mach-pxa/generic.c
@@ -16,6 +16,7 @@
16 * initialization stuff for PXA machines which can be overridden later if 16 * initialization stuff for PXA machines which can be overridden later if
17 * need be. 17 * need be.
18 */ 18 */
19#include <linux/gpio.h>
19#include <linux/module.h> 20#include <linux/module.h>
20#include <linux/kernel.h> 21#include <linux/kernel.h>
21#include <linux/init.h> 22#include <linux/init.h>
@@ -26,7 +27,6 @@
26#include <asm/mach-types.h> 27#include <asm/mach-types.h>
27 28
28#include <mach/reset.h> 29#include <mach/reset.h>
29#include <mach/gpio.h>
30#include <mach/smemc.h> 30#include <mach/smemc.h>
31#include <mach/pxa3xx-regs.h> 31#include <mach/pxa3xx-regs.h>
32 32
diff --git a/arch/arm/mach-pxa/include/mach/gpio-pxa.h b/arch/arm/mach-pxa/include/mach/gpio-pxa.h
new file mode 100644
index 000000000000..41b4c93a96c2
--- /dev/null
+++ b/arch/arm/mach-pxa/include/mach/gpio-pxa.h
@@ -0,0 +1,133 @@
1/*
2 * Written by Philipp Zabel <philipp.zabel@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 */
19#ifndef __MACH_PXA_GPIO_PXA_H
20#define __MACH_PXA_GPIO_PXA_H
21
22#include <mach/irqs.h>
23#include <mach/hardware.h>
24
25#define GPIO_REGS_VIRT io_p2v(0x40E00000)
26
27#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
28#define GPIO_REG(x) (*(volatile u32 *)(GPIO_REGS_VIRT + (x)))
29
30/* GPIO Pin Level Registers */
31#define GPLR0 GPIO_REG(BANK_OFF(0) + 0x00)
32#define GPLR1 GPIO_REG(BANK_OFF(1) + 0x00)
33#define GPLR2 GPIO_REG(BANK_OFF(2) + 0x00)
34#define GPLR3 GPIO_REG(BANK_OFF(3) + 0x00)
35
36/* GPIO Pin Direction Registers */
37#define GPDR0 GPIO_REG(BANK_OFF(0) + 0x0c)
38#define GPDR1 GPIO_REG(BANK_OFF(1) + 0x0c)
39#define GPDR2 GPIO_REG(BANK_OFF(2) + 0x0c)
40#define GPDR3 GPIO_REG(BANK_OFF(3) + 0x0c)
41
42/* GPIO Pin Output Set Registers */
43#define GPSR0 GPIO_REG(BANK_OFF(0) + 0x18)
44#define GPSR1 GPIO_REG(BANK_OFF(1) + 0x18)
45#define GPSR2 GPIO_REG(BANK_OFF(2) + 0x18)
46#define GPSR3 GPIO_REG(BANK_OFF(3) + 0x18)
47
48/* GPIO Pin Output Clear Registers */
49#define GPCR0 GPIO_REG(BANK_OFF(0) + 0x24)
50#define GPCR1 GPIO_REG(BANK_OFF(1) + 0x24)
51#define GPCR2 GPIO_REG(BANK_OFF(2) + 0x24)
52#define GPCR3 GPIO_REG(BANK_OFF(3) + 0x24)
53
54/* GPIO Rising Edge Detect Registers */
55#define GRER0 GPIO_REG(BANK_OFF(0) + 0x30)
56#define GRER1 GPIO_REG(BANK_OFF(1) + 0x30)
57#define GRER2 GPIO_REG(BANK_OFF(2) + 0x30)
58#define GRER3 GPIO_REG(BANK_OFF(3) + 0x30)
59
60/* GPIO Falling Edge Detect Registers */
61#define GFER0 GPIO_REG(BANK_OFF(0) + 0x3c)
62#define GFER1 GPIO_REG(BANK_OFF(1) + 0x3c)
63#define GFER2 GPIO_REG(BANK_OFF(2) + 0x3c)
64#define GFER3 GPIO_REG(BANK_OFF(3) + 0x3c)
65
66/* GPIO Edge Detect Status Registers */
67#define GEDR0 GPIO_REG(BANK_OFF(0) + 0x48)
68#define GEDR1 GPIO_REG(BANK_OFF(1) + 0x48)
69#define GEDR2 GPIO_REG(BANK_OFF(2) + 0x48)
70#define GEDR3 GPIO_REG(BANK_OFF(3) + 0x48)
71
72/* GPIO Alternate Function Select Registers */
73#define GAFR0_L GPIO_REG(0x0054)
74#define GAFR0_U GPIO_REG(0x0058)
75#define GAFR1_L GPIO_REG(0x005C)
76#define GAFR1_U GPIO_REG(0x0060)
77#define GAFR2_L GPIO_REG(0x0064)
78#define GAFR2_U GPIO_REG(0x0068)
79#define GAFR3_L GPIO_REG(0x006C)
80#define GAFR3_U GPIO_REG(0x0070)
81
82/* More handy macros. The argument is a literal GPIO number. */
83
84#define GPIO_bit(x) (1 << ((x) & 0x1f))
85
86#define GPLR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x00)
87#define GPDR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x0c)
88#define GPSR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x18)
89#define GPCR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x24)
90#define GRER(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x30)
91#define GFER(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x3c)
92#define GEDR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x48)
93#define GAFR(x) GPIO_REG(0x54 + (((x) & 0x70) >> 2))
94
95
96#define NR_BUILTIN_GPIO PXA_GPIO_IRQ_NUM
97
98#define gpio_to_bank(gpio) ((gpio) >> 5)
99
100#ifdef CONFIG_CPU_PXA26x
101/* GPIO86/87/88/89 on PXA26x have their direction bits in GPDR2 inverted,
102 * as well as their Alternate Function value being '1' for GPIO in GAFRx.
103 */
104static inline int __gpio_is_inverted(unsigned gpio)
105{
106 return cpu_is_pxa25x() && gpio > 85;
107}
108#else
109static inline int __gpio_is_inverted(unsigned gpio) { return 0; }
110#endif
111
112/*
113 * On PXA25x and PXA27x, GAFRx and GPDRx together decide the alternate
114 * function of a GPIO, and GPDRx cannot be altered once configured. It
115 * is attributed as "occupied" here (I know this terminology isn't
116 * accurate, you are welcome to propose a better one :-)
117 */
118static inline int __gpio_is_occupied(unsigned gpio)
119{
120 if (cpu_is_pxa27x() || cpu_is_pxa25x()) {
121 int af = (GAFR(gpio) >> ((gpio & 0xf) * 2)) & 0x3;
122 int dir = GPDR(gpio) & GPIO_bit(gpio);
123
124 if (__gpio_is_inverted(gpio))
125 return af != 1 || dir == 0;
126 else
127 return af != 0 || dir != 0;
128 } else
129 return GPDR(gpio) & GPIO_bit(gpio);
130}
131
132#include <plat/gpio-pxa.h>
133#endif /* __MACH_PXA_GPIO_PXA_H */
diff --git a/arch/arm/mach-pxa/include/mach/gpio.h b/arch/arm/mach-pxa/include/mach/gpio.h
index c4639502efca..004cade7bb13 100644
--- a/arch/arm/mach-pxa/include/mach/gpio.h
+++ b/arch/arm/mach-pxa/include/mach/gpio.h
@@ -24,84 +24,10 @@
24#ifndef __ASM_ARCH_PXA_GPIO_H 24#ifndef __ASM_ARCH_PXA_GPIO_H
25#define __ASM_ARCH_PXA_GPIO_H 25#define __ASM_ARCH_PXA_GPIO_H
26 26
27#include <mach/irqs.h>
28#include <mach/hardware.h>
29#include <asm-generic/gpio.h> 27#include <asm-generic/gpio.h>
28/* The defines for the driver are needed for the accelerated accessors */
29#include "gpio-pxa.h"
30 30
31#define GPIO_REGS_VIRT io_p2v(0x40E00000)
32
33#define BANK_OFF(n) (((n) < 3) ? (n) << 2 : 0x100 + (((n) - 3) << 2))
34#define GPIO_REG(x) (*(volatile u32 *)(GPIO_REGS_VIRT + (x)))
35
36/* GPIO Pin Level Registers */
37#define GPLR0 GPIO_REG(BANK_OFF(0) + 0x00)
38#define GPLR1 GPIO_REG(BANK_OFF(1) + 0x00)
39#define GPLR2 GPIO_REG(BANK_OFF(2) + 0x00)
40#define GPLR3 GPIO_REG(BANK_OFF(3) + 0x00)
41
42/* GPIO Pin Direction Registers */
43#define GPDR0 GPIO_REG(BANK_OFF(0) + 0x0c)
44#define GPDR1 GPIO_REG(BANK_OFF(1) + 0x0c)
45#define GPDR2 GPIO_REG(BANK_OFF(2) + 0x0c)
46#define GPDR3 GPIO_REG(BANK_OFF(3) + 0x0c)
47
48/* GPIO Pin Output Set Registers */
49#define GPSR0 GPIO_REG(BANK_OFF(0) + 0x18)
50#define GPSR1 GPIO_REG(BANK_OFF(1) + 0x18)
51#define GPSR2 GPIO_REG(BANK_OFF(2) + 0x18)
52#define GPSR3 GPIO_REG(BANK_OFF(3) + 0x18)
53
54/* GPIO Pin Output Clear Registers */
55#define GPCR0 GPIO_REG(BANK_OFF(0) + 0x24)
56#define GPCR1 GPIO_REG(BANK_OFF(1) + 0x24)
57#define GPCR2 GPIO_REG(BANK_OFF(2) + 0x24)
58#define GPCR3 GPIO_REG(BANK_OFF(3) + 0x24)
59
60/* GPIO Rising Edge Detect Registers */
61#define GRER0 GPIO_REG(BANK_OFF(0) + 0x30)
62#define GRER1 GPIO_REG(BANK_OFF(1) + 0x30)
63#define GRER2 GPIO_REG(BANK_OFF(2) + 0x30)
64#define GRER3 GPIO_REG(BANK_OFF(3) + 0x30)
65
66/* GPIO Falling Edge Detect Registers */
67#define GFER0 GPIO_REG(BANK_OFF(0) + 0x3c)
68#define GFER1 GPIO_REG(BANK_OFF(1) + 0x3c)
69#define GFER2 GPIO_REG(BANK_OFF(2) + 0x3c)
70#define GFER3 GPIO_REG(BANK_OFF(3) + 0x3c)
71
72/* GPIO Edge Detect Status Registers */
73#define GEDR0 GPIO_REG(BANK_OFF(0) + 0x48)
74#define GEDR1 GPIO_REG(BANK_OFF(1) + 0x48)
75#define GEDR2 GPIO_REG(BANK_OFF(2) + 0x48)
76#define GEDR3 GPIO_REG(BANK_OFF(3) + 0x48)
77
78/* GPIO Alternate Function Select Registers */
79#define GAFR0_L GPIO_REG(0x0054)
80#define GAFR0_U GPIO_REG(0x0058)
81#define GAFR1_L GPIO_REG(0x005C)
82#define GAFR1_U GPIO_REG(0x0060)
83#define GAFR2_L GPIO_REG(0x0064)
84#define GAFR2_U GPIO_REG(0x0068)
85#define GAFR3_L GPIO_REG(0x006C)
86#define GAFR3_U GPIO_REG(0x0070)
87
88/* More handy macros. The argument is a literal GPIO number. */
89
90#define GPIO_bit(x) (1 << ((x) & 0x1f))
91
92#define GPLR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x00)
93#define GPDR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x0c)
94#define GPSR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x18)
95#define GPCR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x24)
96#define GRER(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x30)
97#define GFER(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x3c)
98#define GEDR(x) GPIO_REG(BANK_OFF((x) >> 5) + 0x48)
99#define GAFR(x) GPIO_REG(0x54 + (((x) & 0x70) >> 2))
100
101
102#define NR_BUILTIN_GPIO PXA_GPIO_IRQ_NUM
103
104#define gpio_to_bank(gpio) ((gpio) >> 5)
105#define gpio_to_irq(gpio) IRQ_GPIO(gpio) 31#define gpio_to_irq(gpio) IRQ_GPIO(gpio)
106 32
107static inline int irq_to_gpio(unsigned int irq) 33static inline int irq_to_gpio(unsigned int irq)
@@ -118,37 +44,5 @@ static inline int irq_to_gpio(unsigned int irq)
118 return -1; 44 return -1;
119} 45}
120 46
121#ifdef CONFIG_CPU_PXA26x
122/* GPIO86/87/88/89 on PXA26x have their direction bits in GPDR2 inverted,
123 * as well as their Alternate Function value being '1' for GPIO in GAFRx.
124 */
125static inline int __gpio_is_inverted(unsigned gpio)
126{
127 return cpu_is_pxa25x() && gpio > 85;
128}
129#else
130static inline int __gpio_is_inverted(unsigned gpio) { return 0; }
131#endif
132
133/*
134 * On PXA25x and PXA27x, GAFRx and GPDRx together decide the alternate
135 * function of a GPIO, and GPDRx cannot be altered once configured. It
136 * is attributed as "occupied" here (I know this terminology isn't
137 * accurate, you are welcome to propose a better one :-)
138 */
139static inline int __gpio_is_occupied(unsigned gpio)
140{
141 if (cpu_is_pxa27x() || cpu_is_pxa25x()) {
142 int af = (GAFR(gpio) >> ((gpio & 0xf) * 2)) & 0x3;
143 int dir = GPDR(gpio) & GPIO_bit(gpio);
144
145 if (__gpio_is_inverted(gpio))
146 return af != 1 || dir == 0;
147 else
148 return af != 0 || dir != 0;
149 } else
150 return GPDR(gpio) & GPIO_bit(gpio);
151}
152
153#include <plat/gpio.h> 47#include <plat/gpio.h>
154#endif 48#endif
diff --git a/arch/arm/mach-pxa/include/mach/littleton.h b/arch/arm/mach-pxa/include/mach/littleton.h
index 2a5726c15e0e..b6238cbd8aea 100644
--- a/arch/arm/mach-pxa/include/mach/littleton.h
+++ b/arch/arm/mach-pxa/include/mach/littleton.h
@@ -1,7 +1,7 @@
1#ifndef __ASM_ARCH_LITTLETON_H 1#ifndef __ASM_ARCH_LITTLETON_H
2#define __ASM_ARCH_LITTLETON_H 2#define __ASM_ARCH_LITTLETON_H
3 3
4#include <mach/gpio.h> 4#include <mach/gpio-pxa.h>
5 5
6#define LITTLETON_ETH_PHYS 0x30000000 6#define LITTLETON_ETH_PHYS 0x30000000
7 7
diff --git a/arch/arm/mach-pxa/irq.c b/arch/arm/mach-pxa/irq.c
index ca6075717824..8d9200f92268 100644
--- a/arch/arm/mach-pxa/irq.c
+++ b/arch/arm/mach-pxa/irq.c
@@ -11,7 +11,6 @@
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14
15#include <linux/init.h> 14#include <linux/init.h>
16#include <linux/module.h> 15#include <linux/module.h>
17#include <linux/interrupt.h> 16#include <linux/interrupt.h>
@@ -23,7 +22,7 @@
23 22
24#include <mach/hardware.h> 23#include <mach/hardware.h>
25#include <mach/irqs.h> 24#include <mach/irqs.h>
26#include <mach/gpio.h> 25#include <mach/gpio-pxa.h>
27 26
28#include "generic.h" 27#include "generic.h"
29 28
diff --git a/arch/arm/mach-pxa/lpd270.c b/arch/arm/mach-pxa/lpd270.c
index 16df0fc0879a..64540d908958 100644
--- a/arch/arm/mach-pxa/lpd270.c
+++ b/arch/arm/mach-pxa/lpd270.c
@@ -12,7 +12,7 @@
12 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation. 13 * published by the Free Software Foundation.
14 */ 14 */
15 15#include <linux/gpio.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/syscore_ops.h> 18#include <linux/syscore_ops.h>
@@ -39,7 +39,6 @@
39#include <asm/mach/flash.h> 39#include <asm/mach/flash.h>
40 40
41#include <mach/pxa27x.h> 41#include <mach/pxa27x.h>
42#include <mach/gpio.h>
43#include <mach/lpd270.h> 42#include <mach/lpd270.h>
44#include <mach/audio.h> 43#include <mach/audio.h>
45#include <mach/pxafb.h> 44#include <mach/pxafb.h>
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index a8c696bfc132..c48ce6da9184 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -11,6 +11,7 @@
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14#include <linux/gpio.h>
14#include <linux/module.h> 15#include <linux/module.h>
15#include <linux/kernel.h> 16#include <linux/kernel.h>
16#include <linux/init.h> 17#include <linux/init.h>
@@ -42,7 +43,6 @@
42#include <asm/hardware/sa1111.h> 43#include <asm/hardware/sa1111.h>
43 44
44#include <mach/pxa25x.h> 45#include <mach/pxa25x.h>
45#include <mach/gpio.h>
46#include <mach/audio.h> 46#include <mach/audio.h>
47#include <mach/lubbock.h> 47#include <mach/lubbock.h>
48#include <mach/udc.h> 48#include <mach/udc.h>
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index cc6e14f6d114..0567d3965fda 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -12,7 +12,7 @@
12 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation. 13 * published by the Free Software Foundation.
14 */ 14 */
15 15#include <linux/gpio.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/syscore_ops.h> 18#include <linux/syscore_ops.h>
@@ -43,7 +43,6 @@
43#include <asm/mach/flash.h> 43#include <asm/mach/flash.h>
44 44
45#include <mach/pxa27x.h> 45#include <mach/pxa27x.h>
46#include <mach/gpio.h>
47#include <mach/mainstone.h> 46#include <mach/mainstone.h>
48#include <mach/audio.h> 47#include <mach/audio.h>
49#include <mach/pxafb.h> 48#include <mach/pxafb.h>
diff --git a/arch/arm/mach-pxa/mfp-pxa2xx.c b/arch/arm/mach-pxa/mfp-pxa2xx.c
index b27544bcafcb..43a5f6861ca3 100644
--- a/arch/arm/mach-pxa/mfp-pxa2xx.c
+++ b/arch/arm/mach-pxa/mfp-pxa2xx.c
@@ -12,15 +12,15 @@
12 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation. 13 * published by the Free Software Foundation.
14 */ 14 */
15 15#include <linux/gpio.h>
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/syscore_ops.h> 19#include <linux/syscore_ops.h>
20 20
21#include <mach/gpio.h>
22#include <mach/pxa2xx-regs.h> 21#include <mach/pxa2xx-regs.h>
23#include <mach/mfp-pxa2xx.h> 22#include <mach/mfp-pxa2xx.h>
23#include <mach/gpio-pxa.h>
24 24
25#include "generic.h" 25#include "generic.h"
26 26
diff --git a/arch/arm/mach-pxa/pcm990-baseboard.c b/arch/arm/mach-pxa/pcm990-baseboard.c
index 6d5b7e062124..9a9c539f6c01 100644
--- a/arch/arm/mach-pxa/pcm990-baseboard.c
+++ b/arch/arm/mach-pxa/pcm990-baseboard.c
@@ -19,7 +19,7 @@
19 * it under the terms of the GNU General Public License version 2 as 19 * it under the terms of the GNU General Public License version 2 as
20 * published by the Free Software Foundation. 20 * published by the Free Software Foundation.
21 */ 21 */
22 22#include <linux/gpio.h>
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/i2c.h> 25#include <linux/i2c.h>
@@ -28,7 +28,6 @@
28 28
29#include <media/soc_camera.h> 29#include <media/soc_camera.h>
30 30
31#include <asm/gpio.h>
32#include <mach/camera.h> 31#include <mach/camera.h>
33#include <asm/mach/map.h> 32#include <asm/mach/map.h>
34#include <mach/pxa27x.h> 33#include <mach/pxa27x.h>
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index a113ea9ab4ab..948ce3e729fa 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -454,8 +454,8 @@ static void __init poodle_init(void)
454 poodle_init_spi(); 454 poodle_init_spi();
455} 455}
456 456
457static void __init fixup_poodle(struct machine_desc *desc, 457static void __init fixup_poodle(struct tag *tags, char **cmdline,
458 struct tag *tags, char **cmdline, struct meminfo *mi) 458 struct meminfo *mi)
459{ 459{
460 sharpsl_save_param(); 460 sharpsl_save_param();
461 mi->nr_banks=1; 461 mi->nr_banks=1;
diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c
index 9c434d21a271..8746e1090b6e 100644
--- a/arch/arm/mach-pxa/pxa25x.c
+++ b/arch/arm/mach-pxa/pxa25x.c
@@ -16,6 +16,7 @@
16 * initialization stuff for PXA machines which can be overridden later if 16 * initialization stuff for PXA machines which can be overridden later if
17 * need be. 17 * need be.
18 */ 18 */
19#include <linux/gpio.h>
19#include <linux/module.h> 20#include <linux/module.h>
20#include <linux/kernel.h> 21#include <linux/kernel.h>
21#include <linux/init.h> 22#include <linux/init.h>
@@ -23,12 +24,12 @@
23#include <linux/suspend.h> 24#include <linux/suspend.h>
24#include <linux/syscore_ops.h> 25#include <linux/syscore_ops.h>
25#include <linux/irq.h> 26#include <linux/irq.h>
27#include <linux/gpio.h>
26 28
27#include <asm/mach/map.h> 29#include <asm/mach/map.h>
28#include <asm/suspend.h> 30#include <asm/suspend.h>
29#include <mach/hardware.h> 31#include <mach/hardware.h>
30#include <mach/irqs.h> 32#include <mach/irqs.h>
31#include <mach/gpio.h>
32#include <mach/pxa25x.h> 33#include <mach/pxa25x.h>
33#include <mach/reset.h> 34#include <mach/reset.h>
34#include <mach/pm.h> 35#include <mach/pm.h>
diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c
index 9d2400b5f503..2bb5cf8ba6ec 100644
--- a/arch/arm/mach-pxa/pxa27x.c
+++ b/arch/arm/mach-pxa/pxa27x.c
@@ -11,6 +11,7 @@
11 * it under the terms of the GNU General Public License version 2 as 11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13 */ 13 */
14#include <linux/gpio.h>
14#include <linux/module.h> 15#include <linux/module.h>
15#include <linux/kernel.h> 16#include <linux/kernel.h>
16#include <linux/init.h> 17#include <linux/init.h>
@@ -20,13 +21,13 @@
20#include <linux/io.h> 21#include <linux/io.h>
21#include <linux/irq.h> 22#include <linux/irq.h>
22#include <linux/i2c/pxa-i2c.h> 23#include <linux/i2c/pxa-i2c.h>
24#include <linux/gpio.h>
23 25
24#include <asm/mach/map.h> 26#include <asm/mach/map.h>
25#include <mach/hardware.h> 27#include <mach/hardware.h>
26#include <asm/irq.h> 28#include <asm/irq.h>
27#include <asm/suspend.h> 29#include <asm/suspend.h>
28#include <mach/irqs.h> 30#include <mach/irqs.h>
29#include <mach/gpio.h>
30#include <mach/pxa27x.h> 31#include <mach/pxa27x.h>
31#include <mach/reset.h> 32#include <mach/reset.h>
32#include <mach/ohci.h> 33#include <mach/ohci.h>
diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c
index b5cd9e5aba31..f940a1345531 100644
--- a/arch/arm/mach-pxa/pxa3xx.c
+++ b/arch/arm/mach-pxa/pxa3xx.c
@@ -12,7 +12,6 @@
12 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation. 13 * published by the Free Software Foundation.
14 */ 14 */
15
16#include <linux/module.h> 15#include <linux/module.h>
17#include <linux/kernel.h> 16#include <linux/kernel.h>
18#include <linux/init.h> 17#include <linux/init.h>
@@ -26,7 +25,7 @@
26#include <asm/mach/map.h> 25#include <asm/mach/map.h>
27#include <asm/suspend.h> 26#include <asm/suspend.h>
28#include <mach/hardware.h> 27#include <mach/hardware.h>
29#include <mach/gpio.h> 28#include <mach/gpio-pxa.h>
30#include <mach/pxa3xx-regs.h> 29#include <mach/pxa3xx-regs.h>
31#include <mach/reset.h> 30#include <mach/reset.h>
32#include <mach/ohci.h> 31#include <mach/ohci.h>
diff --git a/arch/arm/mach-pxa/pxa95x.c b/arch/arm/mach-pxa/pxa95x.c
index 0ee166b61f81..51371b39d2a3 100644
--- a/arch/arm/mach-pxa/pxa95x.c
+++ b/arch/arm/mach-pxa/pxa95x.c
@@ -9,7 +9,6 @@
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12
13#include <linux/module.h> 12#include <linux/module.h>
14#include <linux/kernel.h> 13#include <linux/kernel.h>
15#include <linux/init.h> 14#include <linux/init.h>
@@ -21,7 +20,7 @@
21#include <linux/syscore_ops.h> 20#include <linux/syscore_ops.h>
22 21
23#include <mach/hardware.h> 22#include <mach/hardware.h>
24#include <mach/gpio.h> 23#include <mach/gpio-pxa.h>
25#include <mach/pxa3xx-regs.h> 24#include <mach/pxa3xx-regs.h>
26#include <mach/pxa930.h> 25#include <mach/pxa930.h>
27#include <mach/reset.h> 26#include <mach/reset.h>
diff --git a/arch/arm/mach-pxa/saar.c b/arch/arm/mach-pxa/saar.c
index 602d70b50f81..fc2c1e05af9c 100644
--- a/arch/arm/mach-pxa/saar.c
+++ b/arch/arm/mach-pxa/saar.c
@@ -540,7 +540,7 @@ static struct mtd_partition saar_onenand_partitions[] = {
540 }, { 540 }, {
541 .name = "filesystem", 541 .name = "filesystem",
542 .offset = MTDPART_OFS_APPEND, 542 .offset = MTDPART_OFS_APPEND,
543 .size = SZ_48M, 543 .size = SZ_32M + SZ_16M,
544 .mask_flags = 0, 544 .mask_flags = 0,
545 } 545 }
546}; 546};
diff --git a/arch/arm/mach-pxa/saarb.c b/arch/arm/mach-pxa/saarb.c
index 5ce340320ab9..3c988b6f718f 100644
--- a/arch/arm/mach-pxa/saarb.c
+++ b/arch/arm/mach-pxa/saarb.c
@@ -9,12 +9,13 @@
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
10 * publishhed by the Free Software Foundation. 10 * publishhed by the Free Software Foundation.
11 */ 11 */
12 12#include <linux/gpio.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/i2c.h> 15#include <linux/i2c.h>
16#include <linux/i2c/pxa-i2c.h> 16#include <linux/i2c/pxa-i2c.h>
17#include <linux/mfd/88pm860x.h> 17#include <linux/mfd/88pm860x.h>
18#include <linux/gpio.h>
18 19
19#include <asm/mach-types.h> 20#include <asm/mach-types.h>
20#include <asm/mach/arch.h> 21#include <asm/mach/arch.h>
@@ -23,7 +24,6 @@
23#include <mach/hardware.h> 24#include <mach/hardware.h>
24#include <mach/mfp.h> 25#include <mach/mfp.h>
25#include <mach/mfp-pxa930.h> 26#include <mach/mfp-pxa930.h>
26#include <mach/gpio.h>
27 27
28#include "generic.h" 28#include "generic.h"
29 29
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index 438c7b5e451f..d8dec9113aad 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -970,8 +970,8 @@ static void __init spitz_init(void)
970 spitz_i2c_init(); 970 spitz_i2c_init();
971} 971}
972 972
973static void __init spitz_fixup(struct machine_desc *desc, 973static void __init spitz_fixup(struct tag *tags, char **cmdline,
974 struct tag *tags, char **cmdline, struct meminfo *mi) 974 struct meminfo *mi)
975{ 975{
976 sharpsl_save_param(); 976 sharpsl_save_param();
977 mi->nr_banks = 1; 977 mi->nr_banks = 1;
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index 9f69a2682693..402b0c96613b 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -960,8 +960,8 @@ static void __init tosa_init(void)
960 platform_add_devices(devices, ARRAY_SIZE(devices)); 960 platform_add_devices(devices, ARRAY_SIZE(devices));
961} 961}
962 962
963static void __init fixup_tosa(struct machine_desc *desc, 963static void __init fixup_tosa(struct tag *tags, char **cmdline,
964 struct tag *tags, char **cmdline, struct meminfo *mi) 964 struct meminfo *mi)
965{ 965{
966 sharpsl_save_param(); 966 sharpsl_save_param();
967 mi->nr_banks=1; 967 mi->nr_banks=1;
diff --git a/arch/arm/mach-pxa/xcep.c b/arch/arm/mach-pxa/xcep.c
index 54930cccbe54..70e1730ef282 100644
--- a/arch/arm/mach-pxa/xcep.c
+++ b/arch/arm/mach-pxa/xcep.c
@@ -142,8 +142,7 @@ static struct platform_device *devices[] __initdata = {
142 142
143/* We have to state that there are HWMON devices on the I2C bus on XCEP. 143/* We have to state that there are HWMON devices on the I2C bus on XCEP.
144 * Drivers for HWMON verify capabilities of the adapter when loading and 144 * Drivers for HWMON verify capabilities of the adapter when loading and
145 * refuse to attach if the adapter doesn't support HWMON class of devices. 145 * refuse to attach if the adapter doesn't support HWMON class of devices. */
146 * See also Documentation/i2c/porting-clients. */
147static struct i2c_pxa_platform_data xcep_i2c_platform_data = { 146static struct i2c_pxa_platform_data xcep_i2c_platform_data = {
148 .class = I2C_CLASS_HWMON 147 .class = I2C_CLASS_HWMON
149}; 148};
diff --git a/arch/arm/mach-realview/Makefile.boot b/arch/arm/mach-realview/Makefile.boot
index d97e003d3df4..d2c3d788f688 100644
--- a/arch/arm/mach-realview/Makefile.boot
+++ b/arch/arm/mach-realview/Makefile.boot
@@ -1,9 +1,9 @@
1ifeq ($(CONFIG_REALVIEW_HIGH_PHYS_OFFSET),y) 1ifeq ($(CONFIG_REALVIEW_HIGH_PHYS_OFFSET),y)
2 zreladdr-y := 0x70008000 2 zreladdr-y += 0x70008000
3params_phys-y := 0x70000100 3params_phys-y := 0x70000100
4initrd_phys-y := 0x70800000 4initrd_phys-y := 0x70800000
5else 5else
6 zreladdr-y := 0x00008000 6 zreladdr-y += 0x00008000
7params_phys-y := 0x00000100 7params_phys-y := 0x00000100
8initrd_phys-y := 0x00800000 8initrd_phys-y := 0x00800000
9endif 9endif
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 5c23450d2d1d..d5ed5d4f77d6 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -517,8 +517,7 @@ void __init realview_timer_init(unsigned int timer_irq)
517/* 517/*
518 * Setup the memory banks. 518 * Setup the memory banks.
519 */ 519 */
520void realview_fixup(struct machine_desc *mdesc, struct tag *tags, char **from, 520void realview_fixup(struct tag *tags, char **from, struct meminfo *meminfo)
521 struct meminfo *meminfo)
522{ 521{
523 /* 522 /*
524 * Most RealView platforms have 512MB contiguous RAM at 0x70000000. 523 * Most RealView platforms have 512MB contiguous RAM at 0x70000000.
diff --git a/arch/arm/mach-realview/core.h b/arch/arm/mach-realview/core.h
index 5c83d1e87a03..47259c89a75e 100644
--- a/arch/arm/mach-realview/core.h
+++ b/arch/arm/mach-realview/core.h
@@ -63,8 +63,8 @@ extern int realview_flash_register(struct resource *res, u32 num);
63extern int realview_eth_register(const char *name, struct resource *res); 63extern int realview_eth_register(const char *name, struct resource *res);
64extern int realview_usb_register(struct resource *res); 64extern int realview_usb_register(struct resource *res);
65extern void realview_init_early(void); 65extern void realview_init_early(void);
66extern void realview_fixup(struct machine_desc *mdesc, struct tag *tags, 66extern void realview_fixup(struct tag *tags, char **from,
67 char **from, struct meminfo *meminfo); 67 struct meminfo *meminfo);
68extern void (*realview_reset)(char); 68extern void (*realview_reset)(char);
69 69
70#endif 70#endif
diff --git a/arch/arm/mach-realview/include/mach/board-pb1176.h b/arch/arm/mach-realview/include/mach/board-pb1176.h
index 002ab5d8c11c..2a15fef94730 100644
--- a/arch/arm/mach-realview/include/mach/board-pb1176.h
+++ b/arch/arm/mach-realview/include/mach/board-pb1176.h
@@ -70,6 +70,7 @@
70 70
71#define REALVIEW_DC1176_GIC_CPU_BASE 0x10120000 /* GIC CPU interface, on devchip */ 71#define REALVIEW_DC1176_GIC_CPU_BASE 0x10120000 /* GIC CPU interface, on devchip */
72#define REALVIEW_DC1176_GIC_DIST_BASE 0x10121000 /* GIC distributor, on devchip */ 72#define REALVIEW_DC1176_GIC_DIST_BASE 0x10121000 /* GIC distributor, on devchip */
73#define REALVIEW_DC1176_ROM_BASE 0x10200000 /* 16KiB NRAM preudo-ROM, on devchip */
73#define REALVIEW_PB1176_GIC_CPU_BASE 0x10040000 /* GIC CPU interface, on FPGA */ 74#define REALVIEW_PB1176_GIC_CPU_BASE 0x10040000 /* GIC CPU interface, on FPGA */
74#define REALVIEW_PB1176_GIC_DIST_BASE 0x10041000 /* GIC distributor, on FPGA */ 75#define REALVIEW_PB1176_GIC_DIST_BASE 0x10041000 /* GIC distributor, on FPGA */
75#define REALVIEW_PB1176_L220_BASE 0x10110000 /* L220 registers */ 76#define REALVIEW_PB1176_L220_BASE 0x10110000 /* L220 registers */
diff --git a/arch/arm/mach-realview/include/mach/gpio.h b/arch/arm/mach-realview/include/mach/gpio.h
index 94ff27678a46..40a8c178f10d 100644
--- a/arch/arm/mach-realview/include/mach/gpio.h
+++ b/arch/arm/mach-realview/include/mach/gpio.h
@@ -1,6 +1 @@
1#include <asm-generic/gpio.h> /* empty */
2
3#define gpio_get_value __gpio_get_value
4#define gpio_set_value __gpio_set_value
5#define gpio_cansleep __gpio_cansleep
6#define gpio_to_irq __gpio_to_irq
diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c
index 7263dea77779..c057540ec776 100644
--- a/arch/arm/mach-realview/realview_pb1176.c
+++ b/arch/arm/mach-realview/realview_pb1176.c
@@ -26,6 +26,8 @@
26#include <linux/amba/pl061.h> 26#include <linux/amba/pl061.h>
27#include <linux/amba/mmci.h> 27#include <linux/amba/mmci.h>
28#include <linux/amba/pl022.h> 28#include <linux/amba/pl022.h>
29#include <linux/mtd/physmap.h>
30#include <linux/mtd/partitions.h>
29#include <linux/io.h> 31#include <linux/io.h>
30 32
31#include <mach/hardware.h> 33#include <mach/hardware.h>
@@ -204,22 +206,48 @@ static struct amba_device *amba_devs[] __initdata = {
204 * RealView PB1176 platform devices 206 * RealView PB1176 platform devices
205 */ 207 */
206static struct resource realview_pb1176_flash_resources[] = { 208static struct resource realview_pb1176_flash_resources[] = {
207 [0] = { 209 {
208 .start = REALVIEW_PB1176_FLASH_BASE, 210 .start = REALVIEW_PB1176_FLASH_BASE,
209 .end = REALVIEW_PB1176_FLASH_BASE + REALVIEW_PB1176_FLASH_SIZE - 1, 211 .end = REALVIEW_PB1176_FLASH_BASE + REALVIEW_PB1176_FLASH_SIZE - 1,
210 .flags = IORESOURCE_MEM, 212 .flags = IORESOURCE_MEM,
211 }, 213 },
212 [1] = { 214#ifdef CONFIG_REALVIEW_PB1176_SECURE_FLASH
215 {
213 .start = REALVIEW_PB1176_SEC_FLASH_BASE, 216 .start = REALVIEW_PB1176_SEC_FLASH_BASE,
214 .end = REALVIEW_PB1176_SEC_FLASH_BASE + REALVIEW_PB1176_SEC_FLASH_SIZE - 1, 217 .end = REALVIEW_PB1176_SEC_FLASH_BASE + REALVIEW_PB1176_SEC_FLASH_SIZE - 1,
215 .flags = IORESOURCE_MEM, 218 .flags = IORESOURCE_MEM,
216 }, 219 },
217};
218#ifdef CONFIG_REALVIEW_PB1176_SECURE_FLASH
219#define PB1176_FLASH_BLOCKS 2
220#else
221#define PB1176_FLASH_BLOCKS 1
222#endif 220#endif
221};
222
223static struct physmap_flash_data pb1176_rom_pdata = {
224 .probe_type = "map_rom",
225 .width = 4,
226 .nr_parts = 0,
227};
228
229static struct resource pb1176_rom_resources[] = {
230 /*
231 * This exposes the PB1176 DevChip ROM as an MTD ROM mapping.
232 * The reference manual states that this is actually a pseudo-ROM
233 * programmed in NVRAM.
234 */
235 {
236 .start = REALVIEW_DC1176_ROM_BASE,
237 .end = REALVIEW_DC1176_ROM_BASE + SZ_16K - 1,
238 .flags = IORESOURCE_MEM,
239 }
240};
241
242static struct platform_device pb1176_rom_device = {
243 .name = "physmap-flash",
244 .id = -1,
245 .num_resources = ARRAY_SIZE(pb1176_rom_resources),
246 .resource = pb1176_rom_resources,
247 .dev = {
248 .platform_data = &pb1176_rom_pdata,
249 },
250};
223 251
224static struct resource realview_pb1176_smsc911x_resources[] = { 252static struct resource realview_pb1176_smsc911x_resources[] = {
225 [0] = { 253 [0] = {
@@ -316,8 +344,7 @@ static void realview_pb1176_reset(char mode)
316 __raw_writel(REALVIEW_PB1176_SYS_SOFT_RESET, reset_ctrl); 344 __raw_writel(REALVIEW_PB1176_SYS_SOFT_RESET, reset_ctrl);
317} 345}
318 346
319static void realview_pb1176_fixup(struct machine_desc *mdesc, 347static void realview_pb1176_fixup(struct tag *tags, char **from,
320 struct tag *tags, char **from,
321 struct meminfo *meminfo) 348 struct meminfo *meminfo)
322{ 349{
323 /* 350 /*
@@ -338,7 +365,8 @@ static void __init realview_pb1176_init(void)
338#endif 365#endif
339 366
340 realview_flash_register(realview_pb1176_flash_resources, 367 realview_flash_register(realview_pb1176_flash_resources,
341 PB1176_FLASH_BLOCKS); 368 ARRAY_SIZE(realview_pb1176_flash_resources));
369 platform_device_register(&pb1176_rom_device);
342 realview_eth_register(NULL, realview_pb1176_smsc911x_resources); 370 realview_eth_register(NULL, realview_pb1176_smsc911x_resources);
343 platform_device_register(&realview_i2c_device); 371 platform_device_register(&realview_i2c_device);
344 realview_usb_register(realview_pb1176_isp1761_resources); 372 realview_usb_register(realview_pb1176_isp1761_resources);
diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c
index 8ec7e52618b4..63c4114afae9 100644
--- a/arch/arm/mach-realview/realview_pbx.c
+++ b/arch/arm/mach-realview/realview_pbx.c
@@ -319,8 +319,8 @@ static struct sys_timer realview_pbx_timer = {
319 .init = realview_pbx_timer_init, 319 .init = realview_pbx_timer_init,
320}; 320};
321 321
322static void realview_pbx_fixup(struct machine_desc *mdesc, struct tag *tags, 322static void realview_pbx_fixup(struct tag *tags, char **from,
323 char **from, struct meminfo *meminfo) 323 struct meminfo *meminfo)
324{ 324{
325#ifdef CONFIG_SPARSEMEM 325#ifdef CONFIG_SPARSEMEM
326 /* 326 /*
@@ -335,7 +335,7 @@ static void realview_pbx_fixup(struct machine_desc *mdesc, struct tag *tags,
335 meminfo->bank[2].size = SZ_256M; 335 meminfo->bank[2].size = SZ_256M;
336 meminfo->nr_banks = 3; 336 meminfo->nr_banks = 3;
337#else 337#else
338 realview_fixup(mdesc, tags, from, meminfo); 338 realview_fixup(tags, from, meminfo);
339#endif 339#endif
340} 340}
341 341
diff --git a/arch/arm/mach-rpc/Makefile.boot b/arch/arm/mach-rpc/Makefile.boot
index 9c9e7685ec7c..ae2df0d7d037 100644
--- a/arch/arm/mach-rpc/Makefile.boot
+++ b/arch/arm/mach-rpc/Makefile.boot
@@ -1,4 +1,4 @@
1 zreladdr-y := 0x10008000 1 zreladdr-y += 0x10008000
2params_phys-y := 0x10000100 2params_phys-y := 0x10000100
3initrd_phys-y := 0x18000000 3initrd_phys-y := 0x18000000
4 4
diff --git a/arch/arm/mach-rpc/include/mach/hardware.h b/arch/arm/mach-rpc/include/mach/hardware.h
index dde6b3c0e299..050d63c74cc1 100644
--- a/arch/arm/mach-rpc/include/mach/hardware.h
+++ b/arch/arm/mach-rpc/include/mach/hardware.h
@@ -36,7 +36,7 @@
36 36
37#define EASI_SIZE 0x08000000 /* EASI I/O */ 37#define EASI_SIZE 0x08000000 /* EASI I/O */
38#define EASI_START 0x08000000 38#define EASI_START 0x08000000
39#define EASI_BASE 0xe5000000 39#define EASI_BASE IOMEM(0xe5000000)
40 40
41#define IO_START 0x03000000 /* I/O */ 41#define IO_START 0x03000000 /* I/O */
42#define IO_SIZE 0x01000000 42#define IO_SIZE 0x01000000
@@ -51,21 +51,20 @@
51/* 51/*
52 * IO Addresses 52 * IO Addresses
53 */ 53 */
54#define VIDC_BASE IOMEM(0xe0400000) 54#define ECARD_EASI_BASE (EASI_BASE)
55#define EXPMASK_BASE 0xe0360000 55#define VIDC_BASE (IO_BASE + 0x00400000)
56#define IOMD_BASE IOMEM(0xe0200000) 56#define EXPMASK_BASE (IO_BASE + 0x00360000)
57#define IOC_BASE IOMEM(0xe0200000) 57#define ECARD_IOC4_BASE (IO_BASE + 0x00270000)
58#define PCIO_BASE IOMEM(0xe0010000) 58#define ECARD_IOC_BASE (IO_BASE + 0x00240000)
59#define FLOPPYDMA_BASE IOMEM(0xe002a000) 59#define IOMD_BASE (IO_BASE + 0x00200000)
60#define IOC_BASE (IO_BASE + 0x00200000)
61#define ECARD_MEMC8_BASE (IO_BASE + 0x0002b000)
62#define FLOPPYDMA_BASE (IO_BASE + 0x0002a000)
63#define PCIO_BASE (IO_BASE + 0x00010000)
64#define ECARD_MEMC_BASE (IO_BASE + 0x00000000)
60 65
61#define vidc_writel(val) __raw_writel(val, VIDC_BASE) 66#define vidc_writel(val) __raw_writel(val, VIDC_BASE)
62 67
63#define IO_EC_EASI_BASE 0x81400000
64#define IO_EC_IOC4_BASE 0x8009c000
65#define IO_EC_IOC_BASE 0x80090000
66#define IO_EC_MEMC8_BASE 0x8000ac00
67#define IO_EC_MEMC_BASE 0x80000000
68
69#define NETSLOT_BASE 0x0302b000 68#define NETSLOT_BASE 0x0302b000
70#define NETSLOT_SIZE 0x00001000 69#define NETSLOT_SIZE 0x00001000
71 70
diff --git a/arch/arm/mach-rpc/include/mach/io.h b/arch/arm/mach-rpc/include/mach/io.h
index 20da7f486e51..695f4ed2e11b 100644
--- a/arch/arm/mach-rpc/include/mach/io.h
+++ b/arch/arm/mach-rpc/include/mach/io.h
@@ -15,195 +15,18 @@
15 15
16#include <mach/hardware.h> 16#include <mach/hardware.h>
17 17
18#define IO_SPACE_LIMIT 0xffffffff 18#define IO_SPACE_LIMIT 0xffff
19 19
20/* 20/*
21 * We use two different types of addressing - PC style addresses, and ARM 21 * We need PC style IO addressing for:
22 * addresses. PC style accesses the PC hardware with the normal PC IO 22 * - floppy (at 0x3f2,0x3f4,0x3f5,0x3f7)
23 * addresses, eg 0x3f8 for serial#1. ARM addresses are 0x80000000+ 23 * - parport (at 0x278-0x27a, 0x27b-0x27f, 0x778-0x77a)
24 * and are translated to the start of IO. Note that all addresses are 24 * - 8250 serial (only for compile)
25 * shifted left!
26 */
27#define __PORT_PCIO(x) (!((x) & 0x80000000))
28
29/*
30 * Dynamic IO functions.
31 */
32static inline void __outb (unsigned int value, unsigned int port)
33{
34 unsigned long temp;
35 __asm__ __volatile__(
36 "tst %2, #0x80000000\n\t"
37 "mov %0, %4\n\t"
38 "addeq %0, %0, %3\n\t"
39 "strb %1, [%0, %2, lsl #2] @ outb"
40 : "=&r" (temp)
41 : "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)
42 : "cc");
43}
44
45static inline void __outw (unsigned int value, unsigned int port)
46{
47 unsigned long temp;
48 __asm__ __volatile__(
49 "tst %2, #0x80000000\n\t"
50 "mov %0, %4\n\t"
51 "addeq %0, %0, %3\n\t"
52 "str %1, [%0, %2, lsl #2] @ outw"
53 : "=&r" (temp)
54 : "r" (value|value<<16), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)
55 : "cc");
56}
57
58static inline void __outl (unsigned int value, unsigned int port)
59{
60 unsigned long temp;
61 __asm__ __volatile__(
62 "tst %2, #0x80000000\n\t"
63 "mov %0, %4\n\t"
64 "addeq %0, %0, %3\n\t"
65 "str %1, [%0, %2, lsl #2] @ outl"
66 : "=&r" (temp)
67 : "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)
68 : "cc");
69}
70
71#define DECLARE_DYN_IN(sz,fnsuffix,instr) \
72static inline unsigned sz __in##fnsuffix (unsigned int port) \
73{ \
74 unsigned long temp, value; \
75 __asm__ __volatile__( \
76 "tst %2, #0x80000000\n\t" \
77 "mov %0, %4\n\t" \
78 "addeq %0, %0, %3\n\t" \
79 "ldr" instr " %1, [%0, %2, lsl #2] @ in" #fnsuffix \
80 : "=&r" (temp), "=r" (value) \
81 : "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE) \
82 : "cc"); \
83 return (unsigned sz)value; \
84}
85
86static inline void __iomem *__deprecated __ioaddr(unsigned int port)
87{
88 void __iomem *ret;
89 if (__PORT_PCIO(port))
90 ret = PCIO_BASE;
91 else
92 ret = IO_BASE;
93 return ret + (port << 2);
94}
95
96#define DECLARE_IO(sz,fnsuffix,instr) \
97 DECLARE_DYN_IN(sz,fnsuffix,instr)
98
99DECLARE_IO(char,b,"b")
100DECLARE_IO(short,w,"")
101DECLARE_IO(int,l,"")
102
103#undef DECLARE_IO
104#undef DECLARE_DYN_IN
105
106/*
107 * Constant address IO functions
108 * 25 *
109 * These have to be macros for the 'J' constraint to work - 26 * These peripherals are found in an area of MMIO which looks very much
110 * +/-4096 immediate operand. 27 * like an ISA bus, but with registers at the low byte of each word.
111 */ 28 */
112#define __outbc(value,port) \ 29#define __io(a) (PCIO_BASE + ((a) << 2))
113({ \
114 if (__PORT_PCIO((port))) \
115 __asm__ __volatile__( \
116 "strb %0, [%1, %2] @ outbc" \
117 : : "r" (value), "r" (PCIO_BASE), "Jr" ((port) << 2)); \
118 else \
119 __asm__ __volatile__( \
120 "strb %0, [%1, %2] @ outbc" \
121 : : "r" (value), "r" (IO_BASE), "r" ((port) << 2)); \
122})
123
124#define __inbc(port) \
125({ \
126 unsigned char result; \
127 if (__PORT_PCIO((port))) \
128 __asm__ __volatile__( \
129 "ldrb %0, [%1, %2] @ inbc" \
130 : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \
131 else \
132 __asm__ __volatile__( \
133 "ldrb %0, [%1, %2] @ inbc" \
134 : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \
135 result; \
136})
137
138#define __outwc(value,port) \
139({ \
140 unsigned long __v = value; \
141 if (__PORT_PCIO((port))) \
142 __asm__ __volatile__( \
143 "str %0, [%1, %2] @ outwc" \
144 : : "r" (__v|__v<<16), "r" (PCIO_BASE), "Jr" ((port) << 2)); \
145 else \
146 __asm__ __volatile__( \
147 "str %0, [%1, %2] @ outwc" \
148 : : "r" (__v|__v<<16), "r" (IO_BASE), "r" ((port) << 2)); \
149})
150
151#define __inwc(port) \
152({ \
153 unsigned short result; \
154 if (__PORT_PCIO((port))) \
155 __asm__ __volatile__( \
156 "ldr %0, [%1, %2] @ inwc" \
157 : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \
158 else \
159 __asm__ __volatile__( \
160 "ldr %0, [%1, %2] @ inwc" \
161 : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \
162 result & 0xffff; \
163})
164
165#define __outlc(value,port) \
166({ \
167 unsigned long __v = value; \
168 if (__PORT_PCIO((port))) \
169 __asm__ __volatile__( \
170 "str %0, [%1, %2] @ outlc" \
171 : : "r" (__v), "r" (PCIO_BASE), "Jr" ((port) << 2)); \
172 else \
173 __asm__ __volatile__( \
174 "str %0, [%1, %2] @ outlc" \
175 : : "r" (__v), "r" (IO_BASE), "r" ((port) << 2)); \
176})
177
178#define __inlc(port) \
179({ \
180 unsigned long result; \
181 if (__PORT_PCIO((port))) \
182 __asm__ __volatile__( \
183 "ldr %0, [%1, %2] @ inlc" \
184 : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2)); \
185 else \
186 __asm__ __volatile__( \
187 "ldr %0, [%1, %2] @ inlc" \
188 : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2)); \
189 result; \
190})
191
192#define inb(p) (__builtin_constant_p((p)) ? __inbc(p) : __inb(p))
193#define inw(p) (__builtin_constant_p((p)) ? __inwc(p) : __inw(p))
194#define inl(p) (__builtin_constant_p((p)) ? __inlc(p) : __inl(p))
195#define outb(v,p) (__builtin_constant_p((p)) ? __outbc(v,p) : __outb(v,p))
196#define outw(v,p) (__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p))
197#define outl(v,p) (__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p))
198
199/* the following macro is deprecated */
200#define ioaddr(port) ((unsigned long)__ioaddr((port)))
201
202#define insb(p,d,l) __raw_readsb(__ioaddr(p),d,l)
203#define insw(p,d,l) __raw_readsw(__ioaddr(p),d,l)
204
205#define outsb(p,d,l) __raw_writesb(__ioaddr(p),d,l)
206#define outsw(p,d,l) __raw_writesw(__ioaddr(p),d,l)
207 30
208/* 31/*
209 * 1:1 mapping for ioremapped regions. 32 * 1:1 mapping for ioremapped regions.
diff --git a/arch/arm/mach-rpc/riscpc.c b/arch/arm/mach-rpc/riscpc.c
index a9241eb87724..8559598ab767 100644
--- a/arch/arm/mach-rpc/riscpc.c
+++ b/arch/arm/mach-rpc/riscpc.c
@@ -74,7 +74,7 @@ static struct map_desc rpc_io_desc[] __initdata = {
74 .length = IO_SIZE , 74 .length = IO_SIZE ,
75 .type = MT_DEVICE 75 .type = MT_DEVICE
76 }, { /* EASI space */ 76 }, { /* EASI space */
77 .virtual = EASI_BASE, 77 .virtual = (unsigned long)EASI_BASE,
78 .pfn = __phys_to_pfn(EASI_START), 78 .pfn = __phys_to_pfn(EASI_START),
79 .length = EASI_SIZE, 79 .length = EASI_SIZE,
80 .type = MT_DEVICE 80 .type = MT_DEVICE
diff --git a/arch/arm/mach-s3c2410/Makefile.boot b/arch/arm/mach-s3c2410/Makefile.boot
index 58c1dd7f8e1d..4457605ba04a 100644
--- a/arch/arm/mach-s3c2410/Makefile.boot
+++ b/arch/arm/mach-s3c2410/Makefile.boot
@@ -1,7 +1,7 @@
1ifeq ($(CONFIG_PM_H1940),y) 1ifeq ($(CONFIG_PM_H1940),y)
2 zreladdr-y := 0x30108000 2 zreladdr-y += 0x30108000
3 params_phys-y := 0x30100100 3 params_phys-y := 0x30100100
4else 4else
5 zreladdr-y := 0x30008000 5 zreladdr-y += 0x30008000
6 params_phys-y := 0x30000100 6 params_phys-y := 0x30000100
7endif 7endif
diff --git a/arch/arm/mach-s3c2410/include/mach/gpio.h b/arch/arm/mach-s3c2410/include/mach/gpio.h
index f7f6b07df30e..6fac70f3484e 100644
--- a/arch/arm/mach-s3c2410/include/mach/gpio.h
+++ b/arch/arm/mach-s3c2410/include/mach/gpio.h
@@ -11,11 +11,6 @@
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12*/ 12*/
13 13
14#define gpio_get_value __gpio_get_value
15#define gpio_set_value __gpio_set_value
16#define gpio_cansleep __gpio_cansleep
17#define gpio_to_irq __gpio_to_irq
18
19/* some boards require extra gpio capacity to support external 14/* some boards require extra gpio capacity to support external
20 * devices that need GPIO. 15 * devices that need GPIO.
21 */ 16 */
@@ -28,7 +23,6 @@
28#define ARCH_NR_GPIOS (256 + CONFIG_S3C24XX_GPIO_EXTRA) 23#define ARCH_NR_GPIOS (256 + CONFIG_S3C24XX_GPIO_EXTRA)
29#endif 24#endif
30 25
31#include <asm-generic/gpio.h>
32#include <mach/gpio-nrs.h> 26#include <mach/gpio-nrs.h>
33#include <mach/gpio-fns.h> 27#include <mach/gpio-fns.h>
34 28
diff --git a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
index 97e42bfce81e..fc897d3a056c 100644
--- a/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
+++ b/arch/arm/mach-s3c2410/include/mach/h1940-latch.h
@@ -14,7 +14,7 @@
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#include <asm/gpio.h>
18 18
19#define H1940_LATCH_GPIO(x) (S3C_GPIO_END + (x)) 19#define H1940_LATCH_GPIO(x) (S3C_GPIO_END + (x))
20 20
diff --git a/arch/arm/mach-s3c2410/include/mach/io.h b/arch/arm/mach-s3c2410/include/mach/io.h
index 9813dbf2ae4f..118749f37c4c 100644
--- a/arch/arm/mach-s3c2410/include/mach/io.h
+++ b/arch/arm/mach-s3c2410/include/mach/io.h
@@ -199,8 +199,6 @@ DECLARE_IO(int,l,"")
199#define outw(v,p) (__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p)) 199#define outw(v,p) (__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p))
200#define outl(v,p) (__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p)) 200#define outl(v,p) (__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p))
201#define __ioaddr(p) (__builtin_constant_p((p)) ? __ioaddr(p) : __ioaddrc(p)) 201#define __ioaddr(p) (__builtin_constant_p((p)) ? __ioaddr(p) : __ioaddrc(p))
202/* the following macro is deprecated */
203#define ioaddr(port) __ioaddr((port))
204 202
205#define insb(p,d,l) __raw_readsb(__ioaddr(p),d,l) 203#define insb(p,d,l) __raw_readsb(__ioaddr(p),d,l)
206#define insw(p,d,l) __raw_readsw(__ioaddr(p),d,l) 204#define insw(p,d,l) __raw_readsw(__ioaddr(p),d,l)
diff --git a/arch/arm/mach-s3c2410/s3c2410.c b/arch/arm/mach-s3c2410/s3c2410.c
index f1d3bd8f6f17..343a540d86a9 100644
--- a/arch/arm/mach-s3c2410/s3c2410.c
+++ b/arch/arm/mach-s3c2410/s3c2410.c
@@ -170,7 +170,9 @@ int __init s3c2410_init(void)
170{ 170{
171 printk("S3C2410: Initialising architecture\n"); 171 printk("S3C2410: Initialising architecture\n");
172 172
173#ifdef CONFIG_PM
173 register_syscore_ops(&s3c2410_pm_syscore_ops); 174 register_syscore_ops(&s3c2410_pm_syscore_ops);
175#endif
174 register_syscore_ops(&s3c24xx_irq_syscore_ops); 176 register_syscore_ops(&s3c24xx_irq_syscore_ops);
175 177
176 return sysdev_register(&s3c2410_sysdev); 178 return sysdev_register(&s3c2410_sysdev);
diff --git a/arch/arm/mach-s3c2412/mach-smdk2413.c b/arch/arm/mach-s3c2412/mach-smdk2413.c
index d6325ede9f29..f1eec1b54932 100644
--- a/arch/arm/mach-s3c2412/mach-smdk2413.c
+++ b/arch/arm/mach-s3c2412/mach-smdk2413.c
@@ -92,8 +92,7 @@ static struct platform_device *smdk2413_devices[] __initdata = {
92 &s3c_device_usbgadget, 92 &s3c_device_usbgadget,
93}; 93};
94 94
95static void __init smdk2413_fixup(struct machine_desc *desc, 95static void __init smdk2413_fixup(struct tag *tags, char **cmdline,
96 struct tag *tags, char **cmdline,
97 struct meminfo *mi) 96 struct meminfo *mi)
98{ 97{
99 if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) { 98 if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) {
diff --git a/arch/arm/mach-s3c2412/mach-vstms.c b/arch/arm/mach-s3c2412/mach-vstms.c
index 5955c15018b4..1bbb1ef5f4ff 100644
--- a/arch/arm/mach-s3c2412/mach-vstms.c
+++ b/arch/arm/mach-s3c2412/mach-vstms.c
@@ -129,9 +129,8 @@ static struct platform_device *vstms_devices[] __initdata = {
129 &s3c_device_nand, 129 &s3c_device_nand,
130}; 130};
131 131
132static void __init vstms_fixup(struct machine_desc *desc, 132static void __init vstms_fixup(struct tag *tags, char **cmdline,
133 struct tag *tags, char **cmdline, 133 struct meminfo *mi)
134 struct meminfo *mi)
135{ 134{
136 if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) { 135 if (tags != phys_to_virt(S3C2410_SDRAM_PA + 0x100)) {
137 mi->nr_banks=1; 136 mi->nr_banks=1;
diff --git a/arch/arm/mach-s3c2412/s3c2412.c b/arch/arm/mach-s3c2412/s3c2412.c
index ef0958d3e5c6..57a1e01e4e50 100644
--- a/arch/arm/mach-s3c2412/s3c2412.c
+++ b/arch/arm/mach-s3c2412/s3c2412.c
@@ -245,7 +245,9 @@ int __init s3c2412_init(void)
245{ 245{
246 printk("S3C2412: Initialising architecture\n"); 246 printk("S3C2412: Initialising architecture\n");
247 247
248#ifdef CONFIG_PM
248 register_syscore_ops(&s3c2412_pm_syscore_ops); 249 register_syscore_ops(&s3c2412_pm_syscore_ops);
250#endif
249 register_syscore_ops(&s3c24xx_irq_syscore_ops); 251 register_syscore_ops(&s3c24xx_irq_syscore_ops);
250 252
251 return sysdev_register(&s3c2412_sysdev); 253 return sysdev_register(&s3c2412_sysdev);
diff --git a/arch/arm/mach-s3c2416/s3c2416.c b/arch/arm/mach-s3c2416/s3c2416.c
index 494ce913dc95..20b3fdfb3051 100644
--- a/arch/arm/mach-s3c2416/s3c2416.c
+++ b/arch/arm/mach-s3c2416/s3c2416.c
@@ -97,7 +97,9 @@ int __init s3c2416_init(void)
97 97
98 s3c_fb_setname("s3c2443-fb"); 98 s3c_fb_setname("s3c2443-fb");
99 99
100#ifdef CONFIG_PM
100 register_syscore_ops(&s3c2416_pm_syscore_ops); 101 register_syscore_ops(&s3c2416_pm_syscore_ops);
102#endif
101 register_syscore_ops(&s3c24xx_irq_syscore_ops); 103 register_syscore_ops(&s3c24xx_irq_syscore_ops);
102 104
103 return sysdev_register(&s3c2416_sysdev); 105 return sysdev_register(&s3c2416_sysdev);
diff --git a/arch/arm/mach-s3c2440/s3c2440.c b/arch/arm/mach-s3c2440/s3c2440.c
index ce99ff72838d..2270d3360216 100644
--- a/arch/arm/mach-s3c2440/s3c2440.c
+++ b/arch/arm/mach-s3c2440/s3c2440.c
@@ -55,7 +55,9 @@ int __init s3c2440_init(void)
55 55
56 /* register suspend/resume handlers */ 56 /* register suspend/resume handlers */
57 57
58#ifdef CONFIG_PM
58 register_syscore_ops(&s3c2410_pm_syscore_ops); 59 register_syscore_ops(&s3c2410_pm_syscore_ops);
60#endif
59 register_syscore_ops(&s3c244x_pm_syscore_ops); 61 register_syscore_ops(&s3c244x_pm_syscore_ops);
60 register_syscore_ops(&s3c24xx_irq_syscore_ops); 62 register_syscore_ops(&s3c24xx_irq_syscore_ops);
61 63
diff --git a/arch/arm/mach-s3c2440/s3c2442.c b/arch/arm/mach-s3c2440/s3c2442.c
index 9ad99f8016a1..6f2b65e6e068 100644
--- a/arch/arm/mach-s3c2440/s3c2442.c
+++ b/arch/arm/mach-s3c2440/s3c2442.c
@@ -169,7 +169,9 @@ int __init s3c2442_init(void)
169{ 169{
170 printk("S3C2442: Initialising architecture\n"); 170 printk("S3C2442: Initialising architecture\n");
171 171
172#ifdef CONFIG_PM
172 register_syscore_ops(&s3c2410_pm_syscore_ops); 173 register_syscore_ops(&s3c2410_pm_syscore_ops);
174#endif
173 register_syscore_ops(&s3c244x_pm_syscore_ops); 175 register_syscore_ops(&s3c244x_pm_syscore_ops);
174 register_syscore_ops(&s3c24xx_irq_syscore_ops); 176 register_syscore_ops(&s3c24xx_irq_syscore_ops);
175 177
diff --git a/arch/arm/mach-s3c2443/clock.c b/arch/arm/mach-s3c2443/clock.c
index a1a7176675b9..38058af48972 100644
--- a/arch/arm/mach-s3c2443/clock.c
+++ b/arch/arm/mach-s3c2443/clock.c
@@ -128,7 +128,7 @@ static int s3c2443_armclk_setrate(struct clk *clk, unsigned long rate)
128 unsigned long clkcon0; 128 unsigned long clkcon0;
129 129
130 clkcon0 = __raw_readl(S3C2443_CLKDIV0); 130 clkcon0 = __raw_readl(S3C2443_CLKDIV0);
131 clkcon0 &= S3C2443_CLKDIV0_ARMDIV_MASK; 131 clkcon0 &= ~S3C2443_CLKDIV0_ARMDIV_MASK;
132 clkcon0 |= val << S3C2443_CLKDIV0_ARMDIV_SHIFT; 132 clkcon0 |= val << S3C2443_CLKDIV0_ARMDIV_SHIFT;
133 __raw_writel(clkcon0, S3C2443_CLKDIV0); 133 __raw_writel(clkcon0, S3C2443_CLKDIV0);
134 } 134 }
diff --git a/arch/arm/mach-s3c64xx/Makefile.boot b/arch/arm/mach-s3c64xx/Makefile.boot
index ba41fdc0a586..c642333af3ed 100644
--- a/arch/arm/mach-s3c64xx/Makefile.boot
+++ b/arch/arm/mach-s3c64xx/Makefile.boot
@@ -1,2 +1,2 @@
1 zreladdr-y := 0x50008000 1 zreladdr-y += 0x50008000
2params_phys-y := 0x50000100 2params_phys-y := 0x50000100
diff --git a/arch/arm/mach-s3c64xx/dev-uart.c b/arch/arm/mach-s3c64xx/dev-uart.c
index f797f748b999..c681b99eda08 100644
--- a/arch/arm/mach-s3c64xx/dev-uart.c
+++ b/arch/arm/mach-s3c64xx/dev-uart.c
@@ -37,21 +37,10 @@ static struct resource s3c64xx_uart0_resource[] = {
37 .flags = IORESOURCE_MEM, 37 .flags = IORESOURCE_MEM,
38 }, 38 },
39 [1] = { 39 [1] = {
40 .start = IRQ_S3CUART_RX0, 40 .start = IRQ_UART0,
41 .end = IRQ_S3CUART_RX0, 41 .end = IRQ_UART0,
42 .flags = IORESOURCE_IRQ, 42 .flags = IORESOURCE_IRQ,
43 }, 43 },
44 [2] = {
45 .start = IRQ_S3CUART_TX0,
46 .end = IRQ_S3CUART_TX0,
47 .flags = IORESOURCE_IRQ,
48
49 },
50 [3] = {
51 .start = IRQ_S3CUART_ERR0,
52 .end = IRQ_S3CUART_ERR0,
53 .flags = IORESOURCE_IRQ,
54 }
55}; 44};
56 45
57static struct resource s3c64xx_uart1_resource[] = { 46static struct resource s3c64xx_uart1_resource[] = {
@@ -61,19 +50,8 @@ static struct resource s3c64xx_uart1_resource[] = {
61 .flags = IORESOURCE_MEM, 50 .flags = IORESOURCE_MEM,
62 }, 51 },
63 [1] = { 52 [1] = {
64 .start = IRQ_S3CUART_RX1, 53 .start = IRQ_UART1,
65 .end = IRQ_S3CUART_RX1, 54 .end = IRQ_UART1,
66 .flags = IORESOURCE_IRQ,
67 },
68 [2] = {
69 .start = IRQ_S3CUART_TX1,
70 .end = IRQ_S3CUART_TX1,
71 .flags = IORESOURCE_IRQ,
72
73 },
74 [3] = {
75 .start = IRQ_S3CUART_ERR1,
76 .end = IRQ_S3CUART_ERR1,
77 .flags = IORESOURCE_IRQ, 55 .flags = IORESOURCE_IRQ,
78 }, 56 },
79}; 57};
@@ -85,19 +63,8 @@ static struct resource s3c6xx_uart2_resource[] = {
85 .flags = IORESOURCE_MEM, 63 .flags = IORESOURCE_MEM,
86 }, 64 },
87 [1] = { 65 [1] = {
88 .start = IRQ_S3CUART_RX2, 66 .start = IRQ_UART2,
89 .end = IRQ_S3CUART_RX2, 67 .end = IRQ_UART2,
90 .flags = IORESOURCE_IRQ,
91 },
92 [2] = {
93 .start = IRQ_S3CUART_TX2,
94 .end = IRQ_S3CUART_TX2,
95 .flags = IORESOURCE_IRQ,
96
97 },
98 [3] = {
99 .start = IRQ_S3CUART_ERR2,
100 .end = IRQ_S3CUART_ERR2,
101 .flags = IORESOURCE_IRQ, 68 .flags = IORESOURCE_IRQ,
102 }, 69 },
103}; 70};
@@ -109,19 +76,8 @@ static struct resource s3c64xx_uart3_resource[] = {
109 .flags = IORESOURCE_MEM, 76 .flags = IORESOURCE_MEM,
110 }, 77 },
111 [1] = { 78 [1] = {
112 .start = IRQ_S3CUART_RX3, 79 .start = IRQ_UART3,
113 .end = IRQ_S3CUART_RX3, 80 .end = IRQ_UART3,
114 .flags = IORESOURCE_IRQ,
115 },
116 [2] = {
117 .start = IRQ_S3CUART_TX3,
118 .end = IRQ_S3CUART_TX3,
119 .flags = IORESOURCE_IRQ,
120
121 },
122 [3] = {
123 .start = IRQ_S3CUART_ERR3,
124 .end = IRQ_S3CUART_ERR3,
125 .flags = IORESOURCE_IRQ, 81 .flags = IORESOURCE_IRQ,
126 }, 82 },
127}; 83};
diff --git a/arch/arm/mach-s3c64xx/include/mach/gpio.h b/arch/arm/mach-s3c64xx/include/mach/gpio.h
index 0d46e994048a..6e34c2f6e670 100644
--- a/arch/arm/mach-s3c64xx/include/mach/gpio.h
+++ b/arch/arm/mach-s3c64xx/include/mach/gpio.h
@@ -12,11 +12,6 @@
12 * published by the Free Software Foundation. 12 * published by the Free Software Foundation.
13*/ 13*/
14 14
15#define gpio_get_value __gpio_get_value
16#define gpio_set_value __gpio_set_value
17#define gpio_cansleep __gpio_cansleep
18#define gpio_to_irq __gpio_to_irq
19
20/* GPIO bank sizes */ 15/* GPIO bank sizes */
21#define S3C64XX_GPIO_A_NR (8) 16#define S3C64XX_GPIO_A_NR (8)
22#define S3C64XX_GPIO_B_NR (7) 17#define S3C64XX_GPIO_B_NR (7)
@@ -96,5 +91,3 @@ enum s3c_gpio_number {
96#define BOARD_NR_GPIOS 16 91#define BOARD_NR_GPIOS 16
97 92
98#define ARCH_NR_GPIOS (GPIO_BOARD_START + BOARD_NR_GPIOS) 93#define ARCH_NR_GPIOS (GPIO_BOARD_START + BOARD_NR_GPIOS)
99
100#include <asm-generic/gpio.h>
diff --git a/arch/arm/mach-s3c64xx/include/mach/irqs.h b/arch/arm/mach-s3c64xx/include/mach/irqs.h
index c026f67a80de..443f85b3c203 100644
--- a/arch/arm/mach-s3c64xx/include/mach/irqs.h
+++ b/arch/arm/mach-s3c64xx/include/mach/irqs.h
@@ -27,36 +27,6 @@
27#define IRQ_VIC0_BASE S3C_IRQ(0) 27#define IRQ_VIC0_BASE S3C_IRQ(0)
28#define IRQ_VIC1_BASE S3C_IRQ(32) 28#define IRQ_VIC1_BASE S3C_IRQ(32)
29 29
30/* UART interrupts, each UART has 4 intterupts per channel so
31 * use the space between the ISA and S3C main interrupts. Note, these
32 * are not in the same order as the S3C24XX series! */
33
34#define IRQ_S3CUART_BASE0 (16)
35#define IRQ_S3CUART_BASE1 (20)
36#define IRQ_S3CUART_BASE2 (24)
37#define IRQ_S3CUART_BASE3 (28)
38
39#define UART_IRQ_RXD (0)
40#define UART_IRQ_ERR (1)
41#define UART_IRQ_TXD (2)
42#define UART_IRQ_MODEM (3)
43
44#define IRQ_S3CUART_RX0 (IRQ_S3CUART_BASE0 + UART_IRQ_RXD)
45#define IRQ_S3CUART_TX0 (IRQ_S3CUART_BASE0 + UART_IRQ_TXD)
46#define IRQ_S3CUART_ERR0 (IRQ_S3CUART_BASE0 + UART_IRQ_ERR)
47
48#define IRQ_S3CUART_RX1 (IRQ_S3CUART_BASE1 + UART_IRQ_RXD)
49#define IRQ_S3CUART_TX1 (IRQ_S3CUART_BASE1 + UART_IRQ_TXD)
50#define IRQ_S3CUART_ERR1 (IRQ_S3CUART_BASE1 + UART_IRQ_ERR)
51
52#define IRQ_S3CUART_RX2 (IRQ_S3CUART_BASE2 + UART_IRQ_RXD)
53#define IRQ_S3CUART_TX2 (IRQ_S3CUART_BASE2 + UART_IRQ_TXD)
54#define IRQ_S3CUART_ERR2 (IRQ_S3CUART_BASE2 + UART_IRQ_ERR)
55
56#define IRQ_S3CUART_RX3 (IRQ_S3CUART_BASE3 + UART_IRQ_RXD)
57#define IRQ_S3CUART_TX3 (IRQ_S3CUART_BASE3 + UART_IRQ_TXD)
58#define IRQ_S3CUART_ERR3 (IRQ_S3CUART_BASE3 + UART_IRQ_ERR)
59
60/* VIC based IRQs */ 30/* VIC based IRQs */
61 31
62#define S3C64XX_IRQ_VIC0(x) (IRQ_VIC0_BASE + (x)) 32#define S3C64XX_IRQ_VIC0(x) (IRQ_VIC0_BASE + (x))
diff --git a/arch/arm/mach-s3c64xx/irq.c b/arch/arm/mach-s3c64xx/irq.c
index 75d9a0e49193..b07357e94958 100644
--- a/arch/arm/mach-s3c64xx/irq.c
+++ b/arch/arm/mach-s3c64xx/irq.c
@@ -25,29 +25,6 @@
25#include <plat/irq-uart.h> 25#include <plat/irq-uart.h>
26#include <plat/cpu.h> 26#include <plat/cpu.h>
27 27
28static struct s3c_uart_irq uart_irqs[] = {
29 [0] = {
30 .regs = S3C_VA_UART0,
31 .base_irq = IRQ_S3CUART_BASE0,
32 .parent_irq = IRQ_UART0,
33 },
34 [1] = {
35 .regs = S3C_VA_UART1,
36 .base_irq = IRQ_S3CUART_BASE1,
37 .parent_irq = IRQ_UART1,
38 },
39 [2] = {
40 .regs = S3C_VA_UART2,
41 .base_irq = IRQ_S3CUART_BASE2,
42 .parent_irq = IRQ_UART2,
43 },
44 [3] = {
45 .regs = S3C_VA_UART3,
46 .base_irq = IRQ_S3CUART_BASE3,
47 .parent_irq = IRQ_UART3,
48 },
49};
50
51/* setup the sources the vic should advertise resume for, even though it 28/* setup the sources the vic should advertise resume for, even though it
52 * is not doing the wake (set_irq_wake needs to be valid) */ 29 * is not doing the wake (set_irq_wake needs to be valid) */
53#define IRQ_VIC0_RESUME (1 << (IRQ_RTC_TIC - IRQ_VIC0_BASE)) 30#define IRQ_VIC0_RESUME (1 << (IRQ_RTC_TIC - IRQ_VIC0_BASE))
@@ -67,6 +44,4 @@ void __init s3c64xx_init_irq(u32 vic0_valid, u32 vic1_valid)
67 44
68 /* add the timer sub-irqs */ 45 /* add the timer sub-irqs */
69 s3c_init_vic_timer_irq(5, IRQ_TIMER0); 46 s3c_init_vic_timer_irq(5, IRQ_TIMER0);
70
71 s3c_init_uart_irqs(uart_irqs, ARRAY_SIZE(uart_irqs));
72} 47}
diff --git a/arch/arm/mach-s3c64xx/mach-smdk6410.c b/arch/arm/mach-s3c64xx/mach-smdk6410.c
index dcf2d73b4783..7b66ede9fbcd 100644
--- a/arch/arm/mach-s3c64xx/mach-smdk6410.c
+++ b/arch/arm/mach-s3c64xx/mach-smdk6410.c
@@ -262,45 +262,6 @@ static struct samsung_keypad_platdata smdk6410_keypad_data __initdata = {
262 .cols = 8, 262 .cols = 8,
263}; 263};
264 264
265static int smdk6410_backlight_init(struct device *dev)
266{
267 int ret;
268
269 ret = gpio_request(S3C64XX_GPF(15), "Backlight");
270 if (ret) {
271 printk(KERN_ERR "failed to request GPF for PWM-OUT1\n");
272 return ret;
273 }
274
275 /* Configure GPIO pin with S3C64XX_GPF15_PWM_TOUT1 */
276 s3c_gpio_cfgpin(S3C64XX_GPF(15), S3C_GPIO_SFN(2));
277
278 return 0;
279}
280
281static void smdk6410_backlight_exit(struct device *dev)
282{
283 s3c_gpio_cfgpin(S3C64XX_GPF(15), S3C_GPIO_OUTPUT);
284 gpio_free(S3C64XX_GPF(15));
285}
286
287static struct platform_pwm_backlight_data smdk6410_backlight_data = {
288 .pwm_id = 1,
289 .max_brightness = 255,
290 .dft_brightness = 255,
291 .pwm_period_ns = 78770,
292 .init = smdk6410_backlight_init,
293 .exit = smdk6410_backlight_exit,
294};
295
296static struct platform_device smdk6410_backlight_device = {
297 .name = "pwm-backlight",
298 .dev = {
299 .parent = &s3c_device_timer[1].dev,
300 .platform_data = &smdk6410_backlight_data,
301 },
302};
303
304static struct map_desc smdk6410_iodesc[] = {}; 265static struct map_desc smdk6410_iodesc[] = {};
305 266
306static struct platform_device *smdk6410_devices[] __initdata = { 267static struct platform_device *smdk6410_devices[] __initdata = {
diff --git a/arch/arm/mach-s5p64x0/Makefile.boot b/arch/arm/mach-s5p64x0/Makefile.boot
index ff90aa13bd67..79ece4055b02 100644
--- a/arch/arm/mach-s5p64x0/Makefile.boot
+++ b/arch/arm/mach-s5p64x0/Makefile.boot
@@ -1,2 +1,2 @@
1 zreladdr-y := 0x20008000 1 zreladdr-y += 0x20008000
2params_phys-y := 0x20000100 2params_phys-y := 0x20000100
diff --git a/arch/arm/mach-s5p64x0/include/mach/gpio.h b/arch/arm/mach-s5p64x0/include/mach/gpio.h
index adb5f298ead8..06cd3c9b16ac 100644
--- a/arch/arm/mach-s5p64x0/include/mach/gpio.h
+++ b/arch/arm/mach-s5p64x0/include/mach/gpio.h
@@ -13,11 +13,6 @@
13#ifndef __ASM_ARCH_GPIO_H 13#ifndef __ASM_ARCH_GPIO_H
14#define __ASM_ARCH_GPIO_H __FILE__ 14#define __ASM_ARCH_GPIO_H __FILE__
15 15
16#define gpio_get_value __gpio_get_value
17#define gpio_set_value __gpio_set_value
18#define gpio_cansleep __gpio_cansleep
19#define gpio_to_irq __gpio_to_irq
20
21/* GPIO bank sizes */ 16/* GPIO bank sizes */
22 17
23#define S5P6440_GPIO_A_NR (6) 18#define S5P6440_GPIO_A_NR (6)
@@ -134,6 +129,4 @@ enum s5p6450_gpio_number {
134 129
135#define ARCH_NR_GPIOS (S5P64X0_GPIO_END + CONFIG_SAMSUNG_GPIO_EXTRA) 130#define ARCH_NR_GPIOS (S5P64X0_GPIO_END + CONFIG_SAMSUNG_GPIO_EXTRA)
136 131
137#include <asm-generic/gpio.h>
138
139#endif /* __ASM_ARCH_GPIO_H */ 132#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-s5pc100/Makefile.boot b/arch/arm/mach-s5pc100/Makefile.boot
index ff90aa13bd67..79ece4055b02 100644
--- a/arch/arm/mach-s5pc100/Makefile.boot
+++ b/arch/arm/mach-s5pc100/Makefile.boot
@@ -1,2 +1,2 @@
1 zreladdr-y := 0x20008000 1 zreladdr-y += 0x20008000
2params_phys-y := 0x20000100 2params_phys-y := 0x20000100
diff --git a/arch/arm/mach-s5pc100/include/mach/gpio.h b/arch/arm/mach-s5pc100/include/mach/gpio.h
index 29a8a12d9b4f..5e1a924b595f 100644
--- a/arch/arm/mach-s5pc100/include/mach/gpio.h
+++ b/arch/arm/mach-s5pc100/include/mach/gpio.h
@@ -15,11 +15,6 @@
15#ifndef __ASM_ARCH_GPIO_H 15#ifndef __ASM_ARCH_GPIO_H
16#define __ASM_ARCH_GPIO_H __FILE__ 16#define __ASM_ARCH_GPIO_H __FILE__
17 17
18#define gpio_get_value __gpio_get_value
19#define gpio_set_value __gpio_set_value
20#define gpio_cansleep __gpio_cansleep
21#define gpio_to_irq __gpio_to_irq
22
23/* GPIO bank sizes */ 18/* GPIO bank sizes */
24#define S5PC100_GPIO_A0_NR (8) 19#define S5PC100_GPIO_A0_NR (8)
25#define S5PC100_GPIO_A1_NR (5) 20#define S5PC100_GPIO_A1_NR (5)
@@ -146,6 +141,4 @@ enum s5p_gpio_number {
146/* define the number of gpios we need to the one after the MP04() range */ 141/* define the number of gpios we need to the one after the MP04() range */
147#define ARCH_NR_GPIOS (S5PC100_GPIO_END + 1) 142#define ARCH_NR_GPIOS (S5PC100_GPIO_END + 1)
148 143
149#include <asm-generic/gpio.h>
150
151#endif /* __ASM_ARCH_GPIO_H */ 144#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-s5pv210/Makefile.boot b/arch/arm/mach-s5pv210/Makefile.boot
index ff90aa13bd67..79ece4055b02 100644
--- a/arch/arm/mach-s5pv210/Makefile.boot
+++ b/arch/arm/mach-s5pv210/Makefile.boot
@@ -1,2 +1,2 @@
1 zreladdr-y := 0x20008000 1 zreladdr-y += 0x20008000
2params_phys-y := 0x20000100 2params_phys-y := 0x20000100
diff --git a/arch/arm/mach-s5pv210/clock.c b/arch/arm/mach-s5pv210/clock.c
index 52a8e607bcc2..f5f8fa89679c 100644
--- a/arch/arm/mach-s5pv210/clock.c
+++ b/arch/arm/mach-s5pv210/clock.c
@@ -815,8 +815,7 @@ static struct clksrc_clk clksrcs[] = {
815 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 20, .size = 4 }, 815 .reg_div = { .reg = S5P_CLK_DIV3, .shift = 20, .size = 4 },
816 }, { 816 }, {
817 .clk = { 817 .clk = {
818 .name = "sclk_cam", 818 .name = "sclk_cam0",
819 .devname = "s5pv210-fimc.0",
820 .enable = s5pv210_clk_mask0_ctrl, 819 .enable = s5pv210_clk_mask0_ctrl,
821 .ctrlbit = (1 << 3), 820 .ctrlbit = (1 << 3),
822 }, 821 },
@@ -825,8 +824,7 @@ static struct clksrc_clk clksrcs[] = {
825 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 12, .size = 4 }, 824 .reg_div = { .reg = S5P_CLK_DIV1, .shift = 12, .size = 4 },
826 }, { 825 }, {
827 .clk = { 826 .clk = {
828 .name = "sclk_cam", 827 .name = "sclk_cam1",
829 .devname = "s5pv210-fimc.1",
830 .enable = s5pv210_clk_mask0_ctrl, 828 .enable = s5pv210_clk_mask0_ctrl,
831 .ctrlbit = (1 << 4), 829 .ctrlbit = (1 << 4),
832 }, 830 },
diff --git a/arch/arm/mach-s5pv210/include/mach/gpio.h b/arch/arm/mach-s5pv210/include/mach/gpio.h
index a5a1e331f8ed..6c8b903c02e4 100644
--- a/arch/arm/mach-s5pv210/include/mach/gpio.h
+++ b/arch/arm/mach-s5pv210/include/mach/gpio.h
@@ -13,11 +13,6 @@
13#ifndef __ASM_ARCH_GPIO_H 13#ifndef __ASM_ARCH_GPIO_H
14#define __ASM_ARCH_GPIO_H __FILE__ 14#define __ASM_ARCH_GPIO_H __FILE__
15 15
16#define gpio_get_value __gpio_get_value
17#define gpio_set_value __gpio_set_value
18#define gpio_cansleep __gpio_cansleep
19#define gpio_to_irq __gpio_to_irq
20
21/* Practically, GPIO banks up to MP03 are the configurable gpio banks */ 16/* Practically, GPIO banks up to MP03 are the configurable gpio banks */
22 17
23/* GPIO bank sizes */ 18/* GPIO bank sizes */
@@ -142,6 +137,4 @@ enum s5p_gpio_number {
142#define ARCH_NR_GPIOS (S5PV210_MP05(S5PV210_GPIO_MP05_NR) + \ 137#define ARCH_NR_GPIOS (S5PV210_MP05(S5PV210_GPIO_MP05_NR) + \
143 CONFIG_SAMSUNG_GPIO_EXTRA + 1) 138 CONFIG_SAMSUNG_GPIO_EXTRA + 1)
144 139
145#include <asm-generic/gpio.h>
146
147#endif /* __ASM_ARCH_GPIO_H */ 140#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-sa1100/Makefile b/arch/arm/mach-sa1100/Makefile
index 41252d22e659..ed7408d3216c 100644
--- a/arch/arm/mach-sa1100/Makefile
+++ b/arch/arm/mach-sa1100/Makefile
@@ -3,7 +3,7 @@
3# 3#
4 4
5# Common support 5# Common support
6obj-y := clock.o generic.o gpio.o irq.o dma.o time.o #nmi-oopser.o 6obj-y := clock.o generic.o irq.o dma.o time.o #nmi-oopser.o
7obj-m := 7obj-m :=
8obj-n := 8obj-n :=
9obj- := 9obj- :=
@@ -45,7 +45,6 @@ obj-$(CONFIG_SA1100_PLEB) += pleb.o
45obj-$(CONFIG_SA1100_SHANNON) += shannon.o 45obj-$(CONFIG_SA1100_SHANNON) += shannon.o
46 46
47obj-$(CONFIG_SA1100_SIMPAD) += simpad.o 47obj-$(CONFIG_SA1100_SIMPAD) += simpad.o
48led-$(CONFIG_SA1100_SIMPAD) += leds-simpad.o
49 48
50# LEDs support 49# LEDs support
51obj-$(CONFIG_LEDS) += $(led-y) 50obj-$(CONFIG_LEDS) += $(led-y)
diff --git a/arch/arm/mach-sa1100/Makefile.boot b/arch/arm/mach-sa1100/Makefile.boot
index a56ad0417cf2..5a616f6e5612 100644
--- a/arch/arm/mach-sa1100/Makefile.boot
+++ b/arch/arm/mach-sa1100/Makefile.boot
@@ -1,6 +1,7 @@
1 zreladdr-y := 0xc0008000
2ifeq ($(CONFIG_ARCH_SA1100),y) 1ifeq ($(CONFIG_ARCH_SA1100),y)
3 zreladdr-$(CONFIG_SA1111) := 0xc0208000 2 zreladdr-$(CONFIG_SA1111) += 0xc0208000
3else
4 zreladdr-y += 0xc0008000
4endif 5endif
5params_phys-y := 0xc0000100 6params_phys-y := 0xc0000100
6initrd_phys-y := 0xc0800000 7initrd_phys-y := 0xc0800000
diff --git a/arch/arm/mach-sa1100/assabet.c b/arch/arm/mach-sa1100/assabet.c
index d40da5f1f37b..3dd133f18415 100644
--- a/arch/arm/mach-sa1100/assabet.c
+++ b/arch/arm/mach-sa1100/assabet.c
@@ -301,8 +301,7 @@ static void __init get_assabet_scr(void)
301} 301}
302 302
303static void __init 303static void __init
304fixup_assabet(struct machine_desc *desc, struct tag *tags, 304fixup_assabet(struct tag *tags, char **cmdline, struct meminfo *mi)
305 char **cmdline, struct meminfo *mi)
306{ 305{
307 /* This must be done before any call to machine_has_neponset() */ 306 /* This must be done before any call to machine_has_neponset() */
308 map_sa1100_gpio_regs(); 307 map_sa1100_gpio_regs();
diff --git a/arch/arm/mach-sa1100/generic.c b/arch/arm/mach-sa1100/generic.c
index e21f3470eece..5fa5ae1f39e1 100644
--- a/arch/arm/mach-sa1100/generic.c
+++ b/arch/arm/mach-sa1100/generic.c
@@ -9,6 +9,7 @@
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12#include <linux/gpio.h>
12#include <linux/module.h> 13#include <linux/module.h>
13#include <linux/kernel.h> 14#include <linux/kernel.h>
14#include <linux/init.h> 15#include <linux/init.h>
@@ -24,7 +25,6 @@
24#include <asm/mach/map.h> 25#include <asm/mach/map.h>
25#include <asm/mach/flash.h> 26#include <asm/mach/flash.h>
26#include <asm/irq.h> 27#include <asm/irq.h>
27#include <asm/gpio.h>
28 28
29#include "generic.h" 29#include "generic.h"
30 30
diff --git a/arch/arm/mach-sa1100/gpio.c b/arch/arm/mach-sa1100/gpio.c
deleted file mode 100644
index 0d3829a8c2c1..000000000000
--- a/arch/arm/mach-sa1100/gpio.c
+++ /dev/null
@@ -1,65 +0,0 @@
1/*
2 * linux/arch/arm/mach-sa1100/gpio.c
3 *
4 * Generic SA-1100 GPIO handling
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/init.h>
12#include <linux/module.h>
13
14#include <asm/gpio.h>
15#include <mach/hardware.h>
16#include "generic.h"
17
18static int sa1100_gpio_get(struct gpio_chip *chip, unsigned offset)
19{
20 return GPLR & GPIO_GPIO(offset);
21}
22
23static void sa1100_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
24{
25 if (value)
26 GPSR = GPIO_GPIO(offset);
27 else
28 GPCR = GPIO_GPIO(offset);
29}
30
31static int sa1100_direction_input(struct gpio_chip *chip, unsigned offset)
32{
33 unsigned long flags;
34
35 local_irq_save(flags);
36 GPDR &= ~GPIO_GPIO(offset);
37 local_irq_restore(flags);
38 return 0;
39}
40
41static int sa1100_direction_output(struct gpio_chip *chip, unsigned offset, int value)
42{
43 unsigned long flags;
44
45 local_irq_save(flags);
46 sa1100_gpio_set(chip, offset, value);
47 GPDR |= GPIO_GPIO(offset);
48 local_irq_restore(flags);
49 return 0;
50}
51
52static struct gpio_chip sa1100_gpio_chip = {
53 .label = "gpio",
54 .direction_input = sa1100_direction_input,
55 .direction_output = sa1100_direction_output,
56 .set = sa1100_gpio_set,
57 .get = sa1100_gpio_get,
58 .base = 0,
59 .ngpio = GPIO_MAX + 1,
60};
61
62void __init sa1100_init_gpio(void)
63{
64 gpiochip_add(&sa1100_gpio_chip);
65}
diff --git a/arch/arm/mach-sa1100/include/mach/gpio.h b/arch/arm/mach-sa1100/include/mach/gpio.h
index 7befc104e9a9..703631887c94 100644
--- a/arch/arm/mach-sa1100/include/mach/gpio.h
+++ b/arch/arm/mach-sa1100/include/mach/gpio.h
@@ -28,6 +28,8 @@
28#include <asm/irq.h> 28#include <asm/irq.h>
29#include <asm-generic/gpio.h> 29#include <asm-generic/gpio.h>
30 30
31#define __ARM_GPIOLIB_COMPLEX
32
31static inline int gpio_get_value(unsigned gpio) 33static inline int gpio_get_value(unsigned gpio)
32{ 34{
33 if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX)) 35 if (__builtin_constant_p(gpio) && (gpio <= GPIO_MAX))
@@ -51,7 +53,5 @@ static inline void gpio_set_value(unsigned gpio, int value)
51 53
52#define gpio_to_irq(gpio) ((gpio < 11) ? (IRQ_GPIO0 + gpio) : \ 54#define gpio_to_irq(gpio) ((gpio < 11) ? (IRQ_GPIO0 + gpio) : \
53 (IRQ_GPIO11 - 11 + gpio)) 55 (IRQ_GPIO11 - 11 + gpio))
54#define irq_to_gpio(irq) ((irq < IRQ_GPIO11_27) ? (irq - IRQ_GPIO0) : \
55 (irq - IRQ_GPIO11 + 11))
56 56
57#endif 57#endif
diff --git a/arch/arm/mach-sa1100/include/mach/io.h b/arch/arm/mach-sa1100/include/mach/io.h
index d8b43f3dcd2d..dfc27ff08344 100644
--- a/arch/arm/mach-sa1100/include/mach/io.h
+++ b/arch/arm/mach-sa1100/include/mach/io.h
@@ -10,11 +10,9 @@
10#ifndef __ASM_ARM_ARCH_IO_H 10#ifndef __ASM_ARM_ARCH_IO_H
11#define __ASM_ARM_ARCH_IO_H 11#define __ASM_ARM_ARCH_IO_H
12 12
13#define IO_SPACE_LIMIT 0xffffffff
14
15/* 13/*
16 * We don't actually have real ISA nor PCI buses, but there is so many 14 * __io() is required to be an equivalent mapping to __mem_pci() for
17 * drivers out there that might just work if we fake them... 15 * SOC_COMMON to work.
18 */ 16 */
19#define __io(a) __typesafe_io(a) 17#define __io(a) __typesafe_io(a)
20#define __mem_pci(a) (a) 18#define __mem_pci(a) (a)
diff --git a/arch/arm/mach-sa1100/include/mach/simpad.h b/arch/arm/mach-sa1100/include/mach/simpad.h
index 9296c4513ce1..db28118103eb 100644
--- a/arch/arm/mach-sa1100/include/mach/simpad.h
+++ b/arch/arm/mach-sa1100/include/mach/simpad.h
@@ -48,32 +48,80 @@
48#define GPIO_SMART_CARD GPIO_GPIO10 48#define GPIO_SMART_CARD GPIO_GPIO10
49#define IRQ_GPIO_SMARD_CARD IRQ_GPIO10 49#define IRQ_GPIO_SMARD_CARD IRQ_GPIO10
50 50
51// CS3 Latch is write only, a shadow is necessary 51/*--- ucb1x00 GPIO ---*/
52#define SIMPAD_UCB1X00_GPIO_BASE (GPIO_MAX + 1)
53#define SIMPAD_UCB1X00_GPIO_PROG1 (SIMPAD_UCB1X00_GPIO_BASE)
54#define SIMPAD_UCB1X00_GPIO_PROG2 (SIMPAD_UCB1X00_GPIO_BASE + 1)
55#define SIMPAD_UCB1X00_GPIO_UP (SIMPAD_UCB1X00_GPIO_BASE + 2)
56#define SIMPAD_UCB1X00_GPIO_DOWN (SIMPAD_UCB1X00_GPIO_BASE + 3)
57#define SIMPAD_UCB1X00_GPIO_LEFT (SIMPAD_UCB1X00_GPIO_BASE + 4)
58#define SIMPAD_UCB1X00_GPIO_RIGHT (SIMPAD_UCB1X00_GPIO_BASE + 5)
59#define SIMPAD_UCB1X00_GPIO_6 (SIMPAD_UCB1X00_GPIO_BASE + 6)
60#define SIMPAD_UCB1X00_GPIO_7 (SIMPAD_UCB1X00_GPIO_BASE + 7)
61#define SIMPAD_UCB1X00_GPIO_HEADSET (SIMPAD_UCB1X00_GPIO_BASE + 8)
62#define SIMPAD_UCB1X00_GPIO_SPEAKER (SIMPAD_UCB1X00_GPIO_BASE + 9)
63
64/*--- CS3 Latch ---*/
65#define SIMPAD_CS3_GPIO_BASE (GPIO_MAX + 11)
66#define SIMPAD_CS3_VCC_5V_EN (SIMPAD_CS3_GPIO_BASE)
67#define SIMPAD_CS3_VCC_3V_EN (SIMPAD_CS3_GPIO_BASE + 1)
68#define SIMPAD_CS3_EN1 (SIMPAD_CS3_GPIO_BASE + 2)
69#define SIMPAD_CS3_EN0 (SIMPAD_CS3_GPIO_BASE + 3)
70#define SIMPAD_CS3_DISPLAY_ON (SIMPAD_CS3_GPIO_BASE + 4)
71#define SIMPAD_CS3_PCMCIA_BUFF_DIS (SIMPAD_CS3_GPIO_BASE + 5)
72#define SIMPAD_CS3_MQ_RESET (SIMPAD_CS3_GPIO_BASE + 6)
73#define SIMPAD_CS3_PCMCIA_RESET (SIMPAD_CS3_GPIO_BASE + 7)
74#define SIMPAD_CS3_DECT_POWER_ON (SIMPAD_CS3_GPIO_BASE + 8)
75#define SIMPAD_CS3_IRDA_SD (SIMPAD_CS3_GPIO_BASE + 9)
76#define SIMPAD_CS3_RS232_ON (SIMPAD_CS3_GPIO_BASE + 10)
77#define SIMPAD_CS3_SD_MEDIAQ (SIMPAD_CS3_GPIO_BASE + 11)
78#define SIMPAD_CS3_LED2_ON (SIMPAD_CS3_GPIO_BASE + 12)
79#define SIMPAD_CS3_IRDA_MODE (SIMPAD_CS3_GPIO_BASE + 13)
80#define SIMPAD_CS3_ENABLE_5V (SIMPAD_CS3_GPIO_BASE + 14)
81#define SIMPAD_CS3_RESET_SIMCARD (SIMPAD_CS3_GPIO_BASE + 15)
82
83#define SIMPAD_CS3_PCMCIA_BVD1 (SIMPAD_CS3_GPIO_BASE + 16)
84#define SIMPAD_CS3_PCMCIA_BVD2 (SIMPAD_CS3_GPIO_BASE + 17)
85#define SIMPAD_CS3_PCMCIA_VS1 (SIMPAD_CS3_GPIO_BASE + 18)
86#define SIMPAD_CS3_PCMCIA_VS2 (SIMPAD_CS3_GPIO_BASE + 19)
87#define SIMPAD_CS3_LOCK_IND (SIMPAD_CS3_GPIO_BASE + 20)
88#define SIMPAD_CS3_CHARGING_STATE (SIMPAD_CS3_GPIO_BASE + 21)
89#define SIMPAD_CS3_PCMCIA_SHORT (SIMPAD_CS3_GPIO_BASE + 22)
90#define SIMPAD_CS3_GPIO_23 (SIMPAD_CS3_GPIO_BASE + 23)
52 91
53#define CS3BUSTYPE unsigned volatile long
54#define CS3_BASE 0xf1000000 92#define CS3_BASE 0xf1000000
55 93
56#define VCC_5V_EN 0x0001 // For 5V PCMCIA 94long simpad_get_cs3_ro(void);
57#define VCC_3V_EN 0x0002 // FOR 3.3V PCMCIA 95long simpad_get_cs3_shadow(void);
58#define EN1 0x0004 // This is only for EPROM's 96void simpad_set_cs3_bit(int value);
59#define EN0 0x0008 // Both should be enable for 3.3V or 5V 97void simpad_clear_cs3_bit(int value);
60#define DISPLAY_ON 0x0010 98
61#define PCMCIA_BUFF_DIS 0x0020 99#define VCC_5V_EN 0x0001 /* For 5V PCMCIA */
62#define MQ_RESET 0x0040 100#define VCC_3V_EN 0x0002 /* FOR 3.3V PCMCIA */
63#define PCMCIA_RESET 0x0080 101#define EN1 0x0004 /* This is only for EPROM's */
64#define DECT_POWER_ON 0x0100 102#define EN0 0x0008 /* Both should be enable for 3.3V or 5V */
65#define IRDA_SD 0x0200 // Shutdown for powersave 103#define DISPLAY_ON 0x0010
66#define RS232_ON 0x0400 104#define PCMCIA_BUFF_DIS 0x0020
67#define SD_MEDIAQ 0x0800 // Shutdown for powersave 105#define MQ_RESET 0x0040
68#define LED2_ON 0x1000 106#define PCMCIA_RESET 0x0080
69#define IRDA_MODE 0x2000 // Fast/Slow IrDA mode 107#define DECT_POWER_ON 0x0100
70#define ENABLE_5V 0x4000 // Enable 5V circuit 108#define IRDA_SD 0x0200 /* Shutdown for powersave */
71#define RESET_SIMCARD 0x8000 109#define RS232_ON 0x0400
72 110#define SD_MEDIAQ 0x0800 /* Shutdown for powersave */
73#define RS232_ENABLE 0x0440 111#define LED2_ON 0x1000
74#define PCMCIAMASK 0x402f 112#define IRDA_MODE 0x2000 /* Fast/Slow IrDA mode */
75 113#define ENABLE_5V 0x4000 /* Enable 5V circuit */
76 114#define RESET_SIMCARD 0x8000
115
116#define PCMCIA_BVD1 0x01
117#define PCMCIA_BVD2 0x02
118#define PCMCIA_VS1 0x04
119#define PCMCIA_VS2 0x08
120#define LOCK_IND 0x10
121#define CHARGING_STATE 0x20
122#define PCMCIA_SHORT 0x40
123
124/*--- Battery ---*/
77struct simpad_battery { 125struct simpad_battery {
78 unsigned char ac_status; /* line connected yes/no */ 126 unsigned char ac_status; /* line connected yes/no */
79 unsigned char status; /* battery loading yes/no */ 127 unsigned char status; /* battery loading yes/no */
diff --git a/arch/arm/mach-sa1100/leds-simpad.c b/arch/arm/mach-sa1100/leds-simpad.c
deleted file mode 100644
index d50f4eeaa12e..000000000000
--- a/arch/arm/mach-sa1100/leds-simpad.c
+++ /dev/null
@@ -1,100 +0,0 @@
1/*
2 * linux/arch/arm/mach-sa1100/leds-simpad.c
3 *
4 * Author: Juergen Messerer <juergen.messerer@siemens.ch>
5 */
6#include <linux/init.h>
7
8#include <mach/hardware.h>
9#include <asm/leds.h>
10#include <asm/system.h>
11#include <mach/simpad.h>
12
13#include "leds.h"
14
15
16#define LED_STATE_ENABLED 1
17#define LED_STATE_CLAIMED 2
18
19static unsigned int led_state;
20static unsigned int hw_led_state;
21
22#define LED_GREEN (1)
23#define LED_MASK (1)
24
25extern void set_cs3_bit(int value);
26extern void clear_cs3_bit(int value);
27
28void simpad_leds_event(led_event_t evt)
29{
30 switch (evt)
31 {
32 case led_start:
33 hw_led_state = LED_GREEN;
34 led_state = LED_STATE_ENABLED;
35 break;
36
37 case led_stop:
38 led_state &= ~LED_STATE_ENABLED;
39 break;
40
41 case led_claim:
42 led_state |= LED_STATE_CLAIMED;
43 hw_led_state = LED_GREEN;
44 break;
45
46 case led_release:
47 led_state &= ~LED_STATE_CLAIMED;
48 hw_led_state = LED_GREEN;
49 break;
50
51#ifdef CONFIG_LEDS_TIMER
52 case led_timer:
53 if (!(led_state & LED_STATE_CLAIMED))
54 hw_led_state ^= LED_GREEN;
55 break;
56#endif
57
58#ifdef CONFIG_LEDS_CPU
59 case led_idle_start:
60 break;
61
62 case led_idle_end:
63 break;
64#endif
65
66 case led_halted:
67 break;
68
69 case led_green_on:
70 if (led_state & LED_STATE_CLAIMED)
71 hw_led_state |= LED_GREEN;
72 break;
73
74 case led_green_off:
75 if (led_state & LED_STATE_CLAIMED)
76 hw_led_state &= ~LED_GREEN;
77 break;
78
79 case led_amber_on:
80 break;
81
82 case led_amber_off:
83 break;
84
85 case led_red_on:
86 break;
87
88 case led_red_off:
89 break;
90
91 default:
92 break;
93 }
94
95 if (led_state & LED_STATE_ENABLED)
96 set_cs3_bit(LED2_ON);
97 else
98 clear_cs3_bit(LED2_ON);
99}
100
diff --git a/arch/arm/mach-sa1100/leds.c b/arch/arm/mach-sa1100/leds.c
index bbfe197fb4d6..5fe71a0f1053 100644
--- a/arch/arm/mach-sa1100/leds.c
+++ b/arch/arm/mach-sa1100/leds.c
@@ -42,8 +42,6 @@ sa1100_leds_init(void)
42 leds_event = adsbitsy_leds_event; 42 leds_event = adsbitsy_leds_event;
43 if (machine_is_pt_system3()) 43 if (machine_is_pt_system3())
44 leds_event = system3_leds_event; 44 leds_event = system3_leds_event;
45 if (machine_is_simpad())
46 leds_event = simpad_leds_event; /* what about machine registry? including led, apm... -zecke */
47 45
48 leds_event(led_start); 46 leds_event(led_start);
49 return 0; 47 return 0;
diff --git a/arch/arm/mach-sa1100/leds.h b/arch/arm/mach-sa1100/leds.h
index 68cc9f773d6d..776b6020f550 100644
--- a/arch/arm/mach-sa1100/leds.h
+++ b/arch/arm/mach-sa1100/leds.h
@@ -11,4 +11,3 @@ extern void pfs168_leds_event(led_event_t evt);
11extern void graphicsmaster_leds_event(led_event_t evt); 11extern void graphicsmaster_leds_event(led_event_t evt);
12extern void adsbitsy_leds_event(led_event_t evt); 12extern void adsbitsy_leds_event(led_event_t evt);
13extern void system3_leds_event(led_event_t evt); 13extern void system3_leds_event(led_event_t evt);
14extern void simpad_leds_event(led_event_t evt);
diff --git a/arch/arm/mach-sa1100/simpad.c b/arch/arm/mach-sa1100/simpad.c
index a1c2427655da..4790f3f3d008 100644
--- a/arch/arm/mach-sa1100/simpad.c
+++ b/arch/arm/mach-sa1100/simpad.c
@@ -13,6 +13,7 @@
13#include <linux/mtd/mtd.h> 13#include <linux/mtd/mtd.h>
14#include <linux/mtd/partitions.h> 14#include <linux/mtd/partitions.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/gpio.h>
16 17
17#include <asm/irq.h> 18#include <asm/irq.h>
18#include <mach/hardware.h> 19#include <mach/hardware.h>
@@ -28,35 +29,92 @@
28 29
29#include <linux/serial_core.h> 30#include <linux/serial_core.h>
30#include <linux/ioport.h> 31#include <linux/ioport.h>
32#include <linux/input.h>
33#include <linux/gpio_keys.h>
34#include <linux/leds.h>
35#include <linux/i2c-gpio.h>
31 36
32#include "generic.h" 37#include "generic.h"
33 38
34long cs3_shadow; 39/*
40 * CS3 support
41 */
35 42
36long get_cs3_shadow(void) 43static long cs3_shadow;
44static spinlock_t cs3_lock;
45static struct gpio_chip cs3_gpio;
46
47long simpad_get_cs3_ro(void)
48{
49 return readl(CS3_BASE);
50}
51EXPORT_SYMBOL(simpad_get_cs3_ro);
52
53long simpad_get_cs3_shadow(void)
37{ 54{
38 return cs3_shadow; 55 return cs3_shadow;
39} 56}
57EXPORT_SYMBOL(simpad_get_cs3_shadow);
40 58
41void set_cs3(long value) 59static void __simpad_write_cs3(void)
42{ 60{
43 *(CS3BUSTYPE *)(CS3_BASE) = cs3_shadow = value; 61 writel(cs3_shadow, CS3_BASE);
44} 62}
45 63
46void set_cs3_bit(int value) 64void simpad_set_cs3_bit(int value)
47{ 65{
66 unsigned long flags;
67
68 spin_lock_irqsave(&cs3_lock, flags);
48 cs3_shadow |= value; 69 cs3_shadow |= value;
49 *(CS3BUSTYPE *)(CS3_BASE) = cs3_shadow; 70 __simpad_write_cs3();
71 spin_unlock_irqrestore(&cs3_lock, flags);
50} 72}
73EXPORT_SYMBOL(simpad_set_cs3_bit);
51 74
52void clear_cs3_bit(int value) 75void simpad_clear_cs3_bit(int value)
53{ 76{
77 unsigned long flags;
78
79 spin_lock_irqsave(&cs3_lock, flags);
54 cs3_shadow &= ~value; 80 cs3_shadow &= ~value;
55 *(CS3BUSTYPE *)(CS3_BASE) = cs3_shadow; 81 __simpad_write_cs3();
82 spin_unlock_irqrestore(&cs3_lock, flags);
56} 83}
84EXPORT_SYMBOL(simpad_clear_cs3_bit);
85
86static void cs3_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
87{
88 if (offset > 15)
89 return;
90 if (value)
91 simpad_set_cs3_bit(1 << offset);
92 else
93 simpad_clear_cs3_bit(1 << offset);
94};
95
96static int cs3_gpio_get(struct gpio_chip *chip, unsigned offset)
97{
98 if (offset > 15)
99 return simpad_get_cs3_ro() & (1 << (offset - 16));
100 return simpad_get_cs3_shadow() & (1 << offset);
101};
57 102
58EXPORT_SYMBOL(set_cs3_bit); 103static int cs3_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
59EXPORT_SYMBOL(clear_cs3_bit); 104{
105 if (offset > 15)
106 return 0;
107 return -EINVAL;
108};
109
110static int cs3_gpio_direction_output(struct gpio_chip *chip, unsigned offset,
111 int value)
112{
113 if (offset > 15)
114 return -EINVAL;
115 cs3_gpio_set(chip, offset, value);
116 return 0;
117};
60 118
61static struct map_desc simpad_io_desc[] __initdata = { 119static struct map_desc simpad_io_desc[] __initdata = {
62 { /* MQ200 */ 120 { /* MQ200 */
@@ -64,9 +122,9 @@ static struct map_desc simpad_io_desc[] __initdata = {
64 .pfn = __phys_to_pfn(0x4b800000), 122 .pfn = __phys_to_pfn(0x4b800000),
65 .length = 0x00800000, 123 .length = 0x00800000,
66 .type = MT_DEVICE 124 .type = MT_DEVICE
67 }, { /* Paules CS3, write only */ 125 }, { /* Simpad CS3 */
68 .virtual = 0xf1000000, 126 .virtual = CS3_BASE,
69 .pfn = __phys_to_pfn(0x18000000), 127 .pfn = __phys_to_pfn(SA1100_CS3_PHYS),
70 .length = 0x00100000, 128 .length = 0x00100000,
71 .type = MT_DEVICE 129 .type = MT_DEVICE
72 }, 130 },
@@ -78,12 +136,12 @@ static void simpad_uart_pm(struct uart_port *port, u_int state, u_int oldstate)
78 if (port->mapbase == (u_int)&Ser1UTCR0) { 136 if (port->mapbase == (u_int)&Ser1UTCR0) {
79 if (state) 137 if (state)
80 { 138 {
81 clear_cs3_bit(RS232_ON); 139 simpad_clear_cs3_bit(RS232_ON);
82 clear_cs3_bit(DECT_POWER_ON); 140 simpad_clear_cs3_bit(DECT_POWER_ON);
83 }else 141 }else
84 { 142 {
85 set_cs3_bit(RS232_ON); 143 simpad_set_cs3_bit(RS232_ON);
86 set_cs3_bit(DECT_POWER_ON); 144 simpad_set_cs3_bit(DECT_POWER_ON);
87 } 145 }
88 } 146 }
89} 147}
@@ -132,6 +190,7 @@ static struct resource simpad_flash_resources [] = {
132static struct mcp_plat_data simpad_mcp_data = { 190static struct mcp_plat_data simpad_mcp_data = {
133 .mccr0 = MCCR0_ADM, 191 .mccr0 = MCCR0_ADM,
134 .sclk_rate = 11981000, 192 .sclk_rate = 11981000,
193 .gpio_base = SIMPAD_UCB1X00_GPIO_BASE,
135}; 194};
136 195
137 196
@@ -142,9 +201,10 @@ static void __init simpad_map_io(void)
142 201
143 iotable_init(simpad_io_desc, ARRAY_SIZE(simpad_io_desc)); 202 iotable_init(simpad_io_desc, ARRAY_SIZE(simpad_io_desc));
144 203
145 set_cs3_bit (EN1 | EN0 | LED2_ON | DISPLAY_ON | RS232_ON | 204 /* Initialize CS3 */
146 ENABLE_5V | RESET_SIMCARD | DECT_POWER_ON); 205 cs3_shadow = (EN1 | EN0 | LED2_ON | DISPLAY_ON |
147 206 RS232_ON | ENABLE_5V | RESET_SIMCARD | DECT_POWER_ON);
207 __simpad_write_cs3(); /* Spinlocks not yet initialized */
148 208
149 sa1100_register_uart_fns(&simpad_port_fns); 209 sa1100_register_uart_fns(&simpad_port_fns);
150 sa1100_register_uart(0, 3); /* serial interface */ 210 sa1100_register_uart(0, 3); /* serial interface */
@@ -170,13 +230,14 @@ static void __init simpad_map_io(void)
170 230
171static void simpad_power_off(void) 231static void simpad_power_off(void)
172{ 232{
173 local_irq_disable(); // was cli 233 local_irq_disable();
174 set_cs3(0x800); /* only SD_MEDIAQ */ 234 cs3_shadow = SD_MEDIAQ;
235 __simpad_write_cs3(); /* Bypass spinlock here */
175 236
176 /* disable internal oscillator, float CS lines */ 237 /* disable internal oscillator, float CS lines */
177 PCFR = (PCFR_OPDE | PCFR_FP | PCFR_FS); 238 PCFR = (PCFR_OPDE | PCFR_FP | PCFR_FS);
178 /* enable wake-up on GPIO0 (Assabet...) */ 239 /* enable wake-up on GPIO0 */
179 PWER = GFER = GRER = 1; 240 PWER = GFER = GRER = PWER_GPIO0;
180 /* 241 /*
181 * set scratchpad to zero, just in case it is used as a 242 * set scratchpad to zero, just in case it is used as a
182 * restart address by the bootloader. 243 * restart address by the bootloader.
@@ -192,6 +253,91 @@ static void simpad_power_off(void)
192 253
193} 254}
194 255
256/*
257 * gpio_keys
258*/
259
260static struct gpio_keys_button simpad_button_table[] = {
261 { KEY_POWER, IRQ_GPIO_POWER_BUTTON, 1, "power button" },
262};
263
264static struct gpio_keys_platform_data simpad_keys_data = {
265 .buttons = simpad_button_table,
266 .nbuttons = ARRAY_SIZE(simpad_button_table),
267};
268
269static struct platform_device simpad_keys = {
270 .name = "gpio-keys",
271 .dev = {
272 .platform_data = &simpad_keys_data,
273 },
274};
275
276static struct gpio_keys_button simpad_polled_button_table[] = {
277 { KEY_PROG1, SIMPAD_UCB1X00_GPIO_PROG1, 1, "prog1 button" },
278 { KEY_PROG2, SIMPAD_UCB1X00_GPIO_PROG2, 1, "prog2 button" },
279 { KEY_UP, SIMPAD_UCB1X00_GPIO_UP, 1, "up button" },
280 { KEY_DOWN, SIMPAD_UCB1X00_GPIO_DOWN, 1, "down button" },
281 { KEY_LEFT, SIMPAD_UCB1X00_GPIO_LEFT, 1, "left button" },
282 { KEY_RIGHT, SIMPAD_UCB1X00_GPIO_RIGHT, 1, "right button" },
283};
284
285static struct gpio_keys_platform_data simpad_polled_keys_data = {
286 .buttons = simpad_polled_button_table,
287 .nbuttons = ARRAY_SIZE(simpad_polled_button_table),
288 .poll_interval = 50,
289};
290
291static struct platform_device simpad_polled_keys = {
292 .name = "gpio-keys-polled",
293 .dev = {
294 .platform_data = &simpad_polled_keys_data,
295 },
296};
297
298/*
299 * GPIO LEDs
300 */
301
302static struct gpio_led simpad_leds[] = {
303 {
304 .name = "simpad:power",
305 .gpio = SIMPAD_CS3_LED2_ON,
306 .active_low = 0,
307 .default_trigger = "default-on",
308 },
309};
310
311static struct gpio_led_platform_data simpad_led_data = {
312 .num_leds = ARRAY_SIZE(simpad_leds),
313 .leds = simpad_leds,
314};
315
316static struct platform_device simpad_gpio_leds = {
317 .name = "leds-gpio",
318 .id = 0,
319 .dev = {
320 .platform_data = &simpad_led_data,
321 },
322};
323
324/*
325 * i2c
326 */
327static struct i2c_gpio_platform_data simpad_i2c_data = {
328 .sda_pin = GPIO_GPIO21,
329 .scl_pin = GPIO_GPIO25,
330 .udelay = 10,
331 .timeout = HZ,
332};
333
334static struct platform_device simpad_i2c = {
335 .name = "i2c-gpio",
336 .id = 0,
337 .dev = {
338 .platform_data = &simpad_i2c_data,
339 },
340};
195 341
196/* 342/*
197 * MediaQ Video Device 343 * MediaQ Video Device
@@ -202,7 +348,11 @@ static struct platform_device simpad_mq200fb = {
202}; 348};
203 349
204static struct platform_device *devices[] __initdata = { 350static struct platform_device *devices[] __initdata = {
205 &simpad_mq200fb 351 &simpad_keys,
352 &simpad_polled_keys,
353 &simpad_mq200fb,
354 &simpad_gpio_leds,
355 &simpad_i2c,
206}; 356};
207 357
208 358
@@ -211,6 +361,19 @@ static int __init simpad_init(void)
211{ 361{
212 int ret; 362 int ret;
213 363
364 spin_lock_init(&cs3_lock);
365
366 cs3_gpio.label = "simpad_cs3";
367 cs3_gpio.base = SIMPAD_CS3_GPIO_BASE;
368 cs3_gpio.ngpio = 24;
369 cs3_gpio.set = cs3_gpio_set;
370 cs3_gpio.get = cs3_gpio_get;
371 cs3_gpio.direction_input = cs3_gpio_direction_input;
372 cs3_gpio.direction_output = cs3_gpio_direction_output;
373 ret = gpiochip_add(&cs3_gpio);
374 if (ret)
375 printk(KERN_WARNING "simpad: Unable to register cs3 GPIO device");
376
214 pm_power_off = simpad_power_off; 377 pm_power_off = simpad_power_off;
215 378
216 sa11x0_register_mtd(&simpad_flash_data, simpad_flash_resources, 379 sa11x0_register_mtd(&simpad_flash_data, simpad_flash_resources,
diff --git a/arch/arm/mach-shark/Makefile.boot b/arch/arm/mach-shark/Makefile.boot
index 4320f8b92771..e40e24e4ca34 100644
--- a/arch/arm/mach-shark/Makefile.boot
+++ b/arch/arm/mach-shark/Makefile.boot
@@ -1,2 +1,2 @@
1 zreladdr-y := 0x08008000 1 zreladdr-y += 0x08008000
2 2
diff --git a/arch/arm/mach-shark/leds.c b/arch/arm/mach-shark/leds.c
index c9e32de4adf9..ccd49189bbd0 100644
--- a/arch/arm/mach-shark/leds.c
+++ b/arch/arm/mach-shark/leds.c
@@ -36,7 +36,7 @@ static char led_state;
36static short hw_led_state; 36static short hw_led_state;
37static short saved_state; 37static short saved_state;
38 38
39static DEFINE_SPINLOCK(leds_lock); 39static DEFINE_RAW_SPINLOCK(leds_lock);
40 40
41short sequoia_read(int addr) { 41short sequoia_read(int addr) {
42 outw(addr,0x24); 42 outw(addr,0x24);
@@ -52,7 +52,7 @@ static void sequoia_leds_event(led_event_t evt)
52{ 52{
53 unsigned long flags; 53 unsigned long flags;
54 54
55 spin_lock_irqsave(&leds_lock, flags); 55 raw_spin_lock_irqsave(&leds_lock, flags);
56 56
57 hw_led_state = sequoia_read(0x09); 57 hw_led_state = sequoia_read(0x09);
58 58
@@ -144,7 +144,7 @@ static void sequoia_leds_event(led_event_t evt)
144 if (led_state & LED_STATE_ENABLED) 144 if (led_state & LED_STATE_ENABLED)
145 sequoia_write(hw_led_state,0x09); 145 sequoia_write(hw_led_state,0x09);
146 146
147 spin_unlock_irqrestore(&leds_lock, flags); 147 raw_spin_unlock_irqrestore(&leds_lock, flags);
148} 148}
149 149
150static int __init leds_init(void) 150static int __init leds_init(void)
diff --git a/arch/arm/mach-shmobile/Makefile.boot b/arch/arm/mach-shmobile/Makefile.boot
index 1c08ee9de86a..498efd99338d 100644
--- a/arch/arm/mach-shmobile/Makefile.boot
+++ b/arch/arm/mach-shmobile/Makefile.boot
@@ -1,7 +1,7 @@
1__ZRELADDR := $(shell /bin/bash -c 'printf "0x%08x" \ 1__ZRELADDR := $(shell /bin/bash -c 'printf "0x%08x" \
2 $$[$(CONFIG_MEMORY_START) + 0x8000]') 2 $$[$(CONFIG_MEMORY_START) + 0x8000]')
3 3
4 zreladdr-y := $(__ZRELADDR) 4 zreladdr-y += $(__ZRELADDR)
5 5
6# Unsupported legacy stuff 6# Unsupported legacy stuff
7# 7#
diff --git a/arch/arm/mach-shmobile/board-ap4evb.c b/arch/arm/mach-shmobile/board-ap4evb.c
index b622d8d3ab72..5b7edadf4647 100644
--- a/arch/arm/mach-shmobile/board-ap4evb.c
+++ b/arch/arm/mach-shmobile/board-ap4evb.c
@@ -42,6 +42,7 @@
42#include <linux/leds.h> 42#include <linux/leds.h>
43#include <linux/input/sh_keysc.h> 43#include <linux/input/sh_keysc.h>
44#include <linux/usb/r8a66597.h> 44#include <linux/usb/r8a66597.h>
45#include <linux/pm_clock.h>
45#include <linux/dma-mapping.h> 46#include <linux/dma-mapping.h>
46 47
47#include <media/sh_mobile_ceu.h> 48#include <media/sh_mobile_ceu.h>
@@ -1411,6 +1412,11 @@ static void __init ap4evb_init(void)
1411 sh7372_add_device_to_domain(&sh7372_a4lc, &lcdc_device); 1412 sh7372_add_device_to_domain(&sh7372_a4lc, &lcdc_device);
1412 sh7372_add_device_to_domain(&sh7372_a4mp, &fsi_device); 1413 sh7372_add_device_to_domain(&sh7372_a4mp, &fsi_device);
1413 1414
1415 sh7372_add_device_to_domain(&sh7372_a3sp, &sh_mmcif_device);
1416 sh7372_add_device_to_domain(&sh7372_a3sp, &sdhi0_device);
1417 sh7372_add_device_to_domain(&sh7372_a3sp, &sdhi1_device);
1418 sh7372_add_device_to_domain(&sh7372_a4r, &ceu_device);
1419
1414 hdmi_init_pm_clock(); 1420 hdmi_init_pm_clock();
1415 fsi_init_pm_clock(); 1421 fsi_init_pm_clock();
1416 sh7372_pm_init(); 1422 sh7372_pm_init();
diff --git a/arch/arm/mach-shmobile/board-mackerel.c b/arch/arm/mach-shmobile/board-mackerel.c
index de2253d7f157..7d073c121941 100644
--- a/arch/arm/mach-shmobile/board-mackerel.c
+++ b/arch/arm/mach-shmobile/board-mackerel.c
@@ -39,7 +39,7 @@
39#include <linux/mtd/mtd.h> 39#include <linux/mtd/mtd.h>
40#include <linux/mtd/partitions.h> 40#include <linux/mtd/partitions.h>
41#include <linux/mtd/physmap.h> 41#include <linux/mtd/physmap.h>
42#include <linux/pm_runtime.h> 42#include <linux/pm_clock.h>
43#include <linux/smsc911x.h> 43#include <linux/smsc911x.h>
44#include <linux/sh_intc.h> 44#include <linux/sh_intc.h>
45#include <linux/tca6416_keypad.h> 45#include <linux/tca6416_keypad.h>
@@ -811,6 +811,7 @@ static struct usbhs_private usbhs1_private = {
811 }, 811 },
812 .driver_param = { 812 .driver_param = {
813 .buswait_bwait = 4, 813 .buswait_bwait = 4,
814 .has_otg = 1,
814 .pipe_type = usbhs1_pipe_cfg, 815 .pipe_type = usbhs1_pipe_cfg,
815 .pipe_size = ARRAY_SIZE(usbhs1_pipe_cfg), 816 .pipe_size = ARRAY_SIZE(usbhs1_pipe_cfg),
816 .d0_tx_id = SHDMA_SLAVE_USB1_TX, 817 .d0_tx_id = SHDMA_SLAVE_USB1_TX,
@@ -1591,6 +1592,15 @@ static void __init mackerel_init(void)
1591 sh7372_add_device_to_domain(&sh7372_a4lc, &lcdc_device); 1592 sh7372_add_device_to_domain(&sh7372_a4lc, &lcdc_device);
1592 sh7372_add_device_to_domain(&sh7372_a4lc, &hdmi_lcdc_device); 1593 sh7372_add_device_to_domain(&sh7372_a4lc, &hdmi_lcdc_device);
1593 sh7372_add_device_to_domain(&sh7372_a4mp, &fsi_device); 1594 sh7372_add_device_to_domain(&sh7372_a4mp, &fsi_device);
1595 sh7372_add_device_to_domain(&sh7372_a3sp, &usbhs0_device);
1596 sh7372_add_device_to_domain(&sh7372_a3sp, &usbhs1_device);
1597 sh7372_add_device_to_domain(&sh7372_a3sp, &sh_mmcif_device);
1598 sh7372_add_device_to_domain(&sh7372_a3sp, &sdhi0_device);
1599#if !defined(CONFIG_MMC_SH_MMCIF) && !defined(CONFIG_MMC_SH_MMCIF_MODULE)
1600 sh7372_add_device_to_domain(&sh7372_a3sp, &sdhi1_device);
1601#endif
1602 sh7372_add_device_to_domain(&sh7372_a3sp, &sdhi2_device);
1603 sh7372_add_device_to_domain(&sh7372_a4r, &ceu_device);
1594 1604
1595 hdmi_init_pm_clock(); 1605 hdmi_init_pm_clock();
1596 sh7372_pm_init(); 1606 sh7372_pm_init();
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index 06aecb31d9c7..c0cdbf997c91 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -35,8 +35,8 @@ extern void sh7372_add_standard_devices(void);
35extern void sh7372_clock_init(void); 35extern void sh7372_clock_init(void);
36extern void sh7372_pinmux_init(void); 36extern void sh7372_pinmux_init(void);
37extern void sh7372_pm_init(void); 37extern void sh7372_pm_init(void);
38extern void sh7372_cpu_suspend(void); 38extern void sh7372_resume_core_standby_a3sm(void);
39extern void sh7372_cpu_resume(void); 39extern int sh7372_do_idle_a3sm(unsigned long unused);
40extern struct clk sh7372_extal1_clk; 40extern struct clk sh7372_extal1_clk;
41extern struct clk sh7372_extal2_clk; 41extern struct clk sh7372_extal2_clk;
42 42
diff --git a/arch/arm/mach-shmobile/include/mach/gpio.h b/arch/arm/mach-shmobile/include/mach/gpio.h
index 2b1bb9e43dda..7bf0890e16ba 100644
--- a/arch/arm/mach-shmobile/include/mach/gpio.h
+++ b/arch/arm/mach-shmobile/include/mach/gpio.h
@@ -18,31 +18,15 @@
18 18
19#ifdef CONFIG_GPIOLIB 19#ifdef CONFIG_GPIOLIB
20 20
21static inline int gpio_get_value(unsigned gpio)
22{
23 return __gpio_get_value(gpio);
24}
25
26static inline void gpio_set_value(unsigned gpio, int value)
27{
28 __gpio_set_value(gpio, value);
29}
30
31static inline int gpio_cansleep(unsigned gpio)
32{
33 return __gpio_cansleep(gpio);
34}
35
36static inline int gpio_to_irq(unsigned gpio)
37{
38 return __gpio_to_irq(gpio);
39}
40
41static inline int irq_to_gpio(unsigned int irq) 21static inline int irq_to_gpio(unsigned int irq)
42{ 22{
43 return -ENOSYS; 23 return -ENOSYS;
44} 24}
45 25
26#else
27
28#define __ARM_GPIOLIB_COMPLEX
29
46#endif /* CONFIG_GPIOLIB */ 30#endif /* CONFIG_GPIOLIB */
47 31
48#endif /* __ASM_ARCH_GPIO_H */ 32#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-shmobile/include/mach/sh7372.h b/arch/arm/mach-shmobile/include/mach/sh7372.h
index 24e63a85e669..84532f9629b2 100644
--- a/arch/arm/mach-shmobile/include/mach/sh7372.h
+++ b/arch/arm/mach-shmobile/include/mach/sh7372.h
@@ -479,7 +479,12 @@ struct platform_device;
479 479
480struct sh7372_pm_domain { 480struct sh7372_pm_domain {
481 struct generic_pm_domain genpd; 481 struct generic_pm_domain genpd;
482 struct dev_power_governor *gov;
483 void (*suspend)(void);
484 void (*resume)(void);
482 unsigned int bit_shift; 485 unsigned int bit_shift;
486 bool no_debug;
487 bool stay_on;
483}; 488};
484 489
485static inline struct sh7372_pm_domain *to_sh7372_pd(struct generic_pm_domain *d) 490static inline struct sh7372_pm_domain *to_sh7372_pd(struct generic_pm_domain *d)
@@ -491,16 +496,24 @@ static inline struct sh7372_pm_domain *to_sh7372_pd(struct generic_pm_domain *d)
491extern struct sh7372_pm_domain sh7372_a4lc; 496extern struct sh7372_pm_domain sh7372_a4lc;
492extern struct sh7372_pm_domain sh7372_a4mp; 497extern struct sh7372_pm_domain sh7372_a4mp;
493extern struct sh7372_pm_domain sh7372_d4; 498extern struct sh7372_pm_domain sh7372_d4;
499extern struct sh7372_pm_domain sh7372_a4r;
494extern struct sh7372_pm_domain sh7372_a3rv; 500extern struct sh7372_pm_domain sh7372_a3rv;
495extern struct sh7372_pm_domain sh7372_a3ri; 501extern struct sh7372_pm_domain sh7372_a3ri;
502extern struct sh7372_pm_domain sh7372_a3sp;
496extern struct sh7372_pm_domain sh7372_a3sg; 503extern struct sh7372_pm_domain sh7372_a3sg;
497 504
498extern void sh7372_init_pm_domain(struct sh7372_pm_domain *sh7372_pd); 505extern void sh7372_init_pm_domain(struct sh7372_pm_domain *sh7372_pd);
499extern void sh7372_add_device_to_domain(struct sh7372_pm_domain *sh7372_pd, 506extern void sh7372_add_device_to_domain(struct sh7372_pm_domain *sh7372_pd,
500 struct platform_device *pdev); 507 struct platform_device *pdev);
508extern void sh7372_pm_add_subdomain(struct sh7372_pm_domain *sh7372_pd,
509 struct sh7372_pm_domain *sh7372_sd);
501#else 510#else
502#define sh7372_init_pm_domain(pd) do { } while(0) 511#define sh7372_init_pm_domain(pd) do { } while(0)
503#define sh7372_add_device_to_domain(pd, pdev) do { } while(0) 512#define sh7372_add_device_to_domain(pd, pdev) do { } while(0)
513#define sh7372_pm_add_subdomain(pd, sd) do { } while(0)
504#endif /* CONFIG_PM */ 514#endif /* CONFIG_PM */
505 515
516extern void sh7372_intcs_suspend(void);
517extern void sh7372_intcs_resume(void);
518
506#endif /* __ASM_SH7372_H__ */ 519#endif /* __ASM_SH7372_H__ */
diff --git a/arch/arm/mach-shmobile/intc-sh7372.c b/arch/arm/mach-shmobile/intc-sh7372.c
index 739315e30eb9..29cdc0522d9c 100644
--- a/arch/arm/mach-shmobile/intc-sh7372.c
+++ b/arch/arm/mach-shmobile/intc-sh7372.c
@@ -606,9 +606,16 @@ static void intcs_demux(unsigned int irq, struct irq_desc *desc)
606 generic_handle_irq(intcs_evt2irq(evtcodeas)); 606 generic_handle_irq(intcs_evt2irq(evtcodeas));
607} 607}
608 608
609static void __iomem *intcs_ffd2;
610static void __iomem *intcs_ffd5;
611
609void __init sh7372_init_irq(void) 612void __init sh7372_init_irq(void)
610{ 613{
611 void __iomem *intevtsa = ioremap_nocache(0xffd20100, PAGE_SIZE); 614 void __iomem *intevtsa;
615
616 intcs_ffd2 = ioremap_nocache(0xffd20000, PAGE_SIZE);
617 intevtsa = intcs_ffd2 + 0x100;
618 intcs_ffd5 = ioremap_nocache(0xffd50000, PAGE_SIZE);
612 619
613 register_intc_controller(&intca_desc); 620 register_intc_controller(&intca_desc);
614 register_intc_controller(&intcs_desc); 621 register_intc_controller(&intcs_desc);
@@ -617,3 +624,46 @@ void __init sh7372_init_irq(void)
617 irq_set_handler_data(evt2irq(0xf80), (void *)intevtsa); 624 irq_set_handler_data(evt2irq(0xf80), (void *)intevtsa);
618 irq_set_chained_handler(evt2irq(0xf80), intcs_demux); 625 irq_set_chained_handler(evt2irq(0xf80), intcs_demux);
619} 626}
627
628static unsigned short ffd2[0x200];
629static unsigned short ffd5[0x100];
630
631void sh7372_intcs_suspend(void)
632{
633 int k;
634
635 for (k = 0x00; k <= 0x30; k += 4)
636 ffd2[k] = __raw_readw(intcs_ffd2 + k);
637
638 for (k = 0x80; k <= 0xb0; k += 4)
639 ffd2[k] = __raw_readb(intcs_ffd2 + k);
640
641 for (k = 0x180; k <= 0x188; k += 4)
642 ffd2[k] = __raw_readb(intcs_ffd2 + k);
643
644 for (k = 0x00; k <= 0x3c; k += 4)
645 ffd5[k] = __raw_readw(intcs_ffd5 + k);
646
647 for (k = 0x80; k <= 0x9c; k += 4)
648 ffd5[k] = __raw_readb(intcs_ffd5 + k);
649}
650
651void sh7372_intcs_resume(void)
652{
653 int k;
654
655 for (k = 0x00; k <= 0x30; k += 4)
656 __raw_writew(ffd2[k], intcs_ffd2 + k);
657
658 for (k = 0x80; k <= 0xb0; k += 4)
659 __raw_writeb(ffd2[k], intcs_ffd2 + k);
660
661 for (k = 0x180; k <= 0x188; k += 4)
662 __raw_writeb(ffd2[k], intcs_ffd2 + k);
663
664 for (k = 0x00; k <= 0x3c; k += 4)
665 __raw_writew(ffd5[k], intcs_ffd5 + k);
666
667 for (k = 0x80; k <= 0x9c; k += 4)
668 __raw_writeb(ffd5[k], intcs_ffd5 + k);
669}
diff --git a/arch/arm/mach-shmobile/pm-sh7372.c b/arch/arm/mach-shmobile/pm-sh7372.c
index 933fb411be0f..79612737c5b2 100644
--- a/arch/arm/mach-shmobile/pm-sh7372.c
+++ b/arch/arm/mach-shmobile/pm-sh7372.c
@@ -15,23 +15,61 @@
15#include <linux/list.h> 15#include <linux/list.h>
16#include <linux/err.h> 16#include <linux/err.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/pm_runtime.h> 18#include <linux/pm_clock.h>
19#include <linux/platform_device.h> 19#include <linux/platform_device.h>
20#include <linux/delay.h> 20#include <linux/delay.h>
21#include <linux/irq.h>
22#include <linux/bitrev.h>
21#include <asm/system.h> 23#include <asm/system.h>
22#include <asm/io.h> 24#include <asm/io.h>
23#include <asm/tlbflush.h> 25#include <asm/tlbflush.h>
26#include <asm/suspend.h>
24#include <mach/common.h> 27#include <mach/common.h>
25#include <mach/sh7372.h> 28#include <mach/sh7372.h>
26 29
27#define SMFRAM 0xe6a70000 30/* DBG */
28#define SYSTBCR 0xe6150024 31#define DBGREG1 0xe6100020
29#define SBAR 0xe6180020 32#define DBGREG9 0xe6100040
30#define APARMBAREA 0xe6f10020
31 33
34/* CPGA */
35#define SYSTBCR 0xe6150024
36#define MSTPSR0 0xe6150030
37#define MSTPSR1 0xe6150038
38#define MSTPSR2 0xe6150040
39#define MSTPSR3 0xe6150048
40#define MSTPSR4 0xe615004c
41#define PLLC01STPCR 0xe61500c8
42
43/* SYSC */
32#define SPDCR 0xe6180008 44#define SPDCR 0xe6180008
33#define SWUCR 0xe6180014 45#define SWUCR 0xe6180014
46#define SBAR 0xe6180020
47#define WUPRMSK 0xe6180028
48#define WUPSMSK 0xe618002c
49#define WUPSMSK2 0xe6180048
34#define PSTR 0xe6180080 50#define PSTR 0xe6180080
51#define WUPSFAC 0xe6180098
52#define IRQCR 0xe618022c
53#define IRQCR2 0xe6180238
54#define IRQCR3 0xe6180244
55#define IRQCR4 0xe6180248
56#define PDNSEL 0xe6180254
57
58/* INTC */
59#define ICR1A 0xe6900000
60#define ICR2A 0xe6900004
61#define ICR3A 0xe6900008
62#define ICR4A 0xe690000c
63#define INTMSK00A 0xe6900040
64#define INTMSK10A 0xe6900044
65#define INTMSK20A 0xe6900048
66#define INTMSK30A 0xe690004c
67
68/* MFIS */
69#define SMFRAM 0xe6a70000
70
71/* AP-System Core */
72#define APARMBAREA 0xe6f10020
35 73
36#define PSTR_RETRIES 100 74#define PSTR_RETRIES 100
37#define PSTR_DELAY_US 10 75#define PSTR_DELAY_US 10
@@ -43,6 +81,12 @@ static int pd_power_down(struct generic_pm_domain *genpd)
43 struct sh7372_pm_domain *sh7372_pd = to_sh7372_pd(genpd); 81 struct sh7372_pm_domain *sh7372_pd = to_sh7372_pd(genpd);
44 unsigned int mask = 1 << sh7372_pd->bit_shift; 82 unsigned int mask = 1 << sh7372_pd->bit_shift;
45 83
84 if (sh7372_pd->suspend)
85 sh7372_pd->suspend();
86
87 if (sh7372_pd->stay_on)
88 return 0;
89
46 if (__raw_readl(PSTR) & mask) { 90 if (__raw_readl(PSTR) & mask) {
47 unsigned int retry_count; 91 unsigned int retry_count;
48 92
@@ -55,8 +99,9 @@ static int pd_power_down(struct generic_pm_domain *genpd)
55 } 99 }
56 } 100 }
57 101
58 pr_debug("sh7372 power domain down 0x%08x -> PSTR = 0x%08x\n", 102 if (!sh7372_pd->no_debug)
59 mask, __raw_readl(PSTR)); 103 pr_debug("sh7372 power domain down 0x%08x -> PSTR = 0x%08x\n",
104 mask, __raw_readl(PSTR));
60 105
61 return 0; 106 return 0;
62} 107}
@@ -68,6 +113,9 @@ static int pd_power_up(struct generic_pm_domain *genpd)
68 unsigned int retry_count; 113 unsigned int retry_count;
69 int ret = 0; 114 int ret = 0;
70 115
116 if (sh7372_pd->stay_on)
117 goto out;
118
71 if (__raw_readl(PSTR) & mask) 119 if (__raw_readl(PSTR) & mask)
72 goto out; 120 goto out;
73 121
@@ -84,66 +132,48 @@ static int pd_power_up(struct generic_pm_domain *genpd)
84 if (__raw_readl(SWUCR) & mask) 132 if (__raw_readl(SWUCR) & mask)
85 ret = -EIO; 133 ret = -EIO;
86 134
135 if (!sh7372_pd->no_debug)
136 pr_debug("sh7372 power domain up 0x%08x -> PSTR = 0x%08x\n",
137 mask, __raw_readl(PSTR));
138
87 out: 139 out:
88 pr_debug("sh7372 power domain up 0x%08x -> PSTR = 0x%08x\n", 140 if (ret == 0 && sh7372_pd->resume)
89 mask, __raw_readl(PSTR)); 141 sh7372_pd->resume();
90 142
91 return ret; 143 return ret;
92} 144}
93 145
94static int pd_power_up_a3rv(struct generic_pm_domain *genpd) 146static void sh7372_a4r_suspend(void)
95{ 147{
96 int ret = pd_power_up(genpd); 148 sh7372_intcs_suspend();
97 149 __raw_writel(0x300fffff, WUPRMSK); /* avoid wakeup */
98 /* force A4LC on after A3RV has been requested on */
99 pm_genpd_poweron(&sh7372_a4lc.genpd);
100
101 return ret;
102} 150}
103 151
104static int pd_power_down_a3rv(struct generic_pm_domain *genpd) 152static bool pd_active_wakeup(struct device *dev)
105{ 153{
106 int ret = pd_power_down(genpd); 154 return true;
107
108 /* try to power down A4LC after A3RV is requested off */
109 genpd_queue_power_off_work(&sh7372_a4lc.genpd);
110
111 return ret;
112} 155}
113 156
114static int pd_power_down_a4lc(struct generic_pm_domain *genpd) 157static bool sh7372_power_down_forbidden(struct dev_pm_domain *domain)
115{ 158{
116 /* only power down A4LC if A3RV is off */ 159 return false;
117 if (!(__raw_readl(PSTR) & (1 << sh7372_a3rv.bit_shift)))
118 return pd_power_down(genpd);
119
120 return -EBUSY;
121} 160}
122 161
123static bool pd_active_wakeup(struct device *dev) 162struct dev_power_governor sh7372_always_on_gov = {
124{ 163 .power_down_ok = sh7372_power_down_forbidden,
125 return true; 164};
126}
127 165
128void sh7372_init_pm_domain(struct sh7372_pm_domain *sh7372_pd) 166void sh7372_init_pm_domain(struct sh7372_pm_domain *sh7372_pd)
129{ 167{
130 struct generic_pm_domain *genpd = &sh7372_pd->genpd; 168 struct generic_pm_domain *genpd = &sh7372_pd->genpd;
131 169
132 pm_genpd_init(genpd, NULL, false); 170 pm_genpd_init(genpd, sh7372_pd->gov, false);
133 genpd->stop_device = pm_clk_suspend; 171 genpd->stop_device = pm_clk_suspend;
134 genpd->start_device = pm_clk_resume; 172 genpd->start_device = pm_clk_resume;
173 genpd->dev_irq_safe = true;
135 genpd->active_wakeup = pd_active_wakeup; 174 genpd->active_wakeup = pd_active_wakeup;
136 175 genpd->power_off = pd_power_down;
137 if (sh7372_pd == &sh7372_a4lc) { 176 genpd->power_on = pd_power_up;
138 genpd->power_off = pd_power_down_a4lc;
139 genpd->power_on = pd_power_up;
140 } else if (sh7372_pd == &sh7372_a3rv) {
141 genpd->power_off = pd_power_down_a3rv;
142 genpd->power_on = pd_power_up_a3rv;
143 } else {
144 genpd->power_off = pd_power_down;
145 genpd->power_on = pd_power_up;
146 }
147 genpd->power_on(&sh7372_pd->genpd); 177 genpd->power_on(&sh7372_pd->genpd);
148} 178}
149 179
@@ -152,11 +182,15 @@ void sh7372_add_device_to_domain(struct sh7372_pm_domain *sh7372_pd,
152{ 182{
153 struct device *dev = &pdev->dev; 183 struct device *dev = &pdev->dev;
154 184
155 if (!dev->power.subsys_data) {
156 pm_clk_init(dev);
157 pm_clk_add(dev, NULL);
158 }
159 pm_genpd_add_device(&sh7372_pd->genpd, dev); 185 pm_genpd_add_device(&sh7372_pd->genpd, dev);
186 if (pm_clk_no_clocks(dev))
187 pm_clk_add(dev, NULL);
188}
189
190void sh7372_pm_add_subdomain(struct sh7372_pm_domain *sh7372_pd,
191 struct sh7372_pm_domain *sh7372_sd)
192{
193 pm_genpd_add_subdomain(&sh7372_pd->genpd, &sh7372_sd->genpd);
160} 194}
161 195
162struct sh7372_pm_domain sh7372_a4lc = { 196struct sh7372_pm_domain sh7372_a4lc = {
@@ -171,6 +205,14 @@ struct sh7372_pm_domain sh7372_d4 = {
171 .bit_shift = 3, 205 .bit_shift = 3,
172}; 206};
173 207
208struct sh7372_pm_domain sh7372_a4r = {
209 .bit_shift = 5,
210 .gov = &sh7372_always_on_gov,
211 .suspend = sh7372_a4r_suspend,
212 .resume = sh7372_intcs_resume,
213 .stay_on = true,
214};
215
174struct sh7372_pm_domain sh7372_a3rv = { 216struct sh7372_pm_domain sh7372_a3rv = {
175 .bit_shift = 6, 217 .bit_shift = 6,
176}; 218};
@@ -179,39 +221,187 @@ struct sh7372_pm_domain sh7372_a3ri = {
179 .bit_shift = 8, 221 .bit_shift = 8,
180}; 222};
181 223
224struct sh7372_pm_domain sh7372_a3sp = {
225 .bit_shift = 11,
226 .gov = &sh7372_always_on_gov,
227 .no_debug = true,
228};
229
182struct sh7372_pm_domain sh7372_a3sg = { 230struct sh7372_pm_domain sh7372_a3sg = {
183 .bit_shift = 13, 231 .bit_shift = 13,
184}; 232};
185 233
186#endif /* CONFIG_PM */ 234#endif /* CONFIG_PM */
187 235
236#if defined(CONFIG_SUSPEND) || defined(CONFIG_CPU_IDLE)
237static int sh7372_do_idle_core_standby(unsigned long unused)
238{
239 cpu_do_idle(); /* WFI when SYSTBCR == 0x10 -> Core Standby */
240 return 0;
241}
242
188static void sh7372_enter_core_standby(void) 243static void sh7372_enter_core_standby(void)
189{ 244{
190 void __iomem *smfram = (void __iomem *)SMFRAM; 245 /* set reset vector, translate 4k */
246 __raw_writel(__pa(sh7372_resume_core_standby_a3sm), SBAR);
247 __raw_writel(0, APARMBAREA);
191 248
192 __raw_writel(0, APARMBAREA); /* translate 4k */ 249 /* enter sleep mode with SYSTBCR to 0x10 */
193 __raw_writel(__pa(sh7372_cpu_resume), SBAR); /* set reset vector */ 250 __raw_writel(0x10, SYSTBCR);
194 __raw_writel(0x10, SYSTBCR); /* enable core standby */ 251 cpu_suspend(0, sh7372_do_idle_core_standby);
252 __raw_writel(0, SYSTBCR);
195 253
196 __raw_writel(0, smfram + 0x3c); /* clear page table address */ 254 /* disable reset vector translation */
255 __raw_writel(0, SBAR);
256}
257#endif
258
259#ifdef CONFIG_SUSPEND
260static void sh7372_enter_a3sm_common(int pllc0_on)
261{
262 /* set reset vector, translate 4k */
263 __raw_writel(__pa(sh7372_resume_core_standby_a3sm), SBAR);
264 __raw_writel(0, APARMBAREA);
265
266 if (pllc0_on)
267 __raw_writel(0, PLLC01STPCR);
268 else
269 __raw_writel(1 << 28, PLLC01STPCR);
270
271 __raw_writel(0, PDNSEL); /* power-down A3SM only, not A4S */
272 __raw_readl(WUPSFAC); /* read wakeup int. factor before sleep */
273 cpu_suspend(0, sh7372_do_idle_a3sm);
274 __raw_readl(WUPSFAC); /* read wakeup int. factor after wakeup */
275
276 /* disable reset vector translation */
277 __raw_writel(0, SBAR);
278}
279
280static int sh7372_a3sm_valid(unsigned long *mskp, unsigned long *msk2p)
281{
282 unsigned long mstpsr0, mstpsr1, mstpsr2, mstpsr3, mstpsr4;
283 unsigned long msk, msk2;
284
285 /* check active clocks to determine potential wakeup sources */
286
287 mstpsr0 = __raw_readl(MSTPSR0);
288 if ((mstpsr0 & 0x00000003) != 0x00000003) {
289 pr_debug("sh7372 mstpsr0 0x%08lx\n", mstpsr0);
290 return 0;
291 }
292
293 mstpsr1 = __raw_readl(MSTPSR1);
294 if ((mstpsr1 & 0xff079b7f) != 0xff079b7f) {
295 pr_debug("sh7372 mstpsr1 0x%08lx\n", mstpsr1);
296 return 0;
297 }
197 298
198 sh7372_cpu_suspend(); 299 mstpsr2 = __raw_readl(MSTPSR2);
199 cpu_init(); 300 if ((mstpsr2 & 0x000741ff) != 0x000741ff) {
301 pr_debug("sh7372 mstpsr2 0x%08lx\n", mstpsr2);
302 return 0;
303 }
200 304
201 /* if page table address is non-NULL then we have been powered down */ 305 mstpsr3 = __raw_readl(MSTPSR3);
202 if (__raw_readl(smfram + 0x3c)) { 306 if ((mstpsr3 & 0x1a60f010) != 0x1a60f010) {
203 __raw_writel(__raw_readl(smfram + 0x40), 307 pr_debug("sh7372 mstpsr3 0x%08lx\n", mstpsr3);
204 __va(__raw_readl(smfram + 0x3c))); 308 return 0;
309 }
205 310
206 flush_tlb_all(); 311 mstpsr4 = __raw_readl(MSTPSR4);
207 set_cr(__raw_readl(smfram + 0x38)); 312 if ((mstpsr4 & 0x00008cf0) != 0x00008cf0) {
313 pr_debug("sh7372 mstpsr4 0x%08lx\n", mstpsr4);
314 return 0;
208 } 315 }
209 316
210 __raw_writel(0, SYSTBCR); /* disable core standby */ 317 msk = 0;
211 __raw_writel(0, SBAR); /* disable reset vector translation */ 318 msk2 = 0;
319
320 /* make bitmaps of limited number of wakeup sources */
321
322 if ((mstpsr2 & (1 << 23)) == 0) /* SPU2 */
323 msk |= 1 << 31;
324
325 if ((mstpsr2 & (1 << 12)) == 0) /* MFI_MFIM */
326 msk |= 1 << 21;
327
328 if ((mstpsr4 & (1 << 3)) == 0) /* KEYSC */
329 msk |= 1 << 2;
330
331 if ((mstpsr1 & (1 << 24)) == 0) /* CMT0 */
332 msk |= 1 << 1;
333
334 if ((mstpsr3 & (1 << 29)) == 0) /* CMT1 */
335 msk |= 1 << 1;
336
337 if ((mstpsr4 & (1 << 0)) == 0) /* CMT2 */
338 msk |= 1 << 1;
339
340 if ((mstpsr2 & (1 << 13)) == 0) /* MFI_MFIS */
341 msk2 |= 1 << 17;
342
343 *mskp = msk;
344 *msk2p = msk2;
345
346 return 1;
347}
348
349static void sh7372_icr_to_irqcr(unsigned long icr, u16 *irqcr1p, u16 *irqcr2p)
350{
351 u16 tmp, irqcr1, irqcr2;
352 int k;
353
354 irqcr1 = 0;
355 irqcr2 = 0;
356
357 /* convert INTCA ICR register layout to SYSC IRQCR+IRQCR2 */
358 for (k = 0; k <= 7; k++) {
359 tmp = (icr >> ((7 - k) * 4)) & 0xf;
360 irqcr1 |= (tmp & 0x03) << (k * 2);
361 irqcr2 |= (tmp >> 2) << (k * 2);
362 }
363
364 *irqcr1p = irqcr1;
365 *irqcr2p = irqcr2;
366}
367
368static void sh7372_setup_a3sm(unsigned long msk, unsigned long msk2)
369{
370 u16 irqcrx_low, irqcrx_high, irqcry_low, irqcry_high;
371 unsigned long tmp;
372
373 /* read IRQ0A -> IRQ15A mask */
374 tmp = bitrev8(__raw_readb(INTMSK00A));
375 tmp |= bitrev8(__raw_readb(INTMSK10A)) << 8;
376
377 /* setup WUPSMSK from clocks and external IRQ mask */
378 msk = (~msk & 0xc030000f) | (tmp << 4);
379 __raw_writel(msk, WUPSMSK);
380
381 /* propage level/edge trigger for external IRQ 0->15 */
382 sh7372_icr_to_irqcr(__raw_readl(ICR1A), &irqcrx_low, &irqcry_low);
383 sh7372_icr_to_irqcr(__raw_readl(ICR2A), &irqcrx_high, &irqcry_high);
384 __raw_writel((irqcrx_high << 16) | irqcrx_low, IRQCR);
385 __raw_writel((irqcry_high << 16) | irqcry_low, IRQCR2);
386
387 /* read IRQ16A -> IRQ31A mask */
388 tmp = bitrev8(__raw_readb(INTMSK20A));
389 tmp |= bitrev8(__raw_readb(INTMSK30A)) << 8;
390
391 /* setup WUPSMSK2 from clocks and external IRQ mask */
392 msk2 = (~msk2 & 0x00030000) | tmp;
393 __raw_writel(msk2, WUPSMSK2);
394
395 /* propage level/edge trigger for external IRQ 16->31 */
396 sh7372_icr_to_irqcr(__raw_readl(ICR3A), &irqcrx_low, &irqcry_low);
397 sh7372_icr_to_irqcr(__raw_readl(ICR4A), &irqcrx_high, &irqcry_high);
398 __raw_writel((irqcrx_high << 16) | irqcrx_low, IRQCR3);
399 __raw_writel((irqcry_high << 16) | irqcry_low, IRQCR4);
212} 400}
401#endif
213 402
214#ifdef CONFIG_CPU_IDLE 403#ifdef CONFIG_CPU_IDLE
404
215static void sh7372_cpuidle_setup(struct cpuidle_device *dev) 405static void sh7372_cpuidle_setup(struct cpuidle_device *dev)
216{ 406{
217 struct cpuidle_state *state; 407 struct cpuidle_state *state;
@@ -239,9 +429,25 @@ static void sh7372_cpuidle_init(void) {}
239#endif 429#endif
240 430
241#ifdef CONFIG_SUSPEND 431#ifdef CONFIG_SUSPEND
432
242static int sh7372_enter_suspend(suspend_state_t suspend_state) 433static int sh7372_enter_suspend(suspend_state_t suspend_state)
243{ 434{
244 sh7372_enter_core_standby(); 435 unsigned long msk, msk2;
436
437 /* check active clocks to determine potential wakeup sources */
438 if (sh7372_a3sm_valid(&msk, &msk2)) {
439
440 /* convert INTC mask and sense to SYSC mask and sense */
441 sh7372_setup_a3sm(msk, msk2);
442
443 /* enter A3SM sleep with PLLC0 off */
444 pr_debug("entering A3SM\n");
445 sh7372_enter_a3sm_common(0);
446 } else {
447 /* default to Core Standby that supports all wakeup sources */
448 pr_debug("entering Core Standby\n");
449 sh7372_enter_core_standby();
450 }
245 return 0; 451 return 0;
246} 452}
247 453
@@ -253,9 +459,6 @@ static void sh7372_suspend_init(void)
253static void sh7372_suspend_init(void) {} 459static void sh7372_suspend_init(void) {}
254#endif 460#endif
255 461
256#define DBGREG1 0xe6100020
257#define DBGREG9 0xe6100040
258
259void __init sh7372_pm_init(void) 462void __init sh7372_pm_init(void)
260{ 463{
261 /* enable DBG hardware block to kick SYSC */ 464 /* enable DBG hardware block to kick SYSC */
@@ -263,6 +466,9 @@ void __init sh7372_pm_init(void)
263 __raw_writel(0x0000a501, DBGREG9); 466 __raw_writel(0x0000a501, DBGREG9);
264 __raw_writel(0x00000000, DBGREG1); 467 __raw_writel(0x00000000, DBGREG1);
265 468
469 /* do not convert A3SM, A3SP, A3SG, A4R power down into A4S */
470 __raw_writel(0, PDNSEL);
471
266 sh7372_suspend_init(); 472 sh7372_suspend_init();
267 sh7372_cpuidle_init(); 473 sh7372_cpuidle_init();
268} 474}
diff --git a/arch/arm/mach-shmobile/pm_runtime.c b/arch/arm/mach-shmobile/pm_runtime.c
index 6ec454e1e063..bd5c6a3b8c55 100644
--- a/arch/arm/mach-shmobile/pm_runtime.c
+++ b/arch/arm/mach-shmobile/pm_runtime.c
@@ -15,6 +15,7 @@
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/pm_runtime.h> 16#include <linux/pm_runtime.h>
17#include <linux/pm_domain.h> 17#include <linux/pm_domain.h>
18#include <linux/pm_clock.h>
18#include <linux/platform_device.h> 19#include <linux/platform_device.h>
19#include <linux/clk.h> 20#include <linux/clk.h>
20#include <linux/sh_clk.h> 21#include <linux/sh_clk.h>
diff --git a/arch/arm/mach-shmobile/setup-sh7372.c b/arch/arm/mach-shmobile/setup-sh7372.c
index 2d9b1b1a2538..2380389e6ac5 100644
--- a/arch/arm/mach-shmobile/setup-sh7372.c
+++ b/arch/arm/mach-shmobile/setup-sh7372.c
@@ -30,6 +30,7 @@
30#include <linux/sh_dma.h> 30#include <linux/sh_dma.h>
31#include <linux/sh_intc.h> 31#include <linux/sh_intc.h>
32#include <linux/sh_timer.h> 32#include <linux/sh_timer.h>
33#include <linux/pm_domain.h>
33#include <mach/hardware.h> 34#include <mach/hardware.h>
34#include <mach/sh7372.h> 35#include <mach/sh7372.h>
35#include <asm/mach-types.h> 36#include <asm/mach-types.h>
@@ -990,9 +991,14 @@ void __init sh7372_add_standard_devices(void)
990 sh7372_init_pm_domain(&sh7372_a4lc); 991 sh7372_init_pm_domain(&sh7372_a4lc);
991 sh7372_init_pm_domain(&sh7372_a4mp); 992 sh7372_init_pm_domain(&sh7372_a4mp);
992 sh7372_init_pm_domain(&sh7372_d4); 993 sh7372_init_pm_domain(&sh7372_d4);
994 sh7372_init_pm_domain(&sh7372_a4r);
993 sh7372_init_pm_domain(&sh7372_a3rv); 995 sh7372_init_pm_domain(&sh7372_a3rv);
994 sh7372_init_pm_domain(&sh7372_a3ri); 996 sh7372_init_pm_domain(&sh7372_a3ri);
995 sh7372_init_pm_domain(&sh7372_a3sg); 997 sh7372_init_pm_domain(&sh7372_a3sg);
998 sh7372_init_pm_domain(&sh7372_a3sp);
999
1000 sh7372_pm_add_subdomain(&sh7372_a4lc, &sh7372_a3rv);
1001 sh7372_pm_add_subdomain(&sh7372_a4r, &sh7372_a4lc);
996 1002
997 platform_add_devices(sh7372_early_devices, 1003 platform_add_devices(sh7372_early_devices,
998 ARRAY_SIZE(sh7372_early_devices)); 1004 ARRAY_SIZE(sh7372_early_devices));
@@ -1003,6 +1009,25 @@ void __init sh7372_add_standard_devices(void)
1003 sh7372_add_device_to_domain(&sh7372_a3rv, &vpu_device); 1009 sh7372_add_device_to_domain(&sh7372_a3rv, &vpu_device);
1004 sh7372_add_device_to_domain(&sh7372_a4mp, &spu0_device); 1010 sh7372_add_device_to_domain(&sh7372_a4mp, &spu0_device);
1005 sh7372_add_device_to_domain(&sh7372_a4mp, &spu1_device); 1011 sh7372_add_device_to_domain(&sh7372_a4mp, &spu1_device);
1012 sh7372_add_device_to_domain(&sh7372_a3sp, &scif0_device);
1013 sh7372_add_device_to_domain(&sh7372_a3sp, &scif1_device);
1014 sh7372_add_device_to_domain(&sh7372_a3sp, &scif2_device);
1015 sh7372_add_device_to_domain(&sh7372_a3sp, &scif3_device);
1016 sh7372_add_device_to_domain(&sh7372_a3sp, &scif4_device);
1017 sh7372_add_device_to_domain(&sh7372_a3sp, &scif5_device);
1018 sh7372_add_device_to_domain(&sh7372_a3sp, &scif6_device);
1019 sh7372_add_device_to_domain(&sh7372_a3sp, &iic1_device);
1020 sh7372_add_device_to_domain(&sh7372_a3sp, &dma0_device);
1021 sh7372_add_device_to_domain(&sh7372_a3sp, &dma1_device);
1022 sh7372_add_device_to_domain(&sh7372_a3sp, &dma2_device);
1023 sh7372_add_device_to_domain(&sh7372_a3sp, &usb_dma0_device);
1024 sh7372_add_device_to_domain(&sh7372_a3sp, &usb_dma1_device);
1025 sh7372_add_device_to_domain(&sh7372_a4r, &iic0_device);
1026 sh7372_add_device_to_domain(&sh7372_a4r, &veu0_device);
1027 sh7372_add_device_to_domain(&sh7372_a4r, &veu1_device);
1028 sh7372_add_device_to_domain(&sh7372_a4r, &veu2_device);
1029 sh7372_add_device_to_domain(&sh7372_a4r, &veu3_device);
1030 sh7372_add_device_to_domain(&sh7372_a4r, &jpu_device);
1006} 1031}
1007 1032
1008void __init sh7372_add_early_devices(void) 1033void __init sh7372_add_early_devices(void)
diff --git a/arch/arm/mach-shmobile/sleep-sh7372.S b/arch/arm/mach-shmobile/sleep-sh7372.S
index d37d3ca4d18f..f3ab3c5810ea 100644
--- a/arch/arm/mach-shmobile/sleep-sh7372.S
+++ b/arch/arm/mach-shmobile/sleep-sh7372.S
@@ -30,58 +30,20 @@
30 */ 30 */
31 31
32#include <linux/linkage.h> 32#include <linux/linkage.h>
33#include <linux/init.h>
34#include <asm/memory.h>
33#include <asm/assembler.h> 35#include <asm/assembler.h>
34 36
35#define SMFRAM 0xe6a70000 37#if defined(CONFIG_SUSPEND) || defined(CONFIG_CPU_IDLE)
36 38 .align 12
37 .align 39 .text
38kernel_flush: 40 .global sh7372_resume_core_standby_a3sm
39 .word v7_flush_dcache_all 41sh7372_resume_core_standby_a3sm:
40 42 ldr pc, 1f
41 .align 3 431: .long cpu_resume - PAGE_OFFSET + PLAT_PHYS_OFFSET
42ENTRY(sh7372_cpu_suspend)
43 stmfd sp!, {r0-r12, lr} @ save registers on stack
44
45 ldr r8, =SMFRAM
46
47 mov r4, sp @ Store sp
48 mrs r5, spsr @ Store spsr
49 mov r6, lr @ Store lr
50 stmia r8!, {r4-r6}
51
52 mrc p15, 0, r4, c1, c0, 2 @ Coprocessor access control register
53 mrc p15, 0, r5, c2, c0, 0 @ TTBR0
54 mrc p15, 0, r6, c2, c0, 1 @ TTBR1
55 mrc p15, 0, r7, c2, c0, 2 @ TTBCR
56 stmia r8!, {r4-r7}
57
58 mrc p15, 0, r4, c3, c0, 0 @ Domain access Control Register
59 mrc p15, 0, r5, c10, c2, 0 @ PRRR
60 mrc p15, 0, r6, c10, c2, 1 @ NMRR
61 stmia r8!,{r4-r6}
62
63 mrc p15, 0, r4, c13, c0, 1 @ Context ID
64 mrc p15, 0, r5, c13, c0, 2 @ User r/w thread and process ID
65 mrc p15, 0, r6, c12, c0, 0 @ Secure or NS vector base address
66 mrs r7, cpsr @ Store current cpsr
67 stmia r8!, {r4-r7}
68
69 mrc p15, 0, r4, c1, c0, 0 @ save control register
70 stmia r8!, {r4}
71
72 /*
73 * jump out to kernel flush routine
74 * - reuse that code is better
75 * - it executes in a cached space so is faster than refetch per-block
76 * - should be faster and will change with kernel
77 * - 'might' have to copy address, load and jump to it
78 * Flush all data from the L1 data cache before disabling
79 * SCTLR.C bit.
80 */
81 ldr r1, kernel_flush
82 mov lr, pc
83 bx r1
84 44
45 .global sh7372_do_idle_a3sm
46sh7372_do_idle_a3sm:
85 /* 47 /*
86 * Clear the SCTLR.C bit to prevent further data cache 48 * Clear the SCTLR.C bit to prevent further data cache
87 * allocation. Clearing SCTLR.C would make all the data accesses 49 * allocation. Clearing SCTLR.C would make all the data accesses
@@ -92,10 +54,13 @@ ENTRY(sh7372_cpu_suspend)
92 mcr p15, 0, r0, c1, c0, 0 54 mcr p15, 0, r0, c1, c0, 0
93 isb 55 isb
94 56
57 /* disable L2 cache in the aux control register */
58 mrc p15, 0, r10, c1, c0, 1
59 bic r10, r10, #2
60 mcr p15, 0, r10, c1, c0, 1
61
95 /* 62 /*
96 * Invalidate L1 data cache. Even though only invalidate is 63 * Invalidate data cache again.
97 * necessary exported flush API is used here. Doing clean
98 * on already clean cache would be almost NOP.
99 */ 64 */
100 ldr r1, kernel_flush 65 ldr r1, kernel_flush
101 blx r1 66 blx r1
@@ -115,146 +80,16 @@ ENTRY(sh7372_cpu_suspend)
115 dsb 80 dsb
116 dmb 81 dmb
117 82
118/* 83#define SPDCR 0xe6180008
119 * =================================== 84#define A3SM (1 << 12)
120 * == WFI instruction => Enter idle ==
121 * ===================================
122 */
123 wfi @ wait for interrupt
124
125/*
126 * ===================================
127 * == Resume path for non-OFF modes ==
128 * ===================================
129 */
130 mrc p15, 0, r0, c1, c0, 0
131 tst r0, #(1 << 2) @ Check C bit enabled?
132 orreq r0, r0, #(1 << 2) @ Enable the C bit if cleared
133 mcreq p15, 0, r0, c1, c0, 0
134 isb
135
136/*
137 * ===================================
138 * == Exit point from non-OFF modes ==
139 * ===================================
140 */
141 ldmfd sp!, {r0-r12, pc} @ restore regs and return
142 85
143 .pool 86 /* A3SM power down */
87 ldr r0, =SPDCR
88 ldr r1, =A3SM
89 str r1, [r0]
901:
91 b 1b
144 92
145 .align 12 93kernel_flush:
146 .text 94 .word v7_flush_dcache_all
147 .global sh7372_cpu_resume 95#endif
148sh7372_cpu_resume:
149
150 mov r1, #0
151 /*
152 * Invalidate all instruction caches to PoU
153 * and flush branch target cache
154 */
155 mcr p15, 0, r1, c7, c5, 0
156
157 ldr r3, =SMFRAM
158
159 ldmia r3!, {r4-r6}
160 mov sp, r4 @ Restore sp
161 msr spsr_cxsf, r5 @ Restore spsr
162 mov lr, r6 @ Restore lr
163
164 ldmia r3!, {r4-r7}
165 mcr p15, 0, r4, c1, c0, 2 @ Coprocessor access Control Register
166 mcr p15, 0, r5, c2, c0, 0 @ TTBR0
167 mcr p15, 0, r6, c2, c0, 1 @ TTBR1
168 mcr p15, 0, r7, c2, c0, 2 @ TTBCR
169
170 ldmia r3!,{r4-r6}
171 mcr p15, 0, r4, c3, c0, 0 @ Domain access Control Register
172 mcr p15, 0, r5, c10, c2, 0 @ PRRR
173 mcr p15, 0, r6, c10, c2, 1 @ NMRR
174
175 ldmia r3!,{r4-r7}
176 mcr p15, 0, r4, c13, c0, 1 @ Context ID
177 mcr p15, 0, r5, c13, c0, 2 @ User r/w thread and process ID
178 mrc p15, 0, r6, c12, c0, 0 @ Secure or NS vector base address
179 msr cpsr, r7 @ store cpsr
180
181 /* Starting to enable MMU here */
182 mrc p15, 0, r7, c2, c0, 2 @ Read TTBRControl
183 /* Extract N (0:2) bits and decide whether to use TTBR0 or TTBR1 */
184 and r7, #0x7
185 cmp r7, #0x0
186 beq usettbr0
187ttbr_error:
188 /*
189 * More work needs to be done to support N[0:2] value other than 0
190 * So looping here so that the error can be detected
191 */
192 b ttbr_error
193
194 .align
195cache_pred_disable_mask:
196 .word 0xFFFFE7FB
197ttbrbit_mask:
198 .word 0xFFFFC000
199table_index_mask:
200 .word 0xFFF00000
201table_entry:
202 .word 0x00000C02
203usettbr0:
204
205 mrc p15, 0, r2, c2, c0, 0
206 ldr r5, ttbrbit_mask
207 and r2, r5
208 mov r4, pc
209 ldr r5, table_index_mask
210 and r4, r5 @ r4 = 31 to 20 bits of pc
211 /* Extract the value to be written to table entry */
212 ldr r6, table_entry
213 /* r6 has the value to be written to table entry */
214 add r6, r6, r4
215 /* Getting the address of table entry to modify */
216 lsr r4, #18
217 /* r2 has the location which needs to be modified */
218 add r2, r4
219 ldr r4, [r2]
220 str r6, [r2] /* modify the table entry */
221
222 mov r7, r6
223 mov r5, r2
224 mov r6, r4
225 /* r5 = original page table address */
226 /* r6 = original page table data */
227
228 mov r0, #0
229 mcr p15, 0, r0, c7, c5, 4 @ Flush prefetch buffer
230 mcr p15, 0, r0, c7, c5, 6 @ Invalidate branch predictor array
231 mcr p15, 0, r0, c8, c5, 0 @ Invalidate instruction TLB
232 mcr p15, 0, r0, c8, c6, 0 @ Invalidate data TLB
233
234 /*
235 * Restore control register. This enables the MMU.
236 * The caches and prediction are not enabled here, they
237 * will be enabled after restoring the MMU table entry.
238 */
239 ldmia r3!, {r4}
240 stmia r3!, {r5} /* save original page table address */
241 stmia r3!, {r6} /* save original page table data */
242 stmia r3!, {r7} /* save modified page table data */
243
244 ldr r2, cache_pred_disable_mask
245 and r4, r2
246 mcr p15, 0, r4, c1, c0, 0
247 dsb
248 isb
249
250 ldr r0, =restoremmu_on
251 bx r0
252
253/*
254 * ==============================
255 * == Exit point from OFF mode ==
256 * ==============================
257 */
258restoremmu_on:
259
260 ldmfd sp!, {r0-r12, pc} @ restore regs and return
diff --git a/arch/arm/mach-spear3xx/Makefile.boot b/arch/arm/mach-spear3xx/Makefile.boot
index 7a1f3c0eadb8..4674a4c221db 100644
--- a/arch/arm/mach-spear3xx/Makefile.boot
+++ b/arch/arm/mach-spear3xx/Makefile.boot
@@ -1,3 +1,3 @@
1zreladdr-y := 0x00008000 1zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-spear6xx/Makefile.boot b/arch/arm/mach-spear6xx/Makefile.boot
index 7a1f3c0eadb8..4674a4c221db 100644
--- a/arch/arm/mach-spear6xx/Makefile.boot
+++ b/arch/arm/mach-spear6xx/Makefile.boot
@@ -1,3 +1,3 @@
1zreladdr-y := 0x00008000 1zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mach-tcc8k/Makefile.boot b/arch/arm/mach-tcc8k/Makefile.boot
index f135c9deae10..5e02d4156b04 100644
--- a/arch/arm/mach-tcc8k/Makefile.boot
+++ b/arch/arm/mach-tcc8k/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x20008000 1 zreladdr-y += 0x20008000
2params_phys-y := 0x20000100 2params_phys-y := 0x20000100
3initrd_phys-y := 0x20800000 3initrd_phys-y := 0x20800000
diff --git a/arch/arm/mach-tegra/Makefile.boot b/arch/arm/mach-tegra/Makefile.boot
index 428ad122be03..5e870d29eca1 100644
--- a/arch/arm/mach-tegra/Makefile.boot
+++ b/arch/arm/mach-tegra/Makefile.boot
@@ -1,4 +1,4 @@
1zreladdr-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00008000 1zreladdr-$(CONFIG_ARCH_TEGRA_2x_SOC) += 0x00008000
2params_phys-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00000100 2params_phys-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00000100
3initrd_phys-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00800000 3initrd_phys-$(CONFIG_ARCH_TEGRA_2x_SOC) := 0x00800000
4 4
diff --git a/arch/arm/mach-tegra/board-harmony-pcie.c b/arch/arm/mach-tegra/board-harmony-pcie.c
index 9c27b95b8d86..6db7d699ef1c 100644
--- a/arch/arm/mach-tegra/board-harmony-pcie.c
+++ b/arch/arm/mach-tegra/board-harmony-pcie.c
@@ -24,12 +24,10 @@
24 24
25#include <mach/pinmux.h> 25#include <mach/pinmux.h>
26#include "board.h" 26#include "board.h"
27#include "board-harmony.h"
27 28
28#ifdef CONFIG_TEGRA_PCI 29#ifdef CONFIG_TEGRA_PCI
29 30
30/* GPIO 3 of the PMIC */
31#define EN_VDD_1V05_GPIO (TEGRA_NR_GPIOS + 2)
32
33static int __init harmony_pcie_init(void) 31static int __init harmony_pcie_init(void)
34{ 32{
35 struct regulator *regulator = NULL; 33 struct regulator *regulator = NULL;
@@ -38,11 +36,11 @@ static int __init harmony_pcie_init(void)
38 if (!machine_is_harmony()) 36 if (!machine_is_harmony())
39 return 0; 37 return 0;
40 38
41 err = gpio_request(EN_VDD_1V05_GPIO, "EN_VDD_1V05"); 39 err = gpio_request(TEGRA_GPIO_EN_VDD_1V05_GPIO, "EN_VDD_1V05");
42 if (err) 40 if (err)
43 return err; 41 return err;
44 42
45 gpio_direction_output(EN_VDD_1V05_GPIO, 1); 43 gpio_direction_output(TEGRA_GPIO_EN_VDD_1V05_GPIO, 1);
46 44
47 regulator = regulator_get(NULL, "pex_clk"); 45 regulator = regulator_get(NULL, "pex_clk");
48 if (IS_ERR_OR_NULL(regulator)) 46 if (IS_ERR_OR_NULL(regulator))
@@ -68,7 +66,7 @@ err_pcie:
68 regulator_disable(regulator); 66 regulator_disable(regulator);
69 regulator_put(regulator); 67 regulator_put(regulator);
70err_reg: 68err_reg:
71 gpio_free(EN_VDD_1V05_GPIO); 69 gpio_free(TEGRA_GPIO_EN_VDD_1V05_GPIO);
72 70
73 return err; 71 return err;
74} 72}
diff --git a/arch/arm/mach-tegra/board-harmony.c b/arch/arm/mach-tegra/board-harmony.c
index a4d1980e697a..93c793f48caf 100644
--- a/arch/arm/mach-tegra/board-harmony.c
+++ b/arch/arm/mach-tegra/board-harmony.c
@@ -123,8 +123,8 @@ static struct platform_device *harmony_devices[] __initdata = {
123 &harmony_audio_device, 123 &harmony_audio_device,
124}; 124};
125 125
126static void __init tegra_harmony_fixup(struct machine_desc *desc, 126static void __init tegra_harmony_fixup(struct tag *tags, char **cmdline,
127 struct tag *tags, char **cmdline, struct meminfo *mi) 127 struct meminfo *mi)
128{ 128{
129 mi->nr_banks = 2; 129 mi->nr_banks = 2;
130 mi->bank[0].start = PHYS_OFFSET; 130 mi->bank[0].start = PHYS_OFFSET;
diff --git a/arch/arm/mach-tegra/board-harmony.h b/arch/arm/mach-tegra/board-harmony.h
index d85142edaf6b..139d96c93843 100644
--- a/arch/arm/mach-tegra/board-harmony.h
+++ b/arch/arm/mach-tegra/board-harmony.h
@@ -17,6 +17,8 @@
17#ifndef _MACH_TEGRA_BOARD_HARMONY_H 17#ifndef _MACH_TEGRA_BOARD_HARMONY_H
18#define _MACH_TEGRA_BOARD_HARMONY_H 18#define _MACH_TEGRA_BOARD_HARMONY_H
19 19
20#include <mach/gpio-tegra.h>
21
20#define HARMONY_GPIO_TPS6586X(_x_) (TEGRA_NR_GPIOS + (_x_)) 22#define HARMONY_GPIO_TPS6586X(_x_) (TEGRA_NR_GPIOS + (_x_))
21#define HARMONY_GPIO_WM8903(_x_) (HARMONY_GPIO_TPS6586X(4) + (_x_)) 23#define HARMONY_GPIO_WM8903(_x_) (HARMONY_GPIO_TPS6586X(4) + (_x_))
22 24
@@ -31,6 +33,7 @@
31#define TEGRA_GPIO_HP_DET TEGRA_GPIO_PW2 33#define TEGRA_GPIO_HP_DET TEGRA_GPIO_PW2
32#define TEGRA_GPIO_INT_MIC_EN TEGRA_GPIO_PX0 34#define TEGRA_GPIO_INT_MIC_EN TEGRA_GPIO_PX0
33#define TEGRA_GPIO_EXT_MIC_EN TEGRA_GPIO_PX1 35#define TEGRA_GPIO_EXT_MIC_EN TEGRA_GPIO_PX1
36#define TEGRA_GPIO_EN_VDD_1V05_GPIO HARMONY_GPIO_TPS6586X(2)
34 37
35void harmony_pinmux_init(void); 38void harmony_pinmux_init(void);
36int harmony_regulator_init(void); 39int harmony_regulator_init(void);
diff --git a/arch/arm/mach-tegra/board-paz00.c b/arch/arm/mach-tegra/board-paz00.c
index 3197c4cbaa71..fbc9e0ed926e 100644
--- a/arch/arm/mach-tegra/board-paz00.c
+++ b/arch/arm/mach-tegra/board-paz00.c
@@ -84,8 +84,8 @@ static void paz00_usb_init(void)
84 platform_device_register(&tegra_ehci3_device); 84 platform_device_register(&tegra_ehci3_device);
85} 85}
86 86
87static void __init tegra_paz00_fixup(struct machine_desc *desc, 87static void __init tegra_paz00_fixup(struct tag *tags, char **cmdline,
88 struct tag *tags, char **cmdline, struct meminfo *mi) 88 struct meminfo *mi)
89{ 89{
90 mi->nr_banks = 1; 90 mi->nr_banks = 1;
91 mi->bank[0].start = PHYS_OFFSET; 91 mi->bank[0].start = PHYS_OFFSET;
diff --git a/arch/arm/mach-tegra/board-paz00.h b/arch/arm/mach-tegra/board-paz00.h
index d4ff39ddaeb3..42ce8639b90c 100644
--- a/arch/arm/mach-tegra/board-paz00.h
+++ b/arch/arm/mach-tegra/board-paz00.h
@@ -17,6 +17,8 @@
17#ifndef _MACH_TEGRA_BOARD_PAZ00_H 17#ifndef _MACH_TEGRA_BOARD_PAZ00_H
18#define _MACH_TEGRA_BOARD_PAZ00_H 18#define _MACH_TEGRA_BOARD_PAZ00_H
19 19
20#include <mach/gpio-tegra.h>
21
20#define TEGRA_GPIO_SD1_CD TEGRA_GPIO_PV5 22#define TEGRA_GPIO_SD1_CD TEGRA_GPIO_PV5
21#define TEGRA_GPIO_SD1_WP TEGRA_GPIO_PH1 23#define TEGRA_GPIO_SD1_WP TEGRA_GPIO_PH1
22#define TEGRA_GPIO_SD1_POWER TEGRA_GPIO_PT3 24#define TEGRA_GPIO_SD1_POWER TEGRA_GPIO_PT3
diff --git a/arch/arm/mach-tegra/board-seaboard.h b/arch/arm/mach-tegra/board-seaboard.h
index d8415e1a8434..15b6c57361be 100644
--- a/arch/arm/mach-tegra/board-seaboard.h
+++ b/arch/arm/mach-tegra/board-seaboard.h
@@ -17,6 +17,8 @@
17#ifndef _MACH_TEGRA_BOARD_SEABOARD_H 17#ifndef _MACH_TEGRA_BOARD_SEABOARD_H
18#define _MACH_TEGRA_BOARD_SEABOARD_H 18#define _MACH_TEGRA_BOARD_SEABOARD_H
19 19
20#include <mach/gpio-tegra.h>
21
20#define TEGRA_GPIO_SD2_CD TEGRA_GPIO_PI5 22#define TEGRA_GPIO_SD2_CD TEGRA_GPIO_PI5
21#define TEGRA_GPIO_SD2_WP TEGRA_GPIO_PH1 23#define TEGRA_GPIO_SD2_WP TEGRA_GPIO_PH1
22#define TEGRA_GPIO_SD2_POWER TEGRA_GPIO_PI6 24#define TEGRA_GPIO_SD2_POWER TEGRA_GPIO_PI6
diff --git a/arch/arm/mach-tegra/board-trimslice-pinmux.c b/arch/arm/mach-tegra/board-trimslice-pinmux.c
index 47c596cdbf32..bcb1916e68b9 100644
--- a/arch/arm/mach-tegra/board-trimslice-pinmux.c
+++ b/arch/arm/mach-tegra/board-trimslice-pinmux.c
@@ -13,12 +13,11 @@
13 * GNU General Public License for more details. 13 * GNU General Public License for more details.
14 * 14 *
15 */ 15 */
16 16#include <linux/gpio.h>
17#include <linux/kernel.h> 17#include <linux/kernel.h>
18#include <linux/init.h> 18#include <linux/init.h>
19 19
20#include <mach/pinmux.h> 20#include <mach/pinmux.h>
21#include <mach/gpio.h>
22 21
23#include "gpio-names.h" 22#include "gpio-names.h"
24#include "board-trimslice.h" 23#include "board-trimslice.h"
diff --git a/arch/arm/mach-tegra/board-trimslice.c b/arch/arm/mach-tegra/board-trimslice.c
index 8489aa8f5154..e3d9ec2f0fe1 100644
--- a/arch/arm/mach-tegra/board-trimslice.c
+++ b/arch/arm/mach-tegra/board-trimslice.c
@@ -126,8 +126,8 @@ static void trimslice_usb_init(void)
126 platform_device_register(&tegra_ehci1_device); 126 platform_device_register(&tegra_ehci1_device);
127} 127}
128 128
129static void __init tegra_trimslice_fixup(struct machine_desc *desc, 129static void __init tegra_trimslice_fixup(struct tag *tags, char **cmdline,
130 struct tag *tags, char **cmdline, struct meminfo *mi) 130 struct meminfo *mi)
131{ 131{
132 mi->nr_banks = 2; 132 mi->nr_banks = 2;
133 mi->bank[0].start = PHYS_OFFSET; 133 mi->bank[0].start = PHYS_OFFSET;
diff --git a/arch/arm/mach-tegra/board-trimslice.h b/arch/arm/mach-tegra/board-trimslice.h
index 7a7dee86b4da..50f128d87779 100644
--- a/arch/arm/mach-tegra/board-trimslice.h
+++ b/arch/arm/mach-tegra/board-trimslice.h
@@ -17,6 +17,8 @@
17#ifndef _MACH_TEGRA_BOARD_TRIMSLICE_H 17#ifndef _MACH_TEGRA_BOARD_TRIMSLICE_H
18#define _MACH_TEGRA_BOARD_TRIMSLICE_H 18#define _MACH_TEGRA_BOARD_TRIMSLICE_H
19 19
20#include <mach/gpio-tegra.h>
21
20#define TRIMSLICE_GPIO_SD4_CD TEGRA_GPIO_PP1 /* mmc4 cd */ 22#define TRIMSLICE_GPIO_SD4_CD TEGRA_GPIO_PP1 /* mmc4 cd */
21#define TRIMSLICE_GPIO_SD4_WP TEGRA_GPIO_PP2 /* mmc4 wp */ 23#define TRIMSLICE_GPIO_SD4_WP TEGRA_GPIO_PP2 /* mmc4 wp */
22 24
diff --git a/arch/arm/mach-tegra/cpu-tegra.c b/arch/arm/mach-tegra/cpu-tegra.c
index 0e1016a827ac..0e0fd4d889bd 100644
--- a/arch/arm/mach-tegra/cpu-tegra.c
+++ b/arch/arm/mach-tegra/cpu-tegra.c
@@ -32,7 +32,6 @@
32 32
33#include <asm/system.h> 33#include <asm/system.h>
34 34
35#include <mach/hardware.h>
36#include <mach/clk.h> 35#include <mach/clk.h>
37 36
38/* Frequency table index must be sequential starting at 0 */ 37/* Frequency table index must be sequential starting at 0 */
diff --git a/arch/arm/mach-tegra/include/mach/gpio-tegra.h b/arch/arm/mach-tegra/include/mach/gpio-tegra.h
new file mode 100644
index 000000000000..87d37fdf5084
--- /dev/null
+++ b/arch/arm/mach-tegra/include/mach/gpio-tegra.h
@@ -0,0 +1,39 @@
1/*
2 * arch/arm/mach-tegra/include/mach/gpio.h
3 *
4 * Copyright (C) 2010 Google, Inc.
5 *
6 * Author:
7 * Erik Gilling <konkers@google.com>
8 *
9 * This software is licensed under the terms of the GNU General Public
10 * License version 2, as published by the Free Software Foundation, and
11 * may be copied, distributed, and modified under those terms.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 */
19
20#ifndef __MACH_TEGRA_GPIO_TEGRA_H
21#define __MACH_TEGRA_GPIO_TEGRA_H
22
23#include <linux/types.h>
24#include <mach/irqs.h>
25
26#define TEGRA_NR_GPIOS INT_GPIO_NR
27
28#define TEGRA_GPIO_TO_IRQ(gpio) (INT_GPIO_BASE + (gpio))
29
30struct tegra_gpio_table {
31 int gpio; /* GPIO number */
32 bool enable; /* Enable for GPIO at init? */
33};
34
35void tegra_gpio_config(struct tegra_gpio_table *table, int num);
36void tegra_gpio_enable(int gpio);
37void tegra_gpio_disable(int gpio);
38
39#endif
diff --git a/arch/arm/mach-tegra/include/mach/gpio.h b/arch/arm/mach-tegra/include/mach/gpio.h
index 196f114dc241..e69de29bb2d1 100644
--- a/arch/arm/mach-tegra/include/mach/gpio.h
+++ b/arch/arm/mach-tegra/include/mach/gpio.h
@@ -1,60 +0,0 @@
1/*
2 * arch/arm/mach-tegra/include/mach/gpio.h
3 *
4 * Copyright (C) 2010 Google, Inc.
5 *
6 * Author:
7 * Erik Gilling <konkers@google.com>
8 *
9 * This software is licensed under the terms of the GNU General Public
10 * License version 2, as published by the Free Software Foundation, and
11 * may be copied, distributed, and modified under those terms.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 */
19
20#ifndef __MACH_TEGRA_GPIO_H
21#define __MACH_TEGRA_GPIO_H
22
23#include <linux/init.h>
24#include <mach/irqs.h>
25
26#define TEGRA_NR_GPIOS INT_GPIO_NR
27
28#include <asm-generic/gpio.h>
29
30#define gpio_get_value __gpio_get_value
31#define gpio_set_value __gpio_set_value
32#define gpio_cansleep __gpio_cansleep
33
34#define TEGRA_GPIO_TO_IRQ(gpio) (INT_GPIO_BASE + (gpio))
35#define TEGRA_IRQ_TO_GPIO(irq) ((irq) - INT_GPIO_BASE)
36
37static inline int gpio_to_irq(unsigned int gpio)
38{
39 if (gpio < TEGRA_NR_GPIOS)
40 return INT_GPIO_BASE + gpio;
41 return -EINVAL;
42}
43
44static inline int irq_to_gpio(unsigned int irq)
45{
46 if ((irq >= INT_GPIO_BASE) && (irq < INT_GPIO_BASE + INT_GPIO_NR))
47 return irq - INT_GPIO_BASE;
48 return -EINVAL;
49}
50
51struct tegra_gpio_table {
52 int gpio; /* GPIO number */
53 bool enable; /* Enable for GPIO at init? */
54};
55
56void tegra_gpio_config(struct tegra_gpio_table *table, int num);
57void tegra_gpio_enable(int gpio);
58void tegra_gpio_disable(int gpio);
59
60#endif
diff --git a/arch/arm/mach-tegra/usb_phy.c b/arch/arm/mach-tegra/usb_phy.c
index 88081bb3ec52..37576a721aeb 100644
--- a/arch/arm/mach-tegra/usb_phy.c
+++ b/arch/arm/mach-tegra/usb_phy.c
@@ -28,6 +28,7 @@
28#include <linux/usb/otg.h> 28#include <linux/usb/otg.h>
29#include <linux/usb/ulpi.h> 29#include <linux/usb/ulpi.h>
30#include <asm/mach-types.h> 30#include <asm/mach-types.h>
31#include <mach/gpio-tegra.h>
31#include <mach/usb_phy.h> 32#include <mach/usb_phy.h>
32#include <mach/iomap.h> 33#include <mach/iomap.h>
33 34
diff --git a/arch/arm/mach-u300/Kconfig b/arch/arm/mach-u300/Kconfig
index 32a7b0f7e9f7..d6e5d306557b 100644
--- a/arch/arm/mach-u300/Kconfig
+++ b/arch/arm/mach-u300/Kconfig
@@ -6,6 +6,9 @@ comment "ST-Ericsson Mobile Platform Products"
6 6
7config MACH_U300 7config MACH_U300
8 bool "U300" 8 bool "U300"
9 select PINCTRL
10 select PINMUX_U300
11 select GPIO_U300
9 12
10comment "ST-Ericsson U300/U330/U335/U365 Feature Selections" 13comment "ST-Ericsson U300/U330/U335/U365 Feature Selections"
11 14
diff --git a/arch/arm/mach-u300/Makefile b/arch/arm/mach-u300/Makefile
index 8fd354aaf0a7..285538124e5e 100644
--- a/arch/arm/mach-u300/Makefile
+++ b/arch/arm/mach-u300/Makefile
@@ -2,7 +2,7 @@
2# Makefile for the linux kernel, U300 machine. 2# Makefile for the linux kernel, U300 machine.
3# 3#
4 4
5obj-y := core.o clock.o timer.o padmux.o 5obj-y := core.o clock.o timer.o
6obj-m := 6obj-m :=
7obj-n := 7obj-n :=
8obj- := 8obj- :=
diff --git a/arch/arm/mach-u300/Makefile.boot b/arch/arm/mach-u300/Makefile.boot
index 6fbfc6ea2d35..69357affbd77 100644
--- a/arch/arm/mach-u300/Makefile.boot
+++ b/arch/arm/mach-u300/Makefile.boot
@@ -4,10 +4,10 @@
4# INITRD_PHYS must be in RAM 4# INITRD_PHYS must be in RAM
5 5
6ifdef CONFIG_MACH_U300_SINGLE_RAM 6ifdef CONFIG_MACH_U300_SINGLE_RAM
7 zreladdr-y := 0x28E08000 7 zreladdr-y += 0x28E08000
8 params_phys-y := 0x28E00100 8 params_phys-y := 0x28E00100
9else 9else
10 zreladdr-y := 0x48008000 10 zreladdr-y += 0x48008000
11 params_phys-y := 0x48000100 11 params_phys-y := 0x48000100
12endif 12endif
13 13
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c
index 376b6dfdfae9..f4ad6d2e26f3 100644
--- a/arch/arm/mach-u300/core.c
+++ b/arch/arm/mach-u300/core.c
@@ -25,6 +25,8 @@
25#include <linux/err.h> 25#include <linux/err.h>
26#include <linux/mtd/nand.h> 26#include <linux/mtd/nand.h>
27#include <linux/mtd/fsmc.h> 27#include <linux/mtd/fsmc.h>
28#include <linux/pinctrl/machine.h>
29#include <linux/pinctrl/pinmux.h>
28#include <linux/dma-mapping.h> 30#include <linux/dma-mapping.h>
29 31
30#include <asm/types.h> 32#include <asm/types.h>
@@ -38,6 +40,7 @@
38#include <mach/hardware.h> 40#include <mach/hardware.h>
39#include <mach/syscon.h> 41#include <mach/syscon.h>
40#include <mach/dma_channels.h> 42#include <mach/dma_channels.h>
43#include <mach/gpio-u300.h>
41 44
42#include "clock.h" 45#include "clock.h"
43#include "mmc.h" 46#include "mmc.h"
@@ -242,7 +245,7 @@ static struct resource gpio_resources[] = {
242 .end = IRQ_U300_GPIO_PORT2, 245 .end = IRQ_U300_GPIO_PORT2,
243 .flags = IORESOURCE_IRQ, 246 .flags = IORESOURCE_IRQ,
244 }, 247 },
245#ifdef U300_COH901571_3 248#if defined(CONFIG_MACH_U300_BS365) || defined(CONFIG_MACH_U300_BS335)
246 { 249 {
247 .name = "gpio3", 250 .name = "gpio3",
248 .start = IRQ_U300_GPIO_PORT3, 251 .start = IRQ_U300_GPIO_PORT3,
@@ -255,6 +258,7 @@ static struct resource gpio_resources[] = {
255 .end = IRQ_U300_GPIO_PORT4, 258 .end = IRQ_U300_GPIO_PORT4,
256 .flags = IORESOURCE_IRQ, 259 .flags = IORESOURCE_IRQ,
257 }, 260 },
261#endif
258#ifdef CONFIG_MACH_U300_BS335 262#ifdef CONFIG_MACH_U300_BS335
259 { 263 {
260 .name = "gpio5", 264 .name = "gpio5",
@@ -269,7 +273,6 @@ static struct resource gpio_resources[] = {
269 .flags = IORESOURCE_IRQ, 273 .flags = IORESOURCE_IRQ,
270 }, 274 },
271#endif /* CONFIG_MACH_U300_BS335 */ 275#endif /* CONFIG_MACH_U300_BS335 */
272#endif /* U300_COH901571_3 */
273}; 276};
274 277
275static struct resource keypad_resources[] = { 278static struct resource keypad_resources[] = {
@@ -1538,6 +1541,14 @@ static struct coh901318_platform coh901318_platform = {
1538 .max_channels = U300_DMA_CHANNELS, 1541 .max_channels = U300_DMA_CHANNELS,
1539}; 1542};
1540 1543
1544static struct resource pinmux_resources[] = {
1545 {
1546 .start = U300_SYSCON_BASE,
1547 .end = U300_SYSCON_BASE + SZ_4K - 1,
1548 .flags = IORESOURCE_MEM,
1549 },
1550};
1551
1541static struct platform_device wdog_device = { 1552static struct platform_device wdog_device = {
1542 .name = "coh901327_wdog", 1553 .name = "coh901327_wdog",
1543 .id = -1, 1554 .id = -1,
@@ -1559,11 +1570,35 @@ static struct platform_device i2c1_device = {
1559 .resource = i2c1_resources, 1570 .resource = i2c1_resources,
1560}; 1571};
1561 1572
1573/*
1574 * The different variants have a few different versions of the
1575 * GPIO block, with different number of ports.
1576 */
1577static struct u300_gpio_platform u300_gpio_plat = {
1578#if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330)
1579 .variant = U300_GPIO_COH901335,
1580 .ports = 3,
1581#endif
1582#ifdef CONFIG_MACH_U300_BS335
1583 .variant = U300_GPIO_COH901571_3_BS335,
1584 .ports = 7,
1585#endif
1586#ifdef CONFIG_MACH_U300_BS365
1587 .variant = U300_GPIO_COH901571_3_BS365,
1588 .ports = 5,
1589#endif
1590 .gpio_base = 0,
1591 .gpio_irq_base = IRQ_U300_GPIO_BASE,
1592};
1593
1562static struct platform_device gpio_device = { 1594static struct platform_device gpio_device = {
1563 .name = "u300-gpio", 1595 .name = "u300-gpio",
1564 .id = -1, 1596 .id = -1,
1565 .num_resources = ARRAY_SIZE(gpio_resources), 1597 .num_resources = ARRAY_SIZE(gpio_resources),
1566 .resource = gpio_resources, 1598 .resource = gpio_resources,
1599 .dev = {
1600 .platform_data = &u300_gpio_plat,
1601 },
1567}; 1602};
1568 1603
1569static struct platform_device keypad_device = { 1604static struct platform_device keypad_device = {
@@ -1633,6 +1668,72 @@ static struct platform_device dma_device = {
1633 }, 1668 },
1634}; 1669};
1635 1670
1671static struct platform_device pinmux_device = {
1672 .name = "pinmux-u300",
1673 .id = -1,
1674 .num_resources = ARRAY_SIZE(pinmux_resources),
1675 .resource = pinmux_resources,
1676};
1677
1678/* Pinmux settings */
1679static struct pinmux_map u300_pinmux_map[] = {
1680 /* anonymous maps for chip power and EMIFs */
1681 PINMUX_MAP_PRIMARY_SYS_HOG("POWER", "power"),
1682 PINMUX_MAP_PRIMARY_SYS_HOG("EMIF0", "emif0"),
1683 PINMUX_MAP_PRIMARY_SYS_HOG("EMIF1", "emif1"),
1684 /* per-device maps for MMC/SD, SPI and UART */
1685 PINMUX_MAP_PRIMARY("MMCSD", "mmc0", "mmci"),
1686 PINMUX_MAP_PRIMARY("SPI", "spi0", "pl022"),
1687 PINMUX_MAP_PRIMARY("UART0", "uart0", "uart0"),
1688};
1689
1690struct u300_mux_hog {
1691 const char *name;
1692 struct device *dev;
1693 struct pinmux *pmx;
1694};
1695
1696static struct u300_mux_hog u300_mux_hogs[] = {
1697 {
1698 .name = "uart0",
1699 .dev = &uart0_device.dev,
1700 },
1701 {
1702 .name = "spi0",
1703 .dev = &pl022_device.dev,
1704 },
1705 {
1706 .name = "mmc0",
1707 .dev = &mmcsd_device.dev,
1708 },
1709};
1710
1711static int __init u300_pinmux_fetch(void)
1712{
1713 int i;
1714
1715 for (i = 0; i < ARRAY_SIZE(u300_mux_hogs); i++) {
1716 struct pinmux *pmx;
1717 int ret;
1718
1719 pmx = pinmux_get(u300_mux_hogs[i].dev, NULL);
1720 if (IS_ERR(pmx)) {
1721 pr_err("u300: could not get pinmux hog %s\n",
1722 u300_mux_hogs[i].name);
1723 continue;
1724 }
1725 ret = pinmux_enable(pmx);
1726 if (ret) {
1727 pr_err("u300: could enable pinmux hog %s\n",
1728 u300_mux_hogs[i].name);
1729 continue;
1730 }
1731 u300_mux_hogs[i].pmx = pmx;
1732 }
1733 return 0;
1734}
1735subsys_initcall(u300_pinmux_fetch);
1736
1636/* 1737/*
1637 * Notice that AMBA devices are initialized before platform devices. 1738 * Notice that AMBA devices are initialized before platform devices.
1638 * 1739 *
@@ -1646,10 +1747,10 @@ static struct platform_device *platform_devs[] __initdata = {
1646 &gpio_device, 1747 &gpio_device,
1647 &nand_device, 1748 &nand_device,
1648 &wdog_device, 1749 &wdog_device,
1649 &ave_device 1750 &ave_device,
1751 &pinmux_device,
1650}; 1752};
1651 1753
1652
1653/* 1754/*
1654 * Interrupts: the U300 platforms have two pl190 ARM PrimeCells connected 1755 * Interrupts: the U300 platforms have two pl190 ARM PrimeCells connected
1655 * together so some interrupts are connected to the first one and some 1756 * together so some interrupts are connected to the first one and some
@@ -1669,7 +1770,7 @@ void __init u300_init_irq(void)
1669 BUG_ON(IS_ERR(clk)); 1770 BUG_ON(IS_ERR(clk));
1670 clk_enable(clk); 1771 clk_enable(clk);
1671 1772
1672 for (i = 0; i < NR_IRQS; i++) 1773 for (i = 0; i < U300_VIC_IRQS_END; i++)
1673 set_bit(i, (unsigned long *) &mask[0]); 1774 set_bit(i, (unsigned long *) &mask[0]);
1674 vic_init((void __iomem *) U300_INTCON0_VBASE, 0, mask[0], mask[0]); 1775 vic_init((void __iomem *) U300_INTCON0_VBASE, 0, mask[0], mask[0]);
1675 vic_init((void __iomem *) U300_INTCON1_VBASE, 32, mask[1], mask[1]); 1776 vic_init((void __iomem *) U300_INTCON1_VBASE, 32, mask[1], mask[1]);
@@ -1831,6 +1932,10 @@ void __init u300_init_devices(void)
1831 1932
1832 u300_assign_physmem(); 1933 u300_assign_physmem();
1833 1934
1935 /* Initialize pinmuxing */
1936 pinmux_register_mappings(u300_pinmux_map,
1937 ARRAY_SIZE(u300_pinmux_map));
1938
1834 /* Register subdevices on the I2C buses */ 1939 /* Register subdevices on the I2C buses */
1835 u300_i2c_register_board_devices(); 1940 u300_i2c_register_board_devices();
1836 1941
diff --git a/arch/arm/mach-u300/include/mach/gpio-u300.h b/arch/arm/mach-u300/include/mach/gpio-u300.h
new file mode 100644
index 000000000000..0c2b2021951a
--- /dev/null
+++ b/arch/arm/mach-u300/include/mach/gpio-u300.h
@@ -0,0 +1,150 @@
1/*
2 * Copyright (C) 2007-2011 ST-Ericsson AB
3 * License terms: GNU General Public License (GPL) version 2
4 * GPIO block resgister definitions and inline macros for
5 * U300 GPIO COH 901 335 or COH 901 571/3
6 * Author: Linus Walleij <linus.walleij@stericsson.com>
7 */
8
9#ifndef __MACH_U300_GPIO_U300_H
10#define __MACH_U300_GPIO_U300_H
11
12/*
13 * Individual pin assignments for the B26/S26. Notice that the
14 * actual usage of these pins depends on the PAD MUX settings, that
15 * is why the same number can potentially appear several times.
16 * In the reference design each pin is only used for one purpose.
17 * These were determined by inspecting the B26/S26 schematic:
18 * 2/1911-ROA 128 1603
19 */
20#ifdef CONFIG_MACH_U300_BS2X
21#define U300_GPIO_PIN_UART_RX 0
22#define U300_GPIO_PIN_UART_TX 1
23#define U300_GPIO_PIN_GPIO02 2 /* Unrouted */
24#define U300_GPIO_PIN_GPIO03 3 /* Unrouted */
25#define U300_GPIO_PIN_CAM_SLEEP 4
26#define U300_GPIO_PIN_CAM_REG_EN 5
27#define U300_GPIO_PIN_GPIO06 6 /* Unrouted */
28#define U300_GPIO_PIN_GPIO07 7 /* Unrouted */
29
30#define U300_GPIO_PIN_GPIO08 8 /* Service point SP2321 */
31#define U300_GPIO_PIN_GPIO09 9 /* Service point SP2322 */
32#define U300_GPIO_PIN_PHFSENSE 10 /* Headphone jack sensing */
33#define U300_GPIO_PIN_MMC_CLKRET 11 /* Clock return from MMC/SD card */
34#define U300_GPIO_PIN_MMC_CD 12 /* MMC Card insertion detection */
35#define U300_GPIO_PIN_FLIPSENSE 13 /* Mechanical flip sensing */
36#define U300_GPIO_PIN_GPIO14 14 /* DSP JTAG Port RTCK */
37#define U300_GPIO_PIN_GPIO15 15 /* Unrouted */
38
39#define U300_GPIO_PIN_GPIO16 16 /* Unrouted */
40#define U300_GPIO_PIN_GPIO17 17 /* Unrouted */
41#define U300_GPIO_PIN_GPIO18 18 /* Unrouted */
42#define U300_GPIO_PIN_GPIO19 19 /* Unrouted */
43#define U300_GPIO_PIN_GPIO20 20 /* Unrouted */
44#define U300_GPIO_PIN_GPIO21 21 /* Unrouted */
45#define U300_GPIO_PIN_GPIO22 22 /* Unrouted */
46#define U300_GPIO_PIN_GPIO23 23 /* Unrouted */
47#endif
48
49/*
50 * Individual pin assignments for the B330/S330 and B365/S365.
51 * Notice that the actual usage of these pins depends on the
52 * PAD MUX settings, that is why the same number can potentially
53 * appear several times. In the reference design each pin is only
54 * used for one purpose. These were determined by inspecting the
55 * S365 schematic.
56 */
57#if defined(CONFIG_MACH_U300_BS330) || defined(CONFIG_MACH_U300_BS365) || \
58 defined(CONFIG_MACH_U300_BS335)
59#define U300_GPIO_PIN_UART_RX 0
60#define U300_GPIO_PIN_UART_TX 1
61#define U300_GPIO_PIN_UART_CTS 2
62#define U300_GPIO_PIN_UART_RTS 3
63#define U300_GPIO_PIN_CAM_MAIN_STANDBY 4 /* Camera MAIN standby */
64#define U300_GPIO_PIN_GPIO05 5 /* Unrouted */
65#define U300_GPIO_PIN_MS_CD 6 /* Memory Stick Card insertion */
66#define U300_GPIO_PIN_GPIO07 7 /* Test point TP2430 */
67
68#define U300_GPIO_PIN_GPIO08 8 /* Test point TP2437 */
69#define U300_GPIO_PIN_GPIO09 9 /* Test point TP2431 */
70#define U300_GPIO_PIN_GPIO10 10 /* Test point TP2432 */
71#define U300_GPIO_PIN_MMC_CLKRET 11 /* Clock return from MMC/SD card */
72#define U300_GPIO_PIN_MMC_CD 12 /* MMC Card insertion detection */
73#define U300_GPIO_PIN_CAM_SUB_STANDBY 13 /* Camera SUB standby */
74#define U300_GPIO_PIN_GPIO14 14 /* Test point TP2436 */
75#define U300_GPIO_PIN_GPIO15 15 /* Unrouted */
76
77#define U300_GPIO_PIN_GPIO16 16 /* Test point TP2438 */
78#define U300_GPIO_PIN_PHFSENSE 17 /* Headphone jack sensing */
79#define U300_GPIO_PIN_GPIO18 18 /* Test point TP2439 */
80#define U300_GPIO_PIN_GPIO19 19 /* Routed somewhere */
81#define U300_GPIO_PIN_GPIO20 20 /* Unrouted */
82#define U300_GPIO_PIN_GPIO21 21 /* Unrouted */
83#define U300_GPIO_PIN_GPIO22 22 /* Unrouted */
84#define U300_GPIO_PIN_GPIO23 23 /* Unrouted */
85
86#define U300_GPIO_PIN_GPIO24 24 /* Unrouted */
87#define U300_GPIO_PIN_GPIO25 25 /* Unrouted */
88#define U300_GPIO_PIN_GPIO26 26 /* Unrouted */
89#define U300_GPIO_PIN_GPIO27 27 /* Unrouted */
90#define U300_GPIO_PIN_GPIO28 28 /* Unrouted */
91#define U300_GPIO_PIN_GPIO29 29 /* Unrouted */
92#define U300_GPIO_PIN_GPIO30 30 /* Unrouted */
93#define U300_GPIO_PIN_GPIO31 31 /* Unrouted */
94
95#define U300_GPIO_PIN_GPIO32 32 /* Unrouted */
96#define U300_GPIO_PIN_GPIO33 33 /* Unrouted */
97#define U300_GPIO_PIN_GPIO34 34 /* Unrouted */
98#define U300_GPIO_PIN_GPIO35 35 /* Unrouted */
99#define U300_GPIO_PIN_GPIO36 36 /* Unrouted */
100#define U300_GPIO_PIN_GPIO37 37 /* Unrouted */
101#define U300_GPIO_PIN_GPIO38 38 /* Unrouted */
102#define U300_GPIO_PIN_GPIO39 39 /* Unrouted */
103
104#ifdef CONFIG_MACH_U300_BS335
105
106#define U300_GPIO_PIN_GPIO40 40 /* Unrouted */
107#define U300_GPIO_PIN_GPIO41 41 /* Unrouted */
108#define U300_GPIO_PIN_GPIO42 42 /* Unrouted */
109#define U300_GPIO_PIN_GPIO43 43 /* Unrouted */
110#define U300_GPIO_PIN_GPIO44 44 /* Unrouted */
111#define U300_GPIO_PIN_GPIO45 45 /* Unrouted */
112#define U300_GPIO_PIN_GPIO46 46 /* Unrouted */
113#define U300_GPIO_PIN_GPIO47 47 /* Unrouted */
114
115#define U300_GPIO_PIN_GPIO48 48 /* Unrouted */
116#define U300_GPIO_PIN_GPIO49 49 /* Unrouted */
117#define U300_GPIO_PIN_GPIO50 50 /* Unrouted */
118#define U300_GPIO_PIN_GPIO51 51 /* Unrouted */
119#define U300_GPIO_PIN_GPIO52 52 /* Unrouted */
120#define U300_GPIO_PIN_GPIO53 53 /* Unrouted */
121#define U300_GPIO_PIN_GPIO54 54 /* Unrouted */
122#define U300_GPIO_PIN_GPIO55 55 /* Unrouted */
123#endif
124
125#endif
126
127/**
128 * enum u300_gpio_variant - the type of U300 GPIO employed
129 */
130enum u300_gpio_variant {
131 U300_GPIO_COH901335,
132 U300_GPIO_COH901571_3_BS335,
133 U300_GPIO_COH901571_3_BS365,
134};
135
136/**
137 * struct u300_gpio_platform - U300 GPIO platform data
138 * @variant: IP block variant
139 * @ports: number of GPIO block ports
140 * @gpio_base: first GPIO number for this block (use a free range)
141 * @gpio_irq_base: first GPIO IRQ number for this block (use a free range)
142 */
143struct u300_gpio_platform {
144 enum u300_gpio_variant variant;
145 u8 ports;
146 int gpio_base;
147 int gpio_irq_base;
148};
149
150#endif /* __MACH_U300_GPIO_U300_H */
diff --git a/arch/arm/mach-u300/include/mach/gpio.h b/arch/arm/mach-u300/include/mach/gpio.h
index d5a71abcbaea..e69de29bb2d1 100644
--- a/arch/arm/mach-u300/include/mach/gpio.h
+++ b/arch/arm/mach-u300/include/mach/gpio.h
@@ -1,294 +0,0 @@
1/*
2 *
3 * arch/arm/mach-u300/include/mach/gpio.h
4 *
5 *
6 * Copyright (C) 2007-2009 ST-Ericsson AB
7 * License terms: GNU General Public License (GPL) version 2
8 * GPIO block resgister definitions and inline macros for
9 * U300 GPIO COH 901 335 or COH 901 571/3
10 * Author: Linus Walleij <linus.walleij@stericsson.com>
11 */
12
13#ifndef __MACH_U300_GPIO_H
14#define __MACH_U300_GPIO_H
15
16#include <linux/kernel.h>
17#include <linux/io.h>
18#include <mach/hardware.h>
19#include <asm/irq.h>
20
21/* Switch type depending on platform/chip variant */
22#if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330)
23#define U300_COH901335
24#endif
25#if defined(CONFIG_MACH_U300_BS365) || defined(CONFIG_MACH_U300_BS335)
26#define U300_COH901571_3
27#endif
28
29/* Get base address for regs here */
30#include "u300-regs.h"
31/* IRQ numbers */
32#include "irqs.h"
33
34/*
35 * This is the GPIO block definitions. GPIO (General Purpose I/O) can be
36 * used for anything, and often is. The event/enable etc figures are for
37 * the lowermost pin (pin 0 on each port), shift this left to match your
38 * pin if you're gonna use these values.
39 */
40#ifdef U300_COH901335
41#define U300_GPIO_PORTX_SPACING (0x1C)
42/* Port X Pin Data Register 32bit, this is both input and output (R/W) */
43#define U300_GPIO_PXPDIR (0x00)
44#define U300_GPIO_PXPDOR (0x00)
45/* Port X Pin Config Register 32bit (R/W) */
46#define U300_GPIO_PXPCR (0x04)
47#define U300_GPIO_PXPCR_ALL_PINS_MODE_MASK (0x0000FFFFUL)
48#define U300_GPIO_PXPCR_PIN_MODE_MASK (0x00000003UL)
49#define U300_GPIO_PXPCR_PIN_MODE_SHIFT (0x00000002UL)
50#define U300_GPIO_PXPCR_PIN_MODE_INPUT (0x00000000UL)
51#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL (0x00000001UL)
52#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_DRAIN (0x00000002UL)
53#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_SOURCE (0x00000003UL)
54/* Port X Interrupt Event Register 32bit (R/W) */
55#define U300_GPIO_PXIEV (0x08)
56#define U300_GPIO_PXIEV_ALL_IRQ_EVENT_MASK (0x000000FFUL)
57#define U300_GPIO_PXIEV_IRQ_EVENT (0x00000001UL)
58/* Port X Interrupt Enable Register 32bit (R/W) */
59#define U300_GPIO_PXIEN (0x0C)
60#define U300_GPIO_PXIEN_ALL_IRQ_ENABLE_MASK (0x000000FFUL)
61#define U300_GPIO_PXIEN_IRQ_ENABLE (0x00000001UL)
62/* Port X Interrupt Force Register 32bit (R/W) */
63#define U300_GPIO_PXIFR (0x10)
64#define U300_GPIO_PXIFR_ALL_IRQ_FORCE_MASK (0x000000FFUL)
65#define U300_GPIO_PXIFR_IRQ_FORCE (0x00000001UL)
66/* Port X Interrupt Config Register 32bit (R/W) */
67#define U300_GPIO_PXICR (0x14)
68#define U300_GPIO_PXICR_ALL_IRQ_CONFIG_MASK (0x000000FFUL)
69#define U300_GPIO_PXICR_IRQ_CONFIG_MASK (0x00000001UL)
70#define U300_GPIO_PXICR_IRQ_CONFIG_FALLING_EDGE (0x00000000UL)
71#define U300_GPIO_PXICR_IRQ_CONFIG_RISING_EDGE (0x00000001UL)
72/* Port X Pull-up Enable Register 32bit (R/W) */
73#define U300_GPIO_PXPER (0x18)
74#define U300_GPIO_PXPER_ALL_PULL_UP_DISABLE_MASK (0x000000FFUL)
75#define U300_GPIO_PXPER_PULL_UP_DISABLE (0x00000001UL)
76/* Control Register 32bit (R/W) */
77#define U300_GPIO_CR (0x54)
78#define U300_GPIO_CR_BLOCK_CLOCK_ENABLE (0x00000001UL)
79/* three ports of 8 bits each = GPIO pins 0..23 */
80#define U300_GPIO_NUM_PORTS 3
81#define U300_GPIO_PINS_PER_PORT 8
82#define U300_GPIO_MAX (U300_GPIO_PINS_PER_PORT * U300_GPIO_NUM_PORTS - 1)
83#endif
84
85#ifdef U300_COH901571_3
86/*
87 * Control Register 32bit (R/W)
88 * bit 15-9 (mask 0x0000FE00) contains the number of cores. 8*cores
89 * gives the number of GPIO pins.
90 * bit 8-2 (mask 0x000001FC) contains the core version ID.
91 */
92#define U300_GPIO_CR (0x00)
93#define U300_GPIO_CR_SYNC_SEL_ENABLE (0x00000002UL)
94#define U300_GPIO_CR_BLOCK_CLKRQ_ENABLE (0x00000001UL)
95#define U300_GPIO_PORTX_SPACING (0x30)
96/* Port X Pin Data INPUT Register 32bit (R/W) */
97#define U300_GPIO_PXPDIR (0x04)
98/* Port X Pin Data OUTPUT Register 32bit (R/W) */
99#define U300_GPIO_PXPDOR (0x08)
100/* Port X Pin Config Register 32bit (R/W) */
101#define U300_GPIO_PXPCR (0x0C)
102#define U300_GPIO_PXPCR_ALL_PINS_MODE_MASK (0x0000FFFFUL)
103#define U300_GPIO_PXPCR_PIN_MODE_MASK (0x00000003UL)
104#define U300_GPIO_PXPCR_PIN_MODE_SHIFT (0x00000002UL)
105#define U300_GPIO_PXPCR_PIN_MODE_INPUT (0x00000000UL)
106#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL (0x00000001UL)
107#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_DRAIN (0x00000002UL)
108#define U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_SOURCE (0x00000003UL)
109/* Port X Pull-up Enable Register 32bit (R/W) */
110#define U300_GPIO_PXPER (0x10)
111#define U300_GPIO_PXPER_ALL_PULL_UP_DISABLE_MASK (0x000000FFUL)
112#define U300_GPIO_PXPER_PULL_UP_DISABLE (0x00000001UL)
113/* Port X Interrupt Event Register 32bit (R/W) */
114#define U300_GPIO_PXIEV (0x14)
115#define U300_GPIO_PXIEV_ALL_IRQ_EVENT_MASK (0x000000FFUL)
116#define U300_GPIO_PXIEV_IRQ_EVENT (0x00000001UL)
117/* Port X Interrupt Enable Register 32bit (R/W) */
118#define U300_GPIO_PXIEN (0x18)
119#define U300_GPIO_PXIEN_ALL_IRQ_ENABLE_MASK (0x000000FFUL)
120#define U300_GPIO_PXIEN_IRQ_ENABLE (0x00000001UL)
121/* Port X Interrupt Force Register 32bit (R/W) */
122#define U300_GPIO_PXIFR (0x1C)
123#define U300_GPIO_PXIFR_ALL_IRQ_FORCE_MASK (0x000000FFUL)
124#define U300_GPIO_PXIFR_IRQ_FORCE (0x00000001UL)
125/* Port X Interrupt Config Register 32bit (R/W) */
126#define U300_GPIO_PXICR (0x20)
127#define U300_GPIO_PXICR_ALL_IRQ_CONFIG_MASK (0x000000FFUL)
128#define U300_GPIO_PXICR_IRQ_CONFIG_MASK (0x00000001UL)
129#define U300_GPIO_PXICR_IRQ_CONFIG_FALLING_EDGE (0x00000000UL)
130#define U300_GPIO_PXICR_IRQ_CONFIG_RISING_EDGE (0x00000001UL)
131#ifdef CONFIG_MACH_U300_BS335
132/* seven ports of 8 bits each = GPIO pins 0..55 */
133#define U300_GPIO_NUM_PORTS 7
134#else
135/* five ports of 8 bits each = GPIO pins 0..39 */
136#define U300_GPIO_NUM_PORTS 5
137#endif
138#define U300_GPIO_PINS_PER_PORT 8
139#define U300_GPIO_MAX (U300_GPIO_PINS_PER_PORT * U300_GPIO_NUM_PORTS - 1)
140#endif
141
142/*
143 * Individual pin assignments for the B26/S26. Notice that the
144 * actual usage of these pins depends on the PAD MUX settings, that
145 * is why the same number can potentially appear several times.
146 * In the reference design each pin is only used for one purpose.
147 * These were determined by inspecting the B26/S26 schematic:
148 * 2/1911-ROA 128 1603
149 */
150#ifdef CONFIG_MACH_U300_BS2X
151#define U300_GPIO_PIN_UART_RX 0
152#define U300_GPIO_PIN_UART_TX 1
153#define U300_GPIO_PIN_GPIO02 2 /* Unrouted */
154#define U300_GPIO_PIN_GPIO03 3 /* Unrouted */
155#define U300_GPIO_PIN_CAM_SLEEP 4
156#define U300_GPIO_PIN_CAM_REG_EN 5
157#define U300_GPIO_PIN_GPIO06 6 /* Unrouted */
158#define U300_GPIO_PIN_GPIO07 7 /* Unrouted */
159
160#define U300_GPIO_PIN_GPIO08 8 /* Service point SP2321 */
161#define U300_GPIO_PIN_GPIO09 9 /* Service point SP2322 */
162#define U300_GPIO_PIN_PHFSENSE 10 /* Headphone jack sensing */
163#define U300_GPIO_PIN_MMC_CLKRET 11 /* Clock return from MMC/SD card */
164#define U300_GPIO_PIN_MMC_CD 12 /* MMC Card insertion detection */
165#define U300_GPIO_PIN_FLIPSENSE 13 /* Mechanical flip sensing */
166#define U300_GPIO_PIN_GPIO14 14 /* DSP JTAG Port RTCK */
167#define U300_GPIO_PIN_GPIO15 15 /* Unrouted */
168
169#define U300_GPIO_PIN_GPIO16 16 /* Unrouted */
170#define U300_GPIO_PIN_GPIO17 17 /* Unrouted */
171#define U300_GPIO_PIN_GPIO18 18 /* Unrouted */
172#define U300_GPIO_PIN_GPIO19 19 /* Unrouted */
173#define U300_GPIO_PIN_GPIO20 20 /* Unrouted */
174#define U300_GPIO_PIN_GPIO21 21 /* Unrouted */
175#define U300_GPIO_PIN_GPIO22 22 /* Unrouted */
176#define U300_GPIO_PIN_GPIO23 23 /* Unrouted */
177#endif
178
179/*
180 * Individual pin assignments for the B330/S330 and B365/S365.
181 * Notice that the actual usage of these pins depends on the
182 * PAD MUX settings, that is why the same number can potentially
183 * appear several times. In the reference design each pin is only
184 * used for one purpose. These were determined by inspecting the
185 * S365 schematic.
186 */
187#if defined(CONFIG_MACH_U300_BS330) || defined(CONFIG_MACH_U300_BS365) || \
188 defined(CONFIG_MACH_U300_BS335)
189#define U300_GPIO_PIN_UART_RX 0
190#define U300_GPIO_PIN_UART_TX 1
191#define U300_GPIO_PIN_UART_CTS 2
192#define U300_GPIO_PIN_UART_RTS 3
193#define U300_GPIO_PIN_CAM_MAIN_STANDBY 4 /* Camera MAIN standby */
194#define U300_GPIO_PIN_GPIO05 5 /* Unrouted */
195#define U300_GPIO_PIN_MS_CD 6 /* Memory Stick Card insertion */
196#define U300_GPIO_PIN_GPIO07 7 /* Test point TP2430 */
197
198#define U300_GPIO_PIN_GPIO08 8 /* Test point TP2437 */
199#define U300_GPIO_PIN_GPIO09 9 /* Test point TP2431 */
200#define U300_GPIO_PIN_GPIO10 10 /* Test point TP2432 */
201#define U300_GPIO_PIN_MMC_CLKRET 11 /* Clock return from MMC/SD card */
202#define U300_GPIO_PIN_MMC_CD 12 /* MMC Card insertion detection */
203#define U300_GPIO_PIN_CAM_SUB_STANDBY 13 /* Camera SUB standby */
204#define U300_GPIO_PIN_GPIO14 14 /* Test point TP2436 */
205#define U300_GPIO_PIN_GPIO15 15 /* Unrouted */
206
207#define U300_GPIO_PIN_GPIO16 16 /* Test point TP2438 */
208#define U300_GPIO_PIN_PHFSENSE 17 /* Headphone jack sensing */
209#define U300_GPIO_PIN_GPIO18 18 /* Test point TP2439 */
210#define U300_GPIO_PIN_GPIO19 19 /* Routed somewhere */
211#define U300_GPIO_PIN_GPIO20 20 /* Unrouted */
212#define U300_GPIO_PIN_GPIO21 21 /* Unrouted */
213#define U300_GPIO_PIN_GPIO22 22 /* Unrouted */
214#define U300_GPIO_PIN_GPIO23 23 /* Unrouted */
215
216#define U300_GPIO_PIN_GPIO24 24 /* Unrouted */
217#define U300_GPIO_PIN_GPIO25 25 /* Unrouted */
218#define U300_GPIO_PIN_GPIO26 26 /* Unrouted */
219#define U300_GPIO_PIN_GPIO27 27 /* Unrouted */
220#define U300_GPIO_PIN_GPIO28 28 /* Unrouted */
221#define U300_GPIO_PIN_GPIO29 29 /* Unrouted */
222#define U300_GPIO_PIN_GPIO30 30 /* Unrouted */
223#define U300_GPIO_PIN_GPIO31 31 /* Unrouted */
224
225#define U300_GPIO_PIN_GPIO32 32 /* Unrouted */
226#define U300_GPIO_PIN_GPIO33 33 /* Unrouted */
227#define U300_GPIO_PIN_GPIO34 34 /* Unrouted */
228#define U300_GPIO_PIN_GPIO35 35 /* Unrouted */
229#define U300_GPIO_PIN_GPIO36 36 /* Unrouted */
230#define U300_GPIO_PIN_GPIO37 37 /* Unrouted */
231#define U300_GPIO_PIN_GPIO38 38 /* Unrouted */
232#define U300_GPIO_PIN_GPIO39 39 /* Unrouted */
233
234#ifdef CONFIG_MACH_U300_BS335
235
236#define U300_GPIO_PIN_GPIO40 40 /* Unrouted */
237#define U300_GPIO_PIN_GPIO41 41 /* Unrouted */
238#define U300_GPIO_PIN_GPIO42 42 /* Unrouted */
239#define U300_GPIO_PIN_GPIO43 43 /* Unrouted */
240#define U300_GPIO_PIN_GPIO44 44 /* Unrouted */
241#define U300_GPIO_PIN_GPIO45 45 /* Unrouted */
242#define U300_GPIO_PIN_GPIO46 46 /* Unrouted */
243#define U300_GPIO_PIN_GPIO47 47 /* Unrouted */
244
245#define U300_GPIO_PIN_GPIO48 48 /* Unrouted */
246#define U300_GPIO_PIN_GPIO49 49 /* Unrouted */
247#define U300_GPIO_PIN_GPIO50 50 /* Unrouted */
248#define U300_GPIO_PIN_GPIO51 51 /* Unrouted */
249#define U300_GPIO_PIN_GPIO52 52 /* Unrouted */
250#define U300_GPIO_PIN_GPIO53 53 /* Unrouted */
251#define U300_GPIO_PIN_GPIO54 54 /* Unrouted */
252#define U300_GPIO_PIN_GPIO55 55 /* Unrouted */
253#endif
254
255#endif
256
257/* translates a pin number to a port number */
258#define PIN_TO_PORT(val) (val >> 3)
259
260/* These can be found in arch/arm/mach-u300/gpio.c */
261extern int gpio_is_valid(int number);
262extern int gpio_request(unsigned gpio, const char *label);
263extern void gpio_free(unsigned gpio);
264extern int gpio_direction_input(unsigned gpio);
265extern int gpio_direction_output(unsigned gpio, int value);
266extern int gpio_register_callback(unsigned gpio,
267 int (*func)(void *arg),
268 void *);
269extern int gpio_unregister_callback(unsigned gpio);
270extern void enable_irq_on_gpio_pin(unsigned gpio, int edge);
271extern void disable_irq_on_gpio_pin(unsigned gpio);
272extern void gpio_pullup(unsigned gpio, int value);
273extern int gpio_get_value(unsigned gpio);
274extern void gpio_set_value(unsigned gpio, int value);
275
276#define gpio_get_value_cansleep gpio_get_value
277#define gpio_set_value_cansleep gpio_set_value
278
279/* wrappers to sleep-enable the previous two functions */
280static inline unsigned gpio_to_irq(unsigned gpio)
281{
282 return PIN_TO_PORT(gpio) + IRQ_U300_GPIO_PORT0;
283}
284
285static inline unsigned irq_to_gpio(unsigned irq)
286{
287 /*
288 * FIXME: This is no 1-1 mapping at all, it points to the
289 * whole block of 8 pins.
290 */
291 return (irq - IRQ_U300_GPIO_PORT0) << 3;
292}
293
294#endif
diff --git a/arch/arm/mach-u300/include/mach/irqs.h b/arch/arm/mach-u300/include/mach/irqs.h
index 09b1b28fa8fd..d270fea32926 100644
--- a/arch/arm/mach-u300/include/mach/irqs.h
+++ b/arch/arm/mach-u300/include/mach/irqs.h
@@ -72,7 +72,7 @@
72 72
73/* DB3150 and DB3200 have only 45 IRQs */ 73/* DB3150 and DB3200 have only 45 IRQs */
74#if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330) 74#if defined(CONFIG_MACH_U300_BS2X) || defined(CONFIG_MACH_U300_BS330)
75#define U300_NR_IRQS 45 75#define U300_VIC_IRQS_END 45
76#endif 76#endif
77 77
78/* The DB3350-specific interrupt lines */ 78/* The DB3350-specific interrupt lines */
@@ -88,7 +88,7 @@
88#define IRQ_U300_GPIO_PORT4 53 88#define IRQ_U300_GPIO_PORT4 53
89#define IRQ_U300_GPIO_PORT5 54 89#define IRQ_U300_GPIO_PORT5 54
90#define IRQ_U300_GPIO_PORT6 55 90#define IRQ_U300_GPIO_PORT6 55
91#define U300_NR_IRQS 56 91#define U300_VIC_IRQS_END 56
92#endif 92#endif
93 93
94/* The DB3210-specific interrupt lines */ 94/* The DB3210-specific interrupt lines */
@@ -106,16 +106,25 @@
106#define IRQ_U300_NFIF 45 106#define IRQ_U300_NFIF 45
107#define IRQ_U300_NFIF2 46 107#define IRQ_U300_NFIF2 46
108#define IRQ_U300_SYSCON_PLL_LOCK 47 108#define IRQ_U300_SYSCON_PLL_LOCK 47
109#define U300_NR_IRQS 48 109#define U300_VIC_IRQS_END 48
110#endif 110#endif
111 111
112#ifdef CONFIG_AB3550_CORE 112/* Maximum 8*7 GPIO lines */
113#define IRQ_AB3550_BASE (U300_NR_IRQS) 113#ifdef CONFIG_GPIO_U300
114#define IRQ_AB3550_END (IRQ_AB3550_BASE + 37) 114#define IRQ_U300_GPIO_BASE (U300_VIC_IRQS_END)
115#define IRQ_U300_GPIO_END (IRQ_U300_GPIO_BASE + 56)
116#else
117#define IRQ_U300_GPIO_END (U300_VIC_IRQS_END)
118#endif
115 119
116#define NR_IRQS (IRQ_AB3550_END + 1) 120/* Optional AB3550 mixsig chip */
121#ifdef CONFIG_AB3550_CORE
122#define IRQ_AB3550_BASE (IRQ_U300_GPIO_END)
123#define IRQ_AB3550_END (IRQ_AB3550_BASE + 38)
117#else 124#else
118#define NR_IRQS U300_NR_IRQS 125#define IRQ_AB3550_END (IRQ_U300_GPIO_END)
119#endif 126#endif
120 127
128#define NR_IRQS (IRQ_AB3550_END)
129
121#endif 130#endif
diff --git a/arch/arm/mach-u300/include/mach/syscon.h b/arch/arm/mach-u300/include/mach/syscon.h
index 7444f5c7da97..6e84f07a7c6f 100644
--- a/arch/arm/mach-u300/include/mach/syscon.h
+++ b/arch/arm/mach-u300/include/mach/syscon.h
@@ -234,91 +234,6 @@
234#define U300_SYSCON_ECCR_EMIF_1_RET_OUT_CLK_EN_N_DISABLE (0x0004) 234#define U300_SYSCON_ECCR_EMIF_1_RET_OUT_CLK_EN_N_DISABLE (0x0004)
235#define U300_SYSCON_ECCR_EMIF_MEMCLK_RET_EN_N_DISABLE (0x0002) 235#define U300_SYSCON_ECCR_EMIF_MEMCLK_RET_EN_N_DISABLE (0x0002)
236#define U300_SYSCON_ECCR_EMIF_SDRCLK_RET_EN_N_DISABLE (0x0001) 236#define U300_SYSCON_ECCR_EMIF_SDRCLK_RET_EN_N_DISABLE (0x0001)
237/* PAD MUX Control register 1 (LOW) 16bit (R/W) */
238#define U300_SYSCON_PMC1LR (0x007C)
239#define U300_SYSCON_PMC1LR_MASK (0xFFFF)
240#define U300_SYSCON_PMC1LR_CDI_MASK (0xC000)
241#define U300_SYSCON_PMC1LR_CDI_CDI (0x0000)
242#define U300_SYSCON_PMC1LR_CDI_EMIF (0x4000)
243#ifdef CONFIG_MACH_U300_BS335
244#define U300_SYSCON_PMC1LR_CDI_CDI2 (0x8000)
245#define U300_SYSCON_PMC1LR_CDI_WCDMA_APP_GPIO (0xC000)
246#elif CONFIG_MACH_U300_BS365
247#define U300_SYSCON_PMC1LR_CDI_GPIO (0x8000)
248#define U300_SYSCON_PMC1LR_CDI_WCDMA (0xC000)
249#endif
250#define U300_SYSCON_PMC1LR_PDI_MASK (0x3000)
251#define U300_SYSCON_PMC1LR_PDI_PDI (0x0000)
252#define U300_SYSCON_PMC1LR_PDI_EGG (0x1000)
253#define U300_SYSCON_PMC1LR_PDI_WCDMA (0x3000)
254#define U300_SYSCON_PMC1LR_MMCSD_MASK (0x0C00)
255#define U300_SYSCON_PMC1LR_MMCSD_MMCSD (0x0000)
256#define U300_SYSCON_PMC1LR_MMCSD_MSPRO (0x0400)
257#define U300_SYSCON_PMC1LR_MMCSD_DSP (0x0800)
258#define U300_SYSCON_PMC1LR_MMCSD_WCDMA (0x0C00)
259#define U300_SYSCON_PMC1LR_ETM_MASK (0x0300)
260#define U300_SYSCON_PMC1LR_ETM_ACC (0x0000)
261#define U300_SYSCON_PMC1LR_ETM_APP (0x0100)
262#define U300_SYSCON_PMC1LR_EMIF_1_CS2_MASK (0x00C0)
263#define U300_SYSCON_PMC1LR_EMIF_1_CS2_STATIC (0x0000)
264#define U300_SYSCON_PMC1LR_EMIF_1_CS2_NFIF (0x0040)
265#define U300_SYSCON_PMC1LR_EMIF_1_CS2_SDRAM (0x0080)
266#define U300_SYSCON_PMC1LR_EMIF_1_CS2_STATIC_2GB (0x00C0)
267#define U300_SYSCON_PMC1LR_EMIF_1_CS1_MASK (0x0030)
268#define U300_SYSCON_PMC1LR_EMIF_1_CS1_STATIC (0x0000)
269#define U300_SYSCON_PMC1LR_EMIF_1_CS1_NFIF (0x0010)
270#define U300_SYSCON_PMC1LR_EMIF_1_CS1_SDRAM (0x0020)
271#define U300_SYSCON_PMC1LR_EMIF_1_CS1_SEMI (0x0030)
272#define U300_SYSCON_PMC1LR_EMIF_1_CS0_MASK (0x000C)
273#define U300_SYSCON_PMC1LR_EMIF_1_CS0_STATIC (0x0000)
274#define U300_SYSCON_PMC1LR_EMIF_1_CS0_NFIF (0x0004)
275#define U300_SYSCON_PMC1LR_EMIF_1_CS0_SDRAM (0x0008)
276#define U300_SYSCON_PMC1LR_EMIF_1_CS0_SEMI (0x000C)
277#define U300_SYSCON_PMC1LR_EMIF_1_MASK (0x0003)
278#define U300_SYSCON_PMC1LR_EMIF_1_STATIC (0x0000)
279#define U300_SYSCON_PMC1LR_EMIF_1_SDRAM0 (0x0001)
280#define U300_SYSCON_PMC1LR_EMIF_1_SDRAM1 (0x0002)
281#define U300_SYSCON_PMC1LR_EMIF_1 (0x0003)
282/* PAD MUX Control register 2 (HIGH) 16bit (R/W) */
283#define U300_SYSCON_PMC1HR (0x007E)
284#define U300_SYSCON_PMC1HR_MASK (0xFFFF)
285#define U300_SYSCON_PMC1HR_MISC_2_MASK (0xC000)
286#define U300_SYSCON_PMC1HR_MISC_2_APP_GPIO (0x0000)
287#define U300_SYSCON_PMC1HR_MISC_2_MSPRO (0x4000)
288#define U300_SYSCON_PMC1HR_MISC_2_DSP (0x8000)
289#define U300_SYSCON_PMC1HR_MISC_2_AAIF (0xC000)
290#define U300_SYSCON_PMC1HR_APP_GPIO_2_MASK (0x3000)
291#define U300_SYSCON_PMC1HR_APP_GPIO_2_APP_GPIO (0x0000)
292#define U300_SYSCON_PMC1HR_APP_GPIO_2_NFIF (0x1000)
293#define U300_SYSCON_PMC1HR_APP_GPIO_2_DSP (0x2000)
294#define U300_SYSCON_PMC1HR_APP_GPIO_2_AAIF (0x3000)
295#define U300_SYSCON_PMC1HR_APP_GPIO_1_MASK (0x0C00)
296#define U300_SYSCON_PMC1HR_APP_GPIO_1_APP_GPIO (0x0000)
297#define U300_SYSCON_PMC1HR_APP_GPIO_1_MMC (0x0400)
298#define U300_SYSCON_PMC1HR_APP_GPIO_1_DSP (0x0800)
299#define U300_SYSCON_PMC1HR_APP_GPIO_1_AAIF (0x0C00)
300#define U300_SYSCON_PMC1HR_APP_SPI_CS_2_MASK (0x0300)
301#define U300_SYSCON_PMC1HR_APP_SPI_CS_2_APP_GPIO (0x0000)
302#define U300_SYSCON_PMC1HR_APP_SPI_CS_2_SPI (0x0100)
303#define U300_SYSCON_PMC1HR_APP_SPI_CS_2_AAIF (0x0300)
304#define U300_SYSCON_PMC1HR_APP_SPI_CS_1_MASK (0x00C0)
305#define U300_SYSCON_PMC1HR_APP_SPI_CS_1_APP_GPIO (0x0000)
306#define U300_SYSCON_PMC1HR_APP_SPI_CS_1_SPI (0x0040)
307#define U300_SYSCON_PMC1HR_APP_SPI_CS_1_AAIF (0x00C0)
308#define U300_SYSCON_PMC1HR_APP_SPI_2_MASK (0x0030)
309#define U300_SYSCON_PMC1HR_APP_SPI_2_APP_GPIO (0x0000)
310#define U300_SYSCON_PMC1HR_APP_SPI_2_SPI (0x0010)
311#define U300_SYSCON_PMC1HR_APP_SPI_2_DSP (0x0020)
312#define U300_SYSCON_PMC1HR_APP_SPI_2_AAIF (0x0030)
313#define U300_SYSCON_PMC1HR_APP_UART0_2_MASK (0x000C)
314#define U300_SYSCON_PMC1HR_APP_UART0_2_APP_GPIO (0x0000)
315#define U300_SYSCON_PMC1HR_APP_UART0_2_UART0 (0x0004)
316#define U300_SYSCON_PMC1HR_APP_UART0_2_NFIF_CS (0x0008)
317#define U300_SYSCON_PMC1HR_APP_UART0_2_AAIF (0x000C)
318#define U300_SYSCON_PMC1HR_APP_UART0_1_MASK (0x0003)
319#define U300_SYSCON_PMC1HR_APP_UART0_1_APP_GPIO (0x0000)
320#define U300_SYSCON_PMC1HR_APP_UART0_1_UART0 (0x0001)
321#define U300_SYSCON_PMC1HR_APP_UART0_1_AAIF (0x0003)
322/* Step one for killing the applications system 16bit (-/W) */ 237/* Step one for killing the applications system 16bit (-/W) */
323#define U300_SYSCON_KA1R (0x0080) 238#define U300_SYSCON_KA1R (0x0080)
324#define U300_SYSCON_KA1R_MASK (0xFFFF) 239#define U300_SYSCON_KA1R_MASK (0xFFFF)
@@ -357,57 +272,6 @@
357#define U300_SYSCON_PUCR_EMIF_1_16BIT_PU_ENABLE (0x0080) 272#define U300_SYSCON_PUCR_EMIF_1_16BIT_PU_ENABLE (0x0080)
358#define U300_SYSCON_PUCR_EMIF_1_8BIT_PU_ENABLE (0x0040) 273#define U300_SYSCON_PUCR_EMIF_1_8BIT_PU_ENABLE (0x0040)
359#define U300_SYSCON_PUCR_KEY_IN_PU_EN_MASK (0x003F) 274#define U300_SYSCON_PUCR_KEY_IN_PU_EN_MASK (0x003F)
360/* Padmux 2 control */
361#define U300_SYSCON_PMC2R (0x100)
362#define U300_SYSCON_PMC2R_APP_MISC_0_MASK (0x00C0)
363#define U300_SYSCON_PMC2R_APP_MISC_0_APP_GPIO (0x0000)
364#define U300_SYSCON_PMC2R_APP_MISC_0_EMIF_SDRAM (0x0040)
365#define U300_SYSCON_PMC2R_APP_MISC_0_MMC (0x0080)
366#define U300_SYSCON_PMC2R_APP_MISC_0_CDI2 (0x00C0)
367#define U300_SYSCON_PMC2R_APP_MISC_1_MASK (0x0300)
368#define U300_SYSCON_PMC2R_APP_MISC_1_APP_GPIO (0x0000)
369#define U300_SYSCON_PMC2R_APP_MISC_1_EMIF_SDRAM (0x0100)
370#define U300_SYSCON_PMC2R_APP_MISC_1_MMC (0x0200)
371#define U300_SYSCON_PMC2R_APP_MISC_1_CDI2 (0x0300)
372#define U300_SYSCON_PMC2R_APP_MISC_2_MASK (0x0C00)
373#define U300_SYSCON_PMC2R_APP_MISC_2_APP_GPIO (0x0000)
374#define U300_SYSCON_PMC2R_APP_MISC_2_EMIF_SDRAM (0x0400)
375#define U300_SYSCON_PMC2R_APP_MISC_2_MMC (0x0800)
376#define U300_SYSCON_PMC2R_APP_MISC_2_CDI2 (0x0C00)
377#define U300_SYSCON_PMC2R_APP_MISC_3_MASK (0x3000)
378#define U300_SYSCON_PMC2R_APP_MISC_3_APP_GPIO (0x0000)
379#define U300_SYSCON_PMC2R_APP_MISC_3_EMIF_SDRAM (0x1000)
380#define U300_SYSCON_PMC2R_APP_MISC_3_MMC (0x2000)
381#define U300_SYSCON_PMC2R_APP_MISC_3_CDI2 (0x3000)
382#define U300_SYSCON_PMC2R_APP_MISC_4_MASK (0xC000)
383#define U300_SYSCON_PMC2R_APP_MISC_4_APP_GPIO (0x0000)
384#define U300_SYSCON_PMC2R_APP_MISC_4_EMIF_SDRAM (0x4000)
385#define U300_SYSCON_PMC2R_APP_MISC_4_MMC (0x8000)
386#define U300_SYSCON_PMC2R_APP_MISC_4_ACC_GPIO (0xC000)
387/* TODO: More SYSCON registers missing */
388#define U300_SYSCON_PMC3R (0x10c)
389#define U300_SYSCON_PMC3R_APP_MISC_11_MASK (0xc000)
390#define U300_SYSCON_PMC3R_APP_MISC_11_SPI (0x4000)
391#define U300_SYSCON_PMC3R_APP_MISC_10_MASK (0x3000)
392#define U300_SYSCON_PMC3R_APP_MISC_10_SPI (0x1000)
393/* TODO: Missing other configs */
394#define U300_SYSCON_PMC4R (0x168)
395#define U300_SYSCON_PMC4R_APP_MISC_12_MASK (0x0003)
396#define U300_SYSCON_PMC4R_APP_MISC_12_APP_GPIO (0x0000)
397#define U300_SYSCON_PMC4R_APP_MISC_13_MASK (0x000C)
398#define U300_SYSCON_PMC4R_APP_MISC_13_CDI (0x0000)
399#define U300_SYSCON_PMC4R_APP_MISC_13_SMIA (0x0004)
400#define U300_SYSCON_PMC4R_APP_MISC_13_SMIA2 (0x0008)
401#define U300_SYSCON_PMC4R_APP_MISC_13_APP_GPIO (0x000C)
402#define U300_SYSCON_PMC4R_APP_MISC_14_MASK (0x0030)
403#define U300_SYSCON_PMC4R_APP_MISC_14_CDI (0x0000)
404#define U300_SYSCON_PMC4R_APP_MISC_14_SMIA (0x0010)
405#define U300_SYSCON_PMC4R_APP_MISC_14_CDI2 (0x0020)
406#define U300_SYSCON_PMC4R_APP_MISC_14_APP_GPIO (0x0030)
407#define U300_SYSCON_PMC4R_APP_MISC_16_MASK (0x0300)
408#define U300_SYSCON_PMC4R_APP_MISC_16_APP_GPIO_13 (0x0000)
409#define U300_SYSCON_PMC4R_APP_MISC_16_APP_UART1_CTS (0x0100)
410#define U300_SYSCON_PMC4R_APP_MISC_16_EMIF_1_STATIC_CS5_N (0x0200)
411/* SYS_0_CLK_CONTROL first clock control 16bit (R/W) */ 275/* SYS_0_CLK_CONTROL first clock control 16bit (R/W) */
412#define U300_SYSCON_S0CCR (0x120) 276#define U300_SYSCON_S0CCR (0x120)
413#define U300_SYSCON_S0CCR_FIELD_MASK (0x43FF) 277#define U300_SYSCON_S0CCR_FIELD_MASK (0x43FF)
diff --git a/arch/arm/mach-u300/mmc.c b/arch/arm/mach-u300/mmc.c
index 677ccef5cd32..4d482aacc272 100644
--- a/arch/arm/mach-u300/mmc.c
+++ b/arch/arm/mach-u300/mmc.c
@@ -13,15 +13,14 @@
13#include <linux/device.h> 13#include <linux/device.h>
14#include <linux/amba/bus.h> 14#include <linux/amba/bus.h>
15#include <linux/mmc/host.h> 15#include <linux/mmc/host.h>
16#include <linux/gpio.h>
17#include <linux/dmaengine.h> 16#include <linux/dmaengine.h>
18#include <linux/amba/mmci.h> 17#include <linux/amba/mmci.h>
19#include <linux/slab.h> 18#include <linux/slab.h>
20#include <mach/coh901318.h> 19#include <mach/coh901318.h>
21#include <mach/dma_channels.h> 20#include <mach/dma_channels.h>
21#include <mach/gpio-u300.h>
22 22
23#include "mmc.h" 23#include "mmc.h"
24#include "padmux.h"
25 24
26static struct mmci_platform_data mmc0_plat_data = { 25static struct mmci_platform_data mmc0_plat_data = {
27 /* 26 /*
@@ -45,24 +44,9 @@ static struct mmci_platform_data mmc0_plat_data = {
45int __devinit mmc_init(struct amba_device *adev) 44int __devinit mmc_init(struct amba_device *adev)
46{ 45{
47 struct device *mmcsd_device = &adev->dev; 46 struct device *mmcsd_device = &adev->dev;
48 struct pmx *pmx;
49 int ret = 0; 47 int ret = 0;
50 48
51 mmcsd_device->platform_data = &mmc0_plat_data; 49 mmcsd_device->platform_data = &mmc0_plat_data;
52 50
53 /*
54 * Setup padmuxing for MMC. Since this must always be
55 * compiled into the kernel, pmx is never released.
56 */
57 pmx = pmx_get(mmcsd_device, U300_APP_PMX_MMC_SETTING);
58
59 if (IS_ERR(pmx))
60 pr_warning("Could not get padmux handle\n");
61 else {
62 ret = pmx_activate(mmcsd_device, pmx);
63 if (IS_ERR_VALUE(ret))
64 pr_warning("Could not activate padmuxing\n");
65 }
66
67 return ret; 51 return ret;
68} 52}
diff --git a/arch/arm/mach-u300/padmux.c b/arch/arm/mach-u300/padmux.c
deleted file mode 100644
index 4c93c6cefd37..000000000000
--- a/arch/arm/mach-u300/padmux.c
+++ /dev/null
@@ -1,367 +0,0 @@
1/*
2 *
3 * arch/arm/mach-u300/padmux.c
4 *
5 *
6 * Copyright (C) 2009 ST-Ericsson AB
7 * License terms: GNU General Public License (GPL) version 2
8 * U300 PADMUX functions
9 * Author: Martin Persson <martin.persson@stericsson.com>
10 */
11
12#include <linux/module.h>
13#include <linux/kernel.h>
14#include <linux/device.h>
15#include <linux/err.h>
16#include <linux/errno.h>
17#include <linux/io.h>
18#include <linux/mutex.h>
19#include <linux/string.h>
20#include <linux/bug.h>
21#include <linux/debugfs.h>
22#include <linux/seq_file.h>
23#include <mach/u300-regs.h>
24#include <mach/syscon.h>
25#include "padmux.h"
26
27static DEFINE_MUTEX(pmx_mutex);
28
29const u32 pmx_registers[] = {
30 (U300_SYSCON_VBASE + U300_SYSCON_PMC1LR),
31 (U300_SYSCON_VBASE + U300_SYSCON_PMC1HR),
32 (U300_SYSCON_VBASE + U300_SYSCON_PMC2R),
33 (U300_SYSCON_VBASE + U300_SYSCON_PMC3R),
34 (U300_SYSCON_VBASE + U300_SYSCON_PMC4R)
35};
36
37/* High level functionality */
38
39/* Lazy dog:
40 * onmask = {
41 * {"PMC1LR" mask, "PMC1LR" value},
42 * {"PMC1HR" mask, "PMC1HR" value},
43 * {"PMC2R" mask, "PMC2R" value},
44 * {"PMC3R" mask, "PMC3R" value},
45 * {"PMC4R" mask, "PMC4R" value}
46 * }
47 */
48static struct pmx mmc_setting = {
49 .setting = U300_APP_PMX_MMC_SETTING,
50 .default_on = false,
51 .activated = false,
52 .name = "MMC",
53 .onmask = {
54 {U300_SYSCON_PMC1LR_MMCSD_MASK,
55 U300_SYSCON_PMC1LR_MMCSD_MMCSD},
56 {0, 0},
57 {0, 0},
58 {0, 0},
59 {U300_SYSCON_PMC4R_APP_MISC_12_MASK,
60 U300_SYSCON_PMC4R_APP_MISC_12_APP_GPIO}
61 },
62};
63
64static struct pmx spi_setting = {
65 .setting = U300_APP_PMX_SPI_SETTING,
66 .default_on = false,
67 .activated = false,
68 .name = "SPI",
69 .onmask = {{0, 0},
70 {U300_SYSCON_PMC1HR_APP_SPI_2_MASK |
71 U300_SYSCON_PMC1HR_APP_SPI_CS_1_MASK |
72 U300_SYSCON_PMC1HR_APP_SPI_CS_2_MASK,
73 U300_SYSCON_PMC1HR_APP_SPI_2_SPI |
74 U300_SYSCON_PMC1HR_APP_SPI_CS_1_SPI |
75 U300_SYSCON_PMC1HR_APP_SPI_CS_2_SPI},
76 {0, 0},
77 {0, 0},
78 {0, 0}
79 },
80};
81
82/* Available padmux settings */
83static struct pmx *pmx_settings[] = {
84 &mmc_setting,
85 &spi_setting,
86};
87
88static void update_registers(struct pmx *pmx, bool activate)
89{
90 u16 regval, val, mask;
91 int i;
92
93 for (i = 0; i < ARRAY_SIZE(pmx_registers); i++) {
94 if (activate)
95 val = pmx->onmask[i].val;
96 else
97 val = 0;
98
99 mask = pmx->onmask[i].mask;
100 if (mask != 0) {
101 regval = readw(pmx_registers[i]);
102 regval &= ~mask;
103 regval |= val;
104 writew(regval, pmx_registers[i]);
105 }
106 }
107}
108
109struct pmx *pmx_get(struct device *dev, enum pmx_settings setting)
110{
111 int i;
112 struct pmx *pmx = ERR_PTR(-ENOENT);
113
114 if (dev == NULL)
115 return ERR_PTR(-EINVAL);
116
117 mutex_lock(&pmx_mutex);
118 for (i = 0; i < ARRAY_SIZE(pmx_settings); i++) {
119
120 if (setting == pmx_settings[i]->setting) {
121
122 if (pmx_settings[i]->dev != NULL) {
123 WARN(1, "padmux: required setting "
124 "in use by another consumer\n");
125 } else {
126 pmx = pmx_settings[i];
127 pmx->dev = dev;
128 dev_dbg(dev, "padmux: setting nr %d is now "
129 "bound to %s and ready to use\n",
130 setting, dev_name(dev));
131 break;
132 }
133 }
134 }
135 mutex_unlock(&pmx_mutex);
136
137 return pmx;
138}
139EXPORT_SYMBOL(pmx_get);
140
141int pmx_put(struct device *dev, struct pmx *pmx)
142{
143 int i;
144 int ret = -ENOENT;
145
146 if (pmx == NULL || dev == NULL)
147 return -EINVAL;
148
149 mutex_lock(&pmx_mutex);
150 for (i = 0; i < ARRAY_SIZE(pmx_settings); i++) {
151
152 if (pmx->setting == pmx_settings[i]->setting) {
153
154 if (dev != pmx->dev) {
155 WARN(1, "padmux: cannot release handle as "
156 "it is bound to another consumer\n");
157 ret = -EINVAL;
158 break;
159 } else {
160 pmx_settings[i]->dev = NULL;
161 ret = 0;
162 break;
163 }
164 }
165 }
166 mutex_unlock(&pmx_mutex);
167
168 return ret;
169}
170EXPORT_SYMBOL(pmx_put);
171
172int pmx_activate(struct device *dev, struct pmx *pmx)
173{
174 int i, j, ret;
175 ret = 0;
176
177 if (pmx == NULL || dev == NULL)
178 return -EINVAL;
179
180 mutex_lock(&pmx_mutex);
181
182 /* Make sure the required bits are not used */
183 for (i = 0; i < ARRAY_SIZE(pmx_settings); i++) {
184
185 if (pmx_settings[i]->dev == NULL || pmx_settings[i] == pmx)
186 continue;
187
188 for (j = 0; j < ARRAY_SIZE(pmx_registers); j++) {
189
190 if (pmx_settings[i]->onmask[j].mask & pmx->
191 onmask[j].mask) {
192 /* More than one entry on the same bits */
193 WARN(1, "padmux: cannot activate "
194 "setting. Bit conflict with "
195 "an active setting\n");
196
197 ret = -EUSERS;
198 goto exit;
199 }
200 }
201 }
202 update_registers(pmx, true);
203 pmx->activated = true;
204 dev_dbg(dev, "padmux: setting nr %d is activated\n",
205 pmx->setting);
206
207exit:
208 mutex_unlock(&pmx_mutex);
209 return ret;
210}
211EXPORT_SYMBOL(pmx_activate);
212
213int pmx_deactivate(struct device *dev, struct pmx *pmx)
214{
215 int i;
216 int ret = -ENOENT;
217
218 if (pmx == NULL || dev == NULL)
219 return -EINVAL;
220
221 mutex_lock(&pmx_mutex);
222 for (i = 0; i < ARRAY_SIZE(pmx_settings); i++) {
223
224 if (pmx_settings[i]->dev == NULL)
225 continue;
226
227 if (pmx->setting == pmx_settings[i]->setting) {
228
229 if (dev != pmx->dev) {
230 WARN(1, "padmux: cannot deactivate "
231 "pmx setting as it was activated "
232 "by another consumer\n");
233
234 ret = -EBUSY;
235 continue;
236 } else {
237 update_registers(pmx, false);
238 pmx_settings[i]->dev = NULL;
239 pmx->activated = false;
240 ret = 0;
241 dev_dbg(dev, "padmux: setting nr %d is deactivated",
242 pmx->setting);
243 break;
244 }
245 }
246 }
247 mutex_unlock(&pmx_mutex);
248
249 return ret;
250}
251EXPORT_SYMBOL(pmx_deactivate);
252
253/*
254 * For internal use only. If it is to be exported,
255 * it should be reentrant. Notice that pmx_activate
256 * (i.e. runtime settings) always override default settings.
257 */
258static int pmx_set_default(void)
259{
260 /* Used to identify several entries on the same bits */
261 u16 modbits[ARRAY_SIZE(pmx_registers)];
262
263 int i, j;
264
265 memset(modbits, 0, ARRAY_SIZE(pmx_registers) * sizeof(u16));
266
267 for (i = 0; i < ARRAY_SIZE(pmx_settings); i++) {
268
269 if (!pmx_settings[i]->default_on)
270 continue;
271
272 for (j = 0; j < ARRAY_SIZE(pmx_registers); j++) {
273
274 /* Make sure there is only one entry on the same bits */
275 if (modbits[j] & pmx_settings[i]->onmask[j].mask) {
276 BUG();
277 return -EUSERS;
278 }
279 modbits[j] |= pmx_settings[i]->onmask[j].mask;
280 }
281 update_registers(pmx_settings[i], true);
282 }
283 return 0;
284}
285
286#if (defined(CONFIG_DEBUG_FS) && defined(CONFIG_U300_DEBUG))
287static int pmx_show(struct seq_file *s, void *data)
288{
289 int i;
290 seq_printf(s, "-------------------------------------------------\n");
291 seq_printf(s, "SETTING BOUND TO DEVICE STATE\n");
292 seq_printf(s, "-------------------------------------------------\n");
293 mutex_lock(&pmx_mutex);
294 for (i = 0; i < ARRAY_SIZE(pmx_settings); i++) {
295 /* Format pmx and device name nicely */
296 char cdp[33];
297 int chars;
298
299 chars = snprintf(&cdp[0], 17, "%s", pmx_settings[i]->name);
300 while (chars < 16) {
301 cdp[chars] = ' ';
302 chars++;
303 }
304 chars = snprintf(&cdp[16], 17, "%s", pmx_settings[i]->dev ?
305 dev_name(pmx_settings[i]->dev) : "N/A");
306 while (chars < 16) {
307 cdp[chars+16] = ' ';
308 chars++;
309 }
310 cdp[32] = '\0';
311
312 seq_printf(s,
313 "%s\t%s\n",
314 &cdp[0],
315 pmx_settings[i]->activated ?
316 "ACTIVATED" : "DEACTIVATED"
317 );
318
319 }
320 mutex_unlock(&pmx_mutex);
321 return 0;
322}
323
324static int pmx_open(struct inode *inode, struct file *file)
325{
326 return single_open(file, pmx_show, NULL);
327}
328
329static const struct file_operations pmx_operations = {
330 .owner = THIS_MODULE,
331 .open = pmx_open,
332 .read = seq_read,
333 .llseek = seq_lseek,
334 .release = single_release,
335};
336
337static int __init init_pmx_read_debugfs(void)
338{
339 /* Expose a simple debugfs interface to view pmx settings */
340 (void) debugfs_create_file("padmux", S_IFREG | S_IRUGO,
341 NULL, NULL,
342 &pmx_operations);
343 return 0;
344}
345
346/*
347 * This needs to come in after the core_initcall(),
348 * because debugfs is not available until
349 * the subsystems come up.
350 */
351module_init(init_pmx_read_debugfs);
352#endif
353
354static int __init pmx_init(void)
355{
356 int ret;
357
358 ret = pmx_set_default();
359
360 if (IS_ERR_VALUE(ret))
361 pr_crit("padmux: default settings could not be set\n");
362
363 return 0;
364}
365
366/* Should be initialized before consumers */
367core_initcall(pmx_init);
diff --git a/arch/arm/mach-u300/padmux.h b/arch/arm/mach-u300/padmux.h
deleted file mode 100644
index 6e8b86064097..000000000000
--- a/arch/arm/mach-u300/padmux.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 *
3 * arch/arm/mach-u300/padmux.h
4 *
5 *
6 * Copyright (C) 2009 ST-Ericsson AB
7 * License terms: GNU General Public License (GPL) version 2
8 * U300 PADMUX API
9 * Author: Martin Persson <martin.persson@stericsson.com>
10 */
11
12#ifndef __MACH_U300_PADMUX_H
13#define __MACH_U300_PADMUX_H
14
15enum pmx_settings {
16 U300_APP_PMX_MMC_SETTING,
17 U300_APP_PMX_SPI_SETTING
18};
19
20struct pmx_onmask {
21 u16 mask; /* Mask bits */
22 u16 val; /* Value when active */
23};
24
25struct pmx {
26 struct device *dev;
27 enum pmx_settings setting;
28 char *name;
29 bool activated;
30 bool default_on;
31 struct pmx_onmask onmask[];
32};
33
34struct pmx *pmx_get(struct device *dev, enum pmx_settings setting);
35int pmx_put(struct device *dev, struct pmx *pmx);
36int pmx_activate(struct device *dev, struct pmx *pmx);
37int pmx_deactivate(struct device *dev, struct pmx *pmx);
38
39#endif
diff --git a/arch/arm/mach-u300/spi.c b/arch/arm/mach-u300/spi.c
index 7b597e2b19e2..a1affacfa59c 100644
--- a/arch/arm/mach-u300/spi.c
+++ b/arch/arm/mach-u300/spi.c
@@ -14,8 +14,6 @@
14#include <mach/coh901318.h> 14#include <mach/coh901318.h>
15#include <mach/dma_channels.h> 15#include <mach/dma_channels.h>
16 16
17#include "padmux.h"
18
19/* 17/*
20 * The following is for the actual devices on the SSP/SPI bus 18 * The following is for the actual devices on the SSP/SPI bus
21 */ 19 */
@@ -95,25 +93,7 @@ static struct pl022_ssp_controller ssp_platform_data = {
95 93
96void __init u300_spi_init(struct amba_device *adev) 94void __init u300_spi_init(struct amba_device *adev)
97{ 95{
98 struct pmx *pmx;
99
100 adev->dev.platform_data = &ssp_platform_data; 96 adev->dev.platform_data = &ssp_platform_data;
101 /*
102 * Setup padmuxing for SPI. Since this must always be
103 * compiled into the kernel, pmx is never released.
104 */
105 pmx = pmx_get(&adev->dev, U300_APP_PMX_SPI_SETTING);
106
107 if (IS_ERR(pmx))
108 dev_warn(&adev->dev, "Could not get padmux handle\n");
109 else {
110 int ret;
111
112 ret = pmx_activate(&adev->dev, pmx);
113 if (IS_ERR_VALUE(ret))
114 dev_warn(&adev->dev, "Could not activate padmuxing\n");
115 }
116
117} 97}
118 98
119void __init u300_spi_register_board_devices(void) 99void __init u300_spi_register_board_devices(void)
diff --git a/arch/arm/mach-ux500/Kconfig b/arch/arm/mach-ux500/Kconfig
index 4210cb434dbc..a3e0c8692f0d 100644
--- a/arch/arm/mach-ux500/Kconfig
+++ b/arch/arm/mach-ux500/Kconfig
@@ -6,6 +6,7 @@ config UX500_SOC_COMMON
6 select ARM_GIC 6 select ARM_GIC
7 select HAS_MTU 7 select HAS_MTU
8 select ARM_ERRATA_753970 8 select ARM_ERRATA_753970
9 select ARM_ERRATA_754322
9 10
10menu "Ux500 SoC" 11menu "Ux500 SoC"
11 12
diff --git a/arch/arm/mach-ux500/Makefile.boot b/arch/arm/mach-ux500/Makefile.boot
index c7e75acfe6c9..ff0a4b5b0a82 100644
--- a/arch/arm/mach-ux500/Makefile.boot
+++ b/arch/arm/mach-ux500/Makefile.boot
@@ -1,4 +1,4 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
4 4
diff --git a/arch/arm/mach-ux500/board-mop500-pins.c b/arch/arm/mach-ux500/board-mop500-pins.c
index f26fd76f72b4..15b23e4bd488 100644
--- a/arch/arm/mach-ux500/board-mop500-pins.c
+++ b/arch/arm/mach-ux500/board-mop500-pins.c
@@ -6,10 +6,10 @@
6 6
7#include <linux/kernel.h> 7#include <linux/kernel.h>
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/gpio.h>
10 9
11#include <asm/mach-types.h> 10#include <asm/mach-types.h>
12#include <plat/pincfg.h> 11#include <plat/pincfg.h>
12#include <plat/gpio-nomadik.h>
13#include <mach/hardware.h> 13#include <mach/hardware.h>
14 14
15#include "pins-db8500.h" 15#include "pins-db8500.h"
diff --git a/arch/arm/mach-ux500/board-mop500-u8500uib.c b/arch/arm/mach-ux500/board-mop500-u8500uib.c
index 8ce46c0fdfd5..feb5744d98b7 100644
--- a/arch/arm/mach-ux500/board-mop500-u8500uib.c
+++ b/arch/arm/mach-ux500/board-mop500-u8500uib.c
@@ -4,7 +4,7 @@
4 * Board data for the U8500 UIB, also known as the New UIB 4 * Board data for the U8500 UIB, also known as the New UIB
5 * License terms: GNU General Public License (GPL), version 2 5 * License terms: GNU General Public License (GPL), version 2
6 */ 6 */
7 7#include <linux/gpio.h>
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/init.h> 9#include <linux/init.h>
10#include <linux/i2c.h> 10#include <linux/i2c.h>
@@ -13,7 +13,6 @@
13#include <linux/mfd/tc3589x.h> 13#include <linux/mfd/tc3589x.h>
14#include <linux/input/matrix_keypad.h> 14#include <linux/input/matrix_keypad.h>
15 15
16#include <mach/gpio.h>
17#include <mach/irqs.h> 16#include <mach/irqs.h>
18 17
19#include "board-mop500.h" 18#include "board-mop500.h"
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index 2cc4876db212..f67b83dd9010 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -37,6 +37,7 @@
37#include <plat/i2c.h> 37#include <plat/i2c.h>
38#include <plat/ste_dma40.h> 38#include <plat/ste_dma40.h>
39#include <plat/pincfg.h> 39#include <plat/pincfg.h>
40#include <plat/gpio-nomadik.h>
40 41
41#include <mach/hardware.h> 42#include <mach/hardware.h>
42#include <mach/setup.h> 43#include <mach/setup.h>
diff --git a/arch/arm/mach-ux500/board-u5500-sdi.c b/arch/arm/mach-ux500/board-u5500-sdi.c
index 739fb4c5b160..63c3f8058ffc 100644
--- a/arch/arm/mach-ux500/board-u5500-sdi.c
+++ b/arch/arm/mach-ux500/board-u5500-sdi.c
@@ -7,9 +7,9 @@
7 7
8#include <linux/amba/mmci.h> 8#include <linux/amba/mmci.h>
9#include <linux/mmc/host.h> 9#include <linux/mmc/host.h>
10#include <linux/gpio.h>
11 10
12#include <plat/pincfg.h> 11#include <plat/pincfg.h>
12#include <plat/gpio-nomadik.h>
13#include <mach/db5500-regs.h> 13#include <mach/db5500-regs.h>
14#include <plat/ste_dma40.h> 14#include <plat/ste_dma40.h>
15 15
diff --git a/arch/arm/mach-ux500/board-u5500.c b/arch/arm/mach-ux500/board-u5500.c
index 166d47a5f4f3..e014aa749b03 100644
--- a/arch/arm/mach-ux500/board-u5500.c
+++ b/arch/arm/mach-ux500/board-u5500.c
@@ -8,7 +8,6 @@
8#include <linux/init.h> 8#include <linux/init.h>
9#include <linux/platform_device.h> 9#include <linux/platform_device.h>
10#include <linux/amba/bus.h> 10#include <linux/amba/bus.h>
11#include <linux/gpio.h>
12#include <linux/irq.h> 11#include <linux/irq.h>
13#include <linux/i2c.h> 12#include <linux/i2c.h>
14 13
@@ -17,6 +16,7 @@
17 16
18#include <plat/pincfg.h> 17#include <plat/pincfg.h>
19#include <plat/i2c.h> 18#include <plat/i2c.h>
19#include <plat/gpio-nomadik.h>
20 20
21#include <mach/hardware.h> 21#include <mach/hardware.h>
22#include <mach/devices.h> 22#include <mach/devices.h>
diff --git a/arch/arm/mach-ux500/cpu-db5500.c b/arch/arm/mach-ux500/cpu-db5500.c
index 22705d246fc7..9de1af008094 100644
--- a/arch/arm/mach-ux500/cpu-db5500.c
+++ b/arch/arm/mach-ux500/cpu-db5500.c
@@ -13,7 +13,7 @@
13#include <asm/mach/map.h> 13#include <asm/mach/map.h>
14#include <asm/pmu.h> 14#include <asm/pmu.h>
15 15
16#include <plat/gpio.h> 16#include <plat/gpio-nomadik.h>
17 17
18#include <mach/hardware.h> 18#include <mach/hardware.h>
19#include <mach/devices.h> 19#include <mach/devices.h>
diff --git a/arch/arm/mach-ux500/cpu-db8500.c b/arch/arm/mach-ux500/cpu-db8500.c
index 4598b06c8c55..13e8890a8b8a 100644
--- a/arch/arm/mach-ux500/cpu-db8500.c
+++ b/arch/arm/mach-ux500/cpu-db8500.c
@@ -14,12 +14,12 @@
14#include <linux/amba/bus.h> 14#include <linux/amba/bus.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/irq.h> 16#include <linux/irq.h>
17#include <linux/gpio.h>
18#include <linux/platform_device.h> 17#include <linux/platform_device.h>
19#include <linux/io.h> 18#include <linux/io.h>
20 19
21#include <asm/mach/map.h> 20#include <asm/mach/map.h>
22#include <asm/pmu.h> 21#include <asm/pmu.h>
22#include <plat/gpio-nomadik.h>
23#include <mach/hardware.h> 23#include <mach/hardware.h>
24#include <mach/setup.h> 24#include <mach/setup.h>
25#include <mach/devices.h> 25#include <mach/devices.h>
diff --git a/arch/arm/mach-ux500/devices-common.c b/arch/arm/mach-ux500/devices-common.c
index 13a4ce046ae5..c563e5418d80 100644
--- a/arch/arm/mach-ux500/devices-common.c
+++ b/arch/arm/mach-ux500/devices-common.c
@@ -13,7 +13,7 @@
13#include <linux/platform_device.h> 13#include <linux/platform_device.h>
14#include <linux/amba/bus.h> 14#include <linux/amba/bus.h>
15 15
16#include <plat/gpio.h> 16#include <plat/gpio-nomadik.h>
17 17
18#include <mach/hardware.h> 18#include <mach/hardware.h>
19 19
diff --git a/arch/arm/mach-ux500/include/mach/gpio.h b/arch/arm/mach-ux500/include/mach/gpio.h
index 3c4cd31ad9f7..7389df911b1a 100644
--- a/arch/arm/mach-ux500/include/mach/gpio.h
+++ b/arch/arm/mach-ux500/include/mach/gpio.h
@@ -7,6 +7,4 @@
7 */ 7 */
8#define ARCH_NR_GPIOS 350 8#define ARCH_NR_GPIOS 350
9 9
10#include <plat/gpio.h>
11
12#endif /* __ASM_ARCH_GPIO_H */ 10#endif /* __ASM_ARCH_GPIO_H */
diff --git a/arch/arm/mach-versatile/Makefile.boot b/arch/arm/mach-versatile/Makefile.boot
index c7e75acfe6c9..ff0a4b5b0a82 100644
--- a/arch/arm/mach-versatile/Makefile.boot
+++ b/arch/arm/mach-versatile/Makefile.boot
@@ -1,4 +1,4 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
4 4
diff --git a/arch/arm/mach-versatile/include/mach/gpio.h b/arch/arm/mach-versatile/include/mach/gpio.h
index 94ff27678a46..40a8c178f10d 100644
--- a/arch/arm/mach-versatile/include/mach/gpio.h
+++ b/arch/arm/mach-versatile/include/mach/gpio.h
@@ -1,6 +1 @@
1#include <asm-generic/gpio.h> /* empty */
2
3#define gpio_get_value __gpio_get_value
4#define gpio_set_value __gpio_set_value
5#define gpio_cansleep __gpio_cansleep
6#define gpio_to_irq __gpio_to_irq
diff --git a/arch/arm/mach-vexpress/Makefile.boot b/arch/arm/mach-vexpress/Makefile.boot
index 07c2d9c457ec..8630b3d10a4d 100644
--- a/arch/arm/mach-vexpress/Makefile.boot
+++ b/arch/arm/mach-vexpress/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x60008000 1 zreladdr-y += 0x60008000
2params_phys-y := 0x60000100 2params_phys-y := 0x60000100
3initrd_phys-y := 0x60800000 3initrd_phys-y := 0x60800000
diff --git a/arch/arm/mach-vexpress/hotplug.c b/arch/arm/mach-vexpress/hotplug.c
index ea4cbfb90a66..3668cf91d2de 100644
--- a/arch/arm/mach-vexpress/hotplug.c
+++ b/arch/arm/mach-vexpress/hotplug.c
@@ -13,6 +13,7 @@
13#include <linux/smp.h> 13#include <linux/smp.h>
14 14
15#include <asm/cacheflush.h> 15#include <asm/cacheflush.h>
16#include <asm/system.h>
16 17
17extern volatile int pen_release; 18extern volatile int pen_release;
18 19
@@ -62,13 +63,7 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious)
62 * code will have already disabled interrupts 63 * code will have already disabled interrupts
63 */ 64 */
64 for (;;) { 65 for (;;) {
65 /* 66 wfi();
66 * here's the WFI
67 */
68 asm(".word 0xe320f003\n"
69 :
70 :
71 : "memory", "cc");
72 67
73 if (pen_release == cpu) { 68 if (pen_release == cpu) {
74 /* 69 /*
diff --git a/arch/arm/mach-vexpress/include/mach/io.h b/arch/arm/mach-vexpress/include/mach/io.h
index 748bb524ee71..13522d86685e 100644
--- a/arch/arm/mach-vexpress/include/mach/io.h
+++ b/arch/arm/mach-vexpress/include/mach/io.h
@@ -20,8 +20,6 @@
20#ifndef __ASM_ARM_ARCH_IO_H 20#ifndef __ASM_ARM_ARCH_IO_H
21#define __ASM_ARM_ARCH_IO_H 21#define __ASM_ARM_ARCH_IO_H
22 22
23#define IO_SPACE_LIMIT 0xffffffff
24
25#define __io(a) __typesafe_io(a) 23#define __io(a) __typesafe_io(a)
26#define __mem_pci(a) (a) 24#define __mem_pci(a) (a)
27 25
diff --git a/arch/arm/mach-vt8500/Makefile.boot b/arch/arm/mach-vt8500/Makefile.boot
index a8acc4e24902..b79c41cdfdff 100644
--- a/arch/arm/mach-vt8500/Makefile.boot
+++ b/arch/arm/mach-vt8500/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x01000000 3initrd_phys-y := 0x01000000
diff --git a/arch/arm/mach-vt8500/include/mach/gpio.h b/arch/arm/mach-vt8500/include/mach/gpio.h
index 94ff27678a46..40a8c178f10d 100644
--- a/arch/arm/mach-vt8500/include/mach/gpio.h
+++ b/arch/arm/mach-vt8500/include/mach/gpio.h
@@ -1,6 +1 @@
1#include <asm-generic/gpio.h> /* empty */
2
3#define gpio_get_value __gpio_get_value
4#define gpio_set_value __gpio_set_value
5#define gpio_cansleep __gpio_cansleep
6#define gpio_to_irq __gpio_to_irq
diff --git a/arch/arm/mach-vt8500/include/mach/io.h b/arch/arm/mach-vt8500/include/mach/io.h
index 9077239f78c9..46181eecf273 100644
--- a/arch/arm/mach-vt8500/include/mach/io.h
+++ b/arch/arm/mach-vt8500/include/mach/io.h
@@ -20,8 +20,6 @@
20#ifndef __ASM_ARM_ARCH_IO_H 20#ifndef __ASM_ARM_ARCH_IO_H
21#define __ASM_ARM_ARCH_IO_H 21#define __ASM_ARM_ARCH_IO_H
22 22
23#define IO_SPACE_LIMIT 0xffff
24
25#define __io(a) __typesafe_io((a) + 0xf0000000) 23#define __io(a) __typesafe_io((a) + 0xf0000000)
26#define __mem_pci(a) (a) 24#define __mem_pci(a) (a)
27 25
diff --git a/arch/arm/mach-w90x900/Makefile.boot b/arch/arm/mach-w90x900/Makefile.boot
index a057b546b6e5..6c3d421c2d11 100644
--- a/arch/arm/mach-w90x900/Makefile.boot
+++ b/arch/arm/mach-w90x900/Makefile.boot
@@ -1,3 +1,3 @@
1zreladdr-y := 0x00008000 1zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3 3
diff --git a/arch/arm/mach-w90x900/cpu.c b/arch/arm/mach-w90x900/cpu.c
index 83c56324a472..0a235e502330 100644
--- a/arch/arm/mach-w90x900/cpu.c
+++ b/arch/arm/mach-w90x900/cpu.c
@@ -60,7 +60,7 @@ static DEFINE_CLK(emc, 7);
60static DEFINE_SUBCLK(rmii, 2); 60static DEFINE_SUBCLK(rmii, 2);
61static DEFINE_CLK(usbd, 8); 61static DEFINE_CLK(usbd, 8);
62static DEFINE_CLK(usbh, 9); 62static DEFINE_CLK(usbh, 9);
63static DEFINE_CLK(g2d, 10);; 63static DEFINE_CLK(g2d, 10);
64static DEFINE_CLK(pwm, 18); 64static DEFINE_CLK(pwm, 18);
65static DEFINE_CLK(ps2, 24); 65static DEFINE_CLK(ps2, 24);
66static DEFINE_CLK(kpi, 25); 66static DEFINE_CLK(kpi, 25);
diff --git a/arch/arm/mach-w90x900/include/mach/gpio.h b/arch/arm/mach-w90x900/include/mach/gpio.h
index 034da3e390c9..5385a4203277 100644
--- a/arch/arm/mach-w90x900/include/mach/gpio.h
+++ b/arch/arm/mach-w90x900/include/mach/gpio.h
@@ -15,16 +15,12 @@
15 15
16#include <mach/hardware.h> 16#include <mach/hardware.h>
17#include <asm/irq.h> 17#include <asm/irq.h>
18#include <asm-generic/gpio.h>
19
20#define gpio_get_value __gpio_get_value
21#define gpio_set_value __gpio_set_value
22#define gpio_cansleep __gpio_cansleep
23 18
24static inline int gpio_to_irq(unsigned gpio) 19static inline int gpio_to_irq(unsigned gpio)
25{ 20{
26 return gpio; 21 return gpio;
27} 22}
23#define gpio_to_irq gpio_to_irq
28 24
29static inline int irq_to_gpio(unsigned irq) 25static inline int irq_to_gpio(unsigned irq)
30{ 26{
diff --git a/arch/arm/mach-zynq/Makefile.boot b/arch/arm/mach-zynq/Makefile.boot
index 67039c3e0c48..760a0efe7580 100644
--- a/arch/arm/mach-zynq/Makefile.boot
+++ b/arch/arm/mach-zynq/Makefile.boot
@@ -1,3 +1,3 @@
1 zreladdr-y := 0x00008000 1 zreladdr-y += 0x00008000
2params_phys-y := 0x00000100 2params_phys-y := 0x00000100
3initrd_phys-y := 0x00800000 3initrd_phys-y := 0x00800000
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
index cfbcf8b95599..c335c76e0d88 100644
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -86,16 +86,6 @@ core_param(alignment, ai_usermode, int, 0600);
86#define UM_FIXUP (1 << 1) 86#define UM_FIXUP (1 << 1)
87#define UM_SIGNAL (1 << 2) 87#define UM_SIGNAL (1 << 2)
88 88
89#ifdef CONFIG_PROC_FS
90static const char *usermode_action[] = {
91 "ignored",
92 "warn",
93 "fixup",
94 "fixup+warn",
95 "signal",
96 "signal+warn"
97};
98
99/* Return true if and only if the ARMv6 unaligned access model is in use. */ 89/* Return true if and only if the ARMv6 unaligned access model is in use. */
100static bool cpu_is_v6_unaligned(void) 90static bool cpu_is_v6_unaligned(void)
101{ 91{
@@ -123,6 +113,16 @@ static int safe_usermode(int new_usermode, bool warn)
123 return new_usermode; 113 return new_usermode;
124} 114}
125 115
116#ifdef CONFIG_PROC_FS
117static const char *usermode_action[] = {
118 "ignored",
119 "warn",
120 "fixup",
121 "fixup+warn",
122 "signal",
123 "signal+warn"
124};
125
126static int alignment_proc_show(struct seq_file *m, void *v) 126static int alignment_proc_show(struct seq_file *m, void *v)
127{ 127{
128 seq_printf(m, "User:\t\t%lu\n", ai_user); 128 seq_printf(m, "User:\t\t%lu\n", ai_user);
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index 9ecfdb511951..8ac9e9f84790 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -16,9 +16,12 @@
16 * along with this program; if not, write to the Free Software 16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */ 18 */
19#include <linux/err.h>
19#include <linux/init.h> 20#include <linux/init.h>
20#include <linux/spinlock.h> 21#include <linux/spinlock.h>
21#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/of.h>
24#include <linux/of_address.h>
22 25
23#include <asm/cacheflush.h> 26#include <asm/cacheflush.h>
24#include <asm/hardware/cache-l2x0.h> 27#include <asm/hardware/cache-l2x0.h>
@@ -26,15 +29,23 @@
26#define CACHE_LINE_SIZE 32 29#define CACHE_LINE_SIZE 32
27 30
28static void __iomem *l2x0_base; 31static void __iomem *l2x0_base;
29static DEFINE_SPINLOCK(l2x0_lock); 32static DEFINE_RAW_SPINLOCK(l2x0_lock);
30static uint32_t l2x0_way_mask; /* Bitmask of active ways */ 33static uint32_t l2x0_way_mask; /* Bitmask of active ways */
31static uint32_t l2x0_size; 34static uint32_t l2x0_size;
32 35
36struct l2x0_regs l2x0_saved_regs;
37
38struct l2x0_of_data {
39 void (*setup)(const struct device_node *, __u32 *, __u32 *);
40 void (*save)(void);
41 void (*resume)(void);
42};
43
33static inline void cache_wait_way(void __iomem *reg, unsigned long mask) 44static inline void cache_wait_way(void __iomem *reg, unsigned long mask)
34{ 45{
35 /* wait for cache operation by line or way to complete */ 46 /* wait for cache operation by line or way to complete */
36 while (readl_relaxed(reg) & mask) 47 while (readl_relaxed(reg) & mask)
37 ; 48 cpu_relax();
38} 49}
39 50
40#ifdef CONFIG_CACHE_PL310 51#ifdef CONFIG_CACHE_PL310
@@ -115,9 +126,9 @@ static void l2x0_cache_sync(void)
115{ 126{
116 unsigned long flags; 127 unsigned long flags;
117 128
118 spin_lock_irqsave(&l2x0_lock, flags); 129 raw_spin_lock_irqsave(&l2x0_lock, flags);
119 cache_sync(); 130 cache_sync();
120 spin_unlock_irqrestore(&l2x0_lock, flags); 131 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
121} 132}
122 133
123static void __l2x0_flush_all(void) 134static void __l2x0_flush_all(void)
@@ -134,9 +145,9 @@ static void l2x0_flush_all(void)
134 unsigned long flags; 145 unsigned long flags;
135 146
136 /* clean all ways */ 147 /* clean all ways */
137 spin_lock_irqsave(&l2x0_lock, flags); 148 raw_spin_lock_irqsave(&l2x0_lock, flags);
138 __l2x0_flush_all(); 149 __l2x0_flush_all();
139 spin_unlock_irqrestore(&l2x0_lock, flags); 150 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
140} 151}
141 152
142static void l2x0_clean_all(void) 153static void l2x0_clean_all(void)
@@ -144,11 +155,11 @@ static void l2x0_clean_all(void)
144 unsigned long flags; 155 unsigned long flags;
145 156
146 /* clean all ways */ 157 /* clean all ways */
147 spin_lock_irqsave(&l2x0_lock, flags); 158 raw_spin_lock_irqsave(&l2x0_lock, flags);
148 writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_CLEAN_WAY); 159 writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_CLEAN_WAY);
149 cache_wait_way(l2x0_base + L2X0_CLEAN_WAY, l2x0_way_mask); 160 cache_wait_way(l2x0_base + L2X0_CLEAN_WAY, l2x0_way_mask);
150 cache_sync(); 161 cache_sync();
151 spin_unlock_irqrestore(&l2x0_lock, flags); 162 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
152} 163}
153 164
154static void l2x0_inv_all(void) 165static void l2x0_inv_all(void)
@@ -156,13 +167,13 @@ static void l2x0_inv_all(void)
156 unsigned long flags; 167 unsigned long flags;
157 168
158 /* invalidate all ways */ 169 /* invalidate all ways */
159 spin_lock_irqsave(&l2x0_lock, flags); 170 raw_spin_lock_irqsave(&l2x0_lock, flags);
160 /* Invalidating when L2 is enabled is a nono */ 171 /* Invalidating when L2 is enabled is a nono */
161 BUG_ON(readl(l2x0_base + L2X0_CTRL) & 1); 172 BUG_ON(readl(l2x0_base + L2X0_CTRL) & 1);
162 writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_INV_WAY); 173 writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_INV_WAY);
163 cache_wait_way(l2x0_base + L2X0_INV_WAY, l2x0_way_mask); 174 cache_wait_way(l2x0_base + L2X0_INV_WAY, l2x0_way_mask);
164 cache_sync(); 175 cache_sync();
165 spin_unlock_irqrestore(&l2x0_lock, flags); 176 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
166} 177}
167 178
168static void l2x0_inv_range(unsigned long start, unsigned long end) 179static void l2x0_inv_range(unsigned long start, unsigned long end)
@@ -170,7 +181,7 @@ static void l2x0_inv_range(unsigned long start, unsigned long end)
170 void __iomem *base = l2x0_base; 181 void __iomem *base = l2x0_base;
171 unsigned long flags; 182 unsigned long flags;
172 183
173 spin_lock_irqsave(&l2x0_lock, flags); 184 raw_spin_lock_irqsave(&l2x0_lock, flags);
174 if (start & (CACHE_LINE_SIZE - 1)) { 185 if (start & (CACHE_LINE_SIZE - 1)) {
175 start &= ~(CACHE_LINE_SIZE - 1); 186 start &= ~(CACHE_LINE_SIZE - 1);
176 debug_writel(0x03); 187 debug_writel(0x03);
@@ -195,13 +206,13 @@ static void l2x0_inv_range(unsigned long start, unsigned long end)
195 } 206 }
196 207
197 if (blk_end < end) { 208 if (blk_end < end) {
198 spin_unlock_irqrestore(&l2x0_lock, flags); 209 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
199 spin_lock_irqsave(&l2x0_lock, flags); 210 raw_spin_lock_irqsave(&l2x0_lock, flags);
200 } 211 }
201 } 212 }
202 cache_wait(base + L2X0_INV_LINE_PA, 1); 213 cache_wait(base + L2X0_INV_LINE_PA, 1);
203 cache_sync(); 214 cache_sync();
204 spin_unlock_irqrestore(&l2x0_lock, flags); 215 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
205} 216}
206 217
207static void l2x0_clean_range(unsigned long start, unsigned long end) 218static void l2x0_clean_range(unsigned long start, unsigned long end)
@@ -214,7 +225,7 @@ static void l2x0_clean_range(unsigned long start, unsigned long end)
214 return; 225 return;
215 } 226 }
216 227
217 spin_lock_irqsave(&l2x0_lock, flags); 228 raw_spin_lock_irqsave(&l2x0_lock, flags);
218 start &= ~(CACHE_LINE_SIZE - 1); 229 start &= ~(CACHE_LINE_SIZE - 1);
219 while (start < end) { 230 while (start < end) {
220 unsigned long blk_end = start + min(end - start, 4096UL); 231 unsigned long blk_end = start + min(end - start, 4096UL);
@@ -225,13 +236,13 @@ static void l2x0_clean_range(unsigned long start, unsigned long end)
225 } 236 }
226 237
227 if (blk_end < end) { 238 if (blk_end < end) {
228 spin_unlock_irqrestore(&l2x0_lock, flags); 239 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
229 spin_lock_irqsave(&l2x0_lock, flags); 240 raw_spin_lock_irqsave(&l2x0_lock, flags);
230 } 241 }
231 } 242 }
232 cache_wait(base + L2X0_CLEAN_LINE_PA, 1); 243 cache_wait(base + L2X0_CLEAN_LINE_PA, 1);
233 cache_sync(); 244 cache_sync();
234 spin_unlock_irqrestore(&l2x0_lock, flags); 245 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
235} 246}
236 247
237static void l2x0_flush_range(unsigned long start, unsigned long end) 248static void l2x0_flush_range(unsigned long start, unsigned long end)
@@ -244,7 +255,7 @@ static void l2x0_flush_range(unsigned long start, unsigned long end)
244 return; 255 return;
245 } 256 }
246 257
247 spin_lock_irqsave(&l2x0_lock, flags); 258 raw_spin_lock_irqsave(&l2x0_lock, flags);
248 start &= ~(CACHE_LINE_SIZE - 1); 259 start &= ~(CACHE_LINE_SIZE - 1);
249 while (start < end) { 260 while (start < end) {
250 unsigned long blk_end = start + min(end - start, 4096UL); 261 unsigned long blk_end = start + min(end - start, 4096UL);
@@ -257,27 +268,27 @@ static void l2x0_flush_range(unsigned long start, unsigned long end)
257 debug_writel(0x00); 268 debug_writel(0x00);
258 269
259 if (blk_end < end) { 270 if (blk_end < end) {
260 spin_unlock_irqrestore(&l2x0_lock, flags); 271 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
261 spin_lock_irqsave(&l2x0_lock, flags); 272 raw_spin_lock_irqsave(&l2x0_lock, flags);
262 } 273 }
263 } 274 }
264 cache_wait(base + L2X0_CLEAN_INV_LINE_PA, 1); 275 cache_wait(base + L2X0_CLEAN_INV_LINE_PA, 1);
265 cache_sync(); 276 cache_sync();
266 spin_unlock_irqrestore(&l2x0_lock, flags); 277 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
267} 278}
268 279
269static void l2x0_disable(void) 280static void l2x0_disable(void)
270{ 281{
271 unsigned long flags; 282 unsigned long flags;
272 283
273 spin_lock_irqsave(&l2x0_lock, flags); 284 raw_spin_lock_irqsave(&l2x0_lock, flags);
274 __l2x0_flush_all(); 285 __l2x0_flush_all();
275 writel_relaxed(0, l2x0_base + L2X0_CTRL); 286 writel_relaxed(0, l2x0_base + L2X0_CTRL);
276 dsb(); 287 dsb();
277 spin_unlock_irqrestore(&l2x0_lock, flags); 288 raw_spin_unlock_irqrestore(&l2x0_lock, flags);
278} 289}
279 290
280static void __init l2x0_unlock(__u32 cache_id) 291static void l2x0_unlock(__u32 cache_id)
281{ 292{
282 int lockregs; 293 int lockregs;
283 int i; 294 int i;
@@ -353,6 +364,8 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
353 /* l2x0 controller is disabled */ 364 /* l2x0 controller is disabled */
354 writel_relaxed(aux, l2x0_base + L2X0_AUX_CTRL); 365 writel_relaxed(aux, l2x0_base + L2X0_AUX_CTRL);
355 366
367 l2x0_saved_regs.aux_ctrl = aux;
368
356 l2x0_inv_all(); 369 l2x0_inv_all();
357 370
358 /* enable L2X0 */ 371 /* enable L2X0 */
@@ -372,3 +385,202 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
372 printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n", 385 printk(KERN_INFO "l2x0: %d ways, CACHE_ID 0x%08x, AUX_CTRL 0x%08x, Cache size: %d B\n",
373 ways, cache_id, aux, l2x0_size); 386 ways, cache_id, aux, l2x0_size);
374} 387}
388
389#ifdef CONFIG_OF
390static void __init l2x0_of_setup(const struct device_node *np,
391 __u32 *aux_val, __u32 *aux_mask)
392{
393 u32 data[2] = { 0, 0 };
394 u32 tag = 0;
395 u32 dirty = 0;
396 u32 val = 0, mask = 0;
397
398 of_property_read_u32(np, "arm,tag-latency", &tag);
399 if (tag) {
400 mask |= L2X0_AUX_CTRL_TAG_LATENCY_MASK;
401 val |= (tag - 1) << L2X0_AUX_CTRL_TAG_LATENCY_SHIFT;
402 }
403
404 of_property_read_u32_array(np, "arm,data-latency",
405 data, ARRAY_SIZE(data));
406 if (data[0] && data[1]) {
407 mask |= L2X0_AUX_CTRL_DATA_RD_LATENCY_MASK |
408 L2X0_AUX_CTRL_DATA_WR_LATENCY_MASK;
409 val |= ((data[0] - 1) << L2X0_AUX_CTRL_DATA_RD_LATENCY_SHIFT) |
410 ((data[1] - 1) << L2X0_AUX_CTRL_DATA_WR_LATENCY_SHIFT);
411 }
412
413 of_property_read_u32(np, "arm,dirty-latency", &dirty);
414 if (dirty) {
415 mask |= L2X0_AUX_CTRL_DIRTY_LATENCY_MASK;
416 val |= (dirty - 1) << L2X0_AUX_CTRL_DIRTY_LATENCY_SHIFT;
417 }
418
419 *aux_val &= ~mask;
420 *aux_val |= val;
421 *aux_mask &= ~mask;
422}
423
424static void __init pl310_of_setup(const struct device_node *np,
425 __u32 *aux_val, __u32 *aux_mask)
426{
427 u32 data[3] = { 0, 0, 0 };
428 u32 tag[3] = { 0, 0, 0 };
429 u32 filter[2] = { 0, 0 };
430
431 of_property_read_u32_array(np, "arm,tag-latency", tag, ARRAY_SIZE(tag));
432 if (tag[0] && tag[1] && tag[2])
433 writel_relaxed(
434 ((tag[0] - 1) << L2X0_LATENCY_CTRL_RD_SHIFT) |
435 ((tag[1] - 1) << L2X0_LATENCY_CTRL_WR_SHIFT) |
436 ((tag[2] - 1) << L2X0_LATENCY_CTRL_SETUP_SHIFT),
437 l2x0_base + L2X0_TAG_LATENCY_CTRL);
438
439 of_property_read_u32_array(np, "arm,data-latency",
440 data, ARRAY_SIZE(data));
441 if (data[0] && data[1] && data[2])
442 writel_relaxed(
443 ((data[0] - 1) << L2X0_LATENCY_CTRL_RD_SHIFT) |
444 ((data[1] - 1) << L2X0_LATENCY_CTRL_WR_SHIFT) |
445 ((data[2] - 1) << L2X0_LATENCY_CTRL_SETUP_SHIFT),
446 l2x0_base + L2X0_DATA_LATENCY_CTRL);
447
448 of_property_read_u32_array(np, "arm,filter-ranges",
449 filter, ARRAY_SIZE(filter));
450 if (filter[1]) {
451 writel_relaxed(ALIGN(filter[0] + filter[1], SZ_1M),
452 l2x0_base + L2X0_ADDR_FILTER_END);
453 writel_relaxed((filter[0] & ~(SZ_1M - 1)) | L2X0_ADDR_FILTER_EN,
454 l2x0_base + L2X0_ADDR_FILTER_START);
455 }
456}
457
458static void __init pl310_save(void)
459{
460 u32 l2x0_revision = readl_relaxed(l2x0_base + L2X0_CACHE_ID) &
461 L2X0_CACHE_ID_RTL_MASK;
462
463 l2x0_saved_regs.tag_latency = readl_relaxed(l2x0_base +
464 L2X0_TAG_LATENCY_CTRL);
465 l2x0_saved_regs.data_latency = readl_relaxed(l2x0_base +
466 L2X0_DATA_LATENCY_CTRL);
467 l2x0_saved_regs.filter_end = readl_relaxed(l2x0_base +
468 L2X0_ADDR_FILTER_END);
469 l2x0_saved_regs.filter_start = readl_relaxed(l2x0_base +
470 L2X0_ADDR_FILTER_START);
471
472 if (l2x0_revision >= L2X0_CACHE_ID_RTL_R2P0) {
473 /*
474 * From r2p0, there is Prefetch offset/control register
475 */
476 l2x0_saved_regs.prefetch_ctrl = readl_relaxed(l2x0_base +
477 L2X0_PREFETCH_CTRL);
478 /*
479 * From r3p0, there is Power control register
480 */
481 if (l2x0_revision >= L2X0_CACHE_ID_RTL_R3P0)
482 l2x0_saved_regs.pwr_ctrl = readl_relaxed(l2x0_base +
483 L2X0_POWER_CTRL);
484 }
485}
486
487static void l2x0_resume(void)
488{
489 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & 1)) {
490 /* restore aux ctrl and enable l2 */
491 l2x0_unlock(readl_relaxed(l2x0_base + L2X0_CACHE_ID));
492
493 writel_relaxed(l2x0_saved_regs.aux_ctrl, l2x0_base +
494 L2X0_AUX_CTRL);
495
496 l2x0_inv_all();
497
498 writel_relaxed(1, l2x0_base + L2X0_CTRL);
499 }
500}
501
502static void pl310_resume(void)
503{
504 u32 l2x0_revision;
505
506 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & 1)) {
507 /* restore pl310 setup */
508 writel_relaxed(l2x0_saved_regs.tag_latency,
509 l2x0_base + L2X0_TAG_LATENCY_CTRL);
510 writel_relaxed(l2x0_saved_regs.data_latency,
511 l2x0_base + L2X0_DATA_LATENCY_CTRL);
512 writel_relaxed(l2x0_saved_regs.filter_end,
513 l2x0_base + L2X0_ADDR_FILTER_END);
514 writel_relaxed(l2x0_saved_regs.filter_start,
515 l2x0_base + L2X0_ADDR_FILTER_START);
516
517 l2x0_revision = readl_relaxed(l2x0_base + L2X0_CACHE_ID) &
518 L2X0_CACHE_ID_RTL_MASK;
519
520 if (l2x0_revision >= L2X0_CACHE_ID_RTL_R2P0) {
521 writel_relaxed(l2x0_saved_regs.prefetch_ctrl,
522 l2x0_base + L2X0_PREFETCH_CTRL);
523 if (l2x0_revision >= L2X0_CACHE_ID_RTL_R3P0)
524 writel_relaxed(l2x0_saved_regs.pwr_ctrl,
525 l2x0_base + L2X0_POWER_CTRL);
526 }
527 }
528
529 l2x0_resume();
530}
531
532static const struct l2x0_of_data pl310_data = {
533 pl310_of_setup,
534 pl310_save,
535 pl310_resume,
536};
537
538static const struct l2x0_of_data l2x0_data = {
539 l2x0_of_setup,
540 NULL,
541 l2x0_resume,
542};
543
544static const struct of_device_id l2x0_ids[] __initconst = {
545 { .compatible = "arm,pl310-cache", .data = (void *)&pl310_data },
546 { .compatible = "arm,l220-cache", .data = (void *)&l2x0_data },
547 { .compatible = "arm,l210-cache", .data = (void *)&l2x0_data },
548 {}
549};
550
551int __init l2x0_of_init(__u32 aux_val, __u32 aux_mask)
552{
553 struct device_node *np;
554 struct l2x0_of_data *data;
555 struct resource res;
556
557 np = of_find_matching_node(NULL, l2x0_ids);
558 if (!np)
559 return -ENODEV;
560
561 if (of_address_to_resource(np, 0, &res))
562 return -ENODEV;
563
564 l2x0_base = ioremap(res.start, resource_size(&res));
565 if (!l2x0_base)
566 return -ENOMEM;
567
568 l2x0_saved_regs.phy_base = res.start;
569
570 data = of_match_node(l2x0_ids, np)->data;
571
572 /* L2 configuration can only be changed if the cache is disabled */
573 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & 1)) {
574 if (data->setup)
575 data->setup(np, &aux_val, &aux_mask);
576 }
577
578 if (data->save)
579 data->save();
580
581 l2x0_init(l2x0_base, aux_val, aux_mask);
582
583 outer_cache.resume = data->resume;
584 return 0;
585}
586#endif
diff --git a/arch/arm/mm/cache-v7.S b/arch/arm/mm/cache-v7.S
index 3b24bfa3b828..07c4bc8ea0a4 100644
--- a/arch/arm/mm/cache-v7.S
+++ b/arch/arm/mm/cache-v7.S
@@ -174,6 +174,10 @@ ENTRY(v7_coherent_user_range)
174 dcache_line_size r2, r3 174 dcache_line_size r2, r3
175 sub r3, r2, #1 175 sub r3, r2, #1
176 bic r12, r0, r3 176 bic r12, r0, r3
177#ifdef CONFIG_ARM_ERRATA_764369
178 ALT_SMP(W(dsb))
179 ALT_UP(W(nop))
180#endif
1771: 1811:
178 USER( mcr p15, 0, r12, c7, c11, 1 ) @ clean D line to the point of unification 182 USER( mcr p15, 0, r12, c7, c11, 1 ) @ clean D line to the point of unification
179 add r12, r12, r2 183 add r12, r12, r2
@@ -223,6 +227,10 @@ ENTRY(v7_flush_kern_dcache_area)
223 add r1, r0, r1 227 add r1, r0, r1
224 sub r3, r2, #1 228 sub r3, r2, #1
225 bic r0, r0, r3 229 bic r0, r0, r3
230#ifdef CONFIG_ARM_ERRATA_764369
231 ALT_SMP(W(dsb))
232 ALT_UP(W(nop))
233#endif
2261: 2341:
227 mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D line / unified line 235 mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D line / unified line
228 add r0, r0, r2 236 add r0, r0, r2
@@ -247,6 +255,10 @@ v7_dma_inv_range:
247 sub r3, r2, #1 255 sub r3, r2, #1
248 tst r0, r3 256 tst r0, r3
249 bic r0, r0, r3 257 bic r0, r0, r3
258#ifdef CONFIG_ARM_ERRATA_764369
259 ALT_SMP(W(dsb))
260 ALT_UP(W(nop))
261#endif
250 mcrne p15, 0, r0, c7, c14, 1 @ clean & invalidate D / U line 262 mcrne p15, 0, r0, c7, c14, 1 @ clean & invalidate D / U line
251 263
252 tst r1, r3 264 tst r1, r3
@@ -270,6 +282,10 @@ v7_dma_clean_range:
270 dcache_line_size r2, r3 282 dcache_line_size r2, r3
271 sub r3, r2, #1 283 sub r3, r2, #1
272 bic r0, r0, r3 284 bic r0, r0, r3
285#ifdef CONFIG_ARM_ERRATA_764369
286 ALT_SMP(W(dsb))
287 ALT_UP(W(nop))
288#endif
2731: 2891:
274 mcr p15, 0, r0, c7, c10, 1 @ clean D / U line 290 mcr p15, 0, r0, c7, c10, 1 @ clean D / U line
275 add r0, r0, r2 291 add r0, r0, r2
@@ -288,6 +304,10 @@ ENTRY(v7_dma_flush_range)
288 dcache_line_size r2, r3 304 dcache_line_size r2, r3
289 sub r3, r2, #1 305 sub r3, r2, #1
290 bic r0, r0, r3 306 bic r0, r0, r3
307#ifdef CONFIG_ARM_ERRATA_764369
308 ALT_SMP(W(dsb))
309 ALT_UP(W(nop))
310#endif
2911: 3111:
292 mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D / U line 312 mcr p15, 0, r0, c7, c14, 1 @ clean & invalidate D / U line
293 add r0, r0, r2 313 add r0, r0, r2
diff --git a/arch/arm/mm/context.c b/arch/arm/mm/context.c
index b0ee9ba3cfab..93aac068da94 100644
--- a/arch/arm/mm/context.c
+++ b/arch/arm/mm/context.c
@@ -16,7 +16,7 @@
16#include <asm/mmu_context.h> 16#include <asm/mmu_context.h>
17#include <asm/tlbflush.h> 17#include <asm/tlbflush.h>
18 18
19static DEFINE_SPINLOCK(cpu_asid_lock); 19static DEFINE_RAW_SPINLOCK(cpu_asid_lock);
20unsigned int cpu_last_asid = ASID_FIRST_VERSION; 20unsigned int cpu_last_asid = ASID_FIRST_VERSION;
21#ifdef CONFIG_SMP 21#ifdef CONFIG_SMP
22DEFINE_PER_CPU(struct mm_struct *, current_mm); 22DEFINE_PER_CPU(struct mm_struct *, current_mm);
@@ -31,7 +31,7 @@ DEFINE_PER_CPU(struct mm_struct *, current_mm);
31void __init_new_context(struct task_struct *tsk, struct mm_struct *mm) 31void __init_new_context(struct task_struct *tsk, struct mm_struct *mm)
32{ 32{
33 mm->context.id = 0; 33 mm->context.id = 0;
34 spin_lock_init(&mm->context.id_lock); 34 raw_spin_lock_init(&mm->context.id_lock);
35} 35}
36 36
37static void flush_context(void) 37static void flush_context(void)
@@ -58,7 +58,7 @@ static void set_mm_context(struct mm_struct *mm, unsigned int asid)
58 * the broadcast. This function is also called via IPI so the 58 * the broadcast. This function is also called via IPI so the
59 * mm->context.id_lock has to be IRQ-safe. 59 * mm->context.id_lock has to be IRQ-safe.
60 */ 60 */
61 spin_lock_irqsave(&mm->context.id_lock, flags); 61 raw_spin_lock_irqsave(&mm->context.id_lock, flags);
62 if (likely((mm->context.id ^ cpu_last_asid) >> ASID_BITS)) { 62 if (likely((mm->context.id ^ cpu_last_asid) >> ASID_BITS)) {
63 /* 63 /*
64 * Old version of ASID found. Set the new one and 64 * Old version of ASID found. Set the new one and
@@ -67,7 +67,7 @@ static void set_mm_context(struct mm_struct *mm, unsigned int asid)
67 mm->context.id = asid; 67 mm->context.id = asid;
68 cpumask_clear(mm_cpumask(mm)); 68 cpumask_clear(mm_cpumask(mm));
69 } 69 }
70 spin_unlock_irqrestore(&mm->context.id_lock, flags); 70 raw_spin_unlock_irqrestore(&mm->context.id_lock, flags);
71 71
72 /* 72 /*
73 * Set the mm_cpumask(mm) bit for the current CPU. 73 * Set the mm_cpumask(mm) bit for the current CPU.
@@ -117,7 +117,7 @@ void __new_context(struct mm_struct *mm)
117{ 117{
118 unsigned int asid; 118 unsigned int asid;
119 119
120 spin_lock(&cpu_asid_lock); 120 raw_spin_lock(&cpu_asid_lock);
121#ifdef CONFIG_SMP 121#ifdef CONFIG_SMP
122 /* 122 /*
123 * Check the ASID again, in case the change was broadcast from 123 * Check the ASID again, in case the change was broadcast from
@@ -125,7 +125,7 @@ void __new_context(struct mm_struct *mm)
125 */ 125 */
126 if (unlikely(((mm->context.id ^ cpu_last_asid) >> ASID_BITS) == 0)) { 126 if (unlikely(((mm->context.id ^ cpu_last_asid) >> ASID_BITS) == 0)) {
127 cpumask_set_cpu(smp_processor_id(), mm_cpumask(mm)); 127 cpumask_set_cpu(smp_processor_id(), mm_cpumask(mm));
128 spin_unlock(&cpu_asid_lock); 128 raw_spin_unlock(&cpu_asid_lock);
129 return; 129 return;
130 } 130 }
131#endif 131#endif
@@ -153,5 +153,5 @@ void __new_context(struct mm_struct *mm)
153 } 153 }
154 154
155 set_mm_context(mm, asid); 155 set_mm_context(mm, asid);
156 spin_unlock(&cpu_asid_lock); 156 raw_spin_unlock(&cpu_asid_lock);
157} 157}
diff --git a/arch/arm/mm/copypage-v4mc.c b/arch/arm/mm/copypage-v4mc.c
index b8061519ce77..7d0a8c230342 100644
--- a/arch/arm/mm/copypage-v4mc.c
+++ b/arch/arm/mm/copypage-v4mc.c
@@ -30,7 +30,7 @@
30#define minicache_pgprot __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | \ 30#define minicache_pgprot __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | \
31 L_PTE_MT_MINICACHE) 31 L_PTE_MT_MINICACHE)
32 32
33static DEFINE_SPINLOCK(minicache_lock); 33static DEFINE_RAW_SPINLOCK(minicache_lock);
34 34
35/* 35/*
36 * ARMv4 mini-dcache optimised copy_user_highpage 36 * ARMv4 mini-dcache optimised copy_user_highpage
@@ -76,14 +76,14 @@ void v4_mc_copy_user_highpage(struct page *to, struct page *from,
76 if (!test_and_set_bit(PG_dcache_clean, &from->flags)) 76 if (!test_and_set_bit(PG_dcache_clean, &from->flags))
77 __flush_dcache_page(page_mapping(from), from); 77 __flush_dcache_page(page_mapping(from), from);
78 78
79 spin_lock(&minicache_lock); 79 raw_spin_lock(&minicache_lock);
80 80
81 set_pte_ext(TOP_PTE(0xffff8000), pfn_pte(page_to_pfn(from), minicache_pgprot), 0); 81 set_pte_ext(TOP_PTE(0xffff8000), pfn_pte(page_to_pfn(from), minicache_pgprot), 0);
82 flush_tlb_kernel_page(0xffff8000); 82 flush_tlb_kernel_page(0xffff8000);
83 83
84 mc_copy_user_page((void *)0xffff8000, kto); 84 mc_copy_user_page((void *)0xffff8000, kto);
85 85
86 spin_unlock(&minicache_lock); 86 raw_spin_unlock(&minicache_lock);
87 87
88 kunmap_atomic(kto, KM_USER1); 88 kunmap_atomic(kto, KM_USER1);
89} 89}
diff --git a/arch/arm/mm/copypage-v6.c b/arch/arm/mm/copypage-v6.c
index 63cca0097130..3d9a1552cef6 100644
--- a/arch/arm/mm/copypage-v6.c
+++ b/arch/arm/mm/copypage-v6.c
@@ -27,7 +27,7 @@
27#define from_address (0xffff8000) 27#define from_address (0xffff8000)
28#define to_address (0xffffc000) 28#define to_address (0xffffc000)
29 29
30static DEFINE_SPINLOCK(v6_lock); 30static DEFINE_RAW_SPINLOCK(v6_lock);
31 31
32/* 32/*
33 * Copy the user page. No aliasing to deal with so we can just 33 * Copy the user page. No aliasing to deal with so we can just
@@ -88,7 +88,7 @@ static void v6_copy_user_highpage_aliasing(struct page *to,
88 * Now copy the page using the same cache colour as the 88 * Now copy the page using the same cache colour as the
89 * pages ultimate destination. 89 * pages ultimate destination.
90 */ 90 */
91 spin_lock(&v6_lock); 91 raw_spin_lock(&v6_lock);
92 92
93 set_pte_ext(TOP_PTE(from_address) + offset, pfn_pte(page_to_pfn(from), PAGE_KERNEL), 0); 93 set_pte_ext(TOP_PTE(from_address) + offset, pfn_pte(page_to_pfn(from), PAGE_KERNEL), 0);
94 set_pte_ext(TOP_PTE(to_address) + offset, pfn_pte(page_to_pfn(to), PAGE_KERNEL), 0); 94 set_pte_ext(TOP_PTE(to_address) + offset, pfn_pte(page_to_pfn(to), PAGE_KERNEL), 0);
@@ -101,7 +101,7 @@ static void v6_copy_user_highpage_aliasing(struct page *to,
101 101
102 copy_page((void *)kto, (void *)kfrom); 102 copy_page((void *)kto, (void *)kfrom);
103 103
104 spin_unlock(&v6_lock); 104 raw_spin_unlock(&v6_lock);
105} 105}
106 106
107/* 107/*
@@ -121,13 +121,13 @@ static void v6_clear_user_highpage_aliasing(struct page *page, unsigned long vad
121 * Now clear the page using the same cache colour as 121 * Now clear the page using the same cache colour as
122 * the pages ultimate destination. 122 * the pages ultimate destination.
123 */ 123 */
124 spin_lock(&v6_lock); 124 raw_spin_lock(&v6_lock);
125 125
126 set_pte_ext(TOP_PTE(to_address) + offset, pfn_pte(page_to_pfn(page), PAGE_KERNEL), 0); 126 set_pte_ext(TOP_PTE(to_address) + offset, pfn_pte(page_to_pfn(page), PAGE_KERNEL), 0);
127 flush_tlb_kernel_page(to); 127 flush_tlb_kernel_page(to);
128 clear_page((void *)to); 128 clear_page((void *)to);
129 129
130 spin_unlock(&v6_lock); 130 raw_spin_unlock(&v6_lock);
131} 131}
132 132
133struct cpu_user_fns v6_user_fns __initdata = { 133struct cpu_user_fns v6_user_fns __initdata = {
diff --git a/arch/arm/mm/copypage-xscale.c b/arch/arm/mm/copypage-xscale.c
index 649bbcd325bf..610c24ced310 100644
--- a/arch/arm/mm/copypage-xscale.c
+++ b/arch/arm/mm/copypage-xscale.c
@@ -32,7 +32,7 @@
32#define minicache_pgprot __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | \ 32#define minicache_pgprot __pgprot(L_PTE_PRESENT | L_PTE_YOUNG | \
33 L_PTE_MT_MINICACHE) 33 L_PTE_MT_MINICACHE)
34 34
35static DEFINE_SPINLOCK(minicache_lock); 35static DEFINE_RAW_SPINLOCK(minicache_lock);
36 36
37/* 37/*
38 * XScale mini-dcache optimised copy_user_highpage 38 * XScale mini-dcache optimised copy_user_highpage
@@ -98,14 +98,14 @@ void xscale_mc_copy_user_highpage(struct page *to, struct page *from,
98 if (!test_and_set_bit(PG_dcache_clean, &from->flags)) 98 if (!test_and_set_bit(PG_dcache_clean, &from->flags))
99 __flush_dcache_page(page_mapping(from), from); 99 __flush_dcache_page(page_mapping(from), from);
100 100
101 spin_lock(&minicache_lock); 101 raw_spin_lock(&minicache_lock);
102 102
103 set_pte_ext(TOP_PTE(COPYPAGE_MINICACHE), pfn_pte(page_to_pfn(from), minicache_pgprot), 0); 103 set_pte_ext(TOP_PTE(COPYPAGE_MINICACHE), pfn_pte(page_to_pfn(from), minicache_pgprot), 0);
104 flush_tlb_kernel_page(COPYPAGE_MINICACHE); 104 flush_tlb_kernel_page(COPYPAGE_MINICACHE);
105 105
106 mc_copy_user_page((void *)COPYPAGE_MINICACHE, kto); 106 mc_copy_user_page((void *)COPYPAGE_MINICACHE, kto);
107 107
108 spin_unlock(&minicache_lock); 108 raw_spin_unlock(&minicache_lock);
109 109
110 kunmap_atomic(kto, KM_USER1); 110 kunmap_atomic(kto, KM_USER1);
111} 111}
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 50be842e89fd..e4e7f6cba1ab 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -120,9 +120,8 @@ static void __dma_free_buffer(struct page *page, size_t size)
120 120
121#ifdef CONFIG_MMU 121#ifdef CONFIG_MMU
122 122
123
124#define CONSISTENT_OFFSET(x) (((unsigned long)(x) - consistent_base) >> PAGE_SHIFT) 123#define CONSISTENT_OFFSET(x) (((unsigned long)(x) - consistent_base) >> PAGE_SHIFT)
125#define CONSISTENT_PTE_INDEX(x) (((unsigned long)(x) - consistent_base) >> PGDIR_SHIFT) 124#define CONSISTENT_PTE_INDEX(x) (((unsigned long)(x) - consistent_base) >> PMD_SHIFT)
126 125
127/* 126/*
128 * These are the page tables (2MB each) covering uncached, DMA consistent allocations 127 * These are the page tables (2MB each) covering uncached, DMA consistent allocations
@@ -206,7 +205,7 @@ static int __init consistent_init(void)
206 } 205 }
207 206
208 consistent_pte[i++] = pte; 207 consistent_pte[i++] = pte;
209 base += (1 << PGDIR_SHIFT); 208 base += PMD_SIZE;
210 } while (base < CONSISTENT_END); 209 } while (base < CONSISTENT_END);
211 210
212 return ret; 211 return ret;
@@ -347,6 +346,8 @@ __dma_alloc(struct device *dev, size_t size, dma_addr_t *handle, gfp_t gfp,
347 346
348 if (addr) 347 if (addr)
349 *handle = pfn_to_dma(dev, page_to_pfn(page)); 348 *handle = pfn_to_dma(dev, page_to_pfn(page));
349 else
350 __dma_free_buffer(page, size);
350 351
351 return addr; 352 return addr;
352} 353}
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 34409a08ba0d..04e9a92bb47a 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -496,6 +496,13 @@ static void __init free_unused_memmap(struct meminfo *mi)
496 */ 496 */
497 bank_start = min(bank_start, 497 bank_start = min(bank_start,
498 ALIGN(prev_bank_end, PAGES_PER_SECTION)); 498 ALIGN(prev_bank_end, PAGES_PER_SECTION));
499#else
500 /*
501 * Align down here since the VM subsystem insists that the
502 * memmap entries are valid from the bank start aligned to
503 * MAX_ORDER_NR_PAGES.
504 */
505 bank_start = round_down(bank_start, MAX_ORDER_NR_PAGES);
499#endif 506#endif
500 /* 507 /*
501 * If we had a previous bank, and there is a space 508 * If we had a previous bank, and there is a space
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index ab506272b2d3..bdb248c4f55c 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -289,6 +289,27 @@ __arm_ioremap(unsigned long phys_addr, size_t size, unsigned int mtype)
289} 289}
290EXPORT_SYMBOL(__arm_ioremap); 290EXPORT_SYMBOL(__arm_ioremap);
291 291
292/*
293 * Remap an arbitrary physical address space into the kernel virtual
294 * address space as memory. Needed when the kernel wants to execute
295 * code in external memory. This is needed for reprogramming source
296 * clocks that would affect normal memory for example. Please see
297 * CONFIG_GENERIC_ALLOCATOR for allocating external memory.
298 */
299void __iomem *
300__arm_ioremap_exec(unsigned long phys_addr, size_t size, bool cached)
301{
302 unsigned int mtype;
303
304 if (cached)
305 mtype = MT_MEMORY;
306 else
307 mtype = MT_MEMORY_NONCACHED;
308
309 return __arm_ioremap_caller(phys_addr, size, mtype,
310 __builtin_return_address(0));
311}
312
292void __iounmap(volatile void __iomem *io_addr) 313void __iounmap(volatile void __iomem *io_addr)
293{ 314{
294 void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr); 315 void *addr = (void *)(PAGE_MASK & (unsigned long)io_addr);
diff --git a/arch/arm/mm/mm.h b/arch/arm/mm/mm.h
index 010566799c80..ad7cce3bc431 100644
--- a/arch/arm/mm/mm.h
+++ b/arch/arm/mm/mm.h
@@ -12,8 +12,8 @@ static inline pmd_t *pmd_off_k(unsigned long virt)
12 12
13struct mem_type { 13struct mem_type {
14 pteval_t prot_pte; 14 pteval_t prot_pte;
15 unsigned int prot_l1; 15 pmdval_t prot_l1;
16 unsigned int prot_sect; 16 pmdval_t prot_sect;
17 unsigned int domain; 17 unsigned int domain;
18}; 18};
19 19
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index ea9c9f3e48bf..dc8c550e6cbd 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -60,7 +60,7 @@ EXPORT_SYMBOL(pgprot_kernel);
60struct cachepolicy { 60struct cachepolicy {
61 const char policy[16]; 61 const char policy[16];
62 unsigned int cr_mask; 62 unsigned int cr_mask;
63 unsigned int pmd; 63 pmdval_t pmd;
64 pteval_t pte; 64 pteval_t pte;
65}; 65};
66 66
@@ -296,7 +296,7 @@ static void __init build_mem_type_table(void)
296{ 296{
297 struct cachepolicy *cp; 297 struct cachepolicy *cp;
298 unsigned int cr = get_cr(); 298 unsigned int cr = get_cr();
299 unsigned int user_pgprot, kern_pgprot, vecs_pgprot; 299 pteval_t user_pgprot, kern_pgprot, vecs_pgprot;
300 int cpu_arch = cpu_architecture(); 300 int cpu_arch = cpu_architecture();
301 int i; 301 int i;
302 302
@@ -871,14 +871,14 @@ static inline void prepare_page_table(void)
871 /* 871 /*
872 * Clear out all the mappings below the kernel image. 872 * Clear out all the mappings below the kernel image.
873 */ 873 */
874 for (addr = 0; addr < MODULES_VADDR; addr += PGDIR_SIZE) 874 for (addr = 0; addr < MODULES_VADDR; addr += PMD_SIZE)
875 pmd_clear(pmd_off_k(addr)); 875 pmd_clear(pmd_off_k(addr));
876 876
877#ifdef CONFIG_XIP_KERNEL 877#ifdef CONFIG_XIP_KERNEL
878 /* The XIP kernel is mapped in the module area -- skip over it */ 878 /* The XIP kernel is mapped in the module area -- skip over it */
879 addr = ((unsigned long)_etext + PGDIR_SIZE - 1) & PGDIR_MASK; 879 addr = ((unsigned long)_etext + PMD_SIZE - 1) & PMD_MASK;
880#endif 880#endif
881 for ( ; addr < PAGE_OFFSET; addr += PGDIR_SIZE) 881 for ( ; addr < PAGE_OFFSET; addr += PMD_SIZE)
882 pmd_clear(pmd_off_k(addr)); 882 pmd_clear(pmd_off_k(addr));
883 883
884 /* 884 /*
@@ -893,10 +893,12 @@ static inline void prepare_page_table(void)
893 * memory bank, up to the end of the vmalloc region. 893 * memory bank, up to the end of the vmalloc region.
894 */ 894 */
895 for (addr = __phys_to_virt(end); 895 for (addr = __phys_to_virt(end);
896 addr < VMALLOC_END; addr += PGDIR_SIZE) 896 addr < VMALLOC_END; addr += PMD_SIZE)
897 pmd_clear(pmd_off_k(addr)); 897 pmd_clear(pmd_off_k(addr));
898} 898}
899 899
900#define SWAPPER_PG_DIR_SIZE (PTRS_PER_PGD * sizeof(pgd_t))
901
900/* 902/*
901 * Reserve the special regions of memory 903 * Reserve the special regions of memory
902 */ 904 */
@@ -906,7 +908,7 @@ void __init arm_mm_memblock_reserve(void)
906 * Reserve the page tables. These are already in use, 908 * Reserve the page tables. These are already in use,
907 * and can only be in node 0. 909 * and can only be in node 0.
908 */ 910 */
909 memblock_reserve(__pa(swapper_pg_dir), PTRS_PER_PGD * sizeof(pgd_t)); 911 memblock_reserve(__pa(swapper_pg_dir), SWAPPER_PG_DIR_SIZE);
910 912
911#ifdef CONFIG_SA1111 913#ifdef CONFIG_SA1111
912 /* 914 /*
@@ -934,7 +936,7 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
934 */ 936 */
935 vectors_page = early_alloc(PAGE_SIZE); 937 vectors_page = early_alloc(PAGE_SIZE);
936 938
937 for (addr = VMALLOC_END; addr; addr += PGDIR_SIZE) 939 for (addr = VMALLOC_END; addr; addr += PMD_SIZE)
938 pmd_clear(pmd_off_k(addr)); 940 pmd_clear(pmd_off_k(addr));
939 941
940 /* 942 /*
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index 6af366ce0165..2c559ac38142 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -218,7 +218,7 @@ ENDPROC(cpu_v7_set_pte_ext)
218/* Suspend/resume support: derived from arch/arm/mach-s5pv210/sleep.S */ 218/* Suspend/resume support: derived from arch/arm/mach-s5pv210/sleep.S */
219.globl cpu_v7_suspend_size 219.globl cpu_v7_suspend_size
220.equ cpu_v7_suspend_size, 4 * 7 220.equ cpu_v7_suspend_size, 4 * 7
221#ifdef CONFIG_PM_SLEEP 221#ifdef CONFIG_ARM_CPU_SUSPEND
222ENTRY(cpu_v7_do_suspend) 222ENTRY(cpu_v7_do_suspend)
223 stmfd sp!, {r4 - r10, lr} 223 stmfd sp!, {r4 - r10, lr}
224 mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID 224 mrc p15, 0, r4, c13, c0, 0 @ FCSE/PID
diff --git a/arch/arm/plat-mxc/Kconfig b/arch/arm/plat-mxc/Kconfig
index a5353fc0793f..4c8fdbcc9467 100644
--- a/arch/arm/plat-mxc/Kconfig
+++ b/arch/arm/plat-mxc/Kconfig
@@ -39,7 +39,7 @@ config ARCH_MX503
39 select ARCH_MX50_SUPPORTED 39 select ARCH_MX50_SUPPORTED
40 select ARCH_MX53_SUPPORTED 40 select ARCH_MX53_SUPPORTED
41 help 41 help
42 This enables support for machines using Freescale's i.MX50 and i.MX51 42 This enables support for machines using Freescale's i.MX50 and i.MX53
43 processors. 43 processors.
44 44
45config ARCH_MX51 45config ARCH_MX51
diff --git a/arch/arm/plat-mxc/devices.c b/arch/arm/plat-mxc/devices.c
index 0d6ed31bdbf2..a34b2ae895f2 100644
--- a/arch/arm/plat-mxc/devices.c
+++ b/arch/arm/plat-mxc/devices.c
@@ -37,59 +37,6 @@ int __init mxc_register_device(struct platform_device *pdev, void *data)
37 return ret; 37 return ret;
38} 38}
39 39
40struct platform_device *__init imx_add_platform_device_dmamask(
41 const char *name, int id,
42 const struct resource *res, unsigned int num_resources,
43 const void *data, size_t size_data, u64 dmamask)
44{
45 int ret = -ENOMEM;
46 struct platform_device *pdev;
47
48 pdev = platform_device_alloc(name, id);
49 if (!pdev)
50 goto err;
51
52 if (dmamask) {
53 /*
54 * This memory isn't freed when the device is put,
55 * I don't have a nice idea for that though. Conceptually
56 * dma_mask in struct device should not be a pointer.
57 * See http://thread.gmane.org/gmane.linux.kernel.pci/9081
58 */
59 pdev->dev.dma_mask =
60 kmalloc(sizeof(*pdev->dev.dma_mask), GFP_KERNEL);
61 if (!pdev->dev.dma_mask)
62 /* ret is still -ENOMEM; */
63 goto err;
64
65 *pdev->dev.dma_mask = dmamask;
66 pdev->dev.coherent_dma_mask = dmamask;
67 }
68
69 if (res) {
70 ret = platform_device_add_resources(pdev, res, num_resources);
71 if (ret)
72 goto err;
73 }
74
75 if (data) {
76 ret = platform_device_add_data(pdev, data, size_data);
77 if (ret)
78 goto err;
79 }
80
81 ret = platform_device_add(pdev);
82 if (ret) {
83err:
84 if (dmamask)
85 kfree(pdev->dev.dma_mask);
86 platform_device_put(pdev);
87 return ERR_PTR(ret);
88 }
89
90 return pdev;
91}
92
93struct device mxc_aips_bus = { 40struct device mxc_aips_bus = {
94 .init_name = "mxc_aips", 41 .init_name = "mxc_aips",
95 .parent = &platform_bus, 42 .parent = &platform_bus,
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
index 524538aabc4b..543525d76a60 100644
--- a/arch/arm/plat-mxc/include/mach/devices-common.h
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -14,10 +14,22 @@
14extern struct device mxc_aips_bus; 14extern struct device mxc_aips_bus;
15extern struct device mxc_ahb_bus; 15extern struct device mxc_ahb_bus;
16 16
17struct platform_device *imx_add_platform_device_dmamask( 17static inline struct platform_device *imx_add_platform_device_dmamask(
18 const char *name, int id, 18 const char *name, int id,
19 const struct resource *res, unsigned int num_resources, 19 const struct resource *res, unsigned int num_resources,
20 const void *data, size_t size_data, u64 dmamask); 20 const void *data, size_t size_data, u64 dmamask)
21{
22 struct platform_device_info pdevinfo = {
23 .name = name,
24 .id = id,
25 .res = res,
26 .num_res = num_resources,
27 .data = data,
28 .size_data = size_data,
29 .dma_mask = dmamask,
30 };
31 return platform_device_register_full(&pdevinfo);
32}
21 33
22static inline struct platform_device *imx_add_platform_device( 34static inline struct platform_device *imx_add_platform_device(
23 const char *name, int id, 35 const char *name, int id,
diff --git a/arch/arm/plat-mxc/include/mach/gpio.h b/arch/arm/plat-mxc/include/mach/gpio.h
index 31c820c1b796..3e1ffc8b8f0c 100644
--- a/arch/arm/plat-mxc/include/mach/gpio.h
+++ b/arch/arm/plat-mxc/include/mach/gpio.h
@@ -21,18 +21,12 @@
21 21
22#include <linux/spinlock.h> 22#include <linux/spinlock.h>
23#include <mach/hardware.h> 23#include <mach/hardware.h>
24#include <asm-generic/gpio.h>
25 24
26 25
27/* There's a off-by-one betweem the gpio bank number and the gpiochip */ 26/* There's a off-by-one betweem the gpio bank number and the gpiochip */
28/* range e.g. GPIO_1_5 is gpio 5 under linux */ 27/* range e.g. GPIO_1_5 is gpio 5 under linux */
29#define IMX_GPIO_NR(bank, nr) (((bank) - 1) * 32 + (nr)) 28#define IMX_GPIO_NR(bank, nr) (((bank) - 1) * 32 + (nr))
30 29
31/* use gpiolib dispatchers */
32#define gpio_get_value __gpio_get_value
33#define gpio_set_value __gpio_set_value
34#define gpio_cansleep __gpio_cansleep
35
36#define gpio_to_irq(gpio) (MXC_GPIO_IRQ_START + (gpio)) 30#define gpio_to_irq(gpio) (MXC_GPIO_IRQ_START + (gpio))
37#define irq_to_gpio(irq) ((irq) - MXC_GPIO_IRQ_START) 31#define irq_to_gpio(irq) ((irq) - MXC_GPIO_IRQ_START)
38 32
diff --git a/arch/arm/plat-nomadik/include/plat/gpio.h b/arch/arm/plat-nomadik/include/plat/gpio-nomadik.h
index d5d7e651269c..3ba4d8f8073b 100644
--- a/arch/arm/plat-nomadik/include/plat/gpio.h
+++ b/arch/arm/plat-nomadik/include/plat/gpio-nomadik.h
@@ -9,20 +9,9 @@
9 * it under the terms of the GNU General Public License version 2 as 9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11 */ 11 */
12#ifndef __ASM_PLAT_GPIO_H
13#define __ASM_PLAT_GPIO_H
14 12
15#include <asm-generic/gpio.h> 13#ifndef __PLAT_NOMADIK_GPIO
16 14#define __PLAT_NOMADIK_GPIO
17/*
18 * These currently cause a function call to happen, they may be optimized
19 * if needed by adding cpu-specific defines to identify blocks
20 * (see mach-pxa/include/mach/gpio.h as an example using GPLR etc)
21 */
22#define gpio_get_value __gpio_get_value
23#define gpio_set_value __gpio_set_value
24#define gpio_cansleep __gpio_cansleep
25#define gpio_to_irq __gpio_to_irq
26 15
27/* 16/*
28 * "nmk_gpio" and "NMK_GPIO" stand for "Nomadik GPIO", leaving 17 * "nmk_gpio" and "NMK_GPIO" stand for "Nomadik GPIO", leaving
@@ -93,4 +82,4 @@ struct nmk_gpio_platform_data {
93 bool supports_sleepmode; 82 bool supports_sleepmode;
94}; 83};
95 84
96#endif /* __ASM_PLAT_GPIO_H */ 85#endif /* __PLAT_NOMADIK_GPIO */
diff --git a/arch/arm/plat-omap/Kconfig b/arch/arm/plat-omap/Kconfig
index 95732af7b208..6f4edd3408c2 100644
--- a/arch/arm/plat-omap/Kconfig
+++ b/arch/arm/plat-omap/Kconfig
@@ -14,6 +14,7 @@ config ARCH_OMAP1
14 select CLKDEV_LOOKUP 14 select CLKDEV_LOOKUP
15 select CLKSRC_MMIO 15 select CLKSRC_MMIO
16 select GENERIC_IRQ_CHIP 16 select GENERIC_IRQ_CHIP
17 select HAVE_IDE
17 select NEED_MACH_MEMORY_H 18 select NEED_MACH_MEMORY_H
18 help 19 help
19 "Systems based on omap7xx, omap15xx or omap16xx" 20 "Systems based on omap7xx, omap15xx or omap16xx"
diff --git a/arch/arm/plat-omap/debug-devices.c b/arch/arm/plat-omap/debug-devices.c
index 923c9621096b..caa1f7b6cc21 100644
--- a/arch/arm/plat-omap/debug-devices.c
+++ b/arch/arm/plat-omap/debug-devices.c
@@ -8,7 +8,7 @@
8 * it under the terms of the GNU General Public License version 2 as 8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10 */ 10 */
11 11#include <linux/gpio.h>
12#include <linux/kernel.h> 12#include <linux/kernel.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
@@ -18,7 +18,6 @@
18#include <mach/hardware.h> 18#include <mach/hardware.h>
19 19
20#include <plat/board.h> 20#include <plat/board.h>
21#include <mach/gpio.h>
22 21
23 22
24/* Many OMAP development platforms reuse the same "debug board"; these 23/* Many OMAP development platforms reuse the same "debug board"; these
diff --git a/arch/arm/plat-omap/debug-leds.c b/arch/arm/plat-omap/debug-leds.c
index fc05b1022602..61a1ec2a6af4 100644
--- a/arch/arm/plat-omap/debug-leds.c
+++ b/arch/arm/plat-omap/debug-leds.c
@@ -7,7 +7,7 @@
7 * it under the terms of the GNU General Public License version 2 as 7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation. 8 * published by the Free Software Foundation.
9 */ 9 */
10 10#include <linux/gpio.h>
11#include <linux/init.h> 11#include <linux/init.h>
12#include <linux/platform_device.h> 12#include <linux/platform_device.h>
13#include <linux/leds.h> 13#include <linux/leds.h>
@@ -19,7 +19,6 @@
19#include <asm/mach-types.h> 19#include <asm/mach-types.h>
20 20
21#include <plat/fpga.h> 21#include <plat/fpga.h>
22#include <mach/gpio.h>
23 22
24 23
25/* Many OMAP development platforms reuse the same "debug board"; these 24/* Many OMAP development platforms reuse the same "debug board"; these
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c
index ea28f98d5d6a..64c3bd4aa54e 100644
--- a/arch/arm/plat-omap/devices.c
+++ b/arch/arm/plat-omap/devices.c
@@ -8,7 +8,7 @@
8 * the Free Software Foundation; either version 2 of the License, or 8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version. 9 * (at your option) any later version.
10 */ 10 */
11 11#include <linux/gpio.h>
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/init.h> 14#include <linux/init.h>
@@ -24,7 +24,6 @@
24#include <plat/tc.h> 24#include <plat/tc.h>
25#include <plat/board.h> 25#include <plat/board.h>
26#include <plat/mmc.h> 26#include <plat/mmc.h>
27#include <mach/gpio.h>
28#include <plat/menelaus.h> 27#include <plat/menelaus.h>
29#include <plat/mcbsp.h> 28#include <plat/mcbsp.h>
30#include <plat/omap44xx.h> 29#include <plat/omap44xx.h>
diff --git a/arch/arm/plat-omap/include/plat/gpio.h b/arch/arm/plat-omap/include/plat/gpio.h
index 91e8de3db085..9e86ee0aed0a 100644
--- a/arch/arm/plat-omap/include/plat/gpio.h
+++ b/arch/arm/plat-omap/include/plat/gpio.h
@@ -222,26 +222,6 @@ extern void omap_gpio_restore_context(void);
222#include <linux/errno.h> 222#include <linux/errno.h>
223#include <asm-generic/gpio.h> 223#include <asm-generic/gpio.h>
224 224
225static inline int gpio_get_value(unsigned gpio)
226{
227 return __gpio_get_value(gpio);
228}
229
230static inline void gpio_set_value(unsigned gpio, int value)
231{
232 __gpio_set_value(gpio, value);
233}
234
235static inline int gpio_cansleep(unsigned gpio)
236{
237 return __gpio_cansleep(gpio);
238}
239
240static inline int gpio_to_irq(unsigned gpio)
241{
242 return __gpio_to_irq(gpio);
243}
244
245static inline int irq_to_gpio(unsigned irq) 225static inline int irq_to_gpio(unsigned irq)
246{ 226{
247 int tmp; 227 int tmp;
diff --git a/arch/arm/plat-orion/include/plat/gpio.h b/arch/arm/plat-orion/include/plat/gpio.h
index 3075b9fdde83..3abf30428bee 100644
--- a/arch/arm/plat-orion/include/plat/gpio.h
+++ b/arch/arm/plat-orion/include/plat/gpio.h
@@ -12,15 +12,7 @@
12#define __PLAT_GPIO_H 12#define __PLAT_GPIO_H
13 13
14#include <linux/init.h> 14#include <linux/init.h>
15#include <asm-generic/gpio.h> 15#include <linux/types.h>
16
17/*
18 * GENERIC_GPIO primitives.
19 */
20#define gpio_get_value __gpio_get_value
21#define gpio_set_value __gpio_set_value
22#define gpio_cansleep __gpio_cansleep
23#define gpio_to_irq __gpio_to_irq
24 16
25/* 17/*
26 * Orion-specific GPIO API extensions. 18 * Orion-specific GPIO API extensions.
diff --git a/arch/arm/plat-pxa/Makefile b/arch/arm/plat-pxa/Makefile
index 3aca5ba0f876..f302d048392d 100644
--- a/arch/arm/plat-pxa/Makefile
+++ b/arch/arm/plat-pxa/Makefile
@@ -4,7 +4,6 @@
4 4
5obj-y := dma.o 5obj-y := dma.o
6 6
7obj-$(CONFIG_GENERIC_GPIO) += gpio.o
8obj-$(CONFIG_PXA3xx) += mfp.o 7obj-$(CONFIG_PXA3xx) += mfp.o
9obj-$(CONFIG_PXA95x) += mfp.o 8obj-$(CONFIG_PXA95x) += mfp.o
10obj-$(CONFIG_ARCH_MMP) += mfp.o 9obj-$(CONFIG_ARCH_MMP) += mfp.o
diff --git a/arch/arm/plat-pxa/gpio.c b/arch/arm/plat-pxa/gpio.c
deleted file mode 100644
index a11dc3670505..000000000000
--- a/arch/arm/plat-pxa/gpio.c
+++ /dev/null
@@ -1,338 +0,0 @@
1/*
2 * linux/arch/arm/plat-pxa/gpio.c
3 *
4 * Generic PXA GPIO handling
5 *
6 * Author: Nicolas Pitre
7 * Created: Jun 15, 2001
8 * Copyright: MontaVista Software Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
13 */
14
15#include <linux/init.h>
16#include <linux/irq.h>
17#include <linux/io.h>
18#include <linux/syscore_ops.h>
19#include <linux/slab.h>
20
21#include <mach/gpio.h>
22
23int pxa_last_gpio;
24
25struct pxa_gpio_chip {
26 struct gpio_chip chip;
27 void __iomem *regbase;
28 char label[10];
29
30 unsigned long irq_mask;
31 unsigned long irq_edge_rise;
32 unsigned long irq_edge_fall;
33
34#ifdef CONFIG_PM
35 unsigned long saved_gplr;
36 unsigned long saved_gpdr;
37 unsigned long saved_grer;
38 unsigned long saved_gfer;
39#endif
40};
41
42static DEFINE_SPINLOCK(gpio_lock);
43static struct pxa_gpio_chip *pxa_gpio_chips;
44
45#define for_each_gpio_chip(i, c) \
46 for (i = 0, c = &pxa_gpio_chips[0]; i <= pxa_last_gpio; i += 32, c++)
47
48static inline void __iomem *gpio_chip_base(struct gpio_chip *c)
49{
50 return container_of(c, struct pxa_gpio_chip, chip)->regbase;
51}
52
53static inline struct pxa_gpio_chip *gpio_to_pxachip(unsigned gpio)
54{
55 return &pxa_gpio_chips[gpio_to_bank(gpio)];
56}
57
58static int pxa_gpio_direction_input(struct gpio_chip *chip, unsigned offset)
59{
60 void __iomem *base = gpio_chip_base(chip);
61 uint32_t value, mask = 1 << offset;
62 unsigned long flags;
63
64 spin_lock_irqsave(&gpio_lock, flags);
65
66 value = __raw_readl(base + GPDR_OFFSET);
67 if (__gpio_is_inverted(chip->base + offset))
68 value |= mask;
69 else
70 value &= ~mask;
71 __raw_writel(value, base + GPDR_OFFSET);
72
73 spin_unlock_irqrestore(&gpio_lock, flags);
74 return 0;
75}
76
77static int pxa_gpio_direction_output(struct gpio_chip *chip,
78 unsigned offset, int value)
79{
80 void __iomem *base = gpio_chip_base(chip);
81 uint32_t tmp, mask = 1 << offset;
82 unsigned long flags;
83
84 __raw_writel(mask, base + (value ? GPSR_OFFSET : GPCR_OFFSET));
85
86 spin_lock_irqsave(&gpio_lock, flags);
87
88 tmp = __raw_readl(base + GPDR_OFFSET);
89 if (__gpio_is_inverted(chip->base + offset))
90 tmp &= ~mask;
91 else
92 tmp |= mask;
93 __raw_writel(tmp, base + GPDR_OFFSET);
94
95 spin_unlock_irqrestore(&gpio_lock, flags);
96 return 0;
97}
98
99static int pxa_gpio_get(struct gpio_chip *chip, unsigned offset)
100{
101 return __raw_readl(gpio_chip_base(chip) + GPLR_OFFSET) & (1 << offset);
102}
103
104static void pxa_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
105{
106 __raw_writel(1 << offset, gpio_chip_base(chip) +
107 (value ? GPSR_OFFSET : GPCR_OFFSET));
108}
109
110static int __init pxa_init_gpio_chip(int gpio_end)
111{
112 int i, gpio, nbanks = gpio_to_bank(gpio_end) + 1;
113 struct pxa_gpio_chip *chips;
114
115 chips = kzalloc(nbanks * sizeof(struct pxa_gpio_chip), GFP_KERNEL);
116 if (chips == NULL) {
117 pr_err("%s: failed to allocate GPIO chips\n", __func__);
118 return -ENOMEM;
119 }
120
121 for (i = 0, gpio = 0; i < nbanks; i++, gpio += 32) {
122 struct gpio_chip *c = &chips[i].chip;
123
124 sprintf(chips[i].label, "gpio-%d", i);
125 chips[i].regbase = (void __iomem *)GPIO_BANK(i);
126
127 c->base = gpio;
128 c->label = chips[i].label;
129
130 c->direction_input = pxa_gpio_direction_input;
131 c->direction_output = pxa_gpio_direction_output;
132 c->get = pxa_gpio_get;
133 c->set = pxa_gpio_set;
134
135 /* number of GPIOs on last bank may be less than 32 */
136 c->ngpio = (gpio + 31 > gpio_end) ? (gpio_end - gpio + 1) : 32;
137 gpiochip_add(c);
138 }
139 pxa_gpio_chips = chips;
140 return 0;
141}
142
143/* Update only those GRERx and GFERx edge detection register bits if those
144 * bits are set in c->irq_mask
145 */
146static inline void update_edge_detect(struct pxa_gpio_chip *c)
147{
148 uint32_t grer, gfer;
149
150 grer = __raw_readl(c->regbase + GRER_OFFSET) & ~c->irq_mask;
151 gfer = __raw_readl(c->regbase + GFER_OFFSET) & ~c->irq_mask;
152 grer |= c->irq_edge_rise & c->irq_mask;
153 gfer |= c->irq_edge_fall & c->irq_mask;
154 __raw_writel(grer, c->regbase + GRER_OFFSET);
155 __raw_writel(gfer, c->regbase + GFER_OFFSET);
156}
157
158static int pxa_gpio_irq_type(struct irq_data *d, unsigned int type)
159{
160 struct pxa_gpio_chip *c;
161 int gpio = irq_to_gpio(d->irq);
162 unsigned long gpdr, mask = GPIO_bit(gpio);
163
164 c = gpio_to_pxachip(gpio);
165
166 if (type == IRQ_TYPE_PROBE) {
167 /* Don't mess with enabled GPIOs using preconfigured edges or
168 * GPIOs set to alternate function or to output during probe
169 */
170 if ((c->irq_edge_rise | c->irq_edge_fall) & GPIO_bit(gpio))
171 return 0;
172
173 if (__gpio_is_occupied(gpio))
174 return 0;
175
176 type = IRQ_TYPE_EDGE_RISING | IRQ_TYPE_EDGE_FALLING;
177 }
178
179 gpdr = __raw_readl(c->regbase + GPDR_OFFSET);
180
181 if (__gpio_is_inverted(gpio))
182 __raw_writel(gpdr | mask, c->regbase + GPDR_OFFSET);
183 else
184 __raw_writel(gpdr & ~mask, c->regbase + GPDR_OFFSET);
185
186 if (type & IRQ_TYPE_EDGE_RISING)
187 c->irq_edge_rise |= mask;
188 else
189 c->irq_edge_rise &= ~mask;
190
191 if (type & IRQ_TYPE_EDGE_FALLING)
192 c->irq_edge_fall |= mask;
193 else
194 c->irq_edge_fall &= ~mask;
195
196 update_edge_detect(c);
197
198 pr_debug("%s: IRQ%d (GPIO%d) - edge%s%s\n", __func__, d->irq, gpio,
199 ((type & IRQ_TYPE_EDGE_RISING) ? " rising" : ""),
200 ((type & IRQ_TYPE_EDGE_FALLING) ? " falling" : ""));
201 return 0;
202}
203
204static void pxa_gpio_demux_handler(unsigned int irq, struct irq_desc *desc)
205{
206 struct pxa_gpio_chip *c;
207 int loop, gpio, gpio_base, n;
208 unsigned long gedr;
209
210 do {
211 loop = 0;
212 for_each_gpio_chip(gpio, c) {
213 gpio_base = c->chip.base;
214
215 gedr = __raw_readl(c->regbase + GEDR_OFFSET);
216 gedr = gedr & c->irq_mask;
217 __raw_writel(gedr, c->regbase + GEDR_OFFSET);
218
219 n = find_first_bit(&gedr, BITS_PER_LONG);
220 while (n < BITS_PER_LONG) {
221 loop = 1;
222
223 generic_handle_irq(gpio_to_irq(gpio_base + n));
224 n = find_next_bit(&gedr, BITS_PER_LONG, n + 1);
225 }
226 }
227 } while (loop);
228}
229
230static void pxa_ack_muxed_gpio(struct irq_data *d)
231{
232 int gpio = irq_to_gpio(d->irq);
233 struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
234
235 __raw_writel(GPIO_bit(gpio), c->regbase + GEDR_OFFSET);
236}
237
238static void pxa_mask_muxed_gpio(struct irq_data *d)
239{
240 int gpio = irq_to_gpio(d->irq);
241 struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
242 uint32_t grer, gfer;
243
244 c->irq_mask &= ~GPIO_bit(gpio);
245
246 grer = __raw_readl(c->regbase + GRER_OFFSET) & ~GPIO_bit(gpio);
247 gfer = __raw_readl(c->regbase + GFER_OFFSET) & ~GPIO_bit(gpio);
248 __raw_writel(grer, c->regbase + GRER_OFFSET);
249 __raw_writel(gfer, c->regbase + GFER_OFFSET);
250}
251
252static void pxa_unmask_muxed_gpio(struct irq_data *d)
253{
254 int gpio = irq_to_gpio(d->irq);
255 struct pxa_gpio_chip *c = gpio_to_pxachip(gpio);
256
257 c->irq_mask |= GPIO_bit(gpio);
258 update_edge_detect(c);
259}
260
261static struct irq_chip pxa_muxed_gpio_chip = {
262 .name = "GPIO",
263 .irq_ack = pxa_ack_muxed_gpio,
264 .irq_mask = pxa_mask_muxed_gpio,
265 .irq_unmask = pxa_unmask_muxed_gpio,
266 .irq_set_type = pxa_gpio_irq_type,
267};
268
269void __init pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn)
270{
271 struct pxa_gpio_chip *c;
272 int gpio, irq;
273
274 pxa_last_gpio = end;
275
276 /* Initialize GPIO chips */
277 pxa_init_gpio_chip(end);
278
279 /* clear all GPIO edge detects */
280 for_each_gpio_chip(gpio, c) {
281 __raw_writel(0, c->regbase + GFER_OFFSET);
282 __raw_writel(0, c->regbase + GRER_OFFSET);
283 __raw_writel(~0,c->regbase + GEDR_OFFSET);
284 }
285
286 for (irq = gpio_to_irq(start); irq <= gpio_to_irq(end); irq++) {
287 irq_set_chip_and_handler(irq, &pxa_muxed_gpio_chip,
288 handle_edge_irq);
289 set_irq_flags(irq, IRQF_VALID | IRQF_PROBE);
290 }
291
292 /* Install handler for GPIO>=2 edge detect interrupts */
293 irq_set_chained_handler(mux_irq, pxa_gpio_demux_handler);
294 pxa_muxed_gpio_chip.irq_set_wake = fn;
295}
296
297#ifdef CONFIG_PM
298static int pxa_gpio_suspend(void)
299{
300 struct pxa_gpio_chip *c;
301 int gpio;
302
303 for_each_gpio_chip(gpio, c) {
304 c->saved_gplr = __raw_readl(c->regbase + GPLR_OFFSET);
305 c->saved_gpdr = __raw_readl(c->regbase + GPDR_OFFSET);
306 c->saved_grer = __raw_readl(c->regbase + GRER_OFFSET);
307 c->saved_gfer = __raw_readl(c->regbase + GFER_OFFSET);
308
309 /* Clear GPIO transition detect bits */
310 __raw_writel(0xffffffff, c->regbase + GEDR_OFFSET);
311 }
312 return 0;
313}
314
315static void pxa_gpio_resume(void)
316{
317 struct pxa_gpio_chip *c;
318 int gpio;
319
320 for_each_gpio_chip(gpio, c) {
321 /* restore level with set/clear */
322 __raw_writel( c->saved_gplr, c->regbase + GPSR_OFFSET);
323 __raw_writel(~c->saved_gplr, c->regbase + GPCR_OFFSET);
324
325 __raw_writel(c->saved_grer, c->regbase + GRER_OFFSET);
326 __raw_writel(c->saved_gfer, c->regbase + GFER_OFFSET);
327 __raw_writel(c->saved_gpdr, c->regbase + GPDR_OFFSET);
328 }
329}
330#else
331#define pxa_gpio_suspend NULL
332#define pxa_gpio_resume NULL
333#endif
334
335struct syscore_ops pxa_gpio_syscore_ops = {
336 .suspend = pxa_gpio_suspend,
337 .resume = pxa_gpio_resume,
338};
diff --git a/arch/arm/plat-pxa/include/plat/gpio-pxa.h b/arch/arm/plat-pxa/include/plat/gpio-pxa.h
new file mode 100644
index 000000000000..b6390beff323
--- /dev/null
+++ b/arch/arm/plat-pxa/include/plat/gpio-pxa.h
@@ -0,0 +1,44 @@
1#ifndef __PLAT_PXA_GPIO_H
2#define __PLAT_PXA_GPIO_H
3
4struct irq_data;
5
6/*
7 * We handle the GPIOs by banks, each bank covers up to 32 GPIOs with
8 * one set of registers. The register offsets are organized below:
9 *
10 * GPLR GPDR GPSR GPCR GRER GFER GEDR
11 * BANK 0 - 0x0000 0x000C 0x0018 0x0024 0x0030 0x003C 0x0048
12 * BANK 1 - 0x0004 0x0010 0x001C 0x0028 0x0034 0x0040 0x004C
13 * BANK 2 - 0x0008 0x0014 0x0020 0x002C 0x0038 0x0044 0x0050
14 *
15 * BANK 3 - 0x0100 0x010C 0x0118 0x0124 0x0130 0x013C 0x0148
16 * BANK 4 - 0x0104 0x0110 0x011C 0x0128 0x0134 0x0140 0x014C
17 * BANK 5 - 0x0108 0x0114 0x0120 0x012C 0x0138 0x0144 0x0150
18 *
19 * NOTE:
20 * BANK 3 is only available on PXA27x and later processors.
21 * BANK 4 and 5 are only available on PXA935
22 */
23
24#define GPIO_BANK(n) (GPIO_REGS_VIRT + BANK_OFF(n))
25
26#define GPLR_OFFSET 0x00
27#define GPDR_OFFSET 0x0C
28#define GPSR_OFFSET 0x18
29#define GPCR_OFFSET 0x24
30#define GRER_OFFSET 0x30
31#define GFER_OFFSET 0x3C
32#define GEDR_OFFSET 0x48
33
34/* NOTE: some PXAs have fewer on-chip GPIOs (like PXA255, with 85).
35 * Those cases currently cause holes in the GPIO number space, the
36 * actual number of the last GPIO is recorded by 'pxa_last_gpio'.
37 */
38extern int pxa_last_gpio;
39
40typedef int (*set_wake_t)(struct irq_data *d, unsigned int on);
41
42extern void pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn);
43
44#endif /* __PLAT_PXA_GPIO_H */
diff --git a/arch/arm/plat-pxa/include/plat/gpio.h b/arch/arm/plat-pxa/include/plat/gpio.h
index 1ddd2b97a729..258f77210b02 100644
--- a/arch/arm/plat-pxa/include/plat/gpio.h
+++ b/arch/arm/plat-pxa/include/plat/gpio.h
@@ -1,35 +1,10 @@
1#ifndef __PLAT_GPIO_H 1#ifndef __PLAT_GPIO_H
2#define __PLAT_GPIO_H 2#define __PLAT_GPIO_H
3 3
4struct irq_data; 4#define __ARM_GPIOLIB_COMPLEX
5 5
6/* 6/* The individual machine provides register offsets and NR_BUILTIN_GPIO */
7 * We handle the GPIOs by banks, each bank covers up to 32 GPIOs with 7#include <mach/gpio-pxa.h>
8 * one set of registers. The register offsets are organized below:
9 *
10 * GPLR GPDR GPSR GPCR GRER GFER GEDR
11 * BANK 0 - 0x0000 0x000C 0x0018 0x0024 0x0030 0x003C 0x0048
12 * BANK 1 - 0x0004 0x0010 0x001C 0x0028 0x0034 0x0040 0x004C
13 * BANK 2 - 0x0008 0x0014 0x0020 0x002C 0x0038 0x0044 0x0050
14 *
15 * BANK 3 - 0x0100 0x010C 0x0118 0x0124 0x0130 0x013C 0x0148
16 * BANK 4 - 0x0104 0x0110 0x011C 0x0128 0x0134 0x0140 0x014C
17 * BANK 5 - 0x0108 0x0114 0x0120 0x012C 0x0138 0x0144 0x0150
18 *
19 * NOTE:
20 * BANK 3 is only available on PXA27x and later processors.
21 * BANK 4 and 5 are only available on PXA935
22 */
23
24#define GPIO_BANK(n) (GPIO_REGS_VIRT + BANK_OFF(n))
25
26#define GPLR_OFFSET 0x00
27#define GPDR_OFFSET 0x0C
28#define GPSR_OFFSET 0x18
29#define GPCR_OFFSET 0x24
30#define GRER_OFFSET 0x30
31#define GFER_OFFSET 0x3C
32#define GEDR_OFFSET 0x48
33 8
34static inline int gpio_get_value(unsigned gpio) 9static inline int gpio_get_value(unsigned gpio)
35{ 10{
@@ -52,13 +27,4 @@ static inline void gpio_set_value(unsigned gpio, int value)
52 27
53#define gpio_cansleep __gpio_cansleep 28#define gpio_cansleep __gpio_cansleep
54 29
55/* NOTE: some PXAs have fewer on-chip GPIOs (like PXA255, with 85).
56 * Those cases currently cause holes in the GPIO number space, the
57 * actual number of the last GPIO is recorded by 'pxa_last_gpio'.
58 */
59extern int pxa_last_gpio;
60
61typedef int (*set_wake_t)(struct irq_data *d, unsigned int on);
62
63extern void pxa_init_gpio(int mux_irq, int start, int end, set_wake_t fn);
64#endif /* __PLAT_GPIO_H */ 30#endif /* __PLAT_GPIO_H */
diff --git a/arch/arm/plat-s5p/Kconfig b/arch/arm/plat-s5p/Kconfig
index 9843c954c042..9a197e55f669 100644
--- a/arch/arm/plat-s5p/Kconfig
+++ b/arch/arm/plat-s5p/Kconfig
@@ -22,7 +22,6 @@ config PLAT_S5P
22 select PLAT_SAMSUNG 22 select PLAT_SAMSUNG
23 select SAMSUNG_CLKSRC 23 select SAMSUNG_CLKSRC
24 select SAMSUNG_IRQ_VIC_TIMER 24 select SAMSUNG_IRQ_VIC_TIMER
25 select SAMSUNG_IRQ_UART
26 help 25 help
27 Base platform code for Samsung's S5P series SoC. 26 Base platform code for Samsung's S5P series SoC.
28 27
diff --git a/arch/arm/plat-s5p/dev-uart.c b/arch/arm/plat-s5p/dev-uart.c
index afaf87fdb93e..c9308db36183 100644
--- a/arch/arm/plat-s5p/dev-uart.c
+++ b/arch/arm/plat-s5p/dev-uart.c
@@ -32,20 +32,10 @@ static struct resource s5p_uart0_resource[] = {
32 .flags = IORESOURCE_MEM, 32 .flags = IORESOURCE_MEM,
33 }, 33 },
34 [1] = { 34 [1] = {
35 .start = IRQ_S5P_UART_RX0, 35 .start = IRQ_UART0,
36 .end = IRQ_S5P_UART_RX0, 36 .end = IRQ_UART0,
37 .flags = IORESOURCE_IRQ, 37 .flags = IORESOURCE_IRQ,
38 }, 38 },
39 [2] = {
40 .start = IRQ_S5P_UART_TX0,
41 .end = IRQ_S5P_UART_TX0,
42 .flags = IORESOURCE_IRQ,
43 },
44 [3] = {
45 .start = IRQ_S5P_UART_ERR0,
46 .end = IRQ_S5P_UART_ERR0,
47 .flags = IORESOURCE_IRQ,
48 }
49}; 39};
50 40
51static struct resource s5p_uart1_resource[] = { 41static struct resource s5p_uart1_resource[] = {
@@ -55,18 +45,8 @@ static struct resource s5p_uart1_resource[] = {
55 .flags = IORESOURCE_MEM, 45 .flags = IORESOURCE_MEM,
56 }, 46 },
57 [1] = { 47 [1] = {
58 .start = IRQ_S5P_UART_RX1, 48 .start = IRQ_UART1,
59 .end = IRQ_S5P_UART_RX1, 49 .end = IRQ_UART1,
60 .flags = IORESOURCE_IRQ,
61 },
62 [2] = {
63 .start = IRQ_S5P_UART_TX1,
64 .end = IRQ_S5P_UART_TX1,
65 .flags = IORESOURCE_IRQ,
66 },
67 [3] = {
68 .start = IRQ_S5P_UART_ERR1,
69 .end = IRQ_S5P_UART_ERR1,
70 .flags = IORESOURCE_IRQ, 50 .flags = IORESOURCE_IRQ,
71 }, 51 },
72}; 52};
@@ -78,18 +58,8 @@ static struct resource s5p_uart2_resource[] = {
78 .flags = IORESOURCE_MEM, 58 .flags = IORESOURCE_MEM,
79 }, 59 },
80 [1] = { 60 [1] = {
81 .start = IRQ_S5P_UART_RX2, 61 .start = IRQ_UART2,
82 .end = IRQ_S5P_UART_RX2, 62 .end = IRQ_UART2,
83 .flags = IORESOURCE_IRQ,
84 },
85 [2] = {
86 .start = IRQ_S5P_UART_TX2,
87 .end = IRQ_S5P_UART_TX2,
88 .flags = IORESOURCE_IRQ,
89 },
90 [3] = {
91 .start = IRQ_S5P_UART_ERR2,
92 .end = IRQ_S5P_UART_ERR2,
93 .flags = IORESOURCE_IRQ, 63 .flags = IORESOURCE_IRQ,
94 }, 64 },
95}; 65};
@@ -102,18 +72,8 @@ static struct resource s5p_uart3_resource[] = {
102 .flags = IORESOURCE_MEM, 72 .flags = IORESOURCE_MEM,
103 }, 73 },
104 [1] = { 74 [1] = {
105 .start = IRQ_S5P_UART_RX3, 75 .start = IRQ_UART3,
106 .end = IRQ_S5P_UART_RX3, 76 .end = IRQ_UART3,
107 .flags = IORESOURCE_IRQ,
108 },
109 [2] = {
110 .start = IRQ_S5P_UART_TX3,
111 .end = IRQ_S5P_UART_TX3,
112 .flags = IORESOURCE_IRQ,
113 },
114 [3] = {
115 .start = IRQ_S5P_UART_ERR3,
116 .end = IRQ_S5P_UART_ERR3,
117 .flags = IORESOURCE_IRQ, 77 .flags = IORESOURCE_IRQ,
118 }, 78 },
119#endif 79#endif
@@ -127,18 +87,8 @@ static struct resource s5p_uart4_resource[] = {
127 .flags = IORESOURCE_MEM, 87 .flags = IORESOURCE_MEM,
128 }, 88 },
129 [1] = { 89 [1] = {
130 .start = IRQ_S5P_UART_RX4, 90 .start = IRQ_UART4,
131 .end = IRQ_S5P_UART_RX4, 91 .end = IRQ_UART4,
132 .flags = IORESOURCE_IRQ,
133 },
134 [2] = {
135 .start = IRQ_S5P_UART_TX4,
136 .end = IRQ_S5P_UART_TX4,
137 .flags = IORESOURCE_IRQ,
138 },
139 [3] = {
140 .start = IRQ_S5P_UART_ERR4,
141 .end = IRQ_S5P_UART_ERR4,
142 .flags = IORESOURCE_IRQ, 92 .flags = IORESOURCE_IRQ,
143 }, 93 },
144#endif 94#endif
@@ -152,18 +102,8 @@ static struct resource s5p_uart5_resource[] = {
152 .flags = IORESOURCE_MEM, 102 .flags = IORESOURCE_MEM,
153 }, 103 },
154 [1] = { 104 [1] = {
155 .start = IRQ_S5P_UART_RX5, 105 .start = IRQ_UART5,
156 .end = IRQ_S5P_UART_RX5, 106 .end = IRQ_UART5,
157 .flags = IORESOURCE_IRQ,
158 },
159 [2] = {
160 .start = IRQ_S5P_UART_TX5,
161 .end = IRQ_S5P_UART_TX5,
162 .flags = IORESOURCE_IRQ,
163 },
164 [3] = {
165 .start = IRQ_S5P_UART_ERR5,
166 .end = IRQ_S5P_UART_ERR5,
167 .flags = IORESOURCE_IRQ, 107 .flags = IORESOURCE_IRQ,
168 }, 108 },
169#endif 109#endif
diff --git a/arch/arm/plat-s5p/include/plat/irqs.h b/arch/arm/plat-s5p/include/plat/irqs.h
index ba9121c60a2a..144dbfc6506d 100644
--- a/arch/arm/plat-s5p/include/plat/irqs.h
+++ b/arch/arm/plat-s5p/include/plat/irqs.h
@@ -37,41 +37,6 @@
37#define IRQ_VIC1_BASE S5P_VIC1_BASE 37#define IRQ_VIC1_BASE S5P_VIC1_BASE
38#define IRQ_VIC2_BASE S5P_VIC2_BASE 38#define IRQ_VIC2_BASE S5P_VIC2_BASE
39 39
40/* UART interrupts, each UART has 4 intterupts per channel so
41 * use the space between the ISA and S3C main interrupts. Note, these
42 * are not in the same order as the S3C24XX series! */
43
44#define IRQ_S5P_UART_BASE0 (16)
45#define IRQ_S5P_UART_BASE1 (20)
46#define IRQ_S5P_UART_BASE2 (24)
47#define IRQ_S5P_UART_BASE3 (28)
48
49#define UART_IRQ_RXD (0)
50#define UART_IRQ_ERR (1)
51#define UART_IRQ_TXD (2)
52
53#define IRQ_S5P_UART_RX0 (IRQ_S5P_UART_BASE0 + UART_IRQ_RXD)
54#define IRQ_S5P_UART_TX0 (IRQ_S5P_UART_BASE0 + UART_IRQ_TXD)
55#define IRQ_S5P_UART_ERR0 (IRQ_S5P_UART_BASE0 + UART_IRQ_ERR)
56
57#define IRQ_S5P_UART_RX1 (IRQ_S5P_UART_BASE1 + UART_IRQ_RXD)
58#define IRQ_S5P_UART_TX1 (IRQ_S5P_UART_BASE1 + UART_IRQ_TXD)
59#define IRQ_S5P_UART_ERR1 (IRQ_S5P_UART_BASE1 + UART_IRQ_ERR)
60
61#define IRQ_S5P_UART_RX2 (IRQ_S5P_UART_BASE2 + UART_IRQ_RXD)
62#define IRQ_S5P_UART_TX2 (IRQ_S5P_UART_BASE2 + UART_IRQ_TXD)
63#define IRQ_S5P_UART_ERR2 (IRQ_S5P_UART_BASE2 + UART_IRQ_ERR)
64
65#define IRQ_S5P_UART_RX3 (IRQ_S5P_UART_BASE3 + UART_IRQ_RXD)
66#define IRQ_S5P_UART_TX3 (IRQ_S5P_UART_BASE3 + UART_IRQ_TXD)
67#define IRQ_S5P_UART_ERR3 (IRQ_S5P_UART_BASE3 + UART_IRQ_ERR)
68
69/* S3C compatibilty defines */
70#define IRQ_S3CUART_RX0 IRQ_S5P_UART_RX0
71#define IRQ_S3CUART_RX1 IRQ_S5P_UART_RX1
72#define IRQ_S3CUART_RX2 IRQ_S5P_UART_RX2
73#define IRQ_S3CUART_RX3 IRQ_S5P_UART_RX3
74
75/* VIC based IRQs */ 40/* VIC based IRQs */
76 41
77#define S5P_IRQ_VIC0(x) (S5P_VIC0_BASE + (x)) 42#define S5P_IRQ_VIC0(x) (S5P_VIC0_BASE + (x))
diff --git a/arch/arm/plat-s5p/irq-gpioint.c b/arch/arm/plat-s5p/irq-gpioint.c
index f71078ef6bb5..c65eb791d1bb 100644
--- a/arch/arm/plat-s5p/irq-gpioint.c
+++ b/arch/arm/plat-s5p/irq-gpioint.c
@@ -114,17 +114,18 @@ static __init int s5p_gpioint_add(struct s3c_gpio_chip *chip)
114{ 114{
115 static int used_gpioint_groups = 0; 115 static int used_gpioint_groups = 0;
116 int group = chip->group; 116 int group = chip->group;
117 struct s5p_gpioint_bank *bank = NULL; 117 struct s5p_gpioint_bank *b, *bank = NULL;
118 struct irq_chip_generic *gc; 118 struct irq_chip_generic *gc;
119 struct irq_chip_type *ct; 119 struct irq_chip_type *ct;
120 120
121 if (used_gpioint_groups >= S5P_GPIOINT_GROUP_COUNT) 121 if (used_gpioint_groups >= S5P_GPIOINT_GROUP_COUNT)
122 return -ENOMEM; 122 return -ENOMEM;
123 123
124 list_for_each_entry(bank, &banks, list) { 124 list_for_each_entry(b, &banks, list) {
125 if (group >= bank->start && 125 if (group >= b->start && group < b->start + b->nr_groups) {
126 group < bank->start + bank->nr_groups) 126 bank = b;
127 break; 127 break;
128 }
128 } 129 }
129 if (!bank) 130 if (!bank)
130 return -EINVAL; 131 return -EINVAL;
@@ -162,9 +163,9 @@ static __init int s5p_gpioint_add(struct s3c_gpio_chip *chip)
162 ct->chip.irq_mask = irq_gc_mask_set_bit; 163 ct->chip.irq_mask = irq_gc_mask_set_bit;
163 ct->chip.irq_unmask = irq_gc_mask_clr_bit; 164 ct->chip.irq_unmask = irq_gc_mask_clr_bit;
164 ct->chip.irq_set_type = s5p_gpioint_set_type, 165 ct->chip.irq_set_type = s5p_gpioint_set_type,
165 ct->regs.ack = PEND_OFFSET + REG_OFFSET(chip->group); 166 ct->regs.ack = PEND_OFFSET + REG_OFFSET(group - bank->start);
166 ct->regs.mask = MASK_OFFSET + REG_OFFSET(chip->group); 167 ct->regs.mask = MASK_OFFSET + REG_OFFSET(group - bank->start);
167 ct->regs.type = CON_OFFSET + REG_OFFSET(chip->group); 168 ct->regs.type = CON_OFFSET + REG_OFFSET(group - bank->start);
168 irq_setup_generic_chip(gc, IRQ_MSK(chip->chip.ngpio), 169 irq_setup_generic_chip(gc, IRQ_MSK(chip->chip.ngpio),
169 IRQ_GC_INIT_MASK_CACHE, 170 IRQ_GC_INIT_MASK_CACHE,
170 IRQ_NOREQUEST | IRQ_NOPROBE, 0); 171 IRQ_NOREQUEST | IRQ_NOPROBE, 0);
diff --git a/arch/arm/plat-s5p/irq.c b/arch/arm/plat-s5p/irq.c
index a97c08957f49..afdaa1082b9f 100644
--- a/arch/arm/plat-s5p/irq.c
+++ b/arch/arm/plat-s5p/irq.c
@@ -17,42 +17,10 @@
17 17
18#include <asm/hardware/vic.h> 18#include <asm/hardware/vic.h>
19 19
20#include <linux/serial_core.h>
21#include <mach/map.h> 20#include <mach/map.h>
22#include <plat/regs-timer.h> 21#include <plat/regs-timer.h>
23#include <plat/regs-serial.h>
24#include <plat/cpu.h> 22#include <plat/cpu.h>
25#include <plat/irq-vic-timer.h> 23#include <plat/irq-vic-timer.h>
26#include <plat/irq-uart.h>
27
28/*
29 * Note, we make use of the fact that the parent IRQs, IRQ_UART[0..3]
30 * are consecutive when looking up the interrupt in the demux routines.
31 */
32static struct s3c_uart_irq uart_irqs[] = {
33 [0] = {
34 .regs = S5P_VA_UART0,
35 .base_irq = IRQ_S5P_UART_BASE0,
36 .parent_irq = IRQ_UART0,
37 },
38 [1] = {
39 .regs = S5P_VA_UART1,
40 .base_irq = IRQ_S5P_UART_BASE1,
41 .parent_irq = IRQ_UART1,
42 },
43 [2] = {
44 .regs = S5P_VA_UART2,
45 .base_irq = IRQ_S5P_UART_BASE2,
46 .parent_irq = IRQ_UART2,
47 },
48#if CONFIG_SERIAL_SAMSUNG_UARTS > 3
49 [3] = {
50 .regs = S5P_VA_UART3,
51 .base_irq = IRQ_S5P_UART_BASE3,
52 .parent_irq = IRQ_UART3,
53 },
54#endif
55};
56 24
57void __init s5p_init_irq(u32 *vic, u32 num_vic) 25void __init s5p_init_irq(u32 *vic, u32 num_vic)
58{ 26{
@@ -65,6 +33,4 @@ void __init s5p_init_irq(u32 *vic, u32 num_vic)
65#endif 33#endif
66 34
67 s3c_init_vic_timer_irq(5, IRQ_TIMER0); 35 s3c_init_vic_timer_irq(5, IRQ_TIMER0);
68
69 s3c_init_uart_irqs(uart_irqs, ARRAY_SIZE(uart_irqs));
70} 36}
diff --git a/arch/arm/plat-samsung/Kconfig b/arch/arm/plat-samsung/Kconfig
index b3e10659e4b8..dffa37bc4a0b 100644
--- a/arch/arm/plat-samsung/Kconfig
+++ b/arch/arm/plat-samsung/Kconfig
@@ -65,11 +65,6 @@ config SAMSUNG_IRQ_VIC_TIMER
65 help 65 help
66 Internal configuration to build the VIC timer interrupt code. 66 Internal configuration to build the VIC timer interrupt code.
67 67
68config SAMSUNG_IRQ_UART
69 bool
70 help
71 Internal configuration to build the IRQ UART demux code.
72
73# options for gpio configuration support 68# options for gpio configuration support
74 69
75config SAMSUNG_GPIOLIB_4BIT 70config SAMSUNG_GPIOLIB_4BIT
diff --git a/arch/arm/plat-samsung/Makefile b/arch/arm/plat-samsung/Makefile
index 853764ba8cc5..1105922342fe 100644
--- a/arch/arm/plat-samsung/Makefile
+++ b/arch/arm/plat-samsung/Makefile
@@ -21,7 +21,6 @@ obj-y += dev-asocdma.o
21 21
22obj-$(CONFIG_SAMSUNG_CLKSRC) += clock-clksrc.o 22obj-$(CONFIG_SAMSUNG_CLKSRC) += clock-clksrc.o
23 23
24obj-$(CONFIG_SAMSUNG_IRQ_UART) += irq-uart.o
25obj-$(CONFIG_SAMSUNG_IRQ_VIC_TIMER) += irq-vic-timer.o 24obj-$(CONFIG_SAMSUNG_IRQ_VIC_TIMER) += irq-vic-timer.o
26 25
27# ADC 26# ADC
diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c
index 302c42670bd1..3b4451979d1b 100644
--- a/arch/arm/plat-samsung/clock.c
+++ b/arch/arm/plat-samsung/clock.c
@@ -64,6 +64,17 @@ static LIST_HEAD(clocks);
64 */ 64 */
65DEFINE_SPINLOCK(clocks_lock); 65DEFINE_SPINLOCK(clocks_lock);
66 66
67/* Global watchdog clock used by arch_wtd_reset() callback */
68struct clk *s3c2410_wdtclk;
69static int __init s3c_wdt_reset_init(void)
70{
71 s3c2410_wdtclk = clk_get(NULL, "watchdog");
72 if (IS_ERR(s3c2410_wdtclk))
73 printk(KERN_WARNING "%s: warning: cannot get watchdog clock\n", __func__);
74 return 0;
75}
76arch_initcall(s3c_wdt_reset_init);
77
67/* enable and disable calls for use with the clk struct */ 78/* enable and disable calls for use with the clk struct */
68 79
69static int clk_null_enable(struct clk *clk, int enable) 80static int clk_null_enable(struct clk *clk, int enable)
diff --git a/arch/arm/plat-samsung/include/plat/clock.h b/arch/arm/plat-samsung/include/plat/clock.h
index 87d5b38a86fb..73c66d4d10fa 100644
--- a/arch/arm/plat-samsung/include/plat/clock.h
+++ b/arch/arm/plat-samsung/include/plat/clock.h
@@ -9,6 +9,9 @@
9 * published by the Free Software Foundation. 9 * published by the Free Software Foundation.
10*/ 10*/
11 11
12#ifndef __ASM_PLAT_CLOCK_H
13#define __ASM_PLAT_CLOCK_H __FILE__
14
12#include <linux/spinlock.h> 15#include <linux/spinlock.h>
13#include <linux/clkdev.h> 16#include <linux/clkdev.h>
14 17
@@ -121,3 +124,8 @@ extern int s3c64xx_sclk_ctrl(struct clk *clk, int enable);
121 124
122extern void s3c_pwmclk_init(void); 125extern void s3c_pwmclk_init(void);
123 126
127/* Global watchdog clock used by arch_wtd_reset() callback */
128
129extern struct clk *s3c2410_wdtclk;
130
131#endif /* __ASM_PLAT_CLOCK_H */
diff --git a/arch/arm/plat-samsung/include/plat/regs-serial.h b/arch/arm/plat-samsung/include/plat/regs-serial.h
index bac36fa3becb..720734847027 100644
--- a/arch/arm/plat-samsung/include/plat/regs-serial.h
+++ b/arch/arm/plat-samsung/include/plat/regs-serial.h
@@ -186,6 +186,11 @@
186#define S3C64XX_UINTSP 0x34 186#define S3C64XX_UINTSP 0x34
187#define S3C64XX_UINTM 0x38 187#define S3C64XX_UINTM 0x38
188 188
189#define S3C64XX_UINTM_RXD (0)
190#define S3C64XX_UINTM_TXD (2)
191#define S3C64XX_UINTM_RXD_MSK (1 << S3C64XX_UINTM_RXD)
192#define S3C64XX_UINTM_TXD_MSK (1 << S3C64XX_UINTM_TXD)
193
189/* Following are specific to S5PV210 */ 194/* Following are specific to S5PV210 */
190#define S5PV210_UCON_CLKMASK (1<<10) 195#define S5PV210_UCON_CLKMASK (1<<10)
191#define S5PV210_UCON_PCLK (0<<10) 196#define S5PV210_UCON_PCLK (0<<10)
diff --git a/arch/arm/plat-samsung/include/plat/watchdog-reset.h b/arch/arm/plat-samsung/include/plat/watchdog-reset.h
index 54b762acb5a0..40dbb2b0ae22 100644
--- a/arch/arm/plat-samsung/include/plat/watchdog-reset.h
+++ b/arch/arm/plat-samsung/include/plat/watchdog-reset.h
@@ -10,6 +10,7 @@
10 * published by the Free Software Foundation. 10 * published by the Free Software Foundation.
11*/ 11*/
12 12
13#include <plat/clock.h>
13#include <plat/regs-watchdog.h> 14#include <plat/regs-watchdog.h>
14#include <mach/map.h> 15#include <mach/map.h>
15 16
@@ -19,17 +20,12 @@
19 20
20static inline void arch_wdt_reset(void) 21static inline void arch_wdt_reset(void)
21{ 22{
22 struct clk *wdtclk;
23
24 printk("arch_reset: attempting watchdog reset\n"); 23 printk("arch_reset: attempting watchdog reset\n");
25 24
26 __raw_writel(0, S3C2410_WTCON); /* disable watchdog, to be safe */ 25 __raw_writel(0, S3C2410_WTCON); /* disable watchdog, to be safe */
27 26
28 wdtclk = clk_get(NULL, "watchdog"); 27 if (s3c2410_wdtclk)
29 if (!IS_ERR(wdtclk)) { 28 clk_enable(s3c2410_wdtclk);
30 clk_enable(wdtclk);
31 } else
32 printk(KERN_WARNING "%s: warning: cannot get watchdog clock\n", __func__);
33 29
34 /* put initial values into count and data */ 30 /* put initial values into count and data */
35 __raw_writel(0x80, S3C2410_WTCNT); 31 __raw_writel(0x80, S3C2410_WTCNT);
diff --git a/arch/arm/plat-samsung/irq-uart.c b/arch/arm/plat-samsung/irq-uart.c
deleted file mode 100644
index 3014c7226bd1..000000000000
--- a/arch/arm/plat-samsung/irq-uart.c
+++ /dev/null
@@ -1,96 +0,0 @@
1/* arch/arm/plat-samsung/irq-uart.c
2 * originally part of arch/arm/plat-s3c64xx/irq.c
3 *
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 * Samsung- UART Interrupt handling
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as
13 * published by the Free Software Foundation.
14 */
15
16#include <linux/kernel.h>
17#include <linux/interrupt.h>
18#include <linux/serial_core.h>
19#include <linux/irq.h>
20#include <linux/io.h>
21
22#include <asm/mach/irq.h>
23
24#include <mach/map.h>
25#include <plat/irq-uart.h>
26#include <plat/regs-serial.h>
27#include <plat/cpu.h>
28
29/* Note, we make use of the fact that the parent IRQs, IRQ_UART[0..3]
30 * are consecutive when looking up the interrupt in the demux routines.
31 */
32static void s3c_irq_demux_uart(unsigned int irq, struct irq_desc *desc)
33{
34 struct s3c_uart_irq *uirq = desc->irq_data.handler_data;
35 struct irq_chip *chip = irq_get_chip(irq);
36 u32 pend = __raw_readl(uirq->regs + S3C64XX_UINTP);
37 int base = uirq->base_irq;
38
39 chained_irq_enter(chip, desc);
40
41 if (pend & (1 << 0))
42 generic_handle_irq(base);
43 if (pend & (1 << 1))
44 generic_handle_irq(base + 1);
45 if (pend & (1 << 2))
46 generic_handle_irq(base + 2);
47 if (pend & (1 << 3))
48 generic_handle_irq(base + 3);
49
50 chained_irq_exit(chip, desc);
51}
52
53static void __init s3c_init_uart_irq(struct s3c_uart_irq *uirq)
54{
55 void __iomem *reg_base = uirq->regs;
56 struct irq_chip_generic *gc;
57 struct irq_chip_type *ct;
58
59 /* mask all interrupts at the start. */
60 __raw_writel(0xf, reg_base + S3C64XX_UINTM);
61
62 gc = irq_alloc_generic_chip("s3c-uart", 1, uirq->base_irq, reg_base,
63 handle_level_irq);
64
65 if (!gc) {
66 pr_err("%s: irq_alloc_generic_chip for IRQ %u failed\n",
67 __func__, uirq->base_irq);
68 return;
69 }
70
71 ct = gc->chip_types;
72 ct->chip.irq_ack = irq_gc_ack_set_bit;
73 ct->chip.irq_mask = irq_gc_mask_set_bit;
74 ct->chip.irq_unmask = irq_gc_mask_clr_bit;
75 ct->regs.ack = S3C64XX_UINTP;
76 ct->regs.mask = S3C64XX_UINTM;
77 irq_setup_generic_chip(gc, IRQ_MSK(4), IRQ_GC_INIT_MASK_CACHE,
78 IRQ_NOREQUEST | IRQ_NOPROBE, 0);
79
80 irq_set_handler_data(uirq->parent_irq, uirq);
81 irq_set_chained_handler(uirq->parent_irq, s3c_irq_demux_uart);
82}
83
84/**
85 * s3c_init_uart_irqs() - initialise UART IRQs and the necessary demuxing
86 * @irq: The interrupt data for registering
87 * @nr_irqs: The number of interrupt descriptions in @irq.
88 *
89 * Register the UART interrupts specified by @irq including the demuxing
90 * routines. This supports the S3C6400 and newer style of devices.
91 */
92void __init s3c_init_uart_irqs(struct s3c_uart_irq *irq, unsigned int nr_irqs)
93{
94 for (; nr_irqs > 0; nr_irqs--, irq++)
95 s3c_init_uart_irq(irq);
96}
diff --git a/arch/arm/plat-spear/include/plat/gpio.h b/arch/arm/plat-spear/include/plat/gpio.h
index b857c91257dd..40a8c178f10d 100644
--- a/arch/arm/plat-spear/include/plat/gpio.h
+++ b/arch/arm/plat-spear/include/plat/gpio.h
@@ -1,24 +1 @@
1/* /* empty */
2 * arch/arm/plat-spear/include/plat/gpio.h
3 *
4 * GPIO macros for SPEAr platform
5 *
6 * Copyright (C) 2009 ST Microelectronics
7 * Viresh Kumar<viresh.kumar@st.com>
8 *
9 * This file is licensed under the terms of the GNU General Public
10 * License version 2. This program is licensed "as is" without any
11 * warranty of any kind, whether express or implied.
12 */
13
14#ifndef __PLAT_GPIO_H
15#define __PLAT_GPIO_H
16
17#include <asm-generic/gpio.h>
18
19#define gpio_get_value __gpio_get_value
20#define gpio_set_value __gpio_set_value
21#define gpio_cansleep __gpio_cansleep
22#define gpio_to_irq __gpio_to_irq
23
24#endif /* __PLAT_GPIO_H */
diff --git a/arch/arm/tools/mach-types b/arch/arm/tools/mach-types
index 62cc8f981171..5bdeef969847 100644
--- a/arch/arm/tools/mach-types
+++ b/arch/arm/tools/mach-types
@@ -12,10 +12,9 @@
12# 12#
13# http://www.arm.linux.org.uk/developer/machines/?action=new 13# http://www.arm.linux.org.uk/developer/machines/?action=new
14# 14#
15# XXX: This is a cut-down version of the file; it contains only machines that 15# This is a cut-down version of the file; it contains only machines that
16# XXX: are in mainline or have been submitted to the machine database within 16# are merged into mainline or have been edited in the machine database
17# XXX: the last 12 months. If your entry is missing please email rmk at 17# within the last 12 months. References to machine_is_NAME() do not count!
18# XXX: <linux@arm.linux.org.uk>
19# 18#
20# Last update: Sat May 7 08:48:24 2011 19# Last update: Sat May 7 08:48:24 2011
21# 20#
@@ -65,6 +64,7 @@ h7201 ARCH_H7201 H7201 161
65h7202 ARCH_H7202 H7202 162 64h7202 ARCH_H7202 H7202 162
66iq80321 ARCH_IQ80321 IQ80321 169 65iq80321 ARCH_IQ80321 IQ80321 169
67ks8695 ARCH_KS8695 KS8695 180 66ks8695 ARCH_KS8695 KS8695 180
67karo ARCH_KARO KARO 190
68smdk2410 ARCH_SMDK2410 SMDK2410 193 68smdk2410 ARCH_SMDK2410 SMDK2410 193
69ceiva ARCH_CEIVA CEIVA 200 69ceiva ARCH_CEIVA CEIVA 200
70voiceblue MACH_VOICEBLUE VOICEBLUE 218 70voiceblue MACH_VOICEBLUE VOICEBLUE 218
@@ -188,6 +188,7 @@ omap_2430sdp MACH_OMAP_2430SDP OMAP_2430SDP 900
188davinci_evm MACH_DAVINCI_EVM DAVINCI_EVM 901 188davinci_evm MACH_DAVINCI_EVM DAVINCI_EVM 901
189palmz72 MACH_PALMZ72 PALMZ72 904 189palmz72 MACH_PALMZ72 PALMZ72 904
190nxdb500 MACH_NXDB500 NXDB500 905 190nxdb500 MACH_NXDB500 NXDB500 905
191apf9328 MACH_APF9328 APF9328 906
191palmt5 MACH_PALMT5 PALMT5 917 192palmt5 MACH_PALMT5 PALMT5 917
192palmtc MACH_PALMTC PALMTC 918 193palmtc MACH_PALMTC PALMTC 918
193omap_apollon MACH_OMAP_APOLLON OMAP_APOLLON 919 194omap_apollon MACH_OMAP_APOLLON OMAP_APOLLON 919
@@ -271,10 +272,12 @@ pcm038 MACH_PCM038 PCM038 1551
271ts_x09 MACH_TS209 TS209 1565 272ts_x09 MACH_TS209 TS209 1565
272at91cap9adk MACH_AT91CAP9ADK AT91CAP9ADK 1566 273at91cap9adk MACH_AT91CAP9ADK AT91CAP9ADK 1566
273mx31moboard MACH_MX31MOBOARD MX31MOBOARD 1574 274mx31moboard MACH_MX31MOBOARD MX31MOBOARD 1574
275vision_ep9307 MACH_VISION_EP9307 VISION_EP9307 1578
274terastation_pro2 MACH_TERASTATION_PRO2 TERASTATION_PRO2 1584 276terastation_pro2 MACH_TERASTATION_PRO2 TERASTATION_PRO2 1584
275linkstation_pro MACH_LINKSTATION_PRO LINKSTATION_PRO 1585 277linkstation_pro MACH_LINKSTATION_PRO LINKSTATION_PRO 1585
276e350 MACH_E350 E350 1596 278e350 MACH_E350 E350 1596
277ts409 MACH_TS409 TS409 1601 279ts409 MACH_TS409 TS409 1601
280rsi_ews MACH_RSI_EWS RSI_EWS 1609
278cm_x300 MACH_CM_X300 CM_X300 1616 281cm_x300 MACH_CM_X300 CM_X300 1616
279at91sam9g20ek MACH_AT91SAM9G20EK AT91SAM9G20EK 1624 282at91sam9g20ek MACH_AT91SAM9G20EK AT91SAM9G20EK 1624
280smdk6410 MACH_SMDK6410 SMDK6410 1626 283smdk6410 MACH_SMDK6410 SMDK6410 1626
@@ -331,6 +334,7 @@ smdkc100 MACH_SMDKC100 SMDKC100 1826
331tavorevb MACH_TAVOREVB TAVOREVB 1827 334tavorevb MACH_TAVOREVB TAVOREVB 1827
332saar MACH_SAAR SAAR 1828 335saar MACH_SAAR SAAR 1828
333at91sam9m10g45ek MACH_AT91SAM9M10G45EK AT91SAM9M10G45EK 1830 336at91sam9m10g45ek MACH_AT91SAM9M10G45EK AT91SAM9M10G45EK 1830
337usb_a9g20 MACH_USB_A9G20 USB_A9G20 1841
334mxlads MACH_MXLADS MXLADS 1851 338mxlads MACH_MXLADS MXLADS 1851
335linkstation_mini MACH_LINKSTATION_MINI LINKSTATION_MINI 1858 339linkstation_mini MACH_LINKSTATION_MINI LINKSTATION_MINI 1858
336afeb9260 MACH_AFEB9260 AFEB9260 1859 340afeb9260 MACH_AFEB9260 AFEB9260 1859
@@ -369,6 +373,7 @@ pcm043 MACH_PCM043 PCM043 2072
369sheevaplug MACH_SHEEVAPLUG SHEEVAPLUG 2097 373sheevaplug MACH_SHEEVAPLUG SHEEVAPLUG 2097
370avengers_lite MACH_AVENGERS_LITE AVENGERS_LITE 2104 374avengers_lite MACH_AVENGERS_LITE AVENGERS_LITE 2104
371mx51_babbage MACH_MX51_BABBAGE MX51_BABBAGE 2125 375mx51_babbage MACH_MX51_BABBAGE MX51_BABBAGE 2125
376tx37 MACH_TX37 TX37 2127
372rd78x00_masa MACH_RD78X00_MASA RD78X00_MASA 2135 377rd78x00_masa MACH_RD78X00_MASA RD78X00_MASA 2135
373dm355_leopard MACH_DM355_LEOPARD DM355_LEOPARD 2138 378dm355_leopard MACH_DM355_LEOPARD DM355_LEOPARD 2138
374ts219 MACH_TS219 TS219 2139 379ts219 MACH_TS219 TS219 2139
@@ -379,6 +384,7 @@ omap_4430sdp MACH_OMAP_4430SDP OMAP_4430SDP 2160
379magx_zn5 MACH_MAGX_ZN5 MAGX_ZN5 2162 384magx_zn5 MACH_MAGX_ZN5 MAGX_ZN5 2162
380btmavb101 MACH_BTMAVB101 BTMAVB101 2172 385btmavb101 MACH_BTMAVB101 BTMAVB101 2172
381btmawb101 MACH_BTMAWB101 BTMAWB101 2173 386btmawb101 MACH_BTMAWB101 BTMAWB101 2173
387tx25 MACH_TX25 TX25 2177
382omap3_torpedo MACH_OMAP3_TORPEDO OMAP3_TORPEDO 2178 388omap3_torpedo MACH_OMAP3_TORPEDO OMAP3_TORPEDO 2178
383anw6410 MACH_ANW6410 ANW6410 2183 389anw6410 MACH_ANW6410 ANW6410 2183
384imx27_visstrim_m10 MACH_IMX27_VISSTRIM_M10 IMX27_VISSTRIM_M10 2187 390imx27_visstrim_m10 MACH_IMX27_VISSTRIM_M10 IMX27_VISSTRIM_M10 2187
@@ -423,6 +429,7 @@ raumfeld_rc MACH_RAUMFELD_RC RAUMFELD_RC 2413
423raumfeld_connector MACH_RAUMFELD_CONNECTOR RAUMFELD_CONNECTOR 2414 429raumfeld_connector MACH_RAUMFELD_CONNECTOR RAUMFELD_CONNECTOR 2414
424raumfeld_speaker MACH_RAUMFELD_SPEAKER RAUMFELD_SPEAKER 2415 430raumfeld_speaker MACH_RAUMFELD_SPEAKER RAUMFELD_SPEAKER 2415
425tnetv107x MACH_TNETV107X TNETV107X 2418 431tnetv107x MACH_TNETV107X TNETV107X 2418
432mx51_m2id MACH_MX51_M2ID MX51_M2ID 2428
426smdkv210 MACH_SMDKV210 SMDKV210 2456 433smdkv210 MACH_SMDKV210 SMDKV210 2456
427omap_zoom3 MACH_OMAP_ZOOM3 OMAP_ZOOM3 2464 434omap_zoom3 MACH_OMAP_ZOOM3 OMAP_ZOOM3 2464
428omap_3630sdp MACH_OMAP_3630SDP OMAP_3630SDP 2465 435omap_3630sdp MACH_OMAP_3630SDP OMAP_3630SDP 2465
@@ -433,14 +440,17 @@ omapl138_hawkboard MACH_OMAPL138_HAWKBOARD OMAPL138_HAWKBOARD 2495
433ts41x MACH_TS41X TS41X 2502 440ts41x MACH_TS41X TS41X 2502
434phy3250 MACH_PHY3250 PHY3250 2511 441phy3250 MACH_PHY3250 PHY3250 2511
435mini6410 MACH_MINI6410 MINI6410 2520 442mini6410 MACH_MINI6410 MINI6410 2520
443tx51 MACH_TX51 TX51 2529
436mx28evk MACH_MX28EVK MX28EVK 2531 444mx28evk MACH_MX28EVK MX28EVK 2531
437smartq5 MACH_SMARTQ5 SMARTQ5 2534 445smartq5 MACH_SMARTQ5 SMARTQ5 2534
438davinci_dm6467tevm MACH_DAVINCI_DM6467TEVM DAVINCI_DM6467TEVM 2548 446davinci_dm6467tevm MACH_DAVINCI_DM6467TEVM DAVINCI_DM6467TEVM 2548
439mxt_td60 MACH_MXT_TD60 MXT_TD60 2550 447mxt_td60 MACH_MXT_TD60 MXT_TD60 2550
440riot_bei2 MACH_RIOT_BEI2 RIOT_BEI2 2576 448riot_bei2 MACH_RIOT_BEI2 RIOT_BEI2 2576
441riot_x37 MACH_RIOT_X37 RIOT_X37 2578 449riot_x37 MACH_RIOT_X37 RIOT_X37 2578
450pca101 MACH_PCA101 PCA101 2595
442capc7117 MACH_CAPC7117 CAPC7117 2612 451capc7117 MACH_CAPC7117 CAPC7117 2612
443icontrol MACH_ICONTROL ICONTROL 2624 452icontrol MACH_ICONTROL ICONTROL 2624
453gplugd MACH_GPLUGD GPLUGD 2625
444qsd8x50a_st1_5 MACH_QSD8X50A_ST1_5 QSD8X50A_ST1_5 2627 454qsd8x50a_st1_5 MACH_QSD8X50A_ST1_5 QSD8X50A_ST1_5 2627
445mx23evk MACH_MX23EVK MX23EVK 2629 455mx23evk MACH_MX23EVK MX23EVK 2629
446ap4evb MACH_AP4EVB AP4EVB 2630 456ap4evb MACH_AP4EVB AP4EVB 2630
@@ -1113,3 +1123,5 @@ blissc MACH_BLISSC BLISSC 3491
1113thales_adc MACH_THALES_ADC THALES_ADC 3492 1123thales_adc MACH_THALES_ADC THALES_ADC 3492
1114ubisys_p9d_evp MACH_UBISYS_P9D_EVP UBISYS_P9D_EVP 3493 1124ubisys_p9d_evp MACH_UBISYS_P9D_EVP UBISYS_P9D_EVP 3493
1115atdgp318 MACH_ATDGP318 ATDGP318 3494 1125atdgp318 MACH_ATDGP318 ATDGP318 3494
1126smdk4212 MACH_SMDK4212 SMDK4212 3638
1127smdk4412 MACH_SMDK4412 SMDK4412 3765
diff --git a/arch/arm/vfp/Makefile b/arch/arm/vfp/Makefile
index 6de73aab0195..a81404c09d5d 100644
--- a/arch/arm/vfp/Makefile
+++ b/arch/arm/vfp/Makefile
@@ -7,7 +7,7 @@
7# ccflags-y := -DDEBUG 7# ccflags-y := -DDEBUG
8# asflags-y := -DDEBUG 8# asflags-y := -DDEBUG
9 9
10KBUILD_AFLAGS :=$(KBUILD_AFLAGS:-msoft-float=-Wa,-mfpu=softvfp+vfp) 10KBUILD_AFLAGS :=$(KBUILD_AFLAGS:-msoft-float=-Wa,-mfpu=softvfp+vfp -mfloat-abi=soft)
11LDFLAGS +=--no-warn-mismatch 11LDFLAGS +=--no-warn-mismatch
12 12
13obj-y += vfp.o 13obj-y += vfp.o
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index c7476295de80..abe5a9e85148 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -248,10 +248,6 @@ config HOTPLUG_CPU
248 depends on SMP && HOTPLUG 248 depends on SMP && HOTPLUG
249 default y 249 default y
250 250
251config HAVE_LEGACY_PER_CPU_AREA
252 def_bool y
253 depends on SMP
254
255config BF_REV_MIN 251config BF_REV_MIN
256 int 252 int
257 default 0 if (BF51x || BF52x || (BF54x && !BF54xM)) 253 default 0 if (BF51x || BF52x || (BF54x && !BF54xM))
diff --git a/arch/blackfin/configs/BF548-EZKIT_defconfig b/arch/blackfin/configs/BF548-EZKIT_defconfig
index 56151b5dbc44..0e6d841b5d01 100644
--- a/arch/blackfin/configs/BF548-EZKIT_defconfig
+++ b/arch/blackfin/configs/BF548-EZKIT_defconfig
@@ -4,7 +4,6 @@ CONFIG_IKCONFIG=y
4CONFIG_IKCONFIG_PROC=y 4CONFIG_IKCONFIG_PROC=y
5CONFIG_LOG_BUF_SHIFT=14 5CONFIG_LOG_BUF_SHIFT=14
6CONFIG_BLK_DEV_INITRD=y 6CONFIG_BLK_DEV_INITRD=y
7# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
8CONFIG_EXPERT=y 7CONFIG_EXPERT=y
9# CONFIG_SYSCTL_SYSCALL is not set 8# CONFIG_SYSCTL_SYSCALL is not set
10# CONFIG_ELF_CORE is not set 9# CONFIG_ELF_CORE is not set
@@ -40,7 +39,6 @@ CONFIG_EBIU_MODEVAL=0x1
40CONFIG_EBIU_FCTLVAL=0x6 39CONFIG_EBIU_FCTLVAL=0x6
41CONFIG_BINFMT_FLAT=y 40CONFIG_BINFMT_FLAT=y
42CONFIG_BINFMT_ZFLAT=y 41CONFIG_BINFMT_ZFLAT=y
43CONFIG_PM=y
44CONFIG_NET=y 42CONFIG_NET=y
45CONFIG_PACKET=y 43CONFIG_PACKET=y
46CONFIG_UNIX=y 44CONFIG_UNIX=y
@@ -55,7 +53,6 @@ CONFIG_IP_PNP=y
55CONFIG_CAN=m 53CONFIG_CAN=m
56CONFIG_CAN_RAW=m 54CONFIG_CAN_RAW=m
57CONFIG_CAN_BCM=m 55CONFIG_CAN_BCM=m
58CONFIG_CAN_DEV=m
59CONFIG_CAN_BFIN=m 56CONFIG_CAN_BFIN=m
60CONFIG_IRDA=m 57CONFIG_IRDA=m
61CONFIG_IRLAN=m 58CONFIG_IRLAN=m
@@ -67,7 +64,6 @@ CONFIG_BFIN_SIR3=y
67CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 64CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
68CONFIG_FW_LOADER=m 65CONFIG_FW_LOADER=m
69CONFIG_MTD=y 66CONFIG_MTD=y
70CONFIG_MTD_PARTITIONS=y
71CONFIG_MTD_CMDLINE_PARTS=y 67CONFIG_MTD_CMDLINE_PARTS=y
72CONFIG_MTD_CHAR=y 68CONFIG_MTD_CHAR=y
73CONFIG_MTD_BLOCK=y 69CONFIG_MTD_BLOCK=y
@@ -105,12 +101,12 @@ CONFIG_INPUT_TOUCHSCREEN=y
105CONFIG_TOUCHSCREEN_AD7877=m 101CONFIG_TOUCHSCREEN_AD7877=m
106CONFIG_INPUT_MISC=y 102CONFIG_INPUT_MISC=y
107# CONFIG_SERIO is not set 103# CONFIG_SERIO is not set
108# CONFIG_DEVKMEM is not set 104# CONFIG_LEGACY_PTYS is not set
109CONFIG_BFIN_JTAG_COMM=m 105CONFIG_BFIN_JTAG_COMM=m
106# CONFIG_DEVKMEM is not set
110CONFIG_SERIAL_BFIN=y 107CONFIG_SERIAL_BFIN=y
111CONFIG_SERIAL_BFIN_CONSOLE=y 108CONFIG_SERIAL_BFIN_CONSOLE=y
112CONFIG_SERIAL_BFIN_UART1=y 109CONFIG_SERIAL_BFIN_UART1=y
113# CONFIG_LEGACY_PTYS is not set
114# CONFIG_HW_RANDOM is not set 110# CONFIG_HW_RANDOM is not set
115CONFIG_I2C=y 111CONFIG_I2C=y
116CONFIG_I2C_CHARDEV=y 112CONFIG_I2C_CHARDEV=y
@@ -163,6 +159,7 @@ CONFIG_USB_DEVICEFS=y
163CONFIG_USB_OTG_BLACKLIST_HUB=y 159CONFIG_USB_OTG_BLACKLIST_HUB=y
164CONFIG_USB_MON=y 160CONFIG_USB_MON=y
165CONFIG_USB_MUSB_HDRC=y 161CONFIG_USB_MUSB_HDRC=y
162CONFIG_USB_MUSB_BLACKFIN=y
166CONFIG_USB_STORAGE=y 163CONFIG_USB_STORAGE=y
167CONFIG_MMC=y 164CONFIG_MMC=y
168CONFIG_MMC_BLOCK=m 165CONFIG_MMC_BLOCK=m
@@ -185,8 +182,6 @@ CONFIG_NFS_FS=m
185CONFIG_NFS_V3=y 182CONFIG_NFS_V3=y
186CONFIG_NFSD=m 183CONFIG_NFSD=m
187CONFIG_NFSD_V3=y 184CONFIG_NFSD_V3=y
188CONFIG_SMB_FS=m
189CONFIG_SMB_NLS_DEFAULT=y
190CONFIG_CIFS=y 185CONFIG_CIFS=y
191CONFIG_NLS_CODEPAGE_437=m 186CONFIG_NLS_CODEPAGE_437=m
192CONFIG_NLS_CODEPAGE_936=m 187CONFIG_NLS_CODEPAGE_936=m
@@ -196,7 +191,6 @@ CONFIG_DEBUG_KERNEL=y
196CONFIG_DEBUG_SHIRQ=y 191CONFIG_DEBUG_SHIRQ=y
197CONFIG_DETECT_HUNG_TASK=y 192CONFIG_DETECT_HUNG_TASK=y
198CONFIG_DEBUG_INFO=y 193CONFIG_DEBUG_INFO=y
199# CONFIG_RCU_CPU_STALL_DETECTOR is not set
200# CONFIG_FTRACE is not set 194# CONFIG_FTRACE is not set
201CONFIG_DEBUG_MMRS=y 195CONFIG_DEBUG_MMRS=y
202CONFIG_DEBUG_HWERR=y 196CONFIG_DEBUG_HWERR=y
@@ -206,5 +200,4 @@ CONFIG_DEBUG_BFIN_HWTRACE_COMPRESSION_ONE=y
206CONFIG_EARLY_PRINTK=y 200CONFIG_EARLY_PRINTK=y
207CONFIG_CPLB_INFO=y 201CONFIG_CPLB_INFO=y
208CONFIG_BFIN_PSEUDODBG_INSNS=y 202CONFIG_BFIN_PSEUDODBG_INSNS=y
209CONFIG_CRYPTO=y
210# CONFIG_CRYPTO_ANSI_CPRNG is not set 203# CONFIG_CRYPTO_ANSI_CPRNG is not set
diff --git a/arch/blackfin/include/asm/Kbuild b/arch/blackfin/include/asm/Kbuild
index 7a075eaf6041..5a0625aad6a0 100644
--- a/arch/blackfin/include/asm/Kbuild
+++ b/arch/blackfin/include/asm/Kbuild
@@ -21,6 +21,7 @@ generic-y += local64.h
21generic-y += local.h 21generic-y += local.h
22generic-y += mman.h 22generic-y += mman.h
23generic-y += msgbuf.h 23generic-y += msgbuf.h
24generic-y += mutex.h
24generic-y += param.h 25generic-y += param.h
25generic-y += percpu.h 26generic-y += percpu.h
26generic-y += pgalloc.h 27generic-y += pgalloc.h
diff --git a/arch/blackfin/include/asm/atomic.h b/arch/blackfin/include/asm/atomic.h
index 135225696fd2..54c6e2887e9f 100644
--- a/arch/blackfin/include/asm/atomic.h
+++ b/arch/blackfin/include/asm/atomic.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright 2004-2009 Analog Devices Inc. 2 * Copyright 2004-2011 Analog Devices Inc.
3 * 3 *
4 * Licensed under the GPL-2 or later. 4 * Licensed under the GPL-2 or later.
5 */ 5 */
@@ -7,111 +7,27 @@
7#ifndef __ARCH_BLACKFIN_ATOMIC__ 7#ifndef __ARCH_BLACKFIN_ATOMIC__
8#define __ARCH_BLACKFIN_ATOMIC__ 8#define __ARCH_BLACKFIN_ATOMIC__
9 9
10#ifndef CONFIG_SMP 10#ifdef CONFIG_SMP
11# include <asm-generic/atomic.h>
12#else
13 11
14#include <linux/types.h> 12#include <linux/linkage.h>
15#include <asm/system.h> /* local_irq_XXX() */
16
17/*
18 * Atomic operations that C can't guarantee us. Useful for
19 * resource counting etc..
20 */
21
22#define ATOMIC_INIT(i) { (i) }
23#define atomic_set(v, i) (((v)->counter) = i)
24
25#define atomic_read(v) __raw_uncached_fetch_asm(&(v)->counter)
26 13
27asmlinkage int __raw_uncached_fetch_asm(const volatile int *ptr); 14asmlinkage int __raw_uncached_fetch_asm(const volatile int *ptr);
28
29asmlinkage int __raw_atomic_update_asm(volatile int *ptr, int value); 15asmlinkage int __raw_atomic_update_asm(volatile int *ptr, int value);
30
31asmlinkage int __raw_atomic_clear_asm(volatile int *ptr, int value); 16asmlinkage int __raw_atomic_clear_asm(volatile int *ptr, int value);
32
33asmlinkage int __raw_atomic_set_asm(volatile int *ptr, int value); 17asmlinkage int __raw_atomic_set_asm(volatile int *ptr, int value);
34
35asmlinkage int __raw_atomic_xor_asm(volatile int *ptr, int value); 18asmlinkage int __raw_atomic_xor_asm(volatile int *ptr, int value);
36
37asmlinkage int __raw_atomic_test_asm(const volatile int *ptr, int value); 19asmlinkage int __raw_atomic_test_asm(const volatile int *ptr, int value);
38 20
39static inline void atomic_add(int i, atomic_t *v) 21#define atomic_read(v) __raw_uncached_fetch_asm(&(v)->counter)
40{
41 __raw_atomic_update_asm(&v->counter, i);
42}
43
44static inline void atomic_sub(int i, atomic_t *v)
45{
46 __raw_atomic_update_asm(&v->counter, -i);
47}
48
49static inline int atomic_add_return(int i, atomic_t *v)
50{
51 return __raw_atomic_update_asm(&v->counter, i);
52}
53
54static inline int atomic_sub_return(int i, atomic_t *v)
55{
56 return __raw_atomic_update_asm(&v->counter, -i);
57}
58 22
59static inline void atomic_inc(volatile atomic_t *v) 23#define atomic_add_return(i, v) __raw_atomic_update_asm(&(v)->counter, i)
60{ 24#define atomic_sub_return(i, v) __raw_atomic_update_asm(&(v)->counter, -(i))
61 __raw_atomic_update_asm(&v->counter, 1);
62}
63
64static inline void atomic_dec(volatile atomic_t *v)
65{
66 __raw_atomic_update_asm(&v->counter, -1);
67}
68
69static inline void atomic_clear_mask(int mask, atomic_t *v)
70{
71 __raw_atomic_clear_asm(&v->counter, mask);
72}
73
74static inline void atomic_set_mask(int mask, atomic_t *v)
75{
76 __raw_atomic_set_asm(&v->counter, mask);
77}
78
79/* Atomic operations are already serializing */
80#define smp_mb__before_atomic_dec() barrier()
81#define smp_mb__after_atomic_dec() barrier()
82#define smp_mb__before_atomic_inc() barrier()
83#define smp_mb__after_atomic_inc() barrier()
84
85#define atomic_add_negative(a, v) (atomic_add_return((a), (v)) < 0)
86#define atomic_dec_return(v) atomic_sub_return(1,(v))
87#define atomic_inc_return(v) atomic_add_return(1,(v))
88
89#define atomic_cmpxchg(v, o, n) ((int)cmpxchg(&((v)->counter), (o), (n)))
90#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
91
92#define __atomic_add_unless(v, a, u) \
93({ \
94 int c, old; \
95 c = atomic_read(v); \
96 while (c != (u) && (old = atomic_cmpxchg((v), c, c + (a))) != c) \
97 c = old; \
98 c; \
99})
100
101/*
102 * atomic_inc_and_test - increment and test
103 * @v: pointer of type atomic_t
104 *
105 * Atomically increments @v by 1
106 * and returns true if the result is zero, or false for all
107 * other cases.
108 */
109#define atomic_inc_and_test(v) (atomic_inc_return(v) == 0)
110
111#define atomic_sub_and_test(i,v) (atomic_sub_return((i), (v)) == 0)
112#define atomic_dec_and_test(v) (atomic_sub_return(1, (v)) == 0)
113 25
26#define atomic_clear_mask(m, v) __raw_atomic_clear_asm(&(v)->counter, m)
27#define atomic_set_mask(m, v) __raw_atomic_set_asm(&(v)->counter, m)
114 28
115#endif 29#endif
116 30
31#include <asm-generic/atomic.h>
32
117#endif 33#endif
diff --git a/arch/blackfin/include/asm/mutex.h b/arch/blackfin/include/asm/mutex.h
deleted file mode 100644
index ff6101aa2c71..000000000000
--- a/arch/blackfin/include/asm/mutex.h
+++ /dev/null
@@ -1 +0,0 @@
1#include <asm-generic/mutex-dec.h>
diff --git a/arch/blackfin/include/asm/uaccess.h b/arch/blackfin/include/asm/uaccess.h
index 1c0d190adaef..5cc111502822 100644
--- a/arch/blackfin/include/asm/uaccess.h
+++ b/arch/blackfin/include/asm/uaccess.h
@@ -195,17 +195,17 @@ static inline unsigned long __must_check
195copy_from_user(void *to, const void __user *from, unsigned long n) 195copy_from_user(void *to, const void __user *from, unsigned long n)
196{ 196{
197 if (access_ok(VERIFY_READ, from, n)) 197 if (access_ok(VERIFY_READ, from, n))
198 memcpy(to, from, n); 198 memcpy(to, (const void __force *)from, n);
199 else 199 else
200 return n; 200 return n;
201 return 0; 201 return 0;
202} 202}
203 203
204static inline unsigned long __must_check 204static inline unsigned long __must_check
205copy_to_user(void *to, const void __user *from, unsigned long n) 205copy_to_user(void __user *to, const void *from, unsigned long n)
206{ 206{
207 if (access_ok(VERIFY_WRITE, to, n)) 207 if (access_ok(VERIFY_WRITE, to, n))
208 memcpy(to, from, n); 208 memcpy((void __force *)to, from, n);
209 else 209 else
210 return n; 210 return n;
211 return 0; 211 return 0;
diff --git a/arch/blackfin/kernel/Makefile b/arch/blackfin/kernel/Makefile
index b7bdc42fe1a3..1f88edd4572a 100644
--- a/arch/blackfin/kernel/Makefile
+++ b/arch/blackfin/kernel/Makefile
@@ -38,6 +38,6 @@ obj-$(CONFIG_PERF_EVENTS) += perf_event.o
38 38
39# the kgdb test puts code into L2 and without linker 39# the kgdb test puts code into L2 and without linker
40# relaxation, we need to force long calls to/from it 40# relaxation, we need to force long calls to/from it
41CFLAGS_kgdb_test.o := -mlong-calls -O0 41CFLAGS_kgdb_test.o := -mlong-calls
42 42
43obj-$(CONFIG_DEBUG_MMRS) += debug-mmrs.o 43obj-$(CONFIG_DEBUG_MMRS) += debug-mmrs.o
diff --git a/arch/blackfin/kernel/kgdb_test.c b/arch/blackfin/kernel/kgdb_test.c
index 2a6e9dbb62a5..4a7dcfea98af 100644
--- a/arch/blackfin/kernel/kgdb_test.c
+++ b/arch/blackfin/kernel/kgdb_test.c
@@ -50,8 +50,7 @@ void kgdb_l2_test(void)
50 50
51#endif 51#endif
52 52
53 53noinline int kgdb_test(char *name, int len, int count, int z)
54int kgdb_test(char *name, int len, int count, int z)
55{ 54{
56 pr_alert("kgdb name(%d): %s, %d, %d\n", len, name, count, z); 55 pr_alert("kgdb name(%d): %s, %d, %d\n", len, name, count, z);
57 count = z; 56 count = z;
diff --git a/arch/blackfin/kernel/time-ts.c b/arch/blackfin/kernel/time-ts.c
index 9e9b60d969dc..1bcf3a3c57d8 100644
--- a/arch/blackfin/kernel/time-ts.c
+++ b/arch/blackfin/kernel/time-ts.c
@@ -188,8 +188,7 @@ irqreturn_t bfin_gptmr0_interrupt(int irq, void *dev_id)
188 188
189static struct irqaction gptmr0_irq = { 189static struct irqaction gptmr0_irq = {
190 .name = "Blackfin GPTimer0", 190 .name = "Blackfin GPTimer0",
191 .flags = IRQF_DISABLED | IRQF_TIMER | \ 191 .flags = IRQF_TIMER | IRQF_IRQPOLL | IRQF_PERCPU,
192 IRQF_IRQPOLL | IRQF_PERCPU,
193 .handler = bfin_gptmr0_interrupt, 192 .handler = bfin_gptmr0_interrupt,
194}; 193};
195 194
@@ -297,8 +296,7 @@ irqreturn_t bfin_coretmr_interrupt(int irq, void *dev_id)
297 296
298static struct irqaction coretmr_irq = { 297static struct irqaction coretmr_irq = {
299 .name = "Blackfin CoreTimer", 298 .name = "Blackfin CoreTimer",
300 .flags = IRQF_DISABLED | IRQF_TIMER | \ 299 .flags = IRQF_TIMER | IRQF_IRQPOLL | IRQF_PERCPU,
301 IRQF_IRQPOLL | IRQF_PERCPU,
302 .handler = bfin_coretmr_interrupt, 300 .handler = bfin_coretmr_interrupt,
303}; 301};
304 302
diff --git a/arch/blackfin/kernel/time.c b/arch/blackfin/kernel/time.c
index ceb2bf63dfe2..2310b249675f 100644
--- a/arch/blackfin/kernel/time.c
+++ b/arch/blackfin/kernel/time.c
@@ -25,7 +25,6 @@
25 25
26static struct irqaction bfin_timer_irq = { 26static struct irqaction bfin_timer_irq = {
27 .name = "Blackfin Timer Tick", 27 .name = "Blackfin Timer Tick",
28 .flags = IRQF_DISABLED
29}; 28};
30 29
31#if defined(CONFIG_IPIPE) 30#if defined(CONFIG_IPIPE)
diff --git a/arch/blackfin/mach-bf533/boards/H8606.c b/arch/blackfin/mach-bf533/boards/H8606.c
index eb325ed6607e..5da5787fc4ef 100644
--- a/arch/blackfin/mach-bf533/boards/H8606.c
+++ b/arch/blackfin/mach-bf533/boards/H8606.c
@@ -54,7 +54,8 @@ static struct resource dm9000_resources[] = {
54 [2] = { 54 [2] = {
55 .start = IRQ_PF10, 55 .start = IRQ_PF10,
56 .end = IRQ_PF10, 56 .end = IRQ_PF10,
57 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE | IRQF_SHARED | IRQF_TRIGGER_HIGH), 57 .flags = (IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE |
58 IORESOURCE_IRQ_SHAREABLE),
58 }, 59 },
59}; 60};
60 61
diff --git a/arch/blackfin/mach-bf537/boards/cm_bf537e.c b/arch/blackfin/mach-bf537/boards/cm_bf537e.c
index 44fd8409db10..9fb20d6d8f91 100644
--- a/arch/blackfin/mach-bf537/boards/cm_bf537e.c
+++ b/arch/blackfin/mach-bf537/boards/cm_bf537e.c
@@ -605,7 +605,7 @@ static struct platform_device bfin_mac_device = {
605 605
606static struct pata_platform_info bfin_pata_platform_data = { 606static struct pata_platform_info bfin_pata_platform_data = {
607 .ioport_shift = 2, 607 .ioport_shift = 2,
608 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED, 608 .irq_type = IRQF_TRIGGER_HIGH,
609}; 609};
610 610
611static struct resource bfin_pata_resources[] = { 611static struct resource bfin_pata_resources[] = {
diff --git a/arch/blackfin/mach-bf537/boards/cm_bf537u.c b/arch/blackfin/mach-bf537/boards/cm_bf537u.c
index 1b4ac5c64aae..5ba389fc61ae 100644
--- a/arch/blackfin/mach-bf537/boards/cm_bf537u.c
+++ b/arch/blackfin/mach-bf537/boards/cm_bf537u.c
@@ -570,7 +570,7 @@ static struct platform_device bfin_mac_device = {
570 570
571static struct pata_platform_info bfin_pata_platform_data = { 571static struct pata_platform_info bfin_pata_platform_data = {
572 .ioport_shift = 2, 572 .ioport_shift = 2,
573 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED, 573 .irq_type = IRQF_TRIGGER_HIGH,
574}; 574};
575 575
576static struct resource bfin_pata_resources[] = { 576static struct resource bfin_pata_resources[] = {
diff --git a/arch/blackfin/mach-bf537/boards/stamp.c b/arch/blackfin/mach-bf537/boards/stamp.c
index b52e6728f64f..6c916a67ef68 100644
--- a/arch/blackfin/mach-bf537/boards/stamp.c
+++ b/arch/blackfin/mach-bf537/boards/stamp.c
@@ -962,10 +962,10 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
962 }, 962 },
963#endif 963#endif
964 964
965#if defined(CONFIG_SND_BF5XX_SOC_AD183X) \ 965#if defined(CONFIG_SND_BF5XX_SOC_AD1836) \
966 || defined(CONFIG_SND_BF5XX_SOC_AD183X_MODULE) 966 || defined(CONFIG_SND_BF5XX_SOC_AD1836_MODULE)
967 { 967 {
968 .modalias = "ad183x", 968 .modalias = "ad1836",
969 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ 969 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
970 .bus_num = 0, 970 .bus_num = 0,
971 .chip_select = 4, 971 .chip_select = 4,
@@ -984,9 +984,9 @@ static struct spi_board_info bfin_spi_board_info[] __initdata = {
984 }, 984 },
985#endif 985#endif
986 986
987#if defined(CONFIG_SND_BF5XX_SOC_ADAV80X) || defined(CONFIG_SND_BF5XX_SOC_ADAV80X_MODULE) 987#if defined(CONFIG_SND_SOC_ADAV80X) || defined(CONFIG_SND_SOC_ADV80X_MODULE)
988 { 988 {
989 .modalias = "adav80x", 989 .modalias = "adav801",
990 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */ 990 .max_speed_hz = 3125000, /* max spi clock (SCK) speed in HZ */
991 .bus_num = 0, 991 .bus_num = 0,
992 .chip_select = 1, 992 .chip_select = 1,
@@ -2101,7 +2101,7 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
2101 }, 2101 },
2102#endif 2102#endif
2103 2103
2104#if defined(CONFIG_SND_BF5XX_SOC_ADAV80X) || defined(CONFIG_SND_BF5XX_SOC_ADAV80X_MODULE) 2104#if defined(CONFIG_SND_SOC_ADAV80X) || defined(CONFIG_SND_SOC_ADAV80X_MODULE)
2105 { 2105 {
2106 I2C_BOARD_INFO("adav803", 0x10), 2106 I2C_BOARD_INFO("adav803", 0x10),
2107 }, 2107 },
@@ -2134,23 +2134,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
2134 }, 2134 },
2135#endif 2135#endif
2136 2136
2137#if defined(CONFIG_AD7414) || defined(CONFIG_AD7414_MODULE)
2138 {
2139 I2C_BOARD_INFO("ad7414", 0x9),
2140 .irq = IRQ_PG5,
2141 .irq_flags = IRQF_TRIGGER_LOW,
2142 },
2143#endif
2144
2145#if defined(CONFIG_AD7416) || defined(CONFIG_AD7416_MODULE)
2146 {
2147 I2C_BOARD_INFO("ad7417", 0xb),
2148 .irq = IRQ_PG5,
2149 .irq_flags = IRQF_TRIGGER_LOW,
2150 .platform_data = (void *)GPIO_PF4,
2151 },
2152#endif
2153
2154#if defined(CONFIG_ADE7854_I2C) || defined(CONFIG_ADE7854_I2C_MODULE) 2137#if defined(CONFIG_ADE7854_I2C) || defined(CONFIG_ADE7854_I2C_MODULE)
2155 { 2138 {
2156 I2C_BOARD_INFO("ade7854", 0x38), 2139 I2C_BOARD_INFO("ade7854", 0x38),
@@ -2161,15 +2144,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
2161 { 2144 {
2162 I2C_BOARD_INFO("adt75", 0x9), 2145 I2C_BOARD_INFO("adt75", 0x9),
2163 .irq = IRQ_PG5, 2146 .irq = IRQ_PG5,
2164 .irq_flags = IRQF_TRIGGER_LOW,
2165 },
2166#endif
2167
2168#if defined(CONFIG_ADT7408) || defined(CONFIG_ADT7408_MODULE)
2169 {
2170 I2C_BOARD_INFO("adt7408", 0x18),
2171 .irq = IRQ_PG5,
2172 .irq_flags = IRQF_TRIGGER_LOW,
2173 }, 2147 },
2174#endif 2148#endif
2175 2149
@@ -2178,7 +2152,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
2178 I2C_BOARD_INFO("adt7410", 0x48), 2152 I2C_BOARD_INFO("adt7410", 0x48),
2179 /* CT critical temperature event. line 0 */ 2153 /* CT critical temperature event. line 0 */
2180 .irq = IRQ_PG5, 2154 .irq = IRQ_PG5,
2181 .irq_flags = IRQF_TRIGGER_LOW,
2182 .platform_data = (void *)&adt7410_platform_data, 2155 .platform_data = (void *)&adt7410_platform_data,
2183 }, 2156 },
2184#endif 2157#endif
@@ -2187,7 +2160,6 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
2187 { 2160 {
2188 I2C_BOARD_INFO("ad7291", 0x20), 2161 I2C_BOARD_INFO("ad7291", 0x20),
2189 .irq = IRQ_PG5, 2162 .irq = IRQ_PG5,
2190 .irq_flags = IRQF_TRIGGER_LOW,
2191 }, 2163 },
2192#endif 2164#endif
2193 2165
@@ -2275,6 +2247,11 @@ static struct i2c_board_info __initdata bfin_i2c_board_info[] = {
2275 I2C_BOARD_INFO("adau1361", 0x38), 2247 I2C_BOARD_INFO("adau1361", 0x38),
2276 }, 2248 },
2277#endif 2249#endif
2250#if defined(CONFIG_SND_SOC_ADAU1701) || defined(CONFIG_SND_SOC_ADAU1701_MODULE)
2251 {
2252 I2C_BOARD_INFO("adau1701", 0x34),
2253 },
2254#endif
2278#if defined(CONFIG_AD525X_DPOT) || defined(CONFIG_AD525X_DPOT_MODULE) 2255#if defined(CONFIG_AD525X_DPOT) || defined(CONFIG_AD525X_DPOT_MODULE)
2279 { 2256 {
2280 I2C_BOARD_INFO("ad5258", 0x18), 2257 I2C_BOARD_INFO("ad5258", 0x18),
@@ -2388,7 +2365,7 @@ static struct platform_device bfin_sport1_uart_device = {
2388#define PATA_INT IRQ_PF5 2365#define PATA_INT IRQ_PF5
2389static struct pata_platform_info bfin_pata_platform_data = { 2366static struct pata_platform_info bfin_pata_platform_data = {
2390 .ioport_shift = 1, 2367 .ioport_shift = 1,
2391 .irq_flags = IRQF_TRIGGER_HIGH | IRQF_DISABLED, 2368 .irq_flags = IRQF_TRIGGER_HIGH,
2392}; 2369};
2393 2370
2394static struct resource bfin_pata_resources[] = { 2371static struct resource bfin_pata_resources[] = {
@@ -2540,13 +2517,21 @@ static struct platform_device bfin_ac97_pcm = {
2540}; 2517};
2541#endif 2518#endif
2542 2519
2543#if defined(CONFIG_SND_BF5XX_SOC_AD73311) || defined(CONFIG_SND_BF5XX_SOC_AD73311_MODULE) 2520#if defined(CONFIG_SND_SOC_AD73311) || defined(CONFIG_SND_SOC_AD73311_MODULE)
2544static struct platform_device bfin_ad73311_codec_device = { 2521static struct platform_device bfin_ad73311_codec_device = {
2545 .name = "ad73311", 2522 .name = "ad73311",
2546 .id = -1, 2523 .id = -1,
2547}; 2524};
2548#endif 2525#endif
2549 2526
2527#if defined(CONFIG_SND_SOC_BFIN_EVAL_ADAV80X) || \
2528 defined(CONFIG_SND_SOC_BFIN_EVAL_ADAV80X_MODULE)
2529static struct platform_device bfin_eval_adav801_device = {
2530 .name = "bfin-eval-adav801",
2531 .id = -1,
2532};
2533#endif
2534
2550#if defined(CONFIG_SND_BF5XX_SOC_I2S) || defined(CONFIG_SND_BF5XX_SOC_I2S_MODULE) 2535#if defined(CONFIG_SND_BF5XX_SOC_I2S) || defined(CONFIG_SND_BF5XX_SOC_I2S_MODULE)
2551static struct platform_device bfin_i2s = { 2536static struct platform_device bfin_i2s = {
2552 .name = "bfin-i2s", 2537 .name = "bfin-i2s",
@@ -2661,6 +2646,20 @@ static struct platform_device iio_gpio_trigger = {
2661}; 2646};
2662#endif 2647#endif
2663 2648
2649#if defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1373) || \
2650 defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1373_MODULE)
2651static struct platform_device bf5xx_adau1373_device = {
2652 .name = "bfin-eval-adau1373",
2653};
2654#endif
2655
2656#if defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1701) || \
2657 defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1701_MODULE)
2658static struct platform_device bf5xx_adau1701_device = {
2659 .name = "bfin-eval-adau1701",
2660};
2661#endif
2662
2664static struct platform_device *stamp_devices[] __initdata = { 2663static struct platform_device *stamp_devices[] __initdata = {
2665 2664
2666 &bfin_dpmc, 2665 &bfin_dpmc,
@@ -2782,7 +2781,7 @@ static struct platform_device *stamp_devices[] __initdata = {
2782 &bfin_ac97_pcm, 2781 &bfin_ac97_pcm,
2783#endif 2782#endif
2784 2783
2785#if defined(CONFIG_SND_BF5XX_SOC_AD73311) || defined(CONFIG_SND_BF5XX_SOC_AD73311_MODULE) 2784#if defined(CONFIG_SND_SOC_AD73311) || defined(CONFIG_SND_SOC_AD73311_MODULE)
2786 &bfin_ad73311_codec_device, 2785 &bfin_ad73311_codec_device,
2787#endif 2786#endif
2788 2787
@@ -2821,6 +2820,21 @@ static struct platform_device *stamp_devices[] __initdata = {
2821 defined(CONFIG_IIO_GPIO_TRIGGER_MODULE) 2820 defined(CONFIG_IIO_GPIO_TRIGGER_MODULE)
2822 &iio_gpio_trigger, 2821 &iio_gpio_trigger,
2823#endif 2822#endif
2823
2824#if defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1373) || \
2825 defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1373_MODULE)
2826 &bf5xx_adau1373_device,
2827#endif
2828
2829#if defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1701) || \
2830 defined(CONFIG_SND_SOC_BFIN_EVAL_ADAU1701_MODULE)
2831 &bf5xx_adau1701_device,
2832#endif
2833
2834#if defined(CONFIG_SND_SOC_BFIN_EVAL_ADAV80X) || \
2835 defined(CONFIG_SND_SOC_BFIN_EVAL_ADAV80X_MODULE)
2836 &bfin_eval_adav801_device,
2837#endif
2824}; 2838};
2825 2839
2826static int __init net2272_init(void) 2840static int __init net2272_init(void)
diff --git a/arch/blackfin/mach-bf537/boards/tcm_bf537.c b/arch/blackfin/mach-bf537/boards/tcm_bf537.c
index 9b7287abdfa1..2da0316d890e 100644
--- a/arch/blackfin/mach-bf537/boards/tcm_bf537.c
+++ b/arch/blackfin/mach-bf537/boards/tcm_bf537.c
@@ -572,7 +572,7 @@ static struct platform_device bfin_mac_device = {
572 572
573static struct pata_platform_info bfin_pata_platform_data = { 573static struct pata_platform_info bfin_pata_platform_data = {
574 .ioport_shift = 2, 574 .ioport_shift = 2,
575 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED, 575 .irq_type = IRQF_TRIGGER_HIGH,
576}; 576};
577 577
578static struct resource bfin_pata_resources[] = { 578static struct resource bfin_pata_resources[] = {
diff --git a/arch/blackfin/mach-bf561/boards/cm_bf561.c b/arch/blackfin/mach-bf561/boards/cm_bf561.c
index e4f397d1d65b..c1b72f2d6354 100644
--- a/arch/blackfin/mach-bf561/boards/cm_bf561.c
+++ b/arch/blackfin/mach-bf561/boards/cm_bf561.c
@@ -348,7 +348,7 @@ static struct platform_device bfin_sir0_device = {
348 348
349static struct pata_platform_info bfin_pata_platform_data = { 349static struct pata_platform_info bfin_pata_platform_data = {
350 .ioport_shift = 2, 350 .ioport_shift = 2,
351 .irq_type = IRQF_TRIGGER_HIGH | IRQF_DISABLED, 351 .irq_type = IRQF_TRIGGER_HIGH,
352}; 352};
353 353
354static struct resource bfin_pata_resources[] = { 354static struct resource bfin_pata_resources[] = {
diff --git a/arch/blackfin/mach-bf561/smp.c b/arch/blackfin/mach-bf561/smp.c
index 85abd8be1343..db22401e7605 100644
--- a/arch/blackfin/mach-bf561/smp.c
+++ b/arch/blackfin/mach-bf561/smp.c
@@ -114,7 +114,7 @@ void __init platform_request_ipi(int irq, void *handler)
114 int ret; 114 int ret;
115 const char *name = (irq == IRQ_SUPPLE_0) ? supple0 : supple1; 115 const char *name = (irq == IRQ_SUPPLE_0) ? supple0 : supple1;
116 116
117 ret = request_irq(irq, handler, IRQF_DISABLED | IRQF_PERCPU, name, handler); 117 ret = request_irq(irq, handler, IRQF_PERCPU, name, handler);
118 if (ret) 118 if (ret)
119 panic("Cannot request %s for IPI service", name); 119 panic("Cannot request %s for IPI service", name);
120} 120}
diff --git a/arch/blackfin/mach-common/smp.c b/arch/blackfin/mach-common/smp.c
index 107622aacf6b..0784a52389c8 100644
--- a/arch/blackfin/mach-common/smp.c
+++ b/arch/blackfin/mach-common/smp.c
@@ -295,10 +295,15 @@ EXPORT_SYMBOL_GPL(smp_call_function_single);
295 295
296void smp_send_reschedule(int cpu) 296void smp_send_reschedule(int cpu)
297{ 297{
298 cpumask_t callmap;
298 /* simply trigger an ipi */ 299 /* simply trigger an ipi */
299 if (cpu_is_offline(cpu)) 300 if (cpu_is_offline(cpu))
300 return; 301 return;
301 platform_send_ipi_cpu(cpu, IRQ_SUPPLE_0); 302
303 cpumask_clear(&callmap);
304 cpumask_set_cpu(cpu, &callmap);
305
306 smp_send_message(callmap, BFIN_IPI_RESCHEDULE, NULL, NULL, 0);
302 307
303 return; 308 return;
304} 309}
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index 17addacb169e..408b055c585f 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -282,8 +282,8 @@ config ETRAX_RTC
282 Enables drivers for the Real-Time Clock battery-backed chips on 282 Enables drivers for the Real-Time Clock battery-backed chips on
283 some products. The kernel reads the time when booting, and 283 some products. The kernel reads the time when booting, and
284 the date can be set using ioctl(fd, RTC_SET_TIME, &rt) with rt a 284 the date can be set using ioctl(fd, RTC_SET_TIME, &rt) with rt a
285 rtc_time struct (see <file:include/asm-cris/rtc.h>) on the /dev/rtc 285 rtc_time struct (see <file:arch/cris/include/asm/rtc.h>) on the
286 device. You can check the time with cat /proc/rtc, but 286 /dev/rtc device. You can check the time with cat /proc/rtc, but
287 normal time reading should be done using libc function time and 287 normal time reading should be done using libc function time and
288 friends. 288 friends.
289 289
diff --git a/arch/cris/arch-v10/Kconfig b/arch/cris/arch-v10/Kconfig
index adc164e99339..df9a38b4f18f 100644
--- a/arch/cris/arch-v10/Kconfig
+++ b/arch/cris/arch-v10/Kconfig
@@ -24,8 +24,8 @@ config ETRAX_PA_LEDS
24 help 24 help
25 The ETRAX network driver is responsible for flashing LED's when 25 The ETRAX network driver is responsible for flashing LED's when
26 packets arrive and are sent. It uses macros defined in 26 packets arrive and are sent. It uses macros defined in
27 <file:include/asm-cris/io.h>, and those macros are defined after what 27 <file:arch/cris/include/asm/io.h>, and those macros are defined after
28 YOU choose in this option. The actual bits used are configured 28 what YOU choose in this option. The actual bits used are configured
29 separately. Select this if the LEDs are on port PA. Some products 29 separately. Select this if the LEDs are on port PA. Some products
30 put the leds on PB or a memory-mapped latch (CSP0) instead. 30 put the leds on PB or a memory-mapped latch (CSP0) instead.
31 31
@@ -34,8 +34,8 @@ config ETRAX_PB_LEDS
34 help 34 help
35 The ETRAX network driver is responsible for flashing LED's when 35 The ETRAX network driver is responsible for flashing LED's when
36 packets arrive and are sent. It uses macros defined in 36 packets arrive and are sent. It uses macros defined in
37 <file:include/asm-cris/io.h>, and those macros are defined after what 37 <file:arch/cris/include/asm/io.h>, and those macros are defined after
38 YOU choose in this option. The actual bits used are configured 38 what YOU choose in this option. The actual bits used are configured
39 separately. Select this if the LEDs are on port PB. Some products 39 separately. Select this if the LEDs are on port PB. Some products
40 put the leds on PA or a memory-mapped latch (CSP0) instead. 40 put the leds on PA or a memory-mapped latch (CSP0) instead.
41 41
@@ -44,8 +44,8 @@ config ETRAX_CSP0_LEDS
44 help 44 help
45 The ETRAX network driver is responsible for flashing LED's when 45 The ETRAX network driver is responsible for flashing LED's when
46 packets arrive and are sent. It uses macros defined in 46 packets arrive and are sent. It uses macros defined in
47 <file:include/asm-cris/io.h>, and those macros are defined after what 47 <file:arch/cris/include/asm/io.h>, and those macros are defined after
48 YOU choose in this option. The actual bits used are configured 48 what YOU choose in this option. The actual bits used are configured
49 separately. Select this if the LEDs are on a memory-mapped latch 49 separately. Select this if the LEDs are on a memory-mapped latch
50 using chip select CSP0, this is mapped at 0x90000000. 50 using chip select CSP0, this is mapped at 0x90000000.
51 Some products put the leds on PA or PB instead. 51 Some products put the leds on PA or PB instead.
diff --git a/arch/cris/arch-v10/drivers/Kconfig b/arch/cris/arch-v10/drivers/Kconfig
index 0d7221779923..32d90867a984 100644
--- a/arch/cris/arch-v10/drivers/Kconfig
+++ b/arch/cris/arch-v10/drivers/Kconfig
@@ -4,6 +4,7 @@ config ETRAX_ETHERNET
4 bool "Ethernet support" 4 bool "Ethernet support"
5 depends on ETRAX_ARCH_V10 5 depends on ETRAX_ARCH_V10
6 select NET_ETHERNET 6 select NET_ETHERNET
7 select NET_CORE
7 select MII 8 select MII
8 help 9 help
9 This option enables the ETRAX 100LX built-in 10/100Mbit Ethernet 10 This option enables the ETRAX 100LX built-in 10/100Mbit Ethernet
diff --git a/arch/cris/arch-v32/drivers/Kconfig b/arch/cris/arch-v32/drivers/Kconfig
index 41a2732e8b9c..e47e9c3401b0 100644
--- a/arch/cris/arch-v32/drivers/Kconfig
+++ b/arch/cris/arch-v32/drivers/Kconfig
@@ -4,6 +4,7 @@ config ETRAX_ETHERNET
4 bool "Ethernet support" 4 bool "Ethernet support"
5 depends on ETRAX_ARCH_V32 5 depends on ETRAX_ARCH_V32
6 select NET_ETHERNET 6 select NET_ETHERNET
7 select NET_CORE
7 select MII 8 select MII
8 help 9 help
9 This option enables the ETRAX FS built-in 10/100Mbit Ethernet 10 This option enables the ETRAX FS built-in 10/100Mbit Ethernet
diff --git a/arch/cris/arch-v32/lib/nand_init.S b/arch/cris/arch-v32/lib/nand_init.S
deleted file mode 100644
index d671fed451c9..000000000000
--- a/arch/cris/arch-v32/lib/nand_init.S
+++ /dev/null
@@ -1,178 +0,0 @@
1##=============================================================================
2##
3## nand_init.S
4##
5## The bootrom copies data from the NAND flash to the internal RAM but
6## due to a bug/feature we can only trust the 256 first bytes. So this
7## code copies more data from NAND flash to internal RAM. Obvioulsy this
8## code must fit in the first 256 bytes so alter with care.
9##
10## Some notes about the bug/feature for future reference:
11## The bootrom copies the first 127 KB from NAND flash to internal
12## memory. The problem is that it does a bytewise copy. NAND flashes
13## does autoincrement on the address so for a 16-bite device each
14## read/write increases the address by two. So the copy loop in the
15## bootrom will discard every second byte. This is solved by inserting
16## zeroes in every second byte in the first erase block.
17##
18## The bootrom also incorrectly assumes that it can read the flash
19## linear with only one read command but the flash will actually
20## switch between normal area and spare area if you do that so we
21## can't trust more than the first 256 bytes.
22##
23##=============================================================================
24
25#include <arch/hwregs/asm/reg_map_asm.h>
26#include <arch/hwregs/asm/gio_defs_asm.h>
27#include <arch/hwregs/asm/pinmux_defs_asm.h>
28#include <arch/hwregs/asm/bif_core_defs_asm.h>
29#include <arch/hwregs/asm/config_defs_asm.h>
30
31;; There are 8-bit NAND flashes and 16-bit NAND flashes.
32;; We need to treat them slightly different.
33#if CONFIG_ETRAX_FLASH_BUSWIDTH==2
34#define PAGE_SIZE 256
35#else
36#error 2
37#define PAGE_SIZE 512
38#endif
39#define ERASE_BLOCK 16384
40
41;; GPIO pins connected to NAND flash
42#define CE 4
43#define CLE 5
44#define ALE 6
45#define BY 7
46
47;; Address space for NAND flash
48#define NAND_RD_ADDR 0x90000000
49#define NAND_WR_ADDR 0x94000000
50
51#define READ_CMD 0x00
52
53;; Readability macros
54#define CSP_MASK \
55 REG_MASK(bif_core, rw_grp3_cfg, gated_csp0) | \
56 REG_MASK(bif_core, rw_grp3_cfg, gated_csp1)
57#define CSP_VAL \
58 REG_STATE(bif_core, rw_grp3_cfg, gated_csp0, rd) | \
59 REG_STATE(bif_core, rw_grp3_cfg, gated_csp1, wr)
60
61;;----------------------------------------------------------------------------
62;; Macros to set/clear GPIO bits
63
64.macro SET x
65 or.b (1<<\x),$r9
66 move.d $r9, [$r2]
67.endm
68
69.macro CLR x
70 and.b ~(1<<\x),$r9
71 move.d $r9, [$r2]
72.endm
73
74;;----------------------------------------------------------------------------
75
76nand_boot:
77 ;; Check if nand boot was selected
78 move.d REG_ADDR(config, regi_config, r_bootsel), $r0
79 move.d [$r0], $r0
80 and.d REG_MASK(config, r_bootsel, boot_mode), $r0
81 cmp.d REG_STATE(config, r_bootsel, boot_mode, nand), $r0
82 bne normal_boot ; No NAND boot
83 nop
84
85copy_nand_to_ram:
86 ;; copy_nand_to_ram
87 ;; Arguments
88 ;; r10 - destination
89 ;; r11 - source offset
90 ;; r12 - size
91 ;; r13 - Address to jump to after completion
92 ;; Note : r10-r12 are clobbered on return
93 ;; Registers used:
94 ;; r0 - NAND_RD_ADDR
95 ;; r1 - NAND_WR_ADDR
96 ;; r2 - reg_gio_rw_pa_dout
97 ;; r3 - reg_gio_r_pa_din
98 ;; r4 - tmp
99 ;; r5 - byte counter within a page
100 ;; r6 - reg_pinmux_rw_pa
101 ;; r7 - reg_gio_rw_pa_oe
102 ;; r8 - reg_bif_core_rw_grp3_cfg
103 ;; r9 - reg_gio_rw_pa_dout shadow
104 move.d 0x90000000, $r0
105 move.d 0x94000000, $r1
106 move.d REG_ADDR(gio, regi_gio, rw_pa_dout), $r2
107 move.d REG_ADDR(gio, regi_gio, r_pa_din), $r3
108 move.d REG_ADDR(pinmux, regi_pinmux, rw_pa), $r6
109 move.d REG_ADDR(gio, regi_gio, rw_pa_oe), $r7
110 move.d REG_ADDR(bif_core, regi_bif_core, rw_grp3_cfg), $r8
111
112#if CONFIG_ETRAX_FLASH_BUSWIDTH==2
113 lsrq 1, $r11
114#endif
115 ;; Set up GPIO
116 move.d [$r2], $r9
117 move.d [$r7], $r4
118 or.b (1<<ALE) | (1 << CLE) | (1<<CE), $r4
119 move.d $r4, [$r7]
120
121 ;; Set up bif
122 move.d [$r8], $r4
123 and.d CSP_MASK, $r4
124 or.d CSP_VAL, $r4
125 move.d $r4, [$r8]
126
1271: ;; Copy one page
128 CLR CE
129 SET CLE
130 moveq READ_CMD, $r4
131 move.b $r4, [$r1]
132 moveq 20, $r4
1332: bne 2b
134 subq 1, $r4
135 CLR CLE
136 SET ALE
137 clear.w [$r1] ; Column address = 0
138 move.d $r11, $r4
139 lsrq 8, $r4
140 move.b $r4, [$r1] ; Row address
141 lsrq 8, $r4
142 move.b $r4, [$r1] ; Row address
143 moveq 20, $r4
1442: bne 2b
145 subq 1, $r4
146 CLR ALE
1472: move.d [$r3], $r4
148 and.d 1 << BY, $r4
149 beq 2b
150 movu.w PAGE_SIZE, $r5
1512: ; Copy one byte/word
152#if CONFIG_ETRAX_FLASH_BUSWIDTH==2
153 move.w [$r0], $r4
154#else
155 move.b [$r0], $r4
156#endif
157 subq 1, $r5
158 bne 2b
159#if CONFIG_ETRAX_FLASH_BUSWIDTH==2
160 move.w $r4, [$r10+]
161 subu.w PAGE_SIZE*2, $r12
162#else
163 move.b $r4, [$r10+]
164 subu.w PAGE_SIZE, $r12
165#endif
166 bpl 1b
167 addu.w PAGE_SIZE, $r11
168
169 ;; End of copy
170 jump $r13
171 nop
172
173 ;; This will warn if the code above is too large. If you consider
174 ;; to remove this you don't understand the bug/feature.
175 .org 256
176 .org ERASE_BLOCK
177
178normal_boot:
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index 091ed6192ae8..d1f377f5d3b6 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -160,7 +160,7 @@ config VT_CONSOLE
160 160
161config HW_CONSOLE 161config HW_CONSOLE
162 bool 162 bool
163 depends on VT && !S390 && !UM 163 depends on VT
164 default y 164 default y
165 165
166comment "Unix98 PTY support" 166comment "Unix98 PTY support"
@@ -195,7 +195,7 @@ config UNIX98_PTYS
195 195
196source "drivers/char/pcmcia/Kconfig" 196source "drivers/char/pcmcia/Kconfig"
197 197
198source "drivers/serial/Kconfig" 198source "drivers/tty/serial/Kconfig"
199 199
200source "drivers/i2c/Kconfig" 200source "drivers/i2c/Kconfig"
201 201
diff --git a/arch/ia64/configs/generic_defconfig b/arch/ia64/configs/generic_defconfig
index 0e5cd1405e0e..43ab1cd097a5 100644
--- a/arch/ia64/configs/generic_defconfig
+++ b/arch/ia64/configs/generic_defconfig
@@ -234,4 +234,4 @@ CONFIG_CRYPTO_MD5=y
234# CONFIG_CRYPTO_ANSI_CPRNG is not set 234# CONFIG_CRYPTO_ANSI_CPRNG is not set
235CONFIG_CRC_T10DIF=y 235CONFIG_CRC_T10DIF=y
236CONFIG_MISC_DEVICES=y 236CONFIG_MISC_DEVICES=y
237CONFIG_DMAR=y 237CONFIG_INTEL_IOMMU=y
diff --git a/arch/ia64/dig/Makefile b/arch/ia64/dig/Makefile
index 2f7caddf093e..ae16ec4f6308 100644
--- a/arch/ia64/dig/Makefile
+++ b/arch/ia64/dig/Makefile
@@ -6,7 +6,7 @@
6# 6#
7 7
8obj-y := setup.o 8obj-y := setup.o
9ifeq ($(CONFIG_DMAR), y) 9ifeq ($(CONFIG_INTEL_IOMMU), y)
10obj-$(CONFIG_IA64_GENERIC) += machvec.o machvec_vtd.o 10obj-$(CONFIG_IA64_GENERIC) += machvec.o machvec_vtd.o
11else 11else
12obj-$(CONFIG_IA64_GENERIC) += machvec.o 12obj-$(CONFIG_IA64_GENERIC) += machvec.o
diff --git a/arch/ia64/hp/common/sba_iommu.c b/arch/ia64/hp/common/sba_iommu.c
index 80241fe03f50..f5f4ef149aac 100644
--- a/arch/ia64/hp/common/sba_iommu.c
+++ b/arch/ia64/hp/common/sba_iommu.c
@@ -915,7 +915,7 @@ sba_mark_invalid(struct ioc *ioc, dma_addr_t iova, size_t byte_cnt)
915 * @dir: R/W or both. 915 * @dir: R/W or both.
916 * @attrs: optional dma attributes 916 * @attrs: optional dma attributes
917 * 917 *
918 * See Documentation/PCI/PCI-DMA-mapping.txt 918 * See Documentation/DMA-API-HOWTO.txt
919 */ 919 */
920static dma_addr_t sba_map_page(struct device *dev, struct page *page, 920static dma_addr_t sba_map_page(struct device *dev, struct page *page,
921 unsigned long poff, size_t size, 921 unsigned long poff, size_t size,
@@ -1044,7 +1044,7 @@ sba_mark_clean(struct ioc *ioc, dma_addr_t iova, size_t size)
1044 * @dir: R/W or both. 1044 * @dir: R/W or both.
1045 * @attrs: optional dma attributes 1045 * @attrs: optional dma attributes
1046 * 1046 *
1047 * See Documentation/PCI/PCI-DMA-mapping.txt 1047 * See Documentation/DMA-API-HOWTO.txt
1048 */ 1048 */
1049static void sba_unmap_page(struct device *dev, dma_addr_t iova, size_t size, 1049static void sba_unmap_page(struct device *dev, dma_addr_t iova, size_t size,
1050 enum dma_data_direction dir, struct dma_attrs *attrs) 1050 enum dma_data_direction dir, struct dma_attrs *attrs)
@@ -1127,7 +1127,7 @@ void sba_unmap_single_attrs(struct device *dev, dma_addr_t iova, size_t size,
1127 * @size: number of bytes mapped in driver buffer. 1127 * @size: number of bytes mapped in driver buffer.
1128 * @dma_handle: IOVA of new buffer. 1128 * @dma_handle: IOVA of new buffer.
1129 * 1129 *
1130 * See Documentation/PCI/PCI-DMA-mapping.txt 1130 * See Documentation/DMA-API-HOWTO.txt
1131 */ 1131 */
1132static void * 1132static void *
1133sba_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flags) 1133sba_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t flags)
@@ -1190,7 +1190,7 @@ sba_alloc_coherent (struct device *dev, size_t size, dma_addr_t *dma_handle, gfp
1190 * @vaddr: virtual address IOVA of "consistent" buffer. 1190 * @vaddr: virtual address IOVA of "consistent" buffer.
1191 * @dma_handler: IO virtual address of "consistent" buffer. 1191 * @dma_handler: IO virtual address of "consistent" buffer.
1192 * 1192 *
1193 * See Documentation/PCI/PCI-DMA-mapping.txt 1193 * See Documentation/DMA-API-HOWTO.txt
1194 */ 1194 */
1195static void sba_free_coherent (struct device *dev, size_t size, void *vaddr, 1195static void sba_free_coherent (struct device *dev, size_t size, void *vaddr,
1196 dma_addr_t dma_handle) 1196 dma_addr_t dma_handle)
@@ -1453,7 +1453,7 @@ static void sba_unmap_sg_attrs(struct device *dev, struct scatterlist *sglist,
1453 * @dir: R/W or both. 1453 * @dir: R/W or both.
1454 * @attrs: optional dma attributes 1454 * @attrs: optional dma attributes
1455 * 1455 *
1456 * See Documentation/PCI/PCI-DMA-mapping.txt 1456 * See Documentation/DMA-API-HOWTO.txt
1457 */ 1457 */
1458static int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist, 1458static int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist,
1459 int nents, enum dma_data_direction dir, 1459 int nents, enum dma_data_direction dir,
@@ -1549,7 +1549,7 @@ static int sba_map_sg_attrs(struct device *dev, struct scatterlist *sglist,
1549 * @dir: R/W or both. 1549 * @dir: R/W or both.
1550 * @attrs: optional dma attributes 1550 * @attrs: optional dma attributes
1551 * 1551 *
1552 * See Documentation/PCI/PCI-DMA-mapping.txt 1552 * See Documentation/DMA-API-HOWTO.txt
1553 */ 1553 */
1554static void sba_unmap_sg_attrs(struct device *dev, struct scatterlist *sglist, 1554static void sba_unmap_sg_attrs(struct device *dev, struct scatterlist *sglist,
1555 int nents, enum dma_data_direction dir, 1555 int nents, enum dma_data_direction dir,
diff --git a/arch/ia64/hp/sim/simeth.c b/arch/ia64/hp/sim/simeth.c
index 7e81966ce481..47afcc61f6e5 100644
--- a/arch/ia64/hp/sim/simeth.c
+++ b/arch/ia64/hp/sim/simeth.c
@@ -172,7 +172,7 @@ static const struct net_device_ops simeth_netdev_ops = {
172 .ndo_stop = simeth_close, 172 .ndo_stop = simeth_close,
173 .ndo_start_xmit = simeth_tx, 173 .ndo_start_xmit = simeth_tx,
174 .ndo_get_stats = simeth_get_stats, 174 .ndo_get_stats = simeth_get_stats,
175 .ndo_set_multicast_list = set_multicast_list, /* not yet used */ 175 .ndo_set_rx_mode = set_multicast_list, /* not yet used */
176 176
177}; 177};
178 178
diff --git a/arch/ia64/include/asm/device.h b/arch/ia64/include/asm/device.h
index d66d446b127c..d05e78f6db94 100644
--- a/arch/ia64/include/asm/device.h
+++ b/arch/ia64/include/asm/device.h
@@ -10,7 +10,7 @@ struct dev_archdata {
10#ifdef CONFIG_ACPI 10#ifdef CONFIG_ACPI
11 void *acpi_handle; 11 void *acpi_handle;
12#endif 12#endif
13#ifdef CONFIG_DMAR 13#ifdef CONFIG_INTEL_IOMMU
14 void *iommu; /* hook for IOMMU specific extension */ 14 void *iommu; /* hook for IOMMU specific extension */
15#endif 15#endif
16}; 16};
diff --git a/arch/ia64/include/asm/iommu.h b/arch/ia64/include/asm/iommu.h
index 745e095fe82e..105c93b00b1b 100644
--- a/arch/ia64/include/asm/iommu.h
+++ b/arch/ia64/include/asm/iommu.h
@@ -7,12 +7,14 @@
7 7
8extern void pci_iommu_shutdown(void); 8extern void pci_iommu_shutdown(void);
9extern void no_iommu_init(void); 9extern void no_iommu_init(void);
10#ifdef CONFIG_INTEL_IOMMU
10extern int force_iommu, no_iommu; 11extern int force_iommu, no_iommu;
11extern int iommu_detected;
12#ifdef CONFIG_DMAR
13extern int iommu_pass_through; 12extern int iommu_pass_through;
13extern int iommu_detected;
14#else 14#else
15#define iommu_pass_through (0) 15#define iommu_pass_through (0)
16#define no_iommu (1)
17#define iommu_detected (0)
16#endif 18#endif
17extern void iommu_dma_init(void); 19extern void iommu_dma_init(void);
18extern void machvec_init(const char *name); 20extern void machvec_init(const char *name);
diff --git a/arch/ia64/include/asm/pci.h b/arch/ia64/include/asm/pci.h
index 73b5f785e70c..127dd7be346a 100644
--- a/arch/ia64/include/asm/pci.h
+++ b/arch/ia64/include/asm/pci.h
@@ -139,7 +139,7 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
139 return channel ? isa_irq_to_vector(15) : isa_irq_to_vector(14); 139 return channel ? isa_irq_to_vector(15) : isa_irq_to_vector(14);
140} 140}
141 141
142#ifdef CONFIG_DMAR 142#ifdef CONFIG_INTEL_IOMMU
143extern void pci_iommu_alloc(void); 143extern void pci_iommu_alloc(void);
144#endif 144#endif
145#endif /* _ASM_IA64_PCI_H */ 145#endif /* _ASM_IA64_PCI_H */
diff --git a/arch/ia64/kernel/Makefile b/arch/ia64/kernel/Makefile
index 395c2f216dd8..d959c84904be 100644
--- a/arch/ia64/kernel/Makefile
+++ b/arch/ia64/kernel/Makefile
@@ -43,7 +43,7 @@ obj-$(CONFIG_IA64_ESI) += esi.o
43ifneq ($(CONFIG_IA64_ESI),) 43ifneq ($(CONFIG_IA64_ESI),)
44obj-y += esi_stub.o # must be in kernel proper 44obj-y += esi_stub.o # must be in kernel proper
45endif 45endif
46obj-$(CONFIG_DMAR) += pci-dma.o 46obj-$(CONFIG_INTEL_IOMMU) += pci-dma.o
47obj-$(CONFIG_SWIOTLB) += pci-swiotlb.o 47obj-$(CONFIG_SWIOTLB) += pci-swiotlb.o
48 48
49obj-$(CONFIG_BINFMT_ELF) += elfcore.o 49obj-$(CONFIG_BINFMT_ELF) += elfcore.o
diff --git a/arch/ia64/kernel/acpi.c b/arch/ia64/kernel/acpi.c
index 3be485a300b1..bfb4d01e0e51 100644
--- a/arch/ia64/kernel/acpi.c
+++ b/arch/ia64/kernel/acpi.c
@@ -88,7 +88,7 @@ acpi_get_sysname(void)
88 struct acpi_table_rsdp *rsdp; 88 struct acpi_table_rsdp *rsdp;
89 struct acpi_table_xsdt *xsdt; 89 struct acpi_table_xsdt *xsdt;
90 struct acpi_table_header *hdr; 90 struct acpi_table_header *hdr;
91#ifdef CONFIG_DMAR 91#ifdef CONFIG_INTEL_IOMMU
92 u64 i, nentries; 92 u64 i, nentries;
93#endif 93#endif
94 94
@@ -125,7 +125,7 @@ acpi_get_sysname(void)
125 return "xen"; 125 return "xen";
126 } 126 }
127 127
128#ifdef CONFIG_DMAR 128#ifdef CONFIG_INTEL_IOMMU
129 /* Look for Intel IOMMU */ 129 /* Look for Intel IOMMU */
130 nentries = (hdr->length - sizeof(*hdr)) / 130 nentries = (hdr->length - sizeof(*hdr)) /
131 sizeof(xsdt->table_offset_entry[0]); 131 sizeof(xsdt->table_offset_entry[0]);
diff --git a/arch/ia64/kernel/msi_ia64.c b/arch/ia64/kernel/msi_ia64.c
index 009df5434a7a..94e0db72d4a6 100644
--- a/arch/ia64/kernel/msi_ia64.c
+++ b/arch/ia64/kernel/msi_ia64.c
@@ -131,7 +131,7 @@ void arch_teardown_msi_irq(unsigned int irq)
131 return ia64_teardown_msi_irq(irq); 131 return ia64_teardown_msi_irq(irq);
132} 132}
133 133
134#ifdef CONFIG_DMAR 134#ifdef CONFIG_INTEL_IOMMU
135#ifdef CONFIG_SMP 135#ifdef CONFIG_SMP
136static int dmar_msi_set_affinity(struct irq_data *data, 136static int dmar_msi_set_affinity(struct irq_data *data,
137 const struct cpumask *mask, bool force) 137 const struct cpumask *mask, bool force)
@@ -210,5 +210,5 @@ int arch_setup_dmar_msi(unsigned int irq)
210 "edge"); 210 "edge");
211 return 0; 211 return 0;
212} 212}
213#endif /* CONFIG_DMAR */ 213#endif /* CONFIG_INTEL_IOMMU */
214 214
diff --git a/arch/ia64/kernel/pci-dma.c b/arch/ia64/kernel/pci-dma.c
index f6b1ff0aea76..c16162c70860 100644
--- a/arch/ia64/kernel/pci-dma.c
+++ b/arch/ia64/kernel/pci-dma.c
@@ -14,7 +14,7 @@
14 14
15#include <asm/system.h> 15#include <asm/system.h>
16 16
17#ifdef CONFIG_DMAR 17#ifdef CONFIG_INTEL_IOMMU
18 18
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20 20
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index b92b9445255d..6c4e9aaa70c1 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -10,6 +10,7 @@ config M32R
10 select HAVE_GENERIC_HARDIRQS 10 select HAVE_GENERIC_HARDIRQS
11 select GENERIC_IRQ_PROBE 11 select GENERIC_IRQ_PROBE
12 select GENERIC_IRQ_SHOW 12 select GENERIC_IRQ_SHOW
13 select GENERIC_ATOMIC64
13 14
14config SBUS 15config SBUS
15 bool 16 bool
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 9e8ee9d2b8ca..6c28582fb98f 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -21,6 +21,15 @@ config ARCH_HAS_ILOG2_U32
21config ARCH_HAS_ILOG2_U64 21config ARCH_HAS_ILOG2_U64
22 bool 22 bool
23 23
24config GENERIC_CLOCKEVENTS
25 bool
26
27config GENERIC_CMOS_UPDATE
28 def_bool !MMU
29
30config GENERIC_GPIO
31 bool
32
24config GENERIC_HWEIGHT 33config GENERIC_HWEIGHT
25 bool 34 bool
26 default y 35 default y
@@ -29,10 +38,16 @@ config GENERIC_CALIBRATE_DELAY
29 bool 38 bool
30 default y 39 default y
31 40
41config GENERIC_IOMAP
42 def_bool MMU
43
32config TIME_LOW_RES 44config TIME_LOW_RES
33 bool 45 bool
34 default y 46 default y
35 47
48config ARCH_USES_GETTIMEOFFSET
49 def_bool MMU
50
36config NO_IOPORT 51config NO_IOPORT
37 def_bool y 52 def_bool y
38 53
@@ -62,13 +77,31 @@ config MMU
62 Select if you want MMU-based virtualised addressing space 77 Select if you want MMU-based virtualised addressing space
63 support by paged memory management. If unsure, say 'Y'. 78 support by paged memory management. If unsure, say 'Y'.
64 79
65menu "Platform dependent setup" 80config MMU_MOTOROLA
81 bool
82
83config MMU_SUN3
84 bool
85 depends on MMU && !MMU_MOTOROLA
86
87menu "Platform setup"
88
89source arch/m68k/Kconfig.cpu
90
91source arch/m68k/Kconfig.machine
92
93source arch/m68k/Kconfig.bus
94
95endmenu
96
97menu "Kernel Features"
66 98
67if MMU 99if COLDFIRE
68source arch/m68k/Kconfig.mmu 100source "kernel/Kconfig.preempt"
69endif 101endif
70if !MMU 102
71source arch/m68k/Kconfig.nommu 103if !MMU || COLDFIRE
104source "kernel/time/Kconfig"
72endif 105endif
73 106
74source "mm/Kconfig" 107source "mm/Kconfig"
@@ -85,9 +118,9 @@ if !MMU
85menu "Power management options" 118menu "Power management options"
86 119
87config PM 120config PM
88 bool "Power Management support" 121 bool "Power Management support"
89 help 122 help
90 Support processor power management modes 123 Support processor power management modes
91 124
92endmenu 125endmenu
93endif 126endif
@@ -96,151 +129,7 @@ source "net/Kconfig"
96 129
97source "drivers/Kconfig" 130source "drivers/Kconfig"
98 131
99if MMU 132source "arch/m68k/Kconfig.devices"
100
101menu "Character devices"
102
103config ATARI_MFPSER
104 tristate "Atari MFP serial support"
105 depends on ATARI
106 ---help---
107 If you like to use the MFP serial ports ("Modem1", "Serial1") under
108 Linux, say Y. The driver equally supports all kinds of MFP serial
109 ports and automatically detects whether Serial1 is available.
110
111 To compile this driver as a module, choose M here.
112
113 Note for Falcon users: You also have an MFP port, it's just not
114 wired to the outside... But you could use the port under Linux.
115
116config ATARI_MIDI
117 tristate "Atari MIDI serial support"
118 depends on ATARI
119 help
120 If you want to use your Atari's MIDI port in Linux, say Y.
121
122 To compile this driver as a module, choose M here.
123
124config ATARI_DSP56K
125 tristate "Atari DSP56k support (EXPERIMENTAL)"
126 depends on ATARI && EXPERIMENTAL
127 help
128 If you want to be able to use the DSP56001 in Falcons, say Y. This
129 driver is still experimental, and if you don't know what it is, or
130 if you don't have this processor, just say N.
131
132 To compile this driver as a module, choose M here.
133
134config AMIGA_BUILTIN_SERIAL
135 tristate "Amiga builtin serial support"
136 depends on AMIGA
137 help
138 If you want to use your Amiga's built-in serial port in Linux,
139 answer Y.
140
141 To compile this driver as a module, choose M here.
142
143config MULTIFACE_III_TTY
144 tristate "Multiface Card III serial support"
145 depends on AMIGA
146 help
147 If you want to use a Multiface III card's serial port in Linux,
148 answer Y.
149
150 To compile this driver as a module, choose M here.
151
152config GVPIOEXT
153 tristate "GVP IO-Extender support"
154 depends on PARPORT=n && ZORRO
155 help
156 If you want to use a GVP IO-Extender serial card in Linux, say Y.
157 Otherwise, say N.
158
159config GVPIOEXT_LP
160 tristate "GVP IO-Extender parallel printer support"
161 depends on GVPIOEXT
162 help
163 Say Y to enable driving a printer from the parallel port on your
164 GVP IO-Extender card, N otherwise.
165
166config GVPIOEXT_PLIP
167 tristate "GVP IO-Extender PLIP support"
168 depends on GVPIOEXT
169 help
170 Say Y to enable doing IP over the parallel port on your GVP
171 IO-Extender card, N otherwise.
172
173config MAC_HID
174 bool
175 depends on INPUT_ADBHID
176 default y
177
178config HPDCA
179 tristate "HP DCA serial support"
180 depends on DIO && SERIAL_8250
181 help
182 If you want to use the internal "DCA" serial ports on an HP300
183 machine, say Y here.
184
185config HPAPCI
186 tristate "HP APCI serial support"
187 depends on HP300 && SERIAL_8250 && EXPERIMENTAL
188 help
189 If you want to use the internal "APCI" serial ports on an HP400
190 machine, say Y here.
191
192config MVME147_SCC
193 bool "SCC support for MVME147 serial ports"
194 depends on MVME147 && BROKEN
195 help
196 This is the driver for the serial ports on the Motorola MVME147
197 boards. Everyone using one of these boards should say Y here.
198
199config MVME162_SCC
200 bool "SCC support for MVME162 serial ports"
201 depends on MVME16x && BROKEN
202 help
203 This is the driver for the serial ports on the Motorola MVME162 and
204 172 boards. Everyone using one of these boards should say Y here.
205
206config BVME6000_SCC
207 bool "SCC support for BVME6000 serial ports"
208 depends on BVME6000 && BROKEN
209 help
210 This is the driver for the serial ports on the BVME4000 and BVME6000
211 boards from BVM Ltd. Everyone using one of these boards should say
212 Y here.
213
214config DN_SERIAL
215 bool "Support for DN serial port (dummy)"
216 depends on APOLLO
217
218config SERIAL_CONSOLE
219 bool "Support for serial port console"
220 depends on (AMIGA || ATARI || SUN3 || SUN3X || VME || APOLLO) && (ATARI_MFPSER=y || ATARI_MIDI=y || AMIGA_BUILTIN_SERIAL=y || GVPIOEXT=y || MULTIFACE_III_TTY=y || SERIAL=y || MVME147_SCC || SERIAL167 || MVME162_SCC || BVME6000_SCC || DN_SERIAL)
221 ---help---
222 If you say Y here, it will be possible to use a serial port as the
223 system console (the system console is the device which receives all
224 kernel messages and warnings and which allows logins in single user
225 mode). This could be useful if some terminal or printer is connected
226 to that serial port.
227
228 Even if you say Y here, the currently visible virtual console
229 (/dev/tty0) will still be used as the system console by default, but
230 you can alter that using a kernel command line option such as
231 "console=ttyS1". (Try "man bootparam" or see the documentation of
232 your boot loader (lilo or loadlin) about how to pass options to the
233 kernel at boot time.)
234
235 If you don't have a VGA card installed and you say Y here, the
236 kernel will automatically use the first serial line, /dev/ttyS0, as
237 system console.
238
239 If unsure, say N.
240
241endmenu
242
243endif
244 133
245source "fs/Kconfig" 134source "fs/Kconfig"
246 135
diff --git a/arch/m68k/Kconfig.bus b/arch/m68k/Kconfig.bus
new file mode 100644
index 000000000000..8294f0c1785e
--- /dev/null
+++ b/arch/m68k/Kconfig.bus
@@ -0,0 +1,55 @@
1if MMU
2
3comment "Bus Support"
4
5config NUBUS
6 bool
7 depends on MAC
8 default y
9
10config ZORRO
11 bool "Amiga Zorro (AutoConfig) bus support"
12 depends on AMIGA
13 help
14 This enables support for the Zorro bus in the Amiga. If you have
15 expansion cards in your Amiga that conform to the Amiga
16 AutoConfig(tm) specification, say Y, otherwise N. Note that even
17 expansion cards that do not fit in the Zorro slots but fit in e.g.
18 the CPU slot may fall in this category, so you have to say Y to let
19 Linux use these.
20
21config AMIGA_PCMCIA
22 bool "Amiga 1200/600 PCMCIA support (EXPERIMENTAL)"
23 depends on AMIGA && EXPERIMENTAL
24 help
25 Include support in the kernel for pcmcia on Amiga 1200 and Amiga
26 600. If you intend to use pcmcia cards say Y; otherwise say N.
27
28config ISA
29 bool
30 depends on Q40 || AMIGA_PCMCIA
31 default y
32 help
33 Find out whether you have ISA slots on your motherboard. ISA is the
34 name of a bus system, i.e. the way the CPU talks to the other stuff
35 inside your box. Other bus systems are PCI, EISA, MicroChannel
36 (MCA) or VESA. ISA is an older system, now being displaced by PCI;
37 newer boards don't support it. If you have ISA, say Y, otherwise N.
38
39config GENERIC_ISA_DMA
40 def_bool ISA
41
42source "drivers/pci/Kconfig"
43
44source "drivers/zorro/Kconfig"
45
46endif
47
48if !MMU
49
50config ISA_DMA_API
51 def_bool !M5272
52
53source "drivers/pcmcia/Kconfig"
54
55endif
diff --git a/arch/m68k/Kconfig.cpu b/arch/m68k/Kconfig.cpu
new file mode 100644
index 000000000000..e632b2d12106
--- /dev/null
+++ b/arch/m68k/Kconfig.cpu
@@ -0,0 +1,429 @@
1comment "Processor Type"
2
3config M68000
4 bool
5 select CPU_HAS_NO_BITFIELDS
6 help
7 The Freescale (was Motorola) 68000 CPU is the first generation of
8 the well known M68K family of processors. The CPU core as well as
9 being available as a stand alone CPU was also used in many
10 System-On-Chip devices (eg 68328, 68302, etc). It does not contain
11 a paging MMU.
12
13config MCPU32
14 bool
15 select CPU_HAS_NO_BITFIELDS
16 help
17 The Freescale (was then Motorola) CPU32 is a CPU core that is
18 based on the 68020 processor. For the most part it is used in
19 System-On-Chip parts, and does not contain a paging MMU.
20
21config COLDFIRE
22 bool
23 select GENERIC_GPIO
24 select ARCH_REQUIRE_GPIOLIB
25 select CPU_HAS_NO_BITFIELDS
26 help
27 The Freescale ColdFire family of processors is a modern derivitive
28 of the 68000 processor family. They are mainly targeted at embedded
29 applications, and are all System-On-Chip (SOC) devices, as opposed
30 to stand alone CPUs. They implement a subset of the original 68000
31 processor instruction set.
32
33config M68020
34 bool "68020 support"
35 depends on MMU
36 help
37 If you anticipate running this kernel on a computer with a MC68020
38 processor, say Y. Otherwise, say N. Note that the 68020 requires a
39 68851 MMU (Memory Management Unit) to run Linux/m68k, except on the
40 Sun 3, which provides its own version.
41
42config M68030
43 bool "68030 support"
44 depends on MMU && !MMU_SUN3
45 help
46 If you anticipate running this kernel on a computer with a MC68030
47 processor, say Y. Otherwise, say N. Note that a MC68EC030 will not
48 work, as it does not include an MMU (Memory Management Unit).
49
50config M68040
51 bool "68040 support"
52 depends on MMU && !MMU_SUN3
53 help
54 If you anticipate running this kernel on a computer with a MC68LC040
55 or MC68040 processor, say Y. Otherwise, say N. Note that an
56 MC68EC040 will not work, as it does not include an MMU (Memory
57 Management Unit).
58
59config M68060
60 bool "68060 support"
61 depends on MMU && !MMU_SUN3
62 help
63 If you anticipate running this kernel on a computer with a MC68060
64 processor, say Y. Otherwise, say N.
65
66config M68328
67 bool "MC68328"
68 depends on !MMU
69 select M68000
70 help
71 Motorola 68328 processor support.
72
73config M68EZ328
74 bool "MC68EZ328"
75 depends on !MMU
76 select M68000
77 help
78 Motorola 68EX328 processor support.
79
80config M68VZ328
81 bool "MC68VZ328"
82 depends on !MMU
83 select M68000
84 help
85 Motorola 68VZ328 processor support.
86
87config M68360
88 bool "MC68360"
89 depends on !MMU
90 select MCPU32
91 help
92 Motorola 68360 processor support.
93
94config M5206
95 bool "MCF5206"
96 depends on !MMU
97 select COLDFIRE
98 select COLDFIRE_SW_A7
99 select HAVE_MBAR
100 help
101 Motorola ColdFire 5206 processor support.
102
103config M5206e
104 bool "MCF5206e"
105 depends on !MMU
106 select COLDFIRE
107 select COLDFIRE_SW_A7
108 select HAVE_MBAR
109 help
110 Motorola ColdFire 5206e processor support.
111
112config M520x
113 bool "MCF520x"
114 depends on !MMU
115 select COLDFIRE
116 select GENERIC_CLOCKEVENTS
117 select HAVE_CACHE_SPLIT
118 help
119 Freescale Coldfire 5207/5208 processor support.
120
121config M523x
122 bool "MCF523x"
123 depends on !MMU
124 select COLDFIRE
125 select GENERIC_CLOCKEVENTS
126 select HAVE_CACHE_SPLIT
127 select HAVE_IPSBAR
128 help
129 Freescale Coldfire 5230/1/2/4/5 processor support
130
131config M5249
132 bool "MCF5249"
133 depends on !MMU
134 select COLDFIRE
135 select COLDFIRE_SW_A7
136 select HAVE_MBAR
137 help
138 Motorola ColdFire 5249 processor support.
139
140config M527x
141 bool
142
143config M5271
144 bool "MCF5271"
145 depends on !MMU
146 select COLDFIRE
147 select M527x
148 select HAVE_CACHE_SPLIT
149 select HAVE_IPSBAR
150 select GENERIC_CLOCKEVENTS
151 help
152 Freescale (Motorola) ColdFire 5270/5271 processor support.
153
154config M5272
155 bool "MCF5272"
156 depends on !MMU
157 select COLDFIRE
158 select COLDFIRE_SW_A7
159 select HAVE_MBAR
160 help
161 Motorola ColdFire 5272 processor support.
162
163config M5275
164 bool "MCF5275"
165 depends on !MMU
166 select COLDFIRE
167 select M527x
168 select HAVE_CACHE_SPLIT
169 select HAVE_IPSBAR
170 select GENERIC_CLOCKEVENTS
171 help
172 Freescale (Motorola) ColdFire 5274/5275 processor support.
173
174config M528x
175 bool "MCF528x"
176 depends on !MMU
177 select COLDFIRE
178 select GENERIC_CLOCKEVENTS
179 select HAVE_CACHE_SPLIT
180 select HAVE_IPSBAR
181 help
182 Motorola ColdFire 5280/5282 processor support.
183
184config M5307
185 bool "MCF5307"
186 depends on !MMU
187 select COLDFIRE
188 select COLDFIRE_SW_A7
189 select HAVE_CACHE_CB
190 select HAVE_MBAR
191 help
192 Motorola ColdFire 5307 processor support.
193
194config M532x
195 bool "MCF532x"
196 depends on !MMU
197 select COLDFIRE
198 select HAVE_CACHE_CB
199 help
200 Freescale (Motorola) ColdFire 532x processor support.
201
202config M5407
203 bool "MCF5407"
204 depends on !MMU
205 select COLDFIRE
206 select COLDFIRE_SW_A7
207 select HAVE_CACHE_CB
208 select HAVE_MBAR
209 help
210 Motorola ColdFire 5407 processor support.
211
212config M54xx
213 bool
214
215config M547x
216 bool "MCF547x"
217 depends on !MMU
218 select COLDFIRE
219 select M54xx
220 select HAVE_CACHE_CB
221 select HAVE_MBAR
222 help
223 Freescale ColdFire 5470/5471/5472/5473/5474/5475 processor support.
224
225config M548x
226 bool "MCF548x"
227 depends on !MMU
228 select COLDFIRE
229 select M54xx
230 select HAVE_CACHE_CB
231 select HAVE_MBAR
232 help
233 Freescale ColdFire 5480/5481/5482/5483/5484/5485 processor support.
234
235
236comment "Processor Specific Options"
237
238config M68KFPU_EMU
239 bool "Math emulation support (EXPERIMENTAL)"
240 depends on MMU
241 depends on EXPERIMENTAL
242 help
243 At some point in the future, this will cause floating-point math
244 instructions to be emulated by the kernel on machines that lack a
245 floating-point math coprocessor. Thrill-seekers and chronically
246 sleep-deprived psychotic hacker types can say Y now, everyone else
247 should probably wait a while.
248
249config M68KFPU_EMU_EXTRAPREC
250 bool "Math emulation extra precision"
251 depends on M68KFPU_EMU
252 help
253 The fpu uses normally a few bit more during calculations for
254 correct rounding, the emulator can (often) do the same but this
255 extra calculation can cost quite some time, so you can disable
256 it here. The emulator will then "only" calculate with a 64 bit
257 mantissa and round slightly incorrect, what is more than enough
258 for normal usage.
259
260config M68KFPU_EMU_ONLY
261 bool "Math emulation only kernel"
262 depends on M68KFPU_EMU
263 help
264 This option prevents any floating-point instructions from being
265 compiled into the kernel, thereby the kernel doesn't save any
266 floating point context anymore during task switches, so this
267 kernel will only be usable on machines without a floating-point
268 math coprocessor. This makes the kernel a bit faster as no tests
269 needs to be executed whether a floating-point instruction in the
270 kernel should be executed or not.
271
272config ADVANCED
273 bool "Advanced configuration options"
274 depends on MMU
275 ---help---
276 This gives you access to some advanced options for the CPU. The
277 defaults should be fine for most users, but these options may make
278 it possible for you to improve performance somewhat if you know what
279 you are doing.
280
281 Note that the answer to this question won't directly affect the
282 kernel: saying N will just cause the configurator to skip all
283 the questions about these options.
284
285 Most users should say N to this question.
286
287config RMW_INSNS
288 bool "Use read-modify-write instructions"
289 depends on ADVANCED
290 ---help---
291 This allows to use certain instructions that work with indivisible
292 read-modify-write bus cycles. While this is faster than the
293 workaround of disabling interrupts, it can conflict with DMA
294 ( = direct memory access) on many Amiga systems, and it is also said
295 to destabilize other machines. It is very likely that this will
296 cause serious problems on any Amiga or Atari Medusa if set. The only
297 configuration where it should work are 68030-based Ataris, where it
298 apparently improves performance. But you've been warned! Unless you
299 really know what you are doing, say N. Try Y only if you're quite
300 adventurous.
301
302config SINGLE_MEMORY_CHUNK
303 bool "Use one physical chunk of memory only" if ADVANCED && !SUN3
304 depends on MMU
305 default y if SUN3
306 select NEED_MULTIPLE_NODES
307 help
308 Ignore all but the first contiguous chunk of physical memory for VM
309 purposes. This will save a few bytes kernel size and may speed up
310 some operations. Say N if not sure.
311
312config ARCH_DISCONTIGMEM_ENABLE
313 def_bool MMU && !SINGLE_MEMORY_CHUNK
314
315config 060_WRITETHROUGH
316 bool "Use write-through caching for 68060 supervisor accesses"
317 depends on ADVANCED && M68060
318 ---help---
319 The 68060 generally uses copyback caching of recently accessed data.
320 Copyback caching means that memory writes will be held in an on-chip
321 cache and only written back to memory some time later. Saying Y
322 here will force supervisor (kernel) accesses to use writethrough
323 caching. Writethrough caching means that data is written to memory
324 straight away, so that cache and memory data always agree.
325 Writethrough caching is less efficient, but is needed for some
326 drivers on 68060 based systems where the 68060 bus snooping signal
327 is hardwired on. The 53c710 SCSI driver is known to suffer from
328 this problem.
329
330config M68K_L2_CACHE
331 bool
332 depends on MAC
333 default y
334
335config NODES_SHIFT
336 int
337 default "3"
338 depends on !SINGLE_MEMORY_CHUNK
339
340config FPU
341 bool
342
343config COLDFIRE_SW_A7
344 bool
345
346config HAVE_CACHE_SPLIT
347 bool
348
349config HAVE_CACHE_CB
350 bool
351
352config HAVE_MBAR
353 bool
354
355config HAVE_IPSBAR
356 bool
357
358config CLOCK_SET
359 bool "Enable setting the CPU clock frequency"
360 depends on COLDFIRE
361 default n
362 help
363 On some CPU's you do not need to know what the core CPU clock
364 frequency is. On these you can disable clock setting. On some
365 traditional 68K parts, and on all ColdFire parts you need to set
366 the appropriate CPU clock frequency. On these devices many of the
367 onboard peripherals derive their timing from the master CPU clock
368 frequency.
369
370config CLOCK_FREQ
371 int "Set the core clock frequency"
372 default "66666666"
373 depends on CLOCK_SET
374 help
375 Define the CPU clock frequency in use. This is the core clock
376 frequency, it may or may not be the same as the external clock
377 crystal fitted to your board. Some processors have an internal
378 PLL and can have their frequency programmed at run time, others
379 use internal dividers. In general the kernel won't setup a PLL
380 if it is fitted (there are some exceptions). This value will be
381 specific to the exact CPU that you are using.
382
383config OLDMASK
384 bool "Old mask 5307 (1H55J) silicon"
385 depends on M5307
386 help
387 Build support for the older revision ColdFire 5307 silicon.
388 Specifically this is the 1H55J mask revision.
389
390if HAVE_CACHE_SPLIT
391choice
392 prompt "Split Cache Configuration"
393 default CACHE_I
394
395config CACHE_I
396 bool "Instruction"
397 help
398 Use all of the ColdFire CPU cache memory as an instruction cache.
399
400config CACHE_D
401 bool "Data"
402 help
403 Use all of the ColdFire CPU cache memory as a data cache.
404
405config CACHE_BOTH
406 bool "Both"
407 help
408 Split the ColdFire CPU cache, and use half as an instruction cache
409 and half as a data cache.
410endchoice
411endif
412
413if HAVE_CACHE_CB
414choice
415 prompt "Data cache mode"
416 default CACHE_WRITETHRU
417
418config CACHE_WRITETHRU
419 bool "Write-through"
420 help
421 The ColdFire CPU cache is set into Write-through mode.
422
423config CACHE_COPYBACK
424 bool "Copy-back"
425 help
426 The ColdFire CPU cache is set into Copy-back mode.
427endchoice
428endif
429
diff --git a/arch/m68k/Kconfig.devices b/arch/m68k/Kconfig.devices
new file mode 100644
index 000000000000..d214034be6a6
--- /dev/null
+++ b/arch/m68k/Kconfig.devices
@@ -0,0 +1,123 @@
1if MMU
2
3config ARCH_MAY_HAVE_PC_FDC
4 bool
5 depends on BROKEN && (Q40 || SUN3X)
6 default y
7
8menu "Platform devices"
9
10config HEARTBEAT
11 bool "Use power LED as a heartbeat" if AMIGA || APOLLO || ATARI || MAC ||Q40
12 default y if !AMIGA && !APOLLO && !ATARI && !MAC && !Q40 && HP300
13 help
14 Use the power-on LED on your machine as a load meter. The exact
15 behavior is platform-dependent, but normally the flash frequency is
16 a hyperbolic function of the 5-minute load average.
17
18# We have a dedicated heartbeat LED. :-)
19config PROC_HARDWARE
20 bool "/proc/hardware support"
21 help
22 Say Y here to support the /proc/hardware file, which gives you
23 access to information about the machine you're running on,
24 including the model, CPU, MMU, clock speed, BogoMIPS rating,
25 and memory size.
26
27endmenu
28
29menu "Character devices"
30
31config ATARI_MFPSER
32 tristate "Atari MFP serial support"
33 depends on ATARI
34 ---help---
35 If you like to use the MFP serial ports ("Modem1", "Serial1") under
36 Linux, say Y. The driver equally supports all kinds of MFP serial
37 ports and automatically detects whether Serial1 is available.
38
39 To compile this driver as a module, choose M here.
40
41 Note for Falcon users: You also have an MFP port, it's just not
42 wired to the outside... But you could use the port under Linux.
43
44config ATARI_MIDI
45 tristate "Atari MIDI serial support"
46 depends on ATARI
47 help
48 If you want to use your Atari's MIDI port in Linux, say Y.
49
50 To compile this driver as a module, choose M here.
51
52config ATARI_DSP56K
53 tristate "Atari DSP56k support (EXPERIMENTAL)"
54 depends on ATARI && EXPERIMENTAL
55 help
56 If you want to be able to use the DSP56001 in Falcons, say Y. This
57 driver is still experimental, and if you don't know what it is, or
58 if you don't have this processor, just say N.
59
60 To compile this driver as a module, choose M here.
61
62config AMIGA_BUILTIN_SERIAL
63 tristate "Amiga builtin serial support"
64 depends on AMIGA
65 help
66 If you want to use your Amiga's built-in serial port in Linux,
67 answer Y.
68
69 To compile this driver as a module, choose M here.
70
71config MULTIFACE_III_TTY
72 tristate "Multiface Card III serial support"
73 depends on AMIGA
74 help
75 If you want to use a Multiface III card's serial port in Linux,
76 answer Y.
77
78 To compile this driver as a module, choose M here.
79
80config HPDCA
81 tristate "HP DCA serial support"
82 depends on DIO && SERIAL_8250
83 help
84 If you want to use the internal "DCA" serial ports on an HP300
85 machine, say Y here.
86
87config HPAPCI
88 tristate "HP APCI serial support"
89 depends on HP300 && SERIAL_8250 && EXPERIMENTAL
90 help
91 If you want to use the internal "APCI" serial ports on an HP400
92 machine, say Y here.
93
94config DN_SERIAL
95 bool "Support for DN serial port (dummy)"
96 depends on APOLLO
97
98config SERIAL_CONSOLE
99 bool "Support for serial port console"
100 depends on (AMIGA || ATARI || SUN3 || SUN3X || VME || APOLLO) && (ATARI_MFPSER=y || ATARI_MIDI=y || AMIGA_BUILTIN_SERIAL=y || MULTIFACE_III_TTY=y || SERIAL=y || SERIAL167 || DN_SERIAL)
101 ---help---
102 If you say Y here, it will be possible to use a serial port as the
103 system console (the system console is the device which receives all
104 kernel messages and warnings and which allows logins in single user
105 mode). This could be useful if some terminal or printer is connected
106 to that serial port.
107
108 Even if you say Y here, the currently visible virtual console
109 (/dev/tty0) will still be used as the system console by default, but
110 you can alter that using a kernel command line option such as
111 "console=ttyS1". (Try "man bootparam" or see the documentation of
112 your boot loader (lilo or loadlin) about how to pass options to the
113 kernel at boot time.)
114
115 If you don't have a VGA card installed and you say Y here, the
116 kernel will automatically use the first serial line, /dev/ttyS0, as
117 system console.
118
119 If unsure, say N.
120
121endmenu
122
123endif
diff --git a/arch/m68k/Kconfig.nommu b/arch/m68k/Kconfig.machine
index ff46383112a4..ef4a26aff780 100644
--- a/arch/m68k/Kconfig.nommu
+++ b/arch/m68k/Kconfig.machine
@@ -1,297 +1,142 @@
1config FPU 1comment "Machine Types"
2 bool 2
3 default n 3config AMIGA
4 4 bool "Amiga support"
5config GENERIC_GPIO 5 depends on MMU
6 bool 6 select MMU_MOTOROLA if MMU
7 default n 7 help
8 8 This option enables support for the Amiga series of computers. If
9config GENERIC_CMOS_UPDATE 9 you plan to use this kernel on an Amiga, say Y here and browse the
10 bool 10 material available in <file:Documentation/m68k>; otherwise say N.
11 default y 11
12 12config ATARI
13config GENERIC_CLOCKEVENTS 13 bool "Atari support"
14 bool 14 depends on MMU
15 default n 15 select MMU_MOTOROLA if MMU
16 16 help
17config M68000 17 This option enables support for the 68000-based Atari series of
18 bool 18 computers (including the TT, Falcon and Medusa). If you plan to use
19 select CPU_HAS_NO_BITFIELDS 19 this kernel on an Atari, say Y here and browse the material
20 help 20 available in <file:Documentation/m68k>; otherwise say N.
21 The Freescale (was Motorola) 68000 CPU is the first generation of 21
22 the well known M68K family of processors. The CPU core as well as 22config MAC
23 being available as a stand alone CPU was also used in many 23 bool "Macintosh support"
24 System-On-Chip devices (eg 68328, 68302, etc). It does not contain 24 depends on MMU
25 a paging MMU. 25 select MMU_MOTOROLA if MMU
26 26 help
27config MCPU32 27 This option enables support for the Apple Macintosh series of
28 bool 28 computers (yes, there is experimental support now, at least for part
29 select CPU_HAS_NO_BITFIELDS 29 of the series).
30 help 30
31 The Freescale (was then Motorola) CPU32 is a CPU core that is 31 Say N unless you're willing to code the remaining necessary support.
32 based on the 68020 processor. For the most part it is used in 32 ;)
33 System-On-Chip parts, and does not contain a paging MMU. 33
34 34config APOLLO
35config COLDFIRE 35 bool "Apollo support"
36 bool 36 depends on MMU
37 select GENERIC_GPIO 37 select MMU_MOTOROLA if MMU
38 select ARCH_REQUIRE_GPIOLIB 38 help
39 select CPU_HAS_NO_BITFIELDS 39 Say Y here if you want to run Linux on an MC680x0-based Apollo
40 help 40 Domain workstation such as the DN3500.
41 The Freescale ColdFire family of processors is a modern derivitive 41
42 of the 68000 processor family. They are mainly targeted at embedded 42config VME
43 applications, and are all System-On-Chip (SOC) devices, as opposed 43 bool "VME (Motorola and BVM) support"
44 to stand alone CPUs. They implement a subset of the original 68000 44 depends on MMU
45 processor instruction set. 45 select MMU_MOTOROLA if MMU
46 46 help
47config COLDFIRE_SW_A7 47 Say Y here if you want to build a kernel for a 680x0 based VME
48 bool 48 board. Boards currently supported include Motorola boards MVME147,
49 default n 49 MVME162, MVME166, MVME167, MVME172, and MVME177. BVME4000 and
50 50 BVME6000 boards from BVM Ltd are also supported.
51config HAVE_CACHE_SPLIT 51
52 bool 52config MVME147
53 53 bool "MVME147 support"
54config HAVE_CACHE_CB 54 depends on MMU
55 bool 55 depends on VME
56 56 help
57config HAVE_MBAR 57 Say Y to include support for early Motorola VME boards. This will
58 bool 58 build a kernel which can run on MVME147 single-board computers. If
59 59 you select this option you will have to select the appropriate
60config HAVE_IPSBAR 60 drivers for SCSI, Ethernet and serial ports later on.
61 bool 61
62 62config MVME16x
63choice 63 bool "MVME162, 166 and 167 support"
64 prompt "CPU" 64 depends on MMU
65 default M68EZ328 65 depends on VME
66 66 help
67config M68328 67 Say Y to include support for Motorola VME boards. This will build a
68 bool "MC68328" 68 kernel which can run on MVME162, MVME166, MVME167, MVME172, and
69 select M68000 69 MVME177 boards. If you select this option you will have to select
70 help 70 the appropriate drivers for SCSI, Ethernet and serial ports later
71 Motorola 68328 processor support. 71 on.
72 72
73config M68EZ328 73config BVME6000
74 bool "MC68EZ328" 74 bool "BVME4000 and BVME6000 support"
75 select M68000 75 depends on MMU
76 help 76 depends on VME
77 Motorola 68EX328 processor support. 77 help
78 78 Say Y to include support for VME boards from BVM Ltd. This will
79config M68VZ328 79 build a kernel which can run on BVME4000 and BVME6000 boards. If
80 bool "MC68VZ328" 80 you select this option you will have to select the appropriate
81 select M68000 81 drivers for SCSI, Ethernet and serial ports later on.
82 help 82
83 Motorola 68VZ328 processor support. 83config HP300
84 84 bool "HP9000/300 and HP9000/400 support"
85config M68360 85 depends on MMU
86 bool "MC68360" 86 select MMU_MOTOROLA if MMU
87 select MCPU32 87 help
88 help 88 This option enables support for the HP9000/300 and HP9000/400 series
89 Motorola 68360 processor support. 89 of workstations. Support for these machines is still somewhat
90 90 experimental. If you plan to try to use the kernel on such a machine
91config M5206 91 say Y here.
92 bool "MCF5206" 92 Everybody else says N.
93 select COLDFIRE 93
94 select COLDFIRE_SW_A7 94config SUN3X
95 select HAVE_MBAR 95 bool "Sun3x support"
96 help 96 depends on MMU
97 Motorola ColdFire 5206 processor support. 97 select MMU_MOTOROLA if MMU
98 select M68030
99 help
100 This option enables support for the Sun 3x series of workstations.
101 Be warned that this support is very experimental.
102 Note that Sun 3x kernels are not compatible with Sun 3 hardware.
103 General Linux information on the Sun 3x series (now discontinued)
104 is at <http://www.angelfire.com/ca2/tech68k/sun3.html>.
105
106 If you don't want to compile a kernel for a Sun 3x, say N.
107
108config Q40
109 bool "Q40/Q60 support"
110 depends on MMU
111 select MMU_MOTOROLA if MMU
112 help
113 The Q40 is a Motorola 68040-based successor to the Sinclair QL
114 manufactured in Germany. There is an official Q40 home page at
115 <http://www.q40.de/>. This option enables support for the Q40 and
116 Q60. Select your CPU below. For 68LC060 don't forget to enable FPU
117 emulation.
118
119config SUN3
120 bool "Sun3 support"
121 depends on MMU
122 depends on !MMU_MOTOROLA
123 select MMU_SUN3 if MMU
124 select M68020
125 help
126 This option enables support for the Sun 3 series of workstations
127 (3/50, 3/60, 3/1xx, 3/2xx systems). Enabling this option requires
128 that all other hardware types must be disabled, as Sun 3 kernels
129 are incompatible with all other m68k targets (including Sun 3x!).
130
131 If you don't want to compile a kernel exclusively for a Sun 3, say N.
98 132
99config M5206e 133config PILOT
100 bool "MCF5206e"
101 select COLDFIRE
102 select COLDFIRE_SW_A7
103 select HAVE_MBAR
104 help
105 Motorola ColdFire 5206e processor support.
106
107config M520x
108 bool "MCF520x"
109 select COLDFIRE
110 select GENERIC_CLOCKEVENTS
111 select HAVE_CACHE_SPLIT
112 help
113 Freescale Coldfire 5207/5208 processor support.
114
115config M523x
116 bool "MCF523x"
117 select COLDFIRE
118 select GENERIC_CLOCKEVENTS
119 select HAVE_CACHE_SPLIT
120 select HAVE_IPSBAR
121 help
122 Freescale Coldfire 5230/1/2/4/5 processor support
123
124config M5249
125 bool "MCF5249"
126 select COLDFIRE
127 select COLDFIRE_SW_A7
128 select HAVE_MBAR
129 help
130 Motorola ColdFire 5249 processor support.
131
132config M5271
133 bool "MCF5271"
134 select COLDFIRE
135 select HAVE_CACHE_SPLIT
136 select HAVE_IPSBAR
137 help
138 Freescale (Motorola) ColdFire 5270/5271 processor support.
139
140config M5272
141 bool "MCF5272"
142 select COLDFIRE
143 select COLDFIRE_SW_A7
144 select HAVE_MBAR
145 help
146 Motorola ColdFire 5272 processor support.
147
148config M5275
149 bool "MCF5275"
150 select COLDFIRE
151 select HAVE_CACHE_SPLIT
152 select HAVE_IPSBAR
153 help
154 Freescale (Motorola) ColdFire 5274/5275 processor support.
155
156config M528x
157 bool "MCF528x"
158 select COLDFIRE
159 select GENERIC_CLOCKEVENTS
160 select HAVE_CACHE_SPLIT
161 select HAVE_IPSBAR
162 help
163 Motorola ColdFire 5280/5282 processor support.
164
165config M5307
166 bool "MCF5307"
167 select COLDFIRE
168 select COLDFIRE_SW_A7
169 select HAVE_CACHE_CB
170 select HAVE_MBAR
171 help
172 Motorola ColdFire 5307 processor support.
173
174config M532x
175 bool "MCF532x"
176 select COLDFIRE
177 select HAVE_CACHE_CB
178 help
179 Freescale (Motorola) ColdFire 532x processor support.
180
181config M5407
182 bool "MCF5407"
183 select COLDFIRE
184 select COLDFIRE_SW_A7
185 select HAVE_CACHE_CB
186 select HAVE_MBAR
187 help
188 Motorola ColdFire 5407 processor support.
189
190config M547x
191 bool "MCF547x"
192 select COLDFIRE
193 select HAVE_CACHE_CB
194 select HAVE_MBAR
195 help
196 Freescale ColdFire 5470/5471/5472/5473/5474/5475 processor support.
197
198config M548x
199 bool "MCF548x"
200 select COLDFIRE
201 select HAVE_CACHE_CB
202 select HAVE_MBAR
203 help
204 Freescale ColdFire 5480/5481/5482/5483/5484/5485 processor support.
205
206endchoice
207
208config M527x
209 bool
210 depends on (M5271 || M5275)
211 select GENERIC_CLOCKEVENTS
212 default y
213
214config M54xx
215 bool 134 bool
216 depends on (M548x || M547x)
217 default y
218
219config CLOCK_SET
220 bool "Enable setting the CPU clock frequency"
221 default n
222 help
223 On some CPU's you do not need to know what the core CPU clock
224 frequency is. On these you can disable clock setting. On some
225 traditional 68K parts, and on all ColdFire parts you need to set
226 the appropriate CPU clock frequency. On these devices many of the
227 onboard peripherals derive their timing from the master CPU clock
228 frequency.
229
230config CLOCK_FREQ
231 int "Set the core clock frequency"
232 default "66666666"
233 depends on CLOCK_SET
234 help
235 Define the CPU clock frequency in use. This is the core clock
236 frequency, it may or may not be the same as the external clock
237 crystal fitted to your board. Some processors have an internal
238 PLL and can have their frequency programmed at run time, others
239 use internal dividers. In general the kernel won't setup a PLL
240 if it is fitted (there are some exceptions). This value will be
241 specific to the exact CPU that you are using.
242
243config OLDMASK
244 bool "Old mask 5307 (1H55J) silicon"
245 depends on M5307
246 help
247 Build support for the older revision ColdFire 5307 silicon.
248 Specifically this is the 1H55J mask revision.
249
250if HAVE_CACHE_SPLIT
251choice
252 prompt "Split Cache Configuration"
253 default CACHE_I
254
255config CACHE_I
256 bool "Instruction"
257 help
258 Use all of the ColdFire CPU cache memory as an instruction cache.
259
260config CACHE_D
261 bool "Data"
262 help
263 Use all of the ColdFire CPU cache memory as a data cache.
264
265config CACHE_BOTH
266 bool "Both"
267 help
268 Split the ColdFire CPU cache, and use half as an instruction cache
269 and half as a data cache.
270endchoice
271endif
272
273if HAVE_CACHE_CB
274choice
275 prompt "Data cache mode"
276 default CACHE_WRITETHRU
277
278config CACHE_WRITETHRU
279 bool "Write-through"
280 help
281 The ColdFire CPU cache is set into Write-through mode.
282
283config CACHE_COPYBACK
284 bool "Copy-back"
285 help
286 The ColdFire CPU cache is set into Copy-back mode.
287endchoice
288endif
289
290comment "Platform"
291 135
292config PILOT3 136config PILOT3
293 bool "Pilot 1000/5000, PalmPilot Personal/Pro, or PalmIII support" 137 bool "Pilot 1000/5000, PalmPilot Personal/Pro, or PalmIII support"
294 depends on M68328 138 depends on M68328
139 select PILOT
295 help 140 help
296 Support for the Palm Pilot 1000/5000, Personal/Pro and PalmIII. 141 Support for the Palm Pilot 1000/5000, Personal/Pro and PalmIII.
297 142
@@ -302,7 +147,7 @@ config XCOPILOT_BUGS
302 Support the bugs of Xcopilot. 147 Support the bugs of Xcopilot.
303 148
304config UC5272 149config UC5272
305 bool 'Arcturus Networks uC5272 dimm board support' 150 bool "Arcturus Networks uC5272 dimm board support"
306 depends on M5272 151 depends on M5272
307 help 152 help
308 Support for the Arcturus Networks uC5272 dimm board. 153 Support for the Arcturus Networks uC5272 dimm board.
@@ -356,15 +201,23 @@ config UCQUICC
356 help 201 help
357 Support for the Lineo uCquicc board. 202 Support for the Lineo uCquicc board.
358 203
204config ARNEWSH
205 bool
206
359config ARN5206 207config ARN5206
360 bool "Arnewsh 5206 board support" 208 bool "Arnewsh 5206 board support"
361 depends on M5206 209 depends on M5206
210 select ARNEWSH
362 help 211 help
363 Support for the Arnewsh 5206 board. 212 Support for the Arnewsh 5206 board.
364 213
214config FREESCALE
215 bool
216
365config M5206eC3 217config M5206eC3
366 bool "Motorola M5206eC3 board support" 218 bool "Motorola M5206eC3 board support"
367 depends on M5206e 219 depends on M5206e
220 select FREESCALE
368 help 221 help
369 Support for the Motorola M5206eC3 board. 222 Support for the Motorola M5206eC3 board.
370 223
@@ -377,75 +230,92 @@ config ELITE
377config M5208EVB 230config M5208EVB
378 bool "Freescale M5208EVB board support" 231 bool "Freescale M5208EVB board support"
379 depends on M520x 232 depends on M520x
233 select FREESCALE
380 help 234 help
381 Support for the Freescale Coldfire M5208EVB. 235 Support for the Freescale Coldfire M5208EVB.
382 236
383config M5235EVB 237config M5235EVB
384 bool "Freescale M5235EVB support" 238 bool "Freescale M5235EVB support"
385 depends on M523x 239 depends on M523x
240 select FREESCALE
386 help 241 help
387 Support for the Freescale M5235EVB board. 242 Support for the Freescale M5235EVB board.
388 243
389config M5249C3 244config M5249C3
390 bool "Motorola M5249C3 board support" 245 bool "Motorola M5249C3 board support"
391 depends on M5249 246 depends on M5249
247 select FREESCALE
392 help 248 help
393 Support for the Motorola M5249C3 board. 249 Support for the Motorola M5249C3 board.
394 250
395config M5271EVB 251config M5271EVB
396 bool "Freescale (Motorola) M5271EVB board support" 252 bool "Freescale (Motorola) M5271EVB board support"
397 depends on M5271 253 depends on M5271
254 select FREESCALE
398 help 255 help
399 Support for the Freescale (Motorola) M5271EVB board. 256 Support for the Freescale (Motorola) M5271EVB board.
400 257
401config M5275EVB 258config M5275EVB
402 bool "Freescale (Motorola) M5275EVB board support" 259 bool "Freescale (Motorola) M5275EVB board support"
403 depends on M5275 260 depends on M5275
261 select FREESCALE
404 help 262 help
405 Support for the Freescale (Motorola) M5275EVB board. 263 Support for the Freescale (Motorola) M5275EVB board.
406 264
407config M5272C3 265config M5272C3
408 bool "Motorola M5272C3 board support" 266 bool "Motorola M5272C3 board support"
409 depends on M5272 267 depends on M5272
268 select FREESCALE
410 help 269 help
411 Support for the Motorola M5272C3 board. 270 Support for the Motorola M5272C3 board.
412 271
272config senTec
273 bool
274
413config COBRA5272 275config COBRA5272
414 bool "senTec COBRA5272 board support" 276 bool "senTec COBRA5272 board support"
415 depends on M5272 277 depends on M5272
278 select senTec
416 help 279 help
417 Support for the senTec COBRA5272 board. 280 Support for the senTec COBRA5272 board.
418 281
282config AVNET
283 bool
284
419config AVNET5282 285config AVNET5282
420 bool "Avnet 5282 board support" 286 bool "Avnet 5282 board support"
421 depends on M528x 287 depends on M528x
288 select AVNET
422 help 289 help
423 Support for the Avnet 5282 board. 290 Support for the Avnet 5282 board.
424 291
425config M5282EVB 292config M5282EVB
426 bool "Motorola M5282EVB board support" 293 bool "Motorola M5282EVB board support"
427 depends on M528x 294 depends on M528x
295 select FREESCALE
428 help 296 help
429 Support for the Motorola M5282EVB board. 297 Support for the Motorola M5282EVB board.
430 298
431config COBRA5282 299config COBRA5282
432 bool "senTec COBRA5282 board support" 300 bool "senTec COBRA5282 board support"
433 depends on M528x 301 depends on M528x
302 select senTec
434 help 303 help
435 Support for the senTec COBRA5282 board. 304 Support for the senTec COBRA5282 board.
436 305
437config SOM5282EM 306config SOM5282EM
438 bool "EMAC.Inc SOM5282EM board support" 307 bool "EMAC.Inc SOM5282EM board support"
439 depends on M528x 308 depends on M528x
309 select EMAC_INC
440 help 310 help
441 Support for the EMAC.Inc SOM5282EM module. 311 Support for the EMAC.Inc SOM5282EM module.
442 312
443config WILDFIRE 313config WILDFIRE
444 bool "Intec Automation Inc. WildFire board support" 314 bool "Intec Automation Inc. WildFire board support"
445 depends on M528x 315 depends on M528x
446 help 316 help
447 Support for the Intec Automation Inc. WildFire. 317 Support for the Intec Automation Inc. WildFire.
448 318
449config WILDFIREMOD 319config WILDFIREMOD
450 bool "Intec Automation Inc. WildFire module support" 320 bool "Intec Automation Inc. WildFire module support"
451 depends on M528x 321 depends on M528x
@@ -455,12 +325,14 @@ config WILDFIREMOD
455config ARN5307 325config ARN5307
456 bool "Arnewsh 5307 board support" 326 bool "Arnewsh 5307 board support"
457 depends on M5307 327 depends on M5307
328 select ARNEWSH
458 help 329 help
459 Support for the Arnewsh 5307 board. 330 Support for the Arnewsh 5307 board.
460 331
461config M5307C3 332config M5307C3
462 bool "Motorola M5307C3 board support" 333 bool "Motorola M5307C3 board support"
463 depends on M5307 334 depends on M5307
335 select FREESCALE
464 help 336 help
465 Support for the Motorola M5307C3 board. 337 Support for the Motorola M5307C3 board.
466 338
@@ -473,6 +345,7 @@ config SECUREEDGEMP3
473config M5329EVB 345config M5329EVB
474 bool "Freescale (Motorola) M5329EVB board support" 346 bool "Freescale (Motorola) M5329EVB board support"
475 depends on M532x 347 depends on M532x
348 select FREESCALE
476 help 349 help
477 Support for the Freescale (Motorola) M5329EVB board. 350 Support for the Freescale (Motorola) M5329EVB board.
478 351
@@ -485,6 +358,7 @@ config COBRA5329
485config M5407C3 358config M5407C3
486 bool "Motorola M5407C3 board support" 359 bool "Motorola M5407C3 board support"
487 depends on M5407 360 depends on M5407
361 select FREESCALE
488 help 362 help
489 Support for the Motorola M5407C3 board. 363 Support for the Motorola M5407C3 board.
490 364
@@ -524,9 +398,13 @@ config SNAPGEAR
524 help 398 help
525 Special additional support for SnapGear router boards. 399 Special additional support for SnapGear router boards.
526 400
401config SNEHA
402 bool
403
527config CPU16B 404config CPU16B
528 bool "Sneha Technologies S.L. Sarasvati board support" 405 bool "Sneha Technologies S.L. Sarasvati board support"
529 depends on M5272 406 depends on M5272
407 select SNEHA
530 help 408 help
531 Support for the SNEHA CPU16B board. 409 Support for the SNEHA CPU16B board.
532 410
@@ -536,63 +414,20 @@ config MOD5272
536 help 414 help
537 Support for the Netburner MOD-5272 board. 415 Support for the Netburner MOD-5272 board.
538 416
417config SAVANT
418 bool
419
539config SAVANTrosie1 420config SAVANTrosie1
540 bool "Savant Rosie1 board support" 421 bool "Savant Rosie1 board support"
541 depends on M523x 422 depends on M523x
423 select SAVANT
542 help 424 help
543 Support for the Savant Rosie1 board. 425 Support for the Savant Rosie1 board.
544 426
545config ROMFS_FROM_ROM
546 bool "ROMFS image not RAM resident"
547 depends on (NETtel || SNAPGEAR)
548 help
549 The ROMfs filesystem will stay resident in the FLASH/ROM, not be
550 moved into RAM.
551
552config PILOT
553 bool
554 default y
555 depends on (PILOT3 || PILOT5)
556
557config ARNEWSH
558 bool
559 default y
560 depends on (ARN5206 || ARN5307)
561
562config FREESCALE
563 bool
564 default y
565 depends on (M5206eC3 || M5208EVB || M5235EVB || M5249C3 || M5271EVB || M5272C3 || M5275EVB || M5282EVB || M5307C3 || M5329EVB || M5407C3)
566
567config HW_FEITH
568 bool
569 default y
570 depends on (CLEOPATRA || CANCam || SCALES)
571
572config senTec
573 bool
574 default y
575 depends on (COBRA5272 || COBRA5282)
576
577config EMAC_INC
578 bool
579 default y
580 depends on (SOM5282EM)
581 427
582config SNEHA 428if !MMU || COLDFIRE
583 bool
584 default y
585 depends on CPU16B
586 429
587config SAVANT 430comment "Machine Options"
588 bool
589 default y
590 depends on SAVANTrosie1
591
592config AVNET
593 bool
594 default y
595 depends on (AVNET5282)
596 431
597config UBOOT 432config UBOOT
598 bool "Support for U-Boot command line parameters" 433 bool "Support for U-Boot command line parameters"
@@ -673,33 +508,6 @@ config KERNELBASE
673 a system with the RAM based at address 0, and leaving enough room 508 a system with the RAM based at address 0, and leaving enough room
674 for the theoretical maximum number of 256 vectors. 509 for the theoretical maximum number of 256 vectors.
675 510
676choice
677 prompt "RAM bus width"
678 default RAMAUTOBIT
679
680config RAMAUTOBIT
681 bool "AUTO"
682 help
683 Select the physical RAM data bus size. Not needed on most platforms,
684 so you can generally choose AUTO.
685
686config RAM8BIT
687 bool "8bit"
688 help
689 Configure RAM bus to be 8 bits wide.
690
691config RAM16BIT
692 bool "16bit"
693 help
694 Configure RAM bus to be 16 bits wide.
695
696config RAM32BIT
697 bool "32bit"
698 help
699 Configure RAM bus to be 32 bits wide.
700
701endchoice
702
703comment "ROM configuration" 511comment "ROM configuration"
704 512
705config ROM 513config ROM
@@ -772,16 +580,4 @@ config ROMKERNEL
772 580
773endchoice 581endchoice
774 582
775if COLDFIRE
776source "kernel/Kconfig.preempt"
777endif 583endif
778
779source "kernel/time/Kconfig"
780
781config ISA_DMA_API
782 bool
783 depends on !M5272
784 default y
785
786source "drivers/pcmcia/Kconfig"
787
diff --git a/arch/m68k/Kconfig.mmu b/arch/m68k/Kconfig.mmu
deleted file mode 100644
index 13e20bbc4079..000000000000
--- a/arch/m68k/Kconfig.mmu
+++ /dev/null
@@ -1,411 +0,0 @@
1config GENERIC_IOMAP
2 bool
3 default y
4
5config ARCH_MAY_HAVE_PC_FDC
6 bool
7 depends on BROKEN && (Q40 || SUN3X)
8 default y
9
10config ARCH_USES_GETTIMEOFFSET
11 def_bool y
12
13config EISA
14 bool
15 ---help---
16 The Extended Industry Standard Architecture (EISA) bus was
17 developed as an open alternative to the IBM MicroChannel bus.
18
19 The EISA bus provided some of the features of the IBM MicroChannel
20 bus while maintaining backward compatibility with cards made for
21 the older ISA bus. The EISA bus saw limited use between 1988 and
22 1995 when it was made obsolete by the PCI bus.
23
24 Say Y here if you are building a kernel for an EISA-based machine.
25
26 Otherwise, say N.
27
28config MCA
29 bool
30 help
31 MicroChannel Architecture is found in some IBM PS/2 machines and
32 laptops. It is a bus system similar to PCI or ISA. See
33 <file:Documentation/mca.txt> (and especially the web page given
34 there) before attempting to build an MCA bus kernel.
35
36config PCMCIA
37 tristate
38 ---help---
39 Say Y here if you want to attach PCMCIA- or PC-cards to your Linux
40 computer. These are credit-card size devices such as network cards,
41 modems or hard drives often used with laptops computers. There are
42 actually two varieties of these cards: the older 16 bit PCMCIA cards
43 and the newer 32 bit CardBus cards. If you want to use CardBus
44 cards, you need to say Y here and also to "CardBus support" below.
45
46 To use your PC-cards, you will need supporting software from David
47 Hinds' pcmcia-cs package (see the file <file:Documentation/Changes>
48 for location). Please also read the PCMCIA-HOWTO, available from
49 <http://www.tldp.org/docs.html#howto>.
50
51 To compile this driver as modules, choose M here: the
52 modules will be called pcmcia_core and ds.
53
54config AMIGA
55 bool "Amiga support"
56 select MMU_MOTOROLA if MMU
57 help
58 This option enables support for the Amiga series of computers. If
59 you plan to use this kernel on an Amiga, say Y here and browse the
60 material available in <file:Documentation/m68k>; otherwise say N.
61
62config ATARI
63 bool "Atari support"
64 select MMU_MOTOROLA if MMU
65 help
66 This option enables support for the 68000-based Atari series of
67 computers (including the TT, Falcon and Medusa). If you plan to use
68 this kernel on an Atari, say Y here and browse the material
69 available in <file:Documentation/m68k>; otherwise say N.
70
71config MAC
72 bool "Macintosh support"
73 select MMU_MOTOROLA if MMU
74 help
75 This option enables support for the Apple Macintosh series of
76 computers (yes, there is experimental support now, at least for part
77 of the series).
78
79 Say N unless you're willing to code the remaining necessary support.
80 ;)
81
82config NUBUS
83 bool
84 depends on MAC
85 default y
86
87config M68K_L2_CACHE
88 bool
89 depends on MAC
90 default y
91
92config APOLLO
93 bool "Apollo support"
94 select MMU_MOTOROLA if MMU
95 help
96 Say Y here if you want to run Linux on an MC680x0-based Apollo
97 Domain workstation such as the DN3500.
98
99config VME
100 bool "VME (Motorola and BVM) support"
101 select MMU_MOTOROLA if MMU
102 help
103 Say Y here if you want to build a kernel for a 680x0 based VME
104 board. Boards currently supported include Motorola boards MVME147,
105 MVME162, MVME166, MVME167, MVME172, and MVME177. BVME4000 and
106 BVME6000 boards from BVM Ltd are also supported.
107
108config MVME147
109 bool "MVME147 support"
110 depends on VME
111 help
112 Say Y to include support for early Motorola VME boards. This will
113 build a kernel which can run on MVME147 single-board computers. If
114 you select this option you will have to select the appropriate
115 drivers for SCSI, Ethernet and serial ports later on.
116
117config MVME16x
118 bool "MVME162, 166 and 167 support"
119 depends on VME
120 help
121 Say Y to include support for Motorola VME boards. This will build a
122 kernel which can run on MVME162, MVME166, MVME167, MVME172, and
123 MVME177 boards. If you select this option you will have to select
124 the appropriate drivers for SCSI, Ethernet and serial ports later
125 on.
126
127config BVME6000
128 bool "BVME4000 and BVME6000 support"
129 depends on VME
130 help
131 Say Y to include support for VME boards from BVM Ltd. This will
132 build a kernel which can run on BVME4000 and BVME6000 boards. If
133 you select this option you will have to select the appropriate
134 drivers for SCSI, Ethernet and serial ports later on.
135
136config HP300
137 bool "HP9000/300 and HP9000/400 support"
138 select MMU_MOTOROLA if MMU
139 help
140 This option enables support for the HP9000/300 and HP9000/400 series
141 of workstations. Support for these machines is still somewhat
142 experimental. If you plan to try to use the kernel on such a machine
143 say Y here.
144 Everybody else says N.
145
146config DIO
147 bool "DIO bus support"
148 depends on HP300
149 default y
150 help
151 Say Y here to enable support for the "DIO" expansion bus used in
152 HP300 machines. If you are using such a system you almost certainly
153 want this.
154
155config SUN3X
156 bool "Sun3x support"
157 select MMU_MOTOROLA if MMU
158 select M68030
159 help
160 This option enables support for the Sun 3x series of workstations.
161 Be warned that this support is very experimental.
162 Note that Sun 3x kernels are not compatible with Sun 3 hardware.
163 General Linux information on the Sun 3x series (now discontinued)
164 is at <http://www.angelfire.com/ca2/tech68k/sun3.html>.
165
166 If you don't want to compile a kernel for a Sun 3x, say N.
167
168config Q40
169 bool "Q40/Q60 support"
170 select MMU_MOTOROLA if MMU
171 help
172 The Q40 is a Motorola 68040-based successor to the Sinclair QL
173 manufactured in Germany. There is an official Q40 home page at
174 <http://www.q40.de/>. This option enables support for the Q40 and
175 Q60. Select your CPU below. For 68LC060 don't forget to enable FPU
176 emulation.
177
178config SUN3
179 bool "Sun3 support"
180 depends on !MMU_MOTOROLA
181 select MMU_SUN3 if MMU
182 select M68020
183 help
184 This option enables support for the Sun 3 series of workstations
185 (3/50, 3/60, 3/1xx, 3/2xx systems). Enabling this option requires
186 that all other hardware types must be disabled, as Sun 3 kernels
187 are incompatible with all other m68k targets (including Sun 3x!).
188
189 If you don't want to compile a kernel exclusively for a Sun 3, say N.
190
191config NATFEAT
192 bool "ARAnyM emulator support"
193 depends on ATARI
194 help
195 This option enables support for ARAnyM native features, such as
196 access to a disk image as /dev/hda.
197
198config NFBLOCK
199 tristate "NatFeat block device support"
200 depends on BLOCK && NATFEAT
201 help
202 Say Y to include support for the ARAnyM NatFeat block device
203 which allows direct access to the hard drives without using
204 the hardware emulation.
205
206config NFCON
207 tristate "NatFeat console driver"
208 depends on NATFEAT
209 help
210 Say Y to include support for the ARAnyM NatFeat console driver
211 which allows the console output to be redirected to the stderr
212 output of ARAnyM.
213
214config NFETH
215 tristate "NatFeat Ethernet support"
216 depends on NET_ETHERNET && NATFEAT
217 help
218 Say Y to include support for the ARAnyM NatFeat network device
219 which will emulate a regular ethernet device while presenting an
220 ethertap device to the host system.
221
222comment "Processor type"
223
224config M68020
225 bool "68020 support"
226 help
227 If you anticipate running this kernel on a computer with a MC68020
228 processor, say Y. Otherwise, say N. Note that the 68020 requires a
229 68851 MMU (Memory Management Unit) to run Linux/m68k, except on the
230 Sun 3, which provides its own version.
231
232config M68030
233 bool "68030 support"
234 depends on !MMU_SUN3
235 help
236 If you anticipate running this kernel on a computer with a MC68030
237 processor, say Y. Otherwise, say N. Note that a MC68EC030 will not
238 work, as it does not include an MMU (Memory Management Unit).
239
240config M68040
241 bool "68040 support"
242 depends on !MMU_SUN3
243 help
244 If you anticipate running this kernel on a computer with a MC68LC040
245 or MC68040 processor, say Y. Otherwise, say N. Note that an
246 MC68EC040 will not work, as it does not include an MMU (Memory
247 Management Unit).
248
249config M68060
250 bool "68060 support"
251 depends on !MMU_SUN3
252 help
253 If you anticipate running this kernel on a computer with a MC68060
254 processor, say Y. Otherwise, say N.
255
256config MMU_MOTOROLA
257 bool
258
259config MMU_SUN3
260 bool
261 depends on MMU && !MMU_MOTOROLA
262
263config M68KFPU_EMU
264 bool "Math emulation support (EXPERIMENTAL)"
265 depends on EXPERIMENTAL
266 help
267 At some point in the future, this will cause floating-point math
268 instructions to be emulated by the kernel on machines that lack a
269 floating-point math coprocessor. Thrill-seekers and chronically
270 sleep-deprived psychotic hacker types can say Y now, everyone else
271 should probably wait a while.
272
273config M68KFPU_EMU_EXTRAPREC
274 bool "Math emulation extra precision"
275 depends on M68KFPU_EMU
276 help
277 The fpu uses normally a few bit more during calculations for
278 correct rounding, the emulator can (often) do the same but this
279 extra calculation can cost quite some time, so you can disable
280 it here. The emulator will then "only" calculate with a 64 bit
281 mantissa and round slightly incorrect, what is more than enough
282 for normal usage.
283
284config M68KFPU_EMU_ONLY
285 bool "Math emulation only kernel"
286 depends on M68KFPU_EMU
287 help
288 This option prevents any floating-point instructions from being
289 compiled into the kernel, thereby the kernel doesn't save any
290 floating point context anymore during task switches, so this
291 kernel will only be usable on machines without a floating-point
292 math coprocessor. This makes the kernel a bit faster as no tests
293 needs to be executed whether a floating-point instruction in the
294 kernel should be executed or not.
295
296config ADVANCED
297 bool "Advanced configuration options"
298 ---help---
299 This gives you access to some advanced options for the CPU. The
300 defaults should be fine for most users, but these options may make
301 it possible for you to improve performance somewhat if you know what
302 you are doing.
303
304 Note that the answer to this question won't directly affect the
305 kernel: saying N will just cause the configurator to skip all
306 the questions about these options.
307
308 Most users should say N to this question.
309
310config RMW_INSNS
311 bool "Use read-modify-write instructions"
312 depends on ADVANCED
313 ---help---
314 This allows to use certain instructions that work with indivisible
315 read-modify-write bus cycles. While this is faster than the
316 workaround of disabling interrupts, it can conflict with DMA
317 ( = direct memory access) on many Amiga systems, and it is also said
318 to destabilize other machines. It is very likely that this will
319 cause serious problems on any Amiga or Atari Medusa if set. The only
320 configuration where it should work are 68030-based Ataris, where it
321 apparently improves performance. But you've been warned! Unless you
322 really know what you are doing, say N. Try Y only if you're quite
323 adventurous.
324
325config SINGLE_MEMORY_CHUNK
326 bool "Use one physical chunk of memory only" if ADVANCED && !SUN3
327 default y if SUN3
328 select NEED_MULTIPLE_NODES
329 help
330 Ignore all but the first contiguous chunk of physical memory for VM
331 purposes. This will save a few bytes kernel size and may speed up
332 some operations. Say N if not sure.
333
334config 060_WRITETHROUGH
335 bool "Use write-through caching for 68060 supervisor accesses"
336 depends on ADVANCED && M68060
337 ---help---
338 The 68060 generally uses copyback caching of recently accessed data.
339 Copyback caching means that memory writes will be held in an on-chip
340 cache and only written back to memory some time later. Saying Y
341 here will force supervisor (kernel) accesses to use writethrough
342 caching. Writethrough caching means that data is written to memory
343 straight away, so that cache and memory data always agree.
344 Writethrough caching is less efficient, but is needed for some
345 drivers on 68060 based systems where the 68060 bus snooping signal
346 is hardwired on. The 53c710 SCSI driver is known to suffer from
347 this problem.
348
349config ARCH_DISCONTIGMEM_ENABLE
350 def_bool !SINGLE_MEMORY_CHUNK
351
352config NODES_SHIFT
353 int
354 default "3"
355 depends on !SINGLE_MEMORY_CHUNK
356
357config ZORRO
358 bool "Amiga Zorro (AutoConfig) bus support"
359 depends on AMIGA
360 help
361 This enables support for the Zorro bus in the Amiga. If you have
362 expansion cards in your Amiga that conform to the Amiga
363 AutoConfig(tm) specification, say Y, otherwise N. Note that even
364 expansion cards that do not fit in the Zorro slots but fit in e.g.
365 the CPU slot may fall in this category, so you have to say Y to let
366 Linux use these.
367
368config AMIGA_PCMCIA
369 bool "Amiga 1200/600 PCMCIA support (EXPERIMENTAL)"
370 depends on AMIGA && EXPERIMENTAL
371 help
372 Include support in the kernel for pcmcia on Amiga 1200 and Amiga
373 600. If you intend to use pcmcia cards say Y; otherwise say N.
374
375config HEARTBEAT
376 bool "Use power LED as a heartbeat" if AMIGA || APOLLO || ATARI || MAC ||Q40
377 default y if !AMIGA && !APOLLO && !ATARI && !MAC && !Q40 && HP300
378 help
379 Use the power-on LED on your machine as a load meter. The exact
380 behavior is platform-dependent, but normally the flash frequency is
381 a hyperbolic function of the 5-minute load average.
382
383# We have a dedicated heartbeat LED. :-)
384config PROC_HARDWARE
385 bool "/proc/hardware support"
386 help
387 Say Y here to support the /proc/hardware file, which gives you
388 access to information about the machine you're running on,
389 including the model, CPU, MMU, clock speed, BogoMIPS rating,
390 and memory size.
391
392config ISA
393 bool
394 depends on Q40 || AMIGA_PCMCIA
395 default y
396 help
397 Find out whether you have ISA slots on your motherboard. ISA is the
398 name of a bus system, i.e. the way the CPU talks to the other stuff
399 inside your box. Other bus systems are PCI, EISA, MicroChannel
400 (MCA) or VESA. ISA is an older system, now being displaced by PCI;
401 newer boards don't support it. If you have ISA, say Y, otherwise N.
402
403config GENERIC_ISA_DMA
404 bool
405 depends on Q40 || AMIGA_PCMCIA
406 default y
407
408source "drivers/pci/Kconfig"
409
410source "drivers/zorro/Kconfig"
411
diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
index be46cadd4017..cf318f20c64d 100644
--- a/arch/m68k/Makefile
+++ b/arch/m68k/Makefile
@@ -1,7 +1,171 @@
1#
2# m68k/Makefile
3#
4# This file is included by the global makefile so that you can add your own
5# architecture-specific flags and dependencies. Remember to do have actions
6# for "archclean" and "archdep" for cleaning up and making dependencies for
7# this architecture
8#
9# This file is subject to the terms and conditions of the GNU General Public
10# License. See the file "COPYING" in the main directory of this archive
11# for more details.
12#
13# Copyright (C) 1994 by Hamish Macdonald
14# Copyright (C) 2002,2011 Greg Ungerer <gerg@snapgear.com>
15#
16
1KBUILD_DEFCONFIG := multi_defconfig 17KBUILD_DEFCONFIG := multi_defconfig
2 18
19#
20# Enable processor type. Ordering of these is important - we want to
21# use the minimum processor type of the range we support. The logic
22# for 680x0 will only allow use of the -m68060 or -m68040 if no other
23# 680x0 type is specified - and no option is specified for 68030 or
24# 68020. The other m68k/ColdFire types always specify some type of
25# compiler cpu type flag.
26#
27ifndef CONFIG_M68040
28cpuflags-$(CONFIG_M68060) := -m68060
29endif
30ifndef CONFIG_M68060
31cpuflags-$(CONFIG_M68040) := -m68040
32endif
33cpuflags-$(CONFIG_M68030) :=
34cpuflags-$(CONFIG_M68020) :=
35cpuflags-$(CONFIG_M68360) := -m68332
36cpuflags-$(CONFIG_M68000) := -m68000
37cpuflags-$(CONFIG_M54xx) := $(call cc-option,-mcpu=5475,-m5200)
38cpuflags-$(CONFIG_M5407) := $(call cc-option,-mcpu=5407,-m5200)
39cpuflags-$(CONFIG_M532x) := $(call cc-option,-mcpu=532x,-m5307)
40cpuflags-$(CONFIG_M5307) := $(call cc-option,-mcpu=5307,-m5200)
41cpuflags-$(CONFIG_M528x) := $(call cc-option,-mcpu=528x,-m5307)
42cpuflags-$(CONFIG_M5275) := $(call cc-option,-mcpu=5275,-m5307)
43cpuflags-$(CONFIG_M5272) := $(call cc-option,-mcpu=5272,-m5307)
44cpuflags-$(CONFIG_M5271) := $(call cc-option,-mcpu=5271,-m5307)
45cpuflags-$(CONFIG_M523x) := $(call cc-option,-mcpu=523x,-m5307)
46cpuflags-$(CONFIG_M5249) := $(call cc-option,-mcpu=5249,-m5200)
47cpuflags-$(CONFIG_M520x) := $(call cc-option,-mcpu=5208,-m5200)
48cpuflags-$(CONFIG_M5206e) := $(call cc-option,-mcpu=5206e,-m5200)
49cpuflags-$(CONFIG_M5206) := $(call cc-option,-mcpu=5206,-m5200)
50
51KBUILD_AFLAGS += $(cpuflags-y)
52KBUILD_CFLAGS += $(cpuflags-y) -pipe
3ifdef CONFIG_MMU 53ifdef CONFIG_MMU
4include $(srctree)/arch/m68k/Makefile_mm 54# without -fno-strength-reduce the 53c7xx.c driver fails ;-(
55KBUILD_CFLAGS += -fno-strength-reduce -ffixed-a2
56else
57# we can use a m68k-linux-gcc toolchain with these in place
58KBUILD_CFLAGS += -DUTS_SYSNAME=\"uClinux\"
59KBUILD_CFLAGS += -D__uClinux__
60KBUILD_AFLAGS += -D__uClinux__
61endif
62
63LDFLAGS := -m m68kelf
64KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/m68k/kernel/module.lds
65ifneq ($(SUBARCH),$(ARCH))
66 ifeq ($(CROSS_COMPILE),)
67 CROSS_COMPILE := $(call cc-cross-prefix, \
68 m68k-linux-gnu- m68k-linux- m68k-unknown-linux-gnu-)
69 endif
70endif
71
72ifdef CONFIG_SUN3
73LDFLAGS_vmlinux = -N
74endif
75
76CHECKFLAGS += -D__mc68000__
77
78
79ifdef CONFIG_KGDB
80# If configured for kgdb support, include debugging infos and keep the
81# frame pointer
82KBUILD_CFLAGS := $(subst -fomit-frame-pointer,,$(KBUILD_CFLAGS)) -g
83endif
84
85#
86# Select the assembler head startup code. Order is important. The default
87# head code is first, processor specific selections can override it after.
88#
89head-y := arch/m68k/kernel/head.o
90head-$(CONFIG_SUN3) := arch/m68k/kernel/sun3-head.o
91head-$(CONFIG_M68360) := arch/m68k/platform/68360/head.o
92head-$(CONFIG_M68000) := arch/m68k/platform/68328/head.o
93head-$(CONFIG_COLDFIRE) := arch/m68k/platform/coldfire/head.o
94
95core-y += arch/m68k/kernel/ arch/m68k/mm/
96libs-y += arch/m68k/lib/
97
98core-$(CONFIG_Q40) += arch/m68k/q40/
99core-$(CONFIG_AMIGA) += arch/m68k/amiga/
100core-$(CONFIG_ATARI) += arch/m68k/atari/
101core-$(CONFIG_MAC) += arch/m68k/mac/
102core-$(CONFIG_HP300) += arch/m68k/hp300/
103core-$(CONFIG_APOLLO) += arch/m68k/apollo/
104core-$(CONFIG_MVME147) += arch/m68k/mvme147/
105core-$(CONFIG_MVME16x) += arch/m68k/mvme16x/
106core-$(CONFIG_BVME6000) += arch/m68k/bvme6000/
107core-$(CONFIG_SUN3X) += arch/m68k/sun3x/ arch/m68k/sun3/
108core-$(CONFIG_SUN3) += arch/m68k/sun3/ arch/m68k/sun3/prom/
109core-$(CONFIG_NATFEAT) += arch/m68k/emu/
110core-$(CONFIG_M68040) += arch/m68k/fpsp040/
111core-$(CONFIG_M68060) += arch/m68k/ifpsp060/
112core-$(CONFIG_M68KFPU_EMU) += arch/m68k/math-emu/
113core-$(CONFIG_M68360) += arch/m68k/platform/68360/
114core-$(CONFIG_M68000) += arch/m68k/platform/68328/
115core-$(CONFIG_M68EZ328) += arch/m68k/platform/68EZ328/
116core-$(CONFIG_M68VZ328) += arch/m68k/platform/68VZ328/
117core-$(CONFIG_COLDFIRE) += arch/m68k/platform/coldfire/
118core-$(CONFIG_M5206) += arch/m68k/platform/5206/
119core-$(CONFIG_M5206e) += arch/m68k/platform/5206/
120core-$(CONFIG_M520x) += arch/m68k/platform/520x/
121core-$(CONFIG_M523x) += arch/m68k/platform/523x/
122core-$(CONFIG_M5249) += arch/m68k/platform/5249/
123core-$(CONFIG_M527x) += arch/m68k/platform/527x/
124core-$(CONFIG_M5272) += arch/m68k/platform/5272/
125core-$(CONFIG_M528x) += arch/m68k/platform/528x/
126core-$(CONFIG_M5307) += arch/m68k/platform/5307/
127core-$(CONFIG_M532x) += arch/m68k/platform/532x/
128core-$(CONFIG_M5407) += arch/m68k/platform/5407/
129core-$(CONFIG_M54xx) += arch/m68k/platform/54xx/
130
131
132all: zImage
133
134lilo: vmlinux
135 if [ -f $(INSTALL_PATH)/vmlinux ]; then mv -f $(INSTALL_PATH)/vmlinux $(INSTALL_PATH)/vmlinux.old; fi
136 if [ -f $(INSTALL_PATH)/System.map ]; then mv -f $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi
137 cat vmlinux > $(INSTALL_PATH)/vmlinux
138 cp System.map $(INSTALL_PATH)/System.map
139 if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
140
141zImage compressed: vmlinux.gz
142
143vmlinux.gz: vmlinux
144
145ifndef CONFIG_KGDB
146 cp vmlinux vmlinux.tmp
147 $(STRIP) vmlinux.tmp
148 gzip -9c vmlinux.tmp >vmlinux.gz
149 rm vmlinux.tmp
5else 150else
6include $(srctree)/arch/m68k/Makefile_no 151 gzip -9c vmlinux >vmlinux.gz
7endif 152endif
153
154bzImage: vmlinux.bz2
155
156vmlinux.bz2: vmlinux
157
158ifndef CONFIG_KGDB
159 cp vmlinux vmlinux.tmp
160 $(STRIP) vmlinux.tmp
161 bzip2 -1c vmlinux.tmp >vmlinux.bz2
162 rm vmlinux.tmp
163else
164 bzip2 -1c vmlinux >vmlinux.bz2
165endif
166
167archclean:
168 rm -f vmlinux.gz vmlinux.bz2
169
170install:
171 sh $(srctree)/arch/m68k/install.sh $(KERNELRELEASE) vmlinux.gz System.map "$(INSTALL_PATH)"
diff --git a/arch/m68k/Makefile_mm b/arch/m68k/Makefile_mm
deleted file mode 100644
index d449b6d5aecf..000000000000
--- a/arch/m68k/Makefile_mm
+++ /dev/null
@@ -1,121 +0,0 @@
1#
2# m68k/Makefile
3#
4# This file is included by the global makefile so that you can add your own
5# architecture-specific flags and dependencies. Remember to do have actions
6# for "archclean" and "archdep" for cleaning up and making dependencies for
7# this architecture
8#
9# This file is subject to the terms and conditions of the GNU General Public
10# License. See the file "COPYING" in the main directory of this archive
11# for more details.
12#
13# Copyright (C) 1994 by Hamish Macdonald
14#
15
16# override top level makefile
17AS += -m68020
18LDFLAGS := -m m68kelf
19KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/m68k/kernel/module.lds
20ifneq ($(SUBARCH),$(ARCH))
21 ifeq ($(CROSS_COMPILE),)
22 CROSS_COMPILE := $(call cc-cross-prefix, \
23 m68k-linux-gnu- m68k-linux- m68k-unknown-linux-gnu-)
24 endif
25endif
26
27ifdef CONFIG_SUN3
28LDFLAGS_vmlinux = -N
29endif
30
31CHECKFLAGS += -D__mc68000__
32
33# without -fno-strength-reduce the 53c7xx.c driver fails ;-(
34KBUILD_CFLAGS += -pipe -fno-strength-reduce -ffixed-a2
35
36# enable processor switch if compiled only for a single cpu
37ifndef CONFIG_M68020
38ifndef CONFIG_M68030
39
40ifndef CONFIG_M68060
41KBUILD_CFLAGS += -m68040
42endif
43
44ifndef CONFIG_M68040
45KBUILD_CFLAGS += -m68060
46endif
47
48endif
49endif
50
51ifdef CONFIG_KGDB
52# If configured for kgdb support, include debugging infos and keep the
53# frame pointer
54KBUILD_CFLAGS := $(subst -fomit-frame-pointer,,$(KBUILD_CFLAGS)) -g
55endif
56
57ifndef CONFIG_SUN3
58head-y := arch/m68k/kernel/head.o
59else
60head-y := arch/m68k/kernel/sun3-head.o
61endif
62
63core-y += arch/m68k/kernel/ arch/m68k/mm/
64libs-y += arch/m68k/lib/
65
66core-$(CONFIG_Q40) += arch/m68k/q40/
67core-$(CONFIG_AMIGA) += arch/m68k/amiga/
68core-$(CONFIG_ATARI) += arch/m68k/atari/
69core-$(CONFIG_MAC) += arch/m68k/mac/
70core-$(CONFIG_HP300) += arch/m68k/hp300/
71core-$(CONFIG_APOLLO) += arch/m68k/apollo/
72core-$(CONFIG_MVME147) += arch/m68k/mvme147/
73core-$(CONFIG_MVME16x) += arch/m68k/mvme16x/
74core-$(CONFIG_BVME6000) += arch/m68k/bvme6000/
75core-$(CONFIG_SUN3X) += arch/m68k/sun3x/ arch/m68k/sun3/
76core-$(CONFIG_SUN3) += arch/m68k/sun3/ arch/m68k/sun3/prom/
77core-$(CONFIG_NATFEAT) += arch/m68k/emu/
78core-$(CONFIG_M68040) += arch/m68k/fpsp040/
79core-$(CONFIG_M68060) += arch/m68k/ifpsp060/
80core-$(CONFIG_M68KFPU_EMU) += arch/m68k/math-emu/
81
82all: zImage
83
84lilo: vmlinux
85 if [ -f $(INSTALL_PATH)/vmlinux ]; then mv -f $(INSTALL_PATH)/vmlinux $(INSTALL_PATH)/vmlinux.old; fi
86 if [ -f $(INSTALL_PATH)/System.map ]; then mv -f $(INSTALL_PATH)/System.map $(INSTALL_PATH)/System.old; fi
87 cat vmlinux > $(INSTALL_PATH)/vmlinux
88 cp System.map $(INSTALL_PATH)/System.map
89 if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
90
91zImage compressed: vmlinux.gz
92
93vmlinux.gz: vmlinux
94
95ifndef CONFIG_KGDB
96 cp vmlinux vmlinux.tmp
97 $(STRIP) vmlinux.tmp
98 gzip -9c vmlinux.tmp >vmlinux.gz
99 rm vmlinux.tmp
100else
101 gzip -9c vmlinux >vmlinux.gz
102endif
103
104bzImage: vmlinux.bz2
105
106vmlinux.bz2: vmlinux
107
108ifndef CONFIG_KGDB
109 cp vmlinux vmlinux.tmp
110 $(STRIP) vmlinux.tmp
111 bzip2 -1c vmlinux.tmp >vmlinux.bz2
112 rm vmlinux.tmp
113else
114 bzip2 -1c vmlinux >vmlinux.bz2
115endif
116
117archclean:
118 rm -f vmlinux.gz vmlinux.bz2
119
120install:
121 sh $(srctree)/arch/m68k/install.sh $(KERNELRELEASE) vmlinux.gz System.map "$(INSTALL_PATH)"
diff --git a/arch/m68k/Makefile_no b/arch/m68k/Makefile_no
deleted file mode 100644
index 844d3f172264..000000000000
--- a/arch/m68k/Makefile_no
+++ /dev/null
@@ -1,124 +0,0 @@
1#
2# arch/m68k/Makefile
3#
4# This file is subject to the terms and conditions of the GNU General Public
5# License. See the file "COPYING" in the main directory of this archive
6# for more details.
7#
8# (C) Copyright 2002, Greg Ungerer <gerg@snapgear.com>
9#
10
11platform-$(CONFIG_M68328) := 68328
12platform-$(CONFIG_M68EZ328) := 68EZ328
13platform-$(CONFIG_M68VZ328) := 68VZ328
14platform-$(CONFIG_M68360) := 68360
15platform-$(CONFIG_M5206) := 5206
16platform-$(CONFIG_M5206e) := 5206
17platform-$(CONFIG_M520x) := 520x
18platform-$(CONFIG_M523x) := 523x
19platform-$(CONFIG_M5249) := 5249
20platform-$(CONFIG_M527x) := 527x
21platform-$(CONFIG_M5272) := 5272
22platform-$(CONFIG_M528x) := 528x
23platform-$(CONFIG_M5307) := 5307
24platform-$(CONFIG_M532x) := 532x
25platform-$(CONFIG_M5407) := 5407
26platform-$(CONFIG_M54xx) := 54xx
27PLATFORM := $(platform-y)
28
29board-$(CONFIG_PILOT) := pilot
30board-$(CONFIG_UC5272) := UC5272
31board-$(CONFIG_UC5282) := UC5282
32board-$(CONFIG_UCSIMM) := ucsimm
33board-$(CONFIG_UCDIMM) := ucdimm
34board-$(CONFIG_UCQUICC) := uCquicc
35board-$(CONFIG_DRAGEN2) := de2
36board-$(CONFIG_ARNEWSH) := ARNEWSH
37board-$(CONFIG_FREESCALE) := FREESCALE
38board-$(CONFIG_M5235EVB) := M5235EVB
39board-$(CONFIG_M5271EVB) := M5271EVB
40board-$(CONFIG_M5275EVB) := M5275EVB
41board-$(CONFIG_M5282EVB) := M5282EVB
42board-$(CONFIG_ELITE) := eLITE
43board-$(CONFIG_NETtel) := NETtel
44board-$(CONFIG_SECUREEDGEMP3) := MP3
45board-$(CONFIG_CLEOPATRA) := CLEOPATRA
46board-$(CONFIG_senTec) := senTec
47board-$(CONFIG_SNEHA) := SNEHA
48board-$(CONFIG_M5208EVB) := M5208EVB
49board-$(CONFIG_MOD5272) := MOD5272
50board-$(CONFIG_AVNET) := AVNET
51board-$(CONFIG_SAVANT) := SAVANT
52BOARD := $(board-y)
53
54model-$(CONFIG_RAMKERNEL) := ram
55model-$(CONFIG_ROMKERNEL) := rom
56MODEL := $(model-y)
57
58#
59# Some code support is grouped together for a common cpu-subclass (for
60# example all ColdFire cpu's are very similar). Determine the sub-class
61# for the selected cpu. ONLY need to define this for the non-base member
62# of the family.
63#
64cpuclass-$(CONFIG_M5206) := coldfire
65cpuclass-$(CONFIG_M5206e) := coldfire
66cpuclass-$(CONFIG_M520x) := coldfire
67cpuclass-$(CONFIG_M523x) := coldfire
68cpuclass-$(CONFIG_M5249) := coldfire
69cpuclass-$(CONFIG_M527x) := coldfire
70cpuclass-$(CONFIG_M5272) := coldfire
71cpuclass-$(CONFIG_M528x) := coldfire
72cpuclass-$(CONFIG_M5307) := coldfire
73cpuclass-$(CONFIG_M532x) := coldfire
74cpuclass-$(CONFIG_M5407) := coldfire
75cpuclass-$(CONFIG_M54xx) := coldfire
76cpuclass-$(CONFIG_M68328) := 68328
77cpuclass-$(CONFIG_M68EZ328) := 68328
78cpuclass-$(CONFIG_M68VZ328) := 68328
79cpuclass-$(CONFIG_M68360) := 68360
80CPUCLASS := $(cpuclass-y)
81
82ifneq ($(CPUCLASS),$(PLATFORM))
83CLASSDIR := arch/m68k/platform/$(cpuclass-y)/
84endif
85
86export PLATFORM BOARD MODEL CPUCLASS
87
88#
89# Some CFLAG additions based on specific CPU type.
90#
91cflags-$(CONFIG_M5206) := $(call cc-option,-mcpu=5206,-m5200)
92cflags-$(CONFIG_M5206e) := $(call cc-option,-mcpu=5206e,-m5200)
93cflags-$(CONFIG_M520x) := $(call cc-option,-mcpu=5208,-m5200)
94cflags-$(CONFIG_M523x) := $(call cc-option,-mcpu=523x,-m5307)
95cflags-$(CONFIG_M5249) := $(call cc-option,-mcpu=5249,-m5200)
96cflags-$(CONFIG_M5271) := $(call cc-option,-mcpu=5271,-m5307)
97cflags-$(CONFIG_M5272) := $(call cc-option,-mcpu=5272,-m5307)
98cflags-$(CONFIG_M5275) := $(call cc-option,-mcpu=5275,-m5307)
99cflags-$(CONFIG_M528x) := $(call cc-option,-mcpu=528x,-m5307)
100cflags-$(CONFIG_M5307) := $(call cc-option,-mcpu=5307,-m5200)
101cflags-$(CONFIG_M532x) := $(call cc-option,-mcpu=532x,-m5307)
102cflags-$(CONFIG_M5407) := $(call cc-option,-mcpu=5407,-m5200)
103cflags-$(CONFIG_M54xx) := $(call cc-option,-mcpu=5475,-m5200)
104cflags-$(CONFIG_M68328) := -m68000
105cflags-$(CONFIG_M68EZ328) := -m68000
106cflags-$(CONFIG_M68VZ328) := -m68000
107cflags-$(CONFIG_M68360) := -m68332
108
109KBUILD_AFLAGS += $(cflags-y)
110
111KBUILD_CFLAGS += $(cflags-y)
112KBUILD_CFLAGS += -D__linux__
113KBUILD_CFLAGS += -DUTS_SYSNAME=\"uClinux\"
114
115head-y := arch/m68k/platform/$(cpuclass-y)/head.o
116
117core-y += arch/m68k/kernel/ \
118 arch/m68k/mm/ \
119 $(CLASSDIR) \
120 arch/m68k/platform/$(PLATFORM)/
121libs-y += arch/m68k/lib/
122
123archclean:
124
diff --git a/arch/m68k/include/asm/entry.h b/arch/m68k/include/asm/entry.h
index 876eec6f2b52..c3c5a8643e15 100644
--- a/arch/m68k/include/asm/entry.h
+++ b/arch/m68k/include/asm/entry.h
@@ -1,5 +1,254 @@
1#ifdef __uClinux__ 1#ifndef __M68K_ENTRY_H
2#include "entry_no.h" 2#define __M68K_ENTRY_H
3
4#include <asm/setup.h>
5#include <asm/page.h>
6#ifdef __ASSEMBLY__
7#include <asm/thread_info.h>
8#endif
9
10/*
11 * Stack layout in 'ret_from_exception':
12 *
13 * This allows access to the syscall arguments in registers d1-d5
14 *
15 * 0(sp) - d1
16 * 4(sp) - d2
17 * 8(sp) - d3
18 * C(sp) - d4
19 * 10(sp) - d5
20 * 14(sp) - a0
21 * 18(sp) - a1
22 * 1C(sp) - a2
23 * 20(sp) - d0
24 * 24(sp) - orig_d0
25 * 28(sp) - stack adjustment
26 * 2C(sp) - [ sr ] [ format & vector ]
27 * 2E(sp) - [ pc-hiword ] [ sr ]
28 * 30(sp) - [ pc-loword ] [ pc-hiword ]
29 * 32(sp) - [ format & vector ] [ pc-loword ]
30 * ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
31 * M68K COLDFIRE
32 */
33
34/* the following macro is used when enabling interrupts */
35#if defined(MACH_ATARI_ONLY)
36 /* block out HSYNC on the atari */
37#define ALLOWINT (~0x400)
38#define MAX_NOINT_IPL 3
3#else 39#else
4#include "entry_mm.h" 40 /* portable version */
41#define ALLOWINT (~0x700)
42#define MAX_NOINT_IPL 0
43#endif /* machine compilation types */
44
45#ifdef __ASSEMBLY__
46/*
47 * This defines the normal kernel pt-regs layout.
48 *
49 * regs a3-a6 and d6-d7 are preserved by C code
50 * the kernel doesn't mess with usp unless it needs to
51 */
52#define SWITCH_STACK_SIZE (6*4+4) /* includes return address */
53
54#ifdef CONFIG_COLDFIRE
55#ifdef CONFIG_COLDFIRE_SW_A7
56/*
57 * This is made a little more tricky on older ColdFires. There is no
58 * separate supervisor and user stack pointers. Need to artificially
59 * construct a usp in software... When doing this we need to disable
60 * interrupts, otherwise bad things will happen.
61 */
62.globl sw_usp
63.globl sw_ksp
64
65.macro SAVE_ALL_SYS
66 move #0x2700,%sr /* disable intrs */
67 btst #5,%sp@(2) /* from user? */
68 bnes 6f /* no, skip */
69 movel %sp,sw_usp /* save user sp */
70 addql #8,sw_usp /* remove exception */
71 movel sw_ksp,%sp /* kernel sp */
72 subql #8,%sp /* room for exception */
73 clrl %sp@- /* stkadj */
74 movel %d0,%sp@- /* orig d0 */
75 movel %d0,%sp@- /* d0 */
76 lea %sp@(-32),%sp /* space for 8 regs */
77 moveml %d1-%d5/%a0-%a2,%sp@
78 movel sw_usp,%a0 /* get usp */
79 movel %a0@-,%sp@(PT_OFF_PC) /* copy exception program counter */
80 movel %a0@-,%sp@(PT_OFF_FORMATVEC)/*copy exception format/vector/sr */
81 bra 7f
82 6:
83 clrl %sp@- /* stkadj */
84 movel %d0,%sp@- /* orig d0 */
85 movel %d0,%sp@- /* d0 */
86 lea %sp@(-32),%sp /* space for 8 regs */
87 moveml %d1-%d5/%a0-%a2,%sp@
88 7:
89.endm
90
91.macro SAVE_ALL_INT
92 SAVE_ALL_SYS
93 moveq #-1,%d0 /* not system call entry */
94 movel %d0,%sp@(PT_OFF_ORIG_D0)
95.endm
96
97.macro RESTORE_USER
98 move #0x2700,%sr /* disable intrs */
99 movel sw_usp,%a0 /* get usp */
100 movel %sp@(PT_OFF_PC),%a0@- /* copy exception program counter */
101 movel %sp@(PT_OFF_FORMATVEC),%a0@-/*copy exception format/vector/sr */
102 moveml %sp@,%d1-%d5/%a0-%a2
103 lea %sp@(32),%sp /* space for 8 regs */
104 movel %sp@+,%d0
105 addql #4,%sp /* orig d0 */
106 addl %sp@+,%sp /* stkadj */
107 addql #8,%sp /* remove exception */
108 movel %sp,sw_ksp /* save ksp */
109 subql #8,sw_usp /* set exception */
110 movel sw_usp,%sp /* restore usp */
111 rte
112.endm
113
114.macro RDUSP
115 movel sw_usp,%a3
116.endm
117
118.macro WRUSP
119 movel %a3,sw_usp
120.endm
121
122#else /* !CONFIG_COLDFIRE_SW_A7 */
123/*
124 * Modern ColdFire parts have separate supervisor and user stack
125 * pointers. Simple load and restore macros for this case.
126 */
127.macro SAVE_ALL_SYS
128 move #0x2700,%sr /* disable intrs */
129 clrl %sp@- /* stkadj */
130 movel %d0,%sp@- /* orig d0 */
131 movel %d0,%sp@- /* d0 */
132 lea %sp@(-32),%sp /* space for 8 regs */
133 moveml %d1-%d5/%a0-%a2,%sp@
134.endm
135
136.macro SAVE_ALL_INT
137 move #0x2700,%sr /* disable intrs */
138 clrl %sp@- /* stkadj */
139 pea -1:w /* orig d0 */
140 movel %d0,%sp@- /* d0 */
141 lea %sp@(-32),%sp /* space for 8 regs */
142 moveml %d1-%d5/%a0-%a2,%sp@
143.endm
144
145.macro RESTORE_USER
146 moveml %sp@,%d1-%d5/%a0-%a2
147 lea %sp@(32),%sp /* space for 8 regs */
148 movel %sp@+,%d0
149 addql #4,%sp /* orig d0 */
150 addl %sp@+,%sp /* stkadj */
151 rte
152.endm
153
154.macro RDUSP
155 /*move %usp,%a3*/
156 .word 0x4e6b
157.endm
158
159.macro WRUSP
160 /*move %a3,%usp*/
161 .word 0x4e63
162.endm
163
164#endif /* !CONFIG_COLDFIRE_SW_A7 */
165
166.macro SAVE_SWITCH_STACK
167 lea %sp@(-24),%sp /* 6 regs */
168 moveml %a3-%a6/%d6-%d7,%sp@
169.endm
170
171.macro RESTORE_SWITCH_STACK
172 moveml %sp@,%a3-%a6/%d6-%d7
173 lea %sp@(24),%sp /* 6 regs */
174.endm
175
176#else /* !CONFIG_COLDFIRE */
177
178/*
179 * All other types of m68k parts (68000, 680x0, CPU32) have the same
180 * entry and exit code.
181 */
182
183/*
184 * a -1 in the orig_d0 field signifies
185 * that the stack frame is NOT for syscall
186 */
187.macro SAVE_ALL_INT
188 clrl %sp@- /* stk_adj */
189 pea -1:w /* orig d0 */
190 movel %d0,%sp@- /* d0 */
191 moveml %d1-%d5/%a0-%a2,%sp@-
192.endm
193
194.macro SAVE_ALL_SYS
195 clrl %sp@- /* stk_adj */
196 movel %d0,%sp@- /* orig d0 */
197 movel %d0,%sp@- /* d0 */
198 moveml %d1-%d5/%a0-%a2,%sp@-
199.endm
200
201.macro RESTORE_ALL
202 moveml %sp@+,%a0-%a2/%d1-%d5
203 movel %sp@+,%d0
204 addql #4,%sp /* orig d0 */
205 addl %sp@+,%sp /* stk adj */
206 rte
207.endm
208
209
210.macro SAVE_SWITCH_STACK
211 moveml %a3-%a6/%d6-%d7,%sp@-
212.endm
213
214.macro RESTORE_SWITCH_STACK
215 moveml %sp@+,%a3-%a6/%d6-%d7
216.endm
217
218#endif /* !CONFIG_COLDFIRE */
219
220/*
221 * Register %a2 is reserved and set to current task on MMU enabled systems.
222 * Non-MMU systems do not reserve %a2 in this way, and this definition is
223 * not used for them.
224 */
225#define curptr a2
226
227#define GET_CURRENT(tmp) get_current tmp
228.macro get_current reg=%d0
229 movel %sp,\reg
230 andw #-THREAD_SIZE,\reg
231 movel \reg,%curptr
232 movel %curptr@,%curptr
233.endm
234
235#else /* C source */
236
237#define STR(X) STR1(X)
238#define STR1(X) #X
239
240#define SAVE_ALL_INT \
241 "clrl %%sp@-;" /* stk_adj */ \
242 "pea -1:w;" /* orig d0 = -1 */ \
243 "movel %%d0,%%sp@-;" /* d0 */ \
244 "moveml %%d1-%%d5/%%a0-%%a2,%%sp@-"
245
246#define GET_CURRENT(tmp) \
247 "movel %%sp,"#tmp"\n\t" \
248 "andw #-"STR(THREAD_SIZE)","#tmp"\n\t" \
249 "movel "#tmp",%%a2\n\t" \
250 "movel %%a2@,%%a2"
251
5#endif 252#endif
253
254#endif /* __M68K_ENTRY_H */
diff --git a/arch/m68k/include/asm/entry_mm.h b/arch/m68k/include/asm/entry_mm.h
deleted file mode 100644
index 73b8c8fbed9c..000000000000
--- a/arch/m68k/include/asm/entry_mm.h
+++ /dev/null
@@ -1,128 +0,0 @@
1#ifndef __M68K_ENTRY_H
2#define __M68K_ENTRY_H
3
4#include <asm/setup.h>
5#include <asm/page.h>
6#ifdef __ASSEMBLY__
7#include <asm/thread_info.h>
8#endif
9
10/*
11 * Stack layout in 'ret_from_exception':
12 *
13 * This allows access to the syscall arguments in registers d1-d5
14 *
15 * 0(sp) - d1
16 * 4(sp) - d2
17 * 8(sp) - d3
18 * C(sp) - d4
19 * 10(sp) - d5
20 * 14(sp) - a0
21 * 18(sp) - a1
22 * 1C(sp) - a2
23 * 20(sp) - d0
24 * 24(sp) - orig_d0
25 * 28(sp) - stack adjustment
26 * 2C(sp) - sr
27 * 2E(sp) - pc
28 * 32(sp) - format & vector
29 */
30
31/*
32 * 97/05/14 Andreas: Register %a2 is now set to the current task throughout
33 * the whole kernel.
34 */
35
36/* the following macro is used when enabling interrupts */
37#if defined(MACH_ATARI_ONLY)
38 /* block out HSYNC on the atari */
39#define ALLOWINT (~0x400)
40#define MAX_NOINT_IPL 3
41#else
42 /* portable version */
43#define ALLOWINT (~0x700)
44#define MAX_NOINT_IPL 0
45#endif /* machine compilation types */
46
47#ifdef __ASSEMBLY__
48
49#define curptr a2
50
51LFLUSH_I_AND_D = 0x00000808
52
53#define SAVE_ALL_INT save_all_int
54#define SAVE_ALL_SYS save_all_sys
55#define RESTORE_ALL restore_all
56/*
57 * This defines the normal kernel pt-regs layout.
58 *
59 * regs a3-a6 and d6-d7 are preserved by C code
60 * the kernel doesn't mess with usp unless it needs to
61 */
62
63/*
64 * a -1 in the orig_d0 field signifies
65 * that the stack frame is NOT for syscall
66 */
67.macro save_all_int
68 clrl %sp@- | stk_adj
69 pea -1:w | orig d0
70 movel %d0,%sp@- | d0
71 moveml %d1-%d5/%a0-%a1/%curptr,%sp@-
72.endm
73
74.macro save_all_sys
75 clrl %sp@- | stk_adj
76 movel %d0,%sp@- | orig d0
77 movel %d0,%sp@- | d0
78 moveml %d1-%d5/%a0-%a1/%curptr,%sp@-
79.endm
80
81.macro restore_all
82 moveml %sp@+,%a0-%a1/%curptr/%d1-%d5
83 movel %sp@+,%d0
84 addql #4,%sp | orig d0
85 addl %sp@+,%sp | stk adj
86 rte
87.endm
88
89#define SWITCH_STACK_SIZE (6*4+4) /* includes return address */
90
91#define SAVE_SWITCH_STACK save_switch_stack
92#define RESTORE_SWITCH_STACK restore_switch_stack
93#define GET_CURRENT(tmp) get_current tmp
94
95.macro save_switch_stack
96 moveml %a3-%a6/%d6-%d7,%sp@-
97.endm
98
99.macro restore_switch_stack
100 moveml %sp@+,%a3-%a6/%d6-%d7
101.endm
102
103.macro get_current reg=%d0
104 movel %sp,\reg
105 andw #-THREAD_SIZE,\reg
106 movel \reg,%curptr
107 movel %curptr@,%curptr
108.endm
109
110#else /* C source */
111
112#define STR(X) STR1(X)
113#define STR1(X) #X
114
115#define SAVE_ALL_INT \
116 "clrl %%sp@-;" /* stk_adj */ \
117 "pea -1:w;" /* orig d0 = -1 */ \
118 "movel %%d0,%%sp@-;" /* d0 */ \
119 "moveml %%d1-%%d5/%%a0-%%a2,%%sp@-"
120#define GET_CURRENT(tmp) \
121 "movel %%sp,"#tmp"\n\t" \
122 "andw #-"STR(THREAD_SIZE)","#tmp"\n\t" \
123 "movel "#tmp",%%a2\n\t" \
124 "movel %%a2@,%%a2"
125
126#endif
127
128#endif /* __M68K_ENTRY_H */
diff --git a/arch/m68k/include/asm/entry_no.h b/arch/m68k/include/asm/entry_no.h
deleted file mode 100644
index 68611e3dbb1d..000000000000
--- a/arch/m68k/include/asm/entry_no.h
+++ /dev/null
@@ -1,181 +0,0 @@
1#ifndef __M68KNOMMU_ENTRY_H
2#define __M68KNOMMU_ENTRY_H
3
4#include <asm/setup.h>
5#include <asm/page.h>
6
7/*
8 * Stack layout in 'ret_from_exception':
9 *
10 * This allows access to the syscall arguments in registers d1-d5
11 *
12 * 0(sp) - d1
13 * 4(sp) - d2
14 * 8(sp) - d3
15 * C(sp) - d4
16 * 10(sp) - d5
17 * 14(sp) - a0
18 * 18(sp) - a1
19 * 1C(sp) - a2
20 * 20(sp) - d0
21 * 24(sp) - orig_d0
22 * 28(sp) - stack adjustment
23 * 2C(sp) - [ sr ] [ format & vector ]
24 * 2E(sp) - [ pc-hiword ] [ sr ]
25 * 30(sp) - [ pc-loword ] [ pc-hiword ]
26 * 32(sp) - [ format & vector ] [ pc-loword ]
27 * ^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^
28 * M68K COLDFIRE
29 */
30
31#define ALLOWINT (~0x700)
32
33#ifdef __ASSEMBLY__
34
35#define SWITCH_STACK_SIZE (6*4+4) /* Includes return address */
36
37/*
38 * This defines the normal kernel pt-regs layout.
39 *
40 * regs are a2-a6 and d6-d7 preserved by C code
41 * the kernel doesn't mess with usp unless it needs to
42 */
43
44#ifdef CONFIG_COLDFIRE
45#ifdef CONFIG_COLDFIRE_SW_A7
46/*
47 * This is made a little more tricky on older ColdFires. There is no
48 * separate supervisor and user stack pointers. Need to artificially
49 * construct a usp in software... When doing this we need to disable
50 * interrupts, otherwise bad things will happen.
51 */
52.globl sw_usp
53.globl sw_ksp
54
55.macro SAVE_ALL
56 move #0x2700,%sr /* disable intrs */
57 btst #5,%sp@(2) /* from user? */
58 bnes 6f /* no, skip */
59 movel %sp,sw_usp /* save user sp */
60 addql #8,sw_usp /* remove exception */
61 movel sw_ksp,%sp /* kernel sp */
62 subql #8,%sp /* room for exception */
63 clrl %sp@- /* stkadj */
64 movel %d0,%sp@- /* orig d0 */
65 movel %d0,%sp@- /* d0 */
66 lea %sp@(-32),%sp /* space for 8 regs */
67 moveml %d1-%d5/%a0-%a2,%sp@
68 movel sw_usp,%a0 /* get usp */
69 movel %a0@-,%sp@(PT_OFF_PC) /* copy exception program counter */
70 movel %a0@-,%sp@(PT_OFF_FORMATVEC)/*copy exception format/vector/sr */
71 bra 7f
72 6:
73 clrl %sp@- /* stkadj */
74 movel %d0,%sp@- /* orig d0 */
75 movel %d0,%sp@- /* d0 */
76 lea %sp@(-32),%sp /* space for 8 regs */
77 moveml %d1-%d5/%a0-%a2,%sp@
78 7:
79.endm
80
81.macro RESTORE_USER
82 move #0x2700,%sr /* disable intrs */
83 movel sw_usp,%a0 /* get usp */
84 movel %sp@(PT_OFF_PC),%a0@- /* copy exception program counter */
85 movel %sp@(PT_OFF_FORMATVEC),%a0@-/*copy exception format/vector/sr */
86 moveml %sp@,%d1-%d5/%a0-%a2
87 lea %sp@(32),%sp /* space for 8 regs */
88 movel %sp@+,%d0
89 addql #4,%sp /* orig d0 */
90 addl %sp@+,%sp /* stkadj */
91 addql #8,%sp /* remove exception */
92 movel %sp,sw_ksp /* save ksp */
93 subql #8,sw_usp /* set exception */
94 movel sw_usp,%sp /* restore usp */
95 rte
96.endm
97
98.macro RDUSP
99 movel sw_usp,%a3
100.endm
101
102.macro WRUSP
103 movel %a3,sw_usp
104.endm
105
106#else /* !CONFIG_COLDFIRE_SW_A7 */
107/*
108 * Modern ColdFire parts have separate supervisor and user stack
109 * pointers. Simple load and restore macros for this case.
110 */
111.macro SAVE_ALL
112 move #0x2700,%sr /* disable intrs */
113 clrl %sp@- /* stkadj */
114 movel %d0,%sp@- /* orig d0 */
115 movel %d0,%sp@- /* d0 */
116 lea %sp@(-32),%sp /* space for 8 regs */
117 moveml %d1-%d5/%a0-%a2,%sp@
118.endm
119
120.macro RESTORE_USER
121 moveml %sp@,%d1-%d5/%a0-%a2
122 lea %sp@(32),%sp /* space for 8 regs */
123 movel %sp@+,%d0
124 addql #4,%sp /* orig d0 */
125 addl %sp@+,%sp /* stkadj */
126 rte
127.endm
128
129.macro RDUSP
130 /*move %usp,%a3*/
131 .word 0x4e6b
132.endm
133
134.macro WRUSP
135 /*move %a3,%usp*/
136 .word 0x4e63
137.endm
138
139#endif /* !CONFIG_COLDFIRE_SW_A7 */
140
141.macro SAVE_SWITCH_STACK
142 lea %sp@(-24),%sp /* 6 regs */
143 moveml %a3-%a6/%d6-%d7,%sp@
144.endm
145
146.macro RESTORE_SWITCH_STACK
147 moveml %sp@,%a3-%a6/%d6-%d7
148 lea %sp@(24),%sp /* 6 regs */
149.endm
150
151#else /* !CONFIG_COLDFIRE */
152
153/*
154 * Standard 68k interrupt entry and exit macros.
155 */
156.macro SAVE_ALL
157 clrl %sp@- /* stkadj */
158 movel %d0,%sp@- /* orig d0 */
159 movel %d0,%sp@- /* d0 */
160 moveml %d1-%d5/%a0-%a2,%sp@-
161.endm
162
163.macro RESTORE_ALL
164 moveml %sp@+,%a0-%a2/%d1-%d5
165 movel %sp@+,%d0
166 addql #4,%sp /* orig d0 */
167 addl %sp@+,%sp /* stkadj */
168 rte
169.endm
170
171.macro SAVE_SWITCH_STACK
172 moveml %a3-%a6/%d6-%d7,%sp@-
173.endm
174
175.macro RESTORE_SWITCH_STACK
176 moveml %sp@+,%a3-%a6/%d6-%d7
177.endm
178
179#endif /* !COLDFIRE_SW_A7 */
180#endif /* __ASSEMBLY__ */
181#endif /* __M68KNOMMU_ENTRY_H */
diff --git a/arch/m68k/include/asm/m520xsim.h b/arch/m68k/include/asm/m520xsim.h
index b6bf2c518bac..eda62de7e607 100644
--- a/arch/m68k/include/asm/m520xsim.h
+++ b/arch/m68k/include/asm/m520xsim.h
@@ -90,15 +90,13 @@
90#define MCFGPIO_PDDR_FECH 0xFC0A4013 90#define MCFGPIO_PDDR_FECH 0xFC0A4013
91#define MCFGPIO_PDDR_FECL 0xFC0A4014 91#define MCFGPIO_PDDR_FECL 0xFC0A4014
92 92
93#define MCFGPIO_PPDSDR_BUSCTL 0xFC0A401A 93#define MCFGPIO_PPDSDR_CS 0xFC0A401A
94#define MCFGPIO_PPDSDR_BE 0xFC0A401B 94#define MCFGPIO_PPDSDR_FECI2C 0xFC0A401B
95#define MCFGPIO_PPDSDR_CS 0xFC0A401C 95#define MCFGPIO_PPDSDR_QSPI 0xFC0A401C
96#define MCFGPIO_PPDSDR_FECI2C 0xFC0A401D 96#define MCFGPIO_PPDSDR_TIMER 0xFC0A401D
97#define MCFGPIO_PPDSDR_QSPI 0xFC0A401E 97#define MCFGPIO_PPDSDR_UART 0xFC0A401E
98#define MCFGPIO_PPDSDR_TIMER 0xFC0A401F 98#define MCFGPIO_PPDSDR_FECH 0xFC0A401F
99#define MCFGPIO_PPDSDR_UART 0xFC0A4021 99#define MCFGPIO_PPDSDR_FECL 0xFC0A4020
100#define MCFGPIO_PPDSDR_FECH 0xFC0A4021
101#define MCFGPIO_PPDSDR_FECL 0xFC0A4022
102 100
103#define MCFGPIO_PCLRR_BUSCTL 0xFC0A4024 101#define MCFGPIO_PCLRR_BUSCTL 0xFC0A4024
104#define MCFGPIO_PCLRR_BE 0xFC0A4025 102#define MCFGPIO_PCLRR_BE 0xFC0A4025
@@ -113,11 +111,11 @@
113/* 111/*
114 * Generic GPIO support 112 * Generic GPIO support
115 */ 113 */
116#define MCFGPIO_PODR MCFGPIO_PODR_BUSCTL 114#define MCFGPIO_PODR MCFGPIO_PODR_CS
117#define MCFGPIO_PDDR MCFGPIO_PDDR_BUSCTL 115#define MCFGPIO_PDDR MCFGPIO_PDDR_CS
118#define MCFGPIO_PPDR MCFGPIO_PPDSDR_BUSCTL 116#define MCFGPIO_PPDR MCFGPIO_PPDSDR_CS
119#define MCFGPIO_SETR MCFGPIO_PPDSDR_BUSCTL 117#define MCFGPIO_SETR MCFGPIO_PPDSDR_CS
120#define MCFGPIO_CLRR MCFGPIO_PCLRR_BUSCTL 118#define MCFGPIO_CLRR MCFGPIO_PCLRR_CS
121 119
122#define MCFGPIO_PIN_MAX 80 120#define MCFGPIO_PIN_MAX 80
123#define MCFGPIO_IRQ_MAX 8 121#define MCFGPIO_IRQ_MAX 8
diff --git a/arch/m68k/include/asm/mcfqspi.h b/arch/m68k/include/asm/mcfqspi.h
index 39d90d51111d..7fe631972f1f 100644
--- a/arch/m68k/include/asm/mcfqspi.h
+++ b/arch/m68k/include/asm/mcfqspi.h
@@ -24,9 +24,11 @@
24#if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x) 24#if defined(CONFIG_M523x) || defined(CONFIG_M527x) || defined(CONFIG_M528x)
25#define MCFQSPI_IOBASE (MCF_IPSBAR + 0x340) 25#define MCFQSPI_IOBASE (MCF_IPSBAR + 0x340)
26#elif defined(CONFIG_M5249) 26#elif defined(CONFIG_M5249)
27#define MCFQSPI_IOBASE (MCF_MBAR + 0x300) 27#define MCFQSPI_IOBASE (MCF_MBAR + 0x300)
28#elif defined(CONFIG_M520x) || defined(CONFIG_M532x) 28#elif defined(CONFIG_M520x)
29#define MCFQSPI_IOBASE 0xFC058000 29#define MCFQSPI_IOBASE 0xFC05C000
30#elif defined(CONFIG_M532x)
31#define MCFQSPI_IOBASE 0xFC058000
30#endif 32#endif
31#define MCFQSPI_IOSIZE 0x40 33#define MCFQSPI_IOSIZE 0x40
32 34
diff --git a/arch/m68k/include/asm/page_no.h b/arch/m68k/include/asm/page_no.h
index 90595721185f..a8d1c60eb9ce 100644
--- a/arch/m68k/include/asm/page_no.h
+++ b/arch/m68k/include/asm/page_no.h
@@ -5,6 +5,9 @@
5 5
6extern unsigned long memory_start; 6extern unsigned long memory_start;
7extern unsigned long memory_end; 7extern unsigned long memory_end;
8extern unsigned long _rambase;
9extern unsigned long _ramstart;
10extern unsigned long _ramend;
8 11
9#define get_user_page(vaddr) __get_free_page(GFP_KERNEL) 12#define get_user_page(vaddr) __get_free_page(GFP_KERNEL)
10#define free_user_page(page, addr) free_page(addr) 13#define free_user_page(page, addr) free_page(addr)
diff --git a/arch/m68k/include/asm/processor.h b/arch/m68k/include/asm/processor.h
index d8ef53ac03f9..568facf30276 100644
--- a/arch/m68k/include/asm/processor.h
+++ b/arch/m68k/include/asm/processor.h
@@ -135,6 +135,12 @@ do { \
135 wrusp(_usp); \ 135 wrusp(_usp); \
136} while(0) 136} while(0)
137 137
138static inline int handle_kernel_fault(struct pt_regs *regs)
139{
140 /* Any fault in kernel is fatal on non-mmu */
141 return 0;
142}
143
138#endif 144#endif
139 145
140/* Forward declaration, a strange C thing */ 146/* Forward declaration, a strange C thing */
diff --git a/arch/m68k/include/asm/sections.h b/arch/m68k/include/asm/sections.h
index d64967ecfec6..5277e52715ec 100644
--- a/arch/m68k/include/asm/sections.h
+++ b/arch/m68k/include/asm/sections.h
@@ -3,4 +3,6 @@
3 3
4#include <asm-generic/sections.h> 4#include <asm-generic/sections.h>
5 5
6extern char _sbss[], _ebss[];
7
6#endif /* _ASM_M68K_SECTIONS_H */ 8#endif /* _ASM_M68K_SECTIONS_H */
diff --git a/arch/m68k/kernel/Makefile b/arch/m68k/kernel/Makefile
index c482ebc9dd54..e7f0f2e5ad44 100644
--- a/arch/m68k/kernel/Makefile
+++ b/arch/m68k/kernel/Makefile
@@ -1,5 +1,21 @@
1ifdef CONFIG_MMU 1#
2include arch/m68k/kernel/Makefile_mm 2# Makefile for the linux kernel.
3else 3#
4include arch/m68k/kernel/Makefile_no 4
5extra-$(CONFIG_MMU) := head.o
6extra-$(CONFIG_SUN3) := sun3-head.o
7extra-y += vmlinux.lds
8
9obj-y := entry.o m68k_ksyms.o module.o process.o ptrace.o setup.o signal.o \
10 sys_m68k.o syscalltable.o time.o traps.o
11
12obj-$(CONFIG_MMU) += ints.o devres.o vectors.o
13devres-$(CONFIG_MMU) = ../../../kernel/irq/devres.o
14
15ifndef CONFIG_MMU_SUN3
16obj-y += dma.o
5endif 17endif
18ifndef CONFIG_MMU
19obj-y += init_task.o irq.o
20endif
21
diff --git a/arch/m68k/kernel/Makefile_mm b/arch/m68k/kernel/Makefile_mm
deleted file mode 100644
index aced67804579..000000000000
--- a/arch/m68k/kernel/Makefile_mm
+++ /dev/null
@@ -1,17 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4
5ifndef CONFIG_SUN3
6 extra-y := head.o
7else
8 extra-y := sun3-head.o
9endif
10extra-y += vmlinux.lds
11
12obj-y := entry.o process.o traps.o ints.o signal.o ptrace.o module.o \
13 sys_m68k.o time.o setup.o m68k_ksyms.o devres.o syscalltable.o
14
15devres-y = ../../../kernel/irq/devres.o
16
17obj-y$(CONFIG_MMU_SUN3) += dma.o # no, it's not a typo
diff --git a/arch/m68k/kernel/Makefile_no b/arch/m68k/kernel/Makefile_no
deleted file mode 100644
index 37c3fc074c0a..000000000000
--- a/arch/m68k/kernel/Makefile_no
+++ /dev/null
@@ -1,10 +0,0 @@
1#
2# Makefile for arch/m68knommu/kernel.
3#
4
5extra-y := vmlinux.lds
6
7obj-y += dma.o entry.o init_task.o irq.o m68k_ksyms.o process.o ptrace.o \
8 setup.o signal.o syscalltable.o sys_m68k.o time.o traps.o
9
10obj-$(CONFIG_MODULES) += module.o
diff --git a/arch/m68k/kernel/entry_no.S b/arch/m68k/kernel/entry_no.S
index 5f0f6b598b5a..1b4289061a64 100644
--- a/arch/m68k/kernel/entry_no.S
+++ b/arch/m68k/kernel/entry_no.S
@@ -43,7 +43,7 @@
43.globl sys_vfork 43.globl sys_vfork
44 44
45ENTRY(buserr) 45ENTRY(buserr)
46 SAVE_ALL 46 SAVE_ALL_INT
47 moveq #-1,%d0 47 moveq #-1,%d0
48 movel %d0,%sp@(PT_OFF_ORIG_D0) 48 movel %d0,%sp@(PT_OFF_ORIG_D0)
49 movel %sp,%sp@- /* stack frame pointer argument */ 49 movel %sp,%sp@- /* stack frame pointer argument */
@@ -52,7 +52,7 @@ ENTRY(buserr)
52 jra ret_from_exception 52 jra ret_from_exception
53 53
54ENTRY(trap) 54ENTRY(trap)
55 SAVE_ALL 55 SAVE_ALL_INT
56 moveq #-1,%d0 56 moveq #-1,%d0
57 movel %d0,%sp@(PT_OFF_ORIG_D0) 57 movel %d0,%sp@(PT_OFF_ORIG_D0)
58 movel %sp,%sp@- /* stack frame pointer argument */ 58 movel %sp,%sp@- /* stack frame pointer argument */
@@ -64,7 +64,7 @@ ENTRY(trap)
64 64
65.globl dbginterrupt 65.globl dbginterrupt
66ENTRY(dbginterrupt) 66ENTRY(dbginterrupt)
67 SAVE_ALL 67 SAVE_ALL_INT
68 moveq #-1,%d0 68 moveq #-1,%d0
69 movel %d0,%sp@(PT_OFF_ORIG_D0) 69 movel %d0,%sp@(PT_OFF_ORIG_D0)
70 movel %sp,%sp@- /* stack frame pointer argument */ 70 movel %sp,%sp@- /* stack frame pointer argument */
diff --git a/arch/m68k/kernel/setup_no.c b/arch/m68k/kernel/setup_no.c
index 16b2de7f5101..2ed8c0fb1517 100644
--- a/arch/m68k/kernel/setup_no.c
+++ b/arch/m68k/kernel/setup_no.c
@@ -36,6 +36,7 @@
36#include <asm/irq.h> 36#include <asm/irq.h>
37#include <asm/machdep.h> 37#include <asm/machdep.h>
38#include <asm/pgtable.h> 38#include <asm/pgtable.h>
39#include <asm/sections.h>
39 40
40unsigned long memory_start; 41unsigned long memory_start;
41unsigned long memory_end; 42unsigned long memory_end;
@@ -80,9 +81,6 @@ void (*mach_power_off)(void);
80#define CPU_INSTR_PER_JIFFY 16 81#define CPU_INSTR_PER_JIFFY 16
81#endif 82#endif
82 83
83extern int _stext, _etext, _sdata, _edata, _sbss, _ebss, _end;
84extern int _ramstart, _ramend;
85
86#if defined(CONFIG_UBOOT) 84#if defined(CONFIG_UBOOT)
87/* 85/*
88 * parse_uboot_commandline 86 * parse_uboot_commandline
diff --git a/arch/m68k/kernel/traps.c b/arch/m68k/kernel/traps.c
index c98add3f5f0f..89362f2bb56a 100644
--- a/arch/m68k/kernel/traps.c
+++ b/arch/m68k/kernel/traps.c
@@ -1,5 +1,1107 @@
1#ifdef CONFIG_MMU 1/*
2#include "traps_mm.c" 2 * linux/arch/m68k/kernel/traps.c
3 *
4 * Copyright (C) 1993, 1994 by Hamish Macdonald
5 *
6 * 68040 fixes by Michael Rausch
7 * 68040 fixes by Martin Apel
8 * 68040 fixes and writeback by Richard Zidlicky
9 * 68060 fixes by Roman Hodek
10 * 68060 fixes by Jesper Skov
11 *
12 * This file is subject to the terms and conditions of the GNU General Public
13 * License. See the file COPYING in the main directory of this archive
14 * for more details.
15 */
16
17/*
18 * Sets up all exception vectors
19 */
20
21#include <linux/sched.h>
22#include <linux/signal.h>
23#include <linux/kernel.h>
24#include <linux/mm.h>
25#include <linux/module.h>
26#include <linux/user.h>
27#include <linux/string.h>
28#include <linux/linkage.h>
29#include <linux/init.h>
30#include <linux/ptrace.h>
31#include <linux/kallsyms.h>
32
33#include <asm/setup.h>
34#include <asm/fpu.h>
35#include <asm/system.h>
36#include <asm/uaccess.h>
37#include <asm/traps.h>
38#include <asm/pgalloc.h>
39#include <asm/machdep.h>
40#include <asm/siginfo.h>
41
42
43static const char *vec_names[] = {
44 [VEC_RESETSP] = "RESET SP",
45 [VEC_RESETPC] = "RESET PC",
46 [VEC_BUSERR] = "BUS ERROR",
47 [VEC_ADDRERR] = "ADDRESS ERROR",
48 [VEC_ILLEGAL] = "ILLEGAL INSTRUCTION",
49 [VEC_ZERODIV] = "ZERO DIVIDE",
50 [VEC_CHK] = "CHK",
51 [VEC_TRAP] = "TRAPcc",
52 [VEC_PRIV] = "PRIVILEGE VIOLATION",
53 [VEC_TRACE] = "TRACE",
54 [VEC_LINE10] = "LINE 1010",
55 [VEC_LINE11] = "LINE 1111",
56 [VEC_RESV12] = "UNASSIGNED RESERVED 12",
57 [VEC_COPROC] = "COPROCESSOR PROTOCOL VIOLATION",
58 [VEC_FORMAT] = "FORMAT ERROR",
59 [VEC_UNINT] = "UNINITIALIZED INTERRUPT",
60 [VEC_RESV16] = "UNASSIGNED RESERVED 16",
61 [VEC_RESV17] = "UNASSIGNED RESERVED 17",
62 [VEC_RESV18] = "UNASSIGNED RESERVED 18",
63 [VEC_RESV19] = "UNASSIGNED RESERVED 19",
64 [VEC_RESV20] = "UNASSIGNED RESERVED 20",
65 [VEC_RESV21] = "UNASSIGNED RESERVED 21",
66 [VEC_RESV22] = "UNASSIGNED RESERVED 22",
67 [VEC_RESV23] = "UNASSIGNED RESERVED 23",
68 [VEC_SPUR] = "SPURIOUS INTERRUPT",
69 [VEC_INT1] = "LEVEL 1 INT",
70 [VEC_INT2] = "LEVEL 2 INT",
71 [VEC_INT3] = "LEVEL 3 INT",
72 [VEC_INT4] = "LEVEL 4 INT",
73 [VEC_INT5] = "LEVEL 5 INT",
74 [VEC_INT6] = "LEVEL 6 INT",
75 [VEC_INT7] = "LEVEL 7 INT",
76 [VEC_SYS] = "SYSCALL",
77 [VEC_TRAP1] = "TRAP #1",
78 [VEC_TRAP2] = "TRAP #2",
79 [VEC_TRAP3] = "TRAP #3",
80 [VEC_TRAP4] = "TRAP #4",
81 [VEC_TRAP5] = "TRAP #5",
82 [VEC_TRAP6] = "TRAP #6",
83 [VEC_TRAP7] = "TRAP #7",
84 [VEC_TRAP8] = "TRAP #8",
85 [VEC_TRAP9] = "TRAP #9",
86 [VEC_TRAP10] = "TRAP #10",
87 [VEC_TRAP11] = "TRAP #11",
88 [VEC_TRAP12] = "TRAP #12",
89 [VEC_TRAP13] = "TRAP #13",
90 [VEC_TRAP14] = "TRAP #14",
91 [VEC_TRAP15] = "TRAP #15",
92 [VEC_FPBRUC] = "FPCP BSUN",
93 [VEC_FPIR] = "FPCP INEXACT",
94 [VEC_FPDIVZ] = "FPCP DIV BY 0",
95 [VEC_FPUNDER] = "FPCP UNDERFLOW",
96 [VEC_FPOE] = "FPCP OPERAND ERROR",
97 [VEC_FPOVER] = "FPCP OVERFLOW",
98 [VEC_FPNAN] = "FPCP SNAN",
99 [VEC_FPUNSUP] = "FPCP UNSUPPORTED OPERATION",
100 [VEC_MMUCFG] = "MMU CONFIGURATION ERROR",
101 [VEC_MMUILL] = "MMU ILLEGAL OPERATION ERROR",
102 [VEC_MMUACC] = "MMU ACCESS LEVEL VIOLATION ERROR",
103 [VEC_RESV59] = "UNASSIGNED RESERVED 59",
104 [VEC_UNIMPEA] = "UNASSIGNED RESERVED 60",
105 [VEC_UNIMPII] = "UNASSIGNED RESERVED 61",
106 [VEC_RESV62] = "UNASSIGNED RESERVED 62",
107 [VEC_RESV63] = "UNASSIGNED RESERVED 63",
108};
109
110static const char *space_names[] = {
111 [0] = "Space 0",
112 [USER_DATA] = "User Data",
113 [USER_PROGRAM] = "User Program",
114#ifndef CONFIG_SUN3
115 [3] = "Space 3",
3#else 116#else
4#include "traps_no.c" 117 [FC_CONTROL] = "Control",
118#endif
119 [4] = "Space 4",
120 [SUPER_DATA] = "Super Data",
121 [SUPER_PROGRAM] = "Super Program",
122 [CPU_SPACE] = "CPU"
123};
124
125void die_if_kernel(char *,struct pt_regs *,int);
126asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address,
127 unsigned long error_code);
128int send_fault_sig(struct pt_regs *regs);
129
130asmlinkage void trap_c(struct frame *fp);
131
132#if defined (CONFIG_M68060)
133static inline void access_error060 (struct frame *fp)
134{
135 unsigned long fslw = fp->un.fmt4.pc; /* is really FSLW for access error */
136
137#ifdef DEBUG
138 printk("fslw=%#lx, fa=%#lx\n", fslw, fp->un.fmt4.effaddr);
139#endif
140
141 if (fslw & MMU060_BPE) {
142 /* branch prediction error -> clear branch cache */
143 __asm__ __volatile__ ("movec %/cacr,%/d0\n\t"
144 "orl #0x00400000,%/d0\n\t"
145 "movec %/d0,%/cacr"
146 : : : "d0" );
147 /* return if there's no other error */
148 if (!(fslw & MMU060_ERR_BITS) && !(fslw & MMU060_SEE))
149 return;
150 }
151
152 if (fslw & (MMU060_DESC_ERR | MMU060_WP | MMU060_SP)) {
153 unsigned long errorcode;
154 unsigned long addr = fp->un.fmt4.effaddr;
155
156 if (fslw & MMU060_MA)
157 addr = (addr + PAGE_SIZE - 1) & PAGE_MASK;
158
159 errorcode = 1;
160 if (fslw & MMU060_DESC_ERR) {
161 __flush_tlb040_one(addr);
162 errorcode = 0;
163 }
164 if (fslw & MMU060_W)
165 errorcode |= 2;
166#ifdef DEBUG
167 printk("errorcode = %d\n", errorcode );
168#endif
169 do_page_fault(&fp->ptregs, addr, errorcode);
170 } else if (fslw & (MMU060_SEE)){
171 /* Software Emulation Error.
172 * fault during mem_read/mem_write in ifpsp060/os.S
173 */
174 send_fault_sig(&fp->ptregs);
175 } else if (!(fslw & (MMU060_RE|MMU060_WE)) ||
176 send_fault_sig(&fp->ptregs) > 0) {
177 printk("pc=%#lx, fa=%#lx\n", fp->ptregs.pc, fp->un.fmt4.effaddr);
178 printk( "68060 access error, fslw=%lx\n", fslw );
179 trap_c( fp );
180 }
181}
182#endif /* CONFIG_M68060 */
183
184#if defined (CONFIG_M68040)
185static inline unsigned long probe040(int iswrite, unsigned long addr, int wbs)
186{
187 unsigned long mmusr;
188 mm_segment_t old_fs = get_fs();
189
190 set_fs(MAKE_MM_SEG(wbs));
191
192 if (iswrite)
193 asm volatile (".chip 68040; ptestw (%0); .chip 68k" : : "a" (addr));
194 else
195 asm volatile (".chip 68040; ptestr (%0); .chip 68k" : : "a" (addr));
196
197 asm volatile (".chip 68040; movec %%mmusr,%0; .chip 68k" : "=r" (mmusr));
198
199 set_fs(old_fs);
200
201 return mmusr;
202}
203
204static inline int do_040writeback1(unsigned short wbs, unsigned long wba,
205 unsigned long wbd)
206{
207 int res = 0;
208 mm_segment_t old_fs = get_fs();
209
210 /* set_fs can not be moved, otherwise put_user() may oops */
211 set_fs(MAKE_MM_SEG(wbs));
212
213 switch (wbs & WBSIZ_040) {
214 case BA_SIZE_BYTE:
215 res = put_user(wbd & 0xff, (char __user *)wba);
216 break;
217 case BA_SIZE_WORD:
218 res = put_user(wbd & 0xffff, (short __user *)wba);
219 break;
220 case BA_SIZE_LONG:
221 res = put_user(wbd, (int __user *)wba);
222 break;
223 }
224
225 /* set_fs can not be moved, otherwise put_user() may oops */
226 set_fs(old_fs);
227
228
229#ifdef DEBUG
230 printk("do_040writeback1, res=%d\n",res);
231#endif
232
233 return res;
234}
235
236/* after an exception in a writeback the stack frame corresponding
237 * to that exception is discarded, set a few bits in the old frame
238 * to simulate what it should look like
239 */
240static inline void fix_xframe040(struct frame *fp, unsigned long wba, unsigned short wbs)
241{
242 fp->un.fmt7.faddr = wba;
243 fp->un.fmt7.ssw = wbs & 0xff;
244 if (wba != current->thread.faddr)
245 fp->un.fmt7.ssw |= MA_040;
246}
247
248static inline void do_040writebacks(struct frame *fp)
249{
250 int res = 0;
251#if 0
252 if (fp->un.fmt7.wb1s & WBV_040)
253 printk("access_error040: cannot handle 1st writeback. oops.\n");
254#endif
255
256 if ((fp->un.fmt7.wb2s & WBV_040) &&
257 !(fp->un.fmt7.wb2s & WBTT_040)) {
258 res = do_040writeback1(fp->un.fmt7.wb2s, fp->un.fmt7.wb2a,
259 fp->un.fmt7.wb2d);
260 if (res)
261 fix_xframe040(fp, fp->un.fmt7.wb2a, fp->un.fmt7.wb2s);
262 else
263 fp->un.fmt7.wb2s = 0;
264 }
265
266 /* do the 2nd wb only if the first one was successful (except for a kernel wb) */
267 if (fp->un.fmt7.wb3s & WBV_040 && (!res || fp->un.fmt7.wb3s & 4)) {
268 res = do_040writeback1(fp->un.fmt7.wb3s, fp->un.fmt7.wb3a,
269 fp->un.fmt7.wb3d);
270 if (res)
271 {
272 fix_xframe040(fp, fp->un.fmt7.wb3a, fp->un.fmt7.wb3s);
273
274 fp->un.fmt7.wb2s = fp->un.fmt7.wb3s;
275 fp->un.fmt7.wb3s &= (~WBV_040);
276 fp->un.fmt7.wb2a = fp->un.fmt7.wb3a;
277 fp->un.fmt7.wb2d = fp->un.fmt7.wb3d;
278 }
279 else
280 fp->un.fmt7.wb3s = 0;
281 }
282
283 if (res)
284 send_fault_sig(&fp->ptregs);
285}
286
287/*
288 * called from sigreturn(), must ensure userspace code didn't
289 * manipulate exception frame to circumvent protection, then complete
290 * pending writebacks
291 * we just clear TM2 to turn it into a userspace access
292 */
293asmlinkage void berr_040cleanup(struct frame *fp)
294{
295 fp->un.fmt7.wb2s &= ~4;
296 fp->un.fmt7.wb3s &= ~4;
297
298 do_040writebacks(fp);
299}
300
301static inline void access_error040(struct frame *fp)
302{
303 unsigned short ssw = fp->un.fmt7.ssw;
304 unsigned long mmusr;
305
306#ifdef DEBUG
307 printk("ssw=%#x, fa=%#lx\n", ssw, fp->un.fmt7.faddr);
308 printk("wb1s=%#x, wb2s=%#x, wb3s=%#x\n", fp->un.fmt7.wb1s,
309 fp->un.fmt7.wb2s, fp->un.fmt7.wb3s);
310 printk ("wb2a=%lx, wb3a=%lx, wb2d=%lx, wb3d=%lx\n",
311 fp->un.fmt7.wb2a, fp->un.fmt7.wb3a,
312 fp->un.fmt7.wb2d, fp->un.fmt7.wb3d);
313#endif
314
315 if (ssw & ATC_040) {
316 unsigned long addr = fp->un.fmt7.faddr;
317 unsigned long errorcode;
318
319 /*
320 * The MMU status has to be determined AFTER the address
321 * has been corrected if there was a misaligned access (MA).
322 */
323 if (ssw & MA_040)
324 addr = (addr + 7) & -8;
325
326 /* MMU error, get the MMUSR info for this access */
327 mmusr = probe040(!(ssw & RW_040), addr, ssw);
328#ifdef DEBUG
329 printk("mmusr = %lx\n", mmusr);
330#endif
331 errorcode = 1;
332 if (!(mmusr & MMU_R_040)) {
333 /* clear the invalid atc entry */
334 __flush_tlb040_one(addr);
335 errorcode = 0;
336 }
337
338 /* despite what documentation seems to say, RMW
339 * accesses have always both the LK and RW bits set */
340 if (!(ssw & RW_040) || (ssw & LK_040))
341 errorcode |= 2;
342
343 if (do_page_fault(&fp->ptregs, addr, errorcode)) {
344#ifdef DEBUG
345 printk("do_page_fault() !=0\n");
346#endif
347 if (user_mode(&fp->ptregs)){
348 /* delay writebacks after signal delivery */
349#ifdef DEBUG
350 printk(".. was usermode - return\n");
351#endif
352 return;
353 }
354 /* disable writeback into user space from kernel
355 * (if do_page_fault didn't fix the mapping,
356 * the writeback won't do good)
357 */
358disable_wb:
359#ifdef DEBUG
360 printk(".. disabling wb2\n");
361#endif
362 if (fp->un.fmt7.wb2a == fp->un.fmt7.faddr)
363 fp->un.fmt7.wb2s &= ~WBV_040;
364 if (fp->un.fmt7.wb3a == fp->un.fmt7.faddr)
365 fp->un.fmt7.wb3s &= ~WBV_040;
366 }
367 } else {
368 /* In case of a bus error we either kill the process or expect
369 * the kernel to catch the fault, which then is also responsible
370 * for cleaning up the mess.
371 */
372 current->thread.signo = SIGBUS;
373 current->thread.faddr = fp->un.fmt7.faddr;
374 if (send_fault_sig(&fp->ptregs) >= 0)
375 printk("68040 bus error (ssw=%x, faddr=%lx)\n", ssw,
376 fp->un.fmt7.faddr);
377 goto disable_wb;
378 }
379
380 do_040writebacks(fp);
381}
382#endif /* CONFIG_M68040 */
383
384#if defined(CONFIG_SUN3)
385#include <asm/sun3mmu.h>
386
387extern int mmu_emu_handle_fault (unsigned long, int, int);
388
389/* sun3 version of bus_error030 */
390
391static inline void bus_error030 (struct frame *fp)
392{
393 unsigned char buserr_type = sun3_get_buserr ();
394 unsigned long addr, errorcode;
395 unsigned short ssw = fp->un.fmtb.ssw;
396 extern unsigned long _sun3_map_test_start, _sun3_map_test_end;
397
398#ifdef DEBUG
399 if (ssw & (FC | FB))
400 printk ("Instruction fault at %#010lx\n",
401 ssw & FC ?
402 fp->ptregs.format == 0xa ? fp->ptregs.pc + 2 : fp->un.fmtb.baddr - 2
403 :
404 fp->ptregs.format == 0xa ? fp->ptregs.pc + 4 : fp->un.fmtb.baddr);
405 if (ssw & DF)
406 printk ("Data %s fault at %#010lx in %s (pc=%#lx)\n",
407 ssw & RW ? "read" : "write",
408 fp->un.fmtb.daddr,
409 space_names[ssw & DFC], fp->ptregs.pc);
410#endif
411
412 /*
413 * Check if this page should be demand-mapped. This needs to go before
414 * the testing for a bad kernel-space access (demand-mapping applies
415 * to kernel accesses too).
416 */
417
418 if ((ssw & DF)
419 && (buserr_type & (SUN3_BUSERR_PROTERR | SUN3_BUSERR_INVALID))) {
420 if (mmu_emu_handle_fault (fp->un.fmtb.daddr, ssw & RW, 0))
421 return;
422 }
423
424 /* Check for kernel-space pagefault (BAD). */
425 if (fp->ptregs.sr & PS_S) {
426 /* kernel fault must be a data fault to user space */
427 if (! ((ssw & DF) && ((ssw & DFC) == USER_DATA))) {
428 // try checking the kernel mappings before surrender
429 if (mmu_emu_handle_fault (fp->un.fmtb.daddr, ssw & RW, 1))
430 return;
431 /* instruction fault or kernel data fault! */
432 if (ssw & (FC | FB))
433 printk ("Instruction fault at %#010lx\n",
434 fp->ptregs.pc);
435 if (ssw & DF) {
436 /* was this fault incurred testing bus mappings? */
437 if((fp->ptregs.pc >= (unsigned long)&_sun3_map_test_start) &&
438 (fp->ptregs.pc <= (unsigned long)&_sun3_map_test_end)) {
439 send_fault_sig(&fp->ptregs);
440 return;
441 }
442
443 printk ("Data %s fault at %#010lx in %s (pc=%#lx)\n",
444 ssw & RW ? "read" : "write",
445 fp->un.fmtb.daddr,
446 space_names[ssw & DFC], fp->ptregs.pc);
447 }
448 printk ("BAD KERNEL BUSERR\n");
449
450 die_if_kernel("Oops", &fp->ptregs,0);
451 force_sig(SIGKILL, current);
452 return;
453 }
454 } else {
455 /* user fault */
456 if (!(ssw & (FC | FB)) && !(ssw & DF))
457 /* not an instruction fault or data fault! BAD */
458 panic ("USER BUSERR w/o instruction or data fault");
459 }
460
461
462 /* First handle the data fault, if any. */
463 if (ssw & DF) {
464 addr = fp->un.fmtb.daddr;
465
466// errorcode bit 0: 0 -> no page 1 -> protection fault
467// errorcode bit 1: 0 -> read fault 1 -> write fault
468
469// (buserr_type & SUN3_BUSERR_PROTERR) -> protection fault
470// (buserr_type & SUN3_BUSERR_INVALID) -> invalid page fault
471
472 if (buserr_type & SUN3_BUSERR_PROTERR)
473 errorcode = 0x01;
474 else if (buserr_type & SUN3_BUSERR_INVALID)
475 errorcode = 0x00;
476 else {
477#ifdef DEBUG
478 printk ("*** unexpected busfault type=%#04x\n", buserr_type);
479 printk ("invalid %s access at %#lx from pc %#lx\n",
480 !(ssw & RW) ? "write" : "read", addr,
481 fp->ptregs.pc);
482#endif
483 die_if_kernel ("Oops", &fp->ptregs, buserr_type);
484 force_sig (SIGBUS, current);
485 return;
486 }
487
488//todo: wtf is RM bit? --m
489 if (!(ssw & RW) || ssw & RM)
490 errorcode |= 0x02;
491
492 /* Handle page fault. */
493 do_page_fault (&fp->ptregs, addr, errorcode);
494
495 /* Retry the data fault now. */
496 return;
497 }
498
499 /* Now handle the instruction fault. */
500
501 /* Get the fault address. */
502 if (fp->ptregs.format == 0xA)
503 addr = fp->ptregs.pc + 4;
504 else
505 addr = fp->un.fmtb.baddr;
506 if (ssw & FC)
507 addr -= 2;
508
509 if (buserr_type & SUN3_BUSERR_INVALID) {
510 if (!mmu_emu_handle_fault (fp->un.fmtb.daddr, 1, 0))
511 do_page_fault (&fp->ptregs, addr, 0);
512 } else {
513#ifdef DEBUG
514 printk ("protection fault on insn access (segv).\n");
515#endif
516 force_sig (SIGSEGV, current);
517 }
518}
519#else
520#if defined(CPU_M68020_OR_M68030)
521static inline void bus_error030 (struct frame *fp)
522{
523 volatile unsigned short temp;
524 unsigned short mmusr;
525 unsigned long addr, errorcode;
526 unsigned short ssw = fp->un.fmtb.ssw;
527#ifdef DEBUG
528 unsigned long desc;
529
530 printk ("pid = %x ", current->pid);
531 printk ("SSW=%#06x ", ssw);
532
533 if (ssw & (FC | FB))
534 printk ("Instruction fault at %#010lx\n",
535 ssw & FC ?
536 fp->ptregs.format == 0xa ? fp->ptregs.pc + 2 : fp->un.fmtb.baddr - 2
537 :
538 fp->ptregs.format == 0xa ? fp->ptregs.pc + 4 : fp->un.fmtb.baddr);
539 if (ssw & DF)
540 printk ("Data %s fault at %#010lx in %s (pc=%#lx)\n",
541 ssw & RW ? "read" : "write",
542 fp->un.fmtb.daddr,
543 space_names[ssw & DFC], fp->ptregs.pc);
544#endif
545
546 /* ++andreas: If a data fault and an instruction fault happen
547 at the same time map in both pages. */
548
549 /* First handle the data fault, if any. */
550 if (ssw & DF) {
551 addr = fp->un.fmtb.daddr;
552
553#ifdef DEBUG
554 asm volatile ("ptestr %3,%2@,#7,%0\n\t"
555 "pmove %%psr,%1@"
556 : "=a&" (desc)
557 : "a" (&temp), "a" (addr), "d" (ssw));
558#else
559 asm volatile ("ptestr %2,%1@,#7\n\t"
560 "pmove %%psr,%0@"
561 : : "a" (&temp), "a" (addr), "d" (ssw));
562#endif
563 mmusr = temp;
564
565#ifdef DEBUG
566 printk("mmusr is %#x for addr %#lx in task %p\n",
567 mmusr, addr, current);
568 printk("descriptor address is %#lx, contents %#lx\n",
569 __va(desc), *(unsigned long *)__va(desc));
570#endif
571
572 errorcode = (mmusr & MMU_I) ? 0 : 1;
573 if (!(ssw & RW) || (ssw & RM))
574 errorcode |= 2;
575
576 if (mmusr & (MMU_I | MMU_WP)) {
577 if (ssw & 4) {
578 printk("Data %s fault at %#010lx in %s (pc=%#lx)\n",
579 ssw & RW ? "read" : "write",
580 fp->un.fmtb.daddr,
581 space_names[ssw & DFC], fp->ptregs.pc);
582 goto buserr;
583 }
584 /* Don't try to do anything further if an exception was
585 handled. */
586 if (do_page_fault (&fp->ptregs, addr, errorcode) < 0)
587 return;
588 } else if (!(mmusr & MMU_I)) {
589 /* probably a 020 cas fault */
590 if (!(ssw & RM) && send_fault_sig(&fp->ptregs) > 0)
591 printk("unexpected bus error (%#x,%#x)\n", ssw, mmusr);
592 } else if (mmusr & (MMU_B|MMU_L|MMU_S)) {
593 printk("invalid %s access at %#lx from pc %#lx\n",
594 !(ssw & RW) ? "write" : "read", addr,
595 fp->ptregs.pc);
596 die_if_kernel("Oops",&fp->ptregs,mmusr);
597 force_sig(SIGSEGV, current);
598 return;
599 } else {
600#if 0
601 static volatile long tlong;
602#endif
603
604 printk("weird %s access at %#lx from pc %#lx (ssw is %#x)\n",
605 !(ssw & RW) ? "write" : "read", addr,
606 fp->ptregs.pc, ssw);
607 asm volatile ("ptestr #1,%1@,#0\n\t"
608 "pmove %%psr,%0@"
609 : /* no outputs */
610 : "a" (&temp), "a" (addr));
611 mmusr = temp;
612
613 printk ("level 0 mmusr is %#x\n", mmusr);
614#if 0
615 asm volatile ("pmove %%tt0,%0@"
616 : /* no outputs */
617 : "a" (&tlong));
618 printk("tt0 is %#lx, ", tlong);
619 asm volatile ("pmove %%tt1,%0@"
620 : /* no outputs */
621 : "a" (&tlong));
622 printk("tt1 is %#lx\n", tlong);
623#endif
624#ifdef DEBUG
625 printk("Unknown SIGSEGV - 1\n");
626#endif
627 die_if_kernel("Oops",&fp->ptregs,mmusr);
628 force_sig(SIGSEGV, current);
629 return;
630 }
631
632 /* setup an ATC entry for the access about to be retried */
633 if (!(ssw & RW) || (ssw & RM))
634 asm volatile ("ploadw %1,%0@" : /* no outputs */
635 : "a" (addr), "d" (ssw));
636 else
637 asm volatile ("ploadr %1,%0@" : /* no outputs */
638 : "a" (addr), "d" (ssw));
639 }
640
641 /* Now handle the instruction fault. */
642
643 if (!(ssw & (FC|FB)))
644 return;
645
646 if (fp->ptregs.sr & PS_S) {
647 printk("Instruction fault at %#010lx\n",
648 fp->ptregs.pc);
649 buserr:
650 printk ("BAD KERNEL BUSERR\n");
651 die_if_kernel("Oops",&fp->ptregs,0);
652 force_sig(SIGKILL, current);
653 return;
654 }
655
656 /* get the fault address */
657 if (fp->ptregs.format == 10)
658 addr = fp->ptregs.pc + 4;
659 else
660 addr = fp->un.fmtb.baddr;
661 if (ssw & FC)
662 addr -= 2;
663
664 if ((ssw & DF) && ((addr ^ fp->un.fmtb.daddr) & PAGE_MASK) == 0)
665 /* Insn fault on same page as data fault. But we
666 should still create the ATC entry. */
667 goto create_atc_entry;
668
669#ifdef DEBUG
670 asm volatile ("ptestr #1,%2@,#7,%0\n\t"
671 "pmove %%psr,%1@"
672 : "=a&" (desc)
673 : "a" (&temp), "a" (addr));
674#else
675 asm volatile ("ptestr #1,%1@,#7\n\t"
676 "pmove %%psr,%0@"
677 : : "a" (&temp), "a" (addr));
678#endif
679 mmusr = temp;
680
681#ifdef DEBUG
682 printk ("mmusr is %#x for addr %#lx in task %p\n",
683 mmusr, addr, current);
684 printk ("descriptor address is %#lx, contents %#lx\n",
685 __va(desc), *(unsigned long *)__va(desc));
686#endif
687
688 if (mmusr & MMU_I)
689 do_page_fault (&fp->ptregs, addr, 0);
690 else if (mmusr & (MMU_B|MMU_L|MMU_S)) {
691 printk ("invalid insn access at %#lx from pc %#lx\n",
692 addr, fp->ptregs.pc);
693#ifdef DEBUG
694 printk("Unknown SIGSEGV - 2\n");
695#endif
696 die_if_kernel("Oops",&fp->ptregs,mmusr);
697 force_sig(SIGSEGV, current);
698 return;
699 }
700
701create_atc_entry:
702 /* setup an ATC entry for the access about to be retried */
703 asm volatile ("ploadr #2,%0@" : /* no outputs */
704 : "a" (addr));
705}
706#endif /* CPU_M68020_OR_M68030 */
707#endif /* !CONFIG_SUN3 */
708
709asmlinkage void buserr_c(struct frame *fp)
710{
711 /* Only set esp0 if coming from user mode */
712 if (user_mode(&fp->ptregs))
713 current->thread.esp0 = (unsigned long) fp;
714
715#ifdef DEBUG
716 printk ("*** Bus Error *** Format is %x\n", fp->ptregs.format);
717#endif
718
719 switch (fp->ptregs.format) {
720#if defined (CONFIG_M68060)
721 case 4: /* 68060 access error */
722 access_error060 (fp);
723 break;
724#endif
725#if defined (CONFIG_M68040)
726 case 0x7: /* 68040 access error */
727 access_error040 (fp);
728 break;
729#endif
730#if defined (CPU_M68020_OR_M68030)
731 case 0xa:
732 case 0xb:
733 bus_error030 (fp);
734 break;
735#endif
736 default:
737 die_if_kernel("bad frame format",&fp->ptregs,0);
738#ifdef DEBUG
739 printk("Unknown SIGSEGV - 4\n");
740#endif
741 force_sig(SIGSEGV, current);
742 }
743}
744
745
746static int kstack_depth_to_print = 48;
747
748void show_trace(unsigned long *stack)
749{
750 unsigned long *endstack;
751 unsigned long addr;
752 int i;
753
754 printk("Call Trace:");
755 addr = (unsigned long)stack + THREAD_SIZE - 1;
756 endstack = (unsigned long *)(addr & -THREAD_SIZE);
757 i = 0;
758 while (stack + 1 <= endstack) {
759 addr = *stack++;
760 /*
761 * If the address is either in the text segment of the
762 * kernel, or in the region which contains vmalloc'ed
763 * memory, it *may* be the address of a calling
764 * routine; if so, print it so that someone tracing
765 * down the cause of the crash will be able to figure
766 * out the call path that was taken.
767 */
768 if (__kernel_text_address(addr)) {
769#ifndef CONFIG_KALLSYMS
770 if (i % 5 == 0)
771 printk("\n ");
772#endif
773 printk(" [<%08lx>] %pS\n", addr, (void *)addr);
774 i++;
775 }
776 }
777 printk("\n");
778}
779
780void show_registers(struct pt_regs *regs)
781{
782 struct frame *fp = (struct frame *)regs;
783 mm_segment_t old_fs = get_fs();
784 u16 c, *cp;
785 unsigned long addr;
786 int i;
787
788 print_modules();
789 printk("PC: [<%08lx>] %pS\n", regs->pc, (void *)regs->pc);
790 printk("SR: %04x SP: %p a2: %08lx\n", regs->sr, regs, regs->a2);
791 printk("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
792 regs->d0, regs->d1, regs->d2, regs->d3);
793 printk("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
794 regs->d4, regs->d5, regs->a0, regs->a1);
795
796 printk("Process %s (pid: %d, task=%p)\n",
797 current->comm, task_pid_nr(current), current);
798 addr = (unsigned long)&fp->un;
799 printk("Frame format=%X ", regs->format);
800 switch (regs->format) {
801 case 0x2:
802 printk("instr addr=%08lx\n", fp->un.fmt2.iaddr);
803 addr += sizeof(fp->un.fmt2);
804 break;
805 case 0x3:
806 printk("eff addr=%08lx\n", fp->un.fmt3.effaddr);
807 addr += sizeof(fp->un.fmt3);
808 break;
809 case 0x4:
810 printk((CPU_IS_060 ? "fault addr=%08lx fslw=%08lx\n"
811 : "eff addr=%08lx pc=%08lx\n"),
812 fp->un.fmt4.effaddr, fp->un.fmt4.pc);
813 addr += sizeof(fp->un.fmt4);
814 break;
815 case 0x7:
816 printk("eff addr=%08lx ssw=%04x faddr=%08lx\n",
817 fp->un.fmt7.effaddr, fp->un.fmt7.ssw, fp->un.fmt7.faddr);
818 printk("wb 1 stat/addr/data: %04x %08lx %08lx\n",
819 fp->un.fmt7.wb1s, fp->un.fmt7.wb1a, fp->un.fmt7.wb1dpd0);
820 printk("wb 2 stat/addr/data: %04x %08lx %08lx\n",
821 fp->un.fmt7.wb2s, fp->un.fmt7.wb2a, fp->un.fmt7.wb2d);
822 printk("wb 3 stat/addr/data: %04x %08lx %08lx\n",
823 fp->un.fmt7.wb3s, fp->un.fmt7.wb3a, fp->un.fmt7.wb3d);
824 printk("push data: %08lx %08lx %08lx %08lx\n",
825 fp->un.fmt7.wb1dpd0, fp->un.fmt7.pd1, fp->un.fmt7.pd2,
826 fp->un.fmt7.pd3);
827 addr += sizeof(fp->un.fmt7);
828 break;
829 case 0x9:
830 printk("instr addr=%08lx\n", fp->un.fmt9.iaddr);
831 addr += sizeof(fp->un.fmt9);
832 break;
833 case 0xa:
834 printk("ssw=%04x isc=%04x isb=%04x daddr=%08lx dobuf=%08lx\n",
835 fp->un.fmta.ssw, fp->un.fmta.isc, fp->un.fmta.isb,
836 fp->un.fmta.daddr, fp->un.fmta.dobuf);
837 addr += sizeof(fp->un.fmta);
838 break;
839 case 0xb:
840 printk("ssw=%04x isc=%04x isb=%04x daddr=%08lx dobuf=%08lx\n",
841 fp->un.fmtb.ssw, fp->un.fmtb.isc, fp->un.fmtb.isb,
842 fp->un.fmtb.daddr, fp->un.fmtb.dobuf);
843 printk("baddr=%08lx dibuf=%08lx ver=%x\n",
844 fp->un.fmtb.baddr, fp->un.fmtb.dibuf, fp->un.fmtb.ver);
845 addr += sizeof(fp->un.fmtb);
846 break;
847 default:
848 printk("\n");
849 }
850 show_stack(NULL, (unsigned long *)addr);
851
852 printk("Code:");
853 set_fs(KERNEL_DS);
854 cp = (u16 *)regs->pc;
855 for (i = -8; i < 16; i++) {
856 if (get_user(c, cp + i) && i >= 0) {
857 printk(" Bad PC value.");
858 break;
859 }
860 printk(i ? " %04x" : " <%04x>", c);
861 }
862 set_fs(old_fs);
863 printk ("\n");
864}
865
866void show_stack(struct task_struct *task, unsigned long *stack)
867{
868 unsigned long *p;
869 unsigned long *endstack;
870 int i;
871
872 if (!stack) {
873 if (task)
874 stack = (unsigned long *)task->thread.esp0;
875 else
876 stack = (unsigned long *)&stack;
877 }
878 endstack = (unsigned long *)(((unsigned long)stack + THREAD_SIZE - 1) & -THREAD_SIZE);
879
880 printk("Stack from %08lx:", (unsigned long)stack);
881 p = stack;
882 for (i = 0; i < kstack_depth_to_print; i++) {
883 if (p + 1 > endstack)
884 break;
885 if (i % 8 == 0)
886 printk("\n ");
887 printk(" %08lx", *p++);
888 }
889 printk("\n");
890 show_trace(stack);
891}
892
893/*
894 * The architecture-independent backtrace generator
895 */
896void dump_stack(void)
897{
898 unsigned long stack;
899
900 show_trace(&stack);
901}
902
903EXPORT_SYMBOL(dump_stack);
904
905/*
906 * The vector number returned in the frame pointer may also contain
907 * the "fs" (Fault Status) bits on ColdFire. These are in the bottom
908 * 2 bits, and upper 2 bits. So we need to mask out the real vector
909 * number before using it in comparisons. You don't need to do this on
910 * real 68k parts, but it won't hurt either.
911 */
912
913void bad_super_trap (struct frame *fp)
914{
915 int vector = (fp->ptregs.vector >> 2) & 0xff;
916
917 console_verbose();
918 if (vector < ARRAY_SIZE(vec_names))
919 printk ("*** %s *** FORMAT=%X\n",
920 vec_names[vector],
921 fp->ptregs.format);
922 else
923 printk ("*** Exception %d *** FORMAT=%X\n",
924 vector, fp->ptregs.format);
925 if (vector == VEC_ADDRERR && CPU_IS_020_OR_030) {
926 unsigned short ssw = fp->un.fmtb.ssw;
927
928 printk ("SSW=%#06x ", ssw);
929
930 if (ssw & RC)
931 printk ("Pipe stage C instruction fault at %#010lx\n",
932 (fp->ptregs.format) == 0xA ?
933 fp->ptregs.pc + 2 : fp->un.fmtb.baddr - 2);
934 if (ssw & RB)
935 printk ("Pipe stage B instruction fault at %#010lx\n",
936 (fp->ptregs.format) == 0xA ?
937 fp->ptregs.pc + 4 : fp->un.fmtb.baddr);
938 if (ssw & DF)
939 printk ("Data %s fault at %#010lx in %s (pc=%#lx)\n",
940 ssw & RW ? "read" : "write",
941 fp->un.fmtb.daddr, space_names[ssw & DFC],
942 fp->ptregs.pc);
943 }
944 printk ("Current process id is %d\n", task_pid_nr(current));
945 die_if_kernel("BAD KERNEL TRAP", &fp->ptregs, 0);
946}
947
948asmlinkage void trap_c(struct frame *fp)
949{
950 int sig;
951 int vector = (fp->ptregs.vector >> 2) & 0xff;
952 siginfo_t info;
953
954 if (fp->ptregs.sr & PS_S) {
955 if (vector == VEC_TRACE) {
956 /* traced a trapping instruction on a 68020/30,
957 * real exception will be executed afterwards.
958 */
959 } else if (!handle_kernel_fault(&fp->ptregs))
960 bad_super_trap(fp);
961 return;
962 }
963
964 /* send the appropriate signal to the user program */
965 switch (vector) {
966 case VEC_ADDRERR:
967 info.si_code = BUS_ADRALN;
968 sig = SIGBUS;
969 break;
970 case VEC_ILLEGAL:
971 case VEC_LINE10:
972 case VEC_LINE11:
973 info.si_code = ILL_ILLOPC;
974 sig = SIGILL;
975 break;
976 case VEC_PRIV:
977 info.si_code = ILL_PRVOPC;
978 sig = SIGILL;
979 break;
980 case VEC_COPROC:
981 info.si_code = ILL_COPROC;
982 sig = SIGILL;
983 break;
984 case VEC_TRAP1:
985 case VEC_TRAP2:
986 case VEC_TRAP3:
987 case VEC_TRAP4:
988 case VEC_TRAP5:
989 case VEC_TRAP6:
990 case VEC_TRAP7:
991 case VEC_TRAP8:
992 case VEC_TRAP9:
993 case VEC_TRAP10:
994 case VEC_TRAP11:
995 case VEC_TRAP12:
996 case VEC_TRAP13:
997 case VEC_TRAP14:
998 info.si_code = ILL_ILLTRP;
999 sig = SIGILL;
1000 break;
1001 case VEC_FPBRUC:
1002 case VEC_FPOE:
1003 case VEC_FPNAN:
1004 info.si_code = FPE_FLTINV;
1005 sig = SIGFPE;
1006 break;
1007 case VEC_FPIR:
1008 info.si_code = FPE_FLTRES;
1009 sig = SIGFPE;
1010 break;
1011 case VEC_FPDIVZ:
1012 info.si_code = FPE_FLTDIV;
1013 sig = SIGFPE;
1014 break;
1015 case VEC_FPUNDER:
1016 info.si_code = FPE_FLTUND;
1017 sig = SIGFPE;
1018 break;
1019 case VEC_FPOVER:
1020 info.si_code = FPE_FLTOVF;
1021 sig = SIGFPE;
1022 break;
1023 case VEC_ZERODIV:
1024 info.si_code = FPE_INTDIV;
1025 sig = SIGFPE;
1026 break;
1027 case VEC_CHK:
1028 case VEC_TRAP:
1029 info.si_code = FPE_INTOVF;
1030 sig = SIGFPE;
1031 break;
1032 case VEC_TRACE: /* ptrace single step */
1033 info.si_code = TRAP_TRACE;
1034 sig = SIGTRAP;
1035 break;
1036 case VEC_TRAP15: /* breakpoint */
1037 info.si_code = TRAP_BRKPT;
1038 sig = SIGTRAP;
1039 break;
1040 default:
1041 info.si_code = ILL_ILLOPC;
1042 sig = SIGILL;
1043 break;
1044 }
1045 info.si_signo = sig;
1046 info.si_errno = 0;
1047 switch (fp->ptregs.format) {
1048 default:
1049 info.si_addr = (void *) fp->ptregs.pc;
1050 break;
1051 case 2:
1052 info.si_addr = (void *) fp->un.fmt2.iaddr;
1053 break;
1054 case 7:
1055 info.si_addr = (void *) fp->un.fmt7.effaddr;
1056 break;
1057 case 9:
1058 info.si_addr = (void *) fp->un.fmt9.iaddr;
1059 break;
1060 case 10:
1061 info.si_addr = (void *) fp->un.fmta.daddr;
1062 break;
1063 case 11:
1064 info.si_addr = (void *) fp->un.fmtb.daddr;
1065 break;
1066 }
1067 force_sig_info (sig, &info, current);
1068}
1069
1070void die_if_kernel (char *str, struct pt_regs *fp, int nr)
1071{
1072 if (!(fp->sr & PS_S))
1073 return;
1074
1075 console_verbose();
1076 printk("%s: %08x\n",str,nr);
1077 show_registers(fp);
1078 add_taint(TAINT_DIE);
1079 do_exit(SIGSEGV);
1080}
1081
1082asmlinkage void set_esp0(unsigned long ssp)
1083{
1084 current->thread.esp0 = ssp;
1085}
1086
1087/*
1088 * This function is called if an error occur while accessing
1089 * user-space from the fpsp040 code.
1090 */
1091asmlinkage void fpsp040_die(void)
1092{
1093 do_exit(SIGSEGV);
1094}
1095
1096#ifdef CONFIG_M68KFPU_EMU
1097asmlinkage void fpemu_signal(int signal, int code, void *addr)
1098{
1099 siginfo_t info;
1100
1101 info.si_signo = signal;
1102 info.si_errno = 0;
1103 info.si_code = code;
1104 info.si_addr = addr;
1105 force_sig_info(signal, &info, current);
1106}
5#endif 1107#endif
diff --git a/arch/m68k/kernel/traps_mm.c b/arch/m68k/kernel/traps_mm.c
deleted file mode 100644
index 4022bbc28878..000000000000
--- a/arch/m68k/kernel/traps_mm.c
+++ /dev/null
@@ -1,1207 +0,0 @@
1/*
2 * linux/arch/m68k/kernel/traps.c
3 *
4 * Copyright (C) 1993, 1994 by Hamish Macdonald
5 *
6 * 68040 fixes by Michael Rausch
7 * 68040 fixes by Martin Apel
8 * 68040 fixes and writeback by Richard Zidlicky
9 * 68060 fixes by Roman Hodek
10 * 68060 fixes by Jesper Skov
11 *
12 * This file is subject to the terms and conditions of the GNU General Public
13 * License. See the file COPYING in the main directory of this archive
14 * for more details.
15 */
16
17/*
18 * Sets up all exception vectors
19 */
20
21#include <linux/sched.h>
22#include <linux/signal.h>
23#include <linux/kernel.h>
24#include <linux/mm.h>
25#include <linux/module.h>
26#include <linux/user.h>
27#include <linux/string.h>
28#include <linux/linkage.h>
29#include <linux/init.h>
30#include <linux/ptrace.h>
31#include <linux/kallsyms.h>
32
33#include <asm/setup.h>
34#include <asm/fpu.h>
35#include <asm/system.h>
36#include <asm/uaccess.h>
37#include <asm/traps.h>
38#include <asm/pgalloc.h>
39#include <asm/machdep.h>
40#include <asm/siginfo.h>
41
42/* assembler routines */
43asmlinkage void system_call(void);
44asmlinkage void buserr(void);
45asmlinkage void trap(void);
46asmlinkage void nmihandler(void);
47#ifdef CONFIG_M68KFPU_EMU
48asmlinkage void fpu_emu(void);
49#endif
50
51e_vector vectors[256];
52
53/* nmi handler for the Amiga */
54asm(".text\n"
55 __ALIGN_STR "\n"
56 "nmihandler: rte");
57
58/*
59 * this must be called very early as the kernel might
60 * use some instruction that are emulated on the 060
61 * and so we're prepared for early probe attempts (e.g. nf_init).
62 */
63void __init base_trap_init(void)
64{
65 if (MACH_IS_SUN3X) {
66 extern e_vector *sun3x_prom_vbr;
67
68 __asm__ volatile ("movec %%vbr, %0" : "=r" (sun3x_prom_vbr));
69 }
70
71 /* setup the exception vector table */
72 __asm__ volatile ("movec %0,%%vbr" : : "r" ((void*)vectors));
73
74 if (CPU_IS_060) {
75 /* set up ISP entry points */
76 asmlinkage void unimp_vec(void) asm ("_060_isp_unimp");
77
78 vectors[VEC_UNIMPII] = unimp_vec;
79 }
80
81 vectors[VEC_BUSERR] = buserr;
82 vectors[VEC_ILLEGAL] = trap;
83 vectors[VEC_SYS] = system_call;
84}
85
86void __init trap_init (void)
87{
88 int i;
89
90 for (i = VEC_SPUR; i <= VEC_INT7; i++)
91 vectors[i] = bad_inthandler;
92
93 for (i = 0; i < VEC_USER; i++)
94 if (!vectors[i])
95 vectors[i] = trap;
96
97 for (i = VEC_USER; i < 256; i++)
98 vectors[i] = bad_inthandler;
99
100#ifdef CONFIG_M68KFPU_EMU
101 if (FPU_IS_EMU)
102 vectors[VEC_LINE11] = fpu_emu;
103#endif
104
105 if (CPU_IS_040 && !FPU_IS_EMU) {
106 /* set up FPSP entry points */
107 asmlinkage void dz_vec(void) asm ("dz");
108 asmlinkage void inex_vec(void) asm ("inex");
109 asmlinkage void ovfl_vec(void) asm ("ovfl");
110 asmlinkage void unfl_vec(void) asm ("unfl");
111 asmlinkage void snan_vec(void) asm ("snan");
112 asmlinkage void operr_vec(void) asm ("operr");
113 asmlinkage void bsun_vec(void) asm ("bsun");
114 asmlinkage void fline_vec(void) asm ("fline");
115 asmlinkage void unsupp_vec(void) asm ("unsupp");
116
117 vectors[VEC_FPDIVZ] = dz_vec;
118 vectors[VEC_FPIR] = inex_vec;
119 vectors[VEC_FPOVER] = ovfl_vec;
120 vectors[VEC_FPUNDER] = unfl_vec;
121 vectors[VEC_FPNAN] = snan_vec;
122 vectors[VEC_FPOE] = operr_vec;
123 vectors[VEC_FPBRUC] = bsun_vec;
124 vectors[VEC_LINE11] = fline_vec;
125 vectors[VEC_FPUNSUP] = unsupp_vec;
126 }
127
128 if (CPU_IS_060 && !FPU_IS_EMU) {
129 /* set up IFPSP entry points */
130 asmlinkage void snan_vec6(void) asm ("_060_fpsp_snan");
131 asmlinkage void operr_vec6(void) asm ("_060_fpsp_operr");
132 asmlinkage void ovfl_vec6(void) asm ("_060_fpsp_ovfl");
133 asmlinkage void unfl_vec6(void) asm ("_060_fpsp_unfl");
134 asmlinkage void dz_vec6(void) asm ("_060_fpsp_dz");
135 asmlinkage void inex_vec6(void) asm ("_060_fpsp_inex");
136 asmlinkage void fline_vec6(void) asm ("_060_fpsp_fline");
137 asmlinkage void unsupp_vec6(void) asm ("_060_fpsp_unsupp");
138 asmlinkage void effadd_vec6(void) asm ("_060_fpsp_effadd");
139
140 vectors[VEC_FPNAN] = snan_vec6;
141 vectors[VEC_FPOE] = operr_vec6;
142 vectors[VEC_FPOVER] = ovfl_vec6;
143 vectors[VEC_FPUNDER] = unfl_vec6;
144 vectors[VEC_FPDIVZ] = dz_vec6;
145 vectors[VEC_FPIR] = inex_vec6;
146 vectors[VEC_LINE11] = fline_vec6;
147 vectors[VEC_FPUNSUP] = unsupp_vec6;
148 vectors[VEC_UNIMPEA] = effadd_vec6;
149 }
150
151 /* if running on an amiga, make the NMI interrupt do nothing */
152 if (MACH_IS_AMIGA) {
153 vectors[VEC_INT7] = nmihandler;
154 }
155}
156
157
158static const char *vec_names[] = {
159 [VEC_RESETSP] = "RESET SP",
160 [VEC_RESETPC] = "RESET PC",
161 [VEC_BUSERR] = "BUS ERROR",
162 [VEC_ADDRERR] = "ADDRESS ERROR",
163 [VEC_ILLEGAL] = "ILLEGAL INSTRUCTION",
164 [VEC_ZERODIV] = "ZERO DIVIDE",
165 [VEC_CHK] = "CHK",
166 [VEC_TRAP] = "TRAPcc",
167 [VEC_PRIV] = "PRIVILEGE VIOLATION",
168 [VEC_TRACE] = "TRACE",
169 [VEC_LINE10] = "LINE 1010",
170 [VEC_LINE11] = "LINE 1111",
171 [VEC_RESV12] = "UNASSIGNED RESERVED 12",
172 [VEC_COPROC] = "COPROCESSOR PROTOCOL VIOLATION",
173 [VEC_FORMAT] = "FORMAT ERROR",
174 [VEC_UNINT] = "UNINITIALIZED INTERRUPT",
175 [VEC_RESV16] = "UNASSIGNED RESERVED 16",
176 [VEC_RESV17] = "UNASSIGNED RESERVED 17",
177 [VEC_RESV18] = "UNASSIGNED RESERVED 18",
178 [VEC_RESV19] = "UNASSIGNED RESERVED 19",
179 [VEC_RESV20] = "UNASSIGNED RESERVED 20",
180 [VEC_RESV21] = "UNASSIGNED RESERVED 21",
181 [VEC_RESV22] = "UNASSIGNED RESERVED 22",
182 [VEC_RESV23] = "UNASSIGNED RESERVED 23",
183 [VEC_SPUR] = "SPURIOUS INTERRUPT",
184 [VEC_INT1] = "LEVEL 1 INT",
185 [VEC_INT2] = "LEVEL 2 INT",
186 [VEC_INT3] = "LEVEL 3 INT",
187 [VEC_INT4] = "LEVEL 4 INT",
188 [VEC_INT5] = "LEVEL 5 INT",
189 [VEC_INT6] = "LEVEL 6 INT",
190 [VEC_INT7] = "LEVEL 7 INT",
191 [VEC_SYS] = "SYSCALL",
192 [VEC_TRAP1] = "TRAP #1",
193 [VEC_TRAP2] = "TRAP #2",
194 [VEC_TRAP3] = "TRAP #3",
195 [VEC_TRAP4] = "TRAP #4",
196 [VEC_TRAP5] = "TRAP #5",
197 [VEC_TRAP6] = "TRAP #6",
198 [VEC_TRAP7] = "TRAP #7",
199 [VEC_TRAP8] = "TRAP #8",
200 [VEC_TRAP9] = "TRAP #9",
201 [VEC_TRAP10] = "TRAP #10",
202 [VEC_TRAP11] = "TRAP #11",
203 [VEC_TRAP12] = "TRAP #12",
204 [VEC_TRAP13] = "TRAP #13",
205 [VEC_TRAP14] = "TRAP #14",
206 [VEC_TRAP15] = "TRAP #15",
207 [VEC_FPBRUC] = "FPCP BSUN",
208 [VEC_FPIR] = "FPCP INEXACT",
209 [VEC_FPDIVZ] = "FPCP DIV BY 0",
210 [VEC_FPUNDER] = "FPCP UNDERFLOW",
211 [VEC_FPOE] = "FPCP OPERAND ERROR",
212 [VEC_FPOVER] = "FPCP OVERFLOW",
213 [VEC_FPNAN] = "FPCP SNAN",
214 [VEC_FPUNSUP] = "FPCP UNSUPPORTED OPERATION",
215 [VEC_MMUCFG] = "MMU CONFIGURATION ERROR",
216 [VEC_MMUILL] = "MMU ILLEGAL OPERATION ERROR",
217 [VEC_MMUACC] = "MMU ACCESS LEVEL VIOLATION ERROR",
218 [VEC_RESV59] = "UNASSIGNED RESERVED 59",
219 [VEC_UNIMPEA] = "UNASSIGNED RESERVED 60",
220 [VEC_UNIMPII] = "UNASSIGNED RESERVED 61",
221 [VEC_RESV62] = "UNASSIGNED RESERVED 62",
222 [VEC_RESV63] = "UNASSIGNED RESERVED 63",
223};
224
225static const char *space_names[] = {
226 [0] = "Space 0",
227 [USER_DATA] = "User Data",
228 [USER_PROGRAM] = "User Program",
229#ifndef CONFIG_SUN3
230 [3] = "Space 3",
231#else
232 [FC_CONTROL] = "Control",
233#endif
234 [4] = "Space 4",
235 [SUPER_DATA] = "Super Data",
236 [SUPER_PROGRAM] = "Super Program",
237 [CPU_SPACE] = "CPU"
238};
239
240void die_if_kernel(char *,struct pt_regs *,int);
241asmlinkage int do_page_fault(struct pt_regs *regs, unsigned long address,
242 unsigned long error_code);
243int send_fault_sig(struct pt_regs *regs);
244
245asmlinkage void trap_c(struct frame *fp);
246
247#if defined (CONFIG_M68060)
248static inline void access_error060 (struct frame *fp)
249{
250 unsigned long fslw = fp->un.fmt4.pc; /* is really FSLW for access error */
251
252#ifdef DEBUG
253 printk("fslw=%#lx, fa=%#lx\n", fslw, fp->un.fmt4.effaddr);
254#endif
255
256 if (fslw & MMU060_BPE) {
257 /* branch prediction error -> clear branch cache */
258 __asm__ __volatile__ ("movec %/cacr,%/d0\n\t"
259 "orl #0x00400000,%/d0\n\t"
260 "movec %/d0,%/cacr"
261 : : : "d0" );
262 /* return if there's no other error */
263 if (!(fslw & MMU060_ERR_BITS) && !(fslw & MMU060_SEE))
264 return;
265 }
266
267 if (fslw & (MMU060_DESC_ERR | MMU060_WP | MMU060_SP)) {
268 unsigned long errorcode;
269 unsigned long addr = fp->un.fmt4.effaddr;
270
271 if (fslw & MMU060_MA)
272 addr = (addr + PAGE_SIZE - 1) & PAGE_MASK;
273
274 errorcode = 1;
275 if (fslw & MMU060_DESC_ERR) {
276 __flush_tlb040_one(addr);
277 errorcode = 0;
278 }
279 if (fslw & MMU060_W)
280 errorcode |= 2;
281#ifdef DEBUG
282 printk("errorcode = %d\n", errorcode );
283#endif
284 do_page_fault(&fp->ptregs, addr, errorcode);
285 } else if (fslw & (MMU060_SEE)){
286 /* Software Emulation Error.
287 * fault during mem_read/mem_write in ifpsp060/os.S
288 */
289 send_fault_sig(&fp->ptregs);
290 } else if (!(fslw & (MMU060_RE|MMU060_WE)) ||
291 send_fault_sig(&fp->ptregs) > 0) {
292 printk("pc=%#lx, fa=%#lx\n", fp->ptregs.pc, fp->un.fmt4.effaddr);
293 printk( "68060 access error, fslw=%lx\n", fslw );
294 trap_c( fp );
295 }
296}
297#endif /* CONFIG_M68060 */
298
299#if defined (CONFIG_M68040)
300static inline unsigned long probe040(int iswrite, unsigned long addr, int wbs)
301{
302 unsigned long mmusr;
303 mm_segment_t old_fs = get_fs();
304
305 set_fs(MAKE_MM_SEG(wbs));
306
307 if (iswrite)
308 asm volatile (".chip 68040; ptestw (%0); .chip 68k" : : "a" (addr));
309 else
310 asm volatile (".chip 68040; ptestr (%0); .chip 68k" : : "a" (addr));
311
312 asm volatile (".chip 68040; movec %%mmusr,%0; .chip 68k" : "=r" (mmusr));
313
314 set_fs(old_fs);
315
316 return mmusr;
317}
318
319static inline int do_040writeback1(unsigned short wbs, unsigned long wba,
320 unsigned long wbd)
321{
322 int res = 0;
323 mm_segment_t old_fs = get_fs();
324
325 /* set_fs can not be moved, otherwise put_user() may oops */
326 set_fs(MAKE_MM_SEG(wbs));
327
328 switch (wbs & WBSIZ_040) {
329 case BA_SIZE_BYTE:
330 res = put_user(wbd & 0xff, (char __user *)wba);
331 break;
332 case BA_SIZE_WORD:
333 res = put_user(wbd & 0xffff, (short __user *)wba);
334 break;
335 case BA_SIZE_LONG:
336 res = put_user(wbd, (int __user *)wba);
337 break;
338 }
339
340 /* set_fs can not be moved, otherwise put_user() may oops */
341 set_fs(old_fs);
342
343
344#ifdef DEBUG
345 printk("do_040writeback1, res=%d\n",res);
346#endif
347
348 return res;
349}
350
351/* after an exception in a writeback the stack frame corresponding
352 * to that exception is discarded, set a few bits in the old frame
353 * to simulate what it should look like
354 */
355static inline void fix_xframe040(struct frame *fp, unsigned long wba, unsigned short wbs)
356{
357 fp->un.fmt7.faddr = wba;
358 fp->un.fmt7.ssw = wbs & 0xff;
359 if (wba != current->thread.faddr)
360 fp->un.fmt7.ssw |= MA_040;
361}
362
363static inline void do_040writebacks(struct frame *fp)
364{
365 int res = 0;
366#if 0
367 if (fp->un.fmt7.wb1s & WBV_040)
368 printk("access_error040: cannot handle 1st writeback. oops.\n");
369#endif
370
371 if ((fp->un.fmt7.wb2s & WBV_040) &&
372 !(fp->un.fmt7.wb2s & WBTT_040)) {
373 res = do_040writeback1(fp->un.fmt7.wb2s, fp->un.fmt7.wb2a,
374 fp->un.fmt7.wb2d);
375 if (res)
376 fix_xframe040(fp, fp->un.fmt7.wb2a, fp->un.fmt7.wb2s);
377 else
378 fp->un.fmt7.wb2s = 0;
379 }
380
381 /* do the 2nd wb only if the first one was successful (except for a kernel wb) */
382 if (fp->un.fmt7.wb3s & WBV_040 && (!res || fp->un.fmt7.wb3s & 4)) {
383 res = do_040writeback1(fp->un.fmt7.wb3s, fp->un.fmt7.wb3a,
384 fp->un.fmt7.wb3d);
385 if (res)
386 {
387 fix_xframe040(fp, fp->un.fmt7.wb3a, fp->un.fmt7.wb3s);
388
389 fp->un.fmt7.wb2s = fp->un.fmt7.wb3s;
390 fp->un.fmt7.wb3s &= (~WBV_040);
391 fp->un.fmt7.wb2a = fp->un.fmt7.wb3a;
392 fp->un.fmt7.wb2d = fp->un.fmt7.wb3d;
393 }
394 else
395 fp->un.fmt7.wb3s = 0;
396 }
397
398 if (res)
399 send_fault_sig(&fp->ptregs);
400}
401
402/*
403 * called from sigreturn(), must ensure userspace code didn't
404 * manipulate exception frame to circumvent protection, then complete
405 * pending writebacks
406 * we just clear TM2 to turn it into a userspace access
407 */
408asmlinkage void berr_040cleanup(struct frame *fp)
409{
410 fp->un.fmt7.wb2s &= ~4;
411 fp->un.fmt7.wb3s &= ~4;
412
413 do_040writebacks(fp);
414}
415
416static inline void access_error040(struct frame *fp)
417{
418 unsigned short ssw = fp->un.fmt7.ssw;
419 unsigned long mmusr;
420
421#ifdef DEBUG
422 printk("ssw=%#x, fa=%#lx\n", ssw, fp->un.fmt7.faddr);
423 printk("wb1s=%#x, wb2s=%#x, wb3s=%#x\n", fp->un.fmt7.wb1s,
424 fp->un.fmt7.wb2s, fp->un.fmt7.wb3s);
425 printk ("wb2a=%lx, wb3a=%lx, wb2d=%lx, wb3d=%lx\n",
426 fp->un.fmt7.wb2a, fp->un.fmt7.wb3a,
427 fp->un.fmt7.wb2d, fp->un.fmt7.wb3d);
428#endif
429
430 if (ssw & ATC_040) {
431 unsigned long addr = fp->un.fmt7.faddr;
432 unsigned long errorcode;
433
434 /*
435 * The MMU status has to be determined AFTER the address
436 * has been corrected if there was a misaligned access (MA).
437 */
438 if (ssw & MA_040)
439 addr = (addr + 7) & -8;
440
441 /* MMU error, get the MMUSR info for this access */
442 mmusr = probe040(!(ssw & RW_040), addr, ssw);
443#ifdef DEBUG
444 printk("mmusr = %lx\n", mmusr);
445#endif
446 errorcode = 1;
447 if (!(mmusr & MMU_R_040)) {
448 /* clear the invalid atc entry */
449 __flush_tlb040_one(addr);
450 errorcode = 0;
451 }
452
453 /* despite what documentation seems to say, RMW
454 * accesses have always both the LK and RW bits set */
455 if (!(ssw & RW_040) || (ssw & LK_040))
456 errorcode |= 2;
457
458 if (do_page_fault(&fp->ptregs, addr, errorcode)) {
459#ifdef DEBUG
460 printk("do_page_fault() !=0\n");
461#endif
462 if (user_mode(&fp->ptregs)){
463 /* delay writebacks after signal delivery */
464#ifdef DEBUG
465 printk(".. was usermode - return\n");
466#endif
467 return;
468 }
469 /* disable writeback into user space from kernel
470 * (if do_page_fault didn't fix the mapping,
471 * the writeback won't do good)
472 */
473disable_wb:
474#ifdef DEBUG
475 printk(".. disabling wb2\n");
476#endif
477 if (fp->un.fmt7.wb2a == fp->un.fmt7.faddr)
478 fp->un.fmt7.wb2s &= ~WBV_040;
479 if (fp->un.fmt7.wb3a == fp->un.fmt7.faddr)
480 fp->un.fmt7.wb3s &= ~WBV_040;
481 }
482 } else {
483 /* In case of a bus error we either kill the process or expect
484 * the kernel to catch the fault, which then is also responsible
485 * for cleaning up the mess.
486 */
487 current->thread.signo = SIGBUS;
488 current->thread.faddr = fp->un.fmt7.faddr;
489 if (send_fault_sig(&fp->ptregs) >= 0)
490 printk("68040 bus error (ssw=%x, faddr=%lx)\n", ssw,
491 fp->un.fmt7.faddr);
492 goto disable_wb;
493 }
494
495 do_040writebacks(fp);
496}
497#endif /* CONFIG_M68040 */
498
499#if defined(CONFIG_SUN3)
500#include <asm/sun3mmu.h>
501
502extern int mmu_emu_handle_fault (unsigned long, int, int);
503
504/* sun3 version of bus_error030 */
505
506static inline void bus_error030 (struct frame *fp)
507{
508 unsigned char buserr_type = sun3_get_buserr ();
509 unsigned long addr, errorcode;
510 unsigned short ssw = fp->un.fmtb.ssw;
511 extern unsigned long _sun3_map_test_start, _sun3_map_test_end;
512
513#ifdef DEBUG
514 if (ssw & (FC | FB))
515 printk ("Instruction fault at %#010lx\n",
516 ssw & FC ?
517 fp->ptregs.format == 0xa ? fp->ptregs.pc + 2 : fp->un.fmtb.baddr - 2
518 :
519 fp->ptregs.format == 0xa ? fp->ptregs.pc + 4 : fp->un.fmtb.baddr);
520 if (ssw & DF)
521 printk ("Data %s fault at %#010lx in %s (pc=%#lx)\n",
522 ssw & RW ? "read" : "write",
523 fp->un.fmtb.daddr,
524 space_names[ssw & DFC], fp->ptregs.pc);
525#endif
526
527 /*
528 * Check if this page should be demand-mapped. This needs to go before
529 * the testing for a bad kernel-space access (demand-mapping applies
530 * to kernel accesses too).
531 */
532
533 if ((ssw & DF)
534 && (buserr_type & (SUN3_BUSERR_PROTERR | SUN3_BUSERR_INVALID))) {
535 if (mmu_emu_handle_fault (fp->un.fmtb.daddr, ssw & RW, 0))
536 return;
537 }
538
539 /* Check for kernel-space pagefault (BAD). */
540 if (fp->ptregs.sr & PS_S) {
541 /* kernel fault must be a data fault to user space */
542 if (! ((ssw & DF) && ((ssw & DFC) == USER_DATA))) {
543 // try checking the kernel mappings before surrender
544 if (mmu_emu_handle_fault (fp->un.fmtb.daddr, ssw & RW, 1))
545 return;
546 /* instruction fault or kernel data fault! */
547 if (ssw & (FC | FB))
548 printk ("Instruction fault at %#010lx\n",
549 fp->ptregs.pc);
550 if (ssw & DF) {
551 /* was this fault incurred testing bus mappings? */
552 if((fp->ptregs.pc >= (unsigned long)&_sun3_map_test_start) &&
553 (fp->ptregs.pc <= (unsigned long)&_sun3_map_test_end)) {
554 send_fault_sig(&fp->ptregs);
555 return;
556 }
557
558 printk ("Data %s fault at %#010lx in %s (pc=%#lx)\n",
559 ssw & RW ? "read" : "write",
560 fp->un.fmtb.daddr,
561 space_names[ssw & DFC], fp->ptregs.pc);
562 }
563 printk ("BAD KERNEL BUSERR\n");
564
565 die_if_kernel("Oops", &fp->ptregs,0);
566 force_sig(SIGKILL, current);
567 return;
568 }
569 } else {
570 /* user fault */
571 if (!(ssw & (FC | FB)) && !(ssw & DF))
572 /* not an instruction fault or data fault! BAD */
573 panic ("USER BUSERR w/o instruction or data fault");
574 }
575
576
577 /* First handle the data fault, if any. */
578 if (ssw & DF) {
579 addr = fp->un.fmtb.daddr;
580
581// errorcode bit 0: 0 -> no page 1 -> protection fault
582// errorcode bit 1: 0 -> read fault 1 -> write fault
583
584// (buserr_type & SUN3_BUSERR_PROTERR) -> protection fault
585// (buserr_type & SUN3_BUSERR_INVALID) -> invalid page fault
586
587 if (buserr_type & SUN3_BUSERR_PROTERR)
588 errorcode = 0x01;
589 else if (buserr_type & SUN3_BUSERR_INVALID)
590 errorcode = 0x00;
591 else {
592#ifdef DEBUG
593 printk ("*** unexpected busfault type=%#04x\n", buserr_type);
594 printk ("invalid %s access at %#lx from pc %#lx\n",
595 !(ssw & RW) ? "write" : "read", addr,
596 fp->ptregs.pc);
597#endif
598 die_if_kernel ("Oops", &fp->ptregs, buserr_type);
599 force_sig (SIGBUS, current);
600 return;
601 }
602
603//todo: wtf is RM bit? --m
604 if (!(ssw & RW) || ssw & RM)
605 errorcode |= 0x02;
606
607 /* Handle page fault. */
608 do_page_fault (&fp->ptregs, addr, errorcode);
609
610 /* Retry the data fault now. */
611 return;
612 }
613
614 /* Now handle the instruction fault. */
615
616 /* Get the fault address. */
617 if (fp->ptregs.format == 0xA)
618 addr = fp->ptregs.pc + 4;
619 else
620 addr = fp->un.fmtb.baddr;
621 if (ssw & FC)
622 addr -= 2;
623
624 if (buserr_type & SUN3_BUSERR_INVALID) {
625 if (!mmu_emu_handle_fault (fp->un.fmtb.daddr, 1, 0))
626 do_page_fault (&fp->ptregs, addr, 0);
627 } else {
628#ifdef DEBUG
629 printk ("protection fault on insn access (segv).\n");
630#endif
631 force_sig (SIGSEGV, current);
632 }
633}
634#else
635#if defined(CPU_M68020_OR_M68030)
636static inline void bus_error030 (struct frame *fp)
637{
638 volatile unsigned short temp;
639 unsigned short mmusr;
640 unsigned long addr, errorcode;
641 unsigned short ssw = fp->un.fmtb.ssw;
642#ifdef DEBUG
643 unsigned long desc;
644
645 printk ("pid = %x ", current->pid);
646 printk ("SSW=%#06x ", ssw);
647
648 if (ssw & (FC | FB))
649 printk ("Instruction fault at %#010lx\n",
650 ssw & FC ?
651 fp->ptregs.format == 0xa ? fp->ptregs.pc + 2 : fp->un.fmtb.baddr - 2
652 :
653 fp->ptregs.format == 0xa ? fp->ptregs.pc + 4 : fp->un.fmtb.baddr);
654 if (ssw & DF)
655 printk ("Data %s fault at %#010lx in %s (pc=%#lx)\n",
656 ssw & RW ? "read" : "write",
657 fp->un.fmtb.daddr,
658 space_names[ssw & DFC], fp->ptregs.pc);
659#endif
660
661 /* ++andreas: If a data fault and an instruction fault happen
662 at the same time map in both pages. */
663
664 /* First handle the data fault, if any. */
665 if (ssw & DF) {
666 addr = fp->un.fmtb.daddr;
667
668#ifdef DEBUG
669 asm volatile ("ptestr %3,%2@,#7,%0\n\t"
670 "pmove %%psr,%1@"
671 : "=a&" (desc)
672 : "a" (&temp), "a" (addr), "d" (ssw));
673#else
674 asm volatile ("ptestr %2,%1@,#7\n\t"
675 "pmove %%psr,%0@"
676 : : "a" (&temp), "a" (addr), "d" (ssw));
677#endif
678 mmusr = temp;
679
680#ifdef DEBUG
681 printk("mmusr is %#x for addr %#lx in task %p\n",
682 mmusr, addr, current);
683 printk("descriptor address is %#lx, contents %#lx\n",
684 __va(desc), *(unsigned long *)__va(desc));
685#endif
686
687 errorcode = (mmusr & MMU_I) ? 0 : 1;
688 if (!(ssw & RW) || (ssw & RM))
689 errorcode |= 2;
690
691 if (mmusr & (MMU_I | MMU_WP)) {
692 if (ssw & 4) {
693 printk("Data %s fault at %#010lx in %s (pc=%#lx)\n",
694 ssw & RW ? "read" : "write",
695 fp->un.fmtb.daddr,
696 space_names[ssw & DFC], fp->ptregs.pc);
697 goto buserr;
698 }
699 /* Don't try to do anything further if an exception was
700 handled. */
701 if (do_page_fault (&fp->ptregs, addr, errorcode) < 0)
702 return;
703 } else if (!(mmusr & MMU_I)) {
704 /* probably a 020 cas fault */
705 if (!(ssw & RM) && send_fault_sig(&fp->ptregs) > 0)
706 printk("unexpected bus error (%#x,%#x)\n", ssw, mmusr);
707 } else if (mmusr & (MMU_B|MMU_L|MMU_S)) {
708 printk("invalid %s access at %#lx from pc %#lx\n",
709 !(ssw & RW) ? "write" : "read", addr,
710 fp->ptregs.pc);
711 die_if_kernel("Oops",&fp->ptregs,mmusr);
712 force_sig(SIGSEGV, current);
713 return;
714 } else {
715#if 0
716 static volatile long tlong;
717#endif
718
719 printk("weird %s access at %#lx from pc %#lx (ssw is %#x)\n",
720 !(ssw & RW) ? "write" : "read", addr,
721 fp->ptregs.pc, ssw);
722 asm volatile ("ptestr #1,%1@,#0\n\t"
723 "pmove %%psr,%0@"
724 : /* no outputs */
725 : "a" (&temp), "a" (addr));
726 mmusr = temp;
727
728 printk ("level 0 mmusr is %#x\n", mmusr);
729#if 0
730 asm volatile ("pmove %%tt0,%0@"
731 : /* no outputs */
732 : "a" (&tlong));
733 printk("tt0 is %#lx, ", tlong);
734 asm volatile ("pmove %%tt1,%0@"
735 : /* no outputs */
736 : "a" (&tlong));
737 printk("tt1 is %#lx\n", tlong);
738#endif
739#ifdef DEBUG
740 printk("Unknown SIGSEGV - 1\n");
741#endif
742 die_if_kernel("Oops",&fp->ptregs,mmusr);
743 force_sig(SIGSEGV, current);
744 return;
745 }
746
747 /* setup an ATC entry for the access about to be retried */
748 if (!(ssw & RW) || (ssw & RM))
749 asm volatile ("ploadw %1,%0@" : /* no outputs */
750 : "a" (addr), "d" (ssw));
751 else
752 asm volatile ("ploadr %1,%0@" : /* no outputs */
753 : "a" (addr), "d" (ssw));
754 }
755
756 /* Now handle the instruction fault. */
757
758 if (!(ssw & (FC|FB)))
759 return;
760
761 if (fp->ptregs.sr & PS_S) {
762 printk("Instruction fault at %#010lx\n",
763 fp->ptregs.pc);
764 buserr:
765 printk ("BAD KERNEL BUSERR\n");
766 die_if_kernel("Oops",&fp->ptregs,0);
767 force_sig(SIGKILL, current);
768 return;
769 }
770
771 /* get the fault address */
772 if (fp->ptregs.format == 10)
773 addr = fp->ptregs.pc + 4;
774 else
775 addr = fp->un.fmtb.baddr;
776 if (ssw & FC)
777 addr -= 2;
778
779 if ((ssw & DF) && ((addr ^ fp->un.fmtb.daddr) & PAGE_MASK) == 0)
780 /* Insn fault on same page as data fault. But we
781 should still create the ATC entry. */
782 goto create_atc_entry;
783
784#ifdef DEBUG
785 asm volatile ("ptestr #1,%2@,#7,%0\n\t"
786 "pmove %%psr,%1@"
787 : "=a&" (desc)
788 : "a" (&temp), "a" (addr));
789#else
790 asm volatile ("ptestr #1,%1@,#7\n\t"
791 "pmove %%psr,%0@"
792 : : "a" (&temp), "a" (addr));
793#endif
794 mmusr = temp;
795
796#ifdef DEBUG
797 printk ("mmusr is %#x for addr %#lx in task %p\n",
798 mmusr, addr, current);
799 printk ("descriptor address is %#lx, contents %#lx\n",
800 __va(desc), *(unsigned long *)__va(desc));
801#endif
802
803 if (mmusr & MMU_I)
804 do_page_fault (&fp->ptregs, addr, 0);
805 else if (mmusr & (MMU_B|MMU_L|MMU_S)) {
806 printk ("invalid insn access at %#lx from pc %#lx\n",
807 addr, fp->ptregs.pc);
808#ifdef DEBUG
809 printk("Unknown SIGSEGV - 2\n");
810#endif
811 die_if_kernel("Oops",&fp->ptregs,mmusr);
812 force_sig(SIGSEGV, current);
813 return;
814 }
815
816create_atc_entry:
817 /* setup an ATC entry for the access about to be retried */
818 asm volatile ("ploadr #2,%0@" : /* no outputs */
819 : "a" (addr));
820}
821#endif /* CPU_M68020_OR_M68030 */
822#endif /* !CONFIG_SUN3 */
823
824asmlinkage void buserr_c(struct frame *fp)
825{
826 /* Only set esp0 if coming from user mode */
827 if (user_mode(&fp->ptregs))
828 current->thread.esp0 = (unsigned long) fp;
829
830#ifdef DEBUG
831 printk ("*** Bus Error *** Format is %x\n", fp->ptregs.format);
832#endif
833
834 switch (fp->ptregs.format) {
835#if defined (CONFIG_M68060)
836 case 4: /* 68060 access error */
837 access_error060 (fp);
838 break;
839#endif
840#if defined (CONFIG_M68040)
841 case 0x7: /* 68040 access error */
842 access_error040 (fp);
843 break;
844#endif
845#if defined (CPU_M68020_OR_M68030)
846 case 0xa:
847 case 0xb:
848 bus_error030 (fp);
849 break;
850#endif
851 default:
852 die_if_kernel("bad frame format",&fp->ptregs,0);
853#ifdef DEBUG
854 printk("Unknown SIGSEGV - 4\n");
855#endif
856 force_sig(SIGSEGV, current);
857 }
858}
859
860
861static int kstack_depth_to_print = 48;
862
863void show_trace(unsigned long *stack)
864{
865 unsigned long *endstack;
866 unsigned long addr;
867 int i;
868
869 printk("Call Trace:");
870 addr = (unsigned long)stack + THREAD_SIZE - 1;
871 endstack = (unsigned long *)(addr & -THREAD_SIZE);
872 i = 0;
873 while (stack + 1 <= endstack) {
874 addr = *stack++;
875 /*
876 * If the address is either in the text segment of the
877 * kernel, or in the region which contains vmalloc'ed
878 * memory, it *may* be the address of a calling
879 * routine; if so, print it so that someone tracing
880 * down the cause of the crash will be able to figure
881 * out the call path that was taken.
882 */
883 if (__kernel_text_address(addr)) {
884#ifndef CONFIG_KALLSYMS
885 if (i % 5 == 0)
886 printk("\n ");
887#endif
888 printk(" [<%08lx>] %pS\n", addr, (void *)addr);
889 i++;
890 }
891 }
892 printk("\n");
893}
894
895void show_registers(struct pt_regs *regs)
896{
897 struct frame *fp = (struct frame *)regs;
898 mm_segment_t old_fs = get_fs();
899 u16 c, *cp;
900 unsigned long addr;
901 int i;
902
903 print_modules();
904 printk("PC: [<%08lx>] %pS\n", regs->pc, (void *)regs->pc);
905 printk("SR: %04x SP: %p a2: %08lx\n", regs->sr, regs, regs->a2);
906 printk("d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
907 regs->d0, regs->d1, regs->d2, regs->d3);
908 printk("d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
909 regs->d4, regs->d5, regs->a0, regs->a1);
910
911 printk("Process %s (pid: %d, task=%p)\n",
912 current->comm, task_pid_nr(current), current);
913 addr = (unsigned long)&fp->un;
914 printk("Frame format=%X ", regs->format);
915 switch (regs->format) {
916 case 0x2:
917 printk("instr addr=%08lx\n", fp->un.fmt2.iaddr);
918 addr += sizeof(fp->un.fmt2);
919 break;
920 case 0x3:
921 printk("eff addr=%08lx\n", fp->un.fmt3.effaddr);
922 addr += sizeof(fp->un.fmt3);
923 break;
924 case 0x4:
925 printk((CPU_IS_060 ? "fault addr=%08lx fslw=%08lx\n"
926 : "eff addr=%08lx pc=%08lx\n"),
927 fp->un.fmt4.effaddr, fp->un.fmt4.pc);
928 addr += sizeof(fp->un.fmt4);
929 break;
930 case 0x7:
931 printk("eff addr=%08lx ssw=%04x faddr=%08lx\n",
932 fp->un.fmt7.effaddr, fp->un.fmt7.ssw, fp->un.fmt7.faddr);
933 printk("wb 1 stat/addr/data: %04x %08lx %08lx\n",
934 fp->un.fmt7.wb1s, fp->un.fmt7.wb1a, fp->un.fmt7.wb1dpd0);
935 printk("wb 2 stat/addr/data: %04x %08lx %08lx\n",
936 fp->un.fmt7.wb2s, fp->un.fmt7.wb2a, fp->un.fmt7.wb2d);
937 printk("wb 3 stat/addr/data: %04x %08lx %08lx\n",
938 fp->un.fmt7.wb3s, fp->un.fmt7.wb3a, fp->un.fmt7.wb3d);
939 printk("push data: %08lx %08lx %08lx %08lx\n",
940 fp->un.fmt7.wb1dpd0, fp->un.fmt7.pd1, fp->un.fmt7.pd2,
941 fp->un.fmt7.pd3);
942 addr += sizeof(fp->un.fmt7);
943 break;
944 case 0x9:
945 printk("instr addr=%08lx\n", fp->un.fmt9.iaddr);
946 addr += sizeof(fp->un.fmt9);
947 break;
948 case 0xa:
949 printk("ssw=%04x isc=%04x isb=%04x daddr=%08lx dobuf=%08lx\n",
950 fp->un.fmta.ssw, fp->un.fmta.isc, fp->un.fmta.isb,
951 fp->un.fmta.daddr, fp->un.fmta.dobuf);
952 addr += sizeof(fp->un.fmta);
953 break;
954 case 0xb:
955 printk("ssw=%04x isc=%04x isb=%04x daddr=%08lx dobuf=%08lx\n",
956 fp->un.fmtb.ssw, fp->un.fmtb.isc, fp->un.fmtb.isb,
957 fp->un.fmtb.daddr, fp->un.fmtb.dobuf);
958 printk("baddr=%08lx dibuf=%08lx ver=%x\n",
959 fp->un.fmtb.baddr, fp->un.fmtb.dibuf, fp->un.fmtb.ver);
960 addr += sizeof(fp->un.fmtb);
961 break;
962 default:
963 printk("\n");
964 }
965 show_stack(NULL, (unsigned long *)addr);
966
967 printk("Code:");
968 set_fs(KERNEL_DS);
969 cp = (u16 *)regs->pc;
970 for (i = -8; i < 16; i++) {
971 if (get_user(c, cp + i) && i >= 0) {
972 printk(" Bad PC value.");
973 break;
974 }
975 printk(i ? " %04x" : " <%04x>", c);
976 }
977 set_fs(old_fs);
978 printk ("\n");
979}
980
981void show_stack(struct task_struct *task, unsigned long *stack)
982{
983 unsigned long *p;
984 unsigned long *endstack;
985 int i;
986
987 if (!stack) {
988 if (task)
989 stack = (unsigned long *)task->thread.esp0;
990 else
991 stack = (unsigned long *)&stack;
992 }
993 endstack = (unsigned long *)(((unsigned long)stack + THREAD_SIZE - 1) & -THREAD_SIZE);
994
995 printk("Stack from %08lx:", (unsigned long)stack);
996 p = stack;
997 for (i = 0; i < kstack_depth_to_print; i++) {
998 if (p + 1 > endstack)
999 break;
1000 if (i % 8 == 0)
1001 printk("\n ");
1002 printk(" %08lx", *p++);
1003 }
1004 printk("\n");
1005 show_trace(stack);
1006}
1007
1008/*
1009 * The architecture-independent backtrace generator
1010 */
1011void dump_stack(void)
1012{
1013 unsigned long stack;
1014
1015 show_trace(&stack);
1016}
1017
1018EXPORT_SYMBOL(dump_stack);
1019
1020void bad_super_trap (struct frame *fp)
1021{
1022 console_verbose();
1023 if (fp->ptregs.vector < 4 * ARRAY_SIZE(vec_names))
1024 printk ("*** %s *** FORMAT=%X\n",
1025 vec_names[(fp->ptregs.vector) >> 2],
1026 fp->ptregs.format);
1027 else
1028 printk ("*** Exception %d *** FORMAT=%X\n",
1029 (fp->ptregs.vector) >> 2,
1030 fp->ptregs.format);
1031 if (fp->ptregs.vector >> 2 == VEC_ADDRERR && CPU_IS_020_OR_030) {
1032 unsigned short ssw = fp->un.fmtb.ssw;
1033
1034 printk ("SSW=%#06x ", ssw);
1035
1036 if (ssw & RC)
1037 printk ("Pipe stage C instruction fault at %#010lx\n",
1038 (fp->ptregs.format) == 0xA ?
1039 fp->ptregs.pc + 2 : fp->un.fmtb.baddr - 2);
1040 if (ssw & RB)
1041 printk ("Pipe stage B instruction fault at %#010lx\n",
1042 (fp->ptregs.format) == 0xA ?
1043 fp->ptregs.pc + 4 : fp->un.fmtb.baddr);
1044 if (ssw & DF)
1045 printk ("Data %s fault at %#010lx in %s (pc=%#lx)\n",
1046 ssw & RW ? "read" : "write",
1047 fp->un.fmtb.daddr, space_names[ssw & DFC],
1048 fp->ptregs.pc);
1049 }
1050 printk ("Current process id is %d\n", task_pid_nr(current));
1051 die_if_kernel("BAD KERNEL TRAP", &fp->ptregs, 0);
1052}
1053
1054asmlinkage void trap_c(struct frame *fp)
1055{
1056 int sig;
1057 siginfo_t info;
1058
1059 if (fp->ptregs.sr & PS_S) {
1060 if (fp->ptregs.vector == VEC_TRACE << 2) {
1061 /* traced a trapping instruction on a 68020/30,
1062 * real exception will be executed afterwards.
1063 */
1064 } else if (!handle_kernel_fault(&fp->ptregs))
1065 bad_super_trap(fp);
1066 return;
1067 }
1068
1069 /* send the appropriate signal to the user program */
1070 switch ((fp->ptregs.vector) >> 2) {
1071 case VEC_ADDRERR:
1072 info.si_code = BUS_ADRALN;
1073 sig = SIGBUS;
1074 break;
1075 case VEC_ILLEGAL:
1076 case VEC_LINE10:
1077 case VEC_LINE11:
1078 info.si_code = ILL_ILLOPC;
1079 sig = SIGILL;
1080 break;
1081 case VEC_PRIV:
1082 info.si_code = ILL_PRVOPC;
1083 sig = SIGILL;
1084 break;
1085 case VEC_COPROC:
1086 info.si_code = ILL_COPROC;
1087 sig = SIGILL;
1088 break;
1089 case VEC_TRAP1:
1090 case VEC_TRAP2:
1091 case VEC_TRAP3:
1092 case VEC_TRAP4:
1093 case VEC_TRAP5:
1094 case VEC_TRAP6:
1095 case VEC_TRAP7:
1096 case VEC_TRAP8:
1097 case VEC_TRAP9:
1098 case VEC_TRAP10:
1099 case VEC_TRAP11:
1100 case VEC_TRAP12:
1101 case VEC_TRAP13:
1102 case VEC_TRAP14:
1103 info.si_code = ILL_ILLTRP;
1104 sig = SIGILL;
1105 break;
1106 case VEC_FPBRUC:
1107 case VEC_FPOE:
1108 case VEC_FPNAN:
1109 info.si_code = FPE_FLTINV;
1110 sig = SIGFPE;
1111 break;
1112 case VEC_FPIR:
1113 info.si_code = FPE_FLTRES;
1114 sig = SIGFPE;
1115 break;
1116 case VEC_FPDIVZ:
1117 info.si_code = FPE_FLTDIV;
1118 sig = SIGFPE;
1119 break;
1120 case VEC_FPUNDER:
1121 info.si_code = FPE_FLTUND;
1122 sig = SIGFPE;
1123 break;
1124 case VEC_FPOVER:
1125 info.si_code = FPE_FLTOVF;
1126 sig = SIGFPE;
1127 break;
1128 case VEC_ZERODIV:
1129 info.si_code = FPE_INTDIV;
1130 sig = SIGFPE;
1131 break;
1132 case VEC_CHK:
1133 case VEC_TRAP:
1134 info.si_code = FPE_INTOVF;
1135 sig = SIGFPE;
1136 break;
1137 case VEC_TRACE: /* ptrace single step */
1138 info.si_code = TRAP_TRACE;
1139 sig = SIGTRAP;
1140 break;
1141 case VEC_TRAP15: /* breakpoint */
1142 info.si_code = TRAP_BRKPT;
1143 sig = SIGTRAP;
1144 break;
1145 default:
1146 info.si_code = ILL_ILLOPC;
1147 sig = SIGILL;
1148 break;
1149 }
1150 info.si_signo = sig;
1151 info.si_errno = 0;
1152 switch (fp->ptregs.format) {
1153 default:
1154 info.si_addr = (void *) fp->ptregs.pc;
1155 break;
1156 case 2:
1157 info.si_addr = (void *) fp->un.fmt2.iaddr;
1158 break;
1159 case 7:
1160 info.si_addr = (void *) fp->un.fmt7.effaddr;
1161 break;
1162 case 9:
1163 info.si_addr = (void *) fp->un.fmt9.iaddr;
1164 break;
1165 case 10:
1166 info.si_addr = (void *) fp->un.fmta.daddr;
1167 break;
1168 case 11:
1169 info.si_addr = (void *) fp->un.fmtb.daddr;
1170 break;
1171 }
1172 force_sig_info (sig, &info, current);
1173}
1174
1175void die_if_kernel (char *str, struct pt_regs *fp, int nr)
1176{
1177 if (!(fp->sr & PS_S))
1178 return;
1179
1180 console_verbose();
1181 printk("%s: %08x\n",str,nr);
1182 show_registers(fp);
1183 add_taint(TAINT_DIE);
1184 do_exit(SIGSEGV);
1185}
1186
1187/*
1188 * This function is called if an error occur while accessing
1189 * user-space from the fpsp040 code.
1190 */
1191asmlinkage void fpsp040_die(void)
1192{
1193 do_exit(SIGSEGV);
1194}
1195
1196#ifdef CONFIG_M68KFPU_EMU
1197asmlinkage void fpemu_signal(int signal, int code, void *addr)
1198{
1199 siginfo_t info;
1200
1201 info.si_signo = signal;
1202 info.si_errno = 0;
1203 info.si_code = code;
1204 info.si_addr = addr;
1205 force_sig_info(signal, &info, current);
1206}
1207#endif
diff --git a/arch/m68k/kernel/traps_no.c b/arch/m68k/kernel/traps_no.c
deleted file mode 100644
index e67b8c806959..000000000000
--- a/arch/m68k/kernel/traps_no.c
+++ /dev/null
@@ -1,361 +0,0 @@
1/*
2 * linux/arch/m68knommu/kernel/traps.c
3 *
4 * Copyright (C) 1993, 1994 by Hamish Macdonald
5 *
6 * 68040 fixes by Michael Rausch
7 * 68040 fixes by Martin Apel
8 * 68060 fixes by Roman Hodek
9 * 68060 fixes by Jesper Skov
10 *
11 * This file is subject to the terms and conditions of the GNU General Public
12 * License. See the file COPYING in the main directory of this archive
13 * for more details.
14 */
15
16/*
17 * Sets up all exception vectors
18 */
19#include <linux/sched.h>
20#include <linux/signal.h>
21#include <linux/kernel.h>
22#include <linux/mm.h>
23#include <linux/module.h>
24#include <linux/types.h>
25#include <linux/user.h>
26#include <linux/string.h>
27#include <linux/linkage.h>
28#include <linux/init.h>
29#include <linux/ptrace.h>
30#include <linux/kallsyms.h>
31
32#include <asm/setup.h>
33#include <asm/fpu.h>
34#include <asm/system.h>
35#include <asm/uaccess.h>
36#include <asm/traps.h>
37#include <asm/pgtable.h>
38#include <asm/machdep.h>
39#include <asm/siginfo.h>
40
41static char const * const vec_names[] = {
42 "RESET SP", "RESET PC", "BUS ERROR", "ADDRESS ERROR",
43 "ILLEGAL INSTRUCTION", "ZERO DIVIDE", "CHK", "TRAPcc",
44 "PRIVILEGE VIOLATION", "TRACE", "LINE 1010", "LINE 1111",
45 "UNASSIGNED RESERVED 12", "COPROCESSOR PROTOCOL VIOLATION",
46 "FORMAT ERROR", "UNINITIALIZED INTERRUPT",
47 "UNASSIGNED RESERVED 16", "UNASSIGNED RESERVED 17",
48 "UNASSIGNED RESERVED 18", "UNASSIGNED RESERVED 19",
49 "UNASSIGNED RESERVED 20", "UNASSIGNED RESERVED 21",
50 "UNASSIGNED RESERVED 22", "UNASSIGNED RESERVED 23",
51 "SPURIOUS INTERRUPT", "LEVEL 1 INT", "LEVEL 2 INT", "LEVEL 3 INT",
52 "LEVEL 4 INT", "LEVEL 5 INT", "LEVEL 6 INT", "LEVEL 7 INT",
53 "SYSCALL", "TRAP #1", "TRAP #2", "TRAP #3",
54 "TRAP #4", "TRAP #5", "TRAP #6", "TRAP #7",
55 "TRAP #8", "TRAP #9", "TRAP #10", "TRAP #11",
56 "TRAP #12", "TRAP #13", "TRAP #14", "TRAP #15",
57 "FPCP BSUN", "FPCP INEXACT", "FPCP DIV BY 0", "FPCP UNDERFLOW",
58 "FPCP OPERAND ERROR", "FPCP OVERFLOW", "FPCP SNAN",
59 "FPCP UNSUPPORTED OPERATION",
60 "MMU CONFIGURATION ERROR"
61};
62
63void die_if_kernel(char *str, struct pt_regs *fp, int nr)
64{
65 if (!(fp->sr & PS_S))
66 return;
67
68 console_verbose();
69 printk(KERN_EMERG "%s: %08x\n",str,nr);
70 printk(KERN_EMERG "PC: [<%08lx>]\nSR: %04x SP: %p a2: %08lx\n",
71 fp->pc, fp->sr, fp, fp->a2);
72 printk(KERN_EMERG "d0: %08lx d1: %08lx d2: %08lx d3: %08lx\n",
73 fp->d0, fp->d1, fp->d2, fp->d3);
74 printk(KERN_EMERG "d4: %08lx d5: %08lx a0: %08lx a1: %08lx\n",
75 fp->d4, fp->d5, fp->a0, fp->a1);
76
77 printk(KERN_EMERG "Process %s (pid: %d, stackpage=%08lx)\n",
78 current->comm, current->pid, PAGE_SIZE+(unsigned long)current);
79 show_stack(NULL, (unsigned long *)(fp + 1));
80 add_taint(TAINT_DIE);
81 do_exit(SIGSEGV);
82}
83
84asmlinkage void buserr_c(struct frame *fp)
85{
86 /* Only set esp0 if coming from user mode */
87 if (user_mode(&fp->ptregs))
88 current->thread.esp0 = (unsigned long) fp;
89
90#if defined(DEBUG)
91 printk (KERN_DEBUG "*** Bus Error *** Format is %x\n", fp->ptregs.format);
92#endif
93
94 die_if_kernel("bad frame format",&fp->ptregs,0);
95#if defined(DEBUG)
96 printk(KERN_DEBUG "Unknown SIGSEGV - 4\n");
97#endif
98 force_sig(SIGSEGV, current);
99}
100
101static void print_this_address(unsigned long addr, int i)
102{
103#ifdef CONFIG_KALLSYMS
104 printk(KERN_EMERG " [%08lx] ", addr);
105 print_symbol(KERN_CONT "%s\n", addr);
106#else
107 if (i % 5)
108 printk(KERN_CONT " [%08lx] ", addr);
109 else
110 printk(KERN_EMERG " [%08lx] ", addr);
111 i++;
112#endif
113}
114
115int kstack_depth_to_print = 48;
116
117static void __show_stack(struct task_struct *task, unsigned long *stack)
118{
119 unsigned long *endstack, addr;
120#ifdef CONFIG_FRAME_POINTER
121 unsigned long *last_stack;
122#endif
123 int i;
124
125 if (!stack)
126 stack = (unsigned long *)task->thread.ksp;
127
128 addr = (unsigned long) stack;
129 endstack = (unsigned long *) PAGE_ALIGN(addr);
130
131 printk(KERN_EMERG "Stack from %08lx:", (unsigned long)stack);
132 for (i = 0; i < kstack_depth_to_print; i++) {
133 if (stack + 1 + i > endstack)
134 break;
135 if (i % 8 == 0)
136 printk(KERN_EMERG " ");
137 printk(KERN_CONT " %08lx", *(stack + i));
138 }
139 printk("\n");
140 i = 0;
141
142#ifdef CONFIG_FRAME_POINTER
143 printk(KERN_EMERG "Call Trace:\n");
144
145 last_stack = stack - 1;
146 while (stack <= endstack && stack > last_stack) {
147
148 addr = *(stack + 1);
149 print_this_address(addr, i);
150 i++;
151
152 last_stack = stack;
153 stack = (unsigned long *)*stack;
154 }
155 printk("\n");
156#else
157 printk(KERN_EMERG "Call Trace with CONFIG_FRAME_POINTER disabled:\n");
158 while (stack <= endstack) {
159 addr = *stack++;
160 /*
161 * If the address is either in the text segment of the kernel,
162 * or in a region which is occupied by a module then it *may*
163 * be the address of a calling routine; if so, print it so that
164 * someone tracing down the cause of the crash will be able to
165 * figure out the call path that was taken.
166 */
167 if (__kernel_text_address(addr)) {
168 print_this_address(addr, i);
169 i++;
170 }
171 }
172 printk(KERN_CONT "\n");
173#endif
174}
175
176void bad_super_trap(struct frame *fp)
177{
178 int vector = (fp->ptregs.vector >> 2) & 0xff;
179
180 console_verbose();
181 if (vector < ARRAY_SIZE(vec_names))
182 printk (KERN_WARNING "*** %s *** FORMAT=%X\n",
183 vec_names[vector],
184 fp->ptregs.format);
185 else
186 printk (KERN_WARNING "*** Exception %d *** FORMAT=%X\n",
187 vector,
188 fp->ptregs.format);
189 printk (KERN_WARNING "Current process id is %d\n", current->pid);
190 die_if_kernel("BAD KERNEL TRAP", &fp->ptregs, 0);
191}
192
193asmlinkage void trap_c(struct frame *fp)
194{
195 int sig;
196 int vector = (fp->ptregs.vector >> 2) & 0xff;
197 siginfo_t info;
198
199 if (fp->ptregs.sr & PS_S) {
200 if (vector == VEC_TRACE) {
201 /* traced a trapping instruction */
202 } else
203 bad_super_trap(fp);
204 return;
205 }
206
207 /* send the appropriate signal to the user program */
208 switch (vector) {
209 case VEC_ADDRERR:
210 info.si_code = BUS_ADRALN;
211 sig = SIGBUS;
212 break;
213 case VEC_ILLEGAL:
214 case VEC_LINE10:
215 case VEC_LINE11:
216 info.si_code = ILL_ILLOPC;
217 sig = SIGILL;
218 break;
219 case VEC_PRIV:
220 info.si_code = ILL_PRVOPC;
221 sig = SIGILL;
222 break;
223 case VEC_COPROC:
224 info.si_code = ILL_COPROC;
225 sig = SIGILL;
226 break;
227 case VEC_TRAP1: /* gdbserver breakpoint */
228 fp->ptregs.pc -= 2;
229 info.si_code = TRAP_TRACE;
230 sig = SIGTRAP;
231 break;
232 case VEC_TRAP2:
233 case VEC_TRAP3:
234 case VEC_TRAP4:
235 case VEC_TRAP5:
236 case VEC_TRAP6:
237 case VEC_TRAP7:
238 case VEC_TRAP8:
239 case VEC_TRAP9:
240 case VEC_TRAP10:
241 case VEC_TRAP11:
242 case VEC_TRAP12:
243 case VEC_TRAP13:
244 case VEC_TRAP14:
245 info.si_code = ILL_ILLTRP;
246 sig = SIGILL;
247 break;
248 case VEC_FPBRUC:
249 case VEC_FPOE:
250 case VEC_FPNAN:
251 info.si_code = FPE_FLTINV;
252 sig = SIGFPE;
253 break;
254 case VEC_FPIR:
255 info.si_code = FPE_FLTRES;
256 sig = SIGFPE;
257 break;
258 case VEC_FPDIVZ:
259 info.si_code = FPE_FLTDIV;
260 sig = SIGFPE;
261 break;
262 case VEC_FPUNDER:
263 info.si_code = FPE_FLTUND;
264 sig = SIGFPE;
265 break;
266 case VEC_FPOVER:
267 info.si_code = FPE_FLTOVF;
268 sig = SIGFPE;
269 break;
270 case VEC_ZERODIV:
271 info.si_code = FPE_INTDIV;
272 sig = SIGFPE;
273 break;
274 case VEC_CHK:
275 case VEC_TRAP:
276 info.si_code = FPE_INTOVF;
277 sig = SIGFPE;
278 break;
279 case VEC_TRACE: /* ptrace single step */
280 info.si_code = TRAP_TRACE;
281 sig = SIGTRAP;
282 break;
283 case VEC_TRAP15: /* breakpoint */
284 info.si_code = TRAP_BRKPT;
285 sig = SIGTRAP;
286 break;
287 default:
288 info.si_code = ILL_ILLOPC;
289 sig = SIGILL;
290 break;
291 }
292 info.si_signo = sig;
293 info.si_errno = 0;
294 switch (fp->ptregs.format) {
295 default:
296 info.si_addr = (void *) fp->ptregs.pc;
297 break;
298 case 2:
299 info.si_addr = (void *) fp->un.fmt2.iaddr;
300 break;
301 case 7:
302 info.si_addr = (void *) fp->un.fmt7.effaddr;
303 break;
304 case 9:
305 info.si_addr = (void *) fp->un.fmt9.iaddr;
306 break;
307 case 10:
308 info.si_addr = (void *) fp->un.fmta.daddr;
309 break;
310 case 11:
311 info.si_addr = (void *) fp->un.fmtb.daddr;
312 break;
313 }
314 force_sig_info (sig, &info, current);
315}
316
317asmlinkage void set_esp0(unsigned long ssp)
318{
319 current->thread.esp0 = ssp;
320}
321
322/*
323 * The architecture-independent backtrace generator
324 */
325void dump_stack(void)
326{
327 /*
328 * We need frame pointers for this little trick, which works as follows:
329 *
330 * +------------+ 0x00
331 * | Next SP | -> 0x0c
332 * +------------+ 0x04
333 * | Caller |
334 * +------------+ 0x08
335 * | Local vars | -> our stack var
336 * +------------+ 0x0c
337 * | Next SP | -> 0x18, that is what we pass to show_stack()
338 * +------------+ 0x10
339 * | Caller |
340 * +------------+ 0x14
341 * | Local vars |
342 * +------------+ 0x18
343 * | ... |
344 * +------------+
345 */
346
347 unsigned long *stack;
348
349 stack = (unsigned long *)&stack;
350 stack++;
351 __show_stack(current, stack);
352}
353EXPORT_SYMBOL(dump_stack);
354
355void show_stack(struct task_struct *task, unsigned long *stack)
356{
357 if (!stack && !task)
358 dump_stack();
359 else
360 __show_stack(task, stack);
361}
diff --git a/arch/m68k/kernel/vectors.c b/arch/m68k/kernel/vectors.c
new file mode 100644
index 000000000000..147b03fbc71e
--- /dev/null
+++ b/arch/m68k/kernel/vectors.c
@@ -0,0 +1,145 @@
1/*
2 * vectors.c
3 *
4 * Copyright (C) 1993, 1994 by Hamish Macdonald
5 *
6 * 68040 fixes by Michael Rausch
7 * 68040 fixes by Martin Apel
8 * 68040 fixes and writeback by Richard Zidlicky
9 * 68060 fixes by Roman Hodek
10 * 68060 fixes by Jesper Skov
11 *
12 * This file is subject to the terms and conditions of the GNU General Public
13 * License. See the file COPYING in the main directory of this archive
14 * for more details.
15 */
16
17/*
18 * Sets up all exception vectors
19 */
20#include <linux/sched.h>
21#include <linux/kernel.h>
22#include <linux/linkage.h>
23#include <linux/init.h>
24#include <linux/kallsyms.h>
25
26#include <asm/setup.h>
27#include <asm/fpu.h>
28#include <asm/system.h>
29#include <asm/traps.h>
30
31/* assembler routines */
32asmlinkage void system_call(void);
33asmlinkage void buserr(void);
34asmlinkage void trap(void);
35asmlinkage void nmihandler(void);
36#ifdef CONFIG_M68KFPU_EMU
37asmlinkage void fpu_emu(void);
38#endif
39
40e_vector vectors[256];
41
42/* nmi handler for the Amiga */
43asm(".text\n"
44 __ALIGN_STR "\n"
45 "nmihandler: rte");
46
47/*
48 * this must be called very early as the kernel might
49 * use some instruction that are emulated on the 060
50 * and so we're prepared for early probe attempts (e.g. nf_init).
51 */
52void __init base_trap_init(void)
53{
54 if (MACH_IS_SUN3X) {
55 extern e_vector *sun3x_prom_vbr;
56
57 __asm__ volatile ("movec %%vbr, %0" : "=r" (sun3x_prom_vbr));
58 }
59
60 /* setup the exception vector table */
61 __asm__ volatile ("movec %0,%%vbr" : : "r" ((void*)vectors));
62
63 if (CPU_IS_060) {
64 /* set up ISP entry points */
65 asmlinkage void unimp_vec(void) asm ("_060_isp_unimp");
66
67 vectors[VEC_UNIMPII] = unimp_vec;
68 }
69
70 vectors[VEC_BUSERR] = buserr;
71 vectors[VEC_ILLEGAL] = trap;
72 vectors[VEC_SYS] = system_call;
73}
74
75void __init trap_init (void)
76{
77 int i;
78
79 for (i = VEC_SPUR; i <= VEC_INT7; i++)
80 vectors[i] = bad_inthandler;
81
82 for (i = 0; i < VEC_USER; i++)
83 if (!vectors[i])
84 vectors[i] = trap;
85
86 for (i = VEC_USER; i < 256; i++)
87 vectors[i] = bad_inthandler;
88
89#ifdef CONFIG_M68KFPU_EMU
90 if (FPU_IS_EMU)
91 vectors[VEC_LINE11] = fpu_emu;
92#endif
93
94 if (CPU_IS_040 && !FPU_IS_EMU) {
95 /* set up FPSP entry points */
96 asmlinkage void dz_vec(void) asm ("dz");
97 asmlinkage void inex_vec(void) asm ("inex");
98 asmlinkage void ovfl_vec(void) asm ("ovfl");
99 asmlinkage void unfl_vec(void) asm ("unfl");
100 asmlinkage void snan_vec(void) asm ("snan");
101 asmlinkage void operr_vec(void) asm ("operr");
102 asmlinkage void bsun_vec(void) asm ("bsun");
103 asmlinkage void fline_vec(void) asm ("fline");
104 asmlinkage void unsupp_vec(void) asm ("unsupp");
105
106 vectors[VEC_FPDIVZ] = dz_vec;
107 vectors[VEC_FPIR] = inex_vec;
108 vectors[VEC_FPOVER] = ovfl_vec;
109 vectors[VEC_FPUNDER] = unfl_vec;
110 vectors[VEC_FPNAN] = snan_vec;
111 vectors[VEC_FPOE] = operr_vec;
112 vectors[VEC_FPBRUC] = bsun_vec;
113 vectors[VEC_LINE11] = fline_vec;
114 vectors[VEC_FPUNSUP] = unsupp_vec;
115 }
116
117 if (CPU_IS_060 && !FPU_IS_EMU) {
118 /* set up IFPSP entry points */
119 asmlinkage void snan_vec6(void) asm ("_060_fpsp_snan");
120 asmlinkage void operr_vec6(void) asm ("_060_fpsp_operr");
121 asmlinkage void ovfl_vec6(void) asm ("_060_fpsp_ovfl");
122 asmlinkage void unfl_vec6(void) asm ("_060_fpsp_unfl");
123 asmlinkage void dz_vec6(void) asm ("_060_fpsp_dz");
124 asmlinkage void inex_vec6(void) asm ("_060_fpsp_inex");
125 asmlinkage void fline_vec6(void) asm ("_060_fpsp_fline");
126 asmlinkage void unsupp_vec6(void) asm ("_060_fpsp_unsupp");
127 asmlinkage void effadd_vec6(void) asm ("_060_fpsp_effadd");
128
129 vectors[VEC_FPNAN] = snan_vec6;
130 vectors[VEC_FPOE] = operr_vec6;
131 vectors[VEC_FPOVER] = ovfl_vec6;
132 vectors[VEC_FPUNDER] = unfl_vec6;
133 vectors[VEC_FPDIVZ] = dz_vec6;
134 vectors[VEC_FPIR] = inex_vec6;
135 vectors[VEC_LINE11] = fline_vec6;
136 vectors[VEC_FPUNSUP] = unsupp_vec6;
137 vectors[VEC_UNIMPEA] = effadd_vec6;
138 }
139
140 /* if running on an amiga, make the NMI interrupt do nothing */
141 if (MACH_IS_AMIGA) {
142 vectors[VEC_INT7] = nmihandler;
143 }
144}
145
diff --git a/arch/m68k/kernel/vmlinux.lds_no.S b/arch/m68k/kernel/vmlinux.lds_no.S
index 7dc4087a9545..4e2389340837 100644
--- a/arch/m68k/kernel/vmlinux.lds_no.S
+++ b/arch/m68k/kernel/vmlinux.lds_no.S
@@ -77,7 +77,6 @@ SECTIONS {
77 77
78 *(.rodata) *(.rodata.*) 78 *(.rodata) *(.rodata.*)
79 *(__vermagic) /* Kernel version magic */ 79 *(__vermagic) /* Kernel version magic */
80 *(__markers_strings)
81 *(.rodata1) 80 *(.rodata1)
82 *(.rodata.str1.1) 81 *(.rodata.str1.1)
83 82
diff --git a/arch/m68k/lib/memcpy.c b/arch/m68k/lib/memcpy.c
index 064889316974..10ca051d56b8 100644
--- a/arch/m68k/lib/memcpy.c
+++ b/arch/m68k/lib/memcpy.c
@@ -22,6 +22,15 @@ void *memcpy(void *to, const void *from, size_t n)
22 from = cfrom; 22 from = cfrom;
23 n--; 23 n--;
24 } 24 }
25#if defined(CONFIG_M68000)
26 if ((long)from & 1) {
27 char *cto = to;
28 const char *cfrom = from;
29 for (; n; n--)
30 *cto++ = *cfrom++;
31 return xto;
32 }
33#endif
25 if (n > 2 && (long)to & 2) { 34 if (n > 2 && (long)to & 2) {
26 short *sto = to; 35 short *sto = to;
27 const short *sfrom = from; 36 const short *sfrom = from;
diff --git a/arch/m68k/mac/macints.c b/arch/m68k/mac/macints.c
index 900d899f3323..f92190c159b4 100644
--- a/arch/m68k/mac/macints.c
+++ b/arch/m68k/mac/macints.c
@@ -370,7 +370,7 @@ int mac_irq_pending(unsigned int irq)
370 break; 370 break;
371 case 4: 371 case 4:
372 if (psc_present) 372 if (psc_present)
373 psc_irq_pending(irq); 373 return psc_irq_pending(irq);
374 break; 374 break;
375 } 375 }
376 return 0; 376 return 0;
diff --git a/arch/m68k/mac/misc.c b/arch/m68k/mac/misc.c
index e023fc6b37e5..eb915551de69 100644
--- a/arch/m68k/mac/misc.c
+++ b/arch/m68k/mac/misc.c
@@ -304,35 +304,41 @@ static void via_write_pram(int offset, __u8 data)
304static long via_read_time(void) 304static long via_read_time(void)
305{ 305{
306 union { 306 union {
307 __u8 cdata[4]; 307 __u8 cdata[4];
308 long idata; 308 long idata;
309 } result, last_result; 309 } result, last_result;
310 int ct; 310 int count = 1;
311
312 via_pram_command(0x81, &last_result.cdata[3]);
313 via_pram_command(0x85, &last_result.cdata[2]);
314 via_pram_command(0x89, &last_result.cdata[1]);
315 via_pram_command(0x8D, &last_result.cdata[0]);
311 316
312 /* 317 /*
313 * The NetBSD guys say to loop until you get the same reading 318 * The NetBSD guys say to loop until you get the same reading
314 * twice in a row. 319 * twice in a row.
315 */ 320 */
316 321
317 ct = 0; 322 while (1) {
318 do {
319 if (++ct > 10) {
320 printk("via_read_time: couldn't get valid time, "
321 "last read = 0x%08lx and 0x%08lx\n",
322 last_result.idata, result.idata);
323 break;
324 }
325
326 last_result.idata = result.idata;
327 result.idata = 0;
328
329 via_pram_command(0x81, &result.cdata[3]); 323 via_pram_command(0x81, &result.cdata[3]);
330 via_pram_command(0x85, &result.cdata[2]); 324 via_pram_command(0x85, &result.cdata[2]);
331 via_pram_command(0x89, &result.cdata[1]); 325 via_pram_command(0x89, &result.cdata[1]);
332 via_pram_command(0x8D, &result.cdata[0]); 326 via_pram_command(0x8D, &result.cdata[0]);
333 } while (result.idata != last_result.idata);
334 327
335 return result.idata - RTC_OFFSET; 328 if (result.idata == last_result.idata)
329 return result.idata - RTC_OFFSET;
330
331 if (++count > 10)
332 break;
333
334 last_result.idata = result.idata;
335 }
336
337 pr_err("via_read_time: failed to read a stable value; "
338 "got 0x%08lx then 0x%08lx\n",
339 last_result.idata, result.idata);
340
341 return 0;
336} 342}
337 343
338/* 344/*
diff --git a/arch/m68k/mm/init_no.c b/arch/m68k/mm/init_no.c
index 50cd12cf28d9..1e33d39ca9a0 100644
--- a/arch/m68k/mm/init_no.c
+++ b/arch/m68k/mm/init_no.c
@@ -32,6 +32,7 @@
32#include <linux/gfp.h> 32#include <linux/gfp.h>
33 33
34#include <asm/setup.h> 34#include <asm/setup.h>
35#include <asm/sections.h>
35#include <asm/segment.h> 36#include <asm/segment.h>
36#include <asm/page.h> 37#include <asm/page.h>
37#include <asm/pgtable.h> 38#include <asm/pgtable.h>
@@ -44,9 +45,6 @@
44 */ 45 */
45void *empty_zero_page; 46void *empty_zero_page;
46 47
47extern unsigned long memory_start;
48extern unsigned long memory_end;
49
50/* 48/*
51 * paging_init() continues the virtual memory environment setup which 49 * paging_init() continues the virtual memory environment setup which
52 * was begun by the code in arch/head.S. 50 * was begun by the code in arch/head.S.
@@ -78,8 +76,6 @@ void __init mem_init(void)
78{ 76{
79 int codek = 0, datak = 0, initk = 0; 77 int codek = 0, datak = 0, initk = 0;
80 unsigned long tmp; 78 unsigned long tmp;
81 extern char _etext, _stext, _sdata, _ebss, __init_begin, __init_end;
82 extern unsigned int _ramend, _rambase;
83 unsigned long len = _ramend - _rambase; 79 unsigned long len = _ramend - _rambase;
84 unsigned long start_mem = memory_start; /* DAVIDM - these must start at end of kernel */ 80 unsigned long start_mem = memory_start; /* DAVIDM - these must start at end of kernel */
85 unsigned long end_mem = memory_end; /* DAVIDM - this must not include kernel stack at top */ 81 unsigned long end_mem = memory_end; /* DAVIDM - this must not include kernel stack at top */
@@ -95,9 +91,9 @@ void __init mem_init(void)
95 /* this will put all memory onto the freelists */ 91 /* this will put all memory onto the freelists */
96 totalram_pages = free_all_bootmem(); 92 totalram_pages = free_all_bootmem();
97 93
98 codek = (&_etext - &_stext) >> 10; 94 codek = (_etext - _stext) >> 10;
99 datak = (&_ebss - &_sdata) >> 10; 95 datak = (_ebss - _sdata) >> 10;
100 initk = (&__init_begin - &__init_end) >> 10; 96 initk = (__init_begin - __init_end) >> 10;
101 97
102 tmp = nr_free_pages() << PAGE_SHIFT; 98 tmp = nr_free_pages() << PAGE_SHIFT;
103 printk(KERN_INFO "Memory available: %luk/%luk RAM, (%dk kernel code, %dk data)\n", 99 printk(KERN_INFO "Memory available: %luk/%luk RAM, (%dk kernel code, %dk data)\n",
@@ -129,22 +125,21 @@ void free_initmem(void)
129{ 125{
130#ifdef CONFIG_RAMKERNEL 126#ifdef CONFIG_RAMKERNEL
131 unsigned long addr; 127 unsigned long addr;
132 extern char __init_begin, __init_end;
133 /* 128 /*
134 * The following code should be cool even if these sections 129 * The following code should be cool even if these sections
135 * are not page aligned. 130 * are not page aligned.
136 */ 131 */
137 addr = PAGE_ALIGN((unsigned long)(&__init_begin)); 132 addr = PAGE_ALIGN((unsigned long) __init_begin);
138 /* next to check that the page we free is not a partial page */ 133 /* next to check that the page we free is not a partial page */
139 for (; addr + PAGE_SIZE < (unsigned long)(&__init_end); addr +=PAGE_SIZE) { 134 for (; addr + PAGE_SIZE < ((unsigned long) __init_end); addr += PAGE_SIZE) {
140 ClearPageReserved(virt_to_page(addr)); 135 ClearPageReserved(virt_to_page(addr));
141 init_page_count(virt_to_page(addr)); 136 init_page_count(virt_to_page(addr));
142 free_page(addr); 137 free_page(addr);
143 totalram_pages++; 138 totalram_pages++;
144 } 139 }
145 pr_notice("Freeing unused kernel memory: %luk freed (0x%x - 0x%x)\n", 140 pr_notice("Freeing unused kernel memory: %luk freed (0x%x - 0x%x)\n",
146 (addr - PAGE_ALIGN((long) &__init_begin)) >> 10, 141 (addr - PAGE_ALIGN((unsigned long) __init_begin)) >> 10,
147 (int)(PAGE_ALIGN((unsigned long)(&__init_begin))), 142 (int)(PAGE_ALIGN((unsigned long) __init_begin)),
148 (int)(addr - PAGE_SIZE)); 143 (int)(addr - PAGE_SIZE));
149#endif 144#endif
150} 145}
diff --git a/arch/m68k/platform/520x/config.c b/arch/m68k/platform/520x/config.c
index 621238f1a219..8a98683f1b15 100644
--- a/arch/m68k/platform/520x/config.c
+++ b/arch/m68k/platform/520x/config.c
@@ -91,9 +91,9 @@ static struct resource m520x_qspi_resources[] = {
91 }, 91 },
92}; 92};
93 93
94#define MCFQSPI_CS0 62 94#define MCFQSPI_CS0 46
95#define MCFQSPI_CS1 63 95#define MCFQSPI_CS1 47
96#define MCFQSPI_CS2 44 96#define MCFQSPI_CS2 27
97 97
98static int m520x_cs_setup(struct mcfqspi_cs_control *cs_control) 98static int m520x_cs_setup(struct mcfqspi_cs_control *cs_control)
99{ 99{
diff --git a/arch/m68k/platform/520x/gpio.c b/arch/m68k/platform/520x/gpio.c
index d757328563d1..9bcc3e4b60c5 100644
--- a/arch/m68k/platform/520x/gpio.c
+++ b/arch/m68k/platform/520x/gpio.c
@@ -38,42 +38,6 @@ static struct mcf_gpio_chip mcf_gpio_chips[] = {
38 }, 38 },
39 { 39 {
40 .gpio_chip = { 40 .gpio_chip = {
41 .label = "BUSCTL",
42 .request = mcf_gpio_request,
43 .free = mcf_gpio_free,
44 .direction_input = mcf_gpio_direction_input,
45 .direction_output = mcf_gpio_direction_output,
46 .get = mcf_gpio_get_value,
47 .set = mcf_gpio_set_value_fast,
48 .base = 8,
49 .ngpio = 4,
50 },
51 .pddr = (void __iomem *) MCFGPIO_PDDR_BUSCTL,
52 .podr = (void __iomem *) MCFGPIO_PODR_BUSCTL,
53 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_BUSCTL,
54 .setr = (void __iomem *) MCFGPIO_PPDSDR_BUSCTL,
55 .clrr = (void __iomem *) MCFGPIO_PCLRR_BUSCTL,
56 },
57 {
58 .gpio_chip = {
59 .label = "BE",
60 .request = mcf_gpio_request,
61 .free = mcf_gpio_free,
62 .direction_input = mcf_gpio_direction_input,
63 .direction_output = mcf_gpio_direction_output,
64 .get = mcf_gpio_get_value,
65 .set = mcf_gpio_set_value_fast,
66 .base = 16,
67 .ngpio = 4,
68 },
69 .pddr = (void __iomem *) MCFGPIO_PDDR_BE,
70 .podr = (void __iomem *) MCFGPIO_PODR_BE,
71 .ppdr = (void __iomem *) MCFGPIO_PPDSDR_BE,
72 .setr = (void __iomem *) MCFGPIO_PPDSDR_BE,
73 .clrr = (void __iomem *) MCFGPIO_PCLRR_BE,
74 },
75 {
76 .gpio_chip = {
77 .label = "CS", 41 .label = "CS",
78 .request = mcf_gpio_request, 42 .request = mcf_gpio_request,
79 .free = mcf_gpio_free, 43 .free = mcf_gpio_free,
@@ -81,7 +45,7 @@ static struct mcf_gpio_chip mcf_gpio_chips[] = {
81 .direction_output = mcf_gpio_direction_output, 45 .direction_output = mcf_gpio_direction_output,
82 .get = mcf_gpio_get_value, 46 .get = mcf_gpio_get_value,
83 .set = mcf_gpio_set_value_fast, 47 .set = mcf_gpio_set_value_fast,
84 .base = 25, 48 .base = 9,
85 .ngpio = 3, 49 .ngpio = 3,
86 }, 50 },
87 .pddr = (void __iomem *) MCFGPIO_PDDR_CS, 51 .pddr = (void __iomem *) MCFGPIO_PDDR_CS,
@@ -99,7 +63,7 @@ static struct mcf_gpio_chip mcf_gpio_chips[] = {
99 .direction_output = mcf_gpio_direction_output, 63 .direction_output = mcf_gpio_direction_output,
100 .get = mcf_gpio_get_value, 64 .get = mcf_gpio_get_value,
101 .set = mcf_gpio_set_value_fast, 65 .set = mcf_gpio_set_value_fast,
102 .base = 32, 66 .base = 16,
103 .ngpio = 4, 67 .ngpio = 4,
104 }, 68 },
105 .pddr = (void __iomem *) MCFGPIO_PDDR_FECI2C, 69 .pddr = (void __iomem *) MCFGPIO_PDDR_FECI2C,
@@ -117,7 +81,7 @@ static struct mcf_gpio_chip mcf_gpio_chips[] = {
117 .direction_output = mcf_gpio_direction_output, 81 .direction_output = mcf_gpio_direction_output,
118 .get = mcf_gpio_get_value, 82 .get = mcf_gpio_get_value,
119 .set = mcf_gpio_set_value_fast, 83 .set = mcf_gpio_set_value_fast,
120 .base = 40, 84 .base = 24,
121 .ngpio = 4, 85 .ngpio = 4,
122 }, 86 },
123 .pddr = (void __iomem *) MCFGPIO_PDDR_QSPI, 87 .pddr = (void __iomem *) MCFGPIO_PDDR_QSPI,
@@ -135,7 +99,7 @@ static struct mcf_gpio_chip mcf_gpio_chips[] = {
135 .direction_output = mcf_gpio_direction_output, 99 .direction_output = mcf_gpio_direction_output,
136 .get = mcf_gpio_get_value, 100 .get = mcf_gpio_get_value,
137 .set = mcf_gpio_set_value_fast, 101 .set = mcf_gpio_set_value_fast,
138 .base = 48, 102 .base = 32,
139 .ngpio = 4, 103 .ngpio = 4,
140 }, 104 },
141 .pddr = (void __iomem *) MCFGPIO_PDDR_TIMER, 105 .pddr = (void __iomem *) MCFGPIO_PDDR_TIMER,
@@ -153,7 +117,7 @@ static struct mcf_gpio_chip mcf_gpio_chips[] = {
153 .direction_output = mcf_gpio_direction_output, 117 .direction_output = mcf_gpio_direction_output,
154 .get = mcf_gpio_get_value, 118 .get = mcf_gpio_get_value,
155 .set = mcf_gpio_set_value_fast, 119 .set = mcf_gpio_set_value_fast,
156 .base = 56, 120 .base = 40,
157 .ngpio = 8, 121 .ngpio = 8,
158 }, 122 },
159 .pddr = (void __iomem *) MCFGPIO_PDDR_UART, 123 .pddr = (void __iomem *) MCFGPIO_PDDR_UART,
@@ -171,7 +135,7 @@ static struct mcf_gpio_chip mcf_gpio_chips[] = {
171 .direction_output = mcf_gpio_direction_output, 135 .direction_output = mcf_gpio_direction_output,
172 .get = mcf_gpio_get_value, 136 .get = mcf_gpio_get_value,
173 .set = mcf_gpio_set_value_fast, 137 .set = mcf_gpio_set_value_fast,
174 .base = 64, 138 .base = 48,
175 .ngpio = 8, 139 .ngpio = 8,
176 }, 140 },
177 .pddr = (void __iomem *) MCFGPIO_PDDR_FECH, 141 .pddr = (void __iomem *) MCFGPIO_PDDR_FECH,
@@ -189,7 +153,7 @@ static struct mcf_gpio_chip mcf_gpio_chips[] = {
189 .direction_output = mcf_gpio_direction_output, 153 .direction_output = mcf_gpio_direction_output,
190 .get = mcf_gpio_get_value, 154 .get = mcf_gpio_get_value,
191 .set = mcf_gpio_set_value_fast, 155 .set = mcf_gpio_set_value_fast,
192 .base = 72, 156 .base = 56,
193 .ngpio = 8, 157 .ngpio = 8,
194 }, 158 },
195 .pddr = (void __iomem *) MCFGPIO_PDDR_FECL, 159 .pddr = (void __iomem *) MCFGPIO_PDDR_FECL,
diff --git a/arch/m68k/platform/68328/Makefile b/arch/m68k/platform/68328/Makefile
index 5e5435552d56..e4dfd8fde068 100644
--- a/arch/m68k/platform/68328/Makefile
+++ b/arch/m68k/platform/68328/Makefile
@@ -2,7 +2,10 @@
2# Makefile for arch/m68knommu/platform/68328. 2# Makefile for arch/m68knommu/platform/68328.
3# 3#
4 4
5head-y = head-$(MODEL).o 5model-y := ram
6model-$(CONFIG_ROMKERNEL) := rom
7
8head-y = head-$(model-y).o
6head-$(CONFIG_PILOT) = head-pilot.o 9head-$(CONFIG_PILOT) = head-pilot.o
7head-$(CONFIG_DRAGEN2) = head-de2.o 10head-$(CONFIG_DRAGEN2) = head-de2.o
8 11
diff --git a/arch/m68k/platform/68328/entry.S b/arch/m68k/platform/68328/entry.S
index 293e1eba9acc..5c39b80ed7de 100644
--- a/arch/m68k/platform/68328/entry.S
+++ b/arch/m68k/platform/68328/entry.S
@@ -67,7 +67,7 @@ ret_from_signal:
67 jra ret_from_exception 67 jra ret_from_exception
68 68
69ENTRY(system_call) 69ENTRY(system_call)
70 SAVE_ALL 70 SAVE_ALL_SYS
71 71
72 /* save top of frame*/ 72 /* save top of frame*/
73 pea %sp@ 73 pea %sp@
@@ -129,7 +129,7 @@ Lsignal_return:
129 * This is the main interrupt handler, responsible for calling process_int() 129 * This is the main interrupt handler, responsible for calling process_int()
130 */ 130 */
131inthandler1: 131inthandler1:
132 SAVE_ALL 132 SAVE_ALL_INT
133 movew %sp@(PT_OFF_FORMATVEC), %d0 133 movew %sp@(PT_OFF_FORMATVEC), %d0
134 and #0x3ff, %d0 134 and #0x3ff, %d0
135 135
@@ -140,7 +140,7 @@ inthandler1:
140 bra ret_from_interrupt 140 bra ret_from_interrupt
141 141
142inthandler2: 142inthandler2:
143 SAVE_ALL 143 SAVE_ALL_INT
144 movew %sp@(PT_OFF_FORMATVEC), %d0 144 movew %sp@(PT_OFF_FORMATVEC), %d0
145 and #0x3ff, %d0 145 and #0x3ff, %d0
146 146
@@ -151,7 +151,7 @@ inthandler2:
151 bra ret_from_interrupt 151 bra ret_from_interrupt
152 152
153inthandler3: 153inthandler3:
154 SAVE_ALL 154 SAVE_ALL_INT
155 movew %sp@(PT_OFF_FORMATVEC), %d0 155 movew %sp@(PT_OFF_FORMATVEC), %d0
156 and #0x3ff, %d0 156 and #0x3ff, %d0
157 157
@@ -162,7 +162,7 @@ inthandler3:
162 bra ret_from_interrupt 162 bra ret_from_interrupt
163 163
164inthandler4: 164inthandler4:
165 SAVE_ALL 165 SAVE_ALL_INT
166 movew %sp@(PT_OFF_FORMATVEC), %d0 166 movew %sp@(PT_OFF_FORMATVEC), %d0
167 and #0x3ff, %d0 167 and #0x3ff, %d0
168 168
@@ -173,7 +173,7 @@ inthandler4:
173 bra ret_from_interrupt 173 bra ret_from_interrupt
174 174
175inthandler5: 175inthandler5:
176 SAVE_ALL 176 SAVE_ALL_INT
177 movew %sp@(PT_OFF_FORMATVEC), %d0 177 movew %sp@(PT_OFF_FORMATVEC), %d0
178 and #0x3ff, %d0 178 and #0x3ff, %d0
179 179
@@ -184,7 +184,7 @@ inthandler5:
184 bra ret_from_interrupt 184 bra ret_from_interrupt
185 185
186inthandler6: 186inthandler6:
187 SAVE_ALL 187 SAVE_ALL_INT
188 movew %sp@(PT_OFF_FORMATVEC), %d0 188 movew %sp@(PT_OFF_FORMATVEC), %d0
189 and #0x3ff, %d0 189 and #0x3ff, %d0
190 190
@@ -195,7 +195,7 @@ inthandler6:
195 bra ret_from_interrupt 195 bra ret_from_interrupt
196 196
197inthandler7: 197inthandler7:
198 SAVE_ALL 198 SAVE_ALL_INT
199 movew %sp@(PT_OFF_FORMATVEC), %d0 199 movew %sp@(PT_OFF_FORMATVEC), %d0
200 and #0x3ff, %d0 200 and #0x3ff, %d0
201 201
@@ -206,7 +206,7 @@ inthandler7:
206 bra ret_from_interrupt 206 bra ret_from_interrupt
207 207
208inthandler: 208inthandler:
209 SAVE_ALL 209 SAVE_ALL_INT
210 movew %sp@(PT_OFF_FORMATVEC), %d0 210 movew %sp@(PT_OFF_FORMATVEC), %d0
211 and #0x3ff, %d0 211 and #0x3ff, %d0
212 212
diff --git a/arch/m68k/platform/68360/Makefile b/arch/m68k/platform/68360/Makefile
index cf5af73a5789..f6f434383049 100644
--- a/arch/m68k/platform/68360/Makefile
+++ b/arch/m68k/platform/68360/Makefile
@@ -1,10 +1,12 @@
1# 1#
2# Makefile for arch/m68knommu/platform/68360. 2# Makefile for arch/m68knommu/platform/68360.
3# 3#
4model-y := ram
5model-$(CONFIG_ROMKERNEL) := rom
4 6
5obj-y := config.o commproc.o entry.o ints.o 7obj-y := config.o commproc.o entry.o ints.o
6 8
7extra-y := head.o 9extra-y := head.o
8 10
9$(obj)/head.o: $(obj)/head-$(MODEL).o 11$(obj)/head.o: $(obj)/head-$(model-y).o
10 ln -sf head-$(MODEL).o $(obj)/head.o 12 ln -sf head-$(model-y).o $(obj)/head.o
diff --git a/arch/m68k/platform/68360/entry.S b/arch/m68k/platform/68360/entry.S
index abbb89672ea0..aa47d1d49929 100644
--- a/arch/m68k/platform/68360/entry.S
+++ b/arch/m68k/platform/68360/entry.S
@@ -63,7 +63,7 @@ ret_from_signal:
63 jra ret_from_exception 63 jra ret_from_exception
64 64
65ENTRY(system_call) 65ENTRY(system_call)
66 SAVE_ALL 66 SAVE_ALL_SYS
67 67
68 /* save top of frame*/ 68 /* save top of frame*/
69 pea %sp@ 69 pea %sp@
@@ -125,7 +125,7 @@ Lsignal_return:
125 * This is the main interrupt handler, responsible for calling do_IRQ() 125 * This is the main interrupt handler, responsible for calling do_IRQ()
126 */ 126 */
127inthandler: 127inthandler:
128 SAVE_ALL 128 SAVE_ALL_INT
129 movew %sp@(PT_OFF_FORMATVEC), %d0 129 movew %sp@(PT_OFF_FORMATVEC), %d0
130 and.l #0x3ff, %d0 130 and.l #0x3ff, %d0
131 lsr.l #0x02, %d0 131 lsr.l #0x02, %d0
diff --git a/arch/m68k/platform/coldfire/entry.S b/arch/m68k/platform/coldfire/entry.S
index bd27242c2f43..3157461a8d1d 100644
--- a/arch/m68k/platform/coldfire/entry.S
+++ b/arch/m68k/platform/coldfire/entry.S
@@ -61,7 +61,7 @@ enosys:
61 bra 1f 61 bra 1f
62 62
63ENTRY(system_call) 63ENTRY(system_call)
64 SAVE_ALL 64 SAVE_ALL_SYS
65 move #0x2000,%sr /* enable intrs again */ 65 move #0x2000,%sr /* enable intrs again */
66 66
67 cmpl #NR_syscalls,%d0 67 cmpl #NR_syscalls,%d0
@@ -165,9 +165,7 @@ Lsignal_return:
165 * sources). Calls up to high level code to do all the work. 165 * sources). Calls up to high level code to do all the work.
166 */ 166 */
167ENTRY(inthandler) 167ENTRY(inthandler)
168 SAVE_ALL 168 SAVE_ALL_INT
169 moveq #-1,%d0
170 movel %d0,%sp@(PT_OFF_ORIG_D0)
171 169
172 movew %sp@(PT_OFF_FORMATVEC),%d0 /* put exception # in d0 */ 170 movew %sp@(PT_OFF_FORMATVEC),%d0 /* put exception # in d0 */
173 andl #0x03fc,%d0 /* mask out vector only */ 171 andl #0x03fc,%d0 /* mask out vector only */
diff --git a/arch/m68k/q40/README b/arch/m68k/q40/README
index b26d5f55e91d..93f4c4cd3c45 100644
--- a/arch/m68k/q40/README
+++ b/arch/m68k/q40/README
@@ -31,7 +31,7 @@ drivers used by the Q40, apart from the very obvious (console etc.):
31 char/joystick/* # most of this should work, not 31 char/joystick/* # most of this should work, not
32 # in default config.in 32 # in default config.in
33 block/q40ide.c # startup for ide 33 block/q40ide.c # startup for ide
34 ide* # see Documentation/ide.txt 34 ide* # see Documentation/ide/ide.txt
35 floppy.c # normal PC driver, DMA emu in asm/floppy.h 35 floppy.c # normal PC driver, DMA emu in asm/floppy.h
36 # and arch/m68k/kernel/entry.S 36 # and arch/m68k/kernel/entry.S
37 # see drivers/block/README.fd 37 # see drivers/block/README.fd
diff --git a/arch/microblaze/include/asm/dma-mapping.h b/arch/microblaze/include/asm/dma-mapping.h
index 8fbb0ec10233..a569514cf19f 100644
--- a/arch/microblaze/include/asm/dma-mapping.h
+++ b/arch/microblaze/include/asm/dma-mapping.h
@@ -16,7 +16,7 @@
16#define _ASM_MICROBLAZE_DMA_MAPPING_H 16#define _ASM_MICROBLAZE_DMA_MAPPING_H
17 17
18/* 18/*
19 * See Documentation/PCI/PCI-DMA-mapping.txt and 19 * See Documentation/DMA-API-HOWTO.txt and
20 * Documentation/DMA-API.txt for documentation. 20 * Documentation/DMA-API.txt for documentation.
21 */ 21 */
22 22
diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
index 213f2d671669..36a133e5ee35 100644
--- a/arch/microblaze/mm/init.c
+++ b/arch/microblaze/mm/init.c
@@ -304,11 +304,11 @@ asmlinkage void __init mmu_init(void)
304 /* Map in all of RAM starting at CONFIG_KERNEL_START */ 304 /* Map in all of RAM starting at CONFIG_KERNEL_START */
305 mapin_ram(); 305 mapin_ram();
306 306
307#ifdef HIGHMEM_START_BOOL 307#ifdef CONFIG_HIGHMEM_START_BOOL
308 ioremap_base = HIGHMEM_START; 308 ioremap_base = CONFIG_HIGHMEM_START;
309#else 309#else
310 ioremap_base = 0xfe000000UL; /* for now, could be 0xfffff000 */ 310 ioremap_base = 0xfe000000UL; /* for now, could be 0xfffff000 */
311#endif /* CONFIG_HIGHMEM */ 311#endif /* CONFIG_HIGHMEM_START_BOOL */
312 ioremap_bot = ioremap_base; 312 ioremap_bot = ioremap_base;
313 313
314 /* Initialize the context management stuff */ 314 /* Initialize the context management stuff */
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 177cdaf83564..4cbc6d8de210 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -24,6 +24,7 @@ config MIPS
24 select GENERIC_IRQ_PROBE 24 select GENERIC_IRQ_PROBE
25 select GENERIC_IRQ_SHOW 25 select GENERIC_IRQ_SHOW
26 select HAVE_ARCH_JUMP_LABEL 26 select HAVE_ARCH_JUMP_LABEL
27 select IRQ_FORCED_THREADING
27 28
28menu "Machine selection" 29menu "Machine selection"
29 30
@@ -91,15 +92,8 @@ config BCM47XX
91 select DMA_NONCOHERENT 92 select DMA_NONCOHERENT
92 select HW_HAS_PCI 93 select HW_HAS_PCI
93 select IRQ_CPU 94 select IRQ_CPU
94 select SYS_HAS_CPU_MIPS32_R1
95 select SYS_SUPPORTS_32BIT_KERNEL 95 select SYS_SUPPORTS_32BIT_KERNEL
96 select SYS_SUPPORTS_LITTLE_ENDIAN 96 select SYS_SUPPORTS_LITTLE_ENDIAN
97 select SSB
98 select SSB_DRIVER_MIPS
99 select SSB_DRIVER_EXTIF
100 select SSB_EMBEDDED
101 select SSB_B43_PCI_BRIDGE if PCI
102 select SSB_PCICORE_HOSTMODE if PCI
103 select GENERIC_GPIO 97 select GENERIC_GPIO
104 select SYS_HAS_EARLY_PRINTK 98 select SYS_HAS_EARLY_PRINTK
105 select CFE 99 select CFE
@@ -722,6 +716,7 @@ config CAVIUM_OCTEON_SIMULATOR
722 select SYS_SUPPORTS_HIGHMEM 716 select SYS_SUPPORTS_HIGHMEM
723 select SYS_SUPPORTS_HOTPLUG_CPU 717 select SYS_SUPPORTS_HOTPLUG_CPU
724 select SYS_HAS_CPU_CAVIUM_OCTEON 718 select SYS_HAS_CPU_CAVIUM_OCTEON
719 select HOLES_IN_ZONE
725 help 720 help
726 The Octeon simulator is software performance model of the Cavium 721 The Octeon simulator is software performance model of the Cavium
727 Octeon Processor. It supports simulating Octeon processors on x86 722 Octeon Processor. It supports simulating Octeon processors on x86
@@ -744,6 +739,7 @@ config CAVIUM_OCTEON_REFERENCE_BOARD
744 select ZONE_DMA32 739 select ZONE_DMA32
745 select USB_ARCH_HAS_OHCI 740 select USB_ARCH_HAS_OHCI
746 select USB_ARCH_HAS_EHCI 741 select USB_ARCH_HAS_EHCI
742 select HOLES_IN_ZONE
747 help 743 help
748 This option supports all of the Octeon reference boards from Cavium 744 This option supports all of the Octeon reference boards from Cavium
749 Networks. It builds a kernel that dynamically determines the Octeon 745 Networks. It builds a kernel that dynamically determines the Octeon
@@ -788,6 +784,7 @@ endchoice
788 784
789source "arch/mips/alchemy/Kconfig" 785source "arch/mips/alchemy/Kconfig"
790source "arch/mips/ath79/Kconfig" 786source "arch/mips/ath79/Kconfig"
787source "arch/mips/bcm47xx/Kconfig"
791source "arch/mips/bcm63xx/Kconfig" 788source "arch/mips/bcm63xx/Kconfig"
792source "arch/mips/jazz/Kconfig" 789source "arch/mips/jazz/Kconfig"
793source "arch/mips/jz4740/Kconfig" 790source "arch/mips/jz4740/Kconfig"
@@ -973,6 +970,9 @@ config ISA_DMA_API
973config GENERIC_GPIO 970config GENERIC_GPIO
974 bool 971 bool
975 972
973config HOLES_IN_ZONE
974 bool
975
976# 976#
977# Endianess selection. Sufficiently obscure so many users don't know what to 977# Endianess selection. Sufficiently obscure so many users don't know what to
978# answer,so we try hard to limit the available choices. Also the use of a 978# answer,so we try hard to limit the available choices. Also the use of a
diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c
index 3b2c18b14341..f72c48d4804c 100644
--- a/arch/mips/alchemy/common/platform.c
+++ b/arch/mips/alchemy/common/platform.c
@@ -492,7 +492,7 @@ static void __init alchemy_setup_macs(int ctype)
492 memcpy(au1xxx_eth0_platform_data.mac, ethaddr, 6); 492 memcpy(au1xxx_eth0_platform_data.mac, ethaddr, 6);
493 493
494 ret = platform_device_register(&au1xxx_eth0_device); 494 ret = platform_device_register(&au1xxx_eth0_device);
495 if (!ret) 495 if (ret)
496 printk(KERN_INFO "Alchemy: failed to register MAC0\n"); 496 printk(KERN_INFO "Alchemy: failed to register MAC0\n");
497 497
498 498
diff --git a/arch/mips/alchemy/common/power.c b/arch/mips/alchemy/common/power.c
index 647e518c90bc..b86324a42601 100644
--- a/arch/mips/alchemy/common/power.c
+++ b/arch/mips/alchemy/common/power.c
@@ -158,15 +158,21 @@ static void restore_core_regs(void)
158 158
159void au_sleep(void) 159void au_sleep(void)
160{ 160{
161 int cpuid = alchemy_get_cputype(); 161 save_core_regs();
162 if (cpuid != ALCHEMY_CPU_UNKNOWN) { 162
163 save_core_regs(); 163 switch (alchemy_get_cputype()) {
164 if (cpuid <= ALCHEMY_CPU_AU1500) 164 case ALCHEMY_CPU_AU1000:
165 alchemy_sleep_au1000(); 165 case ALCHEMY_CPU_AU1500:
166 else if (cpuid <= ALCHEMY_CPU_AU1200) 166 case ALCHEMY_CPU_AU1100:
167 alchemy_sleep_au1550(); 167 alchemy_sleep_au1000();
168 restore_core_regs(); 168 break;
169 case ALCHEMY_CPU_AU1550:
170 case ALCHEMY_CPU_AU1200:
171 alchemy_sleep_au1550();
172 break;
169 } 173 }
174
175 restore_core_regs();
170} 176}
171 177
172#endif /* CONFIG_PM */ 178#endif /* CONFIG_PM */
diff --git a/arch/mips/alchemy/devboards/bcsr.c b/arch/mips/alchemy/devboards/bcsr.c
index 596ad00e7f05..463d2c4d9441 100644
--- a/arch/mips/alchemy/devboards/bcsr.c
+++ b/arch/mips/alchemy/devboards/bcsr.c
@@ -89,8 +89,12 @@ static void bcsr_csc_handler(unsigned int irq, struct irq_desc *d)
89{ 89{
90 unsigned short bisr = __raw_readw(bcsr_virt + BCSR_REG_INTSTAT); 90 unsigned short bisr = __raw_readw(bcsr_virt + BCSR_REG_INTSTAT);
91 91
92 disable_irq_nosync(irq);
93
92 for ( ; bisr; bisr &= bisr - 1) 94 for ( ; bisr; bisr &= bisr - 1)
93 generic_handle_irq(bcsr_csc_base + __ffs(bisr)); 95 generic_handle_irq(bcsr_csc_base + __ffs(bisr));
96
97 enable_irq(irq);
94} 98}
95 99
96/* NOTE: both the enable and mask bits must be cleared, otherwise the 100/* NOTE: both the enable and mask bits must be cleared, otherwise the
diff --git a/arch/mips/alchemy/devboards/db1200/setup.c b/arch/mips/alchemy/devboards/db1200/setup.c
index 1dac4f27d334..4a8980027ecf 100644
--- a/arch/mips/alchemy/devboards/db1200/setup.c
+++ b/arch/mips/alchemy/devboards/db1200/setup.c
@@ -23,13 +23,6 @@ void __init board_setup(void)
23 unsigned long freq0, clksrc, div, pfc; 23 unsigned long freq0, clksrc, div, pfc;
24 unsigned short whoami; 24 unsigned short whoami;
25 25
26 /* Set Config[OD] (disable overlapping bus transaction):
27 * This gets rid of a _lot_ of spurious interrupts (especially
28 * wrt. IDE); but incurs ~10% performance hit in some
29 * cpu-bound applications.
30 */
31 set_c0_config(1 << 19);
32
33 bcsr_init(DB1200_BCSR_PHYS_ADDR, 26 bcsr_init(DB1200_BCSR_PHYS_ADDR,
34 DB1200_BCSR_PHYS_ADDR + DB1200_BCSR_HEXLED_OFS); 27 DB1200_BCSR_PHYS_ADDR + DB1200_BCSR_HEXLED_OFS);
35 28
diff --git a/arch/mips/ar7/irq.c b/arch/mips/ar7/irq.c
index 03db3daadbd8..88c4babfdb5d 100644
--- a/arch/mips/ar7/irq.c
+++ b/arch/mips/ar7/irq.c
@@ -98,7 +98,8 @@ static struct irq_chip ar7_sec_irq_type = {
98 98
99static struct irqaction ar7_cascade_action = { 99static struct irqaction ar7_cascade_action = {
100 .handler = no_action, 100 .handler = no_action,
101 .name = "AR7 cascade interrupt" 101 .name = "AR7 cascade interrupt",
102 .flags = IRQF_NO_THREAD,
102}; 103};
103 104
104static void __init ar7_irq_init(int base) 105static void __init ar7_irq_init(int base)
diff --git a/arch/mips/bcm47xx/Kconfig b/arch/mips/bcm47xx/Kconfig
new file mode 100644
index 000000000000..6210b8d84109
--- /dev/null
+++ b/arch/mips/bcm47xx/Kconfig
@@ -0,0 +1,31 @@
1if BCM47XX
2
3config BCM47XX_SSB
4 bool "SSB Support for Broadcom BCM47XX"
5 select SYS_HAS_CPU_MIPS32_R1
6 select SSB
7 select SSB_DRIVER_MIPS
8 select SSB_DRIVER_EXTIF
9 select SSB_EMBEDDED
10 select SSB_B43_PCI_BRIDGE if PCI
11 select SSB_PCICORE_HOSTMODE if PCI
12 default y
13 help
14 Add support for old Broadcom BCM47xx boards with Sonics Silicon Backplane support.
15
16 This will generate an image with support for SSB and MIPS32 R1 instruction set.
17
18config BCM47XX_BCMA
19 bool "BCMA Support for Broadcom BCM47XX"
20 select SYS_HAS_CPU_MIPS32_R2
21 select BCMA
22 select BCMA_HOST_SOC
23 select BCMA_DRIVER_MIPS
24 select BCMA_DRIVER_PCI_HOSTMODE if PCI
25 default y
26 help
27 Add support for new Broadcom BCM47xx boards with Broadcom specific Advanced Microcontroller Bus.
28
29 This will generate an image with support for BCMA and MIPS32 R2 instruction set.
30
31endif
diff --git a/arch/mips/bcm47xx/Makefile b/arch/mips/bcm47xx/Makefile
index 7465e8a72d9a..4add17349ff9 100644
--- a/arch/mips/bcm47xx/Makefile
+++ b/arch/mips/bcm47xx/Makefile
@@ -3,4 +3,5 @@
3# under Linux. 3# under Linux.
4# 4#
5 5
6obj-y := gpio.o irq.o nvram.o prom.o serial.o setup.o time.o wgt634u.o 6obj-y += gpio.o irq.o nvram.o prom.o serial.o setup.o time.o
7obj-$(CONFIG_BCM47XX_SSB) += wgt634u.o
diff --git a/arch/mips/bcm47xx/gpio.c b/arch/mips/bcm47xx/gpio.c
index e4a5ee9c9721..57b425fd4d41 100644
--- a/arch/mips/bcm47xx/gpio.c
+++ b/arch/mips/bcm47xx/gpio.c
@@ -20,42 +20,82 @@ static DECLARE_BITMAP(gpio_in_use, BCM47XX_EXTIF_GPIO_LINES);
20 20
21int gpio_request(unsigned gpio, const char *tag) 21int gpio_request(unsigned gpio, const char *tag)
22{ 22{
23 if (ssb_chipco_available(&ssb_bcm47xx.chipco) && 23 switch (bcm47xx_bus_type) {
24 ((unsigned)gpio >= BCM47XX_CHIPCO_GPIO_LINES)) 24#ifdef CONFIG_BCM47XX_SSB
25 return -EINVAL; 25 case BCM47XX_BUS_TYPE_SSB:
26 if (ssb_chipco_available(&bcm47xx_bus.ssb.chipco) &&
27 ((unsigned)gpio >= BCM47XX_CHIPCO_GPIO_LINES))
28 return -EINVAL;
26 29
27 if (ssb_extif_available(&ssb_bcm47xx.extif) && 30 if (ssb_extif_available(&bcm47xx_bus.ssb.extif) &&
28 ((unsigned)gpio >= BCM47XX_EXTIF_GPIO_LINES)) 31 ((unsigned)gpio >= BCM47XX_EXTIF_GPIO_LINES))
29 return -EINVAL; 32 return -EINVAL;
30 33
31 if (test_and_set_bit(gpio, gpio_in_use)) 34 if (test_and_set_bit(gpio, gpio_in_use))
32 return -EBUSY; 35 return -EBUSY;
33 36
34 return 0; 37 return 0;
38#endif
39#ifdef CONFIG_BCM47XX_BCMA
40 case BCM47XX_BUS_TYPE_BCMA:
41 if (gpio >= BCM47XX_CHIPCO_GPIO_LINES)
42 return -EINVAL;
43
44 if (test_and_set_bit(gpio, gpio_in_use))
45 return -EBUSY;
46
47 return 0;
48#endif
49 }
50 return -EINVAL;
35} 51}
36EXPORT_SYMBOL(gpio_request); 52EXPORT_SYMBOL(gpio_request);
37 53
38void gpio_free(unsigned gpio) 54void gpio_free(unsigned gpio)
39{ 55{
40 if (ssb_chipco_available(&ssb_bcm47xx.chipco) && 56 switch (bcm47xx_bus_type) {
41 ((unsigned)gpio >= BCM47XX_CHIPCO_GPIO_LINES)) 57#ifdef CONFIG_BCM47XX_SSB
42 return; 58 case BCM47XX_BUS_TYPE_SSB:
59 if (ssb_chipco_available(&bcm47xx_bus.ssb.chipco) &&
60 ((unsigned)gpio >= BCM47XX_CHIPCO_GPIO_LINES))
61 return;
62
63 if (ssb_extif_available(&bcm47xx_bus.ssb.extif) &&
64 ((unsigned)gpio >= BCM47XX_EXTIF_GPIO_LINES))
65 return;
43 66
44 if (ssb_extif_available(&ssb_bcm47xx.extif) && 67 clear_bit(gpio, gpio_in_use);
45 ((unsigned)gpio >= BCM47XX_EXTIF_GPIO_LINES))
46 return; 68 return;
69#endif
70#ifdef CONFIG_BCM47XX_BCMA
71 case BCM47XX_BUS_TYPE_BCMA:
72 if (gpio >= BCM47XX_CHIPCO_GPIO_LINES)
73 return;
47 74
48 clear_bit(gpio, gpio_in_use); 75 clear_bit(gpio, gpio_in_use);
76 return;
77#endif
78 }
49} 79}
50EXPORT_SYMBOL(gpio_free); 80EXPORT_SYMBOL(gpio_free);
51 81
52int gpio_to_irq(unsigned gpio) 82int gpio_to_irq(unsigned gpio)
53{ 83{
54 if (ssb_chipco_available(&ssb_bcm47xx.chipco)) 84 switch (bcm47xx_bus_type) {
55 return ssb_mips_irq(ssb_bcm47xx.chipco.dev) + 2; 85#ifdef CONFIG_BCM47XX_SSB
56 else if (ssb_extif_available(&ssb_bcm47xx.extif)) 86 case BCM47XX_BUS_TYPE_SSB:
57 return ssb_mips_irq(ssb_bcm47xx.extif.dev) + 2; 87 if (ssb_chipco_available(&bcm47xx_bus.ssb.chipco))
58 else 88 return ssb_mips_irq(bcm47xx_bus.ssb.chipco.dev) + 2;
59 return -EINVAL; 89 else if (ssb_extif_available(&bcm47xx_bus.ssb.extif))
90 return ssb_mips_irq(bcm47xx_bus.ssb.extif.dev) + 2;
91 else
92 return -EINVAL;
93#endif
94#ifdef CONFIG_BCM47XX_BCMA
95 case BCM47XX_BUS_TYPE_BCMA:
96 return bcma_core_mips_irq(bcm47xx_bus.bcma.bus.drv_cc.core) + 2;
97#endif
98 }
99 return -EINVAL;
60} 100}
61EXPORT_SYMBOL_GPL(gpio_to_irq); 101EXPORT_SYMBOL_GPL(gpio_to_irq);
diff --git a/arch/mips/bcm47xx/irq.c b/arch/mips/bcm47xx/irq.c
index 325757acd020..8cf3833b2d29 100644
--- a/arch/mips/bcm47xx/irq.c
+++ b/arch/mips/bcm47xx/irq.c
@@ -26,6 +26,7 @@
26#include <linux/interrupt.h> 26#include <linux/interrupt.h>
27#include <linux/irq.h> 27#include <linux/irq.h>
28#include <asm/irq_cpu.h> 28#include <asm/irq_cpu.h>
29#include <bcm47xx.h>
29 30
30void plat_irq_dispatch(void) 31void plat_irq_dispatch(void)
31{ 32{
@@ -51,5 +52,16 @@ void plat_irq_dispatch(void)
51 52
52void __init arch_init_irq(void) 53void __init arch_init_irq(void)
53{ 54{
55#ifdef CONFIG_BCM47XX_BCMA
56 if (bcm47xx_bus_type == BCM47XX_BUS_TYPE_BCMA) {
57 bcma_write32(bcm47xx_bus.bcma.bus.drv_mips.core,
58 BCMA_MIPS_MIPS74K_INTMASK(5), 1 << 31);
59 /*
60 * the kernel reads the timer irq from some register and thinks
61 * it's #5, but we offset it by 2 and route to #7
62 */
63 cp0_compare_irq = 7;
64 }
65#endif
54 mips_cpu_irq_init(); 66 mips_cpu_irq_init();
55} 67}
diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
index 54db815bc86c..a84e3bb7387f 100644
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
@@ -26,14 +26,35 @@ static char nvram_buf[NVRAM_SPACE];
26/* Probe for NVRAM header */ 26/* Probe for NVRAM header */
27static void early_nvram_init(void) 27static void early_nvram_init(void)
28{ 28{
29 struct ssb_mipscore *mcore = &ssb_bcm47xx.mipscore; 29#ifdef CONFIG_BCM47XX_SSB
30 struct ssb_mipscore *mcore_ssb;
31#endif
32#ifdef CONFIG_BCM47XX_BCMA
33 struct bcma_drv_cc *bcma_cc;
34#endif
30 struct nvram_header *header; 35 struct nvram_header *header;
31 int i; 36 int i;
32 u32 base, lim, off; 37 u32 base = 0;
38 u32 lim = 0;
39 u32 off;
33 u32 *src, *dst; 40 u32 *src, *dst;
34 41
35 base = mcore->flash_window; 42 switch (bcm47xx_bus_type) {
36 lim = mcore->flash_window_size; 43#ifdef CONFIG_BCM47XX_SSB
44 case BCM47XX_BUS_TYPE_SSB:
45 mcore_ssb = &bcm47xx_bus.ssb.mipscore;
46 base = mcore_ssb->flash_window;
47 lim = mcore_ssb->flash_window_size;
48 break;
49#endif
50#ifdef CONFIG_BCM47XX_BCMA
51 case BCM47XX_BUS_TYPE_BCMA:
52 bcma_cc = &bcm47xx_bus.bcma.bus.drv_cc;
53 base = bcma_cc->pflash.window;
54 lim = bcma_cc->pflash.window_size;
55 break;
56#endif
57 }
37 58
38 off = FLASH_MIN; 59 off = FLASH_MIN;
39 while (off <= lim) { 60 while (off <= lim) {
diff --git a/arch/mips/bcm47xx/serial.c b/arch/mips/bcm47xx/serial.c
index 59c11afdb2ab..57981e4fe2bc 100644
--- a/arch/mips/bcm47xx/serial.c
+++ b/arch/mips/bcm47xx/serial.c
@@ -23,10 +23,11 @@ static struct platform_device uart8250_device = {
23 }, 23 },
24}; 24};
25 25
26static int __init uart8250_init(void) 26#ifdef CONFIG_BCM47XX_SSB
27static int __init uart8250_init_ssb(void)
27{ 28{
28 int i; 29 int i;
29 struct ssb_mipscore *mcore = &(ssb_bcm47xx.mipscore); 30 struct ssb_mipscore *mcore = &(bcm47xx_bus.ssb.mipscore);
30 31
31 memset(&uart8250_data, 0, sizeof(uart8250_data)); 32 memset(&uart8250_data, 0, sizeof(uart8250_data));
32 33
@@ -44,6 +45,47 @@ static int __init uart8250_init(void)
44 } 45 }
45 return platform_device_register(&uart8250_device); 46 return platform_device_register(&uart8250_device);
46} 47}
48#endif
49
50#ifdef CONFIG_BCM47XX_BCMA
51static int __init uart8250_init_bcma(void)
52{
53 int i;
54 struct bcma_drv_cc *cc = &(bcm47xx_bus.bcma.bus.drv_cc);
55
56 memset(&uart8250_data, 0, sizeof(uart8250_data));
57
58 for (i = 0; i < cc->nr_serial_ports; i++) {
59 struct plat_serial8250_port *p = &(uart8250_data[i]);
60 struct bcma_serial_port *bcma_port;
61 bcma_port = &(cc->serial_ports[i]);
62
63 p->mapbase = (unsigned int) bcma_port->regs;
64 p->membase = (void *) bcma_port->regs;
65 p->irq = bcma_port->irq + 2;
66 p->uartclk = bcma_port->baud_base;
67 p->regshift = bcma_port->reg_shift;
68 p->iotype = UPIO_MEM;
69 p->flags = UPF_BOOT_AUTOCONF | UPF_SHARE_IRQ;
70 }
71 return platform_device_register(&uart8250_device);
72}
73#endif
74
75static int __init uart8250_init(void)
76{
77 switch (bcm47xx_bus_type) {
78#ifdef CONFIG_BCM47XX_SSB
79 case BCM47XX_BUS_TYPE_SSB:
80 return uart8250_init_ssb();
81#endif
82#ifdef CONFIG_BCM47XX_BCMA
83 case BCM47XX_BUS_TYPE_BCMA:
84 return uart8250_init_bcma();
85#endif
86 }
87 return -EINVAL;
88}
47 89
48module_init(uart8250_init); 90module_init(uart8250_init);
49 91
diff --git a/arch/mips/bcm47xx/setup.c b/arch/mips/bcm47xx/setup.c
index cfae81571ded..17c3d14d7c49 100644
--- a/arch/mips/bcm47xx/setup.c
+++ b/arch/mips/bcm47xx/setup.c
@@ -29,21 +29,36 @@
29#include <linux/types.h> 29#include <linux/types.h>
30#include <linux/ssb/ssb.h> 30#include <linux/ssb/ssb.h>
31#include <linux/ssb/ssb_embedded.h> 31#include <linux/ssb/ssb_embedded.h>
32#include <linux/bcma/bcma_soc.h>
32#include <asm/bootinfo.h> 33#include <asm/bootinfo.h>
33#include <asm/reboot.h> 34#include <asm/reboot.h>
34#include <asm/time.h> 35#include <asm/time.h>
35#include <bcm47xx.h> 36#include <bcm47xx.h>
36#include <asm/mach-bcm47xx/nvram.h> 37#include <asm/mach-bcm47xx/nvram.h>
37 38
38struct ssb_bus ssb_bcm47xx; 39union bcm47xx_bus bcm47xx_bus;
39EXPORT_SYMBOL(ssb_bcm47xx); 40EXPORT_SYMBOL(bcm47xx_bus);
41
42enum bcm47xx_bus_type bcm47xx_bus_type;
43EXPORT_SYMBOL(bcm47xx_bus_type);
40 44
41static void bcm47xx_machine_restart(char *command) 45static void bcm47xx_machine_restart(char *command)
42{ 46{
43 printk(KERN_ALERT "Please stand by while rebooting the system...\n"); 47 printk(KERN_ALERT "Please stand by while rebooting the system...\n");
44 local_irq_disable(); 48 local_irq_disable();
45 /* Set the watchdog timer to reset immediately */ 49 /* Set the watchdog timer to reset immediately */
46 ssb_watchdog_timer_set(&ssb_bcm47xx, 1); 50 switch (bcm47xx_bus_type) {
51#ifdef CONFIG_BCM47XX_SSB
52 case BCM47XX_BUS_TYPE_SSB:
53 ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 1);
54 break;
55#endif
56#ifdef CONFIG_BCM47XX_BCMA
57 case BCM47XX_BUS_TYPE_BCMA:
58 bcma_chipco_watchdog_timer_set(&bcm47xx_bus.bcma.bus.drv_cc, 1);
59 break;
60#endif
61 }
47 while (1) 62 while (1)
48 cpu_relax(); 63 cpu_relax();
49} 64}
@@ -52,11 +67,23 @@ static void bcm47xx_machine_halt(void)
52{ 67{
53 /* Disable interrupts and watchdog and spin forever */ 68 /* Disable interrupts and watchdog and spin forever */
54 local_irq_disable(); 69 local_irq_disable();
55 ssb_watchdog_timer_set(&ssb_bcm47xx, 0); 70 switch (bcm47xx_bus_type) {
71#ifdef CONFIG_BCM47XX_SSB
72 case BCM47XX_BUS_TYPE_SSB:
73 ssb_watchdog_timer_set(&bcm47xx_bus.ssb, 0);
74 break;
75#endif
76#ifdef CONFIG_BCM47XX_BCMA
77 case BCM47XX_BUS_TYPE_BCMA:
78 bcma_chipco_watchdog_timer_set(&bcm47xx_bus.bcma.bus.drv_cc, 0);
79 break;
80#endif
81 }
56 while (1) 82 while (1)
57 cpu_relax(); 83 cpu_relax();
58} 84}
59 85
86#ifdef CONFIG_BCM47XX_SSB
60#define READ_FROM_NVRAM(_outvar, name, buf) \ 87#define READ_FROM_NVRAM(_outvar, name, buf) \
61 if (nvram_getprefix(prefix, name, buf, sizeof(buf)) >= 0)\ 88 if (nvram_getprefix(prefix, name, buf, sizeof(buf)) >= 0)\
62 sprom->_outvar = simple_strtoul(buf, NULL, 0); 89 sprom->_outvar = simple_strtoul(buf, NULL, 0);
@@ -247,7 +274,7 @@ static int bcm47xx_get_invariants(struct ssb_bus *bus,
247 return 0; 274 return 0;
248} 275}
249 276
250void __init plat_mem_setup(void) 277static void __init bcm47xx_register_ssb(void)
251{ 278{
252 int err; 279 int err;
253 char buf[100]; 280 char buf[100];
@@ -258,12 +285,12 @@ void __init plat_mem_setup(void)
258 printk(KERN_WARNING "bcm47xx: someone else already registered" 285 printk(KERN_WARNING "bcm47xx: someone else already registered"
259 " a ssb SPROM callback handler (err %d)\n", err); 286 " a ssb SPROM callback handler (err %d)\n", err);
260 287
261 err = ssb_bus_ssbbus_register(&ssb_bcm47xx, SSB_ENUM_BASE, 288 err = ssb_bus_ssbbus_register(&(bcm47xx_bus.ssb), SSB_ENUM_BASE,
262 bcm47xx_get_invariants); 289 bcm47xx_get_invariants);
263 if (err) 290 if (err)
264 panic("Failed to initialize SSB bus (err %d)\n", err); 291 panic("Failed to initialize SSB bus (err %d)\n", err);
265 292
266 mcore = &ssb_bcm47xx.mipscore; 293 mcore = &bcm47xx_bus.ssb.mipscore;
267 if (nvram_getenv("kernel_args", buf, sizeof(buf)) >= 0) { 294 if (nvram_getenv("kernel_args", buf, sizeof(buf)) >= 0) {
268 if (strstr(buf, "console=ttyS1")) { 295 if (strstr(buf, "console=ttyS1")) {
269 struct ssb_serial_port port; 296 struct ssb_serial_port port;
@@ -276,8 +303,57 @@ void __init plat_mem_setup(void)
276 memcpy(&mcore->serial_ports[1], &port, sizeof(port)); 303 memcpy(&mcore->serial_ports[1], &port, sizeof(port));
277 } 304 }
278 } 305 }
306}
307#endif
308
309#ifdef CONFIG_BCM47XX_BCMA
310static void __init bcm47xx_register_bcma(void)
311{
312 int err;
313
314 err = bcma_host_soc_register(&bcm47xx_bus.bcma);
315 if (err)
316 panic("Failed to initialize BCMA bus (err %d)\n", err);
317}
318#endif
319
320void __init plat_mem_setup(void)
321{
322 struct cpuinfo_mips *c = &current_cpu_data;
323
324 if (c->cputype == CPU_74K) {
325 printk(KERN_INFO "bcm47xx: using bcma bus\n");
326#ifdef CONFIG_BCM47XX_BCMA
327 bcm47xx_bus_type = BCM47XX_BUS_TYPE_BCMA;
328 bcm47xx_register_bcma();
329#endif
330 } else {
331 printk(KERN_INFO "bcm47xx: using ssb bus\n");
332#ifdef CONFIG_BCM47XX_SSB
333 bcm47xx_bus_type = BCM47XX_BUS_TYPE_SSB;
334 bcm47xx_register_ssb();
335#endif
336 }
279 337
280 _machine_restart = bcm47xx_machine_restart; 338 _machine_restart = bcm47xx_machine_restart;
281 _machine_halt = bcm47xx_machine_halt; 339 _machine_halt = bcm47xx_machine_halt;
282 pm_power_off = bcm47xx_machine_halt; 340 pm_power_off = bcm47xx_machine_halt;
283} 341}
342
343static int __init bcm47xx_register_bus_complete(void)
344{
345 switch (bcm47xx_bus_type) {
346#ifdef CONFIG_BCM47XX_SSB
347 case BCM47XX_BUS_TYPE_SSB:
348 /* Nothing to do */
349 break;
350#endif
351#ifdef CONFIG_BCM47XX_BCMA
352 case BCM47XX_BUS_TYPE_BCMA:
353 bcma_bus_register(&bcm47xx_bus.bcma.bus);
354 break;
355#endif
356 }
357 return 0;
358}
359device_initcall(bcm47xx_register_bus_complete);
diff --git a/arch/mips/bcm47xx/time.c b/arch/mips/bcm47xx/time.c
index 0c6f47b3fd94..536374dcba78 100644
--- a/arch/mips/bcm47xx/time.c
+++ b/arch/mips/bcm47xx/time.c
@@ -30,7 +30,7 @@
30 30
31void __init plat_time_init(void) 31void __init plat_time_init(void)
32{ 32{
33 unsigned long hz; 33 unsigned long hz = 0;
34 34
35 /* 35 /*
36 * Use deterministic values for initial counter interrupt 36 * Use deterministic values for initial counter interrupt
@@ -39,7 +39,19 @@ void __init plat_time_init(void)
39 write_c0_count(0); 39 write_c0_count(0);
40 write_c0_compare(0xffff); 40 write_c0_compare(0xffff);
41 41
42 hz = ssb_cpu_clock(&ssb_bcm47xx.mipscore) / 2; 42 switch (bcm47xx_bus_type) {
43#ifdef CONFIG_BCM47XX_SSB
44 case BCM47XX_BUS_TYPE_SSB:
45 hz = ssb_cpu_clock(&bcm47xx_bus.ssb.mipscore) / 2;
46 break;
47#endif
48#ifdef CONFIG_BCM47XX_BCMA
49 case BCM47XX_BUS_TYPE_BCMA:
50 hz = bcma_cpu_clock(&bcm47xx_bus.bcma.bus.drv_mips) / 2;
51 break;
52#endif
53 }
54
43 if (!hz) 55 if (!hz)
44 hz = 100000000; 56 hz = 100000000;
45 57
diff --git a/arch/mips/bcm47xx/wgt634u.c b/arch/mips/bcm47xx/wgt634u.c
index 74d06965326f..e9f9ec8d443b 100644
--- a/arch/mips/bcm47xx/wgt634u.c
+++ b/arch/mips/bcm47xx/wgt634u.c
@@ -108,7 +108,7 @@ static irqreturn_t gpio_interrupt(int irq, void *ignored)
108 108
109 /* Interrupts are shared, check if the current one is 109 /* Interrupts are shared, check if the current one is
110 a GPIO interrupt. */ 110 a GPIO interrupt. */
111 if (!ssb_chipco_irq_status(&ssb_bcm47xx.chipco, 111 if (!ssb_chipco_irq_status(&bcm47xx_bus.ssb.chipco,
112 SSB_CHIPCO_IRQ_GPIO)) 112 SSB_CHIPCO_IRQ_GPIO))
113 return IRQ_NONE; 113 return IRQ_NONE;
114 114
@@ -132,22 +132,26 @@ static int __init wgt634u_init(void)
132 * machine. Use the MAC address as an heuristic. Netgear Inc. has 132 * machine. Use the MAC address as an heuristic. Netgear Inc. has
133 * been allocated ranges 00:09:5b:xx:xx:xx and 00:0f:b5:xx:xx:xx. 133 * been allocated ranges 00:09:5b:xx:xx:xx and 00:0f:b5:xx:xx:xx.
134 */ 134 */
135 u8 *et0mac;
135 136
136 u8 *et0mac = ssb_bcm47xx.sprom.et0mac; 137 if (bcm47xx_bus_type != BCM47XX_BUS_TYPE_SSB)
138 return -ENODEV;
139
140 et0mac = bcm47xx_bus.ssb.sprom.et0mac;
137 141
138 if (et0mac[0] == 0x00 && 142 if (et0mac[0] == 0x00 &&
139 ((et0mac[1] == 0x09 && et0mac[2] == 0x5b) || 143 ((et0mac[1] == 0x09 && et0mac[2] == 0x5b) ||
140 (et0mac[1] == 0x0f && et0mac[2] == 0xb5))) { 144 (et0mac[1] == 0x0f && et0mac[2] == 0xb5))) {
141 struct ssb_mipscore *mcore = &ssb_bcm47xx.mipscore; 145 struct ssb_mipscore *mcore = &bcm47xx_bus.ssb.mipscore;
142 146
143 printk(KERN_INFO "WGT634U machine detected.\n"); 147 printk(KERN_INFO "WGT634U machine detected.\n");
144 148
145 if (!request_irq(gpio_to_irq(WGT634U_GPIO_RESET), 149 if (!request_irq(gpio_to_irq(WGT634U_GPIO_RESET),
146 gpio_interrupt, IRQF_SHARED, 150 gpio_interrupt, IRQF_SHARED,
147 "WGT634U GPIO", &ssb_bcm47xx.chipco)) { 151 "WGT634U GPIO", &bcm47xx_bus.ssb.chipco)) {
148 gpio_direction_input(WGT634U_GPIO_RESET); 152 gpio_direction_input(WGT634U_GPIO_RESET);
149 gpio_intmask(WGT634U_GPIO_RESET, 1); 153 gpio_intmask(WGT634U_GPIO_RESET, 1);
150 ssb_chipco_irq_mask(&ssb_bcm47xx.chipco, 154 ssb_chipco_irq_mask(&bcm47xx_bus.ssb.chipco,
151 SSB_CHIPCO_IRQ_GPIO, 155 SSB_CHIPCO_IRQ_GPIO,
152 SSB_CHIPCO_IRQ_GPIO); 156 SSB_CHIPCO_IRQ_GPIO);
153 } 157 }
diff --git a/arch/mips/bcm63xx/irq.c b/arch/mips/bcm63xx/irq.c
index cea6021cb8d7..162e11b4ed75 100644
--- a/arch/mips/bcm63xx/irq.c
+++ b/arch/mips/bcm63xx/irq.c
@@ -222,6 +222,7 @@ static struct irq_chip bcm63xx_external_irq_chip = {
222static struct irqaction cpu_ip2_cascade_action = { 222static struct irqaction cpu_ip2_cascade_action = {
223 .handler = no_action, 223 .handler = no_action,
224 .name = "cascade_ip2", 224 .name = "cascade_ip2",
225 .flags = IRQF_NO_THREAD,
225}; 226};
226 227
227void __init arch_init_irq(void) 228void __init arch_init_irq(void)
diff --git a/arch/mips/cobalt/irq.c b/arch/mips/cobalt/irq.c
index cb9bf820fe53..965c777d3561 100644
--- a/arch/mips/cobalt/irq.c
+++ b/arch/mips/cobalt/irq.c
@@ -48,6 +48,7 @@ asmlinkage void plat_irq_dispatch(void)
48static struct irqaction cascade = { 48static struct irqaction cascade = {
49 .handler = no_action, 49 .handler = no_action,
50 .name = "cascade", 50 .name = "cascade",
51 .flags = IRQF_NO_THREAD,
51}; 52};
52 53
53void __init arch_init_irq(void) 54void __init arch_init_irq(void)
diff --git a/arch/mips/dec/setup.c b/arch/mips/dec/setup.c
index fa45e924be05..f7b7ba6d5c45 100644
--- a/arch/mips/dec/setup.c
+++ b/arch/mips/dec/setup.c
@@ -101,20 +101,24 @@ int cpu_fpu_mask = DEC_CPU_IRQ_MASK(DEC_CPU_INR_FPU);
101static struct irqaction ioirq = { 101static struct irqaction ioirq = {
102 .handler = no_action, 102 .handler = no_action,
103 .name = "cascade", 103 .name = "cascade",
104 .flags = IRQF_NO_THREAD,
104}; 105};
105static struct irqaction fpuirq = { 106static struct irqaction fpuirq = {
106 .handler = no_action, 107 .handler = no_action,
107 .name = "fpu", 108 .name = "fpu",
109 .flags = IRQF_NO_THREAD,
108}; 110};
109 111
110static struct irqaction busirq = { 112static struct irqaction busirq = {
111 .flags = IRQF_DISABLED, 113 .flags = IRQF_DISABLED,
112 .name = "bus error", 114 .name = "bus error",
115 .flags = IRQF_NO_THREAD,
113}; 116};
114 117
115static struct irqaction haltirq = { 118static struct irqaction haltirq = {
116 .handler = dec_intr_halt, 119 .handler = dec_intr_halt,
117 .name = "halt", 120 .name = "halt",
121 .flags = IRQF_NO_THREAD,
118}; 122};
119 123
120 124
diff --git a/arch/mips/emma/markeins/irq.c b/arch/mips/emma/markeins/irq.c
index 3dbd7a5a6ad3..7798887a1288 100644
--- a/arch/mips/emma/markeins/irq.c
+++ b/arch/mips/emma/markeins/irq.c
@@ -169,7 +169,7 @@ void emma2rh_gpio_irq_init(void)
169 169
170static struct irqaction irq_cascade = { 170static struct irqaction irq_cascade = {
171 .handler = no_action, 171 .handler = no_action,
172 .flags = 0, 172 .flags = IRQF_NO_THREAD,
173 .name = "cascade", 173 .name = "cascade",
174 .dev_id = NULL, 174 .dev_id = NULL,
175 .next = NULL, 175 .next = NULL,
diff --git a/arch/mips/include/asm/compat.h b/arch/mips/include/asm/compat.h
index dbc51065df5b..b77df0366ee6 100644
--- a/arch/mips/include/asm/compat.h
+++ b/arch/mips/include/asm/compat.h
@@ -111,7 +111,8 @@ struct compat_statfs {
111 int f_bavail; 111 int f_bavail;
112 compat_fsid_t f_fsid; 112 compat_fsid_t f_fsid;
113 int f_namelen; 113 int f_namelen;
114 int f_spare[6]; 114 int f_flags;
115 int f_spare[5];
115}; 116};
116 117
117#define COMPAT_RLIM_INFINITY 0x7fffffffUL 118#define COMPAT_RLIM_INFINITY 0x7fffffffUL
diff --git a/arch/mips/include/asm/lasat/lasat.h b/arch/mips/include/asm/lasat/lasat.h
index a1ada1c27c16..e8ff70f80e13 100644
--- a/arch/mips/include/asm/lasat/lasat.h
+++ b/arch/mips/include/asm/lasat/lasat.h
@@ -41,10 +41,8 @@ enum lasat_mtdparts {
41 41
42/* 42/*
43 * The format of the data record in the EEPROM. 43 * The format of the data record in the EEPROM.
44 * See Documentation/LASAT/eeprom.txt for a detailed description 44 * See the LASAT Hardware Configuration field specification for a detailed
45 * of the fields in this struct, and the LASAT Hardware Configuration 45 * description of the config field.
46 * field specification for a detailed description of the config
47 * field.
48 */ 46 */
49#include <linux/types.h> 47#include <linux/types.h>
50 48
diff --git a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
index d008f47a28bd..de95e0723e2b 100644
--- a/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
+++ b/arch/mips/include/asm/mach-bcm47xx/bcm47xx.h
@@ -19,7 +19,29 @@
19#ifndef __ASM_BCM47XX_H 19#ifndef __ASM_BCM47XX_H
20#define __ASM_BCM47XX_H 20#define __ASM_BCM47XX_H
21 21
22/* SSB bus */ 22#include <linux/ssb/ssb.h>
23extern struct ssb_bus ssb_bcm47xx; 23#include <linux/bcma/bcma.h>
24#include <linux/bcma/bcma_soc.h>
25
26enum bcm47xx_bus_type {
27#ifdef CONFIG_BCM47XX_SSB
28 BCM47XX_BUS_TYPE_SSB,
29#endif
30#ifdef CONFIG_BCM47XX_BCMA
31 BCM47XX_BUS_TYPE_BCMA,
32#endif
33};
34
35union bcm47xx_bus {
36#ifdef CONFIG_BCM47XX_SSB
37 struct ssb_bus ssb;
38#endif
39#ifdef CONFIG_BCM47XX_BCMA
40 struct bcma_soc bcma;
41#endif
42};
43
44extern union bcm47xx_bus bcm47xx_bus;
45extern enum bcm47xx_bus_type bcm47xx_bus_type;
24 46
25#endif /* __ASM_BCM47XX_H */ 47#endif /* __ASM_BCM47XX_H */
diff --git a/arch/mips/include/asm/mach-bcm47xx/gpio.h b/arch/mips/include/asm/mach-bcm47xx/gpio.h
index 98504142124e..76961cabeedf 100644
--- a/arch/mips/include/asm/mach-bcm47xx/gpio.h
+++ b/arch/mips/include/asm/mach-bcm47xx/gpio.h
@@ -10,6 +10,7 @@
10#define __BCM47XX_GPIO_H 10#define __BCM47XX_GPIO_H
11 11
12#include <linux/ssb/ssb_embedded.h> 12#include <linux/ssb/ssb_embedded.h>
13#include <linux/bcma/bcma.h>
13#include <asm/mach-bcm47xx/bcm47xx.h> 14#include <asm/mach-bcm47xx/bcm47xx.h>
14 15
15#define BCM47XX_EXTIF_GPIO_LINES 5 16#define BCM47XX_EXTIF_GPIO_LINES 5
@@ -21,41 +22,118 @@ extern int gpio_to_irq(unsigned gpio);
21 22
22static inline int gpio_get_value(unsigned gpio) 23static inline int gpio_get_value(unsigned gpio)
23{ 24{
24 return ssb_gpio_in(&ssb_bcm47xx, 1 << gpio); 25 switch (bcm47xx_bus_type) {
26#ifdef CONFIG_BCM47XX_SSB
27 case BCM47XX_BUS_TYPE_SSB:
28 return ssb_gpio_in(&bcm47xx_bus.ssb, 1 << gpio);
29#endif
30#ifdef CONFIG_BCM47XX_BCMA
31 case BCM47XX_BUS_TYPE_BCMA:
32 return bcma_chipco_gpio_in(&bcm47xx_bus.bcma.bus.drv_cc,
33 1 << gpio);
34#endif
35 }
36 return -EINVAL;
25} 37}
26 38
27static inline void gpio_set_value(unsigned gpio, int value) 39static inline void gpio_set_value(unsigned gpio, int value)
28{ 40{
29 ssb_gpio_out(&ssb_bcm47xx, 1 << gpio, value ? 1 << gpio : 0); 41 switch (bcm47xx_bus_type) {
42#ifdef CONFIG_BCM47XX_SSB
43 case BCM47XX_BUS_TYPE_SSB:
44 ssb_gpio_out(&bcm47xx_bus.ssb, 1 << gpio,
45 value ? 1 << gpio : 0);
46 return;
47#endif
48#ifdef CONFIG_BCM47XX_BCMA
49 case BCM47XX_BUS_TYPE_BCMA:
50 bcma_chipco_gpio_out(&bcm47xx_bus.bcma.bus.drv_cc, 1 << gpio,
51 value ? 1 << gpio : 0);
52 return;
53#endif
54 }
30} 55}
31 56
32static inline int gpio_direction_input(unsigned gpio) 57static inline int gpio_direction_input(unsigned gpio)
33{ 58{
34 ssb_gpio_outen(&ssb_bcm47xx, 1 << gpio, 0); 59 switch (bcm47xx_bus_type) {
35 return 0; 60#ifdef CONFIG_BCM47XX_SSB
61 case BCM47XX_BUS_TYPE_SSB:
62 ssb_gpio_outen(&bcm47xx_bus.ssb, 1 << gpio, 0);
63 return 0;
64#endif
65#ifdef CONFIG_BCM47XX_BCMA
66 case BCM47XX_BUS_TYPE_BCMA:
67 bcma_chipco_gpio_outen(&bcm47xx_bus.bcma.bus.drv_cc, 1 << gpio,
68 0);
69 return 0;
70#endif
71 }
72 return -EINVAL;
36} 73}
37 74
38static inline int gpio_direction_output(unsigned gpio, int value) 75static inline int gpio_direction_output(unsigned gpio, int value)
39{ 76{
40 /* first set the gpio out value */ 77 switch (bcm47xx_bus_type) {
41 ssb_gpio_out(&ssb_bcm47xx, 1 << gpio, value ? 1 << gpio : 0); 78#ifdef CONFIG_BCM47XX_SSB
42 /* then set the gpio mode */ 79 case BCM47XX_BUS_TYPE_SSB:
43 ssb_gpio_outen(&ssb_bcm47xx, 1 << gpio, 1 << gpio); 80 /* first set the gpio out value */
44 return 0; 81 ssb_gpio_out(&bcm47xx_bus.ssb, 1 << gpio,
82 value ? 1 << gpio : 0);
83 /* then set the gpio mode */
84 ssb_gpio_outen(&bcm47xx_bus.ssb, 1 << gpio, 1 << gpio);
85 return 0;
86#endif
87#ifdef CONFIG_BCM47XX_BCMA
88 case BCM47XX_BUS_TYPE_BCMA:
89 /* first set the gpio out value */
90 bcma_chipco_gpio_out(&bcm47xx_bus.bcma.bus.drv_cc, 1 << gpio,
91 value ? 1 << gpio : 0);
92 /* then set the gpio mode */
93 bcma_chipco_gpio_outen(&bcm47xx_bus.bcma.bus.drv_cc, 1 << gpio,
94 1 << gpio);
95 return 0;
96#endif
97 }
98 return -EINVAL;
45} 99}
46 100
47static inline int gpio_intmask(unsigned gpio, int value) 101static inline int gpio_intmask(unsigned gpio, int value)
48{ 102{
49 ssb_gpio_intmask(&ssb_bcm47xx, 1 << gpio, 103 switch (bcm47xx_bus_type) {
50 value ? 1 << gpio : 0); 104#ifdef CONFIG_BCM47XX_SSB
51 return 0; 105 case BCM47XX_BUS_TYPE_SSB:
106 ssb_gpio_intmask(&bcm47xx_bus.ssb, 1 << gpio,
107 value ? 1 << gpio : 0);
108 return 0;
109#endif
110#ifdef CONFIG_BCM47XX_BCMA
111 case BCM47XX_BUS_TYPE_BCMA:
112 bcma_chipco_gpio_intmask(&bcm47xx_bus.bcma.bus.drv_cc,
113 1 << gpio, value ? 1 << gpio : 0);
114 return 0;
115#endif
116 }
117 return -EINVAL;
52} 118}
53 119
54static inline int gpio_polarity(unsigned gpio, int value) 120static inline int gpio_polarity(unsigned gpio, int value)
55{ 121{
56 ssb_gpio_polarity(&ssb_bcm47xx, 1 << gpio, 122 switch (bcm47xx_bus_type) {
57 value ? 1 << gpio : 0); 123#ifdef CONFIG_BCM47XX_SSB
58 return 0; 124 case BCM47XX_BUS_TYPE_SSB:
125 ssb_gpio_polarity(&bcm47xx_bus.ssb, 1 << gpio,
126 value ? 1 << gpio : 0);
127 return 0;
128#endif
129#ifdef CONFIG_BCM47XX_BCMA
130 case BCM47XX_BUS_TYPE_BCMA:
131 bcma_chipco_gpio_polarity(&bcm47xx_bus.bcma.bus.drv_cc,
132 1 << gpio, value ? 1 << gpio : 0);
133 return 0;
134#endif
135 }
136 return -EINVAL;
59} 137}
60 138
61 139
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 0d5a42b5f47a..a58addb98cfd 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
@@ -54,7 +54,6 @@
54#define cpu_has_mips_r2_exec_hazard 0 54#define cpu_has_mips_r2_exec_hazard 0
55#define cpu_has_dsp 0 55#define cpu_has_dsp 0
56#define cpu_has_mipsmt 0 56#define cpu_has_mipsmt 0
57#define cpu_has_userlocal 0
58#define cpu_has_vint 0 57#define cpu_has_vint 0
59#define cpu_has_veic 0 58#define cpu_has_veic 0
60#define cpu_hwrena_impl_bits 0xc0000000 59#define cpu_hwrena_impl_bits 0xc0000000
diff --git a/arch/mips/include/asm/mach-powertv/dma-coherence.h b/arch/mips/include/asm/mach-powertv/dma-coherence.h
index 62c094085947..35371641575d 100644
--- a/arch/mips/include/asm/mach-powertv/dma-coherence.h
+++ b/arch/mips/include/asm/mach-powertv/dma-coherence.h
@@ -13,7 +13,6 @@
13#define __ASM_MACH_POWERTV_DMA_COHERENCE_H 13#define __ASM_MACH_POWERTV_DMA_COHERENCE_H
14 14
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/version.h>
17#include <linux/device.h> 16#include <linux/device.h>
18#include <asm/mach-powertv/asic.h> 17#include <asm/mach-powertv/asic.h>
19 18
diff --git a/arch/mips/include/asm/stackframe.h b/arch/mips/include/asm/stackframe.h
index b4ba2449444b..cb41af5f3406 100644
--- a/arch/mips/include/asm/stackframe.h
+++ b/arch/mips/include/asm/stackframe.h
@@ -195,9 +195,9 @@
195 * to cover the pipeline delay. 195 * to cover the pipeline delay.
196 */ 196 */
197 .set mips32 197 .set mips32
198 mfc0 v1, CP0_TCSTATUS 198 mfc0 k0, CP0_TCSTATUS
199 .set mips0 199 .set mips0
200 LONG_S v1, PT_TCSTATUS(sp) 200 LONG_S k0, PT_TCSTATUS(sp)
201#endif /* CONFIG_MIPS_MT_SMTC */ 201#endif /* CONFIG_MIPS_MT_SMTC */
202 LONG_S $4, PT_R4(sp) 202 LONG_S $4, PT_R4(sp)
203 LONG_S $5, PT_R5(sp) 203 LONG_S $5, PT_R5(sp)
diff --git a/arch/mips/jz4740/gpio.c b/arch/mips/jz4740/gpio.c
index 73031f7fc827..4397972949fa 100644
--- a/arch/mips/jz4740/gpio.c
+++ b/arch/mips/jz4740/gpio.c
@@ -18,7 +18,7 @@
18#include <linux/init.h> 18#include <linux/init.h>
19 19
20#include <linux/spinlock.h> 20#include <linux/spinlock.h>
21#include <linux/sysdev.h> 21#include <linux/syscore_ops.h>
22#include <linux/io.h> 22#include <linux/io.h>
23#include <linux/gpio.h> 23#include <linux/gpio.h>
24#include <linux/delay.h> 24#include <linux/delay.h>
@@ -86,7 +86,6 @@ struct jz_gpio_chip {
86 spinlock_t lock; 86 spinlock_t lock;
87 87
88 struct gpio_chip gpio_chip; 88 struct gpio_chip gpio_chip;
89 struct sys_device sysdev;
90}; 89};
91 90
92static struct jz_gpio_chip jz4740_gpio_chips[]; 91static struct jz_gpio_chip jz4740_gpio_chips[];
@@ -459,49 +458,47 @@ static struct jz_gpio_chip jz4740_gpio_chips[] = {
459 JZ4740_GPIO_CHIP(D), 458 JZ4740_GPIO_CHIP(D),
460}; 459};
461 460
462static inline struct jz_gpio_chip *sysdev_to_chip(struct sys_device *dev) 461static void jz4740_gpio_suspend_chip(struct jz_gpio_chip *chip)
463{ 462{
464 return container_of(dev, struct jz_gpio_chip, sysdev); 463 chip->suspend_mask = readl(chip->base + JZ_REG_GPIO_MASK);
464 writel(~(chip->wakeup), chip->base + JZ_REG_GPIO_MASK_SET);
465 writel(chip->wakeup, chip->base + JZ_REG_GPIO_MASK_CLEAR);
465} 466}
466 467
467static int jz4740_gpio_suspend(struct sys_device *dev, pm_message_t state) 468static int jz4740_gpio_suspend(void)
468{ 469{
469 struct jz_gpio_chip *chip = sysdev_to_chip(dev); 470 int i;
470 471
471 chip->suspend_mask = readl(chip->base + JZ_REG_GPIO_MASK); 472 for (i = 0; i < ARRAY_SIZE(jz4740_gpio_chips); i++)
472 writel(~(chip->wakeup), chip->base + JZ_REG_GPIO_MASK_SET); 473 jz4740_gpio_suspend_chip(&jz4740_gpio_chips[i]);
473 writel(chip->wakeup, chip->base + JZ_REG_GPIO_MASK_CLEAR);
474 474
475 return 0; 475 return 0;
476} 476}
477 477
478static int jz4740_gpio_resume(struct sys_device *dev) 478static void jz4740_gpio_resume_chip(struct jz_gpio_chip *chip)
479{ 479{
480 struct jz_gpio_chip *chip = sysdev_to_chip(dev);
481 uint32_t mask = chip->suspend_mask; 480 uint32_t mask = chip->suspend_mask;
482 481
483 writel(~mask, chip->base + JZ_REG_GPIO_MASK_CLEAR); 482 writel(~mask, chip->base + JZ_REG_GPIO_MASK_CLEAR);
484 writel(mask, chip->base + JZ_REG_GPIO_MASK_SET); 483 writel(mask, chip->base + JZ_REG_GPIO_MASK_SET);
484}
485 485
486 return 0; 486static void jz4740_gpio_resume(void)
487{
488 int i;
489
490 for (i = ARRAY_SIZE(jz4740_gpio_chips) - 1; i >= 0 ; i--)
491 jz4740_gpio_resume_chip(&jz4740_gpio_chips[i]);
487} 492}
488 493
489static struct sysdev_class jz4740_gpio_sysdev_class = { 494static struct syscore_ops jz4740_gpio_syscore_ops = {
490 .name = "gpio",
491 .suspend = jz4740_gpio_suspend, 495 .suspend = jz4740_gpio_suspend,
492 .resume = jz4740_gpio_resume, 496 .resume = jz4740_gpio_resume,
493}; 497};
494 498
495static int jz4740_gpio_chip_init(struct jz_gpio_chip *chip, unsigned int id) 499static void jz4740_gpio_chip_init(struct jz_gpio_chip *chip, unsigned int id)
496{ 500{
497 int ret, irq; 501 int irq;
498
499 chip->sysdev.id = id;
500 chip->sysdev.cls = &jz4740_gpio_sysdev_class;
501 ret = sysdev_register(&chip->sysdev);
502
503 if (ret)
504 return ret;
505 502
506 spin_lock_init(&chip->lock); 503 spin_lock_init(&chip->lock);
507 504
@@ -519,22 +516,17 @@ static int jz4740_gpio_chip_init(struct jz_gpio_chip *chip, unsigned int id)
519 irq_set_chip_and_handler(irq, &jz_gpio_irq_chip, 516 irq_set_chip_and_handler(irq, &jz_gpio_irq_chip,
520 handle_level_irq); 517 handle_level_irq);
521 } 518 }
522
523 return 0;
524} 519}
525 520
526static int __init jz4740_gpio_init(void) 521static int __init jz4740_gpio_init(void)
527{ 522{
528 unsigned int i; 523 unsigned int i;
529 int ret;
530
531 ret = sysdev_class_register(&jz4740_gpio_sysdev_class);
532 if (ret)
533 return ret;
534 524
535 for (i = 0; i < ARRAY_SIZE(jz4740_gpio_chips); ++i) 525 for (i = 0; i < ARRAY_SIZE(jz4740_gpio_chips); ++i)
536 jz4740_gpio_chip_init(&jz4740_gpio_chips[i], i); 526 jz4740_gpio_chip_init(&jz4740_gpio_chips[i], i);
537 527
528 register_syscore_ops(&jz4740_gpio_syscore_ops);
529
538 printk(KERN_INFO "JZ4740 GPIO initialized\n"); 530 printk(KERN_INFO "JZ4740 GPIO initialized\n");
539 531
540 return 0; 532 return 0;
diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c
index feb8021a305f..6a2d758dd8e9 100644
--- a/arch/mips/kernel/ftrace.c
+++ b/arch/mips/kernel/ftrace.c
@@ -19,6 +19,26 @@
19 19
20#include <asm-generic/sections.h> 20#include <asm-generic/sections.h>
21 21
22#if defined(KBUILD_MCOUNT_RA_ADDRESS) && defined(CONFIG_32BIT)
23#define MCOUNT_OFFSET_INSNS 5
24#else
25#define MCOUNT_OFFSET_INSNS 4
26#endif
27
28/*
29 * Check if the address is in kernel space
30 *
31 * Clone core_kernel_text() from kernel/extable.c, but doesn't call
32 * init_kernel_text() for Ftrace doesn't trace functions in init sections.
33 */
34static inline int in_kernel_space(unsigned long ip)
35{
36 if (ip >= (unsigned long)_stext &&
37 ip <= (unsigned long)_etext)
38 return 1;
39 return 0;
40}
41
22#ifdef CONFIG_DYNAMIC_FTRACE 42#ifdef CONFIG_DYNAMIC_FTRACE
23 43
24#define JAL 0x0c000000 /* jump & link: ip --> ra, jump to target */ 44#define JAL 0x0c000000 /* jump & link: ip --> ra, jump to target */
@@ -54,20 +74,6 @@ static inline void ftrace_dyn_arch_init_insns(void)
54#endif 74#endif
55} 75}
56 76
57/*
58 * Check if the address is in kernel space
59 *
60 * Clone core_kernel_text() from kernel/extable.c, but doesn't call
61 * init_kernel_text() for Ftrace doesn't trace functions in init sections.
62 */
63static inline int in_kernel_space(unsigned long ip)
64{
65 if (ip >= (unsigned long)_stext &&
66 ip <= (unsigned long)_etext)
67 return 1;
68 return 0;
69}
70
71static int ftrace_modify_code(unsigned long ip, unsigned int new_code) 77static int ftrace_modify_code(unsigned long ip, unsigned int new_code)
72{ 78{
73 int faulted; 79 int faulted;
@@ -112,11 +118,6 @@ static int ftrace_modify_code(unsigned long ip, unsigned int new_code)
112 * 1: offset = 4 instructions 118 * 1: offset = 4 instructions
113 */ 119 */
114 120
115#if defined(KBUILD_MCOUNT_RA_ADDRESS) && defined(CONFIG_32BIT)
116#define MCOUNT_OFFSET_INSNS 5
117#else
118#define MCOUNT_OFFSET_INSNS 4
119#endif
120#define INSN_B_1F (0x10000000 | MCOUNT_OFFSET_INSNS) 121#define INSN_B_1F (0x10000000 | MCOUNT_OFFSET_INSNS)
121 122
122int ftrace_make_nop(struct module *mod, 123int ftrace_make_nop(struct module *mod,
diff --git a/arch/mips/kernel/i8259.c b/arch/mips/kernel/i8259.c
index 5c74eb797f08..32b397b646ee 100644
--- a/arch/mips/kernel/i8259.c
+++ b/arch/mips/kernel/i8259.c
@@ -229,7 +229,7 @@ static void i8259A_shutdown(void)
229 */ 229 */
230 if (i8259A_auto_eoi >= 0) { 230 if (i8259A_auto_eoi >= 0) {
231 outb(0xff, PIC_MASTER_IMR); /* mask all of 8259A-1 */ 231 outb(0xff, PIC_MASTER_IMR); /* mask all of 8259A-1 */
232 outb(0xff, PIC_SLAVE_IMR); /* mask all of 8259A-1 */ 232 outb(0xff, PIC_SLAVE_IMR); /* mask all of 8259A-2 */
233 } 233 }
234} 234}
235 235
@@ -295,6 +295,7 @@ static void init_8259A(int auto_eoi)
295static struct irqaction irq2 = { 295static struct irqaction irq2 = {
296 .handler = no_action, 296 .handler = no_action,
297 .name = "cascade", 297 .name = "cascade",
298 .flags = IRQF_NO_THREAD,
298}; 299};
299 300
300static struct resource pic1_io_resource = { 301static struct resource pic1_io_resource = {
diff --git a/arch/mips/kernel/linux32.c b/arch/mips/kernel/linux32.c
index 876a75cc376f..922a554cd108 100644
--- a/arch/mips/kernel/linux32.c
+++ b/arch/mips/kernel/linux32.c
@@ -349,3 +349,10 @@ SYSCALL_DEFINE6(32_fanotify_mark, int, fanotify_fd, unsigned int, flags,
349 return sys_fanotify_mark(fanotify_fd, flags, merge_64(a3, a4), 349 return sys_fanotify_mark(fanotify_fd, flags, merge_64(a3, a4),
350 dfd, pathname); 350 dfd, pathname);
351} 351}
352
353SYSCALL_DEFINE6(32_futex, u32 __user *, uaddr, int, op, u32, val,
354 struct compat_timespec __user *, utime, u32 __user *, uaddr2,
355 u32, val3)
356{
357 return compat_sys_futex(uaddr, op, val, utime, uaddr2, val3);
358}
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index f9296e894e46..6de1f598346e 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -315,7 +315,7 @@ EXPORT(sysn32_call_table)
315 PTR sys_fremovexattr 315 PTR sys_fremovexattr
316 PTR sys_tkill 316 PTR sys_tkill
317 PTR sys_ni_syscall 317 PTR sys_ni_syscall
318 PTR compat_sys_futex 318 PTR sys_32_futex
319 PTR compat_sys_sched_setaffinity /* 6195 */ 319 PTR compat_sys_sched_setaffinity /* 6195 */
320 PTR compat_sys_sched_getaffinity 320 PTR compat_sys_sched_getaffinity
321 PTR sys_cacheflush 321 PTR sys_cacheflush
diff --git a/arch/mips/kernel/scall64-o32.S b/arch/mips/kernel/scall64-o32.S
index 4d7c9827706f..1d813169e453 100644
--- a/arch/mips/kernel/scall64-o32.S
+++ b/arch/mips/kernel/scall64-o32.S
@@ -441,7 +441,7 @@ sys_call_table:
441 PTR sys_fremovexattr /* 4235 */ 441 PTR sys_fremovexattr /* 4235 */
442 PTR sys_tkill 442 PTR sys_tkill
443 PTR sys_sendfile64 443 PTR sys_sendfile64
444 PTR compat_sys_futex 444 PTR sys_32_futex
445 PTR compat_sys_sched_setaffinity 445 PTR compat_sys_sched_setaffinity
446 PTR compat_sys_sched_getaffinity /* 4240 */ 446 PTR compat_sys_sched_getaffinity /* 4240 */
447 PTR compat_sys_io_setup 447 PTR compat_sys_io_setup
diff --git a/arch/mips/kernel/signal.c b/arch/mips/kernel/signal.c
index dbbe0ce48d89..f8524003676a 100644
--- a/arch/mips/kernel/signal.c
+++ b/arch/mips/kernel/signal.c
@@ -8,6 +8,7 @@
8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc. 8 * Copyright (C) 1999, 2000 Silicon Graphics, Inc.
9 */ 9 */
10#include <linux/cache.h> 10#include <linux/cache.h>
11#include <linux/irqflags.h>
11#include <linux/sched.h> 12#include <linux/sched.h>
12#include <linux/mm.h> 13#include <linux/mm.h>
13#include <linux/personality.h> 14#include <linux/personality.h>
@@ -658,6 +659,8 @@ static void do_signal(struct pt_regs *regs)
658asmlinkage void do_notify_resume(struct pt_regs *regs, void *unused, 659asmlinkage void do_notify_resume(struct pt_regs *regs, void *unused,
659 __u32 thread_info_flags) 660 __u32 thread_info_flags)
660{ 661{
662 local_irq_enable();
663
661 /* deal with pending signal delivery */ 664 /* deal with pending signal delivery */
662 if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK)) 665 if (thread_info_flags & (_TIF_SIGPENDING | _TIF_RESTORE_SIGMASK))
663 do_signal(regs); 666 do_signal(regs);
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index b7517e3abc85..cbea618af0b4 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -14,6 +14,7 @@
14#include <linux/bug.h> 14#include <linux/bug.h>
15#include <linux/compiler.h> 15#include <linux/compiler.h>
16#include <linux/init.h> 16#include <linux/init.h>
17#include <linux/kernel.h>
17#include <linux/mm.h> 18#include <linux/mm.h>
18#include <linux/module.h> 19#include <linux/module.h>
19#include <linux/sched.h> 20#include <linux/sched.h>
@@ -364,21 +365,26 @@ static int regs_to_trapnr(struct pt_regs *regs)
364 return (regs->cp0_cause >> 2) & 0x1f; 365 return (regs->cp0_cause >> 2) & 0x1f;
365} 366}
366 367
367static DEFINE_SPINLOCK(die_lock); 368static DEFINE_RAW_SPINLOCK(die_lock);
368 369
369void __noreturn die(const char *str, struct pt_regs *regs) 370void __noreturn die(const char *str, struct pt_regs *regs)
370{ 371{
371 static int die_counter; 372 static int die_counter;
372 int sig = SIGSEGV; 373 int sig = SIGSEGV;
373#ifdef CONFIG_MIPS_MT_SMTC 374#ifdef CONFIG_MIPS_MT_SMTC
374 unsigned long dvpret = dvpe(); 375 unsigned long dvpret;
375#endif /* CONFIG_MIPS_MT_SMTC */ 376#endif /* CONFIG_MIPS_MT_SMTC */
376 377
378 oops_enter();
379
377 if (notify_die(DIE_OOPS, str, regs, 0, regs_to_trapnr(regs), SIGSEGV) == NOTIFY_STOP) 380 if (notify_die(DIE_OOPS, str, regs, 0, regs_to_trapnr(regs), SIGSEGV) == NOTIFY_STOP)
378 sig = 0; 381 sig = 0;
379 382
380 console_verbose(); 383 console_verbose();
381 spin_lock_irq(&die_lock); 384 raw_spin_lock_irq(&die_lock);
385#ifdef CONFIG_MIPS_MT_SMTC
386 dvpret = dvpe();
387#endif /* CONFIG_MIPS_MT_SMTC */
382 bust_spinlocks(1); 388 bust_spinlocks(1);
383#ifdef CONFIG_MIPS_MT_SMTC 389#ifdef CONFIG_MIPS_MT_SMTC
384 mips_mt_regdump(dvpret); 390 mips_mt_regdump(dvpret);
@@ -387,7 +393,9 @@ void __noreturn die(const char *str, struct pt_regs *regs)
387 printk("%s[#%d]:\n", str, ++die_counter); 393 printk("%s[#%d]:\n", str, ++die_counter);
388 show_registers(regs); 394 show_registers(regs);
389 add_taint(TAINT_DIE); 395 add_taint(TAINT_DIE);
390 spin_unlock_irq(&die_lock); 396 raw_spin_unlock_irq(&die_lock);
397
398 oops_exit();
391 399
392 if (in_interrupt()) 400 if (in_interrupt())
393 panic("Fatal exception in interrupt"); 401 panic("Fatal exception in interrupt");
diff --git a/arch/mips/kernel/vpe.c b/arch/mips/kernel/vpe.c
index 2cd50ad0d5c6..3efcb065f78a 100644
--- a/arch/mips/kernel/vpe.c
+++ b/arch/mips/kernel/vpe.c
@@ -192,7 +192,7 @@ static struct tc *get_tc(int index)
192 } 192 }
193 spin_unlock(&vpecontrol.tc_list_lock); 193 spin_unlock(&vpecontrol.tc_list_lock);
194 194
195 return NULL; 195 return res;
196} 196}
197 197
198/* allocate a vpe and associate it with this minor (or index) */ 198/* allocate a vpe and associate it with this minor (or index) */
diff --git a/arch/mips/lantiq/irq.c b/arch/mips/lantiq/irq.c
index fc89795cafdb..f9737bb3c5ab 100644
--- a/arch/mips/lantiq/irq.c
+++ b/arch/mips/lantiq/irq.c
@@ -123,11 +123,10 @@ void ltq_enable_irq(struct irq_data *d)
123static unsigned int ltq_startup_eiu_irq(struct irq_data *d) 123static unsigned int ltq_startup_eiu_irq(struct irq_data *d)
124{ 124{
125 int i; 125 int i;
126 int irq_nr = d->irq - INT_NUM_IRQ0;
127 126
128 ltq_enable_irq(d); 127 ltq_enable_irq(d);
129 for (i = 0; i < MAX_EIU; i++) { 128 for (i = 0; i < MAX_EIU; i++) {
130 if (irq_nr == ltq_eiu_irq[i]) { 129 if (d->irq == ltq_eiu_irq[i]) {
131 /* low level - we should really handle set_type */ 130 /* low level - we should really handle set_type */
132 ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_C) | 131 ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_C) |
133 (0x6 << (i * 4)), LTQ_EIU_EXIN_C); 132 (0x6 << (i * 4)), LTQ_EIU_EXIN_C);
@@ -147,11 +146,10 @@ static unsigned int ltq_startup_eiu_irq(struct irq_data *d)
147static void ltq_shutdown_eiu_irq(struct irq_data *d) 146static void ltq_shutdown_eiu_irq(struct irq_data *d)
148{ 147{
149 int i; 148 int i;
150 int irq_nr = d->irq - INT_NUM_IRQ0;
151 149
152 ltq_disable_irq(d); 150 ltq_disable_irq(d);
153 for (i = 0; i < MAX_EIU; i++) { 151 for (i = 0; i < MAX_EIU; i++) {
154 if (irq_nr == ltq_eiu_irq[i]) { 152 if (d->irq == ltq_eiu_irq[i]) {
155 /* disable */ 153 /* disable */
156 ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_INEN) & ~(1 << i), 154 ltq_eiu_w32(ltq_eiu_r32(LTQ_EIU_EXIN_INEN) & ~(1 << i),
157 LTQ_EIU_EXIN_INEN); 155 LTQ_EIU_EXIN_INEN);
diff --git a/arch/mips/lantiq/xway/ebu.c b/arch/mips/lantiq/xway/ebu.c
index 66eb52fa50a1..033b3184c7a7 100644
--- a/arch/mips/lantiq/xway/ebu.c
+++ b/arch/mips/lantiq/xway/ebu.c
@@ -10,7 +10,6 @@
10 10
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/module.h> 12#include <linux/module.h>
13#include <linux/version.h>
14#include <linux/ioport.h> 13#include <linux/ioport.h>
15 14
16#include <lantiq_soc.h> 15#include <lantiq_soc.h>
diff --git a/arch/mips/lantiq/xway/pmu.c b/arch/mips/lantiq/xway/pmu.c
index 9d69f01e352b..39f0d2641cbf 100644
--- a/arch/mips/lantiq/xway/pmu.c
+++ b/arch/mips/lantiq/xway/pmu.c
@@ -8,7 +8,6 @@
8 8
9#include <linux/kernel.h> 9#include <linux/kernel.h>
10#include <linux/module.h> 10#include <linux/module.h>
11#include <linux/version.h>
12#include <linux/ioport.h> 11#include <linux/ioport.h>
13 12
14#include <lantiq_soc.h> 13#include <lantiq_soc.h>
diff --git a/arch/mips/lasat/interrupt.c b/arch/mips/lasat/interrupt.c
index de4c165515d7..d608b6ef0edd 100644
--- a/arch/mips/lasat/interrupt.c
+++ b/arch/mips/lasat/interrupt.c
@@ -105,6 +105,7 @@ asmlinkage void plat_irq_dispatch(void)
105static struct irqaction cascade = { 105static struct irqaction cascade = {
106 .handler = no_action, 106 .handler = no_action,
107 .name = "cascade", 107 .name = "cascade",
108 .flags = IRQF_NO_THREAD,
108}; 109};
109 110
110void __init arch_init_irq(void) 111void __init arch_init_irq(void)
diff --git a/arch/mips/loongson/fuloong-2e/irq.c b/arch/mips/loongson/fuloong-2e/irq.c
index d61a04222b87..3cf1fef29f0e 100644
--- a/arch/mips/loongson/fuloong-2e/irq.c
+++ b/arch/mips/loongson/fuloong-2e/irq.c
@@ -42,6 +42,7 @@ asmlinkage void mach_irq_dispatch(unsigned int pending)
42static struct irqaction cascade_irqaction = { 42static struct irqaction cascade_irqaction = {
43 .handler = no_action, 43 .handler = no_action,
44 .name = "cascade", 44 .name = "cascade",
45 .flags = IRQF_NO_THREAD,
45}; 46};
46 47
47void __init mach_init_irq(void) 48void __init mach_init_irq(void)
diff --git a/arch/mips/loongson/lemote-2f/irq.c b/arch/mips/loongson/lemote-2f/irq.c
index 081db102bb98..14b081841b6b 100644
--- a/arch/mips/loongson/lemote-2f/irq.c
+++ b/arch/mips/loongson/lemote-2f/irq.c
@@ -96,12 +96,13 @@ static irqreturn_t ip6_action(int cpl, void *dev_id)
96struct irqaction ip6_irqaction = { 96struct irqaction ip6_irqaction = {
97 .handler = ip6_action, 97 .handler = ip6_action,
98 .name = "cascade", 98 .name = "cascade",
99 .flags = IRQF_SHARED, 99 .flags = IRQF_SHARED | IRQF_NO_THREAD,
100}; 100};
101 101
102struct irqaction cascade_irqaction = { 102struct irqaction cascade_irqaction = {
103 .handler = no_action, 103 .handler = no_action,
104 .name = "cascade", 104 .name = "cascade",
105 .flags = IRQF_NO_THREAD,
105}; 106};
106 107
107void __init mach_init_irq(void) 108void __init mach_init_irq(void)
diff --git a/arch/mips/mm/mmap.c b/arch/mips/mm/mmap.c
index 9ff5d0fac556..302d779d5b0d 100644
--- a/arch/mips/mm/mmap.c
+++ b/arch/mips/mm/mmap.c
@@ -6,6 +6,7 @@
6 * Copyright (C) 2011 Wind River Systems, 6 * Copyright (C) 2011 Wind River Systems,
7 * written by Ralf Baechle <ralf@linux-mips.org> 7 * written by Ralf Baechle <ralf@linux-mips.org>
8 */ 8 */
9#include <linux/compiler.h>
9#include <linux/errno.h> 10#include <linux/errno.h>
10#include <linux/mm.h> 11#include <linux/mm.h>
11#include <linux/mman.h> 12#include <linux/mman.h>
@@ -15,12 +16,11 @@
15#include <linux/sched.h> 16#include <linux/sched.h>
16 17
17unsigned long shm_align_mask = PAGE_SIZE - 1; /* Sane caches */ 18unsigned long shm_align_mask = PAGE_SIZE - 1; /* Sane caches */
18
19EXPORT_SYMBOL(shm_align_mask); 19EXPORT_SYMBOL(shm_align_mask);
20 20
21/* gap between mmap and stack */ 21/* gap between mmap and stack */
22#define MIN_GAP (128*1024*1024UL) 22#define MIN_GAP (128*1024*1024UL)
23#define MAX_GAP ((TASK_SIZE)/6*5) 23#define MAX_GAP ((TASK_SIZE)/6*5)
24 24
25static int mmap_is_legacy(void) 25static int mmap_is_legacy(void)
26{ 26{
@@ -57,13 +57,13 @@ static inline unsigned long COLOUR_ALIGN_DOWN(unsigned long addr,
57 return base - off; 57 return base - off;
58} 58}
59 59
60#define COLOUR_ALIGN(addr,pgoff) \ 60#define COLOUR_ALIGN(addr, pgoff) \
61 ((((addr) + shm_align_mask) & ~shm_align_mask) + \ 61 ((((addr) + shm_align_mask) & ~shm_align_mask) + \
62 (((pgoff) << PAGE_SHIFT) & shm_align_mask)) 62 (((pgoff) << PAGE_SHIFT) & shm_align_mask))
63 63
64enum mmap_allocation_direction {UP, DOWN}; 64enum mmap_allocation_direction {UP, DOWN};
65 65
66static unsigned long arch_get_unmapped_area_foo(struct file *filp, 66static unsigned long arch_get_unmapped_area_common(struct file *filp,
67 unsigned long addr0, unsigned long len, unsigned long pgoff, 67 unsigned long addr0, unsigned long len, unsigned long pgoff,
68 unsigned long flags, enum mmap_allocation_direction dir) 68 unsigned long flags, enum mmap_allocation_direction dir)
69{ 69{
@@ -103,16 +103,16 @@ static unsigned long arch_get_unmapped_area_foo(struct file *filp,
103 103
104 vma = find_vma(mm, addr); 104 vma = find_vma(mm, addr);
105 if (TASK_SIZE - len >= addr && 105 if (TASK_SIZE - len >= addr &&
106 (!vma || addr + len <= vma->vm_start)) 106 (!vma || addr + len <= vma->vm_start))
107 return addr; 107 return addr;
108 } 108 }
109 109
110 if (dir == UP) { 110 if (dir == UP) {
111 addr = mm->mmap_base; 111 addr = mm->mmap_base;
112 if (do_color_align) 112 if (do_color_align)
113 addr = COLOUR_ALIGN(addr, pgoff); 113 addr = COLOUR_ALIGN(addr, pgoff);
114 else 114 else
115 addr = PAGE_ALIGN(addr); 115 addr = PAGE_ALIGN(addr);
116 116
117 for (vma = find_vma(current->mm, addr); ; vma = vma->vm_next) { 117 for (vma = find_vma(current->mm, addr); ; vma = vma->vm_next) {
118 /* At this point: (!vma || addr < vma->vm_end). */ 118 /* At this point: (!vma || addr < vma->vm_end). */
@@ -131,28 +131,30 @@ static unsigned long arch_get_unmapped_area_foo(struct file *filp,
131 mm->free_area_cache = mm->mmap_base; 131 mm->free_area_cache = mm->mmap_base;
132 } 132 }
133 133
134 /* either no address requested or can't fit in requested address hole */ 134 /*
135 * either no address requested, or the mapping can't fit into
136 * the requested address hole
137 */
135 addr = mm->free_area_cache; 138 addr = mm->free_area_cache;
136 if (do_color_align) { 139 if (do_color_align) {
137 unsigned long base = 140 unsigned long base =
138 COLOUR_ALIGN_DOWN(addr - len, pgoff); 141 COLOUR_ALIGN_DOWN(addr - len, pgoff);
139
140 addr = base + len; 142 addr = base + len;
141 } 143 }
142 144
143 /* make sure it can fit in the remaining address space */ 145 /* make sure it can fit in the remaining address space */
144 if (likely(addr > len)) { 146 if (likely(addr > len)) {
145 vma = find_vma(mm, addr - len); 147 vma = find_vma(mm, addr - len);
146 if (!vma || addr <= vma->vm_start) { 148 if (!vma || addr <= vma->vm_start) {
147 /* remember the address as a hint for next time */ 149 /* cache the address as a hint for next time */
148 return mm->free_area_cache = addr-len; 150 return mm->free_area_cache = addr - len;
149 } 151 }
150 } 152 }
151 153
152 if (unlikely(mm->mmap_base < len)) 154 if (unlikely(mm->mmap_base < len))
153 goto bottomup; 155 goto bottomup;
154 156
155 addr = mm->mmap_base-len; 157 addr = mm->mmap_base - len;
156 if (do_color_align) 158 if (do_color_align)
157 addr = COLOUR_ALIGN_DOWN(addr, pgoff); 159 addr = COLOUR_ALIGN_DOWN(addr, pgoff);
158 160
@@ -163,8 +165,8 @@ static unsigned long arch_get_unmapped_area_foo(struct file *filp,
163 * return with success: 165 * return with success:
164 */ 166 */
165 vma = find_vma(mm, addr); 167 vma = find_vma(mm, addr);
166 if (likely(!vma || addr+len <= vma->vm_start)) { 168 if (likely(!vma || addr + len <= vma->vm_start)) {
167 /* remember the address as a hint for next time */ 169 /* cache the address as a hint for next time */
168 return mm->free_area_cache = addr; 170 return mm->free_area_cache = addr;
169 } 171 }
170 172
@@ -173,7 +175,7 @@ static unsigned long arch_get_unmapped_area_foo(struct file *filp,
173 mm->cached_hole_size = vma->vm_start - addr; 175 mm->cached_hole_size = vma->vm_start - addr;
174 176
175 /* try just below the current vma->vm_start */ 177 /* try just below the current vma->vm_start */
176 addr = vma->vm_start-len; 178 addr = vma->vm_start - len;
177 if (do_color_align) 179 if (do_color_align)
178 addr = COLOUR_ALIGN_DOWN(addr, pgoff); 180 addr = COLOUR_ALIGN_DOWN(addr, pgoff);
179 } while (likely(len < vma->vm_start)); 181 } while (likely(len < vma->vm_start));
@@ -201,7 +203,7 @@ bottomup:
201unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr0, 203unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr0,
202 unsigned long len, unsigned long pgoff, unsigned long flags) 204 unsigned long len, unsigned long pgoff, unsigned long flags)
203{ 205{
204 return arch_get_unmapped_area_foo(filp, 206 return arch_get_unmapped_area_common(filp,
205 addr0, len, pgoff, flags, UP); 207 addr0, len, pgoff, flags, UP);
206} 208}
207 209
@@ -213,7 +215,7 @@ unsigned long arch_get_unmapped_area_topdown(struct file *filp,
213 unsigned long addr0, unsigned long len, unsigned long pgoff, 215 unsigned long addr0, unsigned long len, unsigned long pgoff,
214 unsigned long flags) 216 unsigned long flags)
215{ 217{
216 return arch_get_unmapped_area_foo(filp, 218 return arch_get_unmapped_area_common(filp,
217 addr0, len, pgoff, flags, DOWN); 219 addr0, len, pgoff, flags, DOWN);
218} 220}
219 221
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index b6e1cff50667..e06370f58ef3 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -1759,14 +1759,13 @@ static void __cpuinit build_r3000_tlb_modify_handler(void)
1759 u32 *p = handle_tlbm; 1759 u32 *p = handle_tlbm;
1760 struct uasm_label *l = labels; 1760 struct uasm_label *l = labels;
1761 struct uasm_reloc *r = relocs; 1761 struct uasm_reloc *r = relocs;
1762 struct work_registers wr;
1763 1762
1764 memset(handle_tlbm, 0, sizeof(handle_tlbm)); 1763 memset(handle_tlbm, 0, sizeof(handle_tlbm));
1765 memset(labels, 0, sizeof(labels)); 1764 memset(labels, 0, sizeof(labels));
1766 memset(relocs, 0, sizeof(relocs)); 1765 memset(relocs, 0, sizeof(relocs));
1767 1766
1768 build_r3000_tlbchange_handler_head(&p, K0, K1); 1767 build_r3000_tlbchange_handler_head(&p, K0, K1);
1769 build_pte_modifiable(&p, &r, wr.r1, wr.r2, wr.r3, label_nopage_tlbm); 1768 build_pte_modifiable(&p, &r, K0, K1, -1, label_nopage_tlbm);
1770 uasm_i_nop(&p); /* load delay */ 1769 uasm_i_nop(&p); /* load delay */
1771 build_make_write(&p, &r, K0, K1); 1770 build_make_write(&p, &r, K0, K1);
1772 build_r3000_pte_reload_tlbwi(&p, K0, K1); 1771 build_r3000_pte_reload_tlbwi(&p, K0, K1);
@@ -1963,7 +1962,8 @@ static void __cpuinit build_r4000_tlb_load_handler(void)
1963 uasm_i_andi(&p, wr.r3, wr.r3, 2); 1962 uasm_i_andi(&p, wr.r3, wr.r3, 2);
1964 uasm_il_beqz(&p, &r, wr.r3, label_tlbl_goaround2); 1963 uasm_il_beqz(&p, &r, wr.r3, label_tlbl_goaround2);
1965 } 1964 }
1966 1965 if (PM_DEFAULT_MASK == 0)
1966 uasm_i_nop(&p);
1967 /* 1967 /*
1968 * We clobbered C0_PAGEMASK, restore it. On the other branch 1968 * We clobbered C0_PAGEMASK, restore it. On the other branch
1969 * it is restored in build_huge_tlb_write_entry. 1969 * it is restored in build_huge_tlb_write_entry.
diff --git a/arch/mips/mti-malta/malta-int.c b/arch/mips/mti-malta/malta-int.c
index 1d36c511a7a5..d53ff91b277c 100644
--- a/arch/mips/mti-malta/malta-int.c
+++ b/arch/mips/mti-malta/malta-int.c
@@ -350,12 +350,14 @@ unsigned int plat_ipi_resched_int_xlate(unsigned int cpu)
350 350
351static struct irqaction i8259irq = { 351static struct irqaction i8259irq = {
352 .handler = no_action, 352 .handler = no_action,
353 .name = "XT-PIC cascade" 353 .name = "XT-PIC cascade",
354 .flags = IRQF_NO_THREAD,
354}; 355};
355 356
356static struct irqaction corehi_irqaction = { 357static struct irqaction corehi_irqaction = {
357 .handler = no_action, 358 .handler = no_action,
358 .name = "CoreHi" 359 .name = "CoreHi",
360 .flags = IRQF_NO_THREAD,
359}; 361};
360 362
361static msc_irqmap_t __initdata msc_irqmap[] = { 363static msc_irqmap_t __initdata msc_irqmap[] = {
diff --git a/arch/mips/netlogic/xlr/Makefile b/arch/mips/netlogic/xlr/Makefile
index 9bd3f731f62e..2dca585dd2f7 100644
--- a/arch/mips/netlogic/xlr/Makefile
+++ b/arch/mips/netlogic/xlr/Makefile
@@ -2,4 +2,4 @@ obj-y += setup.o platform.o irq.o setup.o time.o
2obj-$(CONFIG_SMP) += smp.o smpboot.o 2obj-$(CONFIG_SMP) += smp.o smpboot.o
3obj-$(CONFIG_EARLY_PRINTK) += xlr_console.o 3obj-$(CONFIG_EARLY_PRINTK) += xlr_console.o
4 4
5EXTRA_CFLAGS += -Werror 5ccflags-y += -Werror
diff --git a/arch/mips/pci/pci-bcm47xx.c b/arch/mips/pci/pci-bcm47xx.c
index 455f8e50a007..400535a955d0 100644
--- a/arch/mips/pci/pci-bcm47xx.c
+++ b/arch/mips/pci/pci-bcm47xx.c
@@ -25,6 +25,7 @@
25#include <linux/types.h> 25#include <linux/types.h>
26#include <linux/pci.h> 26#include <linux/pci.h>
27#include <linux/ssb/ssb.h> 27#include <linux/ssb/ssb.h>
28#include <bcm47xx.h>
28 29
29int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin) 30int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
30{ 31{
@@ -33,9 +34,13 @@ int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
33 34
34int pcibios_plat_dev_init(struct pci_dev *dev) 35int pcibios_plat_dev_init(struct pci_dev *dev)
35{ 36{
37#ifdef CONFIG_BCM47XX_SSB
36 int res; 38 int res;
37 u8 slot, pin; 39 u8 slot, pin;
38 40
41 if (bcm47xx_bus_type != BCM47XX_BUS_TYPE_SSB)
42 return 0;
43
39 res = ssb_pcibios_plat_dev_init(dev); 44 res = ssb_pcibios_plat_dev_init(dev);
40 if (res < 0) { 45 if (res < 0) {
41 printk(KERN_ALERT "PCI: Failed to init device %s\n", 46 printk(KERN_ALERT "PCI: Failed to init device %s\n",
@@ -55,5 +60,6 @@ int pcibios_plat_dev_init(struct pci_dev *dev)
55 } 60 }
56 61
57 dev->irq = res; 62 dev->irq = res;
63#endif
58 return 0; 64 return 0;
59} 65}
diff --git a/arch/mips/pci/pci-lantiq.c b/arch/mips/pci/pci-lantiq.c
index 603d7493e966..8656388b34bd 100644
--- a/arch/mips/pci/pci-lantiq.c
+++ b/arch/mips/pci/pci-lantiq.c
@@ -171,8 +171,13 @@ static int __devinit ltq_pci_startup(struct ltq_pci_data *conf)
171 u32 temp_buffer; 171 u32 temp_buffer;
172 172
173 /* set clock to 33Mhz */ 173 /* set clock to 33Mhz */
174 ltq_cgu_w32(ltq_cgu_r32(LTQ_CGU_IFCCR) & ~0xf00000, LTQ_CGU_IFCCR); 174 if (ltq_is_ar9()) {
175 ltq_cgu_w32(ltq_cgu_r32(LTQ_CGU_IFCCR) | 0x800000, LTQ_CGU_IFCCR); 175 ltq_cgu_w32(ltq_cgu_r32(LTQ_CGU_IFCCR) & ~0x1f00000, LTQ_CGU_IFCCR);
176 ltq_cgu_w32(ltq_cgu_r32(LTQ_CGU_IFCCR) | 0xe00000, LTQ_CGU_IFCCR);
177 } else {
178 ltq_cgu_w32(ltq_cgu_r32(LTQ_CGU_IFCCR) & ~0xf00000, LTQ_CGU_IFCCR);
179 ltq_cgu_w32(ltq_cgu_r32(LTQ_CGU_IFCCR) | 0x800000, LTQ_CGU_IFCCR);
180 }
176 181
177 /* external or internal clock ? */ 182 /* external or internal clock ? */
178 if (conf->clock) { 183 if (conf->clock) {
diff --git a/arch/mips/pci/pci-rc32434.c b/arch/mips/pci/pci-rc32434.c
index 764362ce5e40..5f3a69cebad1 100644
--- a/arch/mips/pci/pci-rc32434.c
+++ b/arch/mips/pci/pci-rc32434.c
@@ -215,7 +215,7 @@ static int __init rc32434_pci_init(void)
215 rc32434_pcibridge_init(); 215 rc32434_pcibridge_init();
216 216
217 io_map_base = ioremap(rc32434_res_pci_io1.start, 217 io_map_base = ioremap(rc32434_res_pci_io1.start,
218 resource_size(&rcrc32434_res_pci_io1)); 218 resource_size(&rc32434_res_pci_io1));
219 219
220 if (!io_map_base) 220 if (!io_map_base)
221 return -ENOMEM; 221 return -ENOMEM;
diff --git a/arch/mips/pmc-sierra/msp71xx/msp_irq.c b/arch/mips/pmc-sierra/msp71xx/msp_irq.c
index 4531c4a514bc..d3c3d81757a5 100644
--- a/arch/mips/pmc-sierra/msp71xx/msp_irq.c
+++ b/arch/mips/pmc-sierra/msp71xx/msp_irq.c
@@ -108,12 +108,14 @@ asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
108 108
109static struct irqaction cic_cascade_msp = { 109static struct irqaction cic_cascade_msp = {
110 .handler = no_action, 110 .handler = no_action,
111 .name = "MSP CIC cascade" 111 .name = "MSP CIC cascade",
112 .flags = IRQF_NO_THREAD,
112}; 113};
113 114
114static struct irqaction per_cascade_msp = { 115static struct irqaction per_cascade_msp = {
115 .handler = no_action, 116 .handler = no_action,
116 .name = "MSP PER cascade" 117 .name = "MSP PER cascade",
118 .flags = IRQF_NO_THREAD,
117}; 119};
118 120
119void __init arch_init_irq(void) 121void __init arch_init_irq(void)
diff --git a/arch/mips/pmc-sierra/msp71xx/msp_serial.c b/arch/mips/pmc-sierra/msp71xx/msp_serial.c
index f7261628d8a6..a1c7c7da2336 100644
--- a/arch/mips/pmc-sierra/msp71xx/msp_serial.c
+++ b/arch/mips/pmc-sierra/msp71xx/msp_serial.c
@@ -27,6 +27,7 @@
27#include <linux/serial.h> 27#include <linux/serial.h>
28#include <linux/serial_core.h> 28#include <linux/serial_core.h>
29#include <linux/serial_reg.h> 29#include <linux/serial_reg.h>
30#include <linux/slab.h>
30 31
31#include <asm/bootinfo.h> 32#include <asm/bootinfo.h>
32#include <asm/io.h> 33#include <asm/io.h>
@@ -38,6 +39,55 @@
38#include <msp_int.h> 39#include <msp_int.h>
39#include <msp_regs.h> 40#include <msp_regs.h>
40 41
42struct msp_uart_data {
43 int last_lcr;
44};
45
46static void msp_serial_out(struct uart_port *p, int offset, int value)
47{
48 struct msp_uart_data *d = p->private_data;
49
50 if (offset == UART_LCR)
51 d->last_lcr = value;
52
53 offset <<= p->regshift;
54 writeb(value, p->membase + offset);
55}
56
57static unsigned int msp_serial_in(struct uart_port *p, int offset)
58{
59 offset <<= p->regshift;
60
61 return readb(p->membase + offset);
62}
63
64static int msp_serial_handle_irq(struct uart_port *p)
65{
66 struct msp_uart_data *d = p->private_data;
67 unsigned int iir = readb(p->membase + (UART_IIR << p->regshift));
68
69 if (serial8250_handle_irq(p, iir)) {
70 return 1;
71 } else if ((iir & UART_IIR_BUSY) == UART_IIR_BUSY) {
72 /*
73 * The DesignWare APB UART has an Busy Detect (0x07) interrupt
74 * meaning an LCR write attempt occurred while the UART was
75 * busy. The interrupt must be cleared by reading the UART
76 * status register (USR) and the LCR re-written.
77 *
78 * Note: MSP reserves 0x20 bytes of address space for the UART
79 * and the USR is mapped in a separate block at an offset of
80 * 0xc0 from the start of the UART.
81 */
82 (void)readb(p->membase + 0xc0);
83 writeb(d->last_lcr, p->membase + (UART_LCR << p->regshift));
84
85 return 1;
86 }
87
88 return 0;
89}
90
41void __init msp_serial_setup(void) 91void __init msp_serial_setup(void)
42{ 92{
43 char *s; 93 char *s;
@@ -59,13 +109,22 @@ void __init msp_serial_setup(void)
59 up.irq = MSP_INT_UART0; 109 up.irq = MSP_INT_UART0;
60 up.uartclk = uartclk; 110 up.uartclk = uartclk;
61 up.regshift = 2; 111 up.regshift = 2;
62 up.iotype = UPIO_DWAPB; /* UPIO_MEM like */ 112 up.iotype = UPIO_MEM;
63 up.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST; 113 up.flags = ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST;
64 up.type = PORT_16550A; 114 up.type = PORT_16550A;
65 up.line = 0; 115 up.line = 0;
66 up.private_data = (void*)UART0_STATUS_REG; 116 up.serial_out = msp_serial_out;
67 if (early_serial_setup(&up)) 117 up.serial_in = msp_serial_in;
68 printk(KERN_ERR "Early serial init of port 0 failed\n"); 118 up.handle_irq = msp_serial_handle_irq;
119 up.private_data = kzalloc(sizeof(struct msp_uart_data), GFP_KERNEL);
120 if (!up.private_data) {
121 pr_err("failed to allocate uart private data\n");
122 return;
123 }
124 if (early_serial_setup(&up)) {
125 kfree(up.private_data);
126 pr_err("Early serial init of port 0 failed\n");
127 }
69 128
70 /* Initialize the second serial port, if one exists */ 129 /* Initialize the second serial port, if one exists */
71 switch (mips_machtype) { 130 switch (mips_machtype) {
@@ -88,6 +147,8 @@ void __init msp_serial_setup(void)
88 up.irq = MSP_INT_UART1; 147 up.irq = MSP_INT_UART1;
89 up.line = 1; 148 up.line = 1;
90 up.private_data = (void*)UART1_STATUS_REG; 149 up.private_data = (void*)UART1_STATUS_REG;
91 if (early_serial_setup(&up)) 150 if (early_serial_setup(&up)) {
92 printk(KERN_ERR "Early serial init of port 1 failed\n"); 151 kfree(up.private_data);
152 pr_err("Early serial init of port 1 failed\n");
153 }
93} 154}
diff --git a/arch/mips/pnx8550/common/int.c b/arch/mips/pnx8550/common/int.c
index 6b93c81779c1..1ebe22bdadc8 100644
--- a/arch/mips/pnx8550/common/int.c
+++ b/arch/mips/pnx8550/common/int.c
@@ -167,7 +167,7 @@ static struct irq_chip level_irq_type = {
167 167
168static struct irqaction gic_action = { 168static struct irqaction gic_action = {
169 .handler = no_action, 169 .handler = no_action,
170 .flags = IRQF_DISABLED, 170 .flags = IRQF_DISABLED | IRQF_NO_THREAD,
171 .name = "GIC", 171 .name = "GIC",
172}; 172};
173 173
diff --git a/arch/mips/sgi-ip22/ip22-int.c b/arch/mips/sgi-ip22/ip22-int.c
index b4d08e4d2ea9..f72c336ea27b 100644
--- a/arch/mips/sgi-ip22/ip22-int.c
+++ b/arch/mips/sgi-ip22/ip22-int.c
@@ -155,32 +155,32 @@ static void __irq_entry indy_buserror_irq(void)
155 155
156static struct irqaction local0_cascade = { 156static struct irqaction local0_cascade = {
157 .handler = no_action, 157 .handler = no_action,
158 .flags = IRQF_DISABLED, 158 .flags = IRQF_DISABLED | IRQF_NO_THREAD,
159 .name = "local0 cascade", 159 .name = "local0 cascade",
160}; 160};
161 161
162static struct irqaction local1_cascade = { 162static struct irqaction local1_cascade = {
163 .handler = no_action, 163 .handler = no_action,
164 .flags = IRQF_DISABLED, 164 .flags = IRQF_DISABLED | IRQF_NO_THREAD,
165 .name = "local1 cascade", 165 .name = "local1 cascade",
166}; 166};
167 167
168static struct irqaction buserr = { 168static struct irqaction buserr = {
169 .handler = no_action, 169 .handler = no_action,
170 .flags = IRQF_DISABLED, 170 .flags = IRQF_DISABLED | IRQF_NO_THREAD,
171 .name = "Bus Error", 171 .name = "Bus Error",
172}; 172};
173 173
174static struct irqaction map0_cascade = { 174static struct irqaction map0_cascade = {
175 .handler = no_action, 175 .handler = no_action,
176 .flags = IRQF_DISABLED, 176 .flags = IRQF_DISABLED | IRQF_NO_THREAD,
177 .name = "mapable0 cascade", 177 .name = "mapable0 cascade",
178}; 178};
179 179
180#ifdef USE_LIO3_IRQ 180#ifdef USE_LIO3_IRQ
181static struct irqaction map1_cascade = { 181static struct irqaction map1_cascade = {
182 .handler = no_action, 182 .handler = no_action,
183 .flags = IRQF_DISABLED, 183 .flags = IRQF_DISABLED | IRQF_NO_THREAD,
184 .name = "mapable1 cascade", 184 .name = "mapable1 cascade",
185}; 185};
186#define SGI_INTERRUPTS SGINT_END 186#define SGI_INTERRUPTS SGINT_END
diff --git a/arch/mips/sni/rm200.c b/arch/mips/sni/rm200.c
index a7e5a6d917b1..3ab5b5d25b0a 100644
--- a/arch/mips/sni/rm200.c
+++ b/arch/mips/sni/rm200.c
@@ -359,6 +359,7 @@ void sni_rm200_init_8259A(void)
359static struct irqaction sni_rm200_irq2 = { 359static struct irqaction sni_rm200_irq2 = {
360 .handler = no_action, 360 .handler = no_action,
361 .name = "cascade", 361 .name = "cascade",
362 .flags = IRQF_NO_THREAD,
362}; 363};
363 364
364static struct resource sni_rm200_pic1_resource = { 365static struct resource sni_rm200_pic1_resource = {
diff --git a/arch/mips/txx9/generic/setup_tx4939.c b/arch/mips/txx9/generic/setup_tx4939.c
index e9f95dcde379..ba3cec3155df 100644
--- a/arch/mips/txx9/generic/setup_tx4939.c
+++ b/arch/mips/txx9/generic/setup_tx4939.c
@@ -321,7 +321,7 @@ void __init tx4939_sio_init(unsigned int sclk, unsigned int cts_mask)
321static u32 tx4939_get_eth_speed(struct net_device *dev) 321static u32 tx4939_get_eth_speed(struct net_device *dev)
322{ 322{
323 struct ethtool_cmd cmd; 323 struct ethtool_cmd cmd;
324 if (dev_ethtool_get_settings(dev, &cmd)) 324 if (__ethtool_get_settings(dev, &cmd))
325 return 100; /* default 100Mbps */ 325 return 100; /* default 100Mbps */
326 326
327 return ethtool_cmd_speed(&cmd); 327 return ethtool_cmd_speed(&cmd);
diff --git a/arch/mips/vr41xx/common/irq.c b/arch/mips/vr41xx/common/irq.c
index 70a3b85f3757..fad2bef432cd 100644
--- a/arch/mips/vr41xx/common/irq.c
+++ b/arch/mips/vr41xx/common/irq.c
@@ -34,6 +34,7 @@ static irq_cascade_t irq_cascade[NR_IRQS] __cacheline_aligned;
34static struct irqaction cascade_irqaction = { 34static struct irqaction cascade_irqaction = {
35 .handler = no_action, 35 .handler = no_action,
36 .name = "cascade", 36 .name = "cascade",
37 .flags = IRQF_NO_THREAD,
37}; 38};
38 39
39int cascade_irq(unsigned int irq, int (*get_irq)(unsigned int)) 40int cascade_irq(unsigned int irq, int (*get_irq)(unsigned int))
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig
index 1f870340ebdd..438db84a1f7c 100644
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@ -47,9 +47,6 @@ config GENERIC_CMOS_UPDATE
47config GENERIC_HWEIGHT 47config GENERIC_HWEIGHT
48 def_bool y 48 def_bool y
49 49
50config GENERIC_TIME
51 def_bool y
52
53config GENERIC_CLOCKEVENTS 50config GENERIC_CLOCKEVENTS
54 def_bool y 51 def_bool y
55 52
@@ -195,7 +192,7 @@ config SMP
195 singleprocessor machines. On a singleprocessor machine, the kernel 192 singleprocessor machines. On a singleprocessor machine, the kernel
196 will run faster if you say N here. 193 will run faster if you say N here.
197 194
198 See also <file:Documentation/i386/IO-APIC.txt>, 195 See also <file:Documentation/x86/i386/IO-APIC.txt>,
199 <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at 196 <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at
200 <http://www.tldp.org/docs.html#howto>. 197 <http://www.tldp.org/docs.html#howto>.
201 198
diff --git a/arch/mn10300/kernel/irq.c b/arch/mn10300/kernel/irq.c
index 2623d19f4f4c..2381df83bd00 100644
--- a/arch/mn10300/kernel/irq.c
+++ b/arch/mn10300/kernel/irq.c
@@ -260,7 +260,6 @@ void set_intr_level(int irq, u16 level)
260/* 260/*
261 * mark an interrupt to be ACK'd after interrupt handlers have been run rather 261 * mark an interrupt to be ACK'd after interrupt handlers have been run rather
262 * than before 262 * than before
263 * - see Documentation/mn10300/features.txt
264 */ 263 */
265void mn10300_set_lateack_irq_type(int irq) 264void mn10300_set_lateack_irq_type(int irq)
266{ 265{
diff --git a/arch/openrisc/Kconfig b/arch/openrisc/Kconfig
index 4558bafbd1a2..9460e1c266dd 100644
--- a/arch/openrisc/Kconfig
+++ b/arch/openrisc/Kconfig
@@ -1,6 +1,6 @@
1# 1#
2# For a description of the syntax of this configuration file, 2# For a description of the syntax of this configuration file,
3# see Documentation/kbuild/config-language.txt. 3# see Documentation/kbuild/kconfig-language.txt.
4# 4#
5 5
6config OPENRISC 6config OPENRISC
diff --git a/arch/openrisc/include/asm/dma-mapping.h b/arch/openrisc/include/asm/dma-mapping.h
index 60b472233900..b206ba4608b2 100644
--- a/arch/openrisc/include/asm/dma-mapping.h
+++ b/arch/openrisc/include/asm/dma-mapping.h
@@ -18,7 +18,7 @@
18#define __ASM_OPENRISC_DMA_MAPPING_H 18#define __ASM_OPENRISC_DMA_MAPPING_H
19 19
20/* 20/*
21 * See Documentation/PCI/PCI-DMA-mapping.txt and 21 * See Documentation/DMA-API-HOWTO.txt and
22 * Documentation/DMA-API.txt for documentation. 22 * Documentation/DMA-API.txt for documentation.
23 * 23 *
24 * This file is written with the intention of eventually moving over 24 * This file is written with the intention of eventually moving over
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index e077b0bf56ca..fdfd8be29e95 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -169,9 +169,7 @@ config 64BIT
169 169
170choice 170choice
171 prompt "Kernel page size" 171 prompt "Kernel page size"
172 default PARISC_PAGE_SIZE_4KB if !64BIT 172 default PARISC_PAGE_SIZE_4KB
173 default PARISC_PAGE_SIZE_4KB if 64BIT
174# default PARISC_PAGE_SIZE_16KB if 64BIT
175 173
176config PARISC_PAGE_SIZE_4KB 174config PARISC_PAGE_SIZE_4KB
177 bool "4KB" 175 bool "4KB"
diff --git a/arch/parisc/include/asm/compat.h b/arch/parisc/include/asm/compat.h
index efa0b60c63fe..760f331d4fa3 100644
--- a/arch/parisc/include/asm/compat.h
+++ b/arch/parisc/include/asm/compat.h
@@ -105,7 +105,8 @@ struct compat_statfs {
105 __kernel_fsid_t f_fsid; 105 __kernel_fsid_t f_fsid;
106 s32 f_namelen; 106 s32 f_namelen;
107 s32 f_frsize; 107 s32 f_frsize;
108 s32 f_spare[5]; 108 s32 f_flags;
109 s32 f_spare[4];
109}; 110};
110 111
111struct compat_sigcontext { 112struct compat_sigcontext {
diff --git a/arch/parisc/include/asm/dma-mapping.h b/arch/parisc/include/asm/dma-mapping.h
index 890531e32fe8..467bbd510eac 100644
--- a/arch/parisc/include/asm/dma-mapping.h
+++ b/arch/parisc/include/asm/dma-mapping.h
@@ -5,7 +5,7 @@
5#include <asm/cacheflush.h> 5#include <asm/cacheflush.h>
6#include <asm/scatterlist.h> 6#include <asm/scatterlist.h>
7 7
8/* See Documentation/PCI/PCI-DMA-mapping.txt */ 8/* See Documentation/DMA-API-HOWTO.txt */
9struct hppa_dma_ops { 9struct hppa_dma_ops {
10 int (*dma_supported)(struct device *dev, u64 mask); 10 int (*dma_supported)(struct device *dev, u64 mask);
11 void *(*alloc_consistent)(struct device *dev, size_t size, dma_addr_t *iova, gfp_t flag); 11 void *(*alloc_consistent)(struct device *dev, size_t size, dma_addr_t *iova, gfp_t flag);
diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
index a029f74a3c5c..d047edea2504 100644
--- a/arch/parisc/kernel/pci-dma.c
+++ b/arch/parisc/kernel/pci-dma.c
@@ -2,7 +2,7 @@
2** PARISC 1.1 Dynamic DMA mapping support. 2** PARISC 1.1 Dynamic DMA mapping support.
3** This implementation is for PA-RISC platforms that do not support 3** This implementation is for PA-RISC platforms that do not support
4** I/O TLBs (aka DMA address translation hardware). 4** I/O TLBs (aka DMA address translation hardware).
5** See Documentation/PCI/PCI-DMA-mapping.txt for interface definitions. 5** See Documentation/DMA-API-HOWTO.txt for interface definitions.
6** 6**
7** (c) Copyright 1999,2000 Hewlett-Packard Company 7** (c) Copyright 1999,2000 Hewlett-Packard Company
8** (c) Copyright 2000 Grant Grundler 8** (c) Copyright 2000 Grant Grundler
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 6926b61acfea..47682b67fd36 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -656,6 +656,8 @@ config SBUS
656 656
657config FSL_SOC 657config FSL_SOC
658 bool 658 bool
659 select HAVE_CAN_FLEXCAN if NET && CAN
660 select PPC_CLOCK if CAN_FLEXCAN
659 661
660config FSL_PCI 662config FSL_PCI
661 bool 663 bool
diff --git a/arch/powerpc/boot/dts/p1010rdb.dts b/arch/powerpc/boot/dts/p1010rdb.dts
index 6b33b73a5ba0..d6c669c888e9 100644
--- a/arch/powerpc/boot/dts/p1010rdb.dts
+++ b/arch/powerpc/boot/dts/p1010rdb.dts
@@ -23,6 +23,8 @@
23 ethernet2 = &enet2; 23 ethernet2 = &enet2;
24 pci0 = &pci0; 24 pci0 = &pci0;
25 pci1 = &pci1; 25 pci1 = &pci1;
26 can0 = &can0;
27 can1 = &can1;
26 }; 28 };
27 29
28 memory { 30 memory {
@@ -169,14 +171,6 @@
169 }; 171 };
170 }; 172 };
171 173
172 can0@1c000 {
173 fsl,flexcan-clock-source = "platform";
174 };
175
176 can1@1d000 {
177 fsl,flexcan-clock-source = "platform";
178 };
179
180 usb@22000 { 174 usb@22000 {
181 phy_type = "utmi"; 175 phy_type = "utmi";
182 }; 176 };
diff --git a/arch/powerpc/boot/dts/p1010si.dtsi b/arch/powerpc/boot/dts/p1010si.dtsi
index 7f51104f2e36..cabe0a453ae6 100644
--- a/arch/powerpc/boot/dts/p1010si.dtsi
+++ b/arch/powerpc/boot/dts/p1010si.dtsi
@@ -140,20 +140,18 @@
140 interrupt-parent = <&mpic>; 140 interrupt-parent = <&mpic>;
141 }; 141 };
142 142
143 can0@1c000 { 143 can0: can@1c000 {
144 compatible = "fsl,flexcan-v1.0"; 144 compatible = "fsl,p1010-flexcan";
145 reg = <0x1c000 0x1000>; 145 reg = <0x1c000 0x1000>;
146 interrupts = <48 0x2>; 146 interrupts = <48 0x2>;
147 interrupt-parent = <&mpic>; 147 interrupt-parent = <&mpic>;
148 fsl,flexcan-clock-divider = <2>;
149 }; 148 };
150 149
151 can1@1d000 { 150 can1: can@1d000 {
152 compatible = "fsl,flexcan-v1.0"; 151 compatible = "fsl,p1010-flexcan";
153 reg = <0x1d000 0x1000>; 152 reg = <0x1d000 0x1000>;
154 interrupts = <61 0x2>; 153 interrupts = <61 0x2>;
155 interrupt-parent = <&mpic>; 154 interrupt-parent = <&mpic>;
156 fsl,flexcan-clock-divider = <2>;
157 }; 155 };
158 156
159 L2: l2-cache-controller@20000 { 157 L2: l2-cache-controller@20000 {
diff --git a/arch/powerpc/configs/40x/acadia_defconfig b/arch/powerpc/configs/40x/acadia_defconfig
index 4182c772340b..ed3bab72a834 100644
--- a/arch/powerpc/configs/40x/acadia_defconfig
+++ b/arch/powerpc/configs/40x/acadia_defconfig
@@ -44,12 +44,13 @@ CONFIG_BLK_DEV_RAM=y
44CONFIG_BLK_DEV_RAM_SIZE=35000 44CONFIG_BLK_DEV_RAM_SIZE=35000
45# CONFIG_MISC_DEVICES is not set 45# CONFIG_MISC_DEVICES is not set
46CONFIG_NETDEVICES=y 46CONFIG_NETDEVICES=y
47CONFIG_NET_ETHERNET=y 47CONFIG_ETHERNET=y
48CONFIG_NET_VENDOR_IBM=y
48CONFIG_MII=y 49CONFIG_MII=y
49CONFIG_IBM_NEW_EMAC=y 50CONFIG_IBM_EMAC=y
50CONFIG_IBM_NEW_EMAC_RXB=256 51CONFIG_IBM_EMAC_RXB=256
51CONFIG_IBM_NEW_EMAC_TXB=256 52CONFIG_IBM_EMAC_TXB=256
52CONFIG_IBM_NEW_EMAC_DEBUG=y 53CONFIG_IBM_EMAC_DEBUG=y
53# CONFIG_NETDEV_1000 is not set 54# CONFIG_NETDEV_1000 is not set
54# CONFIG_NETDEV_10000 is not set 55# CONFIG_NETDEV_10000 is not set
55# CONFIG_INPUT is not set 56# CONFIG_INPUT is not set
diff --git a/arch/powerpc/configs/40x/ep405_defconfig b/arch/powerpc/configs/40x/ep405_defconfig
index 2dbb293163f5..17582a3420fb 100644
--- a/arch/powerpc/configs/40x/ep405_defconfig
+++ b/arch/powerpc/configs/40x/ep405_defconfig
@@ -42,8 +42,9 @@ CONFIG_PROC_DEVICETREE=y
42CONFIG_BLK_DEV_RAM=y 42CONFIG_BLK_DEV_RAM=y
43CONFIG_BLK_DEV_RAM_SIZE=35000 43CONFIG_BLK_DEV_RAM_SIZE=35000
44CONFIG_NETDEVICES=y 44CONFIG_NETDEVICES=y
45CONFIG_NET_ETHERNET=y 45CONFIG_ETHERNET=y
46CONFIG_IBM_NEW_EMAC=y 46CONFIG_NET_VENDOR_IBM=y
47CONFIG_IBM_EMAC=y
47# CONFIG_INPUT is not set 48# CONFIG_INPUT is not set
48# CONFIG_SERIO is not set 49# CONFIG_SERIO is not set
49# CONFIG_VT is not set 50# CONFIG_VT is not set
diff --git a/arch/powerpc/configs/40x/hcu4_defconfig b/arch/powerpc/configs/40x/hcu4_defconfig
index ebeb4accad65..dba263c1d3a2 100644
--- a/arch/powerpc/configs/40x/hcu4_defconfig
+++ b/arch/powerpc/configs/40x/hcu4_defconfig
@@ -43,8 +43,9 @@ CONFIG_PROC_DEVICETREE=y
43CONFIG_BLK_DEV_RAM=y 43CONFIG_BLK_DEV_RAM=y
44CONFIG_BLK_DEV_RAM_SIZE=35000 44CONFIG_BLK_DEV_RAM_SIZE=35000
45CONFIG_NETDEVICES=y 45CONFIG_NETDEVICES=y
46CONFIG_NET_ETHERNET=y 46CONFIG_ETHERNET=y
47CONFIG_IBM_NEW_EMAC=y 47CONFIG_NET_VENDOR_IBM=y
48CONFIG_IBM_EMAC=y
48# CONFIG_INPUT is not set 49# CONFIG_INPUT is not set
49# CONFIG_SERIO is not set 50# CONFIG_SERIO is not set
50# CONFIG_VT is not set 51# CONFIG_VT is not set
diff --git a/arch/powerpc/configs/40x/kilauea_defconfig b/arch/powerpc/configs/40x/kilauea_defconfig
index 532ea9d93a15..f2d4be936e08 100644
--- a/arch/powerpc/configs/40x/kilauea_defconfig
+++ b/arch/powerpc/configs/40x/kilauea_defconfig
@@ -51,10 +51,11 @@ CONFIG_BLK_DEV_RAM=y
51CONFIG_BLK_DEV_RAM_SIZE=35000 51CONFIG_BLK_DEV_RAM_SIZE=35000
52# CONFIG_MISC_DEVICES is not set 52# CONFIG_MISC_DEVICES is not set
53CONFIG_NETDEVICES=y 53CONFIG_NETDEVICES=y
54CONFIG_NET_ETHERNET=y 54CONFIG_ETHERNET=y
55CONFIG_IBM_NEW_EMAC=y 55CONFIG_NET_VENDOR_IBM=y
56CONFIG_IBM_NEW_EMAC_RXB=256 56CONFIG_IBM_EMAC=y
57CONFIG_IBM_NEW_EMAC_TXB=256 57CONFIG_IBM_EMAC_RXB=256
58CONFIG_IBM_EMAC_TXB=256
58# CONFIG_NETDEV_1000 is not set 59# CONFIG_NETDEV_1000 is not set
59# CONFIG_NETDEV_10000 is not set 60# CONFIG_NETDEV_10000 is not set
60# CONFIG_INPUT is not set 61# CONFIG_INPUT is not set
diff --git a/arch/powerpc/configs/40x/makalu_defconfig b/arch/powerpc/configs/40x/makalu_defconfig
index 3c142ac1b344..42b979355f9b 100644
--- a/arch/powerpc/configs/40x/makalu_defconfig
+++ b/arch/powerpc/configs/40x/makalu_defconfig
@@ -43,10 +43,11 @@ CONFIG_BLK_DEV_RAM=y
43CONFIG_BLK_DEV_RAM_SIZE=35000 43CONFIG_BLK_DEV_RAM_SIZE=35000
44# CONFIG_MISC_DEVICES is not set 44# CONFIG_MISC_DEVICES is not set
45CONFIG_NETDEVICES=y 45CONFIG_NETDEVICES=y
46CONFIG_NET_ETHERNET=y 46CONFIG_ETHERNET=y
47CONFIG_IBM_NEW_EMAC=y 47CONFIG_NET_VENDOR_IBM=y
48CONFIG_IBM_NEW_EMAC_RXB=256 48CONFIG_IBM_EMAC=y
49CONFIG_IBM_NEW_EMAC_TXB=256 49CONFIG_IBM_EMAC_RXB=256
50CONFIG_IBM_EMAC_TXB=256
50# CONFIG_NETDEV_1000 is not set 51# CONFIG_NETDEV_1000 is not set
51# CONFIG_NETDEV_10000 is not set 52# CONFIG_NETDEV_10000 is not set
52# CONFIG_INPUT is not set 53# CONFIG_INPUT is not set
diff --git a/arch/powerpc/configs/40x/walnut_defconfig b/arch/powerpc/configs/40x/walnut_defconfig
index ff57d4828ffc..aa1a4cac3708 100644
--- a/arch/powerpc/configs/40x/walnut_defconfig
+++ b/arch/powerpc/configs/40x/walnut_defconfig
@@ -40,8 +40,9 @@ CONFIG_PROC_DEVICETREE=y
40CONFIG_BLK_DEV_RAM=y 40CONFIG_BLK_DEV_RAM=y
41CONFIG_BLK_DEV_RAM_SIZE=35000 41CONFIG_BLK_DEV_RAM_SIZE=35000
42CONFIG_NETDEVICES=y 42CONFIG_NETDEVICES=y
43CONFIG_NET_ETHERNET=y 43CONFIG_ETHERNET=y
44CONFIG_IBM_NEW_EMAC=y 44CONFIG_NET_VENDOR_IBM=y
45CONFIG_IBM_EMAC=y
45# CONFIG_INPUT is not set 46# CONFIG_INPUT is not set
46# CONFIG_SERIO is not set 47# CONFIG_SERIO is not set
47# CONFIG_VT is not set 48# CONFIG_VT is not set
diff --git a/arch/powerpc/configs/44x/arches_defconfig b/arch/powerpc/configs/44x/arches_defconfig
index 3ed16d5c909d..329f9a3b892e 100644
--- a/arch/powerpc/configs/44x/arches_defconfig
+++ b/arch/powerpc/configs/44x/arches_defconfig
@@ -44,10 +44,11 @@ CONFIG_BLK_DEV_RAM=y
44CONFIG_BLK_DEV_RAM_SIZE=35000 44CONFIG_BLK_DEV_RAM_SIZE=35000
45# CONFIG_MISC_DEVICES is not set 45# CONFIG_MISC_DEVICES is not set
46CONFIG_NETDEVICES=y 46CONFIG_NETDEVICES=y
47CONFIG_NET_ETHERNET=y 47CONFIG_ETHERNET=y
48CONFIG_IBM_NEW_EMAC=y 48CONFIG_NET_VENDOR_IBM=y
49CONFIG_IBM_NEW_EMAC_RXB=256 49CONFIG_IBM_EMAC=y
50CONFIG_IBM_NEW_EMAC_TXB=256 50CONFIG_IBM_EMAC_RXB=256
51CONFIG_IBM_EMAC_TXB=256
51# CONFIG_NETDEV_1000 is not set 52# CONFIG_NETDEV_1000 is not set
52# CONFIG_NETDEV_10000 is not set 53# CONFIG_NETDEV_10000 is not set
53# CONFIG_INPUT is not set 54# CONFIG_INPUT is not set
diff --git a/arch/powerpc/configs/44x/bamboo_defconfig b/arch/powerpc/configs/44x/bamboo_defconfig
index b1b7d2c5c059..cef7d62560c4 100644
--- a/arch/powerpc/configs/44x/bamboo_defconfig
+++ b/arch/powerpc/configs/44x/bamboo_defconfig
@@ -32,8 +32,9 @@ CONFIG_PROC_DEVICETREE=y
32CONFIG_BLK_DEV_RAM=y 32CONFIG_BLK_DEV_RAM=y
33CONFIG_BLK_DEV_RAM_SIZE=35000 33CONFIG_BLK_DEV_RAM_SIZE=35000
34CONFIG_NETDEVICES=y 34CONFIG_NETDEVICES=y
35CONFIG_NET_ETHERNET=y 35CONFIG_ETHERNET=y
36CONFIG_IBM_NEW_EMAC=y 36CONFIG_NET_VENDOR_IBM=y
37CONFIG_IBM_EMAC=y
37# CONFIG_INPUT is not set 38# CONFIG_INPUT is not set
38# CONFIG_SERIO is not set 39# CONFIG_SERIO is not set
39# CONFIG_VT is not set 40# CONFIG_VT is not set
diff --git a/arch/powerpc/configs/44x/bluestone_defconfig b/arch/powerpc/configs/44x/bluestone_defconfig
index 30a0a8e08fdd..20c8d26d7fc0 100644
--- a/arch/powerpc/configs/44x/bluestone_defconfig
+++ b/arch/powerpc/configs/44x/bluestone_defconfig
@@ -38,10 +38,11 @@ CONFIG_PROC_DEVICETREE=y
38CONFIG_BLK_DEV_RAM=y 38CONFIG_BLK_DEV_RAM=y
39CONFIG_BLK_DEV_RAM_SIZE=35000 39CONFIG_BLK_DEV_RAM_SIZE=35000
40CONFIG_NETDEVICES=y 40CONFIG_NETDEVICES=y
41CONFIG_NET_ETHERNET=y 41CONFIG_ETHERNET=y
42CONFIG_IBM_NEW_EMAC=y 42CONFIG_NET_VENDOR_IBM=y
43CONFIG_IBM_NEW_EMAC_RXB=256 43CONFIG_IBM_EMAC=y
44CONFIG_IBM_NEW_EMAC_TXB=256 44CONFIG_IBM_EMAC_RXB=256
45CONFIG_IBM_EMAC_TXB=256
45CONFIG_SERIAL_8250=y 46CONFIG_SERIAL_8250=y
46CONFIG_SERIAL_8250_CONSOLE=y 47CONFIG_SERIAL_8250_CONSOLE=y
47CONFIG_SERIAL_8250_NR_UARTS=2 48CONFIG_SERIAL_8250_NR_UARTS=2
diff --git a/arch/powerpc/configs/44x/canyonlands_defconfig b/arch/powerpc/configs/44x/canyonlands_defconfig
index a46942aac695..d5be93e6e92d 100644
--- a/arch/powerpc/configs/44x/canyonlands_defconfig
+++ b/arch/powerpc/configs/44x/canyonlands_defconfig
@@ -49,10 +49,11 @@ CONFIG_BLK_DEV_RAM=y
49CONFIG_BLK_DEV_RAM_SIZE=35000 49CONFIG_BLK_DEV_RAM_SIZE=35000
50# CONFIG_MISC_DEVICES is not set 50# CONFIG_MISC_DEVICES is not set
51CONFIG_NETDEVICES=y 51CONFIG_NETDEVICES=y
52CONFIG_NET_ETHERNET=y 52CONFIG_ETHERNET=y
53CONFIG_IBM_NEW_EMAC=y 53CONFIG_NET_VENDOR_IBM=y
54CONFIG_IBM_NEW_EMAC_RXB=256 54CONFIG_IBM_EMAC=y
55CONFIG_IBM_NEW_EMAC_TXB=256 55CONFIG_IBM_EMAC_RXB=256
56CONFIG_IBM_EMAC_TXB=256
56# CONFIG_NETDEV_1000 is not set 57# CONFIG_NETDEV_1000 is not set
57# CONFIG_NETDEV_10000 is not set 58# CONFIG_NETDEV_10000 is not set
58# CONFIG_INPUT is not set 59# CONFIG_INPUT is not set
diff --git a/arch/powerpc/configs/44x/ebony_defconfig b/arch/powerpc/configs/44x/ebony_defconfig
index 07d77e51f1ba..f9269fc4ffcc 100644
--- a/arch/powerpc/configs/44x/ebony_defconfig
+++ b/arch/powerpc/configs/44x/ebony_defconfig
@@ -40,8 +40,9 @@ CONFIG_PROC_DEVICETREE=y
40CONFIG_BLK_DEV_RAM=y 40CONFIG_BLK_DEV_RAM=y
41CONFIG_BLK_DEV_RAM_SIZE=35000 41CONFIG_BLK_DEV_RAM_SIZE=35000
42CONFIG_NETDEVICES=y 42CONFIG_NETDEVICES=y
43CONFIG_NET_ETHERNET=y 43CONFIG_ETHERNET=y
44CONFIG_IBM_NEW_EMAC=y 44CONFIG_NET_VENDOR_IBM=y
45CONFIG_IBM_EMAC=y
45# CONFIG_INPUT is not set 46# CONFIG_INPUT is not set
46# CONFIG_SERIO is not set 47# CONFIG_SERIO is not set
47# CONFIG_VT is not set 48# CONFIG_VT is not set
diff --git a/arch/powerpc/configs/44x/eiger_defconfig b/arch/powerpc/configs/44x/eiger_defconfig
index 2ce7e9aff09e..9be089038fd7 100644
--- a/arch/powerpc/configs/44x/eiger_defconfig
+++ b/arch/powerpc/configs/44x/eiger_defconfig
@@ -55,10 +55,11 @@ CONFIG_FUSION=y
55CONFIG_FUSION_SAS=y 55CONFIG_FUSION_SAS=y
56CONFIG_I2O=y 56CONFIG_I2O=y
57CONFIG_NETDEVICES=y 57CONFIG_NETDEVICES=y
58CONFIG_NET_ETHERNET=y 58CONFIG_ETHERNET=y
59CONFIG_IBM_NEW_EMAC=y 59CONFIG_NET_VENDOR_IBM=y
60CONFIG_IBM_NEW_EMAC_RXB=256 60CONFIG_IBM_EMAC=y
61CONFIG_IBM_NEW_EMAC_TXB=256 61CONFIG_IBM_EMAC_RXB=256
62CONFIG_IBM_EMAC_TXB=256
62CONFIG_E1000E=y 63CONFIG_E1000E=y
63# CONFIG_NETDEV_10000 is not set 64# CONFIG_NETDEV_10000 is not set
64# CONFIG_INPUT is not set 65# CONFIG_INPUT is not set
diff --git a/arch/powerpc/configs/44x/icon_defconfig b/arch/powerpc/configs/44x/icon_defconfig
index 18730ff9de7c..82f73035a7ce 100644
--- a/arch/powerpc/configs/44x/icon_defconfig
+++ b/arch/powerpc/configs/44x/icon_defconfig
@@ -56,8 +56,9 @@ CONFIG_FUSION_SAS=y
56CONFIG_FUSION_CTL=y 56CONFIG_FUSION_CTL=y
57CONFIG_FUSION_LOGGING=y 57CONFIG_FUSION_LOGGING=y
58CONFIG_NETDEVICES=y 58CONFIG_NETDEVICES=y
59CONFIG_NET_ETHERNET=y 59CONFIG_ETHERNET=y
60CONFIG_IBM_NEW_EMAC=y 60CONFIG_NET_VENDOR_IBM=y
61CONFIG_IBM_EMAC=y
61# CONFIG_NETDEV_1000 is not set 62# CONFIG_NETDEV_1000 is not set
62# CONFIG_NETDEV_10000 is not set 63# CONFIG_NETDEV_10000 is not set
63# CONFIG_WLAN is not set 64# CONFIG_WLAN is not set
diff --git a/arch/powerpc/configs/44x/katmai_defconfig b/arch/powerpc/configs/44x/katmai_defconfig
index 34c09144a699..109562c3c6be 100644
--- a/arch/powerpc/configs/44x/katmai_defconfig
+++ b/arch/powerpc/configs/44x/katmai_defconfig
@@ -42,8 +42,9 @@ CONFIG_BLK_DEV_RAM=y
42CONFIG_BLK_DEV_RAM_SIZE=35000 42CONFIG_BLK_DEV_RAM_SIZE=35000
43CONFIG_MACINTOSH_DRIVERS=y 43CONFIG_MACINTOSH_DRIVERS=y
44CONFIG_NETDEVICES=y 44CONFIG_NETDEVICES=y
45CONFIG_NET_ETHERNET=y 45CONFIG_ETHERNET=y
46CONFIG_IBM_NEW_EMAC=y 46CONFIG_NET_VENDOR_IBM=y
47CONFIG_IBM_EMAC=y
47# CONFIG_INPUT is not set 48# CONFIG_INPUT is not set
48# CONFIG_SERIO is not set 49# CONFIG_SERIO is not set
49# CONFIG_VT is not set 50# CONFIG_VT is not set
diff --git a/arch/powerpc/configs/44x/redwood_defconfig b/arch/powerpc/configs/44x/redwood_defconfig
index 01cc2b1a7f9a..48802811da76 100644
--- a/arch/powerpc/configs/44x/redwood_defconfig
+++ b/arch/powerpc/configs/44x/redwood_defconfig
@@ -53,11 +53,12 @@ CONFIG_FUSION=y
53CONFIG_FUSION_SAS=y 53CONFIG_FUSION_SAS=y
54CONFIG_I2O=y 54CONFIG_I2O=y
55CONFIG_NETDEVICES=y 55CONFIG_NETDEVICES=y
56CONFIG_NET_ETHERNET=y 56CONFIG_ETHERNET=y
57CONFIG_IBM_NEW_EMAC=y 57CONFIG_NET_VENDOR_IBM=y
58CONFIG_IBM_NEW_EMAC_RXB=256 58CONFIG_IBM_EMAC=y
59CONFIG_IBM_NEW_EMAC_TXB=256 59CONFIG_IBM_EMAC_RXB=256
60CONFIG_IBM_NEW_EMAC_DEBUG=y 60CONFIG_IBM_EMAC_TXB=256
61CONFIG_IBM_EMAC_DEBUG=y
61CONFIG_E1000E=y 62CONFIG_E1000E=y
62# CONFIG_NETDEV_10000 is not set 63# CONFIG_NETDEV_10000 is not set
63# CONFIG_INPUT is not set 64# CONFIG_INPUT is not set
diff --git a/arch/powerpc/configs/44x/sam440ep_defconfig b/arch/powerpc/configs/44x/sam440ep_defconfig
index dfcffede16ad..ca088cd581af 100644
--- a/arch/powerpc/configs/44x/sam440ep_defconfig
+++ b/arch/powerpc/configs/44x/sam440ep_defconfig
@@ -44,8 +44,9 @@ CONFIG_ATA=y
44# CONFIG_SATA_PMP is not set 44# CONFIG_SATA_PMP is not set
45CONFIG_SATA_SIL=y 45CONFIG_SATA_SIL=y
46CONFIG_NETDEVICES=y 46CONFIG_NETDEVICES=y
47CONFIG_NET_ETHERNET=y 47CONFIG_ETHERNET=y
48CONFIG_IBM_NEW_EMAC=y 48CONFIG_NET_VENDOR_IBM=y
49CONFIG_IBM_EMAC=y
49# CONFIG_NETDEV_1000 is not set 50# CONFIG_NETDEV_1000 is not set
50# CONFIG_NETDEV_10000 is not set 51# CONFIG_NETDEV_10000 is not set
51CONFIG_INPUT_FF_MEMLESS=m 52CONFIG_INPUT_FF_MEMLESS=m
diff --git a/arch/powerpc/configs/44x/sequoia_defconfig b/arch/powerpc/configs/44x/sequoia_defconfig
index 47e399f2892f..b7a653b626db 100644
--- a/arch/powerpc/configs/44x/sequoia_defconfig
+++ b/arch/powerpc/configs/44x/sequoia_defconfig
@@ -46,8 +46,9 @@ CONFIG_PROC_DEVICETREE=y
46CONFIG_BLK_DEV_RAM=y 46CONFIG_BLK_DEV_RAM=y
47CONFIG_BLK_DEV_RAM_SIZE=35000 47CONFIG_BLK_DEV_RAM_SIZE=35000
48CONFIG_NETDEVICES=y 48CONFIG_NETDEVICES=y
49CONFIG_NET_ETHERNET=y 49CONFIG_ETHERNET=y
50CONFIG_IBM_NEW_EMAC=y 50CONFIG_NET_VENDOR_IBM=y
51CONFIG_IBM_EMAC=y
51# CONFIG_INPUT is not set 52# CONFIG_INPUT is not set
52# CONFIG_SERIO is not set 53# CONFIG_SERIO is not set
53# CONFIG_VT is not set 54# CONFIG_VT is not set
diff --git a/arch/powerpc/configs/44x/taishan_defconfig b/arch/powerpc/configs/44x/taishan_defconfig
index a6a002ed5681..30de97f158a4 100644
--- a/arch/powerpc/configs/44x/taishan_defconfig
+++ b/arch/powerpc/configs/44x/taishan_defconfig
@@ -40,8 +40,9 @@ CONFIG_BLK_DEV_RAM=y
40CONFIG_BLK_DEV_RAM_SIZE=35000 40CONFIG_BLK_DEV_RAM_SIZE=35000
41CONFIG_MACINTOSH_DRIVERS=y 41CONFIG_MACINTOSH_DRIVERS=y
42CONFIG_NETDEVICES=y 42CONFIG_NETDEVICES=y
43CONFIG_NET_ETHERNET=y 43CONFIG_ETHERNET=y
44CONFIG_IBM_NEW_EMAC=y 44CONFIG_NET_VENDOR_IBM=y
45CONFIG_IBM_EMAC=y
45# CONFIG_INPUT is not set 46# CONFIG_INPUT is not set
46# CONFIG_SERIO is not set 47# CONFIG_SERIO is not set
47# CONFIG_VT is not set 48# CONFIG_VT is not set
diff --git a/arch/powerpc/configs/44x/warp_defconfig b/arch/powerpc/configs/44x/warp_defconfig
index abf74dc1f79c..105bc56f4b2b 100644
--- a/arch/powerpc/configs/44x/warp_defconfig
+++ b/arch/powerpc/configs/44x/warp_defconfig
@@ -54,9 +54,10 @@ CONFIG_BLK_DEV_SD=y
54CONFIG_SCSI_SPI_ATTRS=y 54CONFIG_SCSI_SPI_ATTRS=y
55# CONFIG_SCSI_LOWLEVEL is not set 55# CONFIG_SCSI_LOWLEVEL is not set
56CONFIG_NETDEVICES=y 56CONFIG_NETDEVICES=y
57CONFIG_NET_ETHERNET=y 57CONFIG_ETHERNET=y
58CONFIG_NET_VENDOR_IBM=y
58CONFIG_MII=y 59CONFIG_MII=y
59CONFIG_IBM_NEW_EMAC=y 60CONFIG_IBM_EMAC=y
60# CONFIG_NETDEV_1000 is not set 61# CONFIG_NETDEV_1000 is not set
61# CONFIG_NETDEV_10000 is not set 62# CONFIG_NETDEV_10000 is not set
62# CONFIG_INPUT is not set 63# CONFIG_INPUT is not set
diff --git a/arch/powerpc/configs/ppc40x_defconfig b/arch/powerpc/configs/ppc40x_defconfig
index bfd634b5ada7..7cb703b948b1 100644
--- a/arch/powerpc/configs/ppc40x_defconfig
+++ b/arch/powerpc/configs/ppc40x_defconfig
@@ -50,8 +50,9 @@ CONFIG_BLK_DEV_RAM=y
50CONFIG_BLK_DEV_RAM_SIZE=35000 50CONFIG_BLK_DEV_RAM_SIZE=35000
51CONFIG_XILINX_SYSACE=m 51CONFIG_XILINX_SYSACE=m
52CONFIG_NETDEVICES=y 52CONFIG_NETDEVICES=y
53CONFIG_NET_ETHERNET=y 53CONFIG_ETHERNET=y
54CONFIG_IBM_NEW_EMAC=y 54CONFIG_NET_VENDOR_IBM=y
55CONFIG_IBM_EMAC=y
55# CONFIG_INPUT is not set 56# CONFIG_INPUT is not set
56CONFIG_SERIO=m 57CONFIG_SERIO=m
57# CONFIG_SERIO_I8042 is not set 58# CONFIG_SERIO_I8042 is not set
diff --git a/arch/powerpc/configs/ppc44x_defconfig b/arch/powerpc/configs/ppc44x_defconfig
index 47133202a625..6cdf1c0d2c8a 100644
--- a/arch/powerpc/configs/ppc44x_defconfig
+++ b/arch/powerpc/configs/ppc44x_defconfig
@@ -63,8 +63,9 @@ CONFIG_BLK_DEV_SD=m
63# CONFIG_SCSI_LOWLEVEL is not set 63# CONFIG_SCSI_LOWLEVEL is not set
64CONFIG_NETDEVICES=y 64CONFIG_NETDEVICES=y
65CONFIG_TUN=m 65CONFIG_TUN=m
66CONFIG_NET_ETHERNET=y 66CONFIG_ETHERNET=y
67CONFIG_IBM_NEW_EMAC=y 67CONFIG_NET_VENDOR_IBM=y
68CONFIG_IBM_EMAC=y
68# CONFIG_INPUT is not set 69# CONFIG_INPUT is not set
69CONFIG_SERIO=m 70CONFIG_SERIO=m
70# CONFIG_SERIO_I8042 is not set 71# CONFIG_SERIO_I8042 is not set
diff --git a/arch/powerpc/include/asm/compat.h b/arch/powerpc/include/asm/compat.h
index 91010e8f8479..88e602f6430d 100644
--- a/arch/powerpc/include/asm/compat.h
+++ b/arch/powerpc/include/asm/compat.h
@@ -100,7 +100,8 @@ struct compat_statfs {
100 compat_fsid_t f_fsid; 100 compat_fsid_t f_fsid;
101 int f_namelen; /* SunOS ignores this field. */ 101 int f_namelen; /* SunOS ignores this field. */
102 int f_frsize; 102 int f_frsize;
103 int f_spare[5]; 103 int f_flags;
104 int f_spare[4];
104}; 105};
105 106
106#define COMPAT_RLIM_OLD_INFINITY 0x7fffffff 107#define COMPAT_RLIM_OLD_INFINITY 0x7fffffff
diff --git a/arch/powerpc/include/asm/qe.h b/arch/powerpc/include/asm/qe.h
index 0947b36e534c..5e0b6d511e14 100644
--- a/arch/powerpc/include/asm/qe.h
+++ b/arch/powerpc/include/asm/qe.h
@@ -196,7 +196,7 @@ static inline int qe_alive_during_sleep(void)
196 196
197/* Structure that defines QE firmware binary files. 197/* Structure that defines QE firmware binary files.
198 * 198 *
199 * See Documentation/powerpc/qe-firmware.txt for a description of these 199 * See Documentation/powerpc/qe_firmware.txt for a description of these
200 * fields. 200 * fields.
201 */ 201 */
202struct qe_firmware { 202struct qe_firmware {
diff --git a/arch/powerpc/include/asm/udbg.h b/arch/powerpc/include/asm/udbg.h
index 93e05d1b34b2..5354ae91bdde 100644
--- a/arch/powerpc/include/asm/udbg.h
+++ b/arch/powerpc/include/asm/udbg.h
@@ -54,6 +54,7 @@ extern void __init udbg_init_40x_realmode(void);
54extern void __init udbg_init_cpm(void); 54extern void __init udbg_init_cpm(void);
55extern void __init udbg_init_usbgecko(void); 55extern void __init udbg_init_usbgecko(void);
56extern void __init udbg_init_wsp(void); 56extern void __init udbg_init_wsp(void);
57extern void __init udbg_init_ehv_bc(void);
57 58
58#endif /* __KERNEL__ */ 59#endif /* __KERNEL__ */
59#endif /* _ASM_POWERPC_UDBG_H */ 60#endif /* _ASM_POWERPC_UDBG_H */
diff --git a/arch/powerpc/kernel/udbg.c b/arch/powerpc/kernel/udbg.c
index faa82c1f3f68..b4607a91d1f4 100644
--- a/arch/powerpc/kernel/udbg.c
+++ b/arch/powerpc/kernel/udbg.c
@@ -67,6 +67,8 @@ void __init udbg_early_init(void)
67 udbg_init_usbgecko(); 67 udbg_init_usbgecko();
68#elif defined(CONFIG_PPC_EARLY_DEBUG_WSP) 68#elif defined(CONFIG_PPC_EARLY_DEBUG_WSP)
69 udbg_init_wsp(); 69 udbg_init_wsp();
70#elif defined(CONFIG_PPC_EARLY_DEBUG_EHV_BC)
71 udbg_init_ehv_bc();
70#endif 72#endif
71 73
72#ifdef CONFIG_PPC_EARLY_DEBUG 74#ifdef CONFIG_PPC_EARLY_DEBUG
diff --git a/arch/powerpc/platforms/40x/Kconfig b/arch/powerpc/platforms/40x/Kconfig
index d733d7ca939c..b5d87067a58b 100644
--- a/arch/powerpc/platforms/40x/Kconfig
+++ b/arch/powerpc/platforms/40x/Kconfig
@@ -130,21 +130,21 @@ config 405GP
130 bool 130 bool
131 select IBM405_ERR77 131 select IBM405_ERR77
132 select IBM405_ERR51 132 select IBM405_ERR51
133 select IBM_NEW_EMAC_ZMII 133 select IBM_EMAC_ZMII
134 134
135config 405EP 135config 405EP
136 bool 136 bool
137 137
138config 405EX 138config 405EX
139 bool 139 bool
140 select IBM_NEW_EMAC_EMAC4 140 select IBM_EMAC_EMAC4
141 select IBM_NEW_EMAC_RGMII 141 select IBM_EMAC_RGMII
142 142
143config 405EZ 143config 405EZ
144 bool 144 bool
145 select IBM_NEW_EMAC_NO_FLOW_CTRL 145 select IBM_EMAC_NO_FLOW_CTRL
146 select IBM_NEW_EMAC_MAL_CLR_ICINTSTAT 146 select IBM_EMAC_MAL_CLR_ICINTSTAT
147 select IBM_NEW_EMAC_MAL_COMMON_ERR 147 select IBM_EMAC_MAL_COMMON_ERR
148 148
149config 405GPR 149config 405GPR
150 bool 150 bool
diff --git a/arch/powerpc/platforms/44x/Kconfig b/arch/powerpc/platforms/44x/Kconfig
index e958b6f48ec2..762322ce24a9 100644
--- a/arch/powerpc/platforms/44x/Kconfig
+++ b/arch/powerpc/platforms/44x/Kconfig
@@ -23,7 +23,7 @@ config BLUESTONE
23 default n 23 default n
24 select PPC44x_SIMPLE 24 select PPC44x_SIMPLE
25 select APM821xx 25 select APM821xx
26 select IBM_NEW_EMAC_RGMII 26 select IBM_EMAC_RGMII
27 help 27 help
28 This option enables support for the APM APM821xx Evaluation board. 28 This option enables support for the APM APM821xx Evaluation board.
29 29
@@ -122,8 +122,8 @@ config CANYONLANDS
122 select PPC4xx_PCI_EXPRESS 122 select PPC4xx_PCI_EXPRESS
123 select PCI_MSI 123 select PCI_MSI
124 select PPC4xx_MSI 124 select PPC4xx_MSI
125 select IBM_NEW_EMAC_RGMII 125 select IBM_EMAC_RGMII
126 select IBM_NEW_EMAC_ZMII 126 select IBM_EMAC_ZMII
127 help 127 help
128 This option enables support for the AMCC PPC460EX evaluation board. 128 This option enables support for the AMCC PPC460EX evaluation board.
129 129
@@ -135,8 +135,8 @@ config GLACIER
135 select 460EX # Odd since it uses 460GT but the effects are the same 135 select 460EX # Odd since it uses 460GT but the effects are the same
136 select PCI 136 select PCI
137 select PPC4xx_PCI_EXPRESS 137 select PPC4xx_PCI_EXPRESS
138 select IBM_NEW_EMAC_RGMII 138 select IBM_EMAC_RGMII
139 select IBM_NEW_EMAC_ZMII 139 select IBM_EMAC_ZMII
140 help 140 help
141 This option enables support for the AMCC PPC460GT evaluation board. 141 This option enables support for the AMCC PPC460GT evaluation board.
142 142
@@ -161,7 +161,7 @@ config EIGER
161 select 460SX 161 select 460SX
162 select PCI 162 select PCI
163 select PPC4xx_PCI_EXPRESS 163 select PPC4xx_PCI_EXPRESS
164 select IBM_NEW_EMAC_RGMII 164 select IBM_EMAC_RGMII
165 help 165 help
166 This option enables support for the AMCC PPC460SX evaluation board. 166 This option enables support for the AMCC PPC460SX evaluation board.
167 167
@@ -260,59 +260,59 @@ config 440EP
260 bool 260 bool
261 select PPC_FPU 261 select PPC_FPU
262 select IBM440EP_ERR42 262 select IBM440EP_ERR42
263 select IBM_NEW_EMAC_ZMII 263 select IBM_EMAC_ZMII
264 select USB_ARCH_HAS_OHCI 264 select USB_ARCH_HAS_OHCI
265 265
266config 440EPX 266config 440EPX
267 bool 267 bool
268 select PPC_FPU 268 select PPC_FPU
269 select IBM_NEW_EMAC_EMAC4 269 select IBM_EMAC_EMAC4
270 select IBM_NEW_EMAC_RGMII 270 select IBM_EMAC_RGMII
271 select IBM_NEW_EMAC_ZMII 271 select IBM_EMAC_ZMII
272 272
273config 440GRX 273config 440GRX
274 bool 274 bool
275 select IBM_NEW_EMAC_EMAC4 275 select IBM_EMAC_EMAC4
276 select IBM_NEW_EMAC_RGMII 276 select IBM_EMAC_RGMII
277 select IBM_NEW_EMAC_ZMII 277 select IBM_EMAC_ZMII
278 278
279config 440GP 279config 440GP
280 bool 280 bool
281 select IBM_NEW_EMAC_ZMII 281 select IBM_EMAC_ZMII
282 282
283config 440GX 283config 440GX
284 bool 284 bool
285 select IBM_NEW_EMAC_EMAC4 285 select IBM_EMAC_EMAC4
286 select IBM_NEW_EMAC_RGMII 286 select IBM_EMAC_RGMII
287 select IBM_NEW_EMAC_ZMII #test only 287 select IBM_EMAC_ZMII #test only
288 select IBM_NEW_EMAC_TAH #test only 288 select IBM_EMAC_TAH #test only
289 289
290config 440SP 290config 440SP
291 bool 291 bool
292 292
293config 440SPe 293config 440SPe
294 bool 294 bool
295 select IBM_NEW_EMAC_EMAC4 295 select IBM_EMAC_EMAC4
296 296
297config 460EX 297config 460EX
298 bool 298 bool
299 select PPC_FPU 299 select PPC_FPU
300 select IBM_NEW_EMAC_EMAC4 300 select IBM_EMAC_EMAC4
301 select IBM_NEW_EMAC_TAH 301 select IBM_EMAC_TAH
302 302
303config 460SX 303config 460SX
304 bool 304 bool
305 select PPC_FPU 305 select PPC_FPU
306 select IBM_NEW_EMAC_EMAC4 306 select IBM_EMAC_EMAC4
307 select IBM_NEW_EMAC_RGMII 307 select IBM_EMAC_RGMII
308 select IBM_NEW_EMAC_ZMII 308 select IBM_EMAC_ZMII
309 select IBM_NEW_EMAC_TAH 309 select IBM_EMAC_TAH
310 310
311config APM821xx 311config APM821xx
312 bool 312 bool
313 select PPC_FPU 313 select PPC_FPU
314 select IBM_NEW_EMAC_EMAC4 314 select IBM_EMAC_EMAC4
315 select IBM_NEW_EMAC_TAH 315 select IBM_EMAC_TAH
316 316
317# 44x errata/workaround config symbols, selected by the CPU models above 317# 44x errata/workaround config symbols, selected by the CPU models above
318config IBM440EP_ERR42 318config IBM440EP_ERR42
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index 498534cd5265..12f5932dadc9 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -80,7 +80,7 @@ config P1010_RDB
80config P1022_DS 80config P1022_DS
81 bool "Freescale P1022 DS" 81 bool "Freescale P1022 DS"
82 select DEFAULT_UIMAGE 82 select DEFAULT_UIMAGE
83 select CONFIG_PHYS_64BIT # The DTS has 36-bit addresses 83 select PHYS_64BIT # The DTS has 36-bit addresses
84 select SWIOTLB 84 select SWIOTLB
85 help 85 help
86 This option enables support for the Freescale P1022DS reference board. 86 This option enables support for the Freescale P1022DS reference board.
diff --git a/arch/powerpc/platforms/cell/Kconfig b/arch/powerpc/platforms/cell/Kconfig
index 67d5009b4e86..2e7ff0c5cf42 100644
--- a/arch/powerpc/platforms/cell/Kconfig
+++ b/arch/powerpc/platforms/cell/Kconfig
@@ -17,10 +17,10 @@ config PPC_CELL_NATIVE
17 select PPC_CELL_COMMON 17 select PPC_CELL_COMMON
18 select MPIC 18 select MPIC
19 select PPC_IO_WORKAROUNDS 19 select PPC_IO_WORKAROUNDS
20 select IBM_NEW_EMAC_EMAC4 20 select IBM_EMAC_EMAC4
21 select IBM_NEW_EMAC_RGMII 21 select IBM_EMAC_RGMII
22 select IBM_NEW_EMAC_ZMII #test only 22 select IBM_EMAC_ZMII #test only
23 select IBM_NEW_EMAC_TAH #test only 23 select IBM_EMAC_TAH #test only
24 default n 24 default n
25 25
26config PPC_IBM_CELL_BLADE 26config PPC_IBM_CELL_BLADE
diff --git a/arch/powerpc/platforms/embedded6xx/storcenter.c b/arch/powerpc/platforms/embedded6xx/storcenter.c
index 613070e9ddbe..f1eebcae9bf0 100644
--- a/arch/powerpc/platforms/embedded6xx/storcenter.c
+++ b/arch/powerpc/platforms/embedded6xx/storcenter.c
@@ -77,7 +77,7 @@ static void __init storcenter_setup_arch(void)
77} 77}
78 78
79/* 79/*
80 * Interrupt setup and service. Interrrupts on the turbostation come 80 * Interrupt setup and service. Interrupts on the turbostation come
81 * from the four PCI slots plus onboard 8241 devices: I2C, DUART. 81 * from the four PCI slots plus onboard 8241 devices: I2C, DUART.
82 */ 82 */
83static void __init storcenter_init_IRQ(void) 83static void __init storcenter_init_IRQ(void)
diff --git a/arch/powerpc/platforms/powermac/pci.c b/arch/powerpc/platforms/powermac/pci.c
index 5cc83851ad06..31a7d3a7ce25 100644
--- a/arch/powerpc/platforms/powermac/pci.c
+++ b/arch/powerpc/platforms/powermac/pci.c
@@ -561,6 +561,20 @@ static struct pci_ops u4_pcie_pci_ops =
561 .write = u4_pcie_write_config, 561 .write = u4_pcie_write_config,
562}; 562};
563 563
564static void __devinit pmac_pci_fixup_u4_of_node(struct pci_dev *dev)
565{
566 /* Apple's device-tree "hides" the root complex virtual P2P bridge
567 * on U4. However, Linux sees it, causing the PCI <-> OF matching
568 * code to fail to properly match devices below it. This works around
569 * it by setting the node of the bridge to point to the PHB node,
570 * which is not entirely correct but fixes the matching code and
571 * doesn't break anything else. It's also the simplest possible fix.
572 */
573 if (dev->dev.of_node == NULL)
574 dev->dev.of_node = pcibios_get_phb_of_node(dev->bus);
575}
576DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_APPLE, 0x5b, pmac_pci_fixup_u4_of_node);
577
564#endif /* CONFIG_PPC64 */ 578#endif /* CONFIG_PPC64 */
565 579
566#ifdef CONFIG_PPC32 580#ifdef CONFIG_PPC32
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index 904c6cbaf45b..3363fbc964f8 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -382,7 +382,7 @@ static void qe_upload_microcode(const void *base,
382/* 382/*
383 * Upload a microcode to the I-RAM at a specific address. 383 * Upload a microcode to the I-RAM at a specific address.
384 * 384 *
385 * See Documentation/powerpc/qe-firmware.txt for information on QE microcode 385 * See Documentation/powerpc/qe_firmware.txt for information on QE microcode
386 * uploading. 386 * uploading.
387 * 387 *
388 * Currently, only version 1 is supported, so the 'version' field must be 388 * Currently, only version 1 is supported, so the 'version' field must be
diff --git a/arch/powerpc/sysdev/uic.c b/arch/powerpc/sysdev/uic.c
index 984cd2029158..3330feca7502 100644
--- a/arch/powerpc/sysdev/uic.c
+++ b/arch/powerpc/sysdev/uic.c
@@ -47,7 +47,7 @@ struct uic {
47 int index; 47 int index;
48 int dcrbase; 48 int dcrbase;
49 49
50 spinlock_t lock; 50 raw_spinlock_t lock;
51 51
52 /* The remapper for this UIC */ 52 /* The remapper for this UIC */
53 struct irq_host *irqhost; 53 struct irq_host *irqhost;
@@ -61,14 +61,14 @@ static void uic_unmask_irq(struct irq_data *d)
61 u32 er, sr; 61 u32 er, sr;
62 62
63 sr = 1 << (31-src); 63 sr = 1 << (31-src);
64 spin_lock_irqsave(&uic->lock, flags); 64 raw_spin_lock_irqsave(&uic->lock, flags);
65 /* ack level-triggered interrupts here */ 65 /* ack level-triggered interrupts here */
66 if (irqd_is_level_type(d)) 66 if (irqd_is_level_type(d))
67 mtdcr(uic->dcrbase + UIC_SR, sr); 67 mtdcr(uic->dcrbase + UIC_SR, sr);
68 er = mfdcr(uic->dcrbase + UIC_ER); 68 er = mfdcr(uic->dcrbase + UIC_ER);
69 er |= sr; 69 er |= sr;
70 mtdcr(uic->dcrbase + UIC_ER, er); 70 mtdcr(uic->dcrbase + UIC_ER, er);
71 spin_unlock_irqrestore(&uic->lock, flags); 71 raw_spin_unlock_irqrestore(&uic->lock, flags);
72} 72}
73 73
74static void uic_mask_irq(struct irq_data *d) 74static void uic_mask_irq(struct irq_data *d)
@@ -78,11 +78,11 @@ static void uic_mask_irq(struct irq_data *d)
78 unsigned long flags; 78 unsigned long flags;
79 u32 er; 79 u32 er;
80 80
81 spin_lock_irqsave(&uic->lock, flags); 81 raw_spin_lock_irqsave(&uic->lock, flags);
82 er = mfdcr(uic->dcrbase + UIC_ER); 82 er = mfdcr(uic->dcrbase + UIC_ER);
83 er &= ~(1 << (31 - src)); 83 er &= ~(1 << (31 - src));
84 mtdcr(uic->dcrbase + UIC_ER, er); 84 mtdcr(uic->dcrbase + UIC_ER, er);
85 spin_unlock_irqrestore(&uic->lock, flags); 85 raw_spin_unlock_irqrestore(&uic->lock, flags);
86} 86}
87 87
88static void uic_ack_irq(struct irq_data *d) 88static void uic_ack_irq(struct irq_data *d)
@@ -91,9 +91,9 @@ static void uic_ack_irq(struct irq_data *d)
91 unsigned int src = irqd_to_hwirq(d); 91 unsigned int src = irqd_to_hwirq(d);
92 unsigned long flags; 92 unsigned long flags;
93 93
94 spin_lock_irqsave(&uic->lock, flags); 94 raw_spin_lock_irqsave(&uic->lock, flags);
95 mtdcr(uic->dcrbase + UIC_SR, 1 << (31-src)); 95 mtdcr(uic->dcrbase + UIC_SR, 1 << (31-src));
96 spin_unlock_irqrestore(&uic->lock, flags); 96 raw_spin_unlock_irqrestore(&uic->lock, flags);
97} 97}
98 98
99static void uic_mask_ack_irq(struct irq_data *d) 99static void uic_mask_ack_irq(struct irq_data *d)
@@ -104,7 +104,7 @@ static void uic_mask_ack_irq(struct irq_data *d)
104 u32 er, sr; 104 u32 er, sr;
105 105
106 sr = 1 << (31-src); 106 sr = 1 << (31-src);
107 spin_lock_irqsave(&uic->lock, flags); 107 raw_spin_lock_irqsave(&uic->lock, flags);
108 er = mfdcr(uic->dcrbase + UIC_ER); 108 er = mfdcr(uic->dcrbase + UIC_ER);
109 er &= ~sr; 109 er &= ~sr;
110 mtdcr(uic->dcrbase + UIC_ER, er); 110 mtdcr(uic->dcrbase + UIC_ER, er);
@@ -118,7 +118,7 @@ static void uic_mask_ack_irq(struct irq_data *d)
118 */ 118 */
119 if (!irqd_is_level_type(d)) 119 if (!irqd_is_level_type(d))
120 mtdcr(uic->dcrbase + UIC_SR, sr); 120 mtdcr(uic->dcrbase + UIC_SR, sr);
121 spin_unlock_irqrestore(&uic->lock, flags); 121 raw_spin_unlock_irqrestore(&uic->lock, flags);
122} 122}
123 123
124static int uic_set_irq_type(struct irq_data *d, unsigned int flow_type) 124static int uic_set_irq_type(struct irq_data *d, unsigned int flow_type)
@@ -152,7 +152,7 @@ static int uic_set_irq_type(struct irq_data *d, unsigned int flow_type)
152 152
153 mask = ~(1 << (31 - src)); 153 mask = ~(1 << (31 - src));
154 154
155 spin_lock_irqsave(&uic->lock, flags); 155 raw_spin_lock_irqsave(&uic->lock, flags);
156 tr = mfdcr(uic->dcrbase + UIC_TR); 156 tr = mfdcr(uic->dcrbase + UIC_TR);
157 pr = mfdcr(uic->dcrbase + UIC_PR); 157 pr = mfdcr(uic->dcrbase + UIC_PR);
158 tr = (tr & mask) | (trigger << (31-src)); 158 tr = (tr & mask) | (trigger << (31-src));
@@ -161,7 +161,7 @@ static int uic_set_irq_type(struct irq_data *d, unsigned int flow_type)
161 mtdcr(uic->dcrbase + UIC_PR, pr); 161 mtdcr(uic->dcrbase + UIC_PR, pr);
162 mtdcr(uic->dcrbase + UIC_TR, tr); 162 mtdcr(uic->dcrbase + UIC_TR, tr);
163 163
164 spin_unlock_irqrestore(&uic->lock, flags); 164 raw_spin_unlock_irqrestore(&uic->lock, flags);
165 165
166 return 0; 166 return 0;
167} 167}
@@ -254,7 +254,7 @@ static struct uic * __init uic_init_one(struct device_node *node)
254 if (! uic) 254 if (! uic)
255 return NULL; /* FIXME: panic? */ 255 return NULL; /* FIXME: panic? */
256 256
257 spin_lock_init(&uic->lock); 257 raw_spin_lock_init(&uic->lock);
258 indexp = of_get_property(node, "cell-index", &len); 258 indexp = of_get_property(node, "cell-index", &len);
259 if (!indexp || (len != sizeof(u32))) { 259 if (!indexp || (len != sizeof(u32))) {
260 printk(KERN_ERR "uic: Device node %s has missing or invalid " 260 printk(KERN_ERR "uic: Device node %s has missing or invalid "
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index ed5cb5af5281..6b99fc3f9b63 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -91,6 +91,7 @@ config S390
91 select HAVE_ARCH_MUTEX_CPU_RELAX 91 select HAVE_ARCH_MUTEX_CPU_RELAX
92 select HAVE_ARCH_JUMP_LABEL if !MARCH_G5 92 select HAVE_ARCH_JUMP_LABEL if !MARCH_G5
93 select HAVE_RCU_TABLE_FREE if SMP 93 select HAVE_RCU_TABLE_FREE if SMP
94 select ARCH_SAVE_PAGE_KEYS if HIBERNATION
94 select ARCH_INLINE_SPIN_TRYLOCK 95 select ARCH_INLINE_SPIN_TRYLOCK
95 select ARCH_INLINE_SPIN_TRYLOCK_BH 96 select ARCH_INLINE_SPIN_TRYLOCK_BH
96 select ARCH_INLINE_SPIN_LOCK 97 select ARCH_INLINE_SPIN_LOCK
diff --git a/arch/s390/hypfs/hypfs_diag.c b/arch/s390/hypfs/hypfs_diag.c
index 6023c6dc1fb7..74c8f5e76ce4 100644
--- a/arch/s390/hypfs/hypfs_diag.c
+++ b/arch/s390/hypfs/hypfs_diag.c
@@ -562,10 +562,9 @@ static int dbfs_d204_create(void **data, void **data_free_ptr, size_t *size)
562 void *base; 562 void *base;
563 563
564 buf_size = PAGE_SIZE * (diag204_buf_pages + 1) + sizeof(d204->hdr); 564 buf_size = PAGE_SIZE * (diag204_buf_pages + 1) + sizeof(d204->hdr);
565 base = vmalloc(buf_size); 565 base = vzalloc(buf_size);
566 if (!base) 566 if (!base)
567 return -ENOMEM; 567 return -ENOMEM;
568 memset(base, 0, buf_size);
569 d204 = page_align_ptr(base + sizeof(d204->hdr)) - sizeof(d204->hdr); 568 d204 = page_align_ptr(base + sizeof(d204->hdr)) - sizeof(d204->hdr);
570 rc = diag204_do_store(d204->buf, diag204_buf_pages); 569 rc = diag204_do_store(d204->buf, diag204_buf_pages);
571 if (rc) { 570 if (rc) {
diff --git a/arch/s390/include/asm/compat.h b/arch/s390/include/asm/compat.h
index da359ca6fe55..cdb9b78f6c08 100644
--- a/arch/s390/include/asm/compat.h
+++ b/arch/s390/include/asm/compat.h
@@ -131,7 +131,8 @@ struct compat_statfs {
131 compat_fsid_t f_fsid; 131 compat_fsid_t f_fsid;
132 s32 f_namelen; 132 s32 f_namelen;
133 s32 f_frsize; 133 s32 f_frsize;
134 s32 f_spare[6]; 134 s32 f_flags;
135 s32 f_spare[5];
135}; 136};
136 137
137#define COMPAT_RLIM_OLD_INFINITY 0x7fffffff 138#define COMPAT_RLIM_OLD_INFINITY 0x7fffffff
diff --git a/arch/s390/include/asm/elf.h b/arch/s390/include/asm/elf.h
index 64b61bf72e93..547f1a6a35d4 100644
--- a/arch/s390/include/asm/elf.h
+++ b/arch/s390/include/asm/elf.h
@@ -188,7 +188,8 @@ extern char elf_platform[];
188#define SET_PERSONALITY(ex) \ 188#define SET_PERSONALITY(ex) \
189do { \ 189do { \
190 if (personality(current->personality) != PER_LINUX32) \ 190 if (personality(current->personality) != PER_LINUX32) \
191 set_personality(PER_LINUX); \ 191 set_personality(PER_LINUX | \
192 (current->personality & ~PER_MASK)); \
192 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \ 193 if ((ex).e_ident[EI_CLASS] == ELFCLASS32) \
193 set_thread_flag(TIF_31BIT); \ 194 set_thread_flag(TIF_31BIT); \
194 else \ 195 else \
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 519eb5f187ef..c0cb794bb365 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -658,12 +658,14 @@ static inline void pgste_set_pte(pte_t *ptep, pgste_t pgste)
658 * struct gmap_struct - guest address space 658 * struct gmap_struct - guest address space
659 * @mm: pointer to the parent mm_struct 659 * @mm: pointer to the parent mm_struct
660 * @table: pointer to the page directory 660 * @table: pointer to the page directory
661 * @asce: address space control element for gmap page table
661 * @crst_list: list of all crst tables used in the guest address space 662 * @crst_list: list of all crst tables used in the guest address space
662 */ 663 */
663struct gmap { 664struct gmap {
664 struct list_head list; 665 struct list_head list;
665 struct mm_struct *mm; 666 struct mm_struct *mm;
666 unsigned long *table; 667 unsigned long *table;
668 unsigned long asce;
667 struct list_head crst_list; 669 struct list_head crst_list;
668}; 670};
669 671
diff --git a/arch/s390/include/asm/qdio.h b/arch/s390/include/asm/qdio.h
index 15c97625df8d..21993623da9a 100644
--- a/arch/s390/include/asm/qdio.h
+++ b/arch/s390/include/asm/qdio.h
@@ -123,6 +123,40 @@ struct slibe {
123}; 123};
124 124
125/** 125/**
126 * struct qaob - queue asynchronous operation block
127 * @res0: reserved parameters
128 * @res1: reserved parameter
129 * @res2: reserved parameter
130 * @res3: reserved parameter
131 * @aorc: asynchronous operation return code
132 * @flags: internal flags
133 * @cbtbs: control block type
134 * @sb_count: number of storage blocks
135 * @sba: storage block element addresses
136 * @dcount: size of storage block elements
137 * @user0: user defineable value
138 * @res4: reserved paramater
139 * @user1: user defineable value
140 * @user2: user defineable value
141 */
142struct qaob {
143 u64 res0[6];
144 u8 res1;
145 u8 res2;
146 u8 res3;
147 u8 aorc;
148 u8 flags;
149 u16 cbtbs;
150 u8 sb_count;
151 u64 sba[QDIO_MAX_ELEMENTS_PER_BUFFER];
152 u16 dcount[QDIO_MAX_ELEMENTS_PER_BUFFER];
153 u64 user0;
154 u64 res4[2];
155 u64 user1;
156 u64 user2;
157} __attribute__ ((packed, aligned(256)));
158
159/**
126 * struct slib - storage list information block (SLIB) 160 * struct slib - storage list information block (SLIB)
127 * @nsliba: next SLIB address (if any) 161 * @nsliba: next SLIB address (if any)
128 * @sla: SL address 162 * @sla: SL address
@@ -225,6 +259,41 @@ struct slsb {
225#define CHSC_AC2_DATA_DIV_AVAILABLE 0x0010 259#define CHSC_AC2_DATA_DIV_AVAILABLE 0x0010
226#define CHSC_AC2_DATA_DIV_ENABLED 0x0002 260#define CHSC_AC2_DATA_DIV_ENABLED 0x0002
227 261
262/**
263 * struct qdio_outbuf_state - SBAL related asynchronous operation information
264 * (for communication with upper layer programs)
265 * (only required for use with completion queues)
266 * @flags: flags indicating state of buffer
267 * @aob: pointer to QAOB used for the particular SBAL
268 * @user: pointer to upper layer program's state information related to SBAL
269 * (stored in user1 data of QAOB)
270 */
271struct qdio_outbuf_state {
272 u8 flags;
273 struct qaob *aob;
274 void *user;
275};
276
277#define QDIO_OUTBUF_STATE_FLAG_NONE 0x00
278#define QDIO_OUTBUF_STATE_FLAG_PENDING 0x01
279
280#define CHSC_AC1_INITIATE_INPUTQ 0x80
281
282
283/* qdio adapter-characteristics-1 flag */
284#define AC1_SIGA_INPUT_NEEDED 0x40 /* process input queues */
285#define AC1_SIGA_OUTPUT_NEEDED 0x20 /* process output queues */
286#define AC1_SIGA_SYNC_NEEDED 0x10 /* ask hypervisor to sync */
287#define AC1_AUTOMATIC_SYNC_ON_THININT 0x08 /* set by hypervisor */
288#define AC1_AUTOMATIC_SYNC_ON_OUT_PCI 0x04 /* set by hypervisor */
289#define AC1_SC_QEBSM_AVAILABLE 0x02 /* available for subchannel */
290#define AC1_SC_QEBSM_ENABLED 0x01 /* enabled for subchannel */
291
292#define CHSC_AC2_DATA_DIV_AVAILABLE 0x0010
293#define CHSC_AC2_DATA_DIV_ENABLED 0x0002
294
295#define CHSC_AC3_FORMAT2_CQ_AVAILABLE 0x8000
296
228struct qdio_ssqd_desc { 297struct qdio_ssqd_desc {
229 u8 flags; 298 u8 flags;
230 u8:8; 299 u8:8;
@@ -243,8 +312,7 @@ struct qdio_ssqd_desc {
243 u64 sch_token; 312 u64 sch_token;
244 u8 mro; 313 u8 mro;
245 u8 mri; 314 u8 mri;
246 u8:8; 315 u16 qdioac3;
247 u8 sbalic;
248 u16:16; 316 u16:16;
249 u8:8; 317 u8:8;
250 u8 mmwc; 318 u8 mmwc;
@@ -280,9 +348,11 @@ typedef void qdio_handler_t(struct ccw_device *, unsigned int, int,
280 * @no_output_qs: number of output queues 348 * @no_output_qs: number of output queues
281 * @input_handler: handler to be called for input queues 349 * @input_handler: handler to be called for input queues
282 * @output_handler: handler to be called for output queues 350 * @output_handler: handler to be called for output queues
351 * @queue_start_poll: polling handlers (one per input queue or NULL)
283 * @int_parm: interruption parameter 352 * @int_parm: interruption parameter
284 * @input_sbal_addr_array: address of no_input_qs * 128 pointers 353 * @input_sbal_addr_array: address of no_input_qs * 128 pointers
285 * @output_sbal_addr_array: address of no_output_qs * 128 pointers 354 * @output_sbal_addr_array: address of no_output_qs * 128 pointers
355 * @output_sbal_state_array: no_output_qs * 128 state info (for CQ or NULL)
286 */ 356 */
287struct qdio_initialize { 357struct qdio_initialize {
288 struct ccw_device *cdev; 358 struct ccw_device *cdev;
@@ -297,11 +367,12 @@ struct qdio_initialize {
297 unsigned int no_output_qs; 367 unsigned int no_output_qs;
298 qdio_handler_t *input_handler; 368 qdio_handler_t *input_handler;
299 qdio_handler_t *output_handler; 369 qdio_handler_t *output_handler;
300 void (*queue_start_poll) (struct ccw_device *, int, unsigned long); 370 void (**queue_start_poll) (struct ccw_device *, int, unsigned long);
301 int scan_threshold; 371 int scan_threshold;
302 unsigned long int_parm; 372 unsigned long int_parm;
303 void **input_sbal_addr_array; 373 void **input_sbal_addr_array;
304 void **output_sbal_addr_array; 374 void **output_sbal_addr_array;
375 struct qdio_outbuf_state *output_sbal_state_array;
305}; 376};
306 377
307#define QDIO_STATE_INACTIVE 0x00000002 /* after qdio_cleanup */ 378#define QDIO_STATE_INACTIVE 0x00000002 /* after qdio_cleanup */
@@ -316,6 +387,7 @@ struct qdio_initialize {
316extern int qdio_allocate(struct qdio_initialize *); 387extern int qdio_allocate(struct qdio_initialize *);
317extern int qdio_establish(struct qdio_initialize *); 388extern int qdio_establish(struct qdio_initialize *);
318extern int qdio_activate(struct ccw_device *); 389extern int qdio_activate(struct ccw_device *);
390extern void qdio_release_aob(struct qaob *);
319extern int do_QDIO(struct ccw_device *, unsigned int, int, unsigned int, 391extern int do_QDIO(struct ccw_device *, unsigned int, int, unsigned int,
320 unsigned int); 392 unsigned int);
321extern int qdio_start_irq(struct ccw_device *, int); 393extern int qdio_start_irq(struct ccw_device *, int);
diff --git a/arch/s390/kernel/asm-offsets.c b/arch/s390/kernel/asm-offsets.c
index 532fd4322156..2b45591e1582 100644
--- a/arch/s390/kernel/asm-offsets.c
+++ b/arch/s390/kernel/asm-offsets.c
@@ -10,6 +10,7 @@
10#include <linux/sched.h> 10#include <linux/sched.h>
11#include <asm/vdso.h> 11#include <asm/vdso.h>
12#include <asm/sigp.h> 12#include <asm/sigp.h>
13#include <asm/pgtable.h>
13 14
14/* 15/*
15 * Make sure that the compiler is new enough. We want a compiler that 16 * Make sure that the compiler is new enough. We want a compiler that
@@ -126,6 +127,7 @@ int main(void)
126 DEFINE(__LC_KERNEL_STACK, offsetof(struct _lowcore, kernel_stack)); 127 DEFINE(__LC_KERNEL_STACK, offsetof(struct _lowcore, kernel_stack));
127 DEFINE(__LC_ASYNC_STACK, offsetof(struct _lowcore, async_stack)); 128 DEFINE(__LC_ASYNC_STACK, offsetof(struct _lowcore, async_stack));
128 DEFINE(__LC_PANIC_STACK, offsetof(struct _lowcore, panic_stack)); 129 DEFINE(__LC_PANIC_STACK, offsetof(struct _lowcore, panic_stack));
130 DEFINE(__LC_USER_ASCE, offsetof(struct _lowcore, user_asce));
129 DEFINE(__LC_INT_CLOCK, offsetof(struct _lowcore, int_clock)); 131 DEFINE(__LC_INT_CLOCK, offsetof(struct _lowcore, int_clock));
130 DEFINE(__LC_MCCK_CLOCK, offsetof(struct _lowcore, mcck_clock)); 132 DEFINE(__LC_MCCK_CLOCK, offsetof(struct _lowcore, mcck_clock));
131 DEFINE(__LC_MACHINE_FLAGS, offsetof(struct _lowcore, machine_flags)); 133 DEFINE(__LC_MACHINE_FLAGS, offsetof(struct _lowcore, machine_flags));
@@ -151,6 +153,7 @@ int main(void)
151 DEFINE(__LC_VDSO_PER_CPU, offsetof(struct _lowcore, vdso_per_cpu_data)); 153 DEFINE(__LC_VDSO_PER_CPU, offsetof(struct _lowcore, vdso_per_cpu_data));
152 DEFINE(__LC_GMAP, offsetof(struct _lowcore, gmap)); 154 DEFINE(__LC_GMAP, offsetof(struct _lowcore, gmap));
153 DEFINE(__LC_CMF_HPP, offsetof(struct _lowcore, cmf_hpp)); 155 DEFINE(__LC_CMF_HPP, offsetof(struct _lowcore, cmf_hpp));
156 DEFINE(__GMAP_ASCE, offsetof(struct gmap, asce));
154#endif /* CONFIG_32BIT */ 157#endif /* CONFIG_32BIT */
155 return 0; 158 return 0;
156} 159}
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index 5f729d627cef..713da0760538 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -1076,6 +1076,11 @@ sie_loop:
1076 lg %r14,__LC_THREAD_INFO # pointer thread_info struct 1076 lg %r14,__LC_THREAD_INFO # pointer thread_info struct
1077 tm __TI_flags+7(%r14),_TIF_EXIT_SIE 1077 tm __TI_flags+7(%r14),_TIF_EXIT_SIE
1078 jnz sie_exit 1078 jnz sie_exit
1079 lg %r14,__LC_GMAP # get gmap pointer
1080 ltgr %r14,%r14
1081 jz sie_gmap
1082 lctlg %c1,%c1,__GMAP_ASCE(%r14) # load primary asce
1083sie_gmap:
1079 lg %r14,__SF_EMPTY(%r15) # get control block pointer 1084 lg %r14,__SF_EMPTY(%r15) # get control block pointer
1080 SPP __SF_EMPTY(%r15) # set guest id 1085 SPP __SF_EMPTY(%r15) # set guest id
1081 sie 0(%r14) 1086 sie 0(%r14)
@@ -1083,6 +1088,7 @@ sie_done:
1083 SPP __LC_CMF_HPP # set host id 1088 SPP __LC_CMF_HPP # set host id
1084 lg %r14,__LC_THREAD_INFO # pointer thread_info struct 1089 lg %r14,__LC_THREAD_INFO # pointer thread_info struct
1085sie_exit: 1090sie_exit:
1091 lctlg %c1,%c1,__LC_USER_ASCE # load primary asce
1086 ni __TI_flags+6(%r14),255-(_TIF_SIE>>8) 1092 ni __TI_flags+6(%r14),255-(_TIF_SIE>>8)
1087 lg %r14,__SF_EMPTY+8(%r15) # load guest register save area 1093 lg %r14,__SF_EMPTY+8(%r15) # load guest register save area
1088 stmg %r0,%r13,0(%r14) # save guest gprs 0-13 1094 stmg %r0,%r13,0(%r14) # save guest gprs 0-13
diff --git a/arch/s390/kernel/suspend.c b/arch/s390/kernel/suspend.c
index cf9e5c6d5527..b6f9afed74ec 100644
--- a/arch/s390/kernel/suspend.c
+++ b/arch/s390/kernel/suspend.c
@@ -7,6 +7,7 @@
7 */ 7 */
8 8
9#include <linux/pfn.h> 9#include <linux/pfn.h>
10#include <linux/mm.h>
10#include <asm/system.h> 11#include <asm/system.h>
11 12
12/* 13/*
@@ -14,6 +15,123 @@
14 */ 15 */
15extern const void __nosave_begin, __nosave_end; 16extern const void __nosave_begin, __nosave_end;
16 17
18/*
19 * The restore of the saved pages in an hibernation image will set
20 * the change and referenced bits in the storage key for each page.
21 * Overindication of the referenced bits after an hibernation cycle
22 * does not cause any harm but the overindication of the change bits
23 * would cause trouble.
24 * Use the ARCH_SAVE_PAGE_KEYS hooks to save the storage key of each
25 * page to the most significant byte of the associated page frame
26 * number in the hibernation image.
27 */
28
29/*
30 * Key storage is allocated as a linked list of pages.
31 * The size of the keys array is (PAGE_SIZE - sizeof(long))
32 */
33struct page_key_data {
34 struct page_key_data *next;
35 unsigned char data[];
36};
37
38#define PAGE_KEY_DATA_SIZE (PAGE_SIZE - sizeof(struct page_key_data *))
39
40static struct page_key_data *page_key_data;
41static struct page_key_data *page_key_rp, *page_key_wp;
42static unsigned long page_key_rx, page_key_wx;
43
44/*
45 * For each page in the hibernation image one additional byte is
46 * stored in the most significant byte of the page frame number.
47 * On suspend no additional memory is required but on resume the
48 * keys need to be memorized until the page data has been restored.
49 * Only then can the storage keys be set to their old state.
50 */
51unsigned long page_key_additional_pages(unsigned long pages)
52{
53 return DIV_ROUND_UP(pages, PAGE_KEY_DATA_SIZE);
54}
55
56/*
57 * Free page_key_data list of arrays.
58 */
59void page_key_free(void)
60{
61 struct page_key_data *pkd;
62
63 while (page_key_data) {
64 pkd = page_key_data;
65 page_key_data = pkd->next;
66 free_page((unsigned long) pkd);
67 }
68}
69
70/*
71 * Allocate page_key_data list of arrays with enough room to store
72 * one byte for each page in the hibernation image.
73 */
74int page_key_alloc(unsigned long pages)
75{
76 struct page_key_data *pk;
77 unsigned long size;
78
79 size = DIV_ROUND_UP(pages, PAGE_KEY_DATA_SIZE);
80 while (size--) {
81 pk = (struct page_key_data *) get_zeroed_page(GFP_KERNEL);
82 if (!pk) {
83 page_key_free();
84 return -ENOMEM;
85 }
86 pk->next = page_key_data;
87 page_key_data = pk;
88 }
89 page_key_rp = page_key_wp = page_key_data;
90 page_key_rx = page_key_wx = 0;
91 return 0;
92}
93
94/*
95 * Save the storage key into the upper 8 bits of the page frame number.
96 */
97void page_key_read(unsigned long *pfn)
98{
99 unsigned long addr;
100
101 addr = (unsigned long) page_address(pfn_to_page(*pfn));
102 *(unsigned char *) pfn = (unsigned char) page_get_storage_key(addr);
103}
104
105/*
106 * Extract the storage key from the upper 8 bits of the page frame number
107 * and store it in the page_key_data list of arrays.
108 */
109void page_key_memorize(unsigned long *pfn)
110{
111 page_key_wp->data[page_key_wx] = *(unsigned char *) pfn;
112 *(unsigned char *) pfn = 0;
113 if (++page_key_wx < PAGE_KEY_DATA_SIZE)
114 return;
115 page_key_wp = page_key_wp->next;
116 page_key_wx = 0;
117}
118
119/*
120 * Get the next key from the page_key_data list of arrays and set the
121 * storage key of the page referred by @address. If @address refers to
122 * a "safe" page the swsusp_arch_resume code will transfer the storage
123 * key from the buffer page to the original page.
124 */
125void page_key_write(void *address)
126{
127 page_set_storage_key((unsigned long) address,
128 page_key_rp->data[page_key_rx], 0);
129 if (++page_key_rx >= PAGE_KEY_DATA_SIZE)
130 return;
131 page_key_rp = page_key_rp->next;
132 page_key_rx = 0;
133}
134
17int pfn_is_nosave(unsigned long pfn) 135int pfn_is_nosave(unsigned long pfn)
18{ 136{
19 unsigned long nosave_begin_pfn = PFN_DOWN(__pa(&__nosave_begin)); 137 unsigned long nosave_begin_pfn = PFN_DOWN(__pa(&__nosave_begin));
diff --git a/arch/s390/kernel/swsusp_asm64.S b/arch/s390/kernel/swsusp_asm64.S
index 51bcdb50a230..acb78cdee896 100644
--- a/arch/s390/kernel/swsusp_asm64.S
+++ b/arch/s390/kernel/swsusp_asm64.S
@@ -136,11 +136,14 @@ ENTRY(swsusp_arch_resume)
1360: 1360:
137 lg %r2,8(%r1) 137 lg %r2,8(%r1)
138 lg %r4,0(%r1) 138 lg %r4,0(%r1)
139 iske %r0,%r4
139 lghi %r3,PAGE_SIZE 140 lghi %r3,PAGE_SIZE
140 lghi %r5,PAGE_SIZE 141 lghi %r5,PAGE_SIZE
1411: 1421:
142 mvcle %r2,%r4,0 143 mvcle %r2,%r4,0
143 jo 1b 144 jo 1b
145 lg %r2,8(%r1)
146 sske %r0,%r2
144 lg %r1,16(%r1) 147 lg %r1,16(%r1)
145 ltgr %r1,%r1 148 ltgr %r1,%r1
146 jnz 0b 149 jnz 0b
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index dff933065ab6..8d65bd0383fc 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -109,10 +109,14 @@ static void fixup_clock_comparator(unsigned long long delta)
109 set_clock_comparator(S390_lowcore.clock_comparator); 109 set_clock_comparator(S390_lowcore.clock_comparator);
110} 110}
111 111
112static int s390_next_event(unsigned long delta, 112static int s390_next_ktime(ktime_t expires,
113 struct clock_event_device *evt) 113 struct clock_event_device *evt)
114{ 114{
115 S390_lowcore.clock_comparator = get_clock() + delta; 115 u64 nsecs;
116
117 nsecs = ktime_to_ns(ktime_sub(expires, ktime_get_monotonic_offset()));
118 do_div(nsecs, 125);
119 S390_lowcore.clock_comparator = TOD_UNIX_EPOCH + (nsecs << 9);
116 set_clock_comparator(S390_lowcore.clock_comparator); 120 set_clock_comparator(S390_lowcore.clock_comparator);
117 return 0; 121 return 0;
118} 122}
@@ -137,14 +141,15 @@ void init_cpu_timer(void)
137 cpu = smp_processor_id(); 141 cpu = smp_processor_id();
138 cd = &per_cpu(comparators, cpu); 142 cd = &per_cpu(comparators, cpu);
139 cd->name = "comparator"; 143 cd->name = "comparator";
140 cd->features = CLOCK_EVT_FEAT_ONESHOT; 144 cd->features = CLOCK_EVT_FEAT_ONESHOT |
145 CLOCK_EVT_FEAT_KTIME;
141 cd->mult = 16777; 146 cd->mult = 16777;
142 cd->shift = 12; 147 cd->shift = 12;
143 cd->min_delta_ns = 1; 148 cd->min_delta_ns = 1;
144 cd->max_delta_ns = LONG_MAX; 149 cd->max_delta_ns = LONG_MAX;
145 cd->rating = 400; 150 cd->rating = 400;
146 cd->cpumask = cpumask_of(cpu); 151 cd->cpumask = cpumask_of(cpu);
147 cd->set_next_event = s390_next_event; 152 cd->set_next_ktime = s390_next_ktime;
148 cd->set_mode = s390_set_mode; 153 cd->set_mode = s390_set_mode;
149 154
150 clockevents_register_device(cd); 155 clockevents_register_device(cd);
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index f17296e4fc89..dc2b580e27bc 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -123,6 +123,7 @@ int kvm_dev_ioctl_check_extension(long ext)
123 123
124 switch (ext) { 124 switch (ext) {
125 case KVM_CAP_S390_PSW: 125 case KVM_CAP_S390_PSW:
126 case KVM_CAP_S390_GMAP:
126 r = 1; 127 r = 1;
127 break; 128 break;
128 default: 129 default:
@@ -263,10 +264,12 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
263 vcpu->arch.guest_fpregs.fpc &= FPC_VALID_MASK; 264 vcpu->arch.guest_fpregs.fpc &= FPC_VALID_MASK;
264 restore_fp_regs(&vcpu->arch.guest_fpregs); 265 restore_fp_regs(&vcpu->arch.guest_fpregs);
265 restore_access_regs(vcpu->arch.guest_acrs); 266 restore_access_regs(vcpu->arch.guest_acrs);
267 gmap_enable(vcpu->arch.gmap);
266} 268}
267 269
268void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) 270void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
269{ 271{
272 gmap_disable(vcpu->arch.gmap);
270 save_fp_regs(&vcpu->arch.guest_fpregs); 273 save_fp_regs(&vcpu->arch.guest_fpregs);
271 save_access_regs(vcpu->arch.guest_acrs); 274 save_access_regs(vcpu->arch.guest_acrs);
272 restore_fp_regs(&vcpu->arch.host_fpregs); 275 restore_fp_regs(&vcpu->arch.host_fpregs);
@@ -461,7 +464,6 @@ static void __vcpu_run(struct kvm_vcpu *vcpu)
461 local_irq_disable(); 464 local_irq_disable();
462 kvm_guest_enter(); 465 kvm_guest_enter();
463 local_irq_enable(); 466 local_irq_enable();
464 gmap_enable(vcpu->arch.gmap);
465 VCPU_EVENT(vcpu, 6, "entering sie flags %x", 467 VCPU_EVENT(vcpu, 6, "entering sie flags %x",
466 atomic_read(&vcpu->arch.sie_block->cpuflags)); 468 atomic_read(&vcpu->arch.sie_block->cpuflags));
467 if (sie64a(vcpu->arch.sie_block, vcpu->arch.guest_gprs)) { 469 if (sie64a(vcpu->arch.sie_block, vcpu->arch.guest_gprs)) {
@@ -470,7 +472,6 @@ static void __vcpu_run(struct kvm_vcpu *vcpu)
470 } 472 }
471 VCPU_EVENT(vcpu, 6, "exit sie icptcode %d", 473 VCPU_EVENT(vcpu, 6, "exit sie icptcode %d",
472 vcpu->arch.sie_block->icptcode); 474 vcpu->arch.sie_block->icptcode);
473 gmap_disable(vcpu->arch.gmap);
474 local_irq_disable(); 475 local_irq_disable();
475 kvm_guest_exit(); 476 kvm_guest_exit();
476 local_irq_enable(); 477 local_irq_enable();
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c
index 4d1f2bce87b3..5d56c2b95b14 100644
--- a/arch/s390/mm/pgtable.c
+++ b/arch/s390/mm/pgtable.c
@@ -160,6 +160,8 @@ struct gmap *gmap_alloc(struct mm_struct *mm)
160 table = (unsigned long *) page_to_phys(page); 160 table = (unsigned long *) page_to_phys(page);
161 crst_table_init(table, _REGION1_ENTRY_EMPTY); 161 crst_table_init(table, _REGION1_ENTRY_EMPTY);
162 gmap->table = table; 162 gmap->table = table;
163 gmap->asce = _ASCE_TYPE_REGION1 | _ASCE_TABLE_LENGTH |
164 _ASCE_USER_BITS | __pa(table);
163 list_add(&gmap->list, &mm->context.gmap_list); 165 list_add(&gmap->list, &mm->context.gmap_list);
164 return gmap; 166 return gmap;
165 167
@@ -240,10 +242,6 @@ EXPORT_SYMBOL_GPL(gmap_free);
240 */ 242 */
241void gmap_enable(struct gmap *gmap) 243void gmap_enable(struct gmap *gmap)
242{ 244{
243 /* Load primary space page table origin. */
244 S390_lowcore.user_asce = _ASCE_TYPE_REGION1 | _ASCE_TABLE_LENGTH |
245 _ASCE_USER_BITS | __pa(gmap->table);
246 asm volatile("lctlg 1,1,%0\n" : : "m" (S390_lowcore.user_asce) );
247 S390_lowcore.gmap = (unsigned long) gmap; 245 S390_lowcore.gmap = (unsigned long) gmap;
248} 246}
249EXPORT_SYMBOL_GPL(gmap_enable); 247EXPORT_SYMBOL_GPL(gmap_enable);
@@ -254,10 +252,6 @@ EXPORT_SYMBOL_GPL(gmap_enable);
254 */ 252 */
255void gmap_disable(struct gmap *gmap) 253void gmap_disable(struct gmap *gmap)
256{ 254{
257 /* Load primary space page table origin. */
258 S390_lowcore.user_asce =
259 gmap->mm->context.asce_bits | __pa(gmap->mm->pgd);
260 asm volatile("lctlg 1,1,%0\n" : : "m" (S390_lowcore.user_asce) );
261 S390_lowcore.gmap = 0UL; 255 S390_lowcore.gmap = 0UL;
262} 256}
263EXPORT_SYMBOL_GPL(gmap_disable); 257EXPORT_SYMBOL_GPL(gmap_disable);
@@ -309,15 +303,15 @@ int gmap_unmap_segment(struct gmap *gmap, unsigned long to, unsigned long len)
309 /* Walk the guest addr space page table */ 303 /* Walk the guest addr space page table */
310 table = gmap->table + (((to + off) >> 53) & 0x7ff); 304 table = gmap->table + (((to + off) >> 53) & 0x7ff);
311 if (*table & _REGION_ENTRY_INV) 305 if (*table & _REGION_ENTRY_INV)
312 return 0; 306 goto out;
313 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN); 307 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
314 table = table + (((to + off) >> 42) & 0x7ff); 308 table = table + (((to + off) >> 42) & 0x7ff);
315 if (*table & _REGION_ENTRY_INV) 309 if (*table & _REGION_ENTRY_INV)
316 return 0; 310 goto out;
317 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN); 311 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
318 table = table + (((to + off) >> 31) & 0x7ff); 312 table = table + (((to + off) >> 31) & 0x7ff);
319 if (*table & _REGION_ENTRY_INV) 313 if (*table & _REGION_ENTRY_INV)
320 return 0; 314 goto out;
321 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN); 315 table = (unsigned long *)(*table & _REGION_ENTRY_ORIGIN);
322 table = table + (((to + off) >> 20) & 0x7ff); 316 table = table + (((to + off) >> 20) & 0x7ff);
323 317
@@ -325,6 +319,7 @@ int gmap_unmap_segment(struct gmap *gmap, unsigned long to, unsigned long len)
325 flush |= gmap_unlink_segment(gmap, table); 319 flush |= gmap_unlink_segment(gmap, table);
326 *table = _SEGMENT_ENTRY_INV; 320 *table = _SEGMENT_ENTRY_INV;
327 } 321 }
322out:
328 up_read(&gmap->mm->mmap_sem); 323 up_read(&gmap->mm->mmap_sem);
329 if (flush) 324 if (flush)
330 gmap_flush_tlb(gmap); 325 gmap_flush_tlb(gmap);
diff --git a/arch/sh/include/asm/sh_eth.h b/arch/sh/include/asm/sh_eth.h
deleted file mode 100644
index 0f325da0f923..000000000000
--- a/arch/sh/include/asm/sh_eth.h
+++ /dev/null
@@ -1,25 +0,0 @@
1#ifndef __ASM_SH_ETH_H__
2#define __ASM_SH_ETH_H__
3
4#include <linux/phy.h>
5
6enum {EDMAC_LITTLE_ENDIAN, EDMAC_BIG_ENDIAN};
7enum {
8 SH_ETH_REG_GIGABIT,
9 SH_ETH_REG_FAST_SH4,
10 SH_ETH_REG_FAST_SH3_SH2
11};
12
13struct sh_eth_plat_data {
14 int phy;
15 int edmac_endian;
16 int register_type;
17 phy_interface_t phy_interface;
18 void (*set_mdio_gate)(unsigned long addr);
19
20 unsigned char mac_addr[6];
21 unsigned no_ether_link:1;
22 unsigned ether_link_active_low:1;
23};
24
25#endif
diff --git a/arch/sparc/include/asm/compat.h b/arch/sparc/include/asm/compat.h
index 6f57325bb883..b8be20d42a0a 100644
--- a/arch/sparc/include/asm/compat.h
+++ b/arch/sparc/include/asm/compat.h
@@ -134,7 +134,8 @@ struct compat_statfs {
134 compat_fsid_t f_fsid; 134 compat_fsid_t f_fsid;
135 int f_namelen; /* SunOS ignores this field. */ 135 int f_namelen; /* SunOS ignores this field. */
136 int f_frsize; 136 int f_frsize;
137 int f_spare[5]; 137 int f_flags;
138 int f_spare[4];
138}; 139};
139 140
140#define COMPAT_RLIM_INFINITY 0x7fffffff 141#define COMPAT_RLIM_INFINITY 0x7fffffff
diff --git a/arch/sparc/include/asm/pgtsrmmu.h b/arch/sparc/include/asm/pgtsrmmu.h
index 1407c07bdade..f6ae2b2b6870 100644
--- a/arch/sparc/include/asm/pgtsrmmu.h
+++ b/arch/sparc/include/asm/pgtsrmmu.h
@@ -280,7 +280,7 @@ static inline unsigned long srmmu_hwprobe(unsigned long vaddr)
280 return retval; 280 return retval;
281} 281}
282#else 282#else
283#define srmmu_hwprobe(addr) (srmmu_swprobe(addr, 0) & SRMMU_PTE_PMASK) 283#define srmmu_hwprobe(addr) srmmu_swprobe(addr, 0)
284#endif 284#endif
285 285
286static inline int 286static inline int
diff --git a/arch/sparc/include/asm/spitfire.h b/arch/sparc/include/asm/spitfire.h
index 55a17c6efeb8..d06a26601753 100644
--- a/arch/sparc/include/asm/spitfire.h
+++ b/arch/sparc/include/asm/spitfire.h
@@ -43,6 +43,8 @@
43#define SUN4V_CHIP_NIAGARA1 0x01 43#define SUN4V_CHIP_NIAGARA1 0x01
44#define SUN4V_CHIP_NIAGARA2 0x02 44#define SUN4V_CHIP_NIAGARA2 0x02
45#define SUN4V_CHIP_NIAGARA3 0x03 45#define SUN4V_CHIP_NIAGARA3 0x03
46#define SUN4V_CHIP_NIAGARA4 0x04
47#define SUN4V_CHIP_NIAGARA5 0x05
46#define SUN4V_CHIP_UNKNOWN 0xff 48#define SUN4V_CHIP_UNKNOWN 0xff
47 49
48#ifndef __ASSEMBLY__ 50#ifndef __ASSEMBLY__
diff --git a/arch/sparc/include/asm/xor_64.h b/arch/sparc/include/asm/xor_64.h
index 9ed6ff679ab7..ee8edc68423e 100644
--- a/arch/sparc/include/asm/xor_64.h
+++ b/arch/sparc/include/asm/xor_64.h
@@ -66,6 +66,8 @@ static struct xor_block_template xor_block_niagara = {
66 ((tlb_type == hypervisor && \ 66 ((tlb_type == hypervisor && \
67 (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 || \ 67 (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 || \
68 sun4v_chip_type == SUN4V_CHIP_NIAGARA2 || \ 68 sun4v_chip_type == SUN4V_CHIP_NIAGARA2 || \
69 sun4v_chip_type == SUN4V_CHIP_NIAGARA3)) ? \ 69 sun4v_chip_type == SUN4V_CHIP_NIAGARA3 || \
70 sun4v_chip_type == SUN4V_CHIP_NIAGARA4 || \
71 sun4v_chip_type == SUN4V_CHIP_NIAGARA5)) ? \
70 &xor_block_niagara : \ 72 &xor_block_niagara : \
71 &xor_block_VIS) 73 &xor_block_VIS)
diff --git a/arch/sparc/kernel/cpu.c b/arch/sparc/kernel/cpu.c
index 9810fd881058..ba9b1cec4e6b 100644
--- a/arch/sparc/kernel/cpu.c
+++ b/arch/sparc/kernel/cpu.c
@@ -481,6 +481,18 @@ static void __init sun4v_cpu_probe(void)
481 sparc_pmu_type = "niagara3"; 481 sparc_pmu_type = "niagara3";
482 break; 482 break;
483 483
484 case SUN4V_CHIP_NIAGARA4:
485 sparc_cpu_type = "UltraSparc T4 (Niagara4)";
486 sparc_fpu_type = "UltraSparc T4 integrated FPU";
487 sparc_pmu_type = "niagara4";
488 break;
489
490 case SUN4V_CHIP_NIAGARA5:
491 sparc_cpu_type = "UltraSparc T5 (Niagara5)";
492 sparc_fpu_type = "UltraSparc T5 integrated FPU";
493 sparc_pmu_type = "niagara5";
494 break;
495
484 default: 496 default:
485 printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n", 497 printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n",
486 prom_cpu_compatible); 498 prom_cpu_compatible);
diff --git a/arch/sparc/kernel/cpumap.c b/arch/sparc/kernel/cpumap.c
index 4197e8d62d4c..9323eafccb93 100644
--- a/arch/sparc/kernel/cpumap.c
+++ b/arch/sparc/kernel/cpumap.c
@@ -325,6 +325,8 @@ static int iterate_cpu(struct cpuinfo_tree *t, unsigned int root_index)
325 case SUN4V_CHIP_NIAGARA1: 325 case SUN4V_CHIP_NIAGARA1:
326 case SUN4V_CHIP_NIAGARA2: 326 case SUN4V_CHIP_NIAGARA2:
327 case SUN4V_CHIP_NIAGARA3: 327 case SUN4V_CHIP_NIAGARA3:
328 case SUN4V_CHIP_NIAGARA4:
329 case SUN4V_CHIP_NIAGARA5:
328 rover_inc_table = niagara_iterate_method; 330 rover_inc_table = niagara_iterate_method;
329 break; 331 break;
330 default: 332 default:
diff --git a/arch/sparc/kernel/head_64.S b/arch/sparc/kernel/head_64.S
index 0eac1b2fc53d..0d810c2f1d00 100644
--- a/arch/sparc/kernel/head_64.S
+++ b/arch/sparc/kernel/head_64.S
@@ -133,7 +133,7 @@ prom_sun4v_name:
133prom_niagara_prefix: 133prom_niagara_prefix:
134 .asciz "SUNW,UltraSPARC-T" 134 .asciz "SUNW,UltraSPARC-T"
135prom_sparc_prefix: 135prom_sparc_prefix:
136 .asciz "SPARC-T" 136 .asciz "SPARC-"
137 .align 4 137 .align 4
138prom_root_compatible: 138prom_root_compatible:
139 .skip 64 139 .skip 64
@@ -396,7 +396,7 @@ sun4v_chip_type:
396 or %g1, %lo(prom_cpu_compatible), %g1 396 or %g1, %lo(prom_cpu_compatible), %g1
397 sethi %hi(prom_sparc_prefix), %g7 397 sethi %hi(prom_sparc_prefix), %g7
398 or %g7, %lo(prom_sparc_prefix), %g7 398 or %g7, %lo(prom_sparc_prefix), %g7
399 mov 7, %g3 399 mov 6, %g3
40090: ldub [%g7], %g2 40090: ldub [%g7], %g2
401 ldub [%g1], %g4 401 ldub [%g1], %g4
402 cmp %g2, %g4 402 cmp %g2, %g4
@@ -408,10 +408,23 @@ sun4v_chip_type:
408 408
409 sethi %hi(prom_cpu_compatible), %g1 409 sethi %hi(prom_cpu_compatible), %g1
410 or %g1, %lo(prom_cpu_compatible), %g1 410 or %g1, %lo(prom_cpu_compatible), %g1
411 ldub [%g1 + 7], %g2 411 ldub [%g1 + 6], %g2
412 cmp %g2, 'T'
413 be,pt %xcc, 70f
414 cmp %g2, 'M'
415 bne,pn %xcc, 4f
416 nop
417
41870: ldub [%g1 + 7], %g2
412 cmp %g2, '3' 419 cmp %g2, '3'
413 be,pt %xcc, 5f 420 be,pt %xcc, 5f
414 mov SUN4V_CHIP_NIAGARA3, %g4 421 mov SUN4V_CHIP_NIAGARA3, %g4
422 cmp %g2, '4'
423 be,pt %xcc, 5f
424 mov SUN4V_CHIP_NIAGARA4, %g4
425 cmp %g2, '5'
426 be,pt %xcc, 5f
427 mov SUN4V_CHIP_NIAGARA5, %g4
415 ba,pt %xcc, 4f 428 ba,pt %xcc, 4f
416 nop 429 nop
417 430
@@ -545,6 +558,12 @@ niagara_tlb_fixup:
545 cmp %g1, SUN4V_CHIP_NIAGARA3 558 cmp %g1, SUN4V_CHIP_NIAGARA3
546 be,pt %xcc, niagara2_patch 559 be,pt %xcc, niagara2_patch
547 nop 560 nop
561 cmp %g1, SUN4V_CHIP_NIAGARA4
562 be,pt %xcc, niagara2_patch
563 nop
564 cmp %g1, SUN4V_CHIP_NIAGARA5
565 be,pt %xcc, niagara2_patch
566 nop
548 567
549 call generic_patch_copyops 568 call generic_patch_copyops
550 nop 569 nop
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 1e94f946570e..8aa0d4408586 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -230,7 +230,8 @@ static void pci_parse_of_addrs(struct platform_device *op,
230 res = &dev->resource[(i - PCI_BASE_ADDRESS_0) >> 2]; 230 res = &dev->resource[(i - PCI_BASE_ADDRESS_0) >> 2];
231 } else if (i == dev->rom_base_reg) { 231 } else if (i == dev->rom_base_reg) {
232 res = &dev->resource[PCI_ROM_RESOURCE]; 232 res = &dev->resource[PCI_ROM_RESOURCE];
233 flags |= IORESOURCE_READONLY | IORESOURCE_CACHEABLE; 233 flags |= IORESOURCE_READONLY | IORESOURCE_CACHEABLE
234 | IORESOURCE_SIZEALIGN;
234 } else { 235 } else {
235 printk(KERN_ERR "PCI: bad cfg reg num 0x%x\n", i); 236 printk(KERN_ERR "PCI: bad cfg reg num 0x%x\n", i);
236 continue; 237 continue;
diff --git a/arch/sparc/kernel/process_32.c b/arch/sparc/kernel/process_32.c
index c8cc461ff75f..f793742eec2b 100644
--- a/arch/sparc/kernel/process_32.c
+++ b/arch/sparc/kernel/process_32.c
@@ -380,8 +380,7 @@ void flush_thread(void)
380#endif 380#endif
381 } 381 }
382 382
383 /* Now, this task is no longer a kernel thread. */ 383 /* This task is no longer a kernel thread. */
384 current->thread.current_ds = USER_DS;
385 if (current->thread.flags & SPARC_FLAG_KTHREAD) { 384 if (current->thread.flags & SPARC_FLAG_KTHREAD) {
386 current->thread.flags &= ~SPARC_FLAG_KTHREAD; 385 current->thread.flags &= ~SPARC_FLAG_KTHREAD;
387 386
diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c
index c158a95ec664..d959cd0a4aa4 100644
--- a/arch/sparc/kernel/process_64.c
+++ b/arch/sparc/kernel/process_64.c
@@ -368,9 +368,6 @@ void flush_thread(void)
368 368
369 /* Clear FPU register state. */ 369 /* Clear FPU register state. */
370 t->fpsaved[0] = 0; 370 t->fpsaved[0] = 0;
371
372 if (get_thread_current_ds() != ASI_AIUS)
373 set_fs(USER_DS);
374} 371}
375 372
376/* It's a bit more tricky when 64-bit tasks are involved... */ 373/* It's a bit more tricky when 64-bit tasks are involved... */
diff --git a/arch/sparc/kernel/setup_32.c b/arch/sparc/kernel/setup_32.c
index d26e1f6c717a..3e3e2914c70b 100644
--- a/arch/sparc/kernel/setup_32.c
+++ b/arch/sparc/kernel/setup_32.c
@@ -137,7 +137,7 @@ static void __init process_switch(char c)
137 prom_halt(); 137 prom_halt();
138 break; 138 break;
139 case 'p': 139 case 'p':
140 /* Just ignore, this behavior is now the default. */ 140 prom_early_console.flags &= ~CON_BOOT;
141 break; 141 break;
142 default: 142 default:
143 printk("Unknown boot switch (-%c)\n", c); 143 printk("Unknown boot switch (-%c)\n", c);
diff --git a/arch/sparc/kernel/setup_64.c b/arch/sparc/kernel/setup_64.c
index 3c5bb784214f..c965595aa7e9 100644
--- a/arch/sparc/kernel/setup_64.c
+++ b/arch/sparc/kernel/setup_64.c
@@ -106,7 +106,7 @@ static void __init process_switch(char c)
106 prom_halt(); 106 prom_halt();
107 break; 107 break;
108 case 'p': 108 case 'p':
109 /* Just ignore, this behavior is now the default. */ 109 prom_early_console.flags &= ~CON_BOOT;
110 break; 110 break;
111 case 'P': 111 case 'P':
112 /* Force UltraSPARC-III P-Cache on. */ 112 /* Force UltraSPARC-III P-Cache on. */
@@ -425,10 +425,14 @@ static void __init init_sparc64_elf_hwcap(void)
425 else if (tlb_type == hypervisor) { 425 else if (tlb_type == hypervisor) {
426 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 || 426 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 ||
427 sun4v_chip_type == SUN4V_CHIP_NIAGARA2 || 427 sun4v_chip_type == SUN4V_CHIP_NIAGARA2 ||
428 sun4v_chip_type == SUN4V_CHIP_NIAGARA3) 428 sun4v_chip_type == SUN4V_CHIP_NIAGARA3 ||
429 sun4v_chip_type == SUN4V_CHIP_NIAGARA4 ||
430 sun4v_chip_type == SUN4V_CHIP_NIAGARA5)
429 cap |= HWCAP_SPARC_BLKINIT; 431 cap |= HWCAP_SPARC_BLKINIT;
430 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2 || 432 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2 ||
431 sun4v_chip_type == SUN4V_CHIP_NIAGARA3) 433 sun4v_chip_type == SUN4V_CHIP_NIAGARA3 ||
434 sun4v_chip_type == SUN4V_CHIP_NIAGARA4 ||
435 sun4v_chip_type == SUN4V_CHIP_NIAGARA5)
432 cap |= HWCAP_SPARC_N2; 436 cap |= HWCAP_SPARC_N2;
433 } 437 }
434 438
@@ -452,11 +456,15 @@ static void __init init_sparc64_elf_hwcap(void)
452 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1) 456 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA1)
453 cap |= AV_SPARC_ASI_BLK_INIT; 457 cap |= AV_SPARC_ASI_BLK_INIT;
454 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2 || 458 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA2 ||
455 sun4v_chip_type == SUN4V_CHIP_NIAGARA3) 459 sun4v_chip_type == SUN4V_CHIP_NIAGARA3 ||
460 sun4v_chip_type == SUN4V_CHIP_NIAGARA4 ||
461 sun4v_chip_type == SUN4V_CHIP_NIAGARA5)
456 cap |= (AV_SPARC_VIS | AV_SPARC_VIS2 | 462 cap |= (AV_SPARC_VIS | AV_SPARC_VIS2 |
457 AV_SPARC_ASI_BLK_INIT | 463 AV_SPARC_ASI_BLK_INIT |
458 AV_SPARC_POPC); 464 AV_SPARC_POPC);
459 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA3) 465 if (sun4v_chip_type == SUN4V_CHIP_NIAGARA3 ||
466 sun4v_chip_type == SUN4V_CHIP_NIAGARA4 ||
467 sun4v_chip_type == SUN4V_CHIP_NIAGARA5)
460 cap |= (AV_SPARC_VIS3 | AV_SPARC_HPC | 468 cap |= (AV_SPARC_VIS3 | AV_SPARC_HPC |
461 AV_SPARC_FMAF); 469 AV_SPARC_FMAF);
462 } 470 }
diff --git a/arch/sparc/kernel/signal32.c b/arch/sparc/kernel/signal32.c
index 1ba95aff5d59..2caa556db86d 100644
--- a/arch/sparc/kernel/signal32.c
+++ b/arch/sparc/kernel/signal32.c
@@ -273,10 +273,7 @@ void do_sigreturn32(struct pt_regs *regs)
273 case 1: set.sig[0] = seta[0] + (((long)seta[1]) << 32); 273 case 1: set.sig[0] = seta[0] + (((long)seta[1]) << 32);
274 } 274 }
275 sigdelsetmask(&set, ~_BLOCKABLE); 275 sigdelsetmask(&set, ~_BLOCKABLE);
276 spin_lock_irq(&current->sighand->siglock); 276 set_current_blocked(&set);
277 current->blocked = set;
278 recalc_sigpending();
279 spin_unlock_irq(&current->sighand->siglock);
280 return; 277 return;
281 278
282segv: 279segv:
@@ -377,10 +374,7 @@ asmlinkage void do_rt_sigreturn32(struct pt_regs *regs)
377 case 1: set.sig[0] = seta.sig[0] + (((long)seta.sig[1]) << 32); 374 case 1: set.sig[0] = seta.sig[0] + (((long)seta.sig[1]) << 32);
378 } 375 }
379 sigdelsetmask(&set, ~_BLOCKABLE); 376 sigdelsetmask(&set, ~_BLOCKABLE);
380 spin_lock_irq(&current->sighand->siglock); 377 set_current_blocked(&set);
381 current->blocked = set;
382 recalc_sigpending();
383 spin_unlock_irq(&current->sighand->siglock);
384 return; 378 return;
385segv: 379segv:
386 force_sig(SIGSEGV, current); 380 force_sig(SIGSEGV, current);
@@ -782,6 +776,7 @@ static inline int handle_signal32(unsigned long signr, struct k_sigaction *ka,
782 siginfo_t *info, 776 siginfo_t *info,
783 sigset_t *oldset, struct pt_regs *regs) 777 sigset_t *oldset, struct pt_regs *regs)
784{ 778{
779 sigset_t blocked;
785 int err; 780 int err;
786 781
787 if (ka->sa.sa_flags & SA_SIGINFO) 782 if (ka->sa.sa_flags & SA_SIGINFO)
@@ -792,12 +787,10 @@ static inline int handle_signal32(unsigned long signr, struct k_sigaction *ka,
792 if (err) 787 if (err)
793 return err; 788 return err;
794 789
795 spin_lock_irq(&current->sighand->siglock); 790 sigorsets(&blocked, &current->blocked, &ka->sa.sa_mask);
796 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
797 if (!(ka->sa.sa_flags & SA_NOMASK)) 791 if (!(ka->sa.sa_flags & SA_NOMASK))
798 sigaddset(&current->blocked,signr); 792 sigaddset(&blocked, signr);
799 recalc_sigpending(); 793 set_current_blocked(&blocked);
800 spin_unlock_irq(&current->sighand->siglock);
801 794
802 tracehook_signal_handler(signr, info, ka, regs, 0); 795 tracehook_signal_handler(signr, info, ka, regs, 0);
803 796
@@ -881,7 +874,7 @@ void do_signal32(sigset_t *oldset, struct pt_regs * regs,
881 */ 874 */
882 if (current_thread_info()->status & TS_RESTORE_SIGMASK) { 875 if (current_thread_info()->status & TS_RESTORE_SIGMASK) {
883 current_thread_info()->status &= ~TS_RESTORE_SIGMASK; 876 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
884 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL); 877 set_current_blocked(&current->saved_sigmask);
885 } 878 }
886} 879}
887 880
diff --git a/arch/sparc/kernel/signal_32.c b/arch/sparc/kernel/signal_32.c
index 04ede8f04add..8ce247ac04cc 100644
--- a/arch/sparc/kernel/signal_32.c
+++ b/arch/sparc/kernel/signal_32.c
@@ -62,12 +62,13 @@ struct rt_signal_frame {
62 62
63static int _sigpause_common(old_sigset_t set) 63static int _sigpause_common(old_sigset_t set)
64{ 64{
65 set &= _BLOCKABLE; 65 sigset_t blocked;
66 spin_lock_irq(&current->sighand->siglock); 66
67 current->saved_sigmask = current->blocked; 67 current->saved_sigmask = current->blocked;
68 siginitset(&current->blocked, set); 68
69 recalc_sigpending(); 69 set &= _BLOCKABLE;
70 spin_unlock_irq(&current->sighand->siglock); 70 siginitset(&blocked, set);
71 set_current_blocked(&blocked);
71 72
72 current->state = TASK_INTERRUPTIBLE; 73 current->state = TASK_INTERRUPTIBLE;
73 schedule(); 74 schedule();
@@ -139,10 +140,7 @@ asmlinkage void do_sigreturn(struct pt_regs *regs)
139 goto segv_and_exit; 140 goto segv_and_exit;
140 141
141 sigdelsetmask(&set, ~_BLOCKABLE); 142 sigdelsetmask(&set, ~_BLOCKABLE);
142 spin_lock_irq(&current->sighand->siglock); 143 set_current_blocked(&set);
143 current->blocked = set;
144 recalc_sigpending();
145 spin_unlock_irq(&current->sighand->siglock);
146 return; 144 return;
147 145
148segv_and_exit: 146segv_and_exit:
@@ -209,10 +207,7 @@ asmlinkage void do_rt_sigreturn(struct pt_regs *regs)
209 } 207 }
210 208
211 sigdelsetmask(&set, ~_BLOCKABLE); 209 sigdelsetmask(&set, ~_BLOCKABLE);
212 spin_lock_irq(&current->sighand->siglock); 210 set_current_blocked(&set);
213 current->blocked = set;
214 recalc_sigpending();
215 spin_unlock_irq(&current->sighand->siglock);
216 return; 211 return;
217segv: 212segv:
218 force_sig(SIGSEGV, current); 213 force_sig(SIGSEGV, current);
@@ -470,6 +465,7 @@ static inline int
470handle_signal(unsigned long signr, struct k_sigaction *ka, 465handle_signal(unsigned long signr, struct k_sigaction *ka,
471 siginfo_t *info, sigset_t *oldset, struct pt_regs *regs) 466 siginfo_t *info, sigset_t *oldset, struct pt_regs *regs)
472{ 467{
468 sigset_t blocked;
473 int err; 469 int err;
474 470
475 if (ka->sa.sa_flags & SA_SIGINFO) 471 if (ka->sa.sa_flags & SA_SIGINFO)
@@ -480,12 +476,10 @@ handle_signal(unsigned long signr, struct k_sigaction *ka,
480 if (err) 476 if (err)
481 return err; 477 return err;
482 478
483 spin_lock_irq(&current->sighand->siglock); 479 sigorsets(&blocked, &current->blocked, &ka->sa.sa_mask);
484 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
485 if (!(ka->sa.sa_flags & SA_NOMASK)) 480 if (!(ka->sa.sa_flags & SA_NOMASK))
486 sigaddset(&current->blocked, signr); 481 sigaddset(&blocked, signr);
487 recalc_sigpending(); 482 set_current_blocked(&blocked);
488 spin_unlock_irq(&current->sighand->siglock);
489 483
490 tracehook_signal_handler(signr, info, ka, regs, 0); 484 tracehook_signal_handler(signr, info, ka, regs, 0);
491 485
@@ -581,7 +575,7 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
581 */ 575 */
582 if (test_thread_flag(TIF_RESTORE_SIGMASK)) { 576 if (test_thread_flag(TIF_RESTORE_SIGMASK)) {
583 clear_thread_flag(TIF_RESTORE_SIGMASK); 577 clear_thread_flag(TIF_RESTORE_SIGMASK);
584 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL); 578 set_current_blocked(&current->saved_sigmask);
585 } 579 }
586} 580}
587 581
diff --git a/arch/sparc/kernel/signal_64.c b/arch/sparc/kernel/signal_64.c
index 47509df3b893..a2b81598d905 100644
--- a/arch/sparc/kernel/signal_64.c
+++ b/arch/sparc/kernel/signal_64.c
@@ -70,10 +70,7 @@ asmlinkage void sparc64_set_context(struct pt_regs *regs)
70 goto do_sigsegv; 70 goto do_sigsegv;
71 } 71 }
72 sigdelsetmask(&set, ~_BLOCKABLE); 72 sigdelsetmask(&set, ~_BLOCKABLE);
73 spin_lock_irq(&current->sighand->siglock); 73 set_current_blocked(&set);
74 current->blocked = set;
75 recalc_sigpending();
76 spin_unlock_irq(&current->sighand->siglock);
77 } 74 }
78 if (test_thread_flag(TIF_32BIT)) { 75 if (test_thread_flag(TIF_32BIT)) {
79 pc &= 0xffffffff; 76 pc &= 0xffffffff;
@@ -242,12 +239,13 @@ struct rt_signal_frame {
242 239
243static long _sigpause_common(old_sigset_t set) 240static long _sigpause_common(old_sigset_t set)
244{ 241{
245 set &= _BLOCKABLE; 242 sigset_t blocked;
246 spin_lock_irq(&current->sighand->siglock); 243
247 current->saved_sigmask = current->blocked; 244 current->saved_sigmask = current->blocked;
248 siginitset(&current->blocked, set); 245
249 recalc_sigpending(); 246 set &= _BLOCKABLE;
250 spin_unlock_irq(&current->sighand->siglock); 247 siginitset(&blocked, set);
248 set_current_blocked(&blocked);
251 249
252 current->state = TASK_INTERRUPTIBLE; 250 current->state = TASK_INTERRUPTIBLE;
253 schedule(); 251 schedule();
@@ -327,10 +325,7 @@ void do_rt_sigreturn(struct pt_regs *regs)
327 pt_regs_clear_syscall(regs); 325 pt_regs_clear_syscall(regs);
328 326
329 sigdelsetmask(&set, ~_BLOCKABLE); 327 sigdelsetmask(&set, ~_BLOCKABLE);
330 spin_lock_irq(&current->sighand->siglock); 328 set_current_blocked(&set);
331 current->blocked = set;
332 recalc_sigpending();
333 spin_unlock_irq(&current->sighand->siglock);
334 return; 329 return;
335segv: 330segv:
336 force_sig(SIGSEGV, current); 331 force_sig(SIGSEGV, current);
@@ -484,18 +479,17 @@ static inline int handle_signal(unsigned long signr, struct k_sigaction *ka,
484 siginfo_t *info, 479 siginfo_t *info,
485 sigset_t *oldset, struct pt_regs *regs) 480 sigset_t *oldset, struct pt_regs *regs)
486{ 481{
482 sigset_t blocked;
487 int err; 483 int err;
488 484
489 err = setup_rt_frame(ka, regs, signr, oldset, 485 err = setup_rt_frame(ka, regs, signr, oldset,
490 (ka->sa.sa_flags & SA_SIGINFO) ? info : NULL); 486 (ka->sa.sa_flags & SA_SIGINFO) ? info : NULL);
491 if (err) 487 if (err)
492 return err; 488 return err;
493 spin_lock_irq(&current->sighand->siglock); 489 sigorsets(&blocked, &current->blocked, &ka->sa.sa_mask);
494 sigorsets(&current->blocked,&current->blocked,&ka->sa.sa_mask);
495 if (!(ka->sa.sa_flags & SA_NOMASK)) 490 if (!(ka->sa.sa_flags & SA_NOMASK))
496 sigaddset(&current->blocked,signr); 491 sigaddset(&blocked, signr);
497 recalc_sigpending(); 492 set_current_blocked(&blocked);
498 spin_unlock_irq(&current->sighand->siglock);
499 493
500 tracehook_signal_handler(signr, info, ka, regs, 0); 494 tracehook_signal_handler(signr, info, ka, regs, 0);
501 495
@@ -601,7 +595,7 @@ static void do_signal(struct pt_regs *regs, unsigned long orig_i0)
601 */ 595 */
602 if (current_thread_info()->status & TS_RESTORE_SIGMASK) { 596 if (current_thread_info()->status & TS_RESTORE_SIGMASK) {
603 current_thread_info()->status &= ~TS_RESTORE_SIGMASK; 597 current_thread_info()->status &= ~TS_RESTORE_SIGMASK;
604 sigprocmask(SIG_SETMASK, &current->saved_sigmask, NULL); 598 set_current_blocked(&current->saved_sigmask);
605 } 599 }
606} 600}
607 601
diff --git a/arch/sparc/mm/init_64.c b/arch/sparc/mm/init_64.c
index 581531dbc8b5..8e073d802139 100644
--- a/arch/sparc/mm/init_64.c
+++ b/arch/sparc/mm/init_64.c
@@ -511,6 +511,11 @@ static void __init read_obp_translations(void)
511 for (i = 0; i < prom_trans_ents; i++) 511 for (i = 0; i < prom_trans_ents; i++)
512 prom_trans[i].data &= ~0x0003fe0000000000UL; 512 prom_trans[i].data &= ~0x0003fe0000000000UL;
513 } 513 }
514
515 /* Force execute bit on. */
516 for (i = 0; i < prom_trans_ents; i++)
517 prom_trans[i].data |= (tlb_type == hypervisor ?
518 _PAGE_EXEC_4V : _PAGE_EXEC_4U);
514} 519}
515 520
516static void __init hypervisor_tlb_lock(unsigned long vaddr, 521static void __init hypervisor_tlb_lock(unsigned long vaddr,
diff --git a/arch/sparc/mm/leon_mm.c b/arch/sparc/mm/leon_mm.c
index e485a6804998..13c2169822a8 100644
--- a/arch/sparc/mm/leon_mm.c
+++ b/arch/sparc/mm/leon_mm.c
@@ -162,7 +162,7 @@ ready:
162 printk(KERN_INFO "swprobe: padde %x\n", paddr_calc); 162 printk(KERN_INFO "swprobe: padde %x\n", paddr_calc);
163 if (paddr) 163 if (paddr)
164 *paddr = paddr_calc; 164 *paddr = paddr_calc;
165 return paddrbase; 165 return pte;
166} 166}
167 167
168void leon_flush_icache_all(void) 168void leon_flush_icache_all(void)
diff --git a/arch/tile/Kconfig b/arch/tile/Kconfig
index b30f71ac0d06..70a0de46cd1b 100644
--- a/arch/tile/Kconfig
+++ b/arch/tile/Kconfig
@@ -46,9 +46,6 @@ config NEED_PER_CPU_PAGE_FIRST_CHUNK
46config SYS_SUPPORTS_HUGETLBFS 46config SYS_SUPPORTS_HUGETLBFS
47 def_bool y 47 def_bool y
48 48
49config GENERIC_TIME
50 def_bool y
51
52config GENERIC_CLOCKEVENTS 49config GENERIC_CLOCKEVENTS
53 def_bool y 50 def_bool y
54 51
diff --git a/arch/tile/configs/tilegx_defconfig b/arch/tile/configs/tilegx_defconfig
index 2ad73fb707b9..dafdbbae1124 100644
--- a/arch/tile/configs/tilegx_defconfig
+++ b/arch/tile/configs/tilegx_defconfig
@@ -11,7 +11,6 @@ CONFIG_HAVE_ARCH_ALLOC_REMAP=y
11CONFIG_HAVE_SETUP_PER_CPU_AREA=y 11CONFIG_HAVE_SETUP_PER_CPU_AREA=y
12CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y 12CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
13CONFIG_SYS_SUPPORTS_HUGETLBFS=y 13CONFIG_SYS_SUPPORTS_HUGETLBFS=y
14CONFIG_GENERIC_TIME=y
15CONFIG_GENERIC_CLOCKEVENTS=y 14CONFIG_GENERIC_CLOCKEVENTS=y
16CONFIG_RWSEM_GENERIC_SPINLOCK=y 15CONFIG_RWSEM_GENERIC_SPINLOCK=y
17CONFIG_DEFAULT_MIGRATION_COST=10000000 16CONFIG_DEFAULT_MIGRATION_COST=10000000
diff --git a/arch/tile/configs/tilepro_defconfig b/arch/tile/configs/tilepro_defconfig
index f58dc362b944..6f05f969b564 100644
--- a/arch/tile/configs/tilepro_defconfig
+++ b/arch/tile/configs/tilepro_defconfig
@@ -11,7 +11,6 @@ CONFIG_HAVE_ARCH_ALLOC_REMAP=y
11CONFIG_HAVE_SETUP_PER_CPU_AREA=y 11CONFIG_HAVE_SETUP_PER_CPU_AREA=y
12CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y 12CONFIG_NEED_PER_CPU_PAGE_FIRST_CHUNK=y
13CONFIG_SYS_SUPPORTS_HUGETLBFS=y 13CONFIG_SYS_SUPPORTS_HUGETLBFS=y
14CONFIG_GENERIC_TIME=y
15CONFIG_GENERIC_CLOCKEVENTS=y 14CONFIG_GENERIC_CLOCKEVENTS=y
16CONFIG_RWSEM_GENERIC_SPINLOCK=y 15CONFIG_RWSEM_GENERIC_SPINLOCK=y
17CONFIG_DEFAULT_MIGRATION_COST=10000000 16CONFIG_DEFAULT_MIGRATION_COST=10000000
diff --git a/arch/tile/kernel/intvec_32.S b/arch/tile/kernel/intvec_32.S
index fc94607f0bd5..aecc8ed5f39b 100644
--- a/arch/tile/kernel/intvec_32.S
+++ b/arch/tile/kernel/intvec_32.S
@@ -21,7 +21,7 @@
21#include <asm/ptrace.h> 21#include <asm/ptrace.h>
22#include <asm/thread_info.h> 22#include <asm/thread_info.h>
23#include <asm/irqflags.h> 23#include <asm/irqflags.h>
24#include <linux/atomic.h> 24#include <asm/atomic_32.h>
25#include <asm/asm-offsets.h> 25#include <asm/asm-offsets.h>
26#include <hv/hypervisor.h> 26#include <hv/hypervisor.h>
27#include <arch/abi.h> 27#include <arch/abi.h>
diff --git a/arch/tile/lib/atomic_asm_32.S b/arch/tile/lib/atomic_asm_32.S
index 1f75a2a56101..30638042691d 100644
--- a/arch/tile/lib/atomic_asm_32.S
+++ b/arch/tile/lib/atomic_asm_32.S
@@ -70,7 +70,7 @@
70 */ 70 */
71 71
72#include <linux/linkage.h> 72#include <linux/linkage.h>
73#include <linux/atomic.h> 73#include <asm/atomic_32.h>
74#include <asm/page.h> 74#include <asm/page.h>
75#include <asm/processor.h> 75#include <asm/processor.h>
76 76
diff --git a/arch/um/Kconfig.x86 b/arch/um/Kconfig.x86
index d31ecf346b4e..21bebe63df66 100644
--- a/arch/um/Kconfig.x86
+++ b/arch/um/Kconfig.x86
@@ -10,6 +10,10 @@ config CMPXCHG_LOCAL
10 bool 10 bool
11 default n 11 default n
12 12
13config CMPXCHG_DOUBLE
14 bool
15 default n
16
13source "arch/x86/Kconfig.cpu" 17source "arch/x86/Kconfig.cpu"
14 18
15endmenu 19endmenu
diff --git a/arch/um/Makefile b/arch/um/Makefile
index fab8121d2b32..c0f712cc7c5f 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -41,7 +41,7 @@ KBUILD_CPPFLAGS += -I$(srctree)/$(ARCH_DIR)/sys-$(SUBARCH)
41KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) -D__arch_um__ -DSUBARCH=\"$(SUBARCH)\" \ 41KBUILD_CFLAGS += $(CFLAGS) $(CFLAGS-y) -D__arch_um__ -DSUBARCH=\"$(SUBARCH)\" \
42 $(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap \ 42 $(ARCH_INCLUDE) $(MODE_INCLUDE) -Dvmap=kernel_vmap \
43 -Din6addr_loopback=kernel_in6addr_loopback \ 43 -Din6addr_loopback=kernel_in6addr_loopback \
44 -Din6addr_any=kernel_in6addr_any 44 -Din6addr_any=kernel_in6addr_any -Dstrrchr=kernel_strrchr
45 45
46KBUILD_AFLAGS += $(ARCH_INCLUDE) 46KBUILD_AFLAGS += $(ARCH_INCLUDE)
47 47
diff --git a/arch/um/defconfig b/arch/um/defconfig
index 9f7634f08cf3..761f5e1a657e 100644
--- a/arch/um/defconfig
+++ b/arch/um/defconfig
@@ -13,7 +13,6 @@ CONFIG_LOCKDEP_SUPPORT=y
13# CONFIG_STACKTRACE_SUPPORT is not set 13# CONFIG_STACKTRACE_SUPPORT is not set
14CONFIG_GENERIC_CALIBRATE_DELAY=y 14CONFIG_GENERIC_CALIBRATE_DELAY=y
15CONFIG_GENERIC_BUG=y 15CONFIG_GENERIC_BUG=y
16CONFIG_GENERIC_TIME=y
17CONFIG_GENERIC_CLOCKEVENTS=y 16CONFIG_GENERIC_CLOCKEVENTS=y
18CONFIG_IRQ_RELEASE_METHOD=y 17CONFIG_IRQ_RELEASE_METHOD=y
19CONFIG_HZ=100 18CONFIG_HZ=100
diff --git a/arch/um/drivers/line.c b/arch/um/drivers/line.c
index d51c404239a8..364c8a15c4c3 100644
--- a/arch/um/drivers/line.c
+++ b/arch/um/drivers/line.c
@@ -399,8 +399,8 @@ int line_setup_irq(int fd, int input, int output, struct line *line, void *data)
399 * is done under a spinlock. Checking whether the device is in use is 399 * is done under a spinlock. Checking whether the device is in use is
400 * line->tty->count > 1, also under the spinlock. 400 * line->tty->count > 1, also under the spinlock.
401 * 401 *
402 * tty->count serves to decide whether the device should be enabled or 402 * line->count serves to decide whether the device should be enabled or
403 * disabled on the host. If it's equal to 1, then we are doing the 403 * disabled on the host. If it's equal to 0, then we are doing the
404 * first open or last close. Otherwise, open and close just return. 404 * first open or last close. Otherwise, open and close just return.
405 */ 405 */
406 406
@@ -414,16 +414,16 @@ int line_open(struct line *lines, struct tty_struct *tty)
414 goto out_unlock; 414 goto out_unlock;
415 415
416 err = 0; 416 err = 0;
417 if (tty->count > 1) 417 if (line->count++)
418 goto out_unlock; 418 goto out_unlock;
419 419
420 spin_unlock(&line->count_lock); 420 BUG_ON(tty->driver_data);
421
422 tty->driver_data = line; 421 tty->driver_data = line;
423 line->tty = tty; 422 line->tty = tty;
424 423
424 spin_unlock(&line->count_lock);
425 err = enable_chan(line); 425 err = enable_chan(line);
426 if (err) 426 if (err) /* line_close() will be called by our caller */
427 return err; 427 return err;
428 428
429 INIT_DELAYED_WORK(&line->task, line_timer_cb); 429 INIT_DELAYED_WORK(&line->task, line_timer_cb);
@@ -436,7 +436,7 @@ int line_open(struct line *lines, struct tty_struct *tty)
436 chan_window_size(&line->chan_list, &tty->winsize.ws_row, 436 chan_window_size(&line->chan_list, &tty->winsize.ws_row,
437 &tty->winsize.ws_col); 437 &tty->winsize.ws_col);
438 438
439 return err; 439 return 0;
440 440
441out_unlock: 441out_unlock:
442 spin_unlock(&line->count_lock); 442 spin_unlock(&line->count_lock);
@@ -460,17 +460,16 @@ void line_close(struct tty_struct *tty, struct file * filp)
460 flush_buffer(line); 460 flush_buffer(line);
461 461
462 spin_lock(&line->count_lock); 462 spin_lock(&line->count_lock);
463 if (!line->valid) 463 BUG_ON(!line->valid);
464 goto out_unlock;
465 464
466 if (tty->count > 1) 465 if (--line->count)
467 goto out_unlock; 466 goto out_unlock;
468 467
469 spin_unlock(&line->count_lock);
470
471 line->tty = NULL; 468 line->tty = NULL;
472 tty->driver_data = NULL; 469 tty->driver_data = NULL;
473 470
471 spin_unlock(&line->count_lock);
472
474 if (line->sigio) { 473 if (line->sigio) {
475 unregister_winch(tty); 474 unregister_winch(tty);
476 line->sigio = 0; 475 line->sigio = 0;
@@ -498,7 +497,7 @@ static int setup_one_line(struct line *lines, int n, char *init, int init_prio,
498 497
499 spin_lock(&line->count_lock); 498 spin_lock(&line->count_lock);
500 499
501 if (line->tty != NULL) { 500 if (line->count) {
502 *error_out = "Device is already open"; 501 *error_out = "Device is already open";
503 goto out; 502 goto out;
504 } 503 }
@@ -722,41 +721,53 @@ struct winch {
722 int pid; 721 int pid;
723 struct tty_struct *tty; 722 struct tty_struct *tty;
724 unsigned long stack; 723 unsigned long stack;
724 struct work_struct work;
725}; 725};
726 726
727static void free_winch(struct winch *winch, int free_irq_ok) 727static void __free_winch(struct work_struct *work)
728{ 728{
729 if (free_irq_ok) 729 struct winch *winch = container_of(work, struct winch, work);
730 free_irq(WINCH_IRQ, winch); 730 free_irq(WINCH_IRQ, winch);
731
732 list_del(&winch->list);
733 731
734 if (winch->pid != -1) 732 if (winch->pid != -1)
735 os_kill_process(winch->pid, 1); 733 os_kill_process(winch->pid, 1);
736 if (winch->fd != -1)
737 os_close_file(winch->fd);
738 if (winch->stack != 0) 734 if (winch->stack != 0)
739 free_stack(winch->stack, 0); 735 free_stack(winch->stack, 0);
740 kfree(winch); 736 kfree(winch);
741} 737}
742 738
739static void free_winch(struct winch *winch)
740{
741 int fd = winch->fd;
742 winch->fd = -1;
743 if (fd != -1)
744 os_close_file(fd);
745 list_del(&winch->list);
746 __free_winch(&winch->work);
747}
748
743static irqreturn_t winch_interrupt(int irq, void *data) 749static irqreturn_t winch_interrupt(int irq, void *data)
744{ 750{
745 struct winch *winch = data; 751 struct winch *winch = data;
746 struct tty_struct *tty; 752 struct tty_struct *tty;
747 struct line *line; 753 struct line *line;
754 int fd = winch->fd;
748 int err; 755 int err;
749 char c; 756 char c;
750 757
751 if (winch->fd != -1) { 758 if (fd != -1) {
752 err = generic_read(winch->fd, &c, NULL); 759 err = generic_read(fd, &c, NULL);
753 if (err < 0) { 760 if (err < 0) {
754 if (err != -EAGAIN) { 761 if (err != -EAGAIN) {
762 winch->fd = -1;
763 list_del(&winch->list);
764 os_close_file(fd);
755 printk(KERN_ERR "winch_interrupt : " 765 printk(KERN_ERR "winch_interrupt : "
756 "read failed, errno = %d\n", -err); 766 "read failed, errno = %d\n", -err);
757 printk(KERN_ERR "fd %d is losing SIGWINCH " 767 printk(KERN_ERR "fd %d is losing SIGWINCH "
758 "support\n", winch->tty_fd); 768 "support\n", winch->tty_fd);
759 free_winch(winch, 0); 769 INIT_WORK(&winch->work, __free_winch);
770 schedule_work(&winch->work);
760 return IRQ_HANDLED; 771 return IRQ_HANDLED;
761 } 772 }
762 goto out; 773 goto out;
@@ -828,7 +839,7 @@ static void unregister_winch(struct tty_struct *tty)
828 list_for_each_safe(ele, next, &winch_handlers) { 839 list_for_each_safe(ele, next, &winch_handlers) {
829 winch = list_entry(ele, struct winch, list); 840 winch = list_entry(ele, struct winch, list);
830 if (winch->tty == tty) { 841 if (winch->tty == tty) {
831 free_winch(winch, 1); 842 free_winch(winch);
832 break; 843 break;
833 } 844 }
834 } 845 }
@@ -844,7 +855,7 @@ static void winch_cleanup(void)
844 855
845 list_for_each_safe(ele, next, &winch_handlers) { 856 list_for_each_safe(ele, next, &winch_handlers) {
846 winch = list_entry(ele, struct winch, list); 857 winch = list_entry(ele, struct winch, list);
847 free_winch(winch, 1); 858 free_winch(winch);
848 } 859 }
849 860
850 spin_unlock(&winch_handler_lock); 861 spin_unlock(&winch_handler_lock);
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index 22745b47c829..a492e59883a3 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -368,7 +368,7 @@ static const struct net_device_ops uml_netdev_ops = {
368 .ndo_open = uml_net_open, 368 .ndo_open = uml_net_open,
369 .ndo_stop = uml_net_close, 369 .ndo_stop = uml_net_close,
370 .ndo_start_xmit = uml_net_start_xmit, 370 .ndo_start_xmit = uml_net_start_xmit,
371 .ndo_set_multicast_list = uml_net_set_multicast_list, 371 .ndo_set_rx_mode = uml_net_set_multicast_list,
372 .ndo_tx_timeout = uml_net_tx_timeout, 372 .ndo_tx_timeout = uml_net_tx_timeout,
373 .ndo_set_mac_address = eth_mac_addr, 373 .ndo_set_mac_address = eth_mac_addr,
374 .ndo_change_mtu = uml_net_change_mtu, 374 .ndo_change_mtu = uml_net_change_mtu,
diff --git a/arch/um/drivers/xterm.c b/arch/um/drivers/xterm.c
index 8ac7146c237f..2e1de5728604 100644
--- a/arch/um/drivers/xterm.c
+++ b/arch/um/drivers/xterm.c
@@ -123,6 +123,7 @@ static int xterm_open(int input, int output, int primary, void *d,
123 err = -errno; 123 err = -errno;
124 printk(UM_KERN_ERR "xterm_open : unlink failed, errno = %d\n", 124 printk(UM_KERN_ERR "xterm_open : unlink failed, errno = %d\n",
125 errno); 125 errno);
126 close(fd);
126 return err; 127 return err;
127 } 128 }
128 close(fd); 129 close(fd);
diff --git a/arch/um/include/asm/ptrace-generic.h b/arch/um/include/asm/ptrace-generic.h
index ae084ad1a3a0..1a7d2757fe05 100644
--- a/arch/um/include/asm/ptrace-generic.h
+++ b/arch/um/include/asm/ptrace-generic.h
@@ -42,10 +42,6 @@ extern long subarch_ptrace(struct task_struct *child, long request,
42 unsigned long addr, unsigned 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,
46 struct task_struct *child);
47extern int set_fpregs(struct user_i387_struct __user *buf,
48 struct task_struct *child);
49 45
50extern int arch_copy_tls(struct task_struct *new); 46extern int arch_copy_tls(struct task_struct *new);
51extern void clear_flushed_tls(struct task_struct *task); 47extern void clear_flushed_tls(struct task_struct *task);
diff --git a/arch/um/include/shared/line.h b/arch/um/include/shared/line.h
index 72f4f25af247..63df3ca02ac2 100644
--- a/arch/um/include/shared/line.h
+++ b/arch/um/include/shared/line.h
@@ -33,6 +33,7 @@ struct line_driver {
33struct line { 33struct line {
34 struct tty_struct *tty; 34 struct tty_struct *tty;
35 spinlock_t count_lock; 35 spinlock_t count_lock;
36 unsigned long count;
36 int valid; 37 int valid;
37 38
38 char *init_str; 39 char *init_str;
diff --git a/arch/um/include/shared/registers.h b/arch/um/include/shared/registers.h
index b0b4589e0ebc..f1e0aa56c52a 100644
--- a/arch/um/include/shared/registers.h
+++ b/arch/um/include/shared/registers.h
@@ -16,7 +16,7 @@ extern int restore_fpx_registers(int pid, unsigned long *fp_regs);
16extern int save_registers(int pid, struct uml_pt_regs *regs); 16extern int save_registers(int pid, struct uml_pt_regs *regs);
17extern int restore_registers(int pid, struct uml_pt_regs *regs); 17extern int restore_registers(int pid, struct uml_pt_regs *regs);
18extern int init_registers(int pid); 18extern int init_registers(int pid);
19extern void get_safe_registers(unsigned long *regs); 19extern void get_safe_registers(unsigned long *regs, unsigned long *fp_regs);
20extern unsigned long get_thread_reg(int reg, jmp_buf *buf); 20extern unsigned long get_thread_reg(int reg, jmp_buf *buf);
21extern int get_fp_registers(int pid, unsigned long *regs); 21extern int get_fp_registers(int pid, unsigned long *regs);
22extern int put_fp_registers(int pid, unsigned long *regs); 22extern int put_fp_registers(int pid, unsigned long *regs);
diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c
index fab4371184f6..21c1ae7c3d75 100644
--- a/arch/um/kernel/process.c
+++ b/arch/um/kernel/process.c
@@ -202,7 +202,7 @@ int copy_thread(unsigned long clone_flags, unsigned long sp,
202 arch_copy_thread(&current->thread.arch, &p->thread.arch); 202 arch_copy_thread(&current->thread.arch, &p->thread.arch);
203 } 203 }
204 else { 204 else {
205 get_safe_registers(p->thread.regs.regs.gp); 205 get_safe_registers(p->thread.regs.regs.gp, p->thread.regs.regs.fp);
206 p->thread.request.u.thread = current->thread.request.u.thread; 206 p->thread.request.u.thread = current->thread.request.u.thread;
207 handler = new_thread_handler; 207 handler = new_thread_handler;
208 } 208 }
diff --git a/arch/um/kernel/ptrace.c b/arch/um/kernel/ptrace.c
index 701b672c1122..c9da32b0c707 100644
--- a/arch/um/kernel/ptrace.c
+++ b/arch/um/kernel/ptrace.c
@@ -50,23 +50,11 @@ long arch_ptrace(struct task_struct *child, long request,
50 void __user *vp = p; 50 void __user *vp = p;
51 51
52 switch (request) { 52 switch (request) {
53 /* read word at location addr. */
54 case PTRACE_PEEKTEXT:
55 case PTRACE_PEEKDATA:
56 ret = generic_ptrace_peekdata(child, addr, data);
57 break;
58
59 /* read the word at location addr in the USER area. */ 53 /* read the word at location addr in the USER area. */
60 case PTRACE_PEEKUSR: 54 case PTRACE_PEEKUSR:
61 ret = peek_user(child, addr, data); 55 ret = peek_user(child, addr, data);
62 break; 56 break;
63 57
64 /* write the word at location addr. */
65 case PTRACE_POKETEXT:
66 case PTRACE_POKEDATA:
67 ret = generic_ptrace_pokedata(child, addr, data);
68 break;
69
70 /* write the word at location addr in the USER area */ 58 /* write the word at location addr in the USER area */
71 case PTRACE_POKEUSR: 59 case PTRACE_POKEUSR:
72 ret = poke_user(child, addr, data); 60 ret = poke_user(child, addr, data);
@@ -107,16 +95,6 @@ long arch_ptrace(struct task_struct *child, long request,
107 break; 95 break;
108 } 96 }
109#endif 97#endif
110#ifdef PTRACE_GETFPREGS
111 case PTRACE_GETFPREGS: /* Get the child FPU state. */
112 ret = get_fpregs(vp, child);
113 break;
114#endif
115#ifdef PTRACE_SETFPREGS
116 case PTRACE_SETFPREGS: /* Set the child FPU state. */
117 ret = set_fpregs(vp, child);
118 break;
119#endif
120 case PTRACE_GET_THREAD_AREA: 98 case PTRACE_GET_THREAD_AREA:
121 ret = ptrace_get_thread_area(child, addr, vp); 99 ret = ptrace_get_thread_area(child, addr, vp);
122 break; 100 break;
@@ -154,12 +132,6 @@ long arch_ptrace(struct task_struct *child, long request,
154 break; 132 break;
155 } 133 }
156#endif 134#endif
157#ifdef PTRACE_ARCH_PRCTL
158 case PTRACE_ARCH_PRCTL:
159 /* XXX Calls ptrace on the host - needs some SMP thinking */
160 ret = arch_prctl(child, data, (void __user *) addr);
161 break;
162#endif
163 default: 135 default:
164 ret = ptrace_request(child, request, addr, data); 136 ret = ptrace_request(child, request, addr, data);
165 if (ret == -EIO) 137 if (ret == -EIO)
diff --git a/arch/um/os-Linux/registers.c b/arch/um/os-Linux/registers.c
index 830fe6a1518a..b866b9e3bef9 100644
--- a/arch/um/os-Linux/registers.c
+++ b/arch/um/os-Linux/registers.c
@@ -8,6 +8,8 @@
8#include <string.h> 8#include <string.h>
9#include <sys/ptrace.h> 9#include <sys/ptrace.h>
10#include "sysdep/ptrace.h" 10#include "sysdep/ptrace.h"
11#include "sysdep/ptrace_user.h"
12#include "registers.h"
11 13
12int save_registers(int pid, struct uml_pt_regs *regs) 14int save_registers(int pid, struct uml_pt_regs *regs)
13{ 15{
@@ -32,6 +34,7 @@ int restore_registers(int pid, struct uml_pt_regs *regs)
32/* This is set once at boot time and not changed thereafter */ 34/* This is set once at boot time and not changed thereafter */
33 35
34static unsigned long exec_regs[MAX_REG_NR]; 36static unsigned long exec_regs[MAX_REG_NR];
37static unsigned long exec_fp_regs[FP_SIZE];
35 38
36int init_registers(int pid) 39int init_registers(int pid)
37{ 40{
@@ -42,10 +45,14 @@ int init_registers(int pid)
42 return -errno; 45 return -errno;
43 46
44 arch_init_registers(pid); 47 arch_init_registers(pid);
48 get_fp_registers(pid, exec_fp_regs);
45 return 0; 49 return 0;
46} 50}
47 51
48void get_safe_registers(unsigned long *regs) 52void get_safe_registers(unsigned long *regs, unsigned long *fp_regs)
49{ 53{
50 memcpy(regs, exec_regs, sizeof(exec_regs)); 54 memcpy(regs, exec_regs, sizeof(exec_regs));
55
56 if (fp_regs)
57 memcpy(fp_regs, exec_fp_regs, sizeof(exec_fp_regs));
51} 58}
diff --git a/arch/um/os-Linux/skas/mem.c b/arch/um/os-Linux/skas/mem.c
index d261f170d120..e771398be5f3 100644
--- a/arch/um/os-Linux/skas/mem.c
+++ b/arch/um/os-Linux/skas/mem.c
@@ -39,7 +39,7 @@ static unsigned long syscall_regs[MAX_REG_NR];
39 39
40static int __init init_syscall_regs(void) 40static int __init init_syscall_regs(void)
41{ 41{
42 get_safe_registers(syscall_regs); 42 get_safe_registers(syscall_regs, NULL);
43 syscall_regs[REGS_IP_INDEX] = STUB_CODE + 43 syscall_regs[REGS_IP_INDEX] = STUB_CODE +
44 ((unsigned long) &batch_syscall_stub - 44 ((unsigned long) &batch_syscall_stub -
45 (unsigned long) &__syscall_stub_start); 45 (unsigned long) &__syscall_stub_start);
diff --git a/arch/um/os-Linux/skas/process.c b/arch/um/os-Linux/skas/process.c
index d6e0a2234b86..dee0e8cf8ad0 100644
--- a/arch/um/os-Linux/skas/process.c
+++ b/arch/um/os-Linux/skas/process.c
@@ -373,6 +373,9 @@ void userspace(struct uml_pt_regs *regs)
373 if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp)) 373 if (ptrace(PTRACE_SETREGS, pid, 0, regs->gp))
374 fatal_sigsegv(); 374 fatal_sigsegv();
375 375
376 if (put_fp_registers(pid, regs->fp))
377 fatal_sigsegv();
378
376 /* Now we set local_using_sysemu to be used for one loop */ 379 /* Now we set local_using_sysemu to be used for one loop */
377 local_using_sysemu = get_using_sysemu(); 380 local_using_sysemu = get_using_sysemu();
378 381
@@ -399,6 +402,12 @@ void userspace(struct uml_pt_regs *regs)
399 fatal_sigsegv(); 402 fatal_sigsegv();
400 } 403 }
401 404
405 if (get_fp_registers(pid, regs->fp)) {
406 printk(UM_KERN_ERR "userspace - get_fp_registers failed, "
407 "errno = %d\n", errno);
408 fatal_sigsegv();
409 }
410
402 UPT_SYSCALL_NR(regs) = -1; /* Assume: It's not a syscall */ 411 UPT_SYSCALL_NR(regs) = -1; /* Assume: It's not a syscall */
403 412
404 if (WIFSTOPPED(status)) { 413 if (WIFSTOPPED(status)) {
@@ -457,10 +466,11 @@ void userspace(struct uml_pt_regs *regs)
457} 466}
458 467
459static unsigned long thread_regs[MAX_REG_NR]; 468static unsigned long thread_regs[MAX_REG_NR];
469static unsigned long thread_fp_regs[FP_SIZE];
460 470
461static int __init init_thread_regs(void) 471static int __init init_thread_regs(void)
462{ 472{
463 get_safe_registers(thread_regs); 473 get_safe_registers(thread_regs, thread_fp_regs);
464 /* Set parent's instruction pointer to start of clone-stub */ 474 /* Set parent's instruction pointer to start of clone-stub */
465 thread_regs[REGS_IP_INDEX] = STUB_CODE + 475 thread_regs[REGS_IP_INDEX] = STUB_CODE +
466 (unsigned long) stub_clone_handler - 476 (unsigned long) stub_clone_handler -
@@ -503,6 +513,13 @@ int copy_context_skas0(unsigned long new_stack, int pid)
503 return err; 513 return err;
504 } 514 }
505 515
516 err = put_fp_registers(pid, thread_fp_regs);
517 if (err < 0) {
518 printk(UM_KERN_ERR "copy_context_skas0 : put_fp_registers "
519 "failed, pid = %d, err = %d\n", pid, err);
520 return err;
521 }
522
506 /* set a well known return code for detection of child write failure */ 523 /* set a well known return code for detection of child write failure */
507 child_data->err = 12345678; 524 child_data->err = 12345678;
508 525
diff --git a/arch/um/sys-i386/asm/ptrace.h b/arch/um/sys-i386/asm/ptrace.h
index 0273e4d09af7..5d2a59112537 100644
--- a/arch/um/sys-i386/asm/ptrace.h
+++ b/arch/um/sys-i386/asm/ptrace.h
@@ -42,11 +42,6 @@
42 */ 42 */
43struct user_desc; 43struct user_desc;
44 44
45extern int get_fpxregs(struct user_fxsr_struct __user *buf,
46 struct task_struct *child);
47extern int set_fpxregs(struct user_fxsr_struct __user *buf,
48 struct task_struct *tsk);
49
50extern int ptrace_get_thread_area(struct task_struct *child, int idx, 45extern int ptrace_get_thread_area(struct task_struct *child, int idx,
51 struct user_desc __user *user_desc); 46 struct user_desc __user *user_desc);
52 47
diff --git a/arch/um/sys-i386/ptrace.c b/arch/um/sys-i386/ptrace.c
index d23b2d3ea384..3375c2717851 100644
--- a/arch/um/sys-i386/ptrace.c
+++ b/arch/um/sys-i386/ptrace.c
@@ -145,7 +145,7 @@ int peek_user(struct task_struct *child, long addr, long data)
145 return put_user(tmp, (unsigned long __user *) data); 145 return put_user(tmp, (unsigned long __user *) data);
146} 146}
147 147
148int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) 148static int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
149{ 149{
150 int err, n, cpu = ((struct thread_info *) child->stack)->cpu; 150 int err, n, cpu = ((struct thread_info *) child->stack)->cpu;
151 struct user_i387_struct fpregs; 151 struct user_i387_struct fpregs;
@@ -161,7 +161,7 @@ int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
161 return n; 161 return n;
162} 162}
163 163
164int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) 164static int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
165{ 165{
166 int n, cpu = ((struct thread_info *) child->stack)->cpu; 166 int n, cpu = ((struct thread_info *) child->stack)->cpu;
167 struct user_i387_struct fpregs; 167 struct user_i387_struct fpregs;
@@ -174,7 +174,7 @@ int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
174 (unsigned long *) &fpregs); 174 (unsigned long *) &fpregs);
175} 175}
176 176
177int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child) 177static int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
178{ 178{
179 int err, n, cpu = ((struct thread_info *) child->stack)->cpu; 179 int err, n, cpu = ((struct thread_info *) child->stack)->cpu;
180 struct user_fxsr_struct fpregs; 180 struct user_fxsr_struct fpregs;
@@ -190,7 +190,7 @@ int get_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
190 return n; 190 return n;
191} 191}
192 192
193int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child) 193static int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
194{ 194{
195 int n, cpu = ((struct thread_info *) child->stack)->cpu; 195 int n, cpu = ((struct thread_info *) child->stack)->cpu;
196 struct user_fxsr_struct fpregs; 196 struct user_fxsr_struct fpregs;
@@ -206,5 +206,23 @@ int set_fpxregs(struct user_fxsr_struct __user *buf, struct task_struct *child)
206long subarch_ptrace(struct task_struct *child, long request, 206long subarch_ptrace(struct task_struct *child, long request,
207 unsigned long addr, unsigned long data) 207 unsigned long addr, unsigned long data)
208{ 208{
209 return -EIO; 209 int ret = -EIO;
210 void __user *datap = (void __user *) data;
211 switch (request) {
212 case PTRACE_GETFPREGS: /* Get the child FPU state. */
213 ret = get_fpregs(datap, child);
214 break;
215 case PTRACE_SETFPREGS: /* Set the child FPU state. */
216 ret = set_fpregs(datap, child);
217 break;
218 case PTRACE_GETFPXREGS: /* Get the child FPU state. */
219 ret = get_fpxregs(datap, child);
220 break;
221 case PTRACE_SETFPXREGS: /* Set the child FPU state. */
222 ret = set_fpxregs(datap, child);
223 break;
224 default:
225 ret = -EIO;
226 }
227 return ret;
210} 228}
diff --git a/arch/um/sys-i386/shared/sysdep/ptrace.h b/arch/um/sys-i386/shared/sysdep/ptrace.h
index d50e62e07070..c398a5076111 100644
--- a/arch/um/sys-i386/shared/sysdep/ptrace.h
+++ b/arch/um/sys-i386/shared/sysdep/ptrace.h
@@ -53,6 +53,7 @@ extern int sysemu_supported;
53 53
54struct uml_pt_regs { 54struct uml_pt_regs {
55 unsigned long gp[MAX_REG_NR]; 55 unsigned long gp[MAX_REG_NR];
56 unsigned long fp[HOST_FPX_SIZE];
56 struct faultinfo faultinfo; 57 struct faultinfo faultinfo;
57 long syscall; 58 long syscall;
58 int is_user; 59 int is_user;
diff --git a/arch/um/sys-x86_64/ptrace.c b/arch/um/sys-x86_64/ptrace.c
index f43613643cdb..4005506834fd 100644
--- a/arch/um/sys-x86_64/ptrace.c
+++ b/arch/um/sys-x86_64/ptrace.c
@@ -145,7 +145,7 @@ int is_syscall(unsigned long addr)
145 return instr == 0x050f; 145 return instr == 0x050f;
146} 146}
147 147
148int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) 148static int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
149{ 149{
150 int err, n, cpu = ((struct thread_info *) child->stack)->cpu; 150 int err, n, cpu = ((struct thread_info *) child->stack)->cpu;
151 long fpregs[HOST_FP_SIZE]; 151 long fpregs[HOST_FP_SIZE];
@@ -162,7 +162,7 @@ int get_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
162 return n; 162 return n;
163} 163}
164 164
165int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child) 165static int set_fpregs(struct user_i387_struct __user *buf, struct task_struct *child)
166{ 166{
167 int n, cpu = ((struct thread_info *) child->stack)->cpu; 167 int n, cpu = ((struct thread_info *) child->stack)->cpu;
168 long fpregs[HOST_FP_SIZE]; 168 long fpregs[HOST_FP_SIZE];
@@ -182,12 +182,16 @@ long subarch_ptrace(struct task_struct *child, long request,
182 void __user *datap = (void __user *) data; 182 void __user *datap = (void __user *) data;
183 183
184 switch (request) { 184 switch (request) {
185 case PTRACE_GETFPXREGS: /* Get the child FPU state. */ 185 case PTRACE_GETFPREGS: /* Get the child FPU state. */
186 ret = get_fpregs(datap, child); 186 ret = get_fpregs(datap, child);
187 break; 187 break;
188 case PTRACE_SETFPXREGS: /* Set the child FPU state. */ 188 case PTRACE_SETFPREGS: /* Set the child FPU state. */
189 ret = set_fpregs(datap, child); 189 ret = set_fpregs(datap, child);
190 break; 190 break;
191 case PTRACE_ARCH_PRCTL:
192 /* XXX Calls ptrace on the host - needs some SMP thinking */
193 ret = arch_prctl(child, data, (void __user *) addr);
194 break;
191 } 195 }
192 196
193 return ret; 197 return ret;
diff --git a/arch/um/sys-x86_64/shared/sysdep/ptrace.h b/arch/um/sys-x86_64/shared/sysdep/ptrace.h
index fdba5457947a..8ee8f8e12af1 100644
--- a/arch/um/sys-x86_64/shared/sysdep/ptrace.h
+++ b/arch/um/sys-x86_64/shared/sysdep/ptrace.h
@@ -85,6 +85,7 @@
85 85
86struct uml_pt_regs { 86struct uml_pt_regs {
87 unsigned long gp[MAX_REG_NR]; 87 unsigned long gp[MAX_REG_NR];
88 unsigned long fp[HOST_FP_SIZE];
88 struct faultinfo faultinfo; 89 struct faultinfo faultinfo;
89 long syscall; 90 long syscall;
90 int is_user; 91 int is_user;
diff --git a/arch/unicore32/include/asm/io.h b/arch/unicore32/include/asm/io.h
index 4bd87f3d13d4..1a5c5a5eb39c 100644
--- a/arch/unicore32/include/asm/io.h
+++ b/arch/unicore32/include/asm/io.h
@@ -32,7 +32,7 @@ extern void __uc32_iounmap(volatile void __iomem *addr);
32 * ioremap and friends. 32 * ioremap and friends.
33 * 33 *
34 * ioremap takes a PCI memory address, as specified in 34 * ioremap takes a PCI memory address, as specified in
35 * Documentation/IO-mapping.txt. 35 * Documentation/io-mapping.txt.
36 * 36 *
37 */ 37 */
38#define ioremap(cookie, size) __uc32_ioremap(cookie, size) 38#define ioremap(cookie, size) __uc32_ioremap(cookie, size)
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index 6a47bb22657f..77f7a384c0b5 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -64,10 +64,12 @@ config X86
64 select HAVE_TEXT_POKE_SMP 64 select HAVE_TEXT_POKE_SMP
65 select HAVE_GENERIC_HARDIRQS 65 select HAVE_GENERIC_HARDIRQS
66 select HAVE_SPARSE_IRQ 66 select HAVE_SPARSE_IRQ
67 select SPARSE_IRQ
67 select GENERIC_FIND_FIRST_BIT 68 select GENERIC_FIND_FIRST_BIT
68 select GENERIC_IRQ_PROBE 69 select GENERIC_IRQ_PROBE
69 select GENERIC_PENDING_IRQ if SMP 70 select GENERIC_PENDING_IRQ if SMP
70 select GENERIC_IRQ_SHOW 71 select GENERIC_IRQ_SHOW
72 select GENERIC_CLOCKEVENTS_MIN_ADJUST
71 select IRQ_FORCED_THREADING 73 select IRQ_FORCED_THREADING
72 select USE_GENERIC_SMP_HELPERS if SMP 74 select USE_GENERIC_SMP_HELPERS if SMP
73 select HAVE_BPF_JIT if (X86_64 && NET) 75 select HAVE_BPF_JIT if (X86_64 && NET)
@@ -130,7 +132,7 @@ config SBUS
130 bool 132 bool
131 133
132config NEED_DMA_MAP_STATE 134config NEED_DMA_MAP_STATE
133 def_bool (X86_64 || DMAR || DMA_API_DEBUG) 135 def_bool (X86_64 || INTEL_IOMMU || DMA_API_DEBUG)
134 136
135config NEED_SG_DMA_LENGTH 137config NEED_SG_DMA_LENGTH
136 def_bool y 138 def_bool y
@@ -220,7 +222,7 @@ config ARCH_SUPPORTS_DEBUG_PAGEALLOC
220 222
221config HAVE_INTEL_TXT 223config HAVE_INTEL_TXT
222 def_bool y 224 def_bool y
223 depends on EXPERIMENTAL && DMAR && ACPI 225 depends on EXPERIMENTAL && INTEL_IOMMU && ACPI
224 226
225config X86_32_SMP 227config X86_32_SMP
226 def_bool y 228 def_bool y
@@ -279,7 +281,7 @@ config SMP
279 Y to "Enhanced Real Time Clock Support", below. The "Advanced Power 281 Y to "Enhanced Real Time Clock Support", below. The "Advanced Power
280 Management" code will be disabled if you say Y here. 282 Management" code will be disabled if you say Y here.
281 283
282 See also <file:Documentation/i386/IO-APIC.txt>, 284 See also <file:Documentation/x86/i386/IO-APIC.txt>,
283 <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at 285 <file:Documentation/nmi_watchdog.txt> and the SMP-HOWTO available at
284 <http://www.tldp.org/docs.html#howto>. 286 <http://www.tldp.org/docs.html#howto>.
285 287
@@ -287,7 +289,7 @@ config SMP
287 289
288config X86_X2APIC 290config X86_X2APIC
289 bool "Support x2apic" 291 bool "Support x2apic"
290 depends on X86_LOCAL_APIC && X86_64 && INTR_REMAP 292 depends on X86_LOCAL_APIC && X86_64 && IRQ_REMAP
291 ---help--- 293 ---help---
292 This enables x2apic support on CPUs that have this feature. 294 This enables x2apic support on CPUs that have this feature.
293 295
@@ -1452,6 +1454,15 @@ config ARCH_USES_PG_UNCACHED
1452 def_bool y 1454 def_bool y
1453 depends on X86_PAT 1455 depends on X86_PAT
1454 1456
1457config ARCH_RANDOM
1458 def_bool y
1459 prompt "x86 architectural random number generator" if EXPERT
1460 ---help---
1461 Enable the x86 architectural RDRAND instruction
1462 (Intel Bull Mountain technology) to generate random numbers.
1463 If supported, this is a high bandwidth, cryptographically
1464 secure hardware random number generator.
1465
1455config EFI 1466config EFI
1456 bool "EFI runtime service support" 1467 bool "EFI runtime service support"
1457 depends on ACPI 1468 depends on ACPI
@@ -2064,6 +2075,20 @@ config OLPC_XO15_SCI
2064 - AC adapter status updates 2075 - AC adapter status updates
2065 - Battery status updates 2076 - Battery status updates
2066 2077
2078config ALIX
2079 bool "PCEngines ALIX System Support (LED setup)"
2080 select GPIOLIB
2081 ---help---
2082 This option enables system support for the PCEngines ALIX.
2083 At present this just sets up LEDs for GPIO control on
2084 ALIX2/3/6 boards. However, other system specific setup should
2085 get added here.
2086
2087 Note: You must still enable the drivers for GPIO and LED support
2088 (GPIO_CS5535 & LEDS_GPIO) to actually use the LEDs
2089
2090 Note: You have to set alix.force=1 for boards with Award BIOS.
2091
2067endif # X86_32 2092endif # X86_32
2068 2093
2069config AMD_NB 2094config AMD_NB
diff --git a/arch/x86/Kconfig.debug b/arch/x86/Kconfig.debug
index c0f8a5c88910..bf56e1793272 100644
--- a/arch/x86/Kconfig.debug
+++ b/arch/x86/Kconfig.debug
@@ -139,7 +139,7 @@ config IOMMU_DEBUG
139 code. When you use it make sure you have a big enough 139 code. When you use it make sure you have a big enough
140 IOMMU/AGP aperture. Most of the options enabled by this can 140 IOMMU/AGP aperture. Most of the options enabled by this can
141 be set more finegrained using the iommu= command line 141 be set more finegrained using the iommu= command line
142 options. See Documentation/x86_64/boot-options.txt for more 142 options. See Documentation/x86/x86_64/boot-options.txt for more
143 details. 143 details.
144 144
145config IOMMU_STRESS 145config IOMMU_STRESS
diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
index 93e689f4bd86..bdb4d458ec8c 100644
--- a/arch/x86/boot/header.S
+++ b/arch/x86/boot/header.S
@@ -129,7 +129,7 @@ start_sys_seg: .word SYSSEG # obsolete and meaningless, but just
129 129
130type_of_loader: .byte 0 # 0 means ancient bootloader, newer 130type_of_loader: .byte 0 # 0 means ancient bootloader, newer
131 # bootloaders know to change this. 131 # bootloaders know to change this.
132 # See Documentation/i386/boot.txt for 132 # See Documentation/x86/boot.txt for
133 # assigned ids 133 # assigned ids
134 134
135# flags, unused bits must be zero (RFU) bit within loadflags 135# flags, unused bits must be zero (RFU) bit within loadflags
diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig
index 22a0dc8e51dd..058a35b8286c 100644
--- a/arch/x86/configs/x86_64_defconfig
+++ b/arch/x86/configs/x86_64_defconfig
@@ -67,8 +67,8 @@ CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
67CONFIG_CPU_FREQ_GOV_ONDEMAND=y 67CONFIG_CPU_FREQ_GOV_ONDEMAND=y
68CONFIG_X86_ACPI_CPUFREQ=y 68CONFIG_X86_ACPI_CPUFREQ=y
69CONFIG_PCI_MMCONFIG=y 69CONFIG_PCI_MMCONFIG=y
70CONFIG_DMAR=y 70CONFIG_INTEL_IOMMU=y
71# CONFIG_DMAR_DEFAULT_ON is not set 71# CONFIG_INTEL_IOMMU_DEFAULT_ON is not set
72CONFIG_PCIEPORTBUS=y 72CONFIG_PCIEPORTBUS=y
73CONFIG_PCCARD=y 73CONFIG_PCCARD=y
74CONFIG_YENTA=y 74CONFIG_YENTA=y
diff --git a/arch/x86/include/asm/alternative-asm.h b/arch/x86/include/asm/alternative-asm.h
index 4554cc6fb96a..091508b533b4 100644
--- a/arch/x86/include/asm/alternative-asm.h
+++ b/arch/x86/include/asm/alternative-asm.h
@@ -16,7 +16,6 @@
16#endif 16#endif
17 17
18.macro altinstruction_entry orig alt feature orig_len alt_len 18.macro altinstruction_entry orig alt feature orig_len alt_len
19 .align 8
20 .long \orig - . 19 .long \orig - .
21 .long \alt - . 20 .long \alt - .
22 .word \feature 21 .word \feature
diff --git a/arch/x86/include/asm/alternative.h b/arch/x86/include/asm/alternative.h
index 23fb6d79f209..37ad100a2210 100644
--- a/arch/x86/include/asm/alternative.h
+++ b/arch/x86/include/asm/alternative.h
@@ -48,9 +48,6 @@ struct alt_instr {
48 u16 cpuid; /* cpuid bit set for replacement */ 48 u16 cpuid; /* cpuid bit set for replacement */
49 u8 instrlen; /* length of original instruction */ 49 u8 instrlen; /* length of original instruction */
50 u8 replacementlen; /* length of new instruction, <= instrlen */ 50 u8 replacementlen; /* length of new instruction, <= instrlen */
51#ifdef CONFIG_X86_64
52 u32 pad2;
53#endif
54}; 51};
55 52
56extern void alternative_instructions(void); 53extern void alternative_instructions(void);
@@ -83,7 +80,6 @@ static inline int alternatives_text_reserved(void *start, void *end)
83 \ 80 \
84 "661:\n\t" oldinstr "\n662:\n" \ 81 "661:\n\t" oldinstr "\n662:\n" \
85 ".section .altinstructions,\"a\"\n" \ 82 ".section .altinstructions,\"a\"\n" \
86 _ASM_ALIGN "\n" \
87 " .long 661b - .\n" /* label */ \ 83 " .long 661b - .\n" /* label */ \
88 " .long 663f - .\n" /* new instruction */ \ 84 " .long 663f - .\n" /* new instruction */ \
89 " .word " __stringify(feature) "\n" /* feature bit */ \ 85 " .word " __stringify(feature) "\n" /* feature bit */ \
diff --git a/arch/x86/include/asm/amd_nb.h b/arch/x86/include/asm/amd_nb.h
index 67f87f257611..8e41071704a5 100644
--- a/arch/x86/include/asm/amd_nb.h
+++ b/arch/x86/include/asm/amd_nb.h
@@ -19,9 +19,15 @@ extern int amd_numa_init(void);
19extern int amd_get_subcaches(int); 19extern int amd_get_subcaches(int);
20extern int amd_set_subcaches(int, int); 20extern int amd_set_subcaches(int, int);
21 21
22struct amd_l3_cache {
23 unsigned indices;
24 u8 subcaches[4];
25};
26
22struct amd_northbridge { 27struct amd_northbridge {
23 struct pci_dev *misc; 28 struct pci_dev *misc;
24 struct pci_dev *link; 29 struct pci_dev *link;
30 struct amd_l3_cache l3_cache;
25}; 31};
26 32
27struct amd_northbridge_info { 33struct amd_northbridge_info {
diff --git a/arch/x86/include/asm/apic.h b/arch/x86/include/asm/apic.h
index 7b3ca8324b69..9b7273cb2193 100644
--- a/arch/x86/include/asm/apic.h
+++ b/arch/x86/include/asm/apic.h
@@ -495,7 +495,7 @@ static inline void default_wait_for_init_deassert(atomic_t *deassert)
495 return; 495 return;
496} 496}
497 497
498extern struct apic *generic_bigsmp_probe(void); 498extern void generic_bigsmp_probe(void);
499 499
500 500
501#ifdef CONFIG_X86_LOCAL_APIC 501#ifdef CONFIG_X86_LOCAL_APIC
diff --git a/arch/x86/include/asm/archrandom.h b/arch/x86/include/asm/archrandom.h
new file mode 100644
index 000000000000..0d9ec770f2f8
--- /dev/null
+++ b/arch/x86/include/asm/archrandom.h
@@ -0,0 +1,75 @@
1/*
2 * This file is part of the Linux kernel.
3 *
4 * Copyright (c) 2011, Intel Corporation
5 * Authors: Fenghua Yu <fenghua.yu@intel.com>,
6 * H. Peter Anvin <hpa@linux.intel.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License,
10 * version 2, as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 */
22
23#ifndef ASM_X86_ARCHRANDOM_H
24#define ASM_X86_ARCHRANDOM_H
25
26#include <asm/processor.h>
27#include <asm/cpufeature.h>
28#include <asm/alternative.h>
29#include <asm/nops.h>
30
31#define RDRAND_RETRY_LOOPS 10
32
33#define RDRAND_INT ".byte 0x0f,0xc7,0xf0"
34#ifdef CONFIG_X86_64
35# define RDRAND_LONG ".byte 0x48,0x0f,0xc7,0xf0"
36#else
37# define RDRAND_LONG RDRAND_INT
38#endif
39
40#ifdef CONFIG_ARCH_RANDOM
41
42#define GET_RANDOM(name, type, rdrand, nop) \
43static inline int name(type *v) \
44{ \
45 int ok; \
46 alternative_io("movl $0, %0\n\t" \
47 nop, \
48 "\n1: " rdrand "\n\t" \
49 "jc 2f\n\t" \
50 "decl %0\n\t" \
51 "jnz 1b\n\t" \
52 "2:", \
53 X86_FEATURE_RDRAND, \
54 ASM_OUTPUT2("=r" (ok), "=a" (*v)), \
55 "0" (RDRAND_RETRY_LOOPS)); \
56 return ok; \
57}
58
59#ifdef CONFIG_X86_64
60
61GET_RANDOM(arch_get_random_long, unsigned long, RDRAND_LONG, ASM_NOP5);
62GET_RANDOM(arch_get_random_int, unsigned int, RDRAND_INT, ASM_NOP4);
63
64#else
65
66GET_RANDOM(arch_get_random_long, unsigned long, RDRAND_LONG, ASM_NOP3);
67GET_RANDOM(arch_get_random_int, unsigned int, RDRAND_INT, ASM_NOP3);
68
69#endif /* CONFIG_X86_64 */
70
71#endif /* CONFIG_ARCH_RANDOM */
72
73extern void x86_init_rdrand(struct cpuinfo_x86 *c);
74
75#endif /* ASM_X86_ARCHRANDOM_H */
diff --git a/arch/x86/include/asm/atomic.h b/arch/x86/include/asm/atomic.h
index 10572e309ab2..58cb6d4085f7 100644
--- a/arch/x86/include/asm/atomic.h
+++ b/arch/x86/include/asm/atomic.h
@@ -172,18 +172,14 @@ static inline int atomic_add_negative(int i, atomic_t *v)
172 */ 172 */
173static inline int atomic_add_return(int i, atomic_t *v) 173static inline int atomic_add_return(int i, atomic_t *v)
174{ 174{
175 int __i;
176#ifdef CONFIG_M386 175#ifdef CONFIG_M386
176 int __i;
177 unsigned long flags; 177 unsigned long flags;
178 if (unlikely(boot_cpu_data.x86 <= 3)) 178 if (unlikely(boot_cpu_data.x86 <= 3))
179 goto no_xadd; 179 goto no_xadd;
180#endif 180#endif
181 /* Modern 486+ processor */ 181 /* Modern 486+ processor */
182 __i = i; 182 return i + xadd(&v->counter, i);
183 asm volatile(LOCK_PREFIX "xaddl %0, %1"
184 : "+r" (i), "+m" (v->counter)
185 : : "memory");
186 return i + __i;
187 183
188#ifdef CONFIG_M386 184#ifdef CONFIG_M386
189no_xadd: /* Legacy 386 processor */ 185no_xadd: /* Legacy 386 processor */
diff --git a/arch/x86/include/asm/atomic64_64.h b/arch/x86/include/asm/atomic64_64.h
index 017594d403f6..0e1cbfc8ee06 100644
--- a/arch/x86/include/asm/atomic64_64.h
+++ b/arch/x86/include/asm/atomic64_64.h
@@ -170,11 +170,7 @@ static inline int atomic64_add_negative(long i, atomic64_t *v)
170 */ 170 */
171static inline long atomic64_add_return(long i, atomic64_t *v) 171static inline long atomic64_add_return(long i, atomic64_t *v)
172{ 172{
173 long __i = i; 173 return i + xadd(&v->counter, i);
174 asm volatile(LOCK_PREFIX "xaddq %0, %1;"
175 : "+r" (i), "+m" (v->counter)
176 : : "memory");
177 return i + __i;
178} 174}
179 175
180static inline long atomic64_sub_return(long i, atomic64_t *v) 176static inline long atomic64_sub_return(long i, atomic64_t *v)
diff --git a/arch/x86/include/asm/cmpxchg.h b/arch/x86/include/asm/cmpxchg.h
index a460fa088d4c..5d3acdf5a7a6 100644
--- a/arch/x86/include/asm/cmpxchg.h
+++ b/arch/x86/include/asm/cmpxchg.h
@@ -1,5 +1,210 @@
1#ifndef ASM_X86_CMPXCHG_H
2#define ASM_X86_CMPXCHG_H
3
4#include <linux/compiler.h>
5#include <asm/alternative.h> /* Provides LOCK_PREFIX */
6
7/*
8 * Non-existant functions to indicate usage errors at link time
9 * (or compile-time if the compiler implements __compiletime_error().
10 */
11extern void __xchg_wrong_size(void)
12 __compiletime_error("Bad argument size for xchg");
13extern void __cmpxchg_wrong_size(void)
14 __compiletime_error("Bad argument size for cmpxchg");
15extern void __xadd_wrong_size(void)
16 __compiletime_error("Bad argument size for xadd");
17
18/*
19 * Constants for operation sizes. On 32-bit, the 64-bit size it set to
20 * -1 because sizeof will never return -1, thereby making those switch
21 * case statements guaranteeed dead code which the compiler will
22 * eliminate, and allowing the "missing symbol in the default case" to
23 * indicate a usage error.
24 */
25#define __X86_CASE_B 1
26#define __X86_CASE_W 2
27#define __X86_CASE_L 4
28#ifdef CONFIG_64BIT
29#define __X86_CASE_Q 8
30#else
31#define __X86_CASE_Q -1 /* sizeof will never return -1 */
32#endif
33
34/*
35 * Note: no "lock" prefix even on SMP: xchg always implies lock anyway.
36 * Since this is generally used to protect other memory information, we
37 * use "asm volatile" and "memory" clobbers to prevent gcc from moving
38 * information around.
39 */
40#define __xchg(x, ptr, size) \
41({ \
42 __typeof(*(ptr)) __x = (x); \
43 switch (size) { \
44 case __X86_CASE_B: \
45 { \
46 volatile u8 *__ptr = (volatile u8 *)(ptr); \
47 asm volatile("xchgb %0,%1" \
48 : "=q" (__x), "+m" (*__ptr) \
49 : "0" (__x) \
50 : "memory"); \
51 break; \
52 } \
53 case __X86_CASE_W: \
54 { \
55 volatile u16 *__ptr = (volatile u16 *)(ptr); \
56 asm volatile("xchgw %0,%1" \
57 : "=r" (__x), "+m" (*__ptr) \
58 : "0" (__x) \
59 : "memory"); \
60 break; \
61 } \
62 case __X86_CASE_L: \
63 { \
64 volatile u32 *__ptr = (volatile u32 *)(ptr); \
65 asm volatile("xchgl %0,%1" \
66 : "=r" (__x), "+m" (*__ptr) \
67 : "0" (__x) \
68 : "memory"); \
69 break; \
70 } \
71 case __X86_CASE_Q: \
72 { \
73 volatile u64 *__ptr = (volatile u64 *)(ptr); \
74 asm volatile("xchgq %0,%1" \
75 : "=r" (__x), "+m" (*__ptr) \
76 : "0" (__x) \
77 : "memory"); \
78 break; \
79 } \
80 default: \
81 __xchg_wrong_size(); \
82 } \
83 __x; \
84})
85
86#define xchg(ptr, v) \
87 __xchg((v), (ptr), sizeof(*ptr))
88
89/*
90 * Atomic compare and exchange. Compare OLD with MEM, if identical,
91 * store NEW in MEM. Return the initial value in MEM. Success is
92 * indicated by comparing RETURN with OLD.
93 */
94#define __raw_cmpxchg(ptr, old, new, size, lock) \
95({ \
96 __typeof__(*(ptr)) __ret; \
97 __typeof__(*(ptr)) __old = (old); \
98 __typeof__(*(ptr)) __new = (new); \
99 switch (size) { \
100 case __X86_CASE_B: \
101 { \
102 volatile u8 *__ptr = (volatile u8 *)(ptr); \
103 asm volatile(lock "cmpxchgb %2,%1" \
104 : "=a" (__ret), "+m" (*__ptr) \
105 : "q" (__new), "0" (__old) \
106 : "memory"); \
107 break; \
108 } \
109 case __X86_CASE_W: \
110 { \
111 volatile u16 *__ptr = (volatile u16 *)(ptr); \
112 asm volatile(lock "cmpxchgw %2,%1" \
113 : "=a" (__ret), "+m" (*__ptr) \
114 : "r" (__new), "0" (__old) \
115 : "memory"); \
116 break; \
117 } \
118 case __X86_CASE_L: \
119 { \
120 volatile u32 *__ptr = (volatile u32 *)(ptr); \
121 asm volatile(lock "cmpxchgl %2,%1" \
122 : "=a" (__ret), "+m" (*__ptr) \
123 : "r" (__new), "0" (__old) \
124 : "memory"); \
125 break; \
126 } \
127 case __X86_CASE_Q: \
128 { \
129 volatile u64 *__ptr = (volatile u64 *)(ptr); \
130 asm volatile(lock "cmpxchgq %2,%1" \
131 : "=a" (__ret), "+m" (*__ptr) \
132 : "r" (__new), "0" (__old) \
133 : "memory"); \
134 break; \
135 } \
136 default: \
137 __cmpxchg_wrong_size(); \
138 } \
139 __ret; \
140})
141
142#define __cmpxchg(ptr, old, new, size) \
143 __raw_cmpxchg((ptr), (old), (new), (size), LOCK_PREFIX)
144
145#define __sync_cmpxchg(ptr, old, new, size) \
146 __raw_cmpxchg((ptr), (old), (new), (size), "lock; ")
147
148#define __cmpxchg_local(ptr, old, new, size) \
149 __raw_cmpxchg((ptr), (old), (new), (size), "")
150
1#ifdef CONFIG_X86_32 151#ifdef CONFIG_X86_32
2# include "cmpxchg_32.h" 152# include "cmpxchg_32.h"
3#else 153#else
4# include "cmpxchg_64.h" 154# include "cmpxchg_64.h"
5#endif 155#endif
156
157#ifdef __HAVE_ARCH_CMPXCHG
158#define cmpxchg(ptr, old, new) \
159 __cmpxchg((ptr), (old), (new), sizeof(*ptr))
160
161#define sync_cmpxchg(ptr, old, new) \
162 __sync_cmpxchg((ptr), (old), (new), sizeof(*ptr))
163
164#define cmpxchg_local(ptr, old, new) \
165 __cmpxchg_local((ptr), (old), (new), sizeof(*ptr))
166#endif
167
168#define __xadd(ptr, inc, lock) \
169 ({ \
170 __typeof__ (*(ptr)) __ret = (inc); \
171 switch (sizeof(*(ptr))) { \
172 case __X86_CASE_B: \
173 asm volatile (lock "xaddb %b0, %1\n" \
174 : "+r" (__ret), "+m" (*(ptr)) \
175 : : "memory", "cc"); \
176 break; \
177 case __X86_CASE_W: \
178 asm volatile (lock "xaddw %w0, %1\n" \
179 : "+r" (__ret), "+m" (*(ptr)) \
180 : : "memory", "cc"); \
181 break; \
182 case __X86_CASE_L: \
183 asm volatile (lock "xaddl %0, %1\n" \
184 : "+r" (__ret), "+m" (*(ptr)) \
185 : : "memory", "cc"); \
186 break; \
187 case __X86_CASE_Q: \
188 asm volatile (lock "xaddq %q0, %1\n" \
189 : "+r" (__ret), "+m" (*(ptr)) \
190 : : "memory", "cc"); \
191 break; \
192 default: \
193 __xadd_wrong_size(); \
194 } \
195 __ret; \
196 })
197
198/*
199 * xadd() adds "inc" to "*ptr" and atomically returns the previous
200 * value of "*ptr".
201 *
202 * xadd() is locked when multiple CPUs are online
203 * xadd_sync() is always locked
204 * xadd_local() is never locked
205 */
206#define xadd(ptr, inc) __xadd((ptr), (inc), LOCK_PREFIX)
207#define xadd_sync(ptr, inc) __xadd((ptr), (inc), "lock; ")
208#define xadd_local(ptr, inc) __xadd((ptr), (inc), "")
209
210#endif /* ASM_X86_CMPXCHG_H */
diff --git a/arch/x86/include/asm/cmpxchg_32.h b/arch/x86/include/asm/cmpxchg_32.h
index 3deb7250624c..fbebb07dd80b 100644
--- a/arch/x86/include/asm/cmpxchg_32.h
+++ b/arch/x86/include/asm/cmpxchg_32.h
@@ -1,61 +1,11 @@
1#ifndef _ASM_X86_CMPXCHG_32_H 1#ifndef _ASM_X86_CMPXCHG_32_H
2#define _ASM_X86_CMPXCHG_32_H 2#define _ASM_X86_CMPXCHG_32_H
3 3
4#include <linux/bitops.h> /* for LOCK_PREFIX */
5
6/* 4/*
7 * Note: if you use set64_bit(), __cmpxchg64(), or their variants, you 5 * Note: if you use set64_bit(), __cmpxchg64(), or their variants, you
8 * you need to test for the feature in boot_cpu_data. 6 * you need to test for the feature in boot_cpu_data.
9 */ 7 */
10 8
11extern void __xchg_wrong_size(void);
12
13/*
14 * Note: no "lock" prefix even on SMP: xchg always implies lock anyway.
15 * Since this is generally used to protect other memory information, we
16 * use "asm volatile" and "memory" clobbers to prevent gcc from moving
17 * information around.
18 */
19#define __xchg(x, ptr, size) \
20({ \
21 __typeof(*(ptr)) __x = (x); \
22 switch (size) { \
23 case 1: \
24 { \
25 volatile u8 *__ptr = (volatile u8 *)(ptr); \
26 asm volatile("xchgb %0,%1" \
27 : "=q" (__x), "+m" (*__ptr) \
28 : "0" (__x) \
29 : "memory"); \
30 break; \
31 } \
32 case 2: \
33 { \
34 volatile u16 *__ptr = (volatile u16 *)(ptr); \
35 asm volatile("xchgw %0,%1" \
36 : "=r" (__x), "+m" (*__ptr) \
37 : "0" (__x) \
38 : "memory"); \
39 break; \
40 } \
41 case 4: \
42 { \
43 volatile u32 *__ptr = (volatile u32 *)(ptr); \
44 asm volatile("xchgl %0,%1" \
45 : "=r" (__x), "+m" (*__ptr) \
46 : "0" (__x) \
47 : "memory"); \
48 break; \
49 } \
50 default: \
51 __xchg_wrong_size(); \
52 } \
53 __x; \
54})
55
56#define xchg(ptr, v) \
57 __xchg((v), (ptr), sizeof(*ptr))
58
59/* 9/*
60 * CMPXCHG8B only writes to the target if we had the previous 10 * CMPXCHG8B only writes to the target if we had the previous
61 * value in registers, otherwise it acts as a read and gives us the 11 * value in registers, otherwise it acts as a read and gives us the
@@ -84,72 +34,8 @@ static inline void set_64bit(volatile u64 *ptr, u64 value)
84 : "memory"); 34 : "memory");
85} 35}
86 36
87extern void __cmpxchg_wrong_size(void);
88
89/*
90 * Atomic compare and exchange. Compare OLD with MEM, if identical,
91 * store NEW in MEM. Return the initial value in MEM. Success is
92 * indicated by comparing RETURN with OLD.
93 */
94#define __raw_cmpxchg(ptr, old, new, size, lock) \
95({ \
96 __typeof__(*(ptr)) __ret; \
97 __typeof__(*(ptr)) __old = (old); \
98 __typeof__(*(ptr)) __new = (new); \
99 switch (size) { \
100 case 1: \
101 { \
102 volatile u8 *__ptr = (volatile u8 *)(ptr); \
103 asm volatile(lock "cmpxchgb %2,%1" \
104 : "=a" (__ret), "+m" (*__ptr) \
105 : "q" (__new), "0" (__old) \
106 : "memory"); \
107 break; \
108 } \
109 case 2: \
110 { \
111 volatile u16 *__ptr = (volatile u16 *)(ptr); \
112 asm volatile(lock "cmpxchgw %2,%1" \
113 : "=a" (__ret), "+m" (*__ptr) \
114 : "r" (__new), "0" (__old) \
115 : "memory"); \
116 break; \
117 } \
118 case 4: \
119 { \
120 volatile u32 *__ptr = (volatile u32 *)(ptr); \
121 asm volatile(lock "cmpxchgl %2,%1" \
122 : "=a" (__ret), "+m" (*__ptr) \
123 : "r" (__new), "0" (__old) \
124 : "memory"); \
125 break; \
126 } \
127 default: \
128 __cmpxchg_wrong_size(); \
129 } \
130 __ret; \
131})
132
133#define __cmpxchg(ptr, old, new, size) \
134 __raw_cmpxchg((ptr), (old), (new), (size), LOCK_PREFIX)
135
136#define __sync_cmpxchg(ptr, old, new, size) \
137 __raw_cmpxchg((ptr), (old), (new), (size), "lock; ")
138
139#define __cmpxchg_local(ptr, old, new, size) \
140 __raw_cmpxchg((ptr), (old), (new), (size), "")
141
142#ifdef CONFIG_X86_CMPXCHG 37#ifdef CONFIG_X86_CMPXCHG
143#define __HAVE_ARCH_CMPXCHG 1 38#define __HAVE_ARCH_CMPXCHG 1
144
145#define cmpxchg(ptr, old, new) \
146 __cmpxchg((ptr), (old), (new), sizeof(*ptr))
147
148#define sync_cmpxchg(ptr, old, new) \
149 __sync_cmpxchg((ptr), (old), (new), sizeof(*ptr))
150
151#define cmpxchg_local(ptr, old, new) \
152 __cmpxchg_local((ptr), (old), (new), sizeof(*ptr))
153#endif 39#endif
154 40
155#ifdef CONFIG_X86_CMPXCHG64 41#ifdef CONFIG_X86_CMPXCHG64
diff --git a/arch/x86/include/asm/cmpxchg_64.h b/arch/x86/include/asm/cmpxchg_64.h
index 7cf5c0a24434..285da02c38fa 100644
--- a/arch/x86/include/asm/cmpxchg_64.h
+++ b/arch/x86/include/asm/cmpxchg_64.h
@@ -1,144 +1,13 @@
1#ifndef _ASM_X86_CMPXCHG_64_H 1#ifndef _ASM_X86_CMPXCHG_64_H
2#define _ASM_X86_CMPXCHG_64_H 2#define _ASM_X86_CMPXCHG_64_H
3 3
4#include <asm/alternative.h> /* Provides LOCK_PREFIX */
5
6static inline void set_64bit(volatile u64 *ptr, u64 val) 4static inline void set_64bit(volatile u64 *ptr, u64 val)
7{ 5{
8 *ptr = val; 6 *ptr = val;
9} 7}
10 8
11extern void __xchg_wrong_size(void);
12extern void __cmpxchg_wrong_size(void);
13
14/*
15 * Note: no "lock" prefix even on SMP: xchg always implies lock anyway.
16 * Since this is generally used to protect other memory information, we
17 * use "asm volatile" and "memory" clobbers to prevent gcc from moving
18 * information around.
19 */
20#define __xchg(x, ptr, size) \
21({ \
22 __typeof(*(ptr)) __x = (x); \
23 switch (size) { \
24 case 1: \
25 { \
26 volatile u8 *__ptr = (volatile u8 *)(ptr); \
27 asm volatile("xchgb %0,%1" \
28 : "=q" (__x), "+m" (*__ptr) \
29 : "0" (__x) \
30 : "memory"); \
31 break; \
32 } \
33 case 2: \
34 { \
35 volatile u16 *__ptr = (volatile u16 *)(ptr); \
36 asm volatile("xchgw %0,%1" \
37 : "=r" (__x), "+m" (*__ptr) \
38 : "0" (__x) \
39 : "memory"); \
40 break; \
41 } \
42 case 4: \
43 { \
44 volatile u32 *__ptr = (volatile u32 *)(ptr); \
45 asm volatile("xchgl %0,%1" \
46 : "=r" (__x), "+m" (*__ptr) \
47 : "0" (__x) \
48 : "memory"); \
49 break; \
50 } \
51 case 8: \
52 { \
53 volatile u64 *__ptr = (volatile u64 *)(ptr); \
54 asm volatile("xchgq %0,%1" \
55 : "=r" (__x), "+m" (*__ptr) \
56 : "0" (__x) \
57 : "memory"); \
58 break; \
59 } \
60 default: \
61 __xchg_wrong_size(); \
62 } \
63 __x; \
64})
65
66#define xchg(ptr, v) \
67 __xchg((v), (ptr), sizeof(*ptr))
68
69#define __HAVE_ARCH_CMPXCHG 1 9#define __HAVE_ARCH_CMPXCHG 1
70 10
71/*
72 * Atomic compare and exchange. Compare OLD with MEM, if identical,
73 * store NEW in MEM. Return the initial value in MEM. Success is
74 * indicated by comparing RETURN with OLD.
75 */
76#define __raw_cmpxchg(ptr, old, new, size, lock) \
77({ \
78 __typeof__(*(ptr)) __ret; \
79 __typeof__(*(ptr)) __old = (old); \
80 __typeof__(*(ptr)) __new = (new); \
81 switch (size) { \
82 case 1: \
83 { \
84 volatile u8 *__ptr = (volatile u8 *)(ptr); \
85 asm volatile(lock "cmpxchgb %2,%1" \
86 : "=a" (__ret), "+m" (*__ptr) \
87 : "q" (__new), "0" (__old) \
88 : "memory"); \
89 break; \
90 } \
91 case 2: \
92 { \
93 volatile u16 *__ptr = (volatile u16 *)(ptr); \
94 asm volatile(lock "cmpxchgw %2,%1" \
95 : "=a" (__ret), "+m" (*__ptr) \
96 : "r" (__new), "0" (__old) \
97 : "memory"); \
98 break; \
99 } \
100 case 4: \
101 { \
102 volatile u32 *__ptr = (volatile u32 *)(ptr); \
103 asm volatile(lock "cmpxchgl %2,%1" \
104 : "=a" (__ret), "+m" (*__ptr) \
105 : "r" (__new), "0" (__old) \
106 : "memory"); \
107 break; \
108 } \
109 case 8: \
110 { \
111 volatile u64 *__ptr = (volatile u64 *)(ptr); \
112 asm volatile(lock "cmpxchgq %2,%1" \
113 : "=a" (__ret), "+m" (*__ptr) \
114 : "r" (__new), "0" (__old) \
115 : "memory"); \
116 break; \
117 } \
118 default: \
119 __cmpxchg_wrong_size(); \
120 } \
121 __ret; \
122})
123
124#define __cmpxchg(ptr, old, new, size) \
125 __raw_cmpxchg((ptr), (old), (new), (size), LOCK_PREFIX)
126
127#define __sync_cmpxchg(ptr, old, new, size) \
128 __raw_cmpxchg((ptr), (old), (new), (size), "lock; ")
129
130#define __cmpxchg_local(ptr, old, new, size) \
131 __raw_cmpxchg((ptr), (old), (new), (size), "")
132
133#define cmpxchg(ptr, old, new) \
134 __cmpxchg((ptr), (old), (new), sizeof(*ptr))
135
136#define sync_cmpxchg(ptr, old, new) \
137 __sync_cmpxchg((ptr), (old), (new), sizeof(*ptr))
138
139#define cmpxchg_local(ptr, old, new) \
140 __cmpxchg_local((ptr), (old), (new), sizeof(*ptr))
141
142#define cmpxchg64(ptr, o, n) \ 11#define cmpxchg64(ptr, o, n) \
143({ \ 12({ \
144 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \ 13 BUILD_BUG_ON(sizeof(*(ptr)) != 8); \
diff --git a/arch/x86/include/asm/compat.h b/arch/x86/include/asm/compat.h
index 1d9cd27c2920..30d737ef2a42 100644
--- a/arch/x86/include/asm/compat.h
+++ b/arch/x86/include/asm/compat.h
@@ -108,7 +108,8 @@ struct compat_statfs {
108 compat_fsid_t f_fsid; 108 compat_fsid_t f_fsid;
109 int f_namelen; /* SunOS ignores this field. */ 109 int f_namelen; /* SunOS ignores this field. */
110 int f_frsize; 110 int f_frsize;
111 int f_spare[5]; 111 int f_flags;
112 int f_spare[4];
112}; 113};
113 114
114#define COMPAT_RLIM_OLD_INFINITY 0x7fffffff 115#define COMPAT_RLIM_OLD_INFINITY 0x7fffffff
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 4258aac99a6e..aa6a488cd075 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -114,6 +114,7 @@
114#define X86_FEATURE_CX16 (4*32+13) /* CMPXCHG16B */ 114#define X86_FEATURE_CX16 (4*32+13) /* CMPXCHG16B */
115#define X86_FEATURE_XTPR (4*32+14) /* Send Task Priority Messages */ 115#define X86_FEATURE_XTPR (4*32+14) /* Send Task Priority Messages */
116#define X86_FEATURE_PDCM (4*32+15) /* Performance Capabilities */ 116#define X86_FEATURE_PDCM (4*32+15) /* Performance Capabilities */
117#define X86_FEATURE_PCID (4*32+17) /* Process Context Identifiers */
117#define X86_FEATURE_DCA (4*32+18) /* Direct Cache Access */ 118#define X86_FEATURE_DCA (4*32+18) /* Direct Cache Access */
118#define X86_FEATURE_XMM4_1 (4*32+19) /* "sse4_1" SSE-4.1 */ 119#define X86_FEATURE_XMM4_1 (4*32+19) /* "sse4_1" SSE-4.1 */
119#define X86_FEATURE_XMM4_2 (4*32+20) /* "sse4_2" SSE-4.2 */ 120#define X86_FEATURE_XMM4_2 (4*32+20) /* "sse4_2" SSE-4.2 */
@@ -332,7 +333,6 @@ static __always_inline __pure bool __static_cpu_has(u16 bit)
332 asm goto("1: jmp %l[t_no]\n" 333 asm goto("1: jmp %l[t_no]\n"
333 "2:\n" 334 "2:\n"
334 ".section .altinstructions,\"a\"\n" 335 ".section .altinstructions,\"a\"\n"
335 _ASM_ALIGN "\n"
336 " .long 1b - .\n" 336 " .long 1b - .\n"
337 " .long 0\n" /* no replacement */ 337 " .long 0\n" /* no replacement */
338 " .word %P0\n" /* feature bit */ 338 " .word %P0\n" /* feature bit */
@@ -350,7 +350,6 @@ static __always_inline __pure bool __static_cpu_has(u16 bit)
350 asm volatile("1: movb $0,%0\n" 350 asm volatile("1: movb $0,%0\n"
351 "2:\n" 351 "2:\n"
352 ".section .altinstructions,\"a\"\n" 352 ".section .altinstructions,\"a\"\n"
353 _ASM_ALIGN "\n"
354 " .long 1b - .\n" 353 " .long 1b - .\n"
355 " .long 3f - .\n" 354 " .long 3f - .\n"
356 " .word %P1\n" /* feature bit */ 355 " .word %P1\n" /* feature bit */
diff --git a/arch/x86/include/asm/device.h b/arch/x86/include/asm/device.h
index 029f230ab637..63a2a03d7d51 100644
--- a/arch/x86/include/asm/device.h
+++ b/arch/x86/include/asm/device.h
@@ -8,7 +8,7 @@ struct dev_archdata {
8#ifdef CONFIG_X86_64 8#ifdef CONFIG_X86_64
9struct dma_map_ops *dma_ops; 9struct dma_map_ops *dma_ops;
10#endif 10#endif
11#if defined(CONFIG_DMAR) || defined(CONFIG_AMD_IOMMU) 11#if defined(CONFIG_INTEL_IOMMU) || defined(CONFIG_AMD_IOMMU)
12 void *iommu; /* hook for IOMMU specific extension */ 12 void *iommu; /* hook for IOMMU specific extension */
13#endif 13#endif
14}; 14};
diff --git a/arch/x86/include/asm/dma-mapping.h b/arch/x86/include/asm/dma-mapping.h
index d4c419f883a0..ed3065fd6314 100644
--- a/arch/x86/include/asm/dma-mapping.h
+++ b/arch/x86/include/asm/dma-mapping.h
@@ -2,7 +2,7 @@
2#define _ASM_X86_DMA_MAPPING_H 2#define _ASM_X86_DMA_MAPPING_H
3 3
4/* 4/*
5 * IOMMU interface. See Documentation/PCI/PCI-DMA-mapping.txt and 5 * IOMMU interface. See Documentation/DMA-API-HOWTO.txt and
6 * Documentation/DMA-API.txt for documentation. 6 * Documentation/DMA-API.txt for documentation.
7 */ 7 */
8 8
diff --git a/arch/x86/include/asm/dwarf2.h b/arch/x86/include/asm/dwarf2.h
index 326099199318..f6f15986df6c 100644
--- a/arch/x86/include/asm/dwarf2.h
+++ b/arch/x86/include/asm/dwarf2.h
@@ -27,6 +27,7 @@
27#define CFI_REMEMBER_STATE .cfi_remember_state 27#define CFI_REMEMBER_STATE .cfi_remember_state
28#define CFI_RESTORE_STATE .cfi_restore_state 28#define CFI_RESTORE_STATE .cfi_restore_state
29#define CFI_UNDEFINED .cfi_undefined 29#define CFI_UNDEFINED .cfi_undefined
30#define CFI_ESCAPE .cfi_escape
30 31
31#ifdef CONFIG_AS_CFI_SIGNAL_FRAME 32#ifdef CONFIG_AS_CFI_SIGNAL_FRAME
32#define CFI_SIGNAL_FRAME .cfi_signal_frame 33#define CFI_SIGNAL_FRAME .cfi_signal_frame
@@ -68,6 +69,7 @@
68#define CFI_REMEMBER_STATE cfi_ignore 69#define CFI_REMEMBER_STATE cfi_ignore
69#define CFI_RESTORE_STATE cfi_ignore 70#define CFI_RESTORE_STATE cfi_ignore
70#define CFI_UNDEFINED cfi_ignore 71#define CFI_UNDEFINED cfi_ignore
72#define CFI_ESCAPE cfi_ignore
71#define CFI_SIGNAL_FRAME cfi_ignore 73#define CFI_SIGNAL_FRAME cfi_ignore
72 74
73#endif 75#endif
diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
index f2ad2163109d..5f962df30d0f 100644
--- a/arch/x86/include/asm/elf.h
+++ b/arch/x86/include/asm/elf.h
@@ -4,6 +4,7 @@
4/* 4/*
5 * ELF register definitions.. 5 * ELF register definitions..
6 */ 6 */
7#include <linux/thread_info.h>
7 8
8#include <asm/ptrace.h> 9#include <asm/ptrace.h>
9#include <asm/user.h> 10#include <asm/user.h>
@@ -320,4 +321,34 @@ extern int syscall32_setup_pages(struct linux_binprm *, int exstack);
320extern unsigned long arch_randomize_brk(struct mm_struct *mm); 321extern unsigned long arch_randomize_brk(struct mm_struct *mm);
321#define arch_randomize_brk arch_randomize_brk 322#define arch_randomize_brk arch_randomize_brk
322 323
324/*
325 * True on X86_32 or when emulating IA32 on X86_64
326 */
327static inline int mmap_is_ia32(void)
328{
329#ifdef CONFIG_X86_32
330 return 1;
331#endif
332#ifdef CONFIG_IA32_EMULATION
333 if (test_thread_flag(TIF_IA32))
334 return 1;
335#endif
336 return 0;
337}
338
339/* The first two values are special, do not change. See align_addr() */
340enum align_flags {
341 ALIGN_VA_32 = BIT(0),
342 ALIGN_VA_64 = BIT(1),
343 ALIGN_VDSO = BIT(2),
344 ALIGN_TOPDOWN = BIT(3),
345};
346
347struct va_alignment {
348 int flags;
349 unsigned long mask;
350} ____cacheline_aligned;
351
352extern struct va_alignment va_align;
353extern unsigned long align_addr(unsigned long, struct file *, enum align_flags);
323#endif /* _ASM_X86_ELF_H */ 354#endif /* _ASM_X86_ELF_H */
diff --git a/arch/x86/include/asm/hw_irq.h b/arch/x86/include/asm/hw_irq.h
index 09199052060f..eb92a6ed2be7 100644
--- a/arch/x86/include/asm/hw_irq.h
+++ b/arch/x86/include/asm/hw_irq.h
@@ -119,7 +119,7 @@ struct irq_cfg {
119 cpumask_var_t old_domain; 119 cpumask_var_t old_domain;
120 u8 vector; 120 u8 vector;
121 u8 move_in_progress : 1; 121 u8 move_in_progress : 1;
122#ifdef CONFIG_INTR_REMAP 122#ifdef CONFIG_IRQ_REMAP
123 struct irq_2_iommu irq_2_iommu; 123 struct irq_2_iommu irq_2_iommu;
124#endif 124#endif
125}; 125};
diff --git a/arch/x86/include/asm/hyperv.h b/arch/x86/include/asm/hyperv.h
index 5df477ac3af7..b80420bcd09d 100644
--- a/arch/x86/include/asm/hyperv.h
+++ b/arch/x86/include/asm/hyperv.h
@@ -189,5 +189,6 @@
189#define HV_STATUS_INVALID_HYPERCALL_CODE 2 189#define HV_STATUS_INVALID_HYPERCALL_CODE 2
190#define HV_STATUS_INVALID_HYPERCALL_INPUT 3 190#define HV_STATUS_INVALID_HYPERCALL_INPUT 3
191#define HV_STATUS_INVALID_ALIGNMENT 4 191#define HV_STATUS_INVALID_ALIGNMENT 4
192#define HV_STATUS_INSUFFICIENT_BUFFERS 19
192 193
193#endif 194#endif
diff --git a/arch/x86/include/asm/irq_remapping.h b/arch/x86/include/asm/irq_remapping.h
index 1c23360fb2d8..47d99934580f 100644
--- a/arch/x86/include/asm/irq_remapping.h
+++ b/arch/x86/include/asm/irq_remapping.h
@@ -3,7 +3,8 @@
3 3
4#define IRTE_DEST(dest) ((x2apic_mode) ? dest : dest << 8) 4#define IRTE_DEST(dest) ((x2apic_mode) ? dest : dest << 8)
5 5
6#ifdef CONFIG_INTR_REMAP 6#ifdef CONFIG_IRQ_REMAP
7static void irq_remap_modify_chip_defaults(struct irq_chip *chip);
7static inline void prepare_irte(struct irte *irte, int vector, 8static inline void prepare_irte(struct irte *irte, int vector,
8 unsigned int dest) 9 unsigned int dest)
9{ 10{
@@ -36,6 +37,9 @@ static inline bool irq_remapped(struct irq_cfg *cfg)
36{ 37{
37 return false; 38 return false;
38} 39}
40static inline void irq_remap_modify_chip_defaults(struct irq_chip *chip)
41{
42}
39#endif 43#endif
40 44
41#endif /* _ASM_X86_IRQ_REMAPPING_H */ 45#endif /* _ASM_X86_IRQ_REMAPPING_H */
diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_vectors.h
index 7e50f06393aa..4b4448761e88 100644
--- a/arch/x86/include/asm/irq_vectors.h
+++ b/arch/x86/include/asm/irq_vectors.h
@@ -160,19 +160,11 @@ static inline int invalid_vm86_irq(int irq)
160#define IO_APIC_VECTOR_LIMIT ( 32 * MAX_IO_APICS ) 160#define IO_APIC_VECTOR_LIMIT ( 32 * MAX_IO_APICS )
161 161
162#ifdef CONFIG_X86_IO_APIC 162#ifdef CONFIG_X86_IO_APIC
163# ifdef CONFIG_SPARSE_IRQ 163# define CPU_VECTOR_LIMIT (64 * NR_CPUS)
164# define CPU_VECTOR_LIMIT (64 * NR_CPUS) 164# define NR_IRQS \
165# define NR_IRQS \
166 (CPU_VECTOR_LIMIT > IO_APIC_VECTOR_LIMIT ? \ 165 (CPU_VECTOR_LIMIT > IO_APIC_VECTOR_LIMIT ? \
167 (NR_VECTORS + CPU_VECTOR_LIMIT) : \ 166 (NR_VECTORS + CPU_VECTOR_LIMIT) : \
168 (NR_VECTORS + IO_APIC_VECTOR_LIMIT)) 167 (NR_VECTORS + IO_APIC_VECTOR_LIMIT))
169# else
170# define CPU_VECTOR_LIMIT (32 * NR_CPUS)
171# define NR_IRQS \
172 (CPU_VECTOR_LIMIT < IO_APIC_VECTOR_LIMIT ? \
173 (NR_VECTORS + CPU_VECTOR_LIMIT) : \
174 (NR_VECTORS + IO_APIC_VECTOR_LIMIT))
175# endif
176#else /* !CONFIG_X86_IO_APIC: */ 168#else /* !CONFIG_X86_IO_APIC: */
177# define NR_IRQS NR_IRQS_LEGACY 169# define NR_IRQS NR_IRQS_LEGACY
178#endif 170#endif
diff --git a/arch/x86/include/asm/nmi.h b/arch/x86/include/asm/nmi.h
index 4886a68f267e..fd3f9f18cf3f 100644
--- a/arch/x86/include/asm/nmi.h
+++ b/arch/x86/include/asm/nmi.h
@@ -22,27 +22,26 @@ void arch_trigger_all_cpu_backtrace(void);
22#define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace 22#define arch_trigger_all_cpu_backtrace arch_trigger_all_cpu_backtrace
23#endif 23#endif
24 24
25/* 25#define NMI_FLAG_FIRST 1
26 * Define some priorities for the nmi notifier call chain. 26
27 * 27enum {
28 * Create a local nmi bit that has a higher priority than 28 NMI_LOCAL=0,
29 * external nmis, because the local ones are more frequent. 29 NMI_UNKNOWN,
30 * 30 NMI_MAX
31 * Also setup some default high/normal/low settings for 31};
32 * subsystems to registers with. Using 4 bits to separate 32
33 * the priorities. This can go a lot higher if needed be. 33#define NMI_DONE 0
34 */ 34#define NMI_HANDLED 1
35 35
36#define NMI_LOCAL_SHIFT 16 /* randomly picked */ 36typedef int (*nmi_handler_t)(unsigned int, struct pt_regs *);
37#define NMI_LOCAL_BIT (1ULL << NMI_LOCAL_SHIFT) 37
38#define NMI_HIGH_PRIOR (1ULL << 8) 38int register_nmi_handler(unsigned int, nmi_handler_t, unsigned long,
39#define NMI_NORMAL_PRIOR (1ULL << 4) 39 const char *);
40#define NMI_LOW_PRIOR (1ULL << 0) 40
41#define NMI_LOCAL_HIGH_PRIOR (NMI_LOCAL_BIT | NMI_HIGH_PRIOR) 41void unregister_nmi_handler(unsigned int, const char *);
42#define NMI_LOCAL_NORMAL_PRIOR (NMI_LOCAL_BIT | NMI_NORMAL_PRIOR)
43#define NMI_LOCAL_LOW_PRIOR (NMI_LOCAL_BIT | NMI_LOW_PRIOR)
44 42
45void stop_nmi(void); 43void stop_nmi(void);
46void restart_nmi(void); 44void restart_nmi(void);
45void local_touch_nmi(void);
47 46
48#endif /* _ASM_X86_NMI_H */ 47#endif /* _ASM_X86_NMI_H */
diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h
index 094fb30817ab..f61c62f7d5d8 100644
--- a/arch/x86/include/asm/perf_event.h
+++ b/arch/x86/include/asm/perf_event.h
@@ -29,6 +29,9 @@
29#define ARCH_PERFMON_EVENTSEL_INV (1ULL << 23) 29#define ARCH_PERFMON_EVENTSEL_INV (1ULL << 23)
30#define ARCH_PERFMON_EVENTSEL_CMASK 0xFF000000ULL 30#define ARCH_PERFMON_EVENTSEL_CMASK 0xFF000000ULL
31 31
32#define AMD_PERFMON_EVENTSEL_GUESTONLY (1ULL << 40)
33#define AMD_PERFMON_EVENTSEL_HOSTONLY (1ULL << 41)
34
32#define AMD64_EVENTSEL_EVENT \ 35#define AMD64_EVENTSEL_EVENT \
33 (ARCH_PERFMON_EVENTSEL_EVENT | (0x0FULL << 32)) 36 (ARCH_PERFMON_EVENTSEL_EVENT | (0x0FULL << 32))
34#define INTEL_ARCH_EVENT_MASK \ 37#define INTEL_ARCH_EVENT_MASK \
@@ -43,14 +46,17 @@
43#define AMD64_RAW_EVENT_MASK \ 46#define AMD64_RAW_EVENT_MASK \
44 (X86_RAW_EVENT_MASK | \ 47 (X86_RAW_EVENT_MASK | \
45 AMD64_EVENTSEL_EVENT) 48 AMD64_EVENTSEL_EVENT)
49#define AMD64_NUM_COUNTERS 4
50#define AMD64_NUM_COUNTERS_F15H 6
51#define AMD64_NUM_COUNTERS_MAX AMD64_NUM_COUNTERS_F15H
46 52
47#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL 0x3c 53#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_SEL 0x3c
48#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8) 54#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_UMASK (0x00 << 8)
49#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX 0 55#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX 0
50#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT \ 56#define ARCH_PERFMON_UNHALTED_CORE_CYCLES_PRESENT \
51 (1 << (ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX)) 57 (1 << (ARCH_PERFMON_UNHALTED_CORE_CYCLES_INDEX))
52 58
53#define ARCH_PERFMON_BRANCH_MISSES_RETIRED 6 59#define ARCH_PERFMON_BRANCH_MISSES_RETIRED 6
54 60
55/* 61/*
56 * Intel "Architectural Performance Monitoring" CPUID 62 * Intel "Architectural Performance Monitoring" CPUID
@@ -110,6 +116,35 @@ union cpuid10_edx {
110 */ 116 */
111#define X86_PMC_IDX_FIXED_BTS (X86_PMC_IDX_FIXED + 16) 117#define X86_PMC_IDX_FIXED_BTS (X86_PMC_IDX_FIXED + 16)
112 118
119/*
120 * IBS cpuid feature detection
121 */
122
123#define IBS_CPUID_FEATURES 0x8000001b
124
125/*
126 * Same bit mask as for IBS cpuid feature flags (Fn8000_001B_EAX), but
127 * bit 0 is used to indicate the existence of IBS.
128 */
129#define IBS_CAPS_AVAIL (1U<<0)
130#define IBS_CAPS_FETCHSAM (1U<<1)
131#define IBS_CAPS_OPSAM (1U<<2)
132#define IBS_CAPS_RDWROPCNT (1U<<3)
133#define IBS_CAPS_OPCNT (1U<<4)
134#define IBS_CAPS_BRNTRGT (1U<<5)
135#define IBS_CAPS_OPCNTEXT (1U<<6)
136
137#define IBS_CAPS_DEFAULT (IBS_CAPS_AVAIL \
138 | IBS_CAPS_FETCHSAM \
139 | IBS_CAPS_OPSAM)
140
141/*
142 * IBS APIC setup
143 */
144#define IBSCTL 0x1cc
145#define IBSCTL_LVT_OFFSET_VALID (1ULL<<8)
146#define IBSCTL_LVT_OFFSET_MASK 0x0F
147
113/* IbsFetchCtl bits/masks */ 148/* IbsFetchCtl bits/masks */
114#define IBS_FETCH_RAND_EN (1ULL<<57) 149#define IBS_FETCH_RAND_EN (1ULL<<57)
115#define IBS_FETCH_VAL (1ULL<<49) 150#define IBS_FETCH_VAL (1ULL<<49)
@@ -124,6 +159,8 @@ union cpuid10_edx {
124#define IBS_OP_MAX_CNT 0x0000FFFFULL 159#define IBS_OP_MAX_CNT 0x0000FFFFULL
125#define IBS_OP_MAX_CNT_EXT 0x007FFFFFULL /* not a register bit mask */ 160#define IBS_OP_MAX_CNT_EXT 0x007FFFFFULL /* not a register bit mask */
126 161
162extern u32 get_ibs_caps(void);
163
127#ifdef CONFIG_PERF_EVENTS 164#ifdef CONFIG_PERF_EVENTS
128extern void perf_events_lapic_init(void); 165extern void perf_events_lapic_init(void);
129 166
@@ -159,7 +196,19 @@ extern unsigned long perf_misc_flags(struct pt_regs *regs);
159 ); \ 196 ); \
160} 197}
161 198
199struct perf_guest_switch_msr {
200 unsigned msr;
201 u64 host, guest;
202};
203
204extern struct perf_guest_switch_msr *perf_guest_get_msrs(int *nr);
162#else 205#else
206static inline perf_guest_switch_msr *perf_guest_get_msrs(int *nr)
207{
208 *nr = 0;
209 return NULL;
210}
211
163static inline void perf_events_lapic_init(void) { } 212static inline void perf_events_lapic_init(void) { }
164#endif 213#endif
165 214
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 0d1171c97729..b650435ffb53 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -111,6 +111,7 @@ struct cpuinfo_x86 {
111 /* Index into per_cpu list: */ 111 /* Index into per_cpu list: */
112 u16 cpu_index; 112 u16 cpu_index;
113#endif 113#endif
114 u32 microcode;
114} __attribute__((__aligned__(SMP_CACHE_BYTES))); 115} __attribute__((__aligned__(SMP_CACHE_BYTES)));
115 116
116#define X86_VENDOR_INTEL 0 117#define X86_VENDOR_INTEL 0
@@ -179,7 +180,8 @@ static inline void native_cpuid(unsigned int *eax, unsigned int *ebx,
179 "=b" (*ebx), 180 "=b" (*ebx),
180 "=c" (*ecx), 181 "=c" (*ecx),
181 "=d" (*edx) 182 "=d" (*edx)
182 : "0" (*eax), "2" (*ecx)); 183 : "0" (*eax), "2" (*ecx)
184 : "memory");
183} 185}
184 186
185static inline void load_cr3(pgd_t *pgdir) 187static inline void load_cr3(pgd_t *pgdir)
diff --git a/arch/x86/include/asm/reboot.h b/arch/x86/include/asm/reboot.h
index 3250e3d605d9..92f297069e87 100644
--- a/arch/x86/include/asm/reboot.h
+++ b/arch/x86/include/asm/reboot.h
@@ -23,7 +23,7 @@ void machine_real_restart(unsigned int type);
23#define MRR_BIOS 0 23#define MRR_BIOS 0
24#define MRR_APM 1 24#define MRR_APM 1
25 25
26typedef void (*nmi_shootdown_cb)(int, struct die_args*); 26typedef void (*nmi_shootdown_cb)(int, struct pt_regs*);
27void nmi_shootdown_cpus(nmi_shootdown_cb callback); 27void nmi_shootdown_cpus(nmi_shootdown_cb callback);
28 28
29#endif /* _ASM_X86_REBOOT_H */ 29#endif /* _ASM_X86_REBOOT_H */
diff --git a/arch/x86/include/asm/rwsem.h b/arch/x86/include/asm/rwsem.h
index df4cd32b4cc6..2dbe4a721ce5 100644
--- a/arch/x86/include/asm/rwsem.h
+++ b/arch/x86/include/asm/rwsem.h
@@ -204,13 +204,7 @@ static inline void rwsem_atomic_add(long delta, struct rw_semaphore *sem)
204 */ 204 */
205static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem) 205static inline long rwsem_atomic_update(long delta, struct rw_semaphore *sem)
206{ 206{
207 long tmp = delta; 207 return delta + xadd(&sem->count, delta);
208
209 asm volatile(LOCK_PREFIX "xadd %0,%1"
210 : "+r" (tmp), "+m" (sem->count)
211 : : "memory");
212
213 return tmp + delta;
214} 208}
215 209
216#endif /* __KERNEL__ */ 210#endif /* __KERNEL__ */
diff --git a/arch/x86/include/asm/spinlock.h b/arch/x86/include/asm/spinlock.h
index ee67edf86fdd..972c260919a3 100644
--- a/arch/x86/include/asm/spinlock.h
+++ b/arch/x86/include/asm/spinlock.h
@@ -49,109 +49,49 @@
49 * issues and should be optimal for the uncontended case. Note the tail must be 49 * issues and should be optimal for the uncontended case. Note the tail must be
50 * in the high part, because a wide xadd increment of the low part would carry 50 * in the high part, because a wide xadd increment of the low part would carry
51 * up and contaminate the high part. 51 * up and contaminate the high part.
52 *
53 * With fewer than 2^8 possible CPUs, we can use x86's partial registers to
54 * save some instructions and make the code more elegant. There really isn't
55 * much between them in performance though, especially as locks are out of line.
56 */ 52 */
57#if (NR_CPUS < 256)
58#define TICKET_SHIFT 8
59
60static __always_inline void __ticket_spin_lock(arch_spinlock_t *lock) 53static __always_inline void __ticket_spin_lock(arch_spinlock_t *lock)
61{ 54{
62 short inc = 0x0100; 55 register struct __raw_tickets inc = { .tail = 1 };
63 56
64 asm volatile ( 57 inc = xadd(&lock->tickets, inc);
65 LOCK_PREFIX "xaddw %w0, %1\n" 58
66 "1:\t" 59 for (;;) {
67 "cmpb %h0, %b0\n\t" 60 if (inc.head == inc.tail)
68 "je 2f\n\t" 61 break;
69 "rep ; nop\n\t" 62 cpu_relax();
70 "movb %1, %b0\n\t" 63 inc.head = ACCESS_ONCE(lock->tickets.head);
71 /* don't need lfence here, because loads are in-order */ 64 }
72 "jmp 1b\n" 65 barrier(); /* make sure nothing creeps before the lock is taken */
73 "2:"
74 : "+Q" (inc), "+m" (lock->slock)
75 :
76 : "memory", "cc");
77} 66}
78 67
79static __always_inline int __ticket_spin_trylock(arch_spinlock_t *lock) 68static __always_inline int __ticket_spin_trylock(arch_spinlock_t *lock)
80{ 69{
81 int tmp, new; 70 arch_spinlock_t old, new;
82 71
83 asm volatile("movzwl %2, %0\n\t" 72 old.tickets = ACCESS_ONCE(lock->tickets);
84 "cmpb %h0,%b0\n\t" 73 if (old.tickets.head != old.tickets.tail)
85 "leal 0x100(%" REG_PTR_MODE "0), %1\n\t" 74 return 0;
86 "jne 1f\n\t" 75
87 LOCK_PREFIX "cmpxchgw %w1,%2\n\t" 76 new.head_tail = old.head_tail + (1 << TICKET_SHIFT);
88 "1:"
89 "sete %b1\n\t"
90 "movzbl %b1,%0\n\t"
91 : "=&a" (tmp), "=&q" (new), "+m" (lock->slock)
92 :
93 : "memory", "cc");
94 77
95 return tmp; 78 /* cmpxchg is a full barrier, so nothing can move before it */
79 return cmpxchg(&lock->head_tail, old.head_tail, new.head_tail) == old.head_tail;
96} 80}
97 81
82#if (NR_CPUS < 256)
98static __always_inline void __ticket_spin_unlock(arch_spinlock_t *lock) 83static __always_inline void __ticket_spin_unlock(arch_spinlock_t *lock)
99{ 84{
100 asm volatile(UNLOCK_LOCK_PREFIX "incb %0" 85 asm volatile(UNLOCK_LOCK_PREFIX "incb %0"
101 : "+m" (lock->slock) 86 : "+m" (lock->head_tail)
102 : 87 :
103 : "memory", "cc"); 88 : "memory", "cc");
104} 89}
105#else 90#else
106#define TICKET_SHIFT 16
107
108static __always_inline void __ticket_spin_lock(arch_spinlock_t *lock)
109{
110 int inc = 0x00010000;
111 int tmp;
112
113 asm volatile(LOCK_PREFIX "xaddl %0, %1\n"
114 "movzwl %w0, %2\n\t"
115 "shrl $16, %0\n\t"
116 "1:\t"
117 "cmpl %0, %2\n\t"
118 "je 2f\n\t"
119 "rep ; nop\n\t"
120 "movzwl %1, %2\n\t"
121 /* don't need lfence here, because loads are in-order */
122 "jmp 1b\n"
123 "2:"
124 : "+r" (inc), "+m" (lock->slock), "=&r" (tmp)
125 :
126 : "memory", "cc");
127}
128
129static __always_inline int __ticket_spin_trylock(arch_spinlock_t *lock)
130{
131 int tmp;
132 int new;
133
134 asm volatile("movl %2,%0\n\t"
135 "movl %0,%1\n\t"
136 "roll $16, %0\n\t"
137 "cmpl %0,%1\n\t"
138 "leal 0x00010000(%" REG_PTR_MODE "0), %1\n\t"
139 "jne 1f\n\t"
140 LOCK_PREFIX "cmpxchgl %1,%2\n\t"
141 "1:"
142 "sete %b1\n\t"
143 "movzbl %b1,%0\n\t"
144 : "=&a" (tmp), "=&q" (new), "+m" (lock->slock)
145 :
146 : "memory", "cc");
147
148 return tmp;
149}
150
151static __always_inline void __ticket_spin_unlock(arch_spinlock_t *lock) 91static __always_inline void __ticket_spin_unlock(arch_spinlock_t *lock)
152{ 92{
153 asm volatile(UNLOCK_LOCK_PREFIX "incw %0" 93 asm volatile(UNLOCK_LOCK_PREFIX "incw %0"
154 : "+m" (lock->slock) 94 : "+m" (lock->head_tail)
155 : 95 :
156 : "memory", "cc"); 96 : "memory", "cc");
157} 97}
@@ -159,16 +99,16 @@ static __always_inline void __ticket_spin_unlock(arch_spinlock_t *lock)
159 99
160static inline int __ticket_spin_is_locked(arch_spinlock_t *lock) 100static inline int __ticket_spin_is_locked(arch_spinlock_t *lock)
161{ 101{
162 int tmp = ACCESS_ONCE(lock->slock); 102 struct __raw_tickets tmp = ACCESS_ONCE(lock->tickets);
163 103
164 return !!(((tmp >> TICKET_SHIFT) ^ tmp) & ((1 << TICKET_SHIFT) - 1)); 104 return !!(tmp.tail ^ tmp.head);
165} 105}
166 106
167static inline int __ticket_spin_is_contended(arch_spinlock_t *lock) 107static inline int __ticket_spin_is_contended(arch_spinlock_t *lock)
168{ 108{
169 int tmp = ACCESS_ONCE(lock->slock); 109 struct __raw_tickets tmp = ACCESS_ONCE(lock->tickets);
170 110
171 return (((tmp >> TICKET_SHIFT) - tmp) & ((1 << TICKET_SHIFT) - 1)) > 1; 111 return ((tmp.tail - tmp.head) & TICKET_MASK) > 1;
172} 112}
173 113
174#ifndef CONFIG_PARAVIRT_SPINLOCKS 114#ifndef CONFIG_PARAVIRT_SPINLOCKS
diff --git a/arch/x86/include/asm/spinlock_types.h b/arch/x86/include/asm/spinlock_types.h
index 7c7a486fcb68..8ebd5df7451e 100644
--- a/arch/x86/include/asm/spinlock_types.h
+++ b/arch/x86/include/asm/spinlock_types.h
@@ -5,11 +5,29 @@
5# error "please don't include this file directly" 5# error "please don't include this file directly"
6#endif 6#endif
7 7
8#include <linux/types.h>
9
10#if (CONFIG_NR_CPUS < 256)
11typedef u8 __ticket_t;
12typedef u16 __ticketpair_t;
13#else
14typedef u16 __ticket_t;
15typedef u32 __ticketpair_t;
16#endif
17
18#define TICKET_SHIFT (sizeof(__ticket_t) * 8)
19#define TICKET_MASK ((__ticket_t)((1 << TICKET_SHIFT) - 1))
20
8typedef struct arch_spinlock { 21typedef struct arch_spinlock {
9 unsigned int slock; 22 union {
23 __ticketpair_t head_tail;
24 struct __raw_tickets {
25 __ticket_t head, tail;
26 } tickets;
27 };
10} arch_spinlock_t; 28} arch_spinlock_t;
11 29
12#define __ARCH_SPIN_LOCK_UNLOCKED { 0 } 30#define __ARCH_SPIN_LOCK_UNLOCKED { { 0 } }
13 31
14#include <asm/rwlock.h> 32#include <asm/rwlock.h>
15 33
diff --git a/arch/x86/include/asm/unistd_64.h b/arch/x86/include/asm/unistd_64.h
index 201040573444..0a6ba337a2eb 100644
--- a/arch/x86/include/asm/unistd_64.h
+++ b/arch/x86/include/asm/unistd_64.h
@@ -624,7 +624,6 @@ __SYSCALL(__NR_vmsplice, sys_vmsplice)
624__SYSCALL(__NR_move_pages, sys_move_pages) 624__SYSCALL(__NR_move_pages, sys_move_pages)
625#define __NR_utimensat 280 625#define __NR_utimensat 280
626__SYSCALL(__NR_utimensat, sys_utimensat) 626__SYSCALL(__NR_utimensat, sys_utimensat)
627#define __IGNORE_getcpu /* implemented as a vsyscall */
628#define __NR_epoll_pwait 281 627#define __NR_epoll_pwait 281
629__SYSCALL(__NR_epoll_pwait, sys_epoll_pwait) 628__SYSCALL(__NR_epoll_pwait, sys_epoll_pwait)
630#define __NR_signalfd 282 629#define __NR_signalfd 282
diff --git a/arch/x86/include/asm/uv/uv_bau.h b/arch/x86/include/asm/uv/uv_bau.h
index 37d369859c8e..8e862aaf0d90 100644
--- a/arch/x86/include/asm/uv/uv_bau.h
+++ b/arch/x86/include/asm/uv/uv_bau.h
@@ -55,6 +55,7 @@
55#define UV_BAU_TUNABLES_DIR "sgi_uv" 55#define UV_BAU_TUNABLES_DIR "sgi_uv"
56#define UV_BAU_TUNABLES_FILE "bau_tunables" 56#define UV_BAU_TUNABLES_FILE "bau_tunables"
57#define WHITESPACE " \t\n" 57#define WHITESPACE " \t\n"
58#define uv_mmask ((1UL << uv_hub_info->m_val) - 1)
58#define uv_physnodeaddr(x) ((__pa((unsigned long)(x)) & uv_mmask)) 59#define uv_physnodeaddr(x) ((__pa((unsigned long)(x)) & uv_mmask))
59#define cpubit_isset(cpu, bau_local_cpumask) \ 60#define cpubit_isset(cpu, bau_local_cpumask) \
60 test_bit((cpu), (bau_local_cpumask).bits) 61 test_bit((cpu), (bau_local_cpumask).bits)
@@ -656,11 +657,7 @@ static inline int atomic_read_short(const struct atomic_short *v)
656 */ 657 */
657static inline int atom_asr(short i, struct atomic_short *v) 658static inline int atom_asr(short i, struct atomic_short *v)
658{ 659{
659 short __i = i; 660 return i + xadd(&v->counter, i);
660 asm volatile(LOCK_PREFIX "xaddw %0, %1"
661 : "+r" (i), "+m" (v->counter)
662 : : "memory");
663 return i + __i;
664} 661}
665 662
666/* 663/*
diff --git a/arch/x86/include/asm/uv/uv_hub.h b/arch/x86/include/asm/uv/uv_hub.h
index f26544a15214..54a13aaebc40 100644
--- a/arch/x86/include/asm/uv/uv_hub.h
+++ b/arch/x86/include/asm/uv/uv_hub.h
@@ -46,6 +46,13 @@
46 * PNODE - the low N bits of the GNODE. The PNODE is the most useful variant 46 * PNODE - the low N bits of the GNODE. The PNODE is the most useful variant
47 * of the nasid for socket usage. 47 * of the nasid for socket usage.
48 * 48 *
49 * GPA - (global physical address) a socket physical address converted
50 * so that it can be used by the GRU as a global address. Socket
51 * physical addresses 1) need additional NASID (node) bits added
52 * to the high end of the address, and 2) unaliased if the
53 * partition does not have a physical address 0. In addition, on
54 * UV2 rev 1, GPAs need the gnode left shifted to bits 39 or 40.
55 *
49 * 56 *
50 * NumaLink Global Physical Address Format: 57 * NumaLink Global Physical Address Format:
51 * +--------------------------------+---------------------+ 58 * +--------------------------------+---------------------+
@@ -141,6 +148,8 @@ struct uv_hub_info_s {
141 unsigned int gnode_extra; 148 unsigned int gnode_extra;
142 unsigned char hub_revision; 149 unsigned char hub_revision;
143 unsigned char apic_pnode_shift; 150 unsigned char apic_pnode_shift;
151 unsigned char m_shift;
152 unsigned char n_lshift;
144 unsigned long gnode_upper; 153 unsigned long gnode_upper;
145 unsigned long lowmem_remap_top; 154 unsigned long lowmem_remap_top;
146 unsigned long lowmem_remap_base; 155 unsigned long lowmem_remap_base;
@@ -177,6 +186,16 @@ static inline int is_uv2_hub(void)
177 return uv_hub_info->hub_revision >= UV2_HUB_REVISION_BASE; 186 return uv_hub_info->hub_revision >= UV2_HUB_REVISION_BASE;
178} 187}
179 188
189static inline int is_uv2_1_hub(void)
190{
191 return uv_hub_info->hub_revision == UV2_HUB_REVISION_BASE;
192}
193
194static inline int is_uv2_2_hub(void)
195{
196 return uv_hub_info->hub_revision == UV2_HUB_REVISION_BASE + 1;
197}
198
180union uvh_apicid { 199union uvh_apicid {
181 unsigned long v; 200 unsigned long v;
182 struct uvh_apicid_s { 201 struct uvh_apicid_s {
@@ -276,7 +295,10 @@ static inline unsigned long uv_soc_phys_ram_to_gpa(unsigned long paddr)
276{ 295{
277 if (paddr < uv_hub_info->lowmem_remap_top) 296 if (paddr < uv_hub_info->lowmem_remap_top)
278 paddr |= uv_hub_info->lowmem_remap_base; 297 paddr |= uv_hub_info->lowmem_remap_base;
279 return paddr | uv_hub_info->gnode_upper; 298 paddr |= uv_hub_info->gnode_upper;
299 paddr = ((paddr << uv_hub_info->m_shift) >> uv_hub_info->m_shift) |
300 ((paddr >> uv_hub_info->m_val) << uv_hub_info->n_lshift);
301 return paddr;
280} 302}
281 303
282 304
@@ -300,16 +322,19 @@ static inline unsigned long uv_gpa_to_soc_phys_ram(unsigned long gpa)
300 unsigned long remap_base = uv_hub_info->lowmem_remap_base; 322 unsigned long remap_base = uv_hub_info->lowmem_remap_base;
301 unsigned long remap_top = uv_hub_info->lowmem_remap_top; 323 unsigned long remap_top = uv_hub_info->lowmem_remap_top;
302 324
325 gpa = ((gpa << uv_hub_info->m_shift) >> uv_hub_info->m_shift) |
326 ((gpa >> uv_hub_info->n_lshift) << uv_hub_info->m_val);
327 gpa = gpa & uv_hub_info->gpa_mask;
303 if (paddr >= remap_base && paddr < remap_base + remap_top) 328 if (paddr >= remap_base && paddr < remap_base + remap_top)
304 paddr -= remap_base; 329 paddr -= remap_base;
305 return paddr; 330 return paddr;
306} 331}
307 332
308 333
309/* gnode -> pnode */ 334/* gpa -> pnode */
310static inline unsigned long uv_gpa_to_gnode(unsigned long gpa) 335static inline unsigned long uv_gpa_to_gnode(unsigned long gpa)
311{ 336{
312 return gpa >> uv_hub_info->m_val; 337 return gpa >> uv_hub_info->n_lshift;
313} 338}
314 339
315/* gpa -> pnode */ 340/* gpa -> pnode */
@@ -320,6 +345,12 @@ static inline int uv_gpa_to_pnode(unsigned long gpa)
320 return uv_gpa_to_gnode(gpa) & n_mask; 345 return uv_gpa_to_gnode(gpa) & n_mask;
321} 346}
322 347
348/* gpa -> node offset*/
349static inline unsigned long uv_gpa_to_offset(unsigned long gpa)
350{
351 return (gpa << uv_hub_info->m_shift) >> uv_hub_info->m_shift;
352}
353
323/* pnode, offset --> socket virtual */ 354/* pnode, offset --> socket virtual */
324static inline void *uv_pnode_offset_to_vaddr(int pnode, unsigned long offset) 355static inline void *uv_pnode_offset_to_vaddr(int pnode, unsigned long offset)
325{ 356{
diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h
index 7ff4669580cf..c34f96c2f7a0 100644
--- a/arch/x86/include/asm/xen/page.h
+++ b/arch/x86/include/asm/xen/page.h
@@ -12,6 +12,7 @@
12#include <asm/pgtable.h> 12#include <asm/pgtable.h>
13 13
14#include <xen/interface/xen.h> 14#include <xen/interface/xen.h>
15#include <xen/grant_table.h>
15#include <xen/features.h> 16#include <xen/features.h>
16 17
17/* Xen machine address */ 18/* Xen machine address */
@@ -48,14 +49,11 @@ extern unsigned long set_phys_range_identity(unsigned long pfn_s,
48 unsigned long pfn_e); 49 unsigned long pfn_e);
49 50
50extern int m2p_add_override(unsigned long mfn, struct page *page, 51extern int m2p_add_override(unsigned long mfn, struct page *page,
51 bool clear_pte); 52 struct gnttab_map_grant_ref *kmap_op);
52extern int m2p_remove_override(struct page *page, bool clear_pte); 53extern int m2p_remove_override(struct page *page, bool clear_pte);
53extern struct page *m2p_find_override(unsigned long mfn); 54extern struct page *m2p_find_override(unsigned long mfn);
54extern unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn); 55extern unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn);
55 56
56#ifdef CONFIG_XEN_DEBUG_FS
57extern int p2m_dump_show(struct seq_file *m, void *v);
58#endif
59static inline unsigned long pfn_to_mfn(unsigned long pfn) 57static inline unsigned long pfn_to_mfn(unsigned long pfn)
60{ 58{
61 unsigned long mfn; 59 unsigned long mfn;
diff --git a/arch/x86/kernel/Makefile b/arch/x86/kernel/Makefile
index 82f2912155a5..8baca3c4871c 100644
--- a/arch/x86/kernel/Makefile
+++ b/arch/x86/kernel/Makefile
@@ -19,7 +19,7 @@ endif
19 19
20obj-y := process_$(BITS).o signal.o entry_$(BITS).o 20obj-y := process_$(BITS).o signal.o entry_$(BITS).o
21obj-y += traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o 21obj-y += traps.o irq.o irq_$(BITS).o dumpstack_$(BITS).o
22obj-y += time.o ioport.o ldt.o dumpstack.o 22obj-y += time.o ioport.o ldt.o dumpstack.o nmi.o
23obj-y += setup.o x86_init.o i8259.o irqinit.o jump_label.o 23obj-y += setup.o x86_init.o i8259.o irqinit.o jump_label.o
24obj-$(CONFIG_IRQ_WORK) += irq_work.o 24obj-$(CONFIG_IRQ_WORK) += irq_work.o
25obj-y += probe_roms.o 25obj-y += probe_roms.o
diff --git a/arch/x86/kernel/amd_gart_64.c b/arch/x86/kernel/amd_gart_64.c
index 8a439d364b94..b1e7c7f7a0af 100644
--- a/arch/x86/kernel/amd_gart_64.c
+++ b/arch/x86/kernel/amd_gart_64.c
@@ -5,7 +5,7 @@
5 * This allows to use PCI devices that only support 32bit addresses on systems 5 * This allows to use PCI devices that only support 32bit addresses on systems
6 * with more than 4GB. 6 * with more than 4GB.
7 * 7 *
8 * See Documentation/PCI/PCI-DMA-mapping.txt for the interface specification. 8 * See Documentation/DMA-API-HOWTO.txt for the interface specification.
9 * 9 *
10 * Copyright 2002 Andi Kleen, SuSE Labs. 10 * Copyright 2002 Andi Kleen, SuSE Labs.
11 * Subject to the GNU General Public License v2 only. 11 * Subject to the GNU General Public License v2 only.
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index 52fa56399a50..a2fd72e0ab35 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -1437,27 +1437,21 @@ void enable_x2apic(void)
1437 1437
1438int __init enable_IR(void) 1438int __init enable_IR(void)
1439{ 1439{
1440#ifdef CONFIG_INTR_REMAP 1440#ifdef CONFIG_IRQ_REMAP
1441 if (!intr_remapping_supported()) { 1441 if (!intr_remapping_supported()) {
1442 pr_debug("intr-remapping not supported\n"); 1442 pr_debug("intr-remapping not supported\n");
1443 return 0; 1443 return -1;
1444 } 1444 }
1445 1445
1446 if (!x2apic_preenabled && skip_ioapic_setup) { 1446 if (!x2apic_preenabled && skip_ioapic_setup) {
1447 pr_info("Skipped enabling intr-remap because of skipping " 1447 pr_info("Skipped enabling intr-remap because of skipping "
1448 "io-apic setup\n"); 1448 "io-apic setup\n");
1449 return 0; 1449 return -1;
1450 } 1450 }
1451 1451
1452 if (enable_intr_remapping(x2apic_supported())) 1452 return enable_intr_remapping();
1453 return 0;
1454
1455 pr_info("Enabled Interrupt-remapping\n");
1456
1457 return 1;
1458
1459#endif 1453#endif
1460 return 0; 1454 return -1;
1461} 1455}
1462 1456
1463void __init enable_IR_x2apic(void) 1457void __init enable_IR_x2apic(void)
@@ -1481,11 +1475,11 @@ void __init enable_IR_x2apic(void)
1481 mask_ioapic_entries(); 1475 mask_ioapic_entries();
1482 1476
1483 if (dmar_table_init_ret) 1477 if (dmar_table_init_ret)
1484 ret = 0; 1478 ret = -1;
1485 else 1479 else
1486 ret = enable_IR(); 1480 ret = enable_IR();
1487 1481
1488 if (!ret) { 1482 if (ret < 0) {
1489 /* IR is required if there is APIC ID > 255 even when running 1483 /* IR is required if there is APIC ID > 255 even when running
1490 * under KVM 1484 * under KVM
1491 */ 1485 */
@@ -1499,6 +1493,9 @@ void __init enable_IR_x2apic(void)
1499 x2apic_force_phys(); 1493 x2apic_force_phys();
1500 } 1494 }
1501 1495
1496 if (ret == IRQ_REMAP_XAPIC_MODE)
1497 goto nox2apic;
1498
1502 x2apic_enabled = 1; 1499 x2apic_enabled = 1;
1503 1500
1504 if (x2apic_supported() && !x2apic_mode) { 1501 if (x2apic_supported() && !x2apic_mode) {
@@ -1508,19 +1505,21 @@ void __init enable_IR_x2apic(void)
1508 } 1505 }
1509 1506
1510nox2apic: 1507nox2apic:
1511 if (!ret) /* IR enabling failed */ 1508 if (ret < 0) /* IR enabling failed */
1512 restore_ioapic_entries(); 1509 restore_ioapic_entries();
1513 legacy_pic->restore_mask(); 1510 legacy_pic->restore_mask();
1514 local_irq_restore(flags); 1511 local_irq_restore(flags);
1515 1512
1516out: 1513out:
1517 if (x2apic_enabled) 1514 if (x2apic_enabled || !x2apic_supported())
1518 return; 1515 return;
1519 1516
1520 if (x2apic_preenabled) 1517 if (x2apic_preenabled)
1521 panic("x2apic: enabled by BIOS but kernel init failed."); 1518 panic("x2apic: enabled by BIOS but kernel init failed.");
1522 else if (cpu_has_x2apic) 1519 else if (ret == IRQ_REMAP_XAPIC_MODE)
1523 pr_info("Not enabling x2apic, Intr-remapping init failed.\n"); 1520 pr_info("x2apic not enabled, IRQ remapping is in xapic mode\n");
1521 else if (ret < 0)
1522 pr_info("x2apic not enabled, IRQ remapping init failed\n");
1524} 1523}
1525 1524
1526#ifdef CONFIG_X86_64 1525#ifdef CONFIG_X86_64
diff --git a/arch/x86/kernel/apic/bigsmp_32.c b/arch/x86/kernel/apic/bigsmp_32.c
index efd737e827f4..521bead01137 100644
--- a/arch/x86/kernel/apic/bigsmp_32.c
+++ b/arch/x86/kernel/apic/bigsmp_32.c
@@ -255,12 +255,24 @@ static struct apic apic_bigsmp = {
255 .x86_32_early_logical_apicid = bigsmp_early_logical_apicid, 255 .x86_32_early_logical_apicid = bigsmp_early_logical_apicid,
256}; 256};
257 257
258struct apic * __init generic_bigsmp_probe(void) 258void __init generic_bigsmp_probe(void)
259{ 259{
260 if (probe_bigsmp()) 260 unsigned int cpu;
261 return &apic_bigsmp;
262 261
263 return NULL; 262 if (!probe_bigsmp())
263 return;
264
265 apic = &apic_bigsmp;
266
267 for_each_possible_cpu(cpu) {
268 if (early_per_cpu(x86_cpu_to_logical_apicid,
269 cpu) == BAD_APICID)
270 continue;
271 early_per_cpu(x86_cpu_to_logical_apicid, cpu) =
272 bigsmp_early_logical_apicid(cpu);
273 }
274
275 pr_info("Overriding APIC driver with %s\n", apic_bigsmp.name);
264} 276}
265 277
266apic_driver(apic_bigsmp); 278apic_driver(apic_bigsmp);
diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c
index d5e57db0f7be..31cb9ae992b7 100644
--- a/arch/x86/kernel/apic/hw_nmi.c
+++ b/arch/x86/kernel/apic/hw_nmi.c
@@ -60,22 +60,10 @@ void arch_trigger_all_cpu_backtrace(void)
60} 60}
61 61
62static int __kprobes 62static int __kprobes
63arch_trigger_all_cpu_backtrace_handler(struct notifier_block *self, 63arch_trigger_all_cpu_backtrace_handler(unsigned int cmd, struct pt_regs *regs)
64 unsigned long cmd, void *__args)
65{ 64{
66 struct die_args *args = __args;
67 struct pt_regs *regs;
68 int cpu; 65 int cpu;
69 66
70 switch (cmd) {
71 case DIE_NMI:
72 break;
73
74 default:
75 return NOTIFY_DONE;
76 }
77
78 regs = args->regs;
79 cpu = smp_processor_id(); 67 cpu = smp_processor_id();
80 68
81 if (cpumask_test_cpu(cpu, to_cpumask(backtrace_mask))) { 69 if (cpumask_test_cpu(cpu, to_cpumask(backtrace_mask))) {
@@ -86,21 +74,16 @@ arch_trigger_all_cpu_backtrace_handler(struct notifier_block *self,
86 show_regs(regs); 74 show_regs(regs);
87 arch_spin_unlock(&lock); 75 arch_spin_unlock(&lock);
88 cpumask_clear_cpu(cpu, to_cpumask(backtrace_mask)); 76 cpumask_clear_cpu(cpu, to_cpumask(backtrace_mask));
89 return NOTIFY_STOP; 77 return NMI_HANDLED;
90 } 78 }
91 79
92 return NOTIFY_DONE; 80 return NMI_DONE;
93} 81}
94 82
95static __read_mostly struct notifier_block backtrace_notifier = {
96 .notifier_call = arch_trigger_all_cpu_backtrace_handler,
97 .next = NULL,
98 .priority = NMI_LOCAL_LOW_PRIOR,
99};
100
101static int __init register_trigger_all_cpu_backtrace(void) 83static int __init register_trigger_all_cpu_backtrace(void)
102{ 84{
103 register_die_notifier(&backtrace_notifier); 85 register_nmi_handler(NMI_LOCAL, arch_trigger_all_cpu_backtrace_handler,
86 0, "arch_bt");
104 return 0; 87 return 0;
105} 88}
106early_initcall(register_trigger_all_cpu_backtrace); 89early_initcall(register_trigger_all_cpu_backtrace);
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index 8eb863e27ea6..3c31fa98af6d 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -92,21 +92,21 @@ static struct ioapic {
92 DECLARE_BITMAP(pin_programmed, MP_MAX_IOAPIC_PIN + 1); 92 DECLARE_BITMAP(pin_programmed, MP_MAX_IOAPIC_PIN + 1);
93} ioapics[MAX_IO_APICS]; 93} ioapics[MAX_IO_APICS];
94 94
95#define mpc_ioapic_ver(id) ioapics[id].mp_config.apicver 95#define mpc_ioapic_ver(ioapic_idx) ioapics[ioapic_idx].mp_config.apicver
96 96
97int mpc_ioapic_id(int id) 97int mpc_ioapic_id(int ioapic_idx)
98{ 98{
99 return ioapics[id].mp_config.apicid; 99 return ioapics[ioapic_idx].mp_config.apicid;
100} 100}
101 101
102unsigned int mpc_ioapic_addr(int id) 102unsigned int mpc_ioapic_addr(int ioapic_idx)
103{ 103{
104 return ioapics[id].mp_config.apicaddr; 104 return ioapics[ioapic_idx].mp_config.apicaddr;
105} 105}
106 106
107struct mp_ioapic_gsi *mp_ioapic_gsi_routing(int id) 107struct mp_ioapic_gsi *mp_ioapic_gsi_routing(int ioapic_idx)
108{ 108{
109 return &ioapics[id].gsi_config; 109 return &ioapics[ioapic_idx].gsi_config;
110} 110}
111 111
112int nr_ioapics; 112int nr_ioapics;
@@ -186,11 +186,7 @@ static struct irq_pin_list *alloc_irq_pin_list(int node)
186 186
187 187
188/* irq_cfg is indexed by the sum of all RTEs in all I/O APICs. */ 188/* irq_cfg is indexed by the sum of all RTEs in all I/O APICs. */
189#ifdef CONFIG_SPARSE_IRQ
190static struct irq_cfg irq_cfgx[NR_IRQS_LEGACY]; 189static struct irq_cfg irq_cfgx[NR_IRQS_LEGACY];
191#else
192static struct irq_cfg irq_cfgx[NR_IRQS];
193#endif
194 190
195int __init arch_early_irq_init(void) 191int __init arch_early_irq_init(void)
196{ 192{
@@ -234,7 +230,6 @@ int __init arch_early_irq_init(void)
234 return 0; 230 return 0;
235} 231}
236 232
237#ifdef CONFIG_SPARSE_IRQ
238static struct irq_cfg *irq_cfg(unsigned int irq) 233static struct irq_cfg *irq_cfg(unsigned int irq)
239{ 234{
240 return irq_get_chip_data(irq); 235 return irq_get_chip_data(irq);
@@ -269,22 +264,6 @@ static void free_irq_cfg(unsigned int at, struct irq_cfg *cfg)
269 kfree(cfg); 264 kfree(cfg);
270} 265}
271 266
272#else
273
274struct irq_cfg *irq_cfg(unsigned int irq)
275{
276 return irq < nr_irqs ? irq_cfgx + irq : NULL;
277}
278
279static struct irq_cfg *alloc_irq_cfg(unsigned int irq, int node)
280{
281 return irq_cfgx + irq;
282}
283
284static inline void free_irq_cfg(unsigned int at, struct irq_cfg *cfg) { }
285
286#endif
287
288static struct irq_cfg *alloc_irq_and_cfg_at(unsigned int at, int node) 267static struct irq_cfg *alloc_irq_and_cfg_at(unsigned int at, int node)
289{ 268{
290 int res = irq_alloc_desc_at(at, node); 269 int res = irq_alloc_desc_at(at, node);
@@ -394,13 +373,21 @@ union entry_union {
394 struct IO_APIC_route_entry entry; 373 struct IO_APIC_route_entry entry;
395}; 374};
396 375
376static struct IO_APIC_route_entry __ioapic_read_entry(int apic, int pin)
377{
378 union entry_union eu;
379
380 eu.w1 = io_apic_read(apic, 0x10 + 2 * pin);
381 eu.w2 = io_apic_read(apic, 0x11 + 2 * pin);
382 return eu.entry;
383}
384
397static struct IO_APIC_route_entry ioapic_read_entry(int apic, int pin) 385static struct IO_APIC_route_entry ioapic_read_entry(int apic, int pin)
398{ 386{
399 union entry_union eu; 387 union entry_union eu;
400 unsigned long flags; 388 unsigned long flags;
401 raw_spin_lock_irqsave(&ioapic_lock, flags); 389 raw_spin_lock_irqsave(&ioapic_lock, flags);
402 eu.w1 = io_apic_read(apic, 0x10 + 2 * pin); 390 eu.entry = __ioapic_read_entry(apic, pin);
403 eu.w2 = io_apic_read(apic, 0x11 + 2 * pin);
404 raw_spin_unlock_irqrestore(&ioapic_lock, flags); 391 raw_spin_unlock_irqrestore(&ioapic_lock, flags);
405 return eu.entry; 392 return eu.entry;
406} 393}
@@ -529,18 +516,6 @@ static void io_apic_modify_irq(struct irq_cfg *cfg,
529 __io_apic_modify_irq(entry, mask_and, mask_or, final); 516 __io_apic_modify_irq(entry, mask_and, mask_or, final);
530} 517}
531 518
532static void __mask_and_edge_IO_APIC_irq(struct irq_pin_list *entry)
533{
534 __io_apic_modify_irq(entry, ~IO_APIC_REDIR_LEVEL_TRIGGER,
535 IO_APIC_REDIR_MASKED, NULL);
536}
537
538static void __unmask_and_level_IO_APIC_irq(struct irq_pin_list *entry)
539{
540 __io_apic_modify_irq(entry, ~IO_APIC_REDIR_MASKED,
541 IO_APIC_REDIR_LEVEL_TRIGGER, NULL);
542}
543
544static void io_apic_sync(struct irq_pin_list *entry) 519static void io_apic_sync(struct irq_pin_list *entry)
545{ 520{
546 /* 521 /*
@@ -585,6 +560,66 @@ static void unmask_ioapic_irq(struct irq_data *data)
585 unmask_ioapic(data->chip_data); 560 unmask_ioapic(data->chip_data);
586} 561}
587 562
563/*
564 * IO-APIC versions below 0x20 don't support EOI register.
565 * For the record, here is the information about various versions:
566 * 0Xh 82489DX
567 * 1Xh I/OAPIC or I/O(x)APIC which are not PCI 2.2 Compliant
568 * 2Xh I/O(x)APIC which is PCI 2.2 Compliant
569 * 30h-FFh Reserved
570 *
571 * Some of the Intel ICH Specs (ICH2 to ICH5) documents the io-apic
572 * version as 0x2. This is an error with documentation and these ICH chips
573 * use io-apic's of version 0x20.
574 *
575 * For IO-APIC's with EOI register, we use that to do an explicit EOI.
576 * Otherwise, we simulate the EOI message manually by changing the trigger
577 * mode to edge and then back to level, with RTE being masked during this.
578 */
579static void __eoi_ioapic_pin(int apic, int pin, int vector, struct irq_cfg *cfg)
580{
581 if (mpc_ioapic_ver(apic) >= 0x20) {
582 /*
583 * Intr-remapping uses pin number as the virtual vector
584 * in the RTE. Actual vector is programmed in
585 * intr-remapping table entry. Hence for the io-apic
586 * EOI we use the pin number.
587 */
588 if (cfg && irq_remapped(cfg))
589 io_apic_eoi(apic, pin);
590 else
591 io_apic_eoi(apic, vector);
592 } else {
593 struct IO_APIC_route_entry entry, entry1;
594
595 entry = entry1 = __ioapic_read_entry(apic, pin);
596
597 /*
598 * Mask the entry and change the trigger mode to edge.
599 */
600 entry1.mask = 1;
601 entry1.trigger = IOAPIC_EDGE;
602
603 __ioapic_write_entry(apic, pin, entry1);
604
605 /*
606 * Restore the previous level triggered entry.
607 */
608 __ioapic_write_entry(apic, pin, entry);
609 }
610}
611
612static void eoi_ioapic_irq(unsigned int irq, struct irq_cfg *cfg)
613{
614 struct irq_pin_list *entry;
615 unsigned long flags;
616
617 raw_spin_lock_irqsave(&ioapic_lock, flags);
618 for_each_irq_pin(entry, cfg->irq_2_pin)
619 __eoi_ioapic_pin(entry->apic, entry->pin, cfg->vector, cfg);
620 raw_spin_unlock_irqrestore(&ioapic_lock, flags);
621}
622
588static void clear_IO_APIC_pin(unsigned int apic, unsigned int pin) 623static void clear_IO_APIC_pin(unsigned int apic, unsigned int pin)
589{ 624{
590 struct IO_APIC_route_entry entry; 625 struct IO_APIC_route_entry entry;
@@ -593,10 +628,44 @@ static void clear_IO_APIC_pin(unsigned int apic, unsigned int pin)
593 entry = ioapic_read_entry(apic, pin); 628 entry = ioapic_read_entry(apic, pin);
594 if (entry.delivery_mode == dest_SMI) 629 if (entry.delivery_mode == dest_SMI)
595 return; 630 return;
631
632 /*
633 * Make sure the entry is masked and re-read the contents to check
634 * if it is a level triggered pin and if the remote-IRR is set.
635 */
636 if (!entry.mask) {
637 entry.mask = 1;
638 ioapic_write_entry(apic, pin, entry);
639 entry = ioapic_read_entry(apic, pin);
640 }
641
642 if (entry.irr) {
643 unsigned long flags;
644
645 /*
646 * Make sure the trigger mode is set to level. Explicit EOI
647 * doesn't clear the remote-IRR if the trigger mode is not
648 * set to level.
649 */
650 if (!entry.trigger) {
651 entry.trigger = IOAPIC_LEVEL;
652 ioapic_write_entry(apic, pin, entry);
653 }
654
655 raw_spin_lock_irqsave(&ioapic_lock, flags);
656 __eoi_ioapic_pin(apic, pin, entry.vector, NULL);
657 raw_spin_unlock_irqrestore(&ioapic_lock, flags);
658 }
659
596 /* 660 /*
597 * Disable it in the IO-APIC irq-routing table: 661 * Clear the rest of the bits in the IO-APIC RTE except for the mask
662 * bit.
598 */ 663 */
599 ioapic_mask_entry(apic, pin); 664 ioapic_mask_entry(apic, pin);
665 entry = ioapic_read_entry(apic, pin);
666 if (entry.irr)
667 printk(KERN_ERR "Unable to reset IRR for apic: %d, pin :%d\n",
668 mpc_ioapic_id(apic), pin);
600} 669}
601 670
602static void clear_IO_APIC (void) 671static void clear_IO_APIC (void)
@@ -712,13 +781,13 @@ int restore_ioapic_entries(void)
712/* 781/*
713 * Find the IRQ entry number of a certain pin. 782 * Find the IRQ entry number of a certain pin.
714 */ 783 */
715static int find_irq_entry(int apic, int pin, int type) 784static int find_irq_entry(int ioapic_idx, int pin, int type)
716{ 785{
717 int i; 786 int i;
718 787
719 for (i = 0; i < mp_irq_entries; i++) 788 for (i = 0; i < mp_irq_entries; i++)
720 if (mp_irqs[i].irqtype == type && 789 if (mp_irqs[i].irqtype == type &&
721 (mp_irqs[i].dstapic == mpc_ioapic_id(apic) || 790 (mp_irqs[i].dstapic == mpc_ioapic_id(ioapic_idx) ||
722 mp_irqs[i].dstapic == MP_APIC_ALL) && 791 mp_irqs[i].dstapic == MP_APIC_ALL) &&
723 mp_irqs[i].dstirq == pin) 792 mp_irqs[i].dstirq == pin)
724 return i; 793 return i;
@@ -757,12 +826,13 @@ static int __init find_isa_irq_apic(int irq, int type)
757 (mp_irqs[i].srcbusirq == irq)) 826 (mp_irqs[i].srcbusirq == irq))
758 break; 827 break;
759 } 828 }
829
760 if (i < mp_irq_entries) { 830 if (i < mp_irq_entries) {
761 int apic; 831 int ioapic_idx;
762 for(apic = 0; apic < nr_ioapics; apic++) { 832
763 if (mpc_ioapic_id(apic) == mp_irqs[i].dstapic) 833 for (ioapic_idx = 0; ioapic_idx < nr_ioapics; ioapic_idx++)
764 return apic; 834 if (mpc_ioapic_id(ioapic_idx) == mp_irqs[i].dstapic)
765 } 835 return ioapic_idx;
766 } 836 }
767 837
768 return -1; 838 return -1;
@@ -977,7 +1047,7 @@ static int pin_2_irq(int idx, int apic, int pin)
977int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin, 1047int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin,
978 struct io_apic_irq_attr *irq_attr) 1048 struct io_apic_irq_attr *irq_attr)
979{ 1049{
980 int apic, i, best_guess = -1; 1050 int ioapic_idx, i, best_guess = -1;
981 1051
982 apic_printk(APIC_DEBUG, 1052 apic_printk(APIC_DEBUG,
983 "querying PCI -> IRQ mapping bus:%d, slot:%d, pin:%d.\n", 1053 "querying PCI -> IRQ mapping bus:%d, slot:%d, pin:%d.\n",
@@ -990,8 +1060,8 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin,
990 for (i = 0; i < mp_irq_entries; i++) { 1060 for (i = 0; i < mp_irq_entries; i++) {
991 int lbus = mp_irqs[i].srcbus; 1061 int lbus = mp_irqs[i].srcbus;
992 1062
993 for (apic = 0; apic < nr_ioapics; apic++) 1063 for (ioapic_idx = 0; ioapic_idx < nr_ioapics; ioapic_idx++)
994 if (mpc_ioapic_id(apic) == mp_irqs[i].dstapic || 1064 if (mpc_ioapic_id(ioapic_idx) == mp_irqs[i].dstapic ||
995 mp_irqs[i].dstapic == MP_APIC_ALL) 1065 mp_irqs[i].dstapic == MP_APIC_ALL)
996 break; 1066 break;
997 1067
@@ -999,13 +1069,13 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin,
999 !mp_irqs[i].irqtype && 1069 !mp_irqs[i].irqtype &&
1000 (bus == lbus) && 1070 (bus == lbus) &&
1001 (slot == ((mp_irqs[i].srcbusirq >> 2) & 0x1f))) { 1071 (slot == ((mp_irqs[i].srcbusirq >> 2) & 0x1f))) {
1002 int irq = pin_2_irq(i, apic, mp_irqs[i].dstirq); 1072 int irq = pin_2_irq(i, ioapic_idx, mp_irqs[i].dstirq);
1003 1073
1004 if (!(apic || IO_APIC_IRQ(irq))) 1074 if (!(ioapic_idx || IO_APIC_IRQ(irq)))
1005 continue; 1075 continue;
1006 1076
1007 if (pin == (mp_irqs[i].srcbusirq & 3)) { 1077 if (pin == (mp_irqs[i].srcbusirq & 3)) {
1008 set_io_apic_irq_attr(irq_attr, apic, 1078 set_io_apic_irq_attr(irq_attr, ioapic_idx,
1009 mp_irqs[i].dstirq, 1079 mp_irqs[i].dstirq,
1010 irq_trigger(i), 1080 irq_trigger(i),
1011 irq_polarity(i)); 1081 irq_polarity(i));
@@ -1016,7 +1086,7 @@ int IO_APIC_get_PCI_irq_vector(int bus, int slot, int pin,
1016 * best-guess fuzzy result for broken mptables. 1086 * best-guess fuzzy result for broken mptables.
1017 */ 1087 */
1018 if (best_guess < 0) { 1088 if (best_guess < 0) {
1019 set_io_apic_irq_attr(irq_attr, apic, 1089 set_io_apic_irq_attr(irq_attr, ioapic_idx,
1020 mp_irqs[i].dstirq, 1090 mp_irqs[i].dstirq,
1021 irq_trigger(i), 1091 irq_trigger(i),
1022 irq_polarity(i)); 1092 irq_polarity(i));
@@ -1202,7 +1272,6 @@ void __setup_vector_irq(int cpu)
1202} 1272}
1203 1273
1204static struct irq_chip ioapic_chip; 1274static struct irq_chip ioapic_chip;
1205static struct irq_chip ir_ioapic_chip;
1206 1275
1207#ifdef CONFIG_X86_32 1276#ifdef CONFIG_X86_32
1208static inline int IO_APIC_irq_trigger(int irq) 1277static inline int IO_APIC_irq_trigger(int irq)
@@ -1246,7 +1315,7 @@ static void ioapic_register_intr(unsigned int irq, struct irq_cfg *cfg,
1246 1315
1247 if (irq_remapped(cfg)) { 1316 if (irq_remapped(cfg)) {
1248 irq_set_status_flags(irq, IRQ_MOVE_PCNTXT); 1317 irq_set_status_flags(irq, IRQ_MOVE_PCNTXT);
1249 chip = &ir_ioapic_chip; 1318 irq_remap_modify_chip_defaults(chip);
1250 fasteoi = trigger != 0; 1319 fasteoi = trigger != 0;
1251 } 1320 }
1252 1321
@@ -1255,77 +1324,100 @@ static void ioapic_register_intr(unsigned int irq, struct irq_cfg *cfg,
1255 fasteoi ? "fasteoi" : "edge"); 1324 fasteoi ? "fasteoi" : "edge");
1256} 1325}
1257 1326
1258static int setup_ioapic_entry(int apic_id, int irq, 1327
1259 struct IO_APIC_route_entry *entry, 1328static int setup_ir_ioapic_entry(int irq,
1260 unsigned int destination, int trigger, 1329 struct IR_IO_APIC_route_entry *entry,
1261 int polarity, int vector, int pin) 1330 unsigned int destination, int vector,
1331 struct io_apic_irq_attr *attr)
1262{ 1332{
1263 /* 1333 int index;
1264 * add it to the IO-APIC irq-routing table: 1334 struct irte irte;
1265 */ 1335 int ioapic_id = mpc_ioapic_id(attr->ioapic);
1266 memset(entry,0,sizeof(*entry)); 1336 struct intel_iommu *iommu = map_ioapic_to_ir(ioapic_id);
1267 1337
1268 if (intr_remapping_enabled) { 1338 if (!iommu) {
1269 struct intel_iommu *iommu = map_ioapic_to_ir(apic_id); 1339 pr_warn("No mapping iommu for ioapic %d\n", ioapic_id);
1270 struct irte irte; 1340 return -ENODEV;
1271 struct IR_IO_APIC_route_entry *ir_entry = 1341 }
1272 (struct IR_IO_APIC_route_entry *) entry;
1273 int index;
1274 1342
1275 if (!iommu) 1343 index = alloc_irte(iommu, irq, 1);
1276 panic("No mapping iommu for ioapic %d\n", apic_id); 1344 if (index < 0) {
1345 pr_warn("Failed to allocate IRTE for ioapic %d\n", ioapic_id);
1346 return -ENOMEM;
1347 }
1277 1348
1278 index = alloc_irte(iommu, irq, 1); 1349 prepare_irte(&irte, vector, destination);
1279 if (index < 0)
1280 panic("Failed to allocate IRTE for ioapic %d\n", apic_id);
1281 1350
1282 prepare_irte(&irte, vector, destination); 1351 /* Set source-id of interrupt request */
1352 set_ioapic_sid(&irte, ioapic_id);
1283 1353
1284 /* Set source-id of interrupt request */ 1354 modify_irte(irq, &irte);
1285 set_ioapic_sid(&irte, apic_id);
1286 1355
1287 modify_irte(irq, &irte); 1356 apic_printk(APIC_VERBOSE, KERN_DEBUG "IOAPIC[%d]: "
1357 "Set IRTE entry (P:%d FPD:%d Dst_Mode:%d "
1358 "Redir_hint:%d Trig_Mode:%d Dlvry_Mode:%X "
1359 "Avail:%X Vector:%02X Dest:%08X "
1360 "SID:%04X SQ:%X SVT:%X)\n",
1361 attr->ioapic, irte.present, irte.fpd, irte.dst_mode,
1362 irte.redir_hint, irte.trigger_mode, irte.dlvry_mode,
1363 irte.avail, irte.vector, irte.dest_id,
1364 irte.sid, irte.sq, irte.svt);
1365
1366 memset(entry, 0, sizeof(*entry));
1367
1368 entry->index2 = (index >> 15) & 0x1;
1369 entry->zero = 0;
1370 entry->format = 1;
1371 entry->index = (index & 0x7fff);
1372 /*
1373 * IO-APIC RTE will be configured with virtual vector.
1374 * irq handler will do the explicit EOI to the io-apic.
1375 */
1376 entry->vector = attr->ioapic_pin;
1377 entry->mask = 0; /* enable IRQ */
1378 entry->trigger = attr->trigger;
1379 entry->polarity = attr->polarity;
1288 1380
1289 ir_entry->index2 = (index >> 15) & 0x1; 1381 /* Mask level triggered irqs.
1290 ir_entry->zero = 0; 1382 * Use IRQ_DELAYED_DISABLE for edge triggered irqs.
1291 ir_entry->format = 1; 1383 */
1292 ir_entry->index = (index & 0x7fff); 1384 if (attr->trigger)
1293 /* 1385 entry->mask = 1;
1294 * IO-APIC RTE will be configured with virtual vector.
1295 * irq handler will do the explicit EOI to the io-apic.
1296 */
1297 ir_entry->vector = pin;
1298
1299 apic_printk(APIC_VERBOSE, KERN_DEBUG "IOAPIC[%d]: "
1300 "Set IRTE entry (P:%d FPD:%d Dst_Mode:%d "
1301 "Redir_hint:%d Trig_Mode:%d Dlvry_Mode:%X "
1302 "Avail:%X Vector:%02X Dest:%08X "
1303 "SID:%04X SQ:%X SVT:%X)\n",
1304 apic_id, irte.present, irte.fpd, irte.dst_mode,
1305 irte.redir_hint, irte.trigger_mode, irte.dlvry_mode,
1306 irte.avail, irte.vector, irte.dest_id,
1307 irte.sid, irte.sq, irte.svt);
1308 } else {
1309 entry->delivery_mode = apic->irq_delivery_mode;
1310 entry->dest_mode = apic->irq_dest_mode;
1311 entry->dest = destination;
1312 entry->vector = vector;
1313 }
1314 1386
1315 entry->mask = 0; /* enable IRQ */ 1387 return 0;
1316 entry->trigger = trigger; 1388}
1317 entry->polarity = polarity;
1318 1389
1319 /* Mask level triggered irqs. 1390static int setup_ioapic_entry(int irq, struct IO_APIC_route_entry *entry,
1391 unsigned int destination, int vector,
1392 struct io_apic_irq_attr *attr)
1393{
1394 if (intr_remapping_enabled)
1395 return setup_ir_ioapic_entry(irq,
1396 (struct IR_IO_APIC_route_entry *)entry,
1397 destination, vector, attr);
1398
1399 memset(entry, 0, sizeof(*entry));
1400
1401 entry->delivery_mode = apic->irq_delivery_mode;
1402 entry->dest_mode = apic->irq_dest_mode;
1403 entry->dest = destination;
1404 entry->vector = vector;
1405 entry->mask = 0; /* enable IRQ */
1406 entry->trigger = attr->trigger;
1407 entry->polarity = attr->polarity;
1408
1409 /*
1410 * Mask level triggered irqs.
1320 * Use IRQ_DELAYED_DISABLE for edge triggered irqs. 1411 * Use IRQ_DELAYED_DISABLE for edge triggered irqs.
1321 */ 1412 */
1322 if (trigger) 1413 if (attr->trigger)
1323 entry->mask = 1; 1414 entry->mask = 1;
1415
1324 return 0; 1416 return 0;
1325} 1417}
1326 1418
1327static void setup_ioapic_irq(int apic_id, int pin, unsigned int irq, 1419static void setup_ioapic_irq(unsigned int irq, struct irq_cfg *cfg,
1328 struct irq_cfg *cfg, int trigger, int polarity) 1420 struct io_apic_irq_attr *attr)
1329{ 1421{
1330 struct IO_APIC_route_entry entry; 1422 struct IO_APIC_route_entry entry;
1331 unsigned int dest; 1423 unsigned int dest;
@@ -1348,49 +1440,48 @@ static void setup_ioapic_irq(int apic_id, int pin, unsigned int irq,
1348 apic_printk(APIC_VERBOSE,KERN_DEBUG 1440 apic_printk(APIC_VERBOSE,KERN_DEBUG
1349 "IOAPIC[%d]: Set routing entry (%d-%d -> 0x%x -> " 1441 "IOAPIC[%d]: Set routing entry (%d-%d -> 0x%x -> "
1350 "IRQ %d Mode:%i Active:%i Dest:%d)\n", 1442 "IRQ %d Mode:%i Active:%i Dest:%d)\n",
1351 apic_id, mpc_ioapic_id(apic_id), pin, cfg->vector, 1443 attr->ioapic, mpc_ioapic_id(attr->ioapic), attr->ioapic_pin,
1352 irq, trigger, polarity, dest); 1444 cfg->vector, irq, attr->trigger, attr->polarity, dest);
1353
1354 1445
1355 if (setup_ioapic_entry(mpc_ioapic_id(apic_id), irq, &entry, 1446 if (setup_ioapic_entry(irq, &entry, dest, cfg->vector, attr)) {
1356 dest, trigger, polarity, cfg->vector, pin)) { 1447 pr_warn("Failed to setup ioapic entry for ioapic %d, pin %d\n",
1357 printk("Failed to setup ioapic entry for ioapic %d, pin %d\n", 1448 mpc_ioapic_id(attr->ioapic), attr->ioapic_pin);
1358 mpc_ioapic_id(apic_id), pin);
1359 __clear_irq_vector(irq, cfg); 1449 __clear_irq_vector(irq, cfg);
1450
1360 return; 1451 return;
1361 } 1452 }
1362 1453
1363 ioapic_register_intr(irq, cfg, trigger); 1454 ioapic_register_intr(irq, cfg, attr->trigger);
1364 if (irq < legacy_pic->nr_legacy_irqs) 1455 if (irq < legacy_pic->nr_legacy_irqs)
1365 legacy_pic->mask(irq); 1456 legacy_pic->mask(irq);
1366 1457
1367 ioapic_write_entry(apic_id, pin, entry); 1458 ioapic_write_entry(attr->ioapic, attr->ioapic_pin, entry);
1368} 1459}
1369 1460
1370static bool __init io_apic_pin_not_connected(int idx, int apic_id, int pin) 1461static bool __init io_apic_pin_not_connected(int idx, int ioapic_idx, int pin)
1371{ 1462{
1372 if (idx != -1) 1463 if (idx != -1)
1373 return false; 1464 return false;
1374 1465
1375 apic_printk(APIC_VERBOSE, KERN_DEBUG " apic %d pin %d not connected\n", 1466 apic_printk(APIC_VERBOSE, KERN_DEBUG " apic %d pin %d not connected\n",
1376 mpc_ioapic_id(apic_id), pin); 1467 mpc_ioapic_id(ioapic_idx), pin);
1377 return true; 1468 return true;
1378} 1469}
1379 1470
1380static void __init __io_apic_setup_irqs(unsigned int apic_id) 1471static void __init __io_apic_setup_irqs(unsigned int ioapic_idx)
1381{ 1472{
1382 int idx, node = cpu_to_node(0); 1473 int idx, node = cpu_to_node(0);
1383 struct io_apic_irq_attr attr; 1474 struct io_apic_irq_attr attr;
1384 unsigned int pin, irq; 1475 unsigned int pin, irq;
1385 1476
1386 for (pin = 0; pin < ioapics[apic_id].nr_registers; pin++) { 1477 for (pin = 0; pin < ioapics[ioapic_idx].nr_registers; pin++) {
1387 idx = find_irq_entry(apic_id, pin, mp_INT); 1478 idx = find_irq_entry(ioapic_idx, pin, mp_INT);
1388 if (io_apic_pin_not_connected(idx, apic_id, pin)) 1479 if (io_apic_pin_not_connected(idx, ioapic_idx, pin))
1389 continue; 1480 continue;
1390 1481
1391 irq = pin_2_irq(idx, apic_id, pin); 1482 irq = pin_2_irq(idx, ioapic_idx, pin);
1392 1483
1393 if ((apic_id > 0) && (irq > 16)) 1484 if ((ioapic_idx > 0) && (irq > 16))
1394 continue; 1485 continue;
1395 1486
1396 /* 1487 /*
@@ -1398,10 +1489,10 @@ static void __init __io_apic_setup_irqs(unsigned int apic_id)
1398 * installed and if it returns 1: 1489 * installed and if it returns 1:
1399 */ 1490 */
1400 if (apic->multi_timer_check && 1491 if (apic->multi_timer_check &&
1401 apic->multi_timer_check(apic_id, irq)) 1492 apic->multi_timer_check(ioapic_idx, irq))
1402 continue; 1493 continue;
1403 1494
1404 set_io_apic_irq_attr(&attr, apic_id, pin, irq_trigger(idx), 1495 set_io_apic_irq_attr(&attr, ioapic_idx, pin, irq_trigger(idx),
1405 irq_polarity(idx)); 1496 irq_polarity(idx));
1406 1497
1407 io_apic_setup_irq_pin(irq, node, &attr); 1498 io_apic_setup_irq_pin(irq, node, &attr);
@@ -1410,12 +1501,12 @@ static void __init __io_apic_setup_irqs(unsigned int apic_id)
1410 1501
1411static void __init setup_IO_APIC_irqs(void) 1502static void __init setup_IO_APIC_irqs(void)
1412{ 1503{
1413 unsigned int apic_id; 1504 unsigned int ioapic_idx;
1414 1505
1415 apic_printk(APIC_VERBOSE, KERN_DEBUG "init IO_APIC IRQs\n"); 1506 apic_printk(APIC_VERBOSE, KERN_DEBUG "init IO_APIC IRQs\n");
1416 1507
1417 for (apic_id = 0; apic_id < nr_ioapics; apic_id++) 1508 for (ioapic_idx = 0; ioapic_idx < nr_ioapics; ioapic_idx++)
1418 __io_apic_setup_irqs(apic_id); 1509 __io_apic_setup_irqs(ioapic_idx);
1419} 1510}
1420 1511
1421/* 1512/*
@@ -1425,28 +1516,28 @@ static void __init setup_IO_APIC_irqs(void)
1425 */ 1516 */
1426void setup_IO_APIC_irq_extra(u32 gsi) 1517void setup_IO_APIC_irq_extra(u32 gsi)
1427{ 1518{
1428 int apic_id = 0, pin, idx, irq, node = cpu_to_node(0); 1519 int ioapic_idx = 0, pin, idx, irq, node = cpu_to_node(0);
1429 struct io_apic_irq_attr attr; 1520 struct io_apic_irq_attr attr;
1430 1521
1431 /* 1522 /*
1432 * Convert 'gsi' to 'ioapic.pin'. 1523 * Convert 'gsi' to 'ioapic.pin'.
1433 */ 1524 */
1434 apic_id = mp_find_ioapic(gsi); 1525 ioapic_idx = mp_find_ioapic(gsi);
1435 if (apic_id < 0) 1526 if (ioapic_idx < 0)
1436 return; 1527 return;
1437 1528
1438 pin = mp_find_ioapic_pin(apic_id, gsi); 1529 pin = mp_find_ioapic_pin(ioapic_idx, gsi);
1439 idx = find_irq_entry(apic_id, pin, mp_INT); 1530 idx = find_irq_entry(ioapic_idx, pin, mp_INT);
1440 if (idx == -1) 1531 if (idx == -1)
1441 return; 1532 return;
1442 1533
1443 irq = pin_2_irq(idx, apic_id, pin); 1534 irq = pin_2_irq(idx, ioapic_idx, pin);
1444 1535
1445 /* Only handle the non legacy irqs on secondary ioapics */ 1536 /* Only handle the non legacy irqs on secondary ioapics */
1446 if (apic_id == 0 || irq < NR_IRQS_LEGACY) 1537 if (ioapic_idx == 0 || irq < NR_IRQS_LEGACY)
1447 return; 1538 return;
1448 1539
1449 set_io_apic_irq_attr(&attr, apic_id, pin, irq_trigger(idx), 1540 set_io_apic_irq_attr(&attr, ioapic_idx, pin, irq_trigger(idx),
1450 irq_polarity(idx)); 1541 irq_polarity(idx));
1451 1542
1452 io_apic_setup_irq_pin_once(irq, node, &attr); 1543 io_apic_setup_irq_pin_once(irq, node, &attr);
@@ -1455,8 +1546,8 @@ void setup_IO_APIC_irq_extra(u32 gsi)
1455/* 1546/*
1456 * Set up the timer pin, possibly with the 8259A-master behind. 1547 * Set up the timer pin, possibly with the 8259A-master behind.
1457 */ 1548 */
1458static void __init setup_timer_IRQ0_pin(unsigned int apic_id, unsigned int pin, 1549static void __init setup_timer_IRQ0_pin(unsigned int ioapic_idx,
1459 int vector) 1550 unsigned int pin, int vector)
1460{ 1551{
1461 struct IO_APIC_route_entry entry; 1552 struct IO_APIC_route_entry entry;
1462 1553
@@ -1487,45 +1578,29 @@ static void __init setup_timer_IRQ0_pin(unsigned int apic_id, unsigned int pin,
1487 /* 1578 /*
1488 * Add it to the IO-APIC irq-routing table: 1579 * Add it to the IO-APIC irq-routing table:
1489 */ 1580 */
1490 ioapic_write_entry(apic_id, pin, entry); 1581 ioapic_write_entry(ioapic_idx, pin, entry);
1491} 1582}
1492 1583
1493 1584__apicdebuginit(void) print_IO_APIC(int ioapic_idx)
1494__apicdebuginit(void) print_IO_APIC(void)
1495{ 1585{
1496 int apic, i; 1586 int i;
1497 union IO_APIC_reg_00 reg_00; 1587 union IO_APIC_reg_00 reg_00;
1498 union IO_APIC_reg_01 reg_01; 1588 union IO_APIC_reg_01 reg_01;
1499 union IO_APIC_reg_02 reg_02; 1589 union IO_APIC_reg_02 reg_02;
1500 union IO_APIC_reg_03 reg_03; 1590 union IO_APIC_reg_03 reg_03;
1501 unsigned long flags; 1591 unsigned long flags;
1502 struct irq_cfg *cfg;
1503 unsigned int irq;
1504
1505 printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries);
1506 for (i = 0; i < nr_ioapics; i++)
1507 printk(KERN_DEBUG "number of IO-APIC #%d registers: %d.\n",
1508 mpc_ioapic_id(i), ioapics[i].nr_registers);
1509
1510 /*
1511 * We are a bit conservative about what we expect. We have to
1512 * know about every hardware change ASAP.
1513 */
1514 printk(KERN_INFO "testing the IO APIC.......................\n");
1515
1516 for (apic = 0; apic < nr_ioapics; apic++) {
1517 1592
1518 raw_spin_lock_irqsave(&ioapic_lock, flags); 1593 raw_spin_lock_irqsave(&ioapic_lock, flags);
1519 reg_00.raw = io_apic_read(apic, 0); 1594 reg_00.raw = io_apic_read(ioapic_idx, 0);
1520 reg_01.raw = io_apic_read(apic, 1); 1595 reg_01.raw = io_apic_read(ioapic_idx, 1);
1521 if (reg_01.bits.version >= 0x10) 1596 if (reg_01.bits.version >= 0x10)
1522 reg_02.raw = io_apic_read(apic, 2); 1597 reg_02.raw = io_apic_read(ioapic_idx, 2);
1523 if (reg_01.bits.version >= 0x20) 1598 if (reg_01.bits.version >= 0x20)
1524 reg_03.raw = io_apic_read(apic, 3); 1599 reg_03.raw = io_apic_read(ioapic_idx, 3);
1525 raw_spin_unlock_irqrestore(&ioapic_lock, flags); 1600 raw_spin_unlock_irqrestore(&ioapic_lock, flags);
1526 1601
1527 printk("\n"); 1602 printk("\n");
1528 printk(KERN_DEBUG "IO APIC #%d......\n", mpc_ioapic_id(apic)); 1603 printk(KERN_DEBUG "IO APIC #%d......\n", mpc_ioapic_id(ioapic_idx));
1529 printk(KERN_DEBUG ".... register #00: %08X\n", reg_00.raw); 1604 printk(KERN_DEBUG ".... register #00: %08X\n", reg_00.raw);
1530 printk(KERN_DEBUG "....... : physical APIC id: %02X\n", reg_00.bits.ID); 1605 printk(KERN_DEBUG "....... : physical APIC id: %02X\n", reg_00.bits.ID);
1531 printk(KERN_DEBUG "....... : Delivery Type: %X\n", reg_00.bits.delivery_type); 1606 printk(KERN_DEBUG "....... : Delivery Type: %X\n", reg_00.bits.delivery_type);
@@ -1575,7 +1650,7 @@ __apicdebuginit(void) print_IO_APIC(void)
1575 struct IO_APIC_route_entry entry; 1650 struct IO_APIC_route_entry entry;
1576 struct IR_IO_APIC_route_entry *ir_entry; 1651 struct IR_IO_APIC_route_entry *ir_entry;
1577 1652
1578 entry = ioapic_read_entry(apic, i); 1653 entry = ioapic_read_entry(ioapic_idx, i);
1579 ir_entry = (struct IR_IO_APIC_route_entry *) &entry; 1654 ir_entry = (struct IR_IO_APIC_route_entry *) &entry;
1580 printk(KERN_DEBUG " %02x %04X ", 1655 printk(KERN_DEBUG " %02x %04X ",
1581 i, 1656 i,
@@ -1596,7 +1671,7 @@ __apicdebuginit(void) print_IO_APIC(void)
1596 } else { 1671 } else {
1597 struct IO_APIC_route_entry entry; 1672 struct IO_APIC_route_entry entry;
1598 1673
1599 entry = ioapic_read_entry(apic, i); 1674 entry = ioapic_read_entry(ioapic_idx, i);
1600 printk(KERN_DEBUG " %02x %02X ", 1675 printk(KERN_DEBUG " %02x %02X ",
1601 i, 1676 i,
1602 entry.dest 1677 entry.dest
@@ -1614,7 +1689,28 @@ __apicdebuginit(void) print_IO_APIC(void)
1614 ); 1689 );
1615 } 1690 }
1616 } 1691 }
1617 } 1692}
1693
1694__apicdebuginit(void) print_IO_APICs(void)
1695{
1696 int ioapic_idx;
1697 struct irq_cfg *cfg;
1698 unsigned int irq;
1699
1700 printk(KERN_DEBUG "number of MP IRQ sources: %d.\n", mp_irq_entries);
1701 for (ioapic_idx = 0; ioapic_idx < nr_ioapics; ioapic_idx++)
1702 printk(KERN_DEBUG "number of IO-APIC #%d registers: %d.\n",
1703 mpc_ioapic_id(ioapic_idx),
1704 ioapics[ioapic_idx].nr_registers);
1705
1706 /*
1707 * We are a bit conservative about what we expect. We have to
1708 * know about every hardware change ASAP.
1709 */
1710 printk(KERN_INFO "testing the IO APIC.......................\n");
1711
1712 for (ioapic_idx = 0; ioapic_idx < nr_ioapics; ioapic_idx++)
1713 print_IO_APIC(ioapic_idx);
1618 1714
1619 printk(KERN_DEBUG "IRQ to pin mappings:\n"); 1715 printk(KERN_DEBUG "IRQ to pin mappings:\n");
1620 for_each_active_irq(irq) { 1716 for_each_active_irq(irq) {
@@ -1633,8 +1729,6 @@ __apicdebuginit(void) print_IO_APIC(void)
1633 } 1729 }
1634 1730
1635 printk(KERN_INFO ".................................... done.\n"); 1731 printk(KERN_INFO ".................................... done.\n");
1636
1637 return;
1638} 1732}
1639 1733
1640__apicdebuginit(void) print_APIC_field(int base) 1734__apicdebuginit(void) print_APIC_field(int base)
@@ -1828,7 +1922,7 @@ __apicdebuginit(int) print_ICs(void)
1828 return 0; 1922 return 0;
1829 1923
1830 print_local_APICs(show_lapic); 1924 print_local_APICs(show_lapic);
1831 print_IO_APIC(); 1925 print_IO_APICs();
1832 1926
1833 return 0; 1927 return 0;
1834} 1928}
@@ -1953,7 +2047,7 @@ void __init setup_ioapic_ids_from_mpc_nocheck(void)
1953{ 2047{
1954 union IO_APIC_reg_00 reg_00; 2048 union IO_APIC_reg_00 reg_00;
1955 physid_mask_t phys_id_present_map; 2049 physid_mask_t phys_id_present_map;
1956 int apic_id; 2050 int ioapic_idx;
1957 int i; 2051 int i;
1958 unsigned char old_id; 2052 unsigned char old_id;
1959 unsigned long flags; 2053 unsigned long flags;
@@ -1967,21 +2061,20 @@ void __init setup_ioapic_ids_from_mpc_nocheck(void)
1967 /* 2061 /*
1968 * Set the IOAPIC ID to the value stored in the MPC table. 2062 * Set the IOAPIC ID to the value stored in the MPC table.
1969 */ 2063 */
1970 for (apic_id = 0; apic_id < nr_ioapics; apic_id++) { 2064 for (ioapic_idx = 0; ioapic_idx < nr_ioapics; ioapic_idx++) {
1971
1972 /* Read the register 0 value */ 2065 /* Read the register 0 value */
1973 raw_spin_lock_irqsave(&ioapic_lock, flags); 2066 raw_spin_lock_irqsave(&ioapic_lock, flags);
1974 reg_00.raw = io_apic_read(apic_id, 0); 2067 reg_00.raw = io_apic_read(ioapic_idx, 0);
1975 raw_spin_unlock_irqrestore(&ioapic_lock, flags); 2068 raw_spin_unlock_irqrestore(&ioapic_lock, flags);
1976 2069
1977 old_id = mpc_ioapic_id(apic_id); 2070 old_id = mpc_ioapic_id(ioapic_idx);
1978 2071
1979 if (mpc_ioapic_id(apic_id) >= get_physical_broadcast()) { 2072 if (mpc_ioapic_id(ioapic_idx) >= get_physical_broadcast()) {
1980 printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n", 2073 printk(KERN_ERR "BIOS bug, IO-APIC#%d ID is %d in the MPC table!...\n",
1981 apic_id, mpc_ioapic_id(apic_id)); 2074 ioapic_idx, mpc_ioapic_id(ioapic_idx));
1982 printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", 2075 printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
1983 reg_00.bits.ID); 2076 reg_00.bits.ID);
1984 ioapics[apic_id].mp_config.apicid = reg_00.bits.ID; 2077 ioapics[ioapic_idx].mp_config.apicid = reg_00.bits.ID;
1985 } 2078 }
1986 2079
1987 /* 2080 /*
@@ -1990,9 +2083,9 @@ void __init setup_ioapic_ids_from_mpc_nocheck(void)
1990 * 'stuck on smp_invalidate_needed IPI wait' messages. 2083 * 'stuck on smp_invalidate_needed IPI wait' messages.
1991 */ 2084 */
1992 if (apic->check_apicid_used(&phys_id_present_map, 2085 if (apic->check_apicid_used(&phys_id_present_map,
1993 mpc_ioapic_id(apic_id))) { 2086 mpc_ioapic_id(ioapic_idx))) {
1994 printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n", 2087 printk(KERN_ERR "BIOS bug, IO-APIC#%d ID %d is already used!...\n",
1995 apic_id, mpc_ioapic_id(apic_id)); 2088 ioapic_idx, mpc_ioapic_id(ioapic_idx));
1996 for (i = 0; i < get_physical_broadcast(); i++) 2089 for (i = 0; i < get_physical_broadcast(); i++)
1997 if (!physid_isset(i, phys_id_present_map)) 2090 if (!physid_isset(i, phys_id_present_map))
1998 break; 2091 break;
@@ -2001,14 +2094,14 @@ void __init setup_ioapic_ids_from_mpc_nocheck(void)
2001 printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n", 2094 printk(KERN_ERR "... fixing up to %d. (tell your hw vendor)\n",
2002 i); 2095 i);
2003 physid_set(i, phys_id_present_map); 2096 physid_set(i, phys_id_present_map);
2004 ioapics[apic_id].mp_config.apicid = i; 2097 ioapics[ioapic_idx].mp_config.apicid = i;
2005 } else { 2098 } else {
2006 physid_mask_t tmp; 2099 physid_mask_t tmp;
2007 apic->apicid_to_cpu_present(mpc_ioapic_id(apic_id), 2100 apic->apicid_to_cpu_present(mpc_ioapic_id(ioapic_idx),
2008 &tmp); 2101 &tmp);
2009 apic_printk(APIC_VERBOSE, "Setting %d in the " 2102 apic_printk(APIC_VERBOSE, "Setting %d in the "
2010 "phys_id_present_map\n", 2103 "phys_id_present_map\n",
2011 mpc_ioapic_id(apic_id)); 2104 mpc_ioapic_id(ioapic_idx));
2012 physids_or(phys_id_present_map, phys_id_present_map, tmp); 2105 physids_or(phys_id_present_map, phys_id_present_map, tmp);
2013 } 2106 }
2014 2107
@@ -2016,35 +2109,35 @@ void __init setup_ioapic_ids_from_mpc_nocheck(void)
2016 * We need to adjust the IRQ routing table 2109 * We need to adjust the IRQ routing table
2017 * if the ID changed. 2110 * if the ID changed.
2018 */ 2111 */
2019 if (old_id != mpc_ioapic_id(apic_id)) 2112 if (old_id != mpc_ioapic_id(ioapic_idx))
2020 for (i = 0; i < mp_irq_entries; i++) 2113 for (i = 0; i < mp_irq_entries; i++)
2021 if (mp_irqs[i].dstapic == old_id) 2114 if (mp_irqs[i].dstapic == old_id)
2022 mp_irqs[i].dstapic 2115 mp_irqs[i].dstapic
2023 = mpc_ioapic_id(apic_id); 2116 = mpc_ioapic_id(ioapic_idx);
2024 2117
2025 /* 2118 /*
2026 * Update the ID register according to the right value 2119 * Update the ID register according to the right value
2027 * from the MPC table if they are different. 2120 * from the MPC table if they are different.
2028 */ 2121 */
2029 if (mpc_ioapic_id(apic_id) == reg_00.bits.ID) 2122 if (mpc_ioapic_id(ioapic_idx) == reg_00.bits.ID)
2030 continue; 2123 continue;
2031 2124
2032 apic_printk(APIC_VERBOSE, KERN_INFO 2125 apic_printk(APIC_VERBOSE, KERN_INFO
2033 "...changing IO-APIC physical APIC ID to %d ...", 2126 "...changing IO-APIC physical APIC ID to %d ...",
2034 mpc_ioapic_id(apic_id)); 2127 mpc_ioapic_id(ioapic_idx));
2035 2128
2036 reg_00.bits.ID = mpc_ioapic_id(apic_id); 2129 reg_00.bits.ID = mpc_ioapic_id(ioapic_idx);
2037 raw_spin_lock_irqsave(&ioapic_lock, flags); 2130 raw_spin_lock_irqsave(&ioapic_lock, flags);
2038 io_apic_write(apic_id, 0, reg_00.raw); 2131 io_apic_write(ioapic_idx, 0, reg_00.raw);
2039 raw_spin_unlock_irqrestore(&ioapic_lock, flags); 2132 raw_spin_unlock_irqrestore(&ioapic_lock, flags);
2040 2133
2041 /* 2134 /*
2042 * Sanity check 2135 * Sanity check
2043 */ 2136 */
2044 raw_spin_lock_irqsave(&ioapic_lock, flags); 2137 raw_spin_lock_irqsave(&ioapic_lock, flags);
2045 reg_00.raw = io_apic_read(apic_id, 0); 2138 reg_00.raw = io_apic_read(ioapic_idx, 0);
2046 raw_spin_unlock_irqrestore(&ioapic_lock, flags); 2139 raw_spin_unlock_irqrestore(&ioapic_lock, flags);
2047 if (reg_00.bits.ID != mpc_ioapic_id(apic_id)) 2140 if (reg_00.bits.ID != mpc_ioapic_id(ioapic_idx))
2048 printk("could not set ID!\n"); 2141 printk("could not set ID!\n");
2049 else 2142 else
2050 apic_printk(APIC_VERBOSE, " ok.\n"); 2143 apic_printk(APIC_VERBOSE, " ok.\n");
@@ -2255,7 +2348,7 @@ ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask,
2255 return ret; 2348 return ret;
2256} 2349}
2257 2350
2258#ifdef CONFIG_INTR_REMAP 2351#ifdef CONFIG_IRQ_REMAP
2259 2352
2260/* 2353/*
2261 * Migrate the IO-APIC irq in the presence of intr-remapping. 2354 * Migrate the IO-APIC irq in the presence of intr-remapping.
@@ -2267,6 +2360,9 @@ ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask,
2267 * updated vector information), by using a virtual vector (io-apic pin number). 2360 * updated vector information), by using a virtual vector (io-apic pin number).
2268 * Real vector that is used for interrupting cpu will be coming from 2361 * Real vector that is used for interrupting cpu will be coming from
2269 * the interrupt-remapping table entry. 2362 * the interrupt-remapping table entry.
2363 *
2364 * As the migration is a simple atomic update of IRTE, the same mechanism
2365 * is used to migrate MSI irq's in the presence of interrupt-remapping.
2270 */ 2366 */
2271static int 2367static int
2272ir_ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask, 2368ir_ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask,
@@ -2291,10 +2387,16 @@ ir_ioapic_set_affinity(struct irq_data *data, const struct cpumask *mask,
2291 irte.dest_id = IRTE_DEST(dest); 2387 irte.dest_id = IRTE_DEST(dest);
2292 2388
2293 /* 2389 /*
2294 * Modified the IRTE and flushes the Interrupt entry cache. 2390 * Atomically updates the IRTE with the new destination, vector
2391 * and flushes the interrupt entry cache.
2295 */ 2392 */
2296 modify_irte(irq, &irte); 2393 modify_irte(irq, &irte);
2297 2394
2395 /*
2396 * After this point, all the interrupts will start arriving
2397 * at the new destination. So, time to cleanup the previous
2398 * vector allocation.
2399 */
2298 if (cfg->move_in_progress) 2400 if (cfg->move_in_progress)
2299 send_cleanup_vector(cfg); 2401 send_cleanup_vector(cfg);
2300 2402
@@ -2407,48 +2509,6 @@ static void ack_apic_edge(struct irq_data *data)
2407 2509
2408atomic_t irq_mis_count; 2510atomic_t irq_mis_count;
2409 2511
2410/*
2411 * IO-APIC versions below 0x20 don't support EOI register.
2412 * For the record, here is the information about various versions:
2413 * 0Xh 82489DX
2414 * 1Xh I/OAPIC or I/O(x)APIC which are not PCI 2.2 Compliant
2415 * 2Xh I/O(x)APIC which is PCI 2.2 Compliant
2416 * 30h-FFh Reserved
2417 *
2418 * Some of the Intel ICH Specs (ICH2 to ICH5) documents the io-apic
2419 * version as 0x2. This is an error with documentation and these ICH chips
2420 * use io-apic's of version 0x20.
2421 *
2422 * For IO-APIC's with EOI register, we use that to do an explicit EOI.
2423 * Otherwise, we simulate the EOI message manually by changing the trigger
2424 * mode to edge and then back to level, with RTE being masked during this.
2425*/
2426static void eoi_ioapic_irq(unsigned int irq, struct irq_cfg *cfg)
2427{
2428 struct irq_pin_list *entry;
2429 unsigned long flags;
2430
2431 raw_spin_lock_irqsave(&ioapic_lock, flags);
2432 for_each_irq_pin(entry, cfg->irq_2_pin) {
2433 if (mpc_ioapic_ver(entry->apic) >= 0x20) {
2434 /*
2435 * Intr-remapping uses pin number as the virtual vector
2436 * in the RTE. Actual vector is programmed in
2437 * intr-remapping table entry. Hence for the io-apic
2438 * EOI we use the pin number.
2439 */
2440 if (irq_remapped(cfg))
2441 io_apic_eoi(entry->apic, entry->pin);
2442 else
2443 io_apic_eoi(entry->apic, cfg->vector);
2444 } else {
2445 __mask_and_edge_IO_APIC_irq(entry);
2446 __unmask_and_level_IO_APIC_irq(entry);
2447 }
2448 }
2449 raw_spin_unlock_irqrestore(&ioapic_lock, flags);
2450}
2451
2452static void ack_apic_level(struct irq_data *data) 2512static void ack_apic_level(struct irq_data *data)
2453{ 2513{
2454 struct irq_cfg *cfg = data->chip_data; 2514 struct irq_cfg *cfg = data->chip_data;
@@ -2552,7 +2612,7 @@ static void ack_apic_level(struct irq_data *data)
2552 } 2612 }
2553} 2613}
2554 2614
2555#ifdef CONFIG_INTR_REMAP 2615#ifdef CONFIG_IRQ_REMAP
2556static void ir_ack_apic_edge(struct irq_data *data) 2616static void ir_ack_apic_edge(struct irq_data *data)
2557{ 2617{
2558 ack_APIC_irq(); 2618 ack_APIC_irq();
@@ -2563,7 +2623,23 @@ static void ir_ack_apic_level(struct irq_data *data)
2563 ack_APIC_irq(); 2623 ack_APIC_irq();
2564 eoi_ioapic_irq(data->irq, data->chip_data); 2624 eoi_ioapic_irq(data->irq, data->chip_data);
2565} 2625}
2566#endif /* CONFIG_INTR_REMAP */ 2626
2627static void ir_print_prefix(struct irq_data *data, struct seq_file *p)
2628{
2629 seq_printf(p, " IR-%s", data->chip->name);
2630}
2631
2632static void irq_remap_modify_chip_defaults(struct irq_chip *chip)
2633{
2634 chip->irq_print_chip = ir_print_prefix;
2635 chip->irq_ack = ir_ack_apic_edge;
2636 chip->irq_eoi = ir_ack_apic_level;
2637
2638#ifdef CONFIG_SMP
2639 chip->irq_set_affinity = ir_ioapic_set_affinity;
2640#endif
2641}
2642#endif /* CONFIG_IRQ_REMAP */
2567 2643
2568static struct irq_chip ioapic_chip __read_mostly = { 2644static struct irq_chip ioapic_chip __read_mostly = {
2569 .name = "IO-APIC", 2645 .name = "IO-APIC",
@@ -2578,21 +2654,6 @@ static struct irq_chip ioapic_chip __read_mostly = {
2578 .irq_retrigger = ioapic_retrigger_irq, 2654 .irq_retrigger = ioapic_retrigger_irq,
2579}; 2655};
2580 2656
2581static struct irq_chip ir_ioapic_chip __read_mostly = {
2582 .name = "IR-IO-APIC",
2583 .irq_startup = startup_ioapic_irq,
2584 .irq_mask = mask_ioapic_irq,
2585 .irq_unmask = unmask_ioapic_irq,
2586#ifdef CONFIG_INTR_REMAP
2587 .irq_ack = ir_ack_apic_edge,
2588 .irq_eoi = ir_ack_apic_level,
2589#ifdef CONFIG_SMP
2590 .irq_set_affinity = ir_ioapic_set_affinity,
2591#endif
2592#endif
2593 .irq_retrigger = ioapic_retrigger_irq,
2594};
2595
2596static inline void init_IO_APIC_traps(void) 2657static inline void init_IO_APIC_traps(void)
2597{ 2658{
2598 struct irq_cfg *cfg; 2659 struct irq_cfg *cfg;
@@ -2944,27 +3005,26 @@ static int __init io_apic_bug_finalize(void)
2944 3005
2945late_initcall(io_apic_bug_finalize); 3006late_initcall(io_apic_bug_finalize);
2946 3007
2947static void resume_ioapic_id(int ioapic_id) 3008static void resume_ioapic_id(int ioapic_idx)
2948{ 3009{
2949 unsigned long flags; 3010 unsigned long flags;
2950 union IO_APIC_reg_00 reg_00; 3011 union IO_APIC_reg_00 reg_00;
2951 3012
2952
2953 raw_spin_lock_irqsave(&ioapic_lock, flags); 3013 raw_spin_lock_irqsave(&ioapic_lock, flags);
2954 reg_00.raw = io_apic_read(ioapic_id, 0); 3014 reg_00.raw = io_apic_read(ioapic_idx, 0);
2955 if (reg_00.bits.ID != mpc_ioapic_id(ioapic_id)) { 3015 if (reg_00.bits.ID != mpc_ioapic_id(ioapic_idx)) {
2956 reg_00.bits.ID = mpc_ioapic_id(ioapic_id); 3016 reg_00.bits.ID = mpc_ioapic_id(ioapic_idx);
2957 io_apic_write(ioapic_id, 0, reg_00.raw); 3017 io_apic_write(ioapic_idx, 0, reg_00.raw);
2958 } 3018 }
2959 raw_spin_unlock_irqrestore(&ioapic_lock, flags); 3019 raw_spin_unlock_irqrestore(&ioapic_lock, flags);
2960} 3020}
2961 3021
2962static void ioapic_resume(void) 3022static void ioapic_resume(void)
2963{ 3023{
2964 int ioapic_id; 3024 int ioapic_idx;
2965 3025
2966 for (ioapic_id = nr_ioapics - 1; ioapic_id >= 0; ioapic_id--) 3026 for (ioapic_idx = nr_ioapics - 1; ioapic_idx >= 0; ioapic_idx--)
2967 resume_ioapic_id(ioapic_id); 3027 resume_ioapic_id(ioapic_idx);
2968 3028
2969 restore_ioapic_entries(); 3029 restore_ioapic_entries();
2970} 3030}
@@ -3144,45 +3204,6 @@ msi_set_affinity(struct irq_data *data, const struct cpumask *mask, bool force)
3144 3204
3145 return 0; 3205 return 0;
3146} 3206}
3147#ifdef CONFIG_INTR_REMAP
3148/*
3149 * Migrate the MSI irq to another cpumask. This migration is
3150 * done in the process context using interrupt-remapping hardware.
3151 */
3152static int
3153ir_msi_set_affinity(struct irq_data *data, const struct cpumask *mask,
3154 bool force)
3155{
3156 struct irq_cfg *cfg = data->chip_data;
3157 unsigned int dest, irq = data->irq;
3158 struct irte irte;
3159
3160 if (get_irte(irq, &irte))
3161 return -1;
3162
3163 if (__ioapic_set_affinity(data, mask, &dest))
3164 return -1;
3165
3166 irte.vector = cfg->vector;
3167 irte.dest_id = IRTE_DEST(dest);
3168
3169 /*
3170 * atomically update the IRTE with the new destination and vector.
3171 */
3172 modify_irte(irq, &irte);
3173
3174 /*
3175 * After this point, all the interrupts will start arriving
3176 * at the new destination. So, time to cleanup the previous
3177 * vector allocation.
3178 */
3179 if (cfg->move_in_progress)
3180 send_cleanup_vector(cfg);
3181
3182 return 0;
3183}
3184
3185#endif
3186#endif /* CONFIG_SMP */ 3207#endif /* CONFIG_SMP */
3187 3208
3188/* 3209/*
@@ -3200,19 +3221,6 @@ static struct irq_chip msi_chip = {
3200 .irq_retrigger = ioapic_retrigger_irq, 3221 .irq_retrigger = ioapic_retrigger_irq,
3201}; 3222};
3202 3223
3203static struct irq_chip msi_ir_chip = {
3204 .name = "IR-PCI-MSI",
3205 .irq_unmask = unmask_msi_irq,
3206 .irq_mask = mask_msi_irq,
3207#ifdef CONFIG_INTR_REMAP
3208 .irq_ack = ir_ack_apic_edge,
3209#ifdef CONFIG_SMP
3210 .irq_set_affinity = ir_msi_set_affinity,
3211#endif
3212#endif
3213 .irq_retrigger = ioapic_retrigger_irq,
3214};
3215
3216/* 3224/*
3217 * Map the PCI dev to the corresponding remapping hardware unit 3225 * Map the PCI dev to the corresponding remapping hardware unit
3218 * and allocate 'nvec' consecutive interrupt-remapping table entries 3226 * and allocate 'nvec' consecutive interrupt-remapping table entries
@@ -3255,7 +3263,7 @@ static int setup_msi_irq(struct pci_dev *dev, struct msi_desc *msidesc, int irq)
3255 3263
3256 if (irq_remapped(irq_get_chip_data(irq))) { 3264 if (irq_remapped(irq_get_chip_data(irq))) {
3257 irq_set_status_flags(irq, IRQ_MOVE_PCNTXT); 3265 irq_set_status_flags(irq, IRQ_MOVE_PCNTXT);
3258 chip = &msi_ir_chip; 3266 irq_remap_modify_chip_defaults(chip);
3259 } 3267 }
3260 3268
3261 irq_set_chip_and_handler_name(irq, chip, handle_edge_irq, "edge"); 3269 irq_set_chip_and_handler_name(irq, chip, handle_edge_irq, "edge");
@@ -3328,7 +3336,7 @@ void native_teardown_msi_irq(unsigned int irq)
3328 destroy_irq(irq); 3336 destroy_irq(irq);
3329} 3337}
3330 3338
3331#if defined (CONFIG_DMAR) || defined (CONFIG_INTR_REMAP) 3339#ifdef CONFIG_DMAR_TABLE
3332#ifdef CONFIG_SMP 3340#ifdef CONFIG_SMP
3333static int 3341static int
3334dmar_msi_set_affinity(struct irq_data *data, const struct cpumask *mask, 3342dmar_msi_set_affinity(struct irq_data *data, const struct cpumask *mask,
@@ -3409,19 +3417,6 @@ static int hpet_msi_set_affinity(struct irq_data *data,
3409 3417
3410#endif /* CONFIG_SMP */ 3418#endif /* CONFIG_SMP */
3411 3419
3412static struct irq_chip ir_hpet_msi_type = {
3413 .name = "IR-HPET_MSI",
3414 .irq_unmask = hpet_msi_unmask,
3415 .irq_mask = hpet_msi_mask,
3416#ifdef CONFIG_INTR_REMAP
3417 .irq_ack = ir_ack_apic_edge,
3418#ifdef CONFIG_SMP
3419 .irq_set_affinity = ir_msi_set_affinity,
3420#endif
3421#endif
3422 .irq_retrigger = ioapic_retrigger_irq,
3423};
3424
3425static struct irq_chip hpet_msi_type = { 3420static struct irq_chip hpet_msi_type = {
3426 .name = "HPET_MSI", 3421 .name = "HPET_MSI",
3427 .irq_unmask = hpet_msi_unmask, 3422 .irq_unmask = hpet_msi_unmask,
@@ -3458,7 +3453,7 @@ int arch_setup_hpet_msi(unsigned int irq, unsigned int id)
3458 hpet_msi_write(irq_get_handler_data(irq), &msg); 3453 hpet_msi_write(irq_get_handler_data(irq), &msg);
3459 irq_set_status_flags(irq, IRQ_MOVE_PCNTXT); 3454 irq_set_status_flags(irq, IRQ_MOVE_PCNTXT);
3460 if (irq_remapped(irq_get_chip_data(irq))) 3455 if (irq_remapped(irq_get_chip_data(irq)))
3461 chip = &ir_hpet_msi_type; 3456 irq_remap_modify_chip_defaults(chip);
3462 3457
3463 irq_set_chip_and_handler_name(irq, chip, handle_edge_irq, "edge"); 3458 irq_set_chip_and_handler_name(irq, chip, handle_edge_irq, "edge");
3464 return 0; 3459 return 0;
@@ -3566,26 +3561,25 @@ io_apic_setup_irq_pin(unsigned int irq, int node, struct io_apic_irq_attr *attr)
3566 return -EINVAL; 3561 return -EINVAL;
3567 ret = __add_pin_to_irq_node(cfg, node, attr->ioapic, attr->ioapic_pin); 3562 ret = __add_pin_to_irq_node(cfg, node, attr->ioapic, attr->ioapic_pin);
3568 if (!ret) 3563 if (!ret)
3569 setup_ioapic_irq(attr->ioapic, attr->ioapic_pin, irq, cfg, 3564 setup_ioapic_irq(irq, cfg, attr);
3570 attr->trigger, attr->polarity);
3571 return ret; 3565 return ret;
3572} 3566}
3573 3567
3574int io_apic_setup_irq_pin_once(unsigned int irq, int node, 3568int io_apic_setup_irq_pin_once(unsigned int irq, int node,
3575 struct io_apic_irq_attr *attr) 3569 struct io_apic_irq_attr *attr)
3576{ 3570{
3577 unsigned int id = attr->ioapic, pin = attr->ioapic_pin; 3571 unsigned int ioapic_idx = attr->ioapic, pin = attr->ioapic_pin;
3578 int ret; 3572 int ret;
3579 3573
3580 /* Avoid redundant programming */ 3574 /* Avoid redundant programming */
3581 if (test_bit(pin, ioapics[id].pin_programmed)) { 3575 if (test_bit(pin, ioapics[ioapic_idx].pin_programmed)) {
3582 pr_debug("Pin %d-%d already programmed\n", 3576 pr_debug("Pin %d-%d already programmed\n",
3583 mpc_ioapic_id(id), pin); 3577 mpc_ioapic_id(ioapic_idx), pin);
3584 return 0; 3578 return 0;
3585 } 3579 }
3586 ret = io_apic_setup_irq_pin(irq, node, attr); 3580 ret = io_apic_setup_irq_pin(irq, node, attr);
3587 if (!ret) 3581 if (!ret)
3588 set_bit(pin, ioapics[id].pin_programmed); 3582 set_bit(pin, ioapics[ioapic_idx].pin_programmed);
3589 return ret; 3583 return ret;
3590} 3584}
3591 3585
@@ -3621,7 +3615,6 @@ int get_nr_irqs_gsi(void)
3621 return nr_irqs_gsi; 3615 return nr_irqs_gsi;
3622} 3616}
3623 3617
3624#ifdef CONFIG_SPARSE_IRQ
3625int __init arch_probe_nr_irqs(void) 3618int __init arch_probe_nr_irqs(void)
3626{ 3619{
3627 int nr; 3620 int nr;
@@ -3641,7 +3634,6 @@ int __init arch_probe_nr_irqs(void)
3641 3634
3642 return NR_IRQS_LEGACY; 3635 return NR_IRQS_LEGACY;
3643} 3636}
3644#endif
3645 3637
3646int io_apic_set_pci_routing(struct device *dev, int irq, 3638int io_apic_set_pci_routing(struct device *dev, int irq,
3647 struct io_apic_irq_attr *irq_attr) 3639 struct io_apic_irq_attr *irq_attr)
diff --git a/arch/x86/kernel/apic/probe_32.c b/arch/x86/kernel/apic/probe_32.c
index b5254ad044ab..0787bb3412f4 100644
--- a/arch/x86/kernel/apic/probe_32.c
+++ b/arch/x86/kernel/apic/probe_32.c
@@ -200,14 +200,8 @@ void __init default_setup_apic_routing(void)
200 * - we find more than 8 CPUs in acpi LAPIC listing with xAPIC support 200 * - we find more than 8 CPUs in acpi LAPIC listing with xAPIC support
201 */ 201 */
202 202
203 if (!cmdline_apic && apic == &apic_default) { 203 if (!cmdline_apic && apic == &apic_default)
204 struct apic *bigsmp = generic_bigsmp_probe(); 204 generic_bigsmp_probe();
205 if (bigsmp) {
206 apic = bigsmp;
207 printk(KERN_INFO "Overriding APIC driver with %s\n",
208 apic->name);
209 }
210 }
211#endif 205#endif
212 206
213 if (apic->setup_apic_routing) 207 if (apic->setup_apic_routing)
diff --git a/arch/x86/kernel/apic/x2apic_uv_x.c b/arch/x86/kernel/apic/x2apic_uv_x.c
index 34b18594e724..62ae3001ae02 100644
--- a/arch/x86/kernel/apic/x2apic_uv_x.c
+++ b/arch/x86/kernel/apic/x2apic_uv_x.c
@@ -672,18 +672,11 @@ void __cpuinit uv_cpu_init(void)
672/* 672/*
673 * When NMI is received, print a stack trace. 673 * When NMI is received, print a stack trace.
674 */ 674 */
675int uv_handle_nmi(struct notifier_block *self, unsigned long reason, void *data) 675int uv_handle_nmi(unsigned int reason, struct pt_regs *regs)
676{ 676{
677 unsigned long real_uv_nmi; 677 unsigned long real_uv_nmi;
678 int bid; 678 int bid;
679 679
680 if (reason != DIE_NMIUNKNOWN)
681 return NOTIFY_OK;
682
683 if (in_crash_kexec)
684 /* do nothing if entering the crash kernel */
685 return NOTIFY_OK;
686
687 /* 680 /*
688 * Each blade has an MMR that indicates when an NMI has been sent 681 * Each blade has an MMR that indicates when an NMI has been sent
689 * to cpus on the blade. If an NMI is detected, atomically 682 * to cpus on the blade. If an NMI is detected, atomically
@@ -704,7 +697,7 @@ int uv_handle_nmi(struct notifier_block *self, unsigned long reason, void *data)
704 } 697 }
705 698
706 if (likely(__get_cpu_var(cpu_last_nmi_count) == uv_blade_info[bid].nmi_count)) 699 if (likely(__get_cpu_var(cpu_last_nmi_count) == uv_blade_info[bid].nmi_count))
707 return NOTIFY_DONE; 700 return NMI_DONE;
708 701
709 __get_cpu_var(cpu_last_nmi_count) = uv_blade_info[bid].nmi_count; 702 __get_cpu_var(cpu_last_nmi_count) = uv_blade_info[bid].nmi_count;
710 703
@@ -717,17 +710,12 @@ int uv_handle_nmi(struct notifier_block *self, unsigned long reason, void *data)
717 dump_stack(); 710 dump_stack();
718 spin_unlock(&uv_nmi_lock); 711 spin_unlock(&uv_nmi_lock);
719 712
720 return NOTIFY_STOP; 713 return NMI_HANDLED;
721} 714}
722 715
723static struct notifier_block uv_dump_stack_nmi_nb = {
724 .notifier_call = uv_handle_nmi,
725 .priority = NMI_LOCAL_LOW_PRIOR - 1,
726};
727
728void uv_register_nmi_notifier(void) 716void uv_register_nmi_notifier(void)
729{ 717{
730 if (register_die_notifier(&uv_dump_stack_nmi_nb)) 718 if (register_nmi_handler(NMI_UNKNOWN, uv_handle_nmi, 0, "uv"))
731 printk(KERN_WARNING "UV NMI handler failed to register\n"); 719 printk(KERN_WARNING "UV NMI handler failed to register\n");
732} 720}
733 721
@@ -832,6 +820,10 @@ void __init uv_system_init(void)
832 uv_cpu_hub_info(cpu)->apic_pnode_shift = uvh_apicid.s.pnode_shift; 820 uv_cpu_hub_info(cpu)->apic_pnode_shift = uvh_apicid.s.pnode_shift;
833 uv_cpu_hub_info(cpu)->hub_revision = uv_hub_info->hub_revision; 821 uv_cpu_hub_info(cpu)->hub_revision = uv_hub_info->hub_revision;
834 822
823 uv_cpu_hub_info(cpu)->m_shift = 64 - m_val;
824 uv_cpu_hub_info(cpu)->n_lshift = is_uv2_1_hub() ?
825 (m_val == 40 ? 40 : 39) : m_val;
826
835 pnode = uv_apicid_to_pnode(apicid); 827 pnode = uv_apicid_to_pnode(apicid);
836 blade = boot_pnode_to_blade(pnode); 828 blade = boot_pnode_to_blade(pnode);
837 lcpu = uv_blade_info[blade].nr_possible_cpus; 829 lcpu = uv_blade_info[blade].nr_possible_cpus;
@@ -862,8 +854,7 @@ void __init uv_system_init(void)
862 if (uv_node_to_blade[nid] >= 0) 854 if (uv_node_to_blade[nid] >= 0)
863 continue; 855 continue;
864 paddr = node_start_pfn(nid) << PAGE_SHIFT; 856 paddr = node_start_pfn(nid) << PAGE_SHIFT;
865 paddr = uv_soc_phys_ram_to_gpa(paddr); 857 pnode = uv_gpa_to_pnode(uv_soc_phys_ram_to_gpa(paddr));
866 pnode = (paddr >> m_val) & pnode_mask;
867 blade = boot_pnode_to_blade(pnode); 858 blade = boot_pnode_to_blade(pnode);
868 uv_node_to_blade[nid] = blade; 859 uv_node_to_blade[nid] = blade;
869 } 860 }
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index 0371c484bb8a..a46bd383953c 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -249,8 +249,6 @@ extern int (*console_blank_hook)(int);
249#define APM_MINOR_DEV 134 249#define APM_MINOR_DEV 134
250 250
251/* 251/*
252 * See Documentation/Config.help for the configuration options.
253 *
254 * Various options can be changed at boot time as follows: 252 * Various options can be changed at boot time as follows:
255 * (We allow underscores for compatibility with the modules code) 253 * (We allow underscores for compatibility with the modules code)
256 * apm=on/off enable/disable APM 254 * apm=on/off enable/disable APM
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
index 6042981d0309..25f24dccdcfa 100644
--- a/arch/x86/kernel/cpu/Makefile
+++ b/arch/x86/kernel/cpu/Makefile
@@ -15,6 +15,7 @@ CFLAGS_common.o := $(nostackp)
15obj-y := intel_cacheinfo.o scattered.o topology.o 15obj-y := intel_cacheinfo.o scattered.o topology.o
16obj-y += proc.o capflags.o powerflags.o common.o 16obj-y += proc.o capflags.o powerflags.o common.o
17obj-y += vmware.o hypervisor.o sched.o mshyperv.o 17obj-y += vmware.o hypervisor.o sched.o mshyperv.o
18obj-y += rdrand.o
18 19
19obj-$(CONFIG_X86_32) += bugs.o 20obj-$(CONFIG_X86_32) += bugs.o
20obj-$(CONFIG_X86_64) += bugs_64.o 21obj-$(CONFIG_X86_64) += bugs_64.o
@@ -28,10 +29,15 @@ obj-$(CONFIG_CPU_SUP_UMC_32) += umc.o
28 29
29obj-$(CONFIG_PERF_EVENTS) += perf_event.o 30obj-$(CONFIG_PERF_EVENTS) += perf_event.o
30 31
32ifdef CONFIG_PERF_EVENTS
33obj-$(CONFIG_CPU_SUP_AMD) += perf_event_amd.o
34obj-$(CONFIG_CPU_SUP_INTEL) += perf_event_p6.o perf_event_p4.o perf_event_intel_lbr.o perf_event_intel_ds.o perf_event_intel.o
35endif
36
31obj-$(CONFIG_X86_MCE) += mcheck/ 37obj-$(CONFIG_X86_MCE) += mcheck/
32obj-$(CONFIG_MTRR) += mtrr/ 38obj-$(CONFIG_MTRR) += mtrr/
33 39
34obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o 40obj-$(CONFIG_X86_LOCAL_APIC) += perfctr-watchdog.o perf_event_amd_ibs.o
35 41
36quiet_cmd_mkcapflags = MKCAP $@ 42quiet_cmd_mkcapflags = MKCAP $@
37 cmd_mkcapflags = $(PERL) $(srctree)/$(src)/mkcapflags.pl $< $@ 43 cmd_mkcapflags = $(PERL) $(srctree)/$(src)/mkcapflags.pl $< $@
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index b13ed393dfce..46ae4f65fc7f 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -1,5 +1,6 @@
1#include <linux/init.h> 1#include <linux/init.h>
2#include <linux/bitops.h> 2#include <linux/bitops.h>
3#include <linux/elf.h>
3#include <linux/mm.h> 4#include <linux/mm.h>
4 5
5#include <linux/io.h> 6#include <linux/io.h>
@@ -410,8 +411,38 @@ static void __cpuinit early_init_amd_mc(struct cpuinfo_x86 *c)
410#endif 411#endif
411} 412}
412 413
414static void __cpuinit bsp_init_amd(struct cpuinfo_x86 *c)
415{
416 if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) {
417
418 if (c->x86 > 0x10 ||
419 (c->x86 == 0x10 && c->x86_model >= 0x2)) {
420 u64 val;
421
422 rdmsrl(MSR_K7_HWCR, val);
423 if (!(val & BIT(24)))
424 printk(KERN_WARNING FW_BUG "TSC doesn't count "
425 "with P0 frequency!\n");
426 }
427 }
428
429 if (c->x86 == 0x15) {
430 unsigned long upperbit;
431 u32 cpuid, assoc;
432
433 cpuid = cpuid_edx(0x80000005);
434 assoc = cpuid >> 16 & 0xff;
435 upperbit = ((cpuid >> 24) << 10) / assoc;
436
437 va_align.mask = (upperbit - 1) & PAGE_MASK;
438 va_align.flags = ALIGN_VA_32 | ALIGN_VA_64;
439 }
440}
441
413static void __cpuinit early_init_amd(struct cpuinfo_x86 *c) 442static void __cpuinit early_init_amd(struct cpuinfo_x86 *c)
414{ 443{
444 u32 dummy;
445
415 early_init_amd_mc(c); 446 early_init_amd_mc(c);
416 447
417 /* 448 /*
@@ -442,22 +473,7 @@ static void __cpuinit early_init_amd(struct cpuinfo_x86 *c)
442 } 473 }
443#endif 474#endif
444 475
445 /* We need to do the following only once */ 476 rdmsr_safe(MSR_AMD64_PATCH_LEVEL, &c->microcode, &dummy);
446 if (c != &boot_cpu_data)
447 return;
448
449 if (cpu_has(c, X86_FEATURE_CONSTANT_TSC)) {
450
451 if (c->x86 > 0x10 ||
452 (c->x86 == 0x10 && c->x86_model >= 0x2)) {
453 u64 val;
454
455 rdmsrl(MSR_K7_HWCR, val);
456 if (!(val & BIT(24)))
457 printk(KERN_WARNING FW_BUG "TSC doesn't count "
458 "with P0 frequency!\n");
459 }
460 }
461} 477}
462 478
463static void __cpuinit init_amd(struct cpuinfo_x86 *c) 479static void __cpuinit init_amd(struct cpuinfo_x86 *c)
@@ -679,6 +695,7 @@ static const struct cpu_dev __cpuinitconst amd_cpu_dev = {
679 .c_size_cache = amd_size_cache, 695 .c_size_cache = amd_size_cache,
680#endif 696#endif
681 .c_early_init = early_init_amd, 697 .c_early_init = early_init_amd,
698 .c_bsp_init = bsp_init_amd,
682 .c_init = init_amd, 699 .c_init = init_amd,
683 .c_x86_vendor = X86_VENDOR_AMD, 700 .c_x86_vendor = X86_VENDOR_AMD,
684}; 701};
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 62184390a601..aa003b13a831 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -15,6 +15,7 @@
15#include <asm/stackprotector.h> 15#include <asm/stackprotector.h>
16#include <asm/perf_event.h> 16#include <asm/perf_event.h>
17#include <asm/mmu_context.h> 17#include <asm/mmu_context.h>
18#include <asm/archrandom.h>
18#include <asm/hypervisor.h> 19#include <asm/hypervisor.h>
19#include <asm/processor.h> 20#include <asm/processor.h>
20#include <asm/sections.h> 21#include <asm/sections.h>
@@ -681,6 +682,9 @@ static void __init early_identify_cpu(struct cpuinfo_x86 *c)
681 filter_cpuid_features(c, false); 682 filter_cpuid_features(c, false);
682 683
683 setup_smep(c); 684 setup_smep(c);
685
686 if (this_cpu->c_bsp_init)
687 this_cpu->c_bsp_init(c);
684} 688}
685 689
686void __init early_cpu_init(void) 690void __init early_cpu_init(void)
@@ -857,6 +861,7 @@ static void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
857#endif 861#endif
858 862
859 init_hypervisor(c); 863 init_hypervisor(c);
864 x86_init_rdrand(c);
860 865
861 /* 866 /*
862 * Clear/Set all flags overriden by options, need do it 867 * Clear/Set all flags overriden by options, need do it
diff --git a/arch/x86/kernel/cpu/cpu.h b/arch/x86/kernel/cpu/cpu.h
index e765633f210e..1b22dcc51af4 100644
--- a/arch/x86/kernel/cpu/cpu.h
+++ b/arch/x86/kernel/cpu/cpu.h
@@ -18,6 +18,7 @@ struct cpu_dev {
18 struct cpu_model_info c_models[4]; 18 struct cpu_model_info c_models[4];
19 19
20 void (*c_early_init)(struct cpuinfo_x86 *); 20 void (*c_early_init)(struct cpuinfo_x86 *);
21 void (*c_bsp_init)(struct cpuinfo_x86 *);
21 void (*c_init)(struct cpuinfo_x86 *); 22 void (*c_init)(struct cpuinfo_x86 *);
22 void (*c_identify)(struct cpuinfo_x86 *); 23 void (*c_identify)(struct cpuinfo_x86 *);
23 unsigned int (*c_size_cache)(struct cpuinfo_x86 *, unsigned int); 24 unsigned int (*c_size_cache)(struct cpuinfo_x86 *, unsigned int);
diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
index ed6086eedf1d..523131213f08 100644
--- a/arch/x86/kernel/cpu/intel.c
+++ b/arch/x86/kernel/cpu/intel.c
@@ -47,6 +47,15 @@ static void __cpuinit early_init_intel(struct cpuinfo_x86 *c)
47 (c->x86 == 0x6 && c->x86_model >= 0x0e)) 47 (c->x86 == 0x6 && c->x86_model >= 0x0e))
48 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC); 48 set_cpu_cap(c, X86_FEATURE_CONSTANT_TSC);
49 49
50 if (c->x86 >= 6 && !cpu_has(c, X86_FEATURE_IA64)) {
51 unsigned lower_word;
52
53 wrmsr(MSR_IA32_UCODE_REV, 0, 0);
54 /* Required by the SDM */
55 sync_core();
56 rdmsr(MSR_IA32_UCODE_REV, lower_word, c->microcode);
57 }
58
50 /* 59 /*
51 * Atom erratum AAE44/AAF40/AAG38/AAH41: 60 * Atom erratum AAE44/AAF40/AAG38/AAH41:
52 * 61 *
@@ -55,17 +64,10 @@ static void __cpuinit early_init_intel(struct cpuinfo_x86 *c)
55 * need the microcode to have already been loaded... so if it is 64 * need the microcode to have already been loaded... so if it is
56 * not, recommend a BIOS update and disable large pages. 65 * not, recommend a BIOS update and disable large pages.
57 */ 66 */
58 if (c->x86 == 6 && c->x86_model == 0x1c && c->x86_mask <= 2) { 67 if (c->x86 == 6 && c->x86_model == 0x1c && c->x86_mask <= 2 &&
59 u32 ucode, junk; 68 c->microcode < 0x20e) {
60 69 printk(KERN_WARNING "Atom PSE erratum detected, BIOS microcode update recommended\n");
61 wrmsr(MSR_IA32_UCODE_REV, 0, 0); 70 clear_cpu_cap(c, X86_FEATURE_PSE);
62 sync_core();
63 rdmsr(MSR_IA32_UCODE_REV, junk, ucode);
64
65 if (ucode < 0x20e) {
66 printk(KERN_WARNING "Atom PSE erratum detected, BIOS microcode update recommended\n");
67 clear_cpu_cap(c, X86_FEATURE_PSE);
68 }
69 } 71 }
70 72
71#ifdef CONFIG_X86_64 73#ifdef CONFIG_X86_64
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index c105c533ed94..a3b0811693c9 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -151,28 +151,17 @@ union _cpuid4_leaf_ecx {
151 u32 full; 151 u32 full;
152}; 152};
153 153
154struct amd_l3_cache { 154struct _cpuid4_info_regs {
155 struct amd_northbridge *nb;
156 unsigned indices;
157 u8 subcaches[4];
158};
159
160struct _cpuid4_info {
161 union _cpuid4_leaf_eax eax; 155 union _cpuid4_leaf_eax eax;
162 union _cpuid4_leaf_ebx ebx; 156 union _cpuid4_leaf_ebx ebx;
163 union _cpuid4_leaf_ecx ecx; 157 union _cpuid4_leaf_ecx ecx;
164 unsigned long size; 158 unsigned long size;
165 struct amd_l3_cache *l3; 159 struct amd_northbridge *nb;
166 DECLARE_BITMAP(shared_cpu_map, NR_CPUS);
167}; 160};
168 161
169/* subset of above _cpuid4_info w/o shared_cpu_map */ 162struct _cpuid4_info {
170struct _cpuid4_info_regs { 163 struct _cpuid4_info_regs base;
171 union _cpuid4_leaf_eax eax; 164 DECLARE_BITMAP(shared_cpu_map, NR_CPUS);
172 union _cpuid4_leaf_ebx ebx;
173 union _cpuid4_leaf_ecx ecx;
174 unsigned long size;
175 struct amd_l3_cache *l3;
176}; 165};
177 166
178unsigned short num_cache_leaves; 167unsigned short num_cache_leaves;
@@ -314,16 +303,23 @@ struct _cache_attr {
314/* 303/*
315 * L3 cache descriptors 304 * L3 cache descriptors
316 */ 305 */
317static void __cpuinit amd_calc_l3_indices(struct amd_l3_cache *l3) 306static void __cpuinit amd_calc_l3_indices(struct amd_northbridge *nb)
318{ 307{
308 struct amd_l3_cache *l3 = &nb->l3_cache;
319 unsigned int sc0, sc1, sc2, sc3; 309 unsigned int sc0, sc1, sc2, sc3;
320 u32 val = 0; 310 u32 val = 0;
321 311
322 pci_read_config_dword(l3->nb->misc, 0x1C4, &val); 312 pci_read_config_dword(nb->misc, 0x1C4, &val);
323 313
324 /* calculate subcache sizes */ 314 /* calculate subcache sizes */
325 l3->subcaches[0] = sc0 = !(val & BIT(0)); 315 l3->subcaches[0] = sc0 = !(val & BIT(0));
326 l3->subcaches[1] = sc1 = !(val & BIT(4)); 316 l3->subcaches[1] = sc1 = !(val & BIT(4));
317
318 if (boot_cpu_data.x86 == 0x15) {
319 l3->subcaches[0] = sc0 += !(val & BIT(1));
320 l3->subcaches[1] = sc1 += !(val & BIT(5));
321 }
322
327 l3->subcaches[2] = sc2 = !(val & BIT(8)) + !(val & BIT(9)); 323 l3->subcaches[2] = sc2 = !(val & BIT(8)) + !(val & BIT(9));
328 l3->subcaches[3] = sc3 = !(val & BIT(12)) + !(val & BIT(13)); 324 l3->subcaches[3] = sc3 = !(val & BIT(12)) + !(val & BIT(13));
329 325
@@ -333,33 +329,16 @@ static void __cpuinit amd_calc_l3_indices(struct amd_l3_cache *l3)
333static void __cpuinit amd_init_l3_cache(struct _cpuid4_info_regs *this_leaf, 329static void __cpuinit amd_init_l3_cache(struct _cpuid4_info_regs *this_leaf,
334 int index) 330 int index)
335{ 331{
336 static struct amd_l3_cache *__cpuinitdata l3_caches;
337 int node; 332 int node;
338 333
339 /* only for L3, and not in virtualized environments */ 334 /* only for L3, and not in virtualized environments */
340 if (index < 3 || amd_nb_num() == 0) 335 if (index < 3)
341 return; 336 return;
342 337
343 /*
344 * Strictly speaking, the amount in @size below is leaked since it is
345 * never freed but this is done only on shutdown so it doesn't matter.
346 */
347 if (!l3_caches) {
348 int size = amd_nb_num() * sizeof(struct amd_l3_cache);
349
350 l3_caches = kzalloc(size, GFP_ATOMIC);
351 if (!l3_caches)
352 return;
353 }
354
355 node = amd_get_nb_id(smp_processor_id()); 338 node = amd_get_nb_id(smp_processor_id());
356 339 this_leaf->nb = node_to_amd_nb(node);
357 if (!l3_caches[node].nb) { 340 if (this_leaf->nb && !this_leaf->nb->l3_cache.indices)
358 l3_caches[node].nb = node_to_amd_nb(node); 341 amd_calc_l3_indices(this_leaf->nb);
359 amd_calc_l3_indices(&l3_caches[node]);
360 }
361
362 this_leaf->l3 = &l3_caches[node];
363} 342}
364 343
365/* 344/*
@@ -369,11 +348,11 @@ static void __cpuinit amd_init_l3_cache(struct _cpuid4_info_regs *this_leaf,
369 * 348 *
370 * @returns: the disabled index if used or negative value if slot free. 349 * @returns: the disabled index if used or negative value if slot free.
371 */ 350 */
372int amd_get_l3_disable_slot(struct amd_l3_cache *l3, unsigned slot) 351int amd_get_l3_disable_slot(struct amd_northbridge *nb, unsigned slot)
373{ 352{
374 unsigned int reg = 0; 353 unsigned int reg = 0;
375 354
376 pci_read_config_dword(l3->nb->misc, 0x1BC + slot * 4, &reg); 355 pci_read_config_dword(nb->misc, 0x1BC + slot * 4, &reg);
377 356
378 /* check whether this slot is activated already */ 357 /* check whether this slot is activated already */
379 if (reg & (3UL << 30)) 358 if (reg & (3UL << 30))
@@ -387,11 +366,10 @@ static ssize_t show_cache_disable(struct _cpuid4_info *this_leaf, char *buf,
387{ 366{
388 int index; 367 int index;
389 368
390 if (!this_leaf->l3 || 369 if (!this_leaf->base.nb || !amd_nb_has_feature(AMD_NB_L3_INDEX_DISABLE))
391 !amd_nb_has_feature(AMD_NB_L3_INDEX_DISABLE))
392 return -EINVAL; 370 return -EINVAL;
393 371
394 index = amd_get_l3_disable_slot(this_leaf->l3, slot); 372 index = amd_get_l3_disable_slot(this_leaf->base.nb, slot);
395 if (index >= 0) 373 if (index >= 0)
396 return sprintf(buf, "%d\n", index); 374 return sprintf(buf, "%d\n", index);
397 375
@@ -408,7 +386,7 @@ show_cache_disable_##slot(struct _cpuid4_info *this_leaf, char *buf, \
408SHOW_CACHE_DISABLE(0) 386SHOW_CACHE_DISABLE(0)
409SHOW_CACHE_DISABLE(1) 387SHOW_CACHE_DISABLE(1)
410 388
411static void amd_l3_disable_index(struct amd_l3_cache *l3, int cpu, 389static void amd_l3_disable_index(struct amd_northbridge *nb, int cpu,
412 unsigned slot, unsigned long idx) 390 unsigned slot, unsigned long idx)
413{ 391{
414 int i; 392 int i;
@@ -421,10 +399,10 @@ static void amd_l3_disable_index(struct amd_l3_cache *l3, int cpu,
421 for (i = 0; i < 4; i++) { 399 for (i = 0; i < 4; i++) {
422 u32 reg = idx | (i << 20); 400 u32 reg = idx | (i << 20);
423 401
424 if (!l3->subcaches[i]) 402 if (!nb->l3_cache.subcaches[i])
425 continue; 403 continue;
426 404
427 pci_write_config_dword(l3->nb->misc, 0x1BC + slot * 4, reg); 405 pci_write_config_dword(nb->misc, 0x1BC + slot * 4, reg);
428 406
429 /* 407 /*
430 * We need to WBINVD on a core on the node containing the L3 408 * We need to WBINVD on a core on the node containing the L3
@@ -434,7 +412,7 @@ static void amd_l3_disable_index(struct amd_l3_cache *l3, int cpu,
434 wbinvd_on_cpu(cpu); 412 wbinvd_on_cpu(cpu);
435 413
436 reg |= BIT(31); 414 reg |= BIT(31);
437 pci_write_config_dword(l3->nb->misc, 0x1BC + slot * 4, reg); 415 pci_write_config_dword(nb->misc, 0x1BC + slot * 4, reg);
438 } 416 }
439} 417}
440 418
@@ -448,24 +426,24 @@ static void amd_l3_disable_index(struct amd_l3_cache *l3, int cpu,
448 * 426 *
449 * @return: 0 on success, error status on failure 427 * @return: 0 on success, error status on failure
450 */ 428 */
451int amd_set_l3_disable_slot(struct amd_l3_cache *l3, int cpu, unsigned slot, 429int amd_set_l3_disable_slot(struct amd_northbridge *nb, int cpu, unsigned slot,
452 unsigned long index) 430 unsigned long index)
453{ 431{
454 int ret = 0; 432 int ret = 0;
455 433
456 /* check if @slot is already used or the index is already disabled */ 434 /* check if @slot is already used or the index is already disabled */
457 ret = amd_get_l3_disable_slot(l3, slot); 435 ret = amd_get_l3_disable_slot(nb, slot);
458 if (ret >= 0) 436 if (ret >= 0)
459 return -EINVAL; 437 return -EINVAL;
460 438
461 if (index > l3->indices) 439 if (index > nb->l3_cache.indices)
462 return -EINVAL; 440 return -EINVAL;
463 441
464 /* check whether the other slot has disabled the same index already */ 442 /* check whether the other slot has disabled the same index already */
465 if (index == amd_get_l3_disable_slot(l3, !slot)) 443 if (index == amd_get_l3_disable_slot(nb, !slot))
466 return -EINVAL; 444 return -EINVAL;
467 445
468 amd_l3_disable_index(l3, cpu, slot, index); 446 amd_l3_disable_index(nb, cpu, slot, index);
469 447
470 return 0; 448 return 0;
471} 449}
@@ -480,8 +458,7 @@ static ssize_t store_cache_disable(struct _cpuid4_info *this_leaf,
480 if (!capable(CAP_SYS_ADMIN)) 458 if (!capable(CAP_SYS_ADMIN))
481 return -EPERM; 459 return -EPERM;
482 460
483 if (!this_leaf->l3 || 461 if (!this_leaf->base.nb || !amd_nb_has_feature(AMD_NB_L3_INDEX_DISABLE))
484 !amd_nb_has_feature(AMD_NB_L3_INDEX_DISABLE))
485 return -EINVAL; 462 return -EINVAL;
486 463
487 cpu = cpumask_first(to_cpumask(this_leaf->shared_cpu_map)); 464 cpu = cpumask_first(to_cpumask(this_leaf->shared_cpu_map));
@@ -489,7 +466,7 @@ static ssize_t store_cache_disable(struct _cpuid4_info *this_leaf,
489 if (strict_strtoul(buf, 10, &val) < 0) 466 if (strict_strtoul(buf, 10, &val) < 0)
490 return -EINVAL; 467 return -EINVAL;
491 468
492 err = amd_set_l3_disable_slot(this_leaf->l3, cpu, slot, val); 469 err = amd_set_l3_disable_slot(this_leaf->base.nb, cpu, slot, val);
493 if (err) { 470 if (err) {
494 if (err == -EEXIST) 471 if (err == -EEXIST)
495 printk(KERN_WARNING "L3 disable slot %d in use!\n", 472 printk(KERN_WARNING "L3 disable slot %d in use!\n",
@@ -518,7 +495,7 @@ static struct _cache_attr cache_disable_1 = __ATTR(cache_disable_1, 0644,
518static ssize_t 495static ssize_t
519show_subcaches(struct _cpuid4_info *this_leaf, char *buf, unsigned int cpu) 496show_subcaches(struct _cpuid4_info *this_leaf, char *buf, unsigned int cpu)
520{ 497{
521 if (!this_leaf->l3 || !amd_nb_has_feature(AMD_NB_L3_PARTITIONING)) 498 if (!this_leaf->base.nb || !amd_nb_has_feature(AMD_NB_L3_PARTITIONING))
522 return -EINVAL; 499 return -EINVAL;
523 500
524 return sprintf(buf, "%x\n", amd_get_subcaches(cpu)); 501 return sprintf(buf, "%x\n", amd_get_subcaches(cpu));
@@ -533,7 +510,7 @@ store_subcaches(struct _cpuid4_info *this_leaf, const char *buf, size_t count,
533 if (!capable(CAP_SYS_ADMIN)) 510 if (!capable(CAP_SYS_ADMIN))
534 return -EPERM; 511 return -EPERM;
535 512
536 if (!this_leaf->l3 || !amd_nb_has_feature(AMD_NB_L3_PARTITIONING)) 513 if (!this_leaf->base.nb || !amd_nb_has_feature(AMD_NB_L3_PARTITIONING))
537 return -EINVAL; 514 return -EINVAL;
538 515
539 if (strict_strtoul(buf, 16, &val) < 0) 516 if (strict_strtoul(buf, 16, &val) < 0)
@@ -769,7 +746,7 @@ static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu, int index)
769 return; 746 return;
770 } 747 }
771 this_leaf = CPUID4_INFO_IDX(cpu, index); 748 this_leaf = CPUID4_INFO_IDX(cpu, index);
772 num_threads_sharing = 1 + this_leaf->eax.split.num_threads_sharing; 749 num_threads_sharing = 1 + this_leaf->base.eax.split.num_threads_sharing;
773 750
774 if (num_threads_sharing == 1) 751 if (num_threads_sharing == 1)
775 cpumask_set_cpu(cpu, to_cpumask(this_leaf->shared_cpu_map)); 752 cpumask_set_cpu(cpu, to_cpumask(this_leaf->shared_cpu_map));
@@ -820,29 +797,19 @@ static void __cpuinit free_cache_attributes(unsigned int cpu)
820 for (i = 0; i < num_cache_leaves; i++) 797 for (i = 0; i < num_cache_leaves; i++)
821 cache_remove_shared_cpu_map(cpu, i); 798 cache_remove_shared_cpu_map(cpu, i);
822 799
823 kfree(per_cpu(ici_cpuid4_info, cpu)->l3);
824 kfree(per_cpu(ici_cpuid4_info, cpu)); 800 kfree(per_cpu(ici_cpuid4_info, cpu));
825 per_cpu(ici_cpuid4_info, cpu) = NULL; 801 per_cpu(ici_cpuid4_info, cpu) = NULL;
826} 802}
827 803
828static int
829__cpuinit cpuid4_cache_lookup(int index, struct _cpuid4_info *this_leaf)
830{
831 struct _cpuid4_info_regs *leaf_regs =
832 (struct _cpuid4_info_regs *)this_leaf;
833
834 return cpuid4_cache_lookup_regs(index, leaf_regs);
835}
836
837static void __cpuinit get_cpu_leaves(void *_retval) 804static void __cpuinit get_cpu_leaves(void *_retval)
838{ 805{
839 int j, *retval = _retval, cpu = smp_processor_id(); 806 int j, *retval = _retval, cpu = smp_processor_id();
840 807
841 /* Do cpuid and store the results */ 808 /* Do cpuid and store the results */
842 for (j = 0; j < num_cache_leaves; j++) { 809 for (j = 0; j < num_cache_leaves; j++) {
843 struct _cpuid4_info *this_leaf; 810 struct _cpuid4_info *this_leaf = CPUID4_INFO_IDX(cpu, j);
844 this_leaf = CPUID4_INFO_IDX(cpu, j); 811
845 *retval = cpuid4_cache_lookup(j, this_leaf); 812 *retval = cpuid4_cache_lookup_regs(j, &this_leaf->base);
846 if (unlikely(*retval < 0)) { 813 if (unlikely(*retval < 0)) {
847 int i; 814 int i;
848 815
@@ -900,16 +867,16 @@ static ssize_t show_##file_name(struct _cpuid4_info *this_leaf, char *buf, \
900 return sprintf(buf, "%lu\n", (unsigned long)this_leaf->object + val); \ 867 return sprintf(buf, "%lu\n", (unsigned long)this_leaf->object + val); \
901} 868}
902 869
903show_one_plus(level, eax.split.level, 0); 870show_one_plus(level, base.eax.split.level, 0);
904show_one_plus(coherency_line_size, ebx.split.coherency_line_size, 1); 871show_one_plus(coherency_line_size, base.ebx.split.coherency_line_size, 1);
905show_one_plus(physical_line_partition, ebx.split.physical_line_partition, 1); 872show_one_plus(physical_line_partition, base.ebx.split.physical_line_partition, 1);
906show_one_plus(ways_of_associativity, ebx.split.ways_of_associativity, 1); 873show_one_plus(ways_of_associativity, base.ebx.split.ways_of_associativity, 1);
907show_one_plus(number_of_sets, ecx.split.number_of_sets, 1); 874show_one_plus(number_of_sets, base.ecx.split.number_of_sets, 1);
908 875
909static ssize_t show_size(struct _cpuid4_info *this_leaf, char *buf, 876static ssize_t show_size(struct _cpuid4_info *this_leaf, char *buf,
910 unsigned int cpu) 877 unsigned int cpu)
911{ 878{
912 return sprintf(buf, "%luK\n", this_leaf->size / 1024); 879 return sprintf(buf, "%luK\n", this_leaf->base.size / 1024);
913} 880}
914 881
915static ssize_t show_shared_cpu_map_func(struct _cpuid4_info *this_leaf, 882static ssize_t show_shared_cpu_map_func(struct _cpuid4_info *this_leaf,
@@ -946,7 +913,7 @@ static inline ssize_t show_shared_cpu_list(struct _cpuid4_info *leaf, char *buf,
946static ssize_t show_type(struct _cpuid4_info *this_leaf, char *buf, 913static ssize_t show_type(struct _cpuid4_info *this_leaf, char *buf,
947 unsigned int cpu) 914 unsigned int cpu)
948{ 915{
949 switch (this_leaf->eax.split.type) { 916 switch (this_leaf->base.eax.split.type) {
950 case CACHE_TYPE_DATA: 917 case CACHE_TYPE_DATA:
951 return sprintf(buf, "Data\n"); 918 return sprintf(buf, "Data\n");
952 case CACHE_TYPE_INST: 919 case CACHE_TYPE_INST:
@@ -1135,7 +1102,7 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
1135 1102
1136 ktype_cache.default_attrs = default_attrs; 1103 ktype_cache.default_attrs = default_attrs;
1137#ifdef CONFIG_AMD_NB 1104#ifdef CONFIG_AMD_NB
1138 if (this_leaf->l3) 1105 if (this_leaf->base.nb)
1139 ktype_cache.default_attrs = amd_l3_attrs(); 1106 ktype_cache.default_attrs = amd_l3_attrs();
1140#endif 1107#endif
1141 retval = kobject_init_and_add(&(this_object->kobj), 1108 retval = kobject_init_and_add(&(this_object->kobj),
diff --git a/arch/x86/kernel/cpu/mcheck/mce-inject.c b/arch/x86/kernel/cpu/mcheck/mce-inject.c
index 0ed633c5048b..6199232161cf 100644
--- a/arch/x86/kernel/cpu/mcheck/mce-inject.c
+++ b/arch/x86/kernel/cpu/mcheck/mce-inject.c
@@ -78,27 +78,20 @@ static void raise_exception(struct mce *m, struct pt_regs *pregs)
78 78
79static cpumask_var_t mce_inject_cpumask; 79static cpumask_var_t mce_inject_cpumask;
80 80
81static int mce_raise_notify(struct notifier_block *self, 81static int mce_raise_notify(unsigned int cmd, struct pt_regs *regs)
82 unsigned long val, void *data)
83{ 82{
84 struct die_args *args = (struct die_args *)data;
85 int cpu = smp_processor_id(); 83 int cpu = smp_processor_id();
86 struct mce *m = &__get_cpu_var(injectm); 84 struct mce *m = &__get_cpu_var(injectm);
87 if (val != DIE_NMI || !cpumask_test_cpu(cpu, mce_inject_cpumask)) 85 if (!cpumask_test_cpu(cpu, mce_inject_cpumask))
88 return NOTIFY_DONE; 86 return NMI_DONE;
89 cpumask_clear_cpu(cpu, mce_inject_cpumask); 87 cpumask_clear_cpu(cpu, mce_inject_cpumask);
90 if (m->inject_flags & MCJ_EXCEPTION) 88 if (m->inject_flags & MCJ_EXCEPTION)
91 raise_exception(m, args->regs); 89 raise_exception(m, regs);
92 else if (m->status) 90 else if (m->status)
93 raise_poll(m); 91 raise_poll(m);
94 return NOTIFY_STOP; 92 return NMI_HANDLED;
95} 93}
96 94
97static struct notifier_block mce_raise_nb = {
98 .notifier_call = mce_raise_notify,
99 .priority = NMI_LOCAL_NORMAL_PRIOR,
100};
101
102/* Inject mce on current CPU */ 95/* Inject mce on current CPU */
103static int raise_local(void) 96static int raise_local(void)
104{ 97{
@@ -216,7 +209,8 @@ static int inject_init(void)
216 return -ENOMEM; 209 return -ENOMEM;
217 printk(KERN_INFO "Machine check injector initialized\n"); 210 printk(KERN_INFO "Machine check injector initialized\n");
218 mce_chrdev_ops.write = mce_write; 211 mce_chrdev_ops.write = mce_write;
219 register_die_notifier(&mce_raise_nb); 212 register_nmi_handler(NMI_LOCAL, mce_raise_notify, 0,
213 "mce_notify");
220 return 0; 214 return 0;
221} 215}
222 216
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 08363b042122..7b5063a6ad42 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -217,8 +217,13 @@ static void print_mce(struct mce *m)
217 pr_cont("MISC %llx ", m->misc); 217 pr_cont("MISC %llx ", m->misc);
218 218
219 pr_cont("\n"); 219 pr_cont("\n");
220 pr_emerg(HW_ERR "PROCESSOR %u:%x TIME %llu SOCKET %u APIC %x\n", 220 /*
221 m->cpuvendor, m->cpuid, m->time, m->socketid, m->apicid); 221 * Note this output is parsed by external tools and old fields
222 * should not be changed.
223 */
224 pr_emerg(HW_ERR "PROCESSOR %u:%x TIME %llu SOCKET %u APIC %x microcode %x\n",
225 m->cpuvendor, m->cpuid, m->time, m->socketid, m->apicid,
226 cpu_data(m->extcpu).microcode);
222 227
223 /* 228 /*
224 * Print out human-readable details about the MCE error, 229 * Print out human-readable details about the MCE error,
@@ -908,9 +913,6 @@ void do_machine_check(struct pt_regs *regs, long error_code)
908 913
909 percpu_inc(mce_exception_count); 914 percpu_inc(mce_exception_count);
910 915
911 if (notify_die(DIE_NMI, "machine check", regs, error_code,
912 18, SIGKILL) == NOTIFY_STOP)
913 goto out;
914 if (!banks) 916 if (!banks)
915 goto out; 917 goto out;
916 918
@@ -1140,6 +1142,15 @@ static void mce_start_timer(unsigned long data)
1140 add_timer_on(t, smp_processor_id()); 1142 add_timer_on(t, smp_processor_id());
1141} 1143}
1142 1144
1145/* Must not be called in IRQ context where del_timer_sync() can deadlock */
1146static void mce_timer_delete_all(void)
1147{
1148 int cpu;
1149
1150 for_each_online_cpu(cpu)
1151 del_timer_sync(&per_cpu(mce_timer, cpu));
1152}
1153
1143static void mce_do_trigger(struct work_struct *work) 1154static void mce_do_trigger(struct work_struct *work)
1144{ 1155{
1145 call_usermodehelper(mce_helper, mce_helper_argv, NULL, UMH_NO_WAIT); 1156 call_usermodehelper(mce_helper, mce_helper_argv, NULL, UMH_NO_WAIT);
@@ -1750,7 +1761,6 @@ static struct syscore_ops mce_syscore_ops = {
1750 1761
1751static void mce_cpu_restart(void *data) 1762static void mce_cpu_restart(void *data)
1752{ 1763{
1753 del_timer_sync(&__get_cpu_var(mce_timer));
1754 if (!mce_available(__this_cpu_ptr(&cpu_info))) 1764 if (!mce_available(__this_cpu_ptr(&cpu_info)))
1755 return; 1765 return;
1756 __mcheck_cpu_init_generic(); 1766 __mcheck_cpu_init_generic();
@@ -1760,16 +1770,15 @@ static void mce_cpu_restart(void *data)
1760/* Reinit MCEs after user configuration changes */ 1770/* Reinit MCEs after user configuration changes */
1761static void mce_restart(void) 1771static void mce_restart(void)
1762{ 1772{
1773 mce_timer_delete_all();
1763 on_each_cpu(mce_cpu_restart, NULL, 1); 1774 on_each_cpu(mce_cpu_restart, NULL, 1);
1764} 1775}
1765 1776
1766/* Toggle features for corrected errors */ 1777/* Toggle features for corrected errors */
1767static void mce_disable_ce(void *all) 1778static void mce_disable_cmci(void *data)
1768{ 1779{
1769 if (!mce_available(__this_cpu_ptr(&cpu_info))) 1780 if (!mce_available(__this_cpu_ptr(&cpu_info)))
1770 return; 1781 return;
1771 if (all)
1772 del_timer_sync(&__get_cpu_var(mce_timer));
1773 cmci_clear(); 1782 cmci_clear();
1774} 1783}
1775 1784
@@ -1852,7 +1861,8 @@ static ssize_t set_ignore_ce(struct sys_device *s,
1852 if (mce_ignore_ce ^ !!new) { 1861 if (mce_ignore_ce ^ !!new) {
1853 if (new) { 1862 if (new) {
1854 /* disable ce features */ 1863 /* disable ce features */
1855 on_each_cpu(mce_disable_ce, (void *)1, 1); 1864 mce_timer_delete_all();
1865 on_each_cpu(mce_disable_cmci, NULL, 1);
1856 mce_ignore_ce = 1; 1866 mce_ignore_ce = 1;
1857 } else { 1867 } else {
1858 /* enable ce features */ 1868 /* enable ce features */
@@ -1875,7 +1885,7 @@ static ssize_t set_cmci_disabled(struct sys_device *s,
1875 if (mce_cmci_disabled ^ !!new) { 1885 if (mce_cmci_disabled ^ !!new) {
1876 if (new) { 1886 if (new) {
1877 /* disable cmci */ 1887 /* disable cmci */
1878 on_each_cpu(mce_disable_ce, NULL, 1); 1888 on_each_cpu(mce_disable_cmci, NULL, 1);
1879 mce_cmci_disabled = 1; 1889 mce_cmci_disabled = 1;
1880 } else { 1890 } else {
1881 /* enable cmci */ 1891 /* enable cmci */
diff --git a/arch/x86/kernel/cpu/mcheck/mce_intel.c b/arch/x86/kernel/cpu/mcheck/mce_intel.c
index 8694ef56459d..38e49bc95ffc 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_intel.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_intel.c
@@ -28,7 +28,7 @@ static DEFINE_PER_CPU(mce_banks_t, mce_banks_owned);
28 * cmci_discover_lock protects against parallel discovery attempts 28 * cmci_discover_lock protects against parallel discovery attempts
29 * which could race against each other. 29 * which could race against each other.
30 */ 30 */
31static DEFINE_SPINLOCK(cmci_discover_lock); 31static DEFINE_RAW_SPINLOCK(cmci_discover_lock);
32 32
33#define CMCI_THRESHOLD 1 33#define CMCI_THRESHOLD 1
34 34
@@ -85,7 +85,7 @@ static void cmci_discover(int banks, int boot)
85 int hdr = 0; 85 int hdr = 0;
86 int i; 86 int i;
87 87
88 spin_lock_irqsave(&cmci_discover_lock, flags); 88 raw_spin_lock_irqsave(&cmci_discover_lock, flags);
89 for (i = 0; i < banks; i++) { 89 for (i = 0; i < banks; i++) {
90 u64 val; 90 u64 val;
91 91
@@ -116,7 +116,7 @@ static void cmci_discover(int banks, int boot)
116 WARN_ON(!test_bit(i, __get_cpu_var(mce_poll_banks))); 116 WARN_ON(!test_bit(i, __get_cpu_var(mce_poll_banks)));
117 } 117 }
118 } 118 }
119 spin_unlock_irqrestore(&cmci_discover_lock, flags); 119 raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
120 if (hdr) 120 if (hdr)
121 printk(KERN_CONT "\n"); 121 printk(KERN_CONT "\n");
122} 122}
@@ -150,7 +150,7 @@ void cmci_clear(void)
150 150
151 if (!cmci_supported(&banks)) 151 if (!cmci_supported(&banks))
152 return; 152 return;
153 spin_lock_irqsave(&cmci_discover_lock, flags); 153 raw_spin_lock_irqsave(&cmci_discover_lock, flags);
154 for (i = 0; i < banks; i++) { 154 for (i = 0; i < banks; i++) {
155 if (!test_bit(i, __get_cpu_var(mce_banks_owned))) 155 if (!test_bit(i, __get_cpu_var(mce_banks_owned)))
156 continue; 156 continue;
@@ -160,7 +160,7 @@ void cmci_clear(void)
160 wrmsrl(MSR_IA32_MCx_CTL2(i), val); 160 wrmsrl(MSR_IA32_MCx_CTL2(i), val);
161 __clear_bit(i, __get_cpu_var(mce_banks_owned)); 161 __clear_bit(i, __get_cpu_var(mce_banks_owned));
162 } 162 }
163 spin_unlock_irqrestore(&cmci_discover_lock, flags); 163 raw_spin_unlock_irqrestore(&cmci_discover_lock, flags);
164} 164}
165 165
166/* 166/*
diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index d944bf6c50e9..0a630dd4b620 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -11,6 +11,8 @@
11 */ 11 */
12 12
13#include <linux/types.h> 13#include <linux/types.h>
14#include <linux/time.h>
15#include <linux/clocksource.h>
14#include <linux/module.h> 16#include <linux/module.h>
15#include <asm/processor.h> 17#include <asm/processor.h>
16#include <asm/hypervisor.h> 18#include <asm/hypervisor.h>
@@ -36,6 +38,25 @@ static bool __init ms_hyperv_platform(void)
36 !memcmp("Microsoft Hv", hyp_signature, 12); 38 !memcmp("Microsoft Hv", hyp_signature, 12);
37} 39}
38 40
41static cycle_t read_hv_clock(struct clocksource *arg)
42{
43 cycle_t current_tick;
44 /*
45 * Read the partition counter to get the current tick count. This count
46 * is set to 0 when the partition is created and is incremented in
47 * 100 nanosecond units.
48 */
49 rdmsrl(HV_X64_MSR_TIME_REF_COUNT, current_tick);
50 return current_tick;
51}
52
53static struct clocksource hyperv_cs = {
54 .name = "hyperv_clocksource",
55 .rating = 400, /* use this when running on Hyperv*/
56 .read = read_hv_clock,
57 .mask = CLOCKSOURCE_MASK(64),
58};
59
39static void __init ms_hyperv_init_platform(void) 60static void __init ms_hyperv_init_platform(void)
40{ 61{
41 /* 62 /*
@@ -46,6 +67,8 @@ static void __init ms_hyperv_init_platform(void)
46 67
47 printk(KERN_INFO "HyperV: features 0x%x, hints 0x%x\n", 68 printk(KERN_INFO "HyperV: features 0x%x, hints 0x%x\n",
48 ms_hyperv.features, ms_hyperv.hints); 69 ms_hyperv.features, ms_hyperv.hints);
70
71 clocksource_register_hz(&hyperv_cs, NSEC_PER_SEC/100);
49} 72}
50 73
51const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = { 74const __refconst struct hypervisor_x86 x86_hyper_ms_hyperv = {
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index cfa62ec090ec..640891014b2a 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -32,6 +32,8 @@
32#include <asm/smp.h> 32#include <asm/smp.h>
33#include <asm/alternative.h> 33#include <asm/alternative.h>
34 34
35#include "perf_event.h"
36
35#if 0 37#if 0
36#undef wrmsrl 38#undef wrmsrl
37#define wrmsrl(msr, val) \ 39#define wrmsrl(msr, val) \
@@ -43,283 +45,17 @@ do { \
43} while (0) 45} while (0)
44#endif 46#endif
45 47
46/* 48struct x86_pmu x86_pmu __read_mostly;
47 * | NHM/WSM | SNB |
48 * register -------------------------------
49 * | HT | no HT | HT | no HT |
50 *-----------------------------------------
51 * offcore | core | core | cpu | core |
52 * lbr_sel | core | core | cpu | core |
53 * ld_lat | cpu | core | cpu | core |
54 *-----------------------------------------
55 *
56 * Given that there is a small number of shared regs,
57 * we can pre-allocate their slot in the per-cpu
58 * per-core reg tables.
59 */
60enum extra_reg_type {
61 EXTRA_REG_NONE = -1, /* not used */
62
63 EXTRA_REG_RSP_0 = 0, /* offcore_response_0 */
64 EXTRA_REG_RSP_1 = 1, /* offcore_response_1 */
65
66 EXTRA_REG_MAX /* number of entries needed */
67};
68
69struct event_constraint {
70 union {
71 unsigned long idxmsk[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
72 u64 idxmsk64;
73 };
74 u64 code;
75 u64 cmask;
76 int weight;
77};
78
79struct amd_nb {
80 int nb_id; /* NorthBridge id */
81 int refcnt; /* reference count */
82 struct perf_event *owners[X86_PMC_IDX_MAX];
83 struct event_constraint event_constraints[X86_PMC_IDX_MAX];
84};
85
86struct intel_percore;
87
88#define MAX_LBR_ENTRIES 16
89
90struct cpu_hw_events {
91 /*
92 * Generic x86 PMC bits
93 */
94 struct perf_event *events[X86_PMC_IDX_MAX]; /* in counter order */
95 unsigned long active_mask[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
96 unsigned long running[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
97 int enabled;
98
99 int n_events;
100 int n_added;
101 int n_txn;
102 int assign[X86_PMC_IDX_MAX]; /* event to counter assignment */
103 u64 tags[X86_PMC_IDX_MAX];
104 struct perf_event *event_list[X86_PMC_IDX_MAX]; /* in enabled order */
105
106 unsigned int group_flag;
107
108 /*
109 * Intel DebugStore bits
110 */
111 struct debug_store *ds;
112 u64 pebs_enabled;
113
114 /*
115 * Intel LBR bits
116 */
117 int lbr_users;
118 void *lbr_context;
119 struct perf_branch_stack lbr_stack;
120 struct perf_branch_entry lbr_entries[MAX_LBR_ENTRIES];
121
122 /*
123 * manage shared (per-core, per-cpu) registers
124 * used on Intel NHM/WSM/SNB
125 */
126 struct intel_shared_regs *shared_regs;
127
128 /*
129 * AMD specific bits
130 */
131 struct amd_nb *amd_nb;
132};
133
134#define __EVENT_CONSTRAINT(c, n, m, w) {\
135 { .idxmsk64 = (n) }, \
136 .code = (c), \
137 .cmask = (m), \
138 .weight = (w), \
139}
140
141#define EVENT_CONSTRAINT(c, n, m) \
142 __EVENT_CONSTRAINT(c, n, m, HWEIGHT(n))
143
144/*
145 * Constraint on the Event code.
146 */
147#define INTEL_EVENT_CONSTRAINT(c, n) \
148 EVENT_CONSTRAINT(c, n, ARCH_PERFMON_EVENTSEL_EVENT)
149
150/*
151 * Constraint on the Event code + UMask + fixed-mask
152 *
153 * filter mask to validate fixed counter events.
154 * the following filters disqualify for fixed counters:
155 * - inv
156 * - edge
157 * - cnt-mask
158 * The other filters are supported by fixed counters.
159 * The any-thread option is supported starting with v3.
160 */
161#define FIXED_EVENT_CONSTRAINT(c, n) \
162 EVENT_CONSTRAINT(c, (1ULL << (32+n)), X86_RAW_EVENT_MASK)
163
164/*
165 * Constraint on the Event code + UMask
166 */
167#define INTEL_UEVENT_CONSTRAINT(c, n) \
168 EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK)
169
170#define EVENT_CONSTRAINT_END \
171 EVENT_CONSTRAINT(0, 0, 0)
172
173#define for_each_event_constraint(e, c) \
174 for ((e) = (c); (e)->weight; (e)++)
175
176/*
177 * Per register state.
178 */
179struct er_account {
180 raw_spinlock_t lock; /* per-core: protect structure */
181 u64 config; /* extra MSR config */
182 u64 reg; /* extra MSR number */
183 atomic_t ref; /* reference count */
184};
185
186/*
187 * Extra registers for specific events.
188 *
189 * Some events need large masks and require external MSRs.
190 * Those extra MSRs end up being shared for all events on
191 * a PMU and sometimes between PMU of sibling HT threads.
192 * In either case, the kernel needs to handle conflicting
193 * accesses to those extra, shared, regs. The data structure
194 * to manage those registers is stored in cpu_hw_event.
195 */
196struct extra_reg {
197 unsigned int event;
198 unsigned int msr;
199 u64 config_mask;
200 u64 valid_mask;
201 int idx; /* per_xxx->regs[] reg index */
202};
203
204#define EVENT_EXTRA_REG(e, ms, m, vm, i) { \
205 .event = (e), \
206 .msr = (ms), \
207 .config_mask = (m), \
208 .valid_mask = (vm), \
209 .idx = EXTRA_REG_##i \
210 }
211
212#define INTEL_EVENT_EXTRA_REG(event, msr, vm, idx) \
213 EVENT_EXTRA_REG(event, msr, ARCH_PERFMON_EVENTSEL_EVENT, vm, idx)
214
215#define EVENT_EXTRA_END EVENT_EXTRA_REG(0, 0, 0, 0, RSP_0)
216
217union perf_capabilities {
218 struct {
219 u64 lbr_format : 6;
220 u64 pebs_trap : 1;
221 u64 pebs_arch_reg : 1;
222 u64 pebs_format : 4;
223 u64 smm_freeze : 1;
224 };
225 u64 capabilities;
226};
227
228/*
229 * struct x86_pmu - generic x86 pmu
230 */
231struct x86_pmu {
232 /*
233 * Generic x86 PMC bits
234 */
235 const char *name;
236 int version;
237 int (*handle_irq)(struct pt_regs *);
238 void (*disable_all)(void);
239 void (*enable_all)(int added);
240 void (*enable)(struct perf_event *);
241 void (*disable)(struct perf_event *);
242 int (*hw_config)(struct perf_event *event);
243 int (*schedule_events)(struct cpu_hw_events *cpuc, int n, int *assign);
244 unsigned eventsel;
245 unsigned perfctr;
246 u64 (*event_map)(int);
247 int max_events;
248 int num_counters;
249 int num_counters_fixed;
250 int cntval_bits;
251 u64 cntval_mask;
252 int apic;
253 u64 max_period;
254 struct event_constraint *
255 (*get_event_constraints)(struct cpu_hw_events *cpuc,
256 struct perf_event *event);
257
258 void (*put_event_constraints)(struct cpu_hw_events *cpuc,
259 struct perf_event *event);
260 struct event_constraint *event_constraints;
261 void (*quirks)(void);
262 int perfctr_second_write;
263
264 int (*cpu_prepare)(int cpu);
265 void (*cpu_starting)(int cpu);
266 void (*cpu_dying)(int cpu);
267 void (*cpu_dead)(int cpu);
268
269 /*
270 * Intel Arch Perfmon v2+
271 */
272 u64 intel_ctrl;
273 union perf_capabilities intel_cap;
274 49
275 /* 50DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = {
276 * Intel DebugStore bits
277 */
278 int bts, pebs;
279 int bts_active, pebs_active;
280 int pebs_record_size;
281 void (*drain_pebs)(struct pt_regs *regs);
282 struct event_constraint *pebs_constraints;
283
284 /*
285 * Intel LBR
286 */
287 unsigned long lbr_tos, lbr_from, lbr_to; /* MSR base regs */
288 int lbr_nr; /* hardware stack size */
289
290 /*
291 * Extra registers for events
292 */
293 struct extra_reg *extra_regs;
294 unsigned int er_flags;
295};
296
297#define ERF_NO_HT_SHARING 1
298#define ERF_HAS_RSP_1 2
299
300static struct x86_pmu x86_pmu __read_mostly;
301
302static DEFINE_PER_CPU(struct cpu_hw_events, cpu_hw_events) = {
303 .enabled = 1, 51 .enabled = 1,
304}; 52};
305 53
306static int x86_perf_event_set_period(struct perf_event *event); 54u64 __read_mostly hw_cache_event_ids
307
308/*
309 * Generalized hw caching related hw_event table, filled
310 * in on a per model basis. A value of 0 means
311 * 'not supported', -1 means 'hw_event makes no sense on
312 * this CPU', any other value means the raw hw_event
313 * ID.
314 */
315
316#define C(x) PERF_COUNT_HW_CACHE_##x
317
318static u64 __read_mostly hw_cache_event_ids
319 [PERF_COUNT_HW_CACHE_MAX] 55 [PERF_COUNT_HW_CACHE_MAX]
320 [PERF_COUNT_HW_CACHE_OP_MAX] 56 [PERF_COUNT_HW_CACHE_OP_MAX]
321 [PERF_COUNT_HW_CACHE_RESULT_MAX]; 57 [PERF_COUNT_HW_CACHE_RESULT_MAX];
322static u64 __read_mostly hw_cache_extra_regs 58u64 __read_mostly hw_cache_extra_regs
323 [PERF_COUNT_HW_CACHE_MAX] 59 [PERF_COUNT_HW_CACHE_MAX]
324 [PERF_COUNT_HW_CACHE_OP_MAX] 60 [PERF_COUNT_HW_CACHE_OP_MAX]
325 [PERF_COUNT_HW_CACHE_RESULT_MAX]; 61 [PERF_COUNT_HW_CACHE_RESULT_MAX];
@@ -329,8 +65,7 @@ static u64 __read_mostly hw_cache_extra_regs
329 * Can only be executed on the CPU where the event is active. 65 * Can only be executed on the CPU where the event is active.
330 * Returns the delta events processed. 66 * Returns the delta events processed.
331 */ 67 */
332static u64 68u64 x86_perf_event_update(struct perf_event *event)
333x86_perf_event_update(struct perf_event *event)
334{ 69{
335 struct hw_perf_event *hwc = &event->hw; 70 struct hw_perf_event *hwc = &event->hw;
336 int shift = 64 - x86_pmu.cntval_bits; 71 int shift = 64 - x86_pmu.cntval_bits;
@@ -373,30 +108,6 @@ again:
373 return new_raw_count; 108 return new_raw_count;
374} 109}
375 110
376static inline int x86_pmu_addr_offset(int index)
377{
378 int offset;
379
380 /* offset = X86_FEATURE_PERFCTR_CORE ? index << 1 : index */
381 alternative_io(ASM_NOP2,
382 "shll $1, %%eax",
383 X86_FEATURE_PERFCTR_CORE,
384 "=a" (offset),
385 "a" (index));
386
387 return offset;
388}
389
390static inline unsigned int x86_pmu_config_addr(int index)
391{
392 return x86_pmu.eventsel + x86_pmu_addr_offset(index);
393}
394
395static inline unsigned int x86_pmu_event_addr(int index)
396{
397 return x86_pmu.perfctr + x86_pmu_addr_offset(index);
398}
399
400/* 111/*
401 * Find and validate any extra registers to set up. 112 * Find and validate any extra registers to set up.
402 */ 113 */
@@ -532,9 +243,6 @@ msr_fail:
532 return false; 243 return false;
533} 244}
534 245
535static void reserve_ds_buffers(void);
536static void release_ds_buffers(void);
537
538static void hw_perf_event_destroy(struct perf_event *event) 246static void hw_perf_event_destroy(struct perf_event *event)
539{ 247{
540 if (atomic_dec_and_mutex_lock(&active_events, &pmc_reserve_mutex)) { 248 if (atomic_dec_and_mutex_lock(&active_events, &pmc_reserve_mutex)) {
@@ -583,7 +291,7 @@ set_ext_hw_attr(struct hw_perf_event *hwc, struct perf_event *event)
583 return x86_pmu_extra_regs(val, event); 291 return x86_pmu_extra_regs(val, event);
584} 292}
585 293
586static int x86_setup_perfctr(struct perf_event *event) 294int x86_setup_perfctr(struct perf_event *event)
587{ 295{
588 struct perf_event_attr *attr = &event->attr; 296 struct perf_event_attr *attr = &event->attr;
589 struct hw_perf_event *hwc = &event->hw; 297 struct hw_perf_event *hwc = &event->hw;
@@ -647,7 +355,7 @@ static int x86_setup_perfctr(struct perf_event *event)
647 return 0; 355 return 0;
648} 356}
649 357
650static int x86_pmu_hw_config(struct perf_event *event) 358int x86_pmu_hw_config(struct perf_event *event)
651{ 359{
652 if (event->attr.precise_ip) { 360 if (event->attr.precise_ip) {
653 int precise = 0; 361 int precise = 0;
@@ -723,7 +431,7 @@ static int __x86_pmu_event_init(struct perf_event *event)
723 return x86_pmu.hw_config(event); 431 return x86_pmu.hw_config(event);
724} 432}
725 433
726static void x86_pmu_disable_all(void) 434void x86_pmu_disable_all(void)
727{ 435{
728 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 436 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
729 int idx; 437 int idx;
@@ -758,15 +466,7 @@ static void x86_pmu_disable(struct pmu *pmu)
758 x86_pmu.disable_all(); 466 x86_pmu.disable_all();
759} 467}
760 468
761static inline void __x86_pmu_enable_event(struct hw_perf_event *hwc, 469void x86_pmu_enable_all(int added)
762 u64 enable_mask)
763{
764 if (hwc->extra_reg.reg)
765 wrmsrl(hwc->extra_reg.reg, hwc->extra_reg.config);
766 wrmsrl(hwc->config_base, hwc->config | enable_mask);
767}
768
769static void x86_pmu_enable_all(int added)
770{ 470{
771 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 471 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
772 int idx; 472 int idx;
@@ -788,7 +488,7 @@ static inline int is_x86_event(struct perf_event *event)
788 return event->pmu == &pmu; 488 return event->pmu == &pmu;
789} 489}
790 490
791static int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign) 491int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign)
792{ 492{
793 struct event_constraint *c, *constraints[X86_PMC_IDX_MAX]; 493 struct event_constraint *c, *constraints[X86_PMC_IDX_MAX];
794 unsigned long used_mask[BITS_TO_LONGS(X86_PMC_IDX_MAX)]; 494 unsigned long used_mask[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
@@ -959,7 +659,6 @@ static inline int match_prev_assignment(struct hw_perf_event *hwc,
959} 659}
960 660
961static void x86_pmu_start(struct perf_event *event, int flags); 661static void x86_pmu_start(struct perf_event *event, int flags);
962static void x86_pmu_stop(struct perf_event *event, int flags);
963 662
964static void x86_pmu_enable(struct pmu *pmu) 663static void x86_pmu_enable(struct pmu *pmu)
965{ 664{
@@ -1031,21 +730,13 @@ static void x86_pmu_enable(struct pmu *pmu)
1031 x86_pmu.enable_all(added); 730 x86_pmu.enable_all(added);
1032} 731}
1033 732
1034static inline void x86_pmu_disable_event(struct perf_event *event)
1035{
1036 struct hw_perf_event *hwc = &event->hw;
1037
1038 wrmsrl(hwc->config_base, hwc->config);
1039}
1040
1041static DEFINE_PER_CPU(u64 [X86_PMC_IDX_MAX], pmc_prev_left); 733static DEFINE_PER_CPU(u64 [X86_PMC_IDX_MAX], pmc_prev_left);
1042 734
1043/* 735/*
1044 * Set the next IRQ period, based on the hwc->period_left value. 736 * Set the next IRQ period, based on the hwc->period_left value.
1045 * To be called with the event disabled in hw: 737 * To be called with the event disabled in hw:
1046 */ 738 */
1047static int 739int x86_perf_event_set_period(struct perf_event *event)
1048x86_perf_event_set_period(struct perf_event *event)
1049{ 740{
1050 struct hw_perf_event *hwc = &event->hw; 741 struct hw_perf_event *hwc = &event->hw;
1051 s64 left = local64_read(&hwc->period_left); 742 s64 left = local64_read(&hwc->period_left);
@@ -1105,7 +796,7 @@ x86_perf_event_set_period(struct perf_event *event)
1105 return ret; 796 return ret;
1106} 797}
1107 798
1108static void x86_pmu_enable_event(struct perf_event *event) 799void x86_pmu_enable_event(struct perf_event *event)
1109{ 800{
1110 if (__this_cpu_read(cpu_hw_events.enabled)) 801 if (__this_cpu_read(cpu_hw_events.enabled))
1111 __x86_pmu_enable_event(&event->hw, 802 __x86_pmu_enable_event(&event->hw,
@@ -1244,7 +935,7 @@ void perf_event_print_debug(void)
1244 local_irq_restore(flags); 935 local_irq_restore(flags);
1245} 936}
1246 937
1247static void x86_pmu_stop(struct perf_event *event, int flags) 938void x86_pmu_stop(struct perf_event *event, int flags)
1248{ 939{
1249 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 940 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
1250 struct hw_perf_event *hwc = &event->hw; 941 struct hw_perf_event *hwc = &event->hw;
@@ -1297,7 +988,7 @@ static void x86_pmu_del(struct perf_event *event, int flags)
1297 perf_event_update_userpage(event); 988 perf_event_update_userpage(event);
1298} 989}
1299 990
1300static int x86_pmu_handle_irq(struct pt_regs *regs) 991int x86_pmu_handle_irq(struct pt_regs *regs)
1301{ 992{
1302 struct perf_sample_data data; 993 struct perf_sample_data data;
1303 struct cpu_hw_events *cpuc; 994 struct cpu_hw_events *cpuc;
@@ -1367,109 +1058,28 @@ void perf_events_lapic_init(void)
1367 apic_write(APIC_LVTPC, APIC_DM_NMI); 1058 apic_write(APIC_LVTPC, APIC_DM_NMI);
1368} 1059}
1369 1060
1370struct pmu_nmi_state {
1371 unsigned int marked;
1372 int handled;
1373};
1374
1375static DEFINE_PER_CPU(struct pmu_nmi_state, pmu_nmi);
1376
1377static int __kprobes 1061static int __kprobes
1378perf_event_nmi_handler(struct notifier_block *self, 1062perf_event_nmi_handler(unsigned int cmd, struct pt_regs *regs)
1379 unsigned long cmd, void *__args)
1380{ 1063{
1381 struct die_args *args = __args;
1382 unsigned int this_nmi;
1383 int handled;
1384
1385 if (!atomic_read(&active_events)) 1064 if (!atomic_read(&active_events))
1386 return NOTIFY_DONE; 1065 return NMI_DONE;
1387
1388 switch (cmd) {
1389 case DIE_NMI:
1390 break;
1391 case DIE_NMIUNKNOWN:
1392 this_nmi = percpu_read(irq_stat.__nmi_count);
1393 if (this_nmi != __this_cpu_read(pmu_nmi.marked))
1394 /* let the kernel handle the unknown nmi */
1395 return NOTIFY_DONE;
1396 /*
1397 * This one is a PMU back-to-back nmi. Two events
1398 * trigger 'simultaneously' raising two back-to-back
1399 * NMIs. If the first NMI handles both, the latter
1400 * will be empty and daze the CPU. So, we drop it to
1401 * avoid false-positive 'unknown nmi' messages.
1402 */
1403 return NOTIFY_STOP;
1404 default:
1405 return NOTIFY_DONE;
1406 }
1407
1408 handled = x86_pmu.handle_irq(args->regs);
1409 if (!handled)
1410 return NOTIFY_DONE;
1411
1412 this_nmi = percpu_read(irq_stat.__nmi_count);
1413 if ((handled > 1) ||
1414 /* the next nmi could be a back-to-back nmi */
1415 ((__this_cpu_read(pmu_nmi.marked) == this_nmi) &&
1416 (__this_cpu_read(pmu_nmi.handled) > 1))) {
1417 /*
1418 * We could have two subsequent back-to-back nmis: The
1419 * first handles more than one counter, the 2nd
1420 * handles only one counter and the 3rd handles no
1421 * counter.
1422 *
1423 * This is the 2nd nmi because the previous was
1424 * handling more than one counter. We will mark the
1425 * next (3rd) and then drop it if unhandled.
1426 */
1427 __this_cpu_write(pmu_nmi.marked, this_nmi + 1);
1428 __this_cpu_write(pmu_nmi.handled, handled);
1429 }
1430 1066
1431 return NOTIFY_STOP; 1067 return x86_pmu.handle_irq(regs);
1432} 1068}
1433 1069
1434static __read_mostly struct notifier_block perf_event_nmi_notifier = { 1070struct event_constraint emptyconstraint;
1435 .notifier_call = perf_event_nmi_handler, 1071struct event_constraint unconstrained;
1436 .next = NULL,
1437 .priority = NMI_LOCAL_LOW_PRIOR,
1438};
1439
1440static struct event_constraint unconstrained;
1441static struct event_constraint emptyconstraint;
1442
1443static struct event_constraint *
1444x86_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event)
1445{
1446 struct event_constraint *c;
1447
1448 if (x86_pmu.event_constraints) {
1449 for_each_event_constraint(c, x86_pmu.event_constraints) {
1450 if ((event->hw.config & c->cmask) == c->code)
1451 return c;
1452 }
1453 }
1454
1455 return &unconstrained;
1456}
1457
1458#include "perf_event_amd.c"
1459#include "perf_event_p6.c"
1460#include "perf_event_p4.c"
1461#include "perf_event_intel_lbr.c"
1462#include "perf_event_intel_ds.c"
1463#include "perf_event_intel.c"
1464 1072
1465static int __cpuinit 1073static int __cpuinit
1466x86_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu) 1074x86_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
1467{ 1075{
1468 unsigned int cpu = (long)hcpu; 1076 unsigned int cpu = (long)hcpu;
1077 struct cpu_hw_events *cpuc = &per_cpu(cpu_hw_events, cpu);
1469 int ret = NOTIFY_OK; 1078 int ret = NOTIFY_OK;
1470 1079
1471 switch (action & ~CPU_TASKS_FROZEN) { 1080 switch (action & ~CPU_TASKS_FROZEN) {
1472 case CPU_UP_PREPARE: 1081 case CPU_UP_PREPARE:
1082 cpuc->kfree_on_online = NULL;
1473 if (x86_pmu.cpu_prepare) 1083 if (x86_pmu.cpu_prepare)
1474 ret = x86_pmu.cpu_prepare(cpu); 1084 ret = x86_pmu.cpu_prepare(cpu);
1475 break; 1085 break;
@@ -1479,6 +1089,10 @@ x86_pmu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
1479 x86_pmu.cpu_starting(cpu); 1089 x86_pmu.cpu_starting(cpu);
1480 break; 1090 break;
1481 1091
1092 case CPU_ONLINE:
1093 kfree(cpuc->kfree_on_online);
1094 break;
1095
1482 case CPU_DYING: 1096 case CPU_DYING:
1483 if (x86_pmu.cpu_dying) 1097 if (x86_pmu.cpu_dying)
1484 x86_pmu.cpu_dying(cpu); 1098 x86_pmu.cpu_dying(cpu);
@@ -1557,7 +1171,7 @@ static int __init init_hw_perf_events(void)
1557 ((1LL << x86_pmu.num_counters_fixed)-1) << X86_PMC_IDX_FIXED; 1171 ((1LL << x86_pmu.num_counters_fixed)-1) << X86_PMC_IDX_FIXED;
1558 1172
1559 perf_events_lapic_init(); 1173 perf_events_lapic_init();
1560 register_die_notifier(&perf_event_nmi_notifier); 1174 register_nmi_handler(NMI_LOCAL, perf_event_nmi_handler, 0, "PMI");
1561 1175
1562 unconstrained = (struct event_constraint) 1176 unconstrained = (struct event_constraint)
1563 __EVENT_CONSTRAINT(0, (1ULL << x86_pmu.num_counters) - 1, 1177 __EVENT_CONSTRAINT(0, (1ULL << x86_pmu.num_counters) - 1,
diff --git a/arch/x86/kernel/cpu/perf_event.h b/arch/x86/kernel/cpu/perf_event.h
new file mode 100644
index 000000000000..b9698d40ac4b
--- /dev/null
+++ b/arch/x86/kernel/cpu/perf_event.h
@@ -0,0 +1,505 @@
1/*
2 * Performance events x86 architecture header
3 *
4 * Copyright (C) 2008 Thomas Gleixner <tglx@linutronix.de>
5 * Copyright (C) 2008-2009 Red Hat, Inc., Ingo Molnar
6 * Copyright (C) 2009 Jaswinder Singh Rajput
7 * Copyright (C) 2009 Advanced Micro Devices, Inc., Robert Richter
8 * Copyright (C) 2008-2009 Red Hat, Inc., Peter Zijlstra <pzijlstr@redhat.com>
9 * Copyright (C) 2009 Intel Corporation, <markus.t.metzger@intel.com>
10 * Copyright (C) 2009 Google, Inc., Stephane Eranian
11 *
12 * For licencing details see kernel-base/COPYING
13 */
14
15#include <linux/perf_event.h>
16
17/*
18 * | NHM/WSM | SNB |
19 * register -------------------------------
20 * | HT | no HT | HT | no HT |
21 *-----------------------------------------
22 * offcore | core | core | cpu | core |
23 * lbr_sel | core | core | cpu | core |
24 * ld_lat | cpu | core | cpu | core |
25 *-----------------------------------------
26 *
27 * Given that there is a small number of shared regs,
28 * we can pre-allocate their slot in the per-cpu
29 * per-core reg tables.
30 */
31enum extra_reg_type {
32 EXTRA_REG_NONE = -1, /* not used */
33
34 EXTRA_REG_RSP_0 = 0, /* offcore_response_0 */
35 EXTRA_REG_RSP_1 = 1, /* offcore_response_1 */
36
37 EXTRA_REG_MAX /* number of entries needed */
38};
39
40struct event_constraint {
41 union {
42 unsigned long idxmsk[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
43 u64 idxmsk64;
44 };
45 u64 code;
46 u64 cmask;
47 int weight;
48};
49
50struct amd_nb {
51 int nb_id; /* NorthBridge id */
52 int refcnt; /* reference count */
53 struct perf_event *owners[X86_PMC_IDX_MAX];
54 struct event_constraint event_constraints[X86_PMC_IDX_MAX];
55};
56
57/* The maximal number of PEBS events: */
58#define MAX_PEBS_EVENTS 4
59
60/*
61 * A debug store configuration.
62 *
63 * We only support architectures that use 64bit fields.
64 */
65struct debug_store {
66 u64 bts_buffer_base;
67 u64 bts_index;
68 u64 bts_absolute_maximum;
69 u64 bts_interrupt_threshold;
70 u64 pebs_buffer_base;
71 u64 pebs_index;
72 u64 pebs_absolute_maximum;
73 u64 pebs_interrupt_threshold;
74 u64 pebs_event_reset[MAX_PEBS_EVENTS];
75};
76
77/*
78 * Per register state.
79 */
80struct er_account {
81 raw_spinlock_t lock; /* per-core: protect structure */
82 u64 config; /* extra MSR config */
83 u64 reg; /* extra MSR number */
84 atomic_t ref; /* reference count */
85};
86
87/*
88 * Per core/cpu state
89 *
90 * Used to coordinate shared registers between HT threads or
91 * among events on a single PMU.
92 */
93struct intel_shared_regs {
94 struct er_account regs[EXTRA_REG_MAX];
95 int refcnt; /* per-core: #HT threads */
96 unsigned core_id; /* per-core: core id */
97};
98
99#define MAX_LBR_ENTRIES 16
100
101struct cpu_hw_events {
102 /*
103 * Generic x86 PMC bits
104 */
105 struct perf_event *events[X86_PMC_IDX_MAX]; /* in counter order */
106 unsigned long active_mask[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
107 unsigned long running[BITS_TO_LONGS(X86_PMC_IDX_MAX)];
108 int enabled;
109
110 int n_events;
111 int n_added;
112 int n_txn;
113 int assign[X86_PMC_IDX_MAX]; /* event to counter assignment */
114 u64 tags[X86_PMC_IDX_MAX];
115 struct perf_event *event_list[X86_PMC_IDX_MAX]; /* in enabled order */
116
117 unsigned int group_flag;
118
119 /*
120 * Intel DebugStore bits
121 */
122 struct debug_store *ds;
123 u64 pebs_enabled;
124
125 /*
126 * Intel LBR bits
127 */
128 int lbr_users;
129 void *lbr_context;
130 struct perf_branch_stack lbr_stack;
131 struct perf_branch_entry lbr_entries[MAX_LBR_ENTRIES];
132
133 /*
134 * Intel host/guest exclude bits
135 */
136 u64 intel_ctrl_guest_mask;
137 u64 intel_ctrl_host_mask;
138 struct perf_guest_switch_msr guest_switch_msrs[X86_PMC_IDX_MAX];
139
140 /*
141 * manage shared (per-core, per-cpu) registers
142 * used on Intel NHM/WSM/SNB
143 */
144 struct intel_shared_regs *shared_regs;
145
146 /*
147 * AMD specific bits
148 */
149 struct amd_nb *amd_nb;
150
151 void *kfree_on_online;
152};
153
154#define __EVENT_CONSTRAINT(c, n, m, w) {\
155 { .idxmsk64 = (n) }, \
156 .code = (c), \
157 .cmask = (m), \
158 .weight = (w), \
159}
160
161#define EVENT_CONSTRAINT(c, n, m) \
162 __EVENT_CONSTRAINT(c, n, m, HWEIGHT(n))
163
164/*
165 * Constraint on the Event code.
166 */
167#define INTEL_EVENT_CONSTRAINT(c, n) \
168 EVENT_CONSTRAINT(c, n, ARCH_PERFMON_EVENTSEL_EVENT)
169
170/*
171 * Constraint on the Event code + UMask + fixed-mask
172 *
173 * filter mask to validate fixed counter events.
174 * the following filters disqualify for fixed counters:
175 * - inv
176 * - edge
177 * - cnt-mask
178 * The other filters are supported by fixed counters.
179 * The any-thread option is supported starting with v3.
180 */
181#define FIXED_EVENT_CONSTRAINT(c, n) \
182 EVENT_CONSTRAINT(c, (1ULL << (32+n)), X86_RAW_EVENT_MASK)
183
184/*
185 * Constraint on the Event code + UMask
186 */
187#define INTEL_UEVENT_CONSTRAINT(c, n) \
188 EVENT_CONSTRAINT(c, n, INTEL_ARCH_EVENT_MASK)
189
190#define EVENT_CONSTRAINT_END \
191 EVENT_CONSTRAINT(0, 0, 0)
192
193#define for_each_event_constraint(e, c) \
194 for ((e) = (c); (e)->weight; (e)++)
195
196/*
197 * Extra registers for specific events.
198 *
199 * Some events need large masks and require external MSRs.
200 * Those extra MSRs end up being shared for all events on
201 * a PMU and sometimes between PMU of sibling HT threads.
202 * In either case, the kernel needs to handle conflicting
203 * accesses to those extra, shared, regs. The data structure
204 * to manage those registers is stored in cpu_hw_event.
205 */
206struct extra_reg {
207 unsigned int event;
208 unsigned int msr;
209 u64 config_mask;
210 u64 valid_mask;
211 int idx; /* per_xxx->regs[] reg index */
212};
213
214#define EVENT_EXTRA_REG(e, ms, m, vm, i) { \
215 .event = (e), \
216 .msr = (ms), \
217 .config_mask = (m), \
218 .valid_mask = (vm), \
219 .idx = EXTRA_REG_##i \
220 }
221
222#define INTEL_EVENT_EXTRA_REG(event, msr, vm, idx) \
223 EVENT_EXTRA_REG(event, msr, ARCH_PERFMON_EVENTSEL_EVENT, vm, idx)
224
225#define EVENT_EXTRA_END EVENT_EXTRA_REG(0, 0, 0, 0, RSP_0)
226
227union perf_capabilities {
228 struct {
229 u64 lbr_format:6;
230 u64 pebs_trap:1;
231 u64 pebs_arch_reg:1;
232 u64 pebs_format:4;
233 u64 smm_freeze:1;
234 };
235 u64 capabilities;
236};
237
238/*
239 * struct x86_pmu - generic x86 pmu
240 */
241struct x86_pmu {
242 /*
243 * Generic x86 PMC bits
244 */
245 const char *name;
246 int version;
247 int (*handle_irq)(struct pt_regs *);
248 void (*disable_all)(void);
249 void (*enable_all)(int added);
250 void (*enable)(struct perf_event *);
251 void (*disable)(struct perf_event *);
252 int (*hw_config)(struct perf_event *event);
253 int (*schedule_events)(struct cpu_hw_events *cpuc, int n, int *assign);
254 unsigned eventsel;
255 unsigned perfctr;
256 u64 (*event_map)(int);
257 int max_events;
258 int num_counters;
259 int num_counters_fixed;
260 int cntval_bits;
261 u64 cntval_mask;
262 int apic;
263 u64 max_period;
264 struct event_constraint *
265 (*get_event_constraints)(struct cpu_hw_events *cpuc,
266 struct perf_event *event);
267
268 void (*put_event_constraints)(struct cpu_hw_events *cpuc,
269 struct perf_event *event);
270 struct event_constraint *event_constraints;
271 void (*quirks)(void);
272 int perfctr_second_write;
273
274 int (*cpu_prepare)(int cpu);
275 void (*cpu_starting)(int cpu);
276 void (*cpu_dying)(int cpu);
277 void (*cpu_dead)(int cpu);
278
279 /*
280 * Intel Arch Perfmon v2+
281 */
282 u64 intel_ctrl;
283 union perf_capabilities intel_cap;
284
285 /*
286 * Intel DebugStore bits
287 */
288 int bts, pebs;
289 int bts_active, pebs_active;
290 int pebs_record_size;
291 void (*drain_pebs)(struct pt_regs *regs);
292 struct event_constraint *pebs_constraints;
293
294 /*
295 * Intel LBR
296 */
297 unsigned long lbr_tos, lbr_from, lbr_to; /* MSR base regs */
298 int lbr_nr; /* hardware stack size */
299
300 /*
301 * Extra registers for events
302 */
303 struct extra_reg *extra_regs;
304 unsigned int er_flags;
305
306 /*
307 * Intel host/guest support (KVM)
308 */
309 struct perf_guest_switch_msr *(*guest_get_msrs)(int *nr);
310};
311
312#define ERF_NO_HT_SHARING 1
313#define ERF_HAS_RSP_1 2
314
315extern struct x86_pmu x86_pmu __read_mostly;
316
317DECLARE_PER_CPU(struct cpu_hw_events, cpu_hw_events);
318
319int x86_perf_event_set_period(struct perf_event *event);
320
321/*
322 * Generalized hw caching related hw_event table, filled
323 * in on a per model basis. A value of 0 means
324 * 'not supported', -1 means 'hw_event makes no sense on
325 * this CPU', any other value means the raw hw_event
326 * ID.
327 */
328
329#define C(x) PERF_COUNT_HW_CACHE_##x
330
331extern u64 __read_mostly hw_cache_event_ids
332 [PERF_COUNT_HW_CACHE_MAX]
333 [PERF_COUNT_HW_CACHE_OP_MAX]
334 [PERF_COUNT_HW_CACHE_RESULT_MAX];
335extern u64 __read_mostly hw_cache_extra_regs
336 [PERF_COUNT_HW_CACHE_MAX]
337 [PERF_COUNT_HW_CACHE_OP_MAX]
338 [PERF_COUNT_HW_CACHE_RESULT_MAX];
339
340u64 x86_perf_event_update(struct perf_event *event);
341
342static inline int x86_pmu_addr_offset(int index)
343{
344 int offset;
345
346 /* offset = X86_FEATURE_PERFCTR_CORE ? index << 1 : index */
347 alternative_io(ASM_NOP2,
348 "shll $1, %%eax",
349 X86_FEATURE_PERFCTR_CORE,
350 "=a" (offset),
351 "a" (index));
352
353 return offset;
354}
355
356static inline unsigned int x86_pmu_config_addr(int index)
357{
358 return x86_pmu.eventsel + x86_pmu_addr_offset(index);
359}
360
361static inline unsigned int x86_pmu_event_addr(int index)
362{
363 return x86_pmu.perfctr + x86_pmu_addr_offset(index);
364}
365
366int x86_setup_perfctr(struct perf_event *event);
367
368int x86_pmu_hw_config(struct perf_event *event);
369
370void x86_pmu_disable_all(void);
371
372static inline void __x86_pmu_enable_event(struct hw_perf_event *hwc,
373 u64 enable_mask)
374{
375 if (hwc->extra_reg.reg)
376 wrmsrl(hwc->extra_reg.reg, hwc->extra_reg.config);
377 wrmsrl(hwc->config_base, hwc->config | enable_mask);
378}
379
380void x86_pmu_enable_all(int added);
381
382int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign);
383
384void x86_pmu_stop(struct perf_event *event, int flags);
385
386static inline void x86_pmu_disable_event(struct perf_event *event)
387{
388 struct hw_perf_event *hwc = &event->hw;
389
390 wrmsrl(hwc->config_base, hwc->config);
391}
392
393void x86_pmu_enable_event(struct perf_event *event);
394
395int x86_pmu_handle_irq(struct pt_regs *regs);
396
397extern struct event_constraint emptyconstraint;
398
399extern struct event_constraint unconstrained;
400
401#ifdef CONFIG_CPU_SUP_AMD
402
403int amd_pmu_init(void);
404
405#else /* CONFIG_CPU_SUP_AMD */
406
407static inline int amd_pmu_init(void)
408{
409 return 0;
410}
411
412#endif /* CONFIG_CPU_SUP_AMD */
413
414#ifdef CONFIG_CPU_SUP_INTEL
415
416int intel_pmu_save_and_restart(struct perf_event *event);
417
418struct event_constraint *
419x86_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event);
420
421struct intel_shared_regs *allocate_shared_regs(int cpu);
422
423int intel_pmu_init(void);
424
425void init_debug_store_on_cpu(int cpu);
426
427void fini_debug_store_on_cpu(int cpu);
428
429void release_ds_buffers(void);
430
431void reserve_ds_buffers(void);
432
433extern struct event_constraint bts_constraint;
434
435void intel_pmu_enable_bts(u64 config);
436
437void intel_pmu_disable_bts(void);
438
439int intel_pmu_drain_bts_buffer(void);
440
441extern struct event_constraint intel_core2_pebs_event_constraints[];
442
443extern struct event_constraint intel_atom_pebs_event_constraints[];
444
445extern struct event_constraint intel_nehalem_pebs_event_constraints[];
446
447extern struct event_constraint intel_westmere_pebs_event_constraints[];
448
449extern struct event_constraint intel_snb_pebs_event_constraints[];
450
451struct event_constraint *intel_pebs_constraints(struct perf_event *event);
452
453void intel_pmu_pebs_enable(struct perf_event *event);
454
455void intel_pmu_pebs_disable(struct perf_event *event);
456
457void intel_pmu_pebs_enable_all(void);
458
459void intel_pmu_pebs_disable_all(void);
460
461void intel_ds_init(void);
462
463void intel_pmu_lbr_reset(void);
464
465void intel_pmu_lbr_enable(struct perf_event *event);
466
467void intel_pmu_lbr_disable(struct perf_event *event);
468
469void intel_pmu_lbr_enable_all(void);
470
471void intel_pmu_lbr_disable_all(void);
472
473void intel_pmu_lbr_read(void);
474
475void intel_pmu_lbr_init_core(void);
476
477void intel_pmu_lbr_init_nhm(void);
478
479void intel_pmu_lbr_init_atom(void);
480
481int p4_pmu_init(void);
482
483int p6_pmu_init(void);
484
485#else /* CONFIG_CPU_SUP_INTEL */
486
487static inline void reserve_ds_buffers(void)
488{
489}
490
491static inline void release_ds_buffers(void)
492{
493}
494
495static inline int intel_pmu_init(void)
496{
497 return 0;
498}
499
500static inline struct intel_shared_regs *allocate_shared_regs(int cpu)
501{
502 return NULL;
503}
504
505#endif /* CONFIG_CPU_SUP_INTEL */
diff --git a/arch/x86/kernel/cpu/perf_event_amd.c b/arch/x86/kernel/cpu/perf_event_amd.c
index 941caa2e449b..aeefd45697a2 100644
--- a/arch/x86/kernel/cpu/perf_event_amd.c
+++ b/arch/x86/kernel/cpu/perf_event_amd.c
@@ -1,4 +1,10 @@
1#ifdef CONFIG_CPU_SUP_AMD 1#include <linux/perf_event.h>
2#include <linux/types.h>
3#include <linux/init.h>
4#include <linux/slab.h>
5#include <asm/apicdef.h>
6
7#include "perf_event.h"
2 8
3static __initconst const u64 amd_hw_cache_event_ids 9static __initconst const u64 amd_hw_cache_event_ids
4 [PERF_COUNT_HW_CACHE_MAX] 10 [PERF_COUNT_HW_CACHE_MAX]
@@ -132,6 +138,19 @@ static int amd_pmu_hw_config(struct perf_event *event)
132 if (ret) 138 if (ret)
133 return ret; 139 return ret;
134 140
141 if (event->attr.exclude_host && event->attr.exclude_guest)
142 /*
143 * When HO == GO == 1 the hardware treats that as GO == HO == 0
144 * and will count in both modes. We don't want to count in that
145 * case so we emulate no-counting by setting US = OS = 0.
146 */
147 event->hw.config &= ~(ARCH_PERFMON_EVENTSEL_USR |
148 ARCH_PERFMON_EVENTSEL_OS);
149 else if (event->attr.exclude_host)
150 event->hw.config |= AMD_PERFMON_EVENTSEL_GUESTONLY;
151 else if (event->attr.exclude_guest)
152 event->hw.config |= AMD_PERFMON_EVENTSEL_HOSTONLY;
153
135 if (event->attr.type != PERF_TYPE_RAW) 154 if (event->attr.type != PERF_TYPE_RAW)
136 return 0; 155 return 0;
137 156
@@ -350,7 +369,7 @@ static void amd_pmu_cpu_starting(int cpu)
350 continue; 369 continue;
351 370
352 if (nb->nb_id == nb_id) { 371 if (nb->nb_id == nb_id) {
353 kfree(cpuc->amd_nb); 372 cpuc->kfree_on_online = cpuc->amd_nb;
354 cpuc->amd_nb = nb; 373 cpuc->amd_nb = nb;
355 break; 374 break;
356 } 375 }
@@ -392,7 +411,7 @@ static __initconst const struct x86_pmu amd_pmu = {
392 .perfctr = MSR_K7_PERFCTR0, 411 .perfctr = MSR_K7_PERFCTR0,
393 .event_map = amd_pmu_event_map, 412 .event_map = amd_pmu_event_map,
394 .max_events = ARRAY_SIZE(amd_perfmon_event_map), 413 .max_events = ARRAY_SIZE(amd_perfmon_event_map),
395 .num_counters = 4, 414 .num_counters = AMD64_NUM_COUNTERS,
396 .cntval_bits = 48, 415 .cntval_bits = 48,
397 .cntval_mask = (1ULL << 48) - 1, 416 .cntval_mask = (1ULL << 48) - 1,
398 .apic = 1, 417 .apic = 1,
@@ -556,7 +575,7 @@ static __initconst const struct x86_pmu amd_pmu_f15h = {
556 .perfctr = MSR_F15H_PERF_CTR, 575 .perfctr = MSR_F15H_PERF_CTR,
557 .event_map = amd_pmu_event_map, 576 .event_map = amd_pmu_event_map,
558 .max_events = ARRAY_SIZE(amd_perfmon_event_map), 577 .max_events = ARRAY_SIZE(amd_perfmon_event_map),
559 .num_counters = 6, 578 .num_counters = AMD64_NUM_COUNTERS_F15H,
560 .cntval_bits = 48, 579 .cntval_bits = 48,
561 .cntval_mask = (1ULL << 48) - 1, 580 .cntval_mask = (1ULL << 48) - 1,
562 .apic = 1, 581 .apic = 1,
@@ -573,7 +592,7 @@ static __initconst const struct x86_pmu amd_pmu_f15h = {
573#endif 592#endif
574}; 593};
575 594
576static __init int amd_pmu_init(void) 595__init int amd_pmu_init(void)
577{ 596{
578 /* Performance-monitoring supported from K7 and later: */ 597 /* Performance-monitoring supported from K7 and later: */
579 if (boot_cpu_data.x86 < 6) 598 if (boot_cpu_data.x86 < 6)
@@ -602,12 +621,3 @@ static __init int amd_pmu_init(void)
602 621
603 return 0; 622 return 0;
604} 623}
605
606#else /* CONFIG_CPU_SUP_AMD */
607
608static int amd_pmu_init(void)
609{
610 return 0;
611}
612
613#endif
diff --git a/arch/x86/kernel/cpu/perf_event_amd_ibs.c b/arch/x86/kernel/cpu/perf_event_amd_ibs.c
new file mode 100644
index 000000000000..ab6343d21825
--- /dev/null
+++ b/arch/x86/kernel/cpu/perf_event_amd_ibs.c
@@ -0,0 +1,294 @@
1/*
2 * Performance events - AMD IBS
3 *
4 * Copyright (C) 2011 Advanced Micro Devices, Inc., Robert Richter
5 *
6 * For licencing details see kernel-base/COPYING
7 */
8
9#include <linux/perf_event.h>
10#include <linux/module.h>
11#include <linux/pci.h>
12
13#include <asm/apic.h>
14
15static u32 ibs_caps;
16
17#if defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_AMD)
18
19static struct pmu perf_ibs;
20
21static int perf_ibs_init(struct perf_event *event)
22{
23 if (perf_ibs.type != event->attr.type)
24 return -ENOENT;
25 return 0;
26}
27
28static int perf_ibs_add(struct perf_event *event, int flags)
29{
30 return 0;
31}
32
33static void perf_ibs_del(struct perf_event *event, int flags)
34{
35}
36
37static struct pmu perf_ibs = {
38 .event_init= perf_ibs_init,
39 .add= perf_ibs_add,
40 .del= perf_ibs_del,
41};
42
43static __init int perf_event_ibs_init(void)
44{
45 if (!ibs_caps)
46 return -ENODEV; /* ibs not supported by the cpu */
47
48 perf_pmu_register(&perf_ibs, "ibs", -1);
49 printk(KERN_INFO "perf: AMD IBS detected (0x%08x)\n", ibs_caps);
50
51 return 0;
52}
53
54#else /* defined(CONFIG_PERF_EVENTS) && defined(CONFIG_CPU_SUP_AMD) */
55
56static __init int perf_event_ibs_init(void) { return 0; }
57
58#endif
59
60/* IBS - apic initialization, for perf and oprofile */
61
62static __init u32 __get_ibs_caps(void)
63{
64 u32 caps;
65 unsigned int max_level;
66
67 if (!boot_cpu_has(X86_FEATURE_IBS))
68 return 0;
69
70 /* check IBS cpuid feature flags */
71 max_level = cpuid_eax(0x80000000);
72 if (max_level < IBS_CPUID_FEATURES)
73 return IBS_CAPS_DEFAULT;
74
75 caps = cpuid_eax(IBS_CPUID_FEATURES);
76 if (!(caps & IBS_CAPS_AVAIL))
77 /* cpuid flags not valid */
78 return IBS_CAPS_DEFAULT;
79
80 return caps;
81}
82
83u32 get_ibs_caps(void)
84{
85 return ibs_caps;
86}
87
88EXPORT_SYMBOL(get_ibs_caps);
89
90static inline int get_eilvt(int offset)
91{
92 return !setup_APIC_eilvt(offset, 0, APIC_EILVT_MSG_NMI, 1);
93}
94
95static inline int put_eilvt(int offset)
96{
97 return !setup_APIC_eilvt(offset, 0, 0, 1);
98}
99
100/*
101 * Check and reserve APIC extended interrupt LVT offset for IBS if available.
102 */
103static inline int ibs_eilvt_valid(void)
104{
105 int offset;
106 u64 val;
107 int valid = 0;
108
109 preempt_disable();
110
111 rdmsrl(MSR_AMD64_IBSCTL, val);
112 offset = val & IBSCTL_LVT_OFFSET_MASK;
113
114 if (!(val & IBSCTL_LVT_OFFSET_VALID)) {
115 pr_err(FW_BUG "cpu %d, invalid IBS interrupt offset %d (MSR%08X=0x%016llx)\n",
116 smp_processor_id(), offset, MSR_AMD64_IBSCTL, val);
117 goto out;
118 }
119
120 if (!get_eilvt(offset)) {
121 pr_err(FW_BUG "cpu %d, IBS interrupt offset %d not available (MSR%08X=0x%016llx)\n",
122 smp_processor_id(), offset, MSR_AMD64_IBSCTL, val);
123 goto out;
124 }
125
126 valid = 1;
127out:
128 preempt_enable();
129
130 return valid;
131}
132
133static int setup_ibs_ctl(int ibs_eilvt_off)
134{
135 struct pci_dev *cpu_cfg;
136 int nodes;
137 u32 value = 0;
138
139 nodes = 0;
140 cpu_cfg = NULL;
141 do {
142 cpu_cfg = pci_get_device(PCI_VENDOR_ID_AMD,
143 PCI_DEVICE_ID_AMD_10H_NB_MISC,
144 cpu_cfg);
145 if (!cpu_cfg)
146 break;
147 ++nodes;
148 pci_write_config_dword(cpu_cfg, IBSCTL, ibs_eilvt_off
149 | IBSCTL_LVT_OFFSET_VALID);
150 pci_read_config_dword(cpu_cfg, IBSCTL, &value);
151 if (value != (ibs_eilvt_off | IBSCTL_LVT_OFFSET_VALID)) {
152 pci_dev_put(cpu_cfg);
153 printk(KERN_DEBUG "Failed to setup IBS LVT offset, "
154 "IBSCTL = 0x%08x\n", value);
155 return -EINVAL;
156 }
157 } while (1);
158
159 if (!nodes) {
160 printk(KERN_DEBUG "No CPU node configured for IBS\n");
161 return -ENODEV;
162 }
163
164 return 0;
165}
166
167/*
168 * This runs only on the current cpu. We try to find an LVT offset and
169 * setup the local APIC. For this we must disable preemption. On
170 * success we initialize all nodes with this offset. This updates then
171 * the offset in the IBS_CTL per-node msr. The per-core APIC setup of
172 * the IBS interrupt vector is handled by perf_ibs_cpu_notifier that
173 * is using the new offset.
174 */
175static int force_ibs_eilvt_setup(void)
176{
177 int offset;
178 int ret;
179
180 preempt_disable();
181 /* find the next free available EILVT entry, skip offset 0 */
182 for (offset = 1; offset < APIC_EILVT_NR_MAX; offset++) {
183 if (get_eilvt(offset))
184 break;
185 }
186 preempt_enable();
187
188 if (offset == APIC_EILVT_NR_MAX) {
189 printk(KERN_DEBUG "No EILVT entry available\n");
190 return -EBUSY;
191 }
192
193 ret = setup_ibs_ctl(offset);
194 if (ret)
195 goto out;
196
197 if (!ibs_eilvt_valid()) {
198 ret = -EFAULT;
199 goto out;
200 }
201
202 pr_err(FW_BUG "using offset %d for IBS interrupts\n", offset);
203 pr_err(FW_BUG "workaround enabled for IBS LVT offset\n");
204
205 return 0;
206out:
207 preempt_disable();
208 put_eilvt(offset);
209 preempt_enable();
210 return ret;
211}
212
213static inline int get_ibs_lvt_offset(void)
214{
215 u64 val;
216
217 rdmsrl(MSR_AMD64_IBSCTL, val);
218 if (!(val & IBSCTL_LVT_OFFSET_VALID))
219 return -EINVAL;
220
221 return val & IBSCTL_LVT_OFFSET_MASK;
222}
223
224static void setup_APIC_ibs(void *dummy)
225{
226 int offset;
227
228 offset = get_ibs_lvt_offset();
229 if (offset < 0)
230 goto failed;
231
232 if (!setup_APIC_eilvt(offset, 0, APIC_EILVT_MSG_NMI, 0))
233 return;
234failed:
235 pr_warn("perf: IBS APIC setup failed on cpu #%d\n",
236 smp_processor_id());
237}
238
239static void clear_APIC_ibs(void *dummy)
240{
241 int offset;
242
243 offset = get_ibs_lvt_offset();
244 if (offset >= 0)
245 setup_APIC_eilvt(offset, 0, APIC_EILVT_MSG_FIX, 1);
246}
247
248static int __cpuinit
249perf_ibs_cpu_notifier(struct notifier_block *self, unsigned long action, void *hcpu)
250{
251 switch (action & ~CPU_TASKS_FROZEN) {
252 case CPU_STARTING:
253 setup_APIC_ibs(NULL);
254 break;
255 case CPU_DYING:
256 clear_APIC_ibs(NULL);
257 break;
258 default:
259 break;
260 }
261
262 return NOTIFY_OK;
263}
264
265static __init int amd_ibs_init(void)
266{
267 u32 caps;
268 int ret;
269
270 caps = __get_ibs_caps();
271 if (!caps)
272 return -ENODEV; /* ibs not supported by the cpu */
273
274 if (!ibs_eilvt_valid()) {
275 ret = force_ibs_eilvt_setup();
276 if (ret) {
277 pr_err("Failed to setup IBS, %d\n", ret);
278 return ret;
279 }
280 }
281
282 get_online_cpus();
283 ibs_caps = caps;
284 /* make ibs_caps visible to other cpus: */
285 smp_mb();
286 perf_cpu_notifier(perf_ibs_cpu_notifier);
287 smp_call_function(setup_APIC_ibs, NULL, 1);
288 put_online_cpus();
289
290 return perf_event_ibs_init();
291}
292
293/* Since we need the pci subsystem to init ibs we can't do this earlier: */
294device_initcall(amd_ibs_init);
diff --git a/arch/x86/kernel/cpu/perf_event_intel.c b/arch/x86/kernel/cpu/perf_event_intel.c
index f88af2c2a561..e09ca20e86ee 100644
--- a/arch/x86/kernel/cpu/perf_event_intel.c
+++ b/arch/x86/kernel/cpu/perf_event_intel.c
@@ -1,16 +1,19 @@
1#ifdef CONFIG_CPU_SUP_INTEL
2
3/* 1/*
4 * Per core/cpu state 2 * Per core/cpu state
5 * 3 *
6 * Used to coordinate shared registers between HT threads or 4 * Used to coordinate shared registers between HT threads or
7 * among events on a single PMU. 5 * among events on a single PMU.
8 */ 6 */
9struct intel_shared_regs { 7
10 struct er_account regs[EXTRA_REG_MAX]; 8#include <linux/stddef.h>
11 int refcnt; /* per-core: #HT threads */ 9#include <linux/types.h>
12 unsigned core_id; /* per-core: core id */ 10#include <linux/init.h>
13}; 11#include <linux/slab.h>
12
13#include <asm/hardirq.h>
14#include <asm/apic.h>
15
16#include "perf_event.h"
14 17
15/* 18/*
16 * Intel PerfMon, used on Core and later. 19 * Intel PerfMon, used on Core and later.
@@ -746,7 +749,8 @@ static void intel_pmu_enable_all(int added)
746 749
747 intel_pmu_pebs_enable_all(); 750 intel_pmu_pebs_enable_all();
748 intel_pmu_lbr_enable_all(); 751 intel_pmu_lbr_enable_all();
749 wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL, x86_pmu.intel_ctrl); 752 wrmsrl(MSR_CORE_PERF_GLOBAL_CTRL,
753 x86_pmu.intel_ctrl & ~cpuc->intel_ctrl_guest_mask);
750 754
751 if (test_bit(X86_PMC_IDX_FIXED_BTS, cpuc->active_mask)) { 755 if (test_bit(X86_PMC_IDX_FIXED_BTS, cpuc->active_mask)) {
752 struct perf_event *event = 756 struct perf_event *event =
@@ -869,6 +873,7 @@ static void intel_pmu_disable_fixed(struct hw_perf_event *hwc)
869static void intel_pmu_disable_event(struct perf_event *event) 873static void intel_pmu_disable_event(struct perf_event *event)
870{ 874{
871 struct hw_perf_event *hwc = &event->hw; 875 struct hw_perf_event *hwc = &event->hw;
876 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
872 877
873 if (unlikely(hwc->idx == X86_PMC_IDX_FIXED_BTS)) { 878 if (unlikely(hwc->idx == X86_PMC_IDX_FIXED_BTS)) {
874 intel_pmu_disable_bts(); 879 intel_pmu_disable_bts();
@@ -876,6 +881,9 @@ static void intel_pmu_disable_event(struct perf_event *event)
876 return; 881 return;
877 } 882 }
878 883
884 cpuc->intel_ctrl_guest_mask &= ~(1ull << hwc->idx);
885 cpuc->intel_ctrl_host_mask &= ~(1ull << hwc->idx);
886
879 if (unlikely(hwc->config_base == MSR_ARCH_PERFMON_FIXED_CTR_CTRL)) { 887 if (unlikely(hwc->config_base == MSR_ARCH_PERFMON_FIXED_CTR_CTRL)) {
880 intel_pmu_disable_fixed(hwc); 888 intel_pmu_disable_fixed(hwc);
881 return; 889 return;
@@ -921,6 +929,7 @@ static void intel_pmu_enable_fixed(struct hw_perf_event *hwc)
921static void intel_pmu_enable_event(struct perf_event *event) 929static void intel_pmu_enable_event(struct perf_event *event)
922{ 930{
923 struct hw_perf_event *hwc = &event->hw; 931 struct hw_perf_event *hwc = &event->hw;
932 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
924 933
925 if (unlikely(hwc->idx == X86_PMC_IDX_FIXED_BTS)) { 934 if (unlikely(hwc->idx == X86_PMC_IDX_FIXED_BTS)) {
926 if (!__this_cpu_read(cpu_hw_events.enabled)) 935 if (!__this_cpu_read(cpu_hw_events.enabled))
@@ -930,6 +939,11 @@ static void intel_pmu_enable_event(struct perf_event *event)
930 return; 939 return;
931 } 940 }
932 941
942 if (event->attr.exclude_host)
943 cpuc->intel_ctrl_guest_mask |= (1ull << hwc->idx);
944 if (event->attr.exclude_guest)
945 cpuc->intel_ctrl_host_mask |= (1ull << hwc->idx);
946
933 if (unlikely(hwc->config_base == MSR_ARCH_PERFMON_FIXED_CTR_CTRL)) { 947 if (unlikely(hwc->config_base == MSR_ARCH_PERFMON_FIXED_CTR_CTRL)) {
934 intel_pmu_enable_fixed(hwc); 948 intel_pmu_enable_fixed(hwc);
935 return; 949 return;
@@ -945,7 +959,7 @@ static void intel_pmu_enable_event(struct perf_event *event)
945 * Save and restart an expired event. Called by NMI contexts, 959 * Save and restart an expired event. Called by NMI contexts,
946 * so it has to be careful about preempting normal event ops: 960 * so it has to be careful about preempting normal event ops:
947 */ 961 */
948static int intel_pmu_save_and_restart(struct perf_event *event) 962int intel_pmu_save_and_restart(struct perf_event *event)
949{ 963{
950 x86_perf_event_update(event); 964 x86_perf_event_update(event);
951 return x86_perf_event_set_period(event); 965 return x86_perf_event_set_period(event);
@@ -1197,6 +1211,21 @@ intel_shared_regs_constraints(struct cpu_hw_events *cpuc,
1197 return c; 1211 return c;
1198} 1212}
1199 1213
1214struct event_constraint *
1215x86_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event)
1216{
1217 struct event_constraint *c;
1218
1219 if (x86_pmu.event_constraints) {
1220 for_each_event_constraint(c, x86_pmu.event_constraints) {
1221 if ((event->hw.config & c->cmask) == c->code)
1222 return c;
1223 }
1224 }
1225
1226 return &unconstrained;
1227}
1228
1200static struct event_constraint * 1229static struct event_constraint *
1201intel_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event) 1230intel_get_event_constraints(struct cpu_hw_events *cpuc, struct perf_event *event)
1202{ 1231{
@@ -1284,12 +1313,84 @@ static int intel_pmu_hw_config(struct perf_event *event)
1284 return 0; 1313 return 0;
1285} 1314}
1286 1315
1316struct perf_guest_switch_msr *perf_guest_get_msrs(int *nr)
1317{
1318 if (x86_pmu.guest_get_msrs)
1319 return x86_pmu.guest_get_msrs(nr);
1320 *nr = 0;
1321 return NULL;
1322}
1323EXPORT_SYMBOL_GPL(perf_guest_get_msrs);
1324
1325static struct perf_guest_switch_msr *intel_guest_get_msrs(int *nr)
1326{
1327 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
1328 struct perf_guest_switch_msr *arr = cpuc->guest_switch_msrs;
1329
1330 arr[0].msr = MSR_CORE_PERF_GLOBAL_CTRL;
1331 arr[0].host = x86_pmu.intel_ctrl & ~cpuc->intel_ctrl_guest_mask;
1332 arr[0].guest = x86_pmu.intel_ctrl & ~cpuc->intel_ctrl_host_mask;
1333
1334 *nr = 1;
1335 return arr;
1336}
1337
1338static struct perf_guest_switch_msr *core_guest_get_msrs(int *nr)
1339{
1340 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
1341 struct perf_guest_switch_msr *arr = cpuc->guest_switch_msrs;
1342 int idx;
1343
1344 for (idx = 0; idx < x86_pmu.num_counters; idx++) {
1345 struct perf_event *event = cpuc->events[idx];
1346
1347 arr[idx].msr = x86_pmu_config_addr(idx);
1348 arr[idx].host = arr[idx].guest = 0;
1349
1350 if (!test_bit(idx, cpuc->active_mask))
1351 continue;
1352
1353 arr[idx].host = arr[idx].guest =
1354 event->hw.config | ARCH_PERFMON_EVENTSEL_ENABLE;
1355
1356 if (event->attr.exclude_host)
1357 arr[idx].host &= ~ARCH_PERFMON_EVENTSEL_ENABLE;
1358 else if (event->attr.exclude_guest)
1359 arr[idx].guest &= ~ARCH_PERFMON_EVENTSEL_ENABLE;
1360 }
1361
1362 *nr = x86_pmu.num_counters;
1363 return arr;
1364}
1365
1366static void core_pmu_enable_event(struct perf_event *event)
1367{
1368 if (!event->attr.exclude_host)
1369 x86_pmu_enable_event(event);
1370}
1371
1372static void core_pmu_enable_all(int added)
1373{
1374 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
1375 int idx;
1376
1377 for (idx = 0; idx < x86_pmu.num_counters; idx++) {
1378 struct hw_perf_event *hwc = &cpuc->events[idx]->hw;
1379
1380 if (!test_bit(idx, cpuc->active_mask) ||
1381 cpuc->events[idx]->attr.exclude_host)
1382 continue;
1383
1384 __x86_pmu_enable_event(hwc, ARCH_PERFMON_EVENTSEL_ENABLE);
1385 }
1386}
1387
1287static __initconst const struct x86_pmu core_pmu = { 1388static __initconst const struct x86_pmu core_pmu = {
1288 .name = "core", 1389 .name = "core",
1289 .handle_irq = x86_pmu_handle_irq, 1390 .handle_irq = x86_pmu_handle_irq,
1290 .disable_all = x86_pmu_disable_all, 1391 .disable_all = x86_pmu_disable_all,
1291 .enable_all = x86_pmu_enable_all, 1392 .enable_all = core_pmu_enable_all,
1292 .enable = x86_pmu_enable_event, 1393 .enable = core_pmu_enable_event,
1293 .disable = x86_pmu_disable_event, 1394 .disable = x86_pmu_disable_event,
1294 .hw_config = x86_pmu_hw_config, 1395 .hw_config = x86_pmu_hw_config,
1295 .schedule_events = x86_schedule_events, 1396 .schedule_events = x86_schedule_events,
@@ -1307,9 +1408,10 @@ static __initconst const struct x86_pmu core_pmu = {
1307 .get_event_constraints = intel_get_event_constraints, 1408 .get_event_constraints = intel_get_event_constraints,
1308 .put_event_constraints = intel_put_event_constraints, 1409 .put_event_constraints = intel_put_event_constraints,
1309 .event_constraints = intel_core_event_constraints, 1410 .event_constraints = intel_core_event_constraints,
1411 .guest_get_msrs = core_guest_get_msrs,
1310}; 1412};
1311 1413
1312static struct intel_shared_regs *allocate_shared_regs(int cpu) 1414struct intel_shared_regs *allocate_shared_regs(int cpu)
1313{ 1415{
1314 struct intel_shared_regs *regs; 1416 struct intel_shared_regs *regs;
1315 int i; 1417 int i;
@@ -1362,7 +1464,7 @@ static void intel_pmu_cpu_starting(int cpu)
1362 1464
1363 pc = per_cpu(cpu_hw_events, i).shared_regs; 1465 pc = per_cpu(cpu_hw_events, i).shared_regs;
1364 if (pc && pc->core_id == core_id) { 1466 if (pc && pc->core_id == core_id) {
1365 kfree(cpuc->shared_regs); 1467 cpuc->kfree_on_online = cpuc->shared_regs;
1366 cpuc->shared_regs = pc; 1468 cpuc->shared_regs = pc;
1367 break; 1469 break;
1368 } 1470 }
@@ -1413,6 +1515,7 @@ static __initconst const struct x86_pmu intel_pmu = {
1413 .cpu_prepare = intel_pmu_cpu_prepare, 1515 .cpu_prepare = intel_pmu_cpu_prepare,
1414 .cpu_starting = intel_pmu_cpu_starting, 1516 .cpu_starting = intel_pmu_cpu_starting,
1415 .cpu_dying = intel_pmu_cpu_dying, 1517 .cpu_dying = intel_pmu_cpu_dying,
1518 .guest_get_msrs = intel_guest_get_msrs,
1416}; 1519};
1417 1520
1418static void intel_clovertown_quirks(void) 1521static void intel_clovertown_quirks(void)
@@ -1441,7 +1544,7 @@ static void intel_clovertown_quirks(void)
1441 x86_pmu.pebs_constraints = NULL; 1544 x86_pmu.pebs_constraints = NULL;
1442} 1545}
1443 1546
1444static __init int intel_pmu_init(void) 1547__init int intel_pmu_init(void)
1445{ 1548{
1446 union cpuid10_edx edx; 1549 union cpuid10_edx edx;
1447 union cpuid10_eax eax; 1550 union cpuid10_eax eax;
@@ -1597,7 +1700,7 @@ static __init int intel_pmu_init(void)
1597 intel_pmu_lbr_init_nhm(); 1700 intel_pmu_lbr_init_nhm();
1598 1701
1599 x86_pmu.event_constraints = intel_snb_event_constraints; 1702 x86_pmu.event_constraints = intel_snb_event_constraints;
1600 x86_pmu.pebs_constraints = intel_snb_pebs_events; 1703 x86_pmu.pebs_constraints = intel_snb_pebs_event_constraints;
1601 x86_pmu.extra_regs = intel_snb_extra_regs; 1704 x86_pmu.extra_regs = intel_snb_extra_regs;
1602 /* all extra regs are per-cpu when HT is on */ 1705 /* all extra regs are per-cpu when HT is on */
1603 x86_pmu.er_flags |= ERF_HAS_RSP_1; 1706 x86_pmu.er_flags |= ERF_HAS_RSP_1;
@@ -1628,16 +1731,3 @@ static __init int intel_pmu_init(void)
1628 } 1731 }
1629 return 0; 1732 return 0;
1630} 1733}
1631
1632#else /* CONFIG_CPU_SUP_INTEL */
1633
1634static int intel_pmu_init(void)
1635{
1636 return 0;
1637}
1638
1639static struct intel_shared_regs *allocate_shared_regs(int cpu)
1640{
1641 return NULL;
1642}
1643#endif /* CONFIG_CPU_SUP_INTEL */
diff --git a/arch/x86/kernel/cpu/perf_event_intel_ds.c b/arch/x86/kernel/cpu/perf_event_intel_ds.c
index 1b1ef3addcfd..c0d238f49db8 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_ds.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_ds.c
@@ -1,7 +1,10 @@
1#ifdef CONFIG_CPU_SUP_INTEL 1#include <linux/bitops.h>
2#include <linux/types.h>
3#include <linux/slab.h>
2 4
3/* The maximal number of PEBS events: */ 5#include <asm/perf_event.h>
4#define MAX_PEBS_EVENTS 4 6
7#include "perf_event.h"
5 8
6/* The size of a BTS record in bytes: */ 9/* The size of a BTS record in bytes: */
7#define BTS_RECORD_SIZE 24 10#define BTS_RECORD_SIZE 24
@@ -37,24 +40,7 @@ struct pebs_record_nhm {
37 u64 status, dla, dse, lat; 40 u64 status, dla, dse, lat;
38}; 41};
39 42
40/* 43void init_debug_store_on_cpu(int cpu)
41 * A debug store configuration.
42 *
43 * We only support architectures that use 64bit fields.
44 */
45struct debug_store {
46 u64 bts_buffer_base;
47 u64 bts_index;
48 u64 bts_absolute_maximum;
49 u64 bts_interrupt_threshold;
50 u64 pebs_buffer_base;
51 u64 pebs_index;
52 u64 pebs_absolute_maximum;
53 u64 pebs_interrupt_threshold;
54 u64 pebs_event_reset[MAX_PEBS_EVENTS];
55};
56
57static void init_debug_store_on_cpu(int cpu)
58{ 44{
59 struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds; 45 struct debug_store *ds = per_cpu(cpu_hw_events, cpu).ds;
60 46
@@ -66,7 +52,7 @@ static void init_debug_store_on_cpu(int cpu)
66 (u32)((u64)(unsigned long)ds >> 32)); 52 (u32)((u64)(unsigned long)ds >> 32));
67} 53}
68 54
69static void fini_debug_store_on_cpu(int cpu) 55void fini_debug_store_on_cpu(int cpu)
70{ 56{
71 if (!per_cpu(cpu_hw_events, cpu).ds) 57 if (!per_cpu(cpu_hw_events, cpu).ds)
72 return; 58 return;
@@ -175,7 +161,7 @@ static void release_ds_buffer(int cpu)
175 kfree(ds); 161 kfree(ds);
176} 162}
177 163
178static void release_ds_buffers(void) 164void release_ds_buffers(void)
179{ 165{
180 int cpu; 166 int cpu;
181 167
@@ -194,7 +180,7 @@ static void release_ds_buffers(void)
194 put_online_cpus(); 180 put_online_cpus();
195} 181}
196 182
197static void reserve_ds_buffers(void) 183void reserve_ds_buffers(void)
198{ 184{
199 int bts_err = 0, pebs_err = 0; 185 int bts_err = 0, pebs_err = 0;
200 int cpu; 186 int cpu;
@@ -260,10 +246,10 @@ static void reserve_ds_buffers(void)
260 * BTS 246 * BTS
261 */ 247 */
262 248
263static struct event_constraint bts_constraint = 249struct event_constraint bts_constraint =
264 EVENT_CONSTRAINT(0, 1ULL << X86_PMC_IDX_FIXED_BTS, 0); 250 EVENT_CONSTRAINT(0, 1ULL << X86_PMC_IDX_FIXED_BTS, 0);
265 251
266static void intel_pmu_enable_bts(u64 config) 252void intel_pmu_enable_bts(u64 config)
267{ 253{
268 unsigned long debugctlmsr; 254 unsigned long debugctlmsr;
269 255
@@ -282,7 +268,7 @@ static void intel_pmu_enable_bts(u64 config)
282 update_debugctlmsr(debugctlmsr); 268 update_debugctlmsr(debugctlmsr);
283} 269}
284 270
285static void intel_pmu_disable_bts(void) 271void intel_pmu_disable_bts(void)
286{ 272{
287 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 273 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
288 unsigned long debugctlmsr; 274 unsigned long debugctlmsr;
@@ -299,7 +285,7 @@ static void intel_pmu_disable_bts(void)
299 update_debugctlmsr(debugctlmsr); 285 update_debugctlmsr(debugctlmsr);
300} 286}
301 287
302static int intel_pmu_drain_bts_buffer(void) 288int intel_pmu_drain_bts_buffer(void)
303{ 289{
304 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 290 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
305 struct debug_store *ds = cpuc->ds; 291 struct debug_store *ds = cpuc->ds;
@@ -361,7 +347,7 @@ static int intel_pmu_drain_bts_buffer(void)
361/* 347/*
362 * PEBS 348 * PEBS
363 */ 349 */
364static struct event_constraint intel_core2_pebs_event_constraints[] = { 350struct event_constraint intel_core2_pebs_event_constraints[] = {
365 INTEL_UEVENT_CONSTRAINT(0x00c0, 0x1), /* INST_RETIRED.ANY */ 351 INTEL_UEVENT_CONSTRAINT(0x00c0, 0x1), /* INST_RETIRED.ANY */
366 INTEL_UEVENT_CONSTRAINT(0xfec1, 0x1), /* X87_OPS_RETIRED.ANY */ 352 INTEL_UEVENT_CONSTRAINT(0xfec1, 0x1), /* X87_OPS_RETIRED.ANY */
367 INTEL_UEVENT_CONSTRAINT(0x00c5, 0x1), /* BR_INST_RETIRED.MISPRED */ 353 INTEL_UEVENT_CONSTRAINT(0x00c5, 0x1), /* BR_INST_RETIRED.MISPRED */
@@ -370,14 +356,14 @@ static struct event_constraint intel_core2_pebs_event_constraints[] = {
370 EVENT_CONSTRAINT_END 356 EVENT_CONSTRAINT_END
371}; 357};
372 358
373static struct event_constraint intel_atom_pebs_event_constraints[] = { 359struct event_constraint intel_atom_pebs_event_constraints[] = {
374 INTEL_UEVENT_CONSTRAINT(0x00c0, 0x1), /* INST_RETIRED.ANY */ 360 INTEL_UEVENT_CONSTRAINT(0x00c0, 0x1), /* INST_RETIRED.ANY */
375 INTEL_UEVENT_CONSTRAINT(0x00c5, 0x1), /* MISPREDICTED_BRANCH_RETIRED */ 361 INTEL_UEVENT_CONSTRAINT(0x00c5, 0x1), /* MISPREDICTED_BRANCH_RETIRED */
376 INTEL_EVENT_CONSTRAINT(0xcb, 0x1), /* MEM_LOAD_RETIRED.* */ 362 INTEL_EVENT_CONSTRAINT(0xcb, 0x1), /* MEM_LOAD_RETIRED.* */
377 EVENT_CONSTRAINT_END 363 EVENT_CONSTRAINT_END
378}; 364};
379 365
380static struct event_constraint intel_nehalem_pebs_event_constraints[] = { 366struct event_constraint intel_nehalem_pebs_event_constraints[] = {
381 INTEL_EVENT_CONSTRAINT(0x0b, 0xf), /* MEM_INST_RETIRED.* */ 367 INTEL_EVENT_CONSTRAINT(0x0b, 0xf), /* MEM_INST_RETIRED.* */
382 INTEL_EVENT_CONSTRAINT(0x0f, 0xf), /* MEM_UNCORE_RETIRED.* */ 368 INTEL_EVENT_CONSTRAINT(0x0f, 0xf), /* MEM_UNCORE_RETIRED.* */
383 INTEL_UEVENT_CONSTRAINT(0x010c, 0xf), /* MEM_STORE_RETIRED.DTLB_MISS */ 369 INTEL_UEVENT_CONSTRAINT(0x010c, 0xf), /* MEM_STORE_RETIRED.DTLB_MISS */
@@ -392,7 +378,7 @@ static struct event_constraint intel_nehalem_pebs_event_constraints[] = {
392 EVENT_CONSTRAINT_END 378 EVENT_CONSTRAINT_END
393}; 379};
394 380
395static struct event_constraint intel_westmere_pebs_event_constraints[] = { 381struct event_constraint intel_westmere_pebs_event_constraints[] = {
396 INTEL_EVENT_CONSTRAINT(0x0b, 0xf), /* MEM_INST_RETIRED.* */ 382 INTEL_EVENT_CONSTRAINT(0x0b, 0xf), /* MEM_INST_RETIRED.* */
397 INTEL_EVENT_CONSTRAINT(0x0f, 0xf), /* MEM_UNCORE_RETIRED.* */ 383 INTEL_EVENT_CONSTRAINT(0x0f, 0xf), /* MEM_UNCORE_RETIRED.* */
398 INTEL_UEVENT_CONSTRAINT(0x010c, 0xf), /* MEM_STORE_RETIRED.DTLB_MISS */ 384 INTEL_UEVENT_CONSTRAINT(0x010c, 0xf), /* MEM_STORE_RETIRED.DTLB_MISS */
@@ -407,7 +393,7 @@ static struct event_constraint intel_westmere_pebs_event_constraints[] = {
407 EVENT_CONSTRAINT_END 393 EVENT_CONSTRAINT_END
408}; 394};
409 395
410static struct event_constraint intel_snb_pebs_events[] = { 396struct event_constraint intel_snb_pebs_event_constraints[] = {
411 INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PRECDIST */ 397 INTEL_UEVENT_CONSTRAINT(0x01c0, 0x2), /* INST_RETIRED.PRECDIST */
412 INTEL_UEVENT_CONSTRAINT(0x01c2, 0xf), /* UOPS_RETIRED.ALL */ 398 INTEL_UEVENT_CONSTRAINT(0x01c2, 0xf), /* UOPS_RETIRED.ALL */
413 INTEL_UEVENT_CONSTRAINT(0x02c2, 0xf), /* UOPS_RETIRED.RETIRE_SLOTS */ 399 INTEL_UEVENT_CONSTRAINT(0x02c2, 0xf), /* UOPS_RETIRED.RETIRE_SLOTS */
@@ -428,8 +414,7 @@ static struct event_constraint intel_snb_pebs_events[] = {
428 EVENT_CONSTRAINT_END 414 EVENT_CONSTRAINT_END
429}; 415};
430 416
431static struct event_constraint * 417struct event_constraint *intel_pebs_constraints(struct perf_event *event)
432intel_pebs_constraints(struct perf_event *event)
433{ 418{
434 struct event_constraint *c; 419 struct event_constraint *c;
435 420
@@ -446,7 +431,7 @@ intel_pebs_constraints(struct perf_event *event)
446 return &emptyconstraint; 431 return &emptyconstraint;
447} 432}
448 433
449static void intel_pmu_pebs_enable(struct perf_event *event) 434void intel_pmu_pebs_enable(struct perf_event *event)
450{ 435{
451 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 436 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
452 struct hw_perf_event *hwc = &event->hw; 437 struct hw_perf_event *hwc = &event->hw;
@@ -460,7 +445,7 @@ static void intel_pmu_pebs_enable(struct perf_event *event)
460 intel_pmu_lbr_enable(event); 445 intel_pmu_lbr_enable(event);
461} 446}
462 447
463static void intel_pmu_pebs_disable(struct perf_event *event) 448void intel_pmu_pebs_disable(struct perf_event *event)
464{ 449{
465 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 450 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
466 struct hw_perf_event *hwc = &event->hw; 451 struct hw_perf_event *hwc = &event->hw;
@@ -475,7 +460,7 @@ static void intel_pmu_pebs_disable(struct perf_event *event)
475 intel_pmu_lbr_disable(event); 460 intel_pmu_lbr_disable(event);
476} 461}
477 462
478static void intel_pmu_pebs_enable_all(void) 463void intel_pmu_pebs_enable_all(void)
479{ 464{
480 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 465 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
481 466
@@ -483,7 +468,7 @@ static void intel_pmu_pebs_enable_all(void)
483 wrmsrl(MSR_IA32_PEBS_ENABLE, cpuc->pebs_enabled); 468 wrmsrl(MSR_IA32_PEBS_ENABLE, cpuc->pebs_enabled);
484} 469}
485 470
486static void intel_pmu_pebs_disable_all(void) 471void intel_pmu_pebs_disable_all(void)
487{ 472{
488 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 473 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
489 474
@@ -576,8 +561,6 @@ static int intel_pmu_pebs_fixup_ip(struct pt_regs *regs)
576 return 0; 561 return 0;
577} 562}
578 563
579static int intel_pmu_save_and_restart(struct perf_event *event);
580
581static void __intel_pmu_pebs_event(struct perf_event *event, 564static void __intel_pmu_pebs_event(struct perf_event *event,
582 struct pt_regs *iregs, void *__pebs) 565 struct pt_regs *iregs, void *__pebs)
583{ 566{
@@ -716,7 +699,7 @@ static void intel_pmu_drain_pebs_nhm(struct pt_regs *iregs)
716 * BTS, PEBS probe and setup 699 * BTS, PEBS probe and setup
717 */ 700 */
718 701
719static void intel_ds_init(void) 702void intel_ds_init(void)
720{ 703{
721 /* 704 /*
722 * No support for 32bit formats 705 * No support for 32bit formats
@@ -749,15 +732,3 @@ static void intel_ds_init(void)
749 } 732 }
750 } 733 }
751} 734}
752
753#else /* CONFIG_CPU_SUP_INTEL */
754
755static void reserve_ds_buffers(void)
756{
757}
758
759static void release_ds_buffers(void)
760{
761}
762
763#endif /* CONFIG_CPU_SUP_INTEL */
diff --git a/arch/x86/kernel/cpu/perf_event_intel_lbr.c b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
index d202c1bece1a..3fab3de3ce96 100644
--- a/arch/x86/kernel/cpu/perf_event_intel_lbr.c
+++ b/arch/x86/kernel/cpu/perf_event_intel_lbr.c
@@ -1,4 +1,10 @@
1#ifdef CONFIG_CPU_SUP_INTEL 1#include <linux/perf_event.h>
2#include <linux/types.h>
3
4#include <asm/perf_event.h>
5#include <asm/msr.h>
6
7#include "perf_event.h"
2 8
3enum { 9enum {
4 LBR_FORMAT_32 = 0x00, 10 LBR_FORMAT_32 = 0x00,
@@ -48,7 +54,7 @@ static void intel_pmu_lbr_reset_64(void)
48 } 54 }
49} 55}
50 56
51static void intel_pmu_lbr_reset(void) 57void intel_pmu_lbr_reset(void)
52{ 58{
53 if (!x86_pmu.lbr_nr) 59 if (!x86_pmu.lbr_nr)
54 return; 60 return;
@@ -59,7 +65,7 @@ static void intel_pmu_lbr_reset(void)
59 intel_pmu_lbr_reset_64(); 65 intel_pmu_lbr_reset_64();
60} 66}
61 67
62static void intel_pmu_lbr_enable(struct perf_event *event) 68void intel_pmu_lbr_enable(struct perf_event *event)
63{ 69{
64 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 70 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
65 71
@@ -81,7 +87,7 @@ static void intel_pmu_lbr_enable(struct perf_event *event)
81 cpuc->lbr_users++; 87 cpuc->lbr_users++;
82} 88}
83 89
84static void intel_pmu_lbr_disable(struct perf_event *event) 90void intel_pmu_lbr_disable(struct perf_event *event)
85{ 91{
86 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 92 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
87 93
@@ -95,7 +101,7 @@ static void intel_pmu_lbr_disable(struct perf_event *event)
95 __intel_pmu_lbr_disable(); 101 __intel_pmu_lbr_disable();
96} 102}
97 103
98static void intel_pmu_lbr_enable_all(void) 104void intel_pmu_lbr_enable_all(void)
99{ 105{
100 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 106 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
101 107
@@ -103,7 +109,7 @@ static void intel_pmu_lbr_enable_all(void)
103 __intel_pmu_lbr_enable(); 109 __intel_pmu_lbr_enable();
104} 110}
105 111
106static void intel_pmu_lbr_disable_all(void) 112void intel_pmu_lbr_disable_all(void)
107{ 113{
108 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 114 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
109 115
@@ -178,7 +184,7 @@ static void intel_pmu_lbr_read_64(struct cpu_hw_events *cpuc)
178 cpuc->lbr_stack.nr = i; 184 cpuc->lbr_stack.nr = i;
179} 185}
180 186
181static void intel_pmu_lbr_read(void) 187void intel_pmu_lbr_read(void)
182{ 188{
183 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 189 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
184 190
@@ -191,7 +197,7 @@ static void intel_pmu_lbr_read(void)
191 intel_pmu_lbr_read_64(cpuc); 197 intel_pmu_lbr_read_64(cpuc);
192} 198}
193 199
194static void intel_pmu_lbr_init_core(void) 200void intel_pmu_lbr_init_core(void)
195{ 201{
196 x86_pmu.lbr_nr = 4; 202 x86_pmu.lbr_nr = 4;
197 x86_pmu.lbr_tos = 0x01c9; 203 x86_pmu.lbr_tos = 0x01c9;
@@ -199,7 +205,7 @@ static void intel_pmu_lbr_init_core(void)
199 x86_pmu.lbr_to = 0x60; 205 x86_pmu.lbr_to = 0x60;
200} 206}
201 207
202static void intel_pmu_lbr_init_nhm(void) 208void intel_pmu_lbr_init_nhm(void)
203{ 209{
204 x86_pmu.lbr_nr = 16; 210 x86_pmu.lbr_nr = 16;
205 x86_pmu.lbr_tos = 0x01c9; 211 x86_pmu.lbr_tos = 0x01c9;
@@ -207,12 +213,10 @@ static void intel_pmu_lbr_init_nhm(void)
207 x86_pmu.lbr_to = 0x6c0; 213 x86_pmu.lbr_to = 0x6c0;
208} 214}
209 215
210static void intel_pmu_lbr_init_atom(void) 216void intel_pmu_lbr_init_atom(void)
211{ 217{
212 x86_pmu.lbr_nr = 8; 218 x86_pmu.lbr_nr = 8;
213 x86_pmu.lbr_tos = 0x01c9; 219 x86_pmu.lbr_tos = 0x01c9;
214 x86_pmu.lbr_from = 0x40; 220 x86_pmu.lbr_from = 0x40;
215 x86_pmu.lbr_to = 0x60; 221 x86_pmu.lbr_to = 0x60;
216} 222}
217
218#endif /* CONFIG_CPU_SUP_INTEL */
diff --git a/arch/x86/kernel/cpu/perf_event_p4.c b/arch/x86/kernel/cpu/perf_event_p4.c
index 7809d2bcb209..492bf1358a7c 100644
--- a/arch/x86/kernel/cpu/perf_event_p4.c
+++ b/arch/x86/kernel/cpu/perf_event_p4.c
@@ -7,9 +7,13 @@
7 * For licencing details see kernel-base/COPYING 7 * For licencing details see kernel-base/COPYING
8 */ 8 */
9 9
10#ifdef CONFIG_CPU_SUP_INTEL 10#include <linux/perf_event.h>
11 11
12#include <asm/perf_event_p4.h> 12#include <asm/perf_event_p4.h>
13#include <asm/hardirq.h>
14#include <asm/apic.h>
15
16#include "perf_event.h"
13 17
14#define P4_CNTR_LIMIT 3 18#define P4_CNTR_LIMIT 3
15/* 19/*
@@ -1303,7 +1307,7 @@ static __initconst const struct x86_pmu p4_pmu = {
1303 .perfctr_second_write = 1, 1307 .perfctr_second_write = 1,
1304}; 1308};
1305 1309
1306static __init int p4_pmu_init(void) 1310__init int p4_pmu_init(void)
1307{ 1311{
1308 unsigned int low, high; 1312 unsigned int low, high;
1309 1313
@@ -1326,5 +1330,3 @@ static __init int p4_pmu_init(void)
1326 1330
1327 return 0; 1331 return 0;
1328} 1332}
1329
1330#endif /* CONFIG_CPU_SUP_INTEL */
diff --git a/arch/x86/kernel/cpu/perf_event_p6.c b/arch/x86/kernel/cpu/perf_event_p6.c
index 20c097e33860..c7181befecde 100644
--- a/arch/x86/kernel/cpu/perf_event_p6.c
+++ b/arch/x86/kernel/cpu/perf_event_p6.c
@@ -1,4 +1,7 @@
1#ifdef CONFIG_CPU_SUP_INTEL 1#include <linux/perf_event.h>
2#include <linux/types.h>
3
4#include "perf_event.h"
2 5
3/* 6/*
4 * Not sure about some of these 7 * Not sure about some of these
@@ -114,7 +117,7 @@ static __initconst const struct x86_pmu p6_pmu = {
114 .event_constraints = p6_event_constraints, 117 .event_constraints = p6_event_constraints,
115}; 118};
116 119
117static __init int p6_pmu_init(void) 120__init int p6_pmu_init(void)
118{ 121{
119 switch (boot_cpu_data.x86_model) { 122 switch (boot_cpu_data.x86_model) {
120 case 1: 123 case 1:
@@ -138,5 +141,3 @@ static __init int p6_pmu_init(void)
138 141
139 return 0; 142 return 0;
140} 143}
141
142#endif /* CONFIG_CPU_SUP_INTEL */
diff --git a/arch/x86/kernel/cpu/proc.c b/arch/x86/kernel/cpu/proc.c
index 62ac8cb6ba27..14b23140e81f 100644
--- a/arch/x86/kernel/cpu/proc.c
+++ b/arch/x86/kernel/cpu/proc.c
@@ -85,6 +85,8 @@ static int show_cpuinfo(struct seq_file *m, void *v)
85 seq_printf(m, "stepping\t: %d\n", c->x86_mask); 85 seq_printf(m, "stepping\t: %d\n", c->x86_mask);
86 else 86 else
87 seq_printf(m, "stepping\t: unknown\n"); 87 seq_printf(m, "stepping\t: unknown\n");
88 if (c->microcode)
89 seq_printf(m, "microcode\t: 0x%x\n", c->microcode);
88 90
89 if (cpu_has(c, X86_FEATURE_TSC)) { 91 if (cpu_has(c, X86_FEATURE_TSC)) {
90 unsigned int freq = cpufreq_quick_get(cpu); 92 unsigned int freq = cpufreq_quick_get(cpu);
diff --git a/arch/x86/kernel/cpu/rdrand.c b/arch/x86/kernel/cpu/rdrand.c
new file mode 100644
index 000000000000..feca286c2bb4
--- /dev/null
+++ b/arch/x86/kernel/cpu/rdrand.c
@@ -0,0 +1,73 @@
1/*
2 * This file is part of the Linux kernel.
3 *
4 * Copyright (c) 2011, Intel Corporation
5 * Authors: Fenghua Yu <fenghua.yu@intel.com>,
6 * H. Peter Anvin <hpa@linux.intel.com>
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms and conditions of the GNU General Public License,
10 * version 2, as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope it will be useful, but WITHOUT
13 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * this program; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 */
22
23#include <asm/processor.h>
24#include <asm/archrandom.h>
25#include <asm/sections.h>
26
27static int __init x86_rdrand_setup(char *s)
28{
29 setup_clear_cpu_cap(X86_FEATURE_RDRAND);
30 return 1;
31}
32__setup("nordrand", x86_rdrand_setup);
33
34/* We can't use arch_get_random_long() here since alternatives haven't run */
35static inline int rdrand_long(unsigned long *v)
36{
37 int ok;
38 asm volatile("1: " RDRAND_LONG "\n\t"
39 "jc 2f\n\t"
40 "decl %0\n\t"
41 "jnz 1b\n\t"
42 "2:"
43 : "=r" (ok), "=a" (*v)
44 : "0" (RDRAND_RETRY_LOOPS));
45 return ok;
46}
47
48/*
49 * Force a reseed cycle; we are architecturally guaranteed a reseed
50 * after no more than 512 128-bit chunks of random data. This also
51 * acts as a test of the CPU capability.
52 */
53#define RESEED_LOOP ((512*128)/sizeof(unsigned long))
54
55void __cpuinit x86_init_rdrand(struct cpuinfo_x86 *c)
56{
57#ifdef CONFIG_ARCH_RANDOM
58 unsigned long tmp;
59 int i, count, ok;
60
61 if (!cpu_has(c, X86_FEATURE_RDRAND))
62 return; /* Nothing to do */
63
64 for (count = i = 0; i < RESEED_LOOP; i++) {
65 ok = rdrand_long(&tmp);
66 if (ok)
67 count++;
68 }
69
70 if (count != RESEED_LOOP)
71 clear_cpu_cap(c, X86_FEATURE_RDRAND);
72#endif
73}
diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index 764c7c2b1811..13ad89971d47 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -32,15 +32,12 @@ int in_crash_kexec;
32 32
33#if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC) 33#if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC)
34 34
35static void kdump_nmi_callback(int cpu, struct die_args *args) 35static void kdump_nmi_callback(int cpu, struct pt_regs *regs)
36{ 36{
37 struct pt_regs *regs;
38#ifdef CONFIG_X86_32 37#ifdef CONFIG_X86_32
39 struct pt_regs fixed_regs; 38 struct pt_regs fixed_regs;
40#endif 39#endif
41 40
42 regs = args->regs;
43
44#ifdef CONFIG_X86_32 41#ifdef CONFIG_X86_32
45 if (!user_mode_vm(regs)) { 42 if (!user_mode_vm(regs)) {
46 crash_fixup_ss_esp(&fixed_regs, regs); 43 crash_fixup_ss_esp(&fixed_regs, regs);
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 6419bb05ecd5..faf8d5e74b0b 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -331,10 +331,15 @@ ENDPROC(native_usergs_sysret64)
3311: incl PER_CPU_VAR(irq_count) 3311: incl PER_CPU_VAR(irq_count)
332 jne 2f 332 jne 2f
333 mov PER_CPU_VAR(irq_stack_ptr),%rsp 333 mov PER_CPU_VAR(irq_stack_ptr),%rsp
334 EMPTY_FRAME 0 334 CFI_DEF_CFA_REGISTER rsi
335 335
3362: /* Store previous stack value */ 3362: /* Store previous stack value */
337 pushq %rsi 337 pushq %rsi
338 CFI_ESCAPE 0x0f /* DW_CFA_def_cfa_expression */, 6, \
339 0x77 /* DW_OP_breg7 */, 0, \
340 0x06 /* DW_OP_deref */, \
341 0x08 /* DW_OP_const1u */, SS+8-RBP, \
342 0x22 /* DW_OP_plus */
338 /* We entered an interrupt context - irqs are off: */ 343 /* We entered an interrupt context - irqs are off: */
339 TRACE_IRQS_OFF 344 TRACE_IRQS_OFF
340 .endm 345 .endm
@@ -788,7 +793,6 @@ END(interrupt)
788 subq $ORIG_RAX-RBP, %rsp 793 subq $ORIG_RAX-RBP, %rsp
789 CFI_ADJUST_CFA_OFFSET ORIG_RAX-RBP 794 CFI_ADJUST_CFA_OFFSET ORIG_RAX-RBP
790 SAVE_ARGS_IRQ 795 SAVE_ARGS_IRQ
791 PARTIAL_FRAME 0
792 call \func 796 call \func
793 .endm 797 .endm
794 798
@@ -813,10 +817,10 @@ ret_from_intr:
813 817
814 /* Restore saved previous stack */ 818 /* Restore saved previous stack */
815 popq %rsi 819 popq %rsi
816 leaq 16(%rsi), %rsp 820 CFI_DEF_CFA_REGISTER rsi
817 821 leaq ARGOFFSET-RBP(%rsi), %rsp
818 CFI_DEF_CFA_REGISTER rsp 822 CFI_DEF_CFA_REGISTER rsp
819 CFI_ADJUST_CFA_OFFSET -16 823 CFI_ADJUST_CFA_OFFSET RBP-ARGOFFSET
820 824
821exit_intr: 825exit_intr:
822 GET_THREAD_INFO(%rcx) 826 GET_THREAD_INFO(%rcx)
diff --git a/arch/x86/kernel/jump_label.c b/arch/x86/kernel/jump_label.c
index 3fee346ef545..cacdd46d184d 100644
--- a/arch/x86/kernel/jump_label.c
+++ b/arch/x86/kernel/jump_label.c
@@ -42,7 +42,7 @@ void arch_jump_label_transform(struct jump_entry *entry,
42 put_online_cpus(); 42 put_online_cpus();
43} 43}
44 44
45void arch_jump_label_text_poke_early(jump_label_t addr) 45void __init_or_module arch_jump_label_text_poke_early(jump_label_t addr)
46{ 46{
47 text_poke_early((void *)addr, ideal_nops[NOP_ATOMIC5], 47 text_poke_early((void *)addr, ideal_nops[NOP_ATOMIC5],
48 JUMP_LABEL_NOP_SIZE); 48 JUMP_LABEL_NOP_SIZE);
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
index 00354d4919a9..faba5771acad 100644
--- a/arch/x86/kernel/kgdb.c
+++ b/arch/x86/kernel/kgdb.c
@@ -511,28 +511,37 @@ single_step_cont(struct pt_regs *regs, struct die_args *args)
511 511
512static int was_in_debug_nmi[NR_CPUS]; 512static int was_in_debug_nmi[NR_CPUS];
513 513
514static int __kgdb_notify(struct die_args *args, unsigned long cmd) 514static int kgdb_nmi_handler(unsigned int cmd, struct pt_regs *regs)
515{ 515{
516 struct pt_regs *regs = args->regs;
517
518 switch (cmd) { 516 switch (cmd) {
519 case DIE_NMI: 517 case NMI_LOCAL:
520 if (atomic_read(&kgdb_active) != -1) { 518 if (atomic_read(&kgdb_active) != -1) {
521 /* KGDB CPU roundup */ 519 /* KGDB CPU roundup */
522 kgdb_nmicallback(raw_smp_processor_id(), regs); 520 kgdb_nmicallback(raw_smp_processor_id(), regs);
523 was_in_debug_nmi[raw_smp_processor_id()] = 1; 521 was_in_debug_nmi[raw_smp_processor_id()] = 1;
524 touch_nmi_watchdog(); 522 touch_nmi_watchdog();
525 return NOTIFY_STOP; 523 return NMI_HANDLED;
526 } 524 }
527 return NOTIFY_DONE; 525 break;
528 526
529 case DIE_NMIUNKNOWN: 527 case NMI_UNKNOWN:
530 if (was_in_debug_nmi[raw_smp_processor_id()]) { 528 if (was_in_debug_nmi[raw_smp_processor_id()]) {
531 was_in_debug_nmi[raw_smp_processor_id()] = 0; 529 was_in_debug_nmi[raw_smp_processor_id()] = 0;
532 return NOTIFY_STOP; 530 return NMI_HANDLED;
533 } 531 }
534 return NOTIFY_DONE; 532 break;
533 default:
534 /* do nothing */
535 break;
536 }
537 return NMI_DONE;
538}
539
540static int __kgdb_notify(struct die_args *args, unsigned long cmd)
541{
542 struct pt_regs *regs = args->regs;
535 543
544 switch (cmd) {
536 case DIE_DEBUG: 545 case DIE_DEBUG:
537 if (atomic_read(&kgdb_cpu_doing_single_step) != -1) { 546 if (atomic_read(&kgdb_cpu_doing_single_step) != -1) {
538 if (user_mode(regs)) 547 if (user_mode(regs))
@@ -590,11 +599,6 @@ kgdb_notify(struct notifier_block *self, unsigned long cmd, void *ptr)
590 599
591static struct notifier_block kgdb_notifier = { 600static struct notifier_block kgdb_notifier = {
592 .notifier_call = kgdb_notify, 601 .notifier_call = kgdb_notify,
593
594 /*
595 * Lowest-prio notifier priority, we want to be notified last:
596 */
597 .priority = NMI_LOCAL_LOW_PRIOR,
598}; 602};
599 603
600/** 604/**
@@ -605,7 +609,31 @@ static struct notifier_block kgdb_notifier = {
605 */ 609 */
606int kgdb_arch_init(void) 610int kgdb_arch_init(void)
607{ 611{
608 return register_die_notifier(&kgdb_notifier); 612 int retval;
613
614 retval = register_die_notifier(&kgdb_notifier);
615 if (retval)
616 goto out;
617
618 retval = register_nmi_handler(NMI_LOCAL, kgdb_nmi_handler,
619 0, "kgdb");
620 if (retval)
621 goto out1;
622
623 retval = register_nmi_handler(NMI_UNKNOWN, kgdb_nmi_handler,
624 0, "kgdb");
625
626 if (retval)
627 goto out2;
628
629 return retval;
630
631out2:
632 unregister_nmi_handler(NMI_LOCAL, "kgdb");
633out1:
634 unregister_die_notifier(&kgdb_notifier);
635out:
636 return retval;
609} 637}
610 638
611static void kgdb_hw_overflow_handler(struct perf_event *event, 639static void kgdb_hw_overflow_handler(struct perf_event *event,
@@ -673,6 +701,8 @@ void kgdb_arch_exit(void)
673 breakinfo[i].pev = NULL; 701 breakinfo[i].pev = NULL;
674 } 702 }
675 } 703 }
704 unregister_nmi_handler(NMI_UNKNOWN, "kgdb");
705 unregister_nmi_handler(NMI_LOCAL, "kgdb");
676 unregister_die_notifier(&kgdb_notifier); 706 unregister_die_notifier(&kgdb_notifier);
677} 707}
678 708
diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
index f1a6244d7d93..7da647d8b64c 100644
--- a/arch/x86/kernel/kprobes.c
+++ b/arch/x86/kernel/kprobes.c
@@ -75,8 +75,11 @@ DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
75 /* 75 /*
76 * Undefined/reserved opcodes, conditional jump, Opcode Extension 76 * Undefined/reserved opcodes, conditional jump, Opcode Extension
77 * Groups, and some special opcodes can not boost. 77 * Groups, and some special opcodes can not boost.
78 * This is non-const and volatile to keep gcc from statically
79 * optimizing it out, as variable_test_bit makes gcc think only
80 * *(unsigned long*) is used.
78 */ 81 */
79static const u32 twobyte_is_boostable[256 / 32] = { 82static volatile u32 twobyte_is_boostable[256 / 32] = {
80 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */ 83 /* 0 1 2 3 4 5 6 7 8 9 a b c d e f */
81 /* ---------------------------------------------- */ 84 /* ---------------------------------------------- */
82 W(0x00, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0) | /* 00 */ 85 W(0x00, 0, 0, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0) | /* 00 */
diff --git a/arch/x86/kernel/microcode_amd.c b/arch/x86/kernel/microcode_amd.c
index 591be0ee1934..d494799aafcd 100644
--- a/arch/x86/kernel/microcode_amd.c
+++ b/arch/x86/kernel/microcode_amd.c
@@ -74,14 +74,13 @@ static struct equiv_cpu_entry *equiv_cpu_table;
74static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig) 74static int collect_cpu_info_amd(int cpu, struct cpu_signature *csig)
75{ 75{
76 struct cpuinfo_x86 *c = &cpu_data(cpu); 76 struct cpuinfo_x86 *c = &cpu_data(cpu);
77 u32 dummy;
78 77
79 if (c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10) { 78 if (c->x86_vendor != X86_VENDOR_AMD || c->x86 < 0x10) {
80 pr_warning("CPU%d: family %d not supported\n", cpu, c->x86); 79 pr_warning("CPU%d: family %d not supported\n", cpu, c->x86);
81 return -1; 80 return -1;
82 } 81 }
83 82
84 rdmsr(MSR_AMD64_PATCH_LEVEL, csig->rev, dummy); 83 csig->rev = c->microcode;
85 pr_info("CPU%d: patch_level=0x%08x\n", cpu, csig->rev); 84 pr_info("CPU%d: patch_level=0x%08x\n", cpu, csig->rev);
86 85
87 return 0; 86 return 0;
@@ -130,6 +129,7 @@ static int apply_microcode_amd(int cpu)
130 int cpu_num = raw_smp_processor_id(); 129 int cpu_num = raw_smp_processor_id();
131 struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num; 130 struct ucode_cpu_info *uci = ucode_cpu_info + cpu_num;
132 struct microcode_amd *mc_amd = uci->mc; 131 struct microcode_amd *mc_amd = uci->mc;
132 struct cpuinfo_x86 *c = &cpu_data(cpu);
133 133
134 /* We should bind the task to the CPU */ 134 /* We should bind the task to the CPU */
135 BUG_ON(cpu_num != cpu); 135 BUG_ON(cpu_num != cpu);
@@ -150,6 +150,7 @@ static int apply_microcode_amd(int cpu)
150 150
151 pr_info("CPU%d: new patch_level=0x%08x\n", cpu, rev); 151 pr_info("CPU%d: new patch_level=0x%08x\n", cpu, rev);
152 uci->cpu_sig.rev = rev; 152 uci->cpu_sig.rev = rev;
153 c->microcode = rev;
153 154
154 return 0; 155 return 0;
155} 156}
diff --git a/arch/x86/kernel/microcode_core.c b/arch/x86/kernel/microcode_core.c
index f9242800bc84..f2d2a664e797 100644
--- a/arch/x86/kernel/microcode_core.c
+++ b/arch/x86/kernel/microcode_core.c
@@ -483,7 +483,13 @@ mc_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu)
483 sysfs_remove_group(&sys_dev->kobj, &mc_attr_group); 483 sysfs_remove_group(&sys_dev->kobj, &mc_attr_group);
484 pr_debug("CPU%d removed\n", cpu); 484 pr_debug("CPU%d removed\n", cpu);
485 break; 485 break;
486 case CPU_DEAD: 486
487 /*
488 * When a CPU goes offline, don't free up or invalidate the copy of
489 * the microcode in kernel memory, so that we can reuse it when the
490 * CPU comes back online without unnecessarily requesting the userspace
491 * for it again.
492 */
487 case CPU_UP_CANCELED_FROZEN: 493 case CPU_UP_CANCELED_FROZEN:
488 /* The CPU refused to come up during a system resume */ 494 /* The CPU refused to come up during a system resume */
489 microcode_fini_cpu(cpu); 495 microcode_fini_cpu(cpu);
diff --git a/arch/x86/kernel/microcode_intel.c b/arch/x86/kernel/microcode_intel.c
index 1a1b606d3e92..3ca42d0e43a2 100644
--- a/arch/x86/kernel/microcode_intel.c
+++ b/arch/x86/kernel/microcode_intel.c
@@ -161,12 +161,7 @@ static int collect_cpu_info(int cpu_num, struct cpu_signature *csig)
161 csig->pf = 1 << ((val[1] >> 18) & 7); 161 csig->pf = 1 << ((val[1] >> 18) & 7);
162 } 162 }
163 163
164 wrmsr(MSR_IA32_UCODE_REV, 0, 0); 164 csig->rev = c->microcode;
165 /* see notes above for revision 1.07. Apparent chip bug */
166 sync_core();
167 /* get the current revision from MSR 0x8B */
168 rdmsr(MSR_IA32_UCODE_REV, val[0], csig->rev);
169
170 pr_info("CPU%d sig=0x%x, pf=0x%x, revision=0x%x\n", 165 pr_info("CPU%d sig=0x%x, pf=0x%x, revision=0x%x\n",
171 cpu_num, csig->sig, csig->pf, csig->rev); 166 cpu_num, csig->sig, csig->pf, csig->rev);
172 167
@@ -299,9 +294,9 @@ static int apply_microcode(int cpu)
299 struct microcode_intel *mc_intel; 294 struct microcode_intel *mc_intel;
300 struct ucode_cpu_info *uci; 295 struct ucode_cpu_info *uci;
301 unsigned int val[2]; 296 unsigned int val[2];
302 int cpu_num; 297 int cpu_num = raw_smp_processor_id();
298 struct cpuinfo_x86 *c = &cpu_data(cpu_num);
303 299
304 cpu_num = raw_smp_processor_id();
305 uci = ucode_cpu_info + cpu; 300 uci = ucode_cpu_info + cpu;
306 mc_intel = uci->mc; 301 mc_intel = uci->mc;
307 302
@@ -317,7 +312,7 @@ static int apply_microcode(int cpu)
317 (unsigned long) mc_intel->bits >> 16 >> 16); 312 (unsigned long) mc_intel->bits >> 16 >> 16);
318 wrmsr(MSR_IA32_UCODE_REV, 0, 0); 313 wrmsr(MSR_IA32_UCODE_REV, 0, 0);
319 314
320 /* see notes above for revision 1.07. Apparent chip bug */ 315 /* As documented in the SDM: Do a CPUID 1 here */
321 sync_core(); 316 sync_core();
322 317
323 /* get the current revision from MSR 0x8B */ 318 /* get the current revision from MSR 0x8B */
@@ -335,6 +330,7 @@ static int apply_microcode(int cpu)
335 (mc_intel->hdr.date >> 16) & 0xff); 330 (mc_intel->hdr.date >> 16) & 0xff);
336 331
337 uci->cpu_sig.rev = val[1]; 332 uci->cpu_sig.rev = val[1];
333 c->microcode = val[1];
338 334
339 return 0; 335 return 0;
340} 336}
diff --git a/arch/x86/kernel/nmi.c b/arch/x86/kernel/nmi.c
new file mode 100644
index 000000000000..7ec5bd140b87
--- /dev/null
+++ b/arch/x86/kernel/nmi.c
@@ -0,0 +1,433 @@
1/*
2 * Copyright (C) 1991, 1992 Linus Torvalds
3 * Copyright (C) 2000, 2001, 2002 Andi Kleen, SuSE Labs
4 * Copyright (C) 2011 Don Zickus Red Hat, Inc.
5 *
6 * Pentium III FXSR, SSE support
7 * Gareth Hughes <gareth@valinux.com>, May 2000
8 */
9
10/*
11 * Handle hardware traps and faults.
12 */
13#include <linux/spinlock.h>
14#include <linux/kprobes.h>
15#include <linux/kdebug.h>
16#include <linux/nmi.h>
17#include <linux/delay.h>
18#include <linux/hardirq.h>
19#include <linux/slab.h>
20
21#include <linux/mca.h>
22
23#if defined(CONFIG_EDAC)
24#include <linux/edac.h>
25#endif
26
27#include <linux/atomic.h>
28#include <asm/traps.h>
29#include <asm/mach_traps.h>
30#include <asm/nmi.h>
31
32#define NMI_MAX_NAMELEN 16
33struct nmiaction {
34 struct list_head list;
35 nmi_handler_t handler;
36 unsigned int flags;
37 char *name;
38};
39
40struct nmi_desc {
41 spinlock_t lock;
42 struct list_head head;
43};
44
45static struct nmi_desc nmi_desc[NMI_MAX] =
46{
47 {
48 .lock = __SPIN_LOCK_UNLOCKED(&nmi_desc[0].lock),
49 .head = LIST_HEAD_INIT(nmi_desc[0].head),
50 },
51 {
52 .lock = __SPIN_LOCK_UNLOCKED(&nmi_desc[1].lock),
53 .head = LIST_HEAD_INIT(nmi_desc[1].head),
54 },
55
56};
57
58struct nmi_stats {
59 unsigned int normal;
60 unsigned int unknown;
61 unsigned int external;
62 unsigned int swallow;
63};
64
65static DEFINE_PER_CPU(struct nmi_stats, nmi_stats);
66
67static int ignore_nmis;
68
69int unknown_nmi_panic;
70/*
71 * Prevent NMI reason port (0x61) being accessed simultaneously, can
72 * only be used in NMI handler.
73 */
74static DEFINE_RAW_SPINLOCK(nmi_reason_lock);
75
76static int __init setup_unknown_nmi_panic(char *str)
77{
78 unknown_nmi_panic = 1;
79 return 1;
80}
81__setup("unknown_nmi_panic", setup_unknown_nmi_panic);
82
83#define nmi_to_desc(type) (&nmi_desc[type])
84
85static int notrace __kprobes nmi_handle(unsigned int type, struct pt_regs *regs, bool b2b)
86{
87 struct nmi_desc *desc = nmi_to_desc(type);
88 struct nmiaction *a;
89 int handled=0;
90
91 rcu_read_lock();
92
93 /*
94 * NMIs are edge-triggered, which means if you have enough
95 * of them concurrently, you can lose some because only one
96 * can be latched at any given time. Walk the whole list
97 * to handle those situations.
98 */
99 list_for_each_entry_rcu(a, &desc->head, list)
100 handled += a->handler(type, regs);
101
102 rcu_read_unlock();
103
104 /* return total number of NMI events handled */
105 return handled;
106}
107
108static int __setup_nmi(unsigned int type, struct nmiaction *action)
109{
110 struct nmi_desc *desc = nmi_to_desc(type);
111 unsigned long flags;
112
113 spin_lock_irqsave(&desc->lock, flags);
114
115 /*
116 * most handlers of type NMI_UNKNOWN never return because
117 * they just assume the NMI is theirs. Just a sanity check
118 * to manage expectations
119 */
120 WARN_ON_ONCE(type == NMI_UNKNOWN && !list_empty(&desc->head));
121
122 /*
123 * some handlers need to be executed first otherwise a fake
124 * event confuses some handlers (kdump uses this flag)
125 */
126 if (action->flags & NMI_FLAG_FIRST)
127 list_add_rcu(&action->list, &desc->head);
128 else
129 list_add_tail_rcu(&action->list, &desc->head);
130
131 spin_unlock_irqrestore(&desc->lock, flags);
132 return 0;
133}
134
135static struct nmiaction *__free_nmi(unsigned int type, const char *name)
136{
137 struct nmi_desc *desc = nmi_to_desc(type);
138 struct nmiaction *n;
139 unsigned long flags;
140
141 spin_lock_irqsave(&desc->lock, flags);
142
143 list_for_each_entry_rcu(n, &desc->head, list) {
144 /*
145 * the name passed in to describe the nmi handler
146 * is used as the lookup key
147 */
148 if (!strcmp(n->name, name)) {
149 WARN(in_nmi(),
150 "Trying to free NMI (%s) from NMI context!\n", n->name);
151 list_del_rcu(&n->list);
152 break;
153 }
154 }
155
156 spin_unlock_irqrestore(&desc->lock, flags);
157 synchronize_rcu();
158 return (n);
159}
160
161int register_nmi_handler(unsigned int type, nmi_handler_t handler,
162 unsigned long nmiflags, const char *devname)
163{
164 struct nmiaction *action;
165 int retval = -ENOMEM;
166
167 if (!handler)
168 return -EINVAL;
169
170 action = kzalloc(sizeof(struct nmiaction), GFP_KERNEL);
171 if (!action)
172 goto fail_action;
173
174 action->handler = handler;
175 action->flags = nmiflags;
176 action->name = kstrndup(devname, NMI_MAX_NAMELEN, GFP_KERNEL);
177 if (!action->name)
178 goto fail_action_name;
179
180 retval = __setup_nmi(type, action);
181
182 if (retval)
183 goto fail_setup_nmi;
184
185 return retval;
186
187fail_setup_nmi:
188 kfree(action->name);
189fail_action_name:
190 kfree(action);
191fail_action:
192
193 return retval;
194}
195EXPORT_SYMBOL_GPL(register_nmi_handler);
196
197void unregister_nmi_handler(unsigned int type, const char *name)
198{
199 struct nmiaction *a;
200
201 a = __free_nmi(type, name);
202 if (a) {
203 kfree(a->name);
204 kfree(a);
205 }
206}
207
208EXPORT_SYMBOL_GPL(unregister_nmi_handler);
209
210static notrace __kprobes void
211pci_serr_error(unsigned char reason, struct pt_regs *regs)
212{
213 pr_emerg("NMI: PCI system error (SERR) for reason %02x on CPU %d.\n",
214 reason, smp_processor_id());
215
216 /*
217 * On some machines, PCI SERR line is used to report memory
218 * errors. EDAC makes use of it.
219 */
220#if defined(CONFIG_EDAC)
221 if (edac_handler_set()) {
222 edac_atomic_assert_error();
223 return;
224 }
225#endif
226
227 if (panic_on_unrecovered_nmi)
228 panic("NMI: Not continuing");
229
230 pr_emerg("Dazed and confused, but trying to continue\n");
231
232 /* Clear and disable the PCI SERR error line. */
233 reason = (reason & NMI_REASON_CLEAR_MASK) | NMI_REASON_CLEAR_SERR;
234 outb(reason, NMI_REASON_PORT);
235}
236
237static notrace __kprobes void
238io_check_error(unsigned char reason, struct pt_regs *regs)
239{
240 unsigned long i;
241
242 pr_emerg(
243 "NMI: IOCK error (debug interrupt?) for reason %02x on CPU %d.\n",
244 reason, smp_processor_id());
245 show_registers(regs);
246
247 if (panic_on_io_nmi)
248 panic("NMI IOCK error: Not continuing");
249
250 /* Re-enable the IOCK line, wait for a few seconds */
251 reason = (reason & NMI_REASON_CLEAR_MASK) | NMI_REASON_CLEAR_IOCHK;
252 outb(reason, NMI_REASON_PORT);
253
254 i = 20000;
255 while (--i) {
256 touch_nmi_watchdog();
257 udelay(100);
258 }
259
260 reason &= ~NMI_REASON_CLEAR_IOCHK;
261 outb(reason, NMI_REASON_PORT);
262}
263
264static notrace __kprobes void
265unknown_nmi_error(unsigned char reason, struct pt_regs *regs)
266{
267 int handled;
268
269 /*
270 * Use 'false' as back-to-back NMIs are dealt with one level up.
271 * Of course this makes having multiple 'unknown' handlers useless
272 * as only the first one is ever run (unless it can actually determine
273 * if it caused the NMI)
274 */
275 handled = nmi_handle(NMI_UNKNOWN, regs, false);
276 if (handled) {
277 __this_cpu_add(nmi_stats.unknown, handled);
278 return;
279 }
280
281 __this_cpu_add(nmi_stats.unknown, 1);
282
283#ifdef CONFIG_MCA
284 /*
285 * Might actually be able to figure out what the guilty party
286 * is:
287 */
288 if (MCA_bus) {
289 mca_handle_nmi();
290 return;
291 }
292#endif
293 pr_emerg("Uhhuh. NMI received for unknown reason %02x on CPU %d.\n",
294 reason, smp_processor_id());
295
296 pr_emerg("Do you have a strange power saving mode enabled?\n");
297 if (unknown_nmi_panic || panic_on_unrecovered_nmi)
298 panic("NMI: Not continuing");
299
300 pr_emerg("Dazed and confused, but trying to continue\n");
301}
302
303static DEFINE_PER_CPU(bool, swallow_nmi);
304static DEFINE_PER_CPU(unsigned long, last_nmi_rip);
305
306static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
307{
308 unsigned char reason = 0;
309 int handled;
310 bool b2b = false;
311
312 /*
313 * CPU-specific NMI must be processed before non-CPU-specific
314 * NMI, otherwise we may lose it, because the CPU-specific
315 * NMI can not be detected/processed on other CPUs.
316 */
317
318 /*
319 * Back-to-back NMIs are interesting because they can either
320 * be two NMI or more than two NMIs (any thing over two is dropped
321 * due to NMI being edge-triggered). If this is the second half
322 * of the back-to-back NMI, assume we dropped things and process
323 * more handlers. Otherwise reset the 'swallow' NMI behaviour
324 */
325 if (regs->ip == __this_cpu_read(last_nmi_rip))
326 b2b = true;
327 else
328 __this_cpu_write(swallow_nmi, false);
329
330 __this_cpu_write(last_nmi_rip, regs->ip);
331
332 handled = nmi_handle(NMI_LOCAL, regs, b2b);
333 __this_cpu_add(nmi_stats.normal, handled);
334 if (handled) {
335 /*
336 * There are cases when a NMI handler handles multiple
337 * events in the current NMI. One of these events may
338 * be queued for in the next NMI. Because the event is
339 * already handled, the next NMI will result in an unknown
340 * NMI. Instead lets flag this for a potential NMI to
341 * swallow.
342 */
343 if (handled > 1)
344 __this_cpu_write(swallow_nmi, true);
345 return;
346 }
347
348 /* Non-CPU-specific NMI: NMI sources can be processed on any CPU */
349 raw_spin_lock(&nmi_reason_lock);
350 reason = get_nmi_reason();
351
352 if (reason & NMI_REASON_MASK) {
353 if (reason & NMI_REASON_SERR)
354 pci_serr_error(reason, regs);
355 else if (reason & NMI_REASON_IOCHK)
356 io_check_error(reason, regs);
357#ifdef CONFIG_X86_32
358 /*
359 * Reassert NMI in case it became active
360 * meanwhile as it's edge-triggered:
361 */
362 reassert_nmi();
363#endif
364 __this_cpu_add(nmi_stats.external, 1);
365 raw_spin_unlock(&nmi_reason_lock);
366 return;
367 }
368 raw_spin_unlock(&nmi_reason_lock);
369
370 /*
371 * Only one NMI can be latched at a time. To handle
372 * this we may process multiple nmi handlers at once to
373 * cover the case where an NMI is dropped. The downside
374 * to this approach is we may process an NMI prematurely,
375 * while its real NMI is sitting latched. This will cause
376 * an unknown NMI on the next run of the NMI processing.
377 *
378 * We tried to flag that condition above, by setting the
379 * swallow_nmi flag when we process more than one event.
380 * This condition is also only present on the second half
381 * of a back-to-back NMI, so we flag that condition too.
382 *
383 * If both are true, we assume we already processed this
384 * NMI previously and we swallow it. Otherwise we reset
385 * the logic.
386 *
387 * There are scenarios where we may accidentally swallow
388 * a 'real' unknown NMI. For example, while processing
389 * a perf NMI another perf NMI comes in along with a
390 * 'real' unknown NMI. These two NMIs get combined into
391 * one (as descibed above). When the next NMI gets
392 * processed, it will be flagged by perf as handled, but
393 * noone will know that there was a 'real' unknown NMI sent
394 * also. As a result it gets swallowed. Or if the first
395 * perf NMI returns two events handled then the second
396 * NMI will get eaten by the logic below, again losing a
397 * 'real' unknown NMI. But this is the best we can do
398 * for now.
399 */
400 if (b2b && __this_cpu_read(swallow_nmi))
401 __this_cpu_add(nmi_stats.swallow, 1);
402 else
403 unknown_nmi_error(reason, regs);
404}
405
406dotraplinkage notrace __kprobes void
407do_nmi(struct pt_regs *regs, long error_code)
408{
409 nmi_enter();
410
411 inc_irq_stat(__nmi_count);
412
413 if (!ignore_nmis)
414 default_do_nmi(regs);
415
416 nmi_exit();
417}
418
419void stop_nmi(void)
420{
421 ignore_nmis++;
422}
423
424void restart_nmi(void)
425{
426 ignore_nmis--;
427}
428
429/* reset the back-to-back NMI logic */
430void local_touch_nmi(void)
431{
432 __this_cpu_write(last_nmi_rip, 0);
433}
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c
index b49d00da2aed..622872054fbe 100644
--- a/arch/x86/kernel/pci-dma.c
+++ b/arch/x86/kernel/pci-dma.c
@@ -117,8 +117,8 @@ again:
117} 117}
118 118
119/* 119/*
120 * See <Documentation/x86_64/boot-options.txt> for the iommu kernel parameter 120 * See <Documentation/x86/x86_64/boot-options.txt> for the iommu kernel
121 * documentation. 121 * parameter documentation.
122 */ 122 */
123static __init int iommu_setup(char *p) 123static __init int iommu_setup(char *p)
124{ 124{
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index e7e3b019c439..b9b3b1a51643 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -49,7 +49,7 @@ void free_thread_xstate(struct task_struct *tsk)
49void free_thread_info(struct thread_info *ti) 49void free_thread_info(struct thread_info *ti)
50{ 50{
51 free_thread_xstate(ti->task); 51 free_thread_xstate(ti->task);
52 free_pages((unsigned long)ti, get_order(THREAD_SIZE)); 52 free_pages((unsigned long)ti, THREAD_ORDER);
53} 53}
54 54
55void arch_task_cache_init(void) 55void arch_task_cache_init(void)
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 7a3b65107a27..795b79f984c2 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -57,6 +57,7 @@
57#include <asm/idle.h> 57#include <asm/idle.h>
58#include <asm/syscalls.h> 58#include <asm/syscalls.h>
59#include <asm/debugreg.h> 59#include <asm/debugreg.h>
60#include <asm/nmi.h>
60 61
61asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); 62asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
62 63
@@ -107,6 +108,7 @@ void cpu_idle(void)
107 if (cpu_is_offline(cpu)) 108 if (cpu_is_offline(cpu))
108 play_dead(); 109 play_dead();
109 110
111 local_touch_nmi();
110 local_irq_disable(); 112 local_irq_disable();
111 /* Don't trace irqs off for idle */ 113 /* Don't trace irqs off for idle */
112 stop_critical_timings(); 114 stop_critical_timings();
@@ -262,7 +264,7 @@ EXPORT_SYMBOL_GPL(start_thread);
262 264
263 265
264/* 266/*
265 * switch_to(x,yn) should switch tasks from x to y. 267 * switch_to(x,y) should switch tasks from x to y.
266 * 268 *
267 * We fsave/fwait so that an exception goes off at the right time 269 * We fsave/fwait so that an exception goes off at the right time
268 * (as a call from the fsave or fwait in effect) rather than to 270 * (as a call from the fsave or fwait in effect) rather than to
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index f693e44e1bf6..3bd7e6eebf31 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -51,6 +51,7 @@
51#include <asm/idle.h> 51#include <asm/idle.h>
52#include <asm/syscalls.h> 52#include <asm/syscalls.h>
53#include <asm/debugreg.h> 53#include <asm/debugreg.h>
54#include <asm/nmi.h>
54 55
55asmlinkage extern void ret_from_fork(void); 56asmlinkage extern void ret_from_fork(void);
56 57
@@ -133,6 +134,7 @@ void cpu_idle(void)
133 * from here on, until they go to idle. 134 * from here on, until they go to idle.
134 * Otherwise, idle callbacks can misfire. 135 * Otherwise, idle callbacks can misfire.
135 */ 136 */
137 local_touch_nmi();
136 local_irq_disable(); 138 local_irq_disable();
137 enter_idle(); 139 enter_idle();
138 /* Don't trace irqs off for idle */ 140 /* Don't trace irqs off for idle */
diff --git a/arch/x86/kernel/reboot.c b/arch/x86/kernel/reboot.c
index 9242436e9937..e334be1182b9 100644
--- a/arch/x86/kernel/reboot.c
+++ b/arch/x86/kernel/reboot.c
@@ -464,7 +464,7 @@ static inline void kb_wait(void)
464 } 464 }
465} 465}
466 466
467static void vmxoff_nmi(int cpu, struct die_args *args) 467static void vmxoff_nmi(int cpu, struct pt_regs *regs)
468{ 468{
469 cpu_emergency_vmxoff(); 469 cpu_emergency_vmxoff();
470} 470}
@@ -736,14 +736,10 @@ static nmi_shootdown_cb shootdown_callback;
736 736
737static atomic_t waiting_for_crash_ipi; 737static atomic_t waiting_for_crash_ipi;
738 738
739static int crash_nmi_callback(struct notifier_block *self, 739static int crash_nmi_callback(unsigned int val, struct pt_regs *regs)
740 unsigned long val, void *data)
741{ 740{
742 int cpu; 741 int cpu;
743 742
744 if (val != DIE_NMI)
745 return NOTIFY_OK;
746
747 cpu = raw_smp_processor_id(); 743 cpu = raw_smp_processor_id();
748 744
749 /* Don't do anything if this handler is invoked on crashing cpu. 745 /* Don't do anything if this handler is invoked on crashing cpu.
@@ -751,10 +747,10 @@ static int crash_nmi_callback(struct notifier_block *self,
751 * an NMI if system was initially booted with nmi_watchdog parameter. 747 * an NMI if system was initially booted with nmi_watchdog parameter.
752 */ 748 */
753 if (cpu == crashing_cpu) 749 if (cpu == crashing_cpu)
754 return NOTIFY_STOP; 750 return NMI_HANDLED;
755 local_irq_disable(); 751 local_irq_disable();
756 752
757 shootdown_callback(cpu, (struct die_args *)data); 753 shootdown_callback(cpu, regs);
758 754
759 atomic_dec(&waiting_for_crash_ipi); 755 atomic_dec(&waiting_for_crash_ipi);
760 /* Assume hlt works */ 756 /* Assume hlt works */
@@ -762,7 +758,7 @@ static int crash_nmi_callback(struct notifier_block *self,
762 for (;;) 758 for (;;)
763 cpu_relax(); 759 cpu_relax();
764 760
765 return 1; 761 return NMI_HANDLED;
766} 762}
767 763
768static void smp_send_nmi_allbutself(void) 764static void smp_send_nmi_allbutself(void)
@@ -770,12 +766,6 @@ static void smp_send_nmi_allbutself(void)
770 apic->send_IPI_allbutself(NMI_VECTOR); 766 apic->send_IPI_allbutself(NMI_VECTOR);
771} 767}
772 768
773static struct notifier_block crash_nmi_nb = {
774 .notifier_call = crash_nmi_callback,
775 /* we want to be the first one called */
776 .priority = NMI_LOCAL_HIGH_PRIOR+1,
777};
778
779/* Halt all other CPUs, calling the specified function on each of them 769/* Halt all other CPUs, calling the specified function on each of them
780 * 770 *
781 * This function can be used to halt all other CPUs on crash 771 * This function can be used to halt all other CPUs on crash
@@ -794,7 +784,8 @@ void nmi_shootdown_cpus(nmi_shootdown_cb callback)
794 784
795 atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1); 785 atomic_set(&waiting_for_crash_ipi, num_online_cpus() - 1);
796 /* Would it be better to replace the trap vector here? */ 786 /* Would it be better to replace the trap vector here? */
797 if (register_die_notifier(&crash_nmi_nb)) 787 if (register_nmi_handler(NMI_LOCAL, crash_nmi_callback,
788 NMI_FLAG_FIRST, "crash"))
798 return; /* return what? */ 789 return; /* return what? */
799 /* Ensure the new callback function is set before sending 790 /* Ensure the new callback function is set before sending
800 * out the NMI 791 * out the NMI
diff --git a/arch/x86/kernel/rtc.c b/arch/x86/kernel/rtc.c
index 3f2ad2640d85..ccdbc16b8941 100644
--- a/arch/x86/kernel/rtc.c
+++ b/arch/x86/kernel/rtc.c
@@ -42,8 +42,11 @@ int mach_set_rtc_mmss(unsigned long nowtime)
42{ 42{
43 int real_seconds, real_minutes, cmos_minutes; 43 int real_seconds, real_minutes, cmos_minutes;
44 unsigned char save_control, save_freq_select; 44 unsigned char save_control, save_freq_select;
45 unsigned long flags;
45 int retval = 0; 46 int retval = 0;
46 47
48 spin_lock_irqsave(&rtc_lock, flags);
49
47 /* tell the clock it's being set */ 50 /* tell the clock it's being set */
48 save_control = CMOS_READ(RTC_CONTROL); 51 save_control = CMOS_READ(RTC_CONTROL);
49 CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL); 52 CMOS_WRITE((save_control|RTC_SET), RTC_CONTROL);
@@ -93,12 +96,17 @@ int mach_set_rtc_mmss(unsigned long nowtime)
93 CMOS_WRITE(save_control, RTC_CONTROL); 96 CMOS_WRITE(save_control, RTC_CONTROL);
94 CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT); 97 CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);
95 98
99 spin_unlock_irqrestore(&rtc_lock, flags);
100
96 return retval; 101 return retval;
97} 102}
98 103
99unsigned long mach_get_cmos_time(void) 104unsigned long mach_get_cmos_time(void)
100{ 105{
101 unsigned int status, year, mon, day, hour, min, sec, century = 0; 106 unsigned int status, year, mon, day, hour, min, sec, century = 0;
107 unsigned long flags;
108
109 spin_lock_irqsave(&rtc_lock, flags);
102 110
103 /* 111 /*
104 * If UIP is clear, then we have >= 244 microseconds before 112 * If UIP is clear, then we have >= 244 microseconds before
@@ -125,6 +133,8 @@ unsigned long mach_get_cmos_time(void)
125 status = CMOS_READ(RTC_CONTROL); 133 status = CMOS_READ(RTC_CONTROL);
126 WARN_ON_ONCE(RTC_ALWAYS_BCD && (status & RTC_DM_BINARY)); 134 WARN_ON_ONCE(RTC_ALWAYS_BCD && (status & RTC_DM_BINARY));
127 135
136 spin_unlock_irqrestore(&rtc_lock, flags);
137
128 if (RTC_ALWAYS_BCD || !(status & RTC_DM_BINARY)) { 138 if (RTC_ALWAYS_BCD || !(status & RTC_DM_BINARY)) {
129 sec = bcd2bin(sec); 139 sec = bcd2bin(sec);
130 min = bcd2bin(min); 140 min = bcd2bin(min);
@@ -169,24 +179,15 @@ EXPORT_SYMBOL(rtc_cmos_write);
169 179
170int update_persistent_clock(struct timespec now) 180int update_persistent_clock(struct timespec now)
171{ 181{
172 unsigned long flags; 182 return x86_platform.set_wallclock(now.tv_sec);
173 int retval;
174
175 spin_lock_irqsave(&rtc_lock, flags);
176 retval = x86_platform.set_wallclock(now.tv_sec);
177 spin_unlock_irqrestore(&rtc_lock, flags);
178
179 return retval;
180} 183}
181 184
182/* not static: needed by APM */ 185/* not static: needed by APM */
183void read_persistent_clock(struct timespec *ts) 186void read_persistent_clock(struct timespec *ts)
184{ 187{
185 unsigned long retval, flags; 188 unsigned long retval;
186 189
187 spin_lock_irqsave(&rtc_lock, flags);
188 retval = x86_platform.get_wallclock(); 190 retval = x86_platform.get_wallclock();
189 spin_unlock_irqrestore(&rtc_lock, flags);
190 191
191 ts->tv_sec = retval; 192 ts->tv_sec = retval;
192 ts->tv_nsec = 0; 193 ts->tv_nsec = 0;
diff --git a/arch/x86/kernel/sys_x86_64.c b/arch/x86/kernel/sys_x86_64.c
index ff14a5044ce6..051489082d59 100644
--- a/arch/x86/kernel/sys_x86_64.c
+++ b/arch/x86/kernel/sys_x86_64.c
@@ -14,10 +14,73 @@
14#include <linux/personality.h> 14#include <linux/personality.h>
15#include <linux/random.h> 15#include <linux/random.h>
16#include <linux/uaccess.h> 16#include <linux/uaccess.h>
17#include <linux/elf.h>
17 18
18#include <asm/ia32.h> 19#include <asm/ia32.h>
19#include <asm/syscalls.h> 20#include <asm/syscalls.h>
20 21
22/*
23 * Align a virtual address to avoid aliasing in the I$ on AMD F15h.
24 *
25 * @flags denotes the allocation direction - bottomup or topdown -
26 * or vDSO; see call sites below.
27 */
28unsigned long align_addr(unsigned long addr, struct file *filp,
29 enum align_flags flags)
30{
31 unsigned long tmp_addr;
32
33 /* handle 32- and 64-bit case with a single conditional */
34 if (va_align.flags < 0 || !(va_align.flags & (2 - mmap_is_ia32())))
35 return addr;
36
37 if (!(current->flags & PF_RANDOMIZE))
38 return addr;
39
40 if (!((flags & ALIGN_VDSO) || filp))
41 return addr;
42
43 tmp_addr = addr;
44
45 /*
46 * We need an address which is <= than the original
47 * one only when in topdown direction.
48 */
49 if (!(flags & ALIGN_TOPDOWN))
50 tmp_addr += va_align.mask;
51
52 tmp_addr &= ~va_align.mask;
53
54 return tmp_addr;
55}
56
57static int __init control_va_addr_alignment(char *str)
58{
59 /* guard against enabling this on other CPU families */
60 if (va_align.flags < 0)
61 return 1;
62
63 if (*str == 0)
64 return 1;
65
66 if (*str == '=')
67 str++;
68
69 if (!strcmp(str, "32"))
70 va_align.flags = ALIGN_VA_32;
71 else if (!strcmp(str, "64"))
72 va_align.flags = ALIGN_VA_64;
73 else if (!strcmp(str, "off"))
74 va_align.flags = 0;
75 else if (!strcmp(str, "on"))
76 va_align.flags = ALIGN_VA_32 | ALIGN_VA_64;
77 else
78 return 0;
79
80 return 1;
81}
82__setup("align_va_addr", control_va_addr_alignment);
83
21SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len, 84SYSCALL_DEFINE6(mmap, unsigned long, addr, unsigned long, len,
22 unsigned long, prot, unsigned long, flags, 85 unsigned long, prot, unsigned long, flags,
23 unsigned long, fd, unsigned long, off) 86 unsigned long, fd, unsigned long, off)
@@ -92,6 +155,9 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
92 start_addr = addr; 155 start_addr = addr;
93 156
94full_search: 157full_search:
158
159 addr = align_addr(addr, filp, 0);
160
95 for (vma = find_vma(mm, addr); ; vma = vma->vm_next) { 161 for (vma = find_vma(mm, addr); ; vma = vma->vm_next) {
96 /* At this point: (!vma || addr < vma->vm_end). */ 162 /* At this point: (!vma || addr < vma->vm_end). */
97 if (end - len < addr) { 163 if (end - len < addr) {
@@ -117,6 +183,7 @@ full_search:
117 mm->cached_hole_size = vma->vm_start - addr; 183 mm->cached_hole_size = vma->vm_start - addr;
118 184
119 addr = vma->vm_end; 185 addr = vma->vm_end;
186 addr = align_addr(addr, filp, 0);
120 } 187 }
121} 188}
122 189
@@ -161,10 +228,13 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
161 228
162 /* make sure it can fit in the remaining address space */ 229 /* make sure it can fit in the remaining address space */
163 if (addr > len) { 230 if (addr > len) {
164 vma = find_vma(mm, addr-len); 231 unsigned long tmp_addr = align_addr(addr - len, filp,
165 if (!vma || addr <= vma->vm_start) 232 ALIGN_TOPDOWN);
233
234 vma = find_vma(mm, tmp_addr);
235 if (!vma || tmp_addr + len <= vma->vm_start)
166 /* remember the address as a hint for next time */ 236 /* remember the address as a hint for next time */
167 return mm->free_area_cache = addr-len; 237 return mm->free_area_cache = tmp_addr;
168 } 238 }
169 239
170 if (mm->mmap_base < len) 240 if (mm->mmap_base < len)
@@ -173,6 +243,8 @@ arch_get_unmapped_area_topdown(struct file *filp, const unsigned long addr0,
173 addr = mm->mmap_base-len; 243 addr = mm->mmap_base-len;
174 244
175 do { 245 do {
246 addr = align_addr(addr, filp, ALIGN_TOPDOWN);
247
176 /* 248 /*
177 * Lookup failure means no vma is above this address, 249 * Lookup failure means no vma is above this address,
178 * else if new region fits below vma->vm_start, 250 * else if new region fits below vma->vm_start,
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 6913369c234c..a8e3eb83466c 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -81,15 +81,6 @@ gate_desc idt_table[NR_VECTORS] __page_aligned_data = { { { { 0, 0 } } }, };
81DECLARE_BITMAP(used_vectors, NR_VECTORS); 81DECLARE_BITMAP(used_vectors, NR_VECTORS);
82EXPORT_SYMBOL_GPL(used_vectors); 82EXPORT_SYMBOL_GPL(used_vectors);
83 83
84static int ignore_nmis;
85
86int unknown_nmi_panic;
87/*
88 * Prevent NMI reason port (0x61) being accessed simultaneously, can
89 * only be used in NMI handler.
90 */
91static DEFINE_RAW_SPINLOCK(nmi_reason_lock);
92
93static inline void conditional_sti(struct pt_regs *regs) 84static inline void conditional_sti(struct pt_regs *regs)
94{ 85{
95 if (regs->flags & X86_EFLAGS_IF) 86 if (regs->flags & X86_EFLAGS_IF)
@@ -307,152 +298,6 @@ gp_in_kernel:
307 die("general protection fault", regs, error_code); 298 die("general protection fault", regs, error_code);
308} 299}
309 300
310static int __init setup_unknown_nmi_panic(char *str)
311{
312 unknown_nmi_panic = 1;
313 return 1;
314}
315__setup("unknown_nmi_panic", setup_unknown_nmi_panic);
316
317static notrace __kprobes void
318pci_serr_error(unsigned char reason, struct pt_regs *regs)
319{
320 pr_emerg("NMI: PCI system error (SERR) for reason %02x on CPU %d.\n",
321 reason, smp_processor_id());
322
323 /*
324 * On some machines, PCI SERR line is used to report memory
325 * errors. EDAC makes use of it.
326 */
327#if defined(CONFIG_EDAC)
328 if (edac_handler_set()) {
329 edac_atomic_assert_error();
330 return;
331 }
332#endif
333
334 if (panic_on_unrecovered_nmi)
335 panic("NMI: Not continuing");
336
337 pr_emerg("Dazed and confused, but trying to continue\n");
338
339 /* Clear and disable the PCI SERR error line. */
340 reason = (reason & NMI_REASON_CLEAR_MASK) | NMI_REASON_CLEAR_SERR;
341 outb(reason, NMI_REASON_PORT);
342}
343
344static notrace __kprobes void
345io_check_error(unsigned char reason, struct pt_regs *regs)
346{
347 unsigned long i;
348
349 pr_emerg(
350 "NMI: IOCK error (debug interrupt?) for reason %02x on CPU %d.\n",
351 reason, smp_processor_id());
352 show_registers(regs);
353
354 if (panic_on_io_nmi)
355 panic("NMI IOCK error: Not continuing");
356
357 /* Re-enable the IOCK line, wait for a few seconds */
358 reason = (reason & NMI_REASON_CLEAR_MASK) | NMI_REASON_CLEAR_IOCHK;
359 outb(reason, NMI_REASON_PORT);
360
361 i = 20000;
362 while (--i) {
363 touch_nmi_watchdog();
364 udelay(100);
365 }
366
367 reason &= ~NMI_REASON_CLEAR_IOCHK;
368 outb(reason, NMI_REASON_PORT);
369}
370
371static notrace __kprobes void
372unknown_nmi_error(unsigned char reason, struct pt_regs *regs)
373{
374 if (notify_die(DIE_NMIUNKNOWN, "nmi", regs, reason, 2, SIGINT) ==
375 NOTIFY_STOP)
376 return;
377#ifdef CONFIG_MCA
378 /*
379 * Might actually be able to figure out what the guilty party
380 * is:
381 */
382 if (MCA_bus) {
383 mca_handle_nmi();
384 return;
385 }
386#endif
387 pr_emerg("Uhhuh. NMI received for unknown reason %02x on CPU %d.\n",
388 reason, smp_processor_id());
389
390 pr_emerg("Do you have a strange power saving mode enabled?\n");
391 if (unknown_nmi_panic || panic_on_unrecovered_nmi)
392 panic("NMI: Not continuing");
393
394 pr_emerg("Dazed and confused, but trying to continue\n");
395}
396
397static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
398{
399 unsigned char reason = 0;
400
401 /*
402 * CPU-specific NMI must be processed before non-CPU-specific
403 * NMI, otherwise we may lose it, because the CPU-specific
404 * NMI can not be detected/processed on other CPUs.
405 */
406 if (notify_die(DIE_NMI, "nmi", regs, 0, 2, SIGINT) == NOTIFY_STOP)
407 return;
408
409 /* Non-CPU-specific NMI: NMI sources can be processed on any CPU */
410 raw_spin_lock(&nmi_reason_lock);
411 reason = get_nmi_reason();
412
413 if (reason & NMI_REASON_MASK) {
414 if (reason & NMI_REASON_SERR)
415 pci_serr_error(reason, regs);
416 else if (reason & NMI_REASON_IOCHK)
417 io_check_error(reason, regs);
418#ifdef CONFIG_X86_32
419 /*
420 * Reassert NMI in case it became active
421 * meanwhile as it's edge-triggered:
422 */
423 reassert_nmi();
424#endif
425 raw_spin_unlock(&nmi_reason_lock);
426 return;
427 }
428 raw_spin_unlock(&nmi_reason_lock);
429
430 unknown_nmi_error(reason, regs);
431}
432
433dotraplinkage notrace __kprobes void
434do_nmi(struct pt_regs *regs, long error_code)
435{
436 nmi_enter();
437
438 inc_irq_stat(__nmi_count);
439
440 if (!ignore_nmis)
441 default_do_nmi(regs);
442
443 nmi_exit();
444}
445
446void stop_nmi(void)
447{
448 ignore_nmis++;
449}
450
451void restart_nmi(void)
452{
453 ignore_nmis--;
454}
455
456/* May run on IST stack. */ 301/* May run on IST stack. */
457dotraplinkage void __kprobes do_int3(struct pt_regs *regs, long error_code) 302dotraplinkage void __kprobes do_int3(struct pt_regs *regs, long error_code)
458{ 303{
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index 18ae83dd1cd7..b56c65de384d 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -56,7 +56,7 @@ DEFINE_VVAR(struct vsyscall_gtod_data, vsyscall_gtod_data) =
56 .lock = __SEQLOCK_UNLOCKED(__vsyscall_gtod_data.lock), 56 .lock = __SEQLOCK_UNLOCKED(__vsyscall_gtod_data.lock),
57}; 57};
58 58
59static enum { EMULATE, NATIVE, NONE } vsyscall_mode = EMULATE; 59static enum { EMULATE, NATIVE, NONE } vsyscall_mode = NATIVE;
60 60
61static int __init vsyscall_setup(char *str) 61static int __init vsyscall_setup(char *str)
62{ 62{
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 6f08bc940fa8..8b4cc5f067de 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -3603,7 +3603,7 @@ done_prefixes:
3603 break; 3603 break;
3604 case Src2CL: 3604 case Src2CL:
3605 ctxt->src2.bytes = 1; 3605 ctxt->src2.bytes = 1;
3606 ctxt->src2.val = ctxt->regs[VCPU_REGS_RCX] & 0x8; 3606 ctxt->src2.val = ctxt->regs[VCPU_REGS_RCX] & 0xff;
3607 break; 3607 break;
3608 case Src2ImmByte: 3608 case Src2ImmByte:
3609 rc = decode_imm(ctxt, &ctxt->src2, 1, true); 3609 rc = decode_imm(ctxt, &ctxt->src2, 1, true);
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 1c5b69373a00..8e8da7960dbe 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -400,7 +400,8 @@ static u64 __update_clear_spte_slow(u64 *sptep, u64 spte)
400 400
401 /* xchg acts as a barrier before the setting of the high bits */ 401 /* xchg acts as a barrier before the setting of the high bits */
402 orig.spte_low = xchg(&ssptep->spte_low, sspte.spte_low); 402 orig.spte_low = xchg(&ssptep->spte_low, sspte.spte_low);
403 orig.spte_high = ssptep->spte_high = sspte.spte_high; 403 orig.spte_high = ssptep->spte_high;
404 ssptep->spte_high = sspte.spte_high;
404 count_spte_clear(sptep, spte); 405 count_spte_clear(sptep, spte);
405 406
406 return orig.spte; 407 return orig.spte;
diff --git a/arch/x86/lib/insn.c b/arch/x86/lib/insn.c
index 9f33b984d0ef..374562ed6704 100644
--- a/arch/x86/lib/insn.c
+++ b/arch/x86/lib/insn.c
@@ -22,14 +22,23 @@
22#include <asm/inat.h> 22#include <asm/inat.h>
23#include <asm/insn.h> 23#include <asm/insn.h>
24 24
25#define get_next(t, insn) \ 25/* Verify next sizeof(t) bytes can be on the same instruction */
26 ({t r; r = *(t*)insn->next_byte; insn->next_byte += sizeof(t); r; }) 26#define validate_next(t, insn, n) \
27 ((insn)->next_byte + sizeof(t) + n - (insn)->kaddr <= MAX_INSN_SIZE)
28
29#define __get_next(t, insn) \
30 ({ t r = *(t*)insn->next_byte; insn->next_byte += sizeof(t); r; })
31
32#define __peek_nbyte_next(t, insn, n) \
33 ({ t r = *(t*)((insn)->next_byte + n); r; })
27 34
28#define peek_next(t, insn) \ 35#define get_next(t, insn) \
29 ({t r; r = *(t*)insn->next_byte; r; }) 36 ({ if (unlikely(!validate_next(t, insn, 0))) goto err_out; __get_next(t, insn); })
30 37
31#define peek_nbyte_next(t, insn, n) \ 38#define peek_nbyte_next(t, insn, n) \
32 ({t r; r = *(t*)((insn)->next_byte + n); r; }) 39 ({ if (unlikely(!validate_next(t, insn, n))) goto err_out; __peek_nbyte_next(t, insn, n); })
40
41#define peek_next(t, insn) peek_nbyte_next(t, insn, 0)
33 42
34/** 43/**
35 * insn_init() - initialize struct insn 44 * insn_init() - initialize struct insn
@@ -158,6 +167,8 @@ vex_end:
158 insn->vex_prefix.got = 1; 167 insn->vex_prefix.got = 1;
159 168
160 prefixes->got = 1; 169 prefixes->got = 1;
170
171err_out:
161 return; 172 return;
162} 173}
163 174
@@ -208,6 +219,9 @@ void insn_get_opcode(struct insn *insn)
208 insn->attr = 0; /* This instruction is bad */ 219 insn->attr = 0; /* This instruction is bad */
209end: 220end:
210 opcode->got = 1; 221 opcode->got = 1;
222
223err_out:
224 return;
211} 225}
212 226
213/** 227/**
@@ -241,6 +255,9 @@ void insn_get_modrm(struct insn *insn)
241 if (insn->x86_64 && inat_is_force64(insn->attr)) 255 if (insn->x86_64 && inat_is_force64(insn->attr))
242 insn->opnd_bytes = 8; 256 insn->opnd_bytes = 8;
243 modrm->got = 1; 257 modrm->got = 1;
258
259err_out:
260 return;
244} 261}
245 262
246 263
@@ -290,6 +307,9 @@ void insn_get_sib(struct insn *insn)
290 } 307 }
291 } 308 }
292 insn->sib.got = 1; 309 insn->sib.got = 1;
310
311err_out:
312 return;
293} 313}
294 314
295 315
@@ -351,6 +371,9 @@ void insn_get_displacement(struct insn *insn)
351 } 371 }
352out: 372out:
353 insn->displacement.got = 1; 373 insn->displacement.got = 1;
374
375err_out:
376 return;
354} 377}
355 378
356/* Decode moffset16/32/64 */ 379/* Decode moffset16/32/64 */
@@ -373,6 +396,9 @@ static void __get_moffset(struct insn *insn)
373 break; 396 break;
374 } 397 }
375 insn->moffset1.got = insn->moffset2.got = 1; 398 insn->moffset1.got = insn->moffset2.got = 1;
399
400err_out:
401 return;
376} 402}
377 403
378/* Decode imm v32(Iz) */ 404/* Decode imm v32(Iz) */
@@ -389,6 +415,9 @@ static void __get_immv32(struct insn *insn)
389 insn->immediate.nbytes = 4; 415 insn->immediate.nbytes = 4;
390 break; 416 break;
391 } 417 }
418
419err_out:
420 return;
392} 421}
393 422
394/* Decode imm v64(Iv/Ov) */ 423/* Decode imm v64(Iv/Ov) */
@@ -411,6 +440,9 @@ static void __get_immv(struct insn *insn)
411 break; 440 break;
412 } 441 }
413 insn->immediate1.got = insn->immediate2.got = 1; 442 insn->immediate1.got = insn->immediate2.got = 1;
443
444err_out:
445 return;
414} 446}
415 447
416/* Decode ptr16:16/32(Ap) */ 448/* Decode ptr16:16/32(Ap) */
@@ -432,6 +464,9 @@ static void __get_immptr(struct insn *insn)
432 insn->immediate2.value = get_next(unsigned short, insn); 464 insn->immediate2.value = get_next(unsigned short, insn);
433 insn->immediate2.nbytes = 2; 465 insn->immediate2.nbytes = 2;
434 insn->immediate1.got = insn->immediate2.got = 1; 466 insn->immediate1.got = insn->immediate2.got = 1;
467
468err_out:
469 return;
435} 470}
436 471
437/** 472/**
@@ -496,6 +531,9 @@ void insn_get_immediate(struct insn *insn)
496 } 531 }
497done: 532done:
498 insn->immediate.got = 1; 533 insn->immediate.got = 1;
534
535err_out:
536 return;
499} 537}
500 538
501/** 539/**
diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c
index 0d17c8c50acd..5db0490deb07 100644
--- a/arch/x86/mm/fault.c
+++ b/arch/x86/mm/fault.c
@@ -17,7 +17,7 @@
17#include <asm/traps.h> /* dotraplinkage, ... */ 17#include <asm/traps.h> /* dotraplinkage, ... */
18#include <asm/pgalloc.h> /* pgd_*(), ... */ 18#include <asm/pgalloc.h> /* pgd_*(), ... */
19#include <asm/kmemcheck.h> /* kmemcheck_*(), ... */ 19#include <asm/kmemcheck.h> /* kmemcheck_*(), ... */
20#include <asm/vsyscall.h> 20#include <asm/fixmap.h> /* VSYSCALL_START */
21 21
22/* 22/*
23 * Page fault error code bits: 23 * Page fault error code bits:
@@ -420,12 +420,14 @@ static noinline __kprobes int vmalloc_fault(unsigned long address)
420 return 0; 420 return 0;
421} 421}
422 422
423#ifdef CONFIG_CPU_SUP_AMD
423static const char errata93_warning[] = 424static const char errata93_warning[] =
424KERN_ERR 425KERN_ERR
425"******* Your BIOS seems to not contain a fix for K8 errata #93\n" 426"******* Your BIOS seems to not contain a fix for K8 errata #93\n"
426"******* Working around it, but it may cause SEGVs or burn power.\n" 427"******* Working around it, but it may cause SEGVs or burn power.\n"
427"******* Please consider a BIOS update.\n" 428"******* Please consider a BIOS update.\n"
428"******* Disabling USB legacy in the BIOS may also help.\n"; 429"******* Disabling USB legacy in the BIOS may also help.\n";
430#endif
429 431
430/* 432/*
431 * No vm86 mode in 64-bit mode: 433 * No vm86 mode in 64-bit mode:
@@ -505,7 +507,11 @@ bad:
505 */ 507 */
506static int is_errata93(struct pt_regs *regs, unsigned long address) 508static int is_errata93(struct pt_regs *regs, unsigned long address)
507{ 509{
508#ifdef CONFIG_X86_64 510#if defined(CONFIG_X86_64) && defined(CONFIG_CPU_SUP_AMD)
511 if (boot_cpu_data.x86_vendor != X86_VENDOR_AMD
512 || boot_cpu_data.x86 != 0xf)
513 return 0;
514
509 if (address != regs->ip) 515 if (address != regs->ip)
510 return 0; 516 return 0;
511 517
diff --git a/arch/x86/mm/init.c b/arch/x86/mm/init.c
index 30326443ab81..87488b93a65c 100644
--- a/arch/x86/mm/init.c
+++ b/arch/x86/mm/init.c
@@ -63,9 +63,8 @@ static void __init find_early_table_space(unsigned long end, int use_pse,
63#ifdef CONFIG_X86_32 63#ifdef CONFIG_X86_32
64 /* for fixmap */ 64 /* for fixmap */
65 tables += roundup(__end_of_fixed_addresses * sizeof(pte_t), PAGE_SIZE); 65 tables += roundup(__end_of_fixed_addresses * sizeof(pte_t), PAGE_SIZE);
66
67 good_end = max_pfn_mapped << PAGE_SHIFT;
68#endif 66#endif
67 good_end = max_pfn_mapped << PAGE_SHIFT;
69 68
70 base = memblock_find_in_range(start, good_end, tables, PAGE_SIZE); 69 base = memblock_find_in_range(start, good_end, tables, PAGE_SIZE);
71 if (base == MEMBLOCK_ERROR) 70 if (base == MEMBLOCK_ERROR)
diff --git a/arch/x86/mm/mmap.c b/arch/x86/mm/mmap.c
index 1dab5194fd9d..4b5ba85eb5c9 100644
--- a/arch/x86/mm/mmap.c
+++ b/arch/x86/mm/mmap.c
@@ -31,6 +31,10 @@
31#include <linux/sched.h> 31#include <linux/sched.h>
32#include <asm/elf.h> 32#include <asm/elf.h>
33 33
34struct __read_mostly va_alignment va_align = {
35 .flags = -1,
36};
37
34static unsigned int stack_maxrandom_size(void) 38static unsigned int stack_maxrandom_size(void)
35{ 39{
36 unsigned int max = 0; 40 unsigned int max = 0;
@@ -42,7 +46,6 @@ static unsigned int stack_maxrandom_size(void)
42 return max; 46 return max;
43} 47}
44 48
45
46/* 49/*
47 * Top of mmap area (just below the process stack). 50 * Top of mmap area (just below the process stack).
48 * 51 *
@@ -51,21 +54,6 @@ static unsigned int stack_maxrandom_size(void)
51#define MIN_GAP (128*1024*1024UL + stack_maxrandom_size()) 54#define MIN_GAP (128*1024*1024UL + stack_maxrandom_size())
52#define MAX_GAP (TASK_SIZE/6*5) 55#define MAX_GAP (TASK_SIZE/6*5)
53 56
54/*
55 * True on X86_32 or when emulating IA32 on X86_64
56 */
57static int mmap_is_ia32(void)
58{
59#ifdef CONFIG_X86_32
60 return 1;
61#endif
62#ifdef CONFIG_IA32_EMULATION
63 if (test_thread_flag(TIF_IA32))
64 return 1;
65#endif
66 return 0;
67}
68
69static int mmap_is_legacy(void) 57static int mmap_is_legacy(void)
70{ 58{
71 if (current->personality & ADDR_COMPAT_LAYOUT) 59 if (current->personality & ADDR_COMPAT_LAYOUT)
diff --git a/arch/x86/mm/mmio-mod.c b/arch/x86/mm/mmio-mod.c
index 67421f38a215..de54b9b278a7 100644
--- a/arch/x86/mm/mmio-mod.c
+++ b/arch/x86/mm/mmio-mod.c
@@ -29,7 +29,6 @@
29#include <linux/slab.h> 29#include <linux/slab.h>
30#include <linux/uaccess.h> 30#include <linux/uaccess.h>
31#include <linux/io.h> 31#include <linux/io.h>
32#include <linux/version.h>
33#include <linux/kallsyms.h> 32#include <linux/kallsyms.h>
34#include <asm/pgtable.h> 33#include <asm/pgtable.h>
35#include <linux/mmiotrace.h> 34#include <linux/mmiotrace.h>
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
index 68894fdc034b..75f9528e0372 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -61,26 +61,15 @@ u64 op_x86_get_ctrl(struct op_x86_model_spec const *model,
61} 61}
62 62
63 63
64static int profile_exceptions_notify(struct notifier_block *self, 64static int profile_exceptions_notify(unsigned int val, struct pt_regs *regs)
65 unsigned long val, void *data)
66{ 65{
67 struct die_args *args = (struct die_args *)data; 66 if (ctr_running)
68 int ret = NOTIFY_DONE; 67 model->check_ctrs(regs, &__get_cpu_var(cpu_msrs));
69 68 else if (!nmi_enabled)
70 switch (val) { 69 return NMI_DONE;
71 case DIE_NMI: 70 else
72 if (ctr_running) 71 model->stop(&__get_cpu_var(cpu_msrs));
73 model->check_ctrs(args->regs, &__get_cpu_var(cpu_msrs)); 72 return NMI_HANDLED;
74 else if (!nmi_enabled)
75 break;
76 else
77 model->stop(&__get_cpu_var(cpu_msrs));
78 ret = NOTIFY_STOP;
79 break;
80 default:
81 break;
82 }
83 return ret;
84} 73}
85 74
86static void nmi_cpu_save_registers(struct op_msrs *msrs) 75static void nmi_cpu_save_registers(struct op_msrs *msrs)
@@ -355,20 +344,14 @@ static void nmi_cpu_setup(void *dummy)
355 int cpu = smp_processor_id(); 344 int cpu = smp_processor_id();
356 struct op_msrs *msrs = &per_cpu(cpu_msrs, cpu); 345 struct op_msrs *msrs = &per_cpu(cpu_msrs, cpu);
357 nmi_cpu_save_registers(msrs); 346 nmi_cpu_save_registers(msrs);
358 spin_lock(&oprofilefs_lock); 347 raw_spin_lock(&oprofilefs_lock);
359 model->setup_ctrs(model, msrs); 348 model->setup_ctrs(model, msrs);
360 nmi_cpu_setup_mux(cpu, msrs); 349 nmi_cpu_setup_mux(cpu, msrs);
361 spin_unlock(&oprofilefs_lock); 350 raw_spin_unlock(&oprofilefs_lock);
362 per_cpu(saved_lvtpc, cpu) = apic_read(APIC_LVTPC); 351 per_cpu(saved_lvtpc, cpu) = apic_read(APIC_LVTPC);
363 apic_write(APIC_LVTPC, APIC_DM_NMI); 352 apic_write(APIC_LVTPC, APIC_DM_NMI);
364} 353}
365 354
366static struct notifier_block profile_exceptions_nb = {
367 .notifier_call = profile_exceptions_notify,
368 .next = NULL,
369 .priority = NMI_LOCAL_LOW_PRIOR,
370};
371
372static void nmi_cpu_restore_registers(struct op_msrs *msrs) 355static void nmi_cpu_restore_registers(struct op_msrs *msrs)
373{ 356{
374 struct op_msr *counters = msrs->counters; 357 struct op_msr *counters = msrs->counters;
@@ -402,8 +385,6 @@ static void nmi_cpu_shutdown(void *dummy)
402 apic_write(APIC_LVTPC, per_cpu(saved_lvtpc, cpu)); 385 apic_write(APIC_LVTPC, per_cpu(saved_lvtpc, cpu));
403 apic_write(APIC_LVTERR, v); 386 apic_write(APIC_LVTERR, v);
404 nmi_cpu_restore_registers(msrs); 387 nmi_cpu_restore_registers(msrs);
405 if (model->cpu_down)
406 model->cpu_down();
407} 388}
408 389
409static void nmi_cpu_up(void *dummy) 390static void nmi_cpu_up(void *dummy)
@@ -508,7 +489,8 @@ static int nmi_setup(void)
508 ctr_running = 0; 489 ctr_running = 0;
509 /* make variables visible to the nmi handler: */ 490 /* make variables visible to the nmi handler: */
510 smp_mb(); 491 smp_mb();
511 err = register_die_notifier(&profile_exceptions_nb); 492 err = register_nmi_handler(NMI_LOCAL, profile_exceptions_notify,
493 0, "oprofile");
512 if (err) 494 if (err)
513 goto fail; 495 goto fail;
514 496
@@ -538,7 +520,7 @@ static void nmi_shutdown(void)
538 put_online_cpus(); 520 put_online_cpus();
539 /* make variables visible to the nmi handler: */ 521 /* make variables visible to the nmi handler: */
540 smp_mb(); 522 smp_mb();
541 unregister_die_notifier(&profile_exceptions_nb); 523 unregister_nmi_handler(NMI_LOCAL, "oprofile");
542 msrs = &get_cpu_var(cpu_msrs); 524 msrs = &get_cpu_var(cpu_msrs);
543 model->shutdown(msrs); 525 model->shutdown(msrs);
544 free_msrs(); 526 free_msrs();
diff --git a/arch/x86/oprofile/nmi_timer_int.c b/arch/x86/oprofile/nmi_timer_int.c
index 720bf5a53c51..7f8052cd6620 100644
--- a/arch/x86/oprofile/nmi_timer_int.c
+++ b/arch/x86/oprofile/nmi_timer_int.c
@@ -18,32 +18,16 @@
18#include <asm/apic.h> 18#include <asm/apic.h>
19#include <asm/ptrace.h> 19#include <asm/ptrace.h>
20 20
21static int profile_timer_exceptions_notify(struct notifier_block *self, 21static int profile_timer_exceptions_notify(unsigned int val, struct pt_regs *regs)
22 unsigned long val, void *data)
23{ 22{
24 struct die_args *args = (struct die_args *)data; 23 oprofile_add_sample(regs, 0);
25 int ret = NOTIFY_DONE; 24 return NMI_HANDLED;
26
27 switch (val) {
28 case DIE_NMI:
29 oprofile_add_sample(args->regs, 0);
30 ret = NOTIFY_STOP;
31 break;
32 default:
33 break;
34 }
35 return ret;
36} 25}
37 26
38static struct notifier_block profile_timer_exceptions_nb = {
39 .notifier_call = profile_timer_exceptions_notify,
40 .next = NULL,
41 .priority = NMI_LOW_PRIOR,
42};
43
44static int timer_start(void) 27static int timer_start(void)
45{ 28{
46 if (register_die_notifier(&profile_timer_exceptions_nb)) 29 if (register_nmi_handler(NMI_LOCAL, profile_timer_exceptions_notify,
30 0, "oprofile-timer"))
47 return 1; 31 return 1;
48 return 0; 32 return 0;
49} 33}
@@ -51,7 +35,7 @@ static int timer_start(void)
51 35
52static void timer_stop(void) 36static void timer_stop(void)
53{ 37{
54 unregister_die_notifier(&profile_timer_exceptions_nb); 38 unregister_nmi_handler(NMI_LOCAL, "oprofile-timer");
55 synchronize_sched(); /* Allow already-started NMIs to complete. */ 39 synchronize_sched(); /* Allow already-started NMIs to complete. */
56} 40}
57 41
diff --git a/arch/x86/oprofile/op_model_amd.c b/arch/x86/oprofile/op_model_amd.c
index 9cbb710dc94b..303f08637826 100644
--- a/arch/x86/oprofile/op_model_amd.c
+++ b/arch/x86/oprofile/op_model_amd.c
@@ -29,8 +29,6 @@
29#include "op_x86_model.h" 29#include "op_x86_model.h"
30#include "op_counter.h" 30#include "op_counter.h"
31 31
32#define NUM_COUNTERS 4
33#define NUM_COUNTERS_F15H 6
34#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX 32#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
35#define NUM_VIRT_COUNTERS 32 33#define NUM_VIRT_COUNTERS 32
36#else 34#else
@@ -70,62 +68,12 @@ static struct ibs_config ibs_config;
70static struct ibs_state ibs_state; 68static struct ibs_state ibs_state;
71 69
72/* 70/*
73 * IBS cpuid feature detection
74 */
75
76#define IBS_CPUID_FEATURES 0x8000001b
77
78/*
79 * Same bit mask as for IBS cpuid feature flags (Fn8000_001B_EAX), but
80 * bit 0 is used to indicate the existence of IBS.
81 */
82#define IBS_CAPS_AVAIL (1U<<0)
83#define IBS_CAPS_FETCHSAM (1U<<1)
84#define IBS_CAPS_OPSAM (1U<<2)
85#define IBS_CAPS_RDWROPCNT (1U<<3)
86#define IBS_CAPS_OPCNT (1U<<4)
87#define IBS_CAPS_BRNTRGT (1U<<5)
88#define IBS_CAPS_OPCNTEXT (1U<<6)
89
90#define IBS_CAPS_DEFAULT (IBS_CAPS_AVAIL \
91 | IBS_CAPS_FETCHSAM \
92 | IBS_CAPS_OPSAM)
93
94/*
95 * IBS APIC setup
96 */
97#define IBSCTL 0x1cc
98#define IBSCTL_LVT_OFFSET_VALID (1ULL<<8)
99#define IBSCTL_LVT_OFFSET_MASK 0x0F
100
101/*
102 * IBS randomization macros 71 * IBS randomization macros
103 */ 72 */
104#define IBS_RANDOM_BITS 12 73#define IBS_RANDOM_BITS 12
105#define IBS_RANDOM_MASK ((1ULL << IBS_RANDOM_BITS) - 1) 74#define IBS_RANDOM_MASK ((1ULL << IBS_RANDOM_BITS) - 1)
106#define IBS_RANDOM_MAXCNT_OFFSET (1ULL << (IBS_RANDOM_BITS - 5)) 75#define IBS_RANDOM_MAXCNT_OFFSET (1ULL << (IBS_RANDOM_BITS - 5))
107 76
108static u32 get_ibs_caps(void)
109{
110 u32 ibs_caps;
111 unsigned int max_level;
112
113 if (!boot_cpu_has(X86_FEATURE_IBS))
114 return 0;
115
116 /* check IBS cpuid feature flags */
117 max_level = cpuid_eax(0x80000000);
118 if (max_level < IBS_CPUID_FEATURES)
119 return IBS_CAPS_DEFAULT;
120
121 ibs_caps = cpuid_eax(IBS_CPUID_FEATURES);
122 if (!(ibs_caps & IBS_CAPS_AVAIL))
123 /* cpuid flags not valid */
124 return IBS_CAPS_DEFAULT;
125
126 return ibs_caps;
127}
128
129/* 77/*
130 * 16-bit Linear Feedback Shift Register (LFSR) 78 * 16-bit Linear Feedback Shift Register (LFSR)
131 * 79 *
@@ -316,81 +264,6 @@ static void op_amd_stop_ibs(void)
316 wrmsrl(MSR_AMD64_IBSOPCTL, 0); 264 wrmsrl(MSR_AMD64_IBSOPCTL, 0);
317} 265}
318 266
319static inline int get_eilvt(int offset)
320{
321 return !setup_APIC_eilvt(offset, 0, APIC_EILVT_MSG_NMI, 1);
322}
323
324static inline int put_eilvt(int offset)
325{
326 return !setup_APIC_eilvt(offset, 0, 0, 1);
327}
328
329static inline int ibs_eilvt_valid(void)
330{
331 int offset;
332 u64 val;
333 int valid = 0;
334
335 preempt_disable();
336
337 rdmsrl(MSR_AMD64_IBSCTL, val);
338 offset = val & IBSCTL_LVT_OFFSET_MASK;
339
340 if (!(val & IBSCTL_LVT_OFFSET_VALID)) {
341 pr_err(FW_BUG "cpu %d, invalid IBS interrupt offset %d (MSR%08X=0x%016llx)\n",
342 smp_processor_id(), offset, MSR_AMD64_IBSCTL, val);
343 goto out;
344 }
345
346 if (!get_eilvt(offset)) {
347 pr_err(FW_BUG "cpu %d, IBS interrupt offset %d not available (MSR%08X=0x%016llx)\n",
348 smp_processor_id(), offset, MSR_AMD64_IBSCTL, val);
349 goto out;
350 }
351
352 valid = 1;
353out:
354 preempt_enable();
355
356 return valid;
357}
358
359static inline int get_ibs_offset(void)
360{
361 u64 val;
362
363 rdmsrl(MSR_AMD64_IBSCTL, val);
364 if (!(val & IBSCTL_LVT_OFFSET_VALID))
365 return -EINVAL;
366
367 return val & IBSCTL_LVT_OFFSET_MASK;
368}
369
370static void setup_APIC_ibs(void)
371{
372 int offset;
373
374 offset = get_ibs_offset();
375 if (offset < 0)
376 goto failed;
377
378 if (!setup_APIC_eilvt(offset, 0, APIC_EILVT_MSG_NMI, 0))
379 return;
380failed:
381 pr_warn("oprofile: IBS APIC setup failed on cpu #%d\n",
382 smp_processor_id());
383}
384
385static void clear_APIC_ibs(void)
386{
387 int offset;
388
389 offset = get_ibs_offset();
390 if (offset >= 0)
391 setup_APIC_eilvt(offset, 0, APIC_EILVT_MSG_FIX, 1);
392}
393
394#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX 267#ifdef CONFIG_OPROFILE_EVENT_MULTIPLEX
395 268
396static void op_mux_switch_ctrl(struct op_x86_model_spec const *model, 269static void op_mux_switch_ctrl(struct op_x86_model_spec const *model,
@@ -439,7 +312,7 @@ static int op_amd_fill_in_addresses(struct op_msrs * const msrs)
439 goto fail; 312 goto fail;
440 } 313 }
441 /* both registers must be reserved */ 314 /* both registers must be reserved */
442 if (num_counters == NUM_COUNTERS_F15H) { 315 if (num_counters == AMD64_NUM_COUNTERS_F15H) {
443 msrs->counters[i].addr = MSR_F15H_PERF_CTR + (i << 1); 316 msrs->counters[i].addr = MSR_F15H_PERF_CTR + (i << 1);
444 msrs->controls[i].addr = MSR_F15H_PERF_CTL + (i << 1); 317 msrs->controls[i].addr = MSR_F15H_PERF_CTL + (i << 1);
445 } else { 318 } else {
@@ -504,15 +377,6 @@ static void op_amd_setup_ctrs(struct op_x86_model_spec const *model,
504 val |= op_x86_get_ctrl(model, &counter_config[virt]); 377 val |= op_x86_get_ctrl(model, &counter_config[virt]);
505 wrmsrl(msrs->controls[i].addr, val); 378 wrmsrl(msrs->controls[i].addr, val);
506 } 379 }
507
508 if (ibs_caps)
509 setup_APIC_ibs();
510}
511
512static void op_amd_cpu_shutdown(void)
513{
514 if (ibs_caps)
515 clear_APIC_ibs();
516} 380}
517 381
518static int op_amd_check_ctrs(struct pt_regs * const regs, 382static int op_amd_check_ctrs(struct pt_regs * const regs,
@@ -575,86 +439,6 @@ static void op_amd_stop(struct op_msrs const * const msrs)
575 op_amd_stop_ibs(); 439 op_amd_stop_ibs();
576} 440}
577 441
578static int setup_ibs_ctl(int ibs_eilvt_off)
579{
580 struct pci_dev *cpu_cfg;
581 int nodes;
582 u32 value = 0;
583
584 nodes = 0;
585 cpu_cfg = NULL;
586 do {
587 cpu_cfg = pci_get_device(PCI_VENDOR_ID_AMD,
588 PCI_DEVICE_ID_AMD_10H_NB_MISC,
589 cpu_cfg);
590 if (!cpu_cfg)
591 break;
592 ++nodes;
593 pci_write_config_dword(cpu_cfg, IBSCTL, ibs_eilvt_off
594 | IBSCTL_LVT_OFFSET_VALID);
595 pci_read_config_dword(cpu_cfg, IBSCTL, &value);
596 if (value != (ibs_eilvt_off | IBSCTL_LVT_OFFSET_VALID)) {
597 pci_dev_put(cpu_cfg);
598 printk(KERN_DEBUG "Failed to setup IBS LVT offset, "
599 "IBSCTL = 0x%08x\n", value);
600 return -EINVAL;
601 }
602 } while (1);
603
604 if (!nodes) {
605 printk(KERN_DEBUG "No CPU node configured for IBS\n");
606 return -ENODEV;
607 }
608
609 return 0;
610}
611
612/*
613 * This runs only on the current cpu. We try to find an LVT offset and
614 * setup the local APIC. For this we must disable preemption. On
615 * success we initialize all nodes with this offset. This updates then
616 * the offset in the IBS_CTL per-node msr. The per-core APIC setup of
617 * the IBS interrupt vector is called from op_amd_setup_ctrs()/op_-
618 * amd_cpu_shutdown() using the new offset.
619 */
620static int force_ibs_eilvt_setup(void)
621{
622 int offset;
623 int ret;
624
625 preempt_disable();
626 /* find the next free available EILVT entry, skip offset 0 */
627 for (offset = 1; offset < APIC_EILVT_NR_MAX; offset++) {
628 if (get_eilvt(offset))
629 break;
630 }
631 preempt_enable();
632
633 if (offset == APIC_EILVT_NR_MAX) {
634 printk(KERN_DEBUG "No EILVT entry available\n");
635 return -EBUSY;
636 }
637
638 ret = setup_ibs_ctl(offset);
639 if (ret)
640 goto out;
641
642 if (!ibs_eilvt_valid()) {
643 ret = -EFAULT;
644 goto out;
645 }
646
647 pr_err(FW_BUG "using offset %d for IBS interrupts\n", offset);
648 pr_err(FW_BUG "workaround enabled for IBS LVT offset\n");
649
650 return 0;
651out:
652 preempt_disable();
653 put_eilvt(offset);
654 preempt_enable();
655 return ret;
656}
657
658/* 442/*
659 * check and reserve APIC extended interrupt LVT offset for IBS if 443 * check and reserve APIC extended interrupt LVT offset for IBS if
660 * available 444 * available
@@ -667,17 +451,6 @@ static void init_ibs(void)
667 if (!ibs_caps) 451 if (!ibs_caps)
668 return; 452 return;
669 453
670 if (ibs_eilvt_valid())
671 goto out;
672
673 if (!force_ibs_eilvt_setup())
674 goto out;
675
676 /* Failed to setup ibs */
677 ibs_caps = 0;
678 return;
679
680out:
681 printk(KERN_INFO "oprofile: AMD IBS detected (0x%08x)\n", ibs_caps); 454 printk(KERN_INFO "oprofile: AMD IBS detected (0x%08x)\n", ibs_caps);
682} 455}
683 456
@@ -741,9 +514,9 @@ static int op_amd_init(struct oprofile_operations *ops)
741 ops->create_files = setup_ibs_files; 514 ops->create_files = setup_ibs_files;
742 515
743 if (boot_cpu_data.x86 == 0x15) { 516 if (boot_cpu_data.x86 == 0x15) {
744 num_counters = NUM_COUNTERS_F15H; 517 num_counters = AMD64_NUM_COUNTERS_F15H;
745 } else { 518 } else {
746 num_counters = NUM_COUNTERS; 519 num_counters = AMD64_NUM_COUNTERS;
747 } 520 }
748 521
749 op_amd_spec.num_counters = num_counters; 522 op_amd_spec.num_counters = num_counters;
@@ -760,7 +533,6 @@ struct op_x86_model_spec op_amd_spec = {
760 .init = op_amd_init, 533 .init = op_amd_init,
761 .fill_in_addresses = &op_amd_fill_in_addresses, 534 .fill_in_addresses = &op_amd_fill_in_addresses,
762 .setup_ctrs = &op_amd_setup_ctrs, 535 .setup_ctrs = &op_amd_setup_ctrs,
763 .cpu_down = &op_amd_cpu_shutdown,
764 .check_ctrs = &op_amd_check_ctrs, 536 .check_ctrs = &op_amd_check_ctrs,
765 .start = &op_amd_start, 537 .start = &op_amd_start,
766 .stop = &op_amd_stop, 538 .stop = &op_amd_stop,
diff --git a/arch/x86/oprofile/op_model_ppro.c b/arch/x86/oprofile/op_model_ppro.c
index 94b745045e45..d90528ea5412 100644
--- a/arch/x86/oprofile/op_model_ppro.c
+++ b/arch/x86/oprofile/op_model_ppro.c
@@ -28,7 +28,7 @@ static int counter_width = 32;
28 28
29#define MSR_PPRO_EVENTSEL_RESERVED ((0xFFFFFFFFULL<<32)|(1ULL<<21)) 29#define MSR_PPRO_EVENTSEL_RESERVED ((0xFFFFFFFFULL<<32)|(1ULL<<21))
30 30
31static u64 *reset_value; 31static u64 reset_value[OP_MAX_COUNTER];
32 32
33static void ppro_shutdown(struct op_msrs const * const msrs) 33static void ppro_shutdown(struct op_msrs const * const msrs)
34{ 34{
@@ -40,10 +40,6 @@ static void ppro_shutdown(struct op_msrs const * const msrs)
40 release_perfctr_nmi(MSR_P6_PERFCTR0 + i); 40 release_perfctr_nmi(MSR_P6_PERFCTR0 + i);
41 release_evntsel_nmi(MSR_P6_EVNTSEL0 + i); 41 release_evntsel_nmi(MSR_P6_EVNTSEL0 + i);
42 } 42 }
43 if (reset_value) {
44 kfree(reset_value);
45 reset_value = NULL;
46 }
47} 43}
48 44
49static int ppro_fill_in_addresses(struct op_msrs * const msrs) 45static int ppro_fill_in_addresses(struct op_msrs * const msrs)
@@ -79,13 +75,6 @@ static void ppro_setup_ctrs(struct op_x86_model_spec const *model,
79 u64 val; 75 u64 val;
80 int i; 76 int i;
81 77
82 if (!reset_value) {
83 reset_value = kzalloc(sizeof(reset_value[0]) * num_counters,
84 GFP_ATOMIC);
85 if (!reset_value)
86 return;
87 }
88
89 if (cpu_has_arch_perfmon) { 78 if (cpu_has_arch_perfmon) {
90 union cpuid10_eax eax; 79 union cpuid10_eax eax;
91 eax.full = cpuid_eax(0xa); 80 eax.full = cpuid_eax(0xa);
@@ -141,13 +130,6 @@ static int ppro_check_ctrs(struct pt_regs * const regs,
141 u64 val; 130 u64 val;
142 int i; 131 int i;
143 132
144 /*
145 * This can happen if perf counters are in use when
146 * we steal the die notifier NMI.
147 */
148 if (unlikely(!reset_value))
149 goto out;
150
151 for (i = 0; i < num_counters; ++i) { 133 for (i = 0; i < num_counters; ++i) {
152 if (!reset_value[i]) 134 if (!reset_value[i])
153 continue; 135 continue;
@@ -158,7 +140,6 @@ static int ppro_check_ctrs(struct pt_regs * const regs,
158 wrmsrl(msrs->counters[i].addr, -reset_value[i]); 140 wrmsrl(msrs->counters[i].addr, -reset_value[i]);
159 } 141 }
160 142
161out:
162 /* Only P6 based Pentium M need to re-unmask the apic vector but it 143 /* Only P6 based Pentium M need to re-unmask the apic vector but it
163 * doesn't hurt other P6 variant */ 144 * doesn't hurt other P6 variant */
164 apic_write(APIC_LVTPC, apic_read(APIC_LVTPC) & ~APIC_LVT_MASKED); 145 apic_write(APIC_LVTPC, apic_read(APIC_LVTPC) & ~APIC_LVT_MASKED);
@@ -179,8 +160,6 @@ static void ppro_start(struct op_msrs const * const msrs)
179 u64 val; 160 u64 val;
180 int i; 161 int i;
181 162
182 if (!reset_value)
183 return;
184 for (i = 0; i < num_counters; ++i) { 163 for (i = 0; i < num_counters; ++i) {
185 if (reset_value[i]) { 164 if (reset_value[i]) {
186 rdmsrl(msrs->controls[i].addr, val); 165 rdmsrl(msrs->controls[i].addr, val);
@@ -196,8 +175,6 @@ static void ppro_stop(struct op_msrs const * const msrs)
196 u64 val; 175 u64 val;
197 int i; 176 int i;
198 177
199 if (!reset_value)
200 return;
201 for (i = 0; i < num_counters; ++i) { 178 for (i = 0; i < num_counters; ++i) {
202 if (!reset_value[i]) 179 if (!reset_value[i])
203 continue; 180 continue;
@@ -242,7 +219,7 @@ static void arch_perfmon_setup_counters(void)
242 eax.split.bit_width = 40; 219 eax.split.bit_width = 40;
243 } 220 }
244 221
245 num_counters = eax.split.num_counters; 222 num_counters = min((int)eax.split.num_counters, OP_MAX_COUNTER);
246 223
247 op_arch_perfmon_spec.num_counters = num_counters; 224 op_arch_perfmon_spec.num_counters = num_counters;
248 op_arch_perfmon_spec.num_controls = num_counters; 225 op_arch_perfmon_spec.num_controls = num_counters;
diff --git a/arch/x86/oprofile/op_x86_model.h b/arch/x86/oprofile/op_x86_model.h
index 89017fa1fd63..71e8a67337e2 100644
--- a/arch/x86/oprofile/op_x86_model.h
+++ b/arch/x86/oprofile/op_x86_model.h
@@ -43,7 +43,6 @@ struct op_x86_model_spec {
43 int (*fill_in_addresses)(struct op_msrs * const msrs); 43 int (*fill_in_addresses)(struct op_msrs * const msrs);
44 void (*setup_ctrs)(struct op_x86_model_spec const *model, 44 void (*setup_ctrs)(struct op_x86_model_spec const *model,
45 struct op_msrs const * const msrs); 45 struct op_msrs const * const msrs);
46 void (*cpu_down)(void);
47 int (*check_ctrs)(struct pt_regs * const regs, 46 int (*check_ctrs)(struct pt_regs * const regs,
48 struct op_msrs const * const msrs); 47 struct op_msrs const * const msrs);
49 void (*start)(struct op_msrs const * const msrs); 48 void (*start)(struct op_msrs const * const msrs);
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 039d91315bc5..404f21a3ff9e 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -43,6 +43,17 @@ static const struct dmi_system_id pci_use_crs_table[] __initconst = {
43 DMI_MATCH(DMI_PRODUCT_NAME, "ALiveSATA2-GLAN"), 43 DMI_MATCH(DMI_PRODUCT_NAME, "ALiveSATA2-GLAN"),
44 }, 44 },
45 }, 45 },
46 /* https://bugzilla.kernel.org/show_bug.cgi?id=30552 */
47 /* 2006 AMD HT/VIA system with two host bridges */
48 {
49 .callback = set_use_crs,
50 .ident = "ASUS M2V-MX SE",
51 .matches = {
52 DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer INC."),
53 DMI_MATCH(DMI_BOARD_NAME, "M2V-MX SE"),
54 DMI_MATCH(DMI_BIOS_VENDOR, "American Megatrends Inc."),
55 },
56 },
46 {} 57 {}
47}; 58};
48 59
diff --git a/arch/x86/pci/xen.c b/arch/x86/pci/xen.c
index 1017c7bee388..492ade8c978e 100644
--- a/arch/x86/pci/xen.c
+++ b/arch/x86/pci/xen.c
@@ -175,8 +175,10 @@ static int xen_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
175 "pcifront-msi-x" : 175 "pcifront-msi-x" :
176 "pcifront-msi", 176 "pcifront-msi",
177 DOMID_SELF); 177 DOMID_SELF);
178 if (irq < 0) 178 if (irq < 0) {
179 ret = irq;
179 goto free; 180 goto free;
181 }
180 i++; 182 i++;
181 } 183 }
182 kfree(v); 184 kfree(v);
@@ -221,8 +223,10 @@ static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
221 if (msg.data != XEN_PIRQ_MSI_DATA || 223 if (msg.data != XEN_PIRQ_MSI_DATA ||
222 xen_irq_from_pirq(pirq) < 0) { 224 xen_irq_from_pirq(pirq) < 0) {
223 pirq = xen_allocate_pirq_msi(dev, msidesc); 225 pirq = xen_allocate_pirq_msi(dev, msidesc);
224 if (pirq < 0) 226 if (pirq < 0) {
227 irq = -ENODEV;
225 goto error; 228 goto error;
229 }
226 xen_msi_compose_msg(dev, pirq, &msg); 230 xen_msi_compose_msg(dev, pirq, &msg);
227 __write_msi_msg(msidesc, &msg); 231 __write_msi_msg(msidesc, &msg);
228 dev_dbg(&dev->dev, "xen: msi bound to pirq=%d\n", pirq); 232 dev_dbg(&dev->dev, "xen: msi bound to pirq=%d\n", pirq);
@@ -244,10 +248,12 @@ static int xen_hvm_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
244error: 248error:
245 dev_err(&dev->dev, 249 dev_err(&dev->dev,
246 "Xen PCI frontend has not registered MSI/MSI-X support!\n"); 250 "Xen PCI frontend has not registered MSI/MSI-X support!\n");
247 return -ENODEV; 251 return irq;
248} 252}
249 253
250#ifdef CONFIG_XEN_DOM0 254#ifdef CONFIG_XEN_DOM0
255static bool __read_mostly pci_seg_supported = true;
256
251static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type) 257static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
252{ 258{
253 int ret = 0; 259 int ret = 0;
@@ -265,10 +271,11 @@ static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
265 271
266 memset(&map_irq, 0, sizeof(map_irq)); 272 memset(&map_irq, 0, sizeof(map_irq));
267 map_irq.domid = domid; 273 map_irq.domid = domid;
268 map_irq.type = MAP_PIRQ_TYPE_MSI; 274 map_irq.type = MAP_PIRQ_TYPE_MSI_SEG;
269 map_irq.index = -1; 275 map_irq.index = -1;
270 map_irq.pirq = -1; 276 map_irq.pirq = -1;
271 map_irq.bus = dev->bus->number; 277 map_irq.bus = dev->bus->number |
278 (pci_domain_nr(dev->bus) << 16);
272 map_irq.devfn = dev->devfn; 279 map_irq.devfn = dev->devfn;
273 280
274 if (type == PCI_CAP_ID_MSIX) { 281 if (type == PCI_CAP_ID_MSIX) {
@@ -285,7 +292,20 @@ static int xen_initdom_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
285 map_irq.entry_nr = msidesc->msi_attrib.entry_nr; 292 map_irq.entry_nr = msidesc->msi_attrib.entry_nr;
286 } 293 }
287 294
288 ret = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq, &map_irq); 295 ret = -EINVAL;
296 if (pci_seg_supported)
297 ret = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq,
298 &map_irq);
299 if (ret == -EINVAL && !pci_domain_nr(dev->bus)) {
300 map_irq.type = MAP_PIRQ_TYPE_MSI;
301 map_irq.index = -1;
302 map_irq.pirq = -1;
303 map_irq.bus = dev->bus->number;
304 ret = HYPERVISOR_physdev_op(PHYSDEVOP_map_pirq,
305 &map_irq);
306 if (ret != -EINVAL)
307 pci_seg_supported = false;
308 }
289 if (ret) { 309 if (ret) {
290 dev_warn(&dev->dev, "xen map irq failed %d for %d domain\n", 310 dev_warn(&dev->dev, "xen map irq failed %d for %d domain\n",
291 ret, domid); 311 ret, domid);
diff --git a/arch/x86/platform/Makefile b/arch/x86/platform/Makefile
index 021eee91c056..8d874396cb29 100644
--- a/arch/x86/platform/Makefile
+++ b/arch/x86/platform/Makefile
@@ -1,6 +1,7 @@
1# Platform specific code goes here 1# Platform specific code goes here
2obj-y += ce4100/ 2obj-y += ce4100/
3obj-y += efi/ 3obj-y += efi/
4obj-y += geode/
4obj-y += iris/ 5obj-y += iris/
5obj-y += mrst/ 6obj-y += mrst/
6obj-y += olpc/ 7obj-y += olpc/
diff --git a/arch/x86/platform/geode/Makefile b/arch/x86/platform/geode/Makefile
new file mode 100644
index 000000000000..07c9cd05021a
--- /dev/null
+++ b/arch/x86/platform/geode/Makefile
@@ -0,0 +1 @@
obj-$(CONFIG_ALIX) += alix.o
diff --git a/arch/x86/platform/geode/alix.c b/arch/x86/platform/geode/alix.c
new file mode 100644
index 000000000000..ca1973699d3d
--- /dev/null
+++ b/arch/x86/platform/geode/alix.c
@@ -0,0 +1,142 @@
1/*
2 * System Specific setup for PCEngines ALIX.
3 * At the moment this means setup of GPIO control of LEDs
4 * on Alix.2/3/6 boards.
5 *
6 *
7 * Copyright (C) 2008 Constantin Baranov <const@mimas.ru>
8 * Copyright (C) 2011 Ed Wildgoose <kernel@wildgooses.com>
9 *
10 * TODO: There are large similarities with leds-net5501.c
11 * by Alessandro Zummo <a.zummo@towertech.it>
12 * In the future leds-net5501.c should be migrated over to platform
13 *
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2
16 * as published by the Free Software Foundation.
17 */
18
19#include <linux/kernel.h>
20#include <linux/init.h>
21#include <linux/io.h>
22#include <linux/string.h>
23#include <linux/module.h>
24#include <linux/leds.h>
25#include <linux/platform_device.h>
26#include <linux/gpio.h>
27
28#include <asm/geode.h>
29
30static int force = 0;
31module_param(force, bool, 0444);
32/* FIXME: Award bios is not automatically detected as Alix platform */
33MODULE_PARM_DESC(force, "Force detection as ALIX.2/ALIX.3 platform");
34
35static struct gpio_led alix_leds[] = {
36 {
37 .name = "alix:1",
38 .gpio = 6,
39 .default_trigger = "default-on",
40 .active_low = 1,
41 },
42 {
43 .name = "alix:2",
44 .gpio = 25,
45 .default_trigger = "default-off",
46 .active_low = 1,
47 },
48 {
49 .name = "alix:3",
50 .gpio = 27,
51 .default_trigger = "default-off",
52 .active_low = 1,
53 },
54};
55
56static struct gpio_led_platform_data alix_leds_data = {
57 .num_leds = ARRAY_SIZE(alix_leds),
58 .leds = alix_leds,
59};
60
61static struct platform_device alix_leds_dev = {
62 .name = "leds-gpio",
63 .id = -1,
64 .dev.platform_data = &alix_leds_data,
65};
66
67static void __init register_alix(void)
68{
69 /* Setup LED control through leds-gpio driver */
70 platform_device_register(&alix_leds_dev);
71}
72
73static int __init alix_present(unsigned long bios_phys,
74 const char *alix_sig,
75 size_t alix_sig_len)
76{
77 const size_t bios_len = 0x00010000;
78 const char *bios_virt;
79 const char *scan_end;
80 const char *p;
81 char name[64];
82
83 if (force) {
84 printk(KERN_NOTICE "%s: forced to skip BIOS test, "
85 "assume system is ALIX.2/ALIX.3\n",
86 KBUILD_MODNAME);
87 return 1;
88 }
89
90 bios_virt = phys_to_virt(bios_phys);
91 scan_end = bios_virt + bios_len - (alix_sig_len + 2);
92 for (p = bios_virt; p < scan_end; p++) {
93 const char *tail;
94 char *a;
95
96 if (memcmp(p, alix_sig, alix_sig_len) != 0)
97 continue;
98
99 memcpy(name, p, sizeof(name));
100
101 /* remove the first \0 character from string */
102 a = strchr(name, '\0');
103 if (a)
104 *a = ' ';
105
106 /* cut the string at a newline */
107 a = strchr(name, '\r');
108 if (a)
109 *a = '\0';
110
111 tail = p + alix_sig_len;
112 if ((tail[0] == '2' || tail[0] == '3')) {
113 printk(KERN_INFO
114 "%s: system is recognized as \"%s\"\n",
115 KBUILD_MODNAME, name);
116 return 1;
117 }
118 }
119
120 return 0;
121}
122
123static int __init alix_init(void)
124{
125 const char tinybios_sig[] = "PC Engines ALIX.";
126 const char coreboot_sig[] = "PC Engines\0ALIX.";
127
128 if (!is_geode())
129 return 0;
130
131 if (alix_present(0xf0000, tinybios_sig, sizeof(tinybios_sig) - 1) ||
132 alix_present(0x500, coreboot_sig, sizeof(coreboot_sig) - 1))
133 register_alix();
134
135 return 0;
136}
137
138module_init(alix_init);
139
140MODULE_AUTHOR("Ed Wildgoose <kernel@wildgooses.com>");
141MODULE_DESCRIPTION("PCEngines ALIX System Setup");
142MODULE_LICENSE("GPL");
diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c
index 58425adc22c6..e6379526675b 100644
--- a/arch/x86/platform/mrst/mrst.c
+++ b/arch/x86/platform/mrst/mrst.c
@@ -14,6 +14,8 @@
14 14
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/interrupt.h>
18#include <linux/scatterlist.h>
17#include <linux/sfi.h> 19#include <linux/sfi.h>
18#include <linux/intel_pmic_gpio.h> 20#include <linux/intel_pmic_gpio.h>
19#include <linux/spi/spi.h> 21#include <linux/spi/spi.h>
@@ -392,6 +394,7 @@ static void __init *max3111_platform_data(void *info)
392 struct spi_board_info *spi_info = info; 394 struct spi_board_info *spi_info = info;
393 int intr = get_gpio_by_name("max3111_int"); 395 int intr = get_gpio_by_name("max3111_int");
394 396
397 spi_info->mode = SPI_MODE_0;
395 if (intr == -1) 398 if (intr == -1)
396 return NULL; 399 return NULL;
397 spi_info->irq = intr + MRST_IRQ_OFFSET; 400 spi_info->irq = intr + MRST_IRQ_OFFSET;
@@ -678,38 +681,40 @@ static int __init sfi_parse_devs(struct sfi_table_header *table)
678 pentry = (struct sfi_device_table_entry *)sb->pentry; 681 pentry = (struct sfi_device_table_entry *)sb->pentry;
679 682
680 for (i = 0; i < num; i++, pentry++) { 683 for (i = 0; i < num; i++, pentry++) {
681 if (pentry->irq != (u8)0xff) { /* native RTE case */ 684 int irq = pentry->irq;
685
686 if (irq != (u8)0xff) { /* native RTE case */
682 /* these SPI2 devices are not exposed to system as PCI 687 /* these SPI2 devices are not exposed to system as PCI
683 * devices, but they have separate RTE entry in IOAPIC 688 * devices, but they have separate RTE entry in IOAPIC
684 * so we have to enable them one by one here 689 * so we have to enable them one by one here
685 */ 690 */
686 ioapic = mp_find_ioapic(pentry->irq); 691 ioapic = mp_find_ioapic(irq);
687 irq_attr.ioapic = ioapic; 692 irq_attr.ioapic = ioapic;
688 irq_attr.ioapic_pin = pentry->irq; 693 irq_attr.ioapic_pin = irq;
689 irq_attr.trigger = 1; 694 irq_attr.trigger = 1;
690 irq_attr.polarity = 1; 695 irq_attr.polarity = 1;
691 io_apic_set_pci_routing(NULL, pentry->irq, &irq_attr); 696 io_apic_set_pci_routing(NULL, irq, &irq_attr);
692 } else 697 } else
693 pentry->irq = 0; /* No irq */ 698 irq = 0; /* No irq */
694 699
695 switch (pentry->type) { 700 switch (pentry->type) {
696 case SFI_DEV_TYPE_IPC: 701 case SFI_DEV_TYPE_IPC:
697 /* ID as IRQ is a hack that will go away */ 702 /* ID as IRQ is a hack that will go away */
698 pdev = platform_device_alloc(pentry->name, pentry->irq); 703 pdev = platform_device_alloc(pentry->name, irq);
699 if (pdev == NULL) { 704 if (pdev == NULL) {
700 pr_err("out of memory for SFI platform device '%s'.\n", 705 pr_err("out of memory for SFI platform device '%s'.\n",
701 pentry->name); 706 pentry->name);
702 continue; 707 continue;
703 } 708 }
704 install_irq_resource(pdev, pentry->irq); 709 install_irq_resource(pdev, irq);
705 pr_debug("info[%2d]: IPC bus, name = %16.16s, " 710 pr_debug("info[%2d]: IPC bus, name = %16.16s, "
706 "irq = 0x%2x\n", i, pentry->name, pentry->irq); 711 "irq = 0x%2x\n", i, pentry->name, irq);
707 sfi_handle_ipc_dev(pdev); 712 sfi_handle_ipc_dev(pdev);
708 break; 713 break;
709 case SFI_DEV_TYPE_SPI: 714 case SFI_DEV_TYPE_SPI:
710 memset(&spi_info, 0, sizeof(spi_info)); 715 memset(&spi_info, 0, sizeof(spi_info));
711 strncpy(spi_info.modalias, pentry->name, SFI_NAME_LEN); 716 strncpy(spi_info.modalias, pentry->name, SFI_NAME_LEN);
712 spi_info.irq = pentry->irq; 717 spi_info.irq = irq;
713 spi_info.bus_num = pentry->host_num; 718 spi_info.bus_num = pentry->host_num;
714 spi_info.chip_select = pentry->addr; 719 spi_info.chip_select = pentry->addr;
715 spi_info.max_speed_hz = pentry->max_freq; 720 spi_info.max_speed_hz = pentry->max_freq;
@@ -726,7 +731,7 @@ static int __init sfi_parse_devs(struct sfi_table_header *table)
726 memset(&i2c_info, 0, sizeof(i2c_info)); 731 memset(&i2c_info, 0, sizeof(i2c_info));
727 bus = pentry->host_num; 732 bus = pentry->host_num;
728 strncpy(i2c_info.type, pentry->name, SFI_NAME_LEN); 733 strncpy(i2c_info.type, pentry->name, SFI_NAME_LEN);
729 i2c_info.irq = pentry->irq; 734 i2c_info.irq = irq;
730 i2c_info.addr = pentry->addr; 735 i2c_info.addr = pentry->addr;
731 pr_debug("info[%2d]: I2C bus = %d, name = %16.16s, " 736 pr_debug("info[%2d]: I2C bus = %d, name = %16.16s, "
732 "irq = 0x%2x, addr = 0x%x\n", i, bus, 737 "irq = 0x%2x, addr = 0x%x\n", i, bus,
diff --git a/arch/x86/platform/mrst/vrtc.c b/arch/x86/platform/mrst/vrtc.c
index 73d70d65e76e..6d5dbcdd444a 100644
--- a/arch/x86/platform/mrst/vrtc.c
+++ b/arch/x86/platform/mrst/vrtc.c
@@ -58,8 +58,11 @@ EXPORT_SYMBOL_GPL(vrtc_cmos_write);
58unsigned long vrtc_get_time(void) 58unsigned long vrtc_get_time(void)
59{ 59{
60 u8 sec, min, hour, mday, mon; 60 u8 sec, min, hour, mday, mon;
61 unsigned long flags;
61 u32 year; 62 u32 year;
62 63
64 spin_lock_irqsave(&rtc_lock, flags);
65
63 while ((vrtc_cmos_read(RTC_FREQ_SELECT) & RTC_UIP)) 66 while ((vrtc_cmos_read(RTC_FREQ_SELECT) & RTC_UIP))
64 cpu_relax(); 67 cpu_relax();
65 68
@@ -70,6 +73,8 @@ unsigned long vrtc_get_time(void)
70 mon = vrtc_cmos_read(RTC_MONTH); 73 mon = vrtc_cmos_read(RTC_MONTH);
71 year = vrtc_cmos_read(RTC_YEAR); 74 year = vrtc_cmos_read(RTC_YEAR);
72 75
76 spin_unlock_irqrestore(&rtc_lock, flags);
77
73 /* vRTC YEAR reg contains the offset to 1960 */ 78 /* vRTC YEAR reg contains the offset to 1960 */
74 year += 1960; 79 year += 1960;
75 80
@@ -83,8 +88,10 @@ unsigned long vrtc_get_time(void)
83int vrtc_set_mmss(unsigned long nowtime) 88int vrtc_set_mmss(unsigned long nowtime)
84{ 89{
85 int real_sec, real_min; 90 int real_sec, real_min;
91 unsigned long flags;
86 int vrtc_min; 92 int vrtc_min;
87 93
94 spin_lock_irqsave(&rtc_lock, flags);
88 vrtc_min = vrtc_cmos_read(RTC_MINUTES); 95 vrtc_min = vrtc_cmos_read(RTC_MINUTES);
89 96
90 real_sec = nowtime % 60; 97 real_sec = nowtime % 60;
@@ -95,6 +102,8 @@ int vrtc_set_mmss(unsigned long nowtime)
95 102
96 vrtc_cmos_write(real_sec, RTC_SECONDS); 103 vrtc_cmos_write(real_sec, RTC_SECONDS);
97 vrtc_cmos_write(real_min, RTC_MINUTES); 104 vrtc_cmos_write(real_min, RTC_MINUTES);
105 spin_unlock_irqrestore(&rtc_lock, flags);
106
98 return 0; 107 return 0;
99} 108}
100 109
diff --git a/arch/x86/platform/uv/tlb_uv.c b/arch/x86/platform/uv/tlb_uv.c
index db8b915f54bc..5b552198f774 100644
--- a/arch/x86/platform/uv/tlb_uv.c
+++ b/arch/x86/platform/uv/tlb_uv.c
@@ -115,9 +115,6 @@ early_param("nobau", setup_nobau);
115 115
116/* base pnode in this partition */ 116/* base pnode in this partition */
117static int uv_base_pnode __read_mostly; 117static int uv_base_pnode __read_mostly;
118/* position of pnode (which is nasid>>1): */
119static int uv_nshift __read_mostly;
120static unsigned long uv_mmask __read_mostly;
121 118
122static DEFINE_PER_CPU(struct ptc_stats, ptcstats); 119static DEFINE_PER_CPU(struct ptc_stats, ptcstats);
123static DEFINE_PER_CPU(struct bau_control, bau_control); 120static DEFINE_PER_CPU(struct bau_control, bau_control);
@@ -1435,7 +1432,7 @@ static void activation_descriptor_init(int node, int pnode, int base_pnode)
1435{ 1432{
1436 int i; 1433 int i;
1437 int cpu; 1434 int cpu;
1438 unsigned long pa; 1435 unsigned long gpa;
1439 unsigned long m; 1436 unsigned long m;
1440 unsigned long n; 1437 unsigned long n;
1441 size_t dsize; 1438 size_t dsize;
@@ -1451,9 +1448,9 @@ static void activation_descriptor_init(int node, int pnode, int base_pnode)
1451 bau_desc = kmalloc_node(dsize, GFP_KERNEL, node); 1448 bau_desc = kmalloc_node(dsize, GFP_KERNEL, node);
1452 BUG_ON(!bau_desc); 1449 BUG_ON(!bau_desc);
1453 1450
1454 pa = uv_gpa(bau_desc); /* need the real nasid*/ 1451 gpa = uv_gpa(bau_desc);
1455 n = pa >> uv_nshift; 1452 n = uv_gpa_to_gnode(gpa);
1456 m = pa & uv_mmask; 1453 m = uv_gpa_to_offset(gpa);
1457 1454
1458 /* the 14-bit pnode */ 1455 /* the 14-bit pnode */
1459 write_mmr_descriptor_base(pnode, (n << UV_DESC_PSHIFT | m)); 1456 write_mmr_descriptor_base(pnode, (n << UV_DESC_PSHIFT | m));
@@ -1525,9 +1522,9 @@ static void pq_init(int node, int pnode)
1525 bcp->queue_last = pqp + (DEST_Q_SIZE - 1); 1522 bcp->queue_last = pqp + (DEST_Q_SIZE - 1);
1526 } 1523 }
1527 /* 1524 /*
1528 * need the pnode of where the memory was really allocated 1525 * need the gnode of where the memory was really allocated
1529 */ 1526 */
1530 pn = uv_gpa(pqp) >> uv_nshift; 1527 pn = uv_gpa_to_gnode(uv_gpa(pqp));
1531 first = uv_physnodeaddr(pqp); 1528 first = uv_physnodeaddr(pqp);
1532 pn_first = ((unsigned long)pn << UV_PAYLOADQ_PNODE_SHIFT) | first; 1529 pn_first = ((unsigned long)pn << UV_PAYLOADQ_PNODE_SHIFT) | first;
1533 last = uv_physnodeaddr(pqp + (DEST_Q_SIZE - 1)); 1530 last = uv_physnodeaddr(pqp + (DEST_Q_SIZE - 1));
@@ -1837,8 +1834,6 @@ static int __init uv_bau_init(void)
1837 zalloc_cpumask_var_node(mask, GFP_KERNEL, cpu_to_node(cur_cpu)); 1834 zalloc_cpumask_var_node(mask, GFP_KERNEL, cpu_to_node(cur_cpu));
1838 } 1835 }
1839 1836
1840 uv_nshift = uv_hub_info->m_val;
1841 uv_mmask = (1UL << uv_hub_info->m_val) - 1;
1842 nuvhubs = uv_num_possible_blades(); 1837 nuvhubs = uv_num_possible_blades();
1843 spin_lock_init(&disable_lock); 1838 spin_lock_init(&disable_lock);
1844 congested_cycles = usec_2_cycles(congested_respns_us); 1839 congested_cycles = usec_2_cycles(congested_respns_us);
diff --git a/arch/x86/vdso/vma.c b/arch/x86/vdso/vma.c
index 316fbca3490e..153407c35b75 100644
--- a/arch/x86/vdso/vma.c
+++ b/arch/x86/vdso/vma.c
@@ -89,6 +89,15 @@ static unsigned long vdso_addr(unsigned long start, unsigned len)
89 addr = start + (offset << PAGE_SHIFT); 89 addr = start + (offset << PAGE_SHIFT);
90 if (addr >= end) 90 if (addr >= end)
91 addr = end; 91 addr = end;
92
93 /*
94 * page-align it here so that get_unmapped_area doesn't
95 * align it wrongfully again to the next page. addr can come in 4K
96 * unaligned here as a result of stack start randomization.
97 */
98 addr = PAGE_ALIGN(addr);
99 addr = align_addr(addr, NULL, ALIGN_VDSO);
100
92 return addr; 101 return addr;
93} 102}
94 103
diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig
index 5cc821cb2e09..26c731a106af 100644
--- a/arch/x86/xen/Kconfig
+++ b/arch/x86/xen/Kconfig
@@ -25,8 +25,7 @@ config XEN_PRIVILEGED_GUEST
25 25
26config XEN_PVHVM 26config XEN_PVHVM
27 def_bool y 27 def_bool y
28 depends on XEN 28 depends on XEN && PCI && X86_LOCAL_APIC
29 depends on X86_LOCAL_APIC
30 29
31config XEN_MAX_DOMAIN_MEMORY 30config XEN_MAX_DOMAIN_MEMORY
32 int 31 int
@@ -49,11 +48,3 @@ config XEN_DEBUG_FS
49 help 48 help
50 Enable statistics output and various tuning options in debugfs. 49 Enable statistics output and various tuning options in debugfs.
51 Enabling this option may incur a significant performance overhead. 50 Enabling this option may incur a significant performance overhead.
52
53config XEN_DEBUG
54 bool "Enable Xen debug checks"
55 depends on XEN
56 default n
57 help
58 Enable various WARN_ON checks in the Xen MMU code.
59 Enabling this option WILL incur a significant performance overhead.
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 2d69617950f7..da8afd576a6b 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -251,6 +251,7 @@ static void __init xen_init_cpuid_mask(void)
251 ~((1 << X86_FEATURE_APIC) | /* disable local APIC */ 251 ~((1 << X86_FEATURE_APIC) | /* disable local APIC */
252 (1 << X86_FEATURE_ACPI)); /* disable ACPI */ 252 (1 << X86_FEATURE_ACPI)); /* disable ACPI */
253 ax = 1; 253 ax = 1;
254 cx = 0;
254 xen_cpuid(&ax, &bx, &cx, &dx); 255 xen_cpuid(&ax, &bx, &cx, &dx);
255 256
256 xsave_mask = 257 xsave_mask =
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 20a614275064..87f6673b1207 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -495,41 +495,6 @@ static pte_t xen_make_pte(pteval_t pte)
495} 495}
496PV_CALLEE_SAVE_REGS_THUNK(xen_make_pte); 496PV_CALLEE_SAVE_REGS_THUNK(xen_make_pte);
497 497
498#ifdef CONFIG_XEN_DEBUG
499pte_t xen_make_pte_debug(pteval_t pte)
500{
501 phys_addr_t addr = (pte & PTE_PFN_MASK);
502 phys_addr_t other_addr;
503 bool io_page = false;
504 pte_t _pte;
505
506 if (pte & _PAGE_IOMAP)
507 io_page = true;
508
509 _pte = xen_make_pte(pte);
510
511 if (!addr)
512 return _pte;
513
514 if (io_page &&
515 (xen_initial_domain() || addr >= ISA_END_ADDRESS)) {
516 other_addr = pfn_to_mfn(addr >> PAGE_SHIFT) << PAGE_SHIFT;
517 WARN_ONCE(addr != other_addr,
518 "0x%lx is using VM_IO, but it is 0x%lx!\n",
519 (unsigned long)addr, (unsigned long)other_addr);
520 } else {
521 pteval_t iomap_set = (_pte.pte & PTE_FLAGS_MASK) & _PAGE_IOMAP;
522 other_addr = (_pte.pte & PTE_PFN_MASK);
523 WARN_ONCE((addr == other_addr) && (!io_page) && (!iomap_set),
524 "0x%lx is missing VM_IO (and wasn't fixed)!\n",
525 (unsigned long)addr);
526 }
527
528 return _pte;
529}
530PV_CALLEE_SAVE_REGS_THUNK(xen_make_pte_debug);
531#endif
532
533static pgd_t xen_make_pgd(pgdval_t pgd) 498static pgd_t xen_make_pgd(pgdval_t pgd)
534{ 499{
535 pgd = pte_pfn_to_mfn(pgd); 500 pgd = pte_pfn_to_mfn(pgd);
@@ -1721,10 +1686,8 @@ void __init xen_setup_machphys_mapping(void)
1721 machine_to_phys_nr = MACH2PHYS_NR_ENTRIES; 1686 machine_to_phys_nr = MACH2PHYS_NR_ENTRIES;
1722 } 1687 }
1723#ifdef CONFIG_X86_32 1688#ifdef CONFIG_X86_32
1724 if ((machine_to_phys_mapping + machine_to_phys_nr) 1689 WARN_ON((machine_to_phys_mapping + (machine_to_phys_nr - 1))
1725 < machine_to_phys_mapping) 1690 < machine_to_phys_mapping);
1726 machine_to_phys_nr = (unsigned long *)NULL
1727 - machine_to_phys_mapping;
1728#endif 1691#endif
1729} 1692}
1730 1693
@@ -1994,9 +1957,6 @@ void __init xen_ident_map_ISA(void)
1994 1957
1995static void __init xen_post_allocator_init(void) 1958static void __init xen_post_allocator_init(void)
1996{ 1959{
1997#ifdef CONFIG_XEN_DEBUG
1998 pv_mmu_ops.make_pte = PV_CALLEE_SAVE(xen_make_pte_debug);
1999#endif
2000 pv_mmu_ops.set_pte = xen_set_pte; 1960 pv_mmu_ops.set_pte = xen_set_pte;
2001 pv_mmu_ops.set_pmd = xen_set_pmd; 1961 pv_mmu_ops.set_pmd = xen_set_pmd;
2002 pv_mmu_ops.set_pud = xen_set_pud; 1962 pv_mmu_ops.set_pud = xen_set_pud;
@@ -2406,17 +2366,3 @@ out:
2406 return err; 2366 return err;
2407} 2367}
2408EXPORT_SYMBOL_GPL(xen_remap_domain_mfn_range); 2368EXPORT_SYMBOL_GPL(xen_remap_domain_mfn_range);
2409
2410#ifdef CONFIG_XEN_DEBUG_FS
2411static int p2m_dump_open(struct inode *inode, struct file *filp)
2412{
2413 return single_open(filp, p2m_dump_show, NULL);
2414}
2415
2416static const struct file_operations p2m_dump_fops = {
2417 .open = p2m_dump_open,
2418 .read = seq_read,
2419 .llseek = seq_lseek,
2420 .release = single_release,
2421};
2422#endif /* CONFIG_XEN_DEBUG_FS */
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index 58efeb9d5440..1b267e75158d 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -161,7 +161,9 @@
161#include <asm/xen/page.h> 161#include <asm/xen/page.h>
162#include <asm/xen/hypercall.h> 162#include <asm/xen/hypercall.h>
163#include <asm/xen/hypervisor.h> 163#include <asm/xen/hypervisor.h>
164#include <xen/grant_table.h>
164 165
166#include "multicalls.h"
165#include "xen-ops.h" 167#include "xen-ops.h"
166 168
167static void __init m2p_override_init(void); 169static void __init m2p_override_init(void);
@@ -676,7 +678,8 @@ static unsigned long mfn_hash(unsigned long mfn)
676} 678}
677 679
678/* Add an MFN override for a particular page */ 680/* Add an MFN override for a particular page */
679int m2p_add_override(unsigned long mfn, struct page *page, bool clear_pte) 681int m2p_add_override(unsigned long mfn, struct page *page,
682 struct gnttab_map_grant_ref *kmap_op)
680{ 683{
681 unsigned long flags; 684 unsigned long flags;
682 unsigned long pfn; 685 unsigned long pfn;
@@ -692,16 +695,28 @@ int m2p_add_override(unsigned long mfn, struct page *page, bool clear_pte)
692 "m2p_add_override: pfn %lx not mapped", pfn)) 695 "m2p_add_override: pfn %lx not mapped", pfn))
693 return -EINVAL; 696 return -EINVAL;
694 } 697 }
695 698 WARN_ON(PagePrivate(page));
696 page->private = mfn; 699 SetPagePrivate(page);
700 set_page_private(page, mfn);
697 page->index = pfn_to_mfn(pfn); 701 page->index = pfn_to_mfn(pfn);
698 702
699 if (unlikely(!set_phys_to_machine(pfn, FOREIGN_FRAME(mfn)))) 703 if (unlikely(!set_phys_to_machine(pfn, FOREIGN_FRAME(mfn))))
700 return -ENOMEM; 704 return -ENOMEM;
701 705
702 if (clear_pte && !PageHighMem(page)) 706 if (kmap_op != NULL) {
703 /* Just zap old mapping for now */ 707 if (!PageHighMem(page)) {
704 pte_clear(&init_mm, address, ptep); 708 struct multicall_space mcs =
709 xen_mc_entry(sizeof(*kmap_op));
710
711 MULTI_grant_table_op(mcs.mc,
712 GNTTABOP_map_grant_ref, kmap_op, 1);
713
714 xen_mc_issue(PARAVIRT_LAZY_MMU);
715 }
716 /* let's use dev_bus_addr to record the old mfn instead */
717 kmap_op->dev_bus_addr = page->index;
718 page->index = (unsigned long) kmap_op;
719 }
705 spin_lock_irqsave(&m2p_override_lock, flags); 720 spin_lock_irqsave(&m2p_override_lock, flags);
706 list_add(&page->lru, &m2p_overrides[mfn_hash(mfn)]); 721 list_add(&page->lru, &m2p_overrides[mfn_hash(mfn)]);
707 spin_unlock_irqrestore(&m2p_override_lock, flags); 722 spin_unlock_irqrestore(&m2p_override_lock, flags);
@@ -735,13 +750,56 @@ int m2p_remove_override(struct page *page, bool clear_pte)
735 spin_lock_irqsave(&m2p_override_lock, flags); 750 spin_lock_irqsave(&m2p_override_lock, flags);
736 list_del(&page->lru); 751 list_del(&page->lru);
737 spin_unlock_irqrestore(&m2p_override_lock, flags); 752 spin_unlock_irqrestore(&m2p_override_lock, flags);
738 set_phys_to_machine(pfn, page->index); 753 WARN_ON(!PagePrivate(page));
754 ClearPagePrivate(page);
739 755
740 if (clear_pte && !PageHighMem(page)) 756 if (clear_pte) {
741 set_pte_at(&init_mm, address, ptep, 757 struct gnttab_map_grant_ref *map_op =
742 pfn_pte(pfn, PAGE_KERNEL)); 758 (struct gnttab_map_grant_ref *) page->index;
743 /* No tlb flush necessary because the caller already 759 set_phys_to_machine(pfn, map_op->dev_bus_addr);
744 * left the pte unmapped. */ 760 if (!PageHighMem(page)) {
761 struct multicall_space mcs;
762 struct gnttab_unmap_grant_ref *unmap_op;
763
764 /*
765 * It might be that we queued all the m2p grant table
766 * hypercalls in a multicall, then m2p_remove_override
767 * get called before the multicall has actually been
768 * issued. In this case handle is going to -1 because
769 * it hasn't been modified yet.
770 */
771 if (map_op->handle == -1)
772 xen_mc_flush();
773 /*
774 * Now if map_op->handle is negative it means that the
775 * hypercall actually returned an error.
776 */
777 if (map_op->handle == GNTST_general_error) {
778 printk(KERN_WARNING "m2p_remove_override: "
779 "pfn %lx mfn %lx, failed to modify kernel mappings",
780 pfn, mfn);
781 return -1;
782 }
783
784 mcs = xen_mc_entry(
785 sizeof(struct gnttab_unmap_grant_ref));
786 unmap_op = mcs.args;
787 unmap_op->host_addr = map_op->host_addr;
788 unmap_op->handle = map_op->handle;
789 unmap_op->dev_bus_addr = 0;
790
791 MULTI_grant_table_op(mcs.mc,
792 GNTTABOP_unmap_grant_ref, unmap_op, 1);
793
794 xen_mc_issue(PARAVIRT_LAZY_MMU);
795
796 set_pte_at(&init_mm, address, ptep,
797 pfn_pte(pfn, PAGE_KERNEL));
798 __flush_tlb_single(address);
799 map_op->host_addr = 0;
800 }
801 } else
802 set_phys_to_machine(pfn, page->index);
745 803
746 return 0; 804 return 0;
747} 805}
@@ -758,7 +816,7 @@ struct page *m2p_find_override(unsigned long mfn)
758 spin_lock_irqsave(&m2p_override_lock, flags); 816 spin_lock_irqsave(&m2p_override_lock, flags);
759 817
760 list_for_each_entry(p, bucket, lru) { 818 list_for_each_entry(p, bucket, lru) {
761 if (p->private == mfn) { 819 if (page_private(p) == mfn) {
762 ret = p; 820 ret = p;
763 break; 821 break;
764 } 822 }
@@ -782,17 +840,21 @@ unsigned long m2p_find_override_pfn(unsigned long mfn, unsigned long pfn)
782EXPORT_SYMBOL_GPL(m2p_find_override_pfn); 840EXPORT_SYMBOL_GPL(m2p_find_override_pfn);
783 841
784#ifdef CONFIG_XEN_DEBUG_FS 842#ifdef CONFIG_XEN_DEBUG_FS
785 843#include <linux/debugfs.h>
786int p2m_dump_show(struct seq_file *m, void *v) 844#include "debugfs.h"
845static int p2m_dump_show(struct seq_file *m, void *v)
787{ 846{
788 static const char * const level_name[] = { "top", "middle", 847 static const char * const level_name[] = { "top", "middle",
789 "entry", "abnormal" }; 848 "entry", "abnormal", "error"};
790 static const char * const type_name[] = { "identity", "missing",
791 "pfn", "abnormal"};
792#define TYPE_IDENTITY 0 849#define TYPE_IDENTITY 0
793#define TYPE_MISSING 1 850#define TYPE_MISSING 1
794#define TYPE_PFN 2 851#define TYPE_PFN 2
795#define TYPE_UNKNOWN 3 852#define TYPE_UNKNOWN 3
853 static const char * const type_name[] = {
854 [TYPE_IDENTITY] = "identity",
855 [TYPE_MISSING] = "missing",
856 [TYPE_PFN] = "pfn",
857 [TYPE_UNKNOWN] = "abnormal"};
796 unsigned long pfn, prev_pfn_type = 0, prev_pfn_level = 0; 858 unsigned long pfn, prev_pfn_type = 0, prev_pfn_level = 0;
797 unsigned int uninitialized_var(prev_level); 859 unsigned int uninitialized_var(prev_level);
798 unsigned int uninitialized_var(prev_type); 860 unsigned int uninitialized_var(prev_type);
@@ -856,4 +918,32 @@ int p2m_dump_show(struct seq_file *m, void *v)
856#undef TYPE_PFN 918#undef TYPE_PFN
857#undef TYPE_UNKNOWN 919#undef TYPE_UNKNOWN
858} 920}
859#endif 921
922static int p2m_dump_open(struct inode *inode, struct file *filp)
923{
924 return single_open(filp, p2m_dump_show, NULL);
925}
926
927static const struct file_operations p2m_dump_fops = {
928 .open = p2m_dump_open,
929 .read = seq_read,
930 .llseek = seq_lseek,
931 .release = single_release,
932};
933
934static struct dentry *d_mmu_debug;
935
936static int __init xen_p2m_debugfs(void)
937{
938 struct dentry *d_xen = xen_init_debugfs();
939
940 if (d_xen == NULL)
941 return -ENOMEM;
942
943 d_mmu_debug = debugfs_create_dir("mmu", d_xen);
944
945 debugfs_create_file("p2m", 0600, d_mmu_debug, NULL, &p2m_dump_fops);
946 return 0;
947}
948fs_initcall(xen_p2m_debugfs);
949#endif /* CONFIG_XEN_DEBUG_FS */
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index c3b8d440873c..38d0af4fefec 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -37,7 +37,10 @@ extern void xen_syscall_target(void);
37extern void xen_syscall32_target(void); 37extern void xen_syscall32_target(void);
38 38
39/* Amount of extra memory space we add to the e820 ranges */ 39/* Amount of extra memory space we add to the e820 ranges */
40phys_addr_t xen_extra_mem_start, xen_extra_mem_size; 40struct xen_memory_region xen_extra_mem[XEN_EXTRA_MEM_MAX_REGIONS] __initdata;
41
42/* Number of pages released from the initial allocation. */
43unsigned long xen_released_pages;
41 44
42/* 45/*
43 * The maximum amount of extra memory compared to the base size. The 46 * The maximum amount of extra memory compared to the base size. The
@@ -51,48 +54,47 @@ phys_addr_t xen_extra_mem_start, xen_extra_mem_size;
51 */ 54 */
52#define EXTRA_MEM_RATIO (10) 55#define EXTRA_MEM_RATIO (10)
53 56
54static void __init xen_add_extra_mem(unsigned long pages) 57static void __init xen_add_extra_mem(u64 start, u64 size)
55{ 58{
56 unsigned long pfn; 59 unsigned long pfn;
60 int i;
57 61
58 u64 size = (u64)pages * PAGE_SIZE; 62 for (i = 0; i < XEN_EXTRA_MEM_MAX_REGIONS; i++) {
59 u64 extra_start = xen_extra_mem_start + xen_extra_mem_size; 63 /* Add new region. */
60 64 if (xen_extra_mem[i].size == 0) {
61 if (!pages) 65 xen_extra_mem[i].start = start;
62 return; 66 xen_extra_mem[i].size = size;
63 67 break;
64 e820_add_region(extra_start, size, E820_RAM); 68 }
65 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); 69 /* Append to existing region. */
66 70 if (xen_extra_mem[i].start + xen_extra_mem[i].size == start) {
67 memblock_x86_reserve_range(extra_start, extra_start + size, "XEN EXTRA"); 71 xen_extra_mem[i].size += size;
72 break;
73 }
74 }
75 if (i == XEN_EXTRA_MEM_MAX_REGIONS)
76 printk(KERN_WARNING "Warning: not enough extra memory regions\n");
68 77
69 xen_extra_mem_size += size; 78 memblock_x86_reserve_range(start, start + size, "XEN EXTRA");
70 79
71 xen_max_p2m_pfn = PFN_DOWN(extra_start + size); 80 xen_max_p2m_pfn = PFN_DOWN(start + size);
72 81
73 for (pfn = PFN_DOWN(extra_start); pfn <= xen_max_p2m_pfn; pfn++) 82 for (pfn = PFN_DOWN(start); pfn <= xen_max_p2m_pfn; pfn++)
74 __set_phys_to_machine(pfn, INVALID_P2M_ENTRY); 83 __set_phys_to_machine(pfn, INVALID_P2M_ENTRY);
75} 84}
76 85
77static unsigned long __init xen_release_chunk(phys_addr_t start_addr, 86static unsigned long __init xen_release_chunk(unsigned long start,
78 phys_addr_t end_addr) 87 unsigned long end)
79{ 88{
80 struct xen_memory_reservation reservation = { 89 struct xen_memory_reservation reservation = {
81 .address_bits = 0, 90 .address_bits = 0,
82 .extent_order = 0, 91 .extent_order = 0,
83 .domid = DOMID_SELF 92 .domid = DOMID_SELF
84 }; 93 };
85 unsigned long start, end;
86 unsigned long len = 0; 94 unsigned long len = 0;
87 unsigned long pfn; 95 unsigned long pfn;
88 int ret; 96 int ret;
89 97
90 start = PFN_UP(start_addr);
91 end = PFN_DOWN(end_addr);
92
93 if (end <= start)
94 return 0;
95
96 for(pfn = start; pfn < end; pfn++) { 98 for(pfn = start; pfn < end; pfn++) {
97 unsigned long mfn = pfn_to_mfn(pfn); 99 unsigned long mfn = pfn_to_mfn(pfn);
98 100
@@ -117,72 +119,52 @@ static unsigned long __init xen_release_chunk(phys_addr_t start_addr,
117 return len; 119 return len;
118} 120}
119 121
120static unsigned long __init xen_return_unused_memory(unsigned long max_pfn, 122static unsigned long __init xen_set_identity_and_release(
121 const struct e820map *e820) 123 const struct e820entry *list, size_t map_size, unsigned long nr_pages)
122{ 124{
123 phys_addr_t max_addr = PFN_PHYS(max_pfn); 125 phys_addr_t start = 0;
124 phys_addr_t last_end = ISA_END_ADDRESS;
125 unsigned long released = 0; 126 unsigned long released = 0;
126 int i;
127
128 /* Free any unused memory above the low 1Mbyte. */
129 for (i = 0; i < e820->nr_map && last_end < max_addr; i++) {
130 phys_addr_t end = e820->map[i].addr;
131 end = min(max_addr, end);
132
133 if (last_end < end)
134 released += xen_release_chunk(last_end, end);
135 last_end = max(last_end, e820->map[i].addr + e820->map[i].size);
136 }
137
138 if (last_end < max_addr)
139 released += xen_release_chunk(last_end, max_addr);
140
141 printk(KERN_INFO "released %lu pages of unused memory\n", released);
142 return released;
143}
144
145static unsigned long __init xen_set_identity(const struct e820entry *list,
146 ssize_t map_size)
147{
148 phys_addr_t last = xen_initial_domain() ? 0 : ISA_END_ADDRESS;
149 phys_addr_t start_pci = last;
150 const struct e820entry *entry;
151 unsigned long identity = 0; 127 unsigned long identity = 0;
128 const struct e820entry *entry;
152 int i; 129 int i;
153 130
131 /*
132 * Combine non-RAM regions and gaps until a RAM region (or the
133 * end of the map) is reached, then set the 1:1 map and
134 * release the pages (if available) in those non-RAM regions.
135 *
136 * The combined non-RAM regions are rounded to a whole number
137 * of pages so any partial pages are accessible via the 1:1
138 * mapping. This is needed for some BIOSes that put (for
139 * example) the DMI tables in a reserved region that begins on
140 * a non-page boundary.
141 */
154 for (i = 0, entry = list; i < map_size; i++, entry++) { 142 for (i = 0, entry = list; i < map_size; i++, entry++) {
155 phys_addr_t start = entry->addr; 143 phys_addr_t end = entry->addr + entry->size;
156 phys_addr_t end = start + entry->size;
157 144
158 if (start < last) 145 if (entry->type == E820_RAM || i == map_size - 1) {
159 start = last; 146 unsigned long start_pfn = PFN_DOWN(start);
147 unsigned long end_pfn = PFN_UP(end);
160 148
161 if (end <= start) 149 if (entry->type == E820_RAM)
162 continue; 150 end_pfn = PFN_UP(entry->addr);
163 151
164 /* Skip over the 1MB region. */ 152 if (start_pfn < end_pfn) {
165 if (last > end) 153 if (start_pfn < nr_pages)
166 continue; 154 released += xen_release_chunk(
155 start_pfn, min(end_pfn, nr_pages));
167 156
168 if ((entry->type == E820_RAM) || (entry->type == E820_UNUSABLE)) {
169 if (start > start_pci)
170 identity += set_phys_range_identity( 157 identity += set_phys_range_identity(
171 PFN_UP(start_pci), PFN_DOWN(start)); 158 start_pfn, end_pfn);
172 159 }
173 /* Without saving 'last' we would gooble RAM too 160 start = end;
174 * at the end of the loop. */
175 last = end;
176 start_pci = end;
177 continue;
178 } 161 }
179 start_pci = min(start, start_pci);
180 last = end;
181 } 162 }
182 if (last > start_pci) 163
183 identity += set_phys_range_identity( 164 printk(KERN_INFO "Released %lu pages of unused memory\n", released);
184 PFN_UP(start_pci), PFN_DOWN(last)); 165 printk(KERN_INFO "Set %ld page(s) to 1-1 mapping\n", identity);
185 return identity; 166
167 return released;
186} 168}
187 169
188static unsigned long __init xen_get_max_pages(void) 170static unsigned long __init xen_get_max_pages(void)
@@ -197,21 +179,32 @@ static unsigned long __init xen_get_max_pages(void)
197 return min(max_pages, MAX_DOMAIN_PAGES); 179 return min(max_pages, MAX_DOMAIN_PAGES);
198} 180}
199 181
182static void xen_align_and_add_e820_region(u64 start, u64 size, int type)
183{
184 u64 end = start + size;
185
186 /* Align RAM regions to page boundaries. */
187 if (type == E820_RAM) {
188 start = PAGE_ALIGN(start);
189 end &= ~((u64)PAGE_SIZE - 1);
190 }
191
192 e820_add_region(start, end - start, type);
193}
194
200/** 195/**
201 * machine_specific_memory_setup - Hook for machine specific memory setup. 196 * machine_specific_memory_setup - Hook for machine specific memory setup.
202 **/ 197 **/
203char * __init xen_memory_setup(void) 198char * __init xen_memory_setup(void)
204{ 199{
205 static struct e820entry map[E820MAX] __initdata; 200 static struct e820entry map[E820MAX] __initdata;
206 static struct e820entry map_raw[E820MAX] __initdata;
207 201
208 unsigned long max_pfn = xen_start_info->nr_pages; 202 unsigned long max_pfn = xen_start_info->nr_pages;
209 unsigned long long mem_end; 203 unsigned long long mem_end;
210 int rc; 204 int rc;
211 struct xen_memory_map memmap; 205 struct xen_memory_map memmap;
206 unsigned long max_pages;
212 unsigned long extra_pages = 0; 207 unsigned long extra_pages = 0;
213 unsigned long extra_limit;
214 unsigned long identity_pages = 0;
215 int i; 208 int i;
216 int op; 209 int op;
217 210
@@ -237,58 +230,65 @@ char * __init xen_memory_setup(void)
237 } 230 }
238 BUG_ON(rc); 231 BUG_ON(rc);
239 232
240 memcpy(map_raw, map, sizeof(map)); 233 /* Make sure the Xen-supplied memory map is well-ordered. */
241 e820.nr_map = 0; 234 sanitize_e820_map(map, memmap.nr_entries, &memmap.nr_entries);
242 xen_extra_mem_start = mem_end; 235
243 for (i = 0; i < memmap.nr_entries; i++) { 236 max_pages = xen_get_max_pages();
244 unsigned long long end; 237 if (max_pages > max_pfn)
245 238 extra_pages += max_pages - max_pfn;
246 /* Guard against non-page aligned E820 entries. */ 239
247 if (map[i].type == E820_RAM) 240 /*
248 map[i].size -= (map[i].size + map[i].addr) % PAGE_SIZE; 241 * Set P2M for all non-RAM pages and E820 gaps to be identity
249 242 * type PFNs. Any RAM pages that would be made inaccesible by
250 end = map[i].addr + map[i].size; 243 * this are first released.
251 if (map[i].type == E820_RAM && end > mem_end) { 244 */
252 /* RAM off the end - may be partially included */ 245 xen_released_pages = xen_set_identity_and_release(
253 u64 delta = min(map[i].size, end - mem_end); 246 map, memmap.nr_entries, max_pfn);
254 247 extra_pages += xen_released_pages;
255 map[i].size -= delta; 248
256 end -= delta; 249 /*
257 250 * Clamp the amount of extra memory to a EXTRA_MEM_RATIO
258 extra_pages += PFN_DOWN(delta); 251 * factor the base size. On non-highmem systems, the base
259 /* 252 * size is the full initial memory allocation; on highmem it
260 * Set RAM below 4GB that is not for us to be unusable. 253 * is limited to the max size of lowmem, so that it doesn't
261 * This prevents "System RAM" address space from being 254 * get completely filled.
262 * used as potential resource for I/O address (happens 255 *
263 * when 'allocate_resource' is called). 256 * In principle there could be a problem in lowmem systems if
264 */ 257 * the initial memory is also very large with respect to
265 if (delta && 258 * lowmem, but we won't try to deal with that here.
266 (xen_initial_domain() && end < 0x100000000ULL)) 259 */
267 e820_add_region(end, delta, E820_UNUSABLE); 260 extra_pages = min(EXTRA_MEM_RATIO * min(max_pfn, PFN_DOWN(MAXMEM)),
261 extra_pages);
262
263 i = 0;
264 while (i < memmap.nr_entries) {
265 u64 addr = map[i].addr;
266 u64 size = map[i].size;
267 u32 type = map[i].type;
268
269 if (type == E820_RAM) {
270 if (addr < mem_end) {
271 size = min(size, mem_end - addr);
272 } else if (extra_pages) {
273 size = min(size, (u64)extra_pages * PAGE_SIZE);
274 extra_pages -= size / PAGE_SIZE;
275 xen_add_extra_mem(addr, size);
276 } else
277 type = E820_UNUSABLE;
268 } 278 }
269 279
270 if (map[i].size > 0 && end > xen_extra_mem_start) 280 xen_align_and_add_e820_region(addr, size, type);
271 xen_extra_mem_start = end;
272 281
273 /* Add region if any remains */ 282 map[i].addr += size;
274 if (map[i].size > 0) 283 map[i].size -= size;
275 e820_add_region(map[i].addr, map[i].size, map[i].type); 284 if (map[i].size == 0)
285 i++;
276 } 286 }
277 /* Align the balloon area so that max_low_pfn does not get set
278 * to be at the _end_ of the PCI gap at the far end (fee01000).
279 * Note that xen_extra_mem_start gets set in the loop above to be
280 * past the last E820 region. */
281 if (xen_initial_domain() && (xen_extra_mem_start < (1ULL<<32)))
282 xen_extra_mem_start = (1ULL<<32);
283 287
284 /* 288 /*
285 * In domU, the ISA region is normal, usable memory, but we 289 * In domU, the ISA region is normal, usable memory, but we
286 * reserve ISA memory anyway because too many things poke 290 * reserve ISA memory anyway because too many things poke
287 * about in there. 291 * about in there.
288 *
289 * In Dom0, the host E820 information can leave gaps in the
290 * ISA range, which would cause us to release those pages. To
291 * avoid this, we unconditionally reserve them here.
292 */ 292 */
293 e820_add_region(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS, 293 e820_add_region(ISA_START_ADDRESS, ISA_END_ADDRESS - ISA_START_ADDRESS,
294 E820_RESERVED); 294 E820_RESERVED);
@@ -305,42 +305,6 @@ char * __init xen_memory_setup(void)
305 305
306 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); 306 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
307 307
308 extra_limit = xen_get_max_pages();
309 if (extra_limit >= max_pfn)
310 extra_pages = extra_limit - max_pfn;
311 else
312 extra_pages = 0;
313
314 extra_pages += xen_return_unused_memory(xen_start_info->nr_pages, &e820);
315
316 /*
317 * Clamp the amount of extra memory to a EXTRA_MEM_RATIO
318 * factor the base size. On non-highmem systems, the base
319 * size is the full initial memory allocation; on highmem it
320 * is limited to the max size of lowmem, so that it doesn't
321 * get completely filled.
322 *
323 * In principle there could be a problem in lowmem systems if
324 * the initial memory is also very large with respect to
325 * lowmem, but we won't try to deal with that here.
326 */
327 extra_limit = min(EXTRA_MEM_RATIO * min(max_pfn, PFN_DOWN(MAXMEM)),
328 max_pfn + extra_pages);
329
330 if (extra_limit >= max_pfn)
331 extra_pages = extra_limit - max_pfn;
332 else
333 extra_pages = 0;
334
335 xen_add_extra_mem(extra_pages);
336
337 /*
338 * Set P2M for all non-RAM pages and E820 gaps to be identity
339 * type PFNs. We supply it with the non-sanitized version
340 * of the E820.
341 */
342 identity_pages = xen_set_identity(map_raw, memmap.nr_entries);
343 printk(KERN_INFO "Set %ld page(s) to 1-1 mapping.\n", identity_pages);
344 return "Xen"; 308 return "Xen";
345} 309}
346 310
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index d4fc6d454f8d..041d4fe9dfe4 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -532,7 +532,6 @@ static void __init xen_hvm_smp_prepare_cpus(unsigned int max_cpus)
532 WARN_ON(xen_smp_intr_init(0)); 532 WARN_ON(xen_smp_intr_init(0));
533 533
534 xen_init_lock_cpu(0); 534 xen_init_lock_cpu(0);
535 xen_init_spinlocks();
536} 535}
537 536
538static int __cpuinit xen_hvm_cpu_up(unsigned int cpu) 537static int __cpuinit xen_hvm_cpu_up(unsigned int cpu)
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index 5158c505bef9..163b4679556e 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -168,9 +168,10 @@ cycle_t xen_clocksource_read(void)
168 struct pvclock_vcpu_time_info *src; 168 struct pvclock_vcpu_time_info *src;
169 cycle_t ret; 169 cycle_t ret;
170 170
171 src = &get_cpu_var(xen_vcpu)->time; 171 preempt_disable_notrace();
172 src = &__get_cpu_var(xen_vcpu)->time;
172 ret = pvclock_clocksource_read(src); 173 ret = pvclock_clocksource_read(src);
173 put_cpu_var(xen_vcpu); 174 preempt_enable_notrace();
174 return ret; 175 return ret;
175} 176}
176 177
diff --git a/arch/xtensa/configs/iss_defconfig b/arch/xtensa/configs/iss_defconfig
index 0234cd198c54..f932b30b47fb 100644
--- a/arch/xtensa/configs/iss_defconfig
+++ b/arch/xtensa/configs/iss_defconfig
@@ -15,7 +15,6 @@ CONFIG_GENERIC_GPIO=y
15# CONFIG_ARCH_HAS_ILOG2_U64 is not set 15# CONFIG_ARCH_HAS_ILOG2_U64 is not set
16CONFIG_NO_IOPORT=y 16CONFIG_NO_IOPORT=y
17CONFIG_HZ=100 17CONFIG_HZ=100
18CONFIG_GENERIC_TIME=y
19CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 18CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
20CONFIG_CONSTRUCTORS=y 19CONFIG_CONSTRUCTORS=y
21 20
diff --git a/arch/xtensa/configs/s6105_defconfig b/arch/xtensa/configs/s6105_defconfig
index 4891abbf16bc..550e8ed5b5c6 100644
--- a/arch/xtensa/configs/s6105_defconfig
+++ b/arch/xtensa/configs/s6105_defconfig
@@ -15,7 +15,6 @@ CONFIG_GENERIC_GPIO=y
15# CONFIG_ARCH_HAS_ILOG2_U64 is not set 15# CONFIG_ARCH_HAS_ILOG2_U64 is not set
16CONFIG_NO_IOPORT=y 16CONFIG_NO_IOPORT=y
17CONFIG_HZ=100 17CONFIG_HZ=100
18CONFIG_GENERIC_TIME=y
19CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config" 18CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
20 19
21# 20#
diff --git a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/iss/network.c
index f717e20d961b..7dde24456427 100644
--- a/arch/xtensa/platforms/iss/network.c
+++ b/arch/xtensa/platforms/iss/network.c
@@ -633,7 +633,7 @@ static const struct net_device_ops iss_netdev_ops = {
633 .ndo_set_mac_address = iss_net_set_mac, 633 .ndo_set_mac_address = iss_net_set_mac,
634 //.ndo_do_ioctl = iss_net_ioctl, 634 //.ndo_do_ioctl = iss_net_ioctl,
635 .ndo_tx_timeout = iss_net_tx_timeout, 635 .ndo_tx_timeout = iss_net_tx_timeout,
636 .ndo_set_multicast_list = iss_net_set_multicast_list, 636 .ndo_set_rx_mode = iss_net_set_multicast_list,
637}; 637};
638 638
639static int iss_net_configure(int index, char *init) 639static int iss_net_configure(int index, char *init)