aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
Diffstat (limited to 'arch')
-rw-r--r--arch/Kconfig7
-rw-r--r--arch/alpha/Kconfig4
-rw-r--r--arch/alpha/include/asm/local64.h1
-rw-r--r--arch/arm/Kconfig209
-rw-r--r--arch/arm/Makefile10
-rw-r--r--arch/arm/boot/Makefile8
-rw-r--r--arch/arm/boot/compressed/Makefile18
-rw-r--r--arch/arm/boot/compressed/Makefile.debug23
-rw-r--r--arch/arm/boot/compressed/head-l7200.S29
-rw-r--r--arch/arm/boot/compressed/head.S40
-rw-r--r--arch/arm/boot/compressed/misc.c20
-rw-r--r--arch/arm/common/gic.c46
-rw-r--r--arch/arm/common/sa1111.c10
-rw-r--r--arch/arm/configs/kirkwood_defconfig8
-rw-r--r--arch/arm/configs/lusl7200_defconfig23
-rw-r--r--arch/arm/include/asm/elf.h4
-rw-r--r--arch/arm/include/asm/hwcap.h1
-rw-r--r--arch/arm/include/asm/io.h50
-rw-r--r--arch/arm/include/asm/irq.h2
-rw-r--r--arch/arm/include/asm/kexec.h22
-rw-r--r--arch/arm/include/asm/kgdb.h6
-rw-r--r--arch/arm/include/asm/local64.h1
-rw-r--r--arch/arm/include/asm/mach/arch.h2
-rw-r--r--arch/arm/include/asm/mach/irq.h1
-rw-r--r--arch/arm/include/asm/mach/map.h2
-rw-r--r--arch/arm/include/asm/mach/pci.h1
-rw-r--r--arch/arm/include/asm/memblock.h16
-rw-r--r--arch/arm/include/asm/memory.h76
-rw-r--r--arch/arm/include/asm/mmzone.h30
-rw-r--r--arch/arm/include/asm/ptrace.h36
-rw-r--r--arch/arm/include/asm/setup.h8
-rw-r--r--arch/arm/include/asm/stackprotector.h38
-rw-r--r--arch/arm/include/asm/system.h2
-rw-r--r--arch/arm/include/asm/tls.h46
-rw-r--r--arch/arm/include/asm/vfpmacros.h18
-rw-r--r--arch/arm/kernel/Makefile5
-rw-r--r--arch/arm/kernel/asm-offsets.c3
-rw-r--r--arch/arm/kernel/compat.c7
-rw-r--r--arch/arm/kernel/compat.h2
-rw-r--r--arch/arm/kernel/crash_dump.c60
-rw-r--r--arch/arm/kernel/entry-armv.S29
-rw-r--r--arch/arm/kernel/irq.c41
-rw-r--r--arch/arm/kernel/kgdb.c124
-rw-r--r--arch/arm/kernel/machine_kexec.c14
-rw-r--r--arch/arm/kernel/perf_event.c18
-rw-r--r--arch/arm/kernel/process.c42
-rw-r--r--arch/arm/kernel/ptrace.c96
-rw-r--r--arch/arm/kernel/relocate_kernel.S6
-rw-r--r--arch/arm/kernel/setup.c111
-rw-r--r--arch/arm/kernel/smp.c17
-rw-r--r--arch/arm/kernel/smp_twd.c3
-rw-r--r--arch/arm/kernel/tcm.c118
-rw-r--r--arch/arm/kernel/traps.c41
-rw-r--r--arch/arm/lib/Makefile1
-rw-r--r--arch/arm/lib/csumpartialcopyuser.S2
-rw-r--r--arch/arm/mach-aaec2000/include/mach/memory.h10
-rw-r--r--arch/arm/mach-at91/Kconfig11
-rw-r--r--arch/arm/mach-at91/Makefile3
-rw-r--r--arch/arm/mach-at91/at91sam9g45.c11
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c45
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek.c45
-rw-r--r--arch/arm/mach-at91/board-snapper9260.c189
-rw-r--r--arch/arm/mach-at91/include/mach/at91cap9.h2
-rw-r--r--arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h22
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9260.h2
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9261.h2
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h130
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9_sdramc.h23
-rw-r--r--arch/arm/mach-at91/include/mach/at91sam9rl.h2
-rw-r--r--arch/arm/mach-at91/include/mach/board.h2
-rw-r--r--arch/arm/mach-at91/include/mach/cpu.h10
-rw-r--r--arch/arm/mach-at91/include/mach/gpio.h1
-rw-r--r--arch/arm/mach-at91/pm.h49
-rw-r--r--arch/arm/mach-at91/pm_slowclock.S74
-rw-r--r--arch/arm/mach-bcmring/core.c23
-rw-r--r--arch/arm/mach-clps711x/Kconfig1
-rw-r--r--arch/arm/mach-clps711x/clep7312.c1
-rw-r--r--arch/arm/mach-clps711x/edb7211-arch.c10
-rw-r--r--arch/arm/mach-clps711x/fortunet.c1
-rw-r--r--arch/arm/mach-clps711x/include/mach/memory.h2
-rw-r--r--arch/arm/mach-cns3xxx/Makefile3
-rw-r--r--arch/arm/mach-cns3xxx/cns3420vb.c4
-rw-r--r--arch/arm/mach-cns3xxx/devices.c111
-rw-r--r--arch/arm/mach-cns3xxx/devices.h20
-rw-r--r--arch/arm/mach-cns3xxx/include/mach/cns3xxx.h91
-rw-r--r--arch/arm/mach-cns3xxx/pcie.c389
-rw-r--r--arch/arm/mach-cns3xxx/pm.c31
-rw-r--r--arch/arm/mach-davinci/board-da850-evm.c8
-rw-r--r--arch/arm/mach-davinci/include/mach/memory.h9
-rw-r--r--arch/arm/mach-dove/common.c61
-rw-r--r--arch/arm/mach-dove/common.h2
-rw-r--r--arch/arm/mach-dove/dove-db-setup.c2
-rw-r--r--arch/arm/mach-ep93xx/adssphere.c24
-rw-r--r--arch/arm/mach-ep93xx/clock.c2
-rw-r--r--arch/arm/mach-ep93xx/core.c46
-rw-r--r--arch/arm/mach-ep93xx/edb93xx.c31
-rw-r--r--arch/arm/mach-ep93xx/gesbc9312.c24
-rw-r--r--arch/arm/mach-ep93xx/include/mach/platform.h3
-rw-r--r--arch/arm/mach-ep93xx/micro9.c37
-rw-r--r--arch/arm/mach-ep93xx/simone.c24
-rw-r--r--arch/arm/mach-ep93xx/ts72xx.c27
-rw-r--r--arch/arm/mach-imx/Kconfig (renamed from arch/arm/mach-mx2/Kconfig)101
-rw-r--r--arch/arm/mach-imx/Makefile (renamed from arch/arm/mach-mx2/Makefile)18
-rw-r--r--arch/arm/mach-imx/Makefile.boot (renamed from arch/arm/mach-mx2/Makefile.boot)4
-rw-r--r--arch/arm/mach-imx/clock-imx1.c (renamed from arch/arm/mach-mx1/clock.c)50
-rw-r--r--arch/arm/mach-imx/clock-imx21.c (renamed from arch/arm/mach-mx2/clock_imx21.c)0
-rw-r--r--arch/arm/mach-imx/clock-imx27.c (renamed from arch/arm/mach-mx2/clock_imx27.c)2
-rw-r--r--arch/arm/mach-imx/cpu-imx27.c (renamed from arch/arm/mach-mx2/cpu_imx27.c)0
-rw-r--r--arch/arm/mach-imx/devices-imx1.h18
-rw-r--r--arch/arm/mach-imx/devices-imx21.h30
-rw-r--r--arch/arm/mach-imx/devices-imx27.h38
-rw-r--r--arch/arm/mach-imx/devices.c (renamed from arch/arm/mach-mx2/devices.c)296
-rw-r--r--arch/arm/mach-imx/devices.h (renamed from arch/arm/mach-mx2/devices.h)32
-rw-r--r--arch/arm/mach-imx/dma-v1.c (renamed from arch/arm/plat-mxc/dma-mx1-mx2.c)7
-rw-r--r--arch/arm/mach-imx/eukrea_mbimx27-baseboard.c (renamed from arch/arm/mach-mx2/eukrea_mbimx27-baseboard.c)197
-rw-r--r--arch/arm/mach-imx/include/mach/dma-mx1-mx2.h10
-rw-r--r--arch/arm/mach-imx/include/mach/dma-v1.h (renamed from arch/arm/plat-mxc/include/mach/dma-mx1-mx2.h)10
-rw-r--r--arch/arm/mach-imx/mach-cpuimx27.c (renamed from arch/arm/mach-mx2/mach-cpuimx27.c)122
-rw-r--r--arch/arm/mach-imx/mach-imx27lite.c (renamed from arch/arm/mach-mx2/mach-imx27lite.c)11
-rw-r--r--arch/arm/mach-imx/mach-mx1ads.c (renamed from arch/arm/mach-mx1/mach-mx1ads.c)34
-rw-r--r--arch/arm/mach-imx/mach-mx21ads.c (renamed from arch/arm/mach-mx2/mach-mx21ads.c)58
-rw-r--r--arch/arm/mach-imx/mach-mx27_3ds.c (renamed from arch/arm/mach-mx2/mach-mx27_3ds.c)40
-rw-r--r--arch/arm/mach-imx/mach-mx27ads.c (renamed from arch/arm/mach-mx2/mach-mx27ads.c)76
-rw-r--r--arch/arm/mach-imx/mach-mxt_td60.c (renamed from arch/arm/mach-mx2/mach-mxt_td60.c)36
-rw-r--r--arch/arm/mach-imx/mach-pca100.c (renamed from arch/arm/mach-mx2/mach-pca100.c)114
-rw-r--r--arch/arm/mach-imx/mach-pcm038.c (renamed from arch/arm/mach-mx2/mach-pcm038.c)33
-rw-r--r--arch/arm/mach-imx/mach-scb9328.c (renamed from arch/arm/mach-mx1/mach-scb9328.c)21
-rw-r--r--arch/arm/mach-imx/mm-imx1.c (renamed from arch/arm/mach-mx1/generic.c)23
-rw-r--r--arch/arm/mach-imx/mm-imx21.c (renamed from arch/arm/mach-mx2/mm-imx21.c)5
-rw-r--r--arch/arm/mach-imx/mm-imx27.c (renamed from arch/arm/mach-mx2/mm-imx27.c)5
-rw-r--r--arch/arm/mach-imx/mx1-camera-fiq-ksym.c (renamed from arch/arm/mach-mx1/ksym_mx1.c)0
-rw-r--r--arch/arm/mach-imx/mx1-camera-fiq.S (renamed from arch/arm/mach-mx1/mx1_camera_fiq.S)0
-rw-r--r--arch/arm/mach-imx/pcm970-baseboard.c (renamed from arch/arm/mach-mx2/pcm970-baseboard.c)0
-rw-r--r--arch/arm/mach-imx/pm-imx27.c46
-rw-r--r--arch/arm/mach-integrator/common.h1
-rw-r--r--arch/arm/mach-integrator/core.c19
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c3
-rw-r--r--arch/arm/mach-integrator/integrator_cp.c3
-rw-r--r--arch/arm/mach-integrator/pci_v3.c8
-rw-r--r--arch/arm/mach-iop13xx/include/mach/memory.h2
-rw-r--r--arch/arm/mach-iop13xx/pci.c2
-rw-r--r--arch/arm/mach-ixp2000/pci.c2
-rw-r--r--arch/arm/mach-ixp23xx/pci.c2
-rw-r--r--arch/arm/mach-ixp4xx/common-pci.c7
-rw-r--r--arch/arm/mach-ixp4xx/include/mach/memory.h6
-rw-r--r--arch/arm/mach-kirkwood/Kconfig19
-rw-r--r--arch/arm/mach-kirkwood/Makefile2
-rw-r--r--arch/arm/mach-kirkwood/addr-map.c10
-rw-r--r--arch/arm/mach-kirkwood/common.c38
-rw-r--r--arch/arm/mach-kirkwood/common.h5
-rw-r--r--arch/arm/mach-kirkwood/db88f6281-bp-setup.c18
-rw-r--r--arch/arm/mach-kirkwood/include/mach/bridge-regs.h3
-rw-r--r--arch/arm/mach-kirkwood/include/mach/irqs.h1
-rw-r--r--arch/arm/mach-kirkwood/include/mach/kirkwood.h39
-rw-r--r--arch/arm/mach-kirkwood/include/mach/leds-ns2.h26
-rw-r--r--arch/arm/mach-kirkwood/mpp.c3
-rw-r--r--arch/arm/mach-kirkwood/mpp.h596
-rw-r--r--arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c2
-rw-r--r--arch/arm/mach-kirkwood/netspace_v2-setup.c104
-rw-r--r--arch/arm/mach-kirkwood/netxbig_v2-setup.c32
-rw-r--r--arch/arm/mach-kirkwood/openrd-setup.c29
-rw-r--r--arch/arm/mach-kirkwood/pcie.c174
-rw-r--r--arch/arm/mach-kirkwood/rd88f6192-nas-setup.c2
-rw-r--r--arch/arm/mach-kirkwood/rd88f6281-setup.c2
-rw-r--r--arch/arm/mach-kirkwood/t5325-setup.c194
-rw-r--r--arch/arm/mach-kirkwood/ts219-setup.c11
-rw-r--r--arch/arm/mach-kirkwood/ts41x-setup.c39
-rw-r--r--arch/arm/mach-ks8695/pci.c4
-rw-r--r--arch/arm/mach-l7200/Makefile11
-rw-r--r--arch/arm/mach-l7200/Makefile.boot2
-rw-r--r--arch/arm/mach-l7200/core.c100
-rw-r--r--arch/arm/mach-l7200/include/mach/aux_reg.h28
-rw-r--r--arch/arm/mach-l7200/include/mach/debug-macro.S40
-rw-r--r--arch/arm/mach-l7200/include/mach/entry-macro.S35
-rw-r--r--arch/arm/mach-l7200/include/mach/gp_timers.h42
-rw-r--r--arch/arm/mach-l7200/include/mach/gpio.h105
-rw-r--r--arch/arm/mach-l7200/include/mach/hardware.h57
-rw-r--r--arch/arm/mach-l7200/include/mach/io.h21
-rw-r--r--arch/arm/mach-l7200/include/mach/irqs.h56
-rw-r--r--arch/arm/mach-l7200/include/mach/memory.h26
-rw-r--r--arch/arm/mach-l7200/include/mach/pmpcon.h46
-rw-r--r--arch/arm/mach-l7200/include/mach/pmu.h125
-rw-r--r--arch/arm/mach-l7200/include/mach/serial.h37
-rw-r--r--arch/arm/mach-l7200/include/mach/serial_l7200.h101
-rw-r--r--arch/arm/mach-l7200/include/mach/sib.h119
-rw-r--r--arch/arm/mach-l7200/include/mach/sys-clock.h67
-rw-r--r--arch/arm/mach-l7200/include/mach/system.h29
-rw-r--r--arch/arm/mach-l7200/include/mach/time.h73
-rw-r--r--arch/arm/mach-l7200/include/mach/timex.h20
-rw-r--r--arch/arm/mach-l7200/include/mach/uncompress.h39
-rw-r--r--arch/arm/mach-l7200/include/mach/vmalloc.h4
-rw-r--r--arch/arm/mach-lh7a40x/include/mach/memory.h44
-rw-r--r--arch/arm/mach-lpc32xx/Kconfig33
-rw-r--r--arch/arm/mach-lpc32xx/Makefile8
-rw-r--r--arch/arm/mach-lpc32xx/Makefile.boot4
-rw-r--r--arch/arm/mach-lpc32xx/clock.c1137
-rw-r--r--arch/arm/mach-lpc32xx/clock.h38
-rw-r--r--arch/arm/mach-lpc32xx/common.c271
-rw-r--r--arch/arm/mach-lpc32xx/common.h73
-rw-r--r--arch/arm/mach-lpc32xx/gpiolib.c446
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/clkdev.h (renamed from arch/arm/plat-mxc/include/mach/board-pcm043.h)19
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/debug-macro.S (renamed from arch/arm/plat-mxc/include/mach/board-mx35pdk.h)25
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/entry-macro.S47
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/gpio.h74
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/hardware.h34
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/i2c.h63
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/io.h (renamed from arch/arm/plat-mxc/include/mach/board-pcm037.h)21
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/irqs.h117
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/memory.h27
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/platform.h694
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/system.h52
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/timex.h28
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/uncompress.h60
-rw-r--r--arch/arm/mach-lpc32xx/include/mach/vmalloc.h24
-rw-r--r--arch/arm/mach-lpc32xx/irq.c432
-rw-r--r--arch/arm/mach-lpc32xx/phy3250.c397
-rw-r--r--arch/arm/mach-lpc32xx/pm.c146
-rw-r--r--arch/arm/mach-lpc32xx/serial.c190
-rw-r--r--arch/arm/mach-lpc32xx/suspend.S151
-rw-r--r--arch/arm/mach-lpc32xx/timer.c182
-rw-r--r--arch/arm/mach-msm/Makefile2
-rw-r--r--arch/arm/mach-msm/acpuclock-arm11.c4
-rw-r--r--arch/arm/mach-msm/board-trout-gpio.c112
-rw-r--r--arch/arm/mach-msm/board-trout.c1
-rw-r--r--arch/arm/mach-msm/board-trout.h157
-rw-r--r--arch/arm/mach-msm/include/mach/gpio.h7
-rw-r--r--arch/arm/mach-mx1/Kconfig19
-rw-r--r--arch/arm/mach-mx1/Makefile15
-rw-r--r--arch/arm/mach-mx1/Makefile.boot4
-rw-r--r--arch/arm/mach-mx1/crm_regs.h55
-rw-r--r--arch/arm/mach-mx1/devices.c242
-rw-r--r--arch/arm/mach-mx1/devices.h7
-rw-r--r--arch/arm/mach-mx2/serial.c141
-rw-r--r--arch/arm/mach-mx25/Kconfig23
-rw-r--r--arch/arm/mach-mx25/Makefile4
-rw-r--r--arch/arm/mach-mx25/clock.c70
-rw-r--r--arch/arm/mach-mx25/devices-imx25.h43
-rw-r--r--arch/arm/mach-mx25/devices.c313
-rw-r--r--arch/arm/mach-mx25/devices.h16
-rw-r--r--arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c260
-rw-r--r--arch/arm/mach-mx25/mach-cpuimx25.c173
-rw-r--r--arch/arm/mach-mx25/mach-mx25_3ds.c (renamed from arch/arm/mach-mx25/mach-mx25pdk.c)58
-rw-r--r--arch/arm/mach-mx25/mm.c7
-rw-r--r--arch/arm/mach-mx3/Kconfig53
-rw-r--r--arch/arm/mach-mx3/Makefile4
-rw-r--r--arch/arm/mach-mx3/clock-imx35.c6
-rw-r--r--arch/arm/mach-mx3/devices-imx31.h38
-rw-r--r--arch/arm/mach-mx3/devices-imx35.h37
-rw-r--r--arch/arm/mach-mx3/devices.c247
-rw-r--r--arch/arm/mach-mx3/devices.h13
-rw-r--r--arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c263
-rw-r--r--arch/arm/mach-mx3/mach-armadillo5x0.c17
-rw-r--r--arch/arm/mach-mx3/mach-cpuimx35.c227
-rw-r--r--arch/arm/mach-mx3/mach-kzm_arm11_01.c31
-rw-r--r--arch/arm/mach-mx3/mach-mx31_3ds.c256
-rw-r--r--arch/arm/mach-mx3/mach-mx31ads.c55
-rw-r--r--arch/arm/mach-mx3/mach-mx31lilly.c15
-rw-r--r--arch/arm/mach-mx3/mach-mx31lite.c17
-rw-r--r--arch/arm/mach-mx3/mach-mx31moboard.c50
-rw-r--r--arch/arm/mach-mx3/mach-mx35_3ds.c (renamed from arch/arm/mach-mx3/mach-mx35pdk.c)16
-rw-r--r--arch/arm/mach-mx3/mach-pcm037.c34
-rw-r--r--arch/arm/mach-mx3/mach-pcm037_eet.c7
-rw-r--r--arch/arm/mach-mx3/mach-pcm043.c31
-rw-r--r--arch/arm/mach-mx3/mach-qong.c16
-rw-r--r--arch/arm/mach-mx3/mm.c7
-rw-r--r--arch/arm/mach-mx3/mx31lilly-db.c14
-rw-r--r--arch/arm/mach-mx3/mx31lite-db.c15
-rw-r--r--arch/arm/mach-mx3/mx31moboard-devboard.c10
-rw-r--r--arch/arm/mach-mx3/mx31moboard-marxbot.c4
-rw-r--r--arch/arm/mach-mx3/mx31moboard-smartbot.c11
-rw-r--r--arch/arm/mach-mx5/Kconfig27
-rw-r--r--arch/arm/mach-mx5/Makefile4
-rw-r--r--arch/arm/mach-mx5/board-cpuimx51.c293
-rw-r--r--arch/arm/mach-mx5/board-mx51_3ds.c164
-rw-r--r--arch/arm/mach-mx5/board-mx51_babbage.c28
-rw-r--r--arch/arm/mach-mx5/clock-mx51.c16
-rw-r--r--arch/arm/mach-mx5/devices.c83
-rw-r--r--arch/arm/mach-mx5/devices.h4
-rw-r--r--arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c200
-rw-r--r--arch/arm/mach-mx5/mm.c3
-rw-r--r--arch/arm/mach-mxc91231/crm_regs.h5
-rw-r--r--arch/arm/mach-mxc91231/devices.c2
-rw-r--r--arch/arm/mach-mxc91231/mm.c8
-rw-r--r--arch/arm/mach-nomadik/clock.c4
-rw-r--r--arch/arm/mach-omap1/board-ams-delta.c1
-rw-r--r--arch/arm/mach-omap1/board-fsample.c1
-rw-r--r--arch/arm/mach-omap1/board-generic.c1
-rw-r--r--arch/arm/mach-omap1/board-h2.c1
-rw-r--r--arch/arm/mach-omap1/board-h3.c1
-rw-r--r--arch/arm/mach-omap1/board-htcherald.c1
-rw-r--r--arch/arm/mach-omap1/board-innovator.c1
-rw-r--r--arch/arm/mach-omap1/board-nokia770.c1
-rw-r--r--arch/arm/mach-omap1/board-osk.c1
-rw-r--r--arch/arm/mach-omap1/board-palmte.c1
-rw-r--r--arch/arm/mach-omap1/board-palmtt.c1
-rw-r--r--arch/arm/mach-omap1/board-palmz71.c14
-rw-r--r--arch/arm/mach-omap1/board-perseus2.c1
-rw-r--r--arch/arm/mach-omap1/board-sx1.c3
-rw-r--r--arch/arm/mach-omap1/board-voiceblue.c1
-rw-r--r--arch/arm/mach-omap1/io.c2
-rw-r--r--arch/arm/mach-omap2/board-2430sdp.c1
-rw-r--r--arch/arm/mach-omap2/board-3430sdp.c1
-rw-r--r--arch/arm/mach-omap2/board-3630sdp.c1
-rw-r--r--arch/arm/mach-omap2/board-4430sdp.c1
-rw-r--r--arch/arm/mach-omap2/board-am3517evm.c1
-rw-r--r--arch/arm/mach-omap2/board-apollon.c1
-rw-r--r--arch/arm/mach-omap2/board-cm-t35.c1
-rw-r--r--arch/arm/mach-omap2/board-devkit8000.c1
-rw-r--r--arch/arm/mach-omap2/board-generic.c1
-rw-r--r--arch/arm/mach-omap2/board-h4.c1
-rw-r--r--arch/arm/mach-omap2/board-igep0020.c1
-rw-r--r--arch/arm/mach-omap2/board-ldp.c1
-rw-r--r--arch/arm/mach-omap2/board-n8x0.c3
-rw-r--r--arch/arm/mach-omap2/board-omap3beagle.c1
-rw-r--r--arch/arm/mach-omap2/board-omap3evm.c1
-rw-r--r--arch/arm/mach-omap2/board-omap3pandora.c1
-rw-r--r--arch/arm/mach-omap2/board-omap3touchbook.c1
-rw-r--r--arch/arm/mach-omap2/board-overo.c1
-rw-r--r--arch/arm/mach-omap2/board-rx51.c1
-rw-r--r--arch/arm/mach-omap2/board-zoom2.c1
-rw-r--r--arch/arm/mach-omap2/board-zoom3.c1
-rw-r--r--arch/arm/mach-omap2/clock3xxx_data.c5
-rw-r--r--arch/arm/mach-omap2/dpll3xxx.c2
-rw-r--r--arch/arm/mach-omap2/io.c3
-rw-r--r--arch/arm/mach-omap2/sleep34xx.S2
-rw-r--r--arch/arm/mach-orion5x/Kconfig1
-rw-r--r--arch/arm/mach-orion5x/dns323-setup.c370
-rw-r--r--arch/arm/mach-orion5x/include/mach/system.h2
-rw-r--r--arch/arm/mach-pxa/cm-x2xx-pci.c4
-rw-r--r--arch/arm/mach-pxa/corgi.c1
-rw-r--r--arch/arm/mach-pxa/eseries.c1
-rw-r--r--arch/arm/mach-pxa/generic.h3
-rw-r--r--arch/arm/mach-pxa/include/mach/memory.h19
-rw-r--r--arch/arm/mach-pxa/palmt5.c7
-rw-r--r--arch/arm/mach-pxa/palmtreo.c9
-rw-r--r--arch/arm/mach-pxa/poodle.c1
-rw-r--r--arch/arm/mach-pxa/spitz.c1
-rw-r--r--arch/arm/mach-pxa/tosa.c1
-rw-r--r--arch/arm/mach-realview/core.c42
-rw-r--r--arch/arm/mach-realview/include/mach/board-pb1176.h1
-rw-r--r--arch/arm/mach-realview/include/mach/irqs-pb1176.h2
-rw-r--r--arch/arm/mach-realview/include/mach/memory.h7
-rw-r--r--arch/arm/mach-realview/realview_eb.c30
-rw-r--r--arch/arm/mach-realview/realview_pb1176.c46
-rw-r--r--arch/arm/mach-realview/realview_pb11mp.c9
-rw-r--r--arch/arm/mach-realview/realview_pba8.c9
-rw-r--r--arch/arm/mach-realview/realview_pbx.c9
-rw-r--r--arch/arm/mach-s3c2410/mach-h1940.c9
-rw-r--r--arch/arm/mach-s3c2412/mach-smdk2413.c1
-rw-r--r--arch/arm/mach-s3c2412/mach-vstms.c1
-rw-r--r--arch/arm/mach-s3c2440/mach-rx1950.c9
-rw-r--r--arch/arm/mach-s3c2440/mach-rx3715.c9
-rw-r--r--arch/arm/mach-sa1100/collie.c2
-rw-r--r--arch/arm/mach-sa1100/generic.h3
-rw-r--r--arch/arm/mach-sa1100/include/mach/memory.h6
-rw-r--r--arch/arm/mach-shark/include/mach/memory.h7
-rw-r--r--arch/arm/mach-shmobile/Kconfig12
-rw-r--r--arch/arm/mach-shmobile/include/mach/irqs.h1
-rw-r--r--arch/arm/mach-spear3xx/clock.c3
-rw-r--r--arch/arm/mach-spear6xx/clock.c3
-rw-r--r--arch/arm/mach-u300/clock.c6
-rw-r--r--arch/arm/mach-u300/core.c7
-rw-r--r--arch/arm/mach-u300/gpio.c2
-rw-r--r--arch/arm/mach-u300/include/mach/memory.h8
-rw-r--r--arch/arm/mach-u300/u300.c17
-rw-r--r--arch/arm/mach-ux500/board-mop500.c36
-rw-r--r--arch/arm/mach-ux500/clock.c4
-rw-r--r--arch/arm/mach-ux500/devices-db8500.c14
-rw-r--r--arch/arm/mach-ux500/include/mach/irqs-board-mop500.h23
-rw-r--r--arch/arm/mach-ux500/include/mach/irqs-db5500.h85
-rw-r--r--arch/arm/mach-ux500/include/mach/irqs-db8500.h96
-rw-r--r--arch/arm/mach-ux500/include/mach/irqs.h22
-rw-r--r--arch/arm/mach-ux500/include/mach/uncompress.h10
-rw-r--r--arch/arm/mach-ux500/pins-db8500.h742
-rw-r--r--arch/arm/mach-versatile/core.c35
-rw-r--r--arch/arm/mach-versatile/pci.c2
-rw-r--r--arch/arm/mach-vexpress/ct-ca9x4.c2
-rw-r--r--arch/arm/mach-vexpress/include/mach/ct-ca9x4.h1
-rw-r--r--arch/arm/mach-vexpress/v2m.c9
-rw-r--r--arch/arm/mach-w90x900/dev.c96
-rw-r--r--arch/arm/mach-w90x900/include/mach/regs-gcr.h39
-rw-r--r--arch/arm/mach-w90x900/mach-nuc950evb.c44
-rw-r--r--arch/arm/mach-w90x900/nuc910.c2
-rw-r--r--arch/arm/mach-w90x900/nuc950.c2
-rw-r--r--arch/arm/mm/Kconfig11
-rw-r--r--arch/arm/mm/Makefile1
-rw-r--r--arch/arm/mm/alignment.c16
-rw-r--r--arch/arm/mm/cache-l2x0.c26
-rw-r--r--arch/arm/mm/discontig.c45
-rw-r--r--arch/arm/mm/dma-mapping.c15
-rw-r--r--arch/arm/mm/fault.c56
-rw-r--r--arch/arm/mm/highmem.c13
-rw-r--r--arch/arm/mm/init.c424
-rw-r--r--arch/arm/mm/ioremap.c80
-rw-r--r--arch/arm/mm/mm.h4
-rw-r--r--arch/arm/mm/mmap.c4
-rw-r--r--arch/arm/mm/mmu.c174
-rw-r--r--arch/arm/mm/nommu.c22
-rw-r--r--arch/arm/mm/proc-arm1020.S6
-rw-r--r--arch/arm/mm/proc-arm1020e.S6
-rw-r--r--arch/arm/mm/proc-arm1022.S6
-rw-r--r--arch/arm/mm/proc-arm1026.S6
-rw-r--r--arch/arm/mm/proc-arm6_7.S2
-rw-r--r--arch/arm/mm/proc-arm720.S6
-rw-r--r--arch/arm/mm/proc-arm740.S6
-rw-r--r--arch/arm/mm/proc-arm7tdmi.S2
-rw-r--r--arch/arm/mm/proc-arm920.S10
-rw-r--r--arch/arm/mm/proc-arm922.S10
-rw-r--r--arch/arm/mm/proc-arm925.S6
-rw-r--r--arch/arm/mm/proc-arm926.S6
-rw-r--r--arch/arm/mm/proc-arm940.S6
-rw-r--r--arch/arm/mm/proc-arm946.S6
-rw-r--r--arch/arm/mm/proc-arm9tdmi.S2
-rw-r--r--arch/arm/mm/proc-fa526.S6
-rw-r--r--arch/arm/mm/proc-feroceon.S7
-rw-r--r--arch/arm/mm/proc-mohawk.S6
-rw-r--r--arch/arm/mm/proc-sa110.S8
-rw-r--r--arch/arm/mm/proc-sa1100.S6
-rw-r--r--arch/arm/mm/proc-v6.S10
-rw-r--r--arch/arm/mm/proc-v7.S7
-rw-r--r--arch/arm/mm/proc-xsc3.S6
-rw-r--r--arch/arm/mm/proc-xscale.S6
-rw-r--r--arch/arm/mm/vmregion.c5
-rw-r--r--arch/arm/mm/vmregion.h2
-rw-r--r--arch/arm/plat-iop/pci.c2
-rw-r--r--arch/arm/plat-iop/time.c53
-rw-r--r--arch/arm/plat-mxc/3ds_debugboard.c202
-rw-r--r--arch/arm/plat-mxc/Kconfig22
-rw-r--r--arch/arm/plat-mxc/Makefile5
-rw-r--r--arch/arm/plat-mxc/audmux-v1.c4
-rw-r--r--arch/arm/plat-mxc/audmux-v2.c19
-rw-r--r--arch/arm/plat-mxc/clock.c37
-rw-r--r--arch/arm/plat-mxc/devices.c33
-rw-r--r--arch/arm/plat-mxc/devices/Kconfig15
-rw-r--r--arch/arm/plat-mxc/devices/Makefile8
-rw-r--r--arch/arm/plat-mxc/devices/platform-flexcan.c30
-rw-r--r--arch/arm/plat-mxc/devices/platform-imx-i2c.c29
-rw-r--r--arch/arm/plat-mxc/devices/platform-imx-uart.c60
-rw-r--r--arch/arm/plat-mxc/devices/platform-mxc_nand.c44
-rw-r--r--arch/arm/plat-mxc/devices/platform-spi_imx.c30
-rw-r--r--arch/arm/plat-mxc/ehci.c50
-rw-r--r--arch/arm/plat-mxc/gpio.c14
-rw-r--r--arch/arm/plat-mxc/include/mach/3ds_debugboard.h18
-rw-r--r--arch/arm/plat-mxc/include/mach/board-armadillo5x0.h15
-rw-r--r--arch/arm/plat-mxc/include/mach/board-kzmarm11.h39
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx21ads.h52
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx27ads.h344
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx27lite.h14
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx27pdk.h14
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx31_3ds.h59
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx31ads.h117
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx31lilly.h2
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx31lite.h2
-rw-r--r--arch/arm/plat-mxc/include/mach/board-mx31moboard.h2
-rw-r--r--arch/arm/plat-mxc/include/mach/board-pcm038.h2
-rw-r--r--arch/arm/plat-mxc/include/mach/board-qong.h17
-rw-r--r--arch/arm/plat-mxc/include/mach/debug-macro.S4
-rw-r--r--arch/arm/plat-mxc/include/mach/devices-common.h60
-rw-r--r--arch/arm/plat-mxc/include/mach/eukrea-baseboards.h (renamed from arch/arm/plat-mxc/include/mach/board-eukrea_cpuimx27.h)19
-rw-r--r--arch/arm/plat-mxc/include/mach/gpio.h2
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-mx25.h28
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-mx51.h559
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-mxc91231.h4
-rw-r--r--arch/arm/plat-mxc/include/mach/iomux-v3.h15
-rw-r--r--arch/arm/plat-mxc/include/mach/memory.h4
-rw-r--r--arch/arm/plat-mxc/include/mach/mmc.h3
-rw-r--r--arch/arm/plat-mxc/include/mach/mx1.h28
-rw-r--r--arch/arm/plat-mxc/include/mach/mx25.h50
-rw-r--r--arch/arm/plat-mxc/include/mach/mx27.h4
-rw-r--r--arch/arm/plat-mxc/include/mach/mx2_cam.h46
-rw-r--r--arch/arm/plat-mxc/include/mach/mx31.h4
-rw-r--r--arch/arm/plat-mxc/include/mach/mx35.h6
-rw-r--r--arch/arm/plat-mxc/include/mach/mx3_camera.h4
-rw-r--r--arch/arm/plat-mxc/include/mach/mxc91231.h4
-rw-r--r--arch/arm/plat-mxc/include/mach/mxc_nand.h10
-rw-r--r--arch/arm/plat-mxc/include/mach/system.h4
-rw-r--r--arch/arm/plat-mxc/include/mach/timex.h4
-rw-r--r--arch/arm/plat-mxc/include/mach/uncompress.h4
-rw-r--r--arch/arm/plat-mxc/include/mach/vmalloc.h4
-rw-r--r--arch/arm/plat-mxc/irq.c3
-rw-r--r--arch/arm/plat-mxc/system.c4
-rw-r--r--arch/arm/plat-mxc/tzic.c2
-rw-r--r--arch/arm/plat-nomadik/gpio.c316
-rw-r--r--arch/arm/plat-nomadik/include/plat/gpio.h15
-rw-r--r--arch/arm/plat-nomadik/include/plat/mtu.h6
-rw-r--r--arch/arm/plat-nomadik/include/plat/pincfg.h72
-rw-r--r--arch/arm/plat-nomadik/timer.c14
-rw-r--r--arch/arm/plat-omap/common.c8
-rw-r--r--arch/arm/plat-omap/fb.c77
-rw-r--r--arch/arm/plat-omap/include/plat/common.h2
-rw-r--r--arch/arm/plat-omap/include/plat/vram.h4
-rw-r--r--arch/arm/plat-orion/pcie.c34
-rw-r--r--arch/arm/plat-s3c24xx/clock.c2
-rw-r--r--arch/arm/plat-samsung/clock.c2
-rw-r--r--arch/arm/plat-samsung/include/plat/keypad.h43
-rw-r--r--arch/arm/plat-spear/padmux.c2
-rw-r--r--arch/arm/plat-spear/time.c47
-rw-r--r--arch/arm/plat-versatile/Makefile4
-rw-r--r--arch/arm/plat-versatile/leds.c103
-rw-r--r--arch/arm/vfp/vfpmodule.c10
-rw-r--r--arch/avr32/Kconfig3
-rw-r--r--arch/avr32/Makefile2
-rw-r--r--arch/avr32/include/asm/local64.h1
-rw-r--r--arch/blackfin/Kconfig3
-rw-r--r--arch/blackfin/Makefile4
-rw-r--r--arch/blackfin/include/asm/local64.h1
-rw-r--r--arch/cris/Kconfig3
-rw-r--r--arch/cris/arch-v32/mm/intmem.c13
-rw-r--r--arch/cris/include/asm/local64.h1
-rw-r--r--arch/frv/Kconfig4
-rw-r--r--arch/frv/Makefile22
-rw-r--r--arch/frv/include/asm/local64.h1
-rw-r--r--arch/frv/kernel/local64.h1
-rw-r--r--arch/h8300/Kconfig4
-rw-r--r--arch/h8300/include/asm/local64.h1
-rw-r--r--arch/h8300/kernel/timer/itu.c2
-rw-r--r--arch/h8300/kernel/timer/timer16.c2
-rw-r--r--arch/h8300/kernel/timer/timer8.c2
-rw-r--r--arch/ia64/Kconfig4
-rw-r--r--arch/ia64/Makefile6
-rw-r--r--arch/ia64/configs/bigsur_defconfig1428
-rw-r--r--arch/ia64/configs/generic_defconfig1788
-rw-r--r--arch/ia64/configs/gensparse_defconfig1493
-rw-r--r--arch/ia64/configs/sim_defconfig756
-rw-r--r--arch/ia64/configs/tiger_defconfig1356
-rw-r--r--arch/ia64/configs/xen_domu_defconfig1678
-rw-r--r--arch/ia64/configs/zx1_defconfig1681
-rw-r--r--arch/ia64/include/asm/kvm_host.h1
-rw-r--r--arch/ia64/include/asm/local64.h1
-rw-r--r--arch/ia64/include/asm/page.h2
-rw-r--r--arch/ia64/kernel/msi_ia64.c2
-rw-r--r--arch/ia64/kernel/perfmon.c22
-rw-r--r--arch/ia64/kernel/time.c7
-rw-r--r--arch/ia64/kernel/vmlinux.lds.S362
-rw-r--r--arch/ia64/kvm/kvm-ia64.c56
-rw-r--r--arch/ia64/sn/kernel/msi_sn.c2
-rw-r--r--arch/ia64/sn/kernel/setup.c2
-rw-r--r--arch/m32r/Kconfig3
-rw-r--r--arch/m32r/Makefile4
-rw-r--r--arch/m32r/include/asm/local64.h1
-rw-r--r--arch/m68k/Kconfig3
-rw-r--r--arch/m68k/Makefile2
-rw-r--r--arch/m68k/include/asm/local64.h1
-rw-r--r--arch/m68knommu/Kconfig4
-rw-r--r--arch/microblaze/Kconfig51
-rw-r--r--arch/microblaze/Kconfig.debug1
-rw-r--r--arch/microblaze/Makefile2
-rw-r--r--arch/microblaze/boot/Makefile11
-rw-r--r--arch/microblaze/include/asm/cacheflush.h18
-rw-r--r--arch/microblaze/include/asm/dma-mapping.h6
-rw-r--r--arch/microblaze/include/asm/elf.h2
-rw-r--r--arch/microblaze/include/asm/exceptions.h21
-rw-r--r--arch/microblaze/include/asm/irq.h24
-rw-r--r--arch/microblaze/include/asm/kgdb.h28
-rw-r--r--arch/microblaze/include/asm/local64.h1
-rw-r--r--arch/microblaze/include/asm/of_device.h44
-rw-r--r--arch/microblaze/include/asm/of_platform.h54
-rw-r--r--arch/microblaze/include/asm/page.h19
-rw-r--r--arch/microblaze/include/asm/pci-bridge.h5
-rw-r--r--arch/microblaze/include/asm/prom.h115
-rw-r--r--arch/microblaze/include/asm/pvr.h2
-rw-r--r--arch/microblaze/include/asm/setup.h2
-rw-r--r--arch/microblaze/include/asm/system.h4
-rw-r--r--arch/microblaze/include/asm/topology.h10
-rw-r--r--arch/microblaze/include/asm/uaccess.h4
-rw-r--r--arch/microblaze/include/asm/unwind.h29
-rw-r--r--arch/microblaze/kernel/Makefile7
-rw-r--r--arch/microblaze/kernel/cpu/mb.c1
-rw-r--r--arch/microblaze/kernel/entry-nommu.S28
-rw-r--r--arch/microblaze/kernel/entry.S607
-rw-r--r--arch/microblaze/kernel/exceptions.c9
-rw-r--r--arch/microblaze/kernel/head.S4
-rw-r--r--arch/microblaze/kernel/hw_exception_handler.S4
-rw-r--r--arch/microblaze/kernel/irq.c16
-rw-r--r--arch/microblaze/kernel/kgdb.c147
-rw-r--r--arch/microblaze/kernel/misc.S2
-rw-r--r--arch/microblaze/kernel/of_device.c112
-rw-r--r--arch/microblaze/kernel/of_platform.c200
-rw-r--r--arch/microblaze/kernel/process.c7
-rw-r--r--arch/microblaze/kernel/prom_parse.c877
-rw-r--r--arch/microblaze/kernel/ptrace.c17
-rw-r--r--arch/microblaze/kernel/reset.c12
-rw-r--r--arch/microblaze/kernel/setup.c6
-rw-r--r--arch/microblaze/kernel/stacktrace.c44
-rw-r--r--arch/microblaze/kernel/timer.c24
-rw-r--r--arch/microblaze/kernel/traps.c91
-rw-r--r--arch/microblaze/kernel/unwind.c318
-rw-r--r--arch/microblaze/kernel/vmlinux.lds.S16
-rw-r--r--arch/microblaze/mm/fault.c16
-rw-r--r--arch/microblaze/mm/init.c7
-rw-r--r--arch/mips/Kbuild15
-rw-r--r--arch/mips/Kbuild.platforms32
-rw-r--r--arch/mips/Kconfig34
-rw-r--r--arch/mips/Makefile528
-rw-r--r--arch/mips/alchemy/Kconfig28
-rw-r--r--arch/mips/alchemy/Platform114
-rw-r--r--arch/mips/alchemy/common/Makefile2
-rw-r--r--arch/mips/alchemy/common/clocks.c4
-rw-r--r--arch/mips/alchemy/common/platform.c17
-rw-r--r--arch/mips/alchemy/devboards/Makefile2
-rw-r--r--arch/mips/alchemy/devboards/db1200/platform.c8
-rw-r--r--arch/mips/alchemy/devboards/db1x00/board_setup.c1
-rw-r--r--arch/mips/alchemy/devboards/pb1000/board_setup.c6
-rw-r--r--arch/mips/alchemy/devboards/pb1200/Makefile2
-rw-r--r--arch/mips/alchemy/gpr/Makefile8
-rw-r--r--arch/mips/alchemy/gpr/board_setup.c93
-rw-r--r--arch/mips/alchemy/gpr/init.c63
-rw-r--r--arch/mips/alchemy/gpr/platform.c183
-rw-r--r--arch/mips/alchemy/mtx-1/Makefile5
-rw-r--r--arch/mips/alchemy/mtx-1/board_setup.c18
-rw-r--r--arch/mips/alchemy/xxs1500/Makefile4
-rw-r--r--arch/mips/alchemy/xxs1500/board_setup.c6
-rw-r--r--arch/mips/ar7/Makefile1
-rw-r--r--arch/mips/ar7/Platform6
-rw-r--r--arch/mips/ar7/platform.c42
-rw-r--r--arch/mips/bcm47xx/Platform7
-rw-r--r--arch/mips/bcm47xx/nvram.c4
-rw-r--r--arch/mips/bcm47xx/prom.c22
-rw-r--r--arch/mips/bcm63xx/Makefile2
-rw-r--r--arch/mips/bcm63xx/Platform7
-rw-r--r--arch/mips/boot/.gitignore1
-rw-r--r--arch/mips/boot/Makefile49
-rw-r--r--arch/mips/boot/compressed/Makefile81
-rw-r--r--arch/mips/boot/compressed/calc_vmlinuz_load_addr.c57
-rw-r--r--arch/mips/boot/compressed/decompress.c38
-rw-r--r--arch/mips/boot/compressed/ld.script51
-rw-r--r--arch/mips/cavium-octeon/Makefile3
-rw-r--r--arch/mips/cavium-octeon/Platform11
-rw-r--r--arch/mips/cavium-octeon/cpu.c6
-rw-r--r--arch/mips/cavium-octeon/csrc-octeon.c63
-rw-r--r--arch/mips/cavium-octeon/dma-octeon.c17
-rw-r--r--arch/mips/cavium-octeon/octeon-irq.c553
-rw-r--r--arch/mips/cavium-octeon/octeon_boot.h16
-rw-r--r--arch/mips/cavium-octeon/serial.c4
-rw-r--r--arch/mips/cavium-octeon/setup.c48
-rw-r--r--arch/mips/cavium-octeon/smp.c170
-rw-r--r--arch/mips/cobalt/Makefile2
-rw-r--r--arch/mips/cobalt/Platform6
-rw-r--r--arch/mips/configs/db1000_defconfig3
-rw-r--r--arch/mips/configs/db1100_defconfig3
-rw-r--r--arch/mips/configs/db1200_defconfig3
-rw-r--r--arch/mips/configs/db1500_defconfig3
-rw-r--r--arch/mips/configs/db1550_defconfig3
-rw-r--r--arch/mips/configs/gpr_defconfig2060
-rw-r--r--arch/mips/configs/mtx1_defconfig3
-rw-r--r--arch/mips/configs/pb1100_defconfig3
-rw-r--r--arch/mips/configs/pb1200_defconfig3
-rw-r--r--arch/mips/configs/pb1500_defconfig3
-rw-r--r--arch/mips/configs/pb1550_defconfig3
-rw-r--r--arch/mips/configs/powertv_defconfig275
-rw-r--r--arch/mips/dec/Makefile2
-rw-r--r--arch/mips/dec/Platform8
-rw-r--r--arch/mips/dec/promcon.c3
-rw-r--r--arch/mips/emma/Makefile6
-rw-r--r--arch/mips/emma/Platform4
-rw-r--r--arch/mips/emma/markeins/irq.c8
-rw-r--r--arch/mips/emma/markeins/setup.c1
-rw-r--r--arch/mips/include/asm/arch_hweight.h38
-rw-r--r--arch/mips/include/asm/bitops.h5
-rw-r--r--arch/mips/include/asm/bootinfo.h6
-rw-r--r--arch/mips/include/asm/break.h2
-rw-r--r--arch/mips/include/asm/cacheops.h2
-rw-r--r--arch/mips/include/asm/cop2.h12
-rw-r--r--arch/mips/include/asm/cpu-features.h3
-rw-r--r--arch/mips/include/asm/cpu.h9
-rw-r--r--arch/mips/include/asm/elf.h5
-rw-r--r--arch/mips/include/asm/emma/emma2rh.h84
-rw-r--r--arch/mips/include/asm/emma/markeins.h37
-rw-r--r--arch/mips/include/asm/hazards.h4
-rw-r--r--arch/mips/include/asm/inst.h15
-rw-r--r--arch/mips/include/asm/kdebug.h3
-rw-r--r--arch/mips/include/asm/kgdb.h19
-rw-r--r--arch/mips/include/asm/kprobes.h92
-rw-r--r--arch/mips/include/asm/local64.h1
-rw-r--r--arch/mips/include/asm/mach-au1x00/au1xxx_eth.h1
-rw-r--r--arch/mips/include/asm/mach-bcm47xx/nvram.h3
-rw-r--r--arch/mips/include/asm/mach-cavium-octeon/cpu-feature-overrides.h15
-rw-r--r--arch/mips/include/asm/mach-cavium-octeon/irq.h66
-rw-r--r--arch/mips/include/asm/mach-jz4740/base.h26
-rw-r--r--arch/mips/include/asm/mach-jz4740/clock.h28
-rw-r--r--arch/mips/include/asm/mach-jz4740/cpu-feature-overrides.h51
-rw-r--r--arch/mips/include/asm/mach-jz4740/dma.h90
-rw-r--r--arch/mips/include/asm/mach-jz4740/gpio.h398
-rw-r--r--arch/mips/include/asm/mach-jz4740/irq.h57
-rw-r--r--arch/mips/include/asm/mach-jz4740/jz4740_fb.h67
-rw-r--r--arch/mips/include/asm/mach-jz4740/jz4740_mmc.h15
-rw-r--r--arch/mips/include/asm/mach-jz4740/jz4740_nand.h34
-rw-r--r--arch/mips/include/asm/mach-jz4740/platform.h36
-rw-r--r--arch/mips/include/asm/mach-jz4740/timer.h22
-rw-r--r--arch/mips/include/asm/mach-jz4740/war.h25
-rw-r--r--arch/mips/include/asm/mach-loongson/loongson.h9
-rw-r--r--arch/mips/include/asm/mach-pb1x00/pb1550.h8
-rw-r--r--arch/mips/include/asm/mach-powertv/asic.h21
-rw-r--r--arch/mips/include/asm/mach-powertv/asic_reg_map.h2
-rw-r--r--arch/mips/include/asm/mach-powertv/asic_regs.h5
-rw-r--r--arch/mips/include/asm/mach-powertv/dma-coherence.h8
-rw-r--r--arch/mips/include/asm/mach-powertv/ioremap.h165
-rw-r--r--arch/mips/include/asm/mach-tx49xx/kmalloc.h4
-rw-r--r--arch/mips/include/asm/mipsregs.h1
-rw-r--r--arch/mips/include/asm/octeon/octeon.h3
-rw-r--r--arch/mips/include/asm/octeon/pci-octeon.h13
-rw-r--r--arch/mips/include/asm/pci.h5
-rw-r--r--arch/mips/include/asm/pmc-sierra/msp71xx/msp_prom.h4
-rw-r--r--arch/mips/include/asm/processor.h13
-rw-r--r--arch/mips/include/asm/ptrace.h1
-rw-r--r--arch/mips/include/asm/sn/agent.h1
-rw-r--r--arch/mips/include/asm/uasm.h51
-rw-r--r--arch/mips/jazz/Makefile2
-rw-r--r--arch/mips/jazz/Platform6
-rw-r--r--arch/mips/jz4740/Kconfig12
-rw-r--r--arch/mips/jz4740/Makefile20
-rw-r--r--arch/mips/jz4740/Platform3
-rw-r--r--arch/mips/jz4740/board-qi_lb60.c471
-rw-r--r--arch/mips/jz4740/clock-debugfs.c109
-rw-r--r--arch/mips/jz4740/clock.c924
-rw-r--r--arch/mips/jz4740/clock.h76
-rw-r--r--arch/mips/jz4740/dma.c289
-rw-r--r--arch/mips/jz4740/gpio.c604
-rw-r--r--arch/mips/jz4740/irq.c167
-rw-r--r--arch/mips/jz4740/irq.h21
-rw-r--r--arch/mips/jz4740/platform.c291
-rw-r--r--arch/mips/jz4740/pm.c56
-rw-r--r--arch/mips/jz4740/prom.c68
-rw-r--r--arch/mips/jz4740/pwm.c177
-rw-r--r--arch/mips/jz4740/reset.c79
-rw-r--r--arch/mips/jz4740/reset.h6
-rw-r--r--arch/mips/jz4740/serial.c33
-rw-r--r--arch/mips/jz4740/serial.h20
-rw-r--r--arch/mips/jz4740/setup.c29
-rw-r--r--arch/mips/jz4740/time.c144
-rw-r--r--arch/mips/jz4740/timer.c48
-rw-r--r--arch/mips/jz4740/timer.h136
-rw-r--r--arch/mips/kernel/Makefile3
-rw-r--r--arch/mips/kernel/asm-offsets.c1
-rw-r--r--arch/mips/kernel/cevt-r4k.c5
-rw-r--r--arch/mips/kernel/cpu-bugs64.c2
-rw-r--r--arch/mips/kernel/cpu-probe.c23
-rw-r--r--arch/mips/kernel/kgdb.c211
-rw-r--r--arch/mips/kernel/kprobes.c557
-rw-r--r--arch/mips/kernel/mcount.S6
-rw-r--r--arch/mips/kernel/scall64-n32.S8
-rw-r--r--arch/mips/kernel/smp.c4
-rw-r--r--arch/mips/kernel/smtc.c3
-rw-r--r--arch/mips/kernel/syscall.c49
-rw-r--r--arch/mips/kernel/traps.c50
-rw-r--r--arch/mips/lasat/Makefile2
-rw-r--r--arch/mips/lasat/Platform7
-rw-r--r--arch/mips/loongson/Platform32
-rw-r--r--arch/mips/loongson/common/cs5536/Makefile2
-rw-r--r--arch/mips/loongson/common/irq.c14
-rw-r--r--arch/mips/loongson/fuloong-2e/Makefile2
-rw-r--r--arch/mips/loongson/fuloong-2e/irq.c13
-rw-r--r--arch/mips/loongson/lemote-2f/irq.c16
-rw-r--r--arch/mips/math-emu/Makefile1
-rw-r--r--arch/mips/math-emu/dp_modf.c2
-rw-r--r--arch/mips/math-emu/dp_tint.c3
-rw-r--r--arch/mips/math-emu/dp_tlong.c3
-rw-r--r--arch/mips/math-emu/sp_modf.c2
-rw-r--r--arch/mips/math-emu/sp_tint.c3
-rw-r--r--arch/mips/math-emu/sp_tlong.c3
-rw-r--r--arch/mips/mipssim/Makefile2
-rw-r--r--arch/mips/mipssim/Platform6
-rw-r--r--arch/mips/mm/Makefile2
-rw-r--r--arch/mips/mm/fault.c16
-rw-r--r--arch/mips/mm/sc-rm7k.c163
-rw-r--r--arch/mips/mm/tlbex.c5
-rw-r--r--arch/mips/mm/uasm.c162
-rw-r--r--arch/mips/mti-malta/Makefile2
-rw-r--r--arch/mips/mti-malta/Platform7
-rw-r--r--arch/mips/nxp/pnx833x/stb22x/Makefile3
-rw-r--r--arch/mips/nxp/pnx8550/jbs/Makefile4
-rw-r--r--arch/mips/nxp/pnx8550/stb810/Makefile4
-rw-r--r--arch/mips/pci/msi-octeon.c277
-rw-r--r--arch/mips/pci/ops-titan-ht.c4
-rw-r--r--arch/mips/pci/pcie-octeon.c37
-rw-r--r--arch/mips/pmc-sierra/Platform14
-rw-r--r--arch/mips/pmc-sierra/msp71xx/msp_hwbutton.c11
-rw-r--r--arch/mips/pmc-sierra/yosemite/ht-irq.c13
-rw-r--r--arch/mips/pmc-sierra/yosemite/irq.c4
-rw-r--r--arch/mips/pnx833x/Makefile3
-rw-r--r--arch/mips/pnx833x/Platform5
-rw-r--r--arch/mips/pnx833x/common/Makefile (renamed from arch/mips/nxp/pnx833x/common/Makefile)2
-rw-r--r--arch/mips/pnx833x/common/interrupts.c (renamed from arch/mips/nxp/pnx833x/common/interrupts.c)0
-rw-r--r--arch/mips/pnx833x/common/platform.c (renamed from arch/mips/nxp/pnx833x/common/platform.c)0
-rw-r--r--arch/mips/pnx833x/common/prom.c (renamed from arch/mips/nxp/pnx833x/common/prom.c)0
-rw-r--r--arch/mips/pnx833x/common/reset.c (renamed from arch/mips/nxp/pnx833x/common/reset.c)0
-rw-r--r--arch/mips/pnx833x/common/setup.c (renamed from arch/mips/nxp/pnx833x/common/setup.c)0
-rw-r--r--arch/mips/pnx833x/stb22x/Makefile1
-rw-r--r--arch/mips/pnx833x/stb22x/board.c (renamed from arch/mips/nxp/pnx833x/stb22x/board.c)0
-rw-r--r--arch/mips/pnx8550/Makefile3
-rw-r--r--arch/mips/pnx8550/Platform7
-rw-r--r--arch/mips/pnx8550/common/Makefile (renamed from arch/mips/nxp/pnx8550/common/Makefile)2
-rw-r--r--arch/mips/pnx8550/common/int.c (renamed from arch/mips/nxp/pnx8550/common/int.c)0
-rw-r--r--arch/mips/pnx8550/common/pci.c134
-rw-r--r--arch/mips/pnx8550/common/platform.c (renamed from arch/mips/nxp/pnx8550/common/platform.c)0
-rw-r--r--arch/mips/pnx8550/common/proc.c (renamed from arch/mips/nxp/pnx8550/common/proc.c)0
-rw-r--r--arch/mips/pnx8550/common/prom.c (renamed from arch/mips/nxp/pnx8550/common/prom.c)0
-rw-r--r--arch/mips/pnx8550/common/reset.c (renamed from arch/mips/nxp/pnx8550/common/reset.c)0
-rw-r--r--arch/mips/pnx8550/common/setup.c145
-rw-r--r--arch/mips/pnx8550/common/time.c (renamed from arch/mips/nxp/pnx8550/common/time.c)0
-rw-r--r--arch/mips/pnx8550/jbs/Makefile4
-rw-r--r--arch/mips/pnx8550/jbs/board_setup.c (renamed from arch/mips/nxp/pnx8550/jbs/board_setup.c)0
-rw-r--r--arch/mips/pnx8550/jbs/init.c (renamed from arch/mips/nxp/pnx8550/jbs/init.c)0
-rw-r--r--arch/mips/pnx8550/jbs/irqmap.c (renamed from arch/mips/nxp/pnx8550/jbs/irqmap.c)0
-rw-r--r--arch/mips/pnx8550/stb810/Makefile4
-rw-r--r--arch/mips/pnx8550/stb810/board_setup.c (renamed from arch/mips/nxp/pnx8550/stb810/board_setup.c)0
-rw-r--r--arch/mips/pnx8550/stb810/irqmap.c (renamed from arch/mips/nxp/pnx8550/stb810/irqmap.c)0
-rw-r--r--arch/mips/pnx8550/stb810/prom_init.c (renamed from arch/mips/nxp/pnx8550/stb810/prom_init.c)0
-rw-r--r--arch/mips/powertv/Makefile7
-rw-r--r--arch/mips/powertv/Platform7
-rw-r--r--arch/mips/powertv/asic/Makefile6
-rw-r--r--arch/mips/powertv/asic/asic-calliope.c2
-rw-r--r--arch/mips/powertv/asic/asic-cronus.c4
-rw-r--r--arch/mips/powertv/asic/asic-gaia.c96
-rw-r--r--arch/mips/powertv/asic/asic-zeus.c2
-rw-r--r--arch/mips/powertv/asic/asic_devices.c276
-rw-r--r--arch/mips/powertv/asic/prealloc-gaia.c589
-rw-r--r--arch/mips/powertv/init.c4
-rw-r--r--arch/mips/powertv/ioremap.c136
-rw-r--r--arch/mips/powertv/memory.c341
-rw-r--r--arch/mips/powertv/powertv-usb.c403
-rw-r--r--arch/mips/powertv/powertv_setup.c6
-rw-r--r--arch/mips/rb532/Makefile2
-rw-r--r--arch/mips/rb532/Platform7
-rw-r--r--arch/mips/sgi-ip22/Makefile2
-rw-r--r--arch/mips/sgi-ip22/Platform34
-rw-r--r--arch/mips/sgi-ip27/Makefile2
-rw-r--r--arch/mips/sgi-ip27/Platform19
-rw-r--r--arch/mips/sgi-ip27/ip27-klconfig.c8
-rw-r--r--arch/mips/sgi-ip32/Makefile2
-rw-r--r--arch/mips/sgi-ip32/Platform11
-rw-r--r--arch/mips/sibyte/Makefile27
-rw-r--r--arch/mips/sibyte/Platform43
-rw-r--r--arch/mips/sibyte/bcm1480/Makefile2
-rw-r--r--arch/mips/sibyte/common/Makefile2
-rw-r--r--arch/mips/sibyte/sb1250/Makefile2
-rw-r--r--arch/mips/sni/Makefile2
-rw-r--r--arch/mips/sni/Platform11
-rw-r--r--arch/mips/txx9/Makefile17
-rw-r--r--arch/mips/txx9/Platform10
-rw-r--r--arch/mips/txx9/generic/Makefile2
-rw-r--r--arch/mips/txx9/jmr3927/Makefile2
-rw-r--r--arch/mips/txx9/rbtx4927/Makefile2
-rw-r--r--arch/mips/txx9/rbtx4938/Makefile2
-rw-r--r--arch/mips/txx9/rbtx4939/Makefile2
-rw-r--r--arch/mips/vr41xx/Platform32
-rw-r--r--arch/mips/vr41xx/common/Makefile2
-rw-r--r--arch/mips/wrppmc/Makefile (renamed from arch/mips/gt64120/wrppmc/Makefile)4
-rw-r--r--arch/mips/wrppmc/Platform7
-rw-r--r--arch/mips/wrppmc/irq.c (renamed from arch/mips/gt64120/wrppmc/irq.c)0
-rw-r--r--arch/mips/wrppmc/pci.c (renamed from arch/mips/gt64120/wrppmc/pci.c)0
-rw-r--r--arch/mips/wrppmc/reset.c (renamed from arch/mips/gt64120/wrppmc/reset.c)0
-rw-r--r--arch/mips/wrppmc/serial.c (renamed from arch/mips/gt64120/wrppmc/serial.c)0
-rw-r--r--arch/mips/wrppmc/setup.c (renamed from arch/mips/gt64120/wrppmc/setup.c)0
-rw-r--r--arch/mips/wrppmc/time.c (renamed from arch/mips/gt64120/wrppmc/time.c)0
-rw-r--r--arch/mn10300/Kconfig3
-rw-r--r--arch/mn10300/include/asm/local64.h1
-rw-r--r--arch/parisc/Kconfig4
-rw-r--r--arch/parisc/include/asm/local64.h1
-rw-r--r--arch/parisc/kernel/firmware.c12
-rw-r--r--arch/parisc/kernel/ftrace.c4
-rw-r--r--arch/powerpc/Kconfig36
-rw-r--r--arch/powerpc/Makefile2
-rw-r--r--arch/powerpc/boot/dts/canyonlands.dts4
-rw-r--r--arch/powerpc/boot/dts/glacier.dts4
-rw-r--r--arch/powerpc/boot/dts/mpc8308rdb.dts303
-rw-r--r--arch/powerpc/boot/dts/mpc8540ads.dts4
-rw-r--r--arch/powerpc/boot/dts/mpc8541cds.dts4
-rw-r--r--arch/powerpc/boot/dts/mpc8544ds.dts4
-rw-r--r--arch/powerpc/boot/dts/mpc8548cds.dts4
-rw-r--r--arch/powerpc/boot/dts/mpc8555cds.dts4
-rw-r--r--arch/powerpc/boot/dts/mpc8560ads.dts4
-rw-r--r--arch/powerpc/boot/dts/mpc8568mds.dts4
-rw-r--r--arch/powerpc/boot/dts/p1021mds.dts1
-rw-r--r--arch/powerpc/boot/dts/p1022ds.dts633
-rw-r--r--arch/powerpc/boot/dts/pdm360ng.dts410
-rw-r--r--arch/powerpc/boot/dts/stxssa8555.dts380
-rw-r--r--arch/powerpc/boot/dts/tqm8540.dts9
-rw-r--r--arch/powerpc/boot/dts/tqm8541.dts9
-rw-r--r--arch/powerpc/boot/dts/tqm8548-bigflash.dts9
-rw-r--r--arch/powerpc/boot/dts/tqm8548.dts9
-rw-r--r--arch/powerpc/boot/dts/tqm8555.dts9
-rw-r--r--arch/powerpc/boot/dts/tqm8560.dts9
-rw-r--r--arch/powerpc/boot/dts/tqm8xx.dts172
-rw-r--r--arch/powerpc/configs/mpc85xx_defconfig34
-rw-r--r--arch/powerpc/configs/mpc85xx_smp_defconfig34
-rw-r--r--arch/powerpc/configs/tqm8xx_defconfig934
-rw-r--r--arch/powerpc/include/asm/abs_addr.h2
-rw-r--r--arch/powerpc/include/asm/asm-compat.h2
-rw-r--r--arch/powerpc/include/asm/cputable.h7
-rw-r--r--arch/powerpc/include/asm/dbell.h8
-rw-r--r--arch/powerpc/include/asm/hvcall.h1
-rw-r--r--arch/powerpc/include/asm/hw_breakpoint.h74
-rw-r--r--arch/powerpc/include/asm/irq.h28
-rw-r--r--arch/powerpc/include/asm/kvm_book3s.h10
-rw-r--r--arch/powerpc/include/asm/kvm_fpu.h27
-rw-r--r--arch/powerpc/include/asm/kvm_host.h18
-rw-r--r--arch/powerpc/include/asm/local64.h1
-rw-r--r--arch/powerpc/include/asm/machdep.h5
-rw-r--r--arch/powerpc/include/asm/macio.h2
-rw-r--r--arch/powerpc/include/asm/mmu-book3e.h4
-rw-r--r--arch/powerpc/include/asm/mpc5121.h32
-rw-r--r--arch/powerpc/include/asm/of_device.h27
-rw-r--r--arch/powerpc/include/asm/of_platform.h29
-rw-r--r--arch/powerpc/include/asm/paca.h2
-rw-r--r--arch/powerpc/include/asm/pci-bridge.h5
-rw-r--r--arch/powerpc/include/asm/percpu.h3
-rw-r--r--arch/powerpc/include/asm/perf_event.h12
-rw-r--r--arch/powerpc/include/asm/ppc-opcode.h7
-rw-r--r--arch/powerpc/include/asm/processor.h8
-rw-r--r--arch/powerpc/include/asm/prom.h133
-rw-r--r--arch/powerpc/include/asm/reg.h2
-rw-r--r--arch/powerpc/include/asm/reg_booke.h5
-rw-r--r--arch/powerpc/include/asm/rtas.h13
-rw-r--r--arch/powerpc/include/asm/smu.h4
-rw-r--r--arch/powerpc/include/asm/system.h3
-rw-r--r--arch/powerpc/include/asm/time.h7
-rw-r--r--arch/powerpc/include/asm/topology.h10
-rw-r--r--arch/powerpc/include/asm/vdso_datapage.h2
-rw-r--r--arch/powerpc/kernel/Makefile6
-rw-r--r--arch/powerpc/kernel/asm-offsets.c2
-rw-r--r--arch/powerpc/kernel/cputable.c118
-rw-r--r--arch/powerpc/kernel/crash_dump.c4
-rw-r--r--arch/powerpc/kernel/dbell.c78
-rw-r--r--arch/powerpc/kernel/dma-swiotlb.c8
-rw-r--r--arch/powerpc/kernel/exceptions-64e.S50
-rw-r--r--arch/powerpc/kernel/exceptions-64s.S1
-rw-r--r--arch/powerpc/kernel/hw_breakpoint.c364
-rw-r--r--arch/powerpc/kernel/ibmebus.c8
-rw-r--r--arch/powerpc/kernel/idle_book3e.S86
-rw-r--r--arch/powerpc/kernel/irq.c30
-rw-r--r--arch/powerpc/kernel/kgdb.c2
-rw-r--r--arch/powerpc/kernel/legacy_serial.c1
-rw-r--r--arch/powerpc/kernel/machine_kexec.c22
-rw-r--r--arch/powerpc/kernel/machine_kexec_64.c78
-rw-r--r--arch/powerpc/kernel/misc.S26
-rw-r--r--arch/powerpc/kernel/of_device.c133
-rw-r--r--arch/powerpc/kernel/of_platform.c203
-rw-r--r--arch/powerpc/kernel/paca.c10
-rw-r--r--arch/powerpc/kernel/pci-common.c1
-rw-r--r--arch/powerpc/kernel/perf_event.c41
-rw-r--r--arch/powerpc/kernel/perf_event_fsl_emb.c35
-rw-r--r--arch/powerpc/kernel/ppc_ksyms.c4
-rw-r--r--arch/powerpc/kernel/process.c47
-rw-r--r--arch/powerpc/kernel/prom_init.c44
-rw-r--r--arch/powerpc/kernel/prom_parse.c924
-rw-r--r--arch/powerpc/kernel/ptrace.c64
-rw-r--r--arch/powerpc/kernel/rtas.c105
-rw-r--r--arch/powerpc/kernel/setup-common.c20
-rw-r--r--arch/powerpc/kernel/setup_64.c19
-rw-r--r--arch/powerpc/kernel/signal.c3
-rw-r--r--arch/powerpc/kernel/smp.c10
-rw-r--r--arch/powerpc/kernel/suspend.c2
-rw-r--r--arch/powerpc/kernel/time.c201
-rw-r--r--arch/powerpc/kernel/traps.c29
-rw-r--r--arch/powerpc/kernel/vdso32/gettimeofday.S184
-rw-r--r--arch/powerpc/kernel/vdso64/gettimeofday.S88
-rw-r--r--arch/powerpc/kvm/44x_tlb.c3
-rw-r--r--arch/powerpc/kvm/Makefile2
-rw-r--r--arch/powerpc/kvm/book3s.c79
-rw-r--r--arch/powerpc/kvm/book3s_32_mmu.c8
-rw-r--r--arch/powerpc/kvm/book3s_32_mmu_host.c134
-rw-r--r--arch/powerpc/kvm/book3s_64_mmu_host.c129
-rw-r--r--arch/powerpc/kvm/book3s_mmu_hpte.c277
-rw-r--r--arch/powerpc/kvm/book3s_paired_singles.c94
-rw-r--r--arch/powerpc/kvm/booke.c12
-rw-r--r--arch/powerpc/kvm/fpu.S18
-rw-r--r--arch/powerpc/kvm/powerpc.c14
-rw-r--r--arch/powerpc/kvm/timing.c2
-rw-r--r--arch/powerpc/lib/Makefile5
-rw-r--r--arch/powerpc/lib/ldstfp.S375
-rw-r--r--arch/powerpc/lib/sstep.c1514
-rw-r--r--arch/powerpc/mm/fsl_booke_mmu.c7
-rw-r--r--arch/powerpc/mm/numa.c122
-rw-r--r--arch/powerpc/mm/pgtable.c1
-rw-r--r--arch/powerpc/mm/tlb_hash32.c15
-rw-r--r--arch/powerpc/mm/tlb_nohash.c129
-rw-r--r--arch/powerpc/oprofile/Makefile2
-rw-r--r--arch/powerpc/oprofile/common.c2
-rw-r--r--arch/powerpc/platforms/40x/Kconfig16
-rw-r--r--arch/powerpc/platforms/512x/Kconfig20
-rw-r--r--arch/powerpc/platforms/512x/Makefile1
-rw-r--r--arch/powerpc/platforms/512x/clock.c20
-rw-r--r--arch/powerpc/platforms/512x/mpc5121_ads.c2
-rw-r--r--arch/powerpc/platforms/512x/mpc5121_generic.c2
-rw-r--r--arch/powerpc/platforms/512x/mpc512x.h2
-rw-r--r--arch/powerpc/platforms/512x/mpc512x_shared.c284
-rw-r--r--arch/powerpc/platforms/512x/pdm360ng.c129
-rw-r--r--arch/powerpc/platforms/52xx/lite5200.c1
-rw-r--r--arch/powerpc/platforms/52xx/lite5200_pm.c3
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_gpio.c36
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_gpt.c33
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c6
-rw-r--r--arch/powerpc/platforms/52xx/mpc52xx_pm.c3
-rw-r--r--arch/powerpc/platforms/82xx/ep8248e.c4
-rw-r--r--arch/powerpc/platforms/83xx/Kconfig8
-rw-r--r--arch/powerpc/platforms/83xx/Makefile1
-rw-r--r--arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c40
-rw-r--r--arch/powerpc/platforms/83xx/mpc830x_rdb.c94
-rw-r--r--arch/powerpc/platforms/83xx/suspend.c6
-rw-r--r--arch/powerpc/platforms/85xx/Kconfig8
-rw-r--r--arch/powerpc/platforms/85xx/Makefile1
-rw-r--r--arch/powerpc/platforms/85xx/mpc85xx_mds.c279
-rw-r--r--arch/powerpc/platforms/85xx/p1022_ds.c148
-rw-r--r--arch/powerpc/platforms/85xx/smp.c67
-rw-r--r--arch/powerpc/platforms/85xx/tqm85xx.c21
-rw-r--r--arch/powerpc/platforms/86xx/gef_gpio.c24
-rw-r--r--arch/powerpc/platforms/8xx/Kconfig6
-rw-r--r--arch/powerpc/platforms/8xx/Makefile1
-rw-r--r--arch/powerpc/platforms/8xx/tqm8xx_setup.c156
-rw-r--r--arch/powerpc/platforms/amigaone/setup.c3
-rw-r--r--arch/powerpc/platforms/cell/axon_msi.c4
-rw-r--r--arch/powerpc/platforms/cell/beat_iommu.c2
-rw-r--r--arch/powerpc/platforms/cell/iommu.c2
-rw-r--r--arch/powerpc/platforms/cell/qpace_setup.c14
-rw-r--r--arch/powerpc/platforms/cell/setup.c14
-rw-r--r--arch/powerpc/platforms/iseries/mf.c1
-rw-r--r--arch/powerpc/platforms/iseries/vio.c3
-rw-r--r--arch/powerpc/platforms/pasemi/gpio_mdio.c4
-rw-r--r--arch/powerpc/platforms/powermac/cpufreq_32.c8
-rw-r--r--arch/powerpc/platforms/powermac/feature.c8
-rw-r--r--arch/powerpc/platforms/powermac/pic.c72
-rw-r--r--arch/powerpc/platforms/ps3/htab.c2
-rw-r--r--arch/powerpc/platforms/pseries/Makefile4
-rw-r--r--arch/powerpc/platforms/pseries/dlpar.c1
-rw-r--r--arch/powerpc/platforms/pseries/eeh_cache.c3
-rw-r--r--arch/powerpc/platforms/pseries/event_sources.c23
-rw-r--r--arch/powerpc/platforms/pseries/hotplug-cpu.c7
-rw-r--r--arch/powerpc/platforms/pseries/ras.c5
-rw-r--r--arch/powerpc/platforms/pseries/reconfig.c4
-rw-r--r--arch/powerpc/platforms/pseries/suspend.c214
-rw-r--r--arch/powerpc/platforms/pseries/xics.c2
-rw-r--r--arch/powerpc/sysdev/axonram.c12
-rw-r--r--arch/powerpc/sysdev/bestcomm/bestcomm.c7
-rw-r--r--arch/powerpc/sysdev/bestcomm/sram.c1
-rw-r--r--arch/powerpc/sysdev/cpm1.c10
-rw-r--r--arch/powerpc/sysdev/cpm_common.c5
-rw-r--r--arch/powerpc/sysdev/fsl_gtm.c1
-rw-r--r--arch/powerpc/sysdev/fsl_msi.c4
-rw-r--r--arch/powerpc/sysdev/fsl_pci.c1
-rw-r--r--arch/powerpc/sysdev/fsl_pmc.c3
-rw-r--r--arch/powerpc/sysdev/fsl_rio.c4
-rw-r--r--arch/powerpc/sysdev/fsl_soc.h1
-rw-r--r--arch/powerpc/sysdev/mpc8xxx_gpio.c5
-rw-r--r--arch/powerpc/sysdev/mpic.c18
-rw-r--r--arch/powerpc/sysdev/mpic.h1
-rw-r--r--arch/powerpc/sysdev/mv64x60_dev.c7
-rw-r--r--arch/powerpc/sysdev/mv64x60_pci.c1
-rw-r--r--arch/powerpc/sysdev/pmi.c6
-rw-r--r--arch/powerpc/sysdev/ppc4xx_gpio.c5
-rw-r--r--arch/powerpc/sysdev/qe_lib/gpio.c31
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe.c5
-rw-r--r--arch/powerpc/sysdev/simple_gpio.c5
-rw-r--r--arch/powerpc/xmon/xmon.c152
-rw-r--r--arch/s390/Kconfig3
-rw-r--r--arch/s390/Makefile3
-rw-r--r--arch/s390/appldata/appldata_net_sum.c3
-rw-r--r--arch/s390/crypto/Makefile2
-rw-r--r--arch/s390/crypto/crypto_des.h2
-rw-r--r--arch/s390/crypto/des_s390.c238
-rw-r--r--arch/s390/include/asm/kvm_host.h5
-rw-r--r--arch/s390/include/asm/local64.h1
-rw-r--r--arch/s390/include/asm/qdio.h6
-rw-r--r--arch/s390/kernel/entry.S12
-rw-r--r--arch/s390/kernel/entry64.S12
-rw-r--r--arch/s390/kernel/time.c26
-rw-r--r--arch/s390/kvm/intercept.c2
-rw-r--r--arch/s390/kvm/kvm-s390.c64
-rw-r--r--arch/s390/kvm/kvm-s390.h2
-rw-r--r--arch/score/Kconfig3
-rw-r--r--arch/score/Makefile3
-rw-r--r--arch/score/include/asm/local64.h1
-rw-r--r--arch/sh/Kconfig3
-rw-r--r--arch/sh/boards/mach-ap325rxa/setup.c2
-rw-r--r--arch/sh/include/asm/local64.h1
-rw-r--r--arch/sh/kernel/clkdev.c2
-rw-r--r--arch/sh/kernel/perf_event.c6
-rw-r--r--arch/sparc/Kconfig7
-rw-r--r--arch/sparc/boot/btfixupprep.c4
-rw-r--r--arch/sparc/include/asm/device.h11
-rw-r--r--arch/sparc/include/asm/floppy_64.h10
-rw-r--r--arch/sparc/include/asm/local64.h1
-rw-r--r--arch/sparc/include/asm/of_device.h38
-rw-r--r--arch/sparc/include/asm/of_platform.h18
-rw-r--r--arch/sparc/include/asm/parport.h12
-rw-r--r--arch/sparc/include/asm/perf_event.h8
-rw-r--r--arch/sparc/include/asm/prom.h10
-rw-r--r--arch/sparc/kernel/apc.c6
-rw-r--r--arch/sparc/kernel/auxio_64.c5
-rw-r--r--arch/sparc/kernel/central.c8
-rw-r--r--arch/sparc/kernel/chmc.c16
-rw-r--r--arch/sparc/kernel/helpers.S6
-rw-r--r--arch/sparc/kernel/ioport.c2
-rw-r--r--arch/sparc/kernel/of_device_32.c63
-rw-r--r--arch/sparc/kernel/of_device_64.c61
-rw-r--r--arch/sparc/kernel/of_device_common.c35
-rw-r--r--arch/sparc/kernel/pci.c6
-rw-r--r--arch/sparc/kernel/pci_fire.c6
-rw-r--r--arch/sparc/kernel/pci_impl.h2
-rw-r--r--arch/sparc/kernel/pci_psycho.c16
-rw-r--r--arch/sparc/kernel/pci_sabre.c16
-rw-r--r--arch/sparc/kernel/pci_schizo.c32
-rw-r--r--arch/sparc/kernel/pci_sun4v.c6
-rw-r--r--arch/sparc/kernel/perf_event.c25
-rw-r--r--arch/sparc/kernel/pmc.c4
-rw-r--r--arch/sparc/kernel/power.c6
-rw-r--r--arch/sparc/kernel/prom.h8
-rw-r--r--arch/sparc/kernel/prom_64.c6
-rw-r--r--arch/sparc/kernel/prom_common.c2
-rw-r--r--arch/sparc/kernel/prom_irqtrans.c2
-rw-r--r--arch/sparc/kernel/psycho_common.c2
-rw-r--r--arch/sparc/kernel/psycho_common.h2
-rw-r--r--arch/sparc/kernel/sbus.c16
-rw-r--r--arch/sparc/kernel/time_32.c4
-rw-r--r--arch/sparc/kernel/time_64.c12
-rw-r--r--arch/sparc/mm/io-unit.c4
-rw-r--r--arch/sparc/mm/iommu.c6
-rw-r--r--arch/um/Kconfig.common4
-rw-r--r--arch/um/drivers/net_kern.c10
-rw-r--r--arch/um/include/asm/pgtable-3level.h4
-rw-r--r--arch/um/kernel/time.c16
-rw-r--r--arch/x86/Kconfig6
-rw-r--r--arch/x86/boot/Makefile8
-rw-r--r--arch/x86/boot/boot.h28
-rw-r--r--arch/x86/boot/cmdline.c6
-rw-r--r--arch/x86/boot/compressed/Makefile4
-rw-r--r--arch/x86/boot/compressed/cmdline.c21
-rw-r--r--arch/x86/boot/compressed/early_serial_console.c5
-rw-r--r--arch/x86/boot/compressed/head_32.S13
-rw-r--r--arch/x86/boot/compressed/head_64.S13
-rw-r--r--arch/x86/boot/compressed/misc.c56
-rw-r--r--arch/x86/boot/compressed/misc.h39
-rw-r--r--arch/x86/boot/compressed/string.c2
-rw-r--r--arch/x86/boot/compressed/vmlinux.lds.S6
-rw-r--r--arch/x86/boot/ctype.h21
-rw-r--r--arch/x86/boot/early_serial_console.c139
-rw-r--r--arch/x86/boot/main.c9
-rw-r--r--arch/x86/boot/printf.c4
-rw-r--r--arch/x86/boot/string.c63
-rw-r--r--arch/x86/boot/tty.c37
-rw-r--r--arch/x86/configs/i386_defconfig1
-rw-r--r--arch/x86/configs/x86_64_defconfig1
-rw-r--r--arch/x86/include/asm/acpi.h2
-rw-r--r--arch/x86/include/asm/apb_timer.h1
-rw-r--r--arch/x86/include/asm/cmpxchg_32.h198
-rw-r--r--arch/x86/include/asm/cmpxchg_64.h83
-rw-r--r--arch/x86/include/asm/cpufeature.h29
-rw-r--r--arch/x86/include/asm/hw_breakpoint.h2
-rw-r--r--arch/x86/include/asm/hypervisor.h1
-rw-r--r--arch/x86/include/asm/i387.h2
-rw-r--r--arch/x86/include/asm/intel_scu_ipc.h20
-rw-r--r--arch/x86/include/asm/irq_vectors.h3
-rw-r--r--arch/x86/include/asm/kgdb.h20
-rw-r--r--arch/x86/include/asm/kvm.h22
-rw-r--r--arch/x86/include/asm/kvm_emulate.h30
-rw-r--r--arch/x86/include/asm/kvm_host.h70
-rw-r--r--arch/x86/include/asm/local64.h1
-rw-r--r--arch/x86/include/asm/mrst.h26
-rw-r--r--arch/x86/include/asm/msr-index.h23
-rw-r--r--arch/x86/include/asm/msr.h4
-rw-r--r--arch/x86/include/asm/nmi.h2
-rw-r--r--arch/x86/include/asm/pci_x86.h1
-rw-r--r--arch/x86/include/asm/perf_event.h18
-rw-r--r--arch/x86/include/asm/perf_event_p4.h99
-rw-r--r--arch/x86/include/asm/processor.h21
-rw-r--r--arch/x86/include/asm/required-features.h2
-rw-r--r--arch/x86/include/asm/rwsem.h21
-rw-r--r--arch/x86/include/asm/setup.h2
-rw-r--r--arch/x86/include/asm/stacktrace.h49
-rw-r--r--arch/x86/include/asm/system.h7
-rw-r--r--arch/x86/include/asm/vmx.h5
-rw-r--r--arch/x86/include/asm/xen/hypercall.h6
-rw-r--r--arch/x86/include/asm/xsave.h6
-rw-r--r--arch/x86/kernel/acpi/realmode/wakeup.S2
-rw-r--r--arch/x86/kernel/acpi/sleep.c2
-rw-r--r--arch/x86/kernel/amd_iommu.c8
-rw-r--r--arch/x86/kernel/apb_timer.c37
-rw-r--r--arch/x86/kernel/aperture_64.c4
-rw-r--r--arch/x86/kernel/apic/Makefile7
-rw-r--r--arch/x86/kernel/apic/apic.c2
-rw-r--r--arch/x86/kernel/apic/hw_nmi.c107
-rw-r--r--arch/x86/kernel/apic/io_apic.c2
-rw-r--r--arch/x86/kernel/apic/nmi.c7
-rw-r--r--arch/x86/kernel/apm_32.c2
-rw-r--r--arch/x86/kernel/cpu/Makefile4
-rw-r--r--arch/x86/kernel/cpu/amd.c77
-rw-r--r--arch/x86/kernel/cpu/common.c12
-rw-r--r--arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c7
-rw-r--r--arch/x86/kernel/cpu/cpufreq/gx-suspmod.c11
-rw-r--r--arch/x86/kernel/cpu/cpufreq/longhaul.c6
-rw-r--r--arch/x86/kernel/cpu/cpufreq/longhaul.h26
-rw-r--r--arch/x86/kernel/cpu/cpufreq/longrun.c6
-rw-r--r--arch/x86/kernel/cpu/cpufreq/p4-clockmod.c7
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k7.c8
-rw-r--r--arch/x86/kernel/cpu/cpufreq/powernow-k8.c8
-rw-r--r--arch/x86/kernel/cpu/hypervisor.c3
-rw-r--r--arch/x86/kernel/cpu/intel_cacheinfo.c108
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce.c3
-rw-r--r--arch/x86/kernel/cpu/mcheck/therm_throt.c206
-rw-r--r--arch/x86/kernel/cpu/mshyperv.c1
-rw-r--r--arch/x86/kernel/cpu/mtrr/generic.c3
-rw-r--r--arch/x86/kernel/cpu/perf_event.c62
-rw-r--r--arch/x86/kernel/cpu/perf_event_p4.c156
-rw-r--r--arch/x86/kernel/cpu/scattered.c63
-rw-r--r--arch/x86/kernel/cpu/topology.c (renamed from arch/x86/kernel/cpu/addon_cpuid_features.c)58
-rw-r--r--arch/x86/kernel/dumpstack.c1
-rw-r--r--arch/x86/kernel/dumpstack.h56
-rw-r--r--arch/x86/kernel/dumpstack_32.c2
-rw-r--r--arch/x86/kernel/dumpstack_64.c1
-rw-r--r--arch/x86/kernel/entry_32.S14
-rw-r--r--arch/x86/kernel/entry_64.S9
-rw-r--r--arch/x86/kernel/head32.c2
-rw-r--r--arch/x86/kernel/head_64.S5
-rw-r--r--arch/x86/kernel/hpet.c13
-rw-r--r--arch/x86/kernel/hw_breakpoint.c51
-rw-r--r--arch/x86/kernel/i387.c3
-rw-r--r--arch/x86/kernel/kgdb.c198
-rw-r--r--arch/x86/kernel/kprobes.c33
-rw-r--r--arch/x86/kernel/mrst.c105
-rw-r--r--arch/x86/kernel/process.c54
-rw-r--r--arch/x86/kernel/process_32.c4
-rw-r--r--arch/x86/kernel/process_64.c5
-rw-r--r--arch/x86/kernel/stacktrace.c31
-rw-r--r--arch/x86/kernel/traps.c7
-rw-r--r--arch/x86/kernel/tsc.c5
-rw-r--r--arch/x86/kernel/verify_cpu_64.S3
-rw-r--r--arch/x86/kernel/vsyscall_64.c17
-rw-r--r--arch/x86/kernel/xsave.c13
-rw-r--r--arch/x86/kvm/emulate.c749
-rw-r--r--arch/x86/kvm/i8254.c146
-rw-r--r--arch/x86/kvm/i8254.h4
-rw-r--r--arch/x86/kvm/i8259.c48
-rw-r--r--arch/x86/kvm/irq.c2
-rw-r--r--arch/x86/kvm/irq.h4
-rw-r--r--arch/x86/kvm/kvm_cache_regs.h8
-rw-r--r--arch/x86/kvm/lapic.c17
-rw-r--r--arch/x86/kvm/mmu.c807
-rw-r--r--arch/x86/kvm/mmutrace.h2
-rw-r--r--arch/x86/kvm/paging_tmpl.h252
-rw-r--r--arch/x86/kvm/svm.c147
-rw-r--r--arch/x86/kvm/timer.c16
-rw-r--r--arch/x86/kvm/vmx.c261
-rw-r--r--arch/x86/kvm/x86.c1176
-rw-r--r--arch/x86/kvm/x86.h7
-rw-r--r--arch/x86/lib/Makefile1
-rw-r--r--arch/x86/lib/cmpxchg.c (renamed from arch/x86/kernel/cpu/cmpxchg.c)18
-rw-r--r--arch/x86/mm/dump_pagetables.c32
-rw-r--r--arch/x86/mm/init_64.c2
-rw-r--r--arch/x86/mm/ioremap.c14
-rw-r--r--arch/x86/mm/kmmio.c16
-rw-r--r--arch/x86/mm/pat.c2
-rw-r--r--arch/x86/mm/pf_in.c30
-rw-r--r--arch/x86/mm/testmmiotrace.c22
-rw-r--r--arch/x86/mm/tlb.c4
-rw-r--r--arch/x86/oprofile/nmi_int.c16
-rw-r--r--arch/x86/pci/acpi.c9
-rw-r--r--arch/x86/pci/common.c20
-rw-r--r--arch/x86/pci/irq.c6
-rw-r--r--arch/x86/pci/legacy.c2
-rw-r--r--arch/x86/power/cpu.c2
-rw-r--r--arch/x86/power/hibernate_64.c2
-rw-r--r--arch/x86/vdso/Makefile3
-rwxr-xr-xarch/x86/vdso/checkundef.sh10
-rw-r--r--arch/x86/vdso/vdso32-setup.c2
-rw-r--r--arch/x86/vdso/vma.c2
-rw-r--r--arch/x86/xen/Kconfig5
-rw-r--r--arch/x86/xen/Makefile2
-rw-r--r--arch/x86/xen/enlighten.c197
-rw-r--r--arch/x86/xen/mmu.c35
-rw-r--r--arch/x86/xen/mmu.h1
-rw-r--r--arch/x86/xen/platform-pci-unplug.c137
-rw-r--r--arch/x86/xen/setup.c72
-rw-r--r--arch/x86/xen/smp.c2
-rw-r--r--arch/x86/xen/suspend.c12
-rw-r--r--arch/x86/xen/time.c96
-rw-r--r--arch/x86/xen/xen-ops.h13
-rw-r--r--arch/xtensa/Kconfig3
-rw-r--r--arch/xtensa/Makefile2
-rw-r--r--arch/xtensa/configs/iss_defconfig731
-rw-r--r--arch/xtensa/include/asm/cacheflush.h1
-rw-r--r--arch/xtensa/include/asm/coprocessor.h1
-rw-r--r--arch/xtensa/include/asm/elf.h1
-rw-r--r--arch/xtensa/include/asm/local64.h1
-rw-r--r--arch/xtensa/include/asm/pgalloc.h1
-rw-r--r--arch/xtensa/include/asm/processor.h1
-rw-r--r--arch/xtensa/include/asm/ptrace.h2
-rw-r--r--arch/xtensa/kernel/Makefile4
-rw-r--r--arch/xtensa/kernel/asm-offsets.c1
-rw-r--r--arch/xtensa/kernel/entry.S1
-rw-r--r--arch/xtensa/kernel/head.S4
-rw-r--r--arch/xtensa/platforms/iss/network.c22
1291 files changed, 44294 insertions, 26755 deletions
diff --git a/arch/Kconfig b/arch/Kconfig
index acda512da2e2..4877a8c8ee16 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -151,4 +151,11 @@ config HAVE_MIXED_BREAKPOINTS_REGS
151config HAVE_USER_RETURN_NOTIFIER 151config HAVE_USER_RETURN_NOTIFIER
152 bool 152 bool
153 153
154config HAVE_PERF_EVENTS_NMI
155 bool
156 help
157 System hardware can generate an NMI using the perf event
158 subsystem. Also has support for calculating CPU cycle events
159 to determine how many clock cycles in a given period.
160
154source "kernel/gcov/Kconfig" 161source "kernel/gcov/Kconfig"
diff --git a/arch/alpha/Kconfig b/arch/alpha/Kconfig
index 3e2e540a0f2a..b9647bb66d13 100644
--- a/arch/alpha/Kconfig
+++ b/arch/alpha/Kconfig
@@ -47,10 +47,6 @@ config GENERIC_CALIBRATE_DELAY
47 bool 47 bool
48 default y 48 default y
49 49
50config GENERIC_TIME
51 bool
52 default y
53
54config GENERIC_CMOS_UPDATE 50config GENERIC_CMOS_UPDATE
55 def_bool y 51 def_bool y
56 52
diff --git a/arch/alpha/include/asm/local64.h b/arch/alpha/include/asm/local64.h
new file mode 100644
index 000000000000..36c93b5cc239
--- /dev/null
+++ b/arch/alpha/include/asm/local64.h
@@ -0,0 +1 @@
#include <asm-generic/local64.h>
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 98922f7d2d12..9e10882c81d7 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -10,6 +10,7 @@ config ARM
10 default y 10 default y
11 select HAVE_AOUT 11 select HAVE_AOUT
12 select HAVE_IDE 12 select HAVE_IDE
13 select HAVE_MEMBLOCK
13 select RTC_LIB 14 select RTC_LIB
14 select SYS_SUPPORTS_APM_EMULATION 15 select SYS_SUPPORTS_APM_EMULATION
15 select GENERIC_ATOMIC64 if (!CPU_32v6K) 16 select GENERIC_ATOMIC64 if (!CPU_32v6K)
@@ -24,6 +25,7 @@ config ARM
24 select HAVE_KERNEL_LZMA 25 select HAVE_KERNEL_LZMA
25 select HAVE_PERF_EVENTS 26 select HAVE_PERF_EVENTS
26 select PERF_USE_VMALLOC 27 select PERF_USE_VMALLOC
28 select HAVE_REGS_AND_STACK_ACCESS_API
27 help 29 help
28 The ARM series is a line of low-power-consumption RISC chip designs 30 The ARM series is a line of low-power-consumption RISC chip designs
29 licensed by ARM Ltd and targeted at embedded applications and 31 licensed by ARM Ltd and targeted at embedded applications and
@@ -41,10 +43,6 @@ config SYS_SUPPORTS_APM_EMULATION
41config GENERIC_GPIO 43config GENERIC_GPIO
42 bool 44 bool
43 45
44config GENERIC_TIME
45 bool
46 default y
47
48config ARCH_USES_GETTIMEOFFSET 46config ARCH_USES_GETTIMEOFFSET
49 bool 47 bool
50 default n 48 default n
@@ -55,7 +53,7 @@ config GENERIC_CLOCKEVENTS
55config GENERIC_CLOCKEVENTS_BROADCAST 53config GENERIC_CLOCKEVENTS_BROADCAST
56 bool 54 bool
57 depends on GENERIC_CLOCKEVENTS 55 depends on GENERIC_CLOCKEVENTS
58 default y if SMP && !LOCAL_TIMERS 56 default y if SMP
59 57
60config HAVE_TCM 58config HAVE_TCM
61 bool 59 bool
@@ -301,6 +299,7 @@ config ARCH_CNS3XXX
301 select CPU_V6 299 select CPU_V6
302 select GENERIC_CLOCKEVENTS 300 select GENERIC_CLOCKEVENTS
303 select ARM_GIC 301 select ARM_GIC
302 select PCI_DOMAINS if PCI
304 help 303 help
305 Support for Cavium Networks CNS3XXX platform. 304 Support for Cavium Networks CNS3XXX platform.
306 305
@@ -439,21 +438,6 @@ config ARCH_IXP4XX
439 help 438 help
440 Support for Intel's IXP4XX (XScale) family of processors. 439 Support for Intel's IXP4XX (XScale) family of processors.
441 440
442config ARCH_L7200
443 bool "LinkUp-L7200"
444 select CPU_ARM720T
445 select FIQ
446 select ARCH_USES_GETTIMEOFFSET
447 help
448 Say Y here if you intend to run this kernel on a LinkUp Systems
449 L7200 Software Development Board which uses an ARM720T processor.
450 Information on this board can be obtained at:
451
452 <http://www.linkupsys.com/>
453
454 If you have any questions or comments about the Linux kernel port
455 to this board, send e-mail to <sjhill@cotw.com>.
456
457config ARCH_DOVE 441config ARCH_DOVE
458 bool "Marvell Dove" 442 bool "Marvell Dove"
459 select PCI 443 select PCI
@@ -482,6 +466,19 @@ config ARCH_LOKI
482 help 466 help
483 Support for the Marvell Loki (88RC8480) SoC. 467 Support for the Marvell Loki (88RC8480) SoC.
484 468
469config ARCH_LPC32XX
470 bool "NXP LPC32XX"
471 select CPU_ARM926T
472 select ARCH_REQUIRE_GPIOLIB
473 select HAVE_IDE
474 select ARM_AMBA
475 select USB_ARCH_HAS_OHCI
476 select COMMON_CLKDEV
477 select GENERIC_TIME
478 select GENERIC_CLOCKEVENTS
479 help
480 Support for the NXP LPC32XX family of processors
481
485config ARCH_MV78XX0 482config ARCH_MV78XX0
486 bool "Marvell MV78xx0" 483 bool "Marvell MV78xx0"
487 select CPU_FEROCEON 484 select CPU_FEROCEON
@@ -586,6 +583,7 @@ config ARCH_MSM
586 bool "Qualcomm MSM" 583 bool "Qualcomm MSM"
587 select HAVE_CLK 584 select HAVE_CLK
588 select GENERIC_CLOCKEVENTS 585 select GENERIC_CLOCKEVENTS
586 select ARCH_REQUIRE_GPIOLIB
589 help 587 help
590 Support for Qualcomm MSM/QSD based systems. This runs on the 588 Support for Qualcomm MSM/QSD based systems. This runs on the
591 apps processor of the MSM/QSD and depends on a shared memory 589 apps processor of the MSM/QSD and depends on a shared memory
@@ -719,7 +717,6 @@ config ARCH_SHARK
719config ARCH_LH7A40X 717config ARCH_LH7A40X
720 bool "Sharp LH7A40X" 718 bool "Sharp LH7A40X"
721 select CPU_ARM922T 719 select CPU_ARM922T
722 select ARCH_DISCONTIGMEM_ENABLE if !LH7A40X_CONTIGMEM
723 select ARCH_SPARSEMEM_ENABLE if !LH7A40X_CONTIGMEM 720 select ARCH_SPARSEMEM_ENABLE if !LH7A40X_CONTIGMEM
724 select ARCH_USES_GETTIMEOFFSET 721 select ARCH_USES_GETTIMEOFFSET
725 help 722 help
@@ -845,6 +842,8 @@ source "arch/arm/mach-lh7a40x/Kconfig"
845 842
846source "arch/arm/mach-loki/Kconfig" 843source "arch/arm/mach-loki/Kconfig"
847 844
845source "arch/arm/mach-lpc32xx/Kconfig"
846
848source "arch/arm/mach-msm/Kconfig" 847source "arch/arm/mach-msm/Kconfig"
849 848
850source "arch/arm/mach-mv78xx0/Kconfig" 849source "arch/arm/mach-mv78xx0/Kconfig"
@@ -1031,11 +1030,6 @@ endmenu
1031 1030
1032source "arch/arm/common/Kconfig" 1031source "arch/arm/common/Kconfig"
1033 1032
1034config FORCE_MAX_ZONEORDER
1035 int
1036 depends on SA1111
1037 default "9"
1038
1039menu "Bus support" 1033menu "Bus support"
1040 1034
1041config ARM_AMBA 1035config ARM_AMBA
@@ -1060,7 +1054,7 @@ config ISA_DMA_API
1060 bool 1054 bool
1061 1055
1062config PCI 1056config PCI
1063 bool "PCI support" if ARCH_INTEGRATOR_AP || ARCH_VERSATILE_PB || ARCH_IXP4XX || ARCH_KS8695 || MACH_ARMCORE 1057 bool "PCI support" if ARCH_INTEGRATOR_AP || ARCH_VERSATILE_PB || ARCH_IXP4XX || ARCH_KS8695 || MACH_ARMCORE || ARCH_CNS3XXX
1064 help 1058 help
1065 Find out whether you have a PCI motherboard. PCI is the name of a 1059 Find out whether you have a PCI motherboard. PCI is the name of a
1066 bus system, i.e. the way the CPU talks to the other stuff inside 1060 bus system, i.e. the way the CPU talks to the other stuff inside
@@ -1172,9 +1166,10 @@ config HOTPLUG_CPU
1172config LOCAL_TIMERS 1166config LOCAL_TIMERS
1173 bool "Use local timer interrupts" 1167 bool "Use local timer interrupts"
1174 depends on SMP && (REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || \ 1168 depends on SMP && (REALVIEW_EB_ARM11MP || MACH_REALVIEW_PB11MP || \
1175 REALVIEW_EB_A9MP || MACH_REALVIEW_PBX || ARCH_OMAP4 || ARCH_U8500) 1169 REALVIEW_EB_A9MP || MACH_REALVIEW_PBX || ARCH_OMAP4 || \
1170 ARCH_U8500 || ARCH_VEXPRESS_CA9X4)
1176 default y 1171 default y
1177 select HAVE_ARM_TWD if (ARCH_REALVIEW || ARCH_OMAP4 || ARCH_U8500) 1172 select HAVE_ARM_TWD if (ARCH_REALVIEW || ARCH_VEXPRESS || ARCH_OMAP4 || ARCH_U8500)
1178 help 1173 help
1179 Enable support for local timers on SMP platforms, rather then the 1174 Enable support for local timers on SMP platforms, rather then the
1180 legacy IPI broadcast method. Local timers allows the system 1175 legacy IPI broadcast method. Local timers allows the system
@@ -1185,10 +1180,10 @@ source kernel/Kconfig.preempt
1185 1180
1186config HZ 1181config HZ
1187 int 1182 int
1188 default 128 if ARCH_L7200
1189 default 200 if ARCH_EBSA110 || ARCH_S3C2410 || ARCH_S5P6440 || ARCH_S5P6442 || ARCH_S5PV210 1183 default 200 if ARCH_EBSA110 || ARCH_S3C2410 || ARCH_S5P6440 || ARCH_S5P6442 || ARCH_S5PV210
1190 default OMAP_32K_TIMER_HZ if ARCH_OMAP && OMAP_32K_TIMER 1184 default OMAP_32K_TIMER_HZ if ARCH_OMAP && OMAP_32K_TIMER
1191 default AT91_TIMER_HZ if ARCH_AT91 1185 default AT91_TIMER_HZ if ARCH_AT91
1186 default SHMOBILE_TIMER_HZ if ARCH_SHMOBILE
1192 default 100 1187 default 100
1193 1188
1194config THUMB2_KERNEL 1189config THUMB2_KERNEL
@@ -1241,10 +1236,6 @@ config OABI_COMPAT
1241config ARCH_HAS_HOLES_MEMORYMODEL 1236config ARCH_HAS_HOLES_MEMORYMODEL
1242 bool 1237 bool
1243 1238
1244# Discontigmem is deprecated
1245config ARCH_DISCONTIGMEM_ENABLE
1246 bool
1247
1248config ARCH_SPARSEMEM_ENABLE 1239config ARCH_SPARSEMEM_ENABLE
1249 bool 1240 bool
1250 1241
@@ -1252,13 +1243,7 @@ config ARCH_SPARSEMEM_DEFAULT
1252 def_bool ARCH_SPARSEMEM_ENABLE 1243 def_bool ARCH_SPARSEMEM_ENABLE
1253 1244
1254config ARCH_SELECT_MEMORY_MODEL 1245config ARCH_SELECT_MEMORY_MODEL
1255 def_bool ARCH_DISCONTIGMEM_ENABLE && ARCH_SPARSEMEM_ENABLE 1246 def_bool ARCH_SPARSEMEM_ENABLE
1256
1257config NODES_SHIFT
1258 int
1259 default "4" if ARCH_LH7A40X
1260 default "2"
1261 depends on NEED_MULTIPLE_NODES
1262 1247
1263config HIGHMEM 1248config HIGHMEM
1264 bool "High Memory Support (EXPERIMENTAL)" 1249 bool "High Memory Support (EXPERIMENTAL)"
@@ -1290,8 +1275,33 @@ config HW_PERF_EVENTS
1290 Enable hardware performance counter support for perf events. If 1275 Enable hardware performance counter support for perf events. If
1291 disabled, perf events will use software events only. 1276 disabled, perf events will use software events only.
1292 1277
1278config SPARSE_IRQ
1279 def_bool n
1280 help
1281 This enables support for sparse irqs. This is useful in general
1282 as most CPUs have a fairly sparse array of IRQ vectors, which
1283 the irq_desc then maps directly on to. Systems with a high
1284 number of off-chip IRQs will want to treat this as
1285 experimental until they have been independently verified.
1286
1293source "mm/Kconfig" 1287source "mm/Kconfig"
1294 1288
1289config FORCE_MAX_ZONEORDER
1290 int "Maximum zone order" if ARCH_SHMOBILE
1291 range 11 64 if ARCH_SHMOBILE
1292 default "9" if SA1111
1293 default "11"
1294 help
1295 The kernel memory allocator divides physically contiguous memory
1296 blocks into "zones", where each zone is a power of two number of
1297 pages. This option selects the largest power of two that the kernel
1298 keeps in the memory allocator. If you need to allocate very large
1299 blocks of physically contiguous memory, then you may need to
1300 increase this value.
1301
1302 This config option is actually maximum order plus one. For example,
1303 a value of 11 means that the largest free memory block is 2^10 pages.
1304
1295config LEDS 1305config LEDS
1296 bool "Timer and CPU usage LEDs" 1306 bool "Timer and CPU usage LEDs"
1297 depends on ARCH_CDB89712 || ARCH_EBSA110 || \ 1307 depends on ARCH_CDB89712 || ARCH_EBSA110 || \
@@ -1375,6 +1385,24 @@ config UACCESS_WITH_MEMCPY
1375 However, if the CPU data cache is using a write-allocate mode, 1385 However, if the CPU data cache is using a write-allocate mode,
1376 this option is unlikely to provide any performance gain. 1386 this option is unlikely to provide any performance gain.
1377 1387
1388config CC_STACKPROTECTOR
1389 bool "Enable -fstack-protector buffer overflow detection (EXPERIMENTAL)"
1390 help
1391 This option turns on the -fstack-protector GCC feature. This
1392 feature puts, at the beginning of functions, a canary value on
1393 the stack just before the return address, and validates
1394 the value just before actually returning. Stack based buffer
1395 overflows (that need to overwrite this return address) now also
1396 overwrite the canary, which gets detected and the attack is then
1397 neutralized via a kernel panic.
1398 This feature requires gcc version 4.2 or above.
1399
1400config DEPRECATED_PARAM_STRUCT
1401 bool "Provide old way to pass kernel parameters"
1402 help
1403 This was deprecated in 2001 and announced to live on for 5 years.
1404 Some old boot loaders still use this way.
1405
1378endmenu 1406endmenu
1379 1407
1380menu "Boot options" 1408menu "Boot options"
@@ -1485,6 +1513,105 @@ config ATAGS_PROC
1485 Should the atags used to boot the kernel be exported in an "atags" 1513 Should the atags used to boot the kernel be exported in an "atags"
1486 file in procfs. Useful with kexec. 1514 file in procfs. Useful with kexec.
1487 1515
1516config AUTO_ZRELADDR
1517 bool "Auto calculation of the decompressed kernel image address"
1518 depends on !ZBOOT_ROM && !ARCH_U300
1519 help
1520 ZRELADDR is the physical address where the decompressed kernel
1521 image will be placed. If AUTO_ZRELADDR is selected, the address
1522 will be determined at run-time by masking the current IP with
1523 0xf8000000. This assumes the zImage being placed in the first 128MB
1524 from start of memory.
1525
1526config ZRELADDR
1527 hex "Physical address of the decompressed kernel image"
1528 depends on !AUTO_ZRELADDR
1529 default 0x00008000 if ARCH_BCMRING ||\
1530 ARCH_CNS3XXX ||\
1531 ARCH_DOVE ||\
1532 ARCH_EBSA110 ||\
1533 ARCH_FOOTBRIDGE ||\
1534 ARCH_INTEGRATOR ||\
1535 ARCH_IOP13XX ||\
1536 ARCH_IOP33X ||\
1537 ARCH_IXP2000 ||\
1538 ARCH_IXP23XX ||\
1539 ARCH_IXP4XX ||\
1540 ARCH_KIRKWOOD ||\
1541 ARCH_KS8695 ||\
1542 ARCH_LOKI ||\
1543 ARCH_MMP ||\
1544 ARCH_MV78XX0 ||\
1545 ARCH_NOMADIK ||\
1546 ARCH_NUC93X ||\
1547 ARCH_NS9XXX ||\
1548 ARCH_ORION5X ||\
1549 ARCH_SPEAR3XX ||\
1550 ARCH_SPEAR6XX ||\
1551 ARCH_U8500 ||\
1552 ARCH_VERSATILE ||\
1553 ARCH_W90X900
1554 default 0x08008000 if ARCH_MX1 ||\
1555 ARCH_SHARK
1556 default 0x10008000 if ARCH_MSM ||\
1557 ARCH_OMAP1 ||\
1558 ARCH_RPC
1559 default 0x20008000 if ARCH_S5P6440 ||\
1560 ARCH_S5P6442 ||\
1561 ARCH_S5PC100 ||\
1562 ARCH_S5PV210
1563 default 0x30008000 if ARCH_S3C2410 ||\
1564 ARCH_S3C2400 ||\
1565 ARCH_S3C2412 ||\
1566 ARCH_S3C2416 ||\
1567 ARCH_S3C2440 ||\
1568 ARCH_S3C2443
1569 default 0x40008000 if ARCH_STMP378X ||\
1570 ARCH_STMP37XX ||\
1571 ARCH_SH7372 ||\
1572 ARCH_SH7377
1573 default 0x50008000 if ARCH_S3C64XX ||\
1574 ARCH_SH7367
1575 default 0x60008000 if ARCH_VEXPRESS
1576 default 0x80008000 if ARCH_MX25 ||\
1577 ARCH_MX3 ||\
1578 ARCH_NETX ||\
1579 ARCH_OMAP2PLUS ||\
1580 ARCH_PNX4008
1581 default 0x90008000 if ARCH_MX5 ||\
1582 ARCH_MX91231
1583 default 0xa0008000 if ARCH_IOP32X ||\
1584 ARCH_PXA ||\
1585 MACH_MX27
1586 default 0xc0008000 if ARCH_LH7A40X ||\
1587 MACH_MX21
1588 default 0xf0008000 if ARCH_AAEC2000 ||\
1589 ARCH_L7200
1590 default 0xc0028000 if ARCH_CLPS711X
1591 default 0x70008000 if ARCH_AT91 && (ARCH_AT91CAP9 || ARCH_AT91SAM9G45)
1592 default 0x20008000 if ARCH_AT91 && !(ARCH_AT91CAP9 || ARCH_AT91SAM9G45)
1593 default 0xc0008000 if ARCH_DAVINCI && ARCH_DAVINCI_DA8XX
1594 default 0x80008000 if ARCH_DAVINCI && !ARCH_DAVINCI_DA8XX
1595 default 0x00008000 if ARCH_EP93XX && EP93XX_SDCE3_SYNC_PHYS_OFFSET
1596 default 0xc0008000 if ARCH_EP93XX && EP93XX_SDCE0_PHYS_OFFSET
1597 default 0xd0008000 if ARCH_EP93XX && EP93XX_SDCE1_PHYS_OFFSET
1598 default 0xe0008000 if ARCH_EP93XX && EP93XX_SDCE2_PHYS_OFFSET
1599 default 0xf0008000 if ARCH_EP93XX && EP93XX_SDCE3_ASYNC_PHYS_OFFSET
1600 default 0x00008000 if ARCH_GEMINI && GEMINI_MEM_SWAP
1601 default 0x10008000 if ARCH_GEMINI && !GEMINI_MEM_SWAP
1602 default 0x70008000 if ARCH_REALVIEW && REALVIEW_HIGH_PHYS_OFFSET
1603 default 0x00008000 if ARCH_REALVIEW && !REALVIEW_HIGH_PHYS_OFFSET
1604 default 0xc0208000 if ARCH_SA1100 && SA1111
1605 default 0xc0008000 if ARCH_SA1100 && !SA1111
1606 default 0x30108000 if ARCH_S3C2410 && PM_H1940
1607 default 0x28E08000 if ARCH_U300 && MACH_U300_SINGLE_RAM
1608 default 0x48008000 if ARCH_U300 && !MACH_U300_SINGLE_RAM
1609 help
1610 ZRELADDR is the physical address where the decompressed kernel
1611 image will be placed. ZRELADDR has to be specified when the
1612 assumption of AUTO_ZRELADDR is not valid, or when ZBOOT_ROM is
1613 selected.
1614
1488endmenu 1615endmenu
1489 1616
1490menu "CPU Power Management" 1617menu "CPU Power Management"
diff --git a/arch/arm/Makefile b/arch/arm/Makefile
index 64ba313724d2..63d998e8c672 100644
--- a/arch/arm/Makefile
+++ b/arch/arm/Makefile
@@ -34,6 +34,10 @@ ifeq ($(CONFIG_FRAME_POINTER),y)
34KBUILD_CFLAGS +=-fno-omit-frame-pointer -mapcs -mno-sched-prolog 34KBUILD_CFLAGS +=-fno-omit-frame-pointer -mapcs -mno-sched-prolog
35endif 35endif
36 36
37ifeq ($(CONFIG_CC_STACKPROTECTOR),y)
38KBUILD_CFLAGS +=-fstack-protector
39endif
40
37ifeq ($(CONFIG_CPU_BIG_ENDIAN),y) 41ifeq ($(CONFIG_CPU_BIG_ENDIAN),y)
38KBUILD_CPPFLAGS += -mbig-endian 42KBUILD_CPPFLAGS += -mbig-endian
39AS += -EB 43AS += -EB
@@ -139,14 +143,14 @@ machine-$(CONFIG_ARCH_IXP23XX) := ixp23xx
139machine-$(CONFIG_ARCH_IXP4XX) := ixp4xx 143machine-$(CONFIG_ARCH_IXP4XX) := ixp4xx
140machine-$(CONFIG_ARCH_KIRKWOOD) := kirkwood 144machine-$(CONFIG_ARCH_KIRKWOOD) := kirkwood
141machine-$(CONFIG_ARCH_KS8695) := ks8695 145machine-$(CONFIG_ARCH_KS8695) := ks8695
142machine-$(CONFIG_ARCH_L7200) := l7200
143machine-$(CONFIG_ARCH_LH7A40X) := lh7a40x 146machine-$(CONFIG_ARCH_LH7A40X) := lh7a40x
144machine-$(CONFIG_ARCH_LOKI) := loki 147machine-$(CONFIG_ARCH_LOKI) := loki
148machine-$(CONFIG_ARCH_LPC32XX) := lpc32xx
145machine-$(CONFIG_ARCH_MMP) := mmp 149machine-$(CONFIG_ARCH_MMP) := mmp
146machine-$(CONFIG_ARCH_MSM) := msm 150machine-$(CONFIG_ARCH_MSM) := msm
147machine-$(CONFIG_ARCH_MV78XX0) := mv78xx0 151machine-$(CONFIG_ARCH_MV78XX0) := mv78xx0
148machine-$(CONFIG_ARCH_MX1) := mx1 152machine-$(CONFIG_ARCH_MX1) := imx
149machine-$(CONFIG_ARCH_MX2) := mx2 153machine-$(CONFIG_ARCH_MX2) := imx
150machine-$(CONFIG_ARCH_MX25) := mx25 154machine-$(CONFIG_ARCH_MX25) := mx25
151machine-$(CONFIG_ARCH_MX3) := mx3 155machine-$(CONFIG_ARCH_MX3) := mx3
152machine-$(CONFIG_ARCH_MX5) := mx5 156machine-$(CONFIG_ARCH_MX5) := mx5
diff --git a/arch/arm/boot/Makefile b/arch/arm/boot/Makefile
index 4a590f4113e2..f705213caa88 100644
--- a/arch/arm/boot/Makefile
+++ b/arch/arm/boot/Makefile
@@ -14,18 +14,16 @@
14MKIMAGE := $(srctree)/scripts/mkuboot.sh 14MKIMAGE := $(srctree)/scripts/mkuboot.sh
15 15
16ifneq ($(MACHINE),) 16ifneq ($(MACHINE),)
17include $(srctree)/$(MACHINE)/Makefile.boot 17-include $(srctree)/$(MACHINE)/Makefile.boot
18endif 18endif
19 19
20# Note: the following conditions must always be true: 20# Note: the following conditions must always be true:
21# ZRELADDR == virt_to_phys(PAGE_OFFSET + TEXT_OFFSET)
22# PARAMS_PHYS must be within 4MB of ZRELADDR 21# PARAMS_PHYS must be within 4MB of ZRELADDR
23# INITRD_PHYS must be in RAM 22# INITRD_PHYS must be in RAM
24ZRELADDR := $(zreladdr-y)
25PARAMS_PHYS := $(params_phys-y) 23PARAMS_PHYS := $(params_phys-y)
26INITRD_PHYS := $(initrd_phys-y) 24INITRD_PHYS := $(initrd_phys-y)
27 25
28export ZRELADDR INITRD_PHYS PARAMS_PHYS 26export INITRD_PHYS PARAMS_PHYS
29 27
30targets := Image zImage xipImage bootpImage uImage 28targets := Image zImage xipImage bootpImage uImage
31 29
@@ -67,7 +65,7 @@ quiet_cmd_uimage = UIMAGE $@
67ifeq ($(CONFIG_ZBOOT_ROM),y) 65ifeq ($(CONFIG_ZBOOT_ROM),y)
68$(obj)/uImage: LOADADDR=$(CONFIG_ZBOOT_ROM_TEXT) 66$(obj)/uImage: LOADADDR=$(CONFIG_ZBOOT_ROM_TEXT)
69else 67else
70$(obj)/uImage: LOADADDR=$(ZRELADDR) 68$(obj)/uImage: LOADADDR=$(CONFIG_ZRELADDR)
71endif 69endif
72 70
73ifeq ($(CONFIG_THUMB2_KERNEL),y) 71ifeq ($(CONFIG_THUMB2_KERNEL),y)
diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile
index 53faa9063a03..7636c9b3f9a7 100644
--- a/arch/arm/boot/compressed/Makefile
+++ b/arch/arm/boot/compressed/Makefile
@@ -4,6 +4,7 @@
4# create a compressed vmlinuz image from the original vmlinux 4# create a compressed vmlinuz image from the original vmlinux
5# 5#
6 6
7AFLAGS_head.o += -DTEXT_OFFSET=$(TEXT_OFFSET)
7HEAD = head.o 8HEAD = head.o
8OBJS = misc.o decompress.o 9OBJS = misc.o decompress.o
9FONTC = $(srctree)/drivers/video/console/font_acorn_8x8.c 10FONTC = $(srctree)/drivers/video/console/font_acorn_8x8.c
@@ -19,10 +20,6 @@ ifeq ($(CONFIG_ARCH_SHARK),y)
19OBJS += head-shark.o ofw-shark.o 20OBJS += head-shark.o ofw-shark.o
20endif 21endif
21 22
22ifeq ($(CONFIG_ARCH_L7200),y)
23OBJS += head-l7200.o
24endif
25
26ifeq ($(CONFIG_ARCH_P720T),y) 23ifeq ($(CONFIG_ARCH_P720T),y)
27# Borrow this code from SA1100 24# Borrow this code from SA1100
28OBJS += head-sa1100.o 25OBJS += head-sa1100.o
@@ -71,6 +68,9 @@ targets := vmlinux vmlinux.lds \
71 piggy.$(suffix_y) piggy.$(suffix_y).o \ 68 piggy.$(suffix_y) piggy.$(suffix_y).o \
72 font.o font.c head.o misc.o $(OBJS) 69 font.o font.c head.o misc.o $(OBJS)
73 70
71# Make sure files are removed during clean
72extra-y += piggy.gzip piggy.lzo piggy.lzma lib1funcs.S
73
74ifeq ($(CONFIG_FUNCTION_TRACER),y) 74ifeq ($(CONFIG_FUNCTION_TRACER),y)
75ORIG_CFLAGS := $(KBUILD_CFLAGS) 75ORIG_CFLAGS := $(KBUILD_CFLAGS)
76KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS)) 76KBUILD_CFLAGS = $(subst -pg, , $(ORIG_CFLAGS))
@@ -79,19 +79,9 @@ endif
79EXTRA_CFLAGS := -fpic -fno-builtin 79EXTRA_CFLAGS := -fpic -fno-builtin
80EXTRA_AFLAGS := -Wa,-march=all 80EXTRA_AFLAGS := -Wa,-march=all
81 81
82# Supply ZRELADDR, INITRD_PHYS and PARAMS_PHYS to the decompressor via
83# linker symbols. We only define initrd_phys and params_phys if the
84# machine class defined the corresponding makefile variable.
85LDFLAGS_vmlinux := --defsym zreladdr=$(ZRELADDR)
86ifeq ($(CONFIG_CPU_ENDIAN_BE8),y) 82ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
87LDFLAGS_vmlinux += --be8 83LDFLAGS_vmlinux += --be8
88endif 84endif
89ifneq ($(INITRD_PHYS),)
90LDFLAGS_vmlinux += --defsym initrd_phys=$(INITRD_PHYS)
91endif
92ifneq ($(PARAMS_PHYS),)
93LDFLAGS_vmlinux += --defsym params_phys=$(PARAMS_PHYS)
94endif
95# ? 85# ?
96LDFLAGS_vmlinux += -p 86LDFLAGS_vmlinux += -p
97# Report unresolved symbol references 87# Report unresolved symbol references
diff --git a/arch/arm/boot/compressed/Makefile.debug b/arch/arm/boot/compressed/Makefile.debug
deleted file mode 100644
index 491a037b2973..000000000000
--- a/arch/arm/boot/compressed/Makefile.debug
+++ /dev/null
@@ -1,23 +0,0 @@
1#
2# linux/arch/arm/boot/compressed/Makefile
3#
4# create a compressed vmlinux image from the original vmlinux
5#
6
7COMPRESSED_EXTRA=../../lib/ll_char_wr.o
8OBJECTS=misc-debug.o ll_char_wr.aout.o
9
10CFLAGS=-D__KERNEL__ -O2 -DSTDC_HEADERS -DSTANDALONE_DEBUG -Wall -I../../../../include -c
11
12test-gzip: piggy.aout.o $(OBJECTS)
13 $(CC) -o $@ $(OBJECTS) piggy.aout.o
14
15misc-debug.o: misc.c
16 $(CC) $(CFLAGS) -o $@ misc.c
17
18piggy.aout.o: piggy.o
19 arm-linuxelf-objcopy --change-leading-char -I elf32-arm -O arm-aout32-linux piggy.o piggy.aout.o
20
21ll_char_wr.aout.o: $(COMPRESSED_EXTRA)
22 arm-linuxelf-objcopy --change-leading-char -I elf32-arm -O arm-aout32-linux $(COMPRESSED_EXTRA) ll_char_wr.aout.o
23
diff --git a/arch/arm/boot/compressed/head-l7200.S b/arch/arm/boot/compressed/head-l7200.S
deleted file mode 100644
index d0e3b20856cd..000000000000
--- a/arch/arm/boot/compressed/head-l7200.S
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * linux/arch/arm/boot/compressed/head-l7200.S
3 *
4 * Copyright (C) 2000 Steve Hill <sjhill@cotw.com>
5 *
6 * Some code borrowed from Nicolas Pitre's 'head-sa1100.S' file. This
7 * is merged with head.S by the linker.
8 */
9
10#include <asm/mach-types.h>
11
12#ifndef CONFIG_ARCH_L7200
13#error What am I doing here...
14#endif
15
16 .section ".start", "ax"
17
18__L7200_start:
19 mov r0, #0x00100000 @ FLASH address of initrd
20 mov r2, #0xf1000000 @ RAM address of initrd
21 add r3, r2, #0x00700000 @ Size of initrd
221:
23 ldmia r0!, {r4, r5, r6, r7}
24 stmia r2!, {r4, r5, r6, r7}
25 cmp r2, r3
26 ble 1b
27
28 mov r8, #0 @ Zero it out
29 mov r7, #MACH_TYPE_L7200 @ Set architecture ID
diff --git a/arch/arm/boot/compressed/head.S b/arch/arm/boot/compressed/head.S
index c5191b1532e8..abf4d65acf62 100644
--- a/arch/arm/boot/compressed/head.S
+++ b/arch/arm/boot/compressed/head.S
@@ -170,9 +170,16 @@ not_angel:
170 170
171 .text 171 .text
172 adr r0, LC0 172 adr r0, LC0
173 ARM( ldmia r0, {r1, r2, r3, r4, r5, r6, r11, ip, sp}) 173 ARM( ldmia r0, {r1, r2, r3, r5, r6, r11, ip, sp})
174 THUMB( ldmia r0, {r1, r2, r3, r4, r5, r6, r11, ip} ) 174 THUMB( ldmia r0, {r1, r2, r3, r5, r6, r11, ip} )
175 THUMB( ldr sp, [r0, #32] ) 175 THUMB( ldr sp, [r0, #32] )
176#ifdef CONFIG_AUTO_ZRELADDR
177 @ determine final kernel image address
178 and r4, pc, #0xf8000000
179 add r4, r4, #TEXT_OFFSET
180#else
181 ldr r4, =CONFIG_ZRELADDR
182#endif
176 subs r0, r0, r1 @ calculate the delta offset 183 subs r0, r0, r1 @ calculate the delta offset
177 184
178 @ if delta is zero, we are 185 @ if delta is zero, we are
@@ -310,18 +317,17 @@ wont_overwrite: mov r0, r4
310LC0: .word LC0 @ r1 317LC0: .word LC0 @ r1
311 .word __bss_start @ r2 318 .word __bss_start @ r2
312 .word _end @ r3 319 .word _end @ r3
313 .word zreladdr @ r4
314 .word _start @ r5 320 .word _start @ r5
315 .word _image_size @ r6 321 .word _image_size @ r6
316 .word _got_start @ r11 322 .word _got_start @ r11
317 .word _got_end @ ip 323 .word _got_end @ ip
318 .word user_stack+4096 @ sp 324 .word user_stack_end @ sp
319LC1: .word reloc_end - reloc_start 325LC1: .word reloc_end - reloc_start
320 .size LC0, . - LC0 326 .size LC0, . - LC0
321 327
322#ifdef CONFIG_ARCH_RPC 328#ifdef CONFIG_ARCH_RPC
323 .globl params 329 .globl params
324params: ldr r0, =params_phys 330params: ldr r0, =0x10000100 @ params_phys for RPC
325 mov pc, lr 331 mov pc, lr
326 .ltorg 332 .ltorg
327 .align 333 .align
@@ -339,9 +345,8 @@ params: ldr r0, =params_phys
339 * r4 = kernel execution address 345 * r4 = kernel execution address
340 * r7 = architecture number 346 * r7 = architecture number
341 * r8 = atags pointer 347 * r8 = atags pointer
342 * r9 = run-time address of "start" (???)
343 * On exit, 348 * On exit,
344 * r1, r2, r3, r9, r10, r12 corrupted 349 * r0, r1, r2, r3, r9, r10, r12 corrupted
345 * This routine must preserve: 350 * This routine must preserve:
346 * r4, r5, r6, r7, r8 351 * r4, r5, r6, r7, r8
347 */ 352 */
@@ -396,12 +401,18 @@ __armv3_mpu_cache_on:
396 401
397 mov r0, #0 402 mov r0, #0
398 mcr p15, 0, r0, c7, c0, 0 @ invalidate whole cache v3 403 mcr p15, 0, r0, c7, c0, 0 @ invalidate whole cache v3
404 /*
405 * ?? ARMv3 MMU does not allow reading the control register,
406 * does this really work on ARMv3 MPU?
407 */
399 mrc p15, 0, r0, c1, c0, 0 @ read control reg 408 mrc p15, 0, r0, c1, c0, 0 @ read control reg
400 @ .... .... .... WC.M 409 @ .... .... .... WC.M
401 orr r0, r0, #0x000d @ .... .... .... 11.1 410 orr r0, r0, #0x000d @ .... .... .... 11.1
411 /* ?? this overwrites the value constructed above? */
402 mov r0, #0 412 mov r0, #0
403 mcr p15, 0, r0, c1, c0, 0 @ write control reg 413 mcr p15, 0, r0, c1, c0, 0 @ write control reg
404 414
415 /* ?? invalidate for the second time? */
405 mcr p15, 0, r0, c7, c0, 0 @ invalidate whole cache v3 416 mcr p15, 0, r0, c7, c0, 0 @ invalidate whole cache v3
406 mov pc, lr 417 mov pc, lr
407 418
@@ -771,8 +782,10 @@ proc_types:
771 * Turn off the Cache and MMU. ARMv3 does not support 782 * Turn off the Cache and MMU. ARMv3 does not support
772 * reading the control register, but ARMv4 does. 783 * reading the control register, but ARMv4 does.
773 * 784 *
774 * On exit, r0, r1, r2, r3, r9, r12 corrupted 785 * On exit,
775 * This routine must preserve: r4, r6, r7 786 * r0, r1, r2, r3, r9, r12 corrupted
787 * This routine must preserve:
788 * r4, r6, r7
776 */ 789 */
777 .align 5 790 .align 5
778cache_off: mov r3, #12 @ cache_off function 791cache_off: mov r3, #12 @ cache_off function
@@ -845,7 +858,7 @@ __armv3_mmu_cache_off:
845 * Clean and flush the cache to maintain consistency. 858 * Clean and flush the cache to maintain consistency.
846 * 859 *
847 * On exit, 860 * On exit,
848 * r1, r2, r3, r9, r11, r12 corrupted 861 * r1, r2, r3, r9, r10, r11, r12 corrupted
849 * This routine must preserve: 862 * This routine must preserve:
850 * r0, r4, r5, r6, r7 863 * r0, r4, r5, r6, r7
851 */ 864 */
@@ -988,7 +1001,7 @@ no_cache_id:
988__armv3_mmu_cache_flush: 1001__armv3_mmu_cache_flush:
989__armv3_mpu_cache_flush: 1002__armv3_mpu_cache_flush:
990 mov r1, #0 1003 mov r1, #0
991 mcr p15, 0, r0, c7, c0, 0 @ invalidate whole cache v3 1004 mcr p15, 0, r1, c7, c0, 0 @ invalidate whole cache v3
992 mov pc, lr 1005 mov pc, lr
993 1006
994/* 1007/*
@@ -1001,6 +1014,7 @@ __armv3_mpu_cache_flush:
1001phexbuf: .space 12 1014phexbuf: .space 12
1002 .size phexbuf, . - phexbuf 1015 .size phexbuf, . - phexbuf
1003 1016
1017@ phex corrupts {r0, r1, r2, r3}
1004phex: adr r3, phexbuf 1018phex: adr r3, phexbuf
1005 mov r2, #0 1019 mov r2, #0
1006 strb r2, [r3, r1] 1020 strb r2, [r3, r1]
@@ -1015,6 +1029,7 @@ phex: adr r3, phexbuf
1015 strb r2, [r3, r1] 1029 strb r2, [r3, r1]
1016 b 1b 1030 b 1b
1017 1031
1032@ puts corrupts {r0, r1, r2, r3}
1018puts: loadsp r3, r1 1033puts: loadsp r3, r1
10191: ldrb r2, [r0], #1 10341: ldrb r2, [r0], #1
1020 teq r2, #0 1035 teq r2, #0
@@ -1029,12 +1044,14 @@ puts: loadsp r3, r1
1029 teq r0, #0 1044 teq r0, #0
1030 bne 1b 1045 bne 1b
1031 mov pc, lr 1046 mov pc, lr
1047@ putc corrupts {r0, r1, r2, r3}
1032putc: 1048putc:
1033 mov r2, r0 1049 mov r2, r0
1034 mov r0, #0 1050 mov r0, #0
1035 loadsp r3, r1 1051 loadsp r3, r1
1036 b 2b 1052 b 2b
1037 1053
1054@ memdump corrupts {r0, r1, r2, r3, r10, r11, r12, lr}
1038memdump: mov r12, r0 1055memdump: mov r12, r0
1039 mov r10, lr 1056 mov r10, lr
1040 mov r11, #0 1057 mov r11, #0
@@ -1070,3 +1087,4 @@ reloc_end:
1070 .align 1087 .align
1071 .section ".stack", "w" 1088 .section ".stack", "w"
1072user_stack: .space 4096 1089user_stack: .space 4096
1090user_stack_end:
diff --git a/arch/arm/boot/compressed/misc.c b/arch/arm/boot/compressed/misc.c
index d2b2ef41cd4f..e653a6d3c8d9 100644
--- a/arch/arm/boot/compressed/misc.c
+++ b/arch/arm/boot/compressed/misc.c
@@ -28,9 +28,6 @@ unsigned int __machine_arch_type;
28 28
29#include <asm/unaligned.h> 29#include <asm/unaligned.h>
30 30
31#ifdef STANDALONE_DEBUG
32#define putstr printf
33#else
34 31
35static void putstr(const char *ptr); 32static void putstr(const char *ptr);
36extern void error(char *x); 33extern void error(char *x);
@@ -116,7 +113,6 @@ static void putstr(const char *ptr)
116 flush(); 113 flush();
117} 114}
118 115
119#endif
120 116
121void *memcpy(void *__dest, __const void *__src, size_t __n) 117void *memcpy(void *__dest, __const void *__src, size_t __n)
122{ 118{
@@ -186,7 +182,6 @@ asmlinkage void __div0(void)
186 182
187extern void do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x)); 183extern void do_decompress(u8 *input, int len, u8 *output, void (*error)(char *x));
188 184
189#ifndef STANDALONE_DEBUG
190 185
191unsigned long 186unsigned long
192decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p, 187decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p,
@@ -211,18 +206,3 @@ decompress_kernel(unsigned long output_start, unsigned long free_mem_ptr_p,
211 putstr(" done, booting the kernel.\n"); 206 putstr(" done, booting the kernel.\n");
212 return output_ptr; 207 return output_ptr;
213} 208}
214#else
215
216char output_buffer[1500*1024];
217
218int main()
219{
220 output_data = output_buffer;
221
222 putstr("Uncompressing Linux...");
223 decompress(input_data, input_data_end - input_data,
224 NULL, NULL, output_data, NULL, error);
225 putstr("done.\n");
226 return 0;
227}
228#endif
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
index 337741f734ac..7dfa9a85bc0c 100644
--- a/arch/arm/common/gic.c
+++ b/arch/arm/common/gic.c
@@ -108,6 +108,51 @@ static void gic_unmask_irq(unsigned int irq)
108 spin_unlock(&irq_controller_lock); 108 spin_unlock(&irq_controller_lock);
109} 109}
110 110
111static int gic_set_type(unsigned int irq, unsigned int type)
112{
113 void __iomem *base = gic_dist_base(irq);
114 unsigned int gicirq = gic_irq(irq);
115 u32 enablemask = 1 << (gicirq % 32);
116 u32 enableoff = (gicirq / 32) * 4;
117 u32 confmask = 0x2 << ((gicirq % 16) * 2);
118 u32 confoff = (gicirq / 16) * 4;
119 bool enabled = false;
120 u32 val;
121
122 /* Interrupt configuration for SGIs can't be changed */
123 if (gicirq < 16)
124 return -EINVAL;
125
126 if (type != IRQ_TYPE_LEVEL_HIGH && type != IRQ_TYPE_EDGE_RISING)
127 return -EINVAL;
128
129 spin_lock(&irq_controller_lock);
130
131 val = readl(base + GIC_DIST_CONFIG + confoff);
132 if (type == IRQ_TYPE_LEVEL_HIGH)
133 val &= ~confmask;
134 else if (type == IRQ_TYPE_EDGE_RISING)
135 val |= confmask;
136
137 /*
138 * As recommended by the spec, disable the interrupt before changing
139 * the configuration
140 */
141 if (readl(base + GIC_DIST_ENABLE_SET + enableoff) & enablemask) {
142 writel(enablemask, base + GIC_DIST_ENABLE_CLEAR + enableoff);
143 enabled = true;
144 }
145
146 writel(val, base + GIC_DIST_CONFIG + confoff);
147
148 if (enabled)
149 writel(enablemask, base + GIC_DIST_ENABLE_SET + enableoff);
150
151 spin_unlock(&irq_controller_lock);
152
153 return 0;
154}
155
111#ifdef CONFIG_SMP 156#ifdef CONFIG_SMP
112static int gic_set_cpu(unsigned int irq, const struct cpumask *mask_val) 157static int gic_set_cpu(unsigned int irq, const struct cpumask *mask_val)
113{ 158{
@@ -161,6 +206,7 @@ static struct irq_chip gic_chip = {
161 .ack = gic_ack_irq, 206 .ack = gic_ack_irq,
162 .mask = gic_mask_irq, 207 .mask = gic_mask_irq,
163 .unmask = gic_unmask_irq, 208 .unmask = gic_unmask_irq,
209 .set_type = gic_set_type,
164#ifdef CONFIG_SMP 210#ifdef CONFIG_SMP
165 .set_affinity = gic_set_cpu, 211 .set_affinity = gic_set_cpu,
166#endif 212#endif
diff --git a/arch/arm/common/sa1111.c b/arch/arm/common/sa1111.c
index 6f80665f477e..517d50ddbeb3 100644
--- a/arch/arm/common/sa1111.c
+++ b/arch/arm/common/sa1111.c
@@ -185,13 +185,10 @@ static struct sa1111_dev_info sa1111_devices[] = {
185 }, 185 },
186}; 186};
187 187
188void __init sa1111_adjust_zones(int node, unsigned long *size, unsigned long *holes) 188void __init sa1111_adjust_zones(unsigned long *size, unsigned long *holes)
189{ 189{
190 unsigned int sz = SZ_1M >> PAGE_SHIFT; 190 unsigned int sz = SZ_1M >> PAGE_SHIFT;
191 191
192 if (node != 0)
193 sz = 0;
194
195 size[1] = size[0] - sz; 192 size[1] = size[0] - sz;
196 size[0] = sz; 193 size[0] = sz;
197} 194}
@@ -1028,13 +1025,12 @@ static int sa1111_remove(struct platform_device *pdev)
1028 struct sa1111 *sachip = platform_get_drvdata(pdev); 1025 struct sa1111 *sachip = platform_get_drvdata(pdev);
1029 1026
1030 if (sachip) { 1027 if (sachip) {
1031 __sa1111_remove(sachip);
1032 platform_set_drvdata(pdev, NULL);
1033
1034#ifdef CONFIG_PM 1028#ifdef CONFIG_PM
1035 kfree(sachip->saved_state); 1029 kfree(sachip->saved_state);
1036 sachip->saved_state = NULL; 1030 sachip->saved_state = NULL;
1037#endif 1031#endif
1032 __sa1111_remove(sachip);
1033 platform_set_drvdata(pdev, NULL);
1038 } 1034 }
1039 1035
1040 return 0; 1036 return 0;
diff --git a/arch/arm/configs/kirkwood_defconfig b/arch/arm/configs/kirkwood_defconfig
index f2e3a9088df6..ccc9c9959b82 100644
--- a/arch/arm/configs/kirkwood_defconfig
+++ b/arch/arm/configs/kirkwood_defconfig
@@ -13,11 +13,19 @@ CONFIG_MACH_RD88F6192_NAS=y
13CONFIG_MACH_RD88F6281=y 13CONFIG_MACH_RD88F6281=y
14CONFIG_MACH_MV88F6281GTW_GE=y 14CONFIG_MACH_MV88F6281GTW_GE=y
15CONFIG_MACH_SHEEVAPLUG=y 15CONFIG_MACH_SHEEVAPLUG=y
16CONFIG_MACH_ESATA_SHEEVAPLUG=y
17CONFIG_MACH_GURUPLUG=y
16CONFIG_MACH_TS219=y 18CONFIG_MACH_TS219=y
17CONFIG_MACH_TS41X=y 19CONFIG_MACH_TS41X=y
18CONFIG_MACH_OPENRD_BASE=y 20CONFIG_MACH_OPENRD_BASE=y
19CONFIG_MACH_OPENRD_CLIENT=y 21CONFIG_MACH_OPENRD_CLIENT=y
22CONFIG_MACH_OPENRD_ULTIMATE=y
20CONFIG_MACH_NETSPACE_V2=y 23CONFIG_MACH_NETSPACE_V2=y
24CONFIG_MACH_INETSPACE_V2=y
25CONFIG_MACH_NETSPACE_MAX_V2=y
26CONFIG_MACH_NET2BIG_V2=y
27CONFIG_MACH_NET5BIG_V2=y
28CONFIG_MACH_T5325=y
21# CONFIG_CPU_FEROCEON_OLD_ID is not set 29# CONFIG_CPU_FEROCEON_OLD_ID is not set
22CONFIG_NO_HZ=y 30CONFIG_NO_HZ=y
23CONFIG_HIGH_RES_TIMERS=y 31CONFIG_HIGH_RES_TIMERS=y
diff --git a/arch/arm/configs/lusl7200_defconfig b/arch/arm/configs/lusl7200_defconfig
deleted file mode 100644
index 816fc42884c9..000000000000
--- a/arch/arm/configs/lusl7200_defconfig
+++ /dev/null
@@ -1,23 +0,0 @@
1CONFIG_EXPERIMENTAL=y
2CONFIG_SYSVIPC=y
3CONFIG_BSD_PROCESS_ACCT=y
4CONFIG_LOG_BUF_SHIFT=14
5CONFIG_BLK_DEV_INITRD=y
6CONFIG_EMBEDDED=y
7# CONFIG_HOTPLUG is not set
8CONFIG_MODULES=y
9CONFIG_ARCH_L7200=y
10# CONFIG_ARM_THUMB is not set
11CONFIG_ZBOOT_ROM_TEXT=0x00010000
12CONFIG_ZBOOT_ROM_BSS=0xf03e0000
13CONFIG_ZBOOT_ROM=y
14CONFIG_CMDLINE="console=tty0 console=ttyLU1,115200 root=/dev/ram initrd=0xf1000000,0x005dac7b mem=32M"
15CONFIG_BINFMT_AOUT=y
16CONFIG_BLK_DEV_RAM=y
17# CONFIG_INPUT is not set
18# CONFIG_SERIO_SERPORT is not set
19# CONFIG_VT is not set
20CONFIG_SERIAL_NONSTANDARD=y
21CONFIG_EXT2_FS=y
22CONFIG_DEBUG_USER=y
23# CONFIG_CRC32 is not set
diff --git a/arch/arm/include/asm/elf.h b/arch/arm/include/asm/elf.h
index 51662feb9f1d..6750b8e45a49 100644
--- a/arch/arm/include/asm/elf.h
+++ b/arch/arm/include/asm/elf.h
@@ -121,4 +121,8 @@ int dump_task_regs(struct task_struct *t, elf_gregset_t *elfregs);
121extern void elf_set_personality(const struct elf32_hdr *); 121extern void elf_set_personality(const struct elf32_hdr *);
122#define SET_PERSONALITY(ex) elf_set_personality(&(ex)) 122#define SET_PERSONALITY(ex) elf_set_personality(&(ex))
123 123
124struct mm_struct;
125extern unsigned long arch_randomize_brk(struct mm_struct *mm);
126#define arch_randomize_brk arch_randomize_brk
127
124#endif 128#endif
diff --git a/arch/arm/include/asm/hwcap.h b/arch/arm/include/asm/hwcap.h
index f7bd52b1c365..c1062c317103 100644
--- a/arch/arm/include/asm/hwcap.h
+++ b/arch/arm/include/asm/hwcap.h
@@ -19,6 +19,7 @@
19#define HWCAP_NEON 4096 19#define HWCAP_NEON 4096
20#define HWCAP_VFPv3 8192 20#define HWCAP_VFPv3 8192
21#define HWCAP_VFPv3D16 16384 21#define HWCAP_VFPv3D16 16384
22#define HWCAP_TLS 32768
22 23
23#if defined(__KERNEL__) && !defined(__ASSEMBLY__) 24#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
24/* 25/*
diff --git a/arch/arm/include/asm/io.h b/arch/arm/include/asm/io.h
index c980156f3263..1261b1f928d9 100644
--- a/arch/arm/include/asm/io.h
+++ b/arch/arm/include/asm/io.h
@@ -26,6 +26,7 @@
26#include <linux/types.h> 26#include <linux/types.h>
27#include <asm/byteorder.h> 27#include <asm/byteorder.h>
28#include <asm/memory.h> 28#include <asm/memory.h>
29#include <asm/system.h>
29 30
30/* 31/*
31 * ISA I/O bus memory addresses are 1:1 with the physical address. 32 * ISA I/O bus memory addresses are 1:1 with the physical address.
@@ -179,25 +180,38 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
179 * IO port primitives for more information. 180 * IO port primitives for more information.
180 */ 181 */
181#ifdef __mem_pci 182#ifdef __mem_pci
182#define readb(c) ({ __u8 __v = __raw_readb(__mem_pci(c)); __v; }) 183#define readb_relaxed(c) ({ u8 __v = __raw_readb(__mem_pci(c)); __v; })
183#define readw(c) ({ __u16 __v = le16_to_cpu((__force __le16) \ 184#define readw_relaxed(c) ({ u16 __v = le16_to_cpu((__force __le16) \
184 __raw_readw(__mem_pci(c))); __v; }) 185 __raw_readw(__mem_pci(c))); __v; })
185#define readl(c) ({ __u32 __v = le32_to_cpu((__force __le32) \ 186#define readl_relaxed(c) ({ u32 __v = le32_to_cpu((__force __le32) \
186 __raw_readl(__mem_pci(c))); __v; }) 187 __raw_readl(__mem_pci(c))); __v; })
187#define readb_relaxed(addr) readb(addr) 188
188#define readw_relaxed(addr) readw(addr) 189#define writeb_relaxed(v,c) ((void)__raw_writeb(v,__mem_pci(c)))
189#define readl_relaxed(addr) readl(addr) 190#define writew_relaxed(v,c) ((void)__raw_writew((__force u16) \
191 cpu_to_le16(v),__mem_pci(c)))
192#define writel_relaxed(v,c) ((void)__raw_writel((__force u32) \
193 cpu_to_le32(v),__mem_pci(c)))
194
195#ifdef CONFIG_ARM_DMA_MEM_BUFFERABLE
196#define __iormb() rmb()
197#define __iowmb() wmb()
198#else
199#define __iormb() do { } while (0)
200#define __iowmb() do { } while (0)
201#endif
202
203#define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(); __v; })
204#define readw(c) ({ u16 __v = readw_relaxed(c); __iormb(); __v; })
205#define readl(c) ({ u32 __v = readl_relaxed(c); __iormb(); __v; })
206
207#define writeb(v,c) ({ __iowmb(); writeb_relaxed(v,c); })
208#define writew(v,c) ({ __iowmb(); writew_relaxed(v,c); })
209#define writel(v,c) ({ __iowmb(); writel_relaxed(v,c); })
190 210
191#define readsb(p,d,l) __raw_readsb(__mem_pci(p),d,l) 211#define readsb(p,d,l) __raw_readsb(__mem_pci(p),d,l)
192#define readsw(p,d,l) __raw_readsw(__mem_pci(p),d,l) 212#define readsw(p,d,l) __raw_readsw(__mem_pci(p),d,l)
193#define readsl(p,d,l) __raw_readsl(__mem_pci(p),d,l) 213#define readsl(p,d,l) __raw_readsl(__mem_pci(p),d,l)
194 214
195#define writeb(v,c) __raw_writeb(v,__mem_pci(c))
196#define writew(v,c) __raw_writew((__force __u16) \
197 cpu_to_le16(v),__mem_pci(c))
198#define writel(v,c) __raw_writel((__force __u32) \
199 cpu_to_le32(v),__mem_pci(c))
200
201#define writesb(p,d,l) __raw_writesb(__mem_pci(p),d,l) 215#define writesb(p,d,l) __raw_writesb(__mem_pci(p),d,l)
202#define writesw(p,d,l) __raw_writesw(__mem_pci(p),d,l) 216#define writesw(p,d,l) __raw_writesw(__mem_pci(p),d,l)
203#define writesl(p,d,l) __raw_writesl(__mem_pci(p),d,l) 217#define writesl(p,d,l) __raw_writesl(__mem_pci(p),d,l)
@@ -244,13 +258,13 @@ extern void _memset_io(volatile void __iomem *, int, size_t);
244 * io{read,write}{8,16,32} macros 258 * io{read,write}{8,16,32} macros
245 */ 259 */
246#ifndef ioread8 260#ifndef ioread8
247#define ioread8(p) ({ unsigned int __v = __raw_readb(p); __v; }) 261#define ioread8(p) ({ unsigned int __v = __raw_readb(p); __iormb(); __v; })
248#define ioread16(p) ({ unsigned int __v = le16_to_cpu((__force __le16)__raw_readw(p)); __v; }) 262#define ioread16(p) ({ unsigned int __v = le16_to_cpu((__force __le16)__raw_readw(p)); __iormb(); __v; })
249#define ioread32(p) ({ unsigned int __v = le32_to_cpu((__force __le32)__raw_readl(p)); __v; }) 263#define ioread32(p) ({ unsigned int __v = le32_to_cpu((__force __le32)__raw_readl(p)); __iormb(); __v; })
250 264
251#define iowrite8(v,p) __raw_writeb(v, p) 265#define iowrite8(v,p) ({ __iowmb(); (void)__raw_writeb(v, p); })
252#define iowrite16(v,p) __raw_writew((__force __u16)cpu_to_le16(v), p) 266#define iowrite16(v,p) ({ __iowmb(); (void)__raw_writew((__force __u16)cpu_to_le16(v), p); })
253#define iowrite32(v,p) __raw_writel((__force __u32)cpu_to_le32(v), p) 267#define iowrite32(v,p) ({ __iowmb(); (void)__raw_writel((__force __u32)cpu_to_le32(v), p); })
254 268
255#define ioread8_rep(p,d,c) __raw_readsb(p,d,c) 269#define ioread8_rep(p,d,c) __raw_readsb(p,d,c)
256#define ioread16_rep(p,d,c) __raw_readsw(p,d,c) 270#define ioread16_rep(p,d,c) __raw_readsw(p,d,c)
diff --git a/arch/arm/include/asm/irq.h b/arch/arm/include/asm/irq.h
index 237282f7c762..2721a5814cb9 100644
--- a/arch/arm/include/asm/irq.h
+++ b/arch/arm/include/asm/irq.h
@@ -7,6 +7,8 @@
7#define irq_canonicalize(i) (i) 7#define irq_canonicalize(i) (i)
8#endif 8#endif
9 9
10#define NR_IRQS_LEGACY 16
11
10/* 12/*
11 * Use this value to indicate lack of interrupt 13 * Use this value to indicate lack of interrupt
12 * capability 14 * capability
diff --git a/arch/arm/include/asm/kexec.h b/arch/arm/include/asm/kexec.h
index df15a0dc228e..8ec9ef5c3c7b 100644
--- a/arch/arm/include/asm/kexec.h
+++ b/arch/arm/include/asm/kexec.h
@@ -19,10 +19,26 @@
19 19
20#ifndef __ASSEMBLY__ 20#ifndef __ASSEMBLY__
21 21
22struct kimage; 22/**
23/* Provide a dummy definition to avoid build failures. */ 23 * crash_setup_regs() - save registers for the panic kernel
24 * @newregs: registers are saved here
25 * @oldregs: registers to be saved (may be %NULL)
26 *
27 * Function copies machine registers from @oldregs to @newregs. If @oldregs is
28 * %NULL then current registers are stored there.
29 */
24static inline void crash_setup_regs(struct pt_regs *newregs, 30static inline void crash_setup_regs(struct pt_regs *newregs,
25 struct pt_regs *oldregs) { } 31 struct pt_regs *oldregs)
32{
33 if (oldregs) {
34 memcpy(newregs, oldregs, sizeof(*newregs));
35 } else {
36 __asm__ __volatile__ ("stmia %0, {r0 - r15}"
37 : : "r" (&newregs->ARM_r0));
38 __asm__ __volatile__ ("mrs %0, cpsr"
39 : "=r" (newregs->ARM_cpsr));
40 }
41}
26 42
27#endif /* __ASSEMBLY__ */ 43#endif /* __ASSEMBLY__ */
28 44
diff --git a/arch/arm/include/asm/kgdb.h b/arch/arm/include/asm/kgdb.h
index 67af4b841984..08265993227f 100644
--- a/arch/arm/include/asm/kgdb.h
+++ b/arch/arm/include/asm/kgdb.h
@@ -70,11 +70,11 @@ extern int kgdb_fault_expected;
70#define _GP_REGS 16 70#define _GP_REGS 16
71#define _FP_REGS 8 71#define _FP_REGS 8
72#define _EXTRA_REGS 2 72#define _EXTRA_REGS 2
73#define GDB_MAX_REGS (_GP_REGS + (_FP_REGS * 3) + _EXTRA_REGS) 73#define DBG_MAX_REG_NUM (_GP_REGS + (_FP_REGS * 3) + _EXTRA_REGS)
74 74
75#define KGDB_MAX_NO_CPUS 1 75#define KGDB_MAX_NO_CPUS 1
76#define BUFMAX 400 76#define BUFMAX 400
77#define NUMREGBYTES (GDB_MAX_REGS << 2) 77#define NUMREGBYTES (DBG_MAX_REG_NUM << 2)
78#define NUMCRITREGBYTES (32 << 2) 78#define NUMCRITREGBYTES (32 << 2)
79 79
80#define _R0 0 80#define _R0 0
@@ -93,7 +93,7 @@ extern int kgdb_fault_expected;
93#define _SPT 13 93#define _SPT 13
94#define _LR 14 94#define _LR 14
95#define _PC 15 95#define _PC 15
96#define _CPSR (GDB_MAX_REGS - 1) 96#define _CPSR (DBG_MAX_REG_NUM - 1)
97 97
98/* 98/*
99 * So that we can denote the end of a frame for tracing, 99 * So that we can denote the end of a frame for tracing,
diff --git a/arch/arm/include/asm/local64.h b/arch/arm/include/asm/local64.h
new file mode 100644
index 000000000000..36c93b5cc239
--- /dev/null
+++ b/arch/arm/include/asm/local64.h
@@ -0,0 +1 @@
#include <asm-generic/local64.h>
diff --git a/arch/arm/include/asm/mach/arch.h b/arch/arm/include/asm/mach/arch.h
index c59842dc7cb8..8a0dd18ba642 100644
--- a/arch/arm/include/asm/mach/arch.h
+++ b/arch/arm/include/asm/mach/arch.h
@@ -20,6 +20,7 @@ struct machine_desc {
20 * by assembler code in head.S, head-common.S 20 * by assembler code in head.S, head-common.S
21 */ 21 */
22 unsigned int nr; /* architecture number */ 22 unsigned int nr; /* architecture number */
23 unsigned int nr_irqs; /* number of IRQs */
23 unsigned int phys_io; /* start of physical io */ 24 unsigned int phys_io; /* start of physical io */
24 unsigned int io_pg_offst; /* byte offset for io 25 unsigned int io_pg_offst; /* byte offset for io
25 * page tabe entry */ 26 * page tabe entry */
@@ -37,6 +38,7 @@ struct machine_desc {
37 void (*fixup)(struct machine_desc *, 38 void (*fixup)(struct machine_desc *,
38 struct tag *, char **, 39 struct tag *, char **,
39 struct meminfo *); 40 struct meminfo *);
41 void (*reserve)(void);/* reserve mem blocks */
40 void (*map_io)(void);/* IO mapping function */ 42 void (*map_io)(void);/* IO mapping function */
41 void (*init_irq)(void); 43 void (*init_irq)(void);
42 struct sys_timer *timer; /* system tick timer */ 44 struct sys_timer *timer; /* system tick timer */
diff --git a/arch/arm/include/asm/mach/irq.h b/arch/arm/include/asm/mach/irq.h
index 8920b2d6e3b8..ce3eee9fe26c 100644
--- a/arch/arm/include/asm/mach/irq.h
+++ b/arch/arm/include/asm/mach/irq.h
@@ -17,6 +17,7 @@ struct seq_file;
17/* 17/*
18 * This is internal. Do not use it. 18 * This is internal. Do not use it.
19 */ 19 */
20extern unsigned int arch_nr_irqs;
20extern void (*init_arch_irq)(void); 21extern void (*init_arch_irq)(void);
21extern void init_FIQ(void); 22extern void init_FIQ(void);
22extern int show_fiq_list(struct seq_file *, void *); 23extern int show_fiq_list(struct seq_file *, void *);
diff --git a/arch/arm/include/asm/mach/map.h b/arch/arm/include/asm/mach/map.h
index 742c2aaeb020..d2fedb5aeb1f 100644
--- a/arch/arm/include/asm/mach/map.h
+++ b/arch/arm/include/asm/mach/map.h
@@ -27,6 +27,8 @@ struct map_desc {
27#define MT_MEMORY 9 27#define MT_MEMORY 9
28#define MT_ROM 10 28#define MT_ROM 10
29#define MT_MEMORY_NONCACHED 11 29#define MT_MEMORY_NONCACHED 11
30#define MT_MEMORY_DTCM 12
31#define MT_MEMORY_ITCM 13
30 32
31#ifdef CONFIG_MMU 33#ifdef CONFIG_MMU
32extern void iotable_init(struct map_desc *, int); 34extern void iotable_init(struct map_desc *, int);
diff --git a/arch/arm/include/asm/mach/pci.h b/arch/arm/include/asm/mach/pci.h
index 52f0da1e97df..16330bd0657c 100644
--- a/arch/arm/include/asm/mach/pci.h
+++ b/arch/arm/include/asm/mach/pci.h
@@ -46,6 +46,7 @@ struct pci_sys_data {
46 /* IRQ mapping */ 46 /* IRQ mapping */
47 int (*map_irq)(struct pci_dev *, u8, u8); 47 int (*map_irq)(struct pci_dev *, u8, u8);
48 struct hw_pci *hw; 48 struct hw_pci *hw;
49 void *private_data; /* platform controller private data */
49}; 50};
50 51
51/* 52/*
diff --git a/arch/arm/include/asm/memblock.h b/arch/arm/include/asm/memblock.h
new file mode 100644
index 000000000000..fdbc43b2e6c0
--- /dev/null
+++ b/arch/arm/include/asm/memblock.h
@@ -0,0 +1,16 @@
1#ifndef _ASM_ARM_MEMBLOCK_H
2#define _ASM_ARM_MEMBLOCK_H
3
4#ifdef CONFIG_MMU
5extern phys_addr_t lowmem_end_addr;
6#define MEMBLOCK_REAL_LIMIT lowmem_end_addr
7#else
8#define MEMBLOCK_REAL_LIMIT 0
9#endif
10
11struct meminfo;
12struct machine_desc;
13
14extern void arm_memblock_init(struct meminfo *, struct machine_desc *);
15
16#endif
diff --git a/arch/arm/include/asm/memory.h b/arch/arm/include/asm/memory.h
index 4312ee5e3d0b..23c2e8e5c0fa 100644
--- a/arch/arm/include/asm/memory.h
+++ b/arch/arm/include/asm/memory.h
@@ -124,6 +124,15 @@
124#endif /* !CONFIG_MMU */ 124#endif /* !CONFIG_MMU */
125 125
126/* 126/*
127 * We fix the TCM memories max 32 KiB ITCM resp DTCM at these
128 * locations
129 */
130#ifdef CONFIG_HAVE_TCM
131#define ITCM_OFFSET UL(0xfffe0000)
132#define DTCM_OFFSET UL(0xfffe8000)
133#endif
134
135/*
127 * Physical vs virtual RAM address space conversion. These are 136 * Physical vs virtual RAM address space conversion. These are
128 * private definitions which should NOT be used outside memory.h 137 * private definitions which should NOT be used outside memory.h
129 * files. Use virt_to_phys/phys_to_virt/__pa/__va instead. 138 * files. Use virt_to_phys/phys_to_virt/__pa/__va instead.
@@ -158,7 +167,7 @@
158#endif 167#endif
159 168
160#ifndef arch_adjust_zones 169#ifndef arch_adjust_zones
161#define arch_adjust_zones(node,size,holes) do { } while (0) 170#define arch_adjust_zones(size,holes) do { } while (0)
162#elif !defined(CONFIG_ZONE_DMA) 171#elif !defined(CONFIG_ZONE_DMA)
163#error "custom arch_adjust_zones() requires CONFIG_ZONE_DMA" 172#error "custom arch_adjust_zones() requires CONFIG_ZONE_DMA"
164#endif 173#endif
@@ -234,76 +243,11 @@ static inline __deprecated void *bus_to_virt(unsigned long x)
234 * virt_to_page(k) convert a _valid_ virtual address to struct page * 243 * virt_to_page(k) convert a _valid_ virtual address to struct page *
235 * virt_addr_valid(k) indicates whether a virtual address is valid 244 * virt_addr_valid(k) indicates whether a virtual address is valid
236 */ 245 */
237#ifndef CONFIG_DISCONTIGMEM
238
239#define ARCH_PFN_OFFSET PHYS_PFN_OFFSET 246#define ARCH_PFN_OFFSET PHYS_PFN_OFFSET
240 247
241#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT) 248#define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
242#define virt_addr_valid(kaddr) ((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory) 249#define virt_addr_valid(kaddr) ((unsigned long)(kaddr) >= PAGE_OFFSET && (unsigned long)(kaddr) < (unsigned long)high_memory)
243 250
244#define PHYS_TO_NID(addr) (0)
245
246#else /* CONFIG_DISCONTIGMEM */
247
248/*
249 * This is more complex. We have a set of mem_map arrays spread
250 * around in memory.
251 */
252#include <linux/numa.h>
253
254#define arch_pfn_to_nid(pfn) PFN_TO_NID(pfn)
255#define arch_local_page_offset(pfn, nid) LOCAL_MAP_NR((pfn) << PAGE_SHIFT)
256
257#define virt_to_page(kaddr) \
258 (ADDR_TO_MAPBASE(kaddr) + LOCAL_MAP_NR(kaddr))
259
260#define virt_addr_valid(kaddr) (KVADDR_TO_NID(kaddr) < MAX_NUMNODES)
261
262/*
263 * Common discontigmem stuff.
264 * PHYS_TO_NID is used by the ARM kernel/setup.c
265 */
266#define PHYS_TO_NID(addr) PFN_TO_NID((addr) >> PAGE_SHIFT)
267
268/*
269 * Given a kaddr, ADDR_TO_MAPBASE finds the owning node of the memory
270 * and returns the mem_map of that node.
271 */
272#define ADDR_TO_MAPBASE(kaddr) NODE_MEM_MAP(KVADDR_TO_NID(kaddr))
273
274/*
275 * Given a page frame number, find the owning node of the memory
276 * and returns the mem_map of that node.
277 */
278#define PFN_TO_MAPBASE(pfn) NODE_MEM_MAP(PFN_TO_NID(pfn))
279
280#ifdef NODE_MEM_SIZE_BITS
281#define NODE_MEM_SIZE_MASK ((1 << NODE_MEM_SIZE_BITS) - 1)
282
283/*
284 * Given a kernel address, find the home node of the underlying memory.
285 */
286#define KVADDR_TO_NID(addr) \
287 (((unsigned long)(addr) - PAGE_OFFSET) >> NODE_MEM_SIZE_BITS)
288
289/*
290 * Given a page frame number, convert it to a node id.
291 */
292#define PFN_TO_NID(pfn) \
293 (((pfn) - PHYS_PFN_OFFSET) >> (NODE_MEM_SIZE_BITS - PAGE_SHIFT))
294
295/*
296 * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory
297 * and returns the index corresponding to the appropriate page in the
298 * node's mem_map.
299 */
300#define LOCAL_MAP_NR(addr) \
301 (((unsigned long)(addr) & NODE_MEM_SIZE_MASK) >> PAGE_SHIFT)
302
303#endif /* NODE_MEM_SIZE_BITS */
304
305#endif /* !CONFIG_DISCONTIGMEM */
306
307/* 251/*
308 * Optional coherency support. Currently used only by selected 252 * Optional coherency support. Currently used only by selected
309 * Intel XSC3-based systems. 253 * Intel XSC3-based systems.
diff --git a/arch/arm/include/asm/mmzone.h b/arch/arm/include/asm/mmzone.h
deleted file mode 100644
index ae63a4fd28c8..000000000000
--- a/arch/arm/include/asm/mmzone.h
+++ /dev/null
@@ -1,30 +0,0 @@
1/*
2 * arch/arm/include/asm/mmzone.h
3 *
4 * 1999-12-29 Nicolas Pitre Created
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_MMZONE_H
11#define __ASM_MMZONE_H
12
13/*
14 * Currently defined in arch/arm/mm/discontig.c
15 */
16extern pg_data_t discontig_node_data[];
17
18/*
19 * Return a pointer to the node data for node n.
20 */
21#define NODE_DATA(nid) (&discontig_node_data[nid])
22
23/*
24 * NODE_MEM_MAP gives the kaddr for the mem_map of the node.
25 */
26#define NODE_MEM_MAP(nid) (NODE_DATA(nid)->node_mem_map)
27
28#include <mach/memory.h>
29
30#endif
diff --git a/arch/arm/include/asm/ptrace.h b/arch/arm/include/asm/ptrace.h
index 9dcb11e59026..c974be8913a7 100644
--- a/arch/arm/include/asm/ptrace.h
+++ b/arch/arm/include/asm/ptrace.h
@@ -184,6 +184,42 @@ extern unsigned long profile_pc(struct pt_regs *regs);
184#define predicate(x) ((x) & 0xf0000000) 184#define predicate(x) ((x) & 0xf0000000)
185#define PREDICATE_ALWAYS 0xe0000000 185#define PREDICATE_ALWAYS 0xe0000000
186 186
187/*
188 * kprobe-based event tracer support
189 */
190#include <linux/stddef.h>
191#include <linux/types.h>
192#define MAX_REG_OFFSET (offsetof(struct pt_regs, ARM_ORIG_r0))
193
194extern int regs_query_register_offset(const char *name);
195extern const char *regs_query_register_name(unsigned int offset);
196extern bool regs_within_kernel_stack(struct pt_regs *regs, unsigned long addr);
197extern unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs,
198 unsigned int n);
199
200/**
201 * regs_get_register() - get register value from its offset
202 * @regs: pt_regs from which register value is gotten
203 * @offset: offset number of the register.
204 *
205 * regs_get_register returns the value of a register whose offset from @regs.
206 * The @offset is the offset of the register in struct pt_regs.
207 * If @offset is bigger than MAX_REG_OFFSET, this returns 0.
208 */
209static inline unsigned long regs_get_register(struct pt_regs *regs,
210 unsigned int offset)
211{
212 if (unlikely(offset > MAX_REG_OFFSET))
213 return 0;
214 return *(unsigned long *)((unsigned long)regs + offset);
215}
216
217/* Valid only for Kernel mode traps. */
218static inline unsigned long kernel_stack_pointer(struct pt_regs *regs)
219{
220 return regs->ARM_sp;
221}
222
187#endif /* __KERNEL__ */ 223#endif /* __KERNEL__ */
188 224
189#endif /* __ASSEMBLY__ */ 225#endif /* __ASSEMBLY__ */
diff --git a/arch/arm/include/asm/setup.h b/arch/arm/include/asm/setup.h
index f392fb4437af..f1e5a9bca249 100644
--- a/arch/arm/include/asm/setup.h
+++ b/arch/arm/include/asm/setup.h
@@ -201,8 +201,7 @@ static struct tagtable __tagtable_##fn __tag = { tag, fn }
201struct membank { 201struct membank {
202 unsigned long start; 202 unsigned long start;
203 unsigned long size; 203 unsigned long size;
204 unsigned short node; 204 unsigned int highmem;
205 unsigned short highmem;
206}; 205};
207 206
208struct meminfo { 207struct meminfo {
@@ -212,9 +211,8 @@ struct meminfo {
212 211
213extern struct meminfo meminfo; 212extern struct meminfo meminfo;
214 213
215#define for_each_nodebank(iter,mi,no) \ 214#define for_each_bank(iter,mi) \
216 for (iter = 0; iter < (mi)->nr_banks; iter++) \ 215 for (iter = 0; iter < (mi)->nr_banks; iter++)
217 if ((mi)->bank[iter].node == no)
218 216
219#define bank_pfn_start(bank) __phys_to_pfn((bank)->start) 217#define bank_pfn_start(bank) __phys_to_pfn((bank)->start)
220#define bank_pfn_end(bank) __phys_to_pfn((bank)->start + (bank)->size) 218#define bank_pfn_end(bank) __phys_to_pfn((bank)->start + (bank)->size)
diff --git a/arch/arm/include/asm/stackprotector.h b/arch/arm/include/asm/stackprotector.h
new file mode 100644
index 000000000000..de003327be97
--- /dev/null
+++ b/arch/arm/include/asm/stackprotector.h
@@ -0,0 +1,38 @@
1/*
2 * GCC stack protector support.
3 *
4 * Stack protector works by putting predefined pattern at the start of
5 * the stack frame and verifying that it hasn't been overwritten when
6 * returning from the function. The pattern is called stack canary
7 * and gcc expects it to be defined by a global variable called
8 * "__stack_chk_guard" on ARM. This unfortunately means that on SMP
9 * we cannot have a different canary value per task.
10 */
11
12#ifndef _ASM_STACKPROTECTOR_H
13#define _ASM_STACKPROTECTOR_H 1
14
15#include <linux/random.h>
16#include <linux/version.h>
17
18extern unsigned long __stack_chk_guard;
19
20/*
21 * Initialize the stackprotector canary value.
22 *
23 * NOTE: this must only be called from functions that never return,
24 * and it must always be inlined.
25 */
26static __always_inline void boot_init_stack_canary(void)
27{
28 unsigned long canary;
29
30 /* Try to get a semi random initial value. */
31 get_random_bytes(&canary, sizeof(canary));
32 canary ^= LINUX_VERSION_CODE;
33
34 current->stack_canary = canary;
35 __stack_chk_guard = current->stack_canary;
36}
37
38#endif /* _ASM_STACKPROTECTOR_H */
diff --git a/arch/arm/include/asm/system.h b/arch/arm/include/asm/system.h
index 5f4f48002734..8ba1ccf82a02 100644
--- a/arch/arm/include/asm/system.h
+++ b/arch/arm/include/asm/system.h
@@ -83,7 +83,7 @@ void arm_notify_die(const char *str, struct pt_regs *regs, struct siginfo *info,
83 83
84void hook_fault_code(int nr, int (*fn)(unsigned long, unsigned int, 84void hook_fault_code(int nr, int (*fn)(unsigned long, unsigned int,
85 struct pt_regs *), 85 struct pt_regs *),
86 int sig, const char *name); 86 int sig, int code, const char *name);
87 87
88#define xchg(ptr,x) \ 88#define xchg(ptr,x) \
89 ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr)))) 89 ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
diff --git a/arch/arm/include/asm/tls.h b/arch/arm/include/asm/tls.h
new file mode 100644
index 000000000000..e71d6ff8d104
--- /dev/null
+++ b/arch/arm/include/asm/tls.h
@@ -0,0 +1,46 @@
1#ifndef __ASMARM_TLS_H
2#define __ASMARM_TLS_H
3
4#ifdef __ASSEMBLY__
5 .macro set_tls_none, tp, tmp1, tmp2
6 .endm
7
8 .macro set_tls_v6k, tp, tmp1, tmp2
9 mcr p15, 0, \tp, c13, c0, 3 @ set TLS register
10 .endm
11
12 .macro set_tls_v6, tp, tmp1, tmp2
13 ldr \tmp1, =elf_hwcap
14 ldr \tmp1, [\tmp1, #0]
15 mov \tmp2, #0xffff0fff
16 tst \tmp1, #HWCAP_TLS @ hardware TLS available?
17 mcrne p15, 0, \tp, c13, c0, 3 @ yes, set TLS register
18 streq \tp, [\tmp2, #-15] @ set TLS value at 0xffff0ff0
19 .endm
20
21 .macro set_tls_software, tp, tmp1, tmp2
22 mov \tmp1, #0xffff0fff
23 str \tp, [\tmp1, #-15] @ set TLS value at 0xffff0ff0
24 .endm
25#endif
26
27#ifdef CONFIG_TLS_REG_EMUL
28#define tls_emu 1
29#define has_tls_reg 1
30#define set_tls set_tls_none
31#elif __LINUX_ARM_ARCH__ >= 7 || \
32 (__LINUX_ARM_ARCH__ == 6 && defined(CONFIG_CPU_32v6K))
33#define tls_emu 0
34#define has_tls_reg 1
35#define set_tls set_tls_v6k
36#elif __LINUX_ARM_ARCH__ == 6
37#define tls_emu 0
38#define has_tls_reg (elf_hwcap & HWCAP_TLS)
39#define set_tls set_tls_v6
40#else
41#define tls_emu 0
42#define has_tls_reg 0
43#define set_tls set_tls_software
44#endif
45
46#endif /* __ASMARM_TLS_H */
diff --git a/arch/arm/include/asm/vfpmacros.h b/arch/arm/include/asm/vfpmacros.h
index 422f3cc204a2..3d5fc41ae8d3 100644
--- a/arch/arm/include/asm/vfpmacros.h
+++ b/arch/arm/include/asm/vfpmacros.h
@@ -3,6 +3,8 @@
3 * 3 *
4 * Assembler-only file containing VFP macros and register definitions. 4 * Assembler-only file containing VFP macros and register definitions.
5 */ 5 */
6#include <asm/hwcap.h>
7
6#include "vfp.h" 8#include "vfp.h"
7 9
8@ Macros to allow building with old toolkits (with no VFP support) 10@ Macros to allow building with old toolkits (with no VFP support)
@@ -22,12 +24,20 @@
22 LDC p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d0-d15} 24 LDC p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d0-d15}
23#endif 25#endif
24#ifdef CONFIG_VFPv3 26#ifdef CONFIG_VFPv3
27#if __LINUX_ARM_ARCH__ <= 6
28 ldr \tmp, =elf_hwcap @ may not have MVFR regs
29 ldr \tmp, [\tmp, #0]
30 tst \tmp, #HWCAP_VFPv3D16
31 ldceq p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31}
32 addne \base, \base, #32*4 @ step over unused register space
33#else
25 VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0 34 VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0
26 and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field 35 and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field
27 cmp \tmp, #2 @ 32 x 64bit registers? 36 cmp \tmp, #2 @ 32 x 64bit registers?
28 ldceql p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31} 37 ldceql p11, cr0, [\base],#32*4 @ FLDMIAD \base!, {d16-d31}
29 addne \base, \base, #32*4 @ step over unused register space 38 addne \base, \base, #32*4 @ step over unused register space
30#endif 39#endif
40#endif
31 .endm 41 .endm
32 42
33 @ write all the working registers out of the VFP 43 @ write all the working registers out of the VFP
@@ -38,10 +48,18 @@
38 STC p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d0-d15} 48 STC p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d0-d15}
39#endif 49#endif
40#ifdef CONFIG_VFPv3 50#ifdef CONFIG_VFPv3
51#if __LINUX_ARM_ARCH__ <= 6
52 ldr \tmp, =elf_hwcap @ may not have MVFR regs
53 ldr \tmp, [\tmp, #0]
54 tst \tmp, #HWCAP_VFPv3D16
55 stceq p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31}
56 addne \base, \base, #32*4 @ step over unused register space
57#else
41 VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0 58 VFPFMRX \tmp, MVFR0 @ Media and VFP Feature Register 0
42 and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field 59 and \tmp, \tmp, #MVFR0_A_SIMD_MASK @ A_SIMD field
43 cmp \tmp, #2 @ 32 x 64bit registers? 60 cmp \tmp, #2 @ 32 x 64bit registers?
44 stceql p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31} 61 stceql p11, cr0, [\base],#32*4 @ FSTMIAD \base!, {d16-d31}
45 addne \base, \base, #32*4 @ step over unused register space 62 addne \base, \base, #32*4 @ step over unused register space
46#endif 63#endif
64#endif
47 .endm 65 .endm
diff --git a/arch/arm/kernel/Makefile b/arch/arm/kernel/Makefile
index 26d302c28e13..980b78e31328 100644
--- a/arch/arm/kernel/Makefile
+++ b/arch/arm/kernel/Makefile
@@ -13,10 +13,12 @@ CFLAGS_REMOVE_return_address.o = -pg
13 13
14# Object file lists. 14# Object file lists.
15 15
16obj-y := compat.o elf.o entry-armv.o entry-common.o irq.o \ 16obj-y := elf.o entry-armv.o entry-common.o irq.o \
17 process.o ptrace.o return_address.o setup.o signal.o \ 17 process.o ptrace.o return_address.o setup.o signal.o \
18 sys_arm.o stacktrace.o time.o traps.o 18 sys_arm.o stacktrace.o time.o traps.o
19 19
20obj-$(CONFIG_DEPRECATED_PARAM_STRUCT) += compat.o
21
20obj-$(CONFIG_LEDS) += leds.o 22obj-$(CONFIG_LEDS) += leds.o
21obj-$(CONFIG_OC_ETM) += etm.o 23obj-$(CONFIG_OC_ETM) += etm.o
22 24
@@ -39,6 +41,7 @@ obj-$(CONFIG_ARM_THUMBEE) += thumbee.o
39obj-$(CONFIG_KGDB) += kgdb.o 41obj-$(CONFIG_KGDB) += kgdb.o
40obj-$(CONFIG_ARM_UNWIND) += unwind.o 42obj-$(CONFIG_ARM_UNWIND) += unwind.o
41obj-$(CONFIG_HAVE_TCM) += tcm.o 43obj-$(CONFIG_HAVE_TCM) += tcm.o
44obj-$(CONFIG_CRASH_DUMP) += crash_dump.o
42 45
43obj-$(CONFIG_CRUNCH) += crunch.o crunch-bits.o 46obj-$(CONFIG_CRUNCH) += crunch.o crunch-bits.o
44AFLAGS_crunch-bits.o := -Wa,-mcpu=ep9312 47AFLAGS_crunch-bits.o := -Wa,-mcpu=ep9312
diff --git a/arch/arm/kernel/asm-offsets.c b/arch/arm/kernel/asm-offsets.c
index 883511522fca..85f2a019f77b 100644
--- a/arch/arm/kernel/asm-offsets.c
+++ b/arch/arm/kernel/asm-offsets.c
@@ -40,6 +40,9 @@
40int main(void) 40int main(void)
41{ 41{
42 DEFINE(TSK_ACTIVE_MM, offsetof(struct task_struct, active_mm)); 42 DEFINE(TSK_ACTIVE_MM, offsetof(struct task_struct, active_mm));
43#ifdef CONFIG_CC_STACKPROTECTOR
44 DEFINE(TSK_STACK_CANARY, offsetof(struct task_struct, stack_canary));
45#endif
43 BLANK(); 46 BLANK();
44 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags)); 47 DEFINE(TI_FLAGS, offsetof(struct thread_info, flags));
45 DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count)); 48 DEFINE(TI_PREEMPT, offsetof(struct thread_info, preempt_count));
diff --git a/arch/arm/kernel/compat.c b/arch/arm/kernel/compat.c
index 0a1385442f43..925652318b8b 100644
--- a/arch/arm/kernel/compat.c
+++ b/arch/arm/kernel/compat.c
@@ -217,10 +217,3 @@ void __init convert_to_tag_list(struct tag *tags)
217 struct param_struct *params = (struct param_struct *)tags; 217 struct param_struct *params = (struct param_struct *)tags;
218 build_tag_list(params, &params->u2); 218 build_tag_list(params, &params->u2);
219} 219}
220
221void __init squash_mem_tags(struct tag *tag)
222{
223 for (; tag->hdr.size; tag = tag_next(tag))
224 if (tag->hdr.tag == ATAG_MEM)
225 tag->hdr.tag = ATAG_NONE;
226}
diff --git a/arch/arm/kernel/compat.h b/arch/arm/kernel/compat.h
index 27e61a68bd1c..39264ab1b9c6 100644
--- a/arch/arm/kernel/compat.h
+++ b/arch/arm/kernel/compat.h
@@ -9,5 +9,3 @@
9*/ 9*/
10 10
11extern void convert_to_tag_list(struct tag *tags); 11extern void convert_to_tag_list(struct tag *tags);
12
13extern void squash_mem_tags(struct tag *tag);
diff --git a/arch/arm/kernel/crash_dump.c b/arch/arm/kernel/crash_dump.c
new file mode 100644
index 000000000000..cd3b853a8a6d
--- /dev/null
+++ b/arch/arm/kernel/crash_dump.c
@@ -0,0 +1,60 @@
1/*
2 * arch/arm/kernel/crash_dump.c
3 *
4 * Copyright (C) 2010 Nokia Corporation.
5 * Author: Mika Westerberg
6 *
7 * This code is taken from arch/x86/kernel/crash_dump_64.c
8 * Created by: Hariprasad Nellitheertha (hari@in.ibm.com)
9 * Copyright (C) IBM Corporation, 2004. All rights reserved
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/errno.h>
17#include <linux/crash_dump.h>
18#include <linux/uaccess.h>
19#include <linux/io.h>
20
21/* stores the physical address of elf header of crash image */
22unsigned long long elfcorehdr_addr = ELFCORE_ADDR_MAX;
23
24/**
25 * copy_oldmem_page() - copy one page from old kernel memory
26 * @pfn: page frame number to be copied
27 * @buf: buffer where the copied page is placed
28 * @csize: number of bytes to copy
29 * @offset: offset in bytes into the page
30 * @userbuf: if set, @buf is int he user address space
31 *
32 * This function copies one page from old kernel memory into buffer pointed by
33 * @buf. If @buf is in userspace, set @userbuf to %1. Returns number of bytes
34 * copied or negative error in case of failure.
35 */
36ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
37 size_t csize, unsigned long offset,
38 int userbuf)
39{
40 void *vaddr;
41
42 if (!csize)
43 return 0;
44
45 vaddr = ioremap(pfn << PAGE_SHIFT, PAGE_SIZE);
46 if (!vaddr)
47 return -ENOMEM;
48
49 if (userbuf) {
50 if (copy_to_user(buf, vaddr + offset, csize)) {
51 iounmap(vaddr);
52 return -EFAULT;
53 }
54 } else {
55 memcpy(buf, vaddr + offset, csize);
56 }
57
58 iounmap(vaddr);
59 return csize;
60}
diff --git a/arch/arm/kernel/entry-armv.S b/arch/arm/kernel/entry-armv.S
index 3fd7861de4d1..bb8e93a76407 100644
--- a/arch/arm/kernel/entry-armv.S
+++ b/arch/arm/kernel/entry-armv.S
@@ -22,6 +22,7 @@
22#include <asm/thread_notify.h> 22#include <asm/thread_notify.h>
23#include <asm/unwind.h> 23#include <asm/unwind.h>
24#include <asm/unistd.h> 24#include <asm/unistd.h>
25#include <asm/tls.h>
25 26
26#include "entry-header.S" 27#include "entry-header.S"
27 28
@@ -735,11 +736,11 @@ ENTRY(__switch_to)
735#ifdef CONFIG_MMU 736#ifdef CONFIG_MMU
736 ldr r6, [r2, #TI_CPU_DOMAIN] 737 ldr r6, [r2, #TI_CPU_DOMAIN]
737#endif 738#endif
738#if defined(CONFIG_HAS_TLS_REG) 739 set_tls r3, r4, r5
739 mcr p15, 0, r3, c13, c0, 3 @ set TLS register 740#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP)
740#elif !defined(CONFIG_TLS_REG_EMUL) 741 ldr r7, [r2, #TI_TASK]
741 mov r4, #0xffff0fff 742 ldr r8, =__stack_chk_guard
742 str r3, [r4, #-15] @ TLS val at 0xffff0ff0 743 ldr r7, [r7, #TSK_STACK_CANARY]
743#endif 744#endif
744#ifdef CONFIG_MMU 745#ifdef CONFIG_MMU
745 mcr p15, 0, r6, c3, c0, 0 @ Set domain register 746 mcr p15, 0, r6, c3, c0, 0 @ Set domain register
@@ -749,6 +750,9 @@ ENTRY(__switch_to)
749 ldr r0, =thread_notify_head 750 ldr r0, =thread_notify_head
750 mov r1, #THREAD_NOTIFY_SWITCH 751 mov r1, #THREAD_NOTIFY_SWITCH
751 bl atomic_notifier_call_chain 752 bl atomic_notifier_call_chain
753#if defined(CONFIG_CC_STACKPROTECTOR) && !defined(CONFIG_SMP)
754 str r7, [r8]
755#endif
752 THUMB( mov ip, r4 ) 756 THUMB( mov ip, r4 )
753 mov r0, r5 757 mov r0, r5
754 ARM( ldmia r4, {r4 - sl, fp, sp, pc} ) @ Load all regs saved previously 758 ARM( ldmia r4, {r4 - sl, fp, sp, pc} ) @ Load all regs saved previously
@@ -1005,17 +1009,12 @@ kuser_cmpxchg_fixup:
1005 */ 1009 */
1006 1010
1007__kuser_get_tls: @ 0xffff0fe0 1011__kuser_get_tls: @ 0xffff0fe0
1008 1012 ldr r0, [pc, #(16 - 8)] @ read TLS, set in kuser_get_tls_init
1009#if !defined(CONFIG_HAS_TLS_REG) && !defined(CONFIG_TLS_REG_EMUL)
1010 ldr r0, [pc, #(16 - 8)] @ TLS stored at 0xffff0ff0
1011#else
1012 mrc p15, 0, r0, c13, c0, 3 @ read TLS register
1013#endif
1014 usr_ret lr 1013 usr_ret lr
1015 1014 mrc p15, 0, r0, c13, c0, 3 @ 0xffff0fe8 hardware TLS code
1016 .rep 5 1015 .rep 4
1017 .word 0 @ pad up to __kuser_helper_version 1016 .word 0 @ 0xffff0ff0 software TLS value, then
1018 .endr 1017 .endr @ pad up to __kuser_helper_version
1019 1018
1020/* 1019/*
1021 * Reference declaration: 1020 * Reference declaration:
diff --git a/arch/arm/kernel/irq.c b/arch/arm/kernel/irq.c
index 3b3d2c80509c..c0d5c3b3a760 100644
--- a/arch/arm/kernel/irq.c
+++ b/arch/arm/kernel/irq.c
@@ -47,12 +47,14 @@
47#define irq_finish(irq) do { } while (0) 47#define irq_finish(irq) do { } while (0)
48#endif 48#endif
49 49
50unsigned int arch_nr_irqs;
50void (*init_arch_irq)(void) __initdata = NULL; 51void (*init_arch_irq)(void) __initdata = NULL;
51unsigned long irq_err_count; 52unsigned long irq_err_count;
52 53
53int show_interrupts(struct seq_file *p, void *v) 54int show_interrupts(struct seq_file *p, void *v)
54{ 55{
55 int i = *(loff_t *) v, cpu; 56 int i = *(loff_t *) v, cpu;
57 struct irq_desc *desc;
56 struct irqaction * action; 58 struct irqaction * action;
57 unsigned long flags; 59 unsigned long flags;
58 60
@@ -67,24 +69,25 @@ int show_interrupts(struct seq_file *p, void *v)
67 seq_putc(p, '\n'); 69 seq_putc(p, '\n');
68 } 70 }
69 71
70 if (i < NR_IRQS) { 72 if (i < nr_irqs) {
71 raw_spin_lock_irqsave(&irq_desc[i].lock, flags); 73 desc = irq_to_desc(i);
72 action = irq_desc[i].action; 74 raw_spin_lock_irqsave(&desc->lock, flags);
75 action = desc->action;
73 if (!action) 76 if (!action)
74 goto unlock; 77 goto unlock;
75 78
76 seq_printf(p, "%3d: ", i); 79 seq_printf(p, "%3d: ", i);
77 for_each_present_cpu(cpu) 80 for_each_present_cpu(cpu)
78 seq_printf(p, "%10u ", kstat_irqs_cpu(i, cpu)); 81 seq_printf(p, "%10u ", kstat_irqs_cpu(i, cpu));
79 seq_printf(p, " %10s", irq_desc[i].chip->name ? : "-"); 82 seq_printf(p, " %10s", desc->chip->name ? : "-");
80 seq_printf(p, " %s", action->name); 83 seq_printf(p, " %s", action->name);
81 for (action = action->next; action; action = action->next) 84 for (action = action->next; action; action = action->next)
82 seq_printf(p, ", %s", action->name); 85 seq_printf(p, ", %s", action->name);
83 86
84 seq_putc(p, '\n'); 87 seq_putc(p, '\n');
85unlock: 88unlock:
86 raw_spin_unlock_irqrestore(&irq_desc[i].lock, flags); 89 raw_spin_unlock_irqrestore(&desc->lock, flags);
87 } else if (i == NR_IRQS) { 90 } else if (i == nr_irqs) {
88#ifdef CONFIG_FIQ 91#ifdef CONFIG_FIQ
89 show_fiq_list(p, v); 92 show_fiq_list(p, v);
90#endif 93#endif
@@ -112,7 +115,7 @@ asmlinkage void __exception asm_do_IRQ(unsigned int irq, struct pt_regs *regs)
112 * Some hardware gives randomly wrong interrupts. Rather 115 * Some hardware gives randomly wrong interrupts. Rather
113 * than crashing, do something sensible. 116 * than crashing, do something sensible.
114 */ 117 */
115 if (unlikely(irq >= NR_IRQS)) { 118 if (unlikely(irq >= nr_irqs)) {
116 if (printk_ratelimit()) 119 if (printk_ratelimit())
117 printk(KERN_WARNING "Bad IRQ%u\n", irq); 120 printk(KERN_WARNING "Bad IRQ%u\n", irq);
118 ack_bad_irq(irq); 121 ack_bad_irq(irq);
@@ -132,12 +135,12 @@ void set_irq_flags(unsigned int irq, unsigned int iflags)
132 struct irq_desc *desc; 135 struct irq_desc *desc;
133 unsigned long flags; 136 unsigned long flags;
134 137
135 if (irq >= NR_IRQS) { 138 if (irq >= nr_irqs) {
136 printk(KERN_ERR "Trying to set irq flags for IRQ%d\n", irq); 139 printk(KERN_ERR "Trying to set irq flags for IRQ%d\n", irq);
137 return; 140 return;
138 } 141 }
139 142
140 desc = irq_desc + irq; 143 desc = irq_to_desc(irq);
141 raw_spin_lock_irqsave(&desc->lock, flags); 144 raw_spin_lock_irqsave(&desc->lock, flags);
142 desc->status |= IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN; 145 desc->status |= IRQ_NOREQUEST | IRQ_NOPROBE | IRQ_NOAUTOEN;
143 if (iflags & IRQF_VALID) 146 if (iflags & IRQF_VALID)
@@ -151,14 +154,25 @@ void set_irq_flags(unsigned int irq, unsigned int iflags)
151 154
152void __init init_IRQ(void) 155void __init init_IRQ(void)
153{ 156{
157 struct irq_desc *desc;
154 int irq; 158 int irq;
155 159
156 for (irq = 0; irq < NR_IRQS; irq++) 160 for (irq = 0; irq < nr_irqs; irq++) {
157 irq_desc[irq].status |= IRQ_NOREQUEST | IRQ_NOPROBE; 161 desc = irq_to_desc_alloc_node(irq, 0);
162 desc->status |= IRQ_NOREQUEST | IRQ_NOPROBE;
163 }
158 164
159 init_arch_irq(); 165 init_arch_irq();
160} 166}
161 167
168#ifdef CONFIG_SPARSE_IRQ
169int __init arch_probe_nr_irqs(void)
170{
171 nr_irqs = arch_nr_irqs ? arch_nr_irqs : NR_IRQS;
172 return 0;
173}
174#endif
175
162#ifdef CONFIG_HOTPLUG_CPU 176#ifdef CONFIG_HOTPLUG_CPU
163 177
164static void route_irq(struct irq_desc *desc, unsigned int irq, unsigned int cpu) 178static void route_irq(struct irq_desc *desc, unsigned int irq, unsigned int cpu)
@@ -178,10 +192,9 @@ static void route_irq(struct irq_desc *desc, unsigned int irq, unsigned int cpu)
178void migrate_irqs(void) 192void migrate_irqs(void)
179{ 193{
180 unsigned int i, cpu = smp_processor_id(); 194 unsigned int i, cpu = smp_processor_id();
195 struct irq_desc *desc;
181 196
182 for (i = 0; i < NR_IRQS; i++) { 197 for_each_irq_desc(i, desc) {
183 struct irq_desc *desc = irq_desc + i;
184
185 if (desc->node == cpu) { 198 if (desc->node == cpu) {
186 unsigned int newcpu = cpumask_any_and(desc->affinity, 199 unsigned int newcpu = cpumask_any_and(desc->affinity,
187 cpu_online_mask); 200 cpu_online_mask);
diff --git a/arch/arm/kernel/kgdb.c b/arch/arm/kernel/kgdb.c
index c868a8864117..778c2f7024ff 100644
--- a/arch/arm/kernel/kgdb.c
+++ b/arch/arm/kernel/kgdb.c
@@ -10,57 +10,62 @@
10 * Deepak Saxena <dsaxena@plexity.net> 10 * Deepak Saxena <dsaxena@plexity.net>
11 */ 11 */
12#include <linux/irq.h> 12#include <linux/irq.h>
13#include <linux/kdebug.h>
13#include <linux/kgdb.h> 14#include <linux/kgdb.h>
14#include <asm/traps.h> 15#include <asm/traps.h>
15 16
16/* Make a local copy of the registers passed into the handler (bletch) */ 17struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] =
17void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *kernel_regs)
18{ 18{
19 int regno; 19 { "r0", 4, offsetof(struct pt_regs, ARM_r0)},
20 20 { "r1", 4, offsetof(struct pt_regs, ARM_r1)},
21 /* Initialize all to zero. */ 21 { "r2", 4, offsetof(struct pt_regs, ARM_r2)},
22 for (regno = 0; regno < GDB_MAX_REGS; regno++) 22 { "r3", 4, offsetof(struct pt_regs, ARM_r3)},
23 gdb_regs[regno] = 0; 23 { "r4", 4, offsetof(struct pt_regs, ARM_r4)},
24 { "r5", 4, offsetof(struct pt_regs, ARM_r5)},
25 { "r6", 4, offsetof(struct pt_regs, ARM_r6)},
26 { "r7", 4, offsetof(struct pt_regs, ARM_r7)},
27 { "r8", 4, offsetof(struct pt_regs, ARM_r8)},
28 { "r9", 4, offsetof(struct pt_regs, ARM_r9)},
29 { "r10", 4, offsetof(struct pt_regs, ARM_r10)},
30 { "fp", 4, offsetof(struct pt_regs, ARM_fp)},
31 { "ip", 4, offsetof(struct pt_regs, ARM_ip)},
32 { "sp", 4, offsetof(struct pt_regs, ARM_sp)},
33 { "lr", 4, offsetof(struct pt_regs, ARM_lr)},
34 { "pc", 4, offsetof(struct pt_regs, ARM_pc)},
35 { "f0", 12, -1 },
36 { "f1", 12, -1 },
37 { "f2", 12, -1 },
38 { "f3", 12, -1 },
39 { "f4", 12, -1 },
40 { "f5", 12, -1 },
41 { "f6", 12, -1 },
42 { "f7", 12, -1 },
43 { "fps", 4, -1 },
44 { "cpsr", 4, offsetof(struct pt_regs, ARM_cpsr)},
45};
24 46
25 gdb_regs[_R0] = kernel_regs->ARM_r0; 47char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs)
26 gdb_regs[_R1] = kernel_regs->ARM_r1; 48{
27 gdb_regs[_R2] = kernel_regs->ARM_r2; 49 if (regno >= DBG_MAX_REG_NUM || regno < 0)
28 gdb_regs[_R3] = kernel_regs->ARM_r3; 50 return NULL;
29 gdb_regs[_R4] = kernel_regs->ARM_r4; 51
30 gdb_regs[_R5] = kernel_regs->ARM_r5; 52 if (dbg_reg_def[regno].offset != -1)
31 gdb_regs[_R6] = kernel_regs->ARM_r6; 53 memcpy(mem, (void *)regs + dbg_reg_def[regno].offset,
32 gdb_regs[_R7] = kernel_regs->ARM_r7; 54 dbg_reg_def[regno].size);
33 gdb_regs[_R8] = kernel_regs->ARM_r8; 55 else
34 gdb_regs[_R9] = kernel_regs->ARM_r9; 56 memset(mem, 0, dbg_reg_def[regno].size);
35 gdb_regs[_R10] = kernel_regs->ARM_r10; 57 return dbg_reg_def[regno].name;
36 gdb_regs[_FP] = kernel_regs->ARM_fp;
37 gdb_regs[_IP] = kernel_regs->ARM_ip;
38 gdb_regs[_SPT] = kernel_regs->ARM_sp;
39 gdb_regs[_LR] = kernel_regs->ARM_lr;
40 gdb_regs[_PC] = kernel_regs->ARM_pc;
41 gdb_regs[_CPSR] = kernel_regs->ARM_cpsr;
42} 58}
43 59
44/* Copy local gdb registers back to kgdb regs, for later copy to kernel */ 60int dbg_set_reg(int regno, void *mem, struct pt_regs *regs)
45void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *kernel_regs)
46{ 61{
47 kernel_regs->ARM_r0 = gdb_regs[_R0]; 62 if (regno >= DBG_MAX_REG_NUM || regno < 0)
48 kernel_regs->ARM_r1 = gdb_regs[_R1]; 63 return -EINVAL;
49 kernel_regs->ARM_r2 = gdb_regs[_R2]; 64
50 kernel_regs->ARM_r3 = gdb_regs[_R3]; 65 if (dbg_reg_def[regno].offset != -1)
51 kernel_regs->ARM_r4 = gdb_regs[_R4]; 66 memcpy((void *)regs + dbg_reg_def[regno].offset, mem,
52 kernel_regs->ARM_r5 = gdb_regs[_R5]; 67 dbg_reg_def[regno].size);
53 kernel_regs->ARM_r6 = gdb_regs[_R6]; 68 return 0;
54 kernel_regs->ARM_r7 = gdb_regs[_R7];
55 kernel_regs->ARM_r8 = gdb_regs[_R8];
56 kernel_regs->ARM_r9 = gdb_regs[_R9];
57 kernel_regs->ARM_r10 = gdb_regs[_R10];
58 kernel_regs->ARM_fp = gdb_regs[_FP];
59 kernel_regs->ARM_ip = gdb_regs[_IP];
60 kernel_regs->ARM_sp = gdb_regs[_SPT];
61 kernel_regs->ARM_lr = gdb_regs[_LR];
62 kernel_regs->ARM_pc = gdb_regs[_PC];
63 kernel_regs->ARM_cpsr = gdb_regs[_CPSR];
64} 69}
65 70
66void 71void
@@ -176,6 +181,33 @@ void kgdb_roundup_cpus(unsigned long flags)
176 local_irq_disable(); 181 local_irq_disable();
177} 182}
178 183
184static int __kgdb_notify(struct die_args *args, unsigned long cmd)
185{
186 struct pt_regs *regs = args->regs;
187
188 if (kgdb_handle_exception(1, args->signr, cmd, regs))
189 return NOTIFY_DONE;
190 return NOTIFY_STOP;
191}
192static int
193kgdb_notify(struct notifier_block *self, unsigned long cmd, void *ptr)
194{
195 unsigned long flags;
196 int ret;
197
198 local_irq_save(flags);
199 ret = __kgdb_notify(ptr, cmd);
200 local_irq_restore(flags);
201
202 return ret;
203}
204
205static struct notifier_block kgdb_notifier = {
206 .notifier_call = kgdb_notify,
207 .priority = -INT_MAX,
208};
209
210
179/** 211/**
180 * kgdb_arch_init - Perform any architecture specific initalization. 212 * kgdb_arch_init - Perform any architecture specific initalization.
181 * 213 *
@@ -184,6 +216,11 @@ void kgdb_roundup_cpus(unsigned long flags)
184 */ 216 */
185int kgdb_arch_init(void) 217int kgdb_arch_init(void)
186{ 218{
219 int ret = register_die_notifier(&kgdb_notifier);
220
221 if (ret != 0)
222 return ret;
223
187 register_undef_hook(&kgdb_brkpt_hook); 224 register_undef_hook(&kgdb_brkpt_hook);
188 register_undef_hook(&kgdb_compiled_brkpt_hook); 225 register_undef_hook(&kgdb_compiled_brkpt_hook);
189 226
@@ -200,6 +237,7 @@ void kgdb_arch_exit(void)
200{ 237{
201 unregister_undef_hook(&kgdb_brkpt_hook); 238 unregister_undef_hook(&kgdb_brkpt_hook);
202 unregister_undef_hook(&kgdb_compiled_brkpt_hook); 239 unregister_undef_hook(&kgdb_compiled_brkpt_hook);
240 unregister_die_notifier(&kgdb_notifier);
203} 241}
204 242
205/* 243/*
diff --git a/arch/arm/kernel/machine_kexec.c b/arch/arm/kernel/machine_kexec.c
index 598ca61e7bca..1fc74cbd1a19 100644
--- a/arch/arm/kernel/machine_kexec.c
+++ b/arch/arm/kernel/machine_kexec.c
@@ -37,12 +37,12 @@ void machine_kexec_cleanup(struct kimage *image)
37{ 37{
38} 38}
39 39
40void machine_shutdown(void)
41{
42}
43
44void machine_crash_shutdown(struct pt_regs *regs) 40void machine_crash_shutdown(struct pt_regs *regs)
45{ 41{
42 local_irq_disable();
43 crash_save_cpu(regs, smp_processor_id());
44
45 printk(KERN_INFO "Loading crashdump kernel...\n");
46} 46}
47 47
48void machine_kexec(struct kimage *image) 48void machine_kexec(struct kimage *image)
@@ -74,7 +74,11 @@ void machine_kexec(struct kimage *image)
74 (unsigned long) reboot_code_buffer + KEXEC_CONTROL_PAGE_SIZE); 74 (unsigned long) reboot_code_buffer + KEXEC_CONTROL_PAGE_SIZE);
75 printk(KERN_INFO "Bye!\n"); 75 printk(KERN_INFO "Bye!\n");
76 76
77 cpu_proc_fin(); 77 local_irq_disable();
78 local_fiq_disable();
78 setup_mm_for_reboot(0); /* mode is not used, so just pass 0*/ 79 setup_mm_for_reboot(0); /* mode is not used, so just pass 0*/
80 flush_cache_all();
81 cpu_proc_fin();
82 flush_cache_all();
79 cpu_reset(reboot_code_buffer_phys); 83 cpu_reset(reboot_code_buffer_phys);
80} 84}
diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
index de12536d687f..417c392ddf1c 100644
--- a/arch/arm/kernel/perf_event.c
+++ b/arch/arm/kernel/perf_event.c
@@ -164,20 +164,20 @@ armpmu_event_set_period(struct perf_event *event,
164 struct hw_perf_event *hwc, 164 struct hw_perf_event *hwc,
165 int idx) 165 int idx)
166{ 166{
167 s64 left = atomic64_read(&hwc->period_left); 167 s64 left = local64_read(&hwc->period_left);
168 s64 period = hwc->sample_period; 168 s64 period = hwc->sample_period;
169 int ret = 0; 169 int ret = 0;
170 170
171 if (unlikely(left <= -period)) { 171 if (unlikely(left <= -period)) {
172 left = period; 172 left = period;
173 atomic64_set(&hwc->period_left, left); 173 local64_set(&hwc->period_left, left);
174 hwc->last_period = period; 174 hwc->last_period = period;
175 ret = 1; 175 ret = 1;
176 } 176 }
177 177
178 if (unlikely(left <= 0)) { 178 if (unlikely(left <= 0)) {
179 left += period; 179 left += period;
180 atomic64_set(&hwc->period_left, left); 180 local64_set(&hwc->period_left, left);
181 hwc->last_period = period; 181 hwc->last_period = period;
182 ret = 1; 182 ret = 1;
183 } 183 }
@@ -185,7 +185,7 @@ armpmu_event_set_period(struct perf_event *event,
185 if (left > (s64)armpmu->max_period) 185 if (left > (s64)armpmu->max_period)
186 left = armpmu->max_period; 186 left = armpmu->max_period;
187 187
188 atomic64_set(&hwc->prev_count, (u64)-left); 188 local64_set(&hwc->prev_count, (u64)-left);
189 189
190 armpmu->write_counter(idx, (u64)(-left) & 0xffffffff); 190 armpmu->write_counter(idx, (u64)(-left) & 0xffffffff);
191 191
@@ -204,18 +204,18 @@ armpmu_event_update(struct perf_event *event,
204 u64 delta; 204 u64 delta;
205 205
206again: 206again:
207 prev_raw_count = atomic64_read(&hwc->prev_count); 207 prev_raw_count = local64_read(&hwc->prev_count);
208 new_raw_count = armpmu->read_counter(idx); 208 new_raw_count = armpmu->read_counter(idx);
209 209
210 if (atomic64_cmpxchg(&hwc->prev_count, prev_raw_count, 210 if (local64_cmpxchg(&hwc->prev_count, prev_raw_count,
211 new_raw_count) != prev_raw_count) 211 new_raw_count) != prev_raw_count)
212 goto again; 212 goto again;
213 213
214 delta = (new_raw_count << shift) - (prev_raw_count << shift); 214 delta = (new_raw_count << shift) - (prev_raw_count << shift);
215 delta >>= shift; 215 delta >>= shift;
216 216
217 atomic64_add(delta, &event->count); 217 local64_add(delta, &event->count);
218 atomic64_sub(delta, &hwc->period_left); 218 local64_sub(delta, &hwc->period_left);
219 219
220 return new_raw_count; 220 return new_raw_count;
221} 221}
@@ -478,7 +478,7 @@ __hw_perf_event_init(struct perf_event *event)
478 if (!hwc->sample_period) { 478 if (!hwc->sample_period) {
479 hwc->sample_period = armpmu->max_period; 479 hwc->sample_period = armpmu->max_period;
480 hwc->last_period = hwc->sample_period; 480 hwc->last_period = hwc->sample_period;
481 atomic64_set(&hwc->period_left, hwc->sample_period); 481 local64_set(&hwc->period_left, hwc->sample_period);
482 } 482 }
483 483
484 err = 0; 484 err = 0;
diff --git a/arch/arm/kernel/process.c b/arch/arm/kernel/process.c
index a4a9cc88bec7..401e38be1f78 100644
--- a/arch/arm/kernel/process.c
+++ b/arch/arm/kernel/process.c
@@ -28,7 +28,9 @@
28#include <linux/tick.h> 28#include <linux/tick.h>
29#include <linux/utsname.h> 29#include <linux/utsname.h>
30#include <linux/uaccess.h> 30#include <linux/uaccess.h>
31#include <linux/random.h>
31 32
33#include <asm/cacheflush.h>
32#include <asm/leds.h> 34#include <asm/leds.h>
33#include <asm/processor.h> 35#include <asm/processor.h>
34#include <asm/system.h> 36#include <asm/system.h>
@@ -36,6 +38,12 @@
36#include <asm/stacktrace.h> 38#include <asm/stacktrace.h>
37#include <asm/mach/time.h> 39#include <asm/mach/time.h>
38 40
41#ifdef CONFIG_CC_STACKPROTECTOR
42#include <linux/stackprotector.h>
43unsigned long __stack_chk_guard __read_mostly;
44EXPORT_SYMBOL(__stack_chk_guard);
45#endif
46
39static const char *processor_modes[] = { 47static const char *processor_modes[] = {
40 "USER_26", "FIQ_26" , "IRQ_26" , "SVC_26" , "UK4_26" , "UK5_26" , "UK6_26" , "UK7_26" , 48 "USER_26", "FIQ_26" , "IRQ_26" , "SVC_26" , "UK4_26" , "UK5_26" , "UK6_26" , "UK7_26" ,
41 "UK8_26" , "UK9_26" , "UK10_26", "UK11_26", "UK12_26", "UK13_26", "UK14_26", "UK15_26", 49 "UK8_26" , "UK9_26" , "UK10_26", "UK11_26", "UK12_26", "UK13_26", "UK14_26", "UK15_26",
@@ -84,10 +92,9 @@ __setup("hlt", hlt_setup);
84 92
85void arm_machine_restart(char mode, const char *cmd) 93void arm_machine_restart(char mode, const char *cmd)
86{ 94{
87 /* 95 /* Disable interrupts first */
88 * Clean and disable cache, and turn off interrupts 96 local_irq_disable();
89 */ 97 local_fiq_disable();
90 cpu_proc_fin();
91 98
92 /* 99 /*
93 * Tell the mm system that we are going to reboot - 100 * Tell the mm system that we are going to reboot -
@@ -96,6 +103,15 @@ void arm_machine_restart(char mode, const char *cmd)
96 */ 103 */
97 setup_mm_for_reboot(mode); 104 setup_mm_for_reboot(mode);
98 105
106 /* Clean and invalidate caches */
107 flush_cache_all();
108
109 /* Turn off caching */
110 cpu_proc_fin();
111
112 /* Push out any further dirty data, and ensure cache is empty */
113 flush_cache_all();
114
99 /* 115 /*
100 * Now call the architecture specific reboot code. 116 * Now call the architecture specific reboot code.
101 */ 117 */
@@ -189,19 +205,29 @@ int __init reboot_setup(char *str)
189 205
190__setup("reboot=", reboot_setup); 206__setup("reboot=", reboot_setup);
191 207
192void machine_halt(void) 208void machine_shutdown(void)
193{ 209{
210#ifdef CONFIG_SMP
211 smp_send_stop();
212#endif
194} 213}
195 214
215void machine_halt(void)
216{
217 machine_shutdown();
218 while (1);
219}
196 220
197void machine_power_off(void) 221void machine_power_off(void)
198{ 222{
223 machine_shutdown();
199 if (pm_power_off) 224 if (pm_power_off)
200 pm_power_off(); 225 pm_power_off();
201} 226}
202 227
203void machine_restart(char *cmd) 228void machine_restart(char *cmd)
204{ 229{
230 machine_shutdown();
205 arm_pm_restart(reboot_mode, cmd); 231 arm_pm_restart(reboot_mode, cmd);
206} 232}
207 233
@@ -426,3 +452,9 @@ unsigned long get_wchan(struct task_struct *p)
426 } while (count ++ < 16); 452 } while (count ++ < 16);
427 return 0; 453 return 0;
428} 454}
455
456unsigned long arch_randomize_brk(struct mm_struct *mm)
457{
458 unsigned long range_end = mm->brk + 0x02000000;
459 return randomize_range(mm->brk, range_end, 0) ? : mm->brk;
460}
diff --git a/arch/arm/kernel/ptrace.c b/arch/arm/kernel/ptrace.c
index 3f562a7c0a99..f99d489822d5 100644
--- a/arch/arm/kernel/ptrace.c
+++ b/arch/arm/kernel/ptrace.c
@@ -52,6 +52,102 @@
52#define BREAKINST_THUMB 0xde01 52#define BREAKINST_THUMB 0xde01
53#endif 53#endif
54 54
55struct pt_regs_offset {
56 const char *name;
57 int offset;
58};
59
60#define REG_OFFSET_NAME(r) \
61 {.name = #r, .offset = offsetof(struct pt_regs, ARM_##r)}
62#define REG_OFFSET_END {.name = NULL, .offset = 0}
63
64static const struct pt_regs_offset regoffset_table[] = {
65 REG_OFFSET_NAME(r0),
66 REG_OFFSET_NAME(r1),
67 REG_OFFSET_NAME(r2),
68 REG_OFFSET_NAME(r3),
69 REG_OFFSET_NAME(r4),
70 REG_OFFSET_NAME(r5),
71 REG_OFFSET_NAME(r6),
72 REG_OFFSET_NAME(r7),
73 REG_OFFSET_NAME(r8),
74 REG_OFFSET_NAME(r9),
75 REG_OFFSET_NAME(r10),
76 REG_OFFSET_NAME(fp),
77 REG_OFFSET_NAME(ip),
78 REG_OFFSET_NAME(sp),
79 REG_OFFSET_NAME(lr),
80 REG_OFFSET_NAME(pc),
81 REG_OFFSET_NAME(cpsr),
82 REG_OFFSET_NAME(ORIG_r0),
83 REG_OFFSET_END,
84};
85
86/**
87 * regs_query_register_offset() - query register offset from its name
88 * @name: the name of a register
89 *
90 * regs_query_register_offset() returns the offset of a register in struct
91 * pt_regs from its name. If the name is invalid, this returns -EINVAL;
92 */
93int regs_query_register_offset(const char *name)
94{
95 const struct pt_regs_offset *roff;
96 for (roff = regoffset_table; roff->name != NULL; roff++)
97 if (!strcmp(roff->name, name))
98 return roff->offset;
99 return -EINVAL;
100}
101
102/**
103 * regs_query_register_name() - query register name from its offset
104 * @offset: the offset of a register in struct pt_regs.
105 *
106 * regs_query_register_name() returns the name of a register from its
107 * offset in struct pt_regs. If the @offset is invalid, this returns NULL;
108 */
109const char *regs_query_register_name(unsigned int offset)
110{
111 const struct pt_regs_offset *roff;
112 for (roff = regoffset_table; roff->name != NULL; roff++)
113 if (roff->offset == offset)
114 return roff->name;
115 return NULL;
116}
117
118/**
119 * regs_within_kernel_stack() - check the address in the stack
120 * @regs: pt_regs which contains kernel stack pointer.
121 * @addr: address which is checked.
122 *
123 * regs_within_kernel_stack() checks @addr is within the kernel stack page(s).
124 * If @addr is within the kernel stack, it returns true. If not, returns false.
125 */
126bool regs_within_kernel_stack(struct pt_regs *regs, unsigned long addr)
127{
128 return ((addr & ~(THREAD_SIZE - 1)) ==
129 (kernel_stack_pointer(regs) & ~(THREAD_SIZE - 1)));
130}
131
132/**
133 * regs_get_kernel_stack_nth() - get Nth entry of the stack
134 * @regs: pt_regs which contains kernel stack pointer.
135 * @n: stack entry number.
136 *
137 * regs_get_kernel_stack_nth() returns @n th entry of the kernel stack which
138 * is specified by @regs. If the @n th entry is NOT in the kernel stack,
139 * this returns 0.
140 */
141unsigned long regs_get_kernel_stack_nth(struct pt_regs *regs, unsigned int n)
142{
143 unsigned long *addr = (unsigned long *)kernel_stack_pointer(regs);
144 addr += n;
145 if (regs_within_kernel_stack(regs, (unsigned long)addr))
146 return *addr;
147 else
148 return 0;
149}
150
55/* 151/*
56 * this routine will get a word off of the processes privileged stack. 152 * this routine will get a word off of the processes privileged stack.
57 * the offset is how far from the base addr as stored in the THREAD. 153 * the offset is how far from the base addr as stored in the THREAD.
diff --git a/arch/arm/kernel/relocate_kernel.S b/arch/arm/kernel/relocate_kernel.S
index 61930eb09029..fd26f8d65151 100644
--- a/arch/arm/kernel/relocate_kernel.S
+++ b/arch/arm/kernel/relocate_kernel.S
@@ -10,6 +10,12 @@ relocate_new_kernel:
10 ldr r0,kexec_indirection_page 10 ldr r0,kexec_indirection_page
11 ldr r1,kexec_start_address 11 ldr r1,kexec_start_address
12 12
13 /*
14 * If there is no indirection page (we are doing crashdumps)
15 * skip any relocation.
16 */
17 cmp r0, #0
18 beq 2f
13 19
140: /* top, read another word for the indirection page */ 200: /* top, read another word for the indirection page */
15 ldr r3, [r0],#4 21 ldr r3, [r0],#4
diff --git a/arch/arm/kernel/setup.c b/arch/arm/kernel/setup.c
index 122d999bdc7c..d5231ae7355a 100644
--- a/arch/arm/kernel/setup.c
+++ b/arch/arm/kernel/setup.c
@@ -19,12 +19,15 @@
19#include <linux/seq_file.h> 19#include <linux/seq_file.h>
20#include <linux/screen_info.h> 20#include <linux/screen_info.h>
21#include <linux/init.h> 21#include <linux/init.h>
22#include <linux/kexec.h>
23#include <linux/crash_dump.h>
22#include <linux/root_dev.h> 24#include <linux/root_dev.h>
23#include <linux/cpu.h> 25#include <linux/cpu.h>
24#include <linux/interrupt.h> 26#include <linux/interrupt.h>
25#include <linux/smp.h> 27#include <linux/smp.h>
26#include <linux/fs.h> 28#include <linux/fs.h>
27#include <linux/proc_fs.h> 29#include <linux/proc_fs.h>
30#include <linux/memblock.h>
28 31
29#include <asm/unified.h> 32#include <asm/unified.h>
30#include <asm/cpu.h> 33#include <asm/cpu.h>
@@ -44,7 +47,9 @@
44#include <asm/traps.h> 47#include <asm/traps.h>
45#include <asm/unwind.h> 48#include <asm/unwind.h>
46 49
50#if defined(CONFIG_DEPRECATED_PARAM_STRUCT)
47#include "compat.h" 51#include "compat.h"
52#endif
48#include "atags.h" 53#include "atags.h"
49#include "tcm.h" 54#include "tcm.h"
50 55
@@ -269,6 +274,21 @@ static void __init cacheid_init(void)
269extern struct proc_info_list *lookup_processor_type(unsigned int); 274extern struct proc_info_list *lookup_processor_type(unsigned int);
270extern struct machine_desc *lookup_machine_type(unsigned int); 275extern struct machine_desc *lookup_machine_type(unsigned int);
271 276
277static void __init feat_v6_fixup(void)
278{
279 int id = read_cpuid_id();
280
281 if ((id & 0xff0f0000) != 0x41070000)
282 return;
283
284 /*
285 * HWCAP_TLS is available only on 1136 r1p0 and later,
286 * see also kuser_get_tls_init.
287 */
288 if ((((id >> 4) & 0xfff) == 0xb36) && (((id >> 20) & 3) == 0))
289 elf_hwcap &= ~HWCAP_TLS;
290}
291
272static void __init setup_processor(void) 292static void __init setup_processor(void)
273{ 293{
274 struct proc_info_list *list; 294 struct proc_info_list *list;
@@ -311,6 +331,8 @@ static void __init setup_processor(void)
311 elf_hwcap &= ~HWCAP_THUMB; 331 elf_hwcap &= ~HWCAP_THUMB;
312#endif 332#endif
313 333
334 feat_v6_fixup();
335
314 cacheid_init(); 336 cacheid_init();
315 cpu_proc_init(); 337 cpu_proc_init();
316} 338}
@@ -402,13 +424,12 @@ static int __init arm_add_memory(unsigned long start, unsigned long size)
402 size -= start & ~PAGE_MASK; 424 size -= start & ~PAGE_MASK;
403 bank->start = PAGE_ALIGN(start); 425 bank->start = PAGE_ALIGN(start);
404 bank->size = size & PAGE_MASK; 426 bank->size = size & PAGE_MASK;
405 bank->node = PHYS_TO_NID(start);
406 427
407 /* 428 /*
408 * Check whether this memory region has non-zero size or 429 * Check whether this memory region has non-zero size or
409 * invalid node number. 430 * invalid node number.
410 */ 431 */
411 if (bank->size == 0 || bank->node >= MAX_NUMNODES) 432 if (bank->size == 0)
412 return -EINVAL; 433 return -EINVAL;
413 434
414 meminfo.nr_banks++; 435 meminfo.nr_banks++;
@@ -663,6 +684,86 @@ static int __init customize_machine(void)
663} 684}
664arch_initcall(customize_machine); 685arch_initcall(customize_machine);
665 686
687#ifdef CONFIG_KEXEC
688static inline unsigned long long get_total_mem(void)
689{
690 unsigned long total;
691
692 total = max_low_pfn - min_low_pfn;
693 return total << PAGE_SHIFT;
694}
695
696/**
697 * reserve_crashkernel() - reserves memory are for crash kernel
698 *
699 * This function reserves memory area given in "crashkernel=" kernel command
700 * line parameter. The memory reserved is used by a dump capture kernel when
701 * primary kernel is crashing.
702 */
703static void __init reserve_crashkernel(void)
704{
705 unsigned long long crash_size, crash_base;
706 unsigned long long total_mem;
707 int ret;
708
709 total_mem = get_total_mem();
710 ret = parse_crashkernel(boot_command_line, total_mem,
711 &crash_size, &crash_base);
712 if (ret)
713 return;
714
715 ret = reserve_bootmem(crash_base, crash_size, BOOTMEM_EXCLUSIVE);
716 if (ret < 0) {
717 printk(KERN_WARNING "crashkernel reservation failed - "
718 "memory is in use (0x%lx)\n", (unsigned long)crash_base);
719 return;
720 }
721
722 printk(KERN_INFO "Reserving %ldMB of memory at %ldMB "
723 "for crashkernel (System RAM: %ldMB)\n",
724 (unsigned long)(crash_size >> 20),
725 (unsigned long)(crash_base >> 20),
726 (unsigned long)(total_mem >> 20));
727
728 crashk_res.start = crash_base;
729 crashk_res.end = crash_base + crash_size - 1;
730 insert_resource(&iomem_resource, &crashk_res);
731}
732#else
733static inline void reserve_crashkernel(void) {}
734#endif /* CONFIG_KEXEC */
735
736/*
737 * Note: elfcorehdr_addr is not just limited to vmcore. It is also used by
738 * is_kdump_kernel() to determine if we are booting after a panic. Hence
739 * ifdef it under CONFIG_CRASH_DUMP and not CONFIG_PROC_VMCORE.
740 */
741
742#ifdef CONFIG_CRASH_DUMP
743/*
744 * elfcorehdr= specifies the location of elf core header stored by the crashed
745 * kernel. This option will be passed by kexec loader to the capture kernel.
746 */
747static int __init setup_elfcorehdr(char *arg)
748{
749 char *end;
750
751 if (!arg)
752 return -EINVAL;
753
754 elfcorehdr_addr = memparse(arg, &end);
755 return end > arg ? 0 : -EINVAL;
756}
757early_param("elfcorehdr", setup_elfcorehdr);
758#endif /* CONFIG_CRASH_DUMP */
759
760static void __init squash_mem_tags(struct tag *tag)
761{
762 for (; tag->hdr.size; tag = tag_next(tag))
763 if (tag->hdr.tag == ATAG_MEM)
764 tag->hdr.tag = ATAG_NONE;
765}
766
666void __init setup_arch(char **cmdline_p) 767void __init setup_arch(char **cmdline_p)
667{ 768{
668 struct tag *tags = (struct tag *)&init_tags; 769 struct tag *tags = (struct tag *)&init_tags;
@@ -683,12 +784,14 @@ void __init setup_arch(char **cmdline_p)
683 else if (mdesc->boot_params) 784 else if (mdesc->boot_params)
684 tags = phys_to_virt(mdesc->boot_params); 785 tags = phys_to_virt(mdesc->boot_params);
685 786
787#if defined(CONFIG_DEPRECATED_PARAM_STRUCT)
686 /* 788 /*
687 * If we have the old style parameters, convert them to 789 * If we have the old style parameters, convert them to
688 * a tag list. 790 * a tag list.
689 */ 791 */
690 if (tags->hdr.tag != ATAG_CORE) 792 if (tags->hdr.tag != ATAG_CORE)
691 convert_to_tag_list(tags); 793 convert_to_tag_list(tags);
794#endif
692 if (tags->hdr.tag != ATAG_CORE) 795 if (tags->hdr.tag != ATAG_CORE)
693 tags = (struct tag *)&init_tags; 796 tags = (struct tag *)&init_tags;
694 797
@@ -716,12 +819,15 @@ void __init setup_arch(char **cmdline_p)
716 819
717 parse_early_param(); 820 parse_early_param();
718 821
822 arm_memblock_init(&meminfo, mdesc);
823
719 paging_init(mdesc); 824 paging_init(mdesc);
720 request_standard_resources(&meminfo, mdesc); 825 request_standard_resources(&meminfo, mdesc);
721 826
722#ifdef CONFIG_SMP 827#ifdef CONFIG_SMP
723 smp_init_cpus(); 828 smp_init_cpus();
724#endif 829#endif
830 reserve_crashkernel();
725 831
726 cpu_init(); 832 cpu_init();
727 tcm_init(); 833 tcm_init();
@@ -729,6 +835,7 @@ void __init setup_arch(char **cmdline_p)
729 /* 835 /*
730 * Set up various architecture-specific pointers 836 * Set up various architecture-specific pointers
731 */ 837 */
838 arch_nr_irqs = mdesc->nr_irqs;
732 init_arch_irq = mdesc->init_irq; 839 init_arch_irq = mdesc->init_irq;
733 system_timer = mdesc->timer; 840 system_timer = mdesc->timer;
734 init_machine = mdesc->init_machine; 841 init_machine = mdesc->init_machine;
diff --git a/arch/arm/kernel/smp.c b/arch/arm/kernel/smp.c
index b8c3d0f689d9..40dc74f2b27f 100644
--- a/arch/arm/kernel/smp.c
+++ b/arch/arm/kernel/smp.c
@@ -429,7 +429,11 @@ static void smp_timer_broadcast(const struct cpumask *mask)
429{ 429{
430 send_ipi_message(mask, IPI_TIMER); 430 send_ipi_message(mask, IPI_TIMER);
431} 431}
432#else
433#define smp_timer_broadcast NULL
434#endif
432 435
436#ifndef CONFIG_LOCAL_TIMERS
433static void broadcast_timer_set_mode(enum clock_event_mode mode, 437static void broadcast_timer_set_mode(enum clock_event_mode mode,
434 struct clock_event_device *evt) 438 struct clock_event_device *evt)
435{ 439{
@@ -444,7 +448,6 @@ static void local_timer_setup(struct clock_event_device *evt)
444 evt->rating = 400; 448 evt->rating = 400;
445 evt->mult = 1; 449 evt->mult = 1;
446 evt->set_mode = broadcast_timer_set_mode; 450 evt->set_mode = broadcast_timer_set_mode;
447 evt->broadcast = smp_timer_broadcast;
448 451
449 clockevents_register_device(evt); 452 clockevents_register_device(evt);
450} 453}
@@ -456,6 +459,7 @@ void __cpuinit percpu_timer_setup(void)
456 struct clock_event_device *evt = &per_cpu(percpu_clockevent, cpu); 459 struct clock_event_device *evt = &per_cpu(percpu_clockevent, cpu);
457 460
458 evt->cpumask = cpumask_of(cpu); 461 evt->cpumask = cpumask_of(cpu);
462 evt->broadcast = smp_timer_broadcast;
459 463
460 local_timer_setup(evt); 464 local_timer_setup(evt);
461} 465}
@@ -467,10 +471,13 @@ static DEFINE_SPINLOCK(stop_lock);
467 */ 471 */
468static void ipi_cpu_stop(unsigned int cpu) 472static void ipi_cpu_stop(unsigned int cpu)
469{ 473{
470 spin_lock(&stop_lock); 474 if (system_state == SYSTEM_BOOTING ||
471 printk(KERN_CRIT "CPU%u: stopping\n", cpu); 475 system_state == SYSTEM_RUNNING) {
472 dump_stack(); 476 spin_lock(&stop_lock);
473 spin_unlock(&stop_lock); 477 printk(KERN_CRIT "CPU%u: stopping\n", cpu);
478 dump_stack();
479 spin_unlock(&stop_lock);
480 }
474 481
475 set_cpu_online(cpu, false); 482 set_cpu_online(cpu, false);
476 483
diff --git a/arch/arm/kernel/smp_twd.c b/arch/arm/kernel/smp_twd.c
index 7c5f0c024db7..35882fbf37f9 100644
--- a/arch/arm/kernel/smp_twd.c
+++ b/arch/arm/kernel/smp_twd.c
@@ -132,7 +132,8 @@ void __cpuinit twd_timer_setup(struct clock_event_device *clk)
132 twd_calibrate_rate(); 132 twd_calibrate_rate();
133 133
134 clk->name = "local_timer"; 134 clk->name = "local_timer";
135 clk->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT; 135 clk->features = CLOCK_EVT_FEAT_PERIODIC | CLOCK_EVT_FEAT_ONESHOT |
136 CLOCK_EVT_FEAT_C3STOP;
136 clk->rating = 350; 137 clk->rating = 350;
137 clk->set_mode = twd_set_mode; 138 clk->set_mode = twd_set_mode;
138 clk->set_next_event = twd_set_next_event; 139 clk->set_next_event = twd_set_next_event;
diff --git a/arch/arm/kernel/tcm.c b/arch/arm/kernel/tcm.c
index e50303868f1b..26685c2f7a49 100644
--- a/arch/arm/kernel/tcm.c
+++ b/arch/arm/kernel/tcm.c
@@ -13,38 +13,35 @@
13#include <linux/ioport.h> 13#include <linux/ioport.h>
14#include <linux/genalloc.h> 14#include <linux/genalloc.h>
15#include <linux/string.h> /* memcpy */ 15#include <linux/string.h> /* memcpy */
16#include <asm/page.h> /* PAGE_SHIFT */
17#include <asm/cputype.h> 16#include <asm/cputype.h>
18#include <asm/mach/map.h> 17#include <asm/mach/map.h>
19#include <mach/memory.h> 18#include <mach/memory.h>
20#include "tcm.h" 19#include "tcm.h"
21 20
22/* Scream and warn about misuse */
23#if !defined(ITCM_OFFSET) || !defined(ITCM_END) || \
24 !defined(DTCM_OFFSET) || !defined(DTCM_END)
25#error "TCM support selected but offsets not defined!"
26#endif
27
28static struct gen_pool *tcm_pool; 21static struct gen_pool *tcm_pool;
29 22
30/* TCM section definitions from the linker */ 23/* TCM section definitions from the linker */
31extern char __itcm_start, __sitcm_text, __eitcm_text; 24extern char __itcm_start, __sitcm_text, __eitcm_text;
32extern char __dtcm_start, __sdtcm_data, __edtcm_data; 25extern char __dtcm_start, __sdtcm_data, __edtcm_data;
33 26
27/* These will be increased as we run */
28u32 dtcm_end = DTCM_OFFSET;
29u32 itcm_end = ITCM_OFFSET;
30
34/* 31/*
35 * TCM memory resources 32 * TCM memory resources
36 */ 33 */
37static struct resource dtcm_res = { 34static struct resource dtcm_res = {
38 .name = "DTCM RAM", 35 .name = "DTCM RAM",
39 .start = DTCM_OFFSET, 36 .start = DTCM_OFFSET,
40 .end = DTCM_END, 37 .end = DTCM_OFFSET,
41 .flags = IORESOURCE_MEM 38 .flags = IORESOURCE_MEM
42}; 39};
43 40
44static struct resource itcm_res = { 41static struct resource itcm_res = {
45 .name = "ITCM RAM", 42 .name = "ITCM RAM",
46 .start = ITCM_OFFSET, 43 .start = ITCM_OFFSET,
47 .end = ITCM_END, 44 .end = ITCM_OFFSET,
48 .flags = IORESOURCE_MEM 45 .flags = IORESOURCE_MEM
49}; 46};
50 47
@@ -52,8 +49,8 @@ static struct map_desc dtcm_iomap[] __initdata = {
52 { 49 {
53 .virtual = DTCM_OFFSET, 50 .virtual = DTCM_OFFSET,
54 .pfn = __phys_to_pfn(DTCM_OFFSET), 51 .pfn = __phys_to_pfn(DTCM_OFFSET),
55 .length = (DTCM_END - DTCM_OFFSET + 1), 52 .length = 0,
56 .type = MT_UNCACHED 53 .type = MT_MEMORY_DTCM
57 } 54 }
58}; 55};
59 56
@@ -61,8 +58,8 @@ static struct map_desc itcm_iomap[] __initdata = {
61 { 58 {
62 .virtual = ITCM_OFFSET, 59 .virtual = ITCM_OFFSET,
63 .pfn = __phys_to_pfn(ITCM_OFFSET), 60 .pfn = __phys_to_pfn(ITCM_OFFSET),
64 .length = (ITCM_END - ITCM_OFFSET + 1), 61 .length = 0,
65 .type = MT_UNCACHED 62 .type = MT_MEMORY_ITCM
66 } 63 }
67}; 64};
68 65
@@ -93,14 +90,24 @@ void tcm_free(void *addr, size_t len)
93} 90}
94EXPORT_SYMBOL(tcm_free); 91EXPORT_SYMBOL(tcm_free);
95 92
96 93static int __init setup_tcm_bank(u8 type, u8 bank, u8 banks,
97static void __init setup_tcm_bank(u8 type, u32 offset, u32 expected_size) 94 u32 *offset)
98{ 95{
99 const int tcm_sizes[16] = { 0, -1, -1, 4, 8, 16, 32, 64, 128, 96 const int tcm_sizes[16] = { 0, -1, -1, 4, 8, 16, 32, 64, 128,
100 256, 512, 1024, -1, -1, -1, -1 }; 97 256, 512, 1024, -1, -1, -1, -1 };
101 u32 tcm_region; 98 u32 tcm_region;
102 int tcm_size; 99 int tcm_size;
103 100
101 /*
102 * If there are more than one TCM bank of this type,
103 * select the TCM bank to operate on in the TCM selection
104 * register.
105 */
106 if (banks > 1)
107 asm("mcr p15, 0, %0, c9, c2, 0"
108 : /* No output operands */
109 : "r" (bank));
110
104 /* Read the special TCM region register c9, 0 */ 111 /* Read the special TCM region register c9, 0 */
105 if (!type) 112 if (!type)
106 asm("mrc p15, 0, %0, c9, c1, 0" 113 asm("mrc p15, 0, %0, c9, c1, 0"
@@ -111,26 +118,24 @@ static void __init setup_tcm_bank(u8 type, u32 offset, u32 expected_size)
111 118
112 tcm_size = tcm_sizes[(tcm_region >> 2) & 0x0f]; 119 tcm_size = tcm_sizes[(tcm_region >> 2) & 0x0f];
113 if (tcm_size < 0) { 120 if (tcm_size < 0) {
114 pr_err("CPU: %sTCM of unknown size!\n", 121 pr_err("CPU: %sTCM%d of unknown size\n",
115 type ? "I" : "D"); 122 type ? "I" : "D", bank);
123 return -EINVAL;
124 } else if (tcm_size > 32) {
125 pr_err("CPU: %sTCM%d larger than 32k found\n",
126 type ? "I" : "D", bank);
127 return -EINVAL;
116 } else { 128 } else {
117 pr_info("CPU: found %sTCM %dk @ %08x, %senabled\n", 129 pr_info("CPU: found %sTCM%d %dk @ %08x, %senabled\n",
118 type ? "I" : "D", 130 type ? "I" : "D",
131 bank,
119 tcm_size, 132 tcm_size,
120 (tcm_region & 0xfffff000U), 133 (tcm_region & 0xfffff000U),
121 (tcm_region & 1) ? "" : "not "); 134 (tcm_region & 1) ? "" : "not ");
122 } 135 }
123 136
124 if (tcm_size != expected_size) {
125 pr_crit("CPU: %sTCM was detected %dk but expected %dk!\n",
126 type ? "I" : "D",
127 tcm_size,
128 expected_size);
129 /* Adjust to the expected size? what can we do... */
130 }
131
132 /* Force move the TCM bank to where we want it, enable */ 137 /* Force move the TCM bank to where we want it, enable */
133 tcm_region = offset | (tcm_region & 0x00000ffeU) | 1; 138 tcm_region = *offset | (tcm_region & 0x00000ffeU) | 1;
134 139
135 if (!type) 140 if (!type)
136 asm("mcr p15, 0, %0, c9, c1, 0" 141 asm("mcr p15, 0, %0, c9, c1, 0"
@@ -141,10 +146,15 @@ static void __init setup_tcm_bank(u8 type, u32 offset, u32 expected_size)
141 : /* No output operands */ 146 : /* No output operands */
142 : "r" (tcm_region)); 147 : "r" (tcm_region));
143 148
144 pr_debug("CPU: moved %sTCM %dk to %08x, enabled\n", 149 /* Increase offset */
145 type ? "I" : "D", 150 *offset += (tcm_size << 10);
146 tcm_size, 151
147 (tcm_region & 0xfffff000U)); 152 pr_info("CPU: moved %sTCM%d %dk to %08x, enabled\n",
153 type ? "I" : "D",
154 bank,
155 tcm_size,
156 (tcm_region & 0xfffff000U));
157 return 0;
148} 158}
149 159
150/* 160/*
@@ -153,34 +163,52 @@ static void __init setup_tcm_bank(u8 type, u32 offset, u32 expected_size)
153void __init tcm_init(void) 163void __init tcm_init(void)
154{ 164{
155 u32 tcm_status = read_cpuid_tcmstatus(); 165 u32 tcm_status = read_cpuid_tcmstatus();
166 u8 dtcm_banks = (tcm_status >> 16) & 0x03;
167 u8 itcm_banks = (tcm_status & 0x03);
156 char *start; 168 char *start;
157 char *end; 169 char *end;
158 char *ram; 170 char *ram;
171 int ret;
172 int i;
159 173
160 /* Setup DTCM if present */ 174 /* Setup DTCM if present */
161 if (tcm_status & (1 << 16)) { 175 if (dtcm_banks > 0) {
162 setup_tcm_bank(0, DTCM_OFFSET, 176 for (i = 0; i < dtcm_banks; i++) {
163 (DTCM_END - DTCM_OFFSET + 1) >> 10); 177 ret = setup_tcm_bank(0, i, dtcm_banks, &dtcm_end);
178 if (ret)
179 return;
180 }
181 dtcm_res.end = dtcm_end - 1;
164 request_resource(&iomem_resource, &dtcm_res); 182 request_resource(&iomem_resource, &dtcm_res);
183 dtcm_iomap[0].length = dtcm_end - DTCM_OFFSET;
165 iotable_init(dtcm_iomap, 1); 184 iotable_init(dtcm_iomap, 1);
166 /* Copy data from RAM to DTCM */ 185 /* Copy data from RAM to DTCM */
167 start = &__sdtcm_data; 186 start = &__sdtcm_data;
168 end = &__edtcm_data; 187 end = &__edtcm_data;
169 ram = &__dtcm_start; 188 ram = &__dtcm_start;
189 /* This means you compiled more code than fits into DTCM */
190 BUG_ON((end - start) > (dtcm_end - DTCM_OFFSET));
170 memcpy(start, ram, (end-start)); 191 memcpy(start, ram, (end-start));
171 pr_debug("CPU DTCM: copied data from %p - %p\n", start, end); 192 pr_debug("CPU DTCM: copied data from %p - %p\n", start, end);
172 } 193 }
173 194
174 /* Setup ITCM if present */ 195 /* Setup ITCM if present */
175 if (tcm_status & 1) { 196 if (itcm_banks > 0) {
176 setup_tcm_bank(1, ITCM_OFFSET, 197 for (i = 0; i < itcm_banks; i++) {
177 (ITCM_END - ITCM_OFFSET + 1) >> 10); 198 ret = setup_tcm_bank(1, i, itcm_banks, &itcm_end);
199 if (ret)
200 return;
201 }
202 itcm_res.end = itcm_end - 1;
178 request_resource(&iomem_resource, &itcm_res); 203 request_resource(&iomem_resource, &itcm_res);
204 itcm_iomap[0].length = itcm_end - ITCM_OFFSET;
179 iotable_init(itcm_iomap, 1); 205 iotable_init(itcm_iomap, 1);
180 /* Copy code from RAM to ITCM */ 206 /* Copy code from RAM to ITCM */
181 start = &__sitcm_text; 207 start = &__sitcm_text;
182 end = &__eitcm_text; 208 end = &__eitcm_text;
183 ram = &__itcm_start; 209 ram = &__itcm_start;
210 /* This means you compiled more code than fits into ITCM */
211 BUG_ON((end - start) > (itcm_end - ITCM_OFFSET));
184 memcpy(start, ram, (end-start)); 212 memcpy(start, ram, (end-start));
185 pr_debug("CPU ITCM: copied code from %p - %p\n", start, end); 213 pr_debug("CPU ITCM: copied code from %p - %p\n", start, end);
186 } 214 }
@@ -208,10 +236,10 @@ static int __init setup_tcm_pool(void)
208 pr_debug("Setting up TCM memory pool\n"); 236 pr_debug("Setting up TCM memory pool\n");
209 237
210 /* Add the rest of DTCM to the TCM pool */ 238 /* Add the rest of DTCM to the TCM pool */
211 if (tcm_status & (1 << 16)) { 239 if (tcm_status & (0x03 << 16)) {
212 if (dtcm_pool_start < DTCM_END) { 240 if (dtcm_pool_start < dtcm_end) {
213 ret = gen_pool_add(tcm_pool, dtcm_pool_start, 241 ret = gen_pool_add(tcm_pool, dtcm_pool_start,
214 DTCM_END - dtcm_pool_start + 1, -1); 242 dtcm_end - dtcm_pool_start, -1);
215 if (ret) { 243 if (ret) {
216 pr_err("CPU DTCM: could not add DTCM " \ 244 pr_err("CPU DTCM: could not add DTCM " \
217 "remainder to pool!\n"); 245 "remainder to pool!\n");
@@ -219,16 +247,16 @@ static int __init setup_tcm_pool(void)
219 } 247 }
220 pr_debug("CPU DTCM: Added %08x bytes @ %08x to " \ 248 pr_debug("CPU DTCM: Added %08x bytes @ %08x to " \
221 "the TCM memory pool\n", 249 "the TCM memory pool\n",
222 DTCM_END - dtcm_pool_start + 1, 250 dtcm_end - dtcm_pool_start,
223 dtcm_pool_start); 251 dtcm_pool_start);
224 } 252 }
225 } 253 }
226 254
227 /* Add the rest of ITCM to the TCM pool */ 255 /* Add the rest of ITCM to the TCM pool */
228 if (tcm_status & 1) { 256 if (tcm_status & 0x03) {
229 if (itcm_pool_start < ITCM_END) { 257 if (itcm_pool_start < itcm_end) {
230 ret = gen_pool_add(tcm_pool, itcm_pool_start, 258 ret = gen_pool_add(tcm_pool, itcm_pool_start,
231 ITCM_END - itcm_pool_start + 1, -1); 259 itcm_end - itcm_pool_start, -1);
232 if (ret) { 260 if (ret) {
233 pr_err("CPU ITCM: could not add ITCM " \ 261 pr_err("CPU ITCM: could not add ITCM " \
234 "remainder to pool!\n"); 262 "remainder to pool!\n");
@@ -236,7 +264,7 @@ static int __init setup_tcm_pool(void)
236 } 264 }
237 pr_debug("CPU ITCM: Added %08x bytes @ %08x to " \ 265 pr_debug("CPU ITCM: Added %08x bytes @ %08x to " \
238 "the TCM memory pool\n", 266 "the TCM memory pool\n",
239 ITCM_END - itcm_pool_start + 1, 267 itcm_end - itcm_pool_start,
240 itcm_pool_start); 268 itcm_pool_start);
241 } 269 }
242 } 270 }
diff --git a/arch/arm/kernel/traps.c b/arch/arm/kernel/traps.c
index 1621e5327b2a..cda78d59aa31 100644
--- a/arch/arm/kernel/traps.c
+++ b/arch/arm/kernel/traps.c
@@ -30,6 +30,7 @@
30#include <asm/unistd.h> 30#include <asm/unistd.h>
31#include <asm/traps.h> 31#include <asm/traps.h>
32#include <asm/unwind.h> 32#include <asm/unwind.h>
33#include <asm/tls.h>
33 34
34#include "ptrace.h" 35#include "ptrace.h"
35#include "signal.h" 36#include "signal.h"
@@ -518,17 +519,20 @@ asmlinkage int arm_syscall(int no, struct pt_regs *regs)
518 519
519 case NR(set_tls): 520 case NR(set_tls):
520 thread->tp_value = regs->ARM_r0; 521 thread->tp_value = regs->ARM_r0;
521#if defined(CONFIG_HAS_TLS_REG) 522 if (tls_emu)
522 asm ("mcr p15, 0, %0, c13, c0, 3" : : "r" (regs->ARM_r0) ); 523 return 0;
523#elif !defined(CONFIG_TLS_REG_EMUL) 524 if (has_tls_reg) {
524 /* 525 asm ("mcr p15, 0, %0, c13, c0, 3"
525 * User space must never try to access this directly. 526 : : "r" (regs->ARM_r0));
526 * Expect your app to break eventually if you do so. 527 } else {
527 * The user helper at 0xffff0fe0 must be used instead. 528 /*
528 * (see entry-armv.S for details) 529 * User space must never try to access this directly.
529 */ 530 * Expect your app to break eventually if you do so.
530 *((unsigned int *)0xffff0ff0) = regs->ARM_r0; 531 * The user helper at 0xffff0fe0 must be used instead.
531#endif 532 * (see entry-armv.S for details)
533 */
534 *((unsigned int *)0xffff0ff0) = regs->ARM_r0;
535 }
532 return 0; 536 return 0;
533 537
534#ifdef CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG 538#ifdef CONFIG_NEEDS_SYSCALL_FOR_CMPXCHG
@@ -743,6 +747,16 @@ void __init trap_init(void)
743 return; 747 return;
744} 748}
745 749
750static void __init kuser_get_tls_init(unsigned long vectors)
751{
752 /*
753 * vectors + 0xfe0 = __kuser_get_tls
754 * vectors + 0xfe8 = hardware TLS instruction at 0xffff0fe8
755 */
756 if (tls_emu || has_tls_reg)
757 memcpy((void *)vectors + 0xfe0, (void *)vectors + 0xfe8, 4);
758}
759
746void __init early_trap_init(void) 760void __init early_trap_init(void)
747{ 761{
748 unsigned long vectors = CONFIG_VECTORS_BASE; 762 unsigned long vectors = CONFIG_VECTORS_BASE;
@@ -761,6 +775,11 @@ void __init early_trap_init(void)
761 memcpy((void *)vectors + 0x1000 - kuser_sz, __kuser_helper_start, kuser_sz); 775 memcpy((void *)vectors + 0x1000 - kuser_sz, __kuser_helper_start, kuser_sz);
762 776
763 /* 777 /*
778 * Do processor specific fixups for the kuser helpers
779 */
780 kuser_get_tls_init(vectors);
781
782 /*
764 * Copy signal return handlers into the vector page, and 783 * Copy signal return handlers into the vector page, and
765 * set sigreturn to be a pointer to these. 784 * set sigreturn to be a pointer to these.
766 */ 785 */
diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile
index 030ba7219f48..59ff42ddf0ae 100644
--- a/arch/arm/lib/Makefile
+++ b/arch/arm/lib/Makefile
@@ -41,7 +41,6 @@ else
41endif 41endif
42 42
43lib-$(CONFIG_ARCH_RPC) += ecard.o io-acorn.o floppydma.o 43lib-$(CONFIG_ARCH_RPC) += ecard.o io-acorn.o floppydma.o
44lib-$(CONFIG_ARCH_L7200) += io-acorn.o
45lib-$(CONFIG_ARCH_SHARK) += io-shark.o 44lib-$(CONFIG_ARCH_SHARK) += io-shark.o
46 45
47$(obj)/csumpartialcopy.o: $(obj)/csumpartialcopygeneric.S 46$(obj)/csumpartialcopy.o: $(obj)/csumpartialcopygeneric.S
diff --git a/arch/arm/lib/csumpartialcopyuser.S b/arch/arm/lib/csumpartialcopyuser.S
index 59ff6fdc1e63..7d08b43d2c0e 100644
--- a/arch/arm/lib/csumpartialcopyuser.S
+++ b/arch/arm/lib/csumpartialcopyuser.S
@@ -71,7 +71,7 @@
71 .pushsection .fixup,"ax" 71 .pushsection .fixup,"ax"
72 .align 4 72 .align 4
739001: mov r4, #-EFAULT 739001: mov r4, #-EFAULT
74 ldr r5, [fp, #4] @ *err_ptr 74 ldr r5, [sp, #8*4] @ *err_ptr
75 str r4, [r5] 75 str r4, [r5]
76 ldmia sp, {r1, r2} @ retrieve dst, len 76 ldmia sp, {r1, r2} @ retrieve dst, len
77 add r2, r2, r1 77 add r2, r2, r1
diff --git a/arch/arm/mach-aaec2000/include/mach/memory.h b/arch/arm/mach-aaec2000/include/mach/memory.h
index c00822543d9f..4f93c567a35a 100644
--- a/arch/arm/mach-aaec2000/include/mach/memory.h
+++ b/arch/arm/mach-aaec2000/include/mach/memory.h
@@ -14,14 +14,4 @@
14 14
15#define PHYS_OFFSET UL(0xf0000000) 15#define PHYS_OFFSET UL(0xf0000000)
16 16
17/*
18 * The nodes are the followings:
19 *
20 * node 0: 0xf000.0000 - 0xf3ff.ffff
21 * node 1: 0xf400.0000 - 0xf7ff.ffff
22 * node 2: 0xf800.0000 - 0xfbff.ffff
23 * node 3: 0xfc00.0000 - 0xffff.ffff
24 */
25#define NODE_MEM_SIZE_BITS 26
26
27#endif /* __ASM_ARCH_MEMORY_H */ 17#endif /* __ASM_ARCH_MEMORY_H */
diff --git a/arch/arm/mach-at91/Kconfig b/arch/arm/mach-at91/Kconfig
index 841eaf8f27e2..939bccd70569 100644
--- a/arch/arm/mach-at91/Kconfig
+++ b/arch/arm/mach-at91/Kconfig
@@ -366,6 +366,17 @@ config MACH_STAMP9G20
366 366
367endif 367endif
368 368
369if (ARCH_AT91SAM9260 || ARCH_AT91SAM9G20)
370comment "AT91SAM9260/AT91SAM9G20 boards"
371
372config MACH_SNAPPER_9260
373 bool "Bluewater Systems Snapper 9260/9G20 module"
374 help
375 Select this if you are using the Bluewater Systems Snapper 9260 or
376 Snapper 9G20 modules.
377 <http://www.bluewatersys.com/>
378endif
379
369# ---------------------------------------------------------- 380# ----------------------------------------------------------
370 381
371if ARCH_AT91SAM9G45 382if ARCH_AT91SAM9G45
diff --git a/arch/arm/mach-at91/Makefile b/arch/arm/mach-at91/Makefile
index c1f821e58222..ca2ac003f41f 100644
--- a/arch/arm/mach-at91/Makefile
+++ b/arch/arm/mach-at91/Makefile
@@ -66,6 +66,9 @@ obj-$(CONFIG_MACH_CPU9G20) += board-cpu9krea.o
66obj-$(CONFIG_MACH_STAMP9G20) += board-stamp9g20.o 66obj-$(CONFIG_MACH_STAMP9G20) += board-stamp9g20.o
67obj-$(CONFIG_MACH_PORTUXG20) += board-stamp9g20.o 67obj-$(CONFIG_MACH_PORTUXG20) += board-stamp9g20.o
68 68
69# AT91SAM9260/AT91SAM9G20 board-specific support
70obj-$(CONFIG_MACH_SNAPPER_9260) += board-snapper9260.o
71
69# AT91SAM9G45 board-specific support 72# AT91SAM9G45 board-specific support
70obj-$(CONFIG_MACH_AT91SAM9G45EKES) += board-sam9m10g45ek.o 73obj-$(CONFIG_MACH_AT91SAM9G45EKES) += board-sam9m10g45ek.o
71 74
diff --git a/arch/arm/mach-at91/at91sam9g45.c b/arch/arm/mach-at91/at91sam9g45.c
index 85166b7e69a1..753c0d31a3d3 100644
--- a/arch/arm/mach-at91/at91sam9g45.c
+++ b/arch/arm/mach-at91/at91sam9g45.c
@@ -20,6 +20,7 @@
20#include <mach/at91_pmc.h> 20#include <mach/at91_pmc.h>
21#include <mach/at91_rstc.h> 21#include <mach/at91_rstc.h>
22#include <mach/at91_shdwc.h> 22#include <mach/at91_shdwc.h>
23#include <mach/cpu.h>
23 24
24#include "generic.h" 25#include "generic.h"
25#include "clock.h" 26#include "clock.h"
@@ -176,6 +177,13 @@ static struct clk mmc1_clk = {
176 .type = CLK_TYPE_PERIPHERAL, 177 .type = CLK_TYPE_PERIPHERAL,
177}; 178};
178 179
180/* Video decoder clock - Only for sam9m10/sam9m11 */
181static struct clk vdec_clk = {
182 .name = "vdec_clk",
183 .pmc_mask = 1 << AT91SAM9G45_ID_VDEC,
184 .type = CLK_TYPE_PERIPHERAL,
185};
186
179/* One additional fake clock for ohci */ 187/* One additional fake clock for ohci */
180static struct clk ohci_clk = { 188static struct clk ohci_clk = {
181 .name = "ohci_clk", 189 .name = "ohci_clk",
@@ -239,6 +247,9 @@ static void __init at91sam9g45_register_clocks(void)
239 for (i = 0; i < ARRAY_SIZE(periph_clocks); i++) 247 for (i = 0; i < ARRAY_SIZE(periph_clocks); i++)
240 clk_register(periph_clocks[i]); 248 clk_register(periph_clocks[i]);
241 249
250 if (cpu_is_at91sam9m10() || cpu_is_at91sam9m11())
251 clk_register(&vdec_clk);
252
242 clk_register(&pck0); 253 clk_register(&pck0);
243 clk_register(&pck1); 254 clk_register(&pck1);
244} 255}
diff --git a/arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c b/arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c
index a4102d72cc9b..c49f5c003ee1 100644
--- a/arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c
+++ b/arch/arm/mach-at91/board-sam9g20ek-2slot-mmc.c
@@ -26,6 +26,9 @@
26#include <linux/spi/spi.h> 26#include <linux/spi/spi.h>
27#include <linux/spi/at73c213.h> 27#include <linux/spi/at73c213.h>
28#include <linux/clk.h> 28#include <linux/clk.h>
29#include <linux/regulator/machine.h>
30#include <linux/regulator/fixed.h>
31#include <linux/regulator/consumer.h>
29 32
30#include <mach/hardware.h> 33#include <mach/hardware.h>
31#include <asm/setup.h> 34#include <asm/setup.h>
@@ -235,6 +238,46 @@ static struct gpio_led ek_leds[] = {
235 } 238 }
236}; 239};
237 240
241#if defined(CONFIG_REGULATOR_FIXED_VOLTAGE) || defined(CONFIG_REGULATOR_FIXED_VOLTAGE_MODULE)
242static struct regulator_consumer_supply ek_audio_consumer_supplies[] = {
243 REGULATOR_SUPPLY("AVDD", "0-001b"),
244 REGULATOR_SUPPLY("HPVDD", "0-001b"),
245 REGULATOR_SUPPLY("DBVDD", "0-001b"),
246 REGULATOR_SUPPLY("DCVDD", "0-001b"),
247};
248
249static struct regulator_init_data ek_avdd_reg_init_data = {
250 .constraints = {
251 .name = "3V3",
252 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
253 },
254 .consumer_supplies = ek_audio_consumer_supplies,
255 .num_consumer_supplies = ARRAY_SIZE(ek_audio_consumer_supplies),
256};
257
258static struct fixed_voltage_config ek_vdd_pdata = {
259 .supply_name = "board-3V3",
260 .microvolts = 3300000,
261 .gpio = -EINVAL,
262 .enabled_at_boot = 0,
263 .init_data = &ek_avdd_reg_init_data,
264};
265static struct platform_device ek_voltage_regulator = {
266 .name = "reg-fixed-voltage",
267 .id = -1,
268 .num_resources = 0,
269 .dev = {
270 .platform_data = &ek_vdd_pdata,
271 },
272};
273static void __init ek_add_regulators(void)
274{
275 platform_device_register(&ek_voltage_regulator);
276}
277#else
278static void __init ek_add_regulators(void) {}
279#endif
280
238static struct i2c_board_info __initdata ek_i2c_devices[] = { 281static struct i2c_board_info __initdata ek_i2c_devices[] = {
239 { 282 {
240 I2C_BOARD_INFO("24c512", 0x50), 283 I2C_BOARD_INFO("24c512", 0x50),
@@ -256,6 +299,8 @@ static void __init ek_board_init(void)
256 ek_add_device_nand(); 299 ek_add_device_nand();
257 /* Ethernet */ 300 /* Ethernet */
258 at91_add_device_eth(&ek_macb_data); 301 at91_add_device_eth(&ek_macb_data);
302 /* Regulators */
303 ek_add_regulators();
259 /* MMC */ 304 /* MMC */
260#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE) 305#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE)
261 at91_add_device_mci(0, &ek_mmc_data); 306 at91_add_device_mci(0, &ek_mmc_data);
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index c11fd47aec5d..6ea9808b8868 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -27,6 +27,9 @@
27#include <linux/gpio_keys.h> 27#include <linux/gpio_keys.h>
28#include <linux/input.h> 28#include <linux/input.h>
29#include <linux/clk.h> 29#include <linux/clk.h>
30#include <linux/regulator/machine.h>
31#include <linux/regulator/fixed.h>
32#include <linux/regulator/consumer.h>
30 33
31#include <mach/hardware.h> 34#include <mach/hardware.h>
32#include <asm/setup.h> 35#include <asm/setup.h>
@@ -269,6 +272,46 @@ static void __init ek_add_device_buttons(void)
269static void __init ek_add_device_buttons(void) {} 272static void __init ek_add_device_buttons(void) {}
270#endif 273#endif
271 274
275#if defined(CONFIG_REGULATOR_FIXED_VOLTAGE) || defined(CONFIG_REGULATOR_FIXED_VOLTAGE_MODULE)
276static struct regulator_consumer_supply ek_audio_consumer_supplies[] = {
277 REGULATOR_SUPPLY("AVDD", "0-001b"),
278 REGULATOR_SUPPLY("HPVDD", "0-001b"),
279 REGULATOR_SUPPLY("DBVDD", "0-001b"),
280 REGULATOR_SUPPLY("DCVDD", "0-001b"),
281};
282
283static struct regulator_init_data ek_avdd_reg_init_data = {
284 .constraints = {
285 .name = "3V3",
286 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
287 },
288 .consumer_supplies = ek_audio_consumer_supplies,
289 .num_consumer_supplies = ARRAY_SIZE(ek_audio_consumer_supplies),
290};
291
292static struct fixed_voltage_config ek_vdd_pdata = {
293 .supply_name = "board-3V3",
294 .microvolts = 3300000,
295 .gpio = -EINVAL,
296 .enabled_at_boot = 0,
297 .init_data = &ek_avdd_reg_init_data,
298};
299static struct platform_device ek_voltage_regulator = {
300 .name = "reg-fixed-voltage",
301 .id = -1,
302 .num_resources = 0,
303 .dev = {
304 .platform_data = &ek_vdd_pdata,
305 },
306};
307static void __init ek_add_regulators(void)
308{
309 platform_device_register(&ek_voltage_regulator);
310}
311#else
312static void __init ek_add_regulators(void) {}
313#endif
314
272 315
273static struct i2c_board_info __initdata ek_i2c_devices[] = { 316static struct i2c_board_info __initdata ek_i2c_devices[] = {
274 { 317 {
@@ -294,6 +337,8 @@ static void __init ek_board_init(void)
294 ek_add_device_nand(); 337 ek_add_device_nand();
295 /* Ethernet */ 338 /* Ethernet */
296 at91_add_device_eth(&ek_macb_data); 339 at91_add_device_eth(&ek_macb_data);
340 /* Regulators */
341 ek_add_regulators();
297 /* MMC */ 342 /* MMC */
298 at91_add_device_mmc(0, &ek_mmc_data); 343 at91_add_device_mmc(0, &ek_mmc_data);
299 /* I2C */ 344 /* I2C */
diff --git a/arch/arm/mach-at91/board-snapper9260.c b/arch/arm/mach-at91/board-snapper9260.c
new file mode 100644
index 000000000000..2c08ae4ad3a1
--- /dev/null
+++ b/arch/arm/mach-at91/board-snapper9260.c
@@ -0,0 +1,189 @@
1/*
2 * linux/arch/arm/mach-at91/board-snapper9260.c
3 *
4 * Copyright (C) 2010 Bluewater System Ltd
5 *
6 * Author: Andre Renaud <andre@bluewatersys.com>
7 * Author: Ryan Mallon <ryan@bluewatersys.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */
24
25#include <linux/init.h>
26#include <linux/gpio.h>
27#include <linux/platform_device.h>
28#include <linux/spi/spi.h>
29#include <linux/i2c/pca953x.h>
30
31#include <asm/mach-types.h>
32#include <asm/mach/arch.h>
33
34#include <mach/hardware.h>
35#include <mach/board.h>
36#include <mach/at91sam9_smc.h>
37
38#include "sam9_smc.h"
39#include "generic.h"
40
41#define SNAPPER9260_IO_EXP_GPIO(x) (NR_BUILTIN_GPIO + (x))
42
43static void __init snapper9260_map_io(void)
44{
45 at91sam9260_initialize(18432000);
46
47 /* Debug on ttyS0 */
48 at91_register_uart(0, 0, 0);
49 at91_set_serial_console(0);
50
51 at91_register_uart(AT91SAM9260_ID_US0, 1,
52 ATMEL_UART_CTS | ATMEL_UART_RTS);
53 at91_register_uart(AT91SAM9260_ID_US1, 2,
54 ATMEL_UART_CTS | ATMEL_UART_RTS);
55 at91_register_uart(AT91SAM9260_ID_US2, 3, 0);
56}
57
58static void __init snapper9260_init_irq(void)
59{
60 at91sam9260_init_interrupts(NULL);
61}
62
63static struct at91_usbh_data __initdata snapper9260_usbh_data = {
64 .ports = 2,
65};
66
67static struct at91_udc_data __initdata snapper9260_udc_data = {
68 .vbus_pin = SNAPPER9260_IO_EXP_GPIO(5),
69 .vbus_active_low = 1,
70 .vbus_polled = 1,
71};
72
73static struct at91_eth_data snapper9260_macb_data = {
74 .is_rmii = 1,
75};
76
77static struct mtd_partition __initdata snapper9260_nand_partitions[] = {
78 {
79 .name = "Preboot",
80 .offset = 0,
81 .size = SZ_128K,
82 },
83 {
84 .name = "Bootloader",
85 .offset = MTDPART_OFS_APPEND,
86 .size = SZ_256K,
87 },
88 {
89 .name = "Environment",
90 .offset = MTDPART_OFS_APPEND,
91 .size = SZ_128K,
92 },
93 {
94 .name = "Kernel",
95 .offset = MTDPART_OFS_APPEND,
96 .size = SZ_4M,
97 },
98 {
99 .name = "Filesystem",
100 .offset = MTDPART_OFS_APPEND,
101 .size = MTDPART_SIZ_FULL,
102 },
103};
104
105static struct mtd_partition * __init
106snapper9260_nand_partition_info(int size, int *num_partitions)
107{
108 *num_partitions = ARRAY_SIZE(snapper9260_nand_partitions);
109 return snapper9260_nand_partitions;
110}
111
112static struct atmel_nand_data __initdata snapper9260_nand_data = {
113 .ale = 21,
114 .cle = 22,
115 .rdy_pin = AT91_PIN_PC13,
116 .partition_info = snapper9260_nand_partition_info,
117 .bus_width_16 = 0,
118};
119
120static struct sam9_smc_config __initdata snapper9260_nand_smc_config = {
121 .ncs_read_setup = 0,
122 .nrd_setup = 0,
123 .ncs_write_setup = 0,
124 .nwe_setup = 0,
125
126 .ncs_read_pulse = 5,
127 .nrd_pulse = 2,
128 .ncs_write_pulse = 5,
129 .nwe_pulse = 2,
130
131 .read_cycle = 7,
132 .write_cycle = 7,
133
134 .mode = (AT91_SMC_READMODE | AT91_SMC_WRITEMODE |
135 AT91_SMC_EXNWMODE_DISABLE),
136 .tdf_cycles = 1,
137};
138
139static struct pca953x_platform_data snapper9260_io_expander_data = {
140 .gpio_base = SNAPPER9260_IO_EXP_GPIO(0),
141};
142
143static struct i2c_board_info __initdata snapper9260_i2c_devices[] = {
144 {
145 /* IO expander */
146 I2C_BOARD_INFO("max7312", 0x28),
147 .platform_data = &snapper9260_io_expander_data,
148 },
149 {
150 /* Audio codec */
151 I2C_BOARD_INFO("tlv320aic23", 0x1a),
152 },
153 {
154 /* RTC */
155 I2C_BOARD_INFO("isl1208", 0x6f),
156 },
157};
158
159static void __init snapper9260_add_device_nand(void)
160{
161 at91_set_A_periph(AT91_PIN_PC14, 0);
162 sam9_smc_configure(3, &snapper9260_nand_smc_config);
163 at91_add_device_nand(&snapper9260_nand_data);
164}
165
166static void __init snapper9260_board_init(void)
167{
168 at91_add_device_i2c(snapper9260_i2c_devices,
169 ARRAY_SIZE(snapper9260_i2c_devices));
170 at91_add_device_serial();
171 at91_add_device_usbh(&snapper9260_usbh_data);
172 at91_add_device_udc(&snapper9260_udc_data);
173 at91_add_device_eth(&snapper9260_macb_data);
174 at91_add_device_ssc(AT91SAM9260_ID_SSC, (ATMEL_SSC_TF | ATMEL_SSC_TK |
175 ATMEL_SSC_TD | ATMEL_SSC_RD));
176 snapper9260_add_device_nand();
177}
178
179MACHINE_START(SNAPPER_9260, "Bluewater Systems Snapper 9260/9G20 module")
180 .phys_io = AT91_BASE_SYS,
181 .io_pg_offst = (AT91_VA_BASE_SYS >> 18) & 0xfffc,
182 .boot_params = AT91_SDRAM_BASE + 0x100,
183 .timer = &at91sam926x_timer,
184 .map_io = snapper9260_map_io,
185 .init_irq = snapper9260_init_irq,
186 .init_machine = snapper9260_board_init,
187MACHINE_END
188
189
diff --git a/arch/arm/mach-at91/include/mach/at91cap9.h b/arch/arm/mach-at91/include/mach/at91cap9.h
index d8c1ededaa75..9c6af9737485 100644
--- a/arch/arm/mach-at91/include/mach/at91cap9.h
+++ b/arch/arm/mach-at91/include/mach/at91cap9.h
@@ -84,7 +84,7 @@
84 */ 84 */
85#define AT91_ECC (0xffffe200 - AT91_BASE_SYS) 85#define AT91_ECC (0xffffe200 - AT91_BASE_SYS)
86#define AT91_BCRAMC (0xffffe400 - AT91_BASE_SYS) 86#define AT91_BCRAMC (0xffffe400 - AT91_BASE_SYS)
87#define AT91_DDRSDRC (0xffffe600 - AT91_BASE_SYS) 87#define AT91_DDRSDRC0 (0xffffe600 - AT91_BASE_SYS)
88#define AT91_SMC (0xffffe800 - AT91_BASE_SYS) 88#define AT91_SMC (0xffffe800 - AT91_BASE_SYS)
89#define AT91_MATRIX (0xffffea00 - AT91_BASE_SYS) 89#define AT91_MATRIX (0xffffea00 - AT91_BASE_SYS)
90#define AT91_CCFG (0xffffeb10 - AT91_BASE_SYS) 90#define AT91_CCFG (0xffffeb10 - AT91_BASE_SYS)
diff --git a/arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h b/arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h
index 1499b1cbffdd..976f4a6c3353 100644
--- a/arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h
+++ b/arch/arm/mach-at91/include/mach/at91cap9_ddrsdr.h
@@ -15,7 +15,7 @@
15#ifndef AT91CAP9_DDRSDR_H 15#ifndef AT91CAP9_DDRSDR_H
16#define AT91CAP9_DDRSDR_H 16#define AT91CAP9_DDRSDR_H
17 17
18#define AT91_DDRSDRC_MR (AT91_DDRSDRC + 0x00) /* Mode Register */ 18#define AT91_DDRSDRC_MR 0x00 /* Mode Register */
19#define AT91_DDRSDRC_MODE (0xf << 0) /* Command Mode */ 19#define AT91_DDRSDRC_MODE (0xf << 0) /* Command Mode */
20#define AT91_DDRSDRC_MODE_NORMAL 0 20#define AT91_DDRSDRC_MODE_NORMAL 0
21#define AT91_DDRSDRC_MODE_NOP 1 21#define AT91_DDRSDRC_MODE_NOP 1
@@ -25,10 +25,10 @@
25#define AT91_DDRSDRC_MODE_EXT_LMR 5 25#define AT91_DDRSDRC_MODE_EXT_LMR 5
26#define AT91_DDRSDRC_MODE_DEEP 6 26#define AT91_DDRSDRC_MODE_DEEP 6
27 27
28#define AT91_DDRSDRC_RTR (AT91_DDRSDRC + 0x04) /* Refresh Timer Register */ 28#define AT91_DDRSDRC_RTR 0x04 /* Refresh Timer Register */
29#define AT91_DDRSDRC_COUNT (0xfff << 0) /* Refresh Timer Counter */ 29#define AT91_DDRSDRC_COUNT (0xfff << 0) /* Refresh Timer Counter */
30 30
31#define AT91_DDRSDRC_CR (AT91_DDRSDRC + 0x08) /* Configuration Register */ 31#define AT91_DDRSDRC_CR 0x08 /* Configuration Register */
32#define AT91_DDRSDRC_NC (3 << 0) /* Number of Column Bits */ 32#define AT91_DDRSDRC_NC (3 << 0) /* Number of Column Bits */
33#define AT91_DDRSDRC_NC_SDR8 (0 << 0) 33#define AT91_DDRSDRC_NC_SDR8 (0 << 0)
34#define AT91_DDRSDRC_NC_SDR9 (1 << 0) 34#define AT91_DDRSDRC_NC_SDR9 (1 << 0)
@@ -49,7 +49,7 @@
49#define AT91_DDRSDRC_DLL (1 << 7) /* Reset DLL */ 49#define AT91_DDRSDRC_DLL (1 << 7) /* Reset DLL */
50#define AT91_DDRSDRC_DICDS (1 << 8) /* Output impedance control */ 50#define AT91_DDRSDRC_DICDS (1 << 8) /* Output impedance control */
51 51
52#define AT91_DDRSDRC_T0PR (AT91_DDRSDRC + 0x0C) /* Timing 0 Register */ 52#define AT91_DDRSDRC_T0PR 0x0C /* Timing 0 Register */
53#define AT91_DDRSDRC_TRAS (0xf << 0) /* Active to Precharge delay */ 53#define AT91_DDRSDRC_TRAS (0xf << 0) /* Active to Precharge delay */
54#define AT91_DDRSDRC_TRCD (0xf << 4) /* Row to Column delay */ 54#define AT91_DDRSDRC_TRCD (0xf << 4) /* Row to Column delay */
55#define AT91_DDRSDRC_TWR (0xf << 8) /* Write recovery delay */ 55#define AT91_DDRSDRC_TWR (0xf << 8) /* Write recovery delay */
@@ -59,13 +59,13 @@
59#define AT91_DDRSDRC_TWTR (1 << 24) /* Internal Write to Read delay */ 59#define AT91_DDRSDRC_TWTR (1 << 24) /* Internal Write to Read delay */
60#define AT91_DDRSDRC_TMRD (0xf << 28) /* Load mode to active/refresh delay */ 60#define AT91_DDRSDRC_TMRD (0xf << 28) /* Load mode to active/refresh delay */
61 61
62#define AT91_DDRSDRC_T1PR (AT91_DDRSDRC + 0x10) /* Timing 1 Register */ 62#define AT91_DDRSDRC_T1PR 0x10 /* Timing 1 Register */
63#define AT91_DDRSDRC_TRFC (0x1f << 0) /* Row Cycle Delay */ 63#define AT91_DDRSDRC_TRFC (0x1f << 0) /* Row Cycle Delay */
64#define AT91_DDRSDRC_TXSNR (0xff << 8) /* Exit self-refresh to non-read */ 64#define AT91_DDRSDRC_TXSNR (0xff << 8) /* Exit self-refresh to non-read */
65#define AT91_DDRSDRC_TXSRD (0xff << 16) /* Exit self-refresh to read */ 65#define AT91_DDRSDRC_TXSRD (0xff << 16) /* Exit self-refresh to read */
66#define AT91_DDRSDRC_TXP (0xf << 24) /* Exit power-down delay */ 66#define AT91_DDRSDRC_TXP (0xf << 24) /* Exit power-down delay */
67 67
68#define AT91_DDRSDRC_LPR (AT91_DDRSDRC + 0x18) /* Low Power Register */ 68#define AT91_DDRSDRC_LPR 0x18 /* Low Power Register */
69#define AT91_DDRSDRC_LPCB (3 << 0) /* Low-power Configurations */ 69#define AT91_DDRSDRC_LPCB (3 << 0) /* Low-power Configurations */
70#define AT91_DDRSDRC_LPCB_DISABLE 0 70#define AT91_DDRSDRC_LPCB_DISABLE 0
71#define AT91_DDRSDRC_LPCB_SELF_REFRESH 1 71#define AT91_DDRSDRC_LPCB_SELF_REFRESH 1
@@ -80,14 +80,14 @@
80#define AT91_DDRSDRC_TIMEOUT_64_CLK_CYCLES (1 << 12) 80#define AT91_DDRSDRC_TIMEOUT_64_CLK_CYCLES (1 << 12)
81#define AT91_DDRSDRC_TIMEOUT_128_CLK_CYCLES (2 << 12) 81#define AT91_DDRSDRC_TIMEOUT_128_CLK_CYCLES (2 << 12)
82 82
83#define AT91_DDRSDRC_MDR (AT91_DDRSDRC + 0x1C) /* Memory Device Register */ 83#define AT91_DDRSDRC_MDR 0x1C /* Memory Device Register */
84#define AT91_DDRSDRC_MD (3 << 0) /* Memory Device Type */ 84#define AT91_DDRSDRC_MD (3 << 0) /* Memory Device Type */
85#define AT91_DDRSDRC_MD_SDR 0 85#define AT91_DDRSDRC_MD_SDR 0
86#define AT91_DDRSDRC_MD_LOW_POWER_SDR 1 86#define AT91_DDRSDRC_MD_LOW_POWER_SDR 1
87#define AT91_DDRSDRC_MD_DDR 2 87#define AT91_DDRSDRC_MD_DDR 2
88#define AT91_DDRSDRC_MD_LOW_POWER_DDR 3 88#define AT91_DDRSDRC_MD_LOW_POWER_DDR 3
89 89
90#define AT91_DDRSDRC_DLLR (AT91_DDRSDRC + 0x20) /* DLL Information Register */ 90#define AT91_DDRSDRC_DLLR 0x20 /* DLL Information Register */
91#define AT91_DDRSDRC_MDINC (1 << 0) /* Master Delay increment */ 91#define AT91_DDRSDRC_MDINC (1 << 0) /* Master Delay increment */
92#define AT91_DDRSDRC_MDDEC (1 << 1) /* Master Delay decrement */ 92#define AT91_DDRSDRC_MDDEC (1 << 1) /* Master Delay decrement */
93#define AT91_DDRSDRC_MDOVF (1 << 2) /* Master Delay Overflow */ 93#define AT91_DDRSDRC_MDOVF (1 << 2) /* Master Delay Overflow */
@@ -98,5 +98,11 @@
98#define AT91_DDRSDRC_SDVAL (0xff << 16) /* Slave Delay value */ 98#define AT91_DDRSDRC_SDVAL (0xff << 16) /* Slave Delay value */
99#define AT91_DDRSDRC_SDCVAL (0xff << 24) /* Slave Delay Correction value */ 99#define AT91_DDRSDRC_SDCVAL (0xff << 24) /* Slave Delay Correction value */
100 100
101/* Register access macros */
102#define at91_ramc_read(num, reg) \
103 at91_sys_read(AT91_DDRSDRC##num + reg)
104#define at91_ramc_write(num, reg, value) \
105 at91_sys_write(AT91_DDRSDRC##num + reg, value)
106
101 107
102#endif 108#endif
diff --git a/arch/arm/mach-at91/include/mach/at91sam9260.h b/arch/arm/mach-at91/include/mach/at91sam9260.h
index 43c396b9b4cb..4e79036d3b80 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9260.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9260.h
@@ -84,7 +84,7 @@
84 * System Peripherals (offset from AT91_BASE_SYS) 84 * System Peripherals (offset from AT91_BASE_SYS)
85 */ 85 */
86#define AT91_ECC (0xffffe800 - AT91_BASE_SYS) 86#define AT91_ECC (0xffffe800 - AT91_BASE_SYS)
87#define AT91_SDRAMC (0xffffea00 - AT91_BASE_SYS) 87#define AT91_SDRAMC0 (0xffffea00 - AT91_BASE_SYS)
88#define AT91_SMC (0xffffec00 - AT91_BASE_SYS) 88#define AT91_SMC (0xffffec00 - AT91_BASE_SYS)
89#define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS) 89#define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS)
90#define AT91_CCFG (0xffffef10 - AT91_BASE_SYS) 90#define AT91_CCFG (0xffffef10 - AT91_BASE_SYS)
diff --git a/arch/arm/mach-at91/include/mach/at91sam9261.h b/arch/arm/mach-at91/include/mach/at91sam9261.h
index 87de8be17484..2b5618518129 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9261.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9261.h
@@ -68,7 +68,7 @@
68/* 68/*
69 * System Peripherals (offset from AT91_BASE_SYS) 69 * System Peripherals (offset from AT91_BASE_SYS)
70 */ 70 */
71#define AT91_SDRAMC (0xffffea00 - AT91_BASE_SYS) 71#define AT91_SDRAMC0 (0xffffea00 - AT91_BASE_SYS)
72#define AT91_SMC (0xffffec00 - AT91_BASE_SYS) 72#define AT91_SMC (0xffffec00 - AT91_BASE_SYS)
73#define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS) 73#define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS)
74#define AT91_AIC (0xfffff000 - AT91_BASE_SYS) 74#define AT91_AIC (0xfffff000 - AT91_BASE_SYS)
diff --git a/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h b/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h
new file mode 100644
index 000000000000..d27b15ba8ebf
--- /dev/null
+++ b/arch/arm/mach-at91/include/mach/at91sam9_ddrsdr.h
@@ -0,0 +1,130 @@
1/*
2 * Header file for the Atmel DDR/SDR SDRAM Controller
3 *
4 * Copyright (C) 2010 Atmel Corporation
5 * Nicolas Ferre <nicolas.ferre@atmel.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#ifndef AT91SAM9_DDRSDR_H
13#define AT91SAM9_DDRSDR_H
14
15#define AT91_DDRSDRC_MR 0x00 /* Mode Register */
16#define AT91_DDRSDRC_MODE (0x7 << 0) /* Command Mode */
17#define AT91_DDRSDRC_MODE_NORMAL 0
18#define AT91_DDRSDRC_MODE_NOP 1
19#define AT91_DDRSDRC_MODE_PRECHARGE 2
20#define AT91_DDRSDRC_MODE_LMR 3
21#define AT91_DDRSDRC_MODE_REFRESH 4
22#define AT91_DDRSDRC_MODE_EXT_LMR 5
23#define AT91_DDRSDRC_MODE_DEEP 6
24
25#define AT91_DDRSDRC_RTR 0x04 /* Refresh Timer Register */
26#define AT91_DDRSDRC_COUNT (0xfff << 0) /* Refresh Timer Counter */
27
28#define AT91_DDRSDRC_CR 0x08 /* Configuration Register */
29#define AT91_DDRSDRC_NC (3 << 0) /* Number of Column Bits */
30#define AT91_DDRSDRC_NC_SDR8 (0 << 0)
31#define AT91_DDRSDRC_NC_SDR9 (1 << 0)
32#define AT91_DDRSDRC_NC_SDR10 (2 << 0)
33#define AT91_DDRSDRC_NC_SDR11 (3 << 0)
34#define AT91_DDRSDRC_NC_DDR9 (0 << 0)
35#define AT91_DDRSDRC_NC_DDR10 (1 << 0)
36#define AT91_DDRSDRC_NC_DDR11 (2 << 0)
37#define AT91_DDRSDRC_NC_DDR12 (3 << 0)
38#define AT91_DDRSDRC_NR (3 << 2) /* Number of Row Bits */
39#define AT91_DDRSDRC_NR_11 (0 << 2)
40#define AT91_DDRSDRC_NR_12 (1 << 2)
41#define AT91_DDRSDRC_NR_13 (2 << 2)
42#define AT91_DDRSDRC_NR_14 (3 << 2)
43#define AT91_DDRSDRC_CAS (7 << 4) /* CAS Latency */
44#define AT91_DDRSDRC_CAS_2 (2 << 4)
45#define AT91_DDRSDRC_CAS_3 (3 << 4)
46#define AT91_DDRSDRC_CAS_25 (6 << 4)
47#define AT91_DDRSDRC_RST_DLL (1 << 7) /* Reset DLL */
48#define AT91_DDRSDRC_DICDS (1 << 8) /* Output impedance control */
49#define AT91_DDRSDRC_DIS_DLL (1 << 9) /* Disable DLL */
50#define AT91_DDRSDRC_OCD (1 << 12) /* Off-Chip Driver */
51#define AT91_DDRSDRC_DQMS (1 << 16) /* Mask Data is Shared */
52#define AT91_DDRSDRC_ACTBST (1 << 18) /* Active Bank X to Burst Stop Read Access Bank Y */
53
54#define AT91_DDRSDRC_T0PR 0x0C /* Timing 0 Register */
55#define AT91_DDRSDRC_TRAS (0xf << 0) /* Active to Precharge delay */
56#define AT91_DDRSDRC_TRCD (0xf << 4) /* Row to Column delay */
57#define AT91_DDRSDRC_TWR (0xf << 8) /* Write recovery delay */
58#define AT91_DDRSDRC_TRC (0xf << 12) /* Row cycle delay */
59#define AT91_DDRSDRC_TRP (0xf << 16) /* Row precharge delay */
60#define AT91_DDRSDRC_TRRD (0xf << 20) /* Active BankA to BankB */
61#define AT91_DDRSDRC_TWTR (0x7 << 24) /* Internal Write to Read delay */
62#define AT91_DDRSDRC_RED_WRRD (0x1 << 27) /* Reduce Write to Read Delay */
63#define AT91_DDRSDRC_TMRD (0xf << 28) /* Load mode to active/refresh delay */
64
65#define AT91_DDRSDRC_T1PR 0x10 /* Timing 1 Register */
66#define AT91_DDRSDRC_TRFC (0x1f << 0) /* Row Cycle Delay */
67#define AT91_DDRSDRC_TXSNR (0xff << 8) /* Exit self-refresh to non-read */
68#define AT91_DDRSDRC_TXSRD (0xff << 16) /* Exit self-refresh to read */
69#define AT91_DDRSDRC_TXP (0xf << 24) /* Exit power-down delay */
70
71#define AT91_DDRSDRC_T2PR 0x14 /* Timing 2 Register */
72#define AT91_DDRSDRC_TXARD (0xf << 0) /* Exit active power down delay to read command in mode "Fast Exit" */
73#define AT91_DDRSDRC_TXARDS (0xf << 4) /* Exit active power down delay to read command in mode "Slow Exit" */
74#define AT91_DDRSDRC_TRPA (0xf << 8) /* Row Precharge All delay */
75#define AT91_DDRSDRC_TRTP (0x7 << 12) /* Read to Precharge delay */
76
77#define AT91_DDRSDRC_LPR 0x1C /* Low Power Register */
78#define AT91_DDRSDRC_LPCB (3 << 0) /* Low-power Configurations */
79#define AT91_DDRSDRC_LPCB_DISABLE 0
80#define AT91_DDRSDRC_LPCB_SELF_REFRESH 1
81#define AT91_DDRSDRC_LPCB_POWER_DOWN 2
82#define AT91_DDRSDRC_LPCB_DEEP_POWER_DOWN 3
83#define AT91_DDRSDRC_CLKFR (1 << 2) /* Clock Frozen */
84#define AT91_DDRSDRC_PASR (7 << 4) /* Partial Array Self Refresh */
85#define AT91_DDRSDRC_TCSR (3 << 8) /* Temperature Compensated Self Refresh */
86#define AT91_DDRSDRC_DS (3 << 10) /* Drive Strength */
87#define AT91_DDRSDRC_TIMEOUT (3 << 12) /* Time to define when Low Power Mode is enabled */
88#define AT91_DDRSDRC_TIMEOUT_0_CLK_CYCLES (0 << 12)
89#define AT91_DDRSDRC_TIMEOUT_64_CLK_CYCLES (1 << 12)
90#define AT91_DDRSDRC_TIMEOUT_128_CLK_CYCLES (2 << 12)
91#define AT91_DDRSDRC_APDE (1 << 16) /* Active power down exit time */
92#define AT91_DDRSDRC_UPD_MR (3 << 20) /* Update load mode register and extended mode register */
93
94#define AT91_DDRSDRC_MDR 0x20 /* Memory Device Register */
95#define AT91_DDRSDRC_MD (3 << 0) /* Memory Device Type */
96#define AT91_DDRSDRC_MD_SDR 0
97#define AT91_DDRSDRC_MD_LOW_POWER_SDR 1
98#define AT91_DDRSDRC_MD_LOW_POWER_DDR 3
99#define AT91_DDRSDRC_MD_DDR2 6
100#define AT91_DDRSDRC_DBW (1 << 4) /* Data Bus Width */
101#define AT91_DDRSDRC_DBW_32BITS (0 << 4)
102#define AT91_DDRSDRC_DBW_16BITS (1 << 4)
103
104#define AT91_DDRSDRC_DLL 0x24 /* DLL Information Register */
105#define AT91_DDRSDRC_MDINC (1 << 0) /* Master Delay increment */
106#define AT91_DDRSDRC_MDDEC (1 << 1) /* Master Delay decrement */
107#define AT91_DDRSDRC_MDOVF (1 << 2) /* Master Delay Overflow */
108#define AT91_DDRSDRC_MDVAL (0xff << 8) /* Master Delay value */
109
110#define AT91_DDRSDRC_HS 0x2C /* High Speed Register */
111#define AT91_DDRSDRC_DIS_ATCP_RD (1 << 2) /* Anticip read access is disabled */
112
113#define AT91_DDRSDRC_DELAY(n) (0x30 + (0x4 * (n))) /* Delay I/O Register n */
114
115#define AT91_DDRSDRC_WPMR 0xE4 /* Write Protect Mode Register */
116#define AT91_DDRSDRC_WP (1 << 0) /* Write protect enable */
117#define AT91_DDRSDRC_WPKEY (0xffffff << 8) /* Write protect key */
118#define AT91_DDRSDRC_KEY (0x444452 << 8) /* Write protect key = "DDR" */
119
120#define AT91_DDRSDRC_WPSR 0xE8 /* Write Protect Status Register */
121#define AT91_DDRSDRC_WPVS (1 << 0) /* Write protect violation status */
122#define AT91_DDRSDRC_WPVSRC (0xffff << 8) /* Write protect violation source */
123
124/* Register access macros */
125#define at91_ramc_read(num, reg) \
126 at91_sys_read(AT91_DDRSDRC##num + reg)
127#define at91_ramc_write(num, reg, value) \
128 at91_sys_write(AT91_DDRSDRC##num + reg, value)
129
130#endif
diff --git a/arch/arm/mach-at91/include/mach/at91sam9_sdramc.h b/arch/arm/mach-at91/include/mach/at91sam9_sdramc.h
index b7260389f7ca..100f5a592926 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9_sdramc.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9_sdramc.h
@@ -17,7 +17,7 @@
17#define AT91SAM9_SDRAMC_H 17#define AT91SAM9_SDRAMC_H
18 18
19/* SDRAM Controller (SDRAMC) registers */ 19/* SDRAM Controller (SDRAMC) registers */
20#define AT91_SDRAMC_MR (AT91_SDRAMC + 0x00) /* SDRAM Controller Mode Register */ 20#define AT91_SDRAMC_MR 0x00 /* SDRAM Controller Mode Register */
21#define AT91_SDRAMC_MODE (0xf << 0) /* Command Mode */ 21#define AT91_SDRAMC_MODE (0xf << 0) /* Command Mode */
22#define AT91_SDRAMC_MODE_NORMAL 0 22#define AT91_SDRAMC_MODE_NORMAL 0
23#define AT91_SDRAMC_MODE_NOP 1 23#define AT91_SDRAMC_MODE_NOP 1
@@ -27,10 +27,10 @@
27#define AT91_SDRAMC_MODE_EXT_LMR 5 27#define AT91_SDRAMC_MODE_EXT_LMR 5
28#define AT91_SDRAMC_MODE_DEEP 6 28#define AT91_SDRAMC_MODE_DEEP 6
29 29
30#define AT91_SDRAMC_TR (AT91_SDRAMC + 0x04) /* SDRAM Controller Refresh Timer Register */ 30#define AT91_SDRAMC_TR 0x04 /* SDRAM Controller Refresh Timer Register */
31#define AT91_SDRAMC_COUNT (0xfff << 0) /* Refresh Timer Counter */ 31#define AT91_SDRAMC_COUNT (0xfff << 0) /* Refresh Timer Counter */
32 32
33#define AT91_SDRAMC_CR (AT91_SDRAMC + 0x08) /* SDRAM Controller Configuration Register */ 33#define AT91_SDRAMC_CR 0x08 /* SDRAM Controller Configuration Register */
34#define AT91_SDRAMC_NC (3 << 0) /* Number of Column Bits */ 34#define AT91_SDRAMC_NC (3 << 0) /* Number of Column Bits */
35#define AT91_SDRAMC_NC_8 (0 << 0) 35#define AT91_SDRAMC_NC_8 (0 << 0)
36#define AT91_SDRAMC_NC_9 (1 << 0) 36#define AT91_SDRAMC_NC_9 (1 << 0)
@@ -57,7 +57,7 @@
57#define AT91_SDRAMC_TRAS (0xf << 24) /* Active to Precharge Delay */ 57#define AT91_SDRAMC_TRAS (0xf << 24) /* Active to Precharge Delay */
58#define AT91_SDRAMC_TXSR (0xf << 28) /* Exit Self Refresh to Active Delay */ 58#define AT91_SDRAMC_TXSR (0xf << 28) /* Exit Self Refresh to Active Delay */
59 59
60#define AT91_SDRAMC_LPR (AT91_SDRAMC + 0x10) /* SDRAM Controller Low Power Register */ 60#define AT91_SDRAMC_LPR 0x10 /* SDRAM Controller Low Power Register */
61#define AT91_SDRAMC_LPCB (3 << 0) /* Low-power Configurations */ 61#define AT91_SDRAMC_LPCB (3 << 0) /* Low-power Configurations */
62#define AT91_SDRAMC_LPCB_DISABLE 0 62#define AT91_SDRAMC_LPCB_DISABLE 0
63#define AT91_SDRAMC_LPCB_SELF_REFRESH 1 63#define AT91_SDRAMC_LPCB_SELF_REFRESH 1
@@ -71,16 +71,21 @@
71#define AT91_SDRAMC_TIMEOUT_64_CLK_CYCLES (1 << 12) 71#define AT91_SDRAMC_TIMEOUT_64_CLK_CYCLES (1 << 12)
72#define AT91_SDRAMC_TIMEOUT_128_CLK_CYCLES (2 << 12) 72#define AT91_SDRAMC_TIMEOUT_128_CLK_CYCLES (2 << 12)
73 73
74#define AT91_SDRAMC_IER (AT91_SDRAMC + 0x14) /* SDRAM Controller Interrupt Enable Register */ 74#define AT91_SDRAMC_IER 0x14 /* SDRAM Controller Interrupt Enable Register */
75#define AT91_SDRAMC_IDR (AT91_SDRAMC + 0x18) /* SDRAM Controller Interrupt Disable Register */ 75#define AT91_SDRAMC_IDR 0x18 /* SDRAM Controller Interrupt Disable Register */
76#define AT91_SDRAMC_IMR (AT91_SDRAMC + 0x1C) /* SDRAM Controller Interrupt Mask Register */ 76#define AT91_SDRAMC_IMR 0x1C /* SDRAM Controller Interrupt Mask Register */
77#define AT91_SDRAMC_ISR (AT91_SDRAMC + 0x20) /* SDRAM Controller Interrupt Status Register */ 77#define AT91_SDRAMC_ISR 0x20 /* SDRAM Controller Interrupt Status Register */
78#define AT91_SDRAMC_RES (1 << 0) /* Refresh Error Status */ 78#define AT91_SDRAMC_RES (1 << 0) /* Refresh Error Status */
79 79
80#define AT91_SDRAMC_MDR (AT91_SDRAMC + 0x24) /* SDRAM Memory Device Register */ 80#define AT91_SDRAMC_MDR 0x24 /* SDRAM Memory Device Register */
81#define AT91_SDRAMC_MD (3 << 0) /* Memory Device Type */ 81#define AT91_SDRAMC_MD (3 << 0) /* Memory Device Type */
82#define AT91_SDRAMC_MD_SDRAM 0 82#define AT91_SDRAMC_MD_SDRAM 0
83#define AT91_SDRAMC_MD_LOW_POWER_SDRAM 1 83#define AT91_SDRAMC_MD_LOW_POWER_SDRAM 1
84 84
85/* Register access macros */
86#define at91_ramc_read(num, reg) \
87 at91_sys_read(AT91_SDRAMC##num + reg)
88#define at91_ramc_write(num, reg, value) \
89 at91_sys_write(AT91_SDRAMC##num + reg, value)
85 90
86#endif 91#endif
diff --git a/arch/arm/mach-at91/include/mach/at91sam9rl.h b/arch/arm/mach-at91/include/mach/at91sam9rl.h
index fc2de6c09c86..87ba8517ad98 100644
--- a/arch/arm/mach-at91/include/mach/at91sam9rl.h
+++ b/arch/arm/mach-at91/include/mach/at91sam9rl.h
@@ -74,7 +74,7 @@
74 */ 74 */
75#define AT91_DMA (0xffffe600 - AT91_BASE_SYS) 75#define AT91_DMA (0xffffe600 - AT91_BASE_SYS)
76#define AT91_ECC (0xffffe800 - AT91_BASE_SYS) 76#define AT91_ECC (0xffffe800 - AT91_BASE_SYS)
77#define AT91_SDRAMC (0xffffea00 - AT91_BASE_SYS) 77#define AT91_SDRAMC0 (0xffffea00 - AT91_BASE_SYS)
78#define AT91_SMC (0xffffec00 - AT91_BASE_SYS) 78#define AT91_SMC (0xffffec00 - AT91_BASE_SYS)
79#define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS) 79#define AT91_MATRIX (0xffffee00 - AT91_BASE_SYS)
80#define AT91_CCFG (0xffffef10 - AT91_BASE_SYS) 80#define AT91_CCFG (0xffffef10 - AT91_BASE_SYS)
diff --git a/arch/arm/mach-at91/include/mach/board.h b/arch/arm/mach-at91/include/mach/board.h
index df2ed848c9f8..58528aa9c8a8 100644
--- a/arch/arm/mach-at91/include/mach/board.h
+++ b/arch/arm/mach-at91/include/mach/board.h
@@ -44,6 +44,8 @@
44 /* USB Device */ 44 /* USB Device */
45struct at91_udc_data { 45struct at91_udc_data {
46 u8 vbus_pin; /* high == host powering us */ 46 u8 vbus_pin; /* high == host powering us */
47 u8 vbus_active_low; /* vbus polarity */
48 u8 vbus_polled; /* Use polling, not interrupt */
47 u8 pullup_pin; /* active == D+ pulled up */ 49 u8 pullup_pin; /* active == D+ pulled up */
48 u8 pullup_active_low; /* true == pullup_pin is active low */ 50 u8 pullup_active_low; /* true == pullup_pin is active low */
49}; 51};
diff --git a/arch/arm/mach-at91/include/mach/cpu.h b/arch/arm/mach-at91/include/mach/cpu.h
index 833659d1200a..3bef931d0b1c 100644
--- a/arch/arm/mach-at91/include/mach/cpu.h
+++ b/arch/arm/mach-at91/include/mach/cpu.h
@@ -52,6 +52,7 @@ static inline unsigned long at91_cpu_fully_identify(void)
52 52
53#define ARCH_EXID_AT91SAM9M11 0x00000001 53#define ARCH_EXID_AT91SAM9M11 0x00000001
54#define ARCH_EXID_AT91SAM9M10 0x00000002 54#define ARCH_EXID_AT91SAM9M10 0x00000002
55#define ARCH_EXID_AT91SAM9G46 0x00000003
55#define ARCH_EXID_AT91SAM9G45 0x00000004 56#define ARCH_EXID_AT91SAM9G45 0x00000004
56 57
57static inline unsigned long at91_exid_identify(void) 58static inline unsigned long at91_exid_identify(void)
@@ -128,9 +129,18 @@ static inline unsigned long at91cap9_rev_identify(void)
128#ifdef CONFIG_ARCH_AT91SAM9G45 129#ifdef CONFIG_ARCH_AT91SAM9G45
129#define cpu_is_at91sam9g45() (at91_cpu_identify() == ARCH_ID_AT91SAM9G45) 130#define cpu_is_at91sam9g45() (at91_cpu_identify() == ARCH_ID_AT91SAM9G45)
130#define cpu_is_at91sam9g45es() (at91_cpu_fully_identify() == ARCH_ID_AT91SAM9G45ES) 131#define cpu_is_at91sam9g45es() (at91_cpu_fully_identify() == ARCH_ID_AT91SAM9G45ES)
132#define cpu_is_at91sam9m10() (cpu_is_at91sam9g45() && \
133 (at91_exid_identify() == ARCH_EXID_AT91SAM9M10))
134#define cpu_is_at91sam9m46() (cpu_is_at91sam9g45() && \
135 (at91_exid_identify() == ARCH_EXID_AT91SAM9G46))
136#define cpu_is_at91sam9m11() (cpu_is_at91sam9g45() && \
137 (at91_exid_identify() == ARCH_EXID_AT91SAM9M11))
131#else 138#else
132#define cpu_is_at91sam9g45() (0) 139#define cpu_is_at91sam9g45() (0)
133#define cpu_is_at91sam9g45es() (0) 140#define cpu_is_at91sam9g45es() (0)
141#define cpu_is_at91sam9m10() (0)
142#define cpu_is_at91sam9g46() (0)
143#define cpu_is_at91sam9m11() (0)
134#endif 144#endif
135 145
136#ifdef CONFIG_ARCH_AT91CAP9 146#ifdef CONFIG_ARCH_AT91CAP9
diff --git a/arch/arm/mach-at91/include/mach/gpio.h b/arch/arm/mach-at91/include/mach/gpio.h
index 04c91e31c9c5..bfdd8ab26dc8 100644
--- a/arch/arm/mach-at91/include/mach/gpio.h
+++ b/arch/arm/mach-at91/include/mach/gpio.h
@@ -19,6 +19,7 @@
19#define PIN_BASE NR_AIC_IRQS 19#define PIN_BASE NR_AIC_IRQS
20 20
21#define MAX_GPIO_BANKS 5 21#define MAX_GPIO_BANKS 5
22#define NR_BUILTIN_GPIO (PIN_BASE + (MAX_GPIO_BANKS * 32))
22 23
23/* these pin numbers double as IRQ numbers, like AT91xxx_ID_* values */ 24/* these pin numbers double as IRQ numbers, like AT91xxx_ID_* values */
24 25
diff --git a/arch/arm/mach-at91/pm.h b/arch/arm/mach-at91/pm.h
index 08322c44df1a..8c87d0c1b8f8 100644
--- a/arch/arm/mach-at91/pm.h
+++ b/arch/arm/mach-at91/pm.h
@@ -30,14 +30,50 @@ static inline u32 sdram_selfrefresh_enable(void)
30{ 30{
31 u32 saved_lpr, lpr; 31 u32 saved_lpr, lpr;
32 32
33 saved_lpr = at91_sys_read(AT91_DDRSDRC_LPR); 33 saved_lpr = at91_ramc_read(0, AT91_DDRSDRC_LPR);
34 34
35 lpr = saved_lpr & ~AT91_DDRSDRC_LPCB; 35 lpr = saved_lpr & ~AT91_DDRSDRC_LPCB;
36 at91_sys_write(AT91_DDRSDRC_LPR, lpr | AT91_DDRSDRC_LPCB_SELF_REFRESH); 36 at91_ramc_write(0, AT91_DDRSDRC_LPR, lpr | AT91_DDRSDRC_LPCB_SELF_REFRESH);
37 return saved_lpr; 37 return saved_lpr;
38} 38}
39 39
40#define sdram_selfrefresh_disable(saved_lpr) at91_sys_write(AT91_DDRSDRC_LPR, saved_lpr) 40#define sdram_selfrefresh_disable(saved_lpr) at91_ramc_write(0, AT91_DDRSDRC_LPR, saved_lpr)
41
42#elif defined(CONFIG_ARCH_AT91SAM9G45)
43#include <mach/at91sam9_ddrsdr.h>
44
45/* We manage both DDRAM/SDRAM controllers, we need more than one value to
46 * remember.
47 */
48static u32 saved_lpr1;
49
50static inline u32 sdram_selfrefresh_enable(void)
51{
52 /* Those tow values allow us to delay self-refresh activation
53 * to the maximum. */
54 u32 lpr0, lpr1;
55 u32 saved_lpr0;
56
57 saved_lpr1 = at91_ramc_read(1, AT91_DDRSDRC_LPR);
58 lpr1 = saved_lpr1 & ~AT91_DDRSDRC_LPCB;
59 lpr1 |= AT91_DDRSDRC_LPCB_SELF_REFRESH;
60
61 saved_lpr0 = at91_ramc_read(0, AT91_DDRSDRC_LPR);
62 lpr0 = saved_lpr0 & ~AT91_DDRSDRC_LPCB;
63 lpr0 |= AT91_DDRSDRC_LPCB_SELF_REFRESH;
64
65 /* self-refresh mode now */
66 at91_ramc_write(0, AT91_DDRSDRC_LPR, lpr0);
67 at91_ramc_write(1, AT91_DDRSDRC_LPR, lpr1);
68
69 return saved_lpr0;
70}
71
72#define sdram_selfrefresh_disable(saved_lpr0) \
73 do { \
74 at91_ramc_write(0, AT91_DDRSDRC_LPR, saved_lpr0); \
75 at91_ramc_write(1, AT91_DDRSDRC_LPR, saved_lpr1); \
76 } while (0)
41 77
42#else 78#else
43#include <mach/at91sam9_sdramc.h> 79#include <mach/at91sam9_sdramc.h>
@@ -47,7 +83,6 @@ static inline u32 sdram_selfrefresh_enable(void)
47 * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use; 83 * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use;
48 * handle those cases both here and in the Suspend-To-RAM support. 84 * handle those cases both here and in the Suspend-To-RAM support.
49 */ 85 */
50#define AT91_SDRAMC AT91_SDRAMC0
51#warning Assuming EB1 SDRAM controller is *NOT* used 86#warning Assuming EB1 SDRAM controller is *NOT* used
52#endif 87#endif
53 88
@@ -55,13 +90,13 @@ static inline u32 sdram_selfrefresh_enable(void)
55{ 90{
56 u32 saved_lpr, lpr; 91 u32 saved_lpr, lpr;
57 92
58 saved_lpr = at91_sys_read(AT91_SDRAMC_LPR); 93 saved_lpr = at91_ramc_read(0, AT91_SDRAMC_LPR);
59 94
60 lpr = saved_lpr & ~AT91_SDRAMC_LPCB; 95 lpr = saved_lpr & ~AT91_SDRAMC_LPCB;
61 at91_sys_write(AT91_SDRAMC_LPR, lpr | AT91_SDRAMC_LPCB_SELF_REFRESH); 96 at91_ramc_write(0, AT91_SDRAMC_LPR, lpr | AT91_SDRAMC_LPCB_SELF_REFRESH);
62 return saved_lpr; 97 return saved_lpr;
63} 98}
64 99
65#define sdram_selfrefresh_disable(saved_lpr) at91_sys_write(AT91_SDRAMC_LPR, saved_lpr) 100#define sdram_selfrefresh_disable(saved_lpr) at91_ramc_write(0, AT91_SDRAMC_LPR, saved_lpr)
66 101
67#endif 102#endif
diff --git a/arch/arm/mach-at91/pm_slowclock.S b/arch/arm/mach-at91/pm_slowclock.S
index 9c5b48e68a71..b6b00a1f6125 100644
--- a/arch/arm/mach-at91/pm_slowclock.S
+++ b/arch/arm/mach-at91/pm_slowclock.S
@@ -16,10 +16,12 @@
16#include <mach/hardware.h> 16#include <mach/hardware.h>
17#include <mach/at91_pmc.h> 17#include <mach/at91_pmc.h>
18 18
19#ifdef CONFIG_ARCH_AT91RM9200 19#if defined(CONFIG_ARCH_AT91RM9200)
20#include <mach/at91rm9200_mc.h> 20#include <mach/at91rm9200_mc.h>
21#elif defined(CONFIG_ARCH_AT91CAP9) 21#elif defined(CONFIG_ARCH_AT91CAP9)
22#include <mach/at91cap9_ddrsdr.h> 22#include <mach/at91cap9_ddrsdr.h>
23#elif defined(CONFIG_ARCH_AT91SAM9G45)
24#include <mach/at91sam9_ddrsdr.h>
23#else 25#else
24#include <mach/at91sam9_sdramc.h> 26#include <mach/at91sam9_sdramc.h>
25#endif 27#endif
@@ -30,7 +32,6 @@
30 * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use; 32 * FIXME either or both the SDRAM controllers (EB0, EB1) might be in use;
31 * handle those cases both here and in the Suspend-To-RAM support. 33 * handle those cases both here and in the Suspend-To-RAM support.
32 */ 34 */
33#define AT91_SDRAMC AT91_SDRAMC0
34#warning Assuming EB1 SDRAM controller is *NOT* used 35#warning Assuming EB1 SDRAM controller is *NOT* used
35#endif 36#endif
36 37
@@ -113,12 +114,14 @@ ENTRY(at91_slow_clock)
113 /* 114 /*
114 * Register usage: 115 * Register usage:
115 * R1 = Base address of AT91_PMC 116 * R1 = Base address of AT91_PMC
116 * R2 = Base address of AT91_SDRAMC (or AT91_SYS on AT91RM9200) 117 * R2 = Base address of RAM Controller (SDRAM, DDRSDR, or AT91_SYS)
117 * R3 = temporary register 118 * R3 = temporary register
118 * R4 = temporary register 119 * R4 = temporary register
120 * R5 = Base address of second RAM Controller or 0 if not present
119 */ 121 */
120 ldr r1, .at91_va_base_pmc 122 ldr r1, .at91_va_base_pmc
121 ldr r2, .at91_va_base_sdramc 123 ldr r2, .at91_va_base_sdramc
124 ldr r5, .at91_va_base_ramc1
122 125
123 /* Drain write buffer */ 126 /* Drain write buffer */
124 mcr p15, 0, r0, c7, c10, 4 127 mcr p15, 0, r0, c7, c10, 4
@@ -127,20 +130,33 @@ ENTRY(at91_slow_clock)
127 /* Put SDRAM in self-refresh mode */ 130 /* Put SDRAM in self-refresh mode */
128 mov r3, #1 131 mov r3, #1
129 str r3, [r2, #AT91_SDRAMC_SRR] 132 str r3, [r2, #AT91_SDRAMC_SRR]
130#elif defined(CONFIG_ARCH_AT91CAP9) 133#elif defined(CONFIG_ARCH_AT91CAP9) \
131 /* Enable SDRAM self-refresh mode */ 134 || defined(CONFIG_ARCH_AT91SAM9G45)
132 ldr r3, [r2, #AT91_DDRSDRC_LPR - AT91_DDRSDRC]
133 str r3, .saved_sam9_lpr
134 135
135 mov r3, #AT91_DDRSDRC_LPCB_SELF_REFRESH 136 /* prepare for DDRAM self-refresh mode */
136 str r3, [r2, #AT91_DDRSDRC_LPR - AT91_DDRSDRC] 137 ldr r3, [r2, #AT91_DDRSDRC_LPR]
138 str r3, .saved_sam9_lpr
139 bic r3, #AT91_DDRSDRC_LPCB
140 orr r3, #AT91_DDRSDRC_LPCB_SELF_REFRESH
141
142 /* figure out if we use the second ram controller */
143 cmp r5, #0
144 ldrne r4, [r5, #AT91_DDRSDRC_LPR]
145 strne r4, .saved_sam9_lpr1
146 bicne r4, #AT91_DDRSDRC_LPCB
147 orrne r4, #AT91_DDRSDRC_LPCB_SELF_REFRESH
148
149 /* Enable DDRAM self-refresh mode */
150 str r3, [r2, #AT91_DDRSDRC_LPR]
151 strne r4, [r5, #AT91_DDRSDRC_LPR]
137#else 152#else
138 /* Enable SDRAM self-refresh mode */ 153 /* Enable SDRAM self-refresh mode */
139 ldr r3, [r2, #AT91_SDRAMC_LPR - AT91_SDRAMC] 154 ldr r3, [r2, #AT91_SDRAMC_LPR]
140 str r3, .saved_sam9_lpr 155 str r3, .saved_sam9_lpr
141 156
142 mov r3, #AT91_SDRAMC_LPCB_SELF_REFRESH 157 bic r3, #AT91_SDRAMC_LPCB
143 str r3, [r2, #AT91_SDRAMC_LPR - AT91_SDRAMC] 158 orr r3, #AT91_SDRAMC_LPCB_SELF_REFRESH
159 str r3, [r2, #AT91_SDRAMC_LPR]
144#endif 160#endif
145 161
146 /* Save Master clock setting */ 162 /* Save Master clock setting */
@@ -247,14 +263,21 @@ ENTRY(at91_slow_clock)
247 263
248#ifdef CONFIG_ARCH_AT91RM9200 264#ifdef CONFIG_ARCH_AT91RM9200
249 /* Do nothing - self-refresh is automatically disabled. */ 265 /* Do nothing - self-refresh is automatically disabled. */
250#elif defined(CONFIG_ARCH_AT91CAP9) 266#elif defined(CONFIG_ARCH_AT91CAP9) \
251 /* Restore LPR on AT91CAP9 */ 267 || defined(CONFIG_ARCH_AT91SAM9G45)
268 /* Restore LPR on AT91 with DDRAM */
252 ldr r3, .saved_sam9_lpr 269 ldr r3, .saved_sam9_lpr
253 str r3, [r2, #AT91_DDRSDRC_LPR - AT91_DDRSDRC] 270 str r3, [r2, #AT91_DDRSDRC_LPR]
271
272 /* if we use the second ram controller */
273 cmp r5, #0
274 ldrne r4, .saved_sam9_lpr1
275 strne r4, [r5, #AT91_DDRSDRC_LPR]
276
254#else 277#else
255 /* Restore LPR on AT91SAM9 */ 278 /* Restore LPR on AT91 with SDRAM */
256 ldr r3, .saved_sam9_lpr 279 ldr r3, .saved_sam9_lpr
257 str r3, [r2, #AT91_SDRAMC_LPR - AT91_SDRAMC] 280 str r3, [r2, #AT91_SDRAMC_LPR]
258#endif 281#endif
259 282
260 /* Restore registers, and return */ 283 /* Restore registers, and return */
@@ -273,18 +296,29 @@ ENTRY(at91_slow_clock)
273.saved_sam9_lpr: 296.saved_sam9_lpr:
274 .word 0 297 .word 0
275 298
299.saved_sam9_lpr1:
300 .word 0
301
276.at91_va_base_pmc: 302.at91_va_base_pmc:
277 .word AT91_VA_BASE_SYS + AT91_PMC 303 .word AT91_VA_BASE_SYS + AT91_PMC
278 304
279#ifdef CONFIG_ARCH_AT91RM9200 305#ifdef CONFIG_ARCH_AT91RM9200
280.at91_va_base_sdramc: 306.at91_va_base_sdramc:
281 .word AT91_VA_BASE_SYS 307 .word AT91_VA_BASE_SYS
282#elif defined(CONFIG_ARCH_AT91CAP9) 308#elif defined(CONFIG_ARCH_AT91CAP9) \
309 || defined(CONFIG_ARCH_AT91SAM9G45)
283.at91_va_base_sdramc: 310.at91_va_base_sdramc:
284 .word AT91_VA_BASE_SYS + AT91_DDRSDRC 311 .word AT91_VA_BASE_SYS + AT91_DDRSDRC0
285#else 312#else
286.at91_va_base_sdramc: 313.at91_va_base_sdramc:
287 .word AT91_VA_BASE_SYS + AT91_SDRAMC 314 .word AT91_VA_BASE_SYS + AT91_SDRAMC0
315#endif
316
317.at91_va_base_ramc1:
318#if defined(CONFIG_ARCH_AT91SAM9G45)
319 .word AT91_VA_BASE_SYS + AT91_DDRSDRC1
320#else
321 .word 0
288#endif 322#endif
289 323
290ENTRY(at91_slow_clock_sz) 324ENTRY(at91_slow_clock_sz)
diff --git a/arch/arm/mach-bcmring/core.c b/arch/arm/mach-bcmring/core.c
index 72e405df0fb0..d3f959e92b2d 100644
--- a/arch/arm/mach-bcmring/core.c
+++ b/arch/arm/mach-bcmring/core.c
@@ -91,14 +91,23 @@ static struct clk uart_clk = {
91 .parent = &pll1_clk, 91 .parent = &pll1_clk,
92}; 92};
93 93
94static struct clk dummy_apb_pclk = {
95 .name = "BUSCLK",
96 .type = CLK_TYPE_PRIMARY,
97 .mode = CLK_MODE_XTAL,
98};
99
94static struct clk_lookup lookups[] = { 100static struct clk_lookup lookups[] = {
95 { /* UART0 */ 101 { /* Bus clock */
96 .dev_id = "uarta", 102 .con_id = "apb_pclk",
97 .clk = &uart_clk, 103 .clk = &dummy_apb_pclk,
98 }, { /* UART1 */ 104 }, { /* UART0 */
99 .dev_id = "uartb", 105 .dev_id = "uarta",
100 .clk = &uart_clk, 106 .clk = &uart_clk,
101 } 107 }, { /* UART1 */
108 .dev_id = "uartb",
109 .clk = &uart_clk,
110 }
102}; 111};
103 112
104static struct amba_device *amba_devs[] __initdata = { 113static struct amba_device *amba_devs[] __initdata = {
diff --git a/arch/arm/mach-clps711x/Kconfig b/arch/arm/mach-clps711x/Kconfig
index dbaae5f746a1..eb34bd1251d4 100644
--- a/arch/arm/mach-clps711x/Kconfig
+++ b/arch/arm/mach-clps711x/Kconfig
@@ -30,7 +30,6 @@ config ARCH_CLEP7312
30config ARCH_EDB7211 30config ARCH_EDB7211
31 bool "EDB7211" 31 bool "EDB7211"
32 select ISA 32 select ISA
33 select ARCH_DISCONTIGMEM_ENABLE
34 select ARCH_SPARSEMEM_ENABLE 33 select ARCH_SPARSEMEM_ENABLE
35 select ARCH_SELECT_MEMORY_MODEL 34 select ARCH_SELECT_MEMORY_MODEL
36 help 35 help
diff --git a/arch/arm/mach-clps711x/clep7312.c b/arch/arm/mach-clps711x/clep7312.c
index 09fb57e45213..3c3bf45039ff 100644
--- a/arch/arm/mach-clps711x/clep7312.c
+++ b/arch/arm/mach-clps711x/clep7312.c
@@ -32,7 +32,6 @@ fixup_clep7312(struct machine_desc *desc, struct tag *tags,
32 mi->nr_banks=1; 32 mi->nr_banks=1;
33 mi->bank[0].start = 0xc0000000; 33 mi->bank[0].start = 0xc0000000;
34 mi->bank[0].size = 0x01000000; 34 mi->bank[0].size = 0x01000000;
35 mi->bank[0].node = 0;
36} 35}
37 36
38 37
diff --git a/arch/arm/mach-clps711x/edb7211-arch.c b/arch/arm/mach-clps711x/edb7211-arch.c
index dc81cc68595d..4a7a2322979a 100644
--- a/arch/arm/mach-clps711x/edb7211-arch.c
+++ b/arch/arm/mach-clps711x/edb7211-arch.c
@@ -18,6 +18,7 @@
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 19 */
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/memblock.h>
21#include <linux/types.h> 22#include <linux/types.h>
22#include <linux/string.h> 23#include <linux/string.h>
23 24
@@ -29,6 +30,12 @@
29 30
30extern void edb7211_map_io(void); 31extern void edb7211_map_io(void);
31 32
33/* Reserve screen memory region at the start of main system memory. */
34static void __init edb7211_reserve(void)
35{
36 memblock_reserve(PHYS_OFFSET, 0x00020000);
37}
38
32static void __init 39static void __init
33fixup_edb7211(struct machine_desc *desc, struct tag *tags, 40fixup_edb7211(struct machine_desc *desc, struct tag *tags,
34 char **cmdline, struct meminfo *mi) 41 char **cmdline, struct meminfo *mi)
@@ -43,10 +50,8 @@ fixup_edb7211(struct machine_desc *desc, struct tag *tags,
43 */ 50 */
44 mi->bank[0].start = 0xc0000000; 51 mi->bank[0].start = 0xc0000000;
45 mi->bank[0].size = 8*1024*1024; 52 mi->bank[0].size = 8*1024*1024;
46 mi->bank[0].node = 0;
47 mi->bank[1].start = 0xc1000000; 53 mi->bank[1].start = 0xc1000000;
48 mi->bank[1].size = 8*1024*1024; 54 mi->bank[1].size = 8*1024*1024;
49 mi->bank[1].node = 1;
50 mi->nr_banks = 2; 55 mi->nr_banks = 2;
51} 56}
52 57
@@ -57,6 +62,7 @@ MACHINE_START(EDB7211, "CL-EDB7211 (EP7211 eval board)")
57 .boot_params = 0xc0020100, /* 0xc0000000 - 0xc001ffff can be video RAM */ 62 .boot_params = 0xc0020100, /* 0xc0000000 - 0xc001ffff can be video RAM */
58 .fixup = fixup_edb7211, 63 .fixup = fixup_edb7211,
59 .map_io = edb7211_map_io, 64 .map_io = edb7211_map_io,
65 .reserve = edb7211_reserve,
60 .init_irq = clps711x_init_irq, 66 .init_irq = clps711x_init_irq,
61 .timer = &clps711x_timer, 67 .timer = &clps711x_timer,
62MACHINE_END 68MACHINE_END
diff --git a/arch/arm/mach-clps711x/fortunet.c b/arch/arm/mach-clps711x/fortunet.c
index 7430e4049d87..a696099aa4f8 100644
--- a/arch/arm/mach-clps711x/fortunet.c
+++ b/arch/arm/mach-clps711x/fortunet.c
@@ -39,7 +39,6 @@ struct meminfo memmap = {
39 { 39 {
40 .start = 0xC0000000, 40 .start = 0xC0000000,
41 .size = 0x01000000, 41 .size = 0x01000000,
42 .node = 0
43 }, 42 },
44 }, 43 },
45}; 44};
diff --git a/arch/arm/mach-clps711x/include/mach/memory.h b/arch/arm/mach-clps711x/include/mach/memory.h
index f70d52be48a2..f45c8e892cb5 100644
--- a/arch/arm/mach-clps711x/include/mach/memory.h
+++ b/arch/arm/mach-clps711x/include/mach/memory.h
@@ -20,7 +20,6 @@
20#ifndef __ASM_ARCH_MEMORY_H 20#ifndef __ASM_ARCH_MEMORY_H
21#define __ASM_ARCH_MEMORY_H 21#define __ASM_ARCH_MEMORY_H
22 22
23
24/* 23/*
25 * Physical DRAM offset. 24 * Physical DRAM offset.
26 */ 25 */
@@ -72,7 +71,6 @@
72 * node 2: 0xd0000000 - 0xd7ffffff 71 * node 2: 0xd0000000 - 0xd7ffffff
73 * node 3: 0xd8000000 - 0xdfffffff 72 * node 3: 0xd8000000 - 0xdfffffff
74 */ 73 */
75#define NODE_MEM_SIZE_BITS 24
76#define SECTION_SIZE_BITS 24 74#define SECTION_SIZE_BITS 24
77#define MAX_PHYSMEM_BITS 32 75#define MAX_PHYSMEM_BITS 32
78 76
diff --git a/arch/arm/mach-cns3xxx/Makefile b/arch/arm/mach-cns3xxx/Makefile
index 427507a2d696..11033f1c2e23 100644
--- a/arch/arm/mach-cns3xxx/Makefile
+++ b/arch/arm/mach-cns3xxx/Makefile
@@ -1,2 +1,3 @@
1obj-$(CONFIG_ARCH_CNS3XXX) += core.o pm.o 1obj-$(CONFIG_ARCH_CNS3XXX) += core.o pm.o devices.o
2obj-$(CONFIG_PCI) += pcie.o
2obj-$(CONFIG_MACH_CNS3420VB) += cns3420vb.o 3obj-$(CONFIG_MACH_CNS3420VB) += cns3420vb.o
diff --git a/arch/arm/mach-cns3xxx/cns3420vb.c b/arch/arm/mach-cns3xxx/cns3420vb.c
index 2e30c8288740..9df8391fd78a 100644
--- a/arch/arm/mach-cns3xxx/cns3420vb.c
+++ b/arch/arm/mach-cns3xxx/cns3420vb.c
@@ -32,6 +32,7 @@
32#include <mach/cns3xxx.h> 32#include <mach/cns3xxx.h>
33#include <mach/irqs.h> 33#include <mach/irqs.h>
34#include "core.h" 34#include "core.h"
35#include "devices.h"
35 36
36/* 37/*
37 * NOR Flash 38 * NOR Flash
@@ -117,6 +118,9 @@ static void __init cns3420_init(void)
117{ 118{
118 platform_add_devices(cns3420_pdevs, ARRAY_SIZE(cns3420_pdevs)); 119 platform_add_devices(cns3420_pdevs, ARRAY_SIZE(cns3420_pdevs));
119 120
121 cns3xxx_ahci_init();
122 cns3xxx_sdhci_init();
123
120 pm_power_off = cns3xxx_power_off; 124 pm_power_off = cns3xxx_power_off;
121} 125}
122 126
diff --git a/arch/arm/mach-cns3xxx/devices.c b/arch/arm/mach-cns3xxx/devices.c
new file mode 100644
index 000000000000..50b4d31c27c0
--- /dev/null
+++ b/arch/arm/mach-cns3xxx/devices.c
@@ -0,0 +1,111 @@
1/*
2 * CNS3xxx common devices
3 *
4 * Copyright 2008 Cavium Networks
5 * Scott Shu
6 * Copyright 2010 MontaVista Software, LLC.
7 * Anton Vorontsov <avorontsov@mvista.com>
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/io.h>
15#include <linux/init.h>
16#include <linux/compiler.h>
17#include <linux/dma-mapping.h>
18#include <linux/platform_device.h>
19#include <mach/cns3xxx.h>
20#include <mach/irqs.h>
21#include "core.h"
22#include "devices.h"
23
24/*
25 * AHCI
26 */
27static struct resource cns3xxx_ahci_resource[] = {
28 [0] = {
29 .start = CNS3XXX_SATA2_BASE,
30 .end = CNS3XXX_SATA2_BASE + CNS3XXX_SATA2_SIZE - 1,
31 .flags = IORESOURCE_MEM,
32 },
33 [1] = {
34 .start = IRQ_CNS3XXX_SATA,
35 .end = IRQ_CNS3XXX_SATA,
36 .flags = IORESOURCE_IRQ,
37 },
38};
39
40static u64 cns3xxx_ahci_dmamask = DMA_BIT_MASK(32);
41
42static struct platform_device cns3xxx_ahci_pdev = {
43 .name = "ahci",
44 .id = 0,
45 .resource = cns3xxx_ahci_resource,
46 .num_resources = ARRAY_SIZE(cns3xxx_ahci_resource),
47 .dev = {
48 .dma_mask = &cns3xxx_ahci_dmamask,
49 .coherent_dma_mask = DMA_BIT_MASK(32),
50 },
51};
52
53void __init cns3xxx_ahci_init(void)
54{
55 u32 tmp;
56
57 tmp = __raw_readl(MISC_SATA_POWER_MODE);
58 tmp |= 0x1 << 16; /* Disable SATA PHY 0 from SLUMBER Mode */
59 tmp |= 0x1 << 17; /* Disable SATA PHY 1 from SLUMBER Mode */
60 __raw_writel(tmp, MISC_SATA_POWER_MODE);
61
62 /* Enable SATA PHY */
63 cns3xxx_pwr_power_up(0x1 << PM_PLL_HM_PD_CTRL_REG_OFFSET_SATA_PHY0);
64 cns3xxx_pwr_power_up(0x1 << PM_PLL_HM_PD_CTRL_REG_OFFSET_SATA_PHY1);
65
66 /* Enable SATA Clock */
67 cns3xxx_pwr_clk_en(0x1 << PM_CLK_GATE_REG_OFFSET_SATA);
68
69 /* De-Asscer SATA Reset */
70 cns3xxx_pwr_soft_rst(CNS3XXX_PWR_SOFTWARE_RST(SATA));
71
72 platform_device_register(&cns3xxx_ahci_pdev);
73}
74
75/*
76 * SDHCI
77 */
78static struct resource cns3xxx_sdhci_resources[] = {
79 [0] = {
80 .start = CNS3XXX_SDIO_BASE,
81 .end = CNS3XXX_SDIO_BASE + SZ_4K - 1,
82 .flags = IORESOURCE_MEM,
83 },
84 [1] = {
85 .start = IRQ_CNS3XXX_SDIO,
86 .end = IRQ_CNS3XXX_SDIO,
87 .flags = IORESOURCE_IRQ,
88 },
89};
90
91static struct platform_device cns3xxx_sdhci_pdev = {
92 .name = "sdhci-cns3xxx",
93 .id = 0,
94 .num_resources = ARRAY_SIZE(cns3xxx_sdhci_resources),
95 .resource = cns3xxx_sdhci_resources,
96};
97
98void __init cns3xxx_sdhci_init(void)
99{
100 u32 __iomem *gpioa = __io(CNS3XXX_MISC_BASE_VIRT + 0x0014);
101 u32 gpioa_pins = __raw_readl(gpioa);
102
103 /* MMC/SD pins share with GPIOA */
104 gpioa_pins |= 0x1fff0004;
105 __raw_writel(gpioa_pins, gpioa);
106
107 cns3xxx_pwr_clk_en(CNS3XXX_PWR_CLK_EN(SDIO));
108 cns3xxx_pwr_soft_rst(CNS3XXX_PWR_SOFTWARE_RST(SDIO));
109
110 platform_device_register(&cns3xxx_sdhci_pdev);
111}
diff --git a/arch/arm/mach-cns3xxx/devices.h b/arch/arm/mach-cns3xxx/devices.h
new file mode 100644
index 000000000000..27e15a10aa85
--- /dev/null
+++ b/arch/arm/mach-cns3xxx/devices.h
@@ -0,0 +1,20 @@
1/*
2 * CNS3xxx common devices
3 *
4 * Copyright 2008 Cavium Networks
5 * Scott Shu
6 * Copyright 2010 MontaVista Software, LLC.
7 * Anton Vorontsov <avorontsov@mvista.com>
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 */
13
14#ifndef __CNS3XXX_DEVICES_H_
15#define __CNS3XXX_DEVICES_H_
16
17void __init cns3xxx_ahci_init(void);
18void __init cns3xxx_sdhci_init(void);
19
20#endif /* __CNS3XXX_DEVICES_H_ */
diff --git a/arch/arm/mach-cns3xxx/include/mach/cns3xxx.h b/arch/arm/mach-cns3xxx/include/mach/cns3xxx.h
index 8a2f5a21d4ee..6dbce13771ca 100644
--- a/arch/arm/mach-cns3xxx/include/mach/cns3xxx.h
+++ b/arch/arm/mach-cns3xxx/include/mach/cns3xxx.h
@@ -247,37 +247,36 @@
247 * Misc block 247 * Misc block
248 */ 248 */
249#define MISC_MEM_MAP(offs) (void __iomem *)(CNS3XXX_MISC_BASE_VIRT + (offs)) 249#define MISC_MEM_MAP(offs) (void __iomem *)(CNS3XXX_MISC_BASE_VIRT + (offs))
250#define MISC_MEM_MAP_VALUE(offset) (*((volatile unsigned int *)(CNS3XXX_MISC_BASE_VIRT + (offset)))) 250
251 251#define MISC_MEMORY_REMAP_REG MISC_MEM_MAP(0x00)
252#define MISC_MEMORY_REMAP_REG MISC_MEM_MAP_VALUE(0x00) 252#define MISC_CHIP_CONFIG_REG MISC_MEM_MAP(0x04)
253#define MISC_CHIP_CONFIG_REG MISC_MEM_MAP_VALUE(0x04) 253#define MISC_DEBUG_PROBE_DATA_REG MISC_MEM_MAP(0x08)
254#define MISC_DEBUG_PROBE_DATA_REG MISC_MEM_MAP_VALUE(0x08) 254#define MISC_DEBUG_PROBE_SELECTION_REG MISC_MEM_MAP(0x0C)
255#define MISC_DEBUG_PROBE_SELECTION_REG MISC_MEM_MAP_VALUE(0x0C) 255#define MISC_IO_PIN_FUNC_SELECTION_REG MISC_MEM_MAP(0x10)
256#define MISC_IO_PIN_FUNC_SELECTION_REG MISC_MEM_MAP_VALUE(0x10) 256#define MISC_GPIOA_PIN_ENABLE_REG MISC_MEM_MAP(0x14)
257#define MISC_GPIOA_PIN_ENABLE_REG MISC_MEM_MAP_VALUE(0x14) 257#define MISC_GPIOB_PIN_ENABLE_REG MISC_MEM_MAP(0x18)
258#define MISC_GPIOB_PIN_ENABLE_REG MISC_MEM_MAP_VALUE(0x18) 258#define MISC_IO_PAD_DRIVE_STRENGTH_CTRL_A MISC_MEM_MAP(0x1C)
259#define MISC_IO_PAD_DRIVE_STRENGTH_CTRL_A MISC_MEM_MAP_VALUE(0x1C) 259#define MISC_IO_PAD_DRIVE_STRENGTH_CTRL_B MISC_MEM_MAP(0x20)
260#define MISC_IO_PAD_DRIVE_STRENGTH_CTRL_B MISC_MEM_MAP_VALUE(0x20) 260#define MISC_GPIOA_15_0_PULL_CTRL_REG MISC_MEM_MAP(0x24)
261#define MISC_GPIOA_15_0_PULL_CTRL_REG MISC_MEM_MAP_VALUE(0x24) 261#define MISC_GPIOA_16_31_PULL_CTRL_REG MISC_MEM_MAP(0x28)
262#define MISC_GPIOA_16_31_PULL_CTRL_REG MISC_MEM_MAP_VALUE(0x28) 262#define MISC_GPIOB_15_0_PULL_CTRL_REG MISC_MEM_MAP(0x2C)
263#define MISC_GPIOB_15_0_PULL_CTRL_REG MISC_MEM_MAP_VALUE(0x2C) 263#define MISC_GPIOB_16_31_PULL_CTRL_REG MISC_MEM_MAP(0x30)
264#define MISC_GPIOB_16_31_PULL_CTRL_REG MISC_MEM_MAP_VALUE(0x30) 264#define MISC_IO_PULL_CTRL_REG MISC_MEM_MAP(0x34)
265#define MISC_IO_PULL_CTRL_REG MISC_MEM_MAP_VALUE(0x34) 265#define MISC_E_FUSE_31_0_REG MISC_MEM_MAP(0x40)
266#define MISC_E_FUSE_31_0_REG MISC_MEM_MAP_VALUE(0x40) 266#define MISC_E_FUSE_63_32_REG MISC_MEM_MAP(0x44)
267#define MISC_E_FUSE_63_32_REG MISC_MEM_MAP_VALUE(0x44) 267#define MISC_E_FUSE_95_64_REG MISC_MEM_MAP(0x48)
268#define MISC_E_FUSE_95_64_REG MISC_MEM_MAP_VALUE(0x48) 268#define MISC_E_FUSE_127_96_REG MISC_MEM_MAP(0x4C)
269#define MISC_E_FUSE_127_96_REG MISC_MEM_MAP_VALUE(0x4C) 269#define MISC_SOFTWARE_TEST_1_REG MISC_MEM_MAP(0x50)
270#define MISC_SOFTWARE_TEST_1_REG MISC_MEM_MAP_VALUE(0x50) 270#define MISC_SOFTWARE_TEST_2_REG MISC_MEM_MAP(0x54)
271#define MISC_SOFTWARE_TEST_2_REG MISC_MEM_MAP_VALUE(0x54) 271
272 272#define MISC_SATA_POWER_MODE MISC_MEM_MAP(0x310)
273#define MISC_SATA_POWER_MODE MISC_MEM_MAP_VALUE(0x310) 273
274 274#define MISC_USB_CFG_REG MISC_MEM_MAP(0x800)
275#define MISC_USB_CFG_REG MISC_MEM_MAP_VALUE(0x800) 275#define MISC_USB_STS_REG MISC_MEM_MAP(0x804)
276#define MISC_USB_STS_REG MISC_MEM_MAP_VALUE(0x804) 276#define MISC_USBPHY00_CFG_REG MISC_MEM_MAP(0x808)
277#define MISC_USBPHY00_CFG_REG MISC_MEM_MAP_VALUE(0x808) 277#define MISC_USBPHY01_CFG_REG MISC_MEM_MAP(0x80c)
278#define MISC_USBPHY01_CFG_REG MISC_MEM_MAP_VALUE(0x80c) 278#define MISC_USBPHY10_CFG_REG MISC_MEM_MAP(0x810)
279#define MISC_USBPHY10_CFG_REG MISC_MEM_MAP_VALUE(0x810) 279#define MISC_USBPHY11_CFG_REG MISC_MEM_MAP(0x814)
280#define MISC_USBPHY11_CFG_REG MISC_MEM_MAP_VALUE(0x814)
281 280
282#define MISC_PCIEPHY_CMCTL(x) MISC_MEM_MAP(0x900 + (x) * 0x004) 281#define MISC_PCIEPHY_CMCTL(x) MISC_MEM_MAP(0x900 + (x) * 0x004)
283#define MISC_PCIEPHY_CTL(x) MISC_MEM_MAP(0x940 + (x) * 0x100) 282#define MISC_PCIEPHY_CTL(x) MISC_MEM_MAP(0x940 + (x) * 0x100)
@@ -300,21 +299,21 @@
300/* 299/*
301 * Power management and clock control 300 * Power management and clock control
302 */ 301 */
303#define PMU_REG_VALUE(offset) (*((volatile unsigned int *)(CNS3XXX_PM_BASE_VIRT + (offset)))) 302#define PMU_MEM_MAP(offs) (void __iomem *)(CNS3XXX_PM_BASE_VIRT + (offs))
304 303
305#define PM_CLK_GATE_REG PMU_REG_VALUE(0x000) 304#define PM_CLK_GATE_REG PMU_MEM_MAP(0x000)
306#define PM_SOFT_RST_REG PMU_REG_VALUE(0x004) 305#define PM_SOFT_RST_REG PMU_MEM_MAP(0x004)
307#define PM_HS_CFG_REG PMU_REG_VALUE(0x008) 306#define PM_HS_CFG_REG PMU_MEM_MAP(0x008)
308#define PM_CACTIVE_STA_REG PMU_REG_VALUE(0x00C) 307#define PM_CACTIVE_STA_REG PMU_MEM_MAP(0x00C)
309#define PM_PWR_STA_REG PMU_REG_VALUE(0x010) 308#define PM_PWR_STA_REG PMU_MEM_MAP(0x010)
310#define PM_CLK_CTRL_REG PMU_REG_VALUE(0x014) 309#define PM_CLK_CTRL_REG PMU_MEM_MAP(0x014)
311#define PM_PLL_LCD_I2S_CTRL_REG PMU_REG_VALUE(0x018) 310#define PM_PLL_LCD_I2S_CTRL_REG PMU_MEM_MAP(0x018)
312#define PM_PLL_HM_PD_CTRL_REG PMU_REG_VALUE(0x01C) 311#define PM_PLL_HM_PD_CTRL_REG PMU_MEM_MAP(0x01C)
313#define PM_REGULAT_CTRL_REG PMU_REG_VALUE(0x020) 312#define PM_REGULAT_CTRL_REG PMU_MEM_MAP(0x020)
314#define PM_WDT_CTRL_REG PMU_REG_VALUE(0x024) 313#define PM_WDT_CTRL_REG PMU_MEM_MAP(0x024)
315#define PM_WU_CTRL0_REG PMU_REG_VALUE(0x028) 314#define PM_WU_CTRL0_REG PMU_MEM_MAP(0x028)
316#define PM_WU_CTRL1_REG PMU_REG_VALUE(0x02C) 315#define PM_WU_CTRL1_REG PMU_MEM_MAP(0x02C)
317#define PM_CSR_REG PMU_REG_VALUE(0x030) 316#define PM_CSR_REG PMU_MEM_MAP(0x030)
318 317
319/* PM_CLK_GATE_REG */ 318/* PM_CLK_GATE_REG */
320#define PM_CLK_GATE_REG_OFFSET_SDIO (25) 319#define PM_CLK_GATE_REG_OFFSET_SDIO (25)
diff --git a/arch/arm/mach-cns3xxx/pcie.c b/arch/arm/mach-cns3xxx/pcie.c
new file mode 100644
index 000000000000..38088c36936c
--- /dev/null
+++ b/arch/arm/mach-cns3xxx/pcie.c
@@ -0,0 +1,389 @@
1/*
2 * PCI-E support for CNS3xxx
3 *
4 * Copyright 2008 Cavium Networks
5 * Richard Liu <richard.liu@caviumnetworks.com>
6 * Copyright 2010 MontaVista Software, LLC.
7 * Anton Vorontsov <avorontsov@mvista.com>
8 *
9 * This file is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License, Version 2, as
11 * published by the Free Software Foundation.
12 */
13
14#include <linux/init.h>
15#include <linux/kernel.h>
16#include <linux/bug.h>
17#include <linux/pci.h>
18#include <linux/io.h>
19#include <linux/ioport.h>
20#include <linux/interrupt.h>
21#include <linux/ptrace.h>
22#include <asm/mach/map.h>
23#include <mach/cns3xxx.h>
24#include "core.h"
25
26enum cns3xxx_access_type {
27 CNS3XXX_HOST_TYPE = 0,
28 CNS3XXX_CFG0_TYPE,
29 CNS3XXX_CFG1_TYPE,
30 CNS3XXX_NUM_ACCESS_TYPES,
31};
32
33struct cns3xxx_pcie {
34 struct map_desc cfg_bases[CNS3XXX_NUM_ACCESS_TYPES];
35 unsigned int irqs[2];
36 struct resource res_io;
37 struct resource res_mem;
38 struct hw_pci hw_pci;
39
40 bool linked;
41};
42
43static struct cns3xxx_pcie cns3xxx_pcie[]; /* forward decl. */
44
45static struct cns3xxx_pcie *sysdata_to_cnspci(void *sysdata)
46{
47 struct pci_sys_data *root = sysdata;
48
49 return &cns3xxx_pcie[root->domain];
50}
51
52static struct cns3xxx_pcie *pdev_to_cnspci(struct pci_dev *dev)
53{
54 return sysdata_to_cnspci(dev->sysdata);
55}
56
57static struct cns3xxx_pcie *pbus_to_cnspci(struct pci_bus *bus)
58{
59 return sysdata_to_cnspci(bus->sysdata);
60}
61
62static void __iomem *cns3xxx_pci_cfg_base(struct pci_bus *bus,
63 unsigned int devfn, int where)
64{
65 struct cns3xxx_pcie *cnspci = pbus_to_cnspci(bus);
66 int busno = bus->number;
67 int slot = PCI_SLOT(devfn);
68 int offset;
69 enum cns3xxx_access_type type;
70 void __iomem *base;
71
72 /* If there is no link, just show the CNS PCI bridge. */
73 if (!cnspci->linked && (busno > 0 || slot > 0))
74 return NULL;
75
76 /*
77 * The CNS PCI bridge doesn't fit into the PCI hierarchy, though
78 * we still want to access it. For this to work, we must place
79 * the first device on the same bus as the CNS PCI bridge.
80 */
81 if (busno == 0) {
82 if (slot > 1)
83 return NULL;
84 type = slot;
85 } else {
86 type = CNS3XXX_CFG1_TYPE;
87 }
88
89 base = (void __iomem *)cnspci->cfg_bases[type].virtual;
90 offset = ((busno & 0xf) << 20) | (devfn << 12) | (where & 0xffc);
91
92 return base + offset;
93}
94
95static int cns3xxx_pci_read_config(struct pci_bus *bus, unsigned int devfn,
96 int where, int size, u32 *val)
97{
98 u32 v;
99 void __iomem *base;
100 u32 mask = (0x1ull << (size * 8)) - 1;
101 int shift = (where % 4) * 8;
102
103 base = cns3xxx_pci_cfg_base(bus, devfn, where);
104 if (!base) {
105 *val = 0xffffffff;
106 return PCIBIOS_SUCCESSFUL;
107 }
108
109 v = __raw_readl(base);
110
111 if (bus->number == 0 && devfn == 0 &&
112 (where & 0xffc) == PCI_CLASS_REVISION) {
113 /*
114 * RC's class is 0xb, but Linux PCI driver needs 0x604
115 * for a PCIe bridge. So we must fixup the class code
116 * to 0x604 here.
117 */
118 v &= 0xff;
119 v |= 0x604 << 16;
120 }
121
122 *val = (v >> shift) & mask;
123
124 return PCIBIOS_SUCCESSFUL;
125}
126
127static int cns3xxx_pci_write_config(struct pci_bus *bus, unsigned int devfn,
128 int where, int size, u32 val)
129{
130 u32 v;
131 void __iomem *base;
132 u32 mask = (0x1ull << (size * 8)) - 1;
133 int shift = (where % 4) * 8;
134
135 base = cns3xxx_pci_cfg_base(bus, devfn, where);
136 if (!base)
137 return PCIBIOS_SUCCESSFUL;
138
139 v = __raw_readl(base);
140
141 v &= ~(mask << shift);
142 v |= (val & mask) << shift;
143
144 __raw_writel(v, base);
145
146 return PCIBIOS_SUCCESSFUL;
147}
148
149static int cns3xxx_pci_setup(int nr, struct pci_sys_data *sys)
150{
151 struct cns3xxx_pcie *cnspci = sysdata_to_cnspci(sys);
152 struct resource *res_io = &cnspci->res_io;
153 struct resource *res_mem = &cnspci->res_mem;
154 struct resource **sysres = sys->resource;
155
156 BUG_ON(request_resource(&iomem_resource, res_io) ||
157 request_resource(&iomem_resource, res_mem));
158
159 sysres[0] = res_io;
160 sysres[1] = res_mem;
161
162 return 1;
163}
164
165static struct pci_ops cns3xxx_pcie_ops = {
166 .read = cns3xxx_pci_read_config,
167 .write = cns3xxx_pci_write_config,
168};
169
170static struct pci_bus *cns3xxx_pci_scan_bus(int nr, struct pci_sys_data *sys)
171{
172 return pci_scan_bus(sys->busnr, &cns3xxx_pcie_ops, sys);
173}
174
175static int cns3xxx_pcie_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
176{
177 struct cns3xxx_pcie *cnspci = pdev_to_cnspci(dev);
178 int irq = cnspci->irqs[slot];
179
180 pr_info("PCIe map irq: %04d:%02x:%02x.%02x slot %d, pin %d, irq: %d\n",
181 pci_domain_nr(dev->bus), dev->bus->number, PCI_SLOT(dev->devfn),
182 PCI_FUNC(dev->devfn), slot, pin, irq);
183
184 return irq;
185}
186
187static struct cns3xxx_pcie cns3xxx_pcie[] = {
188 [0] = {
189 .cfg_bases = {
190 [CNS3XXX_HOST_TYPE] = {
191 .virtual = CNS3XXX_PCIE0_HOST_BASE_VIRT,
192 .pfn = __phys_to_pfn(CNS3XXX_PCIE0_HOST_BASE),
193 .length = SZ_16M,
194 .type = MT_DEVICE,
195 },
196 [CNS3XXX_CFG0_TYPE] = {
197 .virtual = CNS3XXX_PCIE0_CFG0_BASE_VIRT,
198 .pfn = __phys_to_pfn(CNS3XXX_PCIE0_CFG0_BASE),
199 .length = SZ_16M,
200 .type = MT_DEVICE,
201 },
202 [CNS3XXX_CFG1_TYPE] = {
203 .virtual = CNS3XXX_PCIE0_CFG1_BASE_VIRT,
204 .pfn = __phys_to_pfn(CNS3XXX_PCIE0_CFG1_BASE),
205 .length = SZ_16M,
206 .type = MT_DEVICE,
207 },
208 },
209 .res_io = {
210 .name = "PCIe0 I/O space",
211 .start = CNS3XXX_PCIE0_IO_BASE,
212 .end = CNS3XXX_PCIE0_IO_BASE + SZ_16M - 1,
213 .flags = IORESOURCE_IO,
214 },
215 .res_mem = {
216 .name = "PCIe0 non-prefetchable",
217 .start = CNS3XXX_PCIE0_MEM_BASE,
218 .end = CNS3XXX_PCIE0_MEM_BASE + SZ_16M - 1,
219 .flags = IORESOURCE_MEM,
220 },
221 .irqs = { IRQ_CNS3XXX_PCIE0_RC, IRQ_CNS3XXX_PCIE0_DEVICE, },
222 .hw_pci = {
223 .domain = 0,
224 .swizzle = pci_std_swizzle,
225 .nr_controllers = 1,
226 .setup = cns3xxx_pci_setup,
227 .scan = cns3xxx_pci_scan_bus,
228 .map_irq = cns3xxx_pcie_map_irq,
229 },
230 },
231 [1] = {
232 .cfg_bases = {
233 [CNS3XXX_HOST_TYPE] = {
234 .virtual = CNS3XXX_PCIE1_HOST_BASE_VIRT,
235 .pfn = __phys_to_pfn(CNS3XXX_PCIE1_HOST_BASE),
236 .length = SZ_16M,
237 .type = MT_DEVICE,
238 },
239 [CNS3XXX_CFG0_TYPE] = {
240 .virtual = CNS3XXX_PCIE1_CFG0_BASE_VIRT,
241 .pfn = __phys_to_pfn(CNS3XXX_PCIE1_CFG0_BASE),
242 .length = SZ_16M,
243 .type = MT_DEVICE,
244 },
245 [CNS3XXX_CFG1_TYPE] = {
246 .virtual = CNS3XXX_PCIE1_CFG1_BASE_VIRT,
247 .pfn = __phys_to_pfn(CNS3XXX_PCIE1_CFG1_BASE),
248 .length = SZ_16M,
249 .type = MT_DEVICE,
250 },
251 },
252 .res_io = {
253 .name = "PCIe1 I/O space",
254 .start = CNS3XXX_PCIE1_IO_BASE,
255 .end = CNS3XXX_PCIE1_IO_BASE + SZ_16M - 1,
256 .flags = IORESOURCE_IO,
257 },
258 .res_mem = {
259 .name = "PCIe1 non-prefetchable",
260 .start = CNS3XXX_PCIE1_MEM_BASE,
261 .end = CNS3XXX_PCIE1_MEM_BASE + SZ_16M - 1,
262 .flags = IORESOURCE_MEM,
263 },
264 .irqs = { IRQ_CNS3XXX_PCIE1_RC, IRQ_CNS3XXX_PCIE1_DEVICE, },
265 .hw_pci = {
266 .domain = 1,
267 .swizzle = pci_std_swizzle,
268 .nr_controllers = 1,
269 .setup = cns3xxx_pci_setup,
270 .scan = cns3xxx_pci_scan_bus,
271 .map_irq = cns3xxx_pcie_map_irq,
272 },
273 },
274};
275
276static void __init cns3xxx_pcie_check_link(struct cns3xxx_pcie *cnspci)
277{
278 int port = cnspci->hw_pci.domain;
279 u32 reg;
280 unsigned long time;
281
282 reg = __raw_readl(MISC_PCIE_CTRL(port));
283 /*
284 * Enable Application Request to 1, it will exit L1 automatically,
285 * but when chip back, it will use another clock, still can use 0x1.
286 */
287 reg |= 0x3;
288 __raw_writel(reg, MISC_PCIE_CTRL(port));
289
290 pr_info("PCIe: Port[%d] Enable PCIe LTSSM\n", port);
291 pr_info("PCIe: Port[%d] Check data link layer...", port);
292
293 time = jiffies;
294 while (1) {
295 reg = __raw_readl(MISC_PCIE_PM_DEBUG(port));
296 if (reg & 0x1) {
297 pr_info("Link up.\n");
298 cnspci->linked = 1;
299 break;
300 } else if (time_after(jiffies, time + 50)) {
301 pr_info("Device not found.\n");
302 break;
303 }
304 }
305}
306
307static void __init cns3xxx_pcie_hw_init(struct cns3xxx_pcie *cnspci)
308{
309 int port = cnspci->hw_pci.domain;
310 struct pci_sys_data sd = {
311 .domain = port,
312 };
313 struct pci_bus bus = {
314 .number = 0,
315 .ops = &cns3xxx_pcie_ops,
316 .sysdata = &sd,
317 };
318 u32 io_base = cnspci->res_io.start >> 16;
319 u32 mem_base = cnspci->res_mem.start >> 16;
320 u32 host_base = cnspci->cfg_bases[CNS3XXX_HOST_TYPE].pfn;
321 u32 cfg0_base = cnspci->cfg_bases[CNS3XXX_CFG0_TYPE].pfn;
322 u32 devfn = 0;
323 u8 tmp8;
324 u16 pos;
325 u16 dc;
326
327 host_base = (__pfn_to_phys(host_base) - 1) >> 16;
328 cfg0_base = (__pfn_to_phys(cfg0_base) - 1) >> 16;
329
330 pci_bus_write_config_byte(&bus, devfn, PCI_PRIMARY_BUS, 0);
331 pci_bus_write_config_byte(&bus, devfn, PCI_SECONDARY_BUS, 1);
332 pci_bus_write_config_byte(&bus, devfn, PCI_SUBORDINATE_BUS, 1);
333
334 pci_bus_read_config_byte(&bus, devfn, PCI_PRIMARY_BUS, &tmp8);
335 pci_bus_read_config_byte(&bus, devfn, PCI_SECONDARY_BUS, &tmp8);
336 pci_bus_read_config_byte(&bus, devfn, PCI_SUBORDINATE_BUS, &tmp8);
337
338 pci_bus_write_config_word(&bus, devfn, PCI_MEMORY_BASE, mem_base);
339 pci_bus_write_config_word(&bus, devfn, PCI_MEMORY_LIMIT, host_base);
340 pci_bus_write_config_word(&bus, devfn, PCI_IO_BASE_UPPER16, io_base);
341 pci_bus_write_config_word(&bus, devfn, PCI_IO_LIMIT_UPPER16, cfg0_base);
342
343 if (!cnspci->linked)
344 return;
345
346 /* Set Device Max_Read_Request_Size to 128 byte */
347 devfn = PCI_DEVFN(1, 0);
348 pos = pci_bus_find_capability(&bus, devfn, PCI_CAP_ID_EXP);
349 pci_bus_read_config_word(&bus, devfn, pos + PCI_EXP_DEVCTL, &dc);
350 dc &= ~(0x3 << 12); /* Clear Device Control Register [14:12] */
351 pci_bus_write_config_word(&bus, devfn, pos + PCI_EXP_DEVCTL, dc);
352 pci_bus_read_config_word(&bus, devfn, pos + PCI_EXP_DEVCTL, &dc);
353 if (!(dc & (0x3 << 12)))
354 pr_info("PCIe: Set Device Max_Read_Request_Size to 128 byte\n");
355
356 /* Disable PCIe0 Interrupt Mask INTA to INTD */
357 __raw_writel(~0x3FFF, MISC_PCIE_INT_MASK(port));
358}
359
360static int cns3xxx_pcie_abort_handler(unsigned long addr, unsigned int fsr,
361 struct pt_regs *regs)
362{
363 if (fsr & (1 << 10))
364 regs->ARM_pc += 4;
365 return 0;
366}
367
368static int __init cns3xxx_pcie_init(void)
369{
370 int i;
371
372 hook_fault_code(16 + 6, cns3xxx_pcie_abort_handler, SIGBUS,
373 "imprecise external abort");
374
375 for (i = 0; i < ARRAY_SIZE(cns3xxx_pcie); i++) {
376 iotable_init(cns3xxx_pcie[i].cfg_bases,
377 ARRAY_SIZE(cns3xxx_pcie[i].cfg_bases));
378 cns3xxx_pwr_clk_en(0x1 << PM_CLK_GATE_REG_OFFSET_PCIE(i));
379 cns3xxx_pwr_soft_rst(0x1 << PM_SOFT_RST_REG_OFFST_PCIE(i));
380 cns3xxx_pcie_check_link(&cns3xxx_pcie[i]);
381 cns3xxx_pcie_hw_init(&cns3xxx_pcie[i]);
382 pci_common_init(&cns3xxx_pcie[i].hw_pci);
383 }
384
385 pci_assign_unassigned_resources();
386
387 return 0;
388}
389device_initcall(cns3xxx_pcie_init);
diff --git a/arch/arm/mach-cns3xxx/pm.c b/arch/arm/mach-cns3xxx/pm.c
index 725e1a4fc231..38e44706feab 100644
--- a/arch/arm/mach-cns3xxx/pm.c
+++ b/arch/arm/mach-cns3xxx/pm.c
@@ -6,18 +6,25 @@
6 * published by the Free Software Foundation. 6 * published by the Free Software Foundation.
7 */ 7 */
8 8
9#include <linux/io.h>
9#include <linux/delay.h> 10#include <linux/delay.h>
10#include <mach/system.h> 11#include <mach/system.h>
11#include <mach/cns3xxx.h> 12#include <mach/cns3xxx.h>
12 13
13void cns3xxx_pwr_clk_en(unsigned int block) 14void cns3xxx_pwr_clk_en(unsigned int block)
14{ 15{
15 PM_CLK_GATE_REG |= (block & PM_CLK_GATE_REG_MASK); 16 u32 reg = __raw_readl(PM_CLK_GATE_REG);
17
18 reg |= (block & PM_CLK_GATE_REG_MASK);
19 __raw_writel(reg, PM_CLK_GATE_REG);
16} 20}
17 21
18void cns3xxx_pwr_power_up(unsigned int block) 22void cns3xxx_pwr_power_up(unsigned int block)
19{ 23{
20 PM_PLL_HM_PD_CTRL_REG &= ~(block & CNS3XXX_PWR_PLL_ALL); 24 u32 reg = __raw_readl(PM_PLL_HM_PD_CTRL_REG);
25
26 reg &= ~(block & CNS3XXX_PWR_PLL_ALL);
27 __raw_writel(reg, PM_PLL_HM_PD_CTRL_REG);
21 28
22 /* Wait for 300us for the PLL output clock locked. */ 29 /* Wait for 300us for the PLL output clock locked. */
23 udelay(300); 30 udelay(300);
@@ -25,22 +32,29 @@ void cns3xxx_pwr_power_up(unsigned int block)
25 32
26void cns3xxx_pwr_power_down(unsigned int block) 33void cns3xxx_pwr_power_down(unsigned int block)
27{ 34{
35 u32 reg = __raw_readl(PM_PLL_HM_PD_CTRL_REG);
36
28 /* write '1' to power down */ 37 /* write '1' to power down */
29 PM_PLL_HM_PD_CTRL_REG |= (block & CNS3XXX_PWR_PLL_ALL); 38 reg |= (block & CNS3XXX_PWR_PLL_ALL);
39 __raw_writel(reg, PM_PLL_HM_PD_CTRL_REG);
30}; 40};
31 41
32static void cns3xxx_pwr_soft_rst_force(unsigned int block) 42static void cns3xxx_pwr_soft_rst_force(unsigned int block)
33{ 43{
44 u32 reg = __raw_readl(PM_SOFT_RST_REG);
45
34 /* 46 /*
35 * bit 0, 28, 29 => program low to reset, 47 * bit 0, 28, 29 => program low to reset,
36 * the other else program low and then high 48 * the other else program low and then high
37 */ 49 */
38 if (block & 0x30000001) { 50 if (block & 0x30000001) {
39 PM_SOFT_RST_REG &= ~(block & PM_SOFT_RST_REG_MASK); 51 reg &= ~(block & PM_SOFT_RST_REG_MASK);
40 } else { 52 } else {
41 PM_SOFT_RST_REG &= ~(block & PM_SOFT_RST_REG_MASK); 53 reg &= ~(block & PM_SOFT_RST_REG_MASK);
42 PM_SOFT_RST_REG |= (block & PM_SOFT_RST_REG_MASK); 54 reg |= (block & PM_SOFT_RST_REG_MASK);
43 } 55 }
56
57 __raw_writel(reg, PM_SOFT_RST_REG);
44} 58}
45 59
46void cns3xxx_pwr_soft_rst(unsigned int block) 60void cns3xxx_pwr_soft_rst(unsigned int block)
@@ -73,12 +87,13 @@ void arch_reset(char mode, const char *cmd)
73 */ 87 */
74int cns3xxx_cpu_clock(void) 88int cns3xxx_cpu_clock(void)
75{ 89{
90 u32 reg = __raw_readl(PM_CLK_CTRL_REG);
76 int cpu; 91 int cpu;
77 int cpu_sel; 92 int cpu_sel;
78 int div_sel; 93 int div_sel;
79 94
80 cpu_sel = (PM_CLK_CTRL_REG >> PM_CLK_CTRL_REG_OFFSET_PLL_CPU_SEL) & 0xf; 95 cpu_sel = (reg >> PM_CLK_CTRL_REG_OFFSET_PLL_CPU_SEL) & 0xf;
81 div_sel = (PM_CLK_CTRL_REG >> PM_CLK_CTRL_REG_OFFSET_CPU_CLK_DIV) & 0x3; 96 div_sel = (reg >> PM_CLK_CTRL_REG_OFFSET_CPU_CLK_DIV) & 0x3;
82 97
83 cpu = (300 + ((cpu_sel / 3) * 100) + ((cpu_sel % 3) * 33)) >> div_sel; 98 cpu = (300 + ((cpu_sel / 3) * 100) + ((cpu_sel % 3) * 33)) >> div_sel;
84 99
diff --git a/arch/arm/mach-davinci/board-da850-evm.c b/arch/arm/mach-davinci/board-da850-evm.c
index 2ec3095ffb7b..b280efb1fa12 100644
--- a/arch/arm/mach-davinci/board-da850-evm.c
+++ b/arch/arm/mach-davinci/board-da850-evm.c
@@ -25,6 +25,7 @@
25#include <linux/mtd/partitions.h> 25#include <linux/mtd/partitions.h>
26#include <linux/mtd/physmap.h> 26#include <linux/mtd/physmap.h>
27#include <linux/regulator/machine.h> 27#include <linux/regulator/machine.h>
28#include <linux/regulator/tps6507x.h>
28#include <linux/mfd/tps6507x.h> 29#include <linux/mfd/tps6507x.h>
29#include <linux/input/tps6507x-ts.h> 30#include <linux/input/tps6507x-ts.h>
30 31
@@ -469,6 +470,11 @@ struct regulator_consumer_supply tps65070_ldo2_consumers[] = {
469 }, 470 },
470}; 471};
471 472
473/* We take advantage of the fact that both defdcdc{2,3} are tied high */
474static struct tps6507x_reg_platform_data tps6507x_platform_data = {
475 .defdcdc_default = true,
476};
477
472struct regulator_init_data tps65070_regulator_data[] = { 478struct regulator_init_data tps65070_regulator_data[] = {
473 /* dcdc1 */ 479 /* dcdc1 */
474 { 480 {
@@ -494,6 +500,7 @@ struct regulator_init_data tps65070_regulator_data[] = {
494 }, 500 },
495 .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc2_consumers), 501 .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc2_consumers),
496 .consumer_supplies = tps65070_dcdc2_consumers, 502 .consumer_supplies = tps65070_dcdc2_consumers,
503 .driver_data = &tps6507x_platform_data,
497 }, 504 },
498 505
499 /* dcdc3 */ 506 /* dcdc3 */
@@ -507,6 +514,7 @@ struct regulator_init_data tps65070_regulator_data[] = {
507 }, 514 },
508 .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc3_consumers), 515 .num_consumer_supplies = ARRAY_SIZE(tps65070_dcdc3_consumers),
509 .consumer_supplies = tps65070_dcdc3_consumers, 516 .consumer_supplies = tps65070_dcdc3_consumers,
517 .driver_data = &tps6507x_platform_data,
510 }, 518 },
511 519
512 /* ldo1 */ 520 /* ldo1 */
diff --git a/arch/arm/mach-davinci/include/mach/memory.h b/arch/arm/mach-davinci/include/mach/memory.h
index a91edfb8beea..22eb97c1c30b 100644
--- a/arch/arm/mach-davinci/include/mach/memory.h
+++ b/arch/arm/mach-davinci/include/mach/memory.h
@@ -48,19 +48,16 @@
48 * below 128M 48 * below 128M
49 */ 49 */
50static inline void 50static inline void
51__arch_adjust_zones(int node, unsigned long *size, unsigned long *holes) 51__arch_adjust_zones(unsigned long *size, unsigned long *holes)
52{ 52{
53 unsigned int sz = (128<<20) >> PAGE_SHIFT; 53 unsigned int sz = (128<<20) >> PAGE_SHIFT;
54 54
55 if (node != 0)
56 sz = 0;
57
58 size[1] = size[0] - sz; 55 size[1] = size[0] - sz;
59 size[0] = sz; 56 size[0] = sz;
60} 57}
61 58
62#define arch_adjust_zones(node, zone_size, holes) \ 59#define arch_adjust_zones(zone_size, holes) \
63 if ((meminfo.bank[0].size >> 20) > 128) __arch_adjust_zones(node, zone_size, holes) 60 if ((meminfo.bank[0].size >> 20) > 128) __arch_adjust_zones(zone_size, holes)
64 61
65#define ISA_DMA_THRESHOLD (PHYS_OFFSET + (128<<20) - 1) 62#define ISA_DMA_THRESHOLD (PHYS_OFFSET + (128<<20) - 1)
66#define MAX_DMA_ADDRESS (PAGE_OFFSET + (128<<20)) 63#define MAX_DMA_ADDRESS (PAGE_OFFSET + (128<<20))
diff --git a/arch/arm/mach-dove/common.c b/arch/arm/mach-dove/common.c
index 5da2cf402c81..f7a12586a1f5 100644
--- a/arch/arm/mach-dove/common.c
+++ b/arch/arm/mach-dove/common.c
@@ -752,6 +752,67 @@ void __init dove_xor1_init(void)
752 platform_device_register(&dove_xor11_channel); 752 platform_device_register(&dove_xor11_channel);
753} 753}
754 754
755/*****************************************************************************
756 * SDIO
757 ****************************************************************************/
758static u64 sdio_dmamask = DMA_BIT_MASK(32);
759
760static struct resource dove_sdio0_resources[] = {
761 {
762 .start = DOVE_SDIO0_PHYS_BASE,
763 .end = DOVE_SDIO0_PHYS_BASE + 0xff,
764 .flags = IORESOURCE_MEM,
765 }, {
766 .start = IRQ_DOVE_SDIO0,
767 .end = IRQ_DOVE_SDIO0,
768 .flags = IORESOURCE_IRQ,
769 },
770};
771
772static struct platform_device dove_sdio0 = {
773 .name = "sdhci-mv",
774 .id = 0,
775 .dev = {
776 .dma_mask = &sdio_dmamask,
777 .coherent_dma_mask = DMA_BIT_MASK(32),
778 },
779 .resource = dove_sdio0_resources,
780 .num_resources = ARRAY_SIZE(dove_sdio0_resources),
781};
782
783void __init dove_sdio0_init(void)
784{
785 platform_device_register(&dove_sdio0);
786}
787
788static struct resource dove_sdio1_resources[] = {
789 {
790 .start = DOVE_SDIO1_PHYS_BASE,
791 .end = DOVE_SDIO1_PHYS_BASE + 0xff,
792 .flags = IORESOURCE_MEM,
793 }, {
794 .start = IRQ_DOVE_SDIO1,
795 .end = IRQ_DOVE_SDIO1,
796 .flags = IORESOURCE_IRQ,
797 },
798};
799
800static struct platform_device dove_sdio1 = {
801 .name = "sdhci-mv",
802 .id = 1,
803 .dev = {
804 .dma_mask = &sdio_dmamask,
805 .coherent_dma_mask = DMA_BIT_MASK(32),
806 },
807 .resource = dove_sdio1_resources,
808 .num_resources = ARRAY_SIZE(dove_sdio1_resources),
809};
810
811void __init dove_sdio1_init(void)
812{
813 platform_device_register(&dove_sdio1);
814}
815
755void __init dove_init(void) 816void __init dove_init(void)
756{ 817{
757 int tclk; 818 int tclk;
diff --git a/arch/arm/mach-dove/common.h b/arch/arm/mach-dove/common.h
index b29e8937de4f..a51517c3fe76 100644
--- a/arch/arm/mach-dove/common.h
+++ b/arch/arm/mach-dove/common.h
@@ -36,5 +36,7 @@ void dove_uart3_init(void);
36void dove_spi0_init(void); 36void dove_spi0_init(void);
37void dove_spi1_init(void); 37void dove_spi1_init(void);
38void dove_i2c_init(void); 38void dove_i2c_init(void);
39void dove_sdio0_init(void);
40void dove_sdio1_init(void);
39 41
40#endif 42#endif
diff --git a/arch/arm/mach-dove/dove-db-setup.c b/arch/arm/mach-dove/dove-db-setup.c
index f2971b745224..bef70460fbc6 100644
--- a/arch/arm/mach-dove/dove-db-setup.c
+++ b/arch/arm/mach-dove/dove-db-setup.c
@@ -82,6 +82,8 @@ static void __init dove_db_init(void)
82 dove_ehci0_init(); 82 dove_ehci0_init();
83 dove_ehci1_init(); 83 dove_ehci1_init();
84 dove_sata_init(&dove_db_sata_data); 84 dove_sata_init(&dove_db_sata_data);
85 dove_sdio0_init();
86 dove_sdio1_init();
85 dove_spi0_init(); 87 dove_spi0_init();
86 dove_spi1_init(); 88 dove_spi1_init();
87 dove_uart0_init(); 89 dove_uart0_init();
diff --git a/arch/arm/mach-ep93xx/adssphere.c b/arch/arm/mach-ep93xx/adssphere.c
index 3a1a855bfdca..f744f676783f 100644
--- a/arch/arm/mach-ep93xx/adssphere.c
+++ b/arch/arm/mach-ep93xx/adssphere.c
@@ -13,7 +13,6 @@
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>
16#include <linux/mtd/physmap.h>
17 16
18#include <mach/hardware.h> 17#include <mach/hardware.h>
19 18
@@ -21,26 +20,6 @@
21#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
22 21
23 22
24static struct physmap_flash_data adssphere_flash_data = {
25 .width = 4,
26};
27
28static struct resource adssphere_flash_resource = {
29 .start = EP93XX_CS6_PHYS_BASE,
30 .end = EP93XX_CS6_PHYS_BASE + SZ_32M - 1,
31 .flags = IORESOURCE_MEM,
32};
33
34static struct platform_device adssphere_flash = {
35 .name = "physmap-flash",
36 .id = 0,
37 .dev = {
38 .platform_data = &adssphere_flash_data,
39 },
40 .num_resources = 1,
41 .resource = &adssphere_flash_resource,
42};
43
44static struct ep93xx_eth_data __initdata adssphere_eth_data = { 23static struct ep93xx_eth_data __initdata adssphere_eth_data = {
45 .phy_id = 1, 24 .phy_id = 1,
46}; 25};
@@ -48,8 +27,7 @@ static struct ep93xx_eth_data __initdata adssphere_eth_data = {
48static void __init adssphere_init_machine(void) 27static void __init adssphere_init_machine(void)
49{ 28{
50 ep93xx_init_devices(); 29 ep93xx_init_devices();
51 platform_device_register(&adssphere_flash); 30 ep93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M);
52
53 ep93xx_register_eth(&adssphere_eth_data, 1); 31 ep93xx_register_eth(&adssphere_eth_data, 1);
54} 32}
55 33
diff --git a/arch/arm/mach-ep93xx/clock.c b/arch/arm/mach-ep93xx/clock.c
index e29bdef9b2e2..7f3039761d91 100644
--- a/arch/arm/mach-ep93xx/clock.c
+++ b/arch/arm/mach-ep93xx/clock.c
@@ -185,7 +185,7 @@ static struct clk_lookup clocks[] = {
185 INIT_CK(NULL, "pll1", &clk_pll1), 185 INIT_CK(NULL, "pll1", &clk_pll1),
186 INIT_CK(NULL, "fclk", &clk_f), 186 INIT_CK(NULL, "fclk", &clk_f),
187 INIT_CK(NULL, "hclk", &clk_h), 187 INIT_CK(NULL, "hclk", &clk_h),
188 INIT_CK(NULL, "pclk", &clk_p), 188 INIT_CK(NULL, "apb_pclk", &clk_p),
189 INIT_CK(NULL, "pll2", &clk_pll2), 189 INIT_CK(NULL, "pll2", &clk_pll2),
190 INIT_CK("ep93xx-ohci", NULL, &clk_usb_host), 190 INIT_CK("ep93xx-ohci", NULL, &clk_usb_host),
191 INIT_CK("ep93xx-keypad", NULL, &clk_keypad), 191 INIT_CK("ep93xx-keypad", NULL, &clk_keypad),
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c
index 9092677f63eb..8e37a045188c 100644
--- a/arch/arm/mach-ep93xx/core.c
+++ b/arch/arm/mach-ep93xx/core.c
@@ -29,6 +29,7 @@
29#include <linux/termios.h> 29#include <linux/termios.h>
30#include <linux/amba/bus.h> 30#include <linux/amba/bus.h>
31#include <linux/amba/serial.h> 31#include <linux/amba/serial.h>
32#include <linux/mtd/physmap.h>
32#include <linux/i2c.h> 33#include <linux/i2c.h>
33#include <linux/i2c-gpio.h> 34#include <linux/i2c-gpio.h>
34#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
@@ -215,8 +216,8 @@ void ep93xx_devcfg_set_clear(unsigned int set_bits, unsigned int clear_bits)
215 spin_lock_irqsave(&syscon_swlock, flags); 216 spin_lock_irqsave(&syscon_swlock, flags);
216 217
217 val = __raw_readl(EP93XX_SYSCON_DEVCFG); 218 val = __raw_readl(EP93XX_SYSCON_DEVCFG);
218 val |= set_bits;
219 val &= ~clear_bits; 219 val &= ~clear_bits;
220 val |= set_bits;
220 __raw_writel(0xaa, EP93XX_SYSCON_SWLOCK); 221 __raw_writel(0xaa, EP93XX_SYSCON_SWLOCK);
221 __raw_writel(val, EP93XX_SYSCON_DEVCFG); 222 __raw_writel(val, EP93XX_SYSCON_DEVCFG);
222 223
@@ -348,6 +349,43 @@ static struct platform_device ep93xx_ohci_device = {
348 349
349 350
350/************************************************************************* 351/*************************************************************************
352 * EP93xx physmap'ed flash
353 *************************************************************************/
354static struct physmap_flash_data ep93xx_flash_data;
355
356static struct resource ep93xx_flash_resource = {
357 .flags = IORESOURCE_MEM,
358};
359
360static struct platform_device ep93xx_flash = {
361 .name = "physmap-flash",
362 .id = 0,
363 .dev = {
364 .platform_data = &ep93xx_flash_data,
365 },
366 .num_resources = 1,
367 .resource = &ep93xx_flash_resource,
368};
369
370/**
371 * ep93xx_register_flash() - Register the external flash device.
372 * @width: bank width in octets
373 * @start: resource start address
374 * @size: resource size
375 */
376void __init ep93xx_register_flash(unsigned int width,
377 resource_size_t start, resource_size_t size)
378{
379 ep93xx_flash_data.width = width;
380
381 ep93xx_flash_resource.start = start;
382 ep93xx_flash_resource.end = start + size - 1;
383
384 platform_device_register(&ep93xx_flash);
385}
386
387
388/*************************************************************************
351 * EP93xx ethernet peripheral handling 389 * EP93xx ethernet peripheral handling
352 *************************************************************************/ 390 *************************************************************************/
353static struct ep93xx_eth_data ep93xx_eth_data; 391static struct ep93xx_eth_data ep93xx_eth_data;
@@ -620,6 +658,11 @@ static struct platform_device ep93xx_fb_device = {
620 .resource = ep93xx_fb_resource, 658 .resource = ep93xx_fb_resource,
621}; 659};
622 660
661static struct platform_device ep93xx_bl_device = {
662 .name = "ep93xx-bl",
663 .id = -1,
664};
665
623/** 666/**
624 * ep93xx_register_fb - Register the framebuffer platform device. 667 * ep93xx_register_fb - Register the framebuffer platform device.
625 * @data: platform specific framebuffer configuration (__initdata) 668 * @data: platform specific framebuffer configuration (__initdata)
@@ -628,6 +671,7 @@ void __init ep93xx_register_fb(struct ep93xxfb_mach_info *data)
628{ 671{
629 ep93xxfb_data = *data; 672 ep93xxfb_data = *data;
630 platform_device_register(&ep93xx_fb_device); 673 platform_device_register(&ep93xx_fb_device);
674 platform_device_register(&ep93xx_bl_device);
631} 675}
632 676
633 677
diff --git a/arch/arm/mach-ep93xx/edb93xx.c b/arch/arm/mach-ep93xx/edb93xx.c
index 3884182cd362..c2ce9034ba87 100644
--- a/arch/arm/mach-ep93xx/edb93xx.c
+++ b/arch/arm/mach-ep93xx/edb93xx.c
@@ -27,7 +27,6 @@
27#include <linux/kernel.h> 27#include <linux/kernel.h>
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/platform_device.h> 29#include <linux/platform_device.h>
30#include <linux/mtd/physmap.h>
31#include <linux/gpio.h> 30#include <linux/gpio.h>
32#include <linux/i2c.h> 31#include <linux/i2c.h>
33#include <linux/i2c-gpio.h> 32#include <linux/i2c-gpio.h>
@@ -38,39 +37,13 @@
38#include <asm/mach/arch.h> 37#include <asm/mach/arch.h>
39 38
40 39
41static struct physmap_flash_data edb93xx_flash_data;
42
43static struct resource edb93xx_flash_resource = {
44 .flags = IORESOURCE_MEM,
45};
46
47static struct platform_device edb93xx_flash = {
48 .name = "physmap-flash",
49 .id = 0,
50 .dev = {
51 .platform_data = &edb93xx_flash_data,
52 },
53 .num_resources = 1,
54 .resource = &edb93xx_flash_resource,
55};
56
57static void __init __edb93xx_register_flash(unsigned int width,
58 resource_size_t start, resource_size_t size)
59{
60 edb93xx_flash_data.width = width;
61 edb93xx_flash_resource.start = start;
62 edb93xx_flash_resource.end = start + size - 1;
63
64 platform_device_register(&edb93xx_flash);
65}
66
67static void __init edb93xx_register_flash(void) 40static void __init edb93xx_register_flash(void)
68{ 41{
69 if (machine_is_edb9307() || machine_is_edb9312() || 42 if (machine_is_edb9307() || machine_is_edb9312() ||
70 machine_is_edb9315()) { 43 machine_is_edb9315()) {
71 __edb93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M); 44 ep93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_32M);
72 } else { 45 } else {
73 __edb93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M); 46 ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
74 } 47 }
75} 48}
76 49
diff --git a/arch/arm/mach-ep93xx/gesbc9312.c b/arch/arm/mach-ep93xx/gesbc9312.c
index a809618e9f05..d97168c0ba33 100644
--- a/arch/arm/mach-ep93xx/gesbc9312.c
+++ b/arch/arm/mach-ep93xx/gesbc9312.c
@@ -13,7 +13,6 @@
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>
16#include <linux/mtd/physmap.h>
17 16
18#include <mach/hardware.h> 17#include <mach/hardware.h>
19 18
@@ -21,26 +20,6 @@
21#include <asm/mach/arch.h> 20#include <asm/mach/arch.h>
22 21
23 22
24static struct physmap_flash_data gesbc9312_flash_data = {
25 .width = 4,
26};
27
28static struct resource gesbc9312_flash_resource = {
29 .start = EP93XX_CS6_PHYS_BASE,
30 .end = EP93XX_CS6_PHYS_BASE + SZ_8M - 1,
31 .flags = IORESOURCE_MEM,
32};
33
34static struct platform_device gesbc9312_flash = {
35 .name = "physmap-flash",
36 .id = 0,
37 .dev = {
38 .platform_data = &gesbc9312_flash_data,
39 },
40 .num_resources = 1,
41 .resource = &gesbc9312_flash_resource,
42};
43
44static struct ep93xx_eth_data __initdata gesbc9312_eth_data = { 23static struct ep93xx_eth_data __initdata gesbc9312_eth_data = {
45 .phy_id = 1, 24 .phy_id = 1,
46}; 25};
@@ -48,8 +27,7 @@ static struct ep93xx_eth_data __initdata gesbc9312_eth_data = {
48static void __init gesbc9312_init_machine(void) 27static void __init gesbc9312_init_machine(void)
49{ 28{
50 ep93xx_init_devices(); 29 ep93xx_init_devices();
51 platform_device_register(&gesbc9312_flash); 30 ep93xx_register_flash(4, EP93XX_CS6_PHYS_BASE, SZ_8M);
52
53 ep93xx_register_eth(&gesbc9312_eth_data, 0); 31 ep93xx_register_eth(&gesbc9312_eth_data, 0);
54} 32}
55 33
diff --git a/arch/arm/mach-ep93xx/include/mach/platform.h b/arch/arm/mach-ep93xx/include/mach/platform.h
index 9a4413dd44bb..a6c09176334c 100644
--- a/arch/arm/mach-ep93xx/include/mach/platform.h
+++ b/arch/arm/mach-ep93xx/include/mach/platform.h
@@ -43,6 +43,9 @@ static inline void ep93xx_devcfg_clear_bits(unsigned int bits)
43 43
44unsigned int ep93xx_chip_revision(void); 44unsigned int ep93xx_chip_revision(void);
45 45
46void ep93xx_register_flash(unsigned int width,
47 resource_size_t start, resource_size_t size);
48
46void ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr); 49void ep93xx_register_eth(struct ep93xx_eth_data *data, int copy_addr);
47void ep93xx_register_i2c(struct i2c_gpio_platform_data *data, 50void ep93xx_register_i2c(struct i2c_gpio_platform_data *data,
48 struct i2c_board_info *devices, int num); 51 struct i2c_board_info *devices, int num);
diff --git a/arch/arm/mach-ep93xx/micro9.c b/arch/arm/mach-ep93xx/micro9.c
index 1cc911b4efa6..2ba776320a82 100644
--- a/arch/arm/mach-ep93xx/micro9.c
+++ b/arch/arm/mach-ep93xx/micro9.c
@@ -14,7 +14,6 @@
14#include <linux/kernel.h> 14#include <linux/kernel.h>
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/mtd/physmap.h>
18#include <linux/io.h> 17#include <linux/io.h>
19 18
20#include <mach/hardware.h> 19#include <mach/hardware.h>
@@ -31,31 +30,6 @@
31 * Micro9-Lite uses a separate MTD map driver for flash support 30 * Micro9-Lite uses a separate MTD map driver for flash support
32 * Micro9-Slim has up to 64MB of either 32-bit or 16-bit flash on CS1 31 * Micro9-Slim has up to 64MB of either 32-bit or 16-bit flash on CS1
33 *************************************************************************/ 32 *************************************************************************/
34static struct physmap_flash_data micro9_flash_data;
35
36static struct resource micro9_flash_resource = {
37 .start = EP93XX_CS1_PHYS_BASE,
38 .end = EP93XX_CS1_PHYS_BASE + SZ_64M - 1,
39 .flags = IORESOURCE_MEM,
40};
41
42static struct platform_device micro9_flash = {
43 .name = "physmap-flash",
44 .id = 0,
45 .dev = {
46 .platform_data = &micro9_flash_data,
47 },
48 .num_resources = 1,
49 .resource = &micro9_flash_resource,
50};
51
52static void __init __micro9_register_flash(unsigned int width)
53{
54 micro9_flash_data.width = width;
55
56 platform_device_register(&micro9_flash);
57}
58
59static unsigned int __init micro9_detect_bootwidth(void) 33static unsigned int __init micro9_detect_bootwidth(void)
60{ 34{
61 u32 v; 35 u32 v;
@@ -70,10 +44,17 @@ static unsigned int __init micro9_detect_bootwidth(void)
70 44
71static void __init micro9_register_flash(void) 45static void __init micro9_register_flash(void)
72{ 46{
47 unsigned int width;
48
73 if (machine_is_micro9()) 49 if (machine_is_micro9())
74 __micro9_register_flash(4); 50 width = 4;
75 else if (machine_is_micro9m() || machine_is_micro9s()) 51 else if (machine_is_micro9m() || machine_is_micro9s())
76 __micro9_register_flash(micro9_detect_bootwidth()); 52 width = micro9_detect_bootwidth();
53 else
54 width = 0;
55
56 if (width)
57 ep93xx_register_flash(width, EP93XX_CS1_PHYS_BASE, SZ_64M);
77} 58}
78 59
79 60
diff --git a/arch/arm/mach-ep93xx/simone.c b/arch/arm/mach-ep93xx/simone.c
index 388aec95f60e..5dded5884133 100644
--- a/arch/arm/mach-ep93xx/simone.c
+++ b/arch/arm/mach-ep93xx/simone.c
@@ -18,7 +18,6 @@
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/mtd/physmap.h>
22#include <linux/gpio.h> 21#include <linux/gpio.h>
23#include <linux/i2c.h> 22#include <linux/i2c.h>
24#include <linux/i2c-gpio.h> 23#include <linux/i2c-gpio.h>
@@ -29,26 +28,6 @@
29#include <asm/mach-types.h> 28#include <asm/mach-types.h>
30#include <asm/mach/arch.h> 29#include <asm/mach/arch.h>
31 30
32static struct physmap_flash_data simone_flash_data = {
33 .width = 2,
34};
35
36static struct resource simone_flash_resource = {
37 .start = EP93XX_CS6_PHYS_BASE,
38 .end = EP93XX_CS6_PHYS_BASE + SZ_8M - 1,
39 .flags = IORESOURCE_MEM,
40};
41
42static struct platform_device simone_flash = {
43 .name = "physmap-flash",
44 .id = 0,
45 .num_resources = 1,
46 .resource = &simone_flash_resource,
47 .dev = {
48 .platform_data = &simone_flash_data,
49 },
50};
51
52static struct ep93xx_eth_data __initdata simone_eth_data = { 31static struct ep93xx_eth_data __initdata simone_eth_data = {
53 .phy_id = 1, 32 .phy_id = 1,
54}; 33};
@@ -77,8 +56,7 @@ static struct i2c_board_info __initdata simone_i2c_board_info[] = {
77static void __init simone_init_machine(void) 56static void __init simone_init_machine(void)
78{ 57{
79 ep93xx_init_devices(); 58 ep93xx_init_devices();
80 59 ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_8M);
81 platform_device_register(&simone_flash);
82 ep93xx_register_eth(&simone_eth_data, 1); 60 ep93xx_register_eth(&simone_eth_data, 1);
83 ep93xx_register_fb(&simone_fb_info); 61 ep93xx_register_fb(&simone_fb_info);
84 ep93xx_register_i2c(&simone_i2c_gpio_data, simone_i2c_board_info, 62 ep93xx_register_i2c(&simone_i2c_gpio_data, simone_i2c_board_info,
diff --git a/arch/arm/mach-ep93xx/ts72xx.c b/arch/arm/mach-ep93xx/ts72xx.c
index ae7319e588c7..93aeab8af705 100644
--- a/arch/arm/mach-ep93xx/ts72xx.c
+++ b/arch/arm/mach-ep93xx/ts72xx.c
@@ -17,7 +17,6 @@
17#include <linux/platform_device.h> 17#include <linux/platform_device.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/m48t86.h> 19#include <linux/m48t86.h>
20#include <linux/mtd/physmap.h>
21#include <linux/mtd/nand.h> 20#include <linux/mtd/nand.h>
22#include <linux/mtd/partitions.h> 21#include <linux/mtd/partitions.h>
23 22
@@ -173,31 +172,13 @@ static struct platform_device ts72xx_nand_flash = {
173}; 172};
174 173
175 174
176/*************************************************************************
177 * NOR flash (TS-7200 only)
178 *************************************************************************/
179static struct physmap_flash_data ts72xx_nor_data = {
180 .width = 2,
181};
182
183static struct resource ts72xx_nor_resource = {
184 .start = EP93XX_CS6_PHYS_BASE,
185 .end = EP93XX_CS6_PHYS_BASE + SZ_16M - 1,
186 .flags = IORESOURCE_MEM,
187};
188
189static struct platform_device ts72xx_nor_flash = {
190 .name = "physmap-flash",
191 .id = 0,
192 .dev.platform_data = &ts72xx_nor_data,
193 .resource = &ts72xx_nor_resource,
194 .num_resources = 1,
195};
196
197static void __init ts72xx_register_flash(void) 175static void __init ts72xx_register_flash(void)
198{ 176{
177 /*
178 * TS7200 has NOR flash all other TS72xx board have NAND flash.
179 */
199 if (board_is_ts7200()) { 180 if (board_is_ts7200()) {
200 platform_device_register(&ts72xx_nor_flash); 181 ep93xx_register_flash(2, EP93XX_CS6_PHYS_BASE, SZ_16M);
201 } else { 182 } else {
202 resource_size_t start; 183 resource_size_t start;
203 184
diff --git a/arch/arm/mach-mx2/Kconfig b/arch/arm/mach-imx/Kconfig
index 742fd4e6dcb9..c5c0369bb481 100644
--- a/arch/arm/mach-mx2/Kconfig
+++ b/arch/arm/mach-imx/Kconfig
@@ -1,42 +1,103 @@
1config IMX_HAVE_DMA_V1
2 bool
3
4if ARCH_MX1
5
6config SOC_IMX1
7 select CPU_ARM920T
8 select IMX_HAVE_DMA_V1
9 select IMX_HAVE_IOMUX_V1
10 bool
11
12comment "MX1 platforms:"
13config MACH_MXLADS
14 bool
15
16config ARCH_MX1ADS
17 bool "MX1ADS platform"
18 select MACH_MXLADS
19 select IMX_HAVE_PLATFORM_IMX_I2C
20 select IMX_HAVE_PLATFORM_IMX_UART
21 help
22 Say Y here if you are using Motorola MX1ADS/MXLADS boards
23
24config MACH_SCB9328
25 bool "Synertronixx scb9328"
26 select IMX_HAVE_PLATFORM_IMX_UART
27 help
28 Say Y here if you are using a Synertronixx scb9328 board
29
30endif
31
1if ARCH_MX2 32if ARCH_MX2
2 33
34config SOC_IMX21
35 select CPU_ARM926T
36 select ARCH_MXC_AUDMUX_V1
37 select IMX_HAVE_DMA_V1
38 select IMX_HAVE_IOMUX_V1
39 bool
40
41config SOC_IMX27
42 select CPU_ARM926T
43 select ARCH_MXC_AUDMUX_V1
44 select IMX_HAVE_DMA_V1
45 select IMX_HAVE_IOMUX_V1
46 bool
47
3choice 48choice
4 prompt "CPUs:" 49 prompt "CPUs:"
5 default MACH_MX21 50 default MACH_MX21
6 51
7config MACH_MX21 52config MACH_MX21
8 bool "i.MX21 support" 53 bool "i.MX21 support"
9 select ARCH_MXC_AUDMUX_V1 54 select SOC_IMX21
10 help 55 help
11 This enables support for Freescale's MX2 based i.MX21 processor. 56 This enables support for Freescale's MX2 based i.MX21 processor.
12 57
13config MACH_MX27 58config MACH_MX27
14 bool "i.MX27 support" 59 bool "i.MX27 support"
15 select ARCH_MXC_AUDMUX_V1 60 select SOC_IMX27
16 help 61 help
17 This enables support for Freescale's MX2 based i.MX27 processor. 62 This enables support for Freescale's MX2 based i.MX27 processor.
18 63
19endchoice 64endchoice
20 65
21comment "MX2 platforms:" 66endif
67
68if MACH_MX21
69
70comment "MX21 platforms:"
22 71
23config MACH_MX21ADS 72config MACH_MX21ADS
24 bool "MX21ADS platform" 73 bool "MX21ADS platform"
25 depends on MACH_MX21 74 select IMX_HAVE_PLATFORM_IMX_UART
75 select IMX_HAVE_PLATFORM_MXC_NAND
26 help 76 help
27 Include support for MX21ADS platform. This includes specific 77 Include support for MX21ADS platform. This includes specific
28 configurations for the board and its peripherals. 78 configurations for the board and its peripherals.
29 79
80endif
81
82if MACH_MX27
83
84comment "MX27 platforms:"
85
30config MACH_MX27ADS 86config MACH_MX27ADS
31 bool "MX27ADS platform" 87 bool "MX27ADS platform"
32 depends on MACH_MX27 88 select IMX_HAVE_PLATFORM_IMX_I2C
89 select IMX_HAVE_PLATFORM_IMX_UART
90 select IMX_HAVE_PLATFORM_MXC_NAND
33 help 91 help
34 Include support for MX27ADS platform. This includes specific 92 Include support for MX27ADS platform. This includes specific
35 configurations for the board and its peripherals. 93 configurations for the board and its peripherals.
36 94
37config MACH_PCM038 95config MACH_PCM038
38 bool "Phytec phyCORE-i.MX27 CPU module (pcm038)" 96 bool "Phytec phyCORE-i.MX27 CPU module (pcm038)"
39 depends on MACH_MX27 97 select IMX_HAVE_PLATFORM_IMX_I2C
98 select IMX_HAVE_PLATFORM_IMX_UART
99 select IMX_HAVE_PLATFORM_MXC_NAND
100 select IMX_HAVE_PLATFORM_SPI_IMX
40 select MXC_ULPI if USB_ULPI 101 select MXC_ULPI if USB_ULPI
41 help 102 help
42 Include support for phyCORE-i.MX27 (aka pcm038) platform. This 103 Include support for phyCORE-i.MX27 (aka pcm038) platform. This
@@ -58,7 +119,9 @@ endchoice
58 119
59config MACH_CPUIMX27 120config MACH_CPUIMX27
60 bool "Eukrea CPUIMX27 module" 121 bool "Eukrea CPUIMX27 module"
61 depends on MACH_MX27 122 select IMX_HAVE_PLATFORM_IMX_I2C
123 select IMX_HAVE_PLATFORM_IMX_UART
124 select IMX_HAVE_PLATFORM_MXC_NAND
62 help 125 help
63 Include support for Eukrea CPUIMX27 platform. This includes 126 Include support for Eukrea CPUIMX27 platform. This includes
64 specific configurations for the module and its peripherals. 127 specific configurations for the module and its peripherals.
@@ -67,9 +130,16 @@ config MACH_EUKREA_CPUIMX27_USESDHC2
67 bool "CPUIMX27 integrates SDHC2 module" 130 bool "CPUIMX27 integrates SDHC2 module"
68 depends on MACH_CPUIMX27 131 depends on MACH_CPUIMX27
69 help 132 help
70 This adds support for the internal SDHC2 used on CPUIMX27 used 133 This adds support for the internal SDHC2 used on CPUIMX27
71 for wifi or eMMC. 134 for wifi or eMMC.
72 135
136config MACH_EUKREA_CPUIMX27_USEUART4
137 bool "CPUIMX27 integrates UART4 module"
138 depends on MACH_CPUIMX27
139 help
140 This adds support for the internal UART4 used on CPUIMX27
141 for bluetooth.
142
73choice 143choice
74 prompt "Baseboard" 144 prompt "Baseboard"
75 depends on MACH_CPUIMX27 145 depends on MACH_CPUIMX27
@@ -78,6 +148,8 @@ choice
78config MACH_EUKREA_MBIMX27_BASEBOARD 148config MACH_EUKREA_MBIMX27_BASEBOARD
79 prompt "Eukrea MBIMX27 development board" 149 prompt "Eukrea MBIMX27 development board"
80 bool 150 bool
151 select IMX_HAVE_PLATFORM_IMX_UART
152 select IMX_HAVE_PLATFORM_SPI_IMX
81 help 153 help
82 This adds board specific devices that can be found on Eukrea's 154 This adds board specific devices that can be found on Eukrea's
83 MBIMX27 evaluation board. 155 MBIMX27 evaluation board.
@@ -86,21 +158,24 @@ endchoice
86 158
87config MACH_MX27_3DS 159config MACH_MX27_3DS
88 bool "MX27PDK platform" 160 bool "MX27PDK platform"
89 depends on MACH_MX27 161 select IMX_HAVE_PLATFORM_IMX_UART
90 help 162 help
91 Include support for MX27PDK platform. This includes specific 163 Include support for MX27PDK platform. This includes specific
92 configurations for the board and its peripherals. 164 configurations for the board and its peripherals.
93 165
94config MACH_IMX27LITE 166config MACH_IMX27LITE
95 bool "LogicPD MX27 LITEKIT platform" 167 bool "LogicPD MX27 LITEKIT platform"
96 depends on MACH_MX27 168 select IMX_HAVE_PLATFORM_IMX_UART
97 help 169 help
98 Include support for MX27 LITEKIT platform. This includes specific 170 Include support for MX27 LITEKIT platform. This includes specific
99 configurations for the board and its peripherals. 171 configurations for the board and its peripherals.
100 172
101config MACH_PCA100 173config MACH_PCA100
102 bool "Phytec phyCARD-s (pca100)" 174 bool "Phytec phyCARD-s (pca100)"
103 depends on MACH_MX27 175 select IMX_HAVE_PLATFORM_IMX_I2C
176 select IMX_HAVE_PLATFORM_IMX_UART
177 select IMX_HAVE_PLATFORM_MXC_NAND
178 select IMX_HAVE_PLATFORM_SPI_IMX
104 select MXC_ULPI if USB_ULPI 179 select MXC_ULPI if USB_ULPI
105 help 180 help
106 Include support for phyCARD-s (aka pca100) platform. This 181 Include support for phyCARD-s (aka pca100) platform. This
@@ -108,7 +183,9 @@ config MACH_PCA100
108 183
109config MACH_MXT_TD60 184config MACH_MXT_TD60
110 bool "Maxtrack i-MXT TD60" 185 bool "Maxtrack i-MXT TD60"
111 depends on MACH_MX27 186 select IMX_HAVE_PLATFORM_IMX_I2C
187 select IMX_HAVE_PLATFORM_IMX_UART
188 select IMX_HAVE_PLATFORM_MXC_NAND
112 help 189 help
113 Include support for i-MXT (aka td60) platform. This 190 Include support for i-MXT (aka td60) platform. This
114 includes specific configurations for the module and its peripherals. 191 includes specific configurations for the module and its peripherals.
diff --git a/arch/arm/mach-mx2/Makefile b/arch/arm/mach-imx/Makefile
index e3254faac828..46a9fdfbbd15 100644
--- a/arch/arm/mach-mx2/Makefile
+++ b/arch/arm/mach-imx/Makefile
@@ -4,14 +4,24 @@
4 4
5# Object file lists. 5# Object file lists.
6 6
7obj-y := devices.o serial.o 7obj-y := devices.o
8 8
9obj-$(CONFIG_MACH_MX21) += clock_imx21.o mm-imx21.o 9obj-$(CONFIG_IMX_HAVE_DMA_V1) += dma-v1.o
10 10
11obj-$(CONFIG_MACH_MX27) += cpu_imx27.o 11obj-$(CONFIG_ARCH_MX1) += clock-imx1.o mm-imx1.o
12obj-$(CONFIG_MACH_MX27) += clock_imx27.o mm-imx27.o 12obj-$(CONFIG_MACH_MX21) += clock-imx21.o mm-imx21.o
13
14obj-$(CONFIG_MACH_MX27) += cpu-imx27.o pm-imx27.o
15obj-$(CONFIG_MACH_MX27) += clock-imx27.o mm-imx27.o
16
17# Support for CMOS sensor interface
18obj-$(CONFIG_MX1_VIDEO) += mx1-camera-fiq.o mx1-camera-fiq-ksym.o
19
20obj-$(CONFIG_ARCH_MX1ADS) += mach-mx1ads.o
21obj-$(CONFIG_MACH_SCB9328) += mach-scb9328.o
13 22
14obj-$(CONFIG_MACH_MX21ADS) += mach-mx21ads.o 23obj-$(CONFIG_MACH_MX21ADS) += mach-mx21ads.o
24
15obj-$(CONFIG_MACH_MX27ADS) += mach-mx27ads.o 25obj-$(CONFIG_MACH_MX27ADS) += mach-mx27ads.o
16obj-$(CONFIG_MACH_PCM038) += mach-pcm038.o 26obj-$(CONFIG_MACH_PCM038) += mach-pcm038.o
17obj-$(CONFIG_MACH_PCM970_BASEBOARD) += pcm970-baseboard.o 27obj-$(CONFIG_MACH_PCM970_BASEBOARD) += pcm970-baseboard.o
diff --git a/arch/arm/mach-mx2/Makefile.boot b/arch/arm/mach-imx/Makefile.boot
index e867398a8fdb..7988a85cf07d 100644
--- a/arch/arm/mach-mx2/Makefile.boot
+++ b/arch/arm/mach-imx/Makefile.boot
@@ -1,3 +1,7 @@
1zreladdr-$(CONFIG_ARCH_MX1) := 0x08008000
2params_phys-$(CONFIG_ARCH_MX1) := 0x08000100
3initrd_phys-$(CONFIG_ARCH_MX1) := 0x08800000
4
1zreladdr-$(CONFIG_MACH_MX21) := 0xC0008000 5zreladdr-$(CONFIG_MACH_MX21) := 0xC0008000
2params_phys-$(CONFIG_MACH_MX21) := 0xC0000100 6params_phys-$(CONFIG_MACH_MX21) := 0xC0000100
3initrd_phys-$(CONFIG_MACH_MX21) := 0xC0800000 7initrd_phys-$(CONFIG_MACH_MX21) := 0xC0800000
diff --git a/arch/arm/mach-mx1/clock.c b/arch/arm/mach-imx/clock-imx1.c
index 6cf2d4a7511d..c05096c38301 100644
--- a/arch/arm/mach-mx1/clock.c
+++ b/arch/arm/mach-imx/clock-imx1.c
@@ -2,18 +2,17 @@
2 * Copyright (C) 2008 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix 2 * Copyright (C) 2008 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
3 * 3 *
4 * This program is free software; you can redistribute it and/or modify 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 5 * it under the terms of the GNU General Public License version 2 as
6 * the Free Software Foundation; either version 2 of the License, or 6 * published by the Free Software Foundation.
7 * (at your option) any later version.
8 * 7 *
9 * This program is distributed in the hope that it will be useful, 8 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 11 * GNU General Public License for more details.
13 * 12 *
14 * You should have received a copy of the GNU General Public License 13 * You should have received a copy of the GNU General Public License along
15 * along with this program; if not, write to the Free Software 14 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 15 * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
17 */ 16 */
18 17
19#include <linux/kernel.h> 18#include <linux/kernel.h>
@@ -29,7 +28,41 @@
29#include <mach/clock.h> 28#include <mach/clock.h>
30#include <mach/hardware.h> 29#include <mach/hardware.h>
31#include <mach/common.h> 30#include <mach/common.h>
32#include "crm_regs.h" 31
32#define IO_ADDR_CCM(off) (MX1_IO_ADDRESS(MX1_CCM_BASE_ADDR + (off)))
33
34/* CCM register addresses */
35#define CCM_CSCR IO_ADDR_CCM(0x0)
36#define CCM_MPCTL0 IO_ADDR_CCM(0x4)
37#define CCM_SPCTL0 IO_ADDR_CCM(0xc)
38#define CCM_PCDR IO_ADDR_CCM(0x20)
39
40#define CCM_CSCR_CLKO_OFFSET 29
41#define CCM_CSCR_CLKO_MASK (0x7 << 29)
42#define CCM_CSCR_USB_OFFSET 26
43#define CCM_CSCR_USB_MASK (0x7 << 26)
44#define CCM_CSCR_OSC_EN_SHIFT 17
45#define CCM_CSCR_SYSTEM_SEL (1 << 16)
46#define CCM_CSCR_BCLK_OFFSET 10
47#define CCM_CSCR_BCLK_MASK (0xf << 10)
48#define CCM_CSCR_PRESC (1 << 15)
49
50#define CCM_PCDR_PCLK3_OFFSET 16
51#define CCM_PCDR_PCLK3_MASK (0x7f << 16)
52#define CCM_PCDR_PCLK2_OFFSET 4
53#define CCM_PCDR_PCLK2_MASK (0xf << 4)
54#define CCM_PCDR_PCLK1_OFFSET 0
55#define CCM_PCDR_PCLK1_MASK 0xf
56
57#define IO_ADDR_SCM(off) (MX1_IO_ADDRESS(MX1_SCM_BASE_ADDR + (off)))
58
59/* SCM register addresses */
60#define SCM_GCCR IO_ADDR_SCM(0xc)
61
62#define SCM_GCCR_DMA_CLK_EN_OFFSET 3
63#define SCM_GCCR_CSI_CLK_EN_OFFSET 2
64#define SCM_GCCR_MMA_CLK_EN_OFFSET 1
65#define SCM_GCCR_USBD_CLK_EN_OFFSET 0
33 66
34static int _clk_enable(struct clk *clk) 67static int _clk_enable(struct clk *clk)
35{ 68{
@@ -596,7 +629,8 @@ int __init mx1_clocks_init(unsigned long fref)
596 clk_enable(&hclk); 629 clk_enable(&hclk);
597 clk_enable(&fclk); 630 clk_enable(&fclk);
598 631
599 mxc_timer_init(&gpt_clk, IO_ADDRESS(TIM1_BASE_ADDR), TIM1_INT); 632 mxc_timer_init(&gpt_clk, MX1_IO_ADDRESS(MX1_TIM1_BASE_ADDR),
633 MX1_TIM1_INT);
600 634
601 return 0; 635 return 0;
602} 636}
diff --git a/arch/arm/mach-mx2/clock_imx21.c b/arch/arm/mach-imx/clock-imx21.c
index bb419ef4d133..bb419ef4d133 100644
--- a/arch/arm/mach-mx2/clock_imx21.c
+++ b/arch/arm/mach-imx/clock-imx21.c
diff --git a/arch/arm/mach-mx2/clock_imx27.c b/arch/arm/mach-imx/clock-imx27.c
index 0f0823c8b170..5a1aa15c8a16 100644
--- a/arch/arm/mach-mx2/clock_imx27.c
+++ b/arch/arm/mach-imx/clock-imx27.c
@@ -644,7 +644,7 @@ static struct clk_lookup lookups[] = {
644 _REGISTER_CLOCK("spi_imx.1", NULL, cspi2_clk) 644 _REGISTER_CLOCK("spi_imx.1", NULL, cspi2_clk)
645 _REGISTER_CLOCK("spi_imx.2", NULL, cspi3_clk) 645 _REGISTER_CLOCK("spi_imx.2", NULL, cspi3_clk)
646 _REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk) 646 _REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk)
647 _REGISTER_CLOCK(NULL, "csi", csi_clk) 647 _REGISTER_CLOCK("mx2-camera.0", NULL, csi_clk)
648 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usb_clk) 648 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usb_clk)
649 _REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", usb_clk1) 649 _REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", usb_clk1)
650 _REGISTER_CLOCK("mxc-ehci.0", "usb", usb_clk) 650 _REGISTER_CLOCK("mxc-ehci.0", "usb", usb_clk)
diff --git a/arch/arm/mach-mx2/cpu_imx27.c b/arch/arm/mach-imx/cpu-imx27.c
index d8d3b2d84dc5..d8d3b2d84dc5 100644
--- a/arch/arm/mach-mx2/cpu_imx27.c
+++ b/arch/arm/mach-imx/cpu-imx27.c
diff --git a/arch/arm/mach-imx/devices-imx1.h b/arch/arm/mach-imx/devices-imx1.h
new file mode 100644
index 000000000000..a8d94f078196
--- /dev/null
+++ b/arch/arm/mach-imx/devices-imx1.h
@@ -0,0 +1,18 @@
1/*
2 * Copyright (C) 2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#include <mach/mx1.h>
10#include <mach/devices-common.h>
11
12#define imx1_add_i2c_imx(pdata) \
13 imx_add_imx_i2c(0, MX1_I2C_BASE_ADDR, SZ_4K, MX1_INT_I2C, pdata)
14
15#define imx1_add_imx_uart0(pdata) \
16 imx_add_imx_uart_3irq(0, MX1_UART1_BASE_ADDR, 0xd0, MX1_INT_UART1RX, MX1_INT_UART1TX, MX1_INT_UART1RTS, pdata)
17#define imx1_add_imx_uart1(pdata) \
18 imx_add_imx_uart_3irq(0, MX1_UART2_BASE_ADDR, 0xd0, MX1_INT_UART2RX, MX1_INT_UART2TX, MX1_INT_UART2RTS, pdata)
diff --git a/arch/arm/mach-imx/devices-imx21.h b/arch/arm/mach-imx/devices-imx21.h
new file mode 100644
index 000000000000..42788e99d127
--- /dev/null
+++ b/arch/arm/mach-imx/devices-imx21.h
@@ -0,0 +1,30 @@
1/*
2 * Copyright (C) 2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#include <mach/mx21.h>
10#include <mach/devices-common.h>
11
12#define imx21_add_i2c_imx(pdata) \
13 imx_add_imx_i2c(0, MX2x_I2C_BASE_ADDR, SZ_4K, MX2x_INT_I2C, pdata)
14
15#define imx21_add_imx_uart0(pdata) \
16 imx_add_imx_uart_1irq(0, MX21_UART1_BASE_ADDR, SZ_4K, MX21_INT_UART1, pdata)
17#define imx21_add_imx_uart1(pdata) \
18 imx_add_imx_uart_1irq(1, MX21_UART2_BASE_ADDR, SZ_4K, MX21_INT_UART2, pdata)
19#define imx21_add_imx_uart2(pdata) \
20 imx_add_imx_uart_1irq(2, MX21_UART3_BASE_ADDR, SZ_4K, MX21_INT_UART3, pdata)
21#define imx21_add_imx_uart3(pdata) \
22 imx_add_imx_uart_1irq(3, MX21_UART4_BASE_ADDR, SZ_4K, MX21_INT_UART4, pdata)
23
24#define imx21_add_mxc_nand(pdata) \
25 imx_add_mxc_nand_v1(MX21_NFC_BASE_ADDR, MX21_INT_NANDFC, pdata)
26
27#define imx21_add_spi_imx0(pdata) \
28 imx_add_spi_imx(0, MX21_CSPI1_BASE_ADDR, SZ_4K, MX21_INT_CSPI1, pdata)
29#define imx21_add_spi_imx1(pdata) \
30 imx_add_spi_imx(1, MX21_CSPI2_BASE_ADDR, SZ_4K, MX21_INT_CSPI2, pdata)
diff --git a/arch/arm/mach-imx/devices-imx27.h b/arch/arm/mach-imx/devices-imx27.h
new file mode 100644
index 000000000000..65e7bb7ec2e8
--- /dev/null
+++ b/arch/arm/mach-imx/devices-imx27.h
@@ -0,0 +1,38 @@
1/*
2 * Copyright (C) 2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#include <mach/mx27.h>
10#include <mach/devices-common.h>
11
12#define imx27_add_i2c_imx0(pdata) \
13 imx_add_imx_i2c(0, MX27_I2C1_BASE_ADDR, SZ_4K, MX27_INT_I2C1, pdata)
14#define imx27_add_i2c_imx1(pdata) \
15 imx_add_imx_i2c(1, MX27_I2C2_BASE_ADDR, SZ_4K, MX27_INT_I2C2, pdata)
16
17#define imx27_add_imx_uart0(pdata) \
18 imx_add_imx_uart_1irq(0, MX27_UART1_BASE_ADDR, SZ_4K, MX27_INT_UART1, pdata)
19#define imx27_add_imx_uart1(pdata) \
20 imx_add_imx_uart_1irq(1, MX27_UART2_BASE_ADDR, SZ_4K, MX27_INT_UART2, pdata)
21#define imx27_add_imx_uart2(pdata) \
22 imx_add_imx_uart_1irq(2, MX27_UART3_BASE_ADDR, SZ_4K, MX27_INT_UART3, pdata)
23#define imx27_add_imx_uart3(pdata) \
24 imx_add_imx_uart_1irq(3, MX27_UART4_BASE_ADDR, SZ_4K, MX27_INT_UART4, pdata)
25#define imx27_add_imx_uart4(pdata) \
26 imx_add_imx_uart_1irq(4, MX27_UART5_BASE_ADDR, SZ_4K, MX27_INT_UART5, pdata)
27#define imx27_add_imx_uart5(pdata) \
28 imx_add_imx_uart_1irq(5, MX27_UART6_BASE_ADDR, SZ_4K, MX27_INT_UART6, pdata)
29
30#define imx27_add_mxc_nand(pdata) \
31 imx_add_mxc_nand_v1(MX27_NFC_BASE_ADDR, MX27_INT_NANDFC, pdata)
32
33#define imx27_add_spi_imx0(pdata) \
34 imx_add_spi_imx(0, MX27_CSPI1_BASE_ADDR, SZ_4K, MX27_INT_CSPI1, pdata)
35#define imx27_add_spi_imx1(pdata) \
36 imx_add_spi_imx(1, MX27_CSPI2_BASE_ADDR, SZ_4K, MX27_INT_CSPI2, pdata)
37#define imx27_add_spi_imx2(pdata) \
38 imx_add_spi_imx(2, MX27_CSPI3_BASE_ADDR, SZ_4K, MX27_INT_CSPI3, pdata)
diff --git a/arch/arm/mach-mx2/devices.c b/arch/arm/mach-imx/devices.c
index a0aeb8a4adc1..9c271a752b84 100644
--- a/arch/arm/mach-mx2/devices.c
+++ b/arch/arm/mach-imx/devices.c
@@ -11,6 +11,9 @@
11 * 11 *
12 * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved. 12 * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
13 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de 13 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
14 * Copyright 2008 Sascha Hauer, kernel@pengutronix.de
15 * Copyright (c) 2008 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
16 * Copyright (c) 2008 Darius Augulis <darius.augulis@teltonika.lt>
14 * 17 *
15 * This program is free software; you can redistribute it and/or 18 * This program is free software; you can redistribute it and/or
16 * modify it under the terms of the GNU General Public License 19 * modify it under the terms of the GNU General Public License
@@ -32,6 +35,7 @@
32#include <linux/platform_device.h> 35#include <linux/platform_device.h>
33#include <linux/gpio.h> 36#include <linux/gpio.h>
34#include <linux/dma-mapping.h> 37#include <linux/dma-mapping.h>
38#include <linux/serial.h>
35 39
36#include <mach/irqs.h> 40#include <mach/irqs.h>
37#include <mach/hardware.h> 41#include <mach/hardware.h>
@@ -40,38 +44,179 @@
40 44
41#include "devices.h" 45#include "devices.h"
42 46
43/* 47#if defined(CONFIG_ARCH_MX1)
44 * SPI master controller 48static struct resource imx1_camera_resources[] = {
45 * 49 {
46 * - i.MX1: 2 channel (slighly different register setting) 50 .start = 0x00224000,
47 * - i.MX21: 2 channel 51 .end = 0x00224010,
48 * - i.MX27: 3 channel 52 .flags = IORESOURCE_MEM,
49 */ 53 }, {
50#define DEFINE_IMX_SPI_DEVICE(n, baseaddr, irq) \ 54 .start = MX1_CSI_INT,
51 static struct resource mxc_spi_resources ## n[] = { \ 55 .end = MX1_CSI_INT,
52 { \ 56 .flags = IORESOURCE_IRQ,
53 .start = baseaddr, \ 57 },
54 .end = baseaddr + SZ_4K - 1, \ 58};
55 .flags = IORESOURCE_MEM, \ 59
56 }, { \ 60static u64 imx1_camera_dmamask = DMA_BIT_MASK(32);
57 .start = irq, \ 61
58 .end = irq, \ 62struct platform_device imx1_camera_device = {
59 .flags = IORESOURCE_IRQ, \ 63 .name = "mx1-camera",
60 }, \ 64 .id = 0, /* This is used to put cameras on this interface */
61 }; \ 65 .dev = {
62 \ 66 .dma_mask = &imx1_camera_dmamask,
63 struct platform_device mxc_spi_device ## n = { \ 67 .coherent_dma_mask = DMA_BIT_MASK(32),
64 .name = "spi_imx", \ 68 },
65 .id = n, \ 69 .resource = imx1_camera_resources,
66 .num_resources = ARRAY_SIZE(mxc_spi_resources ## n), \ 70 .num_resources = ARRAY_SIZE(imx1_camera_resources),
67 .resource = mxc_spi_resources ## n, \ 71};
72
73static struct resource imx_rtc_resources[] = {
74 {
75 .start = 0x00204000,
76 .end = 0x00204024,
77 .flags = IORESOURCE_MEM,
78 }, {
79 .start = MX1_RTC_INT,
80 .end = MX1_RTC_INT,
81 .flags = IORESOURCE_IRQ,
82 }, {
83 .start = MX1_RTC_SAMINT,
84 .end = MX1_RTC_SAMINT,
85 .flags = IORESOURCE_IRQ,
86 },
87};
88
89struct platform_device imx_rtc_device = {
90 .name = "rtc-imx",
91 .id = 0,
92 .resource = imx_rtc_resources,
93 .num_resources = ARRAY_SIZE(imx_rtc_resources),
94};
95
96static struct resource imx_wdt_resources[] = {
97 {
98 .start = 0x00201000,
99 .end = 0x00201008,
100 .flags = IORESOURCE_MEM,
101 }, {
102 .start = MX1_WDT_INT,
103 .end = MX1_WDT_INT,
104 .flags = IORESOURCE_IRQ,
105 },
106};
107
108struct platform_device imx_wdt_device = {
109 .name = "imx-wdt",
110 .id = 0,
111 .resource = imx_wdt_resources,
112 .num_resources = ARRAY_SIZE(imx_wdt_resources),
113};
114
115static struct resource imx_usb_resources[] = {
116 {
117 .start = 0x00212000,
118 .end = 0x00212148,
119 .flags = IORESOURCE_MEM,
120 }, {
121 .start = MX1_USBD_INT0,
122 .end = MX1_USBD_INT0,
123 .flags = IORESOURCE_IRQ,
124 }, {
125 .start = MX1_USBD_INT1,
126 .end = MX1_USBD_INT1,
127 .flags = IORESOURCE_IRQ,
128 }, {
129 .start = MX1_USBD_INT2,
130 .end = MX1_USBD_INT2,
131 .flags = IORESOURCE_IRQ,
132 }, {
133 .start = MX1_USBD_INT3,
134 .end = MX1_USBD_INT3,
135 .flags = IORESOURCE_IRQ,
136 }, {
137 .start = MX1_USBD_INT4,
138 .end = MX1_USBD_INT4,
139 .flags = IORESOURCE_IRQ,
140 }, {
141 .start = MX1_USBD_INT5,
142 .end = MX1_USBD_INT5,
143 .flags = IORESOURCE_IRQ,
144 }, {
145 .start = MX1_USBD_INT6,
146 .end = MX1_USBD_INT6,
147 .flags = IORESOURCE_IRQ,
148 },
149};
150
151struct platform_device imx_usb_device = {
152 .name = "imx_udc",
153 .id = 0,
154 .num_resources = ARRAY_SIZE(imx_usb_resources),
155 .resource = imx_usb_resources,
156};
157
158/* GPIO port description */
159static struct mxc_gpio_port imx_gpio_ports[] = {
160 {
161 .chip.label = "gpio-0",
162 .base = (void __iomem *)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR),
163 .irq = MX1_GPIO_INT_PORTA,
164 .virtual_irq_start = MXC_GPIO_IRQ_START,
165 }, {
166 .chip.label = "gpio-1",
167 .base = (void __iomem *)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x100),
168 .irq = MX1_GPIO_INT_PORTB,
169 .virtual_irq_start = MXC_GPIO_IRQ_START + 32,
170 }, {
171 .chip.label = "gpio-2",
172 .base = (void __iomem *)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x200),
173 .irq = MX1_GPIO_INT_PORTC,
174 .virtual_irq_start = MXC_GPIO_IRQ_START + 64,
175 }, {
176 .chip.label = "gpio-3",
177 .base = (void __iomem *)MX1_IO_ADDRESS(MX1_GPIO_BASE_ADDR + 0x300),
178 .irq = MX1_GPIO_INT_PORTD,
179 .virtual_irq_start = MXC_GPIO_IRQ_START + 96,
68 } 180 }
181};
182
183int __init imx1_register_gpios(void)
184{
185 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
186}
187#endif
69 188
70DEFINE_IMX_SPI_DEVICE(0, MX2x_CSPI1_BASE_ADDR, MX2x_INT_CSPI1); 189#if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
71DEFINE_IMX_SPI_DEVICE(1, MX2x_CSPI2_BASE_ADDR, MX2x_INT_CSPI2);
72 190
73#ifdef CONFIG_MACH_MX27 191#ifdef CONFIG_MACH_MX27
74DEFINE_IMX_SPI_DEVICE(2, MX27_CSPI3_BASE_ADDR, MX27_INT_CSPI3); 192static struct resource mx27_camera_resources[] = {
193 {
194 .start = MX27_CSI_BASE_ADDR,
195 .end = MX27_CSI_BASE_ADDR + 0x1f,
196 .flags = IORESOURCE_MEM,
197 }, {
198 .start = MX27_EMMA_PRP_BASE_ADDR,
199 .end = MX27_EMMA_PRP_BASE_ADDR + 0x1f,
200 .flags = IORESOURCE_MEM,
201 }, {
202 .start = MX27_INT_CSI,
203 .end = MX27_INT_CSI,
204 .flags = IORESOURCE_IRQ,
205 },{
206 .start = MX27_INT_EMMAPRP,
207 .end = MX27_INT_EMMAPRP,
208 .flags = IORESOURCE_IRQ,
209 },
210};
211struct platform_device mx27_camera_device = {
212 .name = "mx2-camera",
213 .id = 0,
214 .num_resources = ARRAY_SIZE(mx27_camera_resources),
215 .resource = mx27_camera_resources,
216 .dev = {
217 .coherent_dma_mask = 0xffffffff,
218 },
219};
75#endif 220#endif
76 221
77/* 222/*
@@ -140,34 +285,6 @@ struct platform_device mxc_w1_master_device = {
140 .resource = mxc_w1_master_resources, 285 .resource = mxc_w1_master_resources,
141}; 286};
142 287
143#define DEFINE_MXC_NAND_DEVICE(pfx, baseaddr, irq) \
144 static struct resource pfx ## _nand_resources[] = { \
145 { \
146 .start = baseaddr, \
147 .end = baseaddr + SZ_4K - 1, \
148 .flags = IORESOURCE_MEM, \
149 }, { \
150 .start = irq, \
151 .end = irq, \
152 .flags = IORESOURCE_IRQ, \
153 }, \
154 }; \
155 \
156 struct platform_device pfx ## _nand_device = { \
157 .name = "mxc_nand", \
158 .id = 0, \
159 .num_resources = ARRAY_SIZE(pfx ## _nand_resources), \
160 .resource = pfx ## _nand_resources, \
161 }
162
163#ifdef CONFIG_MACH_MX21
164DEFINE_MXC_NAND_DEVICE(imx21, MX21_NFC_BASE_ADDR, MX21_INT_NANDFC);
165#endif
166
167#ifdef CONFIG_MACH_MX27
168DEFINE_MXC_NAND_DEVICE(imx27, MX27_NFC_BASE_ADDR, MX27_INT_NANDFC);
169#endif
170
171/* 288/*
172 * lcdc: 289 * lcdc:
173 * - i.MX1: the basic controller 290 * - i.MX1: the basic controller
@@ -218,32 +335,6 @@ struct platform_device mxc_fec_device = {
218}; 335};
219#endif 336#endif
220 337
221#define DEFINE_IMX_I2C_DEVICE(n, baseaddr, irq) \
222 static struct resource mxc_i2c_resources ## n[] = { \
223 { \
224 .start = baseaddr, \
225 .end = baseaddr + SZ_4K - 1, \
226 .flags = IORESOURCE_MEM, \
227 }, { \
228 .start = irq, \
229 .end = irq, \
230 .flags = IORESOURCE_IRQ, \
231 } \
232 }; \
233 \
234 struct platform_device mxc_i2c_device ## n = { \
235 .name = "imx-i2c", \
236 .id = n, \
237 .num_resources = ARRAY_SIZE(mxc_i2c_resources ## n), \
238 .resource = mxc_i2c_resources ## n, \
239 }
240
241DEFINE_IMX_I2C_DEVICE(0, MX2x_I2C_BASE_ADDR, MX2x_INT_I2C);
242
243#ifdef CONFIG_MACH_MX27
244DEFINE_IMX_I2C_DEVICE(1, MX27_I2C2_BASE_ADDR, MX27_INT_I2C2);
245#endif
246
247static struct resource mxc_pwm_resources[] = { 338static struct resource mxc_pwm_resources[] = {
248 { 339 {
249 .start = MX2x_PWM_BASE_ADDR, 340 .start = MX2x_PWM_BASE_ADDR,
@@ -454,26 +545,21 @@ DEFINE_IMX_SSI_DEVICE(1, 2, MX2x_SSI1_BASE_ADDR, MX2x_INT_SSI1);
454 545
455#ifdef CONFIG_MACH_MX21 546#ifdef CONFIG_MACH_MX21
456DEFINE_MXC_GPIO_PORTS(MX21, imx21); 547DEFINE_MXC_GPIO_PORTS(MX21, imx21);
548
549int __init imx21_register_gpios(void)
550{
551 return mxc_gpio_init(imx21_gpio_ports, ARRAY_SIZE(imx21_gpio_ports));
552}
457#endif 553#endif
458 554
459#ifdef CONFIG_MACH_MX27 555#ifdef CONFIG_MACH_MX27
460DEFINE_MXC_GPIO_PORTS(MX27, imx27); 556DEFINE_MXC_GPIO_PORTS(MX27, imx27);
461#endif
462 557
463int __init mxc_register_gpios(void) 558int __init imx27_register_gpios(void)
464{ 559{
465#ifdef CONFIG_MACH_MX21 560 return mxc_gpio_init(imx27_gpio_ports, ARRAY_SIZE(imx27_gpio_ports));
466 if (cpu_is_mx21())
467 return mxc_gpio_init(imx21_gpio_ports, ARRAY_SIZE(imx21_gpio_ports));
468 else
469#endif
470#ifdef CONFIG_MACH_MX27
471 if (cpu_is_mx27())
472 return mxc_gpio_init(imx27_gpio_ports, ARRAY_SIZE(imx27_gpio_ports));
473 else
474#endif
475 return 0;
476} 561}
562#endif
477 563
478#ifdef CONFIG_MACH_MX21 564#ifdef CONFIG_MACH_MX21
479static struct resource mx21_usbhc_resources[] = { 565static struct resource mx21_usbhc_resources[] = {
@@ -501,3 +587,23 @@ struct platform_device mx21_usbhc_device = {
501}; 587};
502#endif 588#endif
503 589
590static struct resource imx_kpp_resources[] = {
591 {
592 .start = MX2x_KPP_BASE_ADDR,
593 .end = MX2x_KPP_BASE_ADDR + 0xf,
594 .flags = IORESOURCE_MEM
595 }, {
596 .start = MX2x_INT_KPP,
597 .end = MX2x_INT_KPP,
598 .flags = IORESOURCE_IRQ,
599 },
600};
601
602struct platform_device imx_kpp_device = {
603 .name = "imx-keypad",
604 .id = -1,
605 .num_resources = ARRAY_SIZE(imx_kpp_resources),
606 .resource = imx_kpp_resources,
607};
608
609#endif
diff --git a/arch/arm/mach-mx2/devices.h b/arch/arm/mach-imx/devices.h
index 84ed51380174..efd4527506a5 100644
--- a/arch/arm/mach-mx2/devices.h
+++ b/arch/arm/mach-imx/devices.h
@@ -1,3 +1,11 @@
1#ifdef CONFIG_ARCH_MX1
2extern struct platform_device imx1_camera_device;
3extern struct platform_device imx_rtc_device;
4extern struct platform_device imx_wdt_device;
5extern struct platform_device imx_usb_device;
6#endif
7
8#if defined(CONFIG_MACH_MX21) || defined(CONFIG_MACH_MX27)
1extern struct platform_device mxc_gpt1; 9extern struct platform_device mxc_gpt1;
2extern struct platform_device mxc_gpt2; 10extern struct platform_device mxc_gpt2;
3#ifdef CONFIG_MACH_MX27 11#ifdef CONFIG_MACH_MX27
@@ -6,37 +14,19 @@ extern struct platform_device mxc_gpt4;
6extern struct platform_device mxc_gpt5; 14extern struct platform_device mxc_gpt5;
7#endif 15#endif
8extern struct platform_device mxc_wdt; 16extern struct platform_device mxc_wdt;
9extern struct platform_device mxc_uart_device0;
10extern struct platform_device mxc_uart_device1;
11extern struct platform_device mxc_uart_device2;
12extern struct platform_device mxc_uart_device3;
13extern struct platform_device mxc_uart_device4;
14extern struct platform_device mxc_uart_device5;
15extern struct platform_device mxc_w1_master_device; 17extern struct platform_device mxc_w1_master_device;
16#ifdef CONFIG_MACH_MX21
17extern struct platform_device imx21_nand_device;
18#endif
19#ifdef CONFIG_MACH_MX27
20extern struct platform_device imx27_nand_device;
21#endif
22extern struct platform_device mxc_fb_device; 18extern struct platform_device mxc_fb_device;
23extern struct platform_device mxc_fec_device; 19extern struct platform_device mxc_fec_device;
24extern struct platform_device mxc_pwm_device; 20extern struct platform_device mxc_pwm_device;
25extern struct platform_device mxc_i2c_device0;
26#ifdef CONFIG_MACH_MX27
27extern struct platform_device mxc_i2c_device1;
28#endif
29extern struct platform_device mxc_sdhc_device0; 21extern struct platform_device mxc_sdhc_device0;
30extern struct platform_device mxc_sdhc_device1; 22extern struct platform_device mxc_sdhc_device1;
31extern struct platform_device mxc_otg_udc_device; 23extern struct platform_device mxc_otg_udc_device;
24extern struct platform_device mx27_camera_device;
32extern struct platform_device mxc_otg_host; 25extern struct platform_device mxc_otg_host;
33extern struct platform_device mxc_usbh1; 26extern struct platform_device mxc_usbh1;
34extern struct platform_device mxc_usbh2; 27extern struct platform_device mxc_usbh2;
35extern struct platform_device mxc_spi_device0;
36extern struct platform_device mxc_spi_device1;
37#ifdef CONFIG_MACH_MX27
38extern struct platform_device mxc_spi_device2;
39#endif
40extern struct platform_device mx21_usbhc_device; 28extern struct platform_device mx21_usbhc_device;
41extern struct platform_device imx_ssi_device0; 29extern struct platform_device imx_ssi_device0;
42extern struct platform_device imx_ssi_device1; 30extern struct platform_device imx_ssi_device1;
31extern struct platform_device imx_kpp_device;
32#endif
diff --git a/arch/arm/plat-mxc/dma-mx1-mx2.c b/arch/arm/mach-imx/dma-v1.c
index e16014b0d13c..3e8c47c63bac 100644
--- a/arch/arm/plat-mxc/dma-mx1-mx2.c
+++ b/arch/arm/mach-imx/dma-v1.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/plat-mxc/dma-mx1-mx2.c 2 * linux/arch/arm/plat-mxc/dma-v1.c
3 * 3 *
4 * i.MX DMA registration and IRQ dispatching 4 * i.MX DMA registration and IRQ dispatching
5 * 5 *
@@ -34,7 +34,7 @@
34#include <asm/system.h> 34#include <asm/system.h>
35#include <asm/irq.h> 35#include <asm/irq.h>
36#include <mach/hardware.h> 36#include <mach/hardware.h>
37#include <mach/dma-mx1-mx2.h> 37#include <mach/dma-v1.h>
38 38
39#define DMA_DCR 0x00 /* Control Register */ 39#define DMA_DCR 0x00 /* Control Register */
40#define DMA_DISR 0x04 /* Interrupt status Register */ 40#define DMA_DISR 0x04 /* Interrupt status Register */
@@ -310,7 +310,7 @@ imx_dma_setup_sg(int channel,
310 imxdma->resbytes = dma_length; 310 imxdma->resbytes = dma_length;
311 311
312 if (!sg || !sgcount) { 312 if (!sg || !sgcount) {
313 printk(KERN_ERR "imxdma%d: imx_dma_setup_sg epty sg list\n", 313 printk(KERN_ERR "imxdma%d: imx_dma_setup_sg empty sg list\n",
314 channel); 314 channel);
315 return -EINVAL; 315 return -EINVAL;
316 } 316 }
@@ -760,7 +760,6 @@ EXPORT_SYMBOL(imx_dma_free);
760 * @name: the driver/caller own non-%NULL identification 760 * @name: the driver/caller own non-%NULL identification
761 * 761 *
762 * This function tries to find a free channel in the specified priority group 762 * This function tries to find a free channel in the specified priority group
763 * This function tries to find a free channel in the specified priority group
764 * if the priority cannot be achieved it tries to look for free channel 763 * if the priority cannot be achieved it tries to look for free channel
765 * in the higher and then even lower priority groups. 764 * in the higher and then even lower priority groups.
766 * 765 *
diff --git a/arch/arm/mach-mx2/eukrea_mbimx27-baseboard.c b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
index f3b169d5245f..4edc5f439201 100644
--- a/arch/arm/mach-mx2/eukrea_mbimx27-baseboard.c
+++ b/arch/arm/mach-imx/eukrea_mbimx27-baseboard.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2009 Eric Benard - eric@eukrea.com 2 * Copyright (C) 2009-2010 Eric Benard - eric@eukrea.com
3 * 3 *
4 * Based on pcm970-baseboard.c which is : 4 * Based on pcm970-baseboard.c which is :
5 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de) 5 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
@@ -24,6 +24,9 @@
24#include <linux/platform_device.h> 24#include <linux/platform_device.h>
25#include <linux/spi/spi.h> 25#include <linux/spi/spi.h>
26#include <linux/spi/ads7846.h> 26#include <linux/spi/ads7846.h>
27#include <linux/backlight.h>
28#include <video/platform_lcd.h>
29#include <linux/input/matrix_keypad.h>
27 30
28#include <asm/mach/arch.h> 31#include <asm/mach/arch.h>
29 32
@@ -32,8 +35,11 @@
32#include <mach/imxfb.h> 35#include <mach/imxfb.h>
33#include <mach/hardware.h> 36#include <mach/hardware.h>
34#include <mach/mmc.h> 37#include <mach/mmc.h>
35#include <mach/imx-uart.h> 38#include <mach/spi.h>
39#include <mach/ssi.h>
40#include <mach/audmux.h>
36 41
42#include "devices-imx27.h"
37#include "devices.h" 43#include "devices.h"
38 44
39static int eukrea_mbimx27_pins[] = { 45static int eukrea_mbimx27_pins[] = {
@@ -48,10 +54,12 @@ static int eukrea_mbimx27_pins[] = {
48 PE10_PF_UART3_CTS, 54 PE10_PF_UART3_CTS,
49 PE11_PF_UART3_RTS, 55 PE11_PF_UART3_RTS,
50 /* UART4 */ 56 /* UART4 */
57#if !defined(MACH_EUKREA_CPUIMX27_USEUART4)
51 PB26_AF_UART4_RTS, 58 PB26_AF_UART4_RTS,
52 PB28_AF_UART4_TXD, 59 PB28_AF_UART4_TXD,
53 PB29_AF_UART4_CTS, 60 PB29_AF_UART4_CTS,
54 PB31_AF_UART4_RXD, 61 PB31_AF_UART4_RXD,
62#endif
55 /* SDHC1*/ 63 /* SDHC1*/
56 PE18_PF_SD1_D0, 64 PE18_PF_SD1_D0,
57 PE19_PF_SD1_D1, 65 PE19_PF_SD1_D1,
@@ -84,10 +92,29 @@ static int eukrea_mbimx27_pins[] = {
84 PA30_PF_CONTRAST, 92 PA30_PF_CONTRAST,
85 PA31_PF_OE_ACD, 93 PA31_PF_OE_ACD,
86 /* SPI1 */ 94 /* SPI1 */
87 PD28_PF_CSPI1_SS0,
88 PD29_PF_CSPI1_SCLK, 95 PD29_PF_CSPI1_SCLK,
89 PD30_PF_CSPI1_MISO, 96 PD30_PF_CSPI1_MISO,
90 PD31_PF_CSPI1_MOSI, 97 PD31_PF_CSPI1_MOSI,
98 /* SSI4 */
99#if defined(CONFIG_SND_SOC_EUKREA_TLV320) \
100 || defined(CONFIG_SND_SOC_EUKREA_TLV320_MODULE)
101 PC16_PF_SSI4_FS,
102 PC17_PF_SSI4_RXD | GPIO_PUEN,
103 PC18_PF_SSI4_TXD | GPIO_PUEN,
104 PC19_PF_SSI4_CLK,
105#endif
106};
107
108static const uint32_t eukrea_mbimx27_keymap[] = {
109 KEY(0, 0, KEY_UP),
110 KEY(0, 1, KEY_DOWN),
111 KEY(1, 0, KEY_RIGHT),
112 KEY(1, 1, KEY_LEFT),
113};
114
115static struct matrix_keymap_data eukrea_mbimx27_keymap_data = {
116 .keymap = eukrea_mbimx27_keymap,
117 .keymap_size = ARRAY_SIZE(eukrea_mbimx27_keymap),
91}; 118};
92 119
93static struct gpio_led gpio_leds[] = { 120static struct gpio_led gpio_leds[] = {
@@ -103,12 +130,6 @@ static struct gpio_led gpio_leds[] = {
103 .active_low = 1, 130 .active_low = 1,
104 .gpio = GPIO_PORTF | 19, 131 .gpio = GPIO_PORTF | 19,
105 }, 132 },
106 {
107 .name = "backlight",
108 .default_trigger = "backlight",
109 .active_low = 0,
110 .gpio = GPIO_PORTE | 5,
111 },
112}; 133};
113 134
114static struct gpio_led_platform_data gpio_led_info = { 135static struct gpio_led_platform_data gpio_led_info = {
@@ -127,7 +148,7 @@ static struct platform_device leds_gpio = {
127static struct imx_fb_videomode eukrea_mbimx27_modes[] = { 148static struct imx_fb_videomode eukrea_mbimx27_modes[] = {
128 { 149 {
129 .mode = { 150 .mode = {
130 .name = "CMO-QGVA", 151 .name = "CMO-QVGA",
131 .refresh = 60, 152 .refresh = 60,
132 .xres = 320, 153 .xres = 320,
133 .yres = 240, 154 .yres = 240,
@@ -141,6 +162,38 @@ static struct imx_fb_videomode eukrea_mbimx27_modes[] = {
141 }, 162 },
142 .pcr = 0xFAD08B80, 163 .pcr = 0xFAD08B80,
143 .bpp = 16, 164 .bpp = 16,
165 }, {
166 .mode = {
167 .name = "DVI-VGA",
168 .refresh = 60,
169 .xres = 640,
170 .yres = 480,
171 .pixclock = 32000,
172 .hsync_len = 1,
173 .left_margin = 35,
174 .right_margin = 0,
175 .vsync_len = 1,
176 .upper_margin = 7,
177 .lower_margin = 0,
178 },
179 .pcr = 0xFA208B80,
180 .bpp = 16,
181 }, {
182 .mode = {
183 .name = "DVI-SVGA",
184 .refresh = 60,
185 .xres = 800,
186 .yres = 600,
187 .pixclock = 25000,
188 .hsync_len = 1,
189 .left_margin = 35,
190 .right_margin = 0,
191 .vsync_len = 1,
192 .upper_margin = 7,
193 .lower_margin = 0,
194 },
195 .pcr = 0xFA208B80,
196 .bpp = 16,
144 }, 197 },
145}; 198};
146 199
@@ -153,16 +206,52 @@ static struct imx_fb_platform_data eukrea_mbimx27_fb_data = {
153 .dmacr = 0x00040060, 206 .dmacr = 0x00040060,
154}; 207};
155 208
156static struct imxuart_platform_data uart_pdata[] = { 209static void eukrea_mbimx27_bl_set_intensity(int intensity)
157 { 210{
158 .flags = IMXUART_HAVE_RTSCTS, 211 if (intensity)
159 }, 212 gpio_direction_output(GPIO_PORTE | 5, 1);
160 { 213 else
161 .flags = IMXUART_HAVE_RTSCTS, 214 gpio_direction_output(GPIO_PORTE | 5, 0);
215}
216
217static struct generic_bl_info eukrea_mbimx27_bl_info = {
218 .name = "eukrea_mbimx27-bl",
219 .max_intensity = 0xff,
220 .default_intensity = 0xff,
221 .set_bl_intensity = eukrea_mbimx27_bl_set_intensity,
222};
223
224static struct platform_device eukrea_mbimx27_bl_dev = {
225 .name = "generic-bl",
226 .id = 1,
227 .dev = {
228 .platform_data = &eukrea_mbimx27_bl_info,
162 }, 229 },
163}; 230};
164 231
165#if defined(CONFIG_TOUCHSCREEN_ADS7846) 232static void eukrea_mbimx27_lcd_power_set(struct plat_lcd_data *pd,
233 unsigned int power)
234{
235 if (power)
236 gpio_direction_output(GPIO_PORTA | 25, 1);
237 else
238 gpio_direction_output(GPIO_PORTA | 25, 0);
239}
240
241static struct plat_lcd_data eukrea_mbimx27_lcd_power_data = {
242 .set_power = eukrea_mbimx27_lcd_power_set,
243};
244
245static struct platform_device eukrea_mbimx27_lcd_powerdev = {
246 .name = "platform-lcd",
247 .dev.platform_data = &eukrea_mbimx27_lcd_power_data,
248};
249
250static const struct imxuart_platform_data uart_pdata __initconst = {
251 .flags = IMXUART_HAVE_RTSCTS,
252};
253
254#if defined(CONFIG_TOUCHSCREEN_ADS7846) \
166 || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) 255 || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
167 256
168#define ADS7846_PENDOWN (GPIO_PORTD | 25) 257#define ADS7846_PENDOWN (GPIO_PORTD | 25)
@@ -173,7 +262,6 @@ static void ads7846_dev_init(void)
173 printk(KERN_ERR "can't get ads746 pen down GPIO\n"); 262 printk(KERN_ERR "can't get ads746 pen down GPIO\n");
174 return; 263 return;
175 } 264 }
176
177 gpio_direction_input(ADS7846_PENDOWN); 265 gpio_direction_input(ADS7846_PENDOWN);
178} 266}
179 267
@@ -186,7 +274,9 @@ static struct ads7846_platform_data ads7846_config __initdata = {
186 .get_pendown_state = ads7846_get_pendown_state, 274 .get_pendown_state = ads7846_get_pendown_state,
187 .keep_vref_on = 1, 275 .keep_vref_on = 1,
188}; 276};
277#endif
189 278
279#if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE)
190static struct spi_board_info eukrea_mbimx27_spi_board_info[] __initdata = { 280static struct spi_board_info eukrea_mbimx27_spi_board_info[] __initdata = {
191 [0] = { 281 [0] = {
192 .modalias = "ads7846", 282 .modalias = "ads7846",
@@ -201,16 +291,30 @@ static struct spi_board_info eukrea_mbimx27_spi_board_info[] __initdata = {
201 291
202static int eukrea_mbimx27_spi_cs[] = {GPIO_PORTD | 28}; 292static int eukrea_mbimx27_spi_cs[] = {GPIO_PORTD | 28};
203 293
204static struct spi_imx_master eukrea_mbimx27_spi_0_data = { 294static const struct spi_imx_master eukrea_mbimx27_spi0_data __initconst = {
205 .chipselect = eukrea_mbimx27_spi_cs, 295 .chipselect = eukrea_mbimx27_spi_cs,
206 .num_chipselect = ARRAY_SIZE(eukrea_mbimx27_spi_cs), 296 .num_chipselect = ARRAY_SIZE(eukrea_mbimx27_spi_cs),
207}; 297};
208#endif 298#endif
209 299
300static struct i2c_board_info eukrea_mbimx27_i2c_devices[] = {
301 {
302 I2C_BOARD_INFO("tlv320aic23", 0x1a),
303 },
304};
305
210static struct platform_device *platform_devices[] __initdata = { 306static struct platform_device *platform_devices[] __initdata = {
211 &leds_gpio, 307 &leds_gpio,
212}; 308};
213 309
310static struct imxmmc_platform_data sdhc_pdata = {
311 .dat3_card_detect = 1,
312};
313
314struct imx_ssi_platform_data eukrea_mbimx27_ssi_pdata = {
315 .flags = IMX_SSI_DMA | IMX_SSI_USE_I2S_SLAVE,
316};
317
214/* 318/*
215 * system init for baseboard usage. Will be called by cpuimx27 init. 319 * system init for baseboard usage. Will be called by cpuimx27 init.
216 * 320 *
@@ -222,21 +326,52 @@ void __init eukrea_mbimx27_baseboard_init(void)
222 mxc_gpio_setup_multiple_pins(eukrea_mbimx27_pins, 326 mxc_gpio_setup_multiple_pins(eukrea_mbimx27_pins,
223 ARRAY_SIZE(eukrea_mbimx27_pins), "MBIMX27"); 327 ARRAY_SIZE(eukrea_mbimx27_pins), "MBIMX27");
224 328
225 mxc_register_device(&mxc_uart_device1, &uart_pdata[0]); 329#if defined(CONFIG_SND_SOC_EUKREA_TLV320) \
226 mxc_register_device(&mxc_uart_device2, &uart_pdata[1]); 330 || defined(CONFIG_SND_SOC_EUKREA_TLV320_MODULE)
331 /* SSI unit master I2S codec connected to SSI_PINS_4*/
332 mxc_audmux_v1_configure_port(MX27_AUDMUX_HPCR1_SSI0,
333 MXC_AUDMUX_V1_PCR_SYN |
334 MXC_AUDMUX_V1_PCR_TFSDIR |
335 MXC_AUDMUX_V1_PCR_TCLKDIR |
336 MXC_AUDMUX_V1_PCR_RFSDIR |
337 MXC_AUDMUX_V1_PCR_RCLKDIR |
338 MXC_AUDMUX_V1_PCR_TFCSEL(MX27_AUDMUX_HPCR3_SSI_PINS_4) |
339 MXC_AUDMUX_V1_PCR_RFCSEL(MX27_AUDMUX_HPCR3_SSI_PINS_4) |
340 MXC_AUDMUX_V1_PCR_RXDSEL(MX27_AUDMUX_HPCR3_SSI_PINS_4)
341 );
342 mxc_audmux_v1_configure_port(MX27_AUDMUX_HPCR3_SSI_PINS_4,
343 MXC_AUDMUX_V1_PCR_SYN |
344 MXC_AUDMUX_V1_PCR_RXDSEL(MX27_AUDMUX_HPCR1_SSI0)
345 );
346#endif
347
348 imx27_add_imx_uart1(&uart_pdata);
349 imx27_add_imx_uart2(&uart_pdata);
350#if !defined(MACH_EUKREA_CPUIMX27_USEUART4)
351 imx27_add_imx_uart3(&uart_pdata);
352#endif
227 353
228 mxc_register_device(&mxc_fb_device, &eukrea_mbimx27_fb_data); 354 mxc_register_device(&mxc_fb_device, &eukrea_mbimx27_fb_data);
229 mxc_register_device(&mxc_sdhc_device0, NULL); 355 mxc_register_device(&mxc_sdhc_device0, &sdhc_pdata);
230 356
231#if defined(CONFIG_TOUCHSCREEN_ADS7846) 357 i2c_register_board_info(0, eukrea_mbimx27_i2c_devices,
358 ARRAY_SIZE(eukrea_mbimx27_i2c_devices));
359
360 mxc_register_device(&imx_ssi_device0, &eukrea_mbimx27_ssi_pdata);
361
362#if defined(CONFIG_TOUCHSCREEN_ADS7846) \
232 || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE) 363 || defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
233 /* SPI and ADS7846 Touchscreen controler init */ 364 /* ADS7846 Touchscreen controller init */
234 mxc_gpio_mode(GPIO_PORTD | 28 | GPIO_GPIO | GPIO_OUT);
235 mxc_gpio_mode(GPIO_PORTD | 25 | GPIO_GPIO | GPIO_IN); 365 mxc_gpio_mode(GPIO_PORTD | 25 | GPIO_GPIO | GPIO_IN);
236 mxc_register_device(&mxc_spi_device0, &eukrea_mbimx27_spi_0_data); 366 ads7846_dev_init();
367#endif
368
369#if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE)
370 /* SPI_CS0 init */
371 mxc_gpio_mode(GPIO_PORTD | 28 | GPIO_GPIO | GPIO_OUT);
372 imx27_add_spi_imx0(&eukrea_mbimx27_spi0_data);
237 spi_register_board_info(eukrea_mbimx27_spi_board_info, 373 spi_register_board_info(eukrea_mbimx27_spi_board_info,
238 ARRAY_SIZE(eukrea_mbimx27_spi_board_info)); 374 ARRAY_SIZE(eukrea_mbimx27_spi_board_info));
239 ads7846_dev_init();
240#endif 375#endif
241 376
242 /* Leds configuration */ 377 /* Leds configuration */
@@ -244,6 +379,14 @@ void __init eukrea_mbimx27_baseboard_init(void)
244 mxc_gpio_mode(GPIO_PORTF | 19 | GPIO_GPIO | GPIO_OUT); 379 mxc_gpio_mode(GPIO_PORTF | 19 | GPIO_GPIO | GPIO_OUT);
245 /* Backlight */ 380 /* Backlight */
246 mxc_gpio_mode(GPIO_PORTE | 5 | GPIO_GPIO | GPIO_OUT); 381 mxc_gpio_mode(GPIO_PORTE | 5 | GPIO_GPIO | GPIO_OUT);
382 gpio_request(GPIO_PORTE | 5, "backlight");
383 platform_device_register(&eukrea_mbimx27_bl_dev);
384 /* LCD Reset */
385 mxc_gpio_mode(GPIO_PORTA | 25 | GPIO_GPIO | GPIO_OUT);
386 gpio_request(GPIO_PORTA | 25, "lcd_enable");
387 platform_device_register(&eukrea_mbimx27_lcd_powerdev);
388
389 mxc_register_device(&imx_kpp_device, &eukrea_mbimx27_keymap_data);
247 390
248 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 391 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
249} 392}
diff --git a/arch/arm/mach-imx/include/mach/dma-mx1-mx2.h b/arch/arm/mach-imx/include/mach/dma-mx1-mx2.h
new file mode 100644
index 000000000000..df5f522da6b3
--- /dev/null
+++ b/arch/arm/mach-imx/include/mach/dma-mx1-mx2.h
@@ -0,0 +1,10 @@
1#ifndef __MACH_DMA_MX1_MX2_H__
2#define __MACH_DMA_MX1_MX2_H__
3/*
4 * Don't use this header in new code, it will go away when all users are
5 * converted to mach/dma-v1.h
6 */
7
8#include <mach/dma-v1.h>
9
10#endif /* ifndef __MACH_DMA_MX1_MX2_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/dma-mx1-mx2.h b/arch/arm/mach-imx/include/mach/dma-v1.h
index 7c4870bd5a21..287431cc13e5 100644
--- a/arch/arm/plat-mxc/include/mach/dma-mx1-mx2.h
+++ b/arch/arm/mach-imx/include/mach/dma-v1.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * linux/arch/arm/plat-mxc/include/mach/dma-mx1-mx2.h 2 * linux/arch/arm/mach-imx/include/mach/dma-v1.h
3 * 3 *
4 * i.MX DMA registration and IRQ dispatching 4 * i.MX DMA registration and IRQ dispatching
5 * 5 *
@@ -22,8 +22,10 @@
22 * MA 02110-1301, USA. 22 * MA 02110-1301, USA.
23 */ 23 */
24 24
25#ifndef __ASM_ARCH_MXC_DMA_H 25#ifndef __MACH_DMA_V1_H__
26#define __ASM_ARCH_MXC_DMA_H 26#define __MACH_DMA_V1_H__
27
28#define imx_has_dma_v1() (cpu_is_mx1() || cpu_is_mx21() || cpu_is_mx27())
27 29
28#define IMX_DMA_CHANNELS 16 30#define IMX_DMA_CHANNELS 16
29 31
@@ -102,4 +104,4 @@ enum imx_dma_prio {
102 104
103int imx_dma_request_by_prio(const char *name, enum imx_dma_prio prio); 105int imx_dma_request_by_prio(const char *name, enum imx_dma_prio prio);
104 106
105#endif /* _ASM_ARCH_MXC_DMA_H */ 107#endif /* __MACH_DMA_V1_H__ */
diff --git a/arch/arm/mach-mx2/mach-cpuimx27.c b/arch/arm/mach-imx/mach-cpuimx27.c
index 1f616dcaabc9..575ff1ae85a7 100644
--- a/arch/arm/mach-mx2/mach-cpuimx27.c
+++ b/arch/arm/mach-imx/mach-cpuimx27.c
@@ -26,20 +26,24 @@
26#include <linux/mtd/physmap.h> 26#include <linux/mtd/physmap.h>
27#include <linux/platform_device.h> 27#include <linux/platform_device.h>
28#include <linux/serial_8250.h> 28#include <linux/serial_8250.h>
29#include <linux/usb/otg.h>
30#include <linux/usb/ulpi.h>
31#include <linux/fsl_devices.h>
29 32
30#include <asm/mach-types.h> 33#include <asm/mach-types.h>
31#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
32#include <asm/mach/time.h> 35#include <asm/mach/time.h>
33#include <asm/mach/map.h> 36#include <asm/mach/map.h>
34 37
35#include <mach/board-eukrea_cpuimx27.h> 38#include <mach/eukrea-baseboards.h>
36#include <mach/common.h> 39#include <mach/common.h>
37#include <mach/hardware.h> 40#include <mach/hardware.h>
38#include <mach/i2c.h>
39#include <mach/iomux-mx27.h> 41#include <mach/iomux-mx27.h>
40#include <mach/imx-uart.h>
41#include <mach/mxc_nand.h> 42#include <mach/mxc_nand.h>
43#include <mach/mxc_ehci.h>
44#include <mach/ulpi.h>
42 45
46#include "devices-imx27.h"
43#include "devices.h" 47#include "devices.h"
44 48
45static int eukrea_cpuimx27_pins[] = { 49static int eukrea_cpuimx27_pins[] = {
@@ -49,10 +53,12 @@ static int eukrea_cpuimx27_pins[] = {
49 PE14_PF_UART1_CTS, 53 PE14_PF_UART1_CTS,
50 PE15_PF_UART1_RTS, 54 PE15_PF_UART1_RTS,
51 /* UART4 */ 55 /* UART4 */
56#if defined(MACH_EUKREA_CPUIMX27_USEUART4)
52 PB26_AF_UART4_RTS, 57 PB26_AF_UART4_RTS,
53 PB28_AF_UART4_TXD, 58 PB28_AF_UART4_TXD,
54 PB29_AF_UART4_CTS, 59 PB29_AF_UART4_CTS,
55 PB31_AF_UART4_RXD, 60 PB31_AF_UART4_RXD,
61#endif
56 /* FEC */ 62 /* FEC */
57 PD0_AIN_FEC_TXD0, 63 PD0_AIN_FEC_TXD0,
58 PD1_AIN_FEC_TXD1, 64 PD1_AIN_FEC_TXD1,
@@ -76,19 +82,47 @@ static int eukrea_cpuimx27_pins[] = {
76 PD17_PF_I2C_DATA, 82 PD17_PF_I2C_DATA,
77 PD18_PF_I2C_CLK, 83 PD18_PF_I2C_CLK,
78 /* SDHC2 */ 84 /* SDHC2 */
85#if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2)
79 PB4_PF_SD2_D0, 86 PB4_PF_SD2_D0,
80 PB5_PF_SD2_D1, 87 PB5_PF_SD2_D1,
81 PB6_PF_SD2_D2, 88 PB6_PF_SD2_D2,
82 PB7_PF_SD2_D3, 89 PB7_PF_SD2_D3,
83 PB8_PF_SD2_CMD, 90 PB8_PF_SD2_CMD,
84 PB9_PF_SD2_CLK, 91 PB9_PF_SD2_CLK,
92#endif
85#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE) 93#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
86 /* Quad UART's IRQ */ 94 /* Quad UART's IRQ */
87 GPIO_PORTD | 22 | GPIO_GPIO | GPIO_IN, 95 GPIO_PORTB | 22 | GPIO_GPIO | GPIO_IN,
88 GPIO_PORTD | 23 | GPIO_GPIO | GPIO_IN, 96 GPIO_PORTB | 23 | GPIO_GPIO | GPIO_IN,
89 GPIO_PORTD | 27 | GPIO_GPIO | GPIO_IN, 97 GPIO_PORTB | 27 | GPIO_GPIO | GPIO_IN,
90 GPIO_PORTD | 30 | GPIO_GPIO | GPIO_IN, 98 GPIO_PORTB | 30 | GPIO_GPIO | GPIO_IN,
91#endif 99#endif
100 /* OTG */
101 PC7_PF_USBOTG_DATA5,
102 PC8_PF_USBOTG_DATA6,
103 PC9_PF_USBOTG_DATA0,
104 PC10_PF_USBOTG_DATA2,
105 PC11_PF_USBOTG_DATA1,
106 PC12_PF_USBOTG_DATA4,
107 PC13_PF_USBOTG_DATA3,
108 PE0_PF_USBOTG_NXT,
109 PE1_PF_USBOTG_STP,
110 PE2_PF_USBOTG_DIR,
111 PE24_PF_USBOTG_CLK,
112 PE25_PF_USBOTG_DATA7,
113 /* USBH2 */
114 PA0_PF_USBH2_CLK,
115 PA1_PF_USBH2_DIR,
116 PA2_PF_USBH2_DATA7,
117 PA3_PF_USBH2_NXT,
118 PA4_PF_USBH2_STP,
119 PD19_AF_USBH2_DATA4,
120 PD20_AF_USBH2_DATA3,
121 PD21_AF_USBH2_DATA6,
122 PD22_AF_USBH2_DATA0,
123 PD23_AF_USBH2_DATA2,
124 PD24_AF_USBH2_DATA1,
125 PD26_AF_USBH2_DATA5,
92}; 126};
93 127
94static struct physmap_flash_data eukrea_cpuimx27_flash_data = { 128static struct physmap_flash_data eukrea_cpuimx27_flash_data = {
@@ -111,15 +145,12 @@ static struct platform_device eukrea_cpuimx27_nor_mtd_device = {
111 .resource = &eukrea_cpuimx27_flash_resource, 145 .resource = &eukrea_cpuimx27_flash_resource,
112}; 146};
113 147
114static struct imxuart_platform_data uart_pdata[] = { 148static const struct imxuart_platform_data uart_pdata __initconst = {
115 { 149 .flags = IMXUART_HAVE_RTSCTS,
116 .flags = IMXUART_HAVE_RTSCTS,
117 }, {
118 .flags = IMXUART_HAVE_RTSCTS,
119 },
120}; 150};
121 151
122static struct mxc_nand_platform_data eukrea_cpuimx27_nand_board_info = { 152static const struct mxc_nand_platform_data
153cpuimx27_nand_board_info __initconst = {
123 .width = 1, 154 .width = 1,
124 .hw_ecc = 1, 155 .hw_ecc = 1,
125}; 156};
@@ -127,9 +158,11 @@ static struct mxc_nand_platform_data eukrea_cpuimx27_nand_board_info = {
127static struct platform_device *platform_devices[] __initdata = { 158static struct platform_device *platform_devices[] __initdata = {
128 &eukrea_cpuimx27_nor_mtd_device, 159 &eukrea_cpuimx27_nor_mtd_device,
129 &mxc_fec_device, 160 &mxc_fec_device,
161 &mxc_wdt,
162 &mxc_w1_master_device,
130}; 163};
131 164
132static struct imxi2c_platform_data eukrea_cpuimx27_i2c_1_data = { 165static const struct imxi2c_platform_data cpuimx27_i2c1_data __initconst = {
133 .bitrate = 100000, 166 .bitrate = 100000,
134}; 167};
135 168
@@ -182,34 +215,83 @@ static struct platform_device serial_device = {
182}; 215};
183#endif 216#endif
184 217
218#if defined(CONFIG_USB_ULPI)
219static struct mxc_usbh_platform_data otg_pdata = {
220 .portsc = MXC_EHCI_MODE_ULPI,
221 .flags = MXC_EHCI_INTERFACE_DIFF_UNI,
222};
223
224static struct mxc_usbh_platform_data usbh2_pdata = {
225 .portsc = MXC_EHCI_MODE_ULPI,
226 .flags = MXC_EHCI_INTERFACE_DIFF_UNI,
227};
228#endif
229
230static struct fsl_usb2_platform_data otg_device_pdata = {
231 .operating_mode = FSL_USB2_DR_DEVICE,
232 .phy_mode = FSL_USB2_PHY_ULPI,
233};
234
235static int otg_mode_host;
236
237static int __init eukrea_cpuimx27_otg_mode(char *options)
238{
239 if (!strcmp(options, "host"))
240 otg_mode_host = 1;
241 else if (!strcmp(options, "device"))
242 otg_mode_host = 0;
243 else
244 pr_info("otg_mode neither \"host\" nor \"device\". "
245 "Defaulting to device\n");
246 return 0;
247}
248__setup("otg_mode=", eukrea_cpuimx27_otg_mode);
249
185static void __init eukrea_cpuimx27_init(void) 250static void __init eukrea_cpuimx27_init(void)
186{ 251{
187 mxc_gpio_setup_multiple_pins(eukrea_cpuimx27_pins, 252 mxc_gpio_setup_multiple_pins(eukrea_cpuimx27_pins,
188 ARRAY_SIZE(eukrea_cpuimx27_pins), "CPUIMX27"); 253 ARRAY_SIZE(eukrea_cpuimx27_pins), "CPUIMX27");
189 254
190 mxc_register_device(&mxc_uart_device0, &uart_pdata[0]); 255 imx27_add_imx_uart0(&uart_pdata);
191 256
192 mxc_register_device(&imx27_nand_device, 257 imx27_add_mxc_nand(&cpuimx27_nand_board_info);
193 &eukrea_cpuimx27_nand_board_info);
194 258
195 i2c_register_board_info(0, eukrea_cpuimx27_i2c_devices, 259 i2c_register_board_info(0, eukrea_cpuimx27_i2c_devices,
196 ARRAY_SIZE(eukrea_cpuimx27_i2c_devices)); 260 ARRAY_SIZE(eukrea_cpuimx27_i2c_devices));
197 261
198 mxc_register_device(&mxc_i2c_device0, &eukrea_cpuimx27_i2c_1_data); 262 imx27_add_i2c_imx1(&cpuimx27_i2c1_data);
199 263
200 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 264 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
201 265
202#if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2) 266#if defined(CONFIG_MACH_EUKREA_CPUIMX27_USESDHC2)
203 /* SDHC2 can be used for Wifi */ 267 /* SDHC2 can be used for Wifi */
204 mxc_register_device(&mxc_sdhc_device1, NULL); 268 mxc_register_device(&mxc_sdhc_device1, NULL);
269#endif
270#if defined(MACH_EUKREA_CPUIMX27_USEUART4)
205 /* in which case UART4 is also used for Bluetooth */ 271 /* in which case UART4 is also used for Bluetooth */
206 mxc_register_device(&mxc_uart_device3, &uart_pdata[1]); 272 imx27_add_imx_uart3(&uart_pdata);
207#endif 273#endif
208 274
209#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE) 275#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
210 platform_device_register(&serial_device); 276 platform_device_register(&serial_device);
211#endif 277#endif
212 278
279#if defined(CONFIG_USB_ULPI)
280 if (otg_mode_host) {
281 otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
282 USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT);
283
284 mxc_register_device(&mxc_otg_host, &otg_pdata);
285 }
286
287 usbh2_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
288 USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT);
289
290 mxc_register_device(&mxc_usbh2, &usbh2_pdata);
291#endif
292 if (!otg_mode_host)
293 mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata);
294
213#ifdef CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD 295#ifdef CONFIG_MACH_EUKREA_MBIMX27_BASEBOARD
214 eukrea_mbimx27_baseboard_init(); 296 eukrea_mbimx27_baseboard_init();
215#endif 297#endif
diff --git a/arch/arm/mach-mx2/mach-imx27lite.c b/arch/arm/mach-imx/mach-imx27lite.c
index b5710bf18b96..22a2b5d91213 100644
--- a/arch/arm/mach-mx2/mach-imx27lite.c
+++ b/arch/arm/mach-imx/mach-imx27lite.c
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
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 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 15 */
20 16
21#include <linux/platform_device.h> 17#include <linux/platform_device.h>
@@ -26,10 +22,9 @@
26#include <asm/mach/map.h> 22#include <asm/mach/map.h>
27#include <mach/hardware.h> 23#include <mach/hardware.h>
28#include <mach/common.h> 24#include <mach/common.h>
29#include <mach/imx-uart.h>
30#include <mach/iomux-mx27.h> 25#include <mach/iomux-mx27.h>
31#include <mach/board-mx27lite.h>
32 26
27#include "devices-imx27.h"
33#include "devices.h" 28#include "devices.h"
34 29
35static unsigned int mx27lite_pins[] = { 30static unsigned int mx27lite_pins[] = {
@@ -59,7 +54,7 @@ static unsigned int mx27lite_pins[] = {
59 PF23_AIN_FEC_TX_EN, 54 PF23_AIN_FEC_TX_EN,
60}; 55};
61 56
62static struct imxuart_platform_data uart_pdata = { 57static const struct imxuart_platform_data uart_pdata __initconst = {
63 .flags = IMXUART_HAVE_RTSCTS, 58 .flags = IMXUART_HAVE_RTSCTS,
64}; 59};
65 60
@@ -71,7 +66,7 @@ static void __init mx27lite_init(void)
71{ 66{
72 mxc_gpio_setup_multiple_pins(mx27lite_pins, ARRAY_SIZE(mx27lite_pins), 67 mxc_gpio_setup_multiple_pins(mx27lite_pins, ARRAY_SIZE(mx27lite_pins),
73 "imx27lite"); 68 "imx27lite");
74 mxc_register_device(&mxc_uart_device0, &uart_pdata); 69 imx27_add_imx_uart0(&uart_pdata);
75 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 70 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
76} 71}
77 72
diff --git a/arch/arm/mach-mx1/mach-mx1ads.c b/arch/arm/mach-imx/mach-mx1ads.c
index 51f3cfd83db2..77a760cfadc0 100644
--- a/arch/arm/mach-mx1/mach-mx1ads.c
+++ b/arch/arm/mach-imx/mach-mx1ads.c
@@ -26,10 +26,10 @@
26#include <mach/common.h> 26#include <mach/common.h>
27#include <mach/hardware.h> 27#include <mach/hardware.h>
28#include <mach/i2c.h> 28#include <mach/i2c.h>
29#include <mach/imx-uart.h>
30#include <mach/iomux-mx1.h> 29#include <mach/iomux-mx1.h>
31#include <mach/irqs.h> 30#include <mach/irqs.h>
32 31
32#include "devices-imx1.h"
33#include "devices.h" 33#include "devices.h"
34 34
35static int mx1ads_pins[] = { 35static int mx1ads_pins[] = {
@@ -58,12 +58,12 @@ static int mx1ads_pins[] = {
58 * UARTs platform data 58 * UARTs platform data
59 */ 59 */
60 60
61static struct imxuart_platform_data uart_pdata[] = { 61static const struct imxuart_platform_data uart0_pdata __initconst = {
62 { 62 .flags = IMXUART_HAVE_RTSCTS,
63 .flags = IMXUART_HAVE_RTSCTS, 63};
64 }, { 64
65 .flags = IMXUART_HAVE_RTSCTS, 65static const struct imxuart_platform_data uart1_pdata __initconst = {
66 }, 66 .flags = IMXUART_HAVE_RTSCTS,
67}; 67};
68 68
69/* 69/*
@@ -75,8 +75,8 @@ static struct physmap_flash_data mx1ads_flash_data = {
75}; 75};
76 76
77static struct resource flash_resource = { 77static struct resource flash_resource = {
78 .start = IMX_CS0_PHYS, 78 .start = MX1_CS0_PHYS,
79 .end = IMX_CS0_PHYS + SZ_32M - 1, 79 .end = MX1_CS0_PHYS + SZ_32M - 1,
80 .flags = IORESOURCE_MEM, 80 .flags = IORESOURCE_MEM,
81}; 81};
82 82
@@ -98,7 +98,7 @@ static struct pcf857x_platform_data pcf857x_data[] = {
98 } 98 }
99}; 99};
100 100
101static struct imxi2c_platform_data mx1ads_i2c_data = { 101static const struct imxi2c_platform_data mx1ads_i2c_data __initconst = {
102 .bitrate = 100000, 102 .bitrate = 100000,
103}; 103};
104 104
@@ -121,8 +121,8 @@ static void __init mx1ads_init(void)
121 ARRAY_SIZE(mx1ads_pins), "mx1ads"); 121 ARRAY_SIZE(mx1ads_pins), "mx1ads");
122 122
123 /* UART */ 123 /* UART */
124 mxc_register_device(&imx_uart1_device, &uart_pdata[0]); 124 imx1_add_imx_uart0(&uart0_pdata);
125 mxc_register_device(&imx_uart2_device, &uart_pdata[1]); 125 imx1_add_imx_uart1(&uart1_pdata);
126 126
127 /* Physmap flash */ 127 /* Physmap flash */
128 mxc_register_device(&flash_device, &mx1ads_flash_data); 128 mxc_register_device(&flash_device, &mx1ads_flash_data);
@@ -131,7 +131,7 @@ static void __init mx1ads_init(void)
131 i2c_register_board_info(0, mx1ads_i2c_devices, 131 i2c_register_board_info(0, mx1ads_i2c_devices,
132 ARRAY_SIZE(mx1ads_i2c_devices)); 132 ARRAY_SIZE(mx1ads_i2c_devices));
133 133
134 mxc_register_device(&imx_i2c_device, &mx1ads_i2c_data); 134 imx1_add_i2c_imx(&mx1ads_i2c_data);
135} 135}
136 136
137static void __init mx1ads_timer_init(void) 137static void __init mx1ads_timer_init(void)
@@ -145,8 +145,8 @@ struct sys_timer mx1ads_timer = {
145 145
146MACHINE_START(MX1ADS, "Freescale MX1ADS") 146MACHINE_START(MX1ADS, "Freescale MX1ADS")
147 /* Maintainer: Sascha Hauer, Pengutronix */ 147 /* Maintainer: Sascha Hauer, Pengutronix */
148 .phys_io = IMX_IO_PHYS, 148 .phys_io = MX1_IO_BASE_ADDR,
149 .io_pg_offst = (IMX_IO_BASE >> 18) & 0xfffc, 149 .io_pg_offst = (MX1_IO_BASE_ADDR_VIRT >> 18) & 0xfffc,
150 .boot_params = MX1_PHYS_OFFSET + 0x100, 150 .boot_params = MX1_PHYS_OFFSET + 0x100,
151 .map_io = mx1_map_io, 151 .map_io = mx1_map_io,
152 .init_irq = mx1_init_irq, 152 .init_irq = mx1_init_irq,
@@ -155,8 +155,8 @@ MACHINE_START(MX1ADS, "Freescale MX1ADS")
155MACHINE_END 155MACHINE_END
156 156
157MACHINE_START(MXLADS, "Freescale MXLADS") 157MACHINE_START(MXLADS, "Freescale MXLADS")
158 .phys_io = IMX_IO_PHYS, 158 .phys_io = MX1_IO_BASE_ADDR,
159 .io_pg_offst = (IMX_IO_BASE >> 18) & 0xfffc, 159 .io_pg_offst = (MX1_IO_BASE_ADDR_VIRT >> 18) & 0xfffc,
160 .boot_params = MX1_PHYS_OFFSET + 0x100, 160 .boot_params = MX1_PHYS_OFFSET + 0x100,
161 .map_io = mx1_map_io, 161 .map_io = mx1_map_io,
162 .init_irq = mx1_init_irq, 162 .init_irq = mx1_init_irq,
diff --git a/arch/arm/mach-mx2/mach-mx21ads.c b/arch/arm/mach-imx/mach-mx21ads.c
index 113e58d7cb40..96d7f8189f32 100644
--- a/arch/arm/mach-mx2/mach-mx21ads.c
+++ b/arch/arm/mach-imx/mach-mx21ads.c
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
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 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 15 */
20 16
21#include <linux/platform_device.h> 17#include <linux/platform_device.h>
@@ -28,15 +24,49 @@
28#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
29#include <asm/mach/time.h> 25#include <asm/mach/time.h>
30#include <asm/mach/map.h> 26#include <asm/mach/map.h>
31#include <mach/imx-uart.h>
32#include <mach/imxfb.h> 27#include <mach/imxfb.h>
33#include <mach/iomux-mx21.h> 28#include <mach/iomux-mx21.h>
34#include <mach/mxc_nand.h> 29#include <mach/mxc_nand.h>
35#include <mach/mmc.h> 30#include <mach/mmc.h>
36#include <mach/board-mx21ads.h>
37 31
32#include "devices-imx21.h"
38#include "devices.h" 33#include "devices.h"
39 34
35/*
36 * Memory-mapped I/O on MX21ADS base board
37 */
38#define MX21ADS_MMIO_BASE_ADDR 0xf5000000
39#define MX21ADS_MMIO_SIZE SZ_16M
40
41#define MX21ADS_REG_ADDR(offset) (void __force __iomem *) \
42 (MX21ADS_MMIO_BASE_ADDR + (offset))
43
44#define MX21ADS_CS8900A_IRQ IRQ_GPIOE(11)
45#define MX21ADS_CS8900A_IOBASE_REG MX21ADS_REG_ADDR(0x000000)
46#define MX21ADS_ST16C255_IOBASE_REG MX21ADS_REG_ADDR(0x200000)
47#define MX21ADS_VERSION_REG MX21ADS_REG_ADDR(0x400000)
48#define MX21ADS_IO_REG MX21ADS_REG_ADDR(0x800000)
49
50/* MX21ADS_IO_REG bit definitions */
51#define MX21ADS_IO_SD_WP 0x0001 /* read */
52#define MX21ADS_IO_TP6 0x0001 /* write */
53#define MX21ADS_IO_SW_SEL 0x0002 /* read */
54#define MX21ADS_IO_TP7 0x0002 /* write */
55#define MX21ADS_IO_RESET_E_UART 0x0004
56#define MX21ADS_IO_RESET_BASE 0x0008
57#define MX21ADS_IO_CSI_CTL2 0x0010
58#define MX21ADS_IO_CSI_CTL1 0x0020
59#define MX21ADS_IO_CSI_CTL0 0x0040
60#define MX21ADS_IO_UART1_EN 0x0080
61#define MX21ADS_IO_UART4_EN 0x0100
62#define MX21ADS_IO_LCDON 0x0200
63#define MX21ADS_IO_IRDA_EN 0x0400
64#define MX21ADS_IO_IRDA_FIR_SEL 0x0800
65#define MX21ADS_IO_IRDA_MD0_B 0x1000
66#define MX21ADS_IO_IRDA_MD1 0x2000
67#define MX21ADS_IO_LED4_ON 0x4000
68#define MX21ADS_IO_LED3_ON 0x8000
69
40static unsigned int mx21ads_pins[] = { 70static unsigned int mx21ads_pins[] = {
41 71
42 /* CS8900A */ 72 /* CS8900A */
@@ -133,14 +163,13 @@ static struct platform_device mx21ads_nor_mtd_device = {
133 .resource = &mx21ads_flash_resource, 163 .resource = &mx21ads_flash_resource,
134}; 164};
135 165
136static struct imxuart_platform_data uart_pdata = { 166static const struct imxuart_platform_data uart_pdata_rts __initconst = {
137 .flags = IMXUART_HAVE_RTSCTS, 167 .flags = IMXUART_HAVE_RTSCTS,
138}; 168};
139 169
140static struct imxuart_platform_data uart_norts_pdata = { 170static const struct imxuart_platform_data uart_pdata_norts __initconst = {
141}; 171};
142 172
143
144static int mx21ads_fb_init(struct platform_device *pdev) 173static int mx21ads_fb_init(struct platform_device *pdev)
145{ 174{
146 u16 tmp; 175 u16 tmp;
@@ -227,7 +256,8 @@ static struct imxmmc_platform_data mx21ads_sdhc_pdata = {
227 .exit = mx21ads_sdhc_exit, 256 .exit = mx21ads_sdhc_exit,
228}; 257};
229 258
230static struct mxc_nand_platform_data mx21ads_nand_board_info = { 259static const struct mxc_nand_platform_data
260mx21ads_nand_board_info __initconst = {
231 .width = 1, 261 .width = 1,
232 .hw_ecc = 1, 262 .hw_ecc = 1,
233}; 263};
@@ -263,12 +293,12 @@ static void __init mx21ads_board_init(void)
263 mxc_gpio_setup_multiple_pins(mx21ads_pins, ARRAY_SIZE(mx21ads_pins), 293 mxc_gpio_setup_multiple_pins(mx21ads_pins, ARRAY_SIZE(mx21ads_pins),
264 "mx21ads"); 294 "mx21ads");
265 295
266 mxc_register_device(&mxc_uart_device0, &uart_pdata); 296 imx21_add_imx_uart0(&uart_pdata_rts);
267 mxc_register_device(&mxc_uart_device2, &uart_norts_pdata); 297 imx21_add_imx_uart2(&uart_pdata_norts);
268 mxc_register_device(&mxc_uart_device3, &uart_pdata); 298 imx21_add_imx_uart3(&uart_pdata_rts);
269 mxc_register_device(&mxc_fb_device, &mx21ads_fb_data); 299 mxc_register_device(&mxc_fb_device, &mx21ads_fb_data);
270 mxc_register_device(&mxc_sdhc_device0, &mx21ads_sdhc_pdata); 300 mxc_register_device(&mxc_sdhc_device0, &mx21ads_sdhc_pdata);
271 mxc_register_device(&imx21_nand_device, &mx21ads_nand_board_info); 301 imx21_add_mxc_nand(&mx21ads_nand_board_info);
272 302
273 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 303 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
274} 304}
diff --git a/arch/arm/mach-mx2/mach-mx27_3ds.c b/arch/arm/mach-imx/mach-mx27_3ds.c
index b2f4e0db3fb3..e66ffaa1c26c 100644
--- a/arch/arm/mach-mx2/mach-mx27_3ds.c
+++ b/arch/arm/mach-imx/mach-mx27_3ds.c
@@ -12,23 +12,25 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
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 * You should have received a copy of the GNU General Public License 16
17 * along with this program; if not, write to the Free Software 17/*
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * This machine is known as:
19 * - i.MX27 3-Stack Development System
20 * - i.MX27 Platform Development Kit (i.MX27 PDK)
19 */ 21 */
20 22
21#include <linux/platform_device.h> 23#include <linux/platform_device.h>
22#include <linux/gpio.h> 24#include <linux/gpio.h>
25#include <linux/input/matrix_keypad.h>
23#include <asm/mach-types.h> 26#include <asm/mach-types.h>
24#include <asm/mach/arch.h> 27#include <asm/mach/arch.h>
25#include <asm/mach/time.h> 28#include <asm/mach/time.h>
26#include <mach/hardware.h> 29#include <mach/hardware.h>
27#include <mach/common.h> 30#include <mach/common.h>
28#include <mach/imx-uart.h>
29#include <mach/iomux-mx27.h> 31#include <mach/iomux-mx27.h>
30#include <mach/board-mx27pdk.h>
31 32
33#include "devices-imx27.h"
32#include "devices.h" 34#include "devices.h"
33 35
34static unsigned int mx27pdk_pins[] = { 36static unsigned int mx27pdk_pins[] = {
@@ -58,7 +60,7 @@ static unsigned int mx27pdk_pins[] = {
58 PF23_AIN_FEC_TX_EN, 60 PF23_AIN_FEC_TX_EN,
59}; 61};
60 62
61static struct imxuart_platform_data uart_pdata = { 63static const struct imxuart_platform_data uart_pdata __initconst = {
62 .flags = IMXUART_HAVE_RTSCTS, 64 .flags = IMXUART_HAVE_RTSCTS,
63}; 65};
64 66
@@ -66,12 +68,34 @@ static struct platform_device *platform_devices[] __initdata = {
66 &mxc_fec_device, 68 &mxc_fec_device,
67}; 69};
68 70
71/*
72 * Matrix keyboard
73 */
74
75static const uint32_t mx27_3ds_keymap[] = {
76 KEY(0, 0, KEY_UP),
77 KEY(0, 1, KEY_DOWN),
78 KEY(1, 0, KEY_RIGHT),
79 KEY(1, 1, KEY_LEFT),
80 KEY(1, 2, KEY_ENTER),
81 KEY(2, 0, KEY_F6),
82 KEY(2, 1, KEY_F8),
83 KEY(2, 2, KEY_F9),
84 KEY(2, 3, KEY_F10),
85};
86
87static struct matrix_keymap_data mx27_3ds_keymap_data = {
88 .keymap = mx27_3ds_keymap,
89 .keymap_size = ARRAY_SIZE(mx27_3ds_keymap),
90};
91
69static void __init mx27pdk_init(void) 92static void __init mx27pdk_init(void)
70{ 93{
71 mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins), 94 mxc_gpio_setup_multiple_pins(mx27pdk_pins, ARRAY_SIZE(mx27pdk_pins),
72 "mx27pdk"); 95 "mx27pdk");
73 mxc_register_device(&mxc_uart_device0, &uart_pdata); 96 imx27_add_imx_uart0(&uart_pdata);
74 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 97 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
98 mxc_register_device(&imx_kpp_device, &mx27_3ds_keymap_data);
75} 99}
76 100
77static void __init mx27pdk_timer_init(void) 101static void __init mx27pdk_timer_init(void)
diff --git a/arch/arm/mach-mx2/mach-mx27ads.c b/arch/arm/mach-imx/mach-mx27ads.c
index 6ce323669e58..9c77da98a10e 100644
--- a/arch/arm/mach-mx2/mach-mx27ads.c
+++ b/arch/arm/mach-imx/mach-mx27ads.c
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
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 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 15 */
20 16
21#include <linux/platform_device.h> 17#include <linux/platform_device.h>
@@ -32,16 +28,44 @@
32#include <asm/mach/time.h> 28#include <asm/mach/time.h>
33#include <asm/mach/map.h> 29#include <asm/mach/map.h>
34#include <mach/gpio.h> 30#include <mach/gpio.h>
35#include <mach/imx-uart.h>
36#include <mach/iomux-mx27.h> 31#include <mach/iomux-mx27.h>
37#include <mach/board-mx27ads.h>
38#include <mach/mxc_nand.h> 32#include <mach/mxc_nand.h>
39#include <mach/i2c.h>
40#include <mach/imxfb.h> 33#include <mach/imxfb.h>
41#include <mach/mmc.h> 34#include <mach/mmc.h>
42 35
36#include "devices-imx27.h"
43#include "devices.h" 37#include "devices.h"
44 38
39/*
40 * Base address of PBC controller, CS4
41 */
42#define PBC_BASE_ADDRESS 0xf4300000
43#define PBC_REG_ADDR(offset) (void __force __iomem *) \
44 (PBC_BASE_ADDRESS + (offset))
45
46/* When the PBC address connection is fixed in h/w, defined as 1 */
47#define PBC_ADDR_SH 0
48
49/* Offsets for the PBC Controller register */
50/*
51 * PBC Board version register offset
52 */
53#define PBC_VERSION_REG PBC_REG_ADDR(0x00000 >> PBC_ADDR_SH)
54/*
55 * PBC Board control register 1 set address.
56 */
57#define PBC_BCTRL1_SET_REG PBC_REG_ADDR(0x00008 >> PBC_ADDR_SH)
58/*
59 * PBC Board control register 1 clear address.
60 */
61#define PBC_BCTRL1_CLEAR_REG PBC_REG_ADDR(0x0000C >> PBC_ADDR_SH)
62
63/* PBC Board Control Register 1 bit definitions */
64#define PBC_BCTRL1_LCDON 0x0800 /* Enable the LCD */
65
66/* to determine the correct external crystal reference */
67#define CKIH_27MHZ_BIT_SET (1 << 3)
68
45static unsigned int mx27ads_pins[] = { 69static unsigned int mx27ads_pins[] = {
46 /* UART0 */ 70 /* UART0 */
47 PE12_PF_UART1_TXD, 71 PE12_PF_UART1_TXD,
@@ -141,7 +165,8 @@ static unsigned int mx27ads_pins[] = {
141 PB9_PF_SD2_CLK, 165 PB9_PF_SD2_CLK,
142}; 166};
143 167
144static struct mxc_nand_platform_data mx27ads_nand_board_info = { 168static const struct mxc_nand_platform_data
169mx27ads_nand_board_info __initconst = {
145 .width = 1, 170 .width = 1,
146 .hw_ecc = 1, 171 .hw_ecc = 1,
147}; 172};
@@ -168,7 +193,7 @@ static struct platform_device mx27ads_nor_mtd_device = {
168 .resource = &mx27ads_flash_resource, 193 .resource = &mx27ads_flash_resource,
169}; 194};
170 195
171static struct imxi2c_platform_data mx27ads_i2c_data = { 196static const struct imxi2c_platform_data mx27ads_i2c1_data __initconst = {
172 .bitrate = 100000, 197 .bitrate = 100000,
173}; 198};
174 199
@@ -263,20 +288,8 @@ static struct platform_device *platform_devices[] __initdata = {
263 &mxc_w1_master_device, 288 &mxc_w1_master_device,
264}; 289};
265 290
266static struct imxuart_platform_data uart_pdata[] = { 291static const struct imxuart_platform_data uart_pdata __initconst = {
267 { 292 .flags = IMXUART_HAVE_RTSCTS,
268 .flags = IMXUART_HAVE_RTSCTS,
269 }, {
270 .flags = IMXUART_HAVE_RTSCTS,
271 }, {
272 .flags = IMXUART_HAVE_RTSCTS,
273 }, {
274 .flags = IMXUART_HAVE_RTSCTS,
275 }, {
276 .flags = IMXUART_HAVE_RTSCTS,
277 }, {
278 .flags = IMXUART_HAVE_RTSCTS,
279 },
280}; 293};
281 294
282static void __init mx27ads_board_init(void) 295static void __init mx27ads_board_init(void)
@@ -284,18 +297,18 @@ static void __init mx27ads_board_init(void)
284 mxc_gpio_setup_multiple_pins(mx27ads_pins, ARRAY_SIZE(mx27ads_pins), 297 mxc_gpio_setup_multiple_pins(mx27ads_pins, ARRAY_SIZE(mx27ads_pins),
285 "mx27ads"); 298 "mx27ads");
286 299
287 mxc_register_device(&mxc_uart_device0, &uart_pdata[0]); 300 imx27_add_imx_uart0(&uart_pdata);
288 mxc_register_device(&mxc_uart_device1, &uart_pdata[1]); 301 imx27_add_imx_uart1(&uart_pdata);
289 mxc_register_device(&mxc_uart_device2, &uart_pdata[2]); 302 imx27_add_imx_uart2(&uart_pdata);
290 mxc_register_device(&mxc_uart_device3, &uart_pdata[3]); 303 imx27_add_imx_uart3(&uart_pdata);
291 mxc_register_device(&mxc_uart_device4, &uart_pdata[4]); 304 imx27_add_imx_uart4(&uart_pdata);
292 mxc_register_device(&mxc_uart_device5, &uart_pdata[5]); 305 imx27_add_imx_uart5(&uart_pdata);
293 mxc_register_device(&imx27_nand_device, &mx27ads_nand_board_info); 306 imx27_add_mxc_nand(&mx27ads_nand_board_info);
294 307
295 /* only the i2c master 1 is used on this CPU card */ 308 /* only the i2c master 1 is used on this CPU card */
296 i2c_register_board_info(1, mx27ads_i2c_devices, 309 i2c_register_board_info(1, mx27ads_i2c_devices,
297 ARRAY_SIZE(mx27ads_i2c_devices)); 310 ARRAY_SIZE(mx27ads_i2c_devices));
298 mxc_register_device(&mxc_i2c_device1, &mx27ads_i2c_data); 311 imx27_add_i2c_imx1(&mx27ads_i2c1_data);
299 mxc_register_device(&mxc_fb_device, &mx27ads_fb_data); 312 mxc_register_device(&mxc_fb_device, &mx27ads_fb_data);
300 mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata); 313 mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata);
301 mxc_register_device(&mxc_sdhc_device1, &sdhc2_pdata); 314 mxc_register_device(&mxc_sdhc_device1, &sdhc2_pdata);
@@ -342,4 +355,3 @@ MACHINE_START(MX27ADS, "Freescale i.MX27ADS")
342 .init_machine = mx27ads_board_init, 355 .init_machine = mx27ads_board_init,
343 .timer = &mx27ads_timer, 356 .timer = &mx27ads_timer,
344MACHINE_END 357MACHINE_END
345
diff --git a/arch/arm/mach-mx2/mach-mxt_td60.c b/arch/arm/mach-imx/mach-mxt_td60.c
index bc3855992677..a3a1e452d4c5 100644
--- a/arch/arm/mach-mx2/mach-mxt_td60.c
+++ b/arch/arm/mach-imx/mach-mxt_td60.c
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
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 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 15 */
20 16
21#include <linux/platform_device.h> 17#include <linux/platform_device.h>
@@ -32,14 +28,13 @@
32#include <asm/mach/time.h> 28#include <asm/mach/time.h>
33#include <asm/mach/map.h> 29#include <asm/mach/map.h>
34#include <linux/gpio.h> 30#include <linux/gpio.h>
35#include <mach/imx-uart.h>
36#include <mach/iomux-mx27.h> 31#include <mach/iomux-mx27.h>
37#include <mach/mxc_nand.h> 32#include <mach/mxc_nand.h>
38#include <mach/i2c.h>
39#include <linux/i2c/pca953x.h> 33#include <linux/i2c/pca953x.h>
40#include <mach/imxfb.h> 34#include <mach/imxfb.h>
41#include <mach/mmc.h> 35#include <mach/mmc.h>
42 36
37#include "devices-imx27.h"
43#include "devices.h" 38#include "devices.h"
44 39
45static unsigned int mxt_td60_pins[] __initdata = { 40static unsigned int mxt_td60_pins[] __initdata = {
@@ -128,12 +123,13 @@ static unsigned int mxt_td60_pins[] __initdata = {
128 PB9_PF_SD2_CLK, 123 PB9_PF_SD2_CLK,
129}; 124};
130 125
131static struct mxc_nand_platform_data mxt_td60_nand_board_info = { 126static const struct mxc_nand_platform_data
127mxt_td60_nand_board_info __initconst = {
132 .width = 1, 128 .width = 1,
133 .hw_ecc = 1, 129 .hw_ecc = 1,
134}; 130};
135 131
136static struct imxi2c_platform_data mxt_td60_i2c_data = { 132static const struct imxi2c_platform_data mxt_td60_i2c0_data __initconst = {
137 .bitrate = 100000, 133 .bitrate = 100000,
138}; 134};
139 135
@@ -173,7 +169,7 @@ static struct i2c_board_info mxt_td60_i2c_devices[] = {
173 }, 169 },
174}; 170};
175 171
176static struct imxi2c_platform_data mxt_td60_i2c2_data = { 172static const struct imxi2c_platform_data mxt_td60_i2c1_data __initconst = {
177 .bitrate = 100000, 173 .bitrate = 100000,
178}; 174};
179 175
@@ -239,14 +235,8 @@ static struct platform_device *platform_devices[] __initdata = {
239 &mxc_fec_device, 235 &mxc_fec_device,
240}; 236};
241 237
242static struct imxuart_platform_data uart_pdata[] = { 238static const struct imxuart_platform_data uart_pdata __initconst = {
243 { 239 .flags = IMXUART_HAVE_RTSCTS,
244 .flags = IMXUART_HAVE_RTSCTS,
245 }, {
246 .flags = IMXUART_HAVE_RTSCTS,
247 }, {
248 .flags = IMXUART_HAVE_RTSCTS,
249 },
250}; 240};
251 241
252static void __init mxt_td60_board_init(void) 242static void __init mxt_td60_board_init(void)
@@ -254,10 +244,10 @@ static void __init mxt_td60_board_init(void)
254 mxc_gpio_setup_multiple_pins(mxt_td60_pins, ARRAY_SIZE(mxt_td60_pins), 244 mxc_gpio_setup_multiple_pins(mxt_td60_pins, ARRAY_SIZE(mxt_td60_pins),
255 "MXT_TD60"); 245 "MXT_TD60");
256 246
257 mxc_register_device(&mxc_uart_device0, &uart_pdata[0]); 247 imx27_add_imx_uart0(&uart_pdata);
258 mxc_register_device(&mxc_uart_device1, &uart_pdata[1]); 248 imx27_add_imx_uart1(&uart_pdata);
259 mxc_register_device(&mxc_uart_device2, &uart_pdata[2]); 249 imx27_add_imx_uart2(&uart_pdata);
260 mxc_register_device(&imx27_nand_device, &mxt_td60_nand_board_info); 250 imx27_add_mxc_nand(&mxt_td60_nand_board_info);
261 251
262 i2c_register_board_info(0, mxt_td60_i2c_devices, 252 i2c_register_board_info(0, mxt_td60_i2c_devices,
263 ARRAY_SIZE(mxt_td60_i2c_devices)); 253 ARRAY_SIZE(mxt_td60_i2c_devices));
@@ -265,8 +255,8 @@ static void __init mxt_td60_board_init(void)
265 i2c_register_board_info(1, mxt_td60_i2c2_devices, 255 i2c_register_board_info(1, mxt_td60_i2c2_devices,
266 ARRAY_SIZE(mxt_td60_i2c2_devices)); 256 ARRAY_SIZE(mxt_td60_i2c2_devices));
267 257
268 mxc_register_device(&mxc_i2c_device0, &mxt_td60_i2c_data); 258 imx27_add_i2c_imx0(&mxt_td60_i2c0_data);
269 mxc_register_device(&mxc_i2c_device1, &mxt_td60_i2c2_data); 259 imx27_add_i2c_imx1(&mxt_td60_i2c1_data);
270 mxc_register_device(&mxc_fb_device, &mxt_td60_fb_data); 260 mxc_register_device(&mxc_fb_device, &mxt_td60_fb_data);
271 mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata); 261 mxc_register_device(&mxc_sdhc_device0, &sdhc1_pdata);
272 262
diff --git a/arch/arm/mach-mx2/mach-pca100.c b/arch/arm/mach-imx/mach-pca100.c
index a87422ed4ff5..6c92deaf468f 100644
--- a/arch/arm/mach-mx2/mach-pca100.c
+++ b/arch/arm/mach-imx/mach-pca100.c
@@ -36,12 +36,7 @@
36#include <mach/common.h> 36#include <mach/common.h>
37#include <mach/hardware.h> 37#include <mach/hardware.h>
38#include <mach/iomux-mx27.h> 38#include <mach/iomux-mx27.h>
39#include <mach/i2c.h>
40#include <asm/mach/time.h> 39#include <asm/mach/time.h>
41#if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE)
42#include <mach/spi.h>
43#endif
44#include <mach/imx-uart.h>
45#include <mach/audmux.h> 40#include <mach/audmux.h>
46#include <mach/ssi.h> 41#include <mach/ssi.h>
47#include <mach/mxc_nand.h> 42#include <mach/mxc_nand.h>
@@ -49,11 +44,16 @@
49#include <mach/mmc.h> 44#include <mach/mmc.h>
50#include <mach/mxc_ehci.h> 45#include <mach/mxc_ehci.h>
51#include <mach/ulpi.h> 46#include <mach/ulpi.h>
47#include <mach/imxfb.h>
52 48
49#include "devices-imx27.h"
53#include "devices.h" 50#include "devices.h"
54 51
55#define OTG_PHY_CS_GPIO (GPIO_PORTB + 23) 52#define OTG_PHY_CS_GPIO (GPIO_PORTB + 23)
56#define USBH2_PHY_CS_GPIO (GPIO_PORTB + 24) 53#define USBH2_PHY_CS_GPIO (GPIO_PORTB + 24)
54#define SPI1_SS0 (GPIO_PORTD + 28)
55#define SPI1_SS1 (GPIO_PORTD + 27)
56#define SD2_CD (GPIO_PORTC + 29)
57 57
58static int pca100_pins[] = { 58static int pca100_pins[] = {
59 /* UART1 */ 59 /* UART1 */
@@ -68,6 +68,7 @@ static int pca100_pins[] = {
68 PB7_PF_SD2_D3, 68 PB7_PF_SD2_D3,
69 PB8_PF_SD2_CMD, 69 PB8_PF_SD2_CMD,
70 PB9_PF_SD2_CLK, 70 PB9_PF_SD2_CLK,
71 SD2_CD | GPIO_GPIO | GPIO_IN,
71 /* FEC */ 72 /* FEC */
72 PD0_AIN_FEC_TXD0, 73 PD0_AIN_FEC_TXD0,
73 PD1_AIN_FEC_TXD1, 74 PD1_AIN_FEC_TXD1,
@@ -131,13 +132,42 @@ static int pca100_pins[] = {
131 PD23_AF_USBH2_DATA2, 132 PD23_AF_USBH2_DATA2,
132 PD24_AF_USBH2_DATA1, 133 PD24_AF_USBH2_DATA1,
133 PD26_AF_USBH2_DATA5, 134 PD26_AF_USBH2_DATA5,
135 /* display */
136 PA5_PF_LSCLK,
137 PA6_PF_LD0,
138 PA7_PF_LD1,
139 PA8_PF_LD2,
140 PA9_PF_LD3,
141 PA10_PF_LD4,
142 PA11_PF_LD5,
143 PA12_PF_LD6,
144 PA13_PF_LD7,
145 PA14_PF_LD8,
146 PA15_PF_LD9,
147 PA16_PF_LD10,
148 PA17_PF_LD11,
149 PA18_PF_LD12,
150 PA19_PF_LD13,
151 PA20_PF_LD14,
152 PA21_PF_LD15,
153 PA22_PF_LD16,
154 PA23_PF_LD17,
155 PA26_PF_PS,
156 PA28_PF_HSYNC,
157 PA29_PF_VSYNC,
158 PA31_PF_OE_ACD,
159 /* free GPIO */
160 GPIO_PORTC | 31 | GPIO_GPIO | GPIO_IN, /* GPIO0_IRQ */
161 GPIO_PORTC | 25 | GPIO_GPIO | GPIO_IN, /* GPIO1_IRQ */
162 GPIO_PORTE | 5 | GPIO_GPIO | GPIO_IN, /* GPIO2_IRQ */
134}; 163};
135 164
136static struct imxuart_platform_data uart_pdata = { 165static const struct imxuart_platform_data uart_pdata __initconst = {
137 .flags = IMXUART_HAVE_RTSCTS, 166 .flags = IMXUART_HAVE_RTSCTS,
138}; 167};
139 168
140static struct mxc_nand_platform_data pca100_nand_board_info = { 169static const struct mxc_nand_platform_data
170pca100_nand_board_info __initconst = {
141 .width = 1, 171 .width = 1,
142 .hw_ecc = 1, 172 .hw_ecc = 1,
143}; 173};
@@ -148,7 +178,7 @@ static struct platform_device *platform_devices[] __initdata = {
148 &mxc_wdt, 178 &mxc_wdt,
149}; 179};
150 180
151static struct imxi2c_platform_data pca100_i2c_1_data = { 181static const struct imxi2c_platform_data pca100_i2c1_data __initconst = {
152 .bitrate = 100000, 182 .bitrate = 100000,
153}; 183};
154 184
@@ -189,9 +219,9 @@ static struct spi_board_info pca100_spi_board_info[] __initdata = {
189 }, 219 },
190}; 220};
191 221
192static int pca100_spi_cs[] = {GPIO_PORTD + 28, GPIO_PORTD + 27}; 222static int pca100_spi_cs[] = {SPI1_SS0, SPI1_SS1};
193 223
194static struct spi_imx_master pca100_spi_0_data = { 224static const struct spi_imx_master pca100_spi0_data __initconst = {
195 .chipselect = pca100_spi_cs, 225 .chipselect = pca100_spi_cs,
196 .num_chipselect = ARRAY_SIZE(pca100_spi_cs), 226 .num_chipselect = ARRAY_SIZE(pca100_spi_cs),
197}; 227};
@@ -253,6 +283,7 @@ static struct imxmmc_platform_data sdhc_pdata = {
253 .exit = pca100_sdhc2_exit, 283 .exit = pca100_sdhc2_exit,
254}; 284};
255 285
286#if defined(CONFIG_USB_ULPI)
256static int otg_phy_init(struct platform_device *pdev) 287static int otg_phy_init(struct platform_device *pdev)
257{ 288{
258 gpio_set_value(OTG_PHY_CS_GPIO, 0); 289 gpio_set_value(OTG_PHY_CS_GPIO, 0);
@@ -276,6 +307,7 @@ static struct mxc_usbh_platform_data usbh2_pdata = {
276 .portsc = MXC_EHCI_MODE_ULPI, 307 .portsc = MXC_EHCI_MODE_ULPI,
277 .flags = MXC_EHCI_INTERFACE_DIFF_UNI, 308 .flags = MXC_EHCI_INTERFACE_DIFF_UNI,
278}; 309};
310#endif
279 311
280static struct fsl_usb2_platform_data otg_device_pdata = { 312static struct fsl_usb2_platform_data otg_device_pdata = {
281 .operating_mode = FSL_USB2_DR_DEVICE, 313 .operating_mode = FSL_USB2_DR_DEVICE,
@@ -297,6 +329,45 @@ static int __init pca100_otg_mode(char *options)
297} 329}
298__setup("otg_mode=", pca100_otg_mode); 330__setup("otg_mode=", pca100_otg_mode);
299 331
332/* framebuffer info */
333static struct imx_fb_videomode pca100_fb_modes[] = {
334 {
335 .mode = {
336 .name = "EMERGING-ETV570G0DHU",
337 .refresh = 60,
338 .xres = 640,
339 .yres = 480,
340 .pixclock = 39722, /* in ps (25.175 MHz) */
341 .hsync_len = 30,
342 .left_margin = 114,
343 .right_margin = 16,
344 .vsync_len = 3,
345 .upper_margin = 32,
346 .lower_margin = 0,
347 },
348 /*
349 * TFT
350 * Pixel pol active high
351 * HSYNC active low
352 * VSYNC active low
353 * use HSYNC for ACD count
354 * line clock disable while idle
355 * always enable line clock even if no data
356 */
357 .pcr = 0xf0c08080,
358 .bpp = 16,
359 },
360};
361
362static struct imx_fb_platform_data pca100_fb_data = {
363 .mode = pca100_fb_modes,
364 .num_modes = ARRAY_SIZE(pca100_fb_modes),
365
366 .pwmr = 0x00A903FF,
367 .lscr1 = 0x00120300,
368 .dmacr = 0x00020010,
369};
370
300static void __init pca100_init(void) 371static void __init pca100_init(void)
301{ 372{
302 int ret; 373 int ret;
@@ -320,33 +391,24 @@ static void __init pca100_init(void)
320 391
321 mxc_register_device(&imx_ssi_device0, &pca100_ssi_pdata); 392 mxc_register_device(&imx_ssi_device0, &pca100_ssi_pdata);
322 393
323 mxc_register_device(&mxc_uart_device0, &uart_pdata); 394 imx27_add_imx_uart0(&uart_pdata);
324 395
325 mxc_gpio_mode(GPIO_PORTC | 29 | GPIO_GPIO | GPIO_IN);
326 mxc_register_device(&mxc_sdhc_device1, &sdhc_pdata); 396 mxc_register_device(&mxc_sdhc_device1, &sdhc_pdata);
327 397
328 mxc_register_device(&imx27_nand_device, &pca100_nand_board_info); 398 imx27_add_mxc_nand(&pca100_nand_board_info);
329 399
330 /* only the i2c master 1 is used on this CPU card */ 400 /* only the i2c master 1 is used on this CPU card */
331 i2c_register_board_info(1, pca100_i2c_devices, 401 i2c_register_board_info(1, pca100_i2c_devices,
332 ARRAY_SIZE(pca100_i2c_devices)); 402 ARRAY_SIZE(pca100_i2c_devices));
333 403
334 mxc_register_device(&mxc_i2c_device1, &pca100_i2c_1_data); 404 imx27_add_i2c_imx1(&pca100_i2c1_data);
335
336 mxc_gpio_mode(GPIO_PORTD | 28 | GPIO_GPIO | GPIO_OUT);
337 mxc_gpio_mode(GPIO_PORTD | 27 | GPIO_GPIO | GPIO_OUT);
338
339 /* GPIO0_IRQ */
340 mxc_gpio_mode(GPIO_PORTC | 31 | GPIO_GPIO | GPIO_IN);
341 /* GPIO1_IRQ */
342 mxc_gpio_mode(GPIO_PORTC | 25 | GPIO_GPIO | GPIO_IN);
343 /* GPIO2_IRQ */
344 mxc_gpio_mode(GPIO_PORTE | 5 | GPIO_GPIO | GPIO_IN);
345 405
346#if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE) 406#if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE)
407 mxc_gpio_mode(GPIO_PORTD | 28 | GPIO_GPIO | GPIO_IN);
408 mxc_gpio_mode(GPIO_PORTD | 27 | GPIO_GPIO | GPIO_IN);
347 spi_register_board_info(pca100_spi_board_info, 409 spi_register_board_info(pca100_spi_board_info,
348 ARRAY_SIZE(pca100_spi_board_info)); 410 ARRAY_SIZE(pca100_spi_board_info));
349 mxc_register_device(&mxc_spi_device0, &pca100_spi_0_data); 411 imx27_add_spi_imx0(&pca100_spi_0_data);
350#endif 412#endif
351 413
352 gpio_request(OTG_PHY_CS_GPIO, "usb-otg-cs"); 414 gpio_request(OTG_PHY_CS_GPIO, "usb-otg-cs");
@@ -372,6 +434,8 @@ static void __init pca100_init(void)
372 mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata); 434 mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata);
373 } 435 }
374 436
437 mxc_register_device(&mxc_fb_device, &pca100_fb_data);
438
375 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices)); 439 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
376} 440}
377 441
diff --git a/arch/arm/mach-mx2/mach-pcm038.c b/arch/arm/mach-imx/mach-pcm038.c
index 36c89431679a..9212e8f37001 100644
--- a/arch/arm/mach-mx2/mach-pcm038.c
+++ b/arch/arm/mach-imx/mach-pcm038.c
@@ -35,14 +35,12 @@
35#include <mach/board-pcm038.h> 35#include <mach/board-pcm038.h>
36#include <mach/common.h> 36#include <mach/common.h>
37#include <mach/hardware.h> 37#include <mach/hardware.h>
38#include <mach/i2c.h>
39#include <mach/iomux-mx27.h> 38#include <mach/iomux-mx27.h>
40#include <mach/imx-uart.h>
41#include <mach/mxc_nand.h> 39#include <mach/mxc_nand.h>
42#include <mach/spi.h>
43#include <mach/mxc_ehci.h> 40#include <mach/mxc_ehci.h>
44#include <mach/ulpi.h> 41#include <mach/ulpi.h>
45 42
43#include "devices-imx27.h"
46#include "devices.h" 44#include "devices.h"
47 45
48static int pcm038_pins[] = { 46static int pcm038_pins[] = {
@@ -162,17 +160,12 @@ static struct platform_device pcm038_nor_mtd_device = {
162 .resource = &pcm038_flash_resource, 160 .resource = &pcm038_flash_resource,
163}; 161};
164 162
165static struct imxuart_platform_data uart_pdata[] = { 163static const struct imxuart_platform_data uart_pdata __initconst = {
166 { 164 .flags = IMXUART_HAVE_RTSCTS,
167 .flags = IMXUART_HAVE_RTSCTS,
168 }, {
169 .flags = IMXUART_HAVE_RTSCTS,
170 }, {
171 .flags = IMXUART_HAVE_RTSCTS,
172 },
173}; 165};
174 166
175static struct mxc_nand_platform_data pcm038_nand_board_info = { 167static const struct mxc_nand_platform_data
168pcm038_nand_board_info __initconst = {
176 .width = 1, 169 .width = 1,
177 .hw_ecc = 1, 170 .hw_ecc = 1,
178}; 171};
@@ -192,7 +185,7 @@ static void __init pcm038_init_sram(void)
192 mx27_setup_weimcs(1, 0x0000d843, 0x22252521, 0x22220a00); 185 mx27_setup_weimcs(1, 0x0000d843, 0x22252521, 0x22220a00);
193} 186}
194 187
195static struct imxi2c_platform_data pcm038_i2c_1_data = { 188static const struct imxi2c_platform_data pcm038_i2c1_data __initconst = {
196 .bitrate = 100000, 189 .bitrate = 100000,
197}; 190};
198 191
@@ -215,7 +208,7 @@ static struct i2c_board_info pcm038_i2c_devices[] = {
215 208
216static int pcm038_spi_cs[] = {GPIO_PORTD + 28}; 209static int pcm038_spi_cs[] = {GPIO_PORTD + 28};
217 210
218static struct spi_imx_master pcm038_spi_0_data = { 211static const struct spi_imx_master pcm038_spi0_data __initconst = {
219 .chipselect = pcm038_spi_cs, 212 .chipselect = pcm038_spi_cs,
220 .num_chipselect = ARRAY_SIZE(pcm038_spi_cs), 213 .num_chipselect = ARRAY_SIZE(pcm038_spi_cs),
221}; 214};
@@ -305,18 +298,18 @@ static void __init pcm038_init(void)
305 298
306 pcm038_init_sram(); 299 pcm038_init_sram();
307 300
308 mxc_register_device(&mxc_uart_device0, &uart_pdata[0]); 301 imx27_add_imx_uart0(&uart_pdata);
309 mxc_register_device(&mxc_uart_device1, &uart_pdata[1]); 302 imx27_add_imx_uart1(&uart_pdata);
310 mxc_register_device(&mxc_uart_device2, &uart_pdata[2]); 303 imx27_add_imx_uart2(&uart_pdata);
311 304
312 mxc_gpio_mode(PE16_AF_OWIRE); 305 mxc_gpio_mode(PE16_AF_OWIRE);
313 mxc_register_device(&imx27_nand_device, &pcm038_nand_board_info); 306 imx27_add_mxc_nand(&pcm038_nand_board_info);
314 307
315 /* only the i2c master 1 is used on this CPU card */ 308 /* only the i2c master 1 is used on this CPU card */
316 i2c_register_board_info(1, pcm038_i2c_devices, 309 i2c_register_board_info(1, pcm038_i2c_devices,
317 ARRAY_SIZE(pcm038_i2c_devices)); 310 ARRAY_SIZE(pcm038_i2c_devices));
318 311
319 mxc_register_device(&mxc_i2c_device1, &pcm038_i2c_1_data); 312 imx27_add_i2c_imx1(&pcm038_i2c1_data);
320 313
321 /* PE18 for user-LED D40 */ 314 /* PE18 for user-LED D40 */
322 mxc_gpio_mode(GPIO_PORTE | 18 | GPIO_GPIO | GPIO_OUT); 315 mxc_gpio_mode(GPIO_PORTE | 18 | GPIO_GPIO | GPIO_OUT);
@@ -326,7 +319,7 @@ static void __init pcm038_init(void)
326 /* MC13783 IRQ */ 319 /* MC13783 IRQ */
327 mxc_gpio_mode(GPIO_PORTB | 23 | GPIO_GPIO | GPIO_IN); 320 mxc_gpio_mode(GPIO_PORTB | 23 | GPIO_GPIO | GPIO_IN);
328 321
329 mxc_register_device(&mxc_spi_device0, &pcm038_spi_0_data); 322 imx27_add_spi_imx0(&pcm038_spi0_data);
330 spi_register_board_info(pcm038_spi_board_info, 323 spi_register_board_info(pcm038_spi_board_info,
331 ARRAY_SIZE(pcm038_spi_board_info)); 324 ARRAY_SIZE(pcm038_spi_board_info));
332 325
diff --git a/arch/arm/mach-mx1/mach-scb9328.c b/arch/arm/mach-imx/mach-scb9328.c
index 7587a7a12460..88bf0d1e26e6 100644
--- a/arch/arm/mach-mx1/mach-scb9328.c
+++ b/arch/arm/mach-imx/mach-scb9328.c
@@ -22,17 +22,17 @@
22#include <mach/common.h> 22#include <mach/common.h>
23#include <mach/hardware.h> 23#include <mach/hardware.h>
24#include <mach/irqs.h> 24#include <mach/irqs.h>
25#include <mach/imx-uart.h>
26#include <mach/iomux-mx1.h> 25#include <mach/iomux-mx1.h>
27 26
27#include "devices-imx1.h"
28#include "devices.h" 28#include "devices.h"
29 29
30/* 30/*
31 * This scb9328 has a 32MiB flash 31 * This scb9328 has a 32MiB flash
32 */ 32 */
33static struct resource flash_resource = { 33static struct resource flash_resource = {
34 .start = IMX_CS0_PHYS, 34 .start = MX1_CS0_PHYS,
35 .end = IMX_CS0_PHYS + (32 * 1024 * 1024) - 1, 35 .end = MX1_CS0_PHYS + (32 * 1024 * 1024) - 1,
36 .flags = IORESOURCE_MEM, 36 .flags = IORESOURCE_MEM,
37}; 37};
38 38
@@ -70,13 +70,13 @@ static struct dm9000_plat_data dm9000_platdata = {
70static struct resource dm9000x_resources[] = { 70static struct resource dm9000x_resources[] = {
71 { 71 {
72 .name = "address area", 72 .name = "address area",
73 .start = IMX_CS5_PHYS, 73 .start = MX1_CS5_PHYS,
74 .end = IMX_CS5_PHYS + 1, 74 .end = MX1_CS5_PHYS + 1,
75 .flags = IORESOURCE_MEM, /* address access */ 75 .flags = IORESOURCE_MEM, /* address access */
76 }, { 76 }, {
77 .name = "data area", 77 .name = "data area",
78 .start = IMX_CS5_PHYS + 4, 78 .start = MX1_CS5_PHYS + 4,
79 .end = IMX_CS5_PHYS + 5, 79 .end = MX1_CS5_PHYS + 5,
80 .flags = IORESOURCE_MEM, /* data access */ 80 .flags = IORESOURCE_MEM, /* data access */
81 }, { 81 }, {
82 .start = IRQ_GPIOC(3), 82 .start = IRQ_GPIOC(3),
@@ -108,14 +108,13 @@ static int uart1_mxc_init(struct platform_device *pdev)
108 ARRAY_SIZE(mxc_uart1_pins), "UART1"); 108 ARRAY_SIZE(mxc_uart1_pins), "UART1");
109} 109}
110 110
111static int uart1_mxc_exit(struct platform_device *pdev) 111static void uart1_mxc_exit(struct platform_device *pdev)
112{ 112{
113 mxc_gpio_release_multiple_pins(mxc_uart1_pins, 113 mxc_gpio_release_multiple_pins(mxc_uart1_pins,
114 ARRAY_SIZE(mxc_uart1_pins)); 114 ARRAY_SIZE(mxc_uart1_pins));
115 return 0;
116} 115}
117 116
118static struct imxuart_platform_data uart_pdata = { 117static const struct imxuart_platform_data uart_pdata __initconst = {
119 .init = uart1_mxc_init, 118 .init = uart1_mxc_init,
120 .exit = uart1_mxc_exit, 119 .exit = uart1_mxc_exit,
121 .flags = IMXUART_HAVE_RTSCTS, 120 .flags = IMXUART_HAVE_RTSCTS,
@@ -131,7 +130,7 @@ static struct platform_device *devices[] __initdata = {
131 */ 130 */
132static void __init scb9328_init(void) 131static void __init scb9328_init(void)
133{ 132{
134 mxc_register_device(&imx_uart1_device, &uart_pdata); 133 imx1_add_imx_uart0(&uart_pdata);
135 134
136 printk(KERN_INFO"Scb9328: Adding devices\n"); 135 printk(KERN_INFO"Scb9328: Adding devices\n");
137 platform_add_devices(devices, ARRAY_SIZE(devices)); 136 platform_add_devices(devices, ARRAY_SIZE(devices));
diff --git a/arch/arm/mach-mx1/generic.c b/arch/arm/mach-imx/mm-imx1.c
index 7f9fc1034c08..9be92b96dc89 100644
--- a/arch/arm/mach-mx1/generic.c
+++ b/arch/arm/mach-imx/mm-imx1.c
@@ -3,7 +3,7 @@
3 * Created: april 20th, 2004 3 * Created: april 20th, 2004
4 * Copyright: Synertronixx GmbH 4 * Copyright: Synertronixx GmbH
5 * 5 *
6 * Common code for i.MX machines 6 * Common code for i.MX1 machines
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
@@ -14,11 +14,6 @@
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */ 17 */
23#include <linux/kernel.h> 18#include <linux/kernel.h>
24#include <linux/init.h> 19#include <linux/init.h>
@@ -31,23 +26,25 @@
31 26
32static struct map_desc imx_io_desc[] __initdata = { 27static struct map_desc imx_io_desc[] __initdata = {
33 { 28 {
34 .virtual = IMX_IO_BASE, 29 .virtual = MX1_IO_BASE_ADDR_VIRT,
35 .pfn = __phys_to_pfn(IMX_IO_PHYS), 30 .pfn = __phys_to_pfn(MX1_IO_BASE_ADDR),
36 .length = IMX_IO_SIZE, 31 .length = MX1_IO_SIZE,
37 .type = MT_DEVICE 32 .type = MT_DEVICE
38 } 33 }
39}; 34};
40 35
41void __init mx1_map_io(void) 36void __init mx1_map_io(void)
42{ 37{
43 mxc_set_cpu_type(MXC_CPU_MX1); 38 mxc_set_cpu_type(MXC_CPU_MX1);
44 mxc_arch_reset_init(IO_ADDRESS(WDT_BASE_ADDR)); 39 mxc_arch_reset_init(MX1_IO_ADDRESS(MX1_WDT_BASE_ADDR));
45 40
46 iotable_init(imx_io_desc, ARRAY_SIZE(imx_io_desc)); 41 iotable_init(imx_io_desc, ARRAY_SIZE(imx_io_desc));
47} 42}
48 43
44int imx1_register_gpios(void);
45
49void __init mx1_init_irq(void) 46void __init mx1_init_irq(void)
50{ 47{
51 mxc_init_irq(IO_ADDRESS(AVIC_BASE_ADDR)); 48 mxc_init_irq(MX1_IO_ADDRESS(MX1_AVIC_BASE_ADDR));
49 imx1_register_gpios();
52} 50}
53
diff --git a/arch/arm/mach-mx2/mm-imx21.c b/arch/arm/mach-imx/mm-imx21.c
index 64134314d012..12faeeaa0a97 100644
--- a/arch/arm/mach-mx2/mm-imx21.c
+++ b/arch/arm/mach-imx/mm-imx21.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/arm/mach-mx2/mm-imx21.c 2 * arch/arm/mach-imx/mm-imx21.c
3 * 3 *
4 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de) 4 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
5 * 5 *
@@ -77,7 +77,10 @@ void __init mx21_map_io(void)
77 iotable_init(imx21_io_desc, ARRAY_SIZE(imx21_io_desc)); 77 iotable_init(imx21_io_desc, ARRAY_SIZE(imx21_io_desc));
78} 78}
79 79
80int imx21_register_gpios(void);
81
80void __init mx21_init_irq(void) 82void __init mx21_init_irq(void)
81{ 83{
82 mxc_init_irq(MX21_IO_ADDRESS(MX21_AVIC_BASE_ADDR)); 84 mxc_init_irq(MX21_IO_ADDRESS(MX21_AVIC_BASE_ADDR));
85 imx21_register_gpios();
83} 86}
diff --git a/arch/arm/mach-mx2/mm-imx27.c b/arch/arm/mach-imx/mm-imx27.c
index 3366ed44cfd5..a24622957ff2 100644
--- a/arch/arm/mach-mx2/mm-imx27.c
+++ b/arch/arm/mach-imx/mm-imx27.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * arch/arm/mach-mx2/mm-imx27.c 2 * arch/arm/mach-imx/mm-imx27.c
3 * 3 *
4 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de) 4 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
5 * 5 *
@@ -77,7 +77,10 @@ void __init mx27_map_io(void)
77 iotable_init(imx27_io_desc, ARRAY_SIZE(imx27_io_desc)); 77 iotable_init(imx27_io_desc, ARRAY_SIZE(imx27_io_desc));
78} 78}
79 79
80int imx27_register_gpios(void);
81
80void __init mx27_init_irq(void) 82void __init mx27_init_irq(void)
81{ 83{
82 mxc_init_irq(MX27_IO_ADDRESS(MX27_AVIC_BASE_ADDR)); 84 mxc_init_irq(MX27_IO_ADDRESS(MX27_AVIC_BASE_ADDR));
85 imx27_register_gpios();
83} 86}
diff --git a/arch/arm/mach-mx1/ksym_mx1.c b/arch/arm/mach-imx/mx1-camera-fiq-ksym.c
index b09ee12a4ff0..b09ee12a4ff0 100644
--- a/arch/arm/mach-mx1/ksym_mx1.c
+++ b/arch/arm/mach-imx/mx1-camera-fiq-ksym.c
diff --git a/arch/arm/mach-mx1/mx1_camera_fiq.S b/arch/arm/mach-imx/mx1-camera-fiq.S
index 9c69aa65bf17..9c69aa65bf17 100644
--- a/arch/arm/mach-mx1/mx1_camera_fiq.S
+++ b/arch/arm/mach-imx/mx1-camera-fiq.S
diff --git a/arch/arm/mach-mx2/pcm970-baseboard.c b/arch/arm/mach-imx/pcm970-baseboard.c
index f490a406d57e..f490a406d57e 100644
--- a/arch/arm/mach-mx2/pcm970-baseboard.c
+++ b/arch/arm/mach-imx/pcm970-baseboard.c
diff --git a/arch/arm/mach-imx/pm-imx27.c b/arch/arm/mach-imx/pm-imx27.c
new file mode 100644
index 000000000000..afc17ce0bb54
--- /dev/null
+++ b/arch/arm/mach-imx/pm-imx27.c
@@ -0,0 +1,46 @@
1/*
2 * i.MX27 Power Management Routines
3 *
4 * Based on Freescale's BSP
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License.
8 */
9
10#include <linux/kernel.h>
11#include <linux/suspend.h>
12#include <linux/io.h>
13#include <mach/system.h>
14#include <mach/mx27.h>
15
16static int mx27_suspend_enter(suspend_state_t state)
17{
18 u32 cscr;
19 switch (state) {
20 case PM_SUSPEND_MEM:
21 /* Clear MPEN and SPEN to disable MPLL/SPLL */
22 cscr = __raw_readl(MX27_IO_ADDRESS(MX27_CCM_BASE_ADDR));
23 cscr &= 0xFFFFFFFC;
24 __raw_writel(cscr, MX27_IO_ADDRESS(MX27_CCM_BASE_ADDR));
25 /* Executes WFI */
26 arch_idle();
27 break;
28
29 default:
30 return -EINVAL;
31 }
32 return 0;
33}
34
35static struct platform_suspend_ops mx27_suspend_ops = {
36 .enter = mx27_suspend_enter,
37 .valid = suspend_valid_only_mem,
38};
39
40static int __init mx27_pm_init(void)
41{
42 suspend_set_ops(&mx27_suspend_ops);
43 return 0;
44}
45
46device_initcall(mx27_pm_init);
diff --git a/arch/arm/mach-integrator/common.h b/arch/arm/mach-integrator/common.h
new file mode 100644
index 000000000000..5f96e1518aa9
--- /dev/null
+++ b/arch/arm/mach-integrator/common.h
@@ -0,0 +1 @@
void integrator_reserve(void);
diff --git a/arch/arm/mach-integrator/core.c b/arch/arm/mach-integrator/core.c
index b02cfc06e0ae..8f4fb6d638f7 100644
--- a/arch/arm/mach-integrator/core.c
+++ b/arch/arm/mach-integrator/core.c
@@ -14,6 +14,7 @@
14#include <linux/spinlock.h> 14#include <linux/spinlock.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/irq.h> 16#include <linux/irq.h>
17#include <linux/memblock.h>
17#include <linux/sched.h> 18#include <linux/sched.h>
18#include <linux/smp.h> 19#include <linux/smp.h>
19#include <linux/termios.h> 20#include <linux/termios.h>
@@ -30,6 +31,7 @@
30#include <asm/system.h> 31#include <asm/system.h>
31#include <asm/leds.h> 32#include <asm/leds.h>
32#include <asm/mach/time.h> 33#include <asm/mach/time.h>
34#include <asm/pgtable.h>
33 35
34static struct amba_pl010_data integrator_uart_data; 36static struct amba_pl010_data integrator_uart_data;
35 37
@@ -119,8 +121,13 @@ static struct clk uartclk = {
119 .rate = 14745600, 121 .rate = 14745600,
120}; 122};
121 123
124static struct clk dummy_apb_pclk;
125
122static struct clk_lookup lookups[] = { 126static struct clk_lookup lookups[] = {
123 { /* UART0 */ 127 { /* Bus clock */
128 .con_id = "apb_pclk",
129 .clk = &dummy_apb_pclk,
130 }, { /* UART0 */
124 .dev_id = "mb:16", 131 .dev_id = "mb:16",
125 .clk = &uartclk, 132 .clk = &uartclk,
126 }, { /* UART1 */ 133 }, { /* UART1 */
@@ -215,3 +222,13 @@ void cm_control(u32 mask, u32 set)
215} 222}
216 223
217EXPORT_SYMBOL(cm_control); 224EXPORT_SYMBOL(cm_control);
225
226/*
227 * We need to stop things allocating the low memory; ideally we need a
228 * better implementation of GFP_DMA which does not assume that DMA-able
229 * memory starts at zero.
230 */
231void __init integrator_reserve(void)
232{
233 memblock_reserve(PHYS_OFFSET, __pa(swapper_pg_dir) - PHYS_OFFSET);
234}
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index 227cf4d05088..6ab5a03ab9d8 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -48,6 +48,8 @@
48#include <asm/mach/map.h> 48#include <asm/mach/map.h>
49#include <asm/mach/time.h> 49#include <asm/mach/time.h>
50 50
51#include "common.h"
52
51/* 53/*
52 * All IO addresses are mapped onto VA 0xFFFx.xxxx, where x.xxxx 54 * All IO addresses are mapped onto VA 0xFFFx.xxxx, where x.xxxx
53 * is the (PA >> 12). 55 * is the (PA >> 12).
@@ -502,6 +504,7 @@ MACHINE_START(INTEGRATOR, "ARM-Integrator")
502 .io_pg_offst = ((0xf1600000) >> 18) & 0xfffc, 504 .io_pg_offst = ((0xf1600000) >> 18) & 0xfffc,
503 .boot_params = 0x00000100, 505 .boot_params = 0x00000100,
504 .map_io = ap_map_io, 506 .map_io = ap_map_io,
507 .reserve = integrator_reserve,
505 .init_irq = ap_init_irq, 508 .init_irq = ap_init_irq,
506 .timer = &ap_timer, 509 .timer = &ap_timer,
507 .init_machine = ap_init, 510 .init_machine = ap_init,
diff --git a/arch/arm/mach-integrator/integrator_cp.c b/arch/arm/mach-integrator/integrator_cp.c
index cde57b2b83b5..05db40e3c4f7 100644
--- a/arch/arm/mach-integrator/integrator_cp.c
+++ b/arch/arm/mach-integrator/integrator_cp.c
@@ -43,6 +43,8 @@
43 43
44#include <plat/timer-sp.h> 44#include <plat/timer-sp.h>
45 45
46#include "common.h"
47
46#define INTCP_PA_FLASH_BASE 0x24000000 48#define INTCP_PA_FLASH_BASE 0x24000000
47#define INTCP_FLASH_SIZE SZ_32M 49#define INTCP_FLASH_SIZE SZ_32M
48 50
@@ -601,6 +603,7 @@ MACHINE_START(CINTEGRATOR, "ARM-IntegratorCP")
601 .io_pg_offst = ((0xf1600000) >> 18) & 0xfffc, 603 .io_pg_offst = ((0xf1600000) >> 18) & 0xfffc,
602 .boot_params = 0x00000100, 604 .boot_params = 0x00000100,
603 .map_io = intcp_map_io, 605 .map_io = intcp_map_io,
606 .reserve = integrator_reserve,
604 .init_irq = intcp_init_irq, 607 .init_irq = intcp_init_irq,
605 .timer = &cp_timer, 608 .timer = &cp_timer,
606 .init_machine = intcp_init, 609 .init_machine = intcp_init,
diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c
index 9cef0590d5aa..6467d99fa2ee 100644
--- a/arch/arm/mach-integrator/pci_v3.c
+++ b/arch/arm/mach-integrator/pci_v3.c
@@ -505,10 +505,10 @@ void __init pci_v3_preinit(void)
505 /* 505 /*
506 * Hook in our fault handler for PCI errors 506 * Hook in our fault handler for PCI errors
507 */ 507 */
508 hook_fault_code(4, v3_pci_fault, SIGBUS, "external abort on linefetch"); 508 hook_fault_code(4, v3_pci_fault, SIGBUS, 0, "external abort on linefetch");
509 hook_fault_code(6, v3_pci_fault, SIGBUS, "external abort on linefetch"); 509 hook_fault_code(6, v3_pci_fault, SIGBUS, 0, "external abort on linefetch");
510 hook_fault_code(8, v3_pci_fault, SIGBUS, "external abort on non-linefetch"); 510 hook_fault_code(8, v3_pci_fault, SIGBUS, 0, "external abort on non-linefetch");
511 hook_fault_code(10, v3_pci_fault, SIGBUS, "external abort on non-linefetch"); 511 hook_fault_code(10, v3_pci_fault, SIGBUS, 0, "external abort on non-linefetch");
512 512
513 spin_lock_irqsave(&v3_lock, flags); 513 spin_lock_irqsave(&v3_lock, flags);
514 514
diff --git a/arch/arm/mach-iop13xx/include/mach/memory.h b/arch/arm/mach-iop13xx/include/mach/memory.h
index 25b1da9a5035..7415e4338651 100644
--- a/arch/arm/mach-iop13xx/include/mach/memory.h
+++ b/arch/arm/mach-iop13xx/include/mach/memory.h
@@ -69,6 +69,4 @@ static inline unsigned long __lbus_to_virt(dma_addr_t x)
69#endif /* CONFIG_ARCH_IOP13XX */ 69#endif /* CONFIG_ARCH_IOP13XX */
70#endif /* !ASSEMBLY */ 70#endif /* !ASSEMBLY */
71 71
72#define PFN_TO_NID(addr) (0)
73
74#endif 72#endif
diff --git a/arch/arm/mach-iop13xx/pci.c b/arch/arm/mach-iop13xx/pci.c
index 6d5a90813d31..773ea0c95b9f 100644
--- a/arch/arm/mach-iop13xx/pci.c
+++ b/arch/arm/mach-iop13xx/pci.c
@@ -987,7 +987,7 @@ void __init iop13xx_pci_init(void)
987 iop13xx_atux_setup(); 987 iop13xx_atux_setup();
988 } 988 }
989 989
990 hook_fault_code(16+6, iop13xx_pci_abort, SIGBUS, 990 hook_fault_code(16+6, iop13xx_pci_abort, SIGBUS, 0,
991 "imprecise external abort"); 991 "imprecise external abort");
992} 992}
993 993
diff --git a/arch/arm/mach-ixp2000/pci.c b/arch/arm/mach-ixp2000/pci.c
index 90771cad06f8..f797c5f538b0 100644
--- a/arch/arm/mach-ixp2000/pci.c
+++ b/arch/arm/mach-ixp2000/pci.c
@@ -209,7 +209,7 @@ ixp2000_pci_preinit(void)
209 "the needed workaround has not been configured in"); 209 "the needed workaround has not been configured in");
210#endif 210#endif
211 211
212 hook_fault_code(16+6, ixp2000_pci_abort_handler, SIGBUS, 212 hook_fault_code(16+6, ixp2000_pci_abort_handler, SIGBUS, 0,
213 "PCI config cycle to non-existent device"); 213 "PCI config cycle to non-existent device");
214} 214}
215 215
diff --git a/arch/arm/mach-ixp23xx/pci.c b/arch/arm/mach-ixp23xx/pci.c
index 4b0e598a91c9..563819a83292 100644
--- a/arch/arm/mach-ixp23xx/pci.c
+++ b/arch/arm/mach-ixp23xx/pci.c
@@ -229,7 +229,7 @@ void __init ixp23xx_pci_preinit(void)
229{ 229{
230 ixp23xx_pci_common_init(); 230 ixp23xx_pci_common_init();
231 231
232 hook_fault_code(16+6, ixp23xx_pci_abort_handler, SIGBUS, 232 hook_fault_code(16+6, ixp23xx_pci_abort_handler, SIGBUS, 0,
233 "PCI config cycle to non-existent device"); 233 "PCI config cycle to non-existent device");
234 234
235 *IXP23XX_PCI_ADDR_EXT = 0x0000e000; 235 *IXP23XX_PCI_ADDR_EXT = 0x0000e000;
diff --git a/arch/arm/mach-ixp4xx/common-pci.c b/arch/arm/mach-ixp4xx/common-pci.c
index e3181534c7f9..61cd4d64b985 100644
--- a/arch/arm/mach-ixp4xx/common-pci.c
+++ b/arch/arm/mach-ixp4xx/common-pci.c
@@ -348,7 +348,7 @@ int dma_needs_bounce(struct device *dev, dma_addr_t dma_addr, size_t size)
348 * This is really ugly and we need a better way of specifying 348 * This is really ugly and we need a better way of specifying
349 * DMA-capable regions of memory. 349 * DMA-capable regions of memory.
350 */ 350 */
351void __init ixp4xx_adjust_zones(int node, unsigned long *zone_size, 351void __init ixp4xx_adjust_zones(unsigned long *zone_size,
352 unsigned long *zhole_size) 352 unsigned long *zhole_size)
353{ 353{
354 unsigned int sz = SZ_64M >> PAGE_SHIFT; 354 unsigned int sz = SZ_64M >> PAGE_SHIFT;
@@ -356,7 +356,7 @@ void __init ixp4xx_adjust_zones(int node, unsigned long *zone_size,
356 /* 356 /*
357 * Only adjust if > 64M on current system 357 * Only adjust if > 64M on current system
358 */ 358 */
359 if (node || (zone_size[0] <= sz)) 359 if (zone_size[0] <= sz)
360 return; 360 return;
361 361
362 zone_size[1] = zone_size[0] - sz; 362 zone_size[1] = zone_size[0] - sz;
@@ -382,7 +382,8 @@ void __init ixp4xx_pci_preinit(void)
382 382
383 383
384 /* hook in our fault handler for PCI errors */ 384 /* hook in our fault handler for PCI errors */
385 hook_fault_code(16+6, abort_handler, SIGBUS, "imprecise external abort"); 385 hook_fault_code(16+6, abort_handler, SIGBUS, 0,
386 "imprecise external abort");
386 387
387 pr_debug("setup PCI-AHB(inbound) and AHB-PCI(outbound) address mappings\n"); 388 pr_debug("setup PCI-AHB(inbound) and AHB-PCI(outbound) address mappings\n");
388 389
diff --git a/arch/arm/mach-ixp4xx/include/mach/memory.h b/arch/arm/mach-ixp4xx/include/mach/memory.h
index 98f5e5e20980..0136eaa29224 100644
--- a/arch/arm/mach-ixp4xx/include/mach/memory.h
+++ b/arch/arm/mach-ixp4xx/include/mach/memory.h
@@ -16,10 +16,10 @@
16 16
17#if !defined(__ASSEMBLY__) && defined(CONFIG_PCI) 17#if !defined(__ASSEMBLY__) && defined(CONFIG_PCI)
18 18
19void ixp4xx_adjust_zones(int node, unsigned long *size, unsigned long *holes); 19void ixp4xx_adjust_zones(unsigned long *size, unsigned long *holes);
20 20
21#define arch_adjust_zones(node, size, holes) \ 21#define arch_adjust_zones(size, holes) \
22 ixp4xx_adjust_zones(node, size, holes) 22 ixp4xx_adjust_zones(size, holes)
23 23
24#define ISA_DMA_THRESHOLD (SZ_64M - 1) 24#define ISA_DMA_THRESHOLD (SZ_64M - 1)
25#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_64M) 25#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_64M)
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index 29b2163b1fe3..cc25501b57fa 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -75,6 +75,13 @@ config MACH_OPENRD_CLIENT
75 Say 'Y' here if you want your kernel to support the 75 Say 'Y' here if you want your kernel to support the
76 Marvell OpenRD Client Board. 76 Marvell OpenRD Client Board.
77 77
78config MACH_OPENRD_ULTIMATE
79 bool "Marvell OpenRD Ultimate Board"
80 select MACH_OPENRD
81 help
82 Say 'Y' here if you want your kernel to support the
83 Marvell OpenRD Ultimate Board.
84
78config MACH_NETSPACE_V2 85config MACH_NETSPACE_V2
79 bool "LaCie Network Space v2 NAS Board" 86 bool "LaCie Network Space v2 NAS Board"
80 help 87 help
@@ -87,6 +94,12 @@ config MACH_INETSPACE_V2
87 Say 'Y' here if you want your kernel to support the 94 Say 'Y' here if you want your kernel to support the
88 LaCie Internet Space v2 NAS. 95 LaCie Internet Space v2 NAS.
89 96
97config MACH_NETSPACE_MAX_V2
98 bool "LaCie Network Space Max v2 NAS Board"
99 help
100 Say 'Y' here if you want your kernel to support the
101 LaCie Network Space Max v2 NAS.
102
90config MACH_NET2BIG_V2 103config MACH_NET2BIG_V2
91 bool "LaCie 2Big Network v2 NAS Board" 104 bool "LaCie 2Big Network v2 NAS Board"
92 help 105 help
@@ -99,6 +112,12 @@ config MACH_NET5BIG_V2
99 Say 'Y' here if you want your kernel to support the 112 Say 'Y' here if you want your kernel to support the
100 LaCie 5Big Network v2 NAS. 113 LaCie 5Big Network v2 NAS.
101 114
115config MACH_T5325
116 bool "HP t5325 Thin Client"
117 help
118 Say 'Y' here if you want your kernel to support the
119 HP t5325 Thin Client.
120
102endmenu 121endmenu
103 122
104endif 123endif
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index c0cd5d362002..295d7baa6ae1 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -12,7 +12,9 @@ obj-$(CONFIG_MACH_TS41X) += ts41x-setup.o tsx1x-common.o
12obj-$(CONFIG_MACH_OPENRD) += openrd-setup.o 12obj-$(CONFIG_MACH_OPENRD) += openrd-setup.o
13obj-$(CONFIG_MACH_NETSPACE_V2) += netspace_v2-setup.o 13obj-$(CONFIG_MACH_NETSPACE_V2) += netspace_v2-setup.o
14obj-$(CONFIG_MACH_INETSPACE_V2) += netspace_v2-setup.o 14obj-$(CONFIG_MACH_INETSPACE_V2) += netspace_v2-setup.o
15obj-$(CONFIG_MACH_NETSPACE_MAX_V2) += netspace_v2-setup.o
15obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o 16obj-$(CONFIG_MACH_NET2BIG_V2) += netxbig_v2-setup.o
16obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o 17obj-$(CONFIG_MACH_NET5BIG_V2) += netxbig_v2-setup.o
18obj-$(CONFIG_MACH_T5325) += t5325-setup.o
17 19
18obj-$(CONFIG_CPU_IDLE) += cpuidle.o 20obj-$(CONFIG_CPU_IDLE) += cpuidle.o
diff --git a/arch/arm/mach-kirkwood/addr-map.c b/arch/arm/mach-kirkwood/addr-map.c
index 2e69168fc699..8d03bcef5182 100644
--- a/arch/arm/mach-kirkwood/addr-map.c
+++ b/arch/arm/mach-kirkwood/addr-map.c
@@ -31,6 +31,8 @@
31#define ATTR_DEV_CS0 0x3e 31#define ATTR_DEV_CS0 0x3e
32#define ATTR_PCIE_IO 0xe0 32#define ATTR_PCIE_IO 0xe0
33#define ATTR_PCIE_MEM 0xe8 33#define ATTR_PCIE_MEM 0xe8
34#define ATTR_PCIE1_IO 0xd0
35#define ATTR_PCIE1_MEM 0xd8
34#define ATTR_SRAM 0x01 36#define ATTR_SRAM 0x01
35 37
36/* 38/*
@@ -106,17 +108,21 @@ void __init kirkwood_setup_cpu_mbus(void)
106 TARGET_PCIE, ATTR_PCIE_IO, KIRKWOOD_PCIE_IO_BUS_BASE); 108 TARGET_PCIE, ATTR_PCIE_IO, KIRKWOOD_PCIE_IO_BUS_BASE);
107 setup_cpu_win(1, KIRKWOOD_PCIE_MEM_PHYS_BASE, KIRKWOOD_PCIE_MEM_SIZE, 109 setup_cpu_win(1, KIRKWOOD_PCIE_MEM_PHYS_BASE, KIRKWOOD_PCIE_MEM_SIZE,
108 TARGET_PCIE, ATTR_PCIE_MEM, KIRKWOOD_PCIE_MEM_BUS_BASE); 110 TARGET_PCIE, ATTR_PCIE_MEM, KIRKWOOD_PCIE_MEM_BUS_BASE);
111 setup_cpu_win(2, KIRKWOOD_PCIE1_IO_PHYS_BASE, KIRKWOOD_PCIE1_IO_SIZE,
112 TARGET_PCIE, ATTR_PCIE1_IO, KIRKWOOD_PCIE1_IO_BUS_BASE);
113 setup_cpu_win(3, KIRKWOOD_PCIE1_MEM_PHYS_BASE, KIRKWOOD_PCIE1_MEM_SIZE,
114 TARGET_PCIE, ATTR_PCIE1_MEM, KIRKWOOD_PCIE1_MEM_BUS_BASE);
109 115
110 /* 116 /*
111 * Setup window for NAND controller. 117 * Setup window for NAND controller.
112 */ 118 */
113 setup_cpu_win(2, KIRKWOOD_NAND_MEM_PHYS_BASE, KIRKWOOD_NAND_MEM_SIZE, 119 setup_cpu_win(4, KIRKWOOD_NAND_MEM_PHYS_BASE, KIRKWOOD_NAND_MEM_SIZE,
114 TARGET_DEV_BUS, ATTR_DEV_NAND, -1); 120 TARGET_DEV_BUS, ATTR_DEV_NAND, -1);
115 121
116 /* 122 /*
117 * Setup window for SRAM. 123 * Setup window for SRAM.
118 */ 124 */
119 setup_cpu_win(3, KIRKWOOD_SRAM_PHYS_BASE, KIRKWOOD_SRAM_SIZE, 125 setup_cpu_win(5, KIRKWOOD_SRAM_PHYS_BASE, KIRKWOOD_SRAM_SIZE,
120 TARGET_SRAM, ATTR_SRAM, -1); 126 TARGET_SRAM, ATTR_SRAM, -1);
121 127
122 /* 128 /*
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index 6072eaa5e66a..9dd67c7b4459 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -44,6 +44,11 @@ static struct map_desc kirkwood_io_desc[] __initdata = {
44 .length = KIRKWOOD_PCIE_IO_SIZE, 44 .length = KIRKWOOD_PCIE_IO_SIZE,
45 .type = MT_DEVICE, 45 .type = MT_DEVICE,
46 }, { 46 }, {
47 .virtual = KIRKWOOD_PCIE1_IO_VIRT_BASE,
48 .pfn = __phys_to_pfn(KIRKWOOD_PCIE1_IO_PHYS_BASE),
49 .length = KIRKWOOD_PCIE1_IO_SIZE,
50 .type = MT_DEVICE,
51 }, {
47 .virtual = KIRKWOOD_REGS_VIRT_BASE, 52 .virtual = KIRKWOOD_REGS_VIRT_BASE,
48 .pfn = __phys_to_pfn(KIRKWOOD_REGS_PHYS_BASE), 53 .pfn = __phys_to_pfn(KIRKWOOD_REGS_PHYS_BASE),
49 .length = KIRKWOOD_REGS_SIZE, 54 .length = KIRKWOOD_REGS_SIZE,
@@ -402,7 +407,7 @@ void __init kirkwood_sdio_init(struct mvsdio_platform_data *mvsdio_data)
402 u32 dev, rev; 407 u32 dev, rev;
403 408
404 kirkwood_pcie_id(&dev, &rev); 409 kirkwood_pcie_id(&dev, &rev);
405 if (rev == 0) /* catch all Kirkwood Z0's */ 410 if (rev == 0 && dev != MV88F6282_DEV_ID) /* catch all Kirkwood Z0's */
406 mvsdio_data->clock = 100000000; 411 mvsdio_data->clock = 100000000;
407 else 412 else
408 mvsdio_data->clock = 200000000; 413 mvsdio_data->clock = 200000000;
@@ -847,8 +852,10 @@ int __init kirkwood_find_tclk(void)
847 u32 dev, rev; 852 u32 dev, rev;
848 853
849 kirkwood_pcie_id(&dev, &rev); 854 kirkwood_pcie_id(&dev, &rev);
850 if (dev == MV88F6281_DEV_ID && (rev == MV88F6281_REV_A0 || 855
851 rev == MV88F6281_REV_A1)) 856 if ((dev == MV88F6281_DEV_ID && (rev == MV88F6281_REV_A0 ||
857 rev == MV88F6281_REV_A1)) ||
858 (dev == MV88F6282_DEV_ID))
852 return 200000000; 859 return 200000000;
853 860
854 return 166666667; 861 return 166666667;
@@ -891,13 +898,22 @@ static char * __init kirkwood_id(void)
891 return "MV88F6192-Z0"; 898 return "MV88F6192-Z0";
892 else if (rev == MV88F6192_REV_A0) 899 else if (rev == MV88F6192_REV_A0)
893 return "MV88F6192-A0"; 900 return "MV88F6192-A0";
901 else if (rev == MV88F6192_REV_A1)
902 return "MV88F6192-A1";
894 else 903 else
895 return "MV88F6192-Rev-Unsupported"; 904 return "MV88F6192-Rev-Unsupported";
896 } else if (dev == MV88F6180_DEV_ID) { 905 } else if (dev == MV88F6180_DEV_ID) {
897 if (rev == MV88F6180_REV_A0) 906 if (rev == MV88F6180_REV_A0)
898 return "MV88F6180-Rev-A0"; 907 return "MV88F6180-Rev-A0";
908 else if (rev == MV88F6180_REV_A1)
909 return "MV88F6180-Rev-A1";
899 else 910 else
900 return "MV88F6180-Rev-Unsupported"; 911 return "MV88F6180-Rev-Unsupported";
912 } else if (dev == MV88F6282_DEV_ID) {
913 if (rev == MV88F6282_REV_A0)
914 return "MV88F6282-Rev-A0";
915 else
916 return "MV88F6282-Rev-Unsupported";
901 } else { 917 } else {
902 return "Device-Unknown"; 918 return "Device-Unknown";
903 } 919 }
@@ -949,12 +965,14 @@ void __init kirkwood_init(void)
949static int __init kirkwood_clock_gate(void) 965static int __init kirkwood_clock_gate(void)
950{ 966{
951 unsigned int curr = readl(CLOCK_GATING_CTRL); 967 unsigned int curr = readl(CLOCK_GATING_CTRL);
968 u32 dev, rev;
952 969
970 kirkwood_pcie_id(&dev, &rev);
953 printk(KERN_DEBUG "Gating clock of unused units\n"); 971 printk(KERN_DEBUG "Gating clock of unused units\n");
954 printk(KERN_DEBUG "before: 0x%08x\n", curr); 972 printk(KERN_DEBUG "before: 0x%08x\n", curr);
955 973
956 /* Make sure those units are accessible */ 974 /* Make sure those units are accessible */
957 writel(curr | CGC_SATA0 | CGC_SATA1 | CGC_PEX0, CLOCK_GATING_CTRL); 975 writel(curr | CGC_SATA0 | CGC_SATA1 | CGC_PEX0 | CGC_PEX1, CLOCK_GATING_CTRL);
958 976
959 /* For SATA: first shutdown the phy */ 977 /* For SATA: first shutdown the phy */
960 if (!(kirkwood_clk_ctrl & CGC_SATA0)) { 978 if (!(kirkwood_clk_ctrl & CGC_SATA0)) {
@@ -979,6 +997,18 @@ static int __init kirkwood_clock_gate(void)
979 writel(readl(PCIE_LINK_CTRL) & ~0x10, PCIE_LINK_CTRL); 997 writel(readl(PCIE_LINK_CTRL) & ~0x10, PCIE_LINK_CTRL);
980 } 998 }
981 999
1000 /* For PCIe 1: first shutdown the phy */
1001 if (dev == MV88F6282_DEV_ID) {
1002 if (!(kirkwood_clk_ctrl & CGC_PEX1)) {
1003 writel(readl(PCIE1_LINK_CTRL) | 0x10, PCIE1_LINK_CTRL);
1004 while (1)
1005 if (readl(PCIE1_STATUS) & 0x1)
1006 break;
1007 writel(readl(PCIE1_LINK_CTRL) & ~0x10, PCIE1_LINK_CTRL);
1008 }
1009 } else /* keep this bit set for devices that don't have PCIe1 */
1010 kirkwood_clk_ctrl |= CGC_PEX1;
1011
982 /* Now gate clock the required units */ 1012 /* Now gate clock the required units */
983 writel(kirkwood_clk_ctrl, CLOCK_GATING_CTRL); 1013 writel(kirkwood_clk_ctrl, CLOCK_GATING_CTRL);
984 printk(KERN_DEBUG " after: 0x%08x\n", readl(CLOCK_GATING_CTRL)); 1014 printk(KERN_DEBUG " after: 0x%08x\n", readl(CLOCK_GATING_CTRL));
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index 05e8a8a5692e..5b2c1c18d641 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -18,6 +18,9 @@ struct mvsdio_platform_data;
18struct mtd_partition; 18struct mtd_partition;
19struct mtd_info; 19struct mtd_info;
20 20
21#define KW_PCIE0 (1 << 0)
22#define KW_PCIE1 (1 << 1)
23
21/* 24/*
22 * Basic Kirkwood init functions used early by machine-setup. 25 * Basic Kirkwood init functions used early by machine-setup.
23 */ 26 */
@@ -34,7 +37,7 @@ void kirkwood_ehci_init(void);
34void kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data); 37void kirkwood_ge00_init(struct mv643xx_eth_platform_data *eth_data);
35void kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data); 38void kirkwood_ge01_init(struct mv643xx_eth_platform_data *eth_data);
36void kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq); 39void kirkwood_ge00_switch_init(struct dsa_platform_data *d, int irq);
37void kirkwood_pcie_init(void); 40void kirkwood_pcie_init(unsigned int portmask);
38void kirkwood_sata_init(struct mv_sata_platform_data *sata_data); 41void kirkwood_sata_init(struct mv_sata_platform_data *sata_data);
39void kirkwood_sdio_init(struct mvsdio_platform_data *mvsdio_data); 42void kirkwood_sdio_init(struct mvsdio_platform_data *mvsdio_data);
40void kirkwood_spi_init(void); 43void kirkwood_spi_init(void);
diff --git a/arch/arm/mach-kirkwood/db88f6281-bp-setup.c b/arch/arm/mach-kirkwood/db88f6281-bp-setup.c
index 39bdf4bcace9..16f6691e7c68 100644
--- a/arch/arm/mach-kirkwood/db88f6281-bp-setup.c
+++ b/arch/arm/mach-kirkwood/db88f6281-bp-setup.c
@@ -51,6 +51,14 @@ static struct mvsdio_platform_data db88f6281_mvsdio_data = {
51}; 51};
52 52
53static unsigned int db88f6281_mpp_config[] __initdata = { 53static unsigned int db88f6281_mpp_config[] __initdata = {
54 MPP0_NF_IO2,
55 MPP1_NF_IO3,
56 MPP2_NF_IO4,
57 MPP3_NF_IO5,
58 MPP4_NF_IO6,
59 MPP5_NF_IO7,
60 MPP18_NF_IO0,
61 MPP19_NF_IO1,
54 MPP37_GPIO, 62 MPP37_GPIO,
55 MPP38_GPIO, 63 MPP38_GPIO,
56 0 64 0
@@ -74,9 +82,15 @@ static void __init db88f6281_init(void)
74 82
75static int __init db88f6281_pci_init(void) 83static int __init db88f6281_pci_init(void)
76{ 84{
77 if (machine_is_db88f6281_bp()) 85 if (machine_is_db88f6281_bp()) {
78 kirkwood_pcie_init(); 86 u32 dev, rev;
79 87
88 kirkwood_pcie_id(&dev, &rev);
89 if (dev == MV88F6282_DEV_ID)
90 kirkwood_pcie_init(KW_PCIE1 | KW_PCIE0);
91 else
92 kirkwood_pcie_init(KW_PCIE0);
93 }
80 return 0; 94 return 0;
81} 95}
82subsys_initcall(db88f6281_pci_init); 96subsys_initcall(db88f6281_pci_init);
diff --git a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
index 418f5017c50e..aff0e1327e38 100644
--- a/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
+++ b/arch/arm/mach-kirkwood/include/mach/bridge-regs.h
@@ -59,8 +59,9 @@
59#define CGC_SATA1 (1 << 15) 59#define CGC_SATA1 (1 << 15)
60#define CGC_XOR1 (1 << 16) 60#define CGC_XOR1 (1 << 16)
61#define CGC_CRYPTO (1 << 17) 61#define CGC_CRYPTO (1 << 17)
62#define CGC_PEX1 (1 << 18)
62#define CGC_GE1 (1 << 19) 63#define CGC_GE1 (1 << 19)
63#define CGC_TDM (1 << 20) 64#define CGC_TDM (1 << 20)
64#define CGC_RESERVED ((1 << 18) | (0x6 << 21)) 65#define CGC_RESERVED (0x6 << 21)
65 66
66#endif 67#endif
diff --git a/arch/arm/mach-kirkwood/include/mach/irqs.h b/arch/arm/mach-kirkwood/include/mach/irqs.h
index f00a0a45a67e..9da2eb59180b 100644
--- a/arch/arm/mach-kirkwood/include/mach/irqs.h
+++ b/arch/arm/mach-kirkwood/include/mach/irqs.h
@@ -23,6 +23,7 @@
23#define IRQ_KIRKWOOD_XOR_10 7 23#define IRQ_KIRKWOOD_XOR_10 7
24#define IRQ_KIRKWOOD_XOR_11 8 24#define IRQ_KIRKWOOD_XOR_11 8
25#define IRQ_KIRKWOOD_PCIE 9 25#define IRQ_KIRKWOOD_PCIE 9
26#define IRQ_KIRKWOOD_PCIE1 10
26#define IRQ_KIRKWOOD_GE00_SUM 11 27#define IRQ_KIRKWOOD_GE00_SUM 11
27#define IRQ_KIRKWOOD_GE01_SUM 15 28#define IRQ_KIRKWOOD_GE01_SUM 15
28#define IRQ_KIRKWOOD_USB 19 29#define IRQ_KIRKWOOD_USB 19
diff --git a/arch/arm/mach-kirkwood/include/mach/kirkwood.h b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
index a15cf0ee22bd..d141af4c2744 100644
--- a/arch/arm/mach-kirkwood/include/mach/kirkwood.h
+++ b/arch/arm/mach-kirkwood/include/mach/kirkwood.h
@@ -16,36 +16,48 @@
16 * Marvell Kirkwood address maps. 16 * Marvell Kirkwood address maps.
17 * 17 *
18 * phys 18 * phys
19 * e0000000 PCIe Memory space 19 * e0000000 PCIe #0 Memory space
20 * e8000000 PCIe #1 Memory space
20 * f1000000 on-chip peripheral registers 21 * f1000000 on-chip peripheral registers
21 * f2000000 PCIe I/O space 22 * f2000000 PCIe #0 I/O space
22 * f3000000 NAND controller address window 23 * f3000000 PCIe #1 I/O space
23 * f4000000 Security Accelerator SRAM 24 * f4000000 NAND controller address window
25 * f5000000 Security Accelerator SRAM
24 * 26 *
25 * virt phys size 27 * virt phys size
26 * fee00000 f1000000 1M on-chip peripheral registers 28 * fed00000 f1000000 1M on-chip peripheral registers
27 * fef00000 f2000000 1M PCIe I/O space 29 * fee00000 f2000000 1M PCIe #0 I/O space
30 * fef00000 f3000000 1M PCIe #1 I/O space
28 */ 31 */
29 32
30#define KIRKWOOD_SRAM_PHYS_BASE 0xf4000000 33#define KIRKWOOD_SRAM_PHYS_BASE 0xf5000000
31#define KIRKWOOD_SRAM_SIZE SZ_2K 34#define KIRKWOOD_SRAM_SIZE SZ_2K
32 35
33#define KIRKWOOD_NAND_MEM_PHYS_BASE 0xf3000000 36#define KIRKWOOD_NAND_MEM_PHYS_BASE 0xf4000000
34#define KIRKWOOD_NAND_MEM_SIZE SZ_1K 37#define KIRKWOOD_NAND_MEM_SIZE SZ_1K
35 38
39#define KIRKWOOD_PCIE1_IO_PHYS_BASE 0xf3000000
40#define KIRKWOOD_PCIE1_IO_VIRT_BASE 0xfef00000
41#define KIRKWOOD_PCIE1_IO_BUS_BASE 0x00000000
42#define KIRKWOOD_PCIE1_IO_SIZE SZ_1M
43
36#define KIRKWOOD_PCIE_IO_PHYS_BASE 0xf2000000 44#define KIRKWOOD_PCIE_IO_PHYS_BASE 0xf2000000
37#define KIRKWOOD_PCIE_IO_VIRT_BASE 0xfef00000 45#define KIRKWOOD_PCIE_IO_VIRT_BASE 0xfee00000
38#define KIRKWOOD_PCIE_IO_BUS_BASE 0x00000000 46#define KIRKWOOD_PCIE_IO_BUS_BASE 0x00000000
39#define KIRKWOOD_PCIE_IO_SIZE SZ_1M 47#define KIRKWOOD_PCIE_IO_SIZE SZ_1M
40 48
41#define KIRKWOOD_REGS_PHYS_BASE 0xf1000000 49#define KIRKWOOD_REGS_PHYS_BASE 0xf1000000
42#define KIRKWOOD_REGS_VIRT_BASE 0xfee00000 50#define KIRKWOOD_REGS_VIRT_BASE 0xfed00000
43#define KIRKWOOD_REGS_SIZE SZ_1M 51#define KIRKWOOD_REGS_SIZE SZ_1M
44 52
45#define KIRKWOOD_PCIE_MEM_PHYS_BASE 0xe0000000 53#define KIRKWOOD_PCIE_MEM_PHYS_BASE 0xe0000000
46#define KIRKWOOD_PCIE_MEM_BUS_BASE 0xe0000000 54#define KIRKWOOD_PCIE_MEM_BUS_BASE 0xe0000000
47#define KIRKWOOD_PCIE_MEM_SIZE SZ_128M 55#define KIRKWOOD_PCIE_MEM_SIZE SZ_128M
48 56
57#define KIRKWOOD_PCIE1_MEM_PHYS_BASE 0xe8000000
58#define KIRKWOOD_PCIE1_MEM_BUS_BASE 0xe8000000
59#define KIRKWOOD_PCIE1_MEM_SIZE SZ_128M
60
49/* 61/*
50 * Register Map 62 * Register Map
51 */ 63 */
@@ -72,6 +84,9 @@
72#define PCIE_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x40000) 84#define PCIE_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x40000)
73#define PCIE_LINK_CTRL (PCIE_VIRT_BASE | 0x70) 85#define PCIE_LINK_CTRL (PCIE_VIRT_BASE | 0x70)
74#define PCIE_STATUS (PCIE_VIRT_BASE | 0x1a04) 86#define PCIE_STATUS (PCIE_VIRT_BASE | 0x1a04)
87#define PCIE1_VIRT_BASE (KIRKWOOD_REGS_VIRT_BASE | 0x44000)
88#define PCIE1_LINK_CTRL (PCIE1_VIRT_BASE | 0x70)
89#define PCIE1_STATUS (PCIE1_VIRT_BASE | 0x1a04)
75 90
76#define USB_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x50000) 91#define USB_PHYS_BASE (KIRKWOOD_REGS_PHYS_BASE | 0x50000)
77 92
@@ -107,8 +122,12 @@
107#define MV88F6192_DEV_ID 0x6192 122#define MV88F6192_DEV_ID 0x6192
108#define MV88F6192_REV_Z0 0 123#define MV88F6192_REV_Z0 0
109#define MV88F6192_REV_A0 2 124#define MV88F6192_REV_A0 2
125#define MV88F6192_REV_A1 3
110 126
111#define MV88F6180_DEV_ID 0x6180 127#define MV88F6180_DEV_ID 0x6180
112#define MV88F6180_REV_A0 2 128#define MV88F6180_REV_A0 2
129#define MV88F6180_REV_A1 3
113 130
131#define MV88F6282_DEV_ID 0x6282
132#define MV88F6282_REV_A0 0
114#endif 133#endif
diff --git a/arch/arm/mach-kirkwood/include/mach/leds-ns2.h b/arch/arm/mach-kirkwood/include/mach/leds-ns2.h
new file mode 100644
index 000000000000..e21272e5f668
--- /dev/null
+++ b/arch/arm/mach-kirkwood/include/mach/leds-ns2.h
@@ -0,0 +1,26 @@
1/*
2 * arch/arm/mach-kirkwood/include/mach/leds-ns2.h
3 *
4 * Platform data structure for Network Space v2 LED driver
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10
11#ifndef __MACH_LEDS_NS2_H
12#define __MACH_LEDS_NS2_H
13
14struct ns2_led {
15 const char *name;
16 const char *default_trigger;
17 unsigned cmd;
18 unsigned slow;
19};
20
21struct ns2_led_platform_data {
22 int num_leds;
23 struct ns2_led *leds;
24};
25
26#endif /* __MACH_LEDS_NS2_H */
diff --git a/arch/arm/mach-kirkwood/mpp.c b/arch/arm/mach-kirkwood/mpp.c
index a5900f64e38c..065187d177c6 100644
--- a/arch/arm/mach-kirkwood/mpp.c
+++ b/arch/arm/mach-kirkwood/mpp.c
@@ -23,7 +23,8 @@ static unsigned int __init kirkwood_variant(void)
23 23
24 kirkwood_pcie_id(&dev, &rev); 24 kirkwood_pcie_id(&dev, &rev);
25 25
26 if (dev == MV88F6281_DEV_ID && rev >= MV88F6281_REV_A0) 26 if ((dev == MV88F6281_DEV_ID && rev >= MV88F6281_REV_A0) ||
27 (dev == MV88F6282_DEV_ID))
27 return MPP_F6281_MASK; 28 return MPP_F6281_MASK;
28 if (dev == MV88F6192_DEV_ID && rev >= MV88F6192_REV_A0) 29 if (dev == MV88F6192_DEV_ID && rev >= MV88F6192_REV_A0)
29 return MPP_F6192_MASK; 30 return MPP_F6192_MASK;
diff --git a/arch/arm/mach-kirkwood/mpp.h b/arch/arm/mach-kirkwood/mpp.h
index bc74278ed311..9b0a94d85c3e 100644
--- a/arch/arm/mach-kirkwood/mpp.h
+++ b/arch/arm/mach-kirkwood/mpp.h
@@ -11,7 +11,7 @@
11#ifndef __KIRKWOOD_MPP_H 11#ifndef __KIRKWOOD_MPP_H
12#define __KIRKWOOD_MPP_H 12#define __KIRKWOOD_MPP_H
13 13
14#define MPP(_num, _sel, _in, _out, _F6180, _F6190, _F6192, _F6281) ( \ 14#define MPP(_num, _sel, _in, _out, _F6180, _F6190, _F6192, _F6281, _F6282) ( \
15 /* MPP number */ ((_num) & 0xff) | \ 15 /* MPP number */ ((_num) & 0xff) | \
16 /* MPP select value */ (((_sel) & 0xf) << 8) | \ 16 /* MPP select value */ (((_sel) & 0xf) << 8) | \
17 /* may be input signal */ ((!!(_in)) << 12) | \ 17 /* may be input signal */ ((!!(_in)) << 12) | \
@@ -19,282 +19,332 @@
19 /* available on F6180 */ ((!!(_F6180)) << 14) | \ 19 /* available on F6180 */ ((!!(_F6180)) << 14) | \
20 /* available on F6190 */ ((!!(_F6190)) << 15) | \ 20 /* available on F6190 */ ((!!(_F6190)) << 15) | \
21 /* available on F6192 */ ((!!(_F6192)) << 16) | \ 21 /* available on F6192 */ ((!!(_F6192)) << 16) | \
22 /* available on F6281 */ ((!!(_F6281)) << 17)) 22 /* available on F6281 */ ((!!(_F6281)) << 17) | \
23 /* available on F6282 */ ((!!(_F6282)) << 18))
23 24
24#define MPP_NUM(x) ((x) & 0xff) 25#define MPP_NUM(x) ((x) & 0xff)
25#define MPP_SEL(x) (((x) >> 8) & 0xf) 26#define MPP_SEL(x) (((x) >> 8) & 0xf)
26 27
27 /* num sel i o 6180 6190 6192 6281 */ 28 /* num sel i o 6180 6190 6192 6281 6282 */
28 29
29#define MPP_INPUT_MASK MPP( 0, 0x0, 1, 0, 0, 0, 0, 0 ) 30#define MPP_INPUT_MASK MPP( 0, 0x0, 1, 0, 0, 0, 0, 0, 0 )
30#define MPP_OUTPUT_MASK MPP( 0, 0x0, 0, 1, 0, 0, 0, 0 ) 31#define MPP_OUTPUT_MASK MPP( 0, 0x0, 0, 1, 0, 0, 0, 0, 0 )
31 32
32#define MPP_F6180_MASK MPP( 0, 0x0, 0, 0, 1, 0, 0, 0 ) 33#define MPP_F6180_MASK MPP( 0, 0x0, 0, 0, 1, 0, 0, 0, 0 )
33#define MPP_F6190_MASK MPP( 0, 0x0, 0, 0, 0, 1, 0, 0 ) 34#define MPP_F6190_MASK MPP( 0, 0x0, 0, 0, 0, 1, 0, 0, 0 )
34#define MPP_F6192_MASK MPP( 0, 0x0, 0, 0, 0, 0, 1, 0 ) 35#define MPP_F6192_MASK MPP( 0, 0x0, 0, 0, 0, 0, 1, 0, 0 )
35#define MPP_F6281_MASK MPP( 0, 0x0, 0, 0, 0, 0, 0, 1 ) 36#define MPP_F6281_MASK MPP( 0, 0x0, 0, 0, 0, 0, 0, 1, 0 )
36 37#define MPP_F6282_MASK MPP( 0, 0x0, 0, 0, 0, 0, 0, 0, 1 )
37#define MPP0_GPIO MPP( 0, 0x0, 1, 1, 1, 1, 1, 1 ) 38
38#define MPP0_NF_IO2 MPP( 0, 0x1, 1, 1, 1, 1, 1, 1 ) 39#define MPP0_GPIO MPP( 0, 0x0, 1, 1, 1, 1, 1, 1, 1 )
39#define MPP0_SPI_SCn MPP( 0, 0x2, 0, 1, 1, 1, 1, 1 ) 40#define MPP0_NF_IO2 MPP( 0, 0x1, 1, 1, 1, 1, 1, 1, 1 )
40 41#define MPP0_SPI_SCn MPP( 0, 0x2, 0, 1, 1, 1, 1, 1, 1 )
41#define MPP1_GPO MPP( 1, 0x0, 0, 1, 1, 1, 1, 1 ) 42
42#define MPP1_NF_IO3 MPP( 1, 0x1, 1, 1, 1, 1, 1, 1 ) 43#define MPP1_GPO MPP( 1, 0x0, 0, 1, 1, 1, 1, 1, 1 )
43#define MPP1_SPI_MOSI MPP( 1, 0x2, 0, 1, 1, 1, 1, 1 ) 44#define MPP1_NF_IO3 MPP( 1, 0x1, 1, 1, 1, 1, 1, 1, 1 )
44 45#define MPP1_SPI_MOSI MPP( 1, 0x2, 0, 1, 1, 1, 1, 1, 1 )
45#define MPP2_GPO MPP( 2, 0x0, 0, 1, 1, 1, 1, 1 ) 46
46#define MPP2_NF_IO4 MPP( 2, 0x1, 1, 1, 1, 1, 1, 1 ) 47#define MPP2_GPO MPP( 2, 0x0, 0, 1, 1, 1, 1, 1, 1 )
47#define MPP2_SPI_SCK MPP( 2, 0x2, 0, 1, 1, 1, 1, 1 ) 48#define MPP2_NF_IO4 MPP( 2, 0x1, 1, 1, 1, 1, 1, 1, 1 )
48 49#define MPP2_SPI_SCK MPP( 2, 0x2, 0, 1, 1, 1, 1, 1, 1 )
49#define MPP3_GPO MPP( 3, 0x0, 0, 1, 1, 1, 1, 1 ) 50
50#define MPP3_NF_IO5 MPP( 3, 0x1, 1, 1, 1, 1, 1, 1 ) 51#define MPP3_GPO MPP( 3, 0x0, 0, 1, 1, 1, 1, 1, 1 )
51#define MPP3_SPI_MISO MPP( 3, 0x2, 1, 0, 1, 1, 1, 1 ) 52#define MPP3_NF_IO5 MPP( 3, 0x1, 1, 1, 1, 1, 1, 1, 1 )
52 53#define MPP3_SPI_MISO MPP( 3, 0x2, 1, 0, 1, 1, 1, 1, 1 )
53#define MPP4_GPIO MPP( 4, 0x0, 1, 1, 1, 1, 1, 1 ) 54
54#define MPP4_NF_IO6 MPP( 4, 0x1, 1, 1, 1, 1, 1, 1 ) 55#define MPP4_GPIO MPP( 4, 0x0, 1, 1, 1, 1, 1, 1, 1 )
55#define MPP4_UART0_RXD MPP( 4, 0x2, 1, 0, 1, 1, 1, 1 ) 56#define MPP4_NF_IO6 MPP( 4, 0x1, 1, 1, 1, 1, 1, 1, 1 )
56#define MPP4_SATA1_ACTn MPP( 4, 0x5, 0, 1, 0, 0, 1, 1 ) 57#define MPP4_UART0_RXD MPP( 4, 0x2, 1, 0, 1, 1, 1, 1, 1 )
57#define MPP4_PTP_CLK MPP( 4, 0xd, 1, 0, 1, 1, 1, 1 ) 58#define MPP4_SATA1_ACTn MPP( 4, 0x5, 0, 1, 0, 0, 1, 1, 1 )
58 59#define MPP4_LCD_VGA_HSYNC MPP( 4, 0xb, 0, 0, 0, 0, 0, 0, 1 )
59#define MPP5_GPO MPP( 5, 0x0, 0, 1, 1, 1, 1, 1 ) 60#define MPP4_PTP_CLK MPP( 4, 0xd, 1, 0, 1, 1, 1, 1, 0 )
60#define MPP5_NF_IO7 MPP( 5, 0x1, 1, 1, 1, 1, 1, 1 ) 61
61#define MPP5_UART0_TXD MPP( 5, 0x2, 0, 1, 1, 1, 1, 1 ) 62#define MPP5_GPO MPP( 5, 0x0, 0, 1, 1, 1, 1, 1, 1 )
62#define MPP5_PTP_TRIG_GEN MPP( 5, 0x4, 0, 1, 1, 1, 1, 1 ) 63#define MPP5_NF_IO7 MPP( 5, 0x1, 1, 1, 1, 1, 1, 1, 1 )
63#define MPP5_SATA0_ACTn MPP( 5, 0x5, 0, 1, 0, 1, 1, 1 ) 64#define MPP5_UART0_TXD MPP( 5, 0x2, 0, 1, 1, 1, 1, 1, 1 )
64 65#define MPP5_PTP_TRIG_GEN MPP( 5, 0x4, 0, 1, 1, 1, 1, 1, 0 )
65#define MPP6_SYSRST_OUTn MPP( 6, 0x1, 0, 1, 1, 1, 1, 1 ) 66#define MPP5_SATA0_ACTn MPP( 5, 0x5, 0, 1, 0, 1, 1, 1, 1 )
66#define MPP6_SPI_MOSI MPP( 6, 0x2, 0, 1, 1, 1, 1, 1 ) 67#define MPP5_LCD_VGA_VSYNC MPP( 5, 0xb, 0, 0, 0, 0, 0, 0, 1 )
67#define MPP6_PTP_TRIG_GEN MPP( 6, 0x3, 0, 1, 1, 1, 1, 1 ) 68
68 69#define MPP6_SYSRST_OUTn MPP( 6, 0x1, 0, 1, 1, 1, 1, 1, 1 )
69#define MPP7_GPO MPP( 7, 0x0, 0, 1, 1, 1, 1, 1 ) 70#define MPP6_SPI_MOSI MPP( 6, 0x2, 0, 1, 1, 1, 1, 1, 1 )
70#define MPP7_PEX_RST_OUTn MPP( 7, 0x1, 0, 1, 1, 1, 1, 1 ) 71#define MPP6_PTP_TRIG_GEN MPP( 6, 0x3, 0, 1, 1, 1, 1, 1, 0 )
71#define MPP7_SPI_SCn MPP( 7, 0x2, 0, 1, 1, 1, 1, 1 ) 72
72#define MPP7_PTP_TRIG_GEN MPP( 7, 0x3, 0, 1, 1, 1, 1, 1 ) 73#define MPP7_GPO MPP( 7, 0x0, 0, 1, 1, 1, 1, 1, 1 )
73 74#define MPP7_PEX_RST_OUTn MPP( 7, 0x1, 0, 1, 1, 1, 1, 1, 0 )
74#define MPP8_GPIO MPP( 8, 0x0, 1, 1, 1, 1, 1, 1 ) 75#define MPP7_SPI_SCn MPP( 7, 0x2, 0, 1, 1, 1, 1, 1, 1 )
75#define MPP8_TW_SDA MPP( 8, 0x1, 1, 1, 1, 1, 1, 1 ) 76#define MPP7_PTP_TRIG_GEN MPP( 7, 0x3, 0, 1, 1, 1, 1, 1, 0 )
76#define MPP8_UART0_RTS MPP( 8, 0x2, 0, 1, 1, 1, 1, 1 ) 77#define MPP7_LCD_PWM MPP( 7, 0xb, 0, 1, 0, 0, 0, 0, 1 )
77#define MPP8_UART1_RTS MPP( 8, 0x3, 0, 1, 1, 1, 1, 1 ) 78
78#define MPP8_MII0_RXERR MPP( 8, 0x4, 1, 0, 0, 1, 1, 1 ) 79#define MPP8_GPIO MPP( 8, 0x0, 1, 1, 1, 1, 1, 1, 1 )
79#define MPP8_SATA1_PRESENTn MPP( 8, 0x5, 0, 1, 0, 0, 1, 1 ) 80#define MPP8_TW0_SDA MPP( 8, 0x1, 1, 1, 1, 1, 1, 1, 1 )
80#define MPP8_PTP_CLK MPP( 8, 0xc, 1, 0, 1, 1, 1, 1 ) 81#define MPP8_UART0_RTS MPP( 8, 0x2, 0, 1, 1, 1, 1, 1, 1 )
81#define MPP8_MII0_COL MPP( 8, 0xd, 1, 0, 1, 1, 1, 1 ) 82#define MPP8_UART1_RTS MPP( 8, 0x3, 0, 1, 1, 1, 1, 1, 1 )
82 83#define MPP8_MII0_RXERR MPP( 8, 0x4, 1, 0, 0, 1, 1, 1, 1 )
83#define MPP9_GPIO MPP( 9, 0x0, 1, 1, 1, 1, 1, 1 ) 84#define MPP8_SATA1_PRESENTn MPP( 8, 0x5, 0, 1, 0, 0, 1, 1, 1 )
84#define MPP9_TW_SCK MPP( 9, 0x1, 1, 1, 1, 1, 1, 1 ) 85#define MPP8_PTP_CLK MPP( 8, 0xc, 1, 0, 1, 1, 1, 1, 0 )
85#define MPP9_UART0_CTS MPP( 9, 0x2, 1, 0, 1, 1, 1, 1 ) 86#define MPP8_MII0_COL MPP( 8, 0xd, 1, 0, 1, 1, 1, 1, 1 )
86#define MPP9_UART1_CTS MPP( 9, 0x3, 1, 0, 1, 1, 1, 1 ) 87
87#define MPP9_SATA0_PRESENTn MPP( 9, 0x5, 0, 1, 0, 1, 1, 1 ) 88#define MPP9_GPIO MPP( 9, 0x0, 1, 1, 1, 1, 1, 1, 1 )
88#define MPP9_PTP_EVENT_REQ MPP( 9, 0xc, 1, 0, 1, 1, 1, 1 ) 89#define MPP9_TW0_SCK MPP( 9, 0x1, 1, 1, 1, 1, 1, 1, 1 )
89#define MPP9_MII0_CRS MPP( 9, 0xd, 1, 0, 1, 1, 1, 1 ) 90#define MPP9_UART0_CTS MPP( 9, 0x2, 1, 0, 1, 1, 1, 1, 1 )
90 91#define MPP9_UART1_CTS MPP( 9, 0x3, 1, 0, 1, 1, 1, 1, 1 )
91#define MPP10_GPO MPP( 10, 0x0, 0, 1, 1, 1, 1, 1 ) 92#define MPP9_SATA0_PRESENTn MPP( 9, 0x5, 0, 1, 0, 1, 1, 1, 1 )
92#define MPP10_SPI_SCK MPP( 10, 0x2, 0, 1, 1, 1, 1, 1 ) 93#define MPP9_PTP_EVENT_REQ MPP( 9, 0xc, 1, 0, 1, 1, 1, 1, 0 )
93#define MPP10_UART0_TXD MPP( 10, 0X3, 0, 1, 1, 1, 1, 1 ) 94#define MPP9_MII0_CRS MPP( 9, 0xd, 1, 0, 1, 1, 1, 1, 1 )
94#define MPP10_SATA1_ACTn MPP( 10, 0x5, 0, 1, 0, 0, 1, 1 ) 95
95#define MPP10_PTP_TRIG_GEN MPP( 10, 0xc, 0, 1, 1, 1, 1, 1 ) 96#define MPP10_GPO MPP( 10, 0x0, 0, 1, 1, 1, 1, 1, 1 )
96 97#define MPP10_SPI_SCK MPP( 10, 0x2, 0, 1, 1, 1, 1, 1, 1 )
97#define MPP11_GPIO MPP( 11, 0x0, 1, 1, 1, 1, 1, 1 ) 98#define MPP10_UART0_TXD MPP( 10, 0X3, 0, 1, 1, 1, 1, 1, 1 )
98#define MPP11_SPI_MISO MPP( 11, 0x2, 1, 0, 1, 1, 1, 1 ) 99#define MPP10_SATA1_ACTn MPP( 10, 0x5, 0, 1, 0, 0, 1, 1, 1 )
99#define MPP11_UART0_RXD MPP( 11, 0x3, 1, 0, 1, 1, 1, 1 ) 100#define MPP10_PTP_TRIG_GEN MPP( 10, 0xc, 0, 1, 1, 1, 1, 1, 0 )
100#define MPP11_PTP_EVENT_REQ MPP( 11, 0x4, 1, 0, 1, 1, 1, 1 ) 101
101#define MPP11_PTP_TRIG_GEN MPP( 11, 0xc, 0, 1, 1, 1, 1, 1 ) 102#define MPP11_GPIO MPP( 11, 0x0, 1, 1, 1, 1, 1, 1, 1 )
102#define MPP11_PTP_CLK MPP( 11, 0xd, 1, 0, 1, 1, 1, 1 ) 103#define MPP11_SPI_MISO MPP( 11, 0x2, 1, 0, 1, 1, 1, 1, 1 )
103#define MPP11_SATA0_ACTn MPP( 11, 0x5, 0, 1, 0, 1, 1, 1 ) 104#define MPP11_UART0_RXD MPP( 11, 0x3, 1, 0, 1, 1, 1, 1, 1 )
104 105#define MPP11_PTP_EVENT_REQ MPP( 11, 0x4, 1, 0, 1, 1, 1, 1, 0 )
105#define MPP12_GPO MPP( 12, 0x0, 0, 1, 1, 1, 1, 1 ) 106#define MPP11_PTP_TRIG_GEN MPP( 11, 0xc, 0, 1, 1, 1, 1, 1, 0 )
106#define MPP12_SD_CLK MPP( 12, 0x1, 0, 1, 1, 1, 1, 1 ) 107#define MPP11_PTP_CLK MPP( 11, 0xd, 1, 0, 1, 1, 1, 1, 0 )
107 108#define MPP11_SATA0_ACTn MPP( 11, 0x5, 0, 1, 0, 1, 1, 1, 1 )
108#define MPP13_GPIO MPP( 13, 0x0, 1, 1, 1, 1, 1, 1 ) 109
109#define MPP13_SD_CMD MPP( 13, 0x1, 1, 1, 1, 1, 1, 1 ) 110#define MPP12_GPO MPP( 12, 0x0, 0, 1, 1, 1, 1, 1, 1 )
110#define MPP13_UART1_TXD MPP( 13, 0x3, 0, 1, 1, 1, 1, 1 ) 111#define MPP12_SD_CLK MPP( 12, 0x1, 0, 1, 1, 1, 1, 1, 1 )
111 112#define MPP12_AU_SPDIF0 MPP( 12, 0xa, 0, 1, 0, 0, 0, 0, 1 )
112#define MPP14_GPIO MPP( 14, 0x0, 1, 1, 1, 1, 1, 1 ) 113#define MPP12_SPI_MOSI MPP( 12, 0xb, 0, 1, 0, 0, 0, 0, 1 )
113#define MPP14_SD_D0 MPP( 14, 0x1, 1, 1, 1, 1, 1, 1 ) 114#define MPP12_TW1_SDA MPP( 12, 0xd, 1, 0, 0, 0, 0, 0, 1 )
114#define MPP14_UART1_RXD MPP( 14, 0x3, 1, 0, 1, 1, 1, 1 ) 115
115#define MPP14_SATA1_PRESENTn MPP( 14, 0x4, 0, 1, 0, 0, 1, 1 ) 116#define MPP13_GPIO MPP( 13, 0x0, 1, 1, 1, 1, 1, 1, 1 )
116#define MPP14_MII0_COL MPP( 14, 0xd, 1, 0, 1, 1, 1, 1 ) 117#define MPP13_SD_CMD MPP( 13, 0x1, 1, 1, 1, 1, 1, 1, 1 )
117 118#define MPP13_UART1_TXD MPP( 13, 0x3, 0, 1, 1, 1, 1, 1, 1 )
118#define MPP15_GPIO MPP( 15, 0x0, 1, 1, 1, 1, 1, 1 ) 119#define MPP13_AU_SPDIFRMCLK MPP( 13, 0xa, 0, 1, 0, 0, 0, 0, 1 )
119#define MPP15_SD_D1 MPP( 15, 0x1, 1, 1, 1, 1, 1, 1 ) 120#define MPP13_LCDPWM MPP( 13, 0xb, 0, 1, 0, 0, 0, 0, 1 )
120#define MPP15_UART0_RTS MPP( 15, 0x2, 0, 1, 1, 1, 1, 1 ) 121
121#define MPP15_UART1_TXD MPP( 15, 0x3, 0, 1, 1, 1, 1, 1 ) 122#define MPP14_GPIO MPP( 14, 0x0, 1, 1, 1, 1, 1, 1, 1 )
122#define MPP15_SATA0_ACTn MPP( 15, 0x4, 0, 1, 0, 1, 1, 1 ) 123#define MPP14_SD_D0 MPP( 14, 0x1, 1, 1, 1, 1, 1, 1, 1 )
123 124#define MPP14_UART1_RXD MPP( 14, 0x3, 1, 0, 1, 1, 1, 1, 1 )
124#define MPP16_GPIO MPP( 16, 0x0, 1, 1, 1, 1, 1, 1 ) 125#define MPP14_SATA1_PRESENTn MPP( 14, 0x4, 0, 1, 0, 0, 1, 1, 1 )
125#define MPP16_SD_D2 MPP( 16, 0x1, 1, 1, 1, 1, 1, 1 ) 126#define MPP14_AU_SPDIFI MPP( 14, 0xa, 1, 0, 0, 0, 0, 0, 1 )
126#define MPP16_UART0_CTS MPP( 16, 0x2, 1, 0, 1, 1, 1, 1 ) 127#define MPP14_AU_I2SDI MPP( 14, 0xb, 1, 0, 0, 0, 0, 0, 1 )
127#define MPP16_UART1_RXD MPP( 16, 0x3, 1, 0, 1, 1, 1, 1 ) 128#define MPP14_MII0_COL MPP( 14, 0xd, 1, 0, 1, 1, 1, 1, 1 )
128#define MPP16_SATA1_ACTn MPP( 16, 0x4, 0, 1, 0, 0, 1, 1 ) 129
129#define MPP16_MII0_CRS MPP( 16, 0xd, 1, 0, 1, 1, 1, 1 ) 130#define MPP15_GPIO MPP( 15, 0x0, 1, 1, 1, 1, 1, 1, 1 )
130 131#define MPP15_SD_D1 MPP( 15, 0x1, 1, 1, 1, 1, 1, 1, 1 )
131#define MPP17_GPIO MPP( 17, 0x0, 1, 1, 1, 1, 1, 1 ) 132#define MPP15_UART0_RTS MPP( 15, 0x2, 0, 1, 1, 1, 1, 1, 1 )
132#define MPP17_SD_D3 MPP( 17, 0x1, 1, 1, 1, 1, 1, 1 ) 133#define MPP15_UART1_TXD MPP( 15, 0x3, 0, 1, 1, 1, 1, 1, 1 )
133#define MPP17_SATA0_PRESENTn MPP( 17, 0x4, 0, 1, 0, 1, 1, 1 ) 134#define MPP15_SATA0_ACTn MPP( 15, 0x4, 0, 1, 0, 1, 1, 1, 1 )
134 135#define MPP15_SPI_CSn MPP( 15, 0xb, 0, 1, 0, 0, 0, 0, 1 )
135#define MPP18_GPO MPP( 18, 0x0, 0, 1, 1, 1, 1, 1 ) 136
136#define MPP18_NF_IO0 MPP( 18, 0x1, 1, 1, 1, 1, 1, 1 ) 137#define MPP16_GPIO MPP( 16, 0x0, 1, 1, 1, 1, 1, 1, 1 )
137 138#define MPP16_SD_D2 MPP( 16, 0x1, 1, 1, 1, 1, 1, 1, 1 )
138#define MPP19_GPO MPP( 19, 0x0, 0, 1, 1, 1, 1, 1 ) 139#define MPP16_UART0_CTS MPP( 16, 0x2, 1, 0, 1, 1, 1, 1, 1 )
139#define MPP19_NF_IO1 MPP( 19, 0x1, 1, 1, 1, 1, 1, 1 ) 140#define MPP16_UART1_RXD MPP( 16, 0x3, 1, 0, 1, 1, 1, 1, 1 )
140 141#define MPP16_SATA1_ACTn MPP( 16, 0x4, 0, 1, 0, 0, 1, 1, 1 )
141#define MPP20_GPIO MPP( 20, 0x0, 1, 1, 0, 1, 1, 1 ) 142#define MPP16_LCD_EXT_REF_CLK MPP( 16, 0xb, 1, 0, 0, 0, 0, 0, 1 )
142#define MPP20_TSMP0 MPP( 20, 0x1, 1, 1, 0, 0, 1, 1 ) 143#define MPP16_MII0_CRS MPP( 16, 0xd, 1, 0, 1, 1, 1, 1, 1 )
143#define MPP20_TDM_CH0_TX_QL MPP( 20, 0x2, 0, 1, 0, 0, 1, 1 ) 144
144#define MPP20_GE1_0 MPP( 20, 0x3, 0, 0, 0, 1, 1, 1 ) 145#define MPP17_GPIO MPP( 17, 0x0, 1, 1, 1, 1, 1, 1, 1 )
145#define MPP20_AUDIO_SPDIFI MPP( 20, 0x4, 1, 0, 0, 0, 1, 1 ) 146#define MPP17_SD_D3 MPP( 17, 0x1, 1, 1, 1, 1, 1, 1, 1 )
146#define MPP20_SATA1_ACTn MPP( 20, 0x5, 0, 1, 0, 0, 1, 1 ) 147#define MPP17_SATA0_PRESENTn MPP( 17, 0x4, 0, 1, 0, 1, 1, 1, 1 )
147 148#define MPP17_SATA1_ACTn MPP( 17, 0xa, 0, 1, 0, 0, 0, 0, 1 )
148#define MPP21_GPIO MPP( 21, 0x0, 1, 1, 0, 1, 1, 1 ) 149#define MPP17_TW1_SCK MPP( 17, 0xd, 1, 1, 0, 0, 0, 0, 1 )
149#define MPP21_TSMP1 MPP( 21, 0x1, 1, 1, 0, 0, 1, 1 ) 150
150#define MPP21_TDM_CH0_RX_QL MPP( 21, 0x2, 0, 1, 0, 0, 1, 1 ) 151#define MPP18_GPO MPP( 18, 0x0, 0, 1, 1, 1, 1, 1, 1 )
151#define MPP21_GE1_1 MPP( 21, 0x3, 0, 0, 0, 1, 1, 1 ) 152#define MPP18_NF_IO0 MPP( 18, 0x1, 1, 1, 1, 1, 1, 1, 1 )
152#define MPP21_AUDIO_SPDIFO MPP( 21, 0x4, 0, 1, 0, 0, 1, 1 ) 153#define MPP18_PEX0_CLKREQ MPP( 18, 0x2, 0, 1, 0, 0, 0, 0, 1 )
153#define MPP21_SATA0_ACTn MPP( 21, 0x5, 0, 1, 0, 1, 1, 1 ) 154
154 155#define MPP19_GPO MPP( 19, 0x0, 0, 1, 1, 1, 1, 1, 1 )
155#define MPP22_GPIO MPP( 22, 0x0, 1, 1, 0, 1, 1, 1 ) 156#define MPP19_NF_IO1 MPP( 19, 0x1, 1, 1, 1, 1, 1, 1, 1 )
156#define MPP22_TSMP2 MPP( 22, 0x1, 1, 1, 0, 0, 1, 1 ) 157
157#define MPP22_TDM_CH2_TX_QL MPP( 22, 0x2, 0, 1, 0, 0, 1, 1 ) 158#define MPP20_GPIO MPP( 20, 0x0, 1, 1, 0, 1, 1, 1, 1 )
158#define MPP22_GE1_2 MPP( 22, 0x3, 0, 0, 0, 1, 1, 1 ) 159#define MPP20_TSMP0 MPP( 20, 0x1, 1, 1, 0, 0, 1, 1, 1 )
159#define MPP22_AUDIO_SPDIFRMKCLK MPP( 22, 0x4, 0, 1, 0, 0, 1, 1 ) 160#define MPP20_TDM_CH0_TX_QL MPP( 20, 0x2, 0, 1, 0, 0, 1, 1, 1 )
160#define MPP22_SATA1_PRESENTn MPP( 22, 0x5, 0, 1, 0, 0, 1, 1 ) 161#define MPP20_GE1_TXD0 MPP( 20, 0x3, 0, 0, 0, 1, 1, 1, 1 )
161 162#define MPP20_AU_SPDIFI MPP( 20, 0x4, 1, 0, 0, 0, 1, 1, 1 )
162#define MPP23_GPIO MPP( 23, 0x0, 1, 1, 0, 1, 1, 1 ) 163#define MPP20_SATA1_ACTn MPP( 20, 0x5, 0, 1, 0, 0, 1, 1, 1 )
163#define MPP23_TSMP3 MPP( 23, 0x1, 1, 1, 0, 0, 1, 1 ) 164#define MPP20_LCD_D0 MPP( 20, 0xb, 0, 0, 0, 0, 0, 0, 1 )
164#define MPP23_TDM_CH2_RX_QL MPP( 23, 0x2, 1, 0, 0, 0, 1, 1 ) 165
165#define MPP23_GE1_3 MPP( 23, 0x3, 0, 0, 0, 1, 1, 1 ) 166#define MPP21_GPIO MPP( 21, 0x0, 1, 1, 0, 1, 1, 1, 1 )
166#define MPP23_AUDIO_I2SBCLK MPP( 23, 0x4, 0, 1, 0, 0, 1, 1 ) 167#define MPP21_TSMP1 MPP( 21, 0x1, 1, 1, 0, 0, 1, 1, 1 )
167#define MPP23_SATA0_PRESENTn MPP( 23, 0x5, 0, 1, 0, 1, 1, 1 ) 168#define MPP21_TDM_CH0_RX_QL MPP( 21, 0x2, 0, 1, 0, 0, 1, 1, 1 )
168 169#define MPP21_GE1_TXD1 MPP( 21, 0x3, 0, 0, 0, 1, 1, 1, 1 )
169#define MPP24_GPIO MPP( 24, 0x0, 1, 1, 0, 1, 1, 1 ) 170#define MPP21_AU_SPDIFO MPP( 21, 0x4, 0, 1, 0, 0, 1, 1, 1 )
170#define MPP24_TSMP4 MPP( 24, 0x1, 1, 1, 0, 0, 1, 1 ) 171#define MPP21_SATA0_ACTn MPP( 21, 0x5, 0, 1, 0, 1, 1, 1, 1 )
171#define MPP24_TDM_SPI_CS0 DEV( 24, 0x2, 0, 1, 0, 0, 1, 1 ) 172#define MPP21_LCD_D1 MPP( 21, 0xb, 0, 0, 0, 0, 0, 0, 1 )
172#define MPP24_GE1_4 MPP( 24, 0x3, 0, 0, 0, 1, 1, 1 ) 173
173#define MPP24_AUDIO_I2SDO MPP( 24, 0x4, 0, 1, 0, 0, 1, 1 ) 174#define MPP22_GPIO MPP( 22, 0x0, 1, 1, 0, 1, 1, 1, 1 )
174 175#define MPP22_TSMP2 MPP( 22, 0x1, 1, 1, 0, 0, 1, 1, 1 )
175#define MPP25_GPIO MPP( 25, 0x0, 1, 1, 0, 1, 1, 1 ) 176#define MPP22_TDM_CH2_TX_QL MPP( 22, 0x2, 0, 1, 0, 0, 1, 1, 1 )
176#define MPP25_TSMP5 MPP( 25, 0x1, 1, 1, 0, 0, 1, 1 ) 177#define MPP22_GE1_TXD2 MPP( 22, 0x3, 0, 0, 0, 1, 1, 1, 1 )
177#define MPP25_TDM_SPI_SCK MPP( 25, 0x2, 0, 1, 0, 0, 1, 1 ) 178#define MPP22_AU_SPDIFRMKCLK MPP( 22, 0x4, 0, 1, 0, 0, 1, 1, 1 )
178#define MPP25_GE1_5 MPP( 25, 0x3, 0, 0, 0, 1, 1, 1 ) 179#define MPP22_SATA1_PRESENTn MPP( 22, 0x5, 0, 1, 0, 0, 1, 1, 1 )
179#define MPP25_AUDIO_I2SLRCLK MPP( 25, 0x4, 0, 1, 0, 0, 1, 1 ) 180#define MPP22_LCD_D2 MPP( 22, 0xb, 0, 0, 0, 0, 0, 0, 1 )
180 181
181#define MPP26_GPIO MPP( 26, 0x0, 1, 1, 0, 1, 1, 1 ) 182#define MPP23_GPIO MPP( 23, 0x0, 1, 1, 0, 1, 1, 1, 1 )
182#define MPP26_TSMP6 MPP( 26, 0x1, 1, 1, 0, 0, 1, 1 ) 183#define MPP23_TSMP3 MPP( 23, 0x1, 1, 1, 0, 0, 1, 1, 1 )
183#define MPP26_TDM_SPI_MISO MPP( 26, 0x2, 1, 0, 0, 0, 1, 1 ) 184#define MPP23_TDM_CH2_RX_QL MPP( 23, 0x2, 1, 0, 0, 0, 1, 1, 1 )
184#define MPP26_GE1_6 MPP( 26, 0x3, 0, 0, 0, 1, 1, 1 ) 185#define MPP23_GE1_TXD3 MPP( 23, 0x3, 0, 0, 0, 1, 1, 1, 1 )
185#define MPP26_AUDIO_I2SMCLK MPP( 26, 0x4, 0, 1, 0, 0, 1, 1 ) 186#define MPP23_AU_I2SBCLK MPP( 23, 0x4, 0, 1, 0, 0, 1, 1, 1 )
186 187#define MPP23_SATA0_PRESENTn MPP( 23, 0x5, 0, 1, 0, 1, 1, 1, 1 )
187#define MPP27_GPIO MPP( 27, 0x0, 1, 1, 0, 1, 1, 1 ) 188#define MPP23_LCD_D3 MPP( 23, 0xb, 0, 0, 0, 0, 0, 0, 1 )
188#define MPP27_TSMP7 MPP( 27, 0x1, 1, 1, 0, 0, 1, 1 ) 189
189#define MPP27_TDM_SPI_MOSI MPP( 27, 0x2, 0, 1, 0, 0, 1, 1 ) 190#define MPP24_GPIO MPP( 24, 0x0, 1, 1, 0, 1, 1, 1, 1 )
190#define MPP27_GE1_7 MPP( 27, 0x3, 0, 0, 0, 1, 1, 1 ) 191#define MPP24_TSMP4 MPP( 24, 0x1, 1, 1, 0, 0, 1, 1, 1 )
191#define MPP27_AUDIO_I2SDI MPP( 27, 0x4, 1, 0, 0, 0, 1, 1 ) 192#define MPP24_TDM_SPI_CS0 MPP( 24, 0x2, 0, 1, 0, 0, 1, 1, 1 )
192 193#define MPP24_GE1_RXD0 MPP( 24, 0x3, 0, 0, 0, 1, 1, 1, 1 )
193#define MPP28_GPIO MPP( 28, 0x0, 1, 1, 0, 1, 1, 1 ) 194#define MPP24_AU_I2SDO MPP( 24, 0x4, 0, 1, 0, 0, 1, 1, 1 )
194#define MPP28_TSMP8 MPP( 28, 0x1, 1, 1, 0, 0, 1, 1 ) 195#define MPP24_LCD_D4 MPP( 24, 0xb, 0, 0, 0, 0, 0, 0, 1 )
195#define MPP28_TDM_CODEC_INTn MPP( 28, 0x2, 0, 0, 0, 0, 1, 1 ) 196
196#define MPP28_GE1_8 MPP( 28, 0x3, 0, 0, 0, 1, 1, 1 ) 197#define MPP25_GPIO MPP( 25, 0x0, 1, 1, 0, 1, 1, 1, 1 )
197#define MPP28_AUDIO_EXTCLK MPP( 28, 0x4, 1, 0, 0, 0, 1, 1 ) 198#define MPP25_TSMP5 MPP( 25, 0x1, 1, 1, 0, 0, 1, 1, 1 )
198 199#define MPP25_TDM_SPI_SCK MPP( 25, 0x2, 0, 1, 0, 0, 1, 1, 1 )
199#define MPP29_GPIO MPP( 29, 0x0, 1, 1, 0, 1, 1, 1 ) 200#define MPP25_GE1_RXD1 MPP( 25, 0x3, 0, 0, 0, 1, 1, 1, 1 )
200#define MPP29_TSMP9 MPP( 29, 0x1, 1, 1, 0, 0, 1, 1 ) 201#define MPP25_AU_I2SLRCLK MPP( 25, 0x4, 0, 1, 0, 0, 1, 1, 1 )
201#define MPP29_TDM_CODEC_RSTn MPP( 29, 0x2, 0, 0, 0, 0, 1, 1 ) 202#define MPP25_LCD_D5 MPP( 25, 0xb, 0, 0, 0, 0, 0, 0, 1 )
202#define MPP29_GE1_9 MPP( 29, 0x3, 0, 0, 0, 1, 1, 1 ) 203
203 204#define MPP26_GPIO MPP( 26, 0x0, 1, 1, 0, 1, 1, 1, 1 )
204#define MPP30_GPIO MPP( 30, 0x0, 1, 1, 0, 1, 1, 1 ) 205#define MPP26_TSMP6 MPP( 26, 0x1, 1, 1, 0, 0, 1, 1, 1 )
205#define MPP30_TSMP10 MPP( 30, 0x1, 1, 1, 0, 0, 1, 1 ) 206#define MPP26_TDM_SPI_MISO MPP( 26, 0x2, 1, 0, 0, 0, 1, 1, 1 )
206#define MPP30_TDM_PCLK MPP( 30, 0x2, 1, 1, 0, 0, 1, 1 ) 207#define MPP26_GE1_RXD2 MPP( 26, 0x3, 0, 0, 0, 1, 1, 1, 1 )
207#define MPP30_GE1_10 MPP( 30, 0x3, 0, 0, 0, 1, 1, 1 ) 208#define MPP26_AU_I2SMCLK MPP( 26, 0x4, 0, 1, 0, 0, 1, 1, 1 )
208 209#define MPP26_LCD_D6 MPP( 26, 0xb, 0, 0, 0, 0, 0, 0, 1 )
209#define MPP31_GPIO MPP( 31, 0x0, 1, 1, 0, 1, 1, 1 ) 210
210#define MPP31_TSMP11 MPP( 31, 0x1, 1, 1, 0, 0, 1, 1 ) 211#define MPP27_GPIO MPP( 27, 0x0, 1, 1, 0, 1, 1, 1, 1 )
211#define MPP31_TDM_FS MPP( 31, 0x2, 1, 1, 0, 0, 1, 1 ) 212#define MPP27_TSMP7 MPP( 27, 0x1, 1, 1, 0, 0, 1, 1, 1 )
212#define MPP31_GE1_11 MPP( 31, 0x3, 0, 0, 0, 1, 1, 1 ) 213#define MPP27_TDM_SPI_MOSI MPP( 27, 0x2, 0, 1, 0, 0, 1, 1, 1 )
213 214#define MPP27_GE1_RXD3 MPP( 27, 0x3, 0, 0, 0, 1, 1, 1, 1 )
214#define MPP32_GPIO MPP( 32, 0x0, 1, 1, 0, 1, 1, 1 ) 215#define MPP27_AU_I2SDI MPP( 27, 0x4, 1, 0, 0, 0, 1, 1, 1 )
215#define MPP32_TSMP12 MPP( 32, 0x1, 1, 1, 0, 0, 1, 1 ) 216#define MPP27_LCD_D7 MPP( 27, 0xb, 0, 0, 0, 0, 0, 0, 1 )
216#define MPP32_TDM_DRX MPP( 32, 0x2, 1, 0, 0, 0, 1, 1 ) 217
217#define MPP32_GE1_12 MPP( 32, 0x3, 0, 0, 0, 1, 1, 1 ) 218#define MPP28_GPIO MPP( 28, 0x0, 1, 1, 0, 1, 1, 1, 1 )
218 219#define MPP28_TSMP8 MPP( 28, 0x1, 1, 1, 0, 0, 1, 1, 1 )
219#define MPP33_GPIO MPP( 33, 0x0, 1, 1, 0, 1, 1, 1 ) 220#define MPP28_TDM_CODEC_INTn MPP( 28, 0x2, 0, 0, 0, 0, 1, 1, 1 )
220#define MPP33_TDM_DTX MPP( 33, 0x2, 0, 1, 0, 0, 1, 1 ) 221#define MPP28_GE1_COL MPP( 28, 0x3, 0, 0, 0, 1, 1, 1, 1 )
221#define MPP33_GE1_13 MPP( 33, 0x3, 0, 0, 0, 1, 1, 1 ) 222#define MPP28_AU_EXTCLK MPP( 28, 0x4, 1, 0, 0, 0, 1, 1, 1 )
222 223#define MPP28_LCD_D8 MPP( 28, 0xb, 0, 0, 0, 0, 0, 0, 1 )
223#define MPP34_GPIO MPP( 34, 0x0, 1, 1, 0, 1, 1, 1 ) 224
224#define MPP34_TDM_SPI_CS1 MPP( 34, 0x2, 0, 1, 0, 0, 1, 1 ) 225#define MPP29_GPIO MPP( 29, 0x0, 1, 1, 0, 1, 1, 1, 1 )
225#define MPP34_GE1_14 MPP( 34, 0x3, 0, 0, 0, 1, 1, 1 ) 226#define MPP29_TSMP9 MPP( 29, 0x1, 1, 1, 0, 0, 1, 1, 1 )
226 227#define MPP29_TDM_CODEC_RSTn MPP( 29, 0x2, 0, 0, 0, 0, 1, 1, 1 )
227#define MPP35_GPIO MPP( 35, 0x0, 1, 1, 1, 1, 1, 1 ) 228#define MPP29_GE1_TCLK MPP( 29, 0x3, 0, 0, 0, 1, 1, 1, 1 )
228#define MPP35_TDM_CH0_TX_QL MPP( 35, 0x2, 0, 1, 0, 0, 1, 1 ) 229#define MPP29_LCD_D9 MPP( 29, 0xb, 0, 0, 0, 0, 0, 0, 1 )
229#define MPP35_GE1_15 MPP( 35, 0x3, 0, 0, 0, 1, 1, 1 ) 230
230#define MPP35_SATA0_ACTn MPP( 35, 0x5, 0, 1, 0, 1, 1, 1 ) 231#define MPP30_GPIO MPP( 30, 0x0, 1, 1, 0, 1, 1, 1, 1 )
231#define MPP35_MII0_RXERR MPP( 35, 0xc, 1, 0, 1, 1, 1, 1 ) 232#define MPP30_TSMP10 MPP( 30, 0x1, 1, 1, 0, 0, 1, 1, 1 )
232 233#define MPP30_TDM_PCLK MPP( 30, 0x2, 1, 1, 0, 0, 1, 1, 1 )
233#define MPP36_GPIO MPP( 36, 0x0, 1, 1, 1, 0, 0, 1 ) 234#define MPP30_GE1_RXCTL MPP( 30, 0x3, 0, 0, 0, 1, 1, 1, 1 )
234#define MPP36_TSMP0 MPP( 36, 0x1, 1, 1, 0, 0, 0, 1 ) 235#define MPP30_LCD_D10 MPP( 30, 0xb, 0, 0, 0, 0, 0, 0, 1 )
235#define MPP36_TDM_SPI_CS1 MPP( 36, 0x2, 0, 1, 0, 0, 0, 1 ) 236
236#define MPP36_AUDIO_SPDIFI MPP( 36, 0x4, 1, 0, 1, 0, 0, 1 ) 237#define MPP31_GPIO MPP( 31, 0x0, 1, 1, 0, 1, 1, 1, 1 )
237 238#define MPP31_TSMP11 MPP( 31, 0x1, 1, 1, 0, 0, 1, 1, 1 )
238#define MPP37_GPIO MPP( 37, 0x0, 1, 1, 1, 0, 0, 1 ) 239#define MPP31_TDM_FS MPP( 31, 0x2, 1, 1, 0, 0, 1, 1, 1 )
239#define MPP37_TSMP1 MPP( 37, 0x1, 1, 1, 0, 0, 0, 1 ) 240#define MPP31_GE1_RXCLK MPP( 31, 0x3, 0, 0, 0, 1, 1, 1, 1 )
240#define MPP37_TDM_CH2_TX_QL MPP( 37, 0x2, 0, 1, 0, 0, 0, 1 ) 241#define MPP31_LCD_D11 MPP( 31, 0xb, 0, 0, 0, 0, 0, 0, 1 )
241#define MPP37_AUDIO_SPDIFO MPP( 37, 0x4, 0, 1, 1, 0, 0, 1 ) 242
242 243#define MPP32_GPIO MPP( 32, 0x0, 1, 1, 0, 1, 1, 1, 1 )
243#define MPP38_GPIO MPP( 38, 0x0, 1, 1, 1, 0, 0, 1 ) 244#define MPP32_TSMP12 MPP( 32, 0x1, 1, 1, 0, 0, 1, 1, 1 )
244#define MPP38_TSMP2 MPP( 38, 0x1, 1, 1, 0, 0, 0, 1 ) 245#define MPP32_TDM_DRX MPP( 32, 0x2, 1, 0, 0, 0, 1, 1, 1 )
245#define MPP38_TDM_CH2_RX_QL MPP( 38, 0x2, 0, 1, 0, 0, 0, 1 ) 246#define MPP32_GE1_TCLKOUT MPP( 32, 0x3, 0, 0, 0, 1, 1, 1, 1 )
246#define MPP38_AUDIO_SPDIFRMLCLK MPP( 38, 0x4, 0, 1, 1, 0, 0, 1 ) 247#define MPP32_LCD_D12 MPP( 32, 0xb, 0, 0, 0, 0, 0, 0, 1 )
247 248
248#define MPP39_GPIO MPP( 39, 0x0, 1, 1, 1, 0, 0, 1 ) 249#define MPP33_GPO MPP( 33, 0x0, 0, 1, 0, 1, 1, 1, 1 )
249#define MPP39_TSMP3 MPP( 39, 0x1, 1, 1, 0, 0, 0, 1 ) 250#define MPP33_TDM_DTX MPP( 33, 0x2, 0, 1, 0, 0, 1, 1, 1 )
250#define MPP39_TDM_SPI_CS0 MPP( 39, 0x2, 0, 1, 0, 0, 0, 1 ) 251#define MPP33_GE1_TXCTL MPP( 33, 0x3, 0, 0, 0, 1, 1, 1, 1 )
251#define MPP39_AUDIO_I2SBCLK MPP( 39, 0x4, 0, 1, 1, 0, 0, 1 ) 252#define MPP33_LCD_D13 MPP( 33, 0xb, 0, 0, 0, 0, 0, 0, 1 )
252 253
253#define MPP40_GPIO MPP( 40, 0x0, 1, 1, 1, 0, 0, 1 ) 254#define MPP34_GPIO MPP( 34, 0x0, 1, 1, 0, 1, 1, 1, 1 )
254#define MPP40_TSMP4 MPP( 40, 0x1, 1, 1, 0, 0, 0, 1 ) 255#define MPP34_TDM_SPI_CS1 MPP( 34, 0x2, 0, 1, 0, 0, 1, 1, 1 )
255#define MPP40_TDM_SPI_SCK MPP( 40, 0x2, 0, 1, 0, 0, 0, 1 ) 256#define MPP34_GE1_TXEN MPP( 34, 0x3, 0, 0, 0, 1, 1, 1, 1 )
256#define MPP40_AUDIO_I2SDO MPP( 40, 0x4, 0, 1, 1, 0, 0, 1 ) 257#define MPP34_SATA1_ACTn MPP( 34, 0x5, 0, 1, 0, 0, 0, 1, 1 )
257 258#define MPP34_LCD_D14 MPP( 34, 0xb, 0, 0, 0, 0, 0, 0, 1 )
258#define MPP41_GPIO MPP( 41, 0x0, 1, 1, 1, 0, 0, 1 ) 259
259#define MPP41_TSMP5 MPP( 41, 0x1, 1, 1, 0, 0, 0, 1 ) 260#define MPP35_GPIO MPP( 35, 0x0, 1, 1, 1, 1, 1, 1, 1 )
260#define MPP41_TDM_SPI_MISO MPP( 41, 0x2, 1, 0, 0, 0, 0, 1 ) 261#define MPP35_TDM_CH0_TX_QL MPP( 35, 0x2, 0, 1, 0, 0, 1, 1, 1 )
261#define MPP41_AUDIO_I2SLRC MPP( 41, 0x4, 0, 1, 1, 0, 0, 1 ) 262#define MPP35_GE1_RXERR MPP( 35, 0x3, 0, 0, 0, 1, 1, 1, 1 )
262 263#define MPP35_SATA0_ACTn MPP( 35, 0x5, 0, 1, 0, 1, 1, 1, 1 )
263#define MPP42_GPIO MPP( 42, 0x0, 1, 1, 1, 0, 0, 1 ) 264#define MPP35_LCD_D15 MPP( 22, 0xb, 0, 0, 0, 0, 0, 0, 1 )
264#define MPP42_TSMP6 MPP( 42, 0x1, 1, 1, 0, 0, 0, 1 ) 265#define MPP35_MII0_RXERR MPP( 35, 0xc, 1, 0, 1, 1, 1, 1, 1 )
265#define MPP42_TDM_SPI_MOSI MPP( 42, 0x2, 0, 1, 0, 0, 0, 1 ) 266
266#define MPP42_AUDIO_I2SMCLK MPP( 42, 0x4, 0, 1, 1, 0, 0, 1 ) 267#define MPP36_GPIO MPP( 36, 0x0, 1, 1, 1, 0, 0, 1, 1 )
267 268#define MPP36_TSMP0 MPP( 36, 0x1, 1, 1, 0, 0, 0, 1, 1 )
268#define MPP43_GPIO MPP( 43, 0x0, 1, 1, 1, 0, 0, 1 ) 269#define MPP36_TDM_SPI_CS1 MPP( 36, 0x2, 0, 1, 0, 0, 0, 1, 1 )
269#define MPP43_TSMP7 MPP( 43, 0x1, 1, 1, 0, 0, 0, 1 ) 270#define MPP36_AU_SPDIFI MPP( 36, 0x4, 1, 0, 1, 0, 0, 1, 1 )
270#define MPP43_TDM_CODEC_INTn MPP( 43, 0x2, 0, 0, 0, 0, 0, 1 ) 271#define MPP36_TW1_SDA MPP( 36, 0xb, 1, 1, 0, 0, 0, 0, 1 )
271#define MPP43_AUDIO_I2SDI MPP( 43, 0x4, 1, 0, 1, 0, 0, 1 ) 272
272 273#define MPP37_GPIO MPP( 37, 0x0, 1, 1, 1, 0, 0, 1, 1 )
273#define MPP44_GPIO MPP( 44, 0x0, 1, 1, 1, 0, 0, 1 ) 274#define MPP37_TSMP1 MPP( 37, 0x1, 1, 1, 0, 0, 0, 1, 1 )
274#define MPP44_TSMP8 MPP( 44, 0x1, 1, 1, 0, 0, 0, 1 ) 275#define MPP37_TDM_CH2_TX_QL MPP( 37, 0x2, 0, 1, 0, 0, 0, 1, 1 )
275#define MPP44_TDM_CODEC_RSTn MPP( 44, 0x2, 0, 0, 0, 0, 0, 1 ) 276#define MPP37_AU_SPDIFO MPP( 37, 0x4, 0, 1, 1, 0, 0, 1, 1 )
276#define MPP44_AUDIO_EXTCLK MPP( 44, 0x4, 1, 0, 1, 0, 0, 1 ) 277#define MPP37_TW1_SCK MPP( 37, 0xb, 1, 1, 0, 0, 0, 0, 1 )
277 278
278#define MPP45_GPIO MPP( 45, 0x0, 1, 1, 0, 0, 0, 1 ) 279#define MPP38_GPIO MPP( 38, 0x0, 1, 1, 1, 0, 0, 1, 1 )
279#define MPP45_TSMP9 MPP( 45, 0x1, 1, 1, 0, 0, 0, 1 ) 280#define MPP38_TSMP2 MPP( 38, 0x1, 1, 1, 0, 0, 0, 1, 1 )
280#define MPP45_TDM_PCLK MPP( 45, 0x2, 1, 1, 0, 0, 0, 1 ) 281#define MPP38_TDM_CH2_RX_QL MPP( 38, 0x2, 0, 1, 0, 0, 0, 1, 1 )
281 282#define MPP38_AU_SPDIFRMLCLK MPP( 38, 0x4, 0, 1, 1, 0, 0, 1, 1 )
282#define MPP46_GPIO MPP( 46, 0x0, 1, 1, 0, 0, 0, 1 ) 283#define MPP38_LCD_D18 MPP( 38, 0xb, 0, 0, 0, 0, 0, 0, 1 )
283#define MPP46_TSMP10 MPP( 46, 0x1, 1, 1, 0, 0, 0, 1 ) 284
284#define MPP46_TDM_FS MPP( 46, 0x2, 1, 1, 0, 0, 0, 1 ) 285#define MPP39_GPIO MPP( 39, 0x0, 1, 1, 1, 0, 0, 1, 1 )
285 286#define MPP39_TSMP3 MPP( 39, 0x1, 1, 1, 0, 0, 0, 1, 1 )
286#define MPP47_GPIO MPP( 47, 0x0, 1, 1, 0, 0, 0, 1 ) 287#define MPP39_TDM_SPI_CS0 MPP( 39, 0x2, 0, 1, 0, 0, 0, 1, 1 )
287#define MPP47_TSMP11 MPP( 47, 0x1, 1, 1, 0, 0, 0, 1 ) 288#define MPP39_AU_I2SBCLK MPP( 39, 0x4, 0, 1, 1, 0, 0, 1, 1 )
288#define MPP47_TDM_DRX MPP( 47, 0x2, 1, 0, 0, 0, 0, 1 ) 289#define MPP39_LCD_D19 MPP( 39, 0xb, 0, 0, 0, 0, 0, 0, 1 )
289 290
290#define MPP48_GPIO MPP( 48, 0x0, 1, 1, 0, 0, 0, 1 ) 291#define MPP40_GPIO MPP( 40, 0x0, 1, 1, 1, 0, 0, 1, 1 )
291#define MPP48_TSMP12 MPP( 48, 0x1, 1, 1, 0, 0, 0, 1 ) 292#define MPP40_TSMP4 MPP( 40, 0x1, 1, 1, 0, 0, 0, 1, 1 )
292#define MPP48_TDM_DTX MPP( 48, 0x2, 0, 1, 0, 0, 0, 1 ) 293#define MPP40_TDM_SPI_SCK MPP( 40, 0x2, 0, 1, 0, 0, 0, 1, 1 )
293 294#define MPP40_AU_I2SDO MPP( 40, 0x4, 0, 1, 1, 0, 0, 1, 1 )
294#define MPP49_GPIO MPP( 49, 0x0, 1, 1, 0, 0, 0, 1 ) 295#define MPP40_LCD_D20 MPP( 40, 0xb, 0, 0, 0, 0, 0, 0, 1 )
295#define MPP49_TSMP9 MPP( 49, 0x1, 1, 1, 0, 0, 0, 1 ) 296
296#define MPP49_TDM_CH0_RX_QL MPP( 49, 0x2, 0, 1, 0, 0, 0, 1 ) 297#define MPP41_GPIO MPP( 41, 0x0, 1, 1, 1, 0, 0, 1, 1 )
297#define MPP49_PTP_CLK MPP( 49, 0x5, 1, 0, 0, 0, 0, 1 ) 298#define MPP41_TSMP5 MPP( 41, 0x1, 1, 1, 0, 0, 0, 1, 1 )
299#define MPP41_TDM_SPI_MISO MPP( 41, 0x2, 1, 0, 0, 0, 0, 1, 1 )
300#define MPP41_AU_I2SLRCLK MPP( 41, 0x4, 0, 1, 1, 0, 0, 1, 1 )
301#define MPP41_LCD_D21 MPP( 41, 0xb, 0, 0, 0, 0, 0, 0, 1 )
302
303#define MPP42_GPIO MPP( 42, 0x0, 1, 1, 1, 0, 0, 1, 1 )
304#define MPP42_TSMP6 MPP( 42, 0x1, 1, 1, 0, 0, 0, 1, 1 )
305#define MPP42_TDM_SPI_MOSI MPP( 42, 0x2, 0, 1, 0, 0, 0, 1, 1 )
306#define MPP42_AU_I2SMCLK MPP( 42, 0x4, 0, 1, 1, 0, 0, 1, 1 )
307#define MPP42_LCD_D22 MPP( 42, 0xb, 0, 0, 0, 0, 0, 0, 1 )
308
309#define MPP43_GPIO MPP( 43, 0x0, 1, 1, 1, 0, 0, 1, 1 )
310#define MPP43_TSMP7 MPP( 43, 0x1, 1, 1, 0, 0, 0, 1, 1 )
311#define MPP43_TDM_CODEC_INTn MPP( 43, 0x2, 0, 0, 0, 0, 0, 1, 1 )
312#define MPP43_AU_I2SDI MPP( 43, 0x4, 1, 0, 1, 0, 0, 1, 1 )
313#define MPP43_LCD_D23 MPP( 22, 0xb, 0, 0, 0, 0, 0, 0, 1 )
314
315#define MPP44_GPIO MPP( 44, 0x0, 1, 1, 1, 0, 0, 1, 1 )
316#define MPP44_TSMP8 MPP( 44, 0x1, 1, 1, 0, 0, 0, 1, 1 )
317#define MPP44_TDM_CODEC_RSTn MPP( 44, 0x2, 0, 0, 0, 0, 0, 1, 1 )
318#define MPP44_AU_EXTCLK MPP( 44, 0x4, 1, 0, 1, 0, 0, 1, 1 )
319#define MPP44_LCD_CLK MPP( 44, 0xb, 0, 0, 0, 0, 0, 0, 1 )
320
321#define MPP45_GPIO MPP( 45, 0x0, 1, 1, 0, 0, 0, 1, 1 )
322#define MPP45_TSMP9 MPP( 45, 0x1, 1, 1, 0, 0, 0, 1, 1 )
323#define MPP45_TDM_PCLK MPP( 45, 0x2, 1, 1, 0, 0, 0, 1, 1 )
324#define MPP245_LCD_E MPP( 45, 0xb, 0, 0, 0, 0, 0, 0, 1 )
325
326#define MPP46_GPIO MPP( 46, 0x0, 1, 1, 0, 0, 0, 1, 1 )
327#define MPP46_TSMP10 MPP( 46, 0x1, 1, 1, 0, 0, 0, 1, 1 )
328#define MPP46_TDM_FS MPP( 46, 0x2, 1, 1, 0, 0, 0, 1, 1 )
329#define MPP46_LCD_HSYNC MPP( 46, 0xb, 0, 0, 0, 0, 0, 0, 1 )
330
331#define MPP47_GPIO MPP( 47, 0x0, 1, 1, 0, 0, 0, 1, 1 )
332#define MPP47_TSMP11 MPP( 47, 0x1, 1, 1, 0, 0, 0, 1, 1 )
333#define MPP47_TDM_DRX MPP( 47, 0x2, 1, 0, 0, 0, 0, 1, 1 )
334#define MPP47_LCD_VSYNC MPP( 47, 0xb, 0, 0, 0, 0, 0, 0, 1 )
335
336#define MPP48_GPIO MPP( 48, 0x0, 1, 1, 0, 0, 0, 1, 1 )
337#define MPP48_TSMP12 MPP( 48, 0x1, 1, 1, 0, 0, 0, 1, 1 )
338#define MPP48_TDM_DTX MPP( 48, 0x2, 0, 1, 0, 0, 0, 1, 1 )
339#define MPP48_LCD_D16 MPP( 22, 0xb, 0, 0, 0, 0, 0, 0, 1 )
340
341#define MPP49_GPIO MPP( 49, 0x0, 1, 1, 0, 0, 0, 1, 0 )
342#define MPP49_GPO MPP( 49, 0x0, 0, 1, 0, 0, 0, 0, 1 )
343#define MPP49_TSMP9 MPP( 49, 0x1, 1, 1, 0, 0, 0, 1, 0 )
344#define MPP49_TDM_CH0_RX_QL MPP( 49, 0x2, 0, 1, 0, 0, 0, 1, 1 )
345#define MPP49_PTP_CLK MPP( 49, 0x5, 1, 0, 0, 0, 0, 1, 0 )
346#define MPP49_PEX0_CLKREQ MPP( 49, 0xa, 0, 1, 0, 0, 0, 0, 1 )
347#define MPP49_LCD_D17 MPP( 49, 0xb, 0, 0, 0, 0, 0, 0, 1 )
298 348
299#define MPP_MAX 49 349#define MPP_MAX 49
300 350
diff --git a/arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c b/arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c
index 5e6f711b1c67..c6b92b42eb4e 100644
--- a/arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c
+++ b/arch/arm/mach-kirkwood/mv88f6281gtw_ge-setup.c
@@ -155,7 +155,7 @@ static void __init mv88f6281gtw_ge_init(void)
155static int __init mv88f6281gtw_ge_pci_init(void) 155static int __init mv88f6281gtw_ge_pci_init(void)
156{ 156{
157 if (machine_is_mv88f6281gtw_ge()) 157 if (machine_is_mv88f6281gtw_ge())
158 kirkwood_pcie_init(); 158 kirkwood_pcie_init(KW_PCIE0);
159 159
160 return 0; 160 return 0;
161} 161}
diff --git a/arch/arm/mach-kirkwood/netspace_v2-setup.c b/arch/arm/mach-kirkwood/netspace_v2-setup.c
index 3ae158d72681..d26bf324738b 100644
--- a/arch/arm/mach-kirkwood/netspace_v2-setup.c
+++ b/arch/arm/mach-kirkwood/netspace_v2-setup.c
@@ -39,6 +39,7 @@
39#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
40#include <asm/mach/time.h> 40#include <asm/mach/time.h>
41#include <mach/kirkwood.h> 41#include <mach/kirkwood.h>
42#include <mach/leds-ns2.h>
42#include <plat/time.h> 43#include <plat/time.h>
43#include "common.h" 44#include "common.h"
44#include "mpp.h" 45#include "mpp.h"
@@ -126,6 +127,18 @@ static void __init netspace_v2_sata_power_init(void)
126 } 127 }
127 if (err) 128 if (err)
128 pr_err("netspace_v2: failed to setup SATA0 power\n"); 129 pr_err("netspace_v2: failed to setup SATA0 power\n");
130
131 if (machine_is_netspace_max_v2()) {
132 err = gpio_request(NETSPACE_V2_GPIO_SATA1_POWER, "SATA1 power");
133 if (err == 0) {
134 err = gpio_direction_output(
135 NETSPACE_V2_GPIO_SATA1_POWER, 1);
136 if (err)
137 gpio_free(NETSPACE_V2_GPIO_SATA1_POWER);
138 }
139 if (err)
140 pr_err("netspace_v2: failed to setup SATA1 power\n");
141 }
129} 142}
130 143
131/***************************************************************************** 144/*****************************************************************************
@@ -160,36 +173,12 @@ static struct platform_device netspace_v2_gpio_buttons = {
160 * GPIO LEDs 173 * GPIO LEDs
161 ****************************************************************************/ 174 ****************************************************************************/
162 175
163/*
164 * The blue front LED is wired to a CPLD and can blink in relation with the
165 * SATA activity.
166 *
167 * The following array detail the different LED registers and the combination
168 * of their possible values:
169 *
170 * cmd_led | slow_led | /SATA active | LED state
171 * | | |
172 * 1 | 0 | x | off
173 * - | 1 | x | on
174 * 0 | 0 | 1 | on
175 * 0 | 0 | 0 | blink (rate 300ms)
176 */
177
178#define NETSPACE_V2_GPIO_RED_LED 12 176#define NETSPACE_V2_GPIO_RED_LED 12
179#define NETSPACE_V2_GPIO_BLUE_LED_SLOW 29
180#define NETSPACE_V2_GPIO_BLUE_LED_CMD 30
181
182 177
183static struct gpio_led netspace_v2_gpio_led_pins[] = { 178static struct gpio_led netspace_v2_gpio_led_pins[] = {
184 { 179 {
185 .name = "ns_v2:blue:sata", 180 .name = "ns_v2:red:fail",
186 .default_trigger = "default-on", 181 .gpio = NETSPACE_V2_GPIO_RED_LED,
187 .gpio = NETSPACE_V2_GPIO_BLUE_LED_CMD,
188 .active_low = 1,
189 },
190 {
191 .name = "ns_v2:red:fail",
192 .gpio = NETSPACE_V2_GPIO_RED_LED,
193 }, 182 },
194}; 183};
195 184
@@ -206,22 +195,33 @@ static struct platform_device netspace_v2_gpio_leds = {
206 }, 195 },
207}; 196};
208 197
209static void __init netspace_v2_gpio_leds_init(void) 198/*****************************************************************************
210{ 199 * Dual-GPIO CPLD LEDs
211 int err; 200 ****************************************************************************/
212 201
213 /* Configure register slow_led to allow SATA activity LED blinking */ 202#define NETSPACE_V2_GPIO_BLUE_LED_SLOW 29
214 err = gpio_request(NETSPACE_V2_GPIO_BLUE_LED_SLOW, "blue LED slow"); 203#define NETSPACE_V2_GPIO_BLUE_LED_CMD 30
215 if (err == 0) {
216 err = gpio_direction_output(NETSPACE_V2_GPIO_BLUE_LED_SLOW, 0);
217 if (err)
218 gpio_free(NETSPACE_V2_GPIO_BLUE_LED_SLOW);
219 }
220 if (err)
221 pr_err("netspace_v2: failed to configure blue LED slow GPIO\n");
222 204
223 platform_device_register(&netspace_v2_gpio_leds); 205static struct ns2_led netspace_v2_led_pins[] = {
224} 206 {
207 .name = "ns_v2:blue:sata",
208 .cmd = NETSPACE_V2_GPIO_BLUE_LED_CMD,
209 .slow = NETSPACE_V2_GPIO_BLUE_LED_SLOW,
210 },
211};
212
213static struct ns2_led_platform_data netspace_v2_leds_data = {
214 .num_leds = ARRAY_SIZE(netspace_v2_led_pins),
215 .leds = netspace_v2_led_pins,
216};
217
218static struct platform_device netspace_v2_leds = {
219 .name = "leds-ns2",
220 .id = -1,
221 .dev = {
222 .platform_data = &netspace_v2_leds_data,
223 },
224};
225 225
226/***************************************************************************** 226/*****************************************************************************
227 * Timer 227 * Timer
@@ -249,17 +249,21 @@ static unsigned int netspace_v2_mpp_config[] __initdata = {
249 MPP4_NF_IO6, 249 MPP4_NF_IO6,
250 MPP5_NF_IO7, 250 MPP5_NF_IO7,
251 MPP6_SYSRST_OUTn, 251 MPP6_SYSRST_OUTn,
252 MPP8_TW_SDA, 252 MPP7_GPO, /* Fan speed (bit 1) */
253 MPP9_TW_SCK, 253 MPP8_TW0_SDA,
254 MPP9_TW0_SCK,
254 MPP10_UART0_TXD, 255 MPP10_UART0_TXD,
255 MPP11_UART0_RXD, 256 MPP11_UART0_RXD,
256 MPP12_GPO, /* Red led */ 257 MPP12_GPO, /* Red led */
257 MPP14_GPIO, /* USB fuse */ 258 MPP14_GPIO, /* USB fuse */
258 MPP16_GPIO, /* SATA 0 power */ 259 MPP16_GPIO, /* SATA 0 power */
260 MPP17_GPIO, /* SATA 1 power */
259 MPP18_NF_IO0, 261 MPP18_NF_IO0,
260 MPP19_NF_IO1, 262 MPP19_NF_IO1,
261 MPP20_SATA1_ACTn, 263 MPP20_SATA1_ACTn,
262 MPP21_SATA0_ACTn, 264 MPP21_SATA0_ACTn,
265 MPP22_GPIO, /* Fan speed (bit 0) */
266 MPP23_GPIO, /* Fan power */
263 MPP24_GPIO, /* USB mode select */ 267 MPP24_GPIO, /* USB mode select */
264 MPP25_GPIO, /* Fan rotation fail */ 268 MPP25_GPIO, /* Fan rotation fail */
265 MPP26_GPIO, /* USB device vbus */ 269 MPP26_GPIO, /* USB device vbus */
@@ -268,6 +272,7 @@ static unsigned int netspace_v2_mpp_config[] __initdata = {
268 MPP30_GPIO, /* Blue led (command register) */ 272 MPP30_GPIO, /* Blue led (command register) */
269 MPP31_GPIO, /* Board power off */ 273 MPP31_GPIO, /* Board power off */
270 MPP32_GPIO, /* Power button (0 = Released, 1 = Pushed) */ 274 MPP32_GPIO, /* Power button (0 = Released, 1 = Pushed) */
275 MPP33_GPO, /* Fan speed (bit 2) */
271 0 276 0
272}; 277};
273 278
@@ -299,7 +304,8 @@ static void __init netspace_v2_init(void)
299 i2c_register_board_info(0, netspace_v2_i2c_info, 304 i2c_register_board_info(0, netspace_v2_i2c_info,
300 ARRAY_SIZE(netspace_v2_i2c_info)); 305 ARRAY_SIZE(netspace_v2_i2c_info));
301 306
302 netspace_v2_gpio_leds_init(); 307 platform_device_register(&netspace_v2_leds);
308 platform_device_register(&netspace_v2_gpio_leds);
303 platform_device_register(&netspace_v2_gpio_buttons); 309 platform_device_register(&netspace_v2_gpio_buttons);
304 310
305 if (gpio_request(NETSPACE_V2_GPIO_POWER_OFF, "power-off") == 0 && 311 if (gpio_request(NETSPACE_V2_GPIO_POWER_OFF, "power-off") == 0 &&
@@ -332,3 +338,15 @@ MACHINE_START(INETSPACE_V2, "LaCie Internet Space v2")
332 .timer = &netspace_v2_timer, 338 .timer = &netspace_v2_timer,
333MACHINE_END 339MACHINE_END
334#endif 340#endif
341
342#ifdef CONFIG_MACH_NETSPACE_MAX_V2
343MACHINE_START(NETSPACE_MAX_V2, "LaCie Network Space Max v2")
344 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
345 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
346 .boot_params = 0x00000100,
347 .init_machine = netspace_v2_init,
348 .map_io = kirkwood_map_io,
349 .init_irq = kirkwood_init_irq,
350 .timer = &netspace_v2_timer,
351MACHINE_END
352#endif
diff --git a/arch/arm/mach-kirkwood/netxbig_v2-setup.c b/arch/arm/mach-kirkwood/netxbig_v2-setup.c
index 8a2bb0228e4f..2bd14c5079de 100644
--- a/arch/arm/mach-kirkwood/netxbig_v2-setup.c
+++ b/arch/arm/mach-kirkwood/netxbig_v2-setup.c
@@ -270,8 +270,8 @@ static unsigned int net2big_v2_mpp_config[] __initdata = {
270 MPP3_SPI_MISO, 270 MPP3_SPI_MISO,
271 MPP6_SYSRST_OUTn, 271 MPP6_SYSRST_OUTn,
272 MPP7_GPO, /* Request power-off */ 272 MPP7_GPO, /* Request power-off */
273 MPP8_TW_SDA, 273 MPP8_TW0_SDA,
274 MPP9_TW_SCK, 274 MPP9_TW0_SCK,
275 MPP10_UART0_TXD, 275 MPP10_UART0_TXD,
276 MPP11_UART0_RXD, 276 MPP11_UART0_RXD,
277 MPP13_GPIO, /* Rear power switch (on|auto) */ 277 MPP13_GPIO, /* Rear power switch (on|auto) */
@@ -306,8 +306,8 @@ static unsigned int net5big_v2_mpp_config[] __initdata = {
306 MPP3_SPI_MISO, 306 MPP3_SPI_MISO,
307 MPP6_SYSRST_OUTn, 307 MPP6_SYSRST_OUTn,
308 MPP7_GPO, /* Request power-off */ 308 MPP7_GPO, /* Request power-off */
309 MPP8_TW_SDA, 309 MPP8_TW0_SDA,
310 MPP9_TW_SCK, 310 MPP9_TW0_SCK,
311 MPP10_UART0_TXD, 311 MPP10_UART0_TXD,
312 MPP11_UART0_RXD, 312 MPP11_UART0_RXD,
313 MPP13_GPIO, /* Rear power switch (on|auto) */ 313 MPP13_GPIO, /* Rear power switch (on|auto) */
@@ -315,20 +315,20 @@ static unsigned int net5big_v2_mpp_config[] __initdata = {
315 MPP15_GPIO, /* Rear power switch (auto|off) */ 315 MPP15_GPIO, /* Rear power switch (auto|off) */
316 MPP16_GPIO, /* SATA HDD1 power */ 316 MPP16_GPIO, /* SATA HDD1 power */
317 MPP17_GPIO, /* SATA HDD2 power */ 317 MPP17_GPIO, /* SATA HDD2 power */
318 MPP20_GE1_0, 318 MPP20_GE1_TXD0,
319 MPP21_GE1_1, 319 MPP21_GE1_TXD1,
320 MPP22_GE1_2, 320 MPP22_GE1_TXD2,
321 MPP23_GE1_3, 321 MPP23_GE1_TXD3,
322 MPP24_GE1_4, 322 MPP24_GE1_RXD0,
323 MPP25_GE1_5, 323 MPP25_GE1_RXD1,
324 MPP26_GE1_6, 324 MPP26_GE1_RXD2,
325 MPP27_GE1_7, 325 MPP27_GE1_RXD3,
326 MPP28_GPIO, /* USB enable host vbus */ 326 MPP28_GPIO, /* USB enable host vbus */
327 MPP29_GPIO, /* CPLD extension ALE */ 327 MPP29_GPIO, /* CPLD extension ALE */
328 MPP30_GE1_10, 328 MPP30_GE1_RXCTL,
329 MPP31_GE1_11, 329 MPP31_GE1_RXCLK,
330 MPP32_GE1_12, 330 MPP32_GE1_TCLKOUT,
331 MPP33_GE1_13, 331 MPP33_GE1_TXCTL,
332 MPP34_GPIO, /* Rear Push button */ 332 MPP34_GPIO, /* Rear Push button */
333 MPP35_GPIO, /* Inhibit switch power-off */ 333 MPP35_GPIO, /* Inhibit switch power-off */
334 MPP36_GPIO, /* SATA HDD1 presence */ 334 MPP36_GPIO, /* SATA HDD1 presence */
diff --git a/arch/arm/mach-kirkwood/openrd-setup.c b/arch/arm/mach-kirkwood/openrd-setup.c
index ad3f1ec33796..fd64cd2b4e0a 100644
--- a/arch/arm/mach-kirkwood/openrd-setup.c
+++ b/arch/arm/mach-kirkwood/openrd-setup.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * arch/arm/mach-kirkwood/openrd-setup.c 2 * arch/arm/mach-kirkwood/openrd-setup.c
3 * 3 *
4 * Marvell OpenRD (Base|Client) Board Setup 4 * Marvell OpenRD (Base|Client|Ultimate) Board Setup
5 * 5 *
6 * This file is licensed under the terms of the GNU General Public 6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any 7 * License version 2. This program is licensed "as is" without any
@@ -73,9 +73,15 @@ static void __init openrd_init(void)
73 73
74 kirkwood_ehci_init(); 74 kirkwood_ehci_init();
75 75
76 if (machine_is_openrd_ultimate()) {
77 openrd_ge00_data.phy_addr = MV643XX_ETH_PHY_ADDR(0);
78 openrd_ge01_data.phy_addr = MV643XX_ETH_PHY_ADDR(1);
79 }
80
76 kirkwood_ge00_init(&openrd_ge00_data); 81 kirkwood_ge00_init(&openrd_ge00_data);
77 if (machine_is_openrd_client()) 82 if (!machine_is_openrd_base())
78 kirkwood_ge01_init(&openrd_ge01_data); 83 kirkwood_ge01_init(&openrd_ge01_data);
84
79 kirkwood_sata_init(&openrd_sata_data); 85 kirkwood_sata_init(&openrd_sata_data);
80 kirkwood_sdio_init(&openrd_mvsdio_data); 86 kirkwood_sdio_init(&openrd_mvsdio_data);
81 87
@@ -84,8 +90,10 @@ static void __init openrd_init(void)
84 90
85static int __init openrd_pci_init(void) 91static int __init openrd_pci_init(void)
86{ 92{
87 if (machine_is_openrd_base() || machine_is_openrd_client()) 93 if (machine_is_openrd_base() ||
88 kirkwood_pcie_init(); 94 machine_is_openrd_client() ||
95 machine_is_openrd_ultimate())
96 kirkwood_pcie_init(KW_PCIE0);
89 97
90 return 0; 98 return 0;
91} 99}
@@ -116,3 +124,16 @@ MACHINE_START(OPENRD_CLIENT, "Marvell OpenRD Client Board")
116 .timer = &kirkwood_timer, 124 .timer = &kirkwood_timer,
117MACHINE_END 125MACHINE_END
118#endif 126#endif
127
128#ifdef CONFIG_MACH_OPENRD_ULTIMATE
129MACHINE_START(OPENRD_ULTIMATE, "Marvell OpenRD Ultimate Board")
130 /* Maintainer: Dhaval Vasa <dhaval.vasa@einfochips.com> */
131 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
132 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
133 .boot_params = 0x00000100,
134 .init_machine = openrd_init,
135 .map_io = kirkwood_map_io,
136 .init_irq = kirkwood_init_irq,
137 .timer = &kirkwood_timer,
138MACHINE_END
139#endif
diff --git a/arch/arm/mach-kirkwood/pcie.c b/arch/arm/mach-kirkwood/pcie.c
index dee1eff50d39..55e7f00836b7 100644
--- a/arch/arm/mach-kirkwood/pcie.c
+++ b/arch/arm/mach-kirkwood/pcie.c
@@ -18,29 +18,43 @@
18#include <mach/bridge-regs.h> 18#include <mach/bridge-regs.h>
19#include "common.h" 19#include "common.h"
20 20
21void __init kirkwood_pcie_id(u32 *dev, u32 *rev)
22{
23 *dev = orion_pcie_dev_id((void __iomem *)PCIE_VIRT_BASE);
24 *rev = orion_pcie_rev((void __iomem *)PCIE_VIRT_BASE);
25}
21 26
22#define PCIE_BASE ((void __iomem *)PCIE_VIRT_BASE) 27struct pcie_port {
28 u8 root_bus_nr;
29 void __iomem *base;
30 spinlock_t conf_lock;
31 int irq;
32 struct resource res[2];
33};
23 34
24void __init kirkwood_pcie_id(u32 *dev, u32 *rev) 35static int pcie_port_map[2];
36static int num_pcie_ports;
37
38static inline struct pcie_port *bus_to_port(struct pci_bus *bus)
25{ 39{
26 *dev = orion_pcie_dev_id(PCIE_BASE); 40 struct pci_sys_data *sys = bus->sysdata;
27 *rev = orion_pcie_rev(PCIE_BASE); 41 return sys->private_data;
28} 42}
29 43
30static int pcie_valid_config(int bus, int dev) 44static int pcie_valid_config(struct pcie_port *pp, int bus, int dev)
31{ 45{
32 /* 46 /*
33 * Don't go out when trying to access -- 47 * Don't go out when trying to access --
34 * 1. nonexisting device on local bus 48 * 1. nonexisting device on local bus
35 * 2. where there's no device connected (no link) 49 * 2. where there's no device connected (no link)
36 */ 50 */
37 if (bus == 0 && dev == 0) 51 if (bus == pp->root_bus_nr && dev == 0)
38 return 1; 52 return 1;
39 53
40 if (!orion_pcie_link_up(PCIE_BASE)) 54 if (!orion_pcie_link_up(pp->base))
41 return 0; 55 return 0;
42 56
43 if (bus == 0 && dev != 1) 57 if (bus == pp->root_bus_nr && dev != 1)
44 return 0; 58 return 0;
45 59
46 return 1; 60 return 1;
@@ -52,22 +66,22 @@ static int pcie_valid_config(int bus, int dev)
52 * and then reading the PCIE_CONF_DATA register. Need to make sure these 66 * and then reading the PCIE_CONF_DATA register. Need to make sure these
53 * transactions are atomic. 67 * transactions are atomic.
54 */ 68 */
55static DEFINE_SPINLOCK(kirkwood_pcie_lock);
56 69
57static int pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where, 70static int pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where,
58 int size, u32 *val) 71 int size, u32 *val)
59{ 72{
73 struct pcie_port *pp = bus_to_port(bus);
60 unsigned long flags; 74 unsigned long flags;
61 int ret; 75 int ret;
62 76
63 if (pcie_valid_config(bus->number, PCI_SLOT(devfn)) == 0) { 77 if (pcie_valid_config(pp, bus->number, PCI_SLOT(devfn)) == 0) {
64 *val = 0xffffffff; 78 *val = 0xffffffff;
65 return PCIBIOS_DEVICE_NOT_FOUND; 79 return PCIBIOS_DEVICE_NOT_FOUND;
66 } 80 }
67 81
68 spin_lock_irqsave(&kirkwood_pcie_lock, flags); 82 spin_lock_irqsave(&pp->conf_lock, flags);
69 ret = orion_pcie_rd_conf(PCIE_BASE, bus, devfn, where, size, val); 83 ret = orion_pcie_rd_conf(pp->base, bus, devfn, where, size, val);
70 spin_unlock_irqrestore(&kirkwood_pcie_lock, flags); 84 spin_unlock_irqrestore(&pp->conf_lock, flags);
71 85
72 return ret; 86 return ret;
73} 87}
@@ -75,15 +89,16 @@ static int pcie_rd_conf(struct pci_bus *bus, u32 devfn, int where,
75static int pcie_wr_conf(struct pci_bus *bus, u32 devfn, 89static int pcie_wr_conf(struct pci_bus *bus, u32 devfn,
76 int where, int size, u32 val) 90 int where, int size, u32 val)
77{ 91{
92 struct pcie_port *pp = bus_to_port(bus);
78 unsigned long flags; 93 unsigned long flags;
79 int ret; 94 int ret;
80 95
81 if (pcie_valid_config(bus->number, PCI_SLOT(devfn)) == 0) 96 if (pcie_valid_config(pp, bus->number, PCI_SLOT(devfn)) == 0)
82 return PCIBIOS_DEVICE_NOT_FOUND; 97 return PCIBIOS_DEVICE_NOT_FOUND;
83 98
84 spin_lock_irqsave(&kirkwood_pcie_lock, flags); 99 spin_lock_irqsave(&pp->conf_lock, flags);
85 ret = orion_pcie_wr_conf(PCIE_BASE, bus, devfn, where, size, val); 100 ret = orion_pcie_wr_conf(pp->base, bus, devfn, where, size, val);
86 spin_unlock_irqrestore(&kirkwood_pcie_lock, flags); 101 spin_unlock_irqrestore(&pp->conf_lock, flags);
87 102
88 return ret; 103 return ret;
89} 104}
@@ -93,50 +108,98 @@ static struct pci_ops pcie_ops = {
93 .write = pcie_wr_conf, 108 .write = pcie_wr_conf,
94}; 109};
95 110
96 111static void __init pcie0_ioresources_init(struct pcie_port *pp)
97static int __init kirkwood_pcie_setup(int nr, struct pci_sys_data *sys)
98{ 112{
99 struct resource *res; 113 pp->base = (void __iomem *)PCIE_VIRT_BASE;
100 extern unsigned int kirkwood_clk_ctrl; 114 pp->irq = IRQ_KIRKWOOD_PCIE;
101 115
102 /* 116 /*
103 * Generic PCIe unit setup. 117 * IORESOURCE_IO
104 */ 118 */
105 orion_pcie_setup(PCIE_BASE, &kirkwood_mbus_dram_info); 119 pp->res[0].name = "PCIe 0 I/O Space";
120 pp->res[0].start = KIRKWOOD_PCIE_IO_PHYS_BASE;
121 pp->res[0].end = pp->res[0].start + KIRKWOOD_PCIE_IO_SIZE - 1;
122 pp->res[0].flags = IORESOURCE_IO;
106 123
107 /* 124 /*
108 * Request resources. 125 * IORESOURCE_MEM
109 */ 126 */
110 res = kzalloc(sizeof(struct resource) * 2, GFP_KERNEL); 127 pp->res[1].name = "PCIe 0 MEM";
111 if (!res) 128 pp->res[1].start = KIRKWOOD_PCIE_MEM_PHYS_BASE;
112 panic("pcie_setup unable to alloc resources"); 129 pp->res[1].end = pp->res[1].start + KIRKWOOD_PCIE_MEM_SIZE - 1;
130 pp->res[1].flags = IORESOURCE_MEM;
131}
132
133static void __init pcie1_ioresources_init(struct pcie_port *pp)
134{
135 pp->base = (void __iomem *)PCIE1_VIRT_BASE;
136 pp->irq = IRQ_KIRKWOOD_PCIE1;
113 137
114 /* 138 /*
115 * IORESOURCE_IO 139 * IORESOURCE_IO
116 */ 140 */
117 res[0].name = "PCIe I/O Space"; 141 pp->res[0].name = "PCIe 1 I/O Space";
118 res[0].flags = IORESOURCE_IO; 142 pp->res[0].start = KIRKWOOD_PCIE1_IO_PHYS_BASE;
119 res[0].start = KIRKWOOD_PCIE_IO_BUS_BASE; 143 pp->res[0].end = pp->res[0].start + KIRKWOOD_PCIE1_IO_SIZE - 1;
120 res[0].end = res[0].start + KIRKWOOD_PCIE_IO_SIZE - 1; 144 pp->res[0].flags = IORESOURCE_IO;
121 if (request_resource(&ioport_resource, &res[0]))
122 panic("Request PCIe IO resource failed\n");
123 sys->resource[0] = &res[0];
124 145
125 /* 146 /*
126 * IORESOURCE_MEM 147 * IORESOURCE_MEM
127 */ 148 */
128 res[1].name = "PCIe Memory Space"; 149 pp->res[1].name = "PCIe 1 MEM";
129 res[1].flags = IORESOURCE_MEM; 150 pp->res[1].start = KIRKWOOD_PCIE1_MEM_PHYS_BASE;
130 res[1].start = KIRKWOOD_PCIE_MEM_BUS_BASE; 151 pp->res[1].end = pp->res[1].start + KIRKWOOD_PCIE1_MEM_SIZE - 1;
131 res[1].end = res[1].start + KIRKWOOD_PCIE_MEM_SIZE - 1; 152 pp->res[1].flags = IORESOURCE_MEM;
132 if (request_resource(&iomem_resource, &res[1])) 153}
133 panic("Request PCIe Memory resource failed\n"); 154
134 sys->resource[1] = &res[1]; 155static int __init kirkwood_pcie_setup(int nr, struct pci_sys_data *sys)
156{
157 extern unsigned int kirkwood_clk_ctrl;
158 struct pcie_port *pp;
159 int index;
135 160
161 if (nr >= num_pcie_ports)
162 return 0;
163
164 index = pcie_port_map[nr];
165 printk(KERN_INFO "PCI: bus%d uses PCIe port %d\n", sys->busnr, index);
166
167 pp = kzalloc(sizeof(*pp), GFP_KERNEL);
168 if (!pp)
169 panic("PCIe: failed to allocate pcie_port data");
170 sys->private_data = pp;
171 pp->root_bus_nr = sys->busnr;
172 spin_lock_init(&pp->conf_lock);
173
174 switch (index) {
175 case 0:
176 kirkwood_clk_ctrl |= CGC_PEX0;
177 pcie0_ioresources_init(pp);
178 break;
179 case 1:
180 kirkwood_clk_ctrl |= CGC_PEX1;
181 pcie1_ioresources_init(pp);
182 break;
183 default:
184 panic("PCIe setup: invalid controller %d", index);
185 }
186
187 if (request_resource(&ioport_resource, &pp->res[0]))
188 panic("Request PCIe%d IO resource failed\n", index);
189 if (request_resource(&iomem_resource, &pp->res[1]))
190 panic("Request PCIe%d Memory resource failed\n", index);
191
192 sys->resource[0] = &pp->res[0];
193 sys->resource[1] = &pp->res[1];
136 sys->resource[2] = NULL; 194 sys->resource[2] = NULL;
137 sys->io_offset = 0; 195 sys->io_offset = 0;
138 196
139 kirkwood_clk_ctrl |= CGC_PEX0; 197 /*
198 * Generic PCIe unit setup.
199 */
200 orion_pcie_set_local_bus_nr(pp->base, sys->busnr);
201
202 orion_pcie_setup(pp->base, &kirkwood_mbus_dram_info);
140 203
141 return 1; 204 return 1;
142} 205}
@@ -163,7 +226,7 @@ kirkwood_pcie_scan_bus(int nr, struct pci_sys_data *sys)
163{ 226{
164 struct pci_bus *bus; 227 struct pci_bus *bus;
165 228
166 if (nr == 0) { 229 if (nr < num_pcie_ports) {
167 bus = pci_scan_bus(sys->busnr, &pcie_ops, sys); 230 bus = pci_scan_bus(sys->busnr, &pcie_ops, sys);
168 } else { 231 } else {
169 bus = NULL; 232 bus = NULL;
@@ -175,18 +238,37 @@ kirkwood_pcie_scan_bus(int nr, struct pci_sys_data *sys)
175 238
176static int __init kirkwood_pcie_map_irq(struct pci_dev *dev, u8 slot, u8 pin) 239static int __init kirkwood_pcie_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
177{ 240{
178 return IRQ_KIRKWOOD_PCIE; 241 struct pcie_port *pp = bus_to_port(dev->bus);
242
243 return pp->irq;
179} 244}
180 245
181static struct hw_pci kirkwood_pci __initdata = { 246static struct hw_pci kirkwood_pci __initdata = {
182 .nr_controllers = 1,
183 .swizzle = pci_std_swizzle, 247 .swizzle = pci_std_swizzle,
184 .setup = kirkwood_pcie_setup, 248 .setup = kirkwood_pcie_setup,
185 .scan = kirkwood_pcie_scan_bus, 249 .scan = kirkwood_pcie_scan_bus,
186 .map_irq = kirkwood_pcie_map_irq, 250 .map_irq = kirkwood_pcie_map_irq,
187}; 251};
188 252
189void __init kirkwood_pcie_init(void) 253static void __init add_pcie_port(int index, unsigned long base)
190{ 254{
255 printk(KERN_INFO "Kirkwood PCIe port %d: ", index);
256
257 if (orion_pcie_link_up((void __iomem *)base)) {
258 printk(KERN_INFO "link up\n");
259 pcie_port_map[num_pcie_ports++] = index;
260 } else
261 printk(KERN_INFO "link down, ignoring\n");
262}
263
264void __init kirkwood_pcie_init(unsigned int portmask)
265{
266 if (portmask & KW_PCIE0)
267 add_pcie_port(0, PCIE_VIRT_BASE);
268
269 if (portmask & KW_PCIE1)
270 add_pcie_port(1, PCIE1_VIRT_BASE);
271
272 kirkwood_pci.nr_controllers = num_pcie_ports;
191 pci_common_init(&kirkwood_pci); 273 pci_common_init(&kirkwood_pci);
192} 274}
diff --git a/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c b/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c
index 3bf6304158f6..c34718c2cfe5 100644
--- a/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c
+++ b/arch/arm/mach-kirkwood/rd88f6192-nas-setup.c
@@ -71,7 +71,7 @@ static void __init rd88f6192_init(void)
71static int __init rd88f6192_pci_init(void) 71static int __init rd88f6192_pci_init(void)
72{ 72{
73 if (machine_is_rd88f6192_nas()) 73 if (machine_is_rd88f6192_nas())
74 kirkwood_pcie_init(); 74 kirkwood_pcie_init(KW_PCIE0);
75 75
76 return 0; 76 return 0;
77} 77}
diff --git a/arch/arm/mach-kirkwood/rd88f6281-setup.c b/arch/arm/mach-kirkwood/rd88f6281-setup.c
index 31708ddbc83e..3d1477135e12 100644
--- a/arch/arm/mach-kirkwood/rd88f6281-setup.c
+++ b/arch/arm/mach-kirkwood/rd88f6281-setup.c
@@ -107,7 +107,7 @@ static void __init rd88f6281_init(void)
107static int __init rd88f6281_pci_init(void) 107static int __init rd88f6281_pci_init(void)
108{ 108{
109 if (machine_is_rd88f6281()) 109 if (machine_is_rd88f6281())
110 kirkwood_pcie_init(); 110 kirkwood_pcie_init(KW_PCIE0);
111 111
112 return 0; 112 return 0;
113} 113}
diff --git a/arch/arm/mach-kirkwood/t5325-setup.c b/arch/arm/mach-kirkwood/t5325-setup.c
new file mode 100644
index 000000000000..d01bf89cedbe
--- /dev/null
+++ b/arch/arm/mach-kirkwood/t5325-setup.c
@@ -0,0 +1,194 @@
1/*
2 *
3 * HP t5325 Thin Client setup
4 *
5 * Copyright (C) 2010 Martin Michlmayr <tbm@cyrius.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#include <linux/kernel.h>
14#include <linux/init.h>
15#include <linux/platform_device.h>
16#include <linux/mtd/physmap.h>
17#include <linux/spi/flash.h>
18#include <linux/spi/spi.h>
19#include <linux/spi/orion_spi.h>
20#include <linux/i2c.h>
21#include <linux/mv643xx_eth.h>
22#include <linux/ata_platform.h>
23#include <linux/gpio.h>
24#include <linux/gpio_keys.h>
25#include <linux/input.h>
26#include <asm/mach-types.h>
27#include <asm/mach/arch.h>
28#include <mach/kirkwood.h>
29#include "common.h"
30#include "mpp.h"
31
32struct mtd_partition hp_t5325_partitions[] = {
33 {
34 .name = "u-boot env",
35 .size = SZ_64K,
36 .offset = SZ_512K + SZ_256K,
37 },
38 {
39 .name = "permanent u-boot env",
40 .size = SZ_64K,
41 .offset = MTDPART_OFS_APPEND,
42 .mask_flags = MTD_WRITEABLE,
43 },
44 {
45 .name = "HP env",
46 .size = SZ_64K,
47 .offset = MTDPART_OFS_APPEND,
48 },
49 {
50 .name = "u-boot",
51 .size = SZ_512K,
52 .offset = 0,
53 .mask_flags = MTD_WRITEABLE,
54 },
55 {
56 .name = "SSD firmware",
57 .size = SZ_256K,
58 .offset = SZ_512K,
59 },
60};
61
62const struct flash_platform_data hp_t5325_flash = {
63 .type = "mx25l8005",
64 .name = "spi_flash",
65 .parts = hp_t5325_partitions,
66 .nr_parts = ARRAY_SIZE(hp_t5325_partitions),
67};
68
69struct spi_board_info __initdata hp_t5325_spi_slave_info[] = {
70 {
71 .modalias = "m25p80",
72 .platform_data = &hp_t5325_flash,
73 .irq = -1,
74 },
75};
76
77static struct mv643xx_eth_platform_data hp_t5325_ge00_data = {
78 .phy_addr = MV643XX_ETH_PHY_ADDR(8),
79};
80
81static struct mv_sata_platform_data hp_t5325_sata_data = {
82 .n_ports = 2,
83};
84
85static struct gpio_keys_button hp_t5325_buttons[] = {
86 {
87 .code = KEY_POWER,
88 .gpio = 45,
89 .desc = "Power",
90 .active_low = 1,
91 },
92};
93
94static struct gpio_keys_platform_data hp_t5325_button_data = {
95 .buttons = hp_t5325_buttons,
96 .nbuttons = ARRAY_SIZE(hp_t5325_buttons),
97};
98
99static struct platform_device hp_t5325_button_device = {
100 .name = "gpio-keys",
101 .id = -1,
102 .num_resources = 0,
103 .dev = {
104 .platform_data = &hp_t5325_button_data,
105 }
106};
107
108static unsigned int hp_t5325_mpp_config[] __initdata = {
109 MPP0_NF_IO2,
110 MPP1_SPI_MOSI,
111 MPP2_SPI_SCK,
112 MPP3_SPI_MISO,
113 MPP4_NF_IO6,
114 MPP5_NF_IO7,
115 MPP6_SYSRST_OUTn,
116 MPP7_SPI_SCn,
117 MPP8_TW0_SDA,
118 MPP9_TW0_SCK,
119 MPP10_UART0_TXD,
120 MPP11_UART0_RXD,
121 MPP12_SD_CLK,
122 MPP13_GPIO,
123 MPP14_GPIO,
124 MPP15_GPIO,
125 MPP16_GPIO,
126 MPP17_GPIO,
127 MPP18_NF_IO0,
128 MPP19_NF_IO1,
129 MPP20_GPIO,
130 MPP21_GPIO,
131 MPP22_GPIO,
132 MPP23_GPIO,
133 MPP32_GPIO,
134 MPP33_GE1_TXCTL,
135 MPP39_AU_I2SBCLK,
136 MPP40_AU_I2SDO,
137 MPP41_AU_I2SLRCLK,
138 MPP42_AU_I2SMCLK,
139 MPP45_GPIO, /* Power button */
140 MPP48_GPIO, /* Board power off */
141 0
142};
143
144#define HP_T5325_GPIO_POWER_OFF 48
145
146static void hp_t5325_power_off(void)
147{
148 gpio_set_value(HP_T5325_GPIO_POWER_OFF, 1);
149}
150
151static void __init hp_t5325_init(void)
152{
153 /*
154 * Basic setup. Needs to be called early.
155 */
156 kirkwood_init();
157 kirkwood_mpp_conf(hp_t5325_mpp_config);
158
159 kirkwood_uart0_init();
160 spi_register_board_info(hp_t5325_spi_slave_info,
161 ARRAY_SIZE(hp_t5325_spi_slave_info));
162 kirkwood_spi_init();
163 kirkwood_i2c_init();
164 kirkwood_ge00_init(&hp_t5325_ge00_data);
165 kirkwood_sata_init(&hp_t5325_sata_data);
166 kirkwood_ehci_init();
167 platform_device_register(&hp_t5325_button_device);
168
169 if (gpio_request(HP_T5325_GPIO_POWER_OFF, "power-off") == 0 &&
170 gpio_direction_output(HP_T5325_GPIO_POWER_OFF, 0) == 0)
171 pm_power_off = hp_t5325_power_off;
172 else
173 pr_err("t5325: failed to configure power-off GPIO\n");
174}
175
176static int __init hp_t5325_pci_init(void)
177{
178 if (machine_is_t5325())
179 kirkwood_pcie_init(KW_PCIE0);
180
181 return 0;
182}
183subsys_initcall(hp_t5325_pci_init);
184
185MACHINE_START(T5325, "HP t5325 Thin Client")
186 /* Maintainer: Martin Michlmayr <tbm@cyrius.com> */
187 .phys_io = KIRKWOOD_REGS_PHYS_BASE,
188 .io_pg_offst = ((KIRKWOOD_REGS_VIRT_BASE) >> 18) & 0xfffc,
189 .boot_params = 0x00000100,
190 .init_machine = hp_t5325_init,
191 .map_io = kirkwood_map_io,
192 .init_irq = kirkwood_init_irq,
193 .timer = &kirkwood_timer,
194MACHINE_END
diff --git a/arch/arm/mach-kirkwood/ts219-setup.c b/arch/arm/mach-kirkwood/ts219-setup.c
index 2830f0fe80e0..a5bd7fde04a9 100644
--- a/arch/arm/mach-kirkwood/ts219-setup.c
+++ b/arch/arm/mach-kirkwood/ts219-setup.c
@@ -74,8 +74,8 @@ static unsigned int qnap_ts219_mpp_config[] __initdata = {
74 MPP3_SPI_MISO, 74 MPP3_SPI_MISO,
75 MPP4_SATA1_ACTn, 75 MPP4_SATA1_ACTn,
76 MPP5_SATA0_ACTn, 76 MPP5_SATA0_ACTn,
77 MPP8_TW_SDA, 77 MPP8_TW0_SDA,
78 MPP9_TW_SCK, 78 MPP9_TW0_SCK,
79 MPP10_UART0_TXD, 79 MPP10_UART0_TXD,
80 MPP11_UART0_RXD, 80 MPP11_UART0_RXD,
81 MPP13_UART1_TXD, /* PIC controller */ 81 MPP13_UART1_TXD, /* PIC controller */
@@ -83,6 +83,7 @@ static unsigned int qnap_ts219_mpp_config[] __initdata = {
83 MPP15_GPIO, /* USB Copy button */ 83 MPP15_GPIO, /* USB Copy button */
84 MPP16_GPIO, /* Reset button */ 84 MPP16_GPIO, /* Reset button */
85 MPP36_GPIO, /* RAM: 0: 256 MB, 1: 512 MB */ 85 MPP36_GPIO, /* RAM: 0: 256 MB, 1: 512 MB */
86 MPP44_GPIO, /* Board ID: 0: TS-11x, 1: TS-21x */
86 0 87 0
87}; 88};
88 89
@@ -110,10 +111,10 @@ static void __init qnap_ts219_init(void)
110 111
111static int __init ts219_pci_init(void) 112static int __init ts219_pci_init(void)
112{ 113{
113 if (machine_is_ts219()) 114 if (machine_is_ts219())
114 kirkwood_pcie_init(); 115 kirkwood_pcie_init(KW_PCIE0);
115 116
116 return 0; 117 return 0;
117} 118}
118subsys_initcall(ts219_pci_init); 119subsys_initcall(ts219_pci_init);
119 120
diff --git a/arch/arm/mach-kirkwood/ts41x-setup.c b/arch/arm/mach-kirkwood/ts41x-setup.c
index de49c2d9e74b..2e14afef07a2 100644
--- a/arch/arm/mach-kirkwood/ts41x-setup.c
+++ b/arch/arm/mach-kirkwood/ts41x-setup.c
@@ -2,7 +2,7 @@
2 * 2 *
3 * QNAP TS-410, TS-410U, TS-419P and TS-419U Turbo NAS Board Setup 3 * QNAP TS-410, TS-410U, TS-419P and TS-419U Turbo NAS Board Setup
4 * 4 *
5 * Copyright (C) 2009 Martin Michlmayr <tbm@cyrius.com> 5 * Copyright (C) 2009-2010 Martin Michlmayr <tbm@cyrius.com>
6 * Copyright (C) 2008 Byron Bradley <byron.bbradley@gmail.com> 6 * Copyright (C) 2008 Byron Bradley <byron.bbradley@gmail.com>
7 * 7 *
8 * This program is free software; you can redistribute it and/or 8 * This program is free software; you can redistribute it and/or
@@ -17,6 +17,7 @@
17#include <linux/i2c.h> 17#include <linux/i2c.h>
18#include <linux/mv643xx_eth.h> 18#include <linux/mv643xx_eth.h>
19#include <linux/ata_platform.h> 19#include <linux/ata_platform.h>
20#include <linux/gpio.h>
20#include <linux/gpio_keys.h> 21#include <linux/gpio_keys.h>
21#include <linux/input.h> 22#include <linux/input.h>
22#include <asm/mach-types.h> 23#include <asm/mach-types.h>
@@ -26,6 +27,8 @@
26#include "mpp.h" 27#include "mpp.h"
27#include "tsx1x-common.h" 28#include "tsx1x-common.h"
28 29
30#define QNAP_TS41X_JUMPER_JP1 45
31
29static struct i2c_board_info __initdata qnap_ts41x_i2c_rtc = { 32static struct i2c_board_info __initdata qnap_ts41x_i2c_rtc = {
30 I2C_BOARD_INFO("s35390a", 0x30), 33 I2C_BOARD_INFO("s35390a", 0x30),
31}; 34};
@@ -78,31 +81,31 @@ static unsigned int qnap_ts41x_mpp_config[] __initdata = {
78 MPP3_SPI_MISO, 81 MPP3_SPI_MISO,
79 MPP6_SYSRST_OUTn, 82 MPP6_SYSRST_OUTn,
80 MPP7_PEX_RST_OUTn, 83 MPP7_PEX_RST_OUTn,
81 MPP8_TW_SDA, 84 MPP8_TW0_SDA,
82 MPP9_TW_SCK, 85 MPP9_TW0_SCK,
83 MPP10_UART0_TXD, 86 MPP10_UART0_TXD,
84 MPP11_UART0_RXD, 87 MPP11_UART0_RXD,
85 MPP13_UART1_TXD, /* PIC controller */ 88 MPP13_UART1_TXD, /* PIC controller */
86 MPP14_UART1_RXD, /* PIC controller */ 89 MPP14_UART1_RXD, /* PIC controller */
87 MPP15_SATA0_ACTn, 90 MPP15_SATA0_ACTn,
88 MPP16_SATA1_ACTn, 91 MPP16_SATA1_ACTn,
89 MPP20_GE1_0, 92 MPP20_GE1_TXD0,
90 MPP21_GE1_1, 93 MPP21_GE1_TXD1,
91 MPP22_GE1_2, 94 MPP22_GE1_TXD2,
92 MPP23_GE1_3, 95 MPP23_GE1_TXD3,
93 MPP24_GE1_4, 96 MPP24_GE1_RXD0,
94 MPP25_GE1_5, 97 MPP25_GE1_RXD1,
95 MPP26_GE1_6, 98 MPP26_GE1_RXD2,
96 MPP27_GE1_7, 99 MPP27_GE1_RXD3,
97 MPP30_GE1_10, 100 MPP30_GE1_RXCTL,
98 MPP31_GE1_11, 101 MPP31_GE1_RXCLK,
99 MPP32_GE1_12, 102 MPP32_GE1_TCLKOUT,
100 MPP33_GE1_13, 103 MPP33_GE1_TXCTL,
101 MPP36_GPIO, /* RAM: 0: 256 MB, 1: 512 MB */ 104 MPP36_GPIO, /* RAM: 0: 256 MB, 1: 512 MB */
102 MPP37_GPIO, /* Reset button */ 105 MPP37_GPIO, /* Reset button */
103 MPP43_GPIO, /* USB Copy button */ 106 MPP43_GPIO, /* USB Copy button */
104 MPP44_GPIO, /* Board ID: 0: TS-419U, 1: TS-419 */ 107 MPP44_GPIO, /* Board ID: 0: TS-419U, 1: TS-419 */
105 MPP45_GPIO, /* JP1: 0: console, 1: LCD */ 108 MPP45_GPIO, /* JP1: 0: LCD, 1: serial console */
106 MPP46_GPIO, /* External SATA HDD1 error indicator */ 109 MPP46_GPIO, /* External SATA HDD1 error indicator */
107 MPP47_GPIO, /* External SATA HDD2 error indicator */ 110 MPP47_GPIO, /* External SATA HDD2 error indicator */
108 MPP48_GPIO, /* External SATA HDD3 error indicator */ 111 MPP48_GPIO, /* External SATA HDD3 error indicator */
@@ -131,12 +134,14 @@ static void __init qnap_ts41x_init(void)
131 134
132 pm_power_off = qnap_tsx1x_power_off; 135 pm_power_off = qnap_tsx1x_power_off;
133 136
137 if (gpio_request(QNAP_TS41X_JUMPER_JP1, "JP1") == 0)
138 gpio_export(QNAP_TS41X_JUMPER_JP1, 0);
134} 139}
135 140
136static int __init ts41x_pci_init(void) 141static int __init ts41x_pci_init(void)
137{ 142{
138 if (machine_is_ts41x()) 143 if (machine_is_ts41x())
139 kirkwood_pcie_init(); 144 kirkwood_pcie_init(KW_PCIE0);
140 145
141 return 0; 146 return 0;
142} 147}
diff --git a/arch/arm/mach-ks8695/pci.c b/arch/arm/mach-ks8695/pci.c
index 78499667eb7b..5fcd082a17f9 100644
--- a/arch/arm/mach-ks8695/pci.c
+++ b/arch/arm/mach-ks8695/pci.c
@@ -268,8 +268,8 @@ static void __init ks8695_pci_preinit(void)
268 __raw_writel(0, KS8695_PCI_VA + KS8695_PIOBAC); 268 __raw_writel(0, KS8695_PCI_VA + KS8695_PIOBAC);
269 269
270 /* hook in fault handlers */ 270 /* hook in fault handlers */
271 hook_fault_code(8, ks8695_pci_fault, SIGBUS, "external abort on non-linefetch"); 271 hook_fault_code(8, ks8695_pci_fault, SIGBUS, 0, "external abort on non-linefetch");
272 hook_fault_code(10, ks8695_pci_fault, SIGBUS, "external abort on non-linefetch"); 272 hook_fault_code(10, ks8695_pci_fault, SIGBUS, 0, "external abort on non-linefetch");
273} 273}
274 274
275static void ks8695_show_pciregs(void) 275static void ks8695_show_pciregs(void)
diff --git a/arch/arm/mach-l7200/Makefile b/arch/arm/mach-l7200/Makefile
deleted file mode 100644
index 4bd8ebd70e7b..000000000000
--- a/arch/arm/mach-l7200/Makefile
+++ /dev/null
@@ -1,11 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4
5# Object file lists.
6
7obj-y := core.o
8obj-m :=
9obj-n :=
10obj- :=
11
diff --git a/arch/arm/mach-l7200/Makefile.boot b/arch/arm/mach-l7200/Makefile.boot
deleted file mode 100644
index 6c72ecbe6b64..000000000000
--- a/arch/arm/mach-l7200/Makefile.boot
+++ /dev/null
@@ -1,2 +0,0 @@
1 zreladdr-y := 0xf0008000
2
diff --git a/arch/arm/mach-l7200/core.c b/arch/arm/mach-l7200/core.c
deleted file mode 100644
index 50d23246d4f0..000000000000
--- a/arch/arm/mach-l7200/core.c
+++ /dev/null
@@ -1,100 +0,0 @@
1/*
2 * linux/arch/arm/mm/mm-lusl7200.c
3 *
4 * Copyright (C) 2000 Steve Hill (sjhill@cotw.com)
5 *
6 * Extra MM routines for L7200 architecture
7 */
8#include <linux/kernel.h>
9#include <linux/init.h>
10#include <linux/irq.h>
11#include <linux/device.h>
12
13#include <asm/types.h>
14#include <asm/irq.h>
15#include <asm/mach-types.h>
16#include <mach/hardware.h>
17#include <asm/page.h>
18
19#include <asm/mach/arch.h>
20#include <asm/mach/map.h>
21#include <asm/mach/irq.h>
22
23/*
24 * IRQ base register
25 */
26#define IRQ_BASE (IO_BASE_2 + 0x1000)
27
28/*
29 * Normal IRQ registers
30 */
31#define IRQ_STATUS (*(volatile unsigned long *) (IRQ_BASE + 0x000))
32#define IRQ_RAWSTATUS (*(volatile unsigned long *) (IRQ_BASE + 0x004))
33#define IRQ_ENABLE (*(volatile unsigned long *) (IRQ_BASE + 0x008))
34#define IRQ_ENABLECLEAR (*(volatile unsigned long *) (IRQ_BASE + 0x00c))
35#define IRQ_SOFT (*(volatile unsigned long *) (IRQ_BASE + 0x010))
36#define IRQ_SOURCESEL (*(volatile unsigned long *) (IRQ_BASE + 0x018))
37
38/*
39 * Fast IRQ registers
40 */
41#define FIQ_STATUS (*(volatile unsigned long *) (IRQ_BASE + 0x100))
42#define FIQ_RAWSTATUS (*(volatile unsigned long *) (IRQ_BASE + 0x104))
43#define FIQ_ENABLE (*(volatile unsigned long *) (IRQ_BASE + 0x108))
44#define FIQ_ENABLECLEAR (*(volatile unsigned long *) (IRQ_BASE + 0x10c))
45#define FIQ_SOFT (*(volatile unsigned long *) (IRQ_BASE + 0x110))
46#define FIQ_SOURCESEL (*(volatile unsigned long *) (IRQ_BASE + 0x118))
47
48static void l7200_mask_irq(unsigned int irq)
49{
50 IRQ_ENABLECLEAR = 1 << irq;
51}
52
53static void l7200_unmask_irq(unsigned int irq)
54{
55 IRQ_ENABLE = 1 << irq;
56}
57
58static struct irq_chip l7200_irq_chip = {
59 .ack = l7200_mask_irq,
60 .mask = l7200_mask_irq,
61 .unmask = l7200_unmask_irq
62};
63
64static void __init l7200_init_irq(void)
65{
66 int irq;
67
68 IRQ_ENABLECLEAR = 0xffffffff; /* clear all interrupt enables */
69 FIQ_ENABLECLEAR = 0xffffffff; /* clear all fast interrupt enables */
70
71 for (irq = 0; irq < NR_IRQS; irq++) {
72 set_irq_chip(irq, &l7200_irq_chip);
73 set_irq_flags(irq, IRQF_VALID);
74 set_irq_handler(irq, handle_level_irq);
75 }
76
77 init_FIQ();
78}
79
80static struct map_desc l7200_io_desc[] __initdata = {
81 { IO_BASE, IO_START, IO_SIZE, MT_DEVICE },
82 { IO_BASE_2, IO_START_2, IO_SIZE_2, MT_DEVICE },
83 { AUX_BASE, AUX_START, AUX_SIZE, MT_DEVICE },
84 { FLASH1_BASE, FLASH1_START, FLASH1_SIZE, MT_DEVICE },
85 { FLASH2_BASE, FLASH2_START, FLASH2_SIZE, MT_DEVICE }
86};
87
88static void __init l7200_map_io(void)
89{
90 iotable_init(l7200_io_desc, ARRAY_SIZE(l7200_io_desc));
91}
92
93MACHINE_START(L7200, "LinkUp Systems L7200")
94 /* Maintainer: Steve Hill / Scott McConnell */
95 .phys_io = 0x80040000,
96 .io_pg_offst = ((0xd0000000) >> 18) & 0xfffc,
97 .map_io = l7200_map_io,
98 .init_irq = l7200_init_irq,
99MACHINE_END
100
diff --git a/arch/arm/mach-l7200/include/mach/aux_reg.h b/arch/arm/mach-l7200/include/mach/aux_reg.h
deleted file mode 100644
index 4671558cdd51..000000000000
--- a/arch/arm/mach-l7200/include/mach/aux_reg.h
+++ /dev/null
@@ -1,28 +0,0 @@
1/*
2 * arch/arm/mach-l7200/include/mach/aux_reg.h
3 *
4 * Copyright (C) 2000 Steve Hill (sjhill@cotw.com)
5 *
6 * Changelog:
7 * 08-02-2000 SJH Created file
8 */
9#ifndef _ASM_ARCH_AUXREG_H
10#define _ASM_ARCH_AUXREG_H
11
12#include <mach/hardware.h>
13
14#define l7200aux_reg *((volatile unsigned int *) (AUX_BASE))
15
16/*
17 * Auxillary register values
18 */
19#define AUX_CLEAR 0x00000000
20#define AUX_DIAG_LED_ON 0x00000002
21#define AUX_RTS_UART1 0x00000004
22#define AUX_DTR_UART1 0x00000008
23#define AUX_KBD_COLUMN_12_HIGH 0x00000010
24#define AUX_KBD_COLUMN_12_OFF 0x00000020
25#define AUX_KBD_COLUMN_13_HIGH 0x00000040
26#define AUX_KBD_COLUMN_13_OFF 0x00000080
27
28#endif
diff --git a/arch/arm/mach-l7200/include/mach/debug-macro.S b/arch/arm/mach-l7200/include/mach/debug-macro.S
deleted file mode 100644
index b69ed344c7c9..000000000000
--- a/arch/arm/mach-l7200/include/mach/debug-macro.S
+++ /dev/null
@@ -1,40 +0,0 @@
1/* arch/arm/mach-l7200/include/mach/debug-macro.S
2 *
3 * Debugging macro include header
4 *
5 * Copyright (C) 1994-1999 Russell King
6 * Moved from linux/arch/arm/kernel/debug.S by Ben Dooks
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 *
12*/
13
14 .equ io_virt, IO_BASE
15 .equ io_phys, IO_START
16
17 .macro addruart, rx, tmp
18 mrc p15, 0, \rx, c1, c0
19 tst \rx, #1 @ MMU enabled?
20 moveq \rx, #io_phys @ physical base address
21 movne \rx, #io_virt @ virtual address
22 add \rx, \rx, #0x00044000 @ UART1
23@ add \rx, \rx, #0x00045000 @ UART2
24 .endm
25
26 .macro senduart,rd,rx
27 str \rd, [\rx, #0x0] @ UARTDR
28 .endm
29
30 .macro waituart,rd,rx
311001: ldr \rd, [\rx, #0x18] @ UARTFLG
32 tst \rd, #1 << 5 @ UARTFLGUTXFF - 1 when full
33 bne 1001b
34 .endm
35
36 .macro busyuart,rd,rx
371001: ldr \rd, [\rx, #0x18] @ UARTFLG
38 tst \rd, #1 << 3 @ UARTFLGUBUSY - 1 when busy
39 bne 1001b
40 .endm
diff --git a/arch/arm/mach-l7200/include/mach/entry-macro.S b/arch/arm/mach-l7200/include/mach/entry-macro.S
deleted file mode 100644
index 1726d91fc1d3..000000000000
--- a/arch/arm/mach-l7200/include/mach/entry-macro.S
+++ /dev/null
@@ -1,35 +0,0 @@
1/*
2 * arch/arm/mach-l7200/include/mach/entry-macro.S
3 *
4 * Low-level IRQ helper macros for L7200-based platforms
5 *
6 * This file is licensed under the terms of the GNU General Public
7 * License version 2. This program is licensed "as is" without any
8 * warranty of any kind, whether express or implied.
9 */
10#include <mach/hardware.h>
11
12 .equ irq_base_addr, IO_BASE_2
13
14 .macro disable_fiq
15 .endm
16
17 .macro get_irqnr_preamble, base, tmp
18 .endm
19
20 .macro arch_ret_to_user, tmp1, tmp2
21 .endm
22
23 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
24 mov \irqstat, #irq_base_addr @ Virt addr IRQ regs
25 add \irqstat, \irqstat, #0x00001000 @ Status reg
26 ldr \irqstat, [\irqstat, #0] @ get interrupts
27 mov \irqnr, #0
281001: tst \irqstat, #1
29 addeq \irqnr, \irqnr, #1
30 moveq \irqstat, \irqstat, lsr #1
31 tsteq \irqnr, #32
32 beq 1001b
33 teq \irqnr, #32
34 .endm
35
diff --git a/arch/arm/mach-l7200/include/mach/gp_timers.h b/arch/arm/mach-l7200/include/mach/gp_timers.h
deleted file mode 100644
index 2b7086a26b81..000000000000
--- a/arch/arm/mach-l7200/include/mach/gp_timers.h
+++ /dev/null
@@ -1,42 +0,0 @@
1/*
2 * arch/arm/mach-l7200/include/mach/gp_timers.h
3 *
4 * Copyright (C) 2000 Steve Hill (sjhill@cotw.com)
5 *
6 * Changelog:
7 * 07-28-2000 SJH Created file
8 * 08-02-2000 SJH Used structure for registers
9 */
10#ifndef _ASM_ARCH_GPTIMERS_H
11#define _ASM_ARCH_GPTIMERS_H
12
13#include <mach/hardware.h>
14
15/*
16 * Layout of L7200 general purpose timer registers
17 */
18struct GPT_Regs {
19 unsigned int TIMERLOAD;
20 unsigned int TIMERVALUE;
21 unsigned int TIMERCONTROL;
22 unsigned int TIMERCLEAR;
23};
24
25#define GPT_BASE (IO_BASE_2 + 0x3000)
26#define l7200_timer1_regs ((volatile struct GPT_Regs *) (GPT_BASE))
27#define l7200_timer2_regs ((volatile struct GPT_Regs *) (GPT_BASE + 0x20))
28
29/*
30 * General register values
31 */
32#define GPT_PRESCALE_1 0x00000000
33#define GPT_PRESCALE_16 0x00000004
34#define GPT_PRESCALE_256 0x00000008
35#define GPT_MODE_FREERUN 0x00000000
36#define GPT_MODE_PERIODIC 0x00000040
37#define GPT_ENABLE 0x00000080
38#define GPT_BZTOG 0x00000100
39#define GPT_BZMOD 0x00000200
40#define GPT_LOAD_MASK 0x0000ffff
41
42#endif
diff --git a/arch/arm/mach-l7200/include/mach/gpio.h b/arch/arm/mach-l7200/include/mach/gpio.h
deleted file mode 100644
index c7b0a5d7b8bb..000000000000
--- a/arch/arm/mach-l7200/include/mach/gpio.h
+++ /dev/null
@@ -1,105 +0,0 @@
1/****************************************************************************/
2/*
3 * arch/arm/mach-l7200/include/mach/gpio.h
4 *
5 * Registers and helper functions for the L7200 Link-Up Systems
6 * GPIO.
7 *
8 * (C) Copyright 2000, S A McConnell (samcconn@cotw.com)
9 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file COPYING in the main directory of this archive for
12 * more details.
13 */
14
15/****************************************************************************/
16
17#define GPIO_OFF 0x00005000 /* Offset from IO_START to the GPIO reg's. */
18
19/* IO_START and IO_BASE are defined in hardware.h */
20
21#define GPIO_START (IO_START_2 + GPIO_OFF) /* Physical addr of the GPIO reg. */
22#define GPIO_BASE (IO_BASE_2 + GPIO_OFF) /* Virtual addr of the GPIO reg. */
23
24/* Offsets from the start of the GPIO for all the registers. */
25#define PADR_OFF 0x000
26#define PADDR_OFF 0x004
27#define PASBSR_OFF 0x008
28#define PAEENR_OFF 0x00c
29#define PAESNR_OFF 0x010
30#define PAESTR_OFF 0x014
31#define PAIMR_OFF 0x018
32#define PAINT_OFF 0x01c
33
34#define PBDR_OFF 0x020
35#define PBDDR_OFF 0x024
36#define PBSBSR_OFF 0x028
37#define PBIMR_OFF 0x038
38#define PBINT_OFF 0x03c
39
40#define PCDR_OFF 0x040
41#define PCDDR_OFF 0x044
42#define PCSBSR_OFF 0x048
43#define PCIMR_OFF 0x058
44#define PCINT_OFF 0x05c
45
46#define PDDR_OFF 0x060
47#define PDDDR_OFF 0x064
48#define PDSBSR_OFF 0x068
49#define PDEENR_OFF 0x06c
50#define PDESNR_OFF 0x070
51#define PDESTR_OFF 0x074
52#define PDIMR_OFF 0x078
53#define PDINT_OFF 0x07c
54
55#define PEDR_OFF 0x080
56#define PEDDR_OFF 0x084
57#define PESBSR_OFF 0x088
58#define PEEENR_OFF 0x08c
59#define PEESNR_OFF 0x090
60#define PEESTR_OFF 0x094
61#define PEIMR_OFF 0x098
62#define PEINT_OFF 0x09c
63
64/* Define the GPIO registers for use by device drivers and the kernel. */
65#define PADR (*(volatile unsigned long *)(GPIO_BASE+PADR_OFF))
66#define PADDR (*(volatile unsigned long *)(GPIO_BASE+PADDR_OFF))
67#define PASBSR (*(volatile unsigned long *)(GPIO_BASE+PASBSR_OFF))
68#define PAEENR (*(volatile unsigned long *)(GPIO_BASE+PAEENR_OFF))
69#define PAESNR (*(volatile unsigned long *)(GPIO_BASE+PAESNR_OFF))
70#define PAESTR (*(volatile unsigned long *)(GPIO_BASE+PAESTR_OFF))
71#define PAIMR (*(volatile unsigned long *)(GPIO_BASE+PAIMR_OFF))
72#define PAINT (*(volatile unsigned long *)(GPIO_BASE+PAINT_OFF))
73
74#define PBDR (*(volatile unsigned long *)(GPIO_BASE+PBDR_OFF))
75#define PBDDR (*(volatile unsigned long *)(GPIO_BASE+PBDDR_OFF))
76#define PBSBSR (*(volatile unsigned long *)(GPIO_BASE+PBSBSR_OFF))
77#define PBIMR (*(volatile unsigned long *)(GPIO_BASE+PBIMR_OFF))
78#define PBINT (*(volatile unsigned long *)(GPIO_BASE+PBINT_OFF))
79
80#define PCDR (*(volatile unsigned long *)(GPIO_BASE+PCDR_OFF))
81#define PCDDR (*(volatile unsigned long *)(GPIO_BASE+PCDDR_OFF))
82#define PCSBSR (*(volatile unsigned long *)(GPIO_BASE+PCSBSR_OFF))
83#define PCIMR (*(volatile unsigned long *)(GPIO_BASE+PCIMR_OFF))
84#define PCINT (*(volatile unsigned long *)(GPIO_BASE+PCINT_OFF))
85
86#define PDDR (*(volatile unsigned long *)(GPIO_BASE+PDDR_OFF))
87#define PDDDR (*(volatile unsigned long *)(GPIO_BASE+PDDDR_OFF))
88#define PDSBSR (*(volatile unsigned long *)(GPIO_BASE+PDSBSR_OFF))
89#define PDEENR (*(volatile unsigned long *)(GPIO_BASE+PDEENR_OFF))
90#define PDESNR (*(volatile unsigned long *)(GPIO_BASE+PDESNR_OFF))
91#define PDESTR (*(volatile unsigned long *)(GPIO_BASE+PDESTR_OFF))
92#define PDIMR (*(volatile unsigned long *)(GPIO_BASE+PDIMR_OFF))
93#define PDINT (*(volatile unsigned long *)(GPIO_BASE+PDINT_OFF))
94
95#define PEDR (*(volatile unsigned long *)(GPIO_BASE+PEDR_OFF))
96#define PEDDR (*(volatile unsigned long *)(GPIO_BASE+PEDDR_OFF))
97#define PESBSR (*(volatile unsigned long *)(GPIO_BASE+PESBSR_OFF))
98#define PEEENR (*(volatile unsigned long *)(GPIO_BASE+PEEENR_OFF))
99#define PEESNR (*(volatile unsigned long *)(GPIO_BASE+PEESNR_OFF))
100#define PEESTR (*(volatile unsigned long *)(GPIO_BASE+PEESTR_OFF))
101#define PEIMR (*(volatile unsigned long *)(GPIO_BASE+PEIMR_OFF))
102#define PEINT (*(volatile unsigned long *)(GPIO_BASE+PEINT_OFF))
103
104#define VEE_EN 0x02
105#define BACKLIGHT_EN 0x04
diff --git a/arch/arm/mach-l7200/include/mach/hardware.h b/arch/arm/mach-l7200/include/mach/hardware.h
deleted file mode 100644
index c31909cfc254..000000000000
--- a/arch/arm/mach-l7200/include/mach/hardware.h
+++ /dev/null
@@ -1,57 +0,0 @@
1/*
2 * arch/arm/mach-l7200/include/mach/hardware.h
3 *
4 * Copyright (C) 2000 Rob Scott (rscott@mtrob.fdns.net)
5 * Steve Hill (sjhill@cotw.com)
6 *
7 * This file contains the hardware definitions for the
8 * LinkUp Systems L7200 SOC development board.
9 *
10 * Changelog:
11 * 02-01-2000 RS Created L7200 version, derived from rpc code
12 * 03-21-2000 SJH Cleaned up file
13 * 04-21-2000 RS Changed mapping of I/O in virtual space
14 * 04-25-2000 SJH Removed unused symbols and such
15 * 05-05-2000 SJH Complete rewrite
16 * 07-31-2000 SJH Added undocumented debug auxillary port to
17 * get at last two columns for keyboard driver
18 */
19#ifndef __ASM_ARCH_HARDWARE_H
20#define __ASM_ARCH_HARDWARE_H
21
22/* Hardware addresses of major areas.
23 * *_START is the physical address
24 * *_SIZE is the size of the region
25 * *_BASE is the virtual address
26 */
27#define RAM_START 0xf0000000
28#define RAM_SIZE 0x02000000
29#define RAM_BASE 0xc0000000
30
31#define IO_START 0x80000000 /* I/O */
32#define IO_SIZE 0x01000000
33#define IO_BASE 0xd0000000
34
35#define IO_START_2 0x90000000 /* I/O */
36#define IO_SIZE_2 0x01000000
37#define IO_BASE_2 0xd1000000
38
39#define AUX_START 0x1a000000 /* AUX PORT */
40#define AUX_SIZE 0x01000000
41#define AUX_BASE 0xd2000000
42
43#define FLASH1_START 0x00000000 /* FLASH BANK 1 */
44#define FLASH1_SIZE 0x01000000
45#define FLASH1_BASE 0xd3000000
46
47#define FLASH2_START 0x10000000 /* FLASH BANK 2 */
48#define FLASH2_SIZE 0x01000000
49#define FLASH2_BASE 0xd4000000
50
51#define ISA_START 0x20000000 /* ISA */
52#define ISA_SIZE 0x20000000
53#define ISA_BASE 0xe0000000
54
55#define PCIO_BASE IO_BASE
56
57#endif
diff --git a/arch/arm/mach-l7200/include/mach/io.h b/arch/arm/mach-l7200/include/mach/io.h
deleted file mode 100644
index a770a89fb708..000000000000
--- a/arch/arm/mach-l7200/include/mach/io.h
+++ /dev/null
@@ -1,21 +0,0 @@
1/*
2 * arch/arm/mach-l7200/include/mach/io.h
3 *
4 * Copyright (C) 2000 Steve Hill (sjhill@cotw.com)
5 *
6 * Changelog:
7 * 03-21-2000 SJH Created from arch/arm/mach-nexuspci/include/mach/io.h
8 * 08-31-2000 SJH Added in IO functions necessary for new drivers
9 */
10#ifndef __ASM_ARM_ARCH_IO_H
11#define __ASM_ARM_ARCH_IO_H
12
13#define IO_SPACE_LIMIT 0xffffffff
14
15/*
16 * There are not real ISA nor PCI buses, so we fake it.
17 */
18#define __io(a) __typesafe_io(a)
19#define __mem_pci(a) (a)
20
21#endif
diff --git a/arch/arm/mach-l7200/include/mach/irqs.h b/arch/arm/mach-l7200/include/mach/irqs.h
deleted file mode 100644
index 7edffd713c5b..000000000000
--- a/arch/arm/mach-l7200/include/mach/irqs.h
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2 * arch/arm/mach-l7200/include/mach/irqs.h
3 *
4 * Copyright (C) 2000 Rob Scott (rscott@mtrob.fdns.net)
5 * Steve Hill (sjhill@cotw.com)
6 *
7 * Changelog:
8 * 01-02-2000 RS Create l7200 version
9 * 03-28-2000 SJH Removed unused interrupt
10 * 07-28-2000 SJH Added pseudo-keyboard interrupt
11 */
12
13/*
14 * NOTE: The second timer (Timer 2) is used as the keyboard
15 * interrupt when the keyboard driver is enabled.
16 */
17
18#define NR_IRQS 32
19
20#define IRQ_STWDOG 0 /* Watchdog timer */
21#define IRQ_PROG 1 /* Programmable interrupt */
22#define IRQ_DEBUG_RX 2 /* Comm Rx debug */
23#define IRQ_DEBUG_TX 3 /* Comm Tx debug */
24#define IRQ_GCTC1 4 /* Timer 1 */
25#define IRQ_GCTC2 5 /* Timer 2 / Keyboard */
26#define IRQ_DMA 6 /* DMA controller */
27#define IRQ_CLCD 7 /* Color LCD controller */
28#define IRQ_SM_RX 8 /* Smart card */
29#define IRQ_SM_TX 9 /* Smart cart */
30#define IRQ_SM_RST 10 /* Smart card */
31#define IRQ_SIB 11 /* Serial Interface Bus */
32#define IRQ_MMC 12 /* MultiMediaCard */
33#define IRQ_SSP1 13 /* Synchronous Serial Port 1 */
34#define IRQ_SSP2 14 /* Synchronous Serial Port 1 */
35#define IRQ_SPI 15 /* SPI slave */
36#define IRQ_UART_1 16 /* UART 1 */
37#define IRQ_UART_2 17 /* UART 2 */
38#define IRQ_IRDA 18 /* IRDA */
39#define IRQ_RTC_TICK 19 /* Real Time Clock tick */
40#define IRQ_RTC_ALARM 20 /* Real Time Clock alarm */
41#define IRQ_GPIO 21 /* General Purpose IO */
42#define IRQ_GPIO_DMA 22 /* General Purpose IO, DMA */
43#define IRQ_M2M 23 /* Memory to memory DMA */
44#define IRQ_RESERVED 24 /* RESERVED, don't use */
45#define IRQ_INTF 25 /* External active low interrupt */
46#define IRQ_INT0 26 /* External active low interrupt */
47#define IRQ_INT1 27 /* External active low interrupt */
48#define IRQ_INT2 28 /* External active low interrupt */
49#define IRQ_UCB1200 29 /* Interrupt generated by UCB1200*/
50#define IRQ_BAT_LO 30 /* Low batery or external power */
51#define IRQ_MEDIA_CHG 31 /* Media change interrupt */
52
53/*
54 * This is the offset of the FIQ "IRQ" numbers
55 */
56#define FIQ_START 64
diff --git a/arch/arm/mach-l7200/include/mach/memory.h b/arch/arm/mach-l7200/include/mach/memory.h
deleted file mode 100644
index 9fb40ed2f03b..000000000000
--- a/arch/arm/mach-l7200/include/mach/memory.h
+++ /dev/null
@@ -1,26 +0,0 @@
1/*
2 * arch/arm/mach-l7200/include/mach/memory.h
3 *
4 * Copyright (c) 2000 Steve Hill (sjhill@cotw.com)
5 * Copyright (c) 2000 Rob Scott (rscott@mtrob.fdns.net)
6 *
7 * Changelog:
8 * 03-13-2000 SJH Created
9 * 04-13-2000 RS Changed bus macros for new addr
10 * 05-03-2000 SJH Removed bus macros and fixed virt_to_phys macro
11 */
12#ifndef __ASM_ARCH_MEMORY_H
13#define __ASM_ARCH_MEMORY_H
14
15/*
16 * Physical DRAM offset on the L7200 SDB.
17 */
18#define PHYS_OFFSET UL(0xf0000000)
19
20/*
21 * Cache flushing area - ROM
22 */
23#define FLUSH_BASE_PHYS 0x40000000
24#define FLUSH_BASE 0xdf000000
25
26#endif
diff --git a/arch/arm/mach-l7200/include/mach/pmpcon.h b/arch/arm/mach-l7200/include/mach/pmpcon.h
deleted file mode 100644
index 3959871e8361..000000000000
--- a/arch/arm/mach-l7200/include/mach/pmpcon.h
+++ /dev/null
@@ -1,46 +0,0 @@
1/****************************************************************************/
2/*
3 * arch/arm/mach-l7200/include/mach/pmpcon.h
4 *
5 * Registers and helper functions for the L7200 Link-Up Systems
6 * DC/DC converter register.
7 *
8 * (C) Copyright 2000, S A McConnell (samcconn@cotw.com)
9 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file COPYING in the main directory of this archive for
12 * more details.
13 */
14
15/****************************************************************************/
16
17#define PMPCON_OFF 0x00006000 /* Offset from IO_START_2. */
18
19/* IO_START_2 and IO_BASE_2 are defined in hardware.h */
20
21#define PMPCON_START (IO_START_2 + PMPCON_OFF) /* Physical address of reg. */
22#define PMPCON_BASE (IO_BASE_2 + PMPCON_OFF) /* Virtual address of reg. */
23
24
25#define PMPCON (*(volatile unsigned int *)(PMPCON_BASE))
26
27#define PWM2_50CYCLE 0x800
28#define CONTRAST 0x9
29
30#define PWM1H (CONTRAST)
31#define PWM1L (CONTRAST << 4)
32
33#define PMPCON_VALUE (PWM2_50CYCLE | PWM1L | PWM1H)
34
35/* PMPCON = 0x811; // too light and fuzzy
36 * PMPCON = 0x844;
37 * PMPCON = 0x866; // better color poor depth
38 * PMPCON = 0x888; // Darker but better depth
39 * PMPCON = 0x899; // Darker even better depth
40 * PMPCON = 0x8aa; // too dark even better depth
41 * PMPCON = 0X8cc; // Way too dark
42 */
43
44/* As CONTRAST value increases the greater the depth perception and
45 * the darker the colors.
46 */
diff --git a/arch/arm/mach-l7200/include/mach/pmu.h b/arch/arm/mach-l7200/include/mach/pmu.h
deleted file mode 100644
index a2da7aedf208..000000000000
--- a/arch/arm/mach-l7200/include/mach/pmu.h
+++ /dev/null
@@ -1,125 +0,0 @@
1/****************************************************************************/
2/*
3 * arch/arm/mach-l7200/include/mach/pmu.h
4 *
5 * Registers and helper functions for the L7200 Link-Up Systems
6 * Power Management Unit (PMU).
7 *
8 * (C) Copyright 2000, S A McConnell (samcconn@cotw.com)
9 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file COPYING in the main directory of this archive for
12 * more details.
13 */
14
15/****************************************************************************/
16
17#define PMU_OFF 0x00050000 /* Offset from IO_START to the PMU registers. */
18
19/* IO_START and IO_BASE are defined in hardware.h */
20
21#define PMU_START (IO_START + PMU_OFF) /* Physical addr. of the PMU reg. */
22#define PMU_BASE (IO_BASE + PMU_OFF) /* Virtual addr. of the PMU reg. */
23
24
25/* Define the PMU registers for use by device drivers and the kernel. */
26
27typedef struct {
28 unsigned int CURRENT; /* Current configuration register */
29 unsigned int NEXT; /* Next configuration register */
30 unsigned int reserved;
31 unsigned int RUN; /* Run configuration register */
32 unsigned int COMM; /* Configuration command register */
33 unsigned int SDRAM; /* SDRAM configuration bypass register */
34} pmu_interface;
35
36#define PMU ((volatile pmu_interface *)(PMU_BASE))
37
38
39/* Macro's for reading the common register fields. */
40
41#define GET_TRANSOP(reg) ((reg >> 25) & 0x03) /* Bits 26-25 */
42#define GET_OSCEN(reg) ((reg >> 16) & 0x01)
43#define GET_OSCMUX(reg) ((reg >> 15) & 0x01)
44#define GET_PLLMUL(reg) ((reg >> 9) & 0x3f) /* Bits 14-9 */
45#define GET_PLLEN(reg) ((reg >> 8) & 0x01)
46#define GET_PLLMUX(reg) ((reg >> 7) & 0x01)
47#define GET_BCLK_DIV(reg) ((reg >> 3) & 0x03) /* Bits 4-3 */
48#define GET_SDRB_SEL(reg) ((reg >> 2) & 0x01)
49#define GET_SDRF_SEL(reg) ((reg >> 1) & 0x01)
50#define GET_FASTBUS(reg) (reg & 0x1)
51
52/* CFG_NEXT register */
53
54#define CFG_NEXT_CLOCKRECOVERY ((PMU->NEXT >> 18) & 0x7f) /* Bits 24-18 */
55#define CFG_NEXT_INTRET ((PMU->NEXT >> 17) & 0x01)
56#define CFG_NEXT_SDR_STOP ((PMU->NEXT >> 6) & 0x01)
57#define CFG_NEXT_SYSCLKEN ((PMU->NEXT >> 5) & 0x01)
58
59/* Useful field values that can be used to construct the
60 * CFG_NEXT and CFG_RUN registers.
61 */
62
63#define TRANSOP_NOP 0<<25 /* NOCHANGE_NOSTALL */
64#define NOCHANGE_STALL 1<<25
65#define CHANGE_NOSTALL 2<<25
66#define CHANGE_STALL 3<<25
67
68#define INTRET 1<<17
69#define OSCEN 1<<16
70#define OSCMUX 1<<15
71
72/* PLL frequencies */
73
74#define PLLMUL_0 0<<9 /* 3.6864 MHz */
75#define PLLMUL_1 1<<9 /* ?????? MHz */
76#define PLLMUL_5 5<<9 /* 18.432 MHz */
77#define PLLMUL_10 10<<9 /* 36.864 MHz */
78#define PLLMUL_18 18<<9 /* ?????? MHz */
79#define PLLMUL_20 20<<9 /* 73.728 MHz */
80#define PLLMUL_32 32<<9 /* ?????? MHz */
81#define PLLMUL_35 35<<9 /* 129.024 MHz */
82#define PLLMUL_36 36<<9 /* ?????? MHz */
83#define PLLMUL_39 39<<9 /* ?????? MHz */
84#define PLLMUL_40 40<<9 /* 147.456 MHz */
85
86/* Clock recovery times */
87
88#define CRCLOCK_1 1<<18
89#define CRCLOCK_2 2<<18
90#define CRCLOCK_4 4<<18
91#define CRCLOCK_8 8<<18
92#define CRCLOCK_16 16<<18
93#define CRCLOCK_32 32<<18
94#define CRCLOCK_63 63<<18
95#define CRCLOCK_127 127<<18
96
97#define PLLEN 1<<8
98#define PLLMUX 1<<7
99#define SDR_STOP 1<<6
100#define SYSCLKEN 1<<5
101
102#define BCLK_DIV_4 2<<3
103#define BCLK_DIV_2 1<<3
104#define BCLK_DIV_1 0<<3
105
106#define SDRB_SEL 1<<2
107#define SDRF_SEL 1<<1
108#define FASTBUS 1<<0
109
110
111/* CFG_SDRAM */
112
113#define SDRREFFQ 1<<0 /* Only if SDRSTOPRQ is not set. */
114#define SDRREFACK 1<<1 /* Read-only */
115#define SDRSTOPRQ 1<<2 /* Only if SDRREFFQ is not set. */
116#define SDRSTOPACK 1<<3 /* Read-only */
117#define PICEN 1<<4 /* Enable Co-procesor */
118#define PICTEST 1<<5
119
120#define GET_SDRREFFQ ((PMU->SDRAM >> 0) & 0x01)
121#define GET_SDRREFACK ((PMU->SDRAM >> 1) & 0x01) /* Read-only */
122#define GET_SDRSTOPRQ ((PMU->SDRAM >> 2) & 0x01)
123#define GET_SDRSTOPACK ((PMU->SDRAM >> 3) & 0x01) /* Read-only */
124#define GET_PICEN ((PMU->SDRAM >> 4) & 0x01)
125#define GET_PICTEST ((PMU->SDRAM >> 5) & 0x01)
diff --git a/arch/arm/mach-l7200/include/mach/serial.h b/arch/arm/mach-l7200/include/mach/serial.h
deleted file mode 100644
index adc05e5f8378..000000000000
--- a/arch/arm/mach-l7200/include/mach/serial.h
+++ /dev/null
@@ -1,37 +0,0 @@
1/*
2 * arch/arm/mach-l7200/include/mach/serial.h
3 *
4 * Copyright (c) 2000 Rob Scott (rscott@mtrob.fdns.net)
5 * Steve Hill (sjhill@cotw.com)
6 *
7 * Changelog:
8 * 03-20-2000 SJH Created
9 * 03-26-2000 SJH Added flags for serial ports
10 * 03-27-2000 SJH Corrected BASE_BAUD value
11 * 04-14-2000 RS Made register addr dependent on IO_BASE
12 * 05-03-2000 SJH Complete rewrite
13 * 05-09-2000 SJH Stripped out architecture specific serial stuff
14 * and placed it in a separate file
15 * 07-28-2000 SJH Moved base baud rate variable
16 */
17#ifndef __ASM_ARCH_SERIAL_H
18#define __ASM_ARCH_SERIAL_H
19
20/*
21 * This assumes you have a 3.6864 MHz clock for your UART.
22 */
23#define BASE_BAUD 3686400
24
25/*
26 * Standard COM flags
27 */
28#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
29
30#define STD_SERIAL_PORT_DEFNS \
31 /* MAGIC UART CLK PORT IRQ FLAGS */ \
32 { 0, BASE_BAUD, UART1_BASE, IRQ_UART_1, STD_COM_FLAGS }, /* ttyLU0 */ \
33 { 0, BASE_BAUD, UART2_BASE, IRQ_UART_2, STD_COM_FLAGS }, /* ttyLU1 */ \
34
35#define EXTRA_SERIAL_PORT_DEFNS
36
37#endif
diff --git a/arch/arm/mach-l7200/include/mach/serial_l7200.h b/arch/arm/mach-l7200/include/mach/serial_l7200.h
deleted file mode 100644
index 645f1c5e568d..000000000000
--- a/arch/arm/mach-l7200/include/mach/serial_l7200.h
+++ /dev/null
@@ -1,101 +0,0 @@
1/*
2 * arch/arm/mach-l7200/include/mach/serial_l7200.h
3 *
4 * Copyright (c) 2000 Steven Hill (sjhill@cotw.com)
5 *
6 * Changelog:
7 * 05-09-2000 SJH Created
8 */
9#ifndef __ASM_ARCH_SERIAL_L7200_H
10#define __ASM_ARCH_SERIAL_L7200_H
11
12#include <mach/memory.h>
13
14/*
15 * This assumes you have a 3.6864 MHz clock for your UART.
16 */
17#define BASE_BAUD 3686400
18
19/*
20 * UART base register addresses
21 */
22#define UART1_BASE (IO_BASE + 0x00044000)
23#define UART2_BASE (IO_BASE + 0x00045000)
24
25/*
26 * UART register offsets
27 */
28#define UARTDR 0x00 /* Tx/Rx data */
29#define RXSTAT 0x04 /* Rx status */
30#define H_UBRLCR 0x08 /* mode register high */
31#define M_UBRLCR 0x0C /* mode reg mid (MSB of baud)*/
32#define L_UBRLCR 0x10 /* mode reg low (LSB of baud)*/
33#define UARTCON 0x14 /* control register */
34#define UARTFLG 0x18 /* flag register */
35#define UARTINTSTAT 0x1C /* FIFO IRQ status register */
36#define UARTINTMASK 0x20 /* FIFO IRQ mask register */
37
38/*
39 * UART baud rate register values
40 */
41#define BR_110 0x827
42#define BR_1200 0x06e
43#define BR_2400 0x05f
44#define BR_4800 0x02f
45#define BR_9600 0x017
46#define BR_14400 0x00f
47#define BR_19200 0x00b
48#define BR_38400 0x005
49#define BR_57600 0x003
50#define BR_76800 0x002
51#define BR_115200 0x001
52
53/*
54 * Receiver status register (RXSTAT) mask values
55 */
56#define RXSTAT_NO_ERR 0x00 /* No error */
57#define RXSTAT_FRM_ERR 0x01 /* Framing error */
58#define RXSTAT_PAR_ERR 0x02 /* Parity error */
59#define RXSTAT_OVR_ERR 0x04 /* Overrun error */
60
61/*
62 * High byte of UART bit rate and line control register (H_UBRLCR) values
63 */
64#define UBRLCR_BRK 0x01 /* generate break on tx */
65#define UBRLCR_PEN 0x02 /* enable parity */
66#define UBRLCR_PDIS 0x00 /* disable parity */
67#define UBRLCR_EVEN 0x04 /* 1= even parity,0 = odd parity */
68#define UBRLCR_STP2 0x08 /* transmit 2 stop bits */
69#define UBRLCR_FIFO 0x10 /* enable FIFO */
70#define UBRLCR_LEN5 0x60 /* word length5 */
71#define UBRLCR_LEN6 0x40 /* word length6 */
72#define UBRLCR_LEN7 0x20 /* word length7 */
73#define UBRLCR_LEN8 0x00 /* word length8 */
74
75/*
76 * UART control register (UARTCON) values
77 */
78#define UARTCON_UARTEN 0x01 /* Enable UART */
79#define UARTCON_DMAONERR 0x08 /* Mask RxDmaRq when errors occur */
80
81/*
82 * UART flag register (UARTFLG) mask values
83 */
84#define UARTFLG_UTXFF 0x20 /* Transmit FIFO full */
85#define UARTFLG_URXFE 0x10 /* Receiver FIFO empty */
86#define UARTFLG_UBUSY 0x08 /* Transmitter busy */
87#define UARTFLG_DCD 0x04 /* Data carrier detect */
88#define UARTFLG_DSR 0x02 /* Data set ready */
89#define UARTFLG_CTS 0x01 /* Clear to send */
90
91/*
92 * UART interrupt status/clear registers (UARTINTSTAT/CLR) values
93 */
94#define UART_TXINT 0x01 /* TX interrupt */
95#define UART_RXINT 0x02 /* RX interrupt */
96#define UART_RXERRINT 0x04 /* RX error interrupt */
97#define UART_MSINT 0x08 /* Modem Status interrupt */
98#define UART_UDINT 0x10 /* UART Disabled interrupt */
99#define UART_ALLIRQS 0x1f /* All interrupts */
100
101#endif
diff --git a/arch/arm/mach-l7200/include/mach/sib.h b/arch/arm/mach-l7200/include/mach/sib.h
deleted file mode 100644
index 965728712cf3..000000000000
--- a/arch/arm/mach-l7200/include/mach/sib.h
+++ /dev/null
@@ -1,119 +0,0 @@
1/****************************************************************************/
2/*
3 * arch/arm/mach-l7200/include/mach/sib.h
4 *
5 * Registers and helper functions for the Serial Interface Bus.
6 *
7 * (C) Copyright 2000, S A McConnell (samcconn@cotw.com)
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 for
11 * more details.
12 */
13
14/****************************************************************************/
15
16#define SIB_OFF 0x00040000 /* Offset from IO_START to the SIB reg's. */
17
18/* IO_START and IO_BASE are defined in hardware.h */
19
20#define SIB_START (IO_START + SIB_OFF) /* Physical addr of the SIB reg. */
21#define SIB_BASE (IO_BASE + SIB_OFF) /* Virtual addr of the SIB reg. */
22
23/* Offsets from the start of the SIB for all the registers. */
24
25/* Define the SIB registers for use by device drivers and the kernel. */
26
27typedef struct
28{
29 unsigned int MCCR; /* SIB Control Register Offset: 0x00 */
30 unsigned int RES1; /* Reserved Offset: 0x04 */
31 unsigned int MCDR0; /* SIB Data Register 0 Offset: 0x08 */
32 unsigned int MCDR1; /* SIB Data Register 1 Offset: 0x0c */
33 unsigned int MCDR2; /* SIB Data Register 2 (UCB1x00) Offset: 0x10 */
34 unsigned int RES2; /* Reserved Offset: 0x14 */
35 unsigned int MCSR; /* SIB Status Register Offset: 0x18 */
36} SIB_Interface;
37
38#define SIB ((volatile SIB_Interface *) (SIB_BASE))
39
40/* MCCR */
41
42#define INTERNAL_FREQ 9216000 /* Hertz */
43#define AUDIO_FREQ 5000 /* Hertz */
44#define TELECOM_FREQ 5000 /* Hertz */
45
46#define AUDIO_DIVIDE (INTERNAL_FREQ / (32 * AUDIO_FREQ))
47#define TELECOM_DIVIDE (INTERNAL_FREQ / (32 * TELECOM_FREQ))
48
49#define MCCR_ASD57 AUDIO_DIVIDE
50#define MCCR_TSD57 (TELECOM_DIVIDE << 8)
51#define MCCR_MCE (1 << 16) /* SIB enable */
52#define MCCR_ECS (1 << 17) /* External Clock Select */
53#define MCCR_ADM (1 << 18) /* A/D Data Sampling */
54#define MCCR_PMC (1 << 26) /* PIN Multiplexer Control */
55
56
57#define GET_ASD ((SIB->MCCR >> 0) & 0x3f) /* Audio Sample Rate Div. */
58#define GET_TSD ((SIB->MCCR >> 8) & 0x3f) /* Telcom Sample Rate Div. */
59#define GET_MCE ((SIB->MCCR >> 16) & 0x01) /* SIB Enable */
60#define GET_ECS ((SIB->MCCR >> 17) & 0x01) /* External Clock Select */
61#define GET_ADM ((SIB->MCCR >> 18) & 0x01) /* A/D Data Sampling Mode */
62#define GET_TTM ((SIB->MCCR >> 19) & 0x01) /* Telco Trans. FIFO I mask */
63#define GET_TRM ((SIB->MCCR >> 20) & 0x01) /* Telco Recv. FIFO I mask */
64#define GET_ATM ((SIB->MCCR >> 21) & 0x01) /* Audio Trans. FIFO I mask */
65#define GET_ARM ((SIB->MCCR >> 22) & 0x01) /* Audio Recv. FIFO I mask */
66#define GET_LBM ((SIB->MCCR >> 23) & 0x01) /* Loop Back Mode */
67#define GET_ECP ((SIB->MCCR >> 24) & 0x03) /* Extern. Clck Prescale sel */
68#define GET_PMC ((SIB->MCCR >> 26) & 0x01) /* PIN Multiplexer Control */
69#define GET_ERI ((SIB->MCCR >> 27) & 0x01) /* External Read Interrupt */
70#define GET_EWI ((SIB->MCCR >> 28) & 0x01) /* External Write Interrupt */
71
72/* MCDR0 */
73
74#define AUDIO_RECV ((SIB->MCDR0 >> 4) & 0xfff)
75#define AUDIO_WRITE(v) ((SIB->MCDR0 = (v & 0xfff) << 4))
76
77/* MCDR1 */
78
79#define TELECOM_RECV ((SIB->MCDR1 >> 2) & 032fff)
80#define TELECOM_WRITE(v) ((SIB->MCDR1 = (v & 0x3fff) << 2))
81
82
83/* MCSR */
84
85#define MCSR_ATU (1 << 4) /* Audio Transmit FIFO Underrun */
86#define MCSR_ARO (1 << 5) /* Audio Receive FIFO Underrun */
87#define MCSR_TTU (1 << 6) /* TELECOM Transmit FIFO Underrun */
88#define MCSR_TRO (1 << 7) /* TELECOM Receive FIFO Underrun */
89
90#define MCSR_CLEAR_UNDERUN_BITS (MCSR_ATU | MCSR_ARO | MCSR_TTU | MCSR_TRO)
91
92
93#define GET_ATS ((SIB->MCSR >> 0) & 0x01) /* Audio Transmit FIFO Service Req*/
94#define GET_ARS ((SIB->MCSR >> 1) & 0x01) /* Audio Recv FIFO Service Request*/
95#define GET_TTS ((SIB->MCSR >> 2) & 0x01) /* TELECOM Transmit FIFO Flag */
96#define GET_TRS ((SIB->MCSR >> 3) & 0x01) /* TELECOM Recv FIFO Service Req. */
97#define GET_ATU ((SIB->MCSR >> 4) & 0x01) /* Audio Transmit FIFO Underrun */
98#define GET_ARO ((SIB->MCSR >> 5) & 0x01) /* Audio Receive FIFO Underrun */
99#define GET_TTU ((SIB->MCSR >> 6) & 0x01) /* TELECOM Transmit FIFO Underrun */
100#define GET_TRO ((SIB->MCSR >> 7) & 0x01) /* TELECOM Receive FIFO Underrun */
101#define GET_ANF ((SIB->MCSR >> 8) & 0x01) /* Audio Transmit FIFO not full */
102#define GET_ANE ((SIB->MCSR >> 9) & 0x01) /* Audio Receive FIFO not empty */
103#define GET_TNF ((SIB->MCSR >> 10) & 0x01) /* Telecom Transmit FIFO not full */
104#define GET_TNE ((SIB->MCSR >> 11) & 0x01) /* Telecom Receive FIFO not empty */
105#define GET_CWC ((SIB->MCSR >> 12) & 0x01) /* Codec Write Complete */
106#define GET_CRC ((SIB->MCSR >> 13) & 0x01) /* Codec Read Complete */
107#define GET_ACE ((SIB->MCSR >> 14) & 0x01) /* Audio Codec Enabled */
108#define GET_TCE ((SIB->MCSR >> 15) & 0x01) /* Telecom Codec Enabled */
109
110/* MCDR2 */
111
112#define MCDR2_rW (1 << 16)
113
114#define WRITE_MCDR2(reg, data) (SIB->MCDR2 =((reg<<17)|MCDR2_rW|(data&0xffff)))
115#define MCDR2_WRITE_COMPLETE GET_CWC
116
117#define INITIATE_MCDR2_READ(reg) (SIB->MCDR2 = (reg << 17))
118#define MCDR2_READ_COMPLETE GET_CRC
119#define MCDR2_READ (SIB->MCDR2 & 0xffff)
diff --git a/arch/arm/mach-l7200/include/mach/sys-clock.h b/arch/arm/mach-l7200/include/mach/sys-clock.h
deleted file mode 100644
index e9729a35751d..000000000000
--- a/arch/arm/mach-l7200/include/mach/sys-clock.h
+++ /dev/null
@@ -1,67 +0,0 @@
1/****************************************************************************/
2/*
3 * arch/arm/mach-l7200/include/mach/sys-clock.h
4 *
5 * Registers and helper functions for the L7200 Link-Up Systems
6 * System clocks.
7 *
8 * (C) Copyright 2000, S A McConnell (samcconn@cotw.com)
9 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file COPYING in the main directory of this archive for
12 * more details.
13 */
14
15/****************************************************************************/
16
17#define SYS_CLOCK_OFF 0x00050030 /* Offset from IO_START. */
18
19/* IO_START and IO_BASE are defined in hardware.h */
20
21#define SYS_CLOCK_START (IO_START + SYS_CLOCK_OFF) /* Physical address */
22#define SYS_CLOCK_BASE (IO_BASE + SYS_CLOCK_OFF) /* Virtual address */
23
24/* Define the interface to the SYS_CLOCK */
25
26typedef struct
27{
28 unsigned int ENABLE;
29 unsigned int ESYNC;
30 unsigned int SELECT;
31} sys_clock_interface;
32
33#define SYS_CLOCK ((volatile sys_clock_interface *)(SYS_CLOCK_BASE))
34
35//#define CLOCK_EN (*(volatile unsigned long *)(PMU_BASE+CLOCK_EN_OFF))
36//#define CLOCK_ESYNC (*(volatile unsigned long *)(PMU_BASE+CLOCK_ESYNC_OFF))
37//#define CLOCK_SEL (*(volatile unsigned long *)(PMU_BASE+CLOCK_SEL_OFF))
38
39/* SYS_CLOCK -> ENABLE */
40
41#define SYN_EN 1<<0
42#define B18M_EN 1<<1
43#define CLK3M6_EN 1<<2
44#define BUART_EN 1<<3
45#define CLK18MU_EN 1<<4
46#define FIR_EN 1<<5
47#define MIRN_EN 1<<6
48#define UARTM_EN 1<<7
49#define SIBADC_EN 1<<8
50#define ALTD_EN 1<<9
51#define CLCLK_EN 1<<10
52
53/* SYS_CLOCK -> SELECT */
54
55#define CLK18M_DIV 1<<0
56#define MIR_SEL 1<<1
57#define SSP_SEL 1<<4
58#define MM_DIV 1<<5
59#define MM_SEL 1<<6
60#define ADC_SEL_2 0<<7
61#define ADC_SEL_4 1<<7
62#define ADC_SEL_8 3<<7
63#define ADC_SEL_16 7<<7
64#define ADC_SEL_32 0x0f<<7
65#define ADC_SEL_64 0x1f<<7
66#define ADC_SEL_128 0x3f<<7
67#define ALTD_SEL 1<<13
diff --git a/arch/arm/mach-l7200/include/mach/system.h b/arch/arm/mach-l7200/include/mach/system.h
deleted file mode 100644
index e0dd3b6ae4aa..000000000000
--- a/arch/arm/mach-l7200/include/mach/system.h
+++ /dev/null
@@ -1,29 +0,0 @@
1/*
2 * arch/arm/mach-l7200/include/mach/system.h
3 *
4 * Copyright (c) 2000 Steve Hill (sjhill@cotw.com)
5 *
6 * Changelog
7 * 03-21-2000 SJH Created
8 * 04-26-2000 SJH Fixed functions
9 * 05-03-2000 SJH Removed usage of obsolete 'iomd.h'
10 * 05-31-2000 SJH Properly implemented 'arch_idle'
11 */
12#ifndef __ASM_ARCH_SYSTEM_H
13#define __ASM_ARCH_SYSTEM_H
14
15#include <mach/hardware.h>
16
17static inline void arch_idle(void)
18{
19 *(unsigned long *)(IO_BASE + 0x50004) = 1; /* idle mode */
20}
21
22static inline void arch_reset(char mode, const char *cmd)
23{
24 if (mode == 's') {
25 cpu_reset(0);
26 }
27}
28
29#endif
diff --git a/arch/arm/mach-l7200/include/mach/time.h b/arch/arm/mach-l7200/include/mach/time.h
deleted file mode 100644
index 061771c2c2bd..000000000000
--- a/arch/arm/mach-l7200/include/mach/time.h
+++ /dev/null
@@ -1,73 +0,0 @@
1/*
2 * arch/arm/mach-l7200/include/mach/time.h
3 *
4 * Copyright (C) 2000 Rob Scott (rscott@mtrob.fdns.net)
5 * Steve Hill (sjhill@cotw.com)
6 *
7 * Changelog:
8 * 01-02-2000 RS Created l7200 version, derived from rpc code
9 * 05-03-2000 SJH Complete rewrite
10 */
11#ifndef _ASM_ARCH_TIME_H
12#define _ASM_ARCH_TIME_H
13
14#include <mach/irqs.h>
15
16/*
17 * RTC base register address
18 */
19#define RTC_BASE (IO_BASE_2 + 0x2000)
20
21/*
22 * RTC registers
23 */
24#define RTC_RTCDR (*(volatile unsigned char *) (RTC_BASE + 0x000))
25#define RTC_RTCMR (*(volatile unsigned char *) (RTC_BASE + 0x004))
26#define RTC_RTCS (*(volatile unsigned char *) (RTC_BASE + 0x008))
27#define RTC_RTCC (*(volatile unsigned char *) (RTC_BASE + 0x008))
28#define RTC_RTCDV (*(volatile unsigned char *) (RTC_BASE + 0x00c))
29#define RTC_RTCCR (*(volatile unsigned char *) (RTC_BASE + 0x010))
30
31/*
32 * RTCCR register values
33 */
34#define RTC_RATE_32 0x00 /* 32 Hz tick */
35#define RTC_RATE_64 0x10 /* 64 Hz tick */
36#define RTC_RATE_128 0x20 /* 128 Hz tick */
37#define RTC_RATE_256 0x30 /* 256 Hz tick */
38#define RTC_EN_ALARM 0x01 /* Enable alarm */
39#define RTC_EN_TIC 0x04 /* Enable counter */
40#define RTC_EN_STWDOG 0x08 /* Enable watchdog */
41
42/*
43 * Handler for RTC timer interrupt
44 */
45static irqreturn_t
46timer_interrupt(int irq, void *dev_id)
47{
48 struct pt_regs *regs = get_irq_regs();
49 do_timer(1);
50#ifndef CONFIG_SMP
51 update_process_times(user_mode(regs));
52#endif
53 do_profile(regs);
54 RTC_RTCC = 0; /* Clear interrupt */
55
56 return IRQ_HANDLED;
57}
58
59/*
60 * Set up RTC timer interrupt, and return the current time in seconds.
61 */
62void __init time_init(void)
63{
64 RTC_RTCC = 0; /* Clear interrupt */
65
66 timer_irq.handler = timer_interrupt;
67
68 setup_irq(IRQ_RTC_TICK, &timer_irq);
69
70 RTC_RTCCR = RTC_RATE_128 | RTC_EN_TIC; /* Set rate and enable timer */
71}
72
73#endif
diff --git a/arch/arm/mach-l7200/include/mach/timex.h b/arch/arm/mach-l7200/include/mach/timex.h
deleted file mode 100644
index ffc96a63b5a2..000000000000
--- a/arch/arm/mach-l7200/include/mach/timex.h
+++ /dev/null
@@ -1,20 +0,0 @@
1/*
2 * arch/arm/mach-l7200/include/mach/timex.h
3 *
4 * Copyright (C) 2000 Rob Scott (rscott@mtrob.fdns.net)
5 * Steve Hill (sjhill@cotw.com)
6 *
7 * 04-21-2000 RS Created file
8 * 05-03-2000 SJH Tick rate was wrong
9 *
10 */
11
12/*
13 * On the ARM720T, clock ticks are set to 128 Hz.
14 *
15 * NOTE: The actual RTC value is set in 'time.h' which
16 * must be changed when choosing a different tick
17 * rate. The value of HZ in 'param.h' must also
18 * be changed to match below.
19 */
20#define CLOCK_TICK_RATE 128
diff --git a/arch/arm/mach-l7200/include/mach/uncompress.h b/arch/arm/mach-l7200/include/mach/uncompress.h
deleted file mode 100644
index 591c962bb315..000000000000
--- a/arch/arm/mach-l7200/include/mach/uncompress.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * arch/arm/mach-l7200/include/mach/uncompress.h
3 *
4 * Copyright (C) 2000 Steve Hill (sjhill@cotw.com)
5 *
6 * Changelog:
7 * 05-01-2000 SJH Created
8 * 05-13-2000 SJH Filled in function bodies
9 * 07-26-2000 SJH Removed hard coded baud rate
10 */
11
12#include <mach/hardware.h>
13
14#define IO_UART IO_START + 0x00044000
15
16#define __raw_writeb(v,p) (*(volatile unsigned char *)(p) = (v))
17#define __raw_readb(p) (*(volatile unsigned char *)(p))
18
19static inline void putc(int c)
20{
21 while(__raw_readb(IO_UART + 0x18) & 0x20 ||
22 __raw_readb(IO_UART + 0x18) & 0x08)
23 barrier();
24
25 __raw_writeb(c, IO_UART + 0x00);
26}
27
28static inline void flush(void)
29{
30}
31
32static __inline__ void arch_decomp_setup(void)
33{
34 __raw_writeb(0x00, IO_UART + 0x08); /* Set HSB */
35 __raw_writeb(0x00, IO_UART + 0x20); /* Disable IRQs */
36 __raw_writeb(0x01, IO_UART + 0x14); /* Enable UART */
37}
38
39#define arch_decomp_wdog()
diff --git a/arch/arm/mach-l7200/include/mach/vmalloc.h b/arch/arm/mach-l7200/include/mach/vmalloc.h
deleted file mode 100644
index 85f0abbf15f1..000000000000
--- a/arch/arm/mach-l7200/include/mach/vmalloc.h
+++ /dev/null
@@ -1,4 +0,0 @@
1/*
2 * arch/arm/mach-l7200/include/mach/vmalloc.h
3 */
4#define VMALLOC_END (PAGE_OFFSET + 0x10000000)
diff --git a/arch/arm/mach-lh7a40x/include/mach/memory.h b/arch/arm/mach-lh7a40x/include/mach/memory.h
index 189d20e543e7..edb8f5faf5d5 100644
--- a/arch/arm/mach-lh7a40x/include/mach/memory.h
+++ b/arch/arm/mach-lh7a40x/include/mach/memory.h
@@ -19,50 +19,6 @@
19 */ 19 */
20#define PHYS_OFFSET UL(0xc0000000) 20#define PHYS_OFFSET UL(0xc0000000)
21 21
22#ifdef CONFIG_DISCONTIGMEM
23
24/*
25 * Given a kernel address, find the home node of the underlying memory.
26 */
27
28# ifdef CONFIG_LH7A40X_ONE_BANK_PER_NODE
29# define KVADDR_TO_NID(addr) \
30 ( ((((unsigned long) (addr) - PAGE_OFFSET) >> 24) & 1)\
31 | ((((unsigned long) (addr) - PAGE_OFFSET) >> 25) & ~1))
32# else /* 2 banks per node */
33# define KVADDR_TO_NID(addr) \
34 (((unsigned long) (addr) - PAGE_OFFSET) >> 26)
35# endif
36
37/*
38 * Given a page frame number, convert it to a node id.
39 */
40
41# ifdef CONFIG_LH7A40X_ONE_BANK_PER_NODE
42# define PFN_TO_NID(pfn) \
43 (((((pfn) - PHYS_PFN_OFFSET) >> (24 - PAGE_SHIFT)) & 1)\
44 | ((((pfn) - PHYS_PFN_OFFSET) >> (25 - PAGE_SHIFT)) & ~1))
45# else /* 2 banks per node */
46# define PFN_TO_NID(pfn) \
47 (((pfn) - PHYS_PFN_OFFSET) >> (26 - PAGE_SHIFT))
48#endif
49
50/*
51 * Given a kaddr, LOCAL_MEM_MAP finds the owning node of the memory
52 * and returns the index corresponding to the appropriate page in the
53 * node's mem_map.
54 */
55
56# ifdef CONFIG_LH7A40X_ONE_BANK_PER_NODE
57# define LOCAL_MAP_NR(addr) \
58 (((unsigned long)(addr) & 0x003fffff) >> PAGE_SHIFT)
59# else /* 2 banks per node */
60# define LOCAL_MAP_NR(addr) \
61 (((unsigned long)(addr) & 0x01ffffff) >> PAGE_SHIFT)
62# endif
63
64#endif
65
66/* 22/*
67 * Sparsemem version of the above 23 * Sparsemem version of the above
68 */ 24 */
diff --git a/arch/arm/mach-lpc32xx/Kconfig b/arch/arm/mach-lpc32xx/Kconfig
new file mode 100644
index 000000000000..fde663508696
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/Kconfig
@@ -0,0 +1,33 @@
1if ARCH_LPC32XX
2
3menu "Individual UART enable selections"
4
5config ARCH_LPC32XX_UART3_SELECT
6 bool "Add support for standard UART3"
7 help
8 Adds support for standard UART 3 when the 8250 serial support
9 is enabled.
10
11config ARCH_LPC32XX_UART4_SELECT
12 bool "Add support for standard UART4"
13 help
14 Adds support for standard UART 4 when the 8250 serial support
15 is enabled.
16
17config ARCH_LPC32XX_UART5_SELECT
18 bool "Add support for standard UART5"
19 default y
20 help
21 Adds support for standard UART 5 when the 8250 serial support
22 is enabled.
23
24config ARCH_LPC32XX_UART6_SELECT
25 bool "Add support for standard UART6"
26 help
27 Adds support for standard UART 6 when the 8250 serial support
28 is enabled.
29
30endmenu
31
32endif
33
diff --git a/arch/arm/mach-lpc32xx/Makefile b/arch/arm/mach-lpc32xx/Makefile
new file mode 100644
index 000000000000..a5fc5d0eeaeb
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/Makefile
@@ -0,0 +1,8 @@
1#
2# Makefile for the linux kernel.
3#
4
5obj-y := timer.o irq.o common.o serial.o clock.o
6obj-y += gpiolib.o pm.o suspend.o
7obj-y += phy3250.o
8
diff --git a/arch/arm/mach-lpc32xx/Makefile.boot b/arch/arm/mach-lpc32xx/Makefile.boot
new file mode 100644
index 000000000000..b796b41ebf8f
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/Makefile.boot
@@ -0,0 +1,4 @@
1 zreladdr-y := 0x80008000
2params_phys-y := 0x80000100
3initrd_phys-y := 0x82000000
4
diff --git a/arch/arm/mach-lpc32xx/clock.c b/arch/arm/mach-lpc32xx/clock.c
new file mode 100644
index 000000000000..32d63796430a
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/clock.c
@@ -0,0 +1,1137 @@
1/*
2 * arch/arm/mach-lpc32xx/clock.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/*
20 * LPC32xx clock management driver overview
21 *
22 * The LPC32XX contains a number of high level system clocks that can be
23 * generated from different sources. These system clocks are used to
24 * generate the CPU and bus rates and the individual peripheral clocks in
25 * the system. When Linux is started by the boot loader, the system
26 * clocks are already running. Stopping a system clock during normal
27 * Linux operation should never be attempted, as peripherals that require
28 * those clocks will quit working (ie, DRAM).
29 *
30 * The LPC32xx high level clock tree looks as follows. Clocks marked with
31 * an asterisk are always on and cannot be disabled. Clocks marked with
32 * an ampersand can only be disabled in CPU suspend mode. Clocks marked
33 * with a caret are always on if it is the selected clock for the SYSCLK
34 * source. The clock that isn't used for SYSCLK can be enabled and
35 * disabled normally.
36 * 32KHz oscillator*
37 * / | \
38 * RTC* PLL397^ TOUCH
39 * /
40 * Main oscillator^ /
41 * | \ /
42 * | SYSCLK&
43 * | \
44 * | \
45 * USB_PLL HCLK_PLL&
46 * | | |
47 * USB host/device PCLK& |
48 * | |
49 * Peripherals
50 *
51 * The CPU and chip bus rates are derived from the HCLK PLL, which can
52 * generate various clock rates up to 266MHz and beyond. The internal bus
53 * rates (PCLK and HCLK) are generated from dividers based on the HCLK
54 * PLL rate. HCLK can be a ratio of 1:1, 1:2, or 1:4 or HCLK PLL rate,
55 * while PCLK can be 1:1 to 1:32 of HCLK PLL rate. Most peripherals high
56 * level clocks are based on either HCLK or PCLK, but have their own
57 * dividers as part of the IP itself. Because of this, the system clock
58 * rates should not be changed.
59 *
60 * The HCLK PLL is clocked from SYSCLK, which can be derived from the
61 * main oscillator or PLL397. PLL397 generates a rate that is 397 times
62 * the 32KHz oscillator rate. The main oscillator runs at the selected
63 * oscillator/crystal rate on the mosc_in pin of the LPC32xx. This rate
64 * is normally 13MHz, but depends on the selection of external crystals
65 * or oscillators. If USB operation is required, the main oscillator must
66 * be used in the system.
67 *
68 * Switching SYSCLK between sources during normal Linux operation is not
69 * supported. SYSCLK is preset in the bootloader. Because of the
70 * complexities of clock management during clock frequency changes,
71 * there are some limitations to the clock driver explained below:
72 * - The PLL397 and main oscillator can be enabled and disabled by the
73 * clk_enable() and clk_disable() functions unless SYSCLK is based
74 * on that clock. This allows the other oscillator that isn't driving
75 * the HCLK PLL to be used as another system clock that can be routed
76 * to an external pin.
77 * - The muxed SYSCLK input and HCLK_PLL rate cannot be changed with
78 * this driver.
79 * - HCLK and PCLK rates cannot be changed as part of this driver.
80 * - Most peripherals have their own dividers are part of the peripheral
81 * block. Changing SYSCLK, HCLK PLL, HCLK, or PCLK sources or rates
82 * will also impact the individual peripheral rates.
83 */
84
85#include <linux/kernel.h>
86#include <linux/list.h>
87#include <linux/errno.h>
88#include <linux/device.h>
89#include <linux/err.h>
90#include <linux/clk.h>
91#include <linux/amba/bus.h>
92#include <linux/amba/clcd.h>
93
94#include <mach/hardware.h>
95#include <asm/clkdev.h>
96#include <mach/clkdev.h>
97#include <mach/platform.h>
98#include "clock.h"
99#include "common.h"
100
101static struct clk clk_armpll;
102static struct clk clk_usbpll;
103static DEFINE_MUTEX(clkm_lock);
104
105/*
106 * Post divider values for PLLs based on selected register value
107 */
108static const u32 pll_postdivs[4] = {1, 2, 4, 8};
109
110static unsigned long local_return_parent_rate(struct clk *clk)
111{
112 /*
113 * If a clock has a rate of 0, then it inherits it's parent
114 * clock rate
115 */
116 while (clk->rate == 0)
117 clk = clk->parent;
118
119 return clk->rate;
120}
121
122/* 32KHz clock has a fixed rate and is not stoppable */
123static struct clk osc_32KHz = {
124 .rate = LPC32XX_CLOCK_OSC_FREQ,
125 .get_rate = local_return_parent_rate,
126};
127
128static int local_pll397_enable(struct clk *clk, int enable)
129{
130 u32 reg;
131 unsigned long timeout = 1 + msecs_to_jiffies(10);
132
133 reg = __raw_readl(LPC32XX_CLKPWR_PLL397_CTRL);
134
135 if (enable == 0) {
136 reg |= LPC32XX_CLKPWR_SYSCTRL_PLL397_DIS;
137 __raw_writel(reg, LPC32XX_CLKPWR_PLL397_CTRL);
138 } else {
139 /* Enable PLL397 */
140 reg &= ~LPC32XX_CLKPWR_SYSCTRL_PLL397_DIS;
141 __raw_writel(reg, LPC32XX_CLKPWR_PLL397_CTRL);
142
143 /* Wait for PLL397 lock */
144 while (((__raw_readl(LPC32XX_CLKPWR_PLL397_CTRL) &
145 LPC32XX_CLKPWR_SYSCTRL_PLL397_STS) == 0) &&
146 (timeout > jiffies))
147 cpu_relax();
148
149 if ((__raw_readl(LPC32XX_CLKPWR_PLL397_CTRL) &
150 LPC32XX_CLKPWR_SYSCTRL_PLL397_STS) == 0)
151 return -ENODEV;
152 }
153
154 return 0;
155}
156
157static int local_oscmain_enable(struct clk *clk, int enable)
158{
159 u32 reg;
160 unsigned long timeout = 1 + msecs_to_jiffies(10);
161
162 reg = __raw_readl(LPC32XX_CLKPWR_MAIN_OSC_CTRL);
163
164 if (enable == 0) {
165 reg |= LPC32XX_CLKPWR_MOSC_DISABLE;
166 __raw_writel(reg, LPC32XX_CLKPWR_MAIN_OSC_CTRL);
167 } else {
168 /* Enable main oscillator */
169 reg &= ~LPC32XX_CLKPWR_MOSC_DISABLE;
170 __raw_writel(reg, LPC32XX_CLKPWR_MAIN_OSC_CTRL);
171
172 /* Wait for main oscillator to start */
173 while (((__raw_readl(LPC32XX_CLKPWR_MAIN_OSC_CTRL) &
174 LPC32XX_CLKPWR_MOSC_DISABLE) != 0) &&
175 (timeout > jiffies))
176 cpu_relax();
177
178 if ((__raw_readl(LPC32XX_CLKPWR_MAIN_OSC_CTRL) &
179 LPC32XX_CLKPWR_MOSC_DISABLE) != 0)
180 return -ENODEV;
181 }
182
183 return 0;
184}
185
186static struct clk osc_pll397 = {
187 .parent = &osc_32KHz,
188 .enable = local_pll397_enable,
189 .rate = LPC32XX_CLOCK_OSC_FREQ * 397,
190 .get_rate = local_return_parent_rate,
191};
192
193static struct clk osc_main = {
194 .enable = local_oscmain_enable,
195 .rate = LPC32XX_MAIN_OSC_FREQ,
196 .get_rate = local_return_parent_rate,
197};
198
199static struct clk clk_sys;
200
201/*
202 * Convert a PLL register value to a PLL output frequency
203 */
204u32 clk_get_pllrate_from_reg(u32 inputclk, u32 regval)
205{
206 struct clk_pll_setup pllcfg;
207
208 pllcfg.cco_bypass_b15 = 0;
209 pllcfg.direct_output_b14 = 0;
210 pllcfg.fdbk_div_ctrl_b13 = 0;
211 if ((regval & LPC32XX_CLKPWR_HCLKPLL_CCO_BYPASS) != 0)
212 pllcfg.cco_bypass_b15 = 1;
213 if ((regval & LPC32XX_CLKPWR_HCLKPLL_POSTDIV_BYPASS) != 0)
214 pllcfg.direct_output_b14 = 1;
215 if ((regval & LPC32XX_CLKPWR_HCLKPLL_FDBK_SEL_FCLK) != 0)
216 pllcfg.fdbk_div_ctrl_b13 = 1;
217 pllcfg.pll_m = 1 + ((regval >> 1) & 0xFF);
218 pllcfg.pll_n = 1 + ((regval >> 9) & 0x3);
219 pllcfg.pll_p = pll_postdivs[((regval >> 11) & 0x3)];
220
221 return clk_check_pll_setup(inputclk, &pllcfg);
222}
223
224/*
225 * Setup the HCLK PLL with a PLL structure
226 */
227static u32 local_clk_pll_setup(struct clk_pll_setup *PllSetup)
228{
229 u32 tv, tmp = 0;
230
231 if (PllSetup->analog_on != 0)
232 tmp |= LPC32XX_CLKPWR_HCLKPLL_POWER_UP;
233 if (PllSetup->cco_bypass_b15 != 0)
234 tmp |= LPC32XX_CLKPWR_HCLKPLL_CCO_BYPASS;
235 if (PllSetup->direct_output_b14 != 0)
236 tmp |= LPC32XX_CLKPWR_HCLKPLL_POSTDIV_BYPASS;
237 if (PllSetup->fdbk_div_ctrl_b13 != 0)
238 tmp |= LPC32XX_CLKPWR_HCLKPLL_FDBK_SEL_FCLK;
239
240 tv = ffs(PllSetup->pll_p) - 1;
241 if ((!is_power_of_2(PllSetup->pll_p)) || (tv > 3))
242 return 0;
243
244 tmp |= LPC32XX_CLKPWR_HCLKPLL_POSTDIV_2POW(tv);
245 tmp |= LPC32XX_CLKPWR_HCLKPLL_PREDIV_PLUS1(PllSetup->pll_n - 1);
246 tmp |= LPC32XX_CLKPWR_HCLKPLL_PLLM(PllSetup->pll_m - 1);
247
248 return tmp;
249}
250
251/*
252 * Update the ARM core PLL frequency rate variable from the actual PLL setting
253 */
254static void local_update_armpll_rate(void)
255{
256 u32 clkin, pllreg;
257
258 clkin = clk_armpll.parent->rate;
259 pllreg = __raw_readl(LPC32XX_CLKPWR_HCLKPLL_CTRL) & 0x1FFFF;
260
261 clk_armpll.rate = clk_get_pllrate_from_reg(clkin, pllreg);
262}
263
264/*
265 * Find a PLL configuration for the selected input frequency
266 */
267static u32 local_clk_find_pll_cfg(u32 pllin_freq, u32 target_freq,
268 struct clk_pll_setup *pllsetup)
269{
270 u32 ifreq, freqtol, m, n, p, fclkout;
271
272 /* Determine frequency tolerance limits */
273 freqtol = target_freq / 250;
274 ifreq = pllin_freq;
275
276 /* Is direct bypass mode possible? */
277 if (abs(pllin_freq - target_freq) <= freqtol) {
278 pllsetup->analog_on = 0;
279 pllsetup->cco_bypass_b15 = 1;
280 pllsetup->direct_output_b14 = 1;
281 pllsetup->fdbk_div_ctrl_b13 = 1;
282 pllsetup->pll_p = pll_postdivs[0];
283 pllsetup->pll_n = 1;
284 pllsetup->pll_m = 1;
285 return clk_check_pll_setup(ifreq, pllsetup);
286 } else if (target_freq <= ifreq) {
287 pllsetup->analog_on = 0;
288 pllsetup->cco_bypass_b15 = 1;
289 pllsetup->direct_output_b14 = 0;
290 pllsetup->fdbk_div_ctrl_b13 = 1;
291 pllsetup->pll_n = 1;
292 pllsetup->pll_m = 1;
293 for (p = 0; p <= 3; p++) {
294 pllsetup->pll_p = pll_postdivs[p];
295 fclkout = clk_check_pll_setup(ifreq, pllsetup);
296 if (abs(target_freq - fclkout) <= freqtol)
297 return fclkout;
298 }
299 }
300
301 /* Is direct mode possible? */
302 pllsetup->analog_on = 1;
303 pllsetup->cco_bypass_b15 = 0;
304 pllsetup->direct_output_b14 = 1;
305 pllsetup->fdbk_div_ctrl_b13 = 0;
306 pllsetup->pll_p = pll_postdivs[0];
307 for (m = 1; m <= 256; m++) {
308 for (n = 1; n <= 4; n++) {
309 /* Compute output frequency for this value */
310 pllsetup->pll_n = n;
311 pllsetup->pll_m = m;
312 fclkout = clk_check_pll_setup(ifreq,
313 pllsetup);
314 if (abs(target_freq - fclkout) <=
315 freqtol)
316 return fclkout;
317 }
318 }
319
320 /* Is integer mode possible? */
321 pllsetup->analog_on = 1;
322 pllsetup->cco_bypass_b15 = 0;
323 pllsetup->direct_output_b14 = 0;
324 pllsetup->fdbk_div_ctrl_b13 = 1;
325 for (m = 1; m <= 256; m++) {
326 for (n = 1; n <= 4; n++) {
327 for (p = 0; p < 4; p++) {
328 /* Compute output frequency */
329 pllsetup->pll_p = pll_postdivs[p];
330 pllsetup->pll_n = n;
331 pllsetup->pll_m = m;
332 fclkout = clk_check_pll_setup(
333 ifreq, pllsetup);
334 if (abs(target_freq - fclkout) <= freqtol)
335 return fclkout;
336 }
337 }
338 }
339
340 /* Try non-integer mode */
341 pllsetup->analog_on = 1;
342 pllsetup->cco_bypass_b15 = 0;
343 pllsetup->direct_output_b14 = 0;
344 pllsetup->fdbk_div_ctrl_b13 = 0;
345 for (m = 1; m <= 256; m++) {
346 for (n = 1; n <= 4; n++) {
347 for (p = 0; p < 4; p++) {
348 /* Compute output frequency */
349 pllsetup->pll_p = pll_postdivs[p];
350 pllsetup->pll_n = n;
351 pllsetup->pll_m = m;
352 fclkout = clk_check_pll_setup(
353 ifreq, pllsetup);
354 if (abs(target_freq - fclkout) <= freqtol)
355 return fclkout;
356 }
357 }
358 }
359
360 return 0;
361}
362
363static struct clk clk_armpll = {
364 .parent = &clk_sys,
365 .get_rate = local_return_parent_rate,
366};
367
368/*
369 * Setup the USB PLL with a PLL structure
370 */
371static u32 local_clk_usbpll_setup(struct clk_pll_setup *pHCLKPllSetup)
372{
373 u32 reg, tmp = local_clk_pll_setup(pHCLKPllSetup);
374
375 reg = __raw_readl(LPC32XX_CLKPWR_USB_CTRL) & ~0x1FFFF;
376 reg |= tmp;
377 __raw_writel(reg, LPC32XX_CLKPWR_USB_CTRL);
378
379 return clk_check_pll_setup(clk_usbpll.parent->rate,
380 pHCLKPllSetup);
381}
382
383static int local_usbpll_enable(struct clk *clk, int enable)
384{
385 u32 reg;
386 int ret = -ENODEV;
387 unsigned long timeout = 1 + msecs_to_jiffies(10);
388
389 reg = __raw_readl(LPC32XX_CLKPWR_USB_CTRL);
390
391 if (enable == 0) {
392 reg &= ~(LPC32XX_CLKPWR_USBCTRL_CLK_EN1 |
393 LPC32XX_CLKPWR_USBCTRL_CLK_EN2);
394 __raw_writel(reg, LPC32XX_CLKPWR_USB_CTRL);
395 } else if (reg & LPC32XX_CLKPWR_USBCTRL_PLL_PWRUP) {
396 reg |= LPC32XX_CLKPWR_USBCTRL_CLK_EN1;
397 __raw_writel(reg, LPC32XX_CLKPWR_USB_CTRL);
398
399 /* Wait for PLL lock */
400 while ((timeout > jiffies) & (ret == -ENODEV)) {
401 reg = __raw_readl(LPC32XX_CLKPWR_USB_CTRL);
402 if (reg & LPC32XX_CLKPWR_USBCTRL_PLL_STS)
403 ret = 0;
404 }
405
406 if (ret == 0) {
407 reg |= LPC32XX_CLKPWR_USBCTRL_CLK_EN2;
408 __raw_writel(reg, LPC32XX_CLKPWR_USB_CTRL);
409 }
410 }
411
412 return ret;
413}
414
415static unsigned long local_usbpll_round_rate(struct clk *clk,
416 unsigned long rate)
417{
418 u32 clkin, usbdiv;
419 struct clk_pll_setup pllsetup;
420
421 /*
422 * Unlike other clocks, this clock has a KHz input rate, so bump
423 * it up to work with the PLL function
424 */
425 rate = rate * 1000;
426
427 clkin = clk->parent->rate;
428 usbdiv = (__raw_readl(LPC32XX_CLKPWR_USBCLK_PDIV) &
429 LPC32XX_CLKPWR_USBPDIV_PLL_MASK) + 1;
430 clkin = clkin / usbdiv;
431
432 /* Try to find a good rate setup */
433 if (local_clk_find_pll_cfg(clkin, rate, &pllsetup) == 0)
434 return 0;
435
436 return clk_check_pll_setup(clkin, &pllsetup);
437}
438
439static int local_usbpll_set_rate(struct clk *clk, unsigned long rate)
440{
441 u32 clkin, reg, usbdiv;
442 struct clk_pll_setup pllsetup;
443
444 /*
445 * Unlike other clocks, this clock has a KHz input rate, so bump
446 * it up to work with the PLL function
447 */
448 rate = rate * 1000;
449
450 clkin = clk->get_rate(clk);
451 usbdiv = (__raw_readl(LPC32XX_CLKPWR_USBCLK_PDIV) &
452 LPC32XX_CLKPWR_USBPDIV_PLL_MASK) + 1;
453 clkin = clkin / usbdiv;
454
455 /* Try to find a good rate setup */
456 if (local_clk_find_pll_cfg(clkin, rate, &pllsetup) == 0)
457 return -EINVAL;
458
459 local_usbpll_enable(clk, 0);
460
461 reg = __raw_readl(LPC32XX_CLKPWR_USB_CTRL);
462 reg |= LPC32XX_CLKPWR_USBCTRL_CLK_EN1;
463 __raw_writel(reg, LPC32XX_CLKPWR_USB_CTRL);
464
465 pllsetup.analog_on = 1;
466 local_clk_usbpll_setup(&pllsetup);
467
468 clk->rate = clk_check_pll_setup(clkin, &pllsetup);
469
470 reg = __raw_readl(LPC32XX_CLKPWR_USB_CTRL);
471 reg |= LPC32XX_CLKPWR_USBCTRL_CLK_EN2;
472 __raw_writel(reg, LPC32XX_CLKPWR_USB_CTRL);
473
474 return 0;
475}
476
477static struct clk clk_usbpll = {
478 .parent = &osc_main,
479 .set_rate = local_usbpll_set_rate,
480 .enable = local_usbpll_enable,
481 .rate = 48000, /* In KHz */
482 .get_rate = local_return_parent_rate,
483 .round_rate = local_usbpll_round_rate,
484};
485
486static u32 clk_get_hclk_div(void)
487{
488 static const u32 hclkdivs[4] = {1, 2, 4, 4};
489 return hclkdivs[LPC32XX_CLKPWR_HCLKDIV_DIV_2POW(
490 __raw_readl(LPC32XX_CLKPWR_HCLK_DIV))];
491}
492
493static struct clk clk_hclk = {
494 .parent = &clk_armpll,
495 .get_rate = local_return_parent_rate,
496};
497
498static struct clk clk_pclk = {
499 .parent = &clk_armpll,
500 .get_rate = local_return_parent_rate,
501};
502
503static int local_onoff_enable(struct clk *clk, int enable)
504{
505 u32 tmp;
506
507 tmp = __raw_readl(clk->enable_reg);
508
509 if (enable == 0)
510 tmp &= ~clk->enable_mask;
511 else
512 tmp |= clk->enable_mask;
513
514 __raw_writel(tmp, clk->enable_reg);
515
516 return 0;
517}
518
519/* Peripheral clock sources */
520static struct clk clk_timer0 = {
521 .parent = &clk_pclk,
522 .enable = local_onoff_enable,
523 .enable_reg = LPC32XX_CLKPWR_TIMERS_PWMS_CLK_CTRL_1,
524 .enable_mask = LPC32XX_CLKPWR_TMRPWMCLK_TIMER0_EN,
525 .get_rate = local_return_parent_rate,
526};
527static struct clk clk_timer1 = {
528 .parent = &clk_pclk,
529 .enable = local_onoff_enable,
530 .enable_reg = LPC32XX_CLKPWR_TIMERS_PWMS_CLK_CTRL_1,
531 .enable_mask = LPC32XX_CLKPWR_TMRPWMCLK_TIMER1_EN,
532 .get_rate = local_return_parent_rate,
533};
534static struct clk clk_timer2 = {
535 .parent = &clk_pclk,
536 .enable = local_onoff_enable,
537 .enable_reg = LPC32XX_CLKPWR_TIMERS_PWMS_CLK_CTRL_1,
538 .enable_mask = LPC32XX_CLKPWR_TMRPWMCLK_TIMER2_EN,
539 .get_rate = local_return_parent_rate,
540};
541static struct clk clk_timer3 = {
542 .parent = &clk_pclk,
543 .enable = local_onoff_enable,
544 .enable_reg = LPC32XX_CLKPWR_TIMERS_PWMS_CLK_CTRL_1,
545 .enable_mask = LPC32XX_CLKPWR_TMRPWMCLK_TIMER3_EN,
546 .get_rate = local_return_parent_rate,
547};
548static struct clk clk_wdt = {
549 .parent = &clk_pclk,
550 .enable = local_onoff_enable,
551 .enable_reg = LPC32XX_CLKPWR_TIMER_CLK_CTRL,
552 .enable_mask = LPC32XX_CLKPWR_PWMCLK_WDOG_EN,
553 .get_rate = local_return_parent_rate,
554};
555static struct clk clk_vfp9 = {
556 .parent = &clk_pclk,
557 .enable = local_onoff_enable,
558 .enable_reg = LPC32XX_CLKPWR_DEBUG_CTRL,
559 .enable_mask = LPC32XX_CLKPWR_VFP_CLOCK_ENABLE_BIT,
560 .get_rate = local_return_parent_rate,
561};
562static struct clk clk_dma = {
563 .parent = &clk_hclk,
564 .enable = local_onoff_enable,
565 .enable_reg = LPC32XX_CLKPWR_DMA_CLK_CTRL,
566 .enable_mask = LPC32XX_CLKPWR_DMACLKCTRL_CLK_EN,
567 .get_rate = local_return_parent_rate,
568};
569
570static struct clk clk_uart3 = {
571 .parent = &clk_pclk,
572 .enable = local_onoff_enable,
573 .enable_reg = LPC32XX_CLKPWR_UART_CLK_CTRL,
574 .enable_mask = LPC32XX_CLKPWR_UARTCLKCTRL_UART3_EN,
575 .get_rate = local_return_parent_rate,
576};
577
578static struct clk clk_uart4 = {
579 .parent = &clk_pclk,
580 .enable = local_onoff_enable,
581 .enable_reg = LPC32XX_CLKPWR_UART_CLK_CTRL,
582 .enable_mask = LPC32XX_CLKPWR_UARTCLKCTRL_UART4_EN,
583 .get_rate = local_return_parent_rate,
584};
585
586static struct clk clk_uart5 = {
587 .parent = &clk_pclk,
588 .enable = local_onoff_enable,
589 .enable_reg = LPC32XX_CLKPWR_UART_CLK_CTRL,
590 .enable_mask = LPC32XX_CLKPWR_UARTCLKCTRL_UART5_EN,
591 .get_rate = local_return_parent_rate,
592};
593
594static struct clk clk_uart6 = {
595 .parent = &clk_pclk,
596 .enable = local_onoff_enable,
597 .enable_reg = LPC32XX_CLKPWR_UART_CLK_CTRL,
598 .enable_mask = LPC32XX_CLKPWR_UARTCLKCTRL_UART6_EN,
599 .get_rate = local_return_parent_rate,
600};
601
602static struct clk clk_i2c0 = {
603 .parent = &clk_hclk,
604 .enable = local_onoff_enable,
605 .enable_reg = LPC32XX_CLKPWR_I2C_CLK_CTRL,
606 .enable_mask = LPC32XX_CLKPWR_I2CCLK_I2C1CLK_EN,
607 .get_rate = local_return_parent_rate,
608};
609
610static struct clk clk_i2c1 = {
611 .parent = &clk_hclk,
612 .enable = local_onoff_enable,
613 .enable_reg = LPC32XX_CLKPWR_I2C_CLK_CTRL,
614 .enable_mask = LPC32XX_CLKPWR_I2CCLK_I2C2CLK_EN,
615 .get_rate = local_return_parent_rate,
616};
617
618static struct clk clk_i2c2 = {
619 .parent = &clk_pclk,
620 .enable = local_onoff_enable,
621 .enable_reg = io_p2v(LPC32XX_USB_BASE + 0xFF4),
622 .enable_mask = 0x4,
623 .get_rate = local_return_parent_rate,
624};
625
626static struct clk clk_ssp0 = {
627 .parent = &clk_hclk,
628 .enable = local_onoff_enable,
629 .enable_reg = LPC32XX_CLKPWR_SSP_CLK_CTRL,
630 .enable_mask = LPC32XX_CLKPWR_SSPCTRL_SSPCLK0_EN,
631 .get_rate = local_return_parent_rate,
632};
633
634static struct clk clk_ssp1 = {
635 .parent = &clk_hclk,
636 .enable = local_onoff_enable,
637 .enable_reg = LPC32XX_CLKPWR_SSP_CLK_CTRL,
638 .enable_mask = LPC32XX_CLKPWR_SSPCTRL_SSPCLK1_EN,
639 .get_rate = local_return_parent_rate,
640};
641
642static struct clk clk_kscan = {
643 .parent = &osc_32KHz,
644 .enable = local_onoff_enable,
645 .enable_reg = LPC32XX_CLKPWR_KEY_CLK_CTRL,
646 .enable_mask = LPC32XX_CLKPWR_KEYCLKCTRL_CLK_EN,
647 .get_rate = local_return_parent_rate,
648};
649
650static struct clk clk_nand = {
651 .parent = &clk_hclk,
652 .enable = local_onoff_enable,
653 .enable_reg = LPC32XX_CLKPWR_NAND_CLK_CTRL,
654 .enable_mask = LPC32XX_CLKPWR_NANDCLK_SLCCLK_EN,
655 .get_rate = local_return_parent_rate,
656};
657
658static struct clk clk_i2s0 = {
659 .parent = &clk_hclk,
660 .enable = local_onoff_enable,
661 .enable_reg = LPC32XX_CLKPWR_I2S_CLK_CTRL,
662 .enable_mask = LPC32XX_CLKPWR_I2SCTRL_I2SCLK0_EN,
663 .get_rate = local_return_parent_rate,
664};
665
666static struct clk clk_i2s1 = {
667 .parent = &clk_hclk,
668 .enable = local_onoff_enable,
669 .enable_reg = LPC32XX_CLKPWR_I2S_CLK_CTRL,
670 .enable_mask = LPC32XX_CLKPWR_I2SCTRL_I2SCLK1_EN,
671 .get_rate = local_return_parent_rate,
672};
673
674static struct clk clk_net = {
675 .parent = &clk_hclk,
676 .enable = local_onoff_enable,
677 .enable_reg = LPC32XX_CLKPWR_MACCLK_CTRL,
678 .enable_mask = (LPC32XX_CLKPWR_MACCTRL_DMACLK_EN |
679 LPC32XX_CLKPWR_MACCTRL_MMIOCLK_EN |
680 LPC32XX_CLKPWR_MACCTRL_HRCCLK_EN),
681 .get_rate = local_return_parent_rate,
682};
683
684static struct clk clk_rtc = {
685 .parent = &osc_32KHz,
686 .rate = 1, /* 1 Hz */
687 .get_rate = local_return_parent_rate,
688};
689
690static struct clk clk_usbd = {
691 .parent = &clk_usbpll,
692 .enable = local_onoff_enable,
693 .enable_reg = LPC32XX_CLKPWR_USB_CTRL,
694 .enable_mask = LPC32XX_CLKPWR_USBCTRL_HCLK_EN,
695 .get_rate = local_return_parent_rate,
696};
697
698static int tsc_onoff_enable(struct clk *clk, int enable)
699{
700 u32 tmp;
701
702 /* Make sure 32KHz clock is the selected clock */
703 tmp = __raw_readl(LPC32XX_CLKPWR_ADC_CLK_CTRL_1);
704 tmp &= ~LPC32XX_CLKPWR_ADCCTRL1_PCLK_SEL;
705 __raw_writel(tmp, LPC32XX_CLKPWR_ADC_CLK_CTRL_1);
706
707 if (enable == 0)
708 __raw_writel(0, clk->enable_reg);
709 else
710 __raw_writel(clk->enable_mask, clk->enable_reg);
711
712 return 0;
713}
714
715static struct clk clk_tsc = {
716 .parent = &osc_32KHz,
717 .enable = tsc_onoff_enable,
718 .enable_reg = LPC32XX_CLKPWR_ADC_CLK_CTRL,
719 .enable_mask = LPC32XX_CLKPWR_ADC32CLKCTRL_CLK_EN,
720 .get_rate = local_return_parent_rate,
721};
722
723static int mmc_onoff_enable(struct clk *clk, int enable)
724{
725 u32 tmp;
726
727 tmp = __raw_readl(LPC32XX_CLKPWR_MS_CTRL) &
728 ~LPC32XX_CLKPWR_MSCARD_SDCARD_EN;
729
730 /* If rate is 0, disable clock */
731 if (enable != 0)
732 tmp |= LPC32XX_CLKPWR_MSCARD_SDCARD_EN;
733
734 __raw_writel(tmp, LPC32XX_CLKPWR_MS_CTRL);
735
736 return 0;
737}
738
739static unsigned long mmc_get_rate(struct clk *clk)
740{
741 u32 div, rate, oldclk;
742
743 /* The MMC clock must be on when accessing an MMC register */
744 oldclk = __raw_readl(LPC32XX_CLKPWR_MS_CTRL);
745 __raw_writel(oldclk | LPC32XX_CLKPWR_MSCARD_SDCARD_EN,
746 LPC32XX_CLKPWR_MS_CTRL);
747 div = __raw_readl(LPC32XX_CLKPWR_MS_CTRL);
748 __raw_writel(oldclk, LPC32XX_CLKPWR_MS_CTRL);
749
750 /* Get the parent clock rate */
751 rate = clk->parent->get_rate(clk->parent);
752
753 /* Get the MMC controller clock divider value */
754 div = div & LPC32XX_CLKPWR_MSCARD_SDCARD_DIV(0xf);
755
756 if (!div)
757 div = 1;
758
759 return rate / div;
760}
761
762static unsigned long mmc_round_rate(struct clk *clk, unsigned long rate)
763{
764 unsigned long div, prate;
765
766 /* Get the parent clock rate */
767 prate = clk->parent->get_rate(clk->parent);
768
769 if (rate >= prate)
770 return prate;
771
772 div = prate / rate;
773 if (div > 0xf)
774 div = 0xf;
775
776 return prate / div;
777}
778
779static int mmc_set_rate(struct clk *clk, unsigned long rate)
780{
781 u32 oldclk, tmp;
782 unsigned long prate, div, crate = mmc_round_rate(clk, rate);
783
784 prate = clk->parent->get_rate(clk->parent);
785
786 div = prate / crate;
787
788 /* The MMC clock must be on when accessing an MMC register */
789 oldclk = __raw_readl(LPC32XX_CLKPWR_MS_CTRL);
790 __raw_writel(oldclk | LPC32XX_CLKPWR_MSCARD_SDCARD_EN,
791 LPC32XX_CLKPWR_MS_CTRL);
792 tmp = __raw_readl(LPC32XX_CLKPWR_MS_CTRL) &
793 ~LPC32XX_CLKPWR_MSCARD_SDCARD_DIV(0xf);
794 tmp |= LPC32XX_CLKPWR_MSCARD_SDCARD_DIV(div);
795 __raw_writel(tmp, LPC32XX_CLKPWR_MS_CTRL);
796
797 __raw_writel(oldclk, LPC32XX_CLKPWR_MS_CTRL);
798
799 return 0;
800}
801
802static struct clk clk_mmc = {
803 .parent = &clk_armpll,
804 .set_rate = mmc_set_rate,
805 .get_rate = mmc_get_rate,
806 .round_rate = mmc_round_rate,
807 .enable = mmc_onoff_enable,
808 .enable_reg = LPC32XX_CLKPWR_MS_CTRL,
809 .enable_mask = LPC32XX_CLKPWR_MSCARD_SDCARD_EN,
810};
811
812static unsigned long clcd_get_rate(struct clk *clk)
813{
814 u32 tmp, div, rate, oldclk;
815
816 /* The LCD clock must be on when accessing an LCD register */
817 oldclk = __raw_readl(LPC32XX_CLKPWR_LCDCLK_CTRL);
818 __raw_writel(oldclk | LPC32XX_CLKPWR_LCDCTRL_CLK_EN,
819 LPC32XX_CLKPWR_LCDCLK_CTRL);
820 tmp = __raw_readl(io_p2v(LPC32XX_LCD_BASE + CLCD_TIM2));
821 __raw_writel(oldclk, LPC32XX_CLKPWR_LCDCLK_CTRL);
822
823 rate = clk->parent->get_rate(clk->parent);
824
825 /* Only supports internal clocking */
826 if (tmp & TIM2_BCD)
827 return rate;
828
829 div = (tmp & 0x1F) | ((tmp & 0xF8) >> 22);
830 tmp = rate / (2 + div);
831
832 return tmp;
833}
834
835static int clcd_set_rate(struct clk *clk, unsigned long rate)
836{
837 u32 tmp, prate, div, oldclk;
838
839 /* The LCD clock must be on when accessing an LCD register */
840 oldclk = __raw_readl(LPC32XX_CLKPWR_LCDCLK_CTRL);
841 __raw_writel(oldclk | LPC32XX_CLKPWR_LCDCTRL_CLK_EN,
842 LPC32XX_CLKPWR_LCDCLK_CTRL);
843
844 tmp = __raw_readl(io_p2v(LPC32XX_LCD_BASE + CLCD_TIM2)) | TIM2_BCD;
845 prate = clk->parent->get_rate(clk->parent);
846
847 if (rate < prate) {
848 /* Find closest divider */
849 div = prate / rate;
850 if (div >= 2) {
851 div -= 2;
852 tmp &= ~TIM2_BCD;
853 }
854
855 tmp &= ~(0xF800001F);
856 tmp |= (div & 0x1F);
857 tmp |= (((div >> 5) & 0x1F) << 27);
858 }
859
860 __raw_writel(tmp, io_p2v(LPC32XX_LCD_BASE + CLCD_TIM2));
861 __raw_writel(oldclk, LPC32XX_CLKPWR_LCDCLK_CTRL);
862
863 return 0;
864}
865
866static unsigned long clcd_round_rate(struct clk *clk, unsigned long rate)
867{
868 u32 prate, div;
869
870 prate = clk->parent->get_rate(clk->parent);
871
872 if (rate >= prate)
873 rate = prate;
874 else {
875 div = prate / rate;
876 if (div > 0x3ff)
877 div = 0x3ff;
878
879 rate = prate / div;
880 }
881
882 return rate;
883}
884
885static struct clk clk_lcd = {
886 .parent = &clk_hclk,
887 .set_rate = clcd_set_rate,
888 .get_rate = clcd_get_rate,
889 .round_rate = clcd_round_rate,
890 .enable = local_onoff_enable,
891 .enable_reg = LPC32XX_CLKPWR_LCDCLK_CTRL,
892 .enable_mask = LPC32XX_CLKPWR_LCDCTRL_CLK_EN,
893};
894
895static inline void clk_lock(void)
896{
897 mutex_lock(&clkm_lock);
898}
899
900static inline void clk_unlock(void)
901{
902 mutex_unlock(&clkm_lock);
903}
904
905static void local_clk_disable(struct clk *clk)
906{
907 WARN_ON(clk->usecount == 0);
908
909 /* Don't attempt to disable clock if it has no users */
910 if (clk->usecount > 0) {
911 clk->usecount--;
912
913 /* Only disable clock when it has no more users */
914 if ((clk->usecount == 0) && (clk->enable))
915 clk->enable(clk, 0);
916
917 /* Check parent clocks, they may need to be disabled too */
918 if (clk->parent)
919 local_clk_disable(clk->parent);
920 }
921}
922
923static int local_clk_enable(struct clk *clk)
924{
925 int ret = 0;
926
927 /* Enable parent clocks first and update use counts */
928 if (clk->parent)
929 ret = local_clk_enable(clk->parent);
930
931 if (!ret) {
932 /* Only enable clock if it's currently disabled */
933 if ((clk->usecount == 0) && (clk->enable))
934 ret = clk->enable(clk, 1);
935
936 if (!ret)
937 clk->usecount++;
938 else if (clk->parent)
939 local_clk_disable(clk->parent);
940 }
941
942 return ret;
943}
944
945/*
946 * clk_enable - inform the system when the clock source should be running.
947 */
948int clk_enable(struct clk *clk)
949{
950 int ret;
951
952 clk_lock();
953 ret = local_clk_enable(clk);
954 clk_unlock();
955
956 return ret;
957}
958EXPORT_SYMBOL(clk_enable);
959
960/*
961 * clk_disable - inform the system when the clock source is no longer required
962 */
963void clk_disable(struct clk *clk)
964{
965 clk_lock();
966 local_clk_disable(clk);
967 clk_unlock();
968}
969EXPORT_SYMBOL(clk_disable);
970
971/*
972 * clk_get_rate - obtain the current clock rate (in Hz) for a clock source
973 */
974unsigned long clk_get_rate(struct clk *clk)
975{
976 unsigned long rate;
977
978 clk_lock();
979 rate = clk->get_rate(clk);
980 clk_unlock();
981
982 return rate;
983}
984EXPORT_SYMBOL(clk_get_rate);
985
986/*
987 * clk_set_rate - set the clock rate for a clock source
988 */
989int clk_set_rate(struct clk *clk, unsigned long rate)
990{
991 int ret = -EINVAL;
992
993 /*
994 * Most system clocks can only be enabled or disabled, with
995 * the actual rate set as part of the peripheral dividers
996 * instead of high level clock control
997 */
998 if (clk->set_rate) {
999 clk_lock();
1000 ret = clk->set_rate(clk, rate);
1001 clk_unlock();
1002 }
1003
1004 return ret;
1005}
1006EXPORT_SYMBOL(clk_set_rate);
1007
1008/*
1009 * clk_round_rate - adjust a rate to the exact rate a clock can provide
1010 */
1011long clk_round_rate(struct clk *clk, unsigned long rate)
1012{
1013 clk_lock();
1014
1015 if (clk->round_rate)
1016 rate = clk->round_rate(clk, rate);
1017 else
1018 rate = clk->get_rate(clk);
1019
1020 clk_unlock();
1021
1022 return rate;
1023}
1024EXPORT_SYMBOL(clk_round_rate);
1025
1026/*
1027 * clk_set_parent - set the parent clock source for this clock
1028 */
1029int clk_set_parent(struct clk *clk, struct clk *parent)
1030{
1031 /* Clock re-parenting is not supported */
1032 return -EINVAL;
1033}
1034EXPORT_SYMBOL(clk_set_parent);
1035
1036/*
1037 * clk_get_parent - get the parent clock source for this clock
1038 */
1039struct clk *clk_get_parent(struct clk *clk)
1040{
1041 return clk->parent;
1042}
1043EXPORT_SYMBOL(clk_get_parent);
1044
1045#define _REGISTER_CLOCK(d, n, c) \
1046 { \
1047 .dev_id = (d), \
1048 .con_id = (n), \
1049 .clk = &(c), \
1050 },
1051
1052static struct clk_lookup lookups[] = {
1053 _REGISTER_CLOCK(NULL, "osc_32KHz", osc_32KHz)
1054 _REGISTER_CLOCK(NULL, "osc_pll397", osc_pll397)
1055 _REGISTER_CLOCK(NULL, "osc_main", osc_main)
1056 _REGISTER_CLOCK(NULL, "sys_ck", clk_sys)
1057 _REGISTER_CLOCK(NULL, "arm_pll_ck", clk_armpll)
1058 _REGISTER_CLOCK(NULL, "ck_pll5", clk_usbpll)
1059 _REGISTER_CLOCK(NULL, "hclk_ck", clk_hclk)
1060 _REGISTER_CLOCK(NULL, "pclk_ck", clk_pclk)
1061 _REGISTER_CLOCK(NULL, "timer0_ck", clk_timer0)
1062 _REGISTER_CLOCK(NULL, "timer1_ck", clk_timer1)
1063 _REGISTER_CLOCK(NULL, "timer2_ck", clk_timer2)
1064 _REGISTER_CLOCK(NULL, "timer3_ck", clk_timer3)
1065 _REGISTER_CLOCK(NULL, "vfp9_ck", clk_vfp9)
1066 _REGISTER_CLOCK(NULL, "clk_dmac", clk_dma)
1067 _REGISTER_CLOCK("pnx4008-watchdog", NULL, clk_wdt)
1068 _REGISTER_CLOCK(NULL, "uart3_ck", clk_uart3)
1069 _REGISTER_CLOCK(NULL, "uart4_ck", clk_uart4)
1070 _REGISTER_CLOCK(NULL, "uart5_ck", clk_uart5)
1071 _REGISTER_CLOCK(NULL, "uart6_ck", clk_uart6)
1072 _REGISTER_CLOCK("pnx-i2c.0", NULL, clk_i2c0)
1073 _REGISTER_CLOCK("pnx-i2c.1", NULL, clk_i2c1)
1074 _REGISTER_CLOCK("pnx-i2c.2", NULL, clk_i2c2)
1075 _REGISTER_CLOCK("dev:ssp0", NULL, clk_ssp0)
1076 _REGISTER_CLOCK("dev:ssp1", NULL, clk_ssp1)
1077 _REGISTER_CLOCK("lpc32xx_keys.0", NULL, clk_kscan)
1078 _REGISTER_CLOCK("lpc32xx-nand.0", "nand_ck", clk_nand)
1079 _REGISTER_CLOCK("tbd", "i2s0_ck", clk_i2s0)
1080 _REGISTER_CLOCK("tbd", "i2s1_ck", clk_i2s1)
1081 _REGISTER_CLOCK("lpc32xx-ts", NULL, clk_tsc)
1082 _REGISTER_CLOCK("dev:mmc0", "MCLK", clk_mmc)
1083 _REGISTER_CLOCK("lpc-net.0", NULL, clk_net)
1084 _REGISTER_CLOCK("dev:clcd", NULL, clk_lcd)
1085 _REGISTER_CLOCK("lpc32xx_udc", "ck_usbd", clk_usbd)
1086 _REGISTER_CLOCK("lpc32xx_rtc", NULL, clk_rtc)
1087};
1088
1089static int __init clk_init(void)
1090{
1091 int i;
1092
1093 for (i = 0; i < ARRAY_SIZE(lookups); i++)
1094 clkdev_add(&lookups[i]);
1095
1096 /*
1097 * Setup muxed SYSCLK for HCLK PLL base -this selects the
1098 * parent clock used for the ARM PLL and is used to derive
1099 * the many system clock rates in the device.
1100 */
1101 if (clk_is_sysclk_mainosc() != 0)
1102 clk_sys.parent = &osc_main;
1103 else
1104 clk_sys.parent = &osc_pll397;
1105
1106 clk_sys.rate = clk_sys.parent->rate;
1107
1108 /* Compute the current ARM PLL and USB PLL frequencies */
1109 local_update_armpll_rate();
1110
1111 /* Compute HCLK and PCLK bus rates */
1112 clk_hclk.rate = clk_hclk.parent->rate / clk_get_hclk_div();
1113 clk_pclk.rate = clk_pclk.parent->rate / clk_get_pclk_div();
1114
1115 /*
1116 * Enable system clocks - this step is somewhat formal, as the
1117 * clocks are already running, but it does get the clock data
1118 * inline with the actual system state. Never disable these
1119 * clocks as they will only stop if the system is going to sleep.
1120 * In that case, the chip/system power management functions will
1121 * handle clock gating.
1122 */
1123 if (clk_enable(&clk_hclk) || clk_enable(&clk_pclk))
1124 printk(KERN_ERR "Error enabling system HCLK and PCLK\n");
1125
1126 /*
1127 * Timers 0 and 1 were enabled and are being used by the high
1128 * resolution tick function prior to this driver being initialized.
1129 * Tag them now as used.
1130 */
1131 if (clk_enable(&clk_timer0) || clk_enable(&clk_timer1))
1132 printk(KERN_ERR "Error enabling timer tick clocks\n");
1133
1134 return 0;
1135}
1136core_initcall(clk_init);
1137
diff --git a/arch/arm/mach-lpc32xx/clock.h b/arch/arm/mach-lpc32xx/clock.h
new file mode 100644
index 000000000000..c0a8434307f7
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/clock.h
@@ -0,0 +1,38 @@
1/*
2 * arch/arm/mach-lpc32xx/clock.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 __LPC32XX_CLOCK_H
20#define __LPC32XX_CLOCK_H
21
22struct clk {
23 struct list_head node;
24 struct clk *parent;
25 u32 rate;
26 u32 usecount;
27
28 int (*set_rate) (struct clk *, unsigned long);
29 unsigned long (*round_rate) (struct clk *, unsigned long);
30 unsigned long (*get_rate) (struct clk *clk);
31 int (*enable) (struct clk *, int);
32
33 /* Register address and bit mask for simple clocks */
34 void __iomem *enable_reg;
35 u32 enable_mask;
36};
37
38#endif
diff --git a/arch/arm/mach-lpc32xx/common.c b/arch/arm/mach-lpc32xx/common.c
new file mode 100644
index 000000000000..ee24dc28e93e
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/common.c
@@ -0,0 +1,271 @@
1/*
2 * arch/arm/mach-lpc32xx/common.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/init.h>
20#include <linux/platform_device.h>
21#include <linux/interrupt.h>
22#include <linux/irq.h>
23#include <linux/err.h>
24#include <linux/i2c.h>
25#include <linux/i2c-pnx.h>
26#include <linux/io.h>
27
28#include <asm/mach/map.h>
29
30#include <mach/i2c.h>
31#include <mach/hardware.h>
32#include <mach/platform.h>
33#include "common.h"
34
35/*
36 * Watchdog timer
37 */
38static struct resource watchdog_resources[] = {
39 [0] = {
40 .start = LPC32XX_WDTIM_BASE,
41 .end = LPC32XX_WDTIM_BASE + SZ_4K - 1,
42 .flags = IORESOURCE_MEM,
43 },
44};
45
46struct platform_device lpc32xx_watchdog_device = {
47 .name = "pnx4008-watchdog",
48 .id = -1,
49 .num_resources = ARRAY_SIZE(watchdog_resources),
50 .resource = watchdog_resources,
51};
52
53/*
54 * I2C busses
55 */
56static struct i2c_pnx_data i2c0_data = {
57 .name = I2C_CHIP_NAME "1",
58 .base = LPC32XX_I2C1_BASE,
59 .irq = IRQ_LPC32XX_I2C_1,
60};
61
62static struct i2c_pnx_data i2c1_data = {
63 .name = I2C_CHIP_NAME "2",
64 .base = LPC32XX_I2C2_BASE,
65 .irq = IRQ_LPC32XX_I2C_2,
66};
67
68static struct i2c_pnx_data i2c2_data = {
69 .name = "USB-I2C",
70 .base = LPC32XX_OTG_I2C_BASE,
71 .irq = IRQ_LPC32XX_USB_I2C,
72};
73
74struct platform_device lpc32xx_i2c0_device = {
75 .name = "pnx-i2c",
76 .id = 0,
77 .dev = {
78 .platform_data = &i2c0_data,
79 },
80};
81
82struct platform_device lpc32xx_i2c1_device = {
83 .name = "pnx-i2c",
84 .id = 1,
85 .dev = {
86 .platform_data = &i2c1_data,
87 },
88};
89
90struct platform_device lpc32xx_i2c2_device = {
91 .name = "pnx-i2c",
92 .id = 2,
93 .dev = {
94 .platform_data = &i2c2_data,
95 },
96};
97
98/*
99 * Returns the unique ID for the device
100 */
101void lpc32xx_get_uid(u32 devid[4])
102{
103 int i;
104
105 for (i = 0; i < 4; i++)
106 devid[i] = __raw_readl(LPC32XX_CLKPWR_DEVID(i << 2));
107}
108
109/*
110 * Returns SYSCLK source
111 * 0 = PLL397, 1 = main oscillator
112 */
113int clk_is_sysclk_mainosc(void)
114{
115 if ((__raw_readl(LPC32XX_CLKPWR_SYSCLK_CTRL) &
116 LPC32XX_CLKPWR_SYSCTRL_SYSCLKMUX) == 0)
117 return 1;
118
119 return 0;
120}
121
122/*
123 * System reset via the watchdog timer
124 */
125void lpc32xx_watchdog_reset(void)
126{
127 /* Make sure WDT clocks are enabled */
128 __raw_writel(LPC32XX_CLKPWR_PWMCLK_WDOG_EN,
129 LPC32XX_CLKPWR_TIMER_CLK_CTRL);
130
131 /* Instant assert of RESETOUT_N with pulse length 1mS */
132 __raw_writel(13000, io_p2v(LPC32XX_WDTIM_BASE + 0x18));
133 __raw_writel(0x70, io_p2v(LPC32XX_WDTIM_BASE + 0xC));
134}
135
136/*
137 * Detects and returns IRAM size for the device variation
138 */
139#define LPC32XX_IRAM_BANK_SIZE SZ_128K
140static u32 iram_size;
141u32 lpc32xx_return_iram_size(void)
142{
143 if (iram_size == 0) {
144 u32 savedval1, savedval2;
145 void __iomem *iramptr1, *iramptr2;
146
147 iramptr1 = io_p2v(LPC32XX_IRAM_BASE);
148 iramptr2 = io_p2v(LPC32XX_IRAM_BASE + LPC32XX_IRAM_BANK_SIZE);
149 savedval1 = __raw_readl(iramptr1);
150 savedval2 = __raw_readl(iramptr2);
151
152 if (savedval1 == savedval2) {
153 __raw_writel(savedval2 + 1, iramptr2);
154 if (__raw_readl(iramptr1) == savedval2 + 1)
155 iram_size = LPC32XX_IRAM_BANK_SIZE;
156 else
157 iram_size = LPC32XX_IRAM_BANK_SIZE * 2;
158 __raw_writel(savedval2, iramptr2);
159 } else
160 iram_size = LPC32XX_IRAM_BANK_SIZE * 2;
161 }
162
163 return iram_size;
164}
165
166/*
167 * Computes PLL rate from PLL register and input clock
168 */
169u32 clk_check_pll_setup(u32 ifreq, struct clk_pll_setup *pllsetup)
170{
171 u32 ilfreq, p, m, n, fcco, fref, cfreq;
172 int mode;
173
174 /*
175 * PLL requirements
176 * ifreq must be >= 1MHz and <= 20MHz
177 * FCCO must be >= 156MHz and <= 320MHz
178 * FREF must be >= 1MHz and <= 27MHz
179 * Assume the passed input data is not valid
180 */
181
182 ilfreq = ifreq;
183 m = pllsetup->pll_m;
184 n = pllsetup->pll_n;
185 p = pllsetup->pll_p;
186
187 mode = (pllsetup->cco_bypass_b15 << 2) |
188 (pllsetup->direct_output_b14 << 1) |
189 pllsetup->fdbk_div_ctrl_b13;
190
191 switch (mode) {
192 case 0x0: /* Non-integer mode */
193 cfreq = (m * ilfreq) / (2 * p * n);
194 fcco = (m * ilfreq) / n;
195 fref = ilfreq / n;
196 break;
197
198 case 0x1: /* integer mode */
199 cfreq = (m * ilfreq) / n;
200 fcco = (m * ilfreq) / (n * 2 * p);
201 fref = ilfreq / n;
202 break;
203
204 case 0x2:
205 case 0x3: /* Direct mode */
206 cfreq = (m * ilfreq) / n;
207 fcco = cfreq;
208 fref = ilfreq / n;
209 break;
210
211 case 0x4:
212 case 0x5: /* Bypass mode */
213 cfreq = ilfreq / (2 * p);
214 fcco = 156000000;
215 fref = 1000000;
216 break;
217
218 case 0x6:
219 case 0x7: /* Direct bypass mode */
220 default:
221 cfreq = ilfreq;
222 fcco = 156000000;
223 fref = 1000000;
224 break;
225 }
226
227 if (fcco < 156000000 || fcco > 320000000)
228 cfreq = 0;
229
230 if (fref < 1000000 || fref > 27000000)
231 cfreq = 0;
232
233 return (u32) cfreq;
234}
235
236u32 clk_get_pclk_div(void)
237{
238 return 1 + ((__raw_readl(LPC32XX_CLKPWR_HCLK_DIV) >> 2) & 0x1F);
239}
240
241static struct map_desc lpc32xx_io_desc[] __initdata = {
242 {
243 .virtual = IO_ADDRESS(LPC32XX_AHB0_START),
244 .pfn = __phys_to_pfn(LPC32XX_AHB0_START),
245 .length = LPC32XX_AHB0_SIZE,
246 .type = MT_DEVICE
247 },
248 {
249 .virtual = IO_ADDRESS(LPC32XX_AHB1_START),
250 .pfn = __phys_to_pfn(LPC32XX_AHB1_START),
251 .length = LPC32XX_AHB1_SIZE,
252 .type = MT_DEVICE
253 },
254 {
255 .virtual = IO_ADDRESS(LPC32XX_FABAPB_START),
256 .pfn = __phys_to_pfn(LPC32XX_FABAPB_START),
257 .length = LPC32XX_FABAPB_SIZE,
258 .type = MT_DEVICE
259 },
260 {
261 .virtual = IO_ADDRESS(LPC32XX_IRAM_BASE),
262 .pfn = __phys_to_pfn(LPC32XX_IRAM_BASE),
263 .length = (LPC32XX_IRAM_BANK_SIZE * 2),
264 .type = MT_DEVICE
265 },
266};
267
268void __init lpc32xx_map_io(void)
269{
270 iotable_init(lpc32xx_io_desc, ARRAY_SIZE(lpc32xx_io_desc));
271}
diff --git a/arch/arm/mach-lpc32xx/common.h b/arch/arm/mach-lpc32xx/common.h
new file mode 100644
index 000000000000..f82211fd80c1
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/common.h
@@ -0,0 +1,73 @@
1/*
2 * arch/arm/mach-lpc32xx/common.h
3 *
4 * Author: Kevin Wells <kevin.wells@nxp.com>
5 *
6 * Copyright (C) 2009-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 __LPC32XX_COMMON_H
20#define __LPC32XX_COMMON_H
21
22#include <linux/platform_device.h>
23
24/*
25 * Arch specific platform device structures
26 */
27extern struct platform_device lpc32xx_watchdog_device;
28extern struct platform_device lpc32xx_i2c0_device;
29extern struct platform_device lpc32xx_i2c1_device;
30extern struct platform_device lpc32xx_i2c2_device;
31
32/*
33 * Other arch specific structures and functions
34 */
35extern struct sys_timer lpc32xx_timer;
36extern void __init lpc32xx_init_irq(void);
37extern void __init lpc32xx_map_io(void);
38extern void __init lpc32xx_serial_init(void);
39extern void __init lpc32xx_gpio_init(void);
40
41/*
42 * Structure used for setting up and querying the PLLS
43 */
44struct clk_pll_setup {
45 int analog_on;
46 int cco_bypass_b15;
47 int direct_output_b14;
48 int fdbk_div_ctrl_b13;
49 int pll_p;
50 int pll_n;
51 u32 pll_m;
52};
53
54extern int clk_is_sysclk_mainosc(void);
55extern u32 clk_check_pll_setup(u32 ifreq, struct clk_pll_setup *pllsetup);
56extern u32 clk_get_pllrate_from_reg(u32 inputclk, u32 regval);
57extern u32 clk_get_pclk_div(void);
58
59/*
60 * Returns the LPC32xx unique 128-bit chip ID
61 */
62extern void lpc32xx_get_uid(u32 devid[4]);
63
64extern void lpc32xx_watchdog_reset(void);
65extern u32 lpc32xx_return_iram_size(void);
66
67/*
68 * Pointers used for sizing and copying suspend function data
69 */
70extern int lpc32xx_sys_suspend(void);
71extern int lpc32xx_sys_suspend_sz;
72
73#endif
diff --git a/arch/arm/mach-lpc32xx/gpiolib.c b/arch/arm/mach-lpc32xx/gpiolib.c
new file mode 100644
index 000000000000..69061ea8997a
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/gpiolib.c
@@ -0,0 +1,446 @@
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/plat-mxc/include/mach/board-pcm043.h b/arch/arm/mach-lpc32xx/include/mach/clkdev.h
index 1ac4e1682e5c..9bf0637e29ce 100644
--- a/arch/arm/plat-mxc/include/mach/board-pcm043.h
+++ b/arch/arm/mach-lpc32xx/include/mach/clkdev.h
@@ -1,5 +1,9 @@
1/* 1/*
2 * Copyright (C) 2008 Sascha Hauer, Pengutronix 2 * arch/arm/mach-lpc32xx/include/mach/clkdev.h
3 *
4 * Author: Kevin Wells <kevin.wells@nxp.com>
5 *
6 * Copyright (C) 2010 NXP Semiconductors
3 * 7 *
4 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
@@ -10,13 +14,12 @@
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 16 * 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 */ 17 */
18 18
19#ifndef __ASM_ARCH_MXC_BOARD_PCM043_H__ 19#ifndef __ASM_ARCH_CLKDEV_H
20#define __ASM_ARCH_MXC_BOARD_PCM043_H__ 20#define __ASM_ARCH_CLKDEV_H
21
22#define __clk_get(clk) ({ 1; })
23#define __clk_put(clk) do { } while (0)
21 24
22#endif /* __ASM_ARCH_MXC_BOARD_PCM043_H__ */ 25#endif
diff --git a/arch/arm/plat-mxc/include/mach/board-mx35pdk.h b/arch/arm/mach-lpc32xx/include/mach/debug-macro.S
index 383f1c04df06..621744d6b152 100644
--- a/arch/arm/plat-mxc/include/mach/board-mx35pdk.h
+++ b/arch/arm/mach-lpc32xx/include/mach/debug-macro.S
@@ -1,5 +1,9 @@
1/* 1/*
2 * Copyright 2009 Freescale Semiconductor, Inc. All Rights Reserved 2 * arch/arm/mach-lpc32xx/include/mach/debug-macro.S
3 *
4 * Author: Kevin Wells <kevin.wells@nxp.com>
5 *
6 * Copyright (C) 2010 NXP Semiconductors
3 * 7 *
4 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
@@ -10,13 +14,18 @@
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 16 * 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 */ 17 */
18 18
19#ifndef __ASM_ARCH_MXC_BOARD_MX35PDK_H__ 19/*
20#define __ASM_ARCH_MXC_BOARD_MX35PDK_H__ 20 * Debug output is hardcoded to standard UART 5
21*/
22
23 .macro addruart,rx, tmp
24 mrc p15, 0, \rx, c1, c0
25 tst \rx, #1 @ MMU enabled?
26 ldreq \rx, =0x40090000
27 ldrne \rx, =0xF4090000
28 .endm
21 29
22#endif /* __ASM_ARCH_MXC_BOARD_MX35PDK_H__ */ 30#define UART_SHIFT 2
31#include <asm/hardware/debug-8250.S>
diff --git a/arch/arm/mach-lpc32xx/include/mach/entry-macro.S b/arch/arm/mach-lpc32xx/include/mach/entry-macro.S
new file mode 100644
index 000000000000..870227c96602
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/include/mach/entry-macro.S
@@ -0,0 +1,47 @@
1/*
2 * arch/arm/mach-lpc32xx/include/mach/entry-macro.S
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 <mach/hardware.h>
20#include <mach/platform.h>
21
22#define LPC32XX_INTC_MASKED_STATUS_OFS 0x8
23
24 .macro disable_fiq
25 .endm
26
27 .macro get_irqnr_preamble, base, tmp
28 ldr \base, =IO_ADDRESS(LPC32XX_MIC_BASE)
29 .endm
30
31 .macro arch_ret_to_user, tmp1, tmp2
32 .endm
33
34/*
35 * Return IRQ number in irqnr. Also return processor Z flag status in CPSR
36 * as set if an interrupt is pending.
37 */
38 .macro get_irqnr_and_base, irqnr, irqstat, base, tmp
39 ldr \irqstat, [\base, #LPC32XX_INTC_MASKED_STATUS_OFS]
40 clz \irqnr, \irqstat
41 rsb \irqnr, \irqnr, #31
42 teq \irqstat, #0
43 .endm
44
45 .macro irq_prio_table
46 .endm
47
diff --git a/arch/arm/mach-lpc32xx/include/mach/gpio.h b/arch/arm/mach-lpc32xx/include/mach/gpio.h
new file mode 100644
index 000000000000..67d03da1eee9
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/include/mach/gpio.h
@@ -0,0 +1,74 @@
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/include/mach/hardware.h b/arch/arm/mach-lpc32xx/include/mach/hardware.h
new file mode 100644
index 000000000000..33e1dde37bd9
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/include/mach/hardware.h
@@ -0,0 +1,34 @@
1/*
2 * arch/arm/mach-lpc32xx/include/mach/hardware.h
3 *
4 * Copyright (c) 2005 MontaVista Software, Inc. <source@mvista.com>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 */
16
17#ifndef __ASM_ARCH_HARDWARE_H
18#define __ASM_ARCH_HARDWARE_H
19
20/*
21 * Start of virtual addresses for IO devices
22 */
23#define IO_BASE 0xF0000000
24
25/*
26 * This macro relies on fact that for all HW i/o addresses bits 20-23 are 0
27 */
28#define IO_ADDRESS(x) (((((x) & 0xff000000) >> 4) | ((x) & 0xfffff)) |\
29 IO_BASE)
30
31#define io_p2v(x) ((void __iomem *) (unsigned long) IO_ADDRESS(x))
32#define io_v2p(x) ((((x) & 0x0ff00000) << 4) | ((x) & 0x000fffff))
33
34#endif
diff --git a/arch/arm/mach-lpc32xx/include/mach/i2c.h b/arch/arm/mach-lpc32xx/include/mach/i2c.h
new file mode 100644
index 000000000000..034dc9286bcc
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/include/mach/i2c.h
@@ -0,0 +1,63 @@
1/*
2 * PNX4008-specific tweaks for I2C IP3204 block
3 *
4 * Author: Vitaly Wool <vwool@ru.mvista.com>
5 *
6 * 2005 (c) MontaVista Software, Inc. This file is licensed under
7 * the terms of the GNU General Public License version 2. This program
8 * is licensed "as is" without any warranty of any kind, whether express
9 * or implied.
10 */
11
12#ifndef __ASM_ARCH_I2C_H
13#define __ASM_ARCH_I2C_H
14
15enum {
16 mstatus_tdi = 0x00000001,
17 mstatus_afi = 0x00000002,
18 mstatus_nai = 0x00000004,
19 mstatus_drmi = 0x00000008,
20 mstatus_active = 0x00000020,
21 mstatus_scl = 0x00000040,
22 mstatus_sda = 0x00000080,
23 mstatus_rff = 0x00000100,
24 mstatus_rfe = 0x00000200,
25 mstatus_tff = 0x00000400,
26 mstatus_tfe = 0x00000800,
27};
28
29enum {
30 mcntrl_tdie = 0x00000001,
31 mcntrl_afie = 0x00000002,
32 mcntrl_naie = 0x00000004,
33 mcntrl_drmie = 0x00000008,
34 mcntrl_daie = 0x00000020,
35 mcntrl_rffie = 0x00000040,
36 mcntrl_tffie = 0x00000080,
37 mcntrl_reset = 0x00000100,
38 mcntrl_cdbmode = 0x00000400,
39};
40
41enum {
42 rw_bit = 1 << 0,
43 start_bit = 1 << 8,
44 stop_bit = 1 << 9,
45};
46
47#define I2C_REG_RX(a) ((a)->ioaddr) /* Rx FIFO reg (RO) */
48#define I2C_REG_TX(a) ((a)->ioaddr) /* Tx FIFO reg (WO) */
49#define I2C_REG_STS(a) ((a)->ioaddr + 0x04) /* Status reg (RO) */
50#define I2C_REG_CTL(a) ((a)->ioaddr + 0x08) /* Ctl reg */
51#define I2C_REG_CKL(a) ((a)->ioaddr + 0x0c) /* Clock divider low */
52#define I2C_REG_CKH(a) ((a)->ioaddr + 0x10) /* Clock divider high */
53#define I2C_REG_ADR(a) ((a)->ioaddr + 0x14) /* I2C address */
54#define I2C_REG_RFL(a) ((a)->ioaddr + 0x18) /* Rx FIFO level (RO) */
55#define I2C_REG_TFL(a) ((a)->ioaddr + 0x1c) /* Tx FIFO level (RO) */
56#define I2C_REG_RXB(a) ((a)->ioaddr + 0x20) /* Num of bytes Rx-ed (RO) */
57#define I2C_REG_TXB(a) ((a)->ioaddr + 0x24) /* Num of bytes Tx-ed (RO) */
58#define I2C_REG_TXS(a) ((a)->ioaddr + 0x28) /* Tx slave FIFO (RO) */
59#define I2C_REG_STFL(a) ((a)->ioaddr + 0x2c) /* Tx slave FIFO level (RO) */
60
61#define I2C_CHIP_NAME "PNX4008-I2C"
62
63#endif /* __ASM_ARCH_I2C_H */
diff --git a/arch/arm/plat-mxc/include/mach/board-pcm037.h b/arch/arm/mach-lpc32xx/include/mach/io.h
index 13411709b13a..9b59ab5cef89 100644
--- a/arch/arm/plat-mxc/include/mach/board-pcm037.h
+++ b/arch/arm/mach-lpc32xx/include/mach/io.h
@@ -1,5 +1,9 @@
1/* 1/*
2 * Copyright (C) 2008 Sascha Hauer, Pengutronix 2 * arch/arm/mach-lpc32xx/include/mach/io.h
3 *
4 * Author: Kevin Wells <kevin.wells@nxp.com>
5 *
6 * Copyright (C) 2010 NXP Semiconductors
3 * 7 *
4 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
@@ -10,13 +14,14 @@
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details. 16 * 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 */ 17 */
18 18
19#ifndef __ASM_ARCH_MXC_BOARD_PCM037_H__ 19#ifndef __ASM_ARM_ARCH_IO_H
20#define __ASM_ARCH_MXC_BOARD_PCM037_H__ 20#define __ASM_ARM_ARCH_IO_H
21
22#define IO_SPACE_LIMIT 0xffffffff
23
24#define __io(a) __typesafe_io(a)
25#define __mem_pci(a) (a)
21 26
22#endif /* __ASM_ARCH_MXC_BOARD_PCM037_H__ */ 27#endif
diff --git a/arch/arm/mach-lpc32xx/include/mach/irqs.h b/arch/arm/mach-lpc32xx/include/mach/irqs.h
new file mode 100644
index 000000000000..2667f52e3b04
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/include/mach/irqs.h
@@ -0,0 +1,117 @@
1/*
2 * arch/arm/mach-lpc32xx/include/mach/irqs.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_ARM_ARCH_IRQS_H
20#define __ASM_ARM_ARCH_IRQS_H
21
22#define LPC32XX_SIC1_IRQ(n) (32 + (n))
23#define LPC32XX_SIC2_IRQ(n) (64 + (n))
24
25/*
26 * MIC interrupts
27 */
28#define IRQ_LPC32XX_SUB1IRQ 0
29#define IRQ_LPC32XX_SUB2IRQ 1
30#define IRQ_LPC32XX_PWM3 3
31#define IRQ_LPC32XX_PWM4 4
32#define IRQ_LPC32XX_HSTIMER 5
33#define IRQ_LPC32XX_WATCH 6
34#define IRQ_LPC32XX_UART_IIR3 7
35#define IRQ_LPC32XX_UART_IIR4 8
36#define IRQ_LPC32XX_UART_IIR5 9
37#define IRQ_LPC32XX_UART_IIR6 10
38#define IRQ_LPC32XX_FLASH 11
39#define IRQ_LPC32XX_SD1 13
40#define IRQ_LPC32XX_LCD 14
41#define IRQ_LPC32XX_SD0 15
42#define IRQ_LPC32XX_TIMER0 16
43#define IRQ_LPC32XX_TIMER1 17
44#define IRQ_LPC32XX_TIMER2 18
45#define IRQ_LPC32XX_TIMER3 19
46#define IRQ_LPC32XX_SSP0 20
47#define IRQ_LPC32XX_SSP1 21
48#define IRQ_LPC32XX_I2S0 22
49#define IRQ_LPC32XX_I2S1 23
50#define IRQ_LPC32XX_UART_IIR7 24
51#define IRQ_LPC32XX_UART_IIR2 25
52#define IRQ_LPC32XX_UART_IIR1 26
53#define IRQ_LPC32XX_MSTIMER 27
54#define IRQ_LPC32XX_DMA 28
55#define IRQ_LPC32XX_ETHERNET 29
56#define IRQ_LPC32XX_SUB1FIQ 30
57#define IRQ_LPC32XX_SUB2FIQ 31
58
59/*
60 * SIC1 interrupts start at offset 32
61 */
62#define IRQ_LPC32XX_JTAG_COMM_TX LPC32XX_SIC1_IRQ(1)
63#define IRQ_LPC32XX_JTAG_COMM_RX LPC32XX_SIC1_IRQ(2)
64#define IRQ_LPC32XX_GPI_11 LPC32XX_SIC1_IRQ(4)
65#define IRQ_LPC32XX_TS_P LPC32XX_SIC1_IRQ(6)
66#define IRQ_LPC32XX_TS_IRQ LPC32XX_SIC1_IRQ(7)
67#define IRQ_LPC32XX_TS_AUX LPC32XX_SIC1_IRQ(8)
68#define IRQ_LPC32XX_SPI2 LPC32XX_SIC1_IRQ(12)
69#define IRQ_LPC32XX_PLLUSB LPC32XX_SIC1_IRQ(13)
70#define IRQ_LPC32XX_PLLHCLK LPC32XX_SIC1_IRQ(14)
71#define IRQ_LPC32XX_PLL397 LPC32XX_SIC1_IRQ(17)
72#define IRQ_LPC32XX_I2C_2 LPC32XX_SIC1_IRQ(18)
73#define IRQ_LPC32XX_I2C_1 LPC32XX_SIC1_IRQ(19)
74#define IRQ_LPC32XX_RTC LPC32XX_SIC1_IRQ(20)
75#define IRQ_LPC32XX_KEY LPC32XX_SIC1_IRQ(22)
76#define IRQ_LPC32XX_SPI1 LPC32XX_SIC1_IRQ(23)
77#define IRQ_LPC32XX_SW LPC32XX_SIC1_IRQ(24)
78#define IRQ_LPC32XX_USB_OTG_TIMER LPC32XX_SIC1_IRQ(25)
79#define IRQ_LPC32XX_USB_OTG_ATX LPC32XX_SIC1_IRQ(26)
80#define IRQ_LPC32XX_USB_HOST LPC32XX_SIC1_IRQ(27)
81#define IRQ_LPC32XX_USB_DEV_DMA LPC32XX_SIC1_IRQ(28)
82#define IRQ_LPC32XX_USB_DEV_LP LPC32XX_SIC1_IRQ(29)
83#define IRQ_LPC32XX_USB_DEV_HP LPC32XX_SIC1_IRQ(30)
84#define IRQ_LPC32XX_USB_I2C LPC32XX_SIC1_IRQ(31)
85
86/*
87 * SIC2 interrupts start at offset 64
88 */
89#define IRQ_LPC32XX_GPIO_00 LPC32XX_SIC2_IRQ(0)
90#define IRQ_LPC32XX_GPIO_01 LPC32XX_SIC2_IRQ(1)
91#define IRQ_LPC32XX_GPIO_02 LPC32XX_SIC2_IRQ(2)
92#define IRQ_LPC32XX_GPIO_03 LPC32XX_SIC2_IRQ(3)
93#define IRQ_LPC32XX_GPIO_04 LPC32XX_SIC2_IRQ(4)
94#define IRQ_LPC32XX_GPIO_05 LPC32XX_SIC2_IRQ(5)
95#define IRQ_LPC32XX_SPI2_DATAIN LPC32XX_SIC2_IRQ(6)
96#define IRQ_LPC32XX_U2_HCTS LPC32XX_SIC2_IRQ(7)
97#define IRQ_LPC32XX_P0_P1_IRQ LPC32XX_SIC2_IRQ(8)
98#define IRQ_LPC32XX_GPI_08 LPC32XX_SIC2_IRQ(9)
99#define IRQ_LPC32XX_GPI_09 LPC32XX_SIC2_IRQ(10)
100#define IRQ_LPC32XX_GPI_19 LPC32XX_SIC2_IRQ(11)
101#define IRQ_LPC32XX_U7_HCTS LPC32XX_SIC2_IRQ(12)
102#define IRQ_LPC32XX_GPI_07 LPC32XX_SIC2_IRQ(15)
103#define IRQ_LPC32XX_SDIO LPC32XX_SIC2_IRQ(18)
104#define IRQ_LPC32XX_U5_RX LPC32XX_SIC2_IRQ(19)
105#define IRQ_LPC32XX_SPI1_DATAIN LPC32XX_SIC2_IRQ(20)
106#define IRQ_LPC32XX_GPI_00 LPC32XX_SIC2_IRQ(22)
107#define IRQ_LPC32XX_GPI_01 LPC32XX_SIC2_IRQ(23)
108#define IRQ_LPC32XX_GPI_02 LPC32XX_SIC2_IRQ(24)
109#define IRQ_LPC32XX_GPI_03 LPC32XX_SIC2_IRQ(25)
110#define IRQ_LPC32XX_GPI_04 LPC32XX_SIC2_IRQ(26)
111#define IRQ_LPC32XX_GPI_05 LPC32XX_SIC2_IRQ(27)
112#define IRQ_LPC32XX_GPI_06 LPC32XX_SIC2_IRQ(28)
113#define IRQ_LPC32XX_SYSCLK LPC32XX_SIC2_IRQ(31)
114
115#define NR_IRQS 96
116
117#endif
diff --git a/arch/arm/mach-lpc32xx/include/mach/memory.h b/arch/arm/mach-lpc32xx/include/mach/memory.h
new file mode 100644
index 000000000000..044e1acecbe6
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/include/mach/memory.h
@@ -0,0 +1,27 @@
1/*
2 * arch/arm/mach-lpc32xx/include/mach/memory.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_MEMORY_H
20#define __ASM_ARCH_MEMORY_H
21
22/*
23 * Physical DRAM offset of bank 0
24 */
25#define PHYS_OFFSET UL(0x80000000)
26
27#endif
diff --git a/arch/arm/mach-lpc32xx/include/mach/platform.h b/arch/arm/mach-lpc32xx/include/mach/platform.h
new file mode 100644
index 000000000000..14ea8d1aadb5
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/include/mach/platform.h
@@ -0,0 +1,694 @@
1/*
2 * arch/arm/mach-lpc32xx/include/mach/platform.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_PLATFORM_H
20#define __ASM_ARCH_PLATFORM_H
21
22#define _SBF(f, v) ((v) << (f))
23#define _BIT(n) _SBF(n, 1)
24
25/*
26 * AHB 0 physical base addresses
27 */
28#define LPC32XX_SLC_BASE 0x20020000
29#define LPC32XX_SSP0_BASE 0x20084000
30#define LPC32XX_SPI1_BASE 0x20088000
31#define LPC32XX_SSP1_BASE 0x2008C000
32#define LPC32XX_SPI2_BASE 0x20090000
33#define LPC32XX_I2S0_BASE 0x20094000
34#define LPC32XX_SD_BASE 0x20098000
35#define LPC32XX_I2S1_BASE 0x2009C000
36#define LPC32XX_MLC_BASE 0x200A8000
37#define LPC32XX_AHB0_START LPC32XX_SLC_BASE
38#define LPC32XX_AHB0_SIZE 0x00089000
39
40/*
41 * AHB 1 physical base addresses
42 */
43#define LPC32XX_DMA_BASE 0x31000000
44#define LPC32XX_USB_BASE 0x31020000
45#define LPC32XX_USBH_BASE 0x31020000
46#define LPC32XX_USB_OTG_BASE 0x31020000
47#define LPC32XX_OTG_I2C_BASE 0x31020300
48#define LPC32XX_LCD_BASE 0x31040000
49#define LPC32XX_ETHERNET_BASE 0x31060000
50#define LPC32XX_EMC_BASE 0x31080000
51#define LPC32XX_ETB_CFG_BASE 0x310C0000
52#define LPC32XX_ETB_DATA_BASE 0x310E0000
53#define LPC32XX_AHB1_START LPC32XX_DMA_BASE
54#define LPC32XX_AHB1_SIZE 0x000E1000
55
56/*
57 * FAB physical base addresses
58 */
59#define LPC32XX_CLK_PM_BASE 0x40004000
60#define LPC32XX_MIC_BASE 0x40008000
61#define LPC32XX_SIC1_BASE 0x4000C000
62#define LPC32XX_SIC2_BASE 0x40010000
63#define LPC32XX_HS_UART1_BASE 0x40014000
64#define LPC32XX_HS_UART2_BASE 0x40018000
65#define LPC32XX_HS_UART7_BASE 0x4001C000
66#define LPC32XX_RTC_BASE 0x40024000
67#define LPC32XX_RTC_RAM_BASE 0x40024080
68#define LPC32XX_GPIO_BASE 0x40028000
69#define LPC32XX_PWM3_BASE 0x4002C000
70#define LPC32XX_PWM4_BASE 0x40030000
71#define LPC32XX_MSTIM_BASE 0x40034000
72#define LPC32XX_HSTIM_BASE 0x40038000
73#define LPC32XX_WDTIM_BASE 0x4003C000
74#define LPC32XX_DEBUG_CTRL_BASE 0x40040000
75#define LPC32XX_TIMER0_BASE 0x40044000
76#define LPC32XX_ADC_BASE 0x40048000
77#define LPC32XX_TIMER1_BASE 0x4004C000
78#define LPC32XX_KSCAN_BASE 0x40050000
79#define LPC32XX_UART_CTRL_BASE 0x40054000
80#define LPC32XX_TIMER2_BASE 0x40058000
81#define LPC32XX_PWM1_BASE 0x4005C000
82#define LPC32XX_PWM2_BASE 0x4005C004
83#define LPC32XX_TIMER3_BASE 0x40060000
84
85/*
86 * APB physical base addresses
87 */
88#define LPC32XX_UART3_BASE 0x40080000
89#define LPC32XX_UART4_BASE 0x40088000
90#define LPC32XX_UART5_BASE 0x40090000
91#define LPC32XX_UART6_BASE 0x40098000
92#define LPC32XX_I2C1_BASE 0x400A0000
93#define LPC32XX_I2C2_BASE 0x400A8000
94
95/*
96 * FAB and APB base and sizing
97 */
98#define LPC32XX_FABAPB_START LPC32XX_CLK_PM_BASE
99#define LPC32XX_FABAPB_SIZE 0x000A5000
100
101/*
102 * Internal memory bases and sizes
103 */
104#define LPC32XX_IRAM_BASE 0x08000000
105#define LPC32XX_IROM_BASE 0x0C000000
106
107/*
108 * External Static Memory Bank Address Space Bases
109 */
110#define LPC32XX_EMC_CS0_BASE 0xE0000000
111#define LPC32XX_EMC_CS1_BASE 0xE1000000
112#define LPC32XX_EMC_CS2_BASE 0xE2000000
113#define LPC32XX_EMC_CS3_BASE 0xE3000000
114
115/*
116 * External SDRAM Memory Bank Address Space Bases
117 */
118#define LPC32XX_EMC_DYCS0_BASE 0x80000000
119#define LPC32XX_EMC_DYCS1_BASE 0xA0000000
120
121/*
122 * Clock and crystal information
123 */
124#define LPC32XX_MAIN_OSC_FREQ 13000000
125#define LPC32XX_CLOCK_OSC_FREQ 32768
126
127/*
128 * Clock and Power control register offsets
129 */
130#define _PMREG(x) io_p2v(LPC32XX_CLK_PM_BASE +\
131 (x))
132#define LPC32XX_CLKPWR_DEBUG_CTRL _PMREG(0x000)
133#define LPC32XX_CLKPWR_BOOTMAP _PMREG(0x014)
134#define LPC32XX_CLKPWR_P01_ER _PMREG(0x018)
135#define LPC32XX_CLKPWR_USBCLK_PDIV _PMREG(0x01C)
136#define LPC32XX_CLKPWR_INT_ER _PMREG(0x020)
137#define LPC32XX_CLKPWR_INT_RS _PMREG(0x024)
138#define LPC32XX_CLKPWR_INT_SR _PMREG(0x028)
139#define LPC32XX_CLKPWR_INT_AP _PMREG(0x02C)
140#define LPC32XX_CLKPWR_PIN_ER _PMREG(0x030)
141#define LPC32XX_CLKPWR_PIN_RS _PMREG(0x034)
142#define LPC32XX_CLKPWR_PIN_SR _PMREG(0x038)
143#define LPC32XX_CLKPWR_PIN_AP _PMREG(0x03C)
144#define LPC32XX_CLKPWR_HCLK_DIV _PMREG(0x040)
145#define LPC32XX_CLKPWR_PWR_CTRL _PMREG(0x044)
146#define LPC32XX_CLKPWR_PLL397_CTRL _PMREG(0x048)
147#define LPC32XX_CLKPWR_MAIN_OSC_CTRL _PMREG(0x04C)
148#define LPC32XX_CLKPWR_SYSCLK_CTRL _PMREG(0x050)
149#define LPC32XX_CLKPWR_LCDCLK_CTRL _PMREG(0x054)
150#define LPC32XX_CLKPWR_HCLKPLL_CTRL _PMREG(0x058)
151#define LPC32XX_CLKPWR_ADC_CLK_CTRL_1 _PMREG(0x060)
152#define LPC32XX_CLKPWR_USB_CTRL _PMREG(0x064)
153#define LPC32XX_CLKPWR_SDRAMCLK_CTRL _PMREG(0x068)
154#define LPC32XX_CLKPWR_DDR_LAP_NOM _PMREG(0x06C)
155#define LPC32XX_CLKPWR_DDR_LAP_COUNT _PMREG(0x070)
156#define LPC32XX_CLKPWR_DDR_LAP_DELAY _PMREG(0x074)
157#define LPC32XX_CLKPWR_SSP_CLK_CTRL _PMREG(0x078)
158#define LPC32XX_CLKPWR_I2S_CLK_CTRL _PMREG(0x07C)
159#define LPC32XX_CLKPWR_MS_CTRL _PMREG(0x080)
160#define LPC32XX_CLKPWR_MACCLK_CTRL _PMREG(0x090)
161#define LPC32XX_CLKPWR_TEST_CLK_SEL _PMREG(0x0A4)
162#define LPC32XX_CLKPWR_SFW_INT _PMREG(0x0A8)
163#define LPC32XX_CLKPWR_I2C_CLK_CTRL _PMREG(0x0AC)
164#define LPC32XX_CLKPWR_KEY_CLK_CTRL _PMREG(0x0B0)
165#define LPC32XX_CLKPWR_ADC_CLK_CTRL _PMREG(0x0B4)
166#define LPC32XX_CLKPWR_PWM_CLK_CTRL _PMREG(0x0B8)
167#define LPC32XX_CLKPWR_TIMER_CLK_CTRL _PMREG(0x0BC)
168#define LPC32XX_CLKPWR_TIMERS_PWMS_CLK_CTRL_1 _PMREG(0x0C0)
169#define LPC32XX_CLKPWR_SPI_CLK_CTRL _PMREG(0x0C4)
170#define LPC32XX_CLKPWR_NAND_CLK_CTRL _PMREG(0x0C8)
171#define LPC32XX_CLKPWR_UART3_CLK_CTRL _PMREG(0x0D0)
172#define LPC32XX_CLKPWR_UART4_CLK_CTRL _PMREG(0x0D4)
173#define LPC32XX_CLKPWR_UART5_CLK_CTRL _PMREG(0x0D8)
174#define LPC32XX_CLKPWR_UART6_CLK_CTRL _PMREG(0x0DC)
175#define LPC32XX_CLKPWR_IRDA_CLK_CTRL _PMREG(0x0E0)
176#define LPC32XX_CLKPWR_UART_CLK_CTRL _PMREG(0x0E4)
177#define LPC32XX_CLKPWR_DMA_CLK_CTRL _PMREG(0x0E8)
178#define LPC32XX_CLKPWR_AUTOCLOCK _PMREG(0x0EC)
179#define LPC32XX_CLKPWR_DEVID(x) _PMREG(0x130 + (x))
180
181/*
182 * clkpwr_debug_ctrl register definitions
183*/
184#define LPC32XX_CLKPWR_VFP_CLOCK_ENABLE_BIT _BIT(4)
185
186/*
187 * clkpwr_bootmap register definitions
188 */
189#define LPC32XX_CLKPWR_BOOTMAP_SEL_BIT _BIT(1)
190
191/*
192 * clkpwr_start_gpio register bit definitions
193 */
194#define LPC32XX_CLKPWR_GPIOSRC_P1IO23_BIT _BIT(31)
195#define LPC32XX_CLKPWR_GPIOSRC_P1IO22_BIT _BIT(30)
196#define LPC32XX_CLKPWR_GPIOSRC_P1IO21_BIT _BIT(29)
197#define LPC32XX_CLKPWR_GPIOSRC_P1IO20_BIT _BIT(28)
198#define LPC32XX_CLKPWR_GPIOSRC_P1IO19_BIT _BIT(27)
199#define LPC32XX_CLKPWR_GPIOSRC_P1IO18_BIT _BIT(26)
200#define LPC32XX_CLKPWR_GPIOSRC_P1IO17_BIT _BIT(25)
201#define LPC32XX_CLKPWR_GPIOSRC_P1IO16_BIT _BIT(24)
202#define LPC32XX_CLKPWR_GPIOSRC_P1IO15_BIT _BIT(23)
203#define LPC32XX_CLKPWR_GPIOSRC_P1IO14_BIT _BIT(22)
204#define LPC32XX_CLKPWR_GPIOSRC_P1IO13_BIT _BIT(21)
205#define LPC32XX_CLKPWR_GPIOSRC_P1IO12_BIT _BIT(20)
206#define LPC32XX_CLKPWR_GPIOSRC_P1IO11_BIT _BIT(19)
207#define LPC32XX_CLKPWR_GPIOSRC_P1IO10_BIT _BIT(18)
208#define LPC32XX_CLKPWR_GPIOSRC_P1IO9_BIT _BIT(17)
209#define LPC32XX_CLKPWR_GPIOSRC_P1IO8_BIT _BIT(16)
210#define LPC32XX_CLKPWR_GPIOSRC_P1IO7_BIT _BIT(15)
211#define LPC32XX_CLKPWR_GPIOSRC_P1IO6_BIT _BIT(14)
212#define LPC32XX_CLKPWR_GPIOSRC_P1IO5_BIT _BIT(13)
213#define LPC32XX_CLKPWR_GPIOSRC_P1IO4_BIT _BIT(12)
214#define LPC32XX_CLKPWR_GPIOSRC_P1IO3_BIT _BIT(11)
215#define LPC32XX_CLKPWR_GPIOSRC_P1IO2_BIT _BIT(10)
216#define LPC32XX_CLKPWR_GPIOSRC_P1IO1_BIT _BIT(9)
217#define LPC32XX_CLKPWR_GPIOSRC_P1IO0_BIT _BIT(8)
218#define LPC32XX_CLKPWR_GPIOSRC_P0IO7_BIT _BIT(7)
219#define LPC32XX_CLKPWR_GPIOSRC_P0IO6_BIT _BIT(6)
220#define LPC32XX_CLKPWR_GPIOSRC_P0IO5_BIT _BIT(5)
221#define LPC32XX_CLKPWR_GPIOSRC_P0IO4_BIT _BIT(4)
222#define LPC32XX_CLKPWR_GPIOSRC_P0IO3_BIT _BIT(3)
223#define LPC32XX_CLKPWR_GPIOSRC_P0IO2_BIT _BIT(2)
224#define LPC32XX_CLKPWR_GPIOSRC_P0IO1_BIT _BIT(1)
225#define LPC32XX_CLKPWR_GPIOSRC_P0IO0_BIT _BIT(0)
226
227/*
228 * clkpwr_usbclk_pdiv register definitions
229 */
230#define LPC32XX_CLKPWR_USBPDIV_PLL_MASK 0xF
231
232/*
233 * clkpwr_start_int, clkpwr_start_raw_sts_int, clkpwr_start_sts_int,
234 * clkpwr_start_pol_int, register bit definitions
235 */
236#define LPC32XX_CLKPWR_INTSRC_ADC_BIT _BIT(31)
237#define LPC32XX_CLKPWR_INTSRC_TS_P_BIT _BIT(30)
238#define LPC32XX_CLKPWR_INTSRC_TS_AUX_BIT _BIT(29)
239#define LPC32XX_CLKPWR_INTSRC_USBAHNEEDCLK_BIT _BIT(26)
240#define LPC32XX_CLKPWR_INTSRC_MSTIMER_BIT _BIT(25)
241#define LPC32XX_CLKPWR_INTSRC_RTC_BIT _BIT(24)
242#define LPC32XX_CLKPWR_INTSRC_USBNEEDCLK_BIT _BIT(23)
243#define LPC32XX_CLKPWR_INTSRC_USB_BIT _BIT(22)
244#define LPC32XX_CLKPWR_INTSRC_I2C_BIT _BIT(21)
245#define LPC32XX_CLKPWR_INTSRC_USBOTGTIMER_BIT _BIT(20)
246#define LPC32XX_CLKPWR_INTSRC_USBATXINT_BIT _BIT(19)
247#define LPC32XX_CLKPWR_INTSRC_KEY_BIT _BIT(16)
248#define LPC32XX_CLKPWR_INTSRC_MAC_BIT _BIT(7)
249#define LPC32XX_CLKPWR_INTSRC_P0P1_BIT _BIT(6)
250#define LPC32XX_CLKPWR_INTSRC_GPIO_05_BIT _BIT(5)
251#define LPC32XX_CLKPWR_INTSRC_GPIO_04_BIT _BIT(4)
252#define LPC32XX_CLKPWR_INTSRC_GPIO_03_BIT _BIT(3)
253#define LPC32XX_CLKPWR_INTSRC_GPIO_02_BIT _BIT(2)
254#define LPC32XX_CLKPWR_INTSRC_GPIO_01_BIT _BIT(1)
255#define LPC32XX_CLKPWR_INTSRC_GPIO_00_BIT _BIT(0)
256
257/*
258 * clkpwr_start_pin, clkpwr_start_raw_sts_pin, clkpwr_start_sts_pin,
259 * clkpwr_start_pol_pin register bit definitions
260 */
261#define LPC32XX_CLKPWR_EXTSRC_U7_RX_BIT _BIT(31)
262#define LPC32XX_CLKPWR_EXTSRC_U7_HCTS_BIT _BIT(30)
263#define LPC32XX_CLKPWR_EXTSRC_U6_IRRX_BIT _BIT(28)
264#define LPC32XX_CLKPWR_EXTSRC_U5_RX_BIT _BIT(26)
265#define LPC32XX_CLKPWR_EXTSRC_GPI_28_BIT _BIT(25)
266#define LPC32XX_CLKPWR_EXTSRC_U3_RX_BIT _BIT(24)
267#define LPC32XX_CLKPWR_EXTSRC_U2_HCTS_BIT _BIT(23)
268#define LPC32XX_CLKPWR_EXTSRC_U2_RX_BIT _BIT(22)
269#define LPC32XX_CLKPWR_EXTSRC_U1_RX_BIT _BIT(21)
270#define LPC32XX_CLKPWR_EXTSRC_MSDIO_INT_BIT _BIT(18)
271#define LPC32XX_CLKPWR_EXTSRC_MSDIO_SRT_BIT _BIT(17)
272#define LPC32XX_CLKPWR_EXTSRC_GPI_06_BIT _BIT(16)
273#define LPC32XX_CLKPWR_EXTSRC_GPI_05_BIT _BIT(15)
274#define LPC32XX_CLKPWR_EXTSRC_GPI_04_BIT _BIT(14)
275#define LPC32XX_CLKPWR_EXTSRC_GPI_03_BIT _BIT(13)
276#define LPC32XX_CLKPWR_EXTSRC_GPI_02_BIT _BIT(12)
277#define LPC32XX_CLKPWR_EXTSRC_GPI_01_BIT _BIT(11)
278#define LPC32XX_CLKPWR_EXTSRC_GPI_00_BIT _BIT(10)
279#define LPC32XX_CLKPWR_EXTSRC_SYSCLKEN_BIT _BIT(9)
280#define LPC32XX_CLKPWR_EXTSRC_SPI1_DATIN_BIT _BIT(8)
281#define LPC32XX_CLKPWR_EXTSRC_GPI_07_BIT _BIT(7)
282#define LPC32XX_CLKPWR_EXTSRC_SPI2_DATIN_BIT _BIT(6)
283#define LPC32XX_CLKPWR_EXTSRC_GPI_19_BIT _BIT(5)
284#define LPC32XX_CLKPWR_EXTSRC_GPI_09_BIT _BIT(4)
285#define LPC32XX_CLKPWR_EXTSRC_GPI_08_BIT _BIT(3)
286
287/*
288 * clkpwr_hclk_div register definitions
289 */
290#define LPC32XX_CLKPWR_HCLKDIV_DDRCLK_STOP (0x0 << 7)
291#define LPC32XX_CLKPWR_HCLKDIV_DDRCLK_NORM (0x1 << 7)
292#define LPC32XX_CLKPWR_HCLKDIV_DDRCLK_HALF (0x2 << 7)
293#define LPC32XX_CLKPWR_HCLKDIV_PCLK_DIV(n) (((n) & 0x1F) << 2)
294#define LPC32XX_CLKPWR_HCLKDIV_DIV_2POW(n) ((n) & 0x3)
295
296/*
297 * clkpwr_pwr_ctrl register definitions
298 */
299#define LPC32XX_CLKPWR_CTRL_FORCE_PCLK _BIT(10)
300#define LPC32XX_CLKPWR_SDRAM_SELF_RFSH _BIT(9)
301#define LPC32XX_CLKPWR_UPD_SDRAM_SELF_RFSH _BIT(8)
302#define LPC32XX_CLKPWR_AUTO_SDRAM_SELF_RFSH _BIT(7)
303#define LPC32XX_CLKPWR_HIGHCORE_STATE_BIT _BIT(5)
304#define LPC32XX_CLKPWR_SYSCLKEN_STATE_BIT _BIT(4)
305#define LPC32XX_CLKPWR_SYSCLKEN_GPIO_EN _BIT(3)
306#define LPC32XX_CLKPWR_SELECT_RUN_MODE _BIT(2)
307#define LPC32XX_CLKPWR_HIGHCORE_GPIO_EN _BIT(1)
308#define LPC32XX_CLKPWR_STOP_MODE_CTRL _BIT(0)
309
310/*
311 * clkpwr_pll397_ctrl register definitions
312 */
313#define LPC32XX_CLKPWR_PLL397_MSLOCK_STS _BIT(10)
314#define LPC32XX_CLKPWR_PLL397_BYPASS _BIT(9)
315#define LPC32XX_CLKPWR_PLL397_BIAS_NORM 0x000
316#define LPC32XX_CLKPWR_PLL397_BIAS_N12_5 0x040
317#define LPC32XX_CLKPWR_PLL397_BIAS_N25 0x080
318#define LPC32XX_CLKPWR_PLL397_BIAS_N37_5 0x0C0
319#define LPC32XX_CLKPWR_PLL397_BIAS_P12_5 0x100
320#define LPC32XX_CLKPWR_PLL397_BIAS_P25 0x140
321#define LPC32XX_CLKPWR_PLL397_BIAS_P37_5 0x180
322#define LPC32XX_CLKPWR_PLL397_BIAS_P50 0x1C0
323#define LPC32XX_CLKPWR_PLL397_BIAS_MASK 0x1C0
324#define LPC32XX_CLKPWR_SYSCTRL_PLL397_DIS _BIT(1)
325#define LPC32XX_CLKPWR_SYSCTRL_PLL397_STS _BIT(0)
326
327/*
328 * clkpwr_main_osc_ctrl register definitions
329 */
330#define LPC32XX_CLKPWR_MOSC_ADD_CAP(n) (((n) & 0x7F) << 2)
331#define LPC32XX_CLKPWR_MOSC_CAP_MASK (0x7F << 2)
332#define LPC32XX_CLKPWR_TEST_MODE _BIT(1)
333#define LPC32XX_CLKPWR_MOSC_DISABLE _BIT(0)
334
335/*
336 * clkpwr_sysclk_ctrl register definitions
337 */
338#define LPC32XX_CLKPWR_SYSCTRL_BP_TRIG(n) (((n) & 0x3FF) << 2)
339#define LPC32XX_CLKPWR_SYSCTRL_BP_MASK (0x3FF << 2)
340#define LPC32XX_CLKPWR_SYSCTRL_USEPLL397 _BIT(1)
341#define LPC32XX_CLKPWR_SYSCTRL_SYSCLKMUX _BIT(0)
342
343/*
344 * clkpwr_lcdclk_ctrl register definitions
345 */
346#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_TFT12 0x000
347#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_TFT16 0x040
348#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_TFT15 0x080
349#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_TFT24 0x0C0
350#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_STN4M 0x100
351#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_STN8C 0x140
352#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_DSTN4M 0x180
353#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_DSTN8C 0x1C0
354#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_MSK 0x01C0
355#define LPC32XX_CLKPWR_LCDCTRL_CLK_EN 0x020
356#define LPC32XX_CLKPWR_LCDCTRL_SET_PSCALE(n) ((n - 1) & 0x1F)
357#define LPC32XX_CLKPWR_LCDCTRL_PSCALE_MSK 0x001F
358
359/*
360 * clkpwr_hclkpll_ctrl register definitions
361 */
362#define LPC32XX_CLKPWR_HCLKPLL_POWER_UP _BIT(16)
363#define LPC32XX_CLKPWR_HCLKPLL_CCO_BYPASS _BIT(15)
364#define LPC32XX_CLKPWR_HCLKPLL_POSTDIV_BYPASS _BIT(14)
365#define LPC32XX_CLKPWR_HCLKPLL_FDBK_SEL_FCLK _BIT(13)
366#define LPC32XX_CLKPWR_HCLKPLL_POSTDIV_2POW(n) (((n) & 0x3) << 11)
367#define LPC32XX_CLKPWR_HCLKPLL_PREDIV_PLUS1(n) (((n) & 0x3) << 9)
368#define LPC32XX_CLKPWR_HCLKPLL_PLLM(n) (((n) & 0xFF) << 1)
369#define LPC32XX_CLKPWR_HCLKPLL_PLL_STS _BIT(0)
370
371/*
372 * clkpwr_adc_clk_ctrl_1 register definitions
373 */
374#define LPC32XX_CLKPWR_ADCCTRL1_RTDIV(n) (((n) & 0xFF) << 0)
375#define LPC32XX_CLKPWR_ADCCTRL1_PCLK_SEL _BIT(8)
376
377/*
378 * clkpwr_usb_ctrl register definitions
379 */
380#define LPC32XX_CLKPWR_USBCTRL_HCLK_EN _BIT(24)
381#define LPC32XX_CLKPWR_USBCTRL_USBI2C_EN _BIT(23)
382#define LPC32XX_CLKPWR_USBCTRL_USBDVND_EN _BIT(22)
383#define LPC32XX_CLKPWR_USBCTRL_USBHSTND_EN _BIT(21)
384#define LPC32XX_CLKPWR_USBCTRL_PU_ADD (0x0 << 19)
385#define LPC32XX_CLKPWR_USBCTRL_BUS_KEEPER (0x1 << 19)
386#define LPC32XX_CLKPWR_USBCTRL_PD_ADD (0x3 << 19)
387#define LPC32XX_CLKPWR_USBCTRL_CLK_EN2 _BIT(18)
388#define LPC32XX_CLKPWR_USBCTRL_CLK_EN1 _BIT(17)
389#define LPC32XX_CLKPWR_USBCTRL_PLL_PWRUP _BIT(16)
390#define LPC32XX_CLKPWR_USBCTRL_CCO_BYPASS _BIT(15)
391#define LPC32XX_CLKPWR_USBCTRL_POSTDIV_BYPASS _BIT(14)
392#define LPC32XX_CLKPWR_USBCTRL_FDBK_SEL_FCLK _BIT(13)
393#define LPC32XX_CLKPWR_USBCTRL_POSTDIV_2POW(n) (((n) & 0x3) << 11)
394#define LPC32XX_CLKPWR_USBCTRL_PREDIV_PLUS1(n) (((n) & 0x3) << 9)
395#define LPC32XX_CLKPWR_USBCTRL_FDBK_PLUS1(n) (((n) & 0xFF) << 1)
396#define LPC32XX_CLKPWR_USBCTRL_PLL_STS _BIT(0)
397
398/*
399 * clkpwr_sdramclk_ctrl register definitions
400 */
401#define LPC32XX_CLKPWR_SDRCLK_FASTSLEW_CLK _BIT(22)
402#define LPC32XX_CLKPWR_SDRCLK_FASTSLEW _BIT(21)
403#define LPC32XX_CLKPWR_SDRCLK_FASTSLEW_DAT _BIT(20)
404#define LPC32XX_CLKPWR_SDRCLK_SW_DDR_RESET _BIT(19)
405#define LPC32XX_CLKPWR_SDRCLK_HCLK_DLY(n) (((n) & 0x1F) << 14)
406#define LPC32XX_CLKPWR_SDRCLK_DLY_ADDR_STS _BIT(13)
407#define LPC32XX_CLKPWR_SDRCLK_SENS_FACT(n) (((n) & 0x7) << 10)
408#define LPC32XX_CLKPWR_SDRCLK_USE_CAL _BIT(9)
409#define LPC32XX_CLKPWR_SDRCLK_DO_CAL _BIT(8)
410#define LPC32XX_CLKPWR_SDRCLK_CAL_ON_RTC _BIT(7)
411#define LPC32XX_CLKPWR_SDRCLK_DQS_DLY(n) (((n) & 0x1F) << 2)
412#define LPC32XX_CLKPWR_SDRCLK_USE_DDR _BIT(1)
413#define LPC32XX_CLKPWR_SDRCLK_CLK_DIS _BIT(0)
414
415/*
416 * clkpwr_ssp_blk_ctrl register definitions
417 */
418#define LPC32XX_CLKPWR_SSPCTRL_DMA_SSP1RX _BIT(5)
419#define LPC32XX_CLKPWR_SSPCTRL_DMA_SSP1TX _BIT(4)
420#define LPC32XX_CLKPWR_SSPCTRL_DMA_SSP0RX _BIT(3)
421#define LPC32XX_CLKPWR_SSPCTRL_DMA_SSP0TX _BIT(2)
422#define LPC32XX_CLKPWR_SSPCTRL_SSPCLK1_EN _BIT(1)
423#define LPC32XX_CLKPWR_SSPCTRL_SSPCLK0_EN _BIT(0)
424
425/*
426 * clkpwr_i2s_clk_ctrl register definitions
427 */
428#define LPC32XX_CLKPWR_I2SCTRL_I2S1_RX_FOR_TX _BIT(6)
429#define LPC32XX_CLKPWR_I2SCTRL_I2S1_TX_FOR_RX _BIT(5)
430#define LPC32XX_CLKPWR_I2SCTRL_I2S1_USE_DMA _BIT(4)
431#define LPC32XX_CLKPWR_I2SCTRL_I2S0_RX_FOR_TX _BIT(3)
432#define LPC32XX_CLKPWR_I2SCTRL_I2S0_TX_FOR_RX _BIT(2)
433#define LPC32XX_CLKPWR_I2SCTRL_I2SCLK1_EN _BIT(1)
434#define LPC32XX_CLKPWR_I2SCTRL_I2SCLK0_EN _BIT(0)
435
436/*
437 * clkpwr_ms_ctrl register definitions
438 */
439#define LPC32XX_CLKPWR_MSCARD_MSDIO_PIN_DIS _BIT(10)
440#define LPC32XX_CLKPWR_MSCARD_MSDIO_PU_EN _BIT(9)
441#define LPC32XX_CLKPWR_MSCARD_MSDIO23_DIS _BIT(8)
442#define LPC32XX_CLKPWR_MSCARD_MSDIO1_DIS _BIT(7)
443#define LPC32XX_CLKPWR_MSCARD_MSDIO0_DIS _BIT(6)
444#define LPC32XX_CLKPWR_MSCARD_SDCARD_EN _BIT(5)
445#define LPC32XX_CLKPWR_MSCARD_SDCARD_DIV(n) ((n) & 0xF)
446
447/*
448 * clkpwr_macclk_ctrl register definitions
449 */
450#define LPC32XX_CLKPWR_MACCTRL_NO_ENET_PIS 0x00
451#define LPC32XX_CLKPWR_MACCTRL_USE_MII_PINS 0x08
452#define LPC32XX_CLKPWR_MACCTRL_USE_RMII_PINS 0x18
453#define LPC32XX_CLKPWR_MACCTRL_PINS_MSK 0x18
454#define LPC32XX_CLKPWR_MACCTRL_DMACLK_EN _BIT(2)
455#define LPC32XX_CLKPWR_MACCTRL_MMIOCLK_EN _BIT(1)
456#define LPC32XX_CLKPWR_MACCTRL_HRCCLK_EN _BIT(0)
457
458/*
459 * clkpwr_test_clk_sel register definitions
460 */
461#define LPC32XX_CLKPWR_TESTCLK1_SEL_PERCLK (0x0 << 5)
462#define LPC32XX_CLKPWR_TESTCLK1_SEL_RTC (0x1 << 5)
463#define LPC32XX_CLKPWR_TESTCLK1_SEL_MOSC (0x2 << 5)
464#define LPC32XX_CLKPWR_TESTCLK1_SEL_MASK (0x3 << 5)
465#define LPC32XX_CLKPWR_TESTCLK_TESTCLK1_EN _BIT(4)
466#define LPC32XX_CLKPWR_TESTCLK2_SEL_HCLK (0x0 << 1)
467#define LPC32XX_CLKPWR_TESTCLK2_SEL_PERCLK (0x1 << 1)
468#define LPC32XX_CLKPWR_TESTCLK2_SEL_USBCLK (0x2 << 1)
469#define LPC32XX_CLKPWR_TESTCLK2_SEL_MOSC (0x5 << 1)
470#define LPC32XX_CLKPWR_TESTCLK2_SEL_PLL397 (0x7 << 1)
471#define LPC32XX_CLKPWR_TESTCLK2_SEL_MASK (0x7 << 1)
472#define LPC32XX_CLKPWR_TESTCLK_TESTCLK2_EN _BIT(0)
473
474/*
475 * clkpwr_sw_int register definitions
476 */
477#define LPC32XX_CLKPWR_SW_INT(n) (_BIT(0) | (((n) & 0x7F) << 1))
478#define LPC32XX_CLKPWR_SW_GET_ARG(n) (((n) & 0xFE) >> 1)
479
480/*
481 * clkpwr_i2c_clk_ctrl register definitions
482 */
483#define LPC32XX_CLKPWR_I2CCLK_USBI2CHI_DRIVE _BIT(4)
484#define LPC32XX_CLKPWR_I2CCLK_I2C2HI_DRIVE _BIT(3)
485#define LPC32XX_CLKPWR_I2CCLK_I2C1HI_DRIVE _BIT(2)
486#define LPC32XX_CLKPWR_I2CCLK_I2C2CLK_EN _BIT(1)
487#define LPC32XX_CLKPWR_I2CCLK_I2C1CLK_EN _BIT(0)
488
489/*
490 * clkpwr_key_clk_ctrl register definitions
491 */
492#define LPC32XX_CLKPWR_KEYCLKCTRL_CLK_EN 0x1
493
494/*
495 * clkpwr_adc_clk_ctrl register definitions
496 */
497#define LPC32XX_CLKPWR_ADC32CLKCTRL_CLK_EN 0x1
498
499/*
500 * clkpwr_pwm_clk_ctrl register definitions
501 */
502#define LPC32XX_CLKPWR_PWMCLK_PWM2_DIV(n) (((n) & 0xF) << 8)
503#define LPC32XX_CLKPWR_PWMCLK_PWM1_DIV(n) (((n) & 0xF) << 4)
504#define LPC32XX_CLKPWR_PWMCLK_PWM2SEL_PCLK 0x8
505#define LPC32XX_CLKPWR_PWMCLK_PWM2CLK_EN 0x4
506#define LPC32XX_CLKPWR_PWMCLK_PWM1SEL_PCLK 0x2
507#define LPC32XX_CLKPWR_PWMCLK_PWM1CLK_EN 0x1
508
509/*
510 * clkpwr_timer_clk_ctrl register definitions
511 */
512#define LPC32XX_CLKPWR_PWMCLK_HSTIMER_EN 0x2
513#define LPC32XX_CLKPWR_PWMCLK_WDOG_EN 0x1
514
515/*
516 * clkpwr_timers_pwms_clk_ctrl_1 register definitions
517 */
518#define LPC32XX_CLKPWR_TMRPWMCLK_TIMER3_EN 0x20
519#define LPC32XX_CLKPWR_TMRPWMCLK_TIMER2_EN 0x10
520#define LPC32XX_CLKPWR_TMRPWMCLK_TIMER1_EN 0x08
521#define LPC32XX_CLKPWR_TMRPWMCLK_TIMER0_EN 0x04
522#define LPC32XX_CLKPWR_TMRPWMCLK_PWM4_EN 0x02
523#define LPC32XX_CLKPWR_TMRPWMCLK_PWM3_EN 0x01
524
525/*
526 * clkpwr_spi_clk_ctrl register definitions
527 */
528#define LPC32XX_CLKPWR_SPICLK_SET_SPI2DATIO 0x80
529#define LPC32XX_CLKPWR_SPICLK_SET_SPI2CLK 0x40
530#define LPC32XX_CLKPWR_SPICLK_USE_SPI2 0x20
531#define LPC32XX_CLKPWR_SPICLK_SPI2CLK_EN 0x10
532#define LPC32XX_CLKPWR_SPICLK_SET_SPI1DATIO 0x08
533#define LPC32XX_CLKPWR_SPICLK_SET_SPI1CLK 0x04
534#define LPC32XX_CLKPWR_SPICLK_USE_SPI1 0x02
535#define LPC32XX_CLKPWR_SPICLK_SPI1CLK_EN 0x01
536
537/*
538 * clkpwr_nand_clk_ctrl register definitions
539 */
540#define LPC32XX_CLKPWR_NANDCLK_INTSEL_MLC 0x20
541#define LPC32XX_CLKPWR_NANDCLK_DMA_RNB 0x10
542#define LPC32XX_CLKPWR_NANDCLK_DMA_INT 0x08
543#define LPC32XX_CLKPWR_NANDCLK_SEL_SLC 0x04
544#define LPC32XX_CLKPWR_NANDCLK_MLCCLK_EN 0x02
545#define LPC32XX_CLKPWR_NANDCLK_SLCCLK_EN 0x01
546
547/*
548 * clkpwr_uart3_clk_ctrl, clkpwr_uart4_clk_ctrl, clkpwr_uart5_clk_ctrl
549 * and clkpwr_uart6_clk_ctrl register definitions
550 */
551#define LPC32XX_CLKPWR_UART_Y_DIV(y) ((y) & 0xFF)
552#define LPC32XX_CLKPWR_UART_X_DIV(x) (((x) & 0xFF) << 8)
553#define LPC32XX_CLKPWR_UART_USE_HCLK _BIT(16)
554
555/*
556 * clkpwr_irda_clk_ctrl register definitions
557 */
558#define LPC32XX_CLKPWR_IRDA_Y_DIV(y) ((y) & 0xFF)
559#define LPC32XX_CLKPWR_IRDA_X_DIV(x) (((x) & 0xFF) << 8)
560
561/*
562 * clkpwr_uart_clk_ctrl register definitions
563 */
564#define LPC32XX_CLKPWR_UARTCLKCTRL_UART6_EN _BIT(3)
565#define LPC32XX_CLKPWR_UARTCLKCTRL_UART5_EN _BIT(2)
566#define LPC32XX_CLKPWR_UARTCLKCTRL_UART4_EN _BIT(1)
567#define LPC32XX_CLKPWR_UARTCLKCTRL_UART3_EN _BIT(0)
568
569/*
570 * clkpwr_dmaclk_ctrl register definitions
571 */
572#define LPC32XX_CLKPWR_DMACLKCTRL_CLK_EN 0x1
573
574/*
575 * clkpwr_autoclock register definitions
576 */
577#define LPC32XX_CLKPWR_AUTOCLK_USB_EN 0x40
578#define LPC32XX_CLKPWR_AUTOCLK_IRAM_EN 0x02
579#define LPC32XX_CLKPWR_AUTOCLK_IROM_EN 0x01
580
581/*
582 * Interrupt controller register offsets
583 */
584#define LPC32XX_INTC_MASK(x) io_p2v((x) + 0x00)
585#define LPC32XX_INTC_RAW_STAT(x) io_p2v((x) + 0x04)
586#define LPC32XX_INTC_STAT(x) io_p2v((x) + 0x08)
587#define LPC32XX_INTC_POLAR(x) io_p2v((x) + 0x0C)
588#define LPC32XX_INTC_ACT_TYPE(x) io_p2v((x) + 0x10)
589#define LPC32XX_INTC_TYPE(x) io_p2v((x) + 0x14)
590
591/*
592 * Timer/counter register offsets
593 */
594#define LCP32XX_TIMER_IR(x) io_p2v((x) + 0x00)
595#define LCP32XX_TIMER_TCR(x) io_p2v((x) + 0x04)
596#define LCP32XX_TIMER_TC(x) io_p2v((x) + 0x08)
597#define LCP32XX_TIMER_PR(x) io_p2v((x) + 0x0C)
598#define LCP32XX_TIMER_PC(x) io_p2v((x) + 0x10)
599#define LCP32XX_TIMER_MCR(x) io_p2v((x) + 0x14)
600#define LCP32XX_TIMER_MR0(x) io_p2v((x) + 0x18)
601#define LCP32XX_TIMER_MR1(x) io_p2v((x) + 0x1C)
602#define LCP32XX_TIMER_MR2(x) io_p2v((x) + 0x20)
603#define LCP32XX_TIMER_MR3(x) io_p2v((x) + 0x24)
604#define LCP32XX_TIMER_CCR(x) io_p2v((x) + 0x28)
605#define LCP32XX_TIMER_CR0(x) io_p2v((x) + 0x2C)
606#define LCP32XX_TIMER_CR1(x) io_p2v((x) + 0x30)
607#define LCP32XX_TIMER_CR2(x) io_p2v((x) + 0x34)
608#define LCP32XX_TIMER_CR3(x) io_p2v((x) + 0x38)
609#define LCP32XX_TIMER_EMR(x) io_p2v((x) + 0x3C)
610#define LCP32XX_TIMER_CTCR(x) io_p2v((x) + 0x70)
611
612/*
613 * ir register definitions
614 */
615#define LCP32XX_TIMER_CNTR_MTCH_BIT(n) (1 << ((n) & 0x3))
616#define LCP32XX_TIMER_CNTR_CAPT_BIT(n) (1 << (4 + ((n) & 0x3)))
617
618/*
619 * tcr register definitions
620 */
621#define LCP32XX_TIMER_CNTR_TCR_EN 0x1
622#define LCP32XX_TIMER_CNTR_TCR_RESET 0x2
623
624/*
625 * mcr register definitions
626 */
627#define LCP32XX_TIMER_CNTR_MCR_MTCH(n) (0x1 << ((n) * 3))
628#define LCP32XX_TIMER_CNTR_MCR_RESET(n) (0x1 << (((n) * 3) + 1))
629#define LCP32XX_TIMER_CNTR_MCR_STOP(n) (0x1 << (((n) * 3) + 2))
630
631/*
632 * Standard UART register offsets
633 */
634#define LPC32XX_UART_DLL_FIFO(x) io_p2v((x) + 0x00)
635#define LPC32XX_UART_DLM_IER(x) io_p2v((x) + 0x04)
636#define LPC32XX_UART_IIR_FCR(x) io_p2v((x) + 0x08)
637#define LPC32XX_UART_LCR(x) io_p2v((x) + 0x0C)
638#define LPC32XX_UART_MODEM_CTRL(x) io_p2v((x) + 0x10)
639#define LPC32XX_UART_LSR(x) io_p2v((x) + 0x14)
640#define LPC32XX_UART_MODEM_STATUS(x) io_p2v((x) + 0x18)
641#define LPC32XX_UART_RXLEV(x) io_p2v((x) + 0x1C)
642
643/*
644 * UART control structure offsets
645 */
646#define _UCREG(x) io_p2v(\
647 LPC32XX_UART_CTRL_BASE + (x))
648#define LPC32XX_UARTCTL_CTRL _UCREG(0x00)
649#define LPC32XX_UARTCTL_CLKMODE _UCREG(0x04)
650#define LPC32XX_UARTCTL_CLOOP _UCREG(0x08)
651
652/*
653 * ctrl register definitions
654 */
655#define LPC32XX_UART_U3_MD_CTRL_EN _BIT(11)
656#define LPC32XX_UART_IRRX6_INV_EN _BIT(10)
657#define LPC32XX_UART_HDPX_EN _BIT(9)
658#define LPC32XX_UART_UART6_IRDAMOD_BYPASS _BIT(5)
659#define LPC32XX_RT_IRTX6_INV_EN _BIT(4)
660#define LPC32XX_RT_IRTX6_INV_MIR_EN _BIT(3)
661#define LPC32XX_RT_RX_IRPULSE_3_16_115K _BIT(2)
662#define LPC32XX_RT_TX_IRPULSE_3_16_115K _BIT(1)
663#define LPC32XX_UART_U5_ROUTE_TO_USB _BIT(0)
664
665/*
666 * clkmode register definitions
667 */
668#define LPC32XX_UART_ENABLED_CLOCKS(n) (((n) >> 16) & 0x7F)
669#define LPC32XX_UART_ENABLED_CLOCK(n, u) (((n) >> (16 + (u))) & 0x1)
670#define LPC32XX_UART_ENABLED_CLKS_ANY _BIT(14)
671#define LPC32XX_UART_CLKMODE_OFF 0x0
672#define LPC32XX_UART_CLKMODE_ON 0x1
673#define LPC32XX_UART_CLKMODE_AUTO 0x2
674#define LPC32XX_UART_CLKMODE_MASK(u) (0x3 << ((((u) - 3) * 2) + 4))
675#define LPC32XX_UART_CLKMODE_LOAD(m, u) ((m) << ((((u) - 3) * 2) + 4))
676
677/*
678 * GPIO Module Register offsets
679 */
680#define _GPREG(x) io_p2v(LPC32XX_GPIO_BASE + (x))
681#define LPC32XX_GPIO_P_MUX_SET _GPREG(0x100)
682#define LPC32XX_GPIO_P_MUX_CLR _GPREG(0x104)
683#define LPC32XX_GPIO_P_MUX_STATE _GPREG(0x108)
684#define LPC32XX_GPIO_P3_MUX_SET _GPREG(0x110)
685#define LPC32XX_GPIO_P3_MUX_CLR _GPREG(0x114)
686#define LPC32XX_GPIO_P3_MUX_STATE _GPREG(0x118)
687#define LPC32XX_GPIO_P0_MUX_SET _GPREG(0x120)
688#define LPC32XX_GPIO_P0_MUX_CLR _GPREG(0x124)
689#define LPC32XX_GPIO_P0_MUX_STATE _GPREG(0x128)
690#define LPC32XX_GPIO_P1_MUX_SET _GPREG(0x130)
691#define LPC32XX_GPIO_P1_MUX_CLR _GPREG(0x134)
692#define LPC32XX_GPIO_P1_MUX_STATE _GPREG(0x138)
693
694#endif
diff --git a/arch/arm/mach-lpc32xx/include/mach/system.h b/arch/arm/mach-lpc32xx/include/mach/system.h
new file mode 100644
index 000000000000..df3b0dea4d7b
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/include/mach/system.h
@@ -0,0 +1,52 @@
1/*
2 * arch/arm/mach-lpc32xx/include/mach/system.h
3 *
4 * Author: Kevin Wells <kevin.wells@nxp.com>
5 *
6 * Copyright (C) 2010 NXP Semiconductors
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 */
18
19#ifndef __ASM_ARCH_SYSTEM_H
20#define __ASM_ARCH_SYSTEM_H
21
22static void arch_idle(void)
23{
24 cpu_do_idle();
25}
26
27static inline void arch_reset(char mode, const char *cmd)
28{
29 extern void lpc32xx_watchdog_reset(void);
30
31 switch (mode) {
32 case 's':
33 case 'h':
34 printk(KERN_CRIT "RESET: Rebooting system\n");
35
36 /* Disable interrupts */
37 local_irq_disable();
38
39 lpc32xx_watchdog_reset();
40 break;
41
42 default:
43 /* Do nothing */
44 break;
45 }
46
47 /* Wait for watchdog to reset system */
48 while (1)
49 ;
50}
51
52#endif
diff --git a/arch/arm/mach-lpc32xx/include/mach/timex.h b/arch/arm/mach-lpc32xx/include/mach/timex.h
new file mode 100644
index 000000000000..8d4066b16b3f
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/include/mach/timex.h
@@ -0,0 +1,28 @@
1/*
2 * arch/arm/mach-lpc32xx/include/mach/timex.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_TIMEX_H
20#define __ASM_ARCH_TIMEX_H
21
22/*
23 * Rate in Hz of the main system oscillator. This value should match
24 * the value 'MAIN_OSC_FREQ' in platform.h
25 */
26#define CLOCK_TICK_RATE 13000000
27
28#endif
diff --git a/arch/arm/mach-lpc32xx/include/mach/uncompress.h b/arch/arm/mach-lpc32xx/include/mach/uncompress.h
new file mode 100644
index 000000000000..c142487d299a
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/include/mach/uncompress.h
@@ -0,0 +1,60 @@
1/*
2 * arch/arm/mach-lpc32xx/include/mach/uncompress.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_ARM_ARCH_UNCOMPRESS_H
20#define __ASM_ARM_ARCH_UNCOMPRESS_H
21
22#include <linux/io.h>
23
24#include <mach/hardware.h>
25#include <mach/platform.h>
26
27/*
28 * Uncompress output is hardcoded to standard UART 5
29 */
30
31#define UART_FIFO_CTL_TX_RESET (1 << 2)
32#define UART_STATUS_TX_MT (1 << 6)
33
34#define _UARTREG(x) (void __iomem *)(LPC32XX_UART5_BASE + (x))
35
36#define LPC32XX_UART_DLLFIFO_O 0x00
37#define LPC32XX_UART_IIRFCR_O 0x08
38#define LPC32XX_UART_LSR_O 0x14
39
40static inline void putc(int ch)
41{
42 /* Wait for transmit FIFO to empty */
43 while ((__raw_readl(_UARTREG(LPC32XX_UART_LSR_O)) &
44 UART_STATUS_TX_MT) == 0)
45 ;
46
47 __raw_writel((u32) ch, _UARTREG(LPC32XX_UART_DLLFIFO_O));
48}
49
50static inline void flush(void)
51{
52 __raw_writel(__raw_readl(_UARTREG(LPC32XX_UART_IIRFCR_O)) |
53 UART_FIFO_CTL_TX_RESET, _UARTREG(LPC32XX_UART_IIRFCR_O));
54}
55
56/* NULL functions; we don't presently need them */
57#define arch_decomp_setup()
58#define arch_decomp_wdog()
59
60#endif
diff --git a/arch/arm/mach-lpc32xx/include/mach/vmalloc.h b/arch/arm/mach-lpc32xx/include/mach/vmalloc.h
new file mode 100644
index 000000000000..d1d936c7236d
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/include/mach/vmalloc.h
@@ -0,0 +1,24 @@
1/*
2 * arch/arm/mach-lpc32xx/include/mach/vmalloc.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_VMALLOC_H
20#define __ASM_ARCH_VMALLOC_H
21
22#define VMALLOC_END 0xF0000000
23
24#endif
diff --git a/arch/arm/mach-lpc32xx/irq.c b/arch/arm/mach-lpc32xx/irq.c
new file mode 100644
index 000000000000..bd0df26c415b
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/irq.c
@@ -0,0 +1,432 @@
1/*
2 * arch/arm/mach-lpc32xx/irq.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/types.h>
21#include <linux/interrupt.h>
22#include <linux/irq.h>
23#include <linux/err.h>
24#include <linux/io.h>
25
26#include <mach/irqs.h>
27#include <mach/hardware.h>
28#include <mach/platform.h>
29#include "common.h"
30
31/*
32 * Default value representing the Activation polarity of all internal
33 * interrupt sources
34 */
35#define MIC_APR_DEFAULT 0x3FF0EFE0
36#define SIC1_APR_DEFAULT 0xFBD27186
37#define SIC2_APR_DEFAULT 0x801810C0
38
39/*
40 * Default value representing the Activation Type of all internal
41 * interrupt sources. All are level sensitive.
42 */
43#define MIC_ATR_DEFAULT 0x00000000
44#define SIC1_ATR_DEFAULT 0x00026000
45#define SIC2_ATR_DEFAULT 0x00000000
46
47struct lpc32xx_event_group_regs {
48 void __iomem *enab_reg;
49 void __iomem *edge_reg;
50 void __iomem *maskstat_reg;
51 void __iomem *rawstat_reg;
52};
53
54static const struct lpc32xx_event_group_regs lpc32xx_event_int_regs = {
55 .enab_reg = LPC32XX_CLKPWR_INT_ER,
56 .edge_reg = LPC32XX_CLKPWR_INT_AP,
57 .maskstat_reg = LPC32XX_CLKPWR_INT_SR,
58 .rawstat_reg = LPC32XX_CLKPWR_INT_RS,
59};
60
61static const struct lpc32xx_event_group_regs lpc32xx_event_pin_regs = {
62 .enab_reg = LPC32XX_CLKPWR_PIN_ER,
63 .edge_reg = LPC32XX_CLKPWR_PIN_AP,
64 .maskstat_reg = LPC32XX_CLKPWR_PIN_SR,
65 .rawstat_reg = LPC32XX_CLKPWR_PIN_RS,
66};
67
68struct lpc32xx_event_info {
69 const struct lpc32xx_event_group_regs *event_group;
70 u32 mask;
71};
72
73/*
74 * Maps an IRQ number to and event mask and register
75 */
76static const struct lpc32xx_event_info lpc32xx_events[NR_IRQS] = {
77 [IRQ_LPC32XX_GPI_08] = {
78 .event_group = &lpc32xx_event_pin_regs,
79 .mask = LPC32XX_CLKPWR_EXTSRC_GPI_08_BIT,
80 },
81 [IRQ_LPC32XX_GPI_09] = {
82 .event_group = &lpc32xx_event_pin_regs,
83 .mask = LPC32XX_CLKPWR_EXTSRC_GPI_09_BIT,
84 },
85 [IRQ_LPC32XX_GPI_19] = {
86 .event_group = &lpc32xx_event_pin_regs,
87 .mask = LPC32XX_CLKPWR_EXTSRC_GPI_19_BIT,
88 },
89 [IRQ_LPC32XX_GPI_07] = {
90 .event_group = &lpc32xx_event_pin_regs,
91 .mask = LPC32XX_CLKPWR_EXTSRC_GPI_07_BIT,
92 },
93 [IRQ_LPC32XX_GPI_00] = {
94 .event_group = &lpc32xx_event_pin_regs,
95 .mask = LPC32XX_CLKPWR_EXTSRC_GPI_00_BIT,
96 },
97 [IRQ_LPC32XX_GPI_01] = {
98 .event_group = &lpc32xx_event_pin_regs,
99 .mask = LPC32XX_CLKPWR_EXTSRC_GPI_01_BIT,
100 },
101 [IRQ_LPC32XX_GPI_02] = {
102 .event_group = &lpc32xx_event_pin_regs,
103 .mask = LPC32XX_CLKPWR_EXTSRC_GPI_02_BIT,
104 },
105 [IRQ_LPC32XX_GPI_03] = {
106 .event_group = &lpc32xx_event_pin_regs,
107 .mask = LPC32XX_CLKPWR_EXTSRC_GPI_03_BIT,
108 },
109 [IRQ_LPC32XX_GPI_04] = {
110 .event_group = &lpc32xx_event_pin_regs,
111 .mask = LPC32XX_CLKPWR_EXTSRC_GPI_04_BIT,
112 },
113 [IRQ_LPC32XX_GPI_05] = {
114 .event_group = &lpc32xx_event_pin_regs,
115 .mask = LPC32XX_CLKPWR_EXTSRC_GPI_05_BIT,
116 },
117 [IRQ_LPC32XX_GPI_06] = {
118 .event_group = &lpc32xx_event_pin_regs,
119 .mask = LPC32XX_CLKPWR_EXTSRC_GPI_06_BIT,
120 },
121 [IRQ_LPC32XX_GPIO_00] = {
122 .event_group = &lpc32xx_event_int_regs,
123 .mask = LPC32XX_CLKPWR_INTSRC_GPIO_00_BIT,
124 },
125 [IRQ_LPC32XX_GPIO_01] = {
126 .event_group = &lpc32xx_event_int_regs,
127 .mask = LPC32XX_CLKPWR_INTSRC_GPIO_01_BIT,
128 },
129 [IRQ_LPC32XX_GPIO_02] = {
130 .event_group = &lpc32xx_event_int_regs,
131 .mask = LPC32XX_CLKPWR_INTSRC_GPIO_02_BIT,
132 },
133 [IRQ_LPC32XX_GPIO_03] = {
134 .event_group = &lpc32xx_event_int_regs,
135 .mask = LPC32XX_CLKPWR_INTSRC_GPIO_03_BIT,
136 },
137 [IRQ_LPC32XX_GPIO_04] = {
138 .event_group = &lpc32xx_event_int_regs,
139 .mask = LPC32XX_CLKPWR_INTSRC_GPIO_04_BIT,
140 },
141 [IRQ_LPC32XX_GPIO_05] = {
142 .event_group = &lpc32xx_event_int_regs,
143 .mask = LPC32XX_CLKPWR_INTSRC_GPIO_05_BIT,
144 },
145 [IRQ_LPC32XX_KEY] = {
146 .event_group = &lpc32xx_event_int_regs,
147 .mask = LPC32XX_CLKPWR_INTSRC_KEY_BIT,
148 },
149 [IRQ_LPC32XX_USB_OTG_ATX] = {
150 .event_group = &lpc32xx_event_int_regs,
151 .mask = LPC32XX_CLKPWR_INTSRC_USBATXINT_BIT,
152 },
153 [IRQ_LPC32XX_USB_HOST] = {
154 .event_group = &lpc32xx_event_int_regs,
155 .mask = LPC32XX_CLKPWR_INTSRC_USB_BIT,
156 },
157 [IRQ_LPC32XX_RTC] = {
158 .event_group = &lpc32xx_event_int_regs,
159 .mask = LPC32XX_CLKPWR_INTSRC_RTC_BIT,
160 },
161 [IRQ_LPC32XX_MSTIMER] = {
162 .event_group = &lpc32xx_event_int_regs,
163 .mask = LPC32XX_CLKPWR_INTSRC_MSTIMER_BIT,
164 },
165 [IRQ_LPC32XX_TS_AUX] = {
166 .event_group = &lpc32xx_event_int_regs,
167 .mask = LPC32XX_CLKPWR_INTSRC_TS_AUX_BIT,
168 },
169 [IRQ_LPC32XX_TS_P] = {
170 .event_group = &lpc32xx_event_int_regs,
171 .mask = LPC32XX_CLKPWR_INTSRC_TS_P_BIT,
172 },
173 [IRQ_LPC32XX_TS_IRQ] = {
174 .event_group = &lpc32xx_event_int_regs,
175 .mask = LPC32XX_CLKPWR_INTSRC_ADC_BIT,
176 },
177};
178
179static void get_controller(unsigned int irq, unsigned int *base,
180 unsigned int *irqbit)
181{
182 if (irq < 32) {
183 *base = LPC32XX_MIC_BASE;
184 *irqbit = 1 << irq;
185 } else if (irq < 64) {
186 *base = LPC32XX_SIC1_BASE;
187 *irqbit = 1 << (irq - 32);
188 } else {
189 *base = LPC32XX_SIC2_BASE;
190 *irqbit = 1 << (irq - 64);
191 }
192}
193
194static void lpc32xx_mask_irq(unsigned int irq)
195{
196 unsigned int reg, ctrl, mask;
197
198 get_controller(irq, &ctrl, &mask);
199
200 reg = __raw_readl(LPC32XX_INTC_MASK(ctrl)) & ~mask;
201 __raw_writel(reg, LPC32XX_INTC_MASK(ctrl));
202}
203
204static void lpc32xx_unmask_irq(unsigned int irq)
205{
206 unsigned int reg, ctrl, mask;
207
208 get_controller(irq, &ctrl, &mask);
209
210 reg = __raw_readl(LPC32XX_INTC_MASK(ctrl)) | mask;
211 __raw_writel(reg, LPC32XX_INTC_MASK(ctrl));
212}
213
214static void lpc32xx_ack_irq(unsigned int irq)
215{
216 unsigned int ctrl, mask;
217
218 get_controller(irq, &ctrl, &mask);
219
220 __raw_writel(mask, LPC32XX_INTC_RAW_STAT(ctrl));
221
222 /* Also need to clear pending wake event */
223 if (lpc32xx_events[irq].mask != 0)
224 __raw_writel(lpc32xx_events[irq].mask,
225 lpc32xx_events[irq].event_group->rawstat_reg);
226}
227
228static void __lpc32xx_set_irq_type(unsigned int irq, int use_high_level,
229 int use_edge)
230{
231 unsigned int reg, ctrl, mask;
232
233 get_controller(irq, &ctrl, &mask);
234
235 /* Activation level, high or low */
236 reg = __raw_readl(LPC32XX_INTC_POLAR(ctrl));
237 if (use_high_level)
238 reg |= mask;
239 else
240 reg &= ~mask;
241 __raw_writel(reg, LPC32XX_INTC_POLAR(ctrl));
242
243 /* Activation type, edge or level */
244 reg = __raw_readl(LPC32XX_INTC_ACT_TYPE(ctrl));
245 if (use_edge)
246 reg |= mask;
247 else
248 reg &= ~mask;
249 __raw_writel(reg, LPC32XX_INTC_ACT_TYPE(ctrl));
250
251 /* Use same polarity for the wake events */
252 if (lpc32xx_events[irq].mask != 0) {
253 reg = __raw_readl(lpc32xx_events[irq].event_group->edge_reg);
254
255 if (use_high_level)
256 reg |= lpc32xx_events[irq].mask;
257 else
258 reg &= ~lpc32xx_events[irq].mask;
259
260 __raw_writel(reg, lpc32xx_events[irq].event_group->edge_reg);
261 }
262}
263
264static int lpc32xx_set_irq_type(unsigned int irq, unsigned int type)
265{
266 switch (type) {
267 case IRQ_TYPE_EDGE_RISING:
268 /* Rising edge sensitive */
269 __lpc32xx_set_irq_type(irq, 1, 1);
270 break;
271
272 case IRQ_TYPE_EDGE_FALLING:
273 /* Falling edge sensitive */
274 __lpc32xx_set_irq_type(irq, 0, 1);
275 break;
276
277 case IRQ_TYPE_LEVEL_LOW:
278 /* Low level sensitive */
279 __lpc32xx_set_irq_type(irq, 0, 0);
280 break;
281
282 case IRQ_TYPE_LEVEL_HIGH:
283 /* High level sensitive */
284 __lpc32xx_set_irq_type(irq, 1, 0);
285 break;
286
287 /* Other modes are not supported */
288 default:
289 return -EINVAL;
290 }
291
292 /* Ok to use the level handler for all types */
293 set_irq_handler(irq, handle_level_irq);
294
295 return 0;
296}
297
298static int lpc32xx_irq_wake(unsigned int irqno, unsigned int state)
299{
300 unsigned long eventreg;
301
302 if (lpc32xx_events[irqno].mask != 0) {
303 eventreg = __raw_readl(lpc32xx_events[irqno].
304 event_group->enab_reg);
305
306 if (state)
307 eventreg |= lpc32xx_events[irqno].mask;
308 else
309 eventreg &= ~lpc32xx_events[irqno].mask;
310
311 __raw_writel(eventreg,
312 lpc32xx_events[irqno].event_group->enab_reg);
313
314 return 0;
315 }
316
317 /* Clear event */
318 __raw_writel(lpc32xx_events[irqno].mask,
319 lpc32xx_events[irqno].event_group->rawstat_reg);
320
321 return -ENODEV;
322}
323
324static void __init lpc32xx_set_default_mappings(unsigned int apr,
325 unsigned int atr, unsigned int offset)
326{
327 unsigned int i;
328
329 /* Set activation levels for each interrupt */
330 i = 0;
331 while (i < 32) {
332 __lpc32xx_set_irq_type(offset + i, ((apr >> i) & 0x1),
333 ((atr >> i) & 0x1));
334 i++;
335 }
336}
337
338static struct irq_chip lpc32xx_irq_chip = {
339 .ack = lpc32xx_ack_irq,
340 .mask = lpc32xx_mask_irq,
341 .unmask = lpc32xx_unmask_irq,
342 .set_type = lpc32xx_set_irq_type,
343 .set_wake = lpc32xx_irq_wake
344};
345
346static void lpc32xx_sic1_handler(unsigned int irq, struct irq_desc *desc)
347{
348 unsigned long ints = __raw_readl(LPC32XX_INTC_STAT(LPC32XX_SIC1_BASE));
349
350 while (ints != 0) {
351 int irqno = fls(ints) - 1;
352
353 ints &= ~(1 << irqno);
354
355 generic_handle_irq(LPC32XX_SIC1_IRQ(irqno));
356 }
357}
358
359static void lpc32xx_sic2_handler(unsigned int irq, struct irq_desc *desc)
360{
361 unsigned long ints = __raw_readl(LPC32XX_INTC_STAT(LPC32XX_SIC2_BASE));
362
363 while (ints != 0) {
364 int irqno = fls(ints) - 1;
365
366 ints &= ~(1 << irqno);
367
368 generic_handle_irq(LPC32XX_SIC2_IRQ(irqno));
369 }
370}
371
372void __init lpc32xx_init_irq(void)
373{
374 unsigned int i;
375
376 /* Setup MIC */
377 __raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_MIC_BASE));
378 __raw_writel(MIC_APR_DEFAULT, LPC32XX_INTC_POLAR(LPC32XX_MIC_BASE));
379 __raw_writel(MIC_ATR_DEFAULT, LPC32XX_INTC_ACT_TYPE(LPC32XX_MIC_BASE));
380
381 /* Setup SIC1 */
382 __raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_SIC1_BASE));
383 __raw_writel(MIC_APR_DEFAULT, LPC32XX_INTC_POLAR(LPC32XX_SIC1_BASE));
384 __raw_writel(MIC_ATR_DEFAULT, LPC32XX_INTC_ACT_TYPE(LPC32XX_SIC1_BASE));
385
386 /* Setup SIC2 */
387 __raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_SIC2_BASE));
388 __raw_writel(MIC_APR_DEFAULT, LPC32XX_INTC_POLAR(LPC32XX_SIC2_BASE));
389 __raw_writel(MIC_ATR_DEFAULT, LPC32XX_INTC_ACT_TYPE(LPC32XX_SIC2_BASE));
390
391 /* Configure supported IRQ's */
392 for (i = 0; i < NR_IRQS; i++) {
393 set_irq_chip(i, &lpc32xx_irq_chip);
394 set_irq_handler(i, handle_level_irq);
395 set_irq_flags(i, IRQF_VALID);
396 }
397
398 /* Set default mappings */
399 lpc32xx_set_default_mappings(MIC_APR_DEFAULT, MIC_ATR_DEFAULT, 0);
400 lpc32xx_set_default_mappings(SIC1_APR_DEFAULT, SIC1_ATR_DEFAULT, 32);
401 lpc32xx_set_default_mappings(SIC2_APR_DEFAULT, SIC2_ATR_DEFAULT, 64);
402
403 /* mask all interrupts except SUBIRQ */
404 __raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_MIC_BASE));
405 __raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_SIC1_BASE));
406 __raw_writel(0, LPC32XX_INTC_MASK(LPC32XX_SIC2_BASE));
407
408 /* MIC SUBIRQx interrupts will route handling to the chain handlers */
409 set_irq_chained_handler(IRQ_LPC32XX_SUB1IRQ, lpc32xx_sic1_handler);
410 set_irq_chained_handler(IRQ_LPC32XX_SUB2IRQ, lpc32xx_sic2_handler);
411
412 /* Initially disable all wake events */
413 __raw_writel(0, LPC32XX_CLKPWR_P01_ER);
414 __raw_writel(0, LPC32XX_CLKPWR_INT_ER);
415 __raw_writel(0, LPC32XX_CLKPWR_PIN_ER);
416
417 /*
418 * Default wake activation polarities, all pin sources are low edge
419 * triggered
420 */
421 __raw_writel(LPC32XX_CLKPWR_INTSRC_TS_P_BIT |
422 LPC32XX_CLKPWR_INTSRC_MSTIMER_BIT |
423 LPC32XX_CLKPWR_INTSRC_RTC_BIT,
424 LPC32XX_CLKPWR_INT_AP);
425 __raw_writel(0, LPC32XX_CLKPWR_PIN_AP);
426
427 /* Clear latched wake event states */
428 __raw_writel(__raw_readl(LPC32XX_CLKPWR_PIN_RS),
429 LPC32XX_CLKPWR_PIN_RS);
430 __raw_writel(__raw_readl(LPC32XX_CLKPWR_INT_RS),
431 LPC32XX_CLKPWR_INT_RS);
432}
diff --git a/arch/arm/mach-lpc32xx/phy3250.c b/arch/arm/mach-lpc32xx/phy3250.c
new file mode 100644
index 000000000000..bc9a42da2145
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/phy3250.c
@@ -0,0 +1,397 @@
1/*
2 * arch/arm/mach-lpc32xx/phy3250.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/init.h>
20#include <linux/platform_device.h>
21#include <linux/sysdev.h>
22#include <linux/interrupt.h>
23#include <linux/irq.h>
24#include <linux/dma-mapping.h>
25#include <linux/device.h>
26#include <linux/spi/spi.h>
27#include <linux/spi/eeprom.h>
28#include <linux/leds.h>
29#include <linux/gpio.h>
30#include <linux/amba/bus.h>
31#include <linux/amba/clcd.h>
32#include <linux/amba/pl022.h>
33
34#include <asm/setup.h>
35#include <asm/mach-types.h>
36#include <asm/mach/arch.h>
37
38#include <mach/hardware.h>
39#include <mach/platform.h>
40#include "common.h"
41
42/*
43 * Mapped GPIOLIB GPIOs
44 */
45#define SPI0_CS_GPIO LPC32XX_GPIO(LPC32XX_GPIO_P3_GRP, 5)
46#define LCD_POWER_GPIO LPC32XX_GPIO(LPC32XX_GPO_P3_GRP, 0)
47#define BKL_POWER_GPIO LPC32XX_GPIO(LPC32XX_GPO_P3_GRP, 4)
48#define LED_GPIO LPC32XX_GPIO(LPC32XX_GPO_P3_GRP, 1)
49
50/*
51 * AMBA LCD controller
52 */
53static struct clcd_panel conn_lcd_panel = {
54 .mode = {
55 .name = "QVGA portrait",
56 .refresh = 60,
57 .xres = 240,
58 .yres = 320,
59 .pixclock = 191828,
60 .left_margin = 22,
61 .right_margin = 11,
62 .upper_margin = 2,
63 .lower_margin = 1,
64 .hsync_len = 5,
65 .vsync_len = 2,
66 .sync = 0,
67 .vmode = FB_VMODE_NONINTERLACED,
68 },
69 .width = -1,
70 .height = -1,
71 .tim2 = (TIM2_IVS | TIM2_IHS),
72 .cntl = (CNTL_BGR | CNTL_LCDTFT | CNTL_LCDVCOMP(1) |
73 CNTL_LCDBPP16_565),
74 .bpp = 16,
75};
76#define PANEL_SIZE (3 * SZ_64K)
77
78static int lpc32xx_clcd_setup(struct clcd_fb *fb)
79{
80 dma_addr_t dma;
81
82 fb->fb.screen_base = dma_alloc_writecombine(&fb->dev->dev,
83 PANEL_SIZE, &dma, GFP_KERNEL);
84 if (!fb->fb.screen_base) {
85 printk(KERN_ERR "CLCD: unable to map framebuffer\n");
86 return -ENOMEM;
87 }
88
89 fb->fb.fix.smem_start = dma;
90 fb->fb.fix.smem_len = PANEL_SIZE;
91 fb->panel = &conn_lcd_panel;
92
93 if (gpio_request(LCD_POWER_GPIO, "LCD power"))
94 printk(KERN_ERR "Error requesting gpio %u",
95 LCD_POWER_GPIO);
96 else if (gpio_direction_output(LCD_POWER_GPIO, 1))
97 printk(KERN_ERR "Error setting gpio %u to output",
98 LCD_POWER_GPIO);
99
100 if (gpio_request(BKL_POWER_GPIO, "LCD backlight power"))
101 printk(KERN_ERR "Error requesting gpio %u",
102 BKL_POWER_GPIO);
103 else if (gpio_direction_output(BKL_POWER_GPIO, 1))
104 printk(KERN_ERR "Error setting gpio %u to output",
105 BKL_POWER_GPIO);
106
107 return 0;
108}
109
110static int lpc32xx_clcd_mmap(struct clcd_fb *fb, struct vm_area_struct *vma)
111{
112 return dma_mmap_writecombine(&fb->dev->dev, vma,
113 fb->fb.screen_base, fb->fb.fix.smem_start,
114 fb->fb.fix.smem_len);
115}
116
117static void lpc32xx_clcd_remove(struct clcd_fb *fb)
118{
119 dma_free_writecombine(&fb->dev->dev, fb->fb.fix.smem_len,
120 fb->fb.screen_base, fb->fb.fix.smem_start);
121}
122
123/*
124 * On some early LCD modules (1307.0), the backlight logic is inverted.
125 * For those board variants, swap the disable and enable states for
126 * BKL_POWER_GPIO.
127*/
128static void clcd_disable(struct clcd_fb *fb)
129{
130 gpio_set_value(BKL_POWER_GPIO, 0);
131 gpio_set_value(LCD_POWER_GPIO, 0);
132}
133
134static void clcd_enable(struct clcd_fb *fb)
135{
136 gpio_set_value(BKL_POWER_GPIO, 1);
137 gpio_set_value(LCD_POWER_GPIO, 1);
138}
139
140static struct clcd_board lpc32xx_clcd_data = {
141 .name = "Phytec LCD",
142 .check = clcdfb_check,
143 .decode = clcdfb_decode,
144 .disable = clcd_disable,
145 .enable = clcd_enable,
146 .setup = lpc32xx_clcd_setup,
147 .mmap = lpc32xx_clcd_mmap,
148 .remove = lpc32xx_clcd_remove,
149};
150
151static struct amba_device lpc32xx_clcd_device = {
152 .dev = {
153 .coherent_dma_mask = ~0,
154 .init_name = "dev:clcd",
155 .platform_data = &lpc32xx_clcd_data,
156 },
157 .res = {
158 .start = LPC32XX_LCD_BASE,
159 .end = (LPC32XX_LCD_BASE + SZ_4K - 1),
160 .flags = IORESOURCE_MEM,
161 },
162 .dma_mask = ~0,
163 .irq = {IRQ_LPC32XX_LCD, NO_IRQ},
164};
165
166/*
167 * AMBA SSP (SPI)
168 */
169static void phy3250_spi_cs_set(u32 control)
170{
171 gpio_set_value(SPI0_CS_GPIO, (int) control);
172}
173
174static struct pl022_config_chip spi0_chip_info = {
175 .lbm = LOOPBACK_DISABLED,
176 .com_mode = INTERRUPT_TRANSFER,
177 .iface = SSP_INTERFACE_MOTOROLA_SPI,
178 .hierarchy = SSP_MASTER,
179 .slave_tx_disable = 0,
180 .endian_tx = SSP_TX_LSB,
181 .endian_rx = SSP_RX_LSB,
182 .data_size = SSP_DATA_BITS_8,
183 .rx_lev_trig = SSP_RX_4_OR_MORE_ELEM,
184 .tx_lev_trig = SSP_TX_4_OR_MORE_EMPTY_LOC,
185 .clk_phase = SSP_CLK_FIRST_EDGE,
186 .clk_pol = SSP_CLK_POL_IDLE_LOW,
187 .ctrl_len = SSP_BITS_8,
188 .wait_state = SSP_MWIRE_WAIT_ZERO,
189 .duplex = SSP_MICROWIRE_CHANNEL_FULL_DUPLEX,
190 .cs_control = phy3250_spi_cs_set,
191};
192
193static struct pl022_ssp_controller lpc32xx_ssp0_data = {
194 .bus_id = 0,
195 .num_chipselect = 1,
196 .enable_dma = 0,
197};
198
199static struct amba_device lpc32xx_ssp0_device = {
200 .dev = {
201 .coherent_dma_mask = ~0,
202 .init_name = "dev:ssp0",
203 .platform_data = &lpc32xx_ssp0_data,
204 },
205 .res = {
206 .start = LPC32XX_SSP0_BASE,
207 .end = (LPC32XX_SSP0_BASE + SZ_4K - 1),
208 .flags = IORESOURCE_MEM,
209 },
210 .dma_mask = ~0,
211 .irq = {IRQ_LPC32XX_SSP0, NO_IRQ},
212};
213
214/* AT25 driver registration */
215static int __init phy3250_spi_board_register(void)
216{
217#if defined(CONFIG_SPI_SPIDEV) || defined(CONFIG_SPI_SPIDEV_MODULE)
218 static struct spi_board_info info[] = {
219 {
220 .modalias = "spidev",
221 .max_speed_hz = 5000000,
222 .bus_num = 0,
223 .chip_select = 0,
224 .controller_data = &spi0_chip_info,
225 },
226 };
227
228#else
229 static struct spi_eeprom eeprom = {
230 .name = "at25256a",
231 .byte_len = 0x8000,
232 .page_size = 64,
233 .flags = EE_ADDR2,
234 };
235
236 static struct spi_board_info info[] = {
237 {
238 .modalias = "at25",
239 .max_speed_hz = 5000000,
240 .bus_num = 0,
241 .chip_select = 0,
242 .platform_data = &eeprom,
243 .controller_data = &spi0_chip_info,
244 },
245 };
246#endif
247 return spi_register_board_info(info, ARRAY_SIZE(info));
248}
249arch_initcall(phy3250_spi_board_register);
250
251static struct i2c_board_info __initdata phy3250_i2c_board_info[] = {
252 {
253 I2C_BOARD_INFO("pcf8563", 0x51),
254 },
255};
256
257static struct gpio_led phy_leds[] = {
258 {
259 .name = "led0",
260 .gpio = LED_GPIO,
261 .active_low = 1,
262 .default_trigger = "heartbeat",
263 },
264};
265
266static struct gpio_led_platform_data led_data = {
267 .leds = phy_leds,
268 .num_leds = ARRAY_SIZE(phy_leds),
269};
270
271static struct platform_device lpc32xx_gpio_led_device = {
272 .name = "leds-gpio",
273 .id = -1,
274 .dev.platform_data = &led_data,
275};
276
277static struct platform_device *phy3250_devs[] __initdata = {
278 &lpc32xx_i2c0_device,
279 &lpc32xx_i2c1_device,
280 &lpc32xx_i2c2_device,
281 &lpc32xx_watchdog_device,
282 &lpc32xx_gpio_led_device,
283};
284
285static struct amba_device *amba_devs[] __initdata = {
286 &lpc32xx_clcd_device,
287 &lpc32xx_ssp0_device,
288};
289
290/*
291 * Board specific functions
292 */
293static void __init phy3250_board_init(void)
294{
295 u32 tmp;
296 int i;
297
298 lpc32xx_gpio_init();
299
300 /* Register GPIOs used on this board */
301 if (gpio_request(SPI0_CS_GPIO, "spi0 cs"))
302 printk(KERN_ERR "Error requesting gpio %u",
303 SPI0_CS_GPIO);
304 else if (gpio_direction_output(SPI0_CS_GPIO, 1))
305 printk(KERN_ERR "Error setting gpio %u to output",
306 SPI0_CS_GPIO);
307
308 /* Setup network interface for RMII mode */
309 tmp = __raw_readl(LPC32XX_CLKPWR_MACCLK_CTRL);
310 tmp &= ~LPC32XX_CLKPWR_MACCTRL_PINS_MSK;
311 tmp |= LPC32XX_CLKPWR_MACCTRL_USE_RMII_PINS;
312 __raw_writel(tmp, LPC32XX_CLKPWR_MACCLK_CTRL);
313
314 /* Setup SLC NAND controller muxing */
315 __raw_writel(LPC32XX_CLKPWR_NANDCLK_SEL_SLC,
316 LPC32XX_CLKPWR_NAND_CLK_CTRL);
317
318 /* Setup LCD muxing to RGB565 */
319 tmp = __raw_readl(LPC32XX_CLKPWR_LCDCLK_CTRL) &
320 ~(LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_MSK |
321 LPC32XX_CLKPWR_LCDCTRL_PSCALE_MSK);
322 tmp |= LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_TFT16;
323 __raw_writel(tmp, LPC32XX_CLKPWR_LCDCLK_CTRL);
324
325 /* Set up I2C pull levels */
326 tmp = __raw_readl(LPC32XX_CLKPWR_I2C_CLK_CTRL);
327 tmp |= LPC32XX_CLKPWR_I2CCLK_USBI2CHI_DRIVE |
328 LPC32XX_CLKPWR_I2CCLK_I2C2HI_DRIVE;
329 __raw_writel(tmp, LPC32XX_CLKPWR_I2C_CLK_CTRL);
330
331 /* Disable IrDA pulsing support on UART6 */
332 tmp = __raw_readl(LPC32XX_UARTCTL_CTRL);
333 tmp |= LPC32XX_UART_UART6_IRDAMOD_BYPASS;
334 __raw_writel(tmp, LPC32XX_UARTCTL_CTRL);
335
336 /* Enable DMA for I2S1 channel */
337 tmp = __raw_readl(LPC32XX_CLKPWR_I2S_CLK_CTRL);
338 tmp = LPC32XX_CLKPWR_I2SCTRL_I2S1_USE_DMA;
339 __raw_writel(tmp, LPC32XX_CLKPWR_I2S_CLK_CTRL);
340
341 lpc32xx_serial_init();
342
343 /*
344 * AMBA peripheral clocks need to be enabled prior to AMBA device
345 * detection or a data fault will occur, so enable the clocks
346 * here. However, we don't want to enable them if the peripheral
347 * isn't included in the image
348 */
349#ifdef CONFIG_FB_ARMCLCD
350 tmp = __raw_readl(LPC32XX_CLKPWR_LCDCLK_CTRL);
351 __raw_writel((tmp | LPC32XX_CLKPWR_LCDCTRL_CLK_EN),
352 LPC32XX_CLKPWR_LCDCLK_CTRL);
353#endif
354#ifdef CONFIG_SPI_PL022
355 tmp = __raw_readl(LPC32XX_CLKPWR_SSP_CLK_CTRL);
356 __raw_writel((tmp | LPC32XX_CLKPWR_SSPCTRL_SSPCLK0_EN),
357 LPC32XX_CLKPWR_SSP_CLK_CTRL);
358#endif
359
360 platform_add_devices(phy3250_devs, ARRAY_SIZE(phy3250_devs));
361 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
362 struct amba_device *d = amba_devs[i];
363 amba_device_register(d, &iomem_resource);
364 }
365
366 /* Test clock needed for UDA1380 initial init */
367 __raw_writel(LPC32XX_CLKPWR_TESTCLK2_SEL_MOSC |
368 LPC32XX_CLKPWR_TESTCLK_TESTCLK2_EN,
369 LPC32XX_CLKPWR_TEST_CLK_SEL);
370
371 i2c_register_board_info(0, phy3250_i2c_board_info,
372 ARRAY_SIZE(phy3250_i2c_board_info));
373}
374
375static int __init lpc32xx_display_uid(void)
376{
377 u32 uid[4];
378
379 lpc32xx_get_uid(uid);
380
381 printk(KERN_INFO "LPC32XX unique ID: %08x%08x%08x%08x\n",
382 uid[3], uid[2], uid[1], uid[0]);
383
384 return 1;
385}
386arch_initcall(lpc32xx_display_uid);
387
388MACHINE_START(PHY3250, "Phytec 3250 board with the LPC3250 Microcontroller")
389 /* Maintainer: Kevin Wells, NXP Semiconductors */
390 .phys_io = LPC32XX_UART5_BASE,
391 .io_pg_offst = ((IO_ADDRESS(LPC32XX_UART5_BASE))>>18) & 0xfffc,
392 .boot_params = 0x80000100,
393 .map_io = lpc32xx_map_io,
394 .init_irq = lpc32xx_init_irq,
395 .timer = &lpc32xx_timer,
396 .init_machine = phy3250_board_init,
397MACHINE_END
diff --git a/arch/arm/mach-lpc32xx/pm.c b/arch/arm/mach-lpc32xx/pm.c
new file mode 100644
index 000000000000..a6e2aed9a49f
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/pm.c
@@ -0,0 +1,146 @@
1/*
2 * arch/arm/mach-lpc32xx/pm.c
3 *
4 * Original authors: Vitaly Wool, Dmitry Chigirev <source@mvista.com>
5 * Modified by Kevin Wells <kevin.wells@nxp.com>
6 *
7 * 2005 (c) MontaVista Software, Inc. This file is licensed under
8 * the terms of the GNU General Public License version 2. This program
9 * is licensed "as is" without any warranty of any kind, whether express
10 * or implied.
11 */
12
13/*
14 * LPC32XX CPU and system power management
15 *
16 * The LCP32XX has three CPU modes for controlling system power: run,
17 * direct-run, and halt modes. When switching between halt and run modes,
18 * the CPU transistions through direct-run mode. For Linux, direct-run
19 * mode is not used in normal operation. Halt mode is used when the
20 * system is fully suspended.
21 *
22 * Run mode:
23 * The ARM CPU clock (HCLK_PLL), HCLK bus clock, and PCLK bus clocks are
24 * derived from the HCLK PLL. The HCLK and PCLK bus rates are divided from
25 * the HCLK_PLL rate. Linux runs in this mode.
26 *
27 * Direct-run mode:
28 * The ARM CPU clock, HCLK bus clock, and PCLK bus clocks are driven from
29 * SYSCLK. SYSCLK is usually around 13MHz, but may vary based on SYSCLK
30 * source or the frequency of the main oscillator. In this mode, the
31 * HCLK_PLL can be safely enabled, changed, or disabled.
32 *
33 * Halt mode:
34 * SYSCLK is gated off and the CPU and system clocks are halted.
35 * Peripherals based on the 32KHz oscillator clock (ie, RTC, touch,
36 * key scanner, etc.) still operate if enabled. In this state, an enabled
37 * system event (ie, GPIO state change, RTC match, key press, etc.) will
38 * wake the system up back into direct-run mode.
39 *
40 * DRAM refresh
41 * DRAM clocking and refresh are slightly different for systems with DDR
42 * DRAM or regular SDRAM devices. If SDRAM is used in the system, the
43 * SDRAM will still be accessible in direct-run mode. In DDR based systems,
44 * a transistion to direct-run mode will stop all DDR accesses (no clocks).
45 * Because of this, the code to switch power modes and the code to enter
46 * and exit DRAM self-refresh modes must not be executed in DRAM. A small
47 * section of IRAM is used instead for this.
48 *
49 * Suspend is handled with the following logic:
50 * Backup a small area of IRAM used for the suspend code
51 * Copy suspend code to IRAM
52 * Transfer control to code in IRAM
53 * Places DRAMs in self-refresh mode
54 * Enter direct-run mode
55 * Save state of HCLK_PLL PLL
56 * Disable HCLK_PLL PLL
57 * Enter halt mode - CPU and buses will stop
58 * System enters direct-run mode when an enabled event occurs
59 * HCLK PLL state is restored
60 * Run mode is entered
61 * DRAMS are placed back into normal mode
62 * Code execution returns from IRAM
63 * IRAM code are used for suspend is restored
64 * Suspend mode is exited
65 */
66
67#include <linux/suspend.h>
68#include <linux/io.h>
69#include <linux/slab.h>
70
71#include <asm/cacheflush.h>
72
73#include <mach/hardware.h>
74#include <mach/platform.h>
75#include "common.h"
76#include "clock.h"
77
78#define TEMP_IRAM_AREA IO_ADDRESS(LPC32XX_IRAM_BASE)
79
80/*
81 * Both STANDBY and MEM suspend states are handled the same with no
82 * loss of CPU or memory state
83 */
84static int lpc32xx_pm_enter(suspend_state_t state)
85{
86 int (*lpc32xx_suspend_ptr) (void);
87 void *iram_swap_area;
88
89 /* Allocate some space for temporary IRAM storage */
90 iram_swap_area = kmalloc(lpc32xx_sys_suspend_sz, GFP_KERNEL);
91 if (!iram_swap_area) {
92 printk(KERN_ERR
93 "PM Suspend: cannot allocate memory to save portion "
94 "of SRAM\n");
95 return -ENOMEM;
96 }
97
98 /* Backup a small area of IRAM used for the suspend code */
99 memcpy(iram_swap_area, (void *) TEMP_IRAM_AREA,
100 lpc32xx_sys_suspend_sz);
101
102 /*
103 * Copy code to suspend system into IRAM. The suspend code
104 * needs to run from IRAM as DRAM may no longer be available
105 * when the PLL is stopped.
106 */
107 memcpy((void *) TEMP_IRAM_AREA, &lpc32xx_sys_suspend,
108 lpc32xx_sys_suspend_sz);
109 flush_icache_range((unsigned long)TEMP_IRAM_AREA,
110 (unsigned long)(TEMP_IRAM_AREA) + lpc32xx_sys_suspend_sz);
111
112 /* Transfer to suspend code in IRAM */
113 lpc32xx_suspend_ptr = (void *) TEMP_IRAM_AREA;
114 flush_cache_all();
115 (void) lpc32xx_suspend_ptr();
116
117 /* Restore original IRAM contents */
118 memcpy((void *) TEMP_IRAM_AREA, iram_swap_area,
119 lpc32xx_sys_suspend_sz);
120
121 kfree(iram_swap_area);
122
123 return 0;
124}
125
126static struct platform_suspend_ops lpc32xx_pm_ops = {
127 .valid = suspend_valid_only_mem,
128 .enter = lpc32xx_pm_enter,
129};
130
131#define EMC_DYN_MEM_CTRL_OFS 0x20
132#define EMC_SRMMC (1 << 3)
133#define EMC_CTRL_REG io_p2v(LPC32XX_EMC_BASE + EMC_DYN_MEM_CTRL_OFS)
134static int __init lpc32xx_pm_init(void)
135{
136 /*
137 * Setup SDRAM self-refresh clock to automatically disable o
138 * start of self-refresh. This only needs to be done once.
139 */
140 __raw_writel(__raw_readl(EMC_CTRL_REG) | EMC_SRMMC, EMC_CTRL_REG);
141
142 suspend_set_ops(&lpc32xx_pm_ops);
143
144 return 0;
145}
146arch_initcall(lpc32xx_pm_init);
diff --git a/arch/arm/mach-lpc32xx/serial.c b/arch/arm/mach-lpc32xx/serial.c
new file mode 100644
index 000000000000..429cfdbb2b3d
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/serial.c
@@ -0,0 +1,190 @@
1/*
2 * arch/arm/mach-lpc32xx/serial.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/types.h>
21#include <linux/serial.h>
22#include <linux/serial_core.h>
23#include <linux/serial_reg.h>
24#include <linux/serial_8250.h>
25#include <linux/clk.h>
26#include <linux/io.h>
27
28#include <mach/hardware.h>
29#include <mach/platform.h>
30#include "common.h"
31
32#define LPC32XX_SUART_FIFO_SIZE 64
33
34/* Standard 8250/16550 compatible serial ports */
35static struct plat_serial8250_port serial_std_platform_data[] = {
36#ifdef CONFIG_ARCH_LPC32XX_UART5_SELECT
37 {
38 .membase = io_p2v(LPC32XX_UART5_BASE),
39 .mapbase = LPC32XX_UART5_BASE,
40 .irq = IRQ_LPC32XX_UART_IIR5,
41 .uartclk = LPC32XX_MAIN_OSC_FREQ,
42 .regshift = 2,
43 .iotype = UPIO_MEM32,
44 .flags = UPF_BOOT_AUTOCONF | UPF_BUGGY_UART |
45 UPF_SKIP_TEST,
46 },
47#endif
48#ifdef CONFIG_ARCH_LPC32XX_UART3_SELECT
49 {
50 .membase = io_p2v(LPC32XX_UART3_BASE),
51 .mapbase = LPC32XX_UART3_BASE,
52 .irq = IRQ_LPC32XX_UART_IIR3,
53 .uartclk = LPC32XX_MAIN_OSC_FREQ,
54 .regshift = 2,
55 .iotype = UPIO_MEM32,
56 .flags = UPF_BOOT_AUTOCONF | UPF_BUGGY_UART |
57 UPF_SKIP_TEST,
58 },
59#endif
60#ifdef CONFIG_ARCH_LPC32XX_UART4_SELECT
61 {
62 .membase = io_p2v(LPC32XX_UART4_BASE),
63 .mapbase = LPC32XX_UART4_BASE,
64 .irq = IRQ_LPC32XX_UART_IIR4,
65 .uartclk = LPC32XX_MAIN_OSC_FREQ,
66 .regshift = 2,
67 .iotype = UPIO_MEM32,
68 .flags = UPF_BOOT_AUTOCONF | UPF_BUGGY_UART |
69 UPF_SKIP_TEST,
70 },
71#endif
72#ifdef CONFIG_ARCH_LPC32XX_UART6_SELECT
73 {
74 .membase = io_p2v(LPC32XX_UART6_BASE),
75 .mapbase = LPC32XX_UART6_BASE,
76 .irq = IRQ_LPC32XX_UART_IIR6,
77 .uartclk = LPC32XX_MAIN_OSC_FREQ,
78 .regshift = 2,
79 .iotype = UPIO_MEM32,
80 .flags = UPF_BOOT_AUTOCONF | UPF_BUGGY_UART |
81 UPF_SKIP_TEST,
82 },
83#endif
84 { },
85};
86
87struct uartinit {
88 char *uart_ck_name;
89 u32 ck_mode_mask;
90 void __iomem *pdiv_clk_reg;
91};
92
93static struct uartinit uartinit_data[] __initdata = {
94#ifdef CONFIG_ARCH_LPC32XX_UART5_SELECT
95 {
96 .uart_ck_name = "uart5_ck",
97 .ck_mode_mask =
98 LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 5),
99 .pdiv_clk_reg = LPC32XX_CLKPWR_UART5_CLK_CTRL,
100 },
101#endif
102#ifdef CONFIG_ARCH_LPC32XX_UART3_SELECT
103 {
104 .uart_ck_name = "uart3_ck",
105 .ck_mode_mask =
106 LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 3),
107 .pdiv_clk_reg = LPC32XX_CLKPWR_UART3_CLK_CTRL,
108 },
109#endif
110#ifdef CONFIG_ARCH_LPC32XX_UART4_SELECT
111 {
112 .uart_ck_name = "uart4_ck",
113 .ck_mode_mask =
114 LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 4),
115 .pdiv_clk_reg = LPC32XX_CLKPWR_UART4_CLK_CTRL,
116 },
117#endif
118#ifdef CONFIG_ARCH_LPC32XX_UART6_SELECT
119 {
120 .uart_ck_name = "uart6_ck",
121 .ck_mode_mask =
122 LPC32XX_UART_CLKMODE_LOAD(LPC32XX_UART_CLKMODE_ON, 6),
123 .pdiv_clk_reg = LPC32XX_CLKPWR_UART6_CLK_CTRL,
124 },
125#endif
126};
127
128static struct platform_device serial_std_platform_device = {
129 .name = "serial8250",
130 .id = 0,
131 .dev = {
132 .platform_data = serial_std_platform_data,
133 },
134};
135
136static struct platform_device *lpc32xx_serial_devs[] __initdata = {
137 &serial_std_platform_device,
138};
139
140void __init lpc32xx_serial_init(void)
141{
142 u32 tmp, clkmodes = 0;
143 struct clk *clk;
144 unsigned int puart;
145 int i, j;
146
147 /* UART clocks are off, let clock driver manage them */
148 __raw_writel(0, LPC32XX_CLKPWR_UART_CLK_CTRL);
149
150 for (i = 0; i < ARRAY_SIZE(uartinit_data); i++) {
151 clk = clk_get(NULL, uartinit_data[i].uart_ck_name);
152 if (!IS_ERR(clk)) {
153 clk_enable(clk);
154 serial_std_platform_data[i].uartclk =
155 clk_get_rate(clk);
156 }
157
158 /* Fall back on main osc rate if clock rate return fails */
159 if (serial_std_platform_data[i].uartclk == 0)
160 serial_std_platform_data[i].uartclk =
161 LPC32XX_MAIN_OSC_FREQ;
162
163 /* Setup UART clock modes for all UARTs, disable autoclock */
164 clkmodes |= uartinit_data[i].ck_mode_mask;
165
166 /* pre-UART clock divider set to 1 */
167 __raw_writel(0x0101, uartinit_data[i].pdiv_clk_reg);
168 }
169
170 /* This needs to be done after all UART clocks are setup */
171 __raw_writel(clkmodes, LPC32XX_UARTCTL_CLKMODE);
172 for (i = 0; i < ARRAY_SIZE(uartinit_data) - 1; i++) {
173 /* Force a flush of the RX FIFOs to work around a HW bug */
174 puart = serial_std_platform_data[i].mapbase;
175 __raw_writel(0xC1, LPC32XX_UART_IIR_FCR(puart));
176 __raw_writel(0x00, LPC32XX_UART_DLL_FIFO(puart));
177 j = LPC32XX_SUART_FIFO_SIZE;
178 while (j--)
179 tmp = __raw_readl(LPC32XX_UART_DLL_FIFO(puart));
180 __raw_writel(0, LPC32XX_UART_IIR_FCR(puart));
181 }
182
183 /* Disable UART5->USB transparent mode or USB won't work */
184 tmp = __raw_readl(LPC32XX_UARTCTL_CTRL);
185 tmp &= ~LPC32XX_UART_U5_ROUTE_TO_USB;
186 __raw_writel(tmp, LPC32XX_UARTCTL_CTRL);
187
188 platform_add_devices(lpc32xx_serial_devs,
189 ARRAY_SIZE(lpc32xx_serial_devs));
190}
diff --git a/arch/arm/mach-lpc32xx/suspend.S b/arch/arm/mach-lpc32xx/suspend.S
new file mode 100644
index 000000000000..374f9f07fe48
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/suspend.S
@@ -0,0 +1,151 @@
1/*
2 * arch/arm/mach-lpc32xx/suspend.S
3 *
4 * Original authors: Dmitry Chigirev, Vitaly Wool <source@mvista.com>
5 * Modified by Kevin Wells <kevin.wells@nxp.com>
6 *
7 * 2005 (c) MontaVista Software, Inc. This file is licensed under
8 * the terms of the GNU General Public License version 2. This program
9 * is licensed "as is" without any warranty of any kind, whether express
10 * or implied.
11 */
12#include <linux/linkage.h>
13#include <asm/assembler.h>
14#include <mach/platform.h>
15#include <mach/hardware.h>
16
17/* Using named register defines makes the code easier to follow */
18#define WORK1_REG r0
19#define WORK2_REG r1
20#define SAVED_HCLK_DIV_REG r2
21#define SAVED_HCLK_PLL_REG r3
22#define SAVED_DRAM_CLKCTRL_REG r4
23#define SAVED_PWR_CTRL_REG r5
24#define CLKPWRBASE_REG r6
25#define EMCBASE_REG r7
26
27#define LPC32XX_EMC_STATUS_OFFS 0x04
28#define LPC32XX_EMC_STATUS_BUSY 0x1
29#define LPC32XX_EMC_STATUS_SELF_RFSH 0x4
30
31#define LPC32XX_CLKPWR_PWR_CTRL_OFFS 0x44
32#define LPC32XX_CLKPWR_HCLK_DIV_OFFS 0x40
33#define LPC32XX_CLKPWR_HCLKPLL_CTRL_OFFS 0x58
34
35#define CLKPWR_PCLK_DIV_MASK 0xFFFFFE7F
36
37 .text
38
39ENTRY(lpc32xx_sys_suspend)
40 @ Save a copy of the used registers in IRAM, r0 is corrupted
41 adr r0, tmp_stack_end
42 stmfd r0!, {r3 - r7, sp, lr}
43
44 @ Load a few common register addresses
45 adr WORK1_REG, reg_bases
46 ldr CLKPWRBASE_REG, [WORK1_REG, #0]
47 ldr EMCBASE_REG, [WORK1_REG, #4]
48
49 ldr SAVED_PWR_CTRL_REG, [CLKPWRBASE_REG,\
50 #LPC32XX_CLKPWR_PWR_CTRL_OFFS]
51 orr WORK1_REG, SAVED_PWR_CTRL_REG, #LPC32XX_CLKPWR_SDRAM_SELF_RFSH
52
53 @ Wait for SDRAM busy status to go busy and then idle
54 @ This guarantees a small windows where DRAM isn't busy
551:
56 ldr WORK2_REG, [EMCBASE_REG, #LPC32XX_EMC_STATUS_OFFS]
57 and WORK2_REG, WORK2_REG, #LPC32XX_EMC_STATUS_BUSY
58 cmp WORK2_REG, #LPC32XX_EMC_STATUS_BUSY
59 bne 1b @ Branch while idle
602:
61 ldr WORK2_REG, [EMCBASE_REG, #LPC32XX_EMC_STATUS_OFFS]
62 and WORK2_REG, WORK2_REG, #LPC32XX_EMC_STATUS_BUSY
63 cmp WORK2_REG, #LPC32XX_EMC_STATUS_BUSY
64 beq 2b @ Branch until idle
65
66 @ Setup self-refresh with support for manual exit of
67 @ self-refresh mode
68 str WORK1_REG, [CLKPWRBASE_REG, #LPC32XX_CLKPWR_PWR_CTRL_OFFS]
69 orr WORK2_REG, WORK1_REG, #LPC32XX_CLKPWR_UPD_SDRAM_SELF_RFSH
70 str WORK2_REG, [CLKPWRBASE_REG, #LPC32XX_CLKPWR_PWR_CTRL_OFFS]
71 str WORK1_REG, [CLKPWRBASE_REG, #LPC32XX_CLKPWR_PWR_CTRL_OFFS]
72
73 @ Wait for self-refresh acknowledge, clocks to the DRAM device
74 @ will automatically stop on start of self-refresh
753:
76 ldr WORK2_REG, [EMCBASE_REG, #LPC32XX_EMC_STATUS_OFFS]
77 and WORK2_REG, WORK2_REG, #LPC32XX_EMC_STATUS_SELF_RFSH
78 cmp WORK2_REG, #LPC32XX_EMC_STATUS_SELF_RFSH
79 bne 3b @ Branch until self-refresh mode starts
80
81 @ Enter direct-run mode from run mode
82 bic WORK1_REG, WORK1_REG, #LPC32XX_CLKPWR_SELECT_RUN_MODE
83 str WORK1_REG, [CLKPWRBASE_REG, #LPC32XX_CLKPWR_PWR_CTRL_OFFS]
84
85 @ Safe disable of DRAM clock in EMC block, prevents DDR sync
86 @ issues on restart
87 ldr SAVED_HCLK_DIV_REG, [CLKPWRBASE_REG,\
88 #LPC32XX_CLKPWR_HCLK_DIV_OFFS]
89 and WORK2_REG, SAVED_HCLK_DIV_REG, #CLKPWR_PCLK_DIV_MASK
90 str WORK2_REG, [CLKPWRBASE_REG, #LPC32XX_CLKPWR_HCLK_DIV_OFFS]
91
92 @ Save HCLK PLL state and disable HCLK PLL
93 ldr SAVED_HCLK_PLL_REG, [CLKPWRBASE_REG,\
94 #LPC32XX_CLKPWR_HCLKPLL_CTRL_OFFS]
95 bic WORK2_REG, SAVED_HCLK_PLL_REG, #LPC32XX_CLKPWR_HCLKPLL_POWER_UP
96 str WORK2_REG, [CLKPWRBASE_REG, #LPC32XX_CLKPWR_HCLKPLL_CTRL_OFFS]
97
98 @ Enter stop mode until an enabled event occurs
99 orr WORK1_REG, WORK1_REG, #LPC32XX_CLKPWR_STOP_MODE_CTRL
100 str WORK1_REG, [CLKPWRBASE_REG, #LPC32XX_CLKPWR_PWR_CTRL_OFFS]
101 .rept 9
102 nop
103 .endr
104
105 @ Clear stop status
106 bic WORK1_REG, WORK1_REG, #LPC32XX_CLKPWR_STOP_MODE_CTRL
107
108 @ Restore original HCLK PLL value and wait for PLL lock
109 str SAVED_HCLK_PLL_REG, [CLKPWRBASE_REG,\
110 #LPC32XX_CLKPWR_HCLKPLL_CTRL_OFFS]
1114:
112 ldr WORK2_REG, [CLKPWRBASE_REG, #LPC32XX_CLKPWR_HCLKPLL_CTRL_OFFS]
113 and WORK2_REG, WORK2_REG, #LPC32XX_CLKPWR_HCLKPLL_PLL_STS
114 bne 4b
115
116 @ Re-enter run mode with self-refresh flag cleared, but no DRAM
117 @ update yet. DRAM is still in self-refresh
118 str SAVED_PWR_CTRL_REG, [CLKPWRBASE_REG,\
119 #LPC32XX_CLKPWR_PWR_CTRL_OFFS]
120
121 @ Restore original DRAM clock mode to restore DRAM clocks
122 str SAVED_HCLK_DIV_REG, [CLKPWRBASE_REG,\
123 #LPC32XX_CLKPWR_HCLK_DIV_OFFS]
124
125 @ Clear self-refresh mode
126 orr WORK1_REG, SAVED_PWR_CTRL_REG,\
127 #LPC32XX_CLKPWR_UPD_SDRAM_SELF_RFSH
128 str WORK1_REG, [CLKPWRBASE_REG, #LPC32XX_CLKPWR_PWR_CTRL_OFFS]
129 str SAVED_PWR_CTRL_REG, [CLKPWRBASE_REG,\
130 #LPC32XX_CLKPWR_PWR_CTRL_OFFS]
131
132 @ Wait for EMC to clear self-refresh mode
1335:
134 ldr WORK2_REG, [EMCBASE_REG, #LPC32XX_EMC_STATUS_OFFS]
135 and WORK2_REG, WORK2_REG, #LPC32XX_EMC_STATUS_SELF_RFSH
136 bne 5b @ Branch until self-refresh has exited
137
138 @ restore regs and return
139 adr r0, tmp_stack
140 ldmfd r0!, {r3 - r7, sp, pc}
141
142reg_bases:
143 .long IO_ADDRESS(LPC32XX_CLK_PM_BASE)
144 .long IO_ADDRESS(LPC32XX_EMC_BASE)
145
146tmp_stack:
147 .long 0, 0, 0, 0, 0, 0, 0
148tmp_stack_end:
149
150ENTRY(lpc32xx_sys_suspend_sz)
151 .word . - lpc32xx_sys_suspend
diff --git a/arch/arm/mach-lpc32xx/timer.c b/arch/arm/mach-lpc32xx/timer.c
new file mode 100644
index 000000000000..630dd4a74b26
--- /dev/null
+++ b/arch/arm/mach-lpc32xx/timer.c
@@ -0,0 +1,182 @@
1/*
2 * arch/arm/mach-lpc32xx/timer.c
3 *
4 * Author: Kevin Wells <kevin.wells@nxp.com>
5 *
6 * Copyright (C) 2009 - 2010 NXP Semiconductors
7 * Copyright (C) 2009 Fontys University of Applied Sciences, Eindhoven
8 * Ed Schouten <e.schouten@fontys.nl>
9 * Laurens Timmermans <l.timmermans@fontys.nl>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 */
21
22#include <linux/interrupt.h>
23#include <linux/irq.h>
24#include <linux/time.h>
25#include <linux/err.h>
26#include <linux/clockchips.h>
27
28#include <asm/mach/time.h>
29
30#include <mach/hardware.h>
31#include <mach/platform.h>
32#include "common.h"
33
34static cycle_t lpc32xx_clksrc_read(struct clocksource *cs)
35{
36 return (cycle_t)__raw_readl(LCP32XX_TIMER_TC(LPC32XX_TIMER1_BASE));
37}
38
39static struct clocksource lpc32xx_clksrc = {
40 .name = "lpc32xx_clksrc",
41 .shift = 24,
42 .rating = 300,
43 .read = lpc32xx_clksrc_read,
44 .mask = CLOCKSOURCE_MASK(32),
45 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
46};
47
48static int lpc32xx_clkevt_next_event(unsigned long delta,
49 struct clock_event_device *dev)
50{
51 __raw_writel(LCP32XX_TIMER_CNTR_TCR_RESET,
52 LCP32XX_TIMER_TCR(LPC32XX_TIMER0_BASE));
53 __raw_writel(delta, LCP32XX_TIMER_PR(LPC32XX_TIMER0_BASE));
54 __raw_writel(LCP32XX_TIMER_CNTR_TCR_EN,
55 LCP32XX_TIMER_TCR(LPC32XX_TIMER0_BASE));
56
57 return 0;
58}
59
60static void lpc32xx_clkevt_mode(enum clock_event_mode mode,
61 struct clock_event_device *dev)
62{
63 switch (mode) {
64 case CLOCK_EVT_MODE_PERIODIC:
65 WARN_ON(1);
66 break;
67
68 case CLOCK_EVT_MODE_ONESHOT:
69 case CLOCK_EVT_MODE_SHUTDOWN:
70 /*
71 * Disable the timer. When using oneshot, we must also
72 * disable the timer to wait for the first call to
73 * set_next_event().
74 */
75 __raw_writel(0, LCP32XX_TIMER_TCR(LPC32XX_TIMER0_BASE));
76 break;
77
78 case CLOCK_EVT_MODE_UNUSED:
79 case CLOCK_EVT_MODE_RESUME:
80 break;
81 }
82}
83
84static struct clock_event_device lpc32xx_clkevt = {
85 .name = "lpc32xx_clkevt",
86 .features = CLOCK_EVT_FEAT_ONESHOT,
87 .shift = 32,
88 .rating = 300,
89 .set_next_event = lpc32xx_clkevt_next_event,
90 .set_mode = lpc32xx_clkevt_mode,
91};
92
93static irqreturn_t lpc32xx_timer_interrupt(int irq, void *dev_id)
94{
95 struct clock_event_device *evt = &lpc32xx_clkevt;
96
97 /* Clear match */
98 __raw_writel(LCP32XX_TIMER_CNTR_MTCH_BIT(0),
99 LCP32XX_TIMER_IR(LPC32XX_TIMER0_BASE));
100
101 evt->event_handler(evt);
102
103 return IRQ_HANDLED;
104}
105
106static struct irqaction lpc32xx_timer_irq = {
107 .name = "LPC32XX Timer Tick",
108 .flags = IRQF_DISABLED | IRQF_TIMER | IRQF_IRQPOLL,
109 .handler = lpc32xx_timer_interrupt,
110};
111
112/*
113 * The clock management driver isn't initialized at this point, so the
114 * clocks need to be enabled here manually and then tagged as used in
115 * the clock driver initialization
116 */
117static void __init lpc32xx_timer_init(void)
118{
119 u32 clkrate, pllreg;
120
121 /* Enable timer clock */
122 __raw_writel(LPC32XX_CLKPWR_TMRPWMCLK_TIMER0_EN |
123 LPC32XX_CLKPWR_TMRPWMCLK_TIMER1_EN,
124 LPC32XX_CLKPWR_TIMERS_PWMS_CLK_CTRL_1);
125
126 /*
127 * The clock driver isn't initialized at this point. So determine if
128 * the SYSCLK is driven from the PLL397 or main oscillator and then use
129 * it to compute the PLL frequency and the PCLK divider to get the base
130 * timer rates. This rate is needed to compute the tick rate.
131 */
132 if (clk_is_sysclk_mainosc() != 0)
133 clkrate = LPC32XX_MAIN_OSC_FREQ;
134 else
135 clkrate = 397 * LPC32XX_CLOCK_OSC_FREQ;
136
137 /* Get ARM HCLKPLL register and convert it into a frequency */
138 pllreg = __raw_readl(LPC32XX_CLKPWR_HCLKPLL_CTRL) & 0x1FFFF;
139 clkrate = clk_get_pllrate_from_reg(clkrate, pllreg);
140
141 /* Get PCLK divider and divide ARM PLL clock by it to get timer rate */
142 clkrate = clkrate / clk_get_pclk_div();
143
144 /* Initial timer setup */
145 __raw_writel(0, LCP32XX_TIMER_TCR(LPC32XX_TIMER0_BASE));
146 __raw_writel(LCP32XX_TIMER_CNTR_MTCH_BIT(0),
147 LCP32XX_TIMER_IR(LPC32XX_TIMER0_BASE));
148 __raw_writel(1, LCP32XX_TIMER_MR0(LPC32XX_TIMER0_BASE));
149 __raw_writel(LCP32XX_TIMER_CNTR_MCR_MTCH(0) |
150 LCP32XX_TIMER_CNTR_MCR_STOP(0) |
151 LCP32XX_TIMER_CNTR_MCR_RESET(0),
152 LCP32XX_TIMER_MCR(LPC32XX_TIMER0_BASE));
153
154 /* Setup tick interrupt */
155 setup_irq(IRQ_LPC32XX_TIMER0, &lpc32xx_timer_irq);
156
157 /* Setup the clockevent structure. */
158 lpc32xx_clkevt.mult = div_sc(clkrate, NSEC_PER_SEC,
159 lpc32xx_clkevt.shift);
160 lpc32xx_clkevt.max_delta_ns = clockevent_delta2ns(-1,
161 &lpc32xx_clkevt);
162 lpc32xx_clkevt.min_delta_ns = clockevent_delta2ns(1,
163 &lpc32xx_clkevt) + 1;
164 lpc32xx_clkevt.cpumask = cpumask_of(0);
165 clockevents_register_device(&lpc32xx_clkevt);
166
167 /* Use timer1 as clock source. */
168 __raw_writel(LCP32XX_TIMER_CNTR_TCR_RESET,
169 LCP32XX_TIMER_TCR(LPC32XX_TIMER1_BASE));
170 __raw_writel(0, LCP32XX_TIMER_PR(LPC32XX_TIMER1_BASE));
171 __raw_writel(0, LCP32XX_TIMER_MCR(LPC32XX_TIMER1_BASE));
172 __raw_writel(LCP32XX_TIMER_CNTR_TCR_EN,
173 LCP32XX_TIMER_TCR(LPC32XX_TIMER1_BASE));
174 lpc32xx_clksrc.mult = clocksource_hz2mult(clkrate,
175 lpc32xx_clksrc.shift);
176 clocksource_register(&lpc32xx_clksrc);
177}
178
179struct sys_timer lpc32xx_timer = {
180 .init = &lpc32xx_timer_init,
181};
182
diff --git a/arch/arm/mach-msm/Makefile b/arch/arm/mach-msm/Makefile
index 66677f0acaed..7ff8020d4d24 100644
--- a/arch/arm/mach-msm/Makefile
+++ b/arch/arm/mach-msm/Makefile
@@ -15,7 +15,7 @@ obj-$(CONFIG_ARCH_QSD8X50) += sirc.o
15obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o 15obj-$(CONFIG_MSM_SMD) += smd.o smd_debug.o
16obj-$(CONFIG_MSM_SMD) += last_radio_log.o 16obj-$(CONFIG_MSM_SMD) += last_radio_log.o
17 17
18obj-$(CONFIG_MACH_TROUT) += board-trout.o devices-msm7x00.o 18obj-$(CONFIG_MACH_TROUT) += board-trout.o board-trout-gpio.o devices-msm7x00.o
19obj-$(CONFIG_MACH_HALIBUT) += board-halibut.o devices-msm7x00.o 19obj-$(CONFIG_MACH_HALIBUT) += board-halibut.o devices-msm7x00.o
20obj-$(CONFIG_ARCH_MSM7X30) += board-msm7x30.o devices-msm7x30.o 20obj-$(CONFIG_ARCH_MSM7X30) += board-msm7x30.o devices-msm7x30.o
21obj-$(CONFIG_ARCH_QSD8X50) += board-qsd8x50.o devices-qsd8x50.o 21obj-$(CONFIG_ARCH_QSD8X50) += board-qsd8x50.o devices-qsd8x50.o
diff --git a/arch/arm/mach-msm/acpuclock-arm11.c b/arch/arm/mach-msm/acpuclock-arm11.c
index af5e85b91d02..f060a3959a75 100644
--- a/arch/arm/mach-msm/acpuclock-arm11.c
+++ b/arch/arm/mach-msm/acpuclock-arm11.c
@@ -98,7 +98,7 @@ struct clkctl_acpu_speed {
98 98
99/* 99/*
100 * ACPU speed table. Complete table is shown but certain speeds are commented 100 * ACPU speed table. Complete table is shown but certain speeds are commented
101 * out to optimized speed switching. Initalize loops_per_jiffy to 0. 101 * out to optimized speed switching. Initialize loops_per_jiffy to 0.
102 * 102 *
103 * Table stepping up/down is optimized for 256mhz jumps while staying on the 103 * Table stepping up/down is optimized for 256mhz jumps while staying on the
104 * same PLL. 104 * same PLL.
@@ -494,7 +494,7 @@ uint32_t acpuclk_get_switch_time(void)
494 * Clock driver initialization 494 * Clock driver initialization
495 *---------------------------------------------------------------------------*/ 495 *---------------------------------------------------------------------------*/
496 496
497/* Initalize the lpj field in the acpu_freq_tbl. */ 497/* Initialize the lpj field in the acpu_freq_tbl. */
498static void __init lpj_init(void) 498static void __init lpj_init(void)
499{ 499{
500 int i; 500 int i;
diff --git a/arch/arm/mach-msm/board-trout-gpio.c b/arch/arm/mach-msm/board-trout-gpio.c
new file mode 100644
index 000000000000..523d213bf79e
--- /dev/null
+++ b/arch/arm/mach-msm/board-trout-gpio.c
@@ -0,0 +1,112 @@
1/*
2 * linux/arch/arm/mach-msm/gpio.c
3 *
4 * Copyright (C) 2005 HP Labs
5 * Copyright (C) 2008 Google, Inc.
6 * Copyright (C) 2009 Pavel Machek <pavel@ucw.cz>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#include <linux/kernel.h>
15#include <linux/module.h>
16#include <linux/io.h>
17#include <linux/irq.h>
18#include <linux/gpio.h>
19
20#include "board-trout.h"
21
22struct msm_gpio_chip {
23 struct gpio_chip chip;
24 void __iomem *reg; /* Base of register bank */
25 u8 shadow;
26};
27
28#define to_msm_gpio_chip(c) container_of(c, struct msm_gpio_chip, chip)
29
30static int msm_gpiolib_get(struct gpio_chip *chip, unsigned offset)
31{
32 struct msm_gpio_chip *msm_gpio = to_msm_gpio_chip(chip);
33 unsigned mask = 1 << offset;
34
35 return !!(readb(msm_gpio->reg) & mask);
36}
37
38static void msm_gpiolib_set(struct gpio_chip *chip, unsigned offset, int val)
39{
40 struct msm_gpio_chip *msm_gpio = to_msm_gpio_chip(chip);
41 unsigned mask = 1 << offset;
42
43 if (val)
44 msm_gpio->shadow |= mask;
45 else
46 msm_gpio->shadow &= ~mask;
47
48 writeb(msm_gpio->shadow, msm_gpio->reg);
49}
50
51static int msm_gpiolib_direction_input(struct gpio_chip *chip,
52 unsigned offset)
53{
54 msm_gpiolib_set(chip, offset, 0);
55 return 0;
56}
57
58static int msm_gpiolib_direction_output(struct gpio_chip *chip,
59 unsigned offset, int val)
60{
61 msm_gpiolib_set(chip, offset, val);
62 return 0;
63}
64
65#define TROUT_GPIO_BANK(name, reg_num, base_gpio, shadow_val) \
66 { \
67 .chip = { \
68 .label = name, \
69 .direction_input = msm_gpiolib_direction_input,\
70 .direction_output = msm_gpiolib_direction_output, \
71 .get = msm_gpiolib_get, \
72 .set = msm_gpiolib_set, \
73 .base = base_gpio, \
74 .ngpio = 8, \
75 }, \
76 .reg = (void *) reg_num + TROUT_CPLD_BASE, \
77 .shadow = shadow_val, \
78 }
79
80static struct msm_gpio_chip msm_gpio_banks[] = {
81#if defined(CONFIG_MSM_DEBUG_UART1)
82 /* H2W pins <-> UART1 */
83 TROUT_GPIO_BANK("MISC2", 0x00, TROUT_GPIO_MISC2_BASE, 0x40),
84#else
85 /* H2W pins <-> UART3, Bluetooth <-> UART1 */
86 TROUT_GPIO_BANK("MISC2", 0x00, TROUT_GPIO_MISC2_BASE, 0x80),
87#endif
88 /* I2C pull */
89 TROUT_GPIO_BANK("MISC3", 0x02, TROUT_GPIO_MISC3_BASE, 0x04),
90 TROUT_GPIO_BANK("MISC4", 0x04, TROUT_GPIO_MISC4_BASE, 0),
91 /* mmdi 32k en */
92 TROUT_GPIO_BANK("MISC5", 0x06, TROUT_GPIO_MISC5_BASE, 0x04),
93 TROUT_GPIO_BANK("INT2", 0x08, TROUT_GPIO_INT2_BASE, 0),
94 TROUT_GPIO_BANK("MISC1", 0x0a, TROUT_GPIO_MISC1_BASE, 0),
95 TROUT_GPIO_BANK("VIRTUAL", 0x12, TROUT_GPIO_VIRTUAL_BASE, 0),
96};
97
98/*
99 * Called from the processor-specific init to enable GPIO pin support.
100 */
101int __init trout_init_gpio(void)
102{
103 int i;
104
105 for (i = 0; i < ARRAY_SIZE(msm_gpio_banks); i++)
106 gpiochip_add(&msm_gpio_banks[i].chip);
107
108 return 0;
109}
110
111postcore_initcall(trout_init_gpio);
112
diff --git a/arch/arm/mach-msm/board-trout.c b/arch/arm/mach-msm/board-trout.c
index dca5a5f062dc..e69a1502e4e8 100644
--- a/arch/arm/mach-msm/board-trout.c
+++ b/arch/arm/mach-msm/board-trout.c
@@ -50,7 +50,6 @@ static void __init trout_fixup(struct machine_desc *desc, struct tag *tags,
50{ 50{
51 mi->nr_banks = 1; 51 mi->nr_banks = 1;
52 mi->bank[0].start = PHYS_OFFSET; 52 mi->bank[0].start = PHYS_OFFSET;
53 mi->bank[0].node = PHYS_TO_NID(PHYS_OFFSET);
54 mi->bank[0].size = (101*1024*1024); 53 mi->bank[0].size = (101*1024*1024);
55} 54}
56 55
diff --git a/arch/arm/mach-msm/board-trout.h b/arch/arm/mach-msm/board-trout.h
index 4f345a5a0a61..651851c3e1dd 100644
--- a/arch/arm/mach-msm/board-trout.h
+++ b/arch/arm/mach-msm/board-trout.h
@@ -1,5 +1,162 @@
1/* linux/arch/arm/mach-msm/board-trout.h
2** Author: Brian Swetland <swetland@google.com>
3*/
4#ifndef __ARCH_ARM_MACH_MSM_BOARD_TROUT_H
5#define __ARCH_ARM_MACH_MSM_BOARD_TROUT_H
6
7#include <mach/board.h>
8
9#define MSM_SMI_BASE 0x00000000
10#define MSM_SMI_SIZE 0x00800000
11
12#define MSM_EBI_BASE 0x10000000
13#define MSM_EBI_SIZE 0x06e00000
14
15#define MSM_PMEM_GPU0_BASE 0x00000000
16#define MSM_PMEM_GPU0_SIZE 0x00700000
17
18#define MSM_PMEM_MDP_BASE 0x02000000
19#define MSM_PMEM_MDP_SIZE 0x00800000
20
21#define MSM_PMEM_ADSP_BASE 0x02800000
22#define MSM_PMEM_ADSP_SIZE 0x00800000
23
24#define MSM_PMEM_CAMERA_BASE 0x03000000
25#define MSM_PMEM_CAMERA_SIZE 0x00800000
26
27#define MSM_FB_BASE 0x03800000
28#define MSM_FB_SIZE 0x00100000
29
30#define MSM_LINUX_BASE MSM_EBI_BASE
31#define MSM_LINUX_SIZE 0x06500000
32
33#define MSM_PMEM_GPU1_SIZE 0x800000
34#define MSM_PMEM_GPU1_BASE (MSM_RAM_CONSOLE_BASE - MSM_PMEM_GPU1_SIZE)
35
36#define MSM_RAM_CONSOLE_BASE (MSM_EBI_BASE + 0x6d00000)
37#define MSM_RAM_CONSOLE_SIZE (128 * SZ_1K)
38
39#if (MSM_FB_BASE + MSM_FB_SIZE) >= (MSM_PMEM_GPU1_BASE)
40#error invalid memory map
41#endif
42
43#define DECLARE_MSM_IOMAP
44#include <mach/msm_iomap.h>
45
46#define TROUT_4_BALL_UP_0 1
47#define TROUT_4_BALL_LEFT_0 18
48#define TROUT_4_BALL_DOWN_0 57
49#define TROUT_4_BALL_RIGHT_0 91
50
51#define TROUT_5_BALL_UP_0 94
52#define TROUT_5_BALL_LEFT_0 18
53#define TROUT_5_BALL_DOWN_0 90
54#define TROUT_5_BALL_RIGHT_0 19
55
56#define TROUT_POWER_KEY 20
57
58#define TROUT_4_TP_LS_EN 19
59#define TROUT_5_TP_LS_EN 1
1 60
2#define TROUT_CPLD_BASE 0xE8100000 61#define TROUT_CPLD_BASE 0xE8100000
3#define TROUT_CPLD_START 0x98000000 62#define TROUT_CPLD_START 0x98000000
4#define TROUT_CPLD_SIZE SZ_4K 63#define TROUT_CPLD_SIZE SZ_4K
5 64
65#define TROUT_GPIO_CABLE_IN1 (83)
66#define TROUT_GPIO_CABLE_IN2 (49)
67
68#define TROUT_GPIO_START (128)
69
70#define TROUT_GPIO_INT_MASK0_REG (0x0c)
71#define TROUT_GPIO_INT_STAT0_REG (0x0e)
72#define TROUT_GPIO_INT_MASK1_REG (0x14)
73#define TROUT_GPIO_INT_STAT1_REG (0x10)
74
75#define TROUT_GPIO_HAPTIC_PWM (28)
76#define TROUT_GPIO_PS_HOLD (25)
77
78#define TROUT_GPIO_MISC2_BASE (TROUT_GPIO_START + 0x00)
79#define TROUT_GPIO_MISC3_BASE (TROUT_GPIO_START + 0x08)
80#define TROUT_GPIO_MISC4_BASE (TROUT_GPIO_START + 0x10)
81#define TROUT_GPIO_MISC5_BASE (TROUT_GPIO_START + 0x18)
82#define TROUT_GPIO_INT2_BASE (TROUT_GPIO_START + 0x20)
83#define TROUT_GPIO_MISC1_BASE (TROUT_GPIO_START + 0x28)
84#define TROUT_GPIO_VIRTUAL_BASE (TROUT_GPIO_START + 0x30)
85#define TROUT_GPIO_INT5_BASE (TROUT_GPIO_START + 0x48)
86
87#define TROUT_GPIO_CHARGER_EN (TROUT_GPIO_MISC2_BASE + 0)
88#define TROUT_GPIO_ISET (TROUT_GPIO_MISC2_BASE + 1)
89#define TROUT_GPIO_H2W_DAT_DIR (TROUT_GPIO_MISC2_BASE + 2)
90#define TROUT_GPIO_H2W_CLK_DIR (TROUT_GPIO_MISC2_BASE + 3)
91#define TROUT_GPIO_H2W_DAT_GPO (TROUT_GPIO_MISC2_BASE + 4)
92#define TROUT_GPIO_H2W_CLK_GPO (TROUT_GPIO_MISC2_BASE + 5)
93#define TROUT_GPIO_H2W_SEL0 (TROUT_GPIO_MISC2_BASE + 6)
94#define TROUT_GPIO_H2W_SEL1 (TROUT_GPIO_MISC2_BASE + 7)
95
96#define TROUT_GPIO_SPOTLIGHT_EN (TROUT_GPIO_MISC3_BASE + 0)
97#define TROUT_GPIO_FLASH_EN (TROUT_GPIO_MISC3_BASE + 1)
98#define TROUT_GPIO_I2C_PULL (TROUT_GPIO_MISC3_BASE + 2)
99#define TROUT_GPIO_TP_I2C_PULL (TROUT_GPIO_MISC3_BASE + 3)
100#define TROUT_GPIO_TP_EN (TROUT_GPIO_MISC3_BASE + 4)
101#define TROUT_GPIO_JOG_EN (TROUT_GPIO_MISC3_BASE + 5)
102#define TROUT_GPIO_UI_LED_EN (TROUT_GPIO_MISC3_BASE + 6)
103#define TROUT_GPIO_QTKEY_LED_EN (TROUT_GPIO_MISC3_BASE + 7)
104
105#define TROUT_GPIO_VCM_PWDN (TROUT_GPIO_MISC4_BASE + 0)
106#define TROUT_GPIO_USB_H2W_SW (TROUT_GPIO_MISC4_BASE + 1)
107#define TROUT_GPIO_COMPASS_RST_N (TROUT_GPIO_MISC4_BASE + 2)
108#define TROUT_GPIO_HAPTIC_EN_UP (TROUT_GPIO_MISC4_BASE + 3)
109#define TROUT_GPIO_HAPTIC_EN_MAIN (TROUT_GPIO_MISC4_BASE + 4)
110#define TROUT_GPIO_USB_PHY_RST_N (TROUT_GPIO_MISC4_BASE + 5)
111#define TROUT_GPIO_WIFI_PA_RESETX (TROUT_GPIO_MISC4_BASE + 6)
112#define TROUT_GPIO_WIFI_EN (TROUT_GPIO_MISC4_BASE + 7)
113
114#define TROUT_GPIO_BT_32K_EN (TROUT_GPIO_MISC5_BASE + 0)
115#define TROUT_GPIO_MAC_32K_EN (TROUT_GPIO_MISC5_BASE + 1)
116#define TROUT_GPIO_MDDI_32K_EN (TROUT_GPIO_MISC5_BASE + 2)
117#define TROUT_GPIO_COMPASS_32K_EN (TROUT_GPIO_MISC5_BASE + 3)
118
119#define TROUT_GPIO_NAVI_ACT_N (TROUT_GPIO_INT2_BASE + 0)
120#define TROUT_GPIO_COMPASS_IRQ (TROUT_GPIO_INT2_BASE + 1)
121#define TROUT_GPIO_SLIDING_DET (TROUT_GPIO_INT2_BASE + 2)
122#define TROUT_GPIO_AUD_HSMIC_DET_N (TROUT_GPIO_INT2_BASE + 3)
123#define TROUT_GPIO_SD_DOOR_N (TROUT_GPIO_INT2_BASE + 4)
124#define TROUT_GPIO_CAM_BTN_STEP1_N (TROUT_GPIO_INT2_BASE + 5)
125#define TROUT_GPIO_CAM_BTN_STEP2_N (TROUT_GPIO_INT2_BASE + 6)
126#define TROUT_GPIO_TP_ATT_N (TROUT_GPIO_INT2_BASE + 7)
127#define TROUT_GPIO_BANK0_FIRST_INT_SOURCE (TROUT_GPIO_NAVI_ACT_N)
128#define TROUT_GPIO_BANK0_LAST_INT_SOURCE (TROUT_GPIO_TP_ATT_N)
129
130#define TROUT_GPIO_H2W_DAT_GPI (TROUT_GPIO_MISC1_BASE + 0)
131#define TROUT_GPIO_H2W_CLK_GPI (TROUT_GPIO_MISC1_BASE + 1)
132#define TROUT_GPIO_CPLD128_VER_0 (TROUT_GPIO_MISC1_BASE + 4)
133#define TROUT_GPIO_CPLD128_VER_1 (TROUT_GPIO_MISC1_BASE + 5)
134#define TROUT_GPIO_CPLD128_VER_2 (TROUT_GPIO_MISC1_BASE + 6)
135#define TROUT_GPIO_CPLD128_VER_3 (TROUT_GPIO_MISC1_BASE + 7)
136
137#define TROUT_GPIO_SDMC_CD_N (TROUT_GPIO_VIRTUAL_BASE + 0)
138#define TROUT_GPIO_END (TROUT_GPIO_SDMC_CD_N)
139#define TROUT_GPIO_BANK1_FIRST_INT_SOURCE (TROUT_GPIO_SDMC_CD_N)
140#define TROUT_GPIO_BANK1_LAST_INT_SOURCE (TROUT_GPIO_SDMC_CD_N)
141
142#define TROUT_GPIO_VIRTUAL_TO_REAL_OFFSET \
143 (TROUT_GPIO_INT5_BASE - TROUT_GPIO_VIRTUAL_BASE)
144
145#define TROUT_INT_START (NR_MSM_IRQS + NR_GPIO_IRQS)
146#define TROUT_INT_BANK0_COUNT (8)
147#define TROUT_INT_BANK1_START (TROUT_INT_START + TROUT_INT_BANK0_COUNT)
148#define TROUT_INT_BANK1_COUNT (1)
149#define TROUT_INT_END (TROUT_INT_START + TROUT_INT_BANK0_COUNT + \
150 TROUT_INT_BANK1_COUNT - 1)
151#define TROUT_GPIO_TO_INT(n) (((n) <= TROUT_GPIO_BANK0_LAST_INT_SOURCE) ? \
152 (TROUT_INT_START - TROUT_GPIO_BANK0_FIRST_INT_SOURCE + (n)) : \
153 (TROUT_INT_BANK1_START - TROUT_GPIO_BANK1_FIRST_INT_SOURCE + (n)))
154
155#define TROUT_INT_TO_BANK(n) ((n - TROUT_INT_START) / TROUT_INT_BANK0_COUNT)
156#define TROUT_INT_TO_MASK(n) (1U << ((n - TROUT_INT_START) & 7))
157#define TROUT_BANK_TO_MASK_REG(bank) \
158 (bank ? TROUT_GPIO_INT_MASK1_REG : TROUT_GPIO_INT_MASK0_REG)
159#define TROUT_BANK_TO_STAT_REG(bank) \
160 (bank ? TROUT_GPIO_INT_STAT1_REG : TROUT_GPIO_INT_STAT0_REG)
161
162#endif /* GUARD */
diff --git a/arch/arm/mach-msm/include/mach/gpio.h b/arch/arm/mach-msm/include/mach/gpio.h
index 262b441b4374..83e47c0d5c2e 100644
--- a/arch/arm/mach-msm/include/mach/gpio.h
+++ b/arch/arm/mach-msm/include/mach/gpio.h
@@ -16,6 +16,13 @@
16#ifndef __ASM_ARCH_MSM_GPIO_H 16#ifndef __ASM_ARCH_MSM_GPIO_H
17#define __ASM_ARCH_MSM_GPIO_H 17#define __ASM_ARCH_MSM_GPIO_H
18 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
19/** 26/**
20 * struct msm_gpio - GPIO pin description 27 * struct msm_gpio - GPIO pin description
21 * @gpio_cfg - configuration bitmap, as per gpio_tlmm_config() 28 * @gpio_cfg - configuration bitmap, as per gpio_tlmm_config()
diff --git a/arch/arm/mach-mx1/Kconfig b/arch/arm/mach-mx1/Kconfig
deleted file mode 100644
index eb7660f5d4b7..000000000000
--- a/arch/arm/mach-mx1/Kconfig
+++ /dev/null
@@ -1,19 +0,0 @@
1if ARCH_MX1
2
3comment "MX1 platforms:"
4
5config MACH_MXLADS
6 bool
7
8config ARCH_MX1ADS
9 bool "MX1ADS platform"
10 select MACH_MXLADS
11 help
12 Say Y here if you are using Motorola MX1ADS/MXLADS boards
13
14config MACH_SCB9328
15 bool "Synertronixx scb9328"
16 help
17 Say Y here if you are using a Synertronixx scb9328 board
18
19endif
diff --git a/arch/arm/mach-mx1/Makefile b/arch/arm/mach-mx1/Makefile
deleted file mode 100644
index fc2ddf82441b..000000000000
--- a/arch/arm/mach-mx1/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
1#
2# Makefile for the linux kernel.
3#
4
5# Object file lists.
6
7EXTRA_CFLAGS += -DIMX_NEEDS_DEPRECATED_SYMBOLS
8obj-y += generic.o clock.o devices.o
9
10# Support for CMOS sensor interface
11obj-$(CONFIG_MX1_VIDEO) += ksym_mx1.o mx1_camera_fiq.o
12
13# Specific board support
14obj-$(CONFIG_ARCH_MX1ADS) += mach-mx1ads.o
15obj-$(CONFIG_MACH_SCB9328) += mach-scb9328.o
diff --git a/arch/arm/mach-mx1/Makefile.boot b/arch/arm/mach-mx1/Makefile.boot
deleted file mode 100644
index 8ed1492288a2..000000000000
--- a/arch/arm/mach-mx1/Makefile.boot
+++ /dev/null
@@ -1,4 +0,0 @@
1 zreladdr-y := 0x08008000
2params_phys-y := 0x08000100
3initrd_phys-y := 0x08800000
4
diff --git a/arch/arm/mach-mx1/crm_regs.h b/arch/arm/mach-mx1/crm_regs.h
deleted file mode 100644
index 22e866ff0c09..000000000000
--- a/arch/arm/mach-mx1/crm_regs.h
+++ /dev/null
@@ -1,55 +0,0 @@
1/*
2 * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright (c) 2008 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
4 *
5 * This file may be distributed under the terms of the GNU General
6 * Public License, version 2.
7 */
8
9#ifndef __ARCH_ARM_MACH_MX1_CRM_REGS_H__
10#define __ARCH_ARM_MACH_MX1_CRM_REGS_H__
11
12#define CCM_BASE IO_ADDRESS(CCM_BASE_ADDR)
13#define SCM_BASE IO_ADDRESS(SCM_BASE_ADDR)
14
15/* CCM register addresses */
16#define CCM_CSCR (CCM_BASE + 0x0)
17#define CCM_MPCTL0 (CCM_BASE + 0x4)
18#define CCM_MPCTL1 (CCM_BASE + 0x8)
19#define CCM_SPCTL0 (CCM_BASE + 0xC)
20#define CCM_SPCTL1 (CCM_BASE + 0x10)
21#define CCM_PCDR (CCM_BASE + 0x20)
22
23#define CCM_CSCR_CLKO_OFFSET 29
24#define CCM_CSCR_CLKO_MASK (0x7 << 29)
25#define CCM_CSCR_USB_OFFSET 26
26#define CCM_CSCR_USB_MASK (0x7 << 26)
27#define CCM_CSCR_SPLL_RESTART (1 << 22)
28#define CCM_CSCR_MPLL_RESTART (1 << 21)
29#define CCM_CSCR_OSC_EN_SHIFT 17
30#define CCM_CSCR_SYSTEM_SEL (1 << 16)
31#define CCM_CSCR_BCLK_OFFSET 10
32#define CCM_CSCR_BCLK_MASK (0xF << 10)
33#define CCM_CSCR_PRESC (1 << 15)
34#define CCM_CSCR_SPEN (1 << 1)
35#define CCM_CSCR_MPEN (1 << 0)
36
37#define CCM_PCDR_PCLK3_OFFSET 16
38#define CCM_PCDR_PCLK3_MASK (0x7F << 16)
39#define CCM_PCDR_PCLK2_OFFSET 4
40#define CCM_PCDR_PCLK2_MASK (0xF << 4)
41#define CCM_PCDR_PCLK1_OFFSET 0
42#define CCM_PCDR_PCLK1_MASK 0xF
43
44/* SCM register addresses */
45#define SCM_SIDR (SCM_BASE + 0x0)
46#define SCM_FMCR (SCM_BASE + 0x4)
47#define SCM_GPCR (SCM_BASE + 0x8)
48#define SCM_GCCR (SCM_BASE + 0xC)
49
50#define SCM_GCCR_DMA_CLK_EN_OFFSET 3
51#define SCM_GCCR_CSI_CLK_EN_OFFSET 2
52#define SCM_GCCR_MMA_CLK_EN_OFFSET 1
53#define SCM_GCCR_USBD_CLK_EN_OFFSET 0
54
55#endif /* __ARCH_ARM_MACH_MX2_CRM_REGS_H__ */
diff --git a/arch/arm/mach-mx1/devices.c b/arch/arm/mach-mx1/devices.c
deleted file mode 100644
index b6be29d1cb08..000000000000
--- a/arch/arm/mach-mx1/devices.c
+++ /dev/null
@@ -1,242 +0,0 @@
1/*
2 * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright 2008 Sascha Hauer, kernel@pengutronix.de
4 * Copyright (c) 2008 Paulius Zaleckas <paulius.zaleckas@teltonika.lt>
5 * Copyright (c) 2008 Darius Augulis <darius.augulis@teltonika.lt>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
20 */
21
22#include <linux/kernel.h>
23#include <linux/init.h>
24#include <linux/platform_device.h>
25#include <linux/gpio.h>
26#include <mach/irqs.h>
27#include <mach/hardware.h>
28
29#include "devices.h"
30
31static struct resource imx_csi_resources[] = {
32 {
33 .start = 0x00224000,
34 .end = 0x00224010,
35 .flags = IORESOURCE_MEM,
36 }, {
37 .start = CSI_INT,
38 .end = CSI_INT,
39 .flags = IORESOURCE_IRQ,
40 },
41};
42
43static u64 imx_csi_dmamask = 0xffffffffUL;
44
45struct platform_device imx_csi_device = {
46 .name = "mx1-camera",
47 .id = 0, /* This is used to put cameras on this interface */
48 .dev = {
49 .dma_mask = &imx_csi_dmamask,
50 .coherent_dma_mask = 0xffffffff,
51 },
52 .resource = imx_csi_resources,
53 .num_resources = ARRAY_SIZE(imx_csi_resources),
54};
55
56static struct resource imx_i2c_resources[] = {
57 {
58 .start = 0x00217000,
59 .end = 0x00217010,
60 .flags = IORESOURCE_MEM,
61 }, {
62 .start = I2C_INT,
63 .end = I2C_INT,
64 .flags = IORESOURCE_IRQ,
65 },
66};
67
68struct platform_device imx_i2c_device = {
69 .name = "imx-i2c",
70 .id = 0,
71 .resource = imx_i2c_resources,
72 .num_resources = ARRAY_SIZE(imx_i2c_resources),
73};
74
75static struct resource imx_uart1_resources[] = {
76 {
77 .start = UART1_BASE_ADDR,
78 .end = UART1_BASE_ADDR + 0xD0,
79 .flags = IORESOURCE_MEM,
80 }, {
81 .start = UART1_MINT_RX,
82 .end = UART1_MINT_RX,
83 .flags = IORESOURCE_IRQ,
84 }, {
85 .start = UART1_MINT_TX,
86 .end = UART1_MINT_TX,
87 .flags = IORESOURCE_IRQ,
88 }, {
89 .start = UART1_MINT_RTS,
90 .end = UART1_MINT_RTS,
91 .flags = IORESOURCE_IRQ,
92 },
93};
94
95struct platform_device imx_uart1_device = {
96 .name = "imx-uart",
97 .id = 0,
98 .num_resources = ARRAY_SIZE(imx_uart1_resources),
99 .resource = imx_uart1_resources,
100};
101
102static struct resource imx_uart2_resources[] = {
103 {
104 .start = UART2_BASE_ADDR,
105 .end = UART2_BASE_ADDR + 0xD0,
106 .flags = IORESOURCE_MEM,
107 }, {
108 .start = UART2_MINT_RX,
109 .end = UART2_MINT_RX,
110 .flags = IORESOURCE_IRQ,
111 }, {
112 .start = UART2_MINT_TX,
113 .end = UART2_MINT_TX,
114 .flags = IORESOURCE_IRQ,
115 }, {
116 .start = UART2_MINT_RTS,
117 .end = UART2_MINT_RTS,
118 .flags = IORESOURCE_IRQ,
119 },
120};
121
122struct platform_device imx_uart2_device = {
123 .name = "imx-uart",
124 .id = 1,
125 .num_resources = ARRAY_SIZE(imx_uart2_resources),
126 .resource = imx_uart2_resources,
127};
128
129static struct resource imx_rtc_resources[] = {
130 {
131 .start = 0x00204000,
132 .end = 0x00204024,
133 .flags = IORESOURCE_MEM,
134 }, {
135 .start = RTC_INT,
136 .end = RTC_INT,
137 .flags = IORESOURCE_IRQ,
138 }, {
139 .start = RTC_SAMINT,
140 .end = RTC_SAMINT,
141 .flags = IORESOURCE_IRQ,
142 },
143};
144
145struct platform_device imx_rtc_device = {
146 .name = "rtc-imx",
147 .id = 0,
148 .resource = imx_rtc_resources,
149 .num_resources = ARRAY_SIZE(imx_rtc_resources),
150};
151
152static struct resource imx_wdt_resources[] = {
153 {
154 .start = 0x00201000,
155 .end = 0x00201008,
156 .flags = IORESOURCE_MEM,
157 }, {
158 .start = WDT_INT,
159 .end = WDT_INT,
160 .flags = IORESOURCE_IRQ,
161 },
162};
163
164struct platform_device imx_wdt_device = {
165 .name = "imx-wdt",
166 .id = 0,
167 .resource = imx_wdt_resources,
168 .num_resources = ARRAY_SIZE(imx_wdt_resources),
169};
170
171static struct resource imx_usb_resources[] = {
172 {
173 .start = 0x00212000,
174 .end = 0x00212148,
175 .flags = IORESOURCE_MEM,
176 }, {
177 .start = USBD_INT0,
178 .end = USBD_INT0,
179 .flags = IORESOURCE_IRQ,
180 }, {
181 .start = USBD_INT1,
182 .end = USBD_INT1,
183 .flags = IORESOURCE_IRQ,
184 }, {
185 .start = USBD_INT2,
186 .end = USBD_INT2,
187 .flags = IORESOURCE_IRQ,
188 }, {
189 .start = USBD_INT3,
190 .end = USBD_INT3,
191 .flags = IORESOURCE_IRQ,
192 }, {
193 .start = USBD_INT4,
194 .end = USBD_INT4,
195 .flags = IORESOURCE_IRQ,
196 }, {
197 .start = USBD_INT5,
198 .end = USBD_INT5,
199 .flags = IORESOURCE_IRQ,
200 }, {
201 .start = USBD_INT6,
202 .end = USBD_INT6,
203 .flags = IORESOURCE_IRQ,
204 },
205};
206
207struct platform_device imx_usb_device = {
208 .name = "imx_udc",
209 .id = 0,
210 .num_resources = ARRAY_SIZE(imx_usb_resources),
211 .resource = imx_usb_resources,
212};
213
214/* GPIO port description */
215static struct mxc_gpio_port imx_gpio_ports[] = {
216 {
217 .chip.label = "gpio-0",
218 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR),
219 .irq = GPIO_INT_PORTA,
220 .virtual_irq_start = MXC_GPIO_IRQ_START,
221 }, {
222 .chip.label = "gpio-1",
223 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x100),
224 .irq = GPIO_INT_PORTB,
225 .virtual_irq_start = MXC_GPIO_IRQ_START + 32,
226 }, {
227 .chip.label = "gpio-2",
228 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x200),
229 .irq = GPIO_INT_PORTC,
230 .virtual_irq_start = MXC_GPIO_IRQ_START + 64,
231 }, {
232 .chip.label = "gpio-3",
233 .base = (void __iomem *)IO_ADDRESS(GPIO_BASE_ADDR + 0x300),
234 .irq = GPIO_INT_PORTD,
235 .virtual_irq_start = MXC_GPIO_IRQ_START + 96,
236 }
237};
238
239int __init mxc_register_gpios(void)
240{
241 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
242}
diff --git a/arch/arm/mach-mx1/devices.h b/arch/arm/mach-mx1/devices.h
deleted file mode 100644
index 0da5d7cce3a2..000000000000
--- a/arch/arm/mach-mx1/devices.h
+++ /dev/null
@@ -1,7 +0,0 @@
1extern struct platform_device imx_csi_device;
2extern struct platform_device imx_i2c_device;
3extern struct platform_device imx_uart1_device;
4extern struct platform_device imx_uart2_device;
5extern struct platform_device imx_rtc_device;
6extern struct platform_device imx_wdt_device;
7extern struct platform_device imx_usb_device;
diff --git a/arch/arm/mach-mx2/serial.c b/arch/arm/mach-mx2/serial.c
deleted file mode 100644
index 1c0c835b2252..000000000000
--- a/arch/arm/mach-mx2/serial.c
+++ /dev/null
@@ -1,141 +0,0 @@
1/*
2 * Copyright 2006-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright 2008 Juergen Beisert, kernel@pengutronix.de
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
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., 51 Franklin Street, Fifth Floor, Boston,
17 * MA 02110-1301, USA.
18 */
19
20#include <linux/module.h>
21#include <linux/platform_device.h>
22#include <linux/serial.h>
23#include <mach/hardware.h>
24#include <mach/imx-uart.h>
25#include "devices.h"
26
27static struct resource uart0[] = {
28 {
29 .start = MX2x_UART1_BASE_ADDR,
30 .end = MX2x_UART1_BASE_ADDR + 0x0B5,
31 .flags = IORESOURCE_MEM,
32 }, {
33 .start = MX2x_INT_UART1,
34 .end = MX2x_INT_UART1,
35 .flags = IORESOURCE_IRQ,
36 },
37};
38
39struct platform_device mxc_uart_device0 = {
40 .name = "imx-uart",
41 .id = 0,
42 .resource = uart0,
43 .num_resources = ARRAY_SIZE(uart0),
44};
45
46static struct resource uart1[] = {
47 {
48 .start = MX2x_UART2_BASE_ADDR,
49 .end = MX2x_UART2_BASE_ADDR + 0x0B5,
50 .flags = IORESOURCE_MEM,
51 }, {
52 .start = MX2x_INT_UART2,
53 .end = MX2x_INT_UART2,
54 .flags = IORESOURCE_IRQ,
55 },
56};
57
58struct platform_device mxc_uart_device1 = {
59 .name = "imx-uart",
60 .id = 1,
61 .resource = uart1,
62 .num_resources = ARRAY_SIZE(uart1),
63};
64
65static struct resource uart2[] = {
66 {
67 .start = MX2x_UART3_BASE_ADDR,
68 .end = MX2x_UART3_BASE_ADDR + 0x0B5,
69 .flags = IORESOURCE_MEM,
70 }, {
71 .start = MX2x_INT_UART3,
72 .end = MX2x_INT_UART3,
73 .flags = IORESOURCE_IRQ,
74 },
75};
76
77struct platform_device mxc_uart_device2 = {
78 .name = "imx-uart",
79 .id = 2,
80 .resource = uart2,
81 .num_resources = ARRAY_SIZE(uart2),
82};
83
84static struct resource uart3[] = {
85 {
86 .start = MX2x_UART4_BASE_ADDR,
87 .end = MX2x_UART4_BASE_ADDR + 0x0B5,
88 .flags = IORESOURCE_MEM,
89 }, {
90 .start = MX2x_INT_UART4,
91 .end = MX2x_INT_UART4,
92 .flags = IORESOURCE_IRQ,
93 },
94};
95
96struct platform_device mxc_uart_device3 = {
97 .name = "imx-uart",
98 .id = 3,
99 .resource = uart3,
100 .num_resources = ARRAY_SIZE(uart3),
101};
102
103#ifdef CONFIG_MACH_MX27
104static struct resource uart4[] = {
105 {
106 .start = MX27_UART5_BASE_ADDR,
107 .end = MX27_UART5_BASE_ADDR + 0x0B5,
108 .flags = IORESOURCE_MEM,
109 }, {
110 .start = MX27_INT_UART5,
111 .end = MX27_INT_UART5,
112 .flags = IORESOURCE_IRQ,
113 },
114};
115
116struct platform_device mxc_uart_device4 = {
117 .name = "imx-uart",
118 .id = 4,
119 .resource = uart4,
120 .num_resources = ARRAY_SIZE(uart4),
121};
122
123static struct resource uart5[] = {
124 {
125 .start = MX27_UART6_BASE_ADDR,
126 .end = MX27_UART6_BASE_ADDR + 0x0B5,
127 .flags = IORESOURCE_MEM,
128 }, {
129 .start = MX27_INT_UART6,
130 .end = MX27_INT_UART6,
131 .flags = IORESOURCE_IRQ,
132 },
133};
134
135struct platform_device mxc_uart_device5 = {
136 .name = "imx-uart",
137 .id = 5,
138 .resource = uart5,
139 .num_resources = ARRAY_SIZE(uart5),
140};
141#endif
diff --git a/arch/arm/mach-mx25/Kconfig b/arch/arm/mach-mx25/Kconfig
index 54d217314ee9..c71a7bc19284 100644
--- a/arch/arm/mach-mx25/Kconfig
+++ b/arch/arm/mach-mx25/Kconfig
@@ -4,5 +4,28 @@ comment "MX25 platforms:"
4 4
5config MACH_MX25_3DS 5config MACH_MX25_3DS
6 bool "Support MX25PDK (3DS) Platform" 6 bool "Support MX25PDK (3DS) Platform"
7 select IMX_HAVE_PLATFORM_IMX_UART
8 select IMX_HAVE_PLATFORM_MXC_NAND
9
10config MACH_EUKREA_CPUIMX25
11 bool "Support Eukrea CPUIMX25 Platform"
12 select IMX_HAVE_PLATFORM_IMX_I2C
13 select IMX_HAVE_PLATFORM_IMX_UART
14 select IMX_HAVE_PLATFORM_MXC_NAND
15 select MXC_ULPI if USB_ULPI
16
17choice
18 prompt "Baseboard"
19 depends on MACH_EUKREA_CPUIMX25
20 default MACH_EUKREA_MBIMXSD25_BASEBOARD
21
22config MACH_EUKREA_MBIMXSD25_BASEBOARD
23 prompt "Eukrea MBIMXSD development board"
24 bool
25 help
26 This adds board specific devices that can be found on Eukrea's
27 MBIMXSD evaluation board.
28
29endchoice
7 30
8endif 31endif
diff --git a/arch/arm/mach-mx25/Makefile b/arch/arm/mach-mx25/Makefile
index 10cebc5ced8c..d9e46ce00a4e 100644
--- a/arch/arm/mach-mx25/Makefile
+++ b/arch/arm/mach-mx25/Makefile
@@ -1,3 +1,5 @@
1obj-y := mm.o devices.o 1obj-y := mm.o devices.o
2obj-$(CONFIG_ARCH_MX25) += clock.o 2obj-$(CONFIG_ARCH_MX25) += clock.o
3obj-$(CONFIG_MACH_MX25_3DS) += mach-mx25pdk.o 3obj-$(CONFIG_MACH_MX25_3DS) += mach-mx25_3ds.o
4obj-$(CONFIG_MACH_EUKREA_CPUIMX25) += mach-cpuimx25.o
5obj-$(CONFIG_MACH_EUKREA_MBIMXSD25_BASEBOARD) += eukrea_mbimxsd-baseboard.o
diff --git a/arch/arm/mach-mx25/clock.c b/arch/arm/mach-mx25/clock.c
index 155014993b13..40c7cc41cee3 100644
--- a/arch/arm/mach-mx25/clock.c
+++ b/arch/arm/mach-mx25/clock.c
@@ -109,6 +109,16 @@ static unsigned long get_rate_uart(struct clk *clk)
109 return get_rate_per(15); 109 return get_rate_per(15);
110} 110}
111 111
112static unsigned long get_rate_ssi2(struct clk *clk)
113{
114 return get_rate_per(14);
115}
116
117static unsigned long get_rate_ssi1(struct clk *clk)
118{
119 return get_rate_per(13);
120}
121
112static unsigned long get_rate_i2c(struct clk *clk) 122static unsigned long get_rate_i2c(struct clk *clk)
113{ 123{
114 return get_rate_per(6); 124 return get_rate_per(6);
@@ -129,9 +139,17 @@ static unsigned long get_rate_lcdc(struct clk *clk)
129 return get_rate_per(7); 139 return get_rate_per(7);
130} 140}
131 141
142static unsigned long get_rate_csi(struct clk *clk)
143{
144 return get_rate_per(0);
145}
146
132static unsigned long get_rate_otg(struct clk *clk) 147static unsigned long get_rate_otg(struct clk *clk)
133{ 148{
134 return 48000000; /* FIXME */ 149 unsigned long cctl = readl(CRM_BASE + CCM_CCTL);
150 unsigned long rate = get_rate_upll();
151
152 return (cctl & (1 << 23)) ? 0 : rate / ((0x3F & (cctl >> 16)) + 1);
135} 153}
136 154
137static int clk_cgcr_enable(struct clk *clk) 155static int clk_cgcr_enable(struct clk *clk)
@@ -166,14 +184,40 @@ static void clk_cgcr_disable(struct clk *clk)
166 .secondary = s, \ 184 .secondary = s, \
167 } 185 }
168 186
187/*
188 * Note: the following IPG clock gating bits are wrongly marked "Reserved" in
189 * the i.MX25 Reference Manual Rev 1, table 15-13. The information below is
190 * taken from the Freescale released BSP.
191 *
192 * bit reg offset clock
193 *
194 * 0 CGCR1 0 AUDMUX
195 * 12 CGCR1 12 ESAI
196 * 16 CGCR1 16 GPIO1
197 * 17 CGCR1 17 GPIO2
198 * 18 CGCR1 18 GPIO3
199 * 23 CGCR1 23 I2C1
200 * 24 CGCR1 24 I2C2
201 * 25 CGCR1 25 I2C3
202 * 27 CGCR1 27 IOMUXC
203 * 28 CGCR1 28 KPP
204 * 30 CGCR1 30 OWIRE
205 * 36 CGCR2 4 RTIC
206 * 51 CGCR2 19 WDOG
207 */
208
169DEFINE_CLOCK(gpt_clk, 0, CCM_CGCR0, 5, get_rate_gpt, NULL, NULL); 209DEFINE_CLOCK(gpt_clk, 0, CCM_CGCR0, 5, get_rate_gpt, NULL, NULL);
170DEFINE_CLOCK(uart_per_clk, 0, CCM_CGCR0, 15, get_rate_uart, NULL, NULL); 210DEFINE_CLOCK(uart_per_clk, 0, CCM_CGCR0, 15, get_rate_uart, NULL, NULL);
211DEFINE_CLOCK(ssi1_per_clk, 0, CCM_CGCR0, 13, get_rate_ipg, NULL, NULL);
212DEFINE_CLOCK(ssi2_per_clk, 0, CCM_CGCR0, 14, get_rate_ipg, NULL, NULL);
171DEFINE_CLOCK(cspi1_clk, 0, CCM_CGCR1, 5, get_rate_ipg, NULL, NULL); 213DEFINE_CLOCK(cspi1_clk, 0, CCM_CGCR1, 5, get_rate_ipg, NULL, NULL);
172DEFINE_CLOCK(cspi2_clk, 0, CCM_CGCR1, 6, get_rate_ipg, NULL, NULL); 214DEFINE_CLOCK(cspi2_clk, 0, CCM_CGCR1, 6, get_rate_ipg, NULL, NULL);
173DEFINE_CLOCK(cspi3_clk, 0, CCM_CGCR1, 7, get_rate_ipg, NULL, NULL); 215DEFINE_CLOCK(cspi3_clk, 0, CCM_CGCR1, 7, get_rate_ipg, NULL, NULL);
174DEFINE_CLOCK(fec_ahb_clk, 0, CCM_CGCR0, 23, NULL, NULL, NULL); 216DEFINE_CLOCK(fec_ahb_clk, 0, CCM_CGCR0, 23, NULL, NULL, NULL);
175DEFINE_CLOCK(lcdc_ahb_clk, 0, CCM_CGCR0, 24, NULL, NULL, NULL); 217DEFINE_CLOCK(lcdc_ahb_clk, 0, CCM_CGCR0, 24, NULL, NULL, NULL);
176DEFINE_CLOCK(lcdc_per_clk, 0, CCM_CGCR0, 7, NULL, NULL, &lcdc_ahb_clk); 218DEFINE_CLOCK(lcdc_per_clk, 0, CCM_CGCR0, 7, NULL, NULL, &lcdc_ahb_clk);
219DEFINE_CLOCK(csi_ahb_clk, 0, CCM_CGCR0, 18, get_rate_csi, NULL, NULL);
220DEFINE_CLOCK(csi_per_clk, 0, CCM_CGCR0, 0, get_rate_csi, NULL, &csi_ahb_clk);
177DEFINE_CLOCK(uart1_clk, 0, CCM_CGCR2, 14, get_rate_uart, NULL, &uart_per_clk); 221DEFINE_CLOCK(uart1_clk, 0, CCM_CGCR2, 14, get_rate_uart, NULL, &uart_per_clk);
178DEFINE_CLOCK(uart2_clk, 0, CCM_CGCR2, 15, get_rate_uart, NULL, &uart_per_clk); 222DEFINE_CLOCK(uart2_clk, 0, CCM_CGCR2, 15, get_rate_uart, NULL, &uart_per_clk);
179DEFINE_CLOCK(uart3_clk, 0, CCM_CGCR2, 16, get_rate_uart, NULL, &uart_per_clk); 223DEFINE_CLOCK(uart3_clk, 0, CCM_CGCR2, 16, get_rate_uart, NULL, &uart_per_clk);
@@ -191,6 +235,13 @@ DEFINE_CLOCK(i2c_clk, 0, CCM_CGCR0, 6, get_rate_i2c, NULL, NULL);
191DEFINE_CLOCK(fec_clk, 0, CCM_CGCR1, 15, get_rate_ipg, NULL, &fec_ahb_clk); 235DEFINE_CLOCK(fec_clk, 0, CCM_CGCR1, 15, get_rate_ipg, NULL, &fec_ahb_clk);
192DEFINE_CLOCK(dryice_clk, 0, CCM_CGCR1, 8, get_rate_ipg, NULL, NULL); 236DEFINE_CLOCK(dryice_clk, 0, CCM_CGCR1, 8, get_rate_ipg, NULL, NULL);
193DEFINE_CLOCK(lcdc_clk, 0, CCM_CGCR1, 29, get_rate_lcdc, NULL, &lcdc_per_clk); 237DEFINE_CLOCK(lcdc_clk, 0, CCM_CGCR1, 29, get_rate_lcdc, NULL, &lcdc_per_clk);
238DEFINE_CLOCK(wdt_clk, 0, CCM_CGCR2, 19, get_rate_ipg, NULL, NULL);
239DEFINE_CLOCK(ssi1_clk, 0, CCM_CGCR2, 11, get_rate_ssi1, NULL, &ssi1_per_clk);
240DEFINE_CLOCK(ssi2_clk, 1, CCM_CGCR2, 12, get_rate_ssi2, NULL, &ssi2_per_clk);
241DEFINE_CLOCK(audmux_clk, 0, CCM_CGCR1, 0, NULL, NULL, NULL);
242DEFINE_CLOCK(csi_clk, 0, CCM_CGCR1, 4, get_rate_csi, NULL, &csi_per_clk);
243DEFINE_CLOCK(can1_clk, 0, CCM_CGCR1, 2, get_rate_ipg, NULL, NULL);
244DEFINE_CLOCK(can2_clk, 0, CCM_CGCR1, 3, get_rate_ipg, NULL, NULL);
194 245
195#define _REGISTER_CLOCK(d, n, c) \ 246#define _REGISTER_CLOCK(d, n, c) \
196 { \ 247 { \
@@ -217,7 +268,7 @@ static struct clk_lookup lookups[] = {
217 _REGISTER_CLOCK("mxc_pwm.1", NULL, pwm2_clk) 268 _REGISTER_CLOCK("mxc_pwm.1", NULL, pwm2_clk)
218 _REGISTER_CLOCK("mxc_pwm.2", NULL, pwm3_clk) 269 _REGISTER_CLOCK("mxc_pwm.2", NULL, pwm3_clk)
219 _REGISTER_CLOCK("mxc_pwm.3", NULL, pwm4_clk) 270 _REGISTER_CLOCK("mxc_pwm.3", NULL, pwm4_clk)
220 _REGISTER_CLOCK("mxc-keypad", NULL, kpp_clk) 271 _REGISTER_CLOCK("imx-keypad", NULL, kpp_clk)
221 _REGISTER_CLOCK("mx25-adc", NULL, tsc_clk) 272 _REGISTER_CLOCK("mx25-adc", NULL, tsc_clk)
222 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk) 273 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c_clk)
223 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c_clk) 274 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c_clk)
@@ -225,6 +276,13 @@ static struct clk_lookup lookups[] = {
225 _REGISTER_CLOCK("fec.0", NULL, fec_clk) 276 _REGISTER_CLOCK("fec.0", NULL, fec_clk)
226 _REGISTER_CLOCK("imxdi_rtc.0", NULL, dryice_clk) 277 _REGISTER_CLOCK("imxdi_rtc.0", NULL, dryice_clk)
227 _REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk) 278 _REGISTER_CLOCK("imx-fb.0", NULL, lcdc_clk)
279 _REGISTER_CLOCK("imx-wdt.0", NULL, wdt_clk)
280 _REGISTER_CLOCK("imx-ssi.0", NULL, ssi1_clk)
281 _REGISTER_CLOCK("imx-ssi.1", NULL, ssi2_clk)
282 _REGISTER_CLOCK("mx2-camera.0", NULL, csi_clk)
283 _REGISTER_CLOCK(NULL, "audmux", audmux_clk)
284 _REGISTER_CLOCK("flexcan.0", NULL, can1_clk)
285 _REGISTER_CLOCK("flexcan.1", NULL, can2_clk)
228}; 286};
229 287
230int __init mx25_clocks_init(void) 288int __init mx25_clocks_init(void)
@@ -238,9 +296,13 @@ int __init mx25_clocks_init(void)
238 __raw_writel((1 << 19), CRM_BASE + CCM_CGCR0); 296 __raw_writel((1 << 19), CRM_BASE + CCM_CGCR0);
239 __raw_writel((0xf << 16) | (3 << 26), CRM_BASE + CCM_CGCR1); 297 __raw_writel((0xf << 16) | (3 << 26), CRM_BASE + CCM_CGCR1);
240 __raw_writel((1 << 5), CRM_BASE + CCM_CGCR2); 298 __raw_writel((1 << 5), CRM_BASE + CCM_CGCR2);
299#if defined(CONFIG_DEBUG_LL) && !defined(CONFIG_DEBUG_ICEDCC)
300 clk_enable(&uart1_clk);
301#endif
241 302
242 /* Clock source for lcdc is upll */ 303 /* Clock source for lcdc and csi is upll */
243 __raw_writel(__raw_readl(CRM_BASE+0x64) | (1 << 7), CRM_BASE + 0x64); 304 __raw_writel(__raw_readl(CRM_BASE+0x64) | (1 << 7) | (1 << 0),
305 CRM_BASE + 0x64);
244 306
245 mxc_timer_init(&gpt_clk, MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), 54); 307 mxc_timer_init(&gpt_clk, MX25_IO_ADDRESS(MX25_GPT1_BASE_ADDR), 54);
246 308
diff --git a/arch/arm/mach-mx25/devices-imx25.h b/arch/arm/mach-mx25/devices-imx25.h
new file mode 100644
index 000000000000..d86a7c3ca8b0
--- /dev/null
+++ b/arch/arm/mach-mx25/devices-imx25.h
@@ -0,0 +1,43 @@
1/*
2 * Copyright (C) 2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#include <mach/mx25.h>
10#include <mach/devices-common.h>
11
12#define imx25_add_flexcan0(pdata) \
13 imx_add_flexcan(0, MX25_CAN1_BASE_ADDR, SZ_16K, MX25_INT_CAN1, pdata)
14#define imx25_add_flexcan1(pdata) \
15 imx_add_flexcan(1, MX25_CAN2_BASE_ADDR, SZ_16K, MX25_INT_CAN2, pdata)
16
17#define imx25_add_imx_i2c0(pdata) \
18 imx_add_imx_i2c(0, MX25_I2C1_BASE_ADDR, SZ_16K, MX25_INT_I2C1, pdata)
19#define imx25_add_imx_i2c1(pdata) \
20 imx_add_imx_i2c(1, MX25_I2C2_BASE_ADDR, SZ_16K, MX25_INT_I2C2, pdata)
21#define imx25_add_imx_i2c2(pdata) \
22 imx_add_imx_i2c(2, MX25_I2C3_BASE_ADDR, SZ_16K, MX25_INT_I2C3, pdata)
23
24#define imx25_add_imx_uart0(pdata) \
25 imx_add_imx_uart_1irq(0, MX25_UART1_BASE_ADDR, SZ_16K, MX25_INT_UART1, pdata)
26#define imx25_add_imx_uart1(pdata) \
27 imx_add_imx_uart_1irq(1, MX25_UART2_BASE_ADDR, SZ_16K, MX25_INT_UART2, pdata)
28#define imx25_add_imx_uart2(pdata) \
29 imx_add_imx_uart_1irq(2, MX25_UART3_BASE_ADDR, SZ_16K, MX25_INT_UART3, pdata)
30#define imx25_add_imx_uart3(pdata) \
31 imx_add_imx_uart_1irq(3, MX25_UART4_BASE_ADDR, SZ_16K, MX25_INT_UART4, pdata)
32#define imx25_add_imx_uart4(pdata) \
33 imx_add_imx_uart_1irq(4, MX25_UART5_BASE_ADDR, SZ_16K, MX25_INT_UART5, pdata)
34
35#define imx25_add_mxc_nand(pdata) \
36 imx_add_mxc_nand_v21(MX25_NFC_BASE_ADDR, MX25_INT_NANDFC, pdata)
37
38#define imx25_add_spi_imx0(pdata) \
39 imx_add_spi_imx(0, MX25_CSPI1_BASE_ADDR, SZ_16K, MX25_INT_CSPI1, pdata)
40#define imx25_add_spi_imx1(pdata) \
41 imx_add_spi_imx(1, MX25_CSPI2_BASE_ADDR, SZ_16K, MX25_INT_CSPI2, pdata)
42#define imx25_add_spi_imx2(pdata) \
43 imx_add_spi_imx(2, MX25_CSPI3_BASE_ADDR, SZ_16K, MX25_INT_CSPI3, pdata)
diff --git a/arch/arm/mach-mx25/devices.c b/arch/arm/mach-mx25/devices.c
index 3a405fa400eb..3468eb15b236 100644
--- a/arch/arm/mach-mx25/devices.c
+++ b/arch/arm/mach-mx25/devices.c
@@ -22,103 +22,6 @@
22#include <mach/mx25.h> 22#include <mach/mx25.h>
23#include <mach/irqs.h> 23#include <mach/irqs.h>
24 24
25static struct resource uart0[] = {
26 {
27 .start = 0x43f90000,
28 .end = 0x43f93fff,
29 .flags = IORESOURCE_MEM,
30 }, {
31 .start = 45,
32 .end = 45,
33 .flags = IORESOURCE_IRQ,
34 },
35};
36
37struct platform_device mxc_uart_device0 = {
38 .name = "imx-uart",
39 .id = 0,
40 .resource = uart0,
41 .num_resources = ARRAY_SIZE(uart0),
42};
43
44static struct resource uart1[] = {
45 {
46 .start = 0x43f94000,
47 .end = 0x43f97fff,
48 .flags = IORESOURCE_MEM,
49 }, {
50 .start = 32,
51 .end = 32,
52 .flags = IORESOURCE_IRQ,
53 },
54};
55
56struct platform_device mxc_uart_device1 = {
57 .name = "imx-uart",
58 .id = 1,
59 .resource = uart1,
60 .num_resources = ARRAY_SIZE(uart1),
61};
62
63static struct resource uart2[] = {
64 {
65 .start = 0x5000c000,
66 .end = 0x5000ffff,
67 .flags = IORESOURCE_MEM,
68 }, {
69 .start = 18,
70 .end = 18,
71 .flags = IORESOURCE_IRQ,
72 },
73};
74
75struct platform_device mxc_uart_device2 = {
76 .name = "imx-uart",
77 .id = 2,
78 .resource = uart2,
79 .num_resources = ARRAY_SIZE(uart2),
80};
81
82static struct resource uart3[] = {
83 {
84 .start = 0x50008000,
85 .end = 0x5000bfff,
86 .flags = IORESOURCE_MEM,
87 }, {
88 .start = 5,
89 .end = 5,
90 .flags = IORESOURCE_IRQ,
91 },
92};
93
94struct platform_device mxc_uart_device3 = {
95 .name = "imx-uart",
96 .id = 3,
97 .resource = uart3,
98 .num_resources = ARRAY_SIZE(uart3),
99};
100
101static struct resource uart4[] = {
102 {
103 .start = 0x5002c000,
104 .end = 0x5002ffff,
105 .flags = IORESOURCE_MEM,
106 }, {
107 .start = 40,
108 .end = 40,
109 .flags = IORESOURCE_IRQ,
110 },
111};
112
113struct platform_device mxc_uart_device4 = {
114 .name = "imx-uart",
115 .id = 4,
116 .resource = uart4,
117 .num_resources = ARRAY_SIZE(uart4),
118};
119
120#define MX25_OTG_BASE_ADDR 0x53FF4000
121
122static u64 otg_dmamask = DMA_BIT_MASK(32); 25static u64 otg_dmamask = DMA_BIT_MASK(32);
123 26
124static struct resource mxc_otg_resources[] = { 27static struct resource mxc_otg_resources[] = {
@@ -181,63 +84,6 @@ struct platform_device mxc_usbh2 = {
181 .num_resources = ARRAY_SIZE(mxc_usbh2_resources), 84 .num_resources = ARRAY_SIZE(mxc_usbh2_resources),
182}; 85};
183 86
184static struct resource mxc_spi_resources0[] = {
185 {
186 .start = 0x43fa4000,
187 .end = 0x43fa7fff,
188 .flags = IORESOURCE_MEM,
189 }, {
190 .start = 14,
191 .end = 14,
192 .flags = IORESOURCE_IRQ,
193 },
194};
195
196struct platform_device mxc_spi_device0 = {
197 .name = "spi_imx",
198 .id = 0,
199 .num_resources = ARRAY_SIZE(mxc_spi_resources0),
200 .resource = mxc_spi_resources0,
201};
202
203static struct resource mxc_spi_resources1[] = {
204 {
205 .start = 0x50010000,
206 .end = 0x50013fff,
207 .flags = IORESOURCE_MEM,
208 }, {
209 .start = 13,
210 .end = 13,
211 .flags = IORESOURCE_IRQ,
212 },
213};
214
215struct platform_device mxc_spi_device1 = {
216 .name = "spi_imx",
217 .id = 1,
218 .num_resources = ARRAY_SIZE(mxc_spi_resources1),
219 .resource = mxc_spi_resources1,
220};
221
222static struct resource mxc_spi_resources2[] = {
223 {
224 .start = 0x50004000,
225 .end = 0x50007fff,
226 .flags = IORESOURCE_MEM,
227 }, {
228 .start = 0,
229 .end = 0,
230 .flags = IORESOURCE_IRQ,
231 },
232};
233
234struct platform_device mxc_spi_device2 = {
235 .name = "spi_imx",
236 .id = 2,
237 .num_resources = ARRAY_SIZE(mxc_spi_resources2),
238 .resource = mxc_spi_resources2,
239};
240
241static struct resource mxc_pwm_resources0[] = { 87static struct resource mxc_pwm_resources0[] = {
242 { 88 {
243 .start = 0x53fe0000, 89 .start = 0x53fe0000,
@@ -333,63 +179,6 @@ struct platform_device mxc_pwm_device3 = {
333 .resource = mxc_pwm_resources3, 179 .resource = mxc_pwm_resources3,
334}; 180};
335 181
336static struct resource mxc_i2c_1_resources[] = {
337 {
338 .start = 0x43f80000,
339 .end = 0x43f83fff,
340 .flags = IORESOURCE_MEM,
341 }, {
342 .start = 3,
343 .end = 3,
344 .flags = IORESOURCE_IRQ,
345 }
346};
347
348struct platform_device mxc_i2c_device0 = {
349 .name = "imx-i2c",
350 .id = 0,
351 .num_resources = ARRAY_SIZE(mxc_i2c_1_resources),
352 .resource = mxc_i2c_1_resources,
353};
354
355static struct resource mxc_i2c_2_resources[] = {
356 {
357 .start = 0x43f98000,
358 .end = 0x43f9bfff,
359 .flags = IORESOURCE_MEM,
360 }, {
361 .start = 4,
362 .end = 4,
363 .flags = IORESOURCE_IRQ,
364 }
365};
366
367struct platform_device mxc_i2c_device1 = {
368 .name = "imx-i2c",
369 .id = 1,
370 .num_resources = ARRAY_SIZE(mxc_i2c_2_resources),
371 .resource = mxc_i2c_2_resources,
372};
373
374static struct resource mxc_i2c_3_resources[] = {
375 {
376 .start = 0x43f84000,
377 .end = 0x43f87fff,
378 .flags = IORESOURCE_MEM,
379 }, {
380 .start = 10,
381 .end = 10,
382 .flags = IORESOURCE_IRQ,
383 }
384};
385
386struct platform_device mxc_i2c_device2 = {
387 .name = "imx-i2c",
388 .id = 2,
389 .num_resources = ARRAY_SIZE(mxc_i2c_3_resources),
390 .resource = mxc_i2c_3_resources,
391};
392
393static struct mxc_gpio_port imx_gpio_ports[] = { 182static struct mxc_gpio_port imx_gpio_ports[] = {
394 { 183 {
395 .chip.label = "gpio-0", 184 .chip.label = "gpio-0",
@@ -414,7 +203,7 @@ static struct mxc_gpio_port imx_gpio_ports[] = {
414 } 203 }
415}; 204};
416 205
417int __init mxc_register_gpios(void) 206int __init imx25_register_gpios(void)
418{ 207{
419 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports)); 208 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
420} 209}
@@ -439,26 +228,6 @@ struct platform_device mx25_fec_device = {
439 .resource = mx25_fec_resources, 228 .resource = mx25_fec_resources,
440}; 229};
441 230
442static struct resource mxc_nand_resources[] = {
443 {
444 .start = MX25_NFC_BASE_ADDR,
445 .end = MX25_NFC_BASE_ADDR + 0x1fff,
446 .flags = IORESOURCE_MEM,
447 },
448 {
449 .start = MX25_INT_NANDFC,
450 .end = MX25_INT_NANDFC,
451 .flags = IORESOURCE_IRQ,
452 },
453};
454
455struct platform_device mxc_nand_device = {
456 .name = "mxc_nand",
457 .id = 0,
458 .num_resources = ARRAY_SIZE(mxc_nand_resources),
459 .resource = mxc_nand_resources,
460};
461
462static struct resource mx25_rtc_resources[] = { 231static struct resource mx25_rtc_resources[] = {
463 { 232 {
464 .start = MX25_DRYICE_BASE_ADDR, 233 .start = MX25_DRYICE_BASE_ADDR,
@@ -515,3 +284,83 @@ struct platform_device mxc_wdt = {
515 .num_resources = ARRAY_SIZE(mxc_wdt_resources), 284 .num_resources = ARRAY_SIZE(mxc_wdt_resources),
516 .resource = mxc_wdt_resources, 285 .resource = mxc_wdt_resources,
517}; 286};
287
288static struct resource mx25_kpp_resources[] = {
289 {
290 .start = MX25_KPP_BASE_ADDR,
291 .end = MX25_KPP_BASE_ADDR + 0xf,
292 .flags = IORESOURCE_MEM,
293 },
294 {
295 .start = MX25_INT_KPP,
296 .end = MX25_INT_KPP,
297 .flags = IORESOURCE_IRQ,
298 },
299};
300
301struct platform_device mx25_kpp_device = {
302 .name = "imx-keypad",
303 .id = -1,
304 .num_resources = ARRAY_SIZE(mx25_kpp_resources),
305 .resource = mx25_kpp_resources,
306};
307
308static struct resource imx_ssi_resources0[] = {
309 {
310 .start = MX25_SSI1_BASE_ADDR,
311 .end = MX25_SSI1_BASE_ADDR + 0x3fff,
312 .flags = IORESOURCE_MEM,
313 }, {
314 .start = MX25_INT_SSI1,
315 .end = MX25_INT_SSI1,
316 .flags = IORESOURCE_IRQ,
317 },
318};
319
320static struct resource imx_ssi_resources1[] = {
321 {
322 .start = MX25_SSI2_BASE_ADDR,
323 .end = MX25_SSI2_BASE_ADDR + 0x3fff,
324 .flags = IORESOURCE_MEM
325 }, {
326 .start = MX25_INT_SSI2,
327 .end = MX25_INT_SSI2,
328 .flags = IORESOURCE_IRQ,
329 },
330};
331
332struct platform_device imx_ssi_device0 = {
333 .name = "imx-ssi",
334 .id = 0,
335 .num_resources = ARRAY_SIZE(imx_ssi_resources0),
336 .resource = imx_ssi_resources0,
337};
338
339struct platform_device imx_ssi_device1 = {
340 .name = "imx-ssi",
341 .id = 1,
342 .num_resources = ARRAY_SIZE(imx_ssi_resources1),
343 .resource = imx_ssi_resources1,
344};
345
346static struct resource mx25_csi_resources[] = {
347 {
348 .start = MX25_CSI_BASE_ADDR,
349 .end = MX25_CSI_BASE_ADDR + 0xfff,
350 .flags = IORESOURCE_MEM,
351 },
352 {
353 .start = MX25_INT_CSI,
354 .flags = IORESOURCE_IRQ
355 },
356};
357
358struct platform_device mx25_csi_device = {
359 .name = "mx2-camera",
360 .id = 0,
361 .num_resources = ARRAY_SIZE(mx25_csi_resources),
362 .resource = mx25_csi_resources,
363 .dev = {
364 .coherent_dma_mask = 0xffffffff,
365 },
366};
diff --git a/arch/arm/mach-mx25/devices.h b/arch/arm/mach-mx25/devices.h
index cee12c0a0be6..4aceb68e35a7 100644
--- a/arch/arm/mach-mx25/devices.h
+++ b/arch/arm/mach-mx25/devices.h
@@ -1,24 +1,16 @@
1extern struct platform_device mxc_uart_device0;
2extern struct platform_device mxc_uart_device1;
3extern struct platform_device mxc_uart_device2;
4extern struct platform_device mxc_uart_device3;
5extern struct platform_device mxc_uart_device4;
6extern struct platform_device mxc_otg; 1extern struct platform_device mxc_otg;
7extern struct platform_device otg_udc_device; 2extern struct platform_device otg_udc_device;
8extern struct platform_device mxc_usbh2; 3extern struct platform_device mxc_usbh2;
9extern struct platform_device mxc_spi_device0;
10extern struct platform_device mxc_spi_device1;
11extern struct platform_device mxc_spi_device2;
12extern struct platform_device mxc_pwm_device0; 4extern struct platform_device mxc_pwm_device0;
13extern struct platform_device mxc_pwm_device1; 5extern struct platform_device mxc_pwm_device1;
14extern struct platform_device mxc_pwm_device2; 6extern struct platform_device mxc_pwm_device2;
15extern struct platform_device mxc_pwm_device3; 7extern struct platform_device mxc_pwm_device3;
16extern struct platform_device mxc_keypad_device; 8extern struct platform_device mxc_keypad_device;
17extern struct platform_device mxc_i2c_device0;
18extern struct platform_device mxc_i2c_device1;
19extern struct platform_device mxc_i2c_device2;
20extern struct platform_device mx25_fec_device; 9extern struct platform_device mx25_fec_device;
21extern struct platform_device mxc_nand_device;
22extern struct platform_device mx25_rtc_device; 10extern struct platform_device mx25_rtc_device;
23extern struct platform_device mx25_fb_device; 11extern struct platform_device mx25_fb_device;
24extern struct platform_device mxc_wdt; 12extern struct platform_device mxc_wdt;
13extern struct platform_device mx25_kpp_device;
14extern struct platform_device imx_ssi_device0;
15extern struct platform_device imx_ssi_device1;
16extern struct platform_device mx25_csi_device;
diff --git a/arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c b/arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c
new file mode 100644
index 000000000000..91931dcb0689
--- /dev/null
+++ b/arch/arm/mach-mx25/eukrea_mbimxsd-baseboard.c
@@ -0,0 +1,260 @@
1/*
2 * Copyright (C) 2010 Eric Benard - eric@eukrea.com
3 *
4 * Based on pcm970-baseboard.c which is :
5 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 */
21
22#include <linux/gpio.h>
23#include <linux/leds.h>
24#include <linux/platform_device.h>
25#include <linux/gpio_keys.h>
26#include <linux/input.h>
27#include <video/platform_lcd.h>
28
29#include <mach/hardware.h>
30#include <mach/iomux-mx25.h>
31#include <mach/common.h>
32#include <asm/mach-types.h>
33#include <asm/mach/arch.h>
34#include <mach/mx25.h>
35#include <mach/imx-uart.h>
36#include <mach/imxfb.h>
37#include <mach/ssi.h>
38#include <mach/audmux.h>
39
40#include "devices-imx25.h"
41#include "devices.h"
42
43static struct pad_desc eukrea_mbimxsd_pads[] = {
44 /* LCD */
45 MX25_PAD_LD0__LD0,
46 MX25_PAD_LD1__LD1,
47 MX25_PAD_LD2__LD2,
48 MX25_PAD_LD3__LD3,
49 MX25_PAD_LD4__LD4,
50 MX25_PAD_LD5__LD5,
51 MX25_PAD_LD6__LD6,
52 MX25_PAD_LD7__LD7,
53 MX25_PAD_LD8__LD8,
54 MX25_PAD_LD9__LD9,
55 MX25_PAD_LD10__LD10,
56 MX25_PAD_LD11__LD11,
57 MX25_PAD_LD12__LD12,
58 MX25_PAD_LD13__LD13,
59 MX25_PAD_LD14__LD14,
60 MX25_PAD_LD15__LD15,
61 MX25_PAD_GPIO_E__LD16,
62 MX25_PAD_GPIO_F__LD17,
63 MX25_PAD_HSYNC__HSYNC,
64 MX25_PAD_VSYNC__VSYNC,
65 MX25_PAD_LSCLK__LSCLK,
66 MX25_PAD_OE_ACD__OE_ACD,
67 MX25_PAD_CONTRAST__CONTRAST,
68 /* LCD_PWR */
69 MX25_PAD_PWM__GPIO_1_26,
70 /* LED */
71 MX25_PAD_POWER_FAIL__GPIO_3_19,
72 /* SWITCH */
73 MX25_PAD_VSTBY_ACK__GPIO_3_18,
74 /* UART2 */
75 MX25_PAD_UART2_RTS__UART2_RTS,
76 MX25_PAD_UART2_CTS__UART2_CTS,
77 MX25_PAD_UART2_TXD__UART2_TXD,
78 MX25_PAD_UART2_RXD__UART2_RXD,
79 /* SD1 */
80 MX25_PAD_SD1_CMD__SD1_CMD,
81 MX25_PAD_SD1_CLK__SD1_CLK,
82 MX25_PAD_SD1_DATA0__SD1_DATA0,
83 MX25_PAD_SD1_DATA1__SD1_DATA1,
84 MX25_PAD_SD1_DATA2__SD1_DATA2,
85 MX25_PAD_SD1_DATA3__SD1_DATA3,
86 /* SD1 CD */
87 MX25_PAD_DE_B__GPIO_2_20,
88 /* I2S */
89 MX25_PAD_KPP_COL3__AUD5_TXFS,
90 MX25_PAD_KPP_COL2__AUD5_TXC,
91 MX25_PAD_KPP_COL1__AUD5_RXD,
92 MX25_PAD_KPP_COL0__AUD5_TXD,
93};
94
95#define GPIO_LED1 83
96#define GPIO_SWITCH1 82
97#define GPIO_SD1CD 52
98#define GPIO_LCDPWR 26
99
100static struct imx_fb_videomode eukrea_mximxsd_modes[] = {
101 {
102 .mode = {
103 .name = "CMO-QVGA",
104 .refresh = 60,
105 .xres = 320,
106 .yres = 240,
107 .pixclock = KHZ2PICOS(6500),
108 .left_margin = 30,
109 .right_margin = 38,
110 .upper_margin = 20,
111 .lower_margin = 3,
112 .hsync_len = 15,
113 .vsync_len = 4,
114 },
115 .bpp = 16,
116 .pcr = 0xCAD08B80,
117 },
118};
119
120static struct imx_fb_platform_data eukrea_mximxsd_fb_pdata = {
121 .mode = eukrea_mximxsd_modes,
122 .num_modes = ARRAY_SIZE(eukrea_mximxsd_modes),
123 .pwmr = 0x00A903FF,
124 .lscr1 = 0x00120300,
125 .dmacr = 0x00040060,
126};
127
128static void eukrea_mbimxsd_lcd_power_set(struct plat_lcd_data *pd,
129 unsigned int power)
130{
131 if (power)
132 gpio_direction_output(GPIO_LCDPWR, 1);
133 else
134 gpio_direction_output(GPIO_LCDPWR, 0);
135}
136
137static struct plat_lcd_data eukrea_mbimxsd_lcd_power_data = {
138 .set_power = eukrea_mbimxsd_lcd_power_set,
139};
140
141static struct platform_device eukrea_mbimxsd_lcd_powerdev = {
142 .name = "platform-lcd",
143 .dev.platform_data = &eukrea_mbimxsd_lcd_power_data,
144};
145
146static struct gpio_led eukrea_mbimxsd_leds[] = {
147 {
148 .name = "led1",
149 .default_trigger = "heartbeat",
150 .active_low = 1,
151 .gpio = GPIO_LED1,
152 },
153};
154
155static struct gpio_led_platform_data eukrea_mbimxsd_led_info = {
156 .leds = eukrea_mbimxsd_leds,
157 .num_leds = ARRAY_SIZE(eukrea_mbimxsd_leds),
158};
159
160static struct platform_device eukrea_mbimxsd_leds_gpio = {
161 .name = "leds-gpio",
162 .id = -1,
163 .dev = {
164 .platform_data = &eukrea_mbimxsd_led_info,
165 },
166};
167
168static struct gpio_keys_button eukrea_mbimxsd_gpio_buttons[] = {
169 {
170 .gpio = GPIO_SWITCH1,
171 .code = BTN_0,
172 .desc = "BP1",
173 .active_low = 1,
174 .wakeup = 1,
175 },
176};
177
178static struct gpio_keys_platform_data eukrea_mbimxsd_button_data = {
179 .buttons = eukrea_mbimxsd_gpio_buttons,
180 .nbuttons = ARRAY_SIZE(eukrea_mbimxsd_gpio_buttons),
181};
182
183static struct platform_device eukrea_mbimxsd_button_device = {
184 .name = "gpio-keys",
185 .id = -1,
186 .num_resources = 0,
187 .dev = {
188 .platform_data = &eukrea_mbimxsd_button_data,
189 }
190};
191
192static struct platform_device *platform_devices[] __initdata = {
193 &eukrea_mbimxsd_leds_gpio,
194 &eukrea_mbimxsd_button_device,
195 &eukrea_mbimxsd_lcd_powerdev,
196};
197
198static const struct imxuart_platform_data uart_pdata __initconst = {
199 .flags = IMXUART_HAVE_RTSCTS,
200};
201
202static struct i2c_board_info eukrea_mbimxsd_i2c_devices[] = {
203 {
204 I2C_BOARD_INFO("tlv320aic23", 0x1a),
205 },
206};
207
208struct imx_ssi_platform_data eukrea_mbimxsd_ssi_pdata = {
209 .flags = IMX_SSI_SYN | IMX_SSI_NET | IMX_SSI_USE_I2S_SLAVE,
210};
211
212/*
213 * system init for baseboard usage. Will be called by cpuimx25 init.
214 *
215 * Add platform devices present on this baseboard and init
216 * them from CPU side as far as required to use them later on
217 */
218void __init eukrea_mbimxsd_baseboard_init(void)
219{
220 if (mxc_iomux_v3_setup_multiple_pads(eukrea_mbimxsd_pads,
221 ARRAY_SIZE(eukrea_mbimxsd_pads)))
222 printk(KERN_ERR "error setting mbimxsd pads !\n");
223
224#if defined(CONFIG_SND_SOC_EUKREA_TLV320)
225 /* SSI unit master I2S codec connected to SSI_AUD5*/
226 mxc_audmux_v2_configure_port(0,
227 MXC_AUDMUX_V2_PTCR_SYN |
228 MXC_AUDMUX_V2_PTCR_TFSDIR |
229 MXC_AUDMUX_V2_PTCR_TFSEL(4) |
230 MXC_AUDMUX_V2_PTCR_TCLKDIR |
231 MXC_AUDMUX_V2_PTCR_TCSEL(4),
232 MXC_AUDMUX_V2_PDCR_RXDSEL(4)
233 );
234 mxc_audmux_v2_configure_port(4,
235 MXC_AUDMUX_V2_PTCR_SYN,
236 MXC_AUDMUX_V2_PDCR_RXDSEL(0)
237 );
238#endif
239
240 imx25_add_imx_uart1(&uart_pdata);
241 mxc_register_device(&mx25_fb_device, &eukrea_mximxsd_fb_pdata);
242 mxc_register_device(&imx_ssi_device0, &eukrea_mbimxsd_ssi_pdata);
243
244 gpio_request(GPIO_LED1, "LED1");
245 gpio_direction_output(GPIO_LED1, 1);
246 gpio_free(GPIO_LED1);
247
248 gpio_request(GPIO_SWITCH1, "SWITCH1");
249 gpio_direction_input(GPIO_SWITCH1);
250 gpio_free(GPIO_SWITCH1);
251
252 gpio_request(GPIO_LCDPWR, "LCDPWR");
253 gpio_direction_output(GPIO_LCDPWR, 1);
254 gpio_free(GPIO_SWITCH1);
255
256 i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices,
257 ARRAY_SIZE(eukrea_mbimxsd_i2c_devices));
258
259 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
260}
diff --git a/arch/arm/mach-mx25/mach-cpuimx25.c b/arch/arm/mach-mx25/mach-cpuimx25.c
new file mode 100644
index 000000000000..56b2e26d23b4
--- /dev/null
+++ b/arch/arm/mach-mx25/mach-cpuimx25.c
@@ -0,0 +1,173 @@
1/*
2 * Copyright 2009 Sascha Hauer, <kernel@pengutronix.de>
3 * Copyright 2010 Eric Bénard - Eukréa Electromatique, <eric@eukrea.com>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
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., 51 Franklin Street, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
18 */
19
20#include <linux/types.h>
21#include <linux/init.h>
22#include <linux/delay.h>
23#include <linux/clk.h>
24#include <linux/irq.h>
25#include <linux/gpio.h>
26#include <linux/fec.h>
27#include <linux/platform_device.h>
28#include <linux/usb/otg.h>
29#include <linux/usb/ulpi.h>
30#include <linux/fsl_devices.h>
31
32#include <mach/eukrea-baseboards.h>
33#include <mach/hardware.h>
34#include <asm/mach-types.h>
35#include <asm/mach/arch.h>
36#include <asm/mach/time.h>
37#include <asm/memory.h>
38#include <asm/mach/map.h>
39#include <mach/common.h>
40#include <mach/mx25.h>
41#include <mach/mxc_nand.h>
42#include <mach/imxfb.h>
43#include <mach/mxc_ehci.h>
44#include <mach/ulpi.h>
45#include <mach/iomux-mx25.h>
46
47#include "devices-imx25.h"
48#include "devices.h"
49
50static const struct imxuart_platform_data uart_pdata __initconst = {
51 .flags = IMXUART_HAVE_RTSCTS,
52};
53
54static struct pad_desc eukrea_cpuimx25_pads[] = {
55 /* FEC - RMII */
56 MX25_PAD_FEC_MDC__FEC_MDC,
57 MX25_PAD_FEC_MDIO__FEC_MDIO,
58 MX25_PAD_FEC_TDATA0__FEC_TDATA0,
59 MX25_PAD_FEC_TDATA1__FEC_TDATA1,
60 MX25_PAD_FEC_TX_EN__FEC_TX_EN,
61 MX25_PAD_FEC_RDATA0__FEC_RDATA0,
62 MX25_PAD_FEC_RDATA1__FEC_RDATA1,
63 MX25_PAD_FEC_RX_DV__FEC_RX_DV,
64 MX25_PAD_FEC_TX_CLK__FEC_TX_CLK,
65 /* I2C1 */
66 MX25_PAD_I2C1_CLK__I2C1_CLK,
67 MX25_PAD_I2C1_DAT__I2C1_DAT,
68};
69
70static struct fec_platform_data mx25_fec_pdata = {
71 .phy = PHY_INTERFACE_MODE_RMII,
72};
73
74static const struct mxc_nand_platform_data
75eukrea_cpuimx25_nand_board_info __initconst = {
76 .width = 1,
77 .hw_ecc = 1,
78 .flash_bbt = 1,
79};
80
81static const struct imxi2c_platform_data
82eukrea_cpuimx25_i2c0_data __initconst = {
83 .bitrate = 100000,
84};
85
86static struct i2c_board_info eukrea_cpuimx25_i2c_devices[] = {
87 {
88 I2C_BOARD_INFO("pcf8563", 0x51),
89 },
90};
91
92static struct mxc_usbh_platform_data otg_pdata = {
93 .portsc = MXC_EHCI_MODE_UTMI,
94 .flags = MXC_EHCI_INTERFACE_DIFF_UNI,
95};
96
97static struct mxc_usbh_platform_data usbh2_pdata = {
98 .portsc = MXC_EHCI_MODE_SERIAL,
99 .flags = MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY |
100 MXC_EHCI_IPPUE_DOWN,
101};
102
103static struct fsl_usb2_platform_data otg_device_pdata = {
104 .operating_mode = FSL_USB2_DR_DEVICE,
105 .phy_mode = FSL_USB2_PHY_UTMI,
106};
107
108static int otg_mode_host;
109
110static int __init eukrea_cpuimx25_otg_mode(char *options)
111{
112 if (!strcmp(options, "host"))
113 otg_mode_host = 1;
114 else if (!strcmp(options, "device"))
115 otg_mode_host = 0;
116 else
117 pr_info("otg_mode neither \"host\" nor \"device\". "
118 "Defaulting to device\n");
119 return 0;
120}
121__setup("otg_mode=", eukrea_cpuimx25_otg_mode);
122
123static void __init eukrea_cpuimx25_init(void)
124{
125 if (mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx25_pads,
126 ARRAY_SIZE(eukrea_cpuimx25_pads)))
127 printk(KERN_ERR "error setting cpuimx25 pads !\n");
128
129 imx25_add_imx_uart0(&uart_pdata);
130 imx25_add_mxc_nand(&eukrea_cpuimx25_nand_board_info);
131 mxc_register_device(&mx25_rtc_device, NULL);
132 mxc_register_device(&mx25_fec_device, &mx25_fec_pdata);
133
134 i2c_register_board_info(0, eukrea_cpuimx25_i2c_devices,
135 ARRAY_SIZE(eukrea_cpuimx25_i2c_devices));
136 imx25_add_imx_i2c0(&eukrea_cpuimx25_i2c0_data);
137
138#if defined(CONFIG_USB_ULPI)
139 if (otg_mode_host) {
140 otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
141 USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT);
142
143 mxc_register_device(&mxc_otg, &otg_pdata);
144 }
145 mxc_register_device(&mxc_usbh2, &usbh2_pdata);
146#endif
147 if (!otg_mode_host)
148 mxc_register_device(&otg_udc_device, &otg_device_pdata);
149
150#ifdef CONFIG_MACH_EUKREA_MBIMXSD_BASEBOARD
151 eukrea_mbimxsd_baseboard_init();
152#endif
153}
154
155static void __init eukrea_cpuimx25_timer_init(void)
156{
157 mx25_clocks_init();
158}
159
160static struct sys_timer eukrea_cpuimx25_timer = {
161 .init = eukrea_cpuimx25_timer_init,
162};
163
164MACHINE_START(EUKREA_CPUIMX25, "Eukrea CPUIMX25")
165 /* Maintainer: Eukrea Electromatique */
166 .phys_io = MX25_AIPS1_BASE_ADDR,
167 .io_pg_offst = ((MX25_AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
168 .boot_params = MX25_PHYS_OFFSET + 0x100,
169 .map_io = mx25_map_io,
170 .init_irq = mx25_init_irq,
171 .init_machine = eukrea_cpuimx25_init,
172 .timer = &eukrea_cpuimx25_timer,
173MACHINE_END
diff --git a/arch/arm/mach-mx25/mach-mx25pdk.c b/arch/arm/mach-mx25/mach-mx25_3ds.c
index 83d74109e7d8..62bc21f11a71 100644
--- a/arch/arm/mach-mx25/mach-mx25pdk.c
+++ b/arch/arm/mach-mx25/mach-mx25_3ds.c
@@ -16,6 +16,12 @@
16 * Boston, MA 02110-1301, USA. 16 * Boston, MA 02110-1301, USA.
17 */ 17 */
18 18
19/*
20 * This machine is known as:
21 * - i.MX25 3-Stack Development System
22 * - i.MX25 Platform Development Kit (i.MX25 PDK)
23 */
24
19#include <linux/types.h> 25#include <linux/types.h>
20#include <linux/init.h> 26#include <linux/init.h>
21#include <linux/delay.h> 27#include <linux/delay.h>
@@ -24,6 +30,7 @@
24#include <linux/gpio.h> 30#include <linux/gpio.h>
25#include <linux/fec.h> 31#include <linux/fec.h>
26#include <linux/platform_device.h> 32#include <linux/platform_device.h>
33#include <linux/input/matrix_keypad.h>
27 34
28#include <mach/hardware.h> 35#include <mach/hardware.h>
29#include <asm/mach-types.h> 36#include <asm/mach-types.h>
@@ -32,14 +39,14 @@
32#include <asm/memory.h> 39#include <asm/memory.h>
33#include <asm/mach/map.h> 40#include <asm/mach/map.h>
34#include <mach/common.h> 41#include <mach/common.h>
35#include <mach/imx-uart.h>
36#include <mach/mx25.h> 42#include <mach/mx25.h>
37#include <mach/mxc_nand.h>
38#include <mach/imxfb.h> 43#include <mach/imxfb.h>
39#include "devices.h"
40#include <mach/iomux-mx25.h> 44#include <mach/iomux-mx25.h>
41 45
42static struct imxuart_platform_data uart_pdata = { 46#include "devices-imx25.h"
47#include "devices.h"
48
49static const struct imxuart_platform_data uart_pdata __initconst = {
43 .flags = IMXUART_HAVE_RTSCTS, 50 .flags = IMXUART_HAVE_RTSCTS,
44}; 51};
45 52
@@ -80,6 +87,16 @@ static struct pad_desc mx25pdk_pads[] = {
80 MX25_PAD_LSCLK__LSCLK, 87 MX25_PAD_LSCLK__LSCLK,
81 MX25_PAD_OE_ACD__OE_ACD, 88 MX25_PAD_OE_ACD__OE_ACD,
82 MX25_PAD_CONTRAST__CONTRAST, 89 MX25_PAD_CONTRAST__CONTRAST,
90
91 /* Keypad */
92 MX25_PAD_KPP_ROW0__KPP_ROW0,
93 MX25_PAD_KPP_ROW1__KPP_ROW1,
94 MX25_PAD_KPP_ROW2__KPP_ROW2,
95 MX25_PAD_KPP_ROW3__KPP_ROW3,
96 MX25_PAD_KPP_COL0__KPP_COL0,
97 MX25_PAD_KPP_COL1__KPP_COL1,
98 MX25_PAD_KPP_COL2__KPP_COL2,
99 MX25_PAD_KPP_COL3__KPP_COL3,
83}; 100};
84 101
85static struct fec_platform_data mx25_fec_pdata = { 102static struct fec_platform_data mx25_fec_pdata = {
@@ -103,7 +120,8 @@ static void __init mx25pdk_fec_reset(void)
103 gpio_set_value(FEC_RESET_B_GPIO, 1); 120 gpio_set_value(FEC_RESET_B_GPIO, 1);
104} 121}
105 122
106static struct mxc_nand_platform_data mx25pdk_nand_board_info = { 123static const struct mxc_nand_platform_data
124mx25pdk_nand_board_info __initconst = {
107 .width = 1, 125 .width = 1,
108 .hw_ecc = 1, 126 .hw_ecc = 1,
109 .flash_bbt = 1, 127 .flash_bbt = 1,
@@ -137,19 +155,45 @@ static struct imx_fb_platform_data mx25pdk_fb_pdata = {
137 .dmacr = 0x00020010, 155 .dmacr = 0x00020010,
138}; 156};
139 157
158static const uint32_t mx25pdk_keymap[] = {
159 KEY(0, 0, KEY_UP),
160 KEY(0, 1, KEY_DOWN),
161 KEY(0, 2, KEY_VOLUMEDOWN),
162 KEY(0, 3, KEY_HOME),
163 KEY(1, 0, KEY_RIGHT),
164 KEY(1, 1, KEY_LEFT),
165 KEY(1, 2, KEY_ENTER),
166 KEY(1, 3, KEY_VOLUMEUP),
167 KEY(2, 0, KEY_F6),
168 KEY(2, 1, KEY_F8),
169 KEY(2, 2, KEY_F9),
170 KEY(2, 3, KEY_F10),
171 KEY(3, 0, KEY_F1),
172 KEY(3, 1, KEY_F2),
173 KEY(3, 2, KEY_F3),
174 KEY(3, 3, KEY_POWER),
175};
176
177static struct matrix_keymap_data mx25pdk_keymap_data = {
178 .keymap = mx25pdk_keymap,
179 .keymap_size = ARRAY_SIZE(mx25pdk_keymap),
180};
181
140static void __init mx25pdk_init(void) 182static void __init mx25pdk_init(void)
141{ 183{
142 mxc_iomux_v3_setup_multiple_pads(mx25pdk_pads, 184 mxc_iomux_v3_setup_multiple_pads(mx25pdk_pads,
143 ARRAY_SIZE(mx25pdk_pads)); 185 ARRAY_SIZE(mx25pdk_pads));
144 186
145 mxc_register_device(&mxc_uart_device0, &uart_pdata); 187 imx25_add_imx_uart0(&uart_pdata);
146 mxc_register_device(&mxc_usbh2, NULL); 188 mxc_register_device(&mxc_usbh2, NULL);
147 mxc_register_device(&mxc_nand_device, &mx25pdk_nand_board_info); 189 imx25_add_mxc_nand(&mx25pdk_nand_board_info);
148 mxc_register_device(&mx25_rtc_device, NULL); 190 mxc_register_device(&mx25_rtc_device, NULL);
149 mxc_register_device(&mx25_fb_device, &mx25pdk_fb_pdata); 191 mxc_register_device(&mx25_fb_device, &mx25pdk_fb_pdata);
192 mxc_register_device(&mxc_wdt, NULL);
150 193
151 mx25pdk_fec_reset(); 194 mx25pdk_fec_reset();
152 mxc_register_device(&mx25_fec_device, &mx25_fec_pdata); 195 mxc_register_device(&mx25_fec_device, &mx25_fec_pdata);
196 mxc_register_device(&mx25_kpp_device, &mx25pdk_keymap_data);
153} 197}
154 198
155static void __init mx25pdk_timer_init(void) 199static void __init mx25pdk_timer_init(void)
diff --git a/arch/arm/mach-mx25/mm.c b/arch/arm/mach-mx25/mm.c
index a7e587ff3e9e..bb677111fb0f 100644
--- a/arch/arm/mach-mx25/mm.c
+++ b/arch/arm/mach-mx25/mm.c
@@ -14,10 +14,6 @@
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 17 */
22 18
23#include <linux/mm.h> 19#include <linux/mm.h>
@@ -69,8 +65,11 @@ void __init mx25_map_io(void)
69 iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc)); 65 iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
70} 66}
71 67
68int imx25_register_gpios(void);
69
72void __init mx25_init_irq(void) 70void __init mx25_init_irq(void)
73{ 71{
74 mxc_init_irq((void __iomem *)MX25_AVIC_BASE_ADDR_VIRT); 72 mxc_init_irq((void __iomem *)MX25_AVIC_BASE_ADDR_VIRT);
73 imx25_register_gpios();
75} 74}
76 75
diff --git a/arch/arm/mach-mx3/Kconfig b/arch/arm/mach-mx3/Kconfig
index 344753fdf25e..85beece802aa 100644
--- a/arch/arm/mach-mx3/Kconfig
+++ b/arch/arm/mach-mx3/Kconfig
@@ -15,6 +15,8 @@ comment "MX3 platforms:"
15config MACH_MX31ADS 15config MACH_MX31ADS
16 bool "Support MX31ADS platforms" 16 bool "Support MX31ADS platforms"
17 select ARCH_MX31 17 select ARCH_MX31
18 select IMX_HAVE_PLATFORM_IMX_I2C
19 select IMX_HAVE_PLATFORM_IMX_UART
18 default y 20 default y
19 help 21 help
20 Include support for MX31ADS platform. This includes specific 22 Include support for MX31ADS platform. This includes specific
@@ -34,6 +36,9 @@ config MACH_MX31ADS_WM1133_EV1
34config MACH_PCM037 36config MACH_PCM037
35 bool "Support Phytec pcm037 (i.MX31) platforms" 37 bool "Support Phytec pcm037 (i.MX31) platforms"
36 select ARCH_MX31 38 select ARCH_MX31
39 select IMX_HAVE_PLATFORM_IMX_I2C
40 select IMX_HAVE_PLATFORM_IMX_UART
41 select IMX_HAVE_PLATFORM_MXC_NAND
37 select MXC_ULPI if USB_ULPI 42 select MXC_ULPI if USB_ULPI
38 help 43 help
39 Include support for Phytec pcm037 platform. This includes 44 Include support for Phytec pcm037 platform. This includes
@@ -42,6 +47,7 @@ config MACH_PCM037
42config MACH_PCM037_EET 47config MACH_PCM037_EET
43 bool "Support pcm037 EET board extensions" 48 bool "Support pcm037 EET board extensions"
44 depends on MACH_PCM037 49 depends on MACH_PCM037
50 select IMX_HAVE_PLATFORM_SPI_IMX
45 help 51 help
46 Add support for PCM037 EET baseboard extensions. If you are using the 52 Add support for PCM037 EET baseboard extensions. If you are using the
47 OLED display with EET, use "video=mx3fb:CMEL-OLED" kernel 53 OLED display with EET, use "video=mx3fb:CMEL-OLED" kernel
@@ -51,6 +57,9 @@ config MACH_MX31LITE
51 bool "Support MX31 LITEKIT (LogicPD)" 57 bool "Support MX31 LITEKIT (LogicPD)"
52 select ARCH_MX31 58 select ARCH_MX31
53 select MXC_ULPI if USB_ULPI 59 select MXC_ULPI if USB_ULPI
60 select IMX_HAVE_PLATFORM_IMX_UART
61 select IMX_HAVE_PLATFORM_MXC_NAND
62 select IMX_HAVE_PLATFORM_SPI_IMX
54 help 63 help
55 Include support for MX31 LITEKIT platform. This includes specific 64 Include support for MX31 LITEKIT platform. This includes specific
56 configurations for the board and its peripherals. 65 configurations for the board and its peripherals.
@@ -58,6 +67,10 @@ config MACH_MX31LITE
58config MACH_MX31_3DS 67config MACH_MX31_3DS
59 bool "Support MX31PDK (3DS)" 68 bool "Support MX31PDK (3DS)"
60 select ARCH_MX31 69 select ARCH_MX31
70 select MXC_DEBUG_BOARD
71 select IMX_HAVE_PLATFORM_IMX_UART
72 select IMX_HAVE_PLATFORM_MXC_NAND
73 select IMX_HAVE_PLATFORM_SPI_IMX
61 help 74 help
62 Include support for MX31PDK (3DS) platform. This includes specific 75 Include support for MX31PDK (3DS) platform. This includes specific
63 configurations for the board and its peripherals. 76 configurations for the board and its peripherals.
@@ -74,6 +87,9 @@ config MACH_MX31_3DS_MXC_NAND_USE_BBT
74config MACH_MX31MOBOARD 87config MACH_MX31MOBOARD
75 bool "Support mx31moboard platforms (EPFL Mobots group)" 88 bool "Support mx31moboard platforms (EPFL Mobots group)"
76 select ARCH_MX31 89 select ARCH_MX31
90 select IMX_HAVE_PLATFORM_IMX_I2C
91 select IMX_HAVE_PLATFORM_IMX_UART
92 select IMX_HAVE_PLATFORM_SPI_IMX
77 select MXC_ULPI if USB_ULPI 93 select MXC_ULPI if USB_ULPI
78 help 94 help
79 Include support for mx31moboard platform. This includes specific 95 Include support for mx31moboard platform. This includes specific
@@ -82,6 +98,8 @@ config MACH_MX31MOBOARD
82config MACH_MX31LILLY 98config MACH_MX31LILLY
83 bool "Support MX31 LILLY-1131 platforms (INCO startec)" 99 bool "Support MX31 LILLY-1131 platforms (INCO startec)"
84 select ARCH_MX31 100 select ARCH_MX31
101 select IMX_HAVE_PLATFORM_IMX_UART
102 select IMX_HAVE_PLATFORM_SPI_IMX
85 select MXC_ULPI if USB_ULPI 103 select MXC_ULPI if USB_ULPI
86 help 104 help
87 Include support for mx31 based LILLY1131 modules. This includes 105 Include support for mx31 based LILLY1131 modules. This includes
@@ -90,6 +108,7 @@ config MACH_MX31LILLY
90config MACH_QONG 108config MACH_QONG
91 bool "Support Dave/DENX QongEVB-LITE platform" 109 bool "Support Dave/DENX QongEVB-LITE platform"
92 select ARCH_MX31 110 select ARCH_MX31
111 select IMX_HAVE_PLATFORM_IMX_UART
93 help 112 help
94 Include support for Dave/DENX QongEVB-LITE platform. This includes 113 Include support for Dave/DENX QongEVB-LITE platform. This includes
95 specific configurations for the board and its peripherals. 114 specific configurations for the board and its peripherals.
@@ -97,6 +116,10 @@ config MACH_QONG
97config MACH_PCM043 116config MACH_PCM043
98 bool "Support Phytec pcm043 (i.MX35) platforms" 117 bool "Support Phytec pcm043 (i.MX35) platforms"
99 select ARCH_MX35 118 select ARCH_MX35
119 select IMX_HAVE_PLATFORM_IMX_I2C
120 select IMX_HAVE_PLATFORM_IMX_UART
121 select IMX_HAVE_PLATFORM_MXC_NAND
122 select IMX_HAVE_PLATFORM_FLEXCAN
100 select MXC_ULPI if USB_ULPI 123 select MXC_ULPI if USB_ULPI
101 help 124 help
102 Include support for Phytec pcm043 platform. This includes 125 Include support for Phytec pcm043 platform. This includes
@@ -105,6 +128,9 @@ config MACH_PCM043
105config MACH_ARMADILLO5X0 128config MACH_ARMADILLO5X0
106 bool "Support Atmark Armadillo-500 Development Base Board" 129 bool "Support Atmark Armadillo-500 Development Base Board"
107 select ARCH_MX31 130 select ARCH_MX31
131 select IMX_HAVE_PLATFORM_IMX_I2C
132 select IMX_HAVE_PLATFORM_IMX_UART
133 select IMX_HAVE_PLATFORM_MXC_NAND
108 select MXC_ULPI if USB_ULPI 134 select MXC_ULPI if USB_ULPI
109 help 135 help
110 Include support for Atmark Armadillo-500 platform. This includes 136 Include support for Atmark Armadillo-500 platform. This includes
@@ -113,6 +139,7 @@ config MACH_ARMADILLO5X0
113config MACH_MX35_3DS 139config MACH_MX35_3DS
114 bool "Support MX35PDK platform" 140 bool "Support MX35PDK platform"
115 select ARCH_MX35 141 select ARCH_MX35
142 select IMX_HAVE_PLATFORM_IMX_UART
116 default n 143 default n
117 help 144 help
118 Include support for MX35PDK platform. This includes specific 145 Include support for MX35PDK platform. This includes specific
@@ -121,8 +148,34 @@ config MACH_MX35_3DS
121config MACH_KZM_ARM11_01 148config MACH_KZM_ARM11_01
122 bool "Support KZM-ARM11-01(Kyoto Microcomputer)" 149 bool "Support KZM-ARM11-01(Kyoto Microcomputer)"
123 select ARCH_MX31 150 select ARCH_MX31
151 select IMX_HAVE_PLATFORM_IMX_UART
124 help 152 help
125 Include support for KZM-ARM11-01. This includes specific 153 Include support for KZM-ARM11-01. This includes specific
126 configurations for the board and its peripherals. 154 configurations for the board and its peripherals.
127 155
156config MACH_EUKREA_CPUIMX35
157 bool "Support Eukrea CPUIMX35 Platform"
158 select ARCH_MX35
159 select IMX_HAVE_PLATFORM_IMX_UART
160 select IMX_HAVE_PLATFORM_IMX_I2C
161 select IMX_HAVE_PLATFORM_MXC_NAND
162 select MXC_ULPI if USB_ULPI
163 help
164 Include support for Eukrea CPUIMX35 platform. This includes
165 specific configurations for the board and its peripherals.
166
167choice
168 prompt "Baseboard"
169 depends on MACH_EUKREA_CPUIMX35
170 default MACH_EUKREA_MBIMXSD35_BASEBOARD
171
172config MACH_EUKREA_MBIMXSD35_BASEBOARD
173 prompt "Eukrea MBIMXSD development board"
174 bool
175 help
176 This adds board specific devices that can be found on Eukrea's
177 MBIMXSD evaluation board.
178
179endchoice
180
128endif 181endif
diff --git a/arch/arm/mach-mx3/Makefile b/arch/arm/mach-mx3/Makefile
index 5d650fda5d5d..2bd7beceb991 100644
--- a/arch/arm/mach-mx3/Makefile
+++ b/arch/arm/mach-mx3/Makefile
@@ -22,5 +22,7 @@ obj-$(CONFIG_MACH_MX31MOBOARD) += mach-mx31moboard.o mx31moboard-devboard.o \
22obj-$(CONFIG_MACH_QONG) += mach-qong.o 22obj-$(CONFIG_MACH_QONG) += mach-qong.o
23obj-$(CONFIG_MACH_PCM043) += mach-pcm043.o 23obj-$(CONFIG_MACH_PCM043) += mach-pcm043.o
24obj-$(CONFIG_MACH_ARMADILLO5X0) += mach-armadillo5x0.o 24obj-$(CONFIG_MACH_ARMADILLO5X0) += mach-armadillo5x0.o
25obj-$(CONFIG_MACH_MX35_3DS) += mach-mx35pdk.o 25obj-$(CONFIG_MACH_MX35_3DS) += mach-mx35_3ds.o
26obj-$(CONFIG_MACH_KZM_ARM11_01) += mach-kzm_arm11_01.o 26obj-$(CONFIG_MACH_KZM_ARM11_01) += mach-kzm_arm11_01.o
27obj-$(CONFIG_MACH_EUKREA_CPUIMX35) += mach-cpuimx35.o
28obj-$(CONFIG_MACH_EUKREA_MBIMXSD35_BASEBOARD) += eukrea_mbimxsd-baseboard.o
diff --git a/arch/arm/mach-mx3/clock-imx35.c b/arch/arm/mach-mx3/clock-imx35.c
index 9f3e943e2232..d3af0fdf8475 100644
--- a/arch/arm/mach-mx3/clock-imx35.c
+++ b/arch/arm/mach-mx3/clock-imx35.c
@@ -359,7 +359,7 @@ DEFINE_CLOCK(i2c1_clk, 0, CCM_CGR1, 10, get_rate_ipg_per, NULL);
359DEFINE_CLOCK(i2c2_clk, 1, CCM_CGR1, 12, get_rate_ipg_per, NULL); 359DEFINE_CLOCK(i2c2_clk, 1, CCM_CGR1, 12, get_rate_ipg_per, NULL);
360DEFINE_CLOCK(i2c3_clk, 2, CCM_CGR1, 14, get_rate_ipg_per, NULL); 360DEFINE_CLOCK(i2c3_clk, 2, CCM_CGR1, 14, get_rate_ipg_per, NULL);
361DEFINE_CLOCK(iomuxc_clk, 0, CCM_CGR1, 16, NULL, NULL); 361DEFINE_CLOCK(iomuxc_clk, 0, CCM_CGR1, 16, NULL, NULL);
362DEFINE_CLOCK(ipu_clk, 0, CCM_CGR1, 18, NULL, NULL); 362DEFINE_CLOCK(ipu_clk, 0, CCM_CGR1, 18, get_rate_ahb, NULL);
363DEFINE_CLOCK(kpp_clk, 0, CCM_CGR1, 20, get_rate_ipg, NULL); 363DEFINE_CLOCK(kpp_clk, 0, CCM_CGR1, 20, get_rate_ipg, NULL);
364DEFINE_CLOCK(mlb_clk, 0, CCM_CGR1, 22, get_rate_ahb, NULL); 364DEFINE_CLOCK(mlb_clk, 0, CCM_CGR1, 22, get_rate_ahb, NULL);
365DEFINE_CLOCK(mshc_clk, 0, CCM_CGR1, 24, get_rate_mshc, NULL); 365DEFINE_CLOCK(mshc_clk, 0, CCM_CGR1, 24, get_rate_mshc, NULL);
@@ -428,8 +428,8 @@ static struct clk nfc_clk = {
428static struct clk_lookup lookups[] = { 428static struct clk_lookup lookups[] = {
429 _REGISTER_CLOCK(NULL, "asrc", asrc_clk) 429 _REGISTER_CLOCK(NULL, "asrc", asrc_clk)
430 _REGISTER_CLOCK(NULL, "ata", ata_clk) 430 _REGISTER_CLOCK(NULL, "ata", ata_clk)
431 _REGISTER_CLOCK(NULL, "can", can1_clk) 431 _REGISTER_CLOCK("flexcan.0", NULL, can1_clk)
432 _REGISTER_CLOCK(NULL, "can", can2_clk) 432 _REGISTER_CLOCK("flexcan.1", NULL, can2_clk)
433 _REGISTER_CLOCK("spi_imx.0", NULL, cspi1_clk) 433 _REGISTER_CLOCK("spi_imx.0", NULL, cspi1_clk)
434 _REGISTER_CLOCK("spi_imx.1", NULL, cspi2_clk) 434 _REGISTER_CLOCK("spi_imx.1", NULL, cspi2_clk)
435 _REGISTER_CLOCK(NULL, "ect", ect_clk) 435 _REGISTER_CLOCK(NULL, "ect", ect_clk)
diff --git a/arch/arm/mach-mx3/devices-imx31.h b/arch/arm/mach-mx3/devices-imx31.h
new file mode 100644
index 000000000000..3b1a44a20585
--- /dev/null
+++ b/arch/arm/mach-mx3/devices-imx31.h
@@ -0,0 +1,38 @@
1/*
2 * Copyright (C) 2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#include <mach/mx31.h>
10#include <mach/devices-common.h>
11
12#define imx31_add_imx_i2c0(pdata) \
13 imx_add_imx_i2c(0, MX31_I2C1_BASE_ADDR, SZ_4K, MX31_INT_I2C1, pdata)
14#define imx31_add_imx_i2c1(pdata) \
15 imx_add_imx_i2c(1, MX31_I2C2_BASE_ADDR, SZ_4K, MX31_INT_I2C2, pdata)
16#define imx31_add_imx_i2c2(pdata) \
17 imx_add_imx_i2c(2, MX31_I2C3_BASE_ADDR, SZ_4K, MX31_INT_I2C3, pdata)
18
19#define imx31_add_imx_uart0(pdata) \
20 imx_add_imx_uart_1irq(0, MX31_UART1_BASE_ADDR, SZ_16K, MX31_INT_UART1, pdata)
21#define imx31_add_imx_uart1(pdata) \
22 imx_add_imx_uart_1irq(1, MX31_UART2_BASE_ADDR, SZ_16K, MX31_INT_UART2, pdata)
23#define imx31_add_imx_uart2(pdata) \
24 imx_add_imx_uart_1irq(2, MX31_UART3_BASE_ADDR, SZ_16K, MX31_INT_UART3, pdata)
25#define imx31_add_imx_uart3(pdata) \
26 imx_add_imx_uart_1irq(3, MX31_UART4_BASE_ADDR, SZ_16K, MX31_INT_UART4, pdata)
27#define imx31_add_imx_uart4(pdata) \
28 imx_add_imx_uart_1irq(4, MX31_UART5_BASE_ADDR, SZ_16K, MX31_INT_UART5, pdata)
29
30#define imx31_add_mxc_nand(pdata) \
31 imx_add_mxc_nand_v1(MX31_NFC_BASE_ADDR, MX31_INT_NANDFC, pdata)
32
33#define imx31_add_spi_imx0(pdata) \
34 imx_add_spi_imx(0, MX31_CSPI1_BASE_ADDR, SZ_4K, MX31_INT_CSPI1, pdata)
35#define imx31_add_spi_imx1(pdata) \
36 imx_add_spi_imx(1, MX31_CSPI2_BASE_ADDR, SZ_4K, MX31_INT_CSPI2, pdata)
37#define imx31_add_spi_imx2(pdata) \
38 imx_add_spi_imx(2, MX31_CSPI3_BASE_ADDR, SZ_4K, MX31_INT_CSPI3, pdata)
diff --git a/arch/arm/mach-mx3/devices-imx35.h b/arch/arm/mach-mx3/devices-imx35.h
new file mode 100644
index 000000000000..f6a431a4c3d2
--- /dev/null
+++ b/arch/arm/mach-mx3/devices-imx35.h
@@ -0,0 +1,37 @@
1/*
2 * Copyright (C) 2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#include <mach/mx35.h>
10#include <mach/devices-common.h>
11
12#define imx35_add_flexcan0(pdata) \
13 imx_add_flexcan(0, MX35_CAN1_BASE_ADDR, SZ_16K, MX35_INT_CAN1, pdata)
14#define imx35_add_flexcan1(pdata) \
15 imx_add_flexcan(1, MX35_CAN2_BASE_ADDR, SZ_16K, MX35_INT_CAN2, pdata)
16
17#define imx35_add_imx_i2c0(pdata) \
18 imx_add_imx_i2c(0, MX35_I2C1_BASE_ADDR, SZ_4K, MX35_INT_I2C1, pdata)
19#define imx35_add_imx_i2c1(pdata) \
20 imx_add_imx_i2c(1, MX35_I2C2_BASE_ADDR, SZ_4K, MX35_INT_I2C2, pdata)
21#define imx35_add_imx_i2c2(pdata) \
22 imx_add_imx_i2c(2, MX35_I2C3_BASE_ADDR, SZ_4K, MX35_INT_I2C3, pdata)
23
24#define imx35_add_imx_uart0(pdata) \
25 imx_add_imx_uart_1irq(0, MX35_UART1_BASE_ADDR, SZ_16K, MX35_INT_UART1, pdata)
26#define imx35_add_imx_uart1(pdata) \
27 imx_add_imx_uart_1irq(1, MX35_UART2_BASE_ADDR, SZ_16K, MX35_INT_UART2, pdata)
28#define imx35_add_imx_uart2(pdata) \
29 imx_add_imx_uart_1irq(2, MX35_UART3_BASE_ADDR, SZ_16K, MX35_INT_UART3, pdata)
30
31#define imx35_add_mxc_nand(pdata) \
32 imx_add_mxc_nand_v21(MX35_NFC_BASE_ADDR, MX35_INT_NANDFC, pdata)
33
34#define imx35_add_spi_imx0(pdata) \
35 imx_add_spi_imx(0, MX35_CSPI1_BASE_ADDR, SZ_4K, MX35_INT_CSPI1, pdata)
36#define imx35_add_spi_imx1(pdata) \
37 imx_add_spi_imx(1, MX35_CSPI2_BASE_ADDR, SZ_4K, MX35_INT_CSPI2, pdata)
diff --git a/arch/arm/mach-mx3/devices.c b/arch/arm/mach-mx3/devices.c
index db7acd6e9101..a4fd1a26fc91 100644
--- a/arch/arm/mach-mx3/devices.c
+++ b/arch/arm/mach-mx3/devices.c
@@ -25,108 +25,10 @@
25#include <mach/hardware.h> 25#include <mach/hardware.h>
26#include <mach/irqs.h> 26#include <mach/irqs.h>
27#include <mach/common.h> 27#include <mach/common.h>
28#include <mach/imx-uart.h>
29#include <mach/mx3_camera.h> 28#include <mach/mx3_camera.h>
30 29
31#include "devices.h" 30#include "devices.h"
32 31
33static struct resource uart0[] = {
34 {
35 .start = UART1_BASE_ADDR,
36 .end = UART1_BASE_ADDR + 0x0B5,
37 .flags = IORESOURCE_MEM,
38 }, {
39 .start = MXC_INT_UART1,
40 .end = MXC_INT_UART1,
41 .flags = IORESOURCE_IRQ,
42 },
43};
44
45struct platform_device mxc_uart_device0 = {
46 .name = "imx-uart",
47 .id = 0,
48 .resource = uart0,
49 .num_resources = ARRAY_SIZE(uart0),
50};
51
52static struct resource uart1[] = {
53 {
54 .start = UART2_BASE_ADDR,
55 .end = UART2_BASE_ADDR + 0x0B5,
56 .flags = IORESOURCE_MEM,
57 }, {
58 .start = MXC_INT_UART2,
59 .end = MXC_INT_UART2,
60 .flags = IORESOURCE_IRQ,
61 },
62};
63
64struct platform_device mxc_uart_device1 = {
65 .name = "imx-uart",
66 .id = 1,
67 .resource = uart1,
68 .num_resources = ARRAY_SIZE(uart1),
69};
70
71static struct resource uart2[] = {
72 {
73 .start = UART3_BASE_ADDR,
74 .end = UART3_BASE_ADDR + 0x0B5,
75 .flags = IORESOURCE_MEM,
76 }, {
77 .start = MXC_INT_UART3,
78 .end = MXC_INT_UART3,
79 .flags = IORESOURCE_IRQ,
80 },
81};
82
83struct platform_device mxc_uart_device2 = {
84 .name = "imx-uart",
85 .id = 2,
86 .resource = uart2,
87 .num_resources = ARRAY_SIZE(uart2),
88};
89
90#ifdef CONFIG_ARCH_MX31
91static struct resource uart3[] = {
92 {
93 .start = UART4_BASE_ADDR,
94 .end = UART4_BASE_ADDR + 0x0B5,
95 .flags = IORESOURCE_MEM,
96 }, {
97 .start = MXC_INT_UART4,
98 .end = MXC_INT_UART4,
99 .flags = IORESOURCE_IRQ,
100 },
101};
102
103struct platform_device mxc_uart_device3 = {
104 .name = "imx-uart",
105 .id = 3,
106 .resource = uart3,
107 .num_resources = ARRAY_SIZE(uart3),
108};
109
110static struct resource uart4[] = {
111 {
112 .start = UART5_BASE_ADDR,
113 .end = UART5_BASE_ADDR + 0x0B5,
114 .flags = IORESOURCE_MEM,
115 }, {
116 .start = MXC_INT_UART5,
117 .end = MXC_INT_UART5,
118 .flags = IORESOURCE_IRQ,
119 },
120};
121
122struct platform_device mxc_uart_device4 = {
123 .name = "imx-uart",
124 .id = 4,
125 .resource = uart4,
126 .num_resources = ARRAY_SIZE(uart4),
127};
128#endif /* CONFIG_ARCH_MX31 */
129
130/* GPIO port description */ 32/* GPIO port description */
131static struct mxc_gpio_port imx_gpio_ports[] = { 33static struct mxc_gpio_port imx_gpio_ports[] = {
132 { 34 {
@@ -147,7 +49,7 @@ static struct mxc_gpio_port imx_gpio_ports[] = {
147 } 49 }
148}; 50};
149 51
150int __init mxc_register_gpios(void) 52int __init imx3x_register_gpios(void)
151{ 53{
152 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports)); 54 return mxc_gpio_init(imx_gpio_ports, ARRAY_SIZE(imx_gpio_ports));
153} 55}
@@ -167,82 +69,6 @@ struct platform_device mxc_w1_master_device = {
167 .resource = mxc_w1_master_resources, 69 .resource = mxc_w1_master_resources,
168}; 70};
169 71
170static struct resource mxc_nand_resources[] = {
171 {
172 .start = 0, /* runtime dependent */
173 .end = 0,
174 .flags = IORESOURCE_MEM,
175 }, {
176 .start = MXC_INT_NANDFC,
177 .end = MXC_INT_NANDFC,
178 .flags = IORESOURCE_IRQ,
179 },
180};
181
182struct platform_device mxc_nand_device = {
183 .name = "mxc_nand",
184 .id = 0,
185 .num_resources = ARRAY_SIZE(mxc_nand_resources),
186 .resource = mxc_nand_resources,
187};
188
189static struct resource mxc_i2c0_resources[] = {
190 {
191 .start = I2C_BASE_ADDR,
192 .end = I2C_BASE_ADDR + SZ_4K - 1,
193 .flags = IORESOURCE_MEM,
194 }, {
195 .start = MXC_INT_I2C,
196 .end = MXC_INT_I2C,
197 .flags = IORESOURCE_IRQ,
198 },
199};
200
201struct platform_device mxc_i2c_device0 = {
202 .name = "imx-i2c",
203 .id = 0,
204 .num_resources = ARRAY_SIZE(mxc_i2c0_resources),
205 .resource = mxc_i2c0_resources,
206};
207
208static struct resource mxc_i2c1_resources[] = {
209 {
210 .start = I2C2_BASE_ADDR,
211 .end = I2C2_BASE_ADDR + SZ_4K - 1,
212 .flags = IORESOURCE_MEM,
213 }, {
214 .start = MXC_INT_I2C2,
215 .end = MXC_INT_I2C2,
216 .flags = IORESOURCE_IRQ,
217 },
218};
219
220struct platform_device mxc_i2c_device1 = {
221 .name = "imx-i2c",
222 .id = 1,
223 .num_resources = ARRAY_SIZE(mxc_i2c1_resources),
224 .resource = mxc_i2c1_resources,
225};
226
227static struct resource mxc_i2c2_resources[] = {
228 {
229 .start = I2C3_BASE_ADDR,
230 .end = I2C3_BASE_ADDR + SZ_4K - 1,
231 .flags = IORESOURCE_MEM,
232 }, {
233 .start = MXC_INT_I2C3,
234 .end = MXC_INT_I2C3,
235 .flags = IORESOURCE_IRQ,
236 },
237};
238
239struct platform_device mxc_i2c_device2 = {
240 .name = "imx-i2c",
241 .id = 2,
242 .num_resources = ARRAY_SIZE(mxc_i2c2_resources),
243 .resource = mxc_i2c2_resources,
244};
245
246#ifdef CONFIG_ARCH_MX31 72#ifdef CONFIG_ARCH_MX31
247static struct resource mxcsdhc0_resources[] = { 73static struct resource mxcsdhc0_resources[] = {
248 { 74 {
@@ -455,68 +281,7 @@ struct platform_device mxc_usbh2 = {
455 .num_resources = ARRAY_SIZE(mxc_usbh2_resources), 281 .num_resources = ARRAY_SIZE(mxc_usbh2_resources),
456}; 282};
457 283
458/* 284#if defined(CONFIG_ARCH_MX35)
459 * SPI master controller
460 * 3 channels
461 */
462static struct resource mxc_spi_0_resources[] = {
463 {
464 .start = CSPI1_BASE_ADDR,
465 .end = CSPI1_BASE_ADDR + SZ_4K - 1,
466 .flags = IORESOURCE_MEM,
467 }, {
468 .start = MXC_INT_CSPI1,
469 .end = MXC_INT_CSPI1,
470 .flags = IORESOURCE_IRQ,
471 },
472};
473
474static struct resource mxc_spi_1_resources[] = {
475 {
476 .start = CSPI2_BASE_ADDR,
477 .end = CSPI2_BASE_ADDR + SZ_4K - 1,
478 .flags = IORESOURCE_MEM,
479 }, {
480 .start = MXC_INT_CSPI2,
481 .end = MXC_INT_CSPI2,
482 .flags = IORESOURCE_IRQ,
483 },
484};
485
486static struct resource mxc_spi_2_resources[] = {
487 {
488 .start = CSPI3_BASE_ADDR,
489 .end = CSPI3_BASE_ADDR + SZ_4K - 1,
490 .flags = IORESOURCE_MEM,
491 }, {
492 .start = MXC_INT_CSPI3,
493 .end = MXC_INT_CSPI3,
494 .flags = IORESOURCE_IRQ,
495 },
496};
497
498struct platform_device mxc_spi_device0 = {
499 .name = "spi_imx",
500 .id = 0,
501 .num_resources = ARRAY_SIZE(mxc_spi_0_resources),
502 .resource = mxc_spi_0_resources,
503};
504
505struct platform_device mxc_spi_device1 = {
506 .name = "spi_imx",
507 .id = 1,
508 .num_resources = ARRAY_SIZE(mxc_spi_1_resources),
509 .resource = mxc_spi_1_resources,
510};
511
512struct platform_device mxc_spi_device2 = {
513 .name = "spi_imx",
514 .id = 2,
515 .num_resources = ARRAY_SIZE(mxc_spi_2_resources),
516 .resource = mxc_spi_2_resources,
517};
518
519#ifdef CONFIG_ARCH_MX35
520static struct resource mxc_fec_resources[] = { 285static struct resource mxc_fec_resources[] = {
521 { 286 {
522 .start = MXC_FEC_BASE_ADDR, 287 .start = MXC_FEC_BASE_ADDR,
@@ -628,16 +393,15 @@ struct platform_device imx_kpp_device = {
628 393
629static int __init mx3_devices_init(void) 394static int __init mx3_devices_init(void)
630{ 395{
396#if defined(CONFIG_ARCH_MX31)
631 if (cpu_is_mx31()) { 397 if (cpu_is_mx31()) {
632 mxc_nand_resources[0].start = MX31_NFC_BASE_ADDR;
633 mxc_nand_resources[0].end = MX31_NFC_BASE_ADDR + 0xfff;
634 imx_wdt_resources[0].start = MX31_WDOG_BASE_ADDR; 398 imx_wdt_resources[0].start = MX31_WDOG_BASE_ADDR;
635 imx_wdt_resources[0].end = MX31_WDOG_BASE_ADDR + 0x3fff; 399 imx_wdt_resources[0].end = MX31_WDOG_BASE_ADDR + 0x3fff;
636 mxc_register_device(&mxc_rnga_device, NULL); 400 mxc_register_device(&mxc_rnga_device, NULL);
637 } 401 }
402#endif
403#if defined(CONFIG_ARCH_MX35)
638 if (cpu_is_mx35()) { 404 if (cpu_is_mx35()) {
639 mxc_nand_resources[0].start = MX35_NFC_BASE_ADDR;
640 mxc_nand_resources[0].end = MX35_NFC_BASE_ADDR + 0x1fff;
641 otg_resources[0].start = MX35_OTG_BASE_ADDR; 405 otg_resources[0].start = MX35_OTG_BASE_ADDR;
642 otg_resources[0].end = MX35_OTG_BASE_ADDR + 0x1ff; 406 otg_resources[0].end = MX35_OTG_BASE_ADDR + 0x1ff;
643 otg_resources[1].start = MXC_INT_USBOTG; 407 otg_resources[1].start = MXC_INT_USBOTG;
@@ -653,6 +417,7 @@ static int __init mx3_devices_init(void)
653 imx_wdt_resources[0].start = MX35_WDOG_BASE_ADDR; 417 imx_wdt_resources[0].start = MX35_WDOG_BASE_ADDR;
654 imx_wdt_resources[0].end = MX35_WDOG_BASE_ADDR + 0x3fff; 418 imx_wdt_resources[0].end = MX35_WDOG_BASE_ADDR + 0x3fff;
655 } 419 }
420#endif
656 421
657 return 0; 422 return 0;
658} 423}
diff --git a/arch/arm/mach-mx3/devices.h b/arch/arm/mach-mx3/devices.h
index 2c3c8646a29e..e5535234839f 100644
--- a/arch/arm/mach-mx3/devices.h
+++ b/arch/arm/mach-mx3/devices.h
@@ -1,14 +1,4 @@
1
2extern struct platform_device mxc_uart_device0;
3extern struct platform_device mxc_uart_device1;
4extern struct platform_device mxc_uart_device2;
5extern struct platform_device mxc_uart_device3;
6extern struct platform_device mxc_uart_device4;
7extern struct platform_device mxc_w1_master_device; 1extern struct platform_device mxc_w1_master_device;
8extern struct platform_device mxc_nand_device;
9extern struct platform_device mxc_i2c_device0;
10extern struct platform_device mxc_i2c_device1;
11extern struct platform_device mxc_i2c_device2;
12extern struct platform_device mx3_ipu; 2extern struct platform_device mx3_ipu;
13extern struct platform_device mx3_fb; 3extern struct platform_device mx3_fb;
14extern struct platform_device mx3_camera; 4extern struct platform_device mx3_camera;
@@ -20,9 +10,6 @@ extern struct platform_device mxc_otg_host;
20extern struct platform_device mxc_usbh1; 10extern struct platform_device mxc_usbh1;
21extern struct platform_device mxc_usbh2; 11extern struct platform_device mxc_usbh2;
22extern struct platform_device mxc_rnga_device; 12extern struct platform_device mxc_rnga_device;
23extern struct platform_device mxc_spi_device0;
24extern struct platform_device mxc_spi_device1;
25extern struct platform_device mxc_spi_device2;
26extern struct platform_device imx_ssi_device0; 13extern struct platform_device imx_ssi_device0;
27extern struct platform_device imx_ssi_device1; 14extern struct platform_device imx_ssi_device1;
28extern struct platform_device imx_ssi_device1; 15extern struct platform_device imx_ssi_device1;
diff --git a/arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c b/arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c
new file mode 100644
index 000000000000..1dc5004df866
--- /dev/null
+++ b/arch/arm/mach-mx3/eukrea_mbimxsd-baseboard.c
@@ -0,0 +1,263 @@
1/*
2 * Copyright (C) 2010 Eric Benard - eric@eukrea.com
3 *
4 * Based on pcm970-baseboard.c which is :
5 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 */
21
22#include <linux/types.h>
23#include <linux/init.h>
24
25#include <linux/gpio.h>
26#include <linux/interrupt.h>
27#include <linux/leds.h>
28#include <linux/platform_device.h>
29#include <linux/gpio_keys.h>
30#include <linux/input.h>
31#include <video/platform_lcd.h>
32#include <linux/i2c.h>
33
34#include <asm/mach-types.h>
35#include <asm/mach/arch.h>
36#include <asm/mach/time.h>
37#include <asm/mach/map.h>
38
39#include <mach/hardware.h>
40#include <mach/common.h>
41#include <mach/imx-uart.h>
42#include <mach/iomux-mx35.h>
43#include <mach/ipu.h>
44#include <mach/mx3fb.h>
45#include <mach/audmux.h>
46#include <mach/ssi.h>
47
48#include "devices-imx35.h"
49#include "devices.h"
50
51static const struct fb_videomode fb_modedb[] = {
52 {
53 .name = "CMO_QVGA",
54 .refresh = 60,
55 .xres = 320,
56 .yres = 240,
57 .pixclock = KHZ2PICOS(6500),
58 .left_margin = 68,
59 .right_margin = 20,
60 .upper_margin = 15,
61 .lower_margin = 4,
62 .hsync_len = 30,
63 .vsync_len = 3,
64 .sync = 0,
65 .vmode = FB_VMODE_NONINTERLACED,
66 .flag = 0,
67 },
68};
69
70static struct ipu_platform_data mx3_ipu_data = {
71 .irq_base = MXC_IPU_IRQ_START,
72};
73
74static struct mx3fb_platform_data mx3fb_pdata = {
75 .dma_dev = &mx3_ipu.dev,
76 .name = "CMO_QVGA",
77 .mode = fb_modedb,
78 .num_modes = ARRAY_SIZE(fb_modedb),
79};
80
81static struct pad_desc eukrea_mbimxsd_pads[] = {
82 /* LCD */
83 MX35_PAD_LD0__IPU_DISPB_DAT_0,
84 MX35_PAD_LD1__IPU_DISPB_DAT_1,
85 MX35_PAD_LD2__IPU_DISPB_DAT_2,
86 MX35_PAD_LD3__IPU_DISPB_DAT_3,
87 MX35_PAD_LD4__IPU_DISPB_DAT_4,
88 MX35_PAD_LD5__IPU_DISPB_DAT_5,
89 MX35_PAD_LD6__IPU_DISPB_DAT_6,
90 MX35_PAD_LD7__IPU_DISPB_DAT_7,
91 MX35_PAD_LD8__IPU_DISPB_DAT_8,
92 MX35_PAD_LD9__IPU_DISPB_DAT_9,
93 MX35_PAD_LD10__IPU_DISPB_DAT_10,
94 MX35_PAD_LD11__IPU_DISPB_DAT_11,
95 MX35_PAD_LD12__IPU_DISPB_DAT_12,
96 MX35_PAD_LD13__IPU_DISPB_DAT_13,
97 MX35_PAD_LD14__IPU_DISPB_DAT_14,
98 MX35_PAD_LD15__IPU_DISPB_DAT_15,
99 MX35_PAD_LD16__IPU_DISPB_DAT_16,
100 MX35_PAD_LD17__IPU_DISPB_DAT_17,
101 MX35_PAD_D3_HSYNC__IPU_DISPB_D3_HSYNC,
102 MX35_PAD_D3_FPSHIFT__IPU_DISPB_D3_CLK,
103 MX35_PAD_D3_DRDY__IPU_DISPB_D3_DRDY,
104 MX35_PAD_D3_VSYNC__IPU_DISPB_D3_VSYNC,
105 /* Backlight */
106 MX35_PAD_CONTRAST__IPU_DISPB_CONTR,
107 /* LCD_PWR */
108 MX35_PAD_D3_CLS__GPIO1_4,
109 /* LED */
110 MX35_PAD_LD23__GPIO3_29,
111 /* SWITCH */
112 MX35_PAD_LD19__GPIO3_25,
113 /* UART2 */
114 MX35_PAD_CTS2__UART2_CTS,
115 MX35_PAD_RTS2__UART2_RTS,
116 MX35_PAD_TXD2__UART2_TXD_MUX,
117 MX35_PAD_RXD2__UART2_RXD_MUX,
118 /* I2S */
119 MX35_PAD_STXFS4__AUDMUX_AUD4_TXFS,
120 MX35_PAD_STXD4__AUDMUX_AUD4_TXD,
121 MX35_PAD_SRXD4__AUDMUX_AUD4_RXD,
122 MX35_PAD_SCK4__AUDMUX_AUD4_TXC,
123};
124
125#define GPIO_LED1 (2 * 32 + 29)
126#define GPIO_SWITCH1 (2 * 32 + 25)
127#define GPIO_LCDPWR (4)
128
129static void eukrea_mbimxsd_lcd_power_set(struct plat_lcd_data *pd,
130 unsigned int power)
131{
132 if (power)
133 gpio_direction_output(GPIO_LCDPWR, 1);
134 else
135 gpio_direction_output(GPIO_LCDPWR, 0);
136}
137
138static struct plat_lcd_data eukrea_mbimxsd_lcd_power_data = {
139 .set_power = eukrea_mbimxsd_lcd_power_set,
140};
141
142static struct platform_device eukrea_mbimxsd_lcd_powerdev = {
143 .name = "platform-lcd",
144 .dev.platform_data = &eukrea_mbimxsd_lcd_power_data,
145};
146
147static struct gpio_led eukrea_mbimxsd_leds[] = {
148 {
149 .name = "led1",
150 .default_trigger = "heartbeat",
151 .active_low = 1,
152 .gpio = GPIO_LED1,
153 },
154};
155
156static struct gpio_led_platform_data eukrea_mbimxsd_led_info = {
157 .leds = eukrea_mbimxsd_leds,
158 .num_leds = ARRAY_SIZE(eukrea_mbimxsd_leds),
159};
160
161static struct platform_device eukrea_mbimxsd_leds_gpio = {
162 .name = "leds-gpio",
163 .id = -1,
164 .dev = {
165 .platform_data = &eukrea_mbimxsd_led_info,
166 },
167};
168
169static struct gpio_keys_button eukrea_mbimxsd_gpio_buttons[] = {
170 {
171 .gpio = GPIO_SWITCH1,
172 .code = BTN_0,
173 .desc = "BP1",
174 .active_low = 1,
175 .wakeup = 1,
176 },
177};
178
179static struct gpio_keys_platform_data eukrea_mbimxsd_button_data = {
180 .buttons = eukrea_mbimxsd_gpio_buttons,
181 .nbuttons = ARRAY_SIZE(eukrea_mbimxsd_gpio_buttons),
182};
183
184static struct platform_device eukrea_mbimxsd_button_device = {
185 .name = "gpio-keys",
186 .id = -1,
187 .num_resources = 0,
188 .dev = {
189 .platform_data = &eukrea_mbimxsd_button_data,
190 }
191};
192
193static struct platform_device *platform_devices[] __initdata = {
194 &eukrea_mbimxsd_leds_gpio,
195 &eukrea_mbimxsd_button_device,
196 &eukrea_mbimxsd_lcd_powerdev,
197};
198
199static const struct imxuart_platform_data uart_pdata __initconst = {
200 .flags = IMXUART_HAVE_RTSCTS,
201};
202
203static struct i2c_board_info eukrea_mbimxsd_i2c_devices[] = {
204 {
205 I2C_BOARD_INFO("tlv320aic23", 0x1a),
206 },
207};
208
209struct imx_ssi_platform_data eukrea_mbimxsd_ssi_pdata = {
210 .flags = IMX_SSI_SYN | IMX_SSI_NET | IMX_SSI_USE_I2S_SLAVE,
211};
212
213/*
214 * system init for baseboard usage. Will be called by cpuimx35 init.
215 *
216 * Add platform devices present on this baseboard and init
217 * them from CPU side as far as required to use them later on
218 */
219void __init eukrea_mbimxsd_baseboard_init(void)
220{
221 if (mxc_iomux_v3_setup_multiple_pads(eukrea_mbimxsd_pads,
222 ARRAY_SIZE(eukrea_mbimxsd_pads)))
223 printk(KERN_ERR "error setting mbimxsd pads !\n");
224
225#if defined(CONFIG_SND_SOC_EUKREA_TLV320)
226 /* SSI unit master I2S codec connected to SSI_AUD4 */
227 mxc_audmux_v2_configure_port(0,
228 MXC_AUDMUX_V2_PTCR_SYN |
229 MXC_AUDMUX_V2_PTCR_TFSDIR |
230 MXC_AUDMUX_V2_PTCR_TFSEL(3) |
231 MXC_AUDMUX_V2_PTCR_TCLKDIR |
232 MXC_AUDMUX_V2_PTCR_TCSEL(3),
233 MXC_AUDMUX_V2_PDCR_RXDSEL(3)
234 );
235 mxc_audmux_v2_configure_port(3,
236 MXC_AUDMUX_V2_PTCR_SYN,
237 MXC_AUDMUX_V2_PDCR_RXDSEL(0)
238 );
239#endif
240
241 imx35_add_imx_uart1(&uart_pdata);
242 mxc_register_device(&mx3_ipu, &mx3_ipu_data);
243 mxc_register_device(&mx3_fb, &mx3fb_pdata);
244
245 mxc_register_device(&imx_ssi_device0, &eukrea_mbimxsd_ssi_pdata);
246
247 gpio_request(GPIO_LED1, "LED1");
248 gpio_direction_output(GPIO_LED1, 1);
249 gpio_free(GPIO_LED1);
250
251 gpio_request(GPIO_SWITCH1, "SWITCH1");
252 gpio_direction_input(GPIO_SWITCH1);
253 gpio_free(GPIO_SWITCH1);
254
255 gpio_request(GPIO_LCDPWR, "LCDPWR");
256 gpio_direction_output(GPIO_LCDPWR, 1);
257 gpio_free(GPIO_SWITCH1);
258
259 i2c_register_board_info(0, eukrea_mbimxsd_i2c_devices,
260 ARRAY_SIZE(eukrea_mbimxsd_i2c_devices));
261
262 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
263}
diff --git a/arch/arm/mach-mx3/mach-armadillo5x0.c b/arch/arm/mach-mx3/mach-armadillo5x0.c
index 5f72ec91af2d..96aadcadb4ff 100644
--- a/arch/arm/mach-mx3/mach-armadillo5x0.c
+++ b/arch/arm/mach-mx3/mach-armadillo5x0.c
@@ -48,16 +48,14 @@
48#include <asm/mach/map.h> 48#include <asm/mach/map.h>
49 49
50#include <mach/common.h> 50#include <mach/common.h>
51#include <mach/imx-uart.h>
52#include <mach/iomux-mx3.h> 51#include <mach/iomux-mx3.h>
53#include <mach/board-armadillo5x0.h>
54#include <mach/mmc.h> 52#include <mach/mmc.h>
55#include <mach/ipu.h> 53#include <mach/ipu.h>
56#include <mach/mx3fb.h> 54#include <mach/mx3fb.h>
57#include <mach/mxc_nand.h>
58#include <mach/mxc_ehci.h> 55#include <mach/mxc_ehci.h>
59#include <mach/ulpi.h> 56#include <mach/ulpi.h>
60 57
58#include "devices-imx31.h"
61#include "devices.h" 59#include "devices.h"
62#include "crm_regs.h" 60#include "crm_regs.h"
63 61
@@ -301,7 +299,8 @@ static struct platform_device armadillo5x0_button_device = {
301/* 299/*
302 * NAND Flash 300 * NAND Flash
303 */ 301 */
304static struct mxc_nand_platform_data armadillo5x0_nand_flash_pdata = { 302static const struct mxc_nand_platform_data
303armadillo5x0_nand_board_info __initconst = {
305 .width = 1, 304 .width = 1,
306 .hw_ecc = 1, 305 .hw_ecc = 1,
307}; 306};
@@ -493,13 +492,12 @@ static struct platform_device armadillo5x0_smc911x_device = {
493}; 492};
494 493
495/* UART device data */ 494/* UART device data */
496static struct imxuart_platform_data uart_pdata = { 495static const struct imxuart_platform_data uart_pdata __initconst = {
497 .flags = IMXUART_HAVE_RTSCTS, 496 .flags = IMXUART_HAVE_RTSCTS,
498}; 497};
499 498
500static struct platform_device *devices[] __initdata = { 499static struct platform_device *devices[] __initdata = {
501 &armadillo5x0_smc911x_device, 500 &armadillo5x0_smc911x_device,
502 &mxc_i2c_device1,
503 &armadillo5x0_button_device, 501 &armadillo5x0_button_device,
504}; 502};
505 503
@@ -512,10 +510,11 @@ static void __init armadillo5x0_init(void)
512 ARRAY_SIZE(armadillo5x0_pins), "armadillo5x0"); 510 ARRAY_SIZE(armadillo5x0_pins), "armadillo5x0");
513 511
514 platform_add_devices(devices, ARRAY_SIZE(devices)); 512 platform_add_devices(devices, ARRAY_SIZE(devices));
513 imx31_add_imx_i2c1(NULL);
515 514
516 /* Register UART */ 515 /* Register UART */
517 mxc_register_device(&mxc_uart_device0, &uart_pdata); 516 imx31_add_imx_uart0(&uart_pdata);
518 mxc_register_device(&mxc_uart_device1, &uart_pdata); 517 imx31_add_imx_uart1(&uart_pdata);
519 518
520 /* SMSC9118 IRQ pin */ 519 /* SMSC9118 IRQ pin */
521 gpio_direction_input(MX31_PIN_GPIO1_0); 520 gpio_direction_input(MX31_PIN_GPIO1_0);
@@ -532,7 +531,7 @@ static void __init armadillo5x0_init(void)
532 &armadillo5x0_nor_flash_pdata); 531 &armadillo5x0_nor_flash_pdata);
533 532
534 /* Register NAND Flash */ 533 /* Register NAND Flash */
535 mxc_register_device(&mxc_nand_device, &armadillo5x0_nand_flash_pdata); 534 imx31_add_mxc_nand(&armadillo5x0_nand_board_info);
536 535
537 /* set NAND page size to 2k if not configured via boot mode pins */ 536 /* set NAND page size to 2k if not configured via boot mode pins */
538 __raw_writel(__raw_readl(MXC_CCM_RCSR) | (1 << 30), MXC_CCM_RCSR); 537 __raw_writel(__raw_readl(MXC_CCM_RCSR) | (1 << 30), MXC_CCM_RCSR);
diff --git a/arch/arm/mach-mx3/mach-cpuimx35.c b/arch/arm/mach-mx3/mach-cpuimx35.c
new file mode 100644
index 000000000000..63f970f340a2
--- /dev/null
+++ b/arch/arm/mach-mx3/mach-cpuimx35.c
@@ -0,0 +1,227 @@
1/*
2 * Copyright (C) 2010 Eric Benard - eric@eukrea.com
3 * Copyright (C) 2009 Sascha Hauer, Pengutronix
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19
20#include <linux/types.h>
21#include <linux/init.h>
22
23#include <linux/platform_device.h>
24#include <linux/mtd/physmap.h>
25#include <linux/memory.h>
26#include <linux/gpio.h>
27#include <linux/interrupt.h>
28#include <linux/delay.h>
29#include <linux/i2c.h>
30#include <linux/i2c/tsc2007.h>
31#include <linux/usb/otg.h>
32#include <linux/usb/ulpi.h>
33#include <linux/fsl_devices.h>
34
35#include <asm/mach-types.h>
36#include <asm/mach/arch.h>
37#include <asm/mach/time.h>
38#include <asm/mach/map.h>
39
40#include <mach/eukrea-baseboards.h>
41#include <mach/hardware.h>
42#include <mach/common.h>
43#include <mach/iomux-mx35.h>
44#include <mach/mxc_nand.h>
45#include <mach/mxc_ehci.h>
46#include <mach/ulpi.h>
47
48#include "devices-imx35.h"
49#include "devices.h"
50
51static const struct imxuart_platform_data uart_pdata __initconst = {
52 .flags = IMXUART_HAVE_RTSCTS,
53};
54
55static const struct imxi2c_platform_data
56eukrea_cpuimx35_i2c0_data __initconst = {
57 .bitrate = 50000,
58};
59
60#define TSC2007_IRQGPIO (2 * 32 + 2)
61static int ts_get_pendown_state(void)
62{
63 int val = 0;
64 gpio_free(TSC2007_IRQGPIO);
65 gpio_request(TSC2007_IRQGPIO, NULL);
66 gpio_direction_input(TSC2007_IRQGPIO);
67
68 val = gpio_get_value(TSC2007_IRQGPIO);
69
70 gpio_free(TSC2007_IRQGPIO);
71 gpio_request(TSC2007_IRQGPIO, NULL);
72
73 return val ? 0 : 1;
74}
75
76static int ts_init(void)
77{
78 gpio_request(TSC2007_IRQGPIO, NULL);
79 return 0;
80}
81
82static struct tsc2007_platform_data tsc2007_info = {
83 .model = 2007,
84 .x_plate_ohms = 180,
85 .get_pendown_state = ts_get_pendown_state,
86 .init_platform_hw = ts_init,
87};
88
89static struct i2c_board_info eukrea_cpuimx35_i2c_devices[] = {
90 {
91 I2C_BOARD_INFO("pcf8563", 0x51),
92 }, {
93 I2C_BOARD_INFO("tsc2007", 0x48),
94 .type = "tsc2007",
95 .platform_data = &tsc2007_info,
96 .irq = gpio_to_irq(TSC2007_IRQGPIO),
97 },
98};
99
100static struct platform_device *devices[] __initdata = {
101 &mxc_fec_device,
102 &imx_wdt_device0,
103};
104
105static struct pad_desc eukrea_cpuimx35_pads[] = {
106 /* UART1 */
107 MX35_PAD_CTS1__UART1_CTS,
108 MX35_PAD_RTS1__UART1_RTS,
109 MX35_PAD_TXD1__UART1_TXD_MUX,
110 MX35_PAD_RXD1__UART1_RXD_MUX,
111 /* FEC */
112 MX35_PAD_FEC_TX_CLK__FEC_TX_CLK,
113 MX35_PAD_FEC_RX_CLK__FEC_RX_CLK,
114 MX35_PAD_FEC_RX_DV__FEC_RX_DV,
115 MX35_PAD_FEC_COL__FEC_COL,
116 MX35_PAD_FEC_RDATA0__FEC_RDATA_0,
117 MX35_PAD_FEC_TDATA0__FEC_TDATA_0,
118 MX35_PAD_FEC_TX_EN__FEC_TX_EN,
119 MX35_PAD_FEC_MDC__FEC_MDC,
120 MX35_PAD_FEC_MDIO__FEC_MDIO,
121 MX35_PAD_FEC_TX_ERR__FEC_TX_ERR,
122 MX35_PAD_FEC_RX_ERR__FEC_RX_ERR,
123 MX35_PAD_FEC_CRS__FEC_CRS,
124 MX35_PAD_FEC_RDATA1__FEC_RDATA_1,
125 MX35_PAD_FEC_TDATA1__FEC_TDATA_1,
126 MX35_PAD_FEC_RDATA2__FEC_RDATA_2,
127 MX35_PAD_FEC_TDATA2__FEC_TDATA_2,
128 MX35_PAD_FEC_RDATA3__FEC_RDATA_3,
129 MX35_PAD_FEC_TDATA3__FEC_TDATA_3,
130 /* I2C1 */
131 MX35_PAD_I2C1_CLK__I2C1_SCL,
132 MX35_PAD_I2C1_DAT__I2C1_SDA,
133 /* TSC2007 IRQ */
134 MX35_PAD_ATA_DA2__GPIO3_2,
135};
136
137static const struct mxc_nand_platform_data
138eukrea_cpuimx35_nand_board_info __initconst = {
139 .width = 1,
140 .hw_ecc = 1,
141 .flash_bbt = 1,
142};
143
144static struct mxc_usbh_platform_data otg_pdata = {
145 .portsc = MXC_EHCI_MODE_UTMI,
146 .flags = MXC_EHCI_INTERFACE_DIFF_UNI,
147};
148
149static struct mxc_usbh_platform_data usbh1_pdata = {
150 .portsc = MXC_EHCI_MODE_SERIAL,
151 .flags = MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY |
152 MXC_EHCI_IPPUE_DOWN,
153};
154
155static struct fsl_usb2_platform_data otg_device_pdata = {
156 .operating_mode = FSL_USB2_DR_DEVICE,
157 .phy_mode = FSL_USB2_PHY_UTMI,
158};
159
160static int otg_mode_host;
161
162static int __init eukrea_cpuimx35_otg_mode(char *options)
163{
164 if (!strcmp(options, "host"))
165 otg_mode_host = 1;
166 else if (!strcmp(options, "device"))
167 otg_mode_host = 0;
168 else
169 pr_info("otg_mode neither \"host\" nor \"device\". "
170 "Defaulting to device\n");
171 return 0;
172}
173__setup("otg_mode=", eukrea_cpuimx35_otg_mode);
174
175/*
176 * Board specific initialization.
177 */
178static void __init mxc_board_init(void)
179{
180 mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx35_pads,
181 ARRAY_SIZE(eukrea_cpuimx35_pads));
182
183 platform_add_devices(devices, ARRAY_SIZE(devices));
184
185 imx35_add_imx_uart0(&uart_pdata);
186 imx35_add_mxc_nand(&eukrea_cpuimx35_nand_board_info);
187
188 i2c_register_board_info(0, eukrea_cpuimx35_i2c_devices,
189 ARRAY_SIZE(eukrea_cpuimx35_i2c_devices));
190 imx35_add_imx_i2c0(&eukrea_cpuimx35_i2c0_data);
191
192#if defined(CONFIG_USB_ULPI)
193 if (otg_mode_host) {
194 otg_pdata.otg = otg_ulpi_create(&mxc_ulpi_access_ops,
195 USB_OTG_DRV_VBUS | USB_OTG_DRV_VBUS_EXT);
196
197 mxc_register_device(&mxc_otg_host, &otg_pdata);
198 }
199 mxc_register_device(&mxc_usbh1, &usbh1_pdata);
200#endif
201 if (!otg_mode_host)
202 mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata);
203
204#ifdef CONFIG_MACH_EUKREA_MBIMXSD_BASEBOARD
205 eukrea_mbimxsd_baseboard_init();
206#endif
207}
208
209static void __init eukrea_cpuimx35_timer_init(void)
210{
211 mx35_clocks_init();
212}
213
214struct sys_timer eukrea_cpuimx35_timer = {
215 .init = eukrea_cpuimx35_timer_init,
216};
217
218MACHINE_START(EUKREA_CPUIMX35, "Eukrea CPUIMX35")
219 /* Maintainer: Eukrea Electromatique */
220 .phys_io = MX35_AIPS1_BASE_ADDR,
221 .io_pg_offst = ((MX35_AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
222 .boot_params = MX3x_PHYS_OFFSET + 0x100,
223 .map_io = mx35_map_io,
224 .init_irq = mx35_init_irq,
225 .init_machine = mxc_board_init,
226 .timer = &eukrea_cpuimx35_timer,
227MACHINE_END
diff --git a/arch/arm/mach-mx3/mach-kzm_arm11_01.c b/arch/arm/mach-mx3/mach-kzm_arm11_01.c
index f085d5d1a6de..5b23e416d6c7 100644
--- a/arch/arm/mach-mx3/mach-kzm_arm11_01.c
+++ b/arch/arm/mach-mx3/mach-kzm_arm11_01.c
@@ -16,10 +16,6 @@
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details. 18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */ 19 */
24 20
25#include <linux/gpio.h> 21#include <linux/gpio.h>
@@ -37,13 +33,12 @@
37#include <asm/mach/map.h> 33#include <asm/mach/map.h>
38#include <asm/mach/time.h> 34#include <asm/mach/time.h>
39 35
40#include <mach/board-kzmarm11.h>
41#include <mach/clock.h> 36#include <mach/clock.h>
42#include <mach/common.h> 37#include <mach/common.h>
43#include <mach/imx-uart.h>
44#include <mach/iomux-mx3.h> 38#include <mach/iomux-mx3.h>
45#include <mach/memory.h> 39#include <mach/memory.h>
46 40
41#include "devices-imx31.h"
47#include "devices.h" 42#include "devices.h"
48 43
49#define KZM_ARM11_IO_ADDRESS(x) ( \ 44#define KZM_ARM11_IO_ADDRESS(x) ( \
@@ -51,6 +46,23 @@
51 IMX_IO_ADDRESS(x, MX31_CS5) ?: \ 46 IMX_IO_ADDRESS(x, MX31_CS5) ?: \
52 MX31_IO_ADDRESS(x)) 47 MX31_IO_ADDRESS(x))
53 48
49/*
50 * KZM-ARM11-01 Board Control Registers on FPGA
51 */
52#define KZM_ARM11_CTL1 (MX31_CS4_BASE_ADDR + 0x1000)
53#define KZM_ARM11_CTL2 (MX31_CS4_BASE_ADDR + 0x1001)
54#define KZM_ARM11_RSW1 (MX31_CS4_BASE_ADDR + 0x1002)
55#define KZM_ARM11_BACK_LIGHT (MX31_CS4_BASE_ADDR + 0x1004)
56#define KZM_ARM11_FPGA_REV (MX31_CS4_BASE_ADDR + 0x1008)
57#define KZM_ARM11_7SEG_LED (MX31_CS4_BASE_ADDR + 0x1010)
58#define KZM_ARM11_LEDS (MX31_CS4_BASE_ADDR + 0x1020)
59#define KZM_ARM11_DIPSW2 (MX31_CS4_BASE_ADDR + 0x1003)
60
61/*
62 * External UART for touch panel on FPGA
63 */
64#define KZM_ARM11_16550 (MX31_CS4_BASE_ADDR + 0x1050)
65
54#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE) 66#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
55/* 67/*
56 * KZM-ARM11-01 has an external UART on FPGA 68 * KZM-ARM11-01 has an external UART on FPGA
@@ -173,15 +185,14 @@ static inline int kzm_init_smsc9118(void)
173#endif 185#endif
174 186
175#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE) 187#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE)
176static struct imxuart_platform_data uart_pdata = { 188static const struct imxuart_platform_data uart_pdata __initconst = {
177 .flags = IMXUART_HAVE_RTSCTS, 189 .flags = IMXUART_HAVE_RTSCTS,
178}; 190};
179 191
180static void __init kzm_init_imx_uart(void) 192static void __init kzm_init_imx_uart(void)
181{ 193{
182 mxc_register_device(&mxc_uart_device0, &uart_pdata); 194 imx31_add_imx_uart0(&uart_pdata);
183 195 imx31_add_imx_uart1(&uart_pdata);
184 mxc_register_device(&mxc_uart_device1, &uart_pdata);
185} 196}
186#else 197#else
187static inline void kzm_init_imx_uart(void) 198static inline void kzm_init_imx_uart(void)
diff --git a/arch/arm/mach-mx3/mach-mx31_3ds.c b/arch/arm/mach-mx3/mach-mx31_3ds.c
index 58e57291b79d..6fe69e124d30 100644
--- a/arch/arm/mach-mx3/mach-mx31_3ds.c
+++ b/arch/arm/mach-mx3/mach-mx31_3ds.c
@@ -10,10 +10,6 @@
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
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 *
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 */ 13 */
18 14
19#include <linux/delay.h> 15#include <linux/delay.h>
@@ -22,7 +18,6 @@
22#include <linux/clk.h> 18#include <linux/clk.h>
23#include <linux/irq.h> 19#include <linux/irq.h>
24#include <linux/gpio.h> 20#include <linux/gpio.h>
25#include <linux/smsc911x.h>
26#include <linux/platform_device.h> 21#include <linux/platform_device.h>
27#include <linux/mfd/mc13783.h> 22#include <linux/mfd/mc13783.h>
28#include <linux/spi/spi.h> 23#include <linux/spi/spi.h>
@@ -37,19 +32,47 @@
37#include <asm/memory.h> 32#include <asm/memory.h>
38#include <asm/mach/map.h> 33#include <asm/mach/map.h>
39#include <mach/common.h> 34#include <mach/common.h>
40#include <mach/board-mx31_3ds.h>
41#include <mach/imx-uart.h>
42#include <mach/iomux-mx3.h> 35#include <mach/iomux-mx3.h>
43#include <mach/mxc_nand.h> 36#include <mach/3ds_debugboard.h>
44#include <mach/spi.h> 37
38#include "devices-imx31.h"
45#include "devices.h" 39#include "devices.h"
46 40
47/*! 41/* Definitions for components on the Debug board */
48 * @file mx31_3ds.c 42
49 * 43/* Base address of CPLD controller on the Debug board */
50 * @brief This file contains the board-specific initialization routines. 44#define DEBUG_BASE_ADDRESS CS5_IO_ADDRESS(MX3x_CS5_BASE_ADDR)
51 * 45
52 * @ingroup System 46/* LAN9217 ethernet base address */
47#define LAN9217_BASE_ADDR MX3x_CS5_BASE_ADDR
48
49/* CPLD config and interrupt base address */
50#define CPLD_ADDR (DEBUG_BASE_ADDRESS + 0x20000)
51
52/* status, interrupt */
53#define CPLD_INT_STATUS_REG (CPLD_ADDR + 0x10)
54#define CPLD_INT_MASK_REG (CPLD_ADDR + 0x38)
55#define CPLD_INT_RESET_REG (CPLD_ADDR + 0x20)
56/* magic word for debug CPLD */
57#define CPLD_MAGIC_NUMBER1_REG (CPLD_ADDR + 0x40)
58#define CPLD_MAGIC_NUMBER2_REG (CPLD_ADDR + 0x48)
59/* CPLD code version */
60#define CPLD_CODE_VER_REG (CPLD_ADDR + 0x50)
61/* magic word for debug CPLD */
62#define CPLD_MAGIC_NUMBER3_REG (CPLD_ADDR + 0x58)
63
64/* CPLD IRQ line for external uart, external ethernet etc */
65#define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_1)
66
67#define MXC_EXP_IO_BASE (MXC_BOARD_IRQ_START)
68#define MXC_IRQ_TO_EXPIO(irq) ((irq) - MXC_EXP_IO_BASE)
69
70#define EXPIO_INT_ENET (MXC_EXP_IO_BASE + 0)
71
72#define MXC_MAX_EXP_IO_LINES 16
73
74/*
75 * This file contains the board-specific initialization routines.
53 */ 76 */
54 77
55static int mx31_3ds_pins[] = { 78static int mx31_3ds_pins[] = {
@@ -145,7 +168,7 @@ static int spi1_internal_chipselect[] = {
145 MXC_SPI_CS(2), 168 MXC_SPI_CS(2),
146}; 169};
147 170
148static struct spi_imx_master spi1_pdata = { 171static const struct spi_imx_master spi1_pdata __initconst = {
149 .chipselect = spi1_internal_chipselect, 172 .chipselect = spi1_internal_chipselect,
150 .num_chipselect = ARRAY_SIZE(spi1_internal_chipselect), 173 .num_chipselect = ARRAY_SIZE(spi1_internal_chipselect),
151}; 174};
@@ -165,7 +188,8 @@ static struct spi_board_info mx31_3ds_spi_devs[] __initdata = {
165/* 188/*
166 * NAND Flash 189 * NAND Flash
167 */ 190 */
168static struct mxc_nand_platform_data imx31_3ds_nand_flash_pdata = { 191static const struct mxc_nand_platform_data
192mx31_3ds_nand_board_info __initconst = {
169 .width = 1, 193 .width = 1,
170 .hw_ecc = 1, 194 .hw_ecc = 1,
171#ifdef MACH_MX31_3DS_MXC_NAND_USE_BBT 195#ifdef MACH_MX31_3DS_MXC_NAND_USE_BBT
@@ -182,8 +206,10 @@ static struct mxc_nand_platform_data imx31_3ds_nand_flash_pdata = {
182 206
183#define USBOTG_RST_B IOMUX_TO_GPIO(MX31_PIN_USB_PWR) 207#define USBOTG_RST_B IOMUX_TO_GPIO(MX31_PIN_USB_PWR)
184 208
185static void mx31_3ds_usbotg_init(void) 209static int mx31_3ds_usbotg_init(void)
186{ 210{
211 int err;
212
187 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG); 213 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA0, USB_PAD_CFG);
188 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG); 214 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA1, USB_PAD_CFG);
189 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG); 215 mxc_iomux_set_pad(MX31_PIN_USBOTG_DATA2, USB_PAD_CFG);
@@ -197,10 +223,25 @@ static void mx31_3ds_usbotg_init(void)
197 mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG); 223 mxc_iomux_set_pad(MX31_PIN_USBOTG_NXT, USB_PAD_CFG);
198 mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG); 224 mxc_iomux_set_pad(MX31_PIN_USBOTG_STP, USB_PAD_CFG);
199 225
200 gpio_request(USBOTG_RST_B, "otgusb-reset"); 226 err = gpio_request(USBOTG_RST_B, "otgusb-reset");
201 gpio_direction_output(USBOTG_RST_B, 0); 227 if (err) {
228 pr_err("Failed to request the USB OTG reset gpio\n");
229 return err;
230 }
231
232 err = gpio_direction_output(USBOTG_RST_B, 0);
233 if (err) {
234 pr_err("Failed to drive the USB OTG reset gpio\n");
235 goto usbotg_free_reset;
236 }
237
202 mdelay(1); 238 mdelay(1);
203 gpio_set_value(USBOTG_RST_B, 1); 239 gpio_set_value(USBOTG_RST_B, 1);
240 return 0;
241
242usbotg_free_reset:
243 gpio_free(USBOTG_RST_B);
244 return err;
204} 245}
205 246
206static struct fsl_usb2_platform_data usbotg_pdata = { 247static struct fsl_usb2_platform_data usbotg_pdata = {
@@ -208,178 +249,16 @@ static struct fsl_usb2_platform_data usbotg_pdata = {
208 .phy_mode = FSL_USB2_PHY_ULPI, 249 .phy_mode = FSL_USB2_PHY_ULPI,
209}; 250};
210 251
211static struct imxuart_platform_data uart_pdata = { 252static const struct imxuart_platform_data uart_pdata __initconst = {
212 .flags = IMXUART_HAVE_RTSCTS, 253 .flags = IMXUART_HAVE_RTSCTS,
213}; 254};
214 255
215/* 256/*
216 * Support for the SMSC9217 on the Debug board.
217 */
218
219static struct smsc911x_platform_config smsc911x_config = {
220 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
221 .irq_type = SMSC911X_IRQ_TYPE_PUSH_PULL,
222 .flags = SMSC911X_USE_16BIT | SMSC911X_FORCE_INTERNAL_PHY,
223 .phy_interface = PHY_INTERFACE_MODE_MII,
224};
225
226static struct resource smsc911x_resources[] = {
227 {
228 .start = LAN9217_BASE_ADDR,
229 .end = LAN9217_BASE_ADDR + 0xff,
230 .flags = IORESOURCE_MEM,
231 }, {
232 .start = EXPIO_INT_ENET,
233 .end = EXPIO_INT_ENET,
234 .flags = IORESOURCE_IRQ,
235 },
236};
237
238static struct platform_device smsc911x_device = {
239 .name = "smsc911x",
240 .id = -1,
241 .num_resources = ARRAY_SIZE(smsc911x_resources),
242 .resource = smsc911x_resources,
243 .dev = {
244 .platform_data = &smsc911x_config,
245 },
246};
247
248/*
249 * Routines for the CPLD on the debug board. It contains a CPLD handling
250 * LEDs, switches, interrupts for Ethernet.
251 */
252
253static void mx31_3ds_expio_irq_handler(uint32_t irq, struct irq_desc *desc)
254{
255 uint32_t imr_val;
256 uint32_t int_valid;
257 uint32_t expio_irq;
258
259 imr_val = __raw_readw(CPLD_INT_MASK_REG);
260 int_valid = __raw_readw(CPLD_INT_STATUS_REG) & ~imr_val;
261
262 expio_irq = MXC_EXP_IO_BASE;
263 for (; int_valid != 0; int_valid >>= 1, expio_irq++) {
264 if ((int_valid & 1) == 0)
265 continue;
266 generic_handle_irq(expio_irq);
267 }
268}
269
270/*
271 * Disable an expio pin's interrupt by setting the bit in the imr.
272 * @param irq an expio virtual irq number
273 */
274static void expio_mask_irq(uint32_t irq)
275{
276 uint16_t reg;
277 uint32_t expio = MXC_IRQ_TO_EXPIO(irq);
278
279 /* mask the interrupt */
280 reg = __raw_readw(CPLD_INT_MASK_REG);
281 reg |= 1 << expio;
282 __raw_writew(reg, CPLD_INT_MASK_REG);
283}
284
285/*
286 * Acknowledge an expanded io pin's interrupt by clearing the bit in the isr.
287 * @param irq an expanded io virtual irq number
288 */
289static void expio_ack_irq(uint32_t irq)
290{
291 uint32_t expio = MXC_IRQ_TO_EXPIO(irq);
292
293 /* clear the interrupt status */
294 __raw_writew(1 << expio, CPLD_INT_RESET_REG);
295 __raw_writew(0, CPLD_INT_RESET_REG);
296 /* mask the interrupt */
297 expio_mask_irq(irq);
298}
299
300/*
301 * Enable a expio pin's interrupt by clearing the bit in the imr.
302 * @param irq a expio virtual irq number
303 */
304static void expio_unmask_irq(uint32_t irq)
305{
306 uint16_t reg;
307 uint32_t expio = MXC_IRQ_TO_EXPIO(irq);
308
309 /* unmask the interrupt */
310 reg = __raw_readw(CPLD_INT_MASK_REG);
311 reg &= ~(1 << expio);
312 __raw_writew(reg, CPLD_INT_MASK_REG);
313}
314
315static struct irq_chip expio_irq_chip = {
316 .ack = expio_ack_irq,
317 .mask = expio_mask_irq,
318 .unmask = expio_unmask_irq,
319};
320
321static int __init mx31_3ds_init_expio(void)
322{
323 int i;
324 int ret;
325
326 /* Check if there's a debug board connected */
327 if ((__raw_readw(CPLD_MAGIC_NUMBER1_REG) != 0xAAAA) ||
328 (__raw_readw(CPLD_MAGIC_NUMBER2_REG) != 0x5555) ||
329 (__raw_readw(CPLD_MAGIC_NUMBER3_REG) != 0xCAFE)) {
330 /* No Debug board found */
331 return -ENODEV;
332 }
333
334 pr_info("i.MX31 3DS Debug board detected, rev = 0x%04X\n",
335 __raw_readw(CPLD_CODE_VER_REG));
336
337 /*
338 * Configure INT line as GPIO input
339 */
340 ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1), "sms9217-irq");
341 if (ret)
342 pr_warning("could not get LAN irq gpio\n");
343 else
344 gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_1));
345
346 /* Disable the interrupts and clear the status */
347 __raw_writew(0, CPLD_INT_MASK_REG);
348 __raw_writew(0xFFFF, CPLD_INT_RESET_REG);
349 __raw_writew(0, CPLD_INT_RESET_REG);
350 __raw_writew(0x1F, CPLD_INT_MASK_REG);
351 for (i = MXC_EXP_IO_BASE;
352 i < (MXC_EXP_IO_BASE + MXC_MAX_EXP_IO_LINES);
353 i++) {
354 set_irq_chip(i, &expio_irq_chip);
355 set_irq_handler(i, handle_level_irq);
356 set_irq_flags(i, IRQF_VALID);
357 }
358 set_irq_type(EXPIO_PARENT_INT, IRQ_TYPE_LEVEL_LOW);
359 set_irq_chained_handler(EXPIO_PARENT_INT, mx31_3ds_expio_irq_handler);
360
361 return 0;
362}
363
364/*
365 * This structure defines the MX31 memory map.
366 */
367static struct map_desc mx31_3ds_io_desc[] __initdata = {
368 {
369 .virtual = MX31_CS5_BASE_ADDR_VIRT,
370 .pfn = __phys_to_pfn(MX31_CS5_BASE_ADDR),
371 .length = MX31_CS5_SIZE,
372 .type = MT_DEVICE,
373 },
374};
375
376/*
377 * Set up static virtual mappings. 257 * Set up static virtual mappings.
378 */ 258 */
379static void __init mx31_3ds_map_io(void) 259static void __init mx31_3ds_map_io(void)
380{ 260{
381 mx31_map_io(); 261 mx31_map_io();
382 iotable_init(mx31_3ds_io_desc, ARRAY_SIZE(mx31_3ds_io_desc));
383} 262}
384 263
385/*! 264/*!
@@ -390,10 +269,10 @@ static void __init mxc_board_init(void)
390 mxc_iomux_setup_multiple_pins(mx31_3ds_pins, ARRAY_SIZE(mx31_3ds_pins), 269 mxc_iomux_setup_multiple_pins(mx31_3ds_pins, ARRAY_SIZE(mx31_3ds_pins),
391 "mx31_3ds"); 270 "mx31_3ds");
392 271
393 mxc_register_device(&mxc_uart_device0, &uart_pdata); 272 imx31_add_imx_uart0(&uart_pdata);
394 mxc_register_device(&mxc_nand_device, &imx31_3ds_nand_flash_pdata); 273 imx31_add_mxc_nand(&mx31_3ds_nand_board_info);
395 274
396 mxc_register_device(&mxc_spi_device1, &spi1_pdata); 275 imx31_add_spi_imx0(&spi1_pdata);
397 spi_register_board_info(mx31_3ds_spi_devs, 276 spi_register_board_info(mx31_3ds_spi_devs,
398 ARRAY_SIZE(mx31_3ds_spi_devs)); 277 ARRAY_SIZE(mx31_3ds_spi_devs));
399 278
@@ -402,8 +281,9 @@ static void __init mxc_board_init(void)
402 mx31_3ds_usbotg_init(); 281 mx31_3ds_usbotg_init();
403 mxc_register_device(&mxc_otg_udc_device, &usbotg_pdata); 282 mxc_register_device(&mxc_otg_udc_device, &usbotg_pdata);
404 283
405 if (!mx31_3ds_init_expio()) 284 if (!mxc_expio_init(CS5_BASE_ADDR, EXPIO_PARENT_INT))
406 platform_device_register(&smsc911x_device); 285 printk(KERN_WARNING "Init of the debugboard failed, all "
286 "devices on the board are unusable.\n");
407} 287}
408 288
409static void __init mx31_3ds_timer_init(void) 289static void __init mx31_3ds_timer_init(void)
diff --git a/arch/arm/mach-mx3/mach-mx31ads.c b/arch/arm/mach-mx3/mach-mx31ads.c
index b3d1a1895c20..94b3e7c42404 100644
--- a/arch/arm/mach-mx3/mach-mx31ads.c
+++ b/arch/arm/mach-mx3/mach-mx31ads.c
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
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 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 15 */
20 16
21#include <linux/types.h> 17#include <linux/types.h>
@@ -33,8 +29,6 @@
33#include <asm/memory.h> 29#include <asm/memory.h>
34#include <asm/mach/map.h> 30#include <asm/mach/map.h>
35#include <mach/common.h> 31#include <mach/common.h>
36#include <mach/board-mx31ads.h>
37#include <mach/imx-uart.h>
38#include <mach/iomux-mx3.h> 32#include <mach/iomux-mx3.h>
39 33
40#ifdef CONFIG_MACH_MX31ADS_WM1133_EV1 34#ifdef CONFIG_MACH_MX31ADS_WM1133_EV1
@@ -43,14 +37,45 @@
43#include <linux/mfd/wm8350/pmic.h> 37#include <linux/mfd/wm8350/pmic.h>
44#endif 38#endif
45 39
40#include "devices-imx31.h"
46#include "devices.h" 41#include "devices.h"
47 42
48/*! 43/* Base address of PBC controller */
49 * @file mx31ads.c 44#define PBC_BASE_ADDRESS MX31_CS4_BASE_ADDR_VIRT
50 * 45/* Offsets for the PBC Controller register */
51 * @brief This file contains the board-specific initialization routines. 46
52 * 47/* PBC Board interrupt status register */
53 * @ingroup System 48#define PBC_INTSTATUS 0x000016
49
50/* PBC Board interrupt current status register */
51#define PBC_INTCURR_STATUS 0x000018
52
53/* PBC Interrupt mask register set address */
54#define PBC_INTMASK_SET 0x00001A
55
56/* PBC Interrupt mask register clear address */
57#define PBC_INTMASK_CLEAR 0x00001C
58
59/* External UART A */
60#define PBC_SC16C652_UARTA 0x010000
61
62/* External UART B */
63#define PBC_SC16C652_UARTB 0x010010
64
65#define PBC_INTSTATUS_REG (PBC_INTSTATUS + PBC_BASE_ADDRESS)
66#define PBC_INTMASK_SET_REG (PBC_INTMASK_SET + PBC_BASE_ADDRESS)
67#define PBC_INTMASK_CLEAR_REG (PBC_INTMASK_CLEAR + PBC_BASE_ADDRESS)
68#define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_4)
69
70#define MXC_EXP_IO_BASE (MXC_BOARD_IRQ_START)
71#define MXC_IRQ_TO_EXPIO(irq) ((irq) - MXC_EXP_IO_BASE)
72
73#define EXPIO_INT_XUART_INTA (MXC_EXP_IO_BASE + 10)
74#define EXPIO_INT_XUART_INTB (MXC_EXP_IO_BASE + 11)
75
76#define MXC_MAX_EXP_IO_LINES 16
77/*
78 * This file contains the board-specific initialization routines.
54 */ 79 */
55 80
56#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE) 81#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
@@ -98,7 +123,7 @@ static inline int mxc_init_extuart(void)
98#endif 123#endif
99 124
100#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE) 125#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE)
101static struct imxuart_platform_data uart_pdata = { 126static const struct imxuart_platform_data uart_pdata __initconst = {
102 .flags = IMXUART_HAVE_RTSCTS, 127 .flags = IMXUART_HAVE_RTSCTS,
103}; 128};
104 129
@@ -112,7 +137,7 @@ static unsigned int uart_pins[] = {
112static inline void mxc_init_imx_uart(void) 137static inline void mxc_init_imx_uart(void)
113{ 138{
114 mxc_iomux_setup_multiple_pins(uart_pins, ARRAY_SIZE(uart_pins), "uart-0"); 139 mxc_iomux_setup_multiple_pins(uart_pins, ARRAY_SIZE(uart_pins), "uart-0");
115 mxc_register_device(&mxc_uart_device0, &uart_pdata); 140 imx31_add_imx_uart0(&uart_pdata);
116} 141}
117#else /* !SERIAL_IMX */ 142#else /* !SERIAL_IMX */
118static inline void mxc_init_imx_uart(void) 143static inline void mxc_init_imx_uart(void)
@@ -475,7 +500,7 @@ static void mxc_init_i2c(void)
475 mxc_iomux_mode(IOMUX_MODE(MX31_PIN_CSPI2_MOSI, IOMUX_CONFIG_ALT1)); 500 mxc_iomux_mode(IOMUX_MODE(MX31_PIN_CSPI2_MOSI, IOMUX_CONFIG_ALT1));
476 mxc_iomux_mode(IOMUX_MODE(MX31_PIN_CSPI2_MISO, IOMUX_CONFIG_ALT1)); 501 mxc_iomux_mode(IOMUX_MODE(MX31_PIN_CSPI2_MISO, IOMUX_CONFIG_ALT1));
477 502
478 mxc_register_device(&mxc_i2c_device1, NULL); 503 imx31_add_imx_i2c1(NULL);
479} 504}
480#else 505#else
481static void mxc_init_i2c(void) 506static void mxc_init_i2c(void)
diff --git a/arch/arm/mach-mx3/mach-mx31lilly.c b/arch/arm/mach-mx3/mach-mx31lilly.c
index b2c7f512070f..8f66f65e80e2 100644
--- a/arch/arm/mach-mx3/mach-mx31lilly.c
+++ b/arch/arm/mach-mx3/mach-mx31lilly.c
@@ -18,10 +18,6 @@
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details. 20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 */ 21 */
26 22
27#include <linux/types.h> 23#include <linux/types.h>
@@ -46,10 +42,10 @@
46#include <mach/common.h> 42#include <mach/common.h>
47#include <mach/iomux-mx3.h> 43#include <mach/iomux-mx3.h>
48#include <mach/board-mx31lilly.h> 44#include <mach/board-mx31lilly.h>
49#include <mach/spi.h>
50#include <mach/mxc_ehci.h> 45#include <mach/mxc_ehci.h>
51#include <mach/ulpi.h> 46#include <mach/ulpi.h>
52 47
48#include "devices-imx31.h"
53#include "devices.h" 49#include "devices.h"
54 50
55/* 51/*
@@ -269,12 +265,12 @@ static int spi_internal_chipselect[] = {
269 MXC_SPI_CS(2), 265 MXC_SPI_CS(2),
270}; 266};
271 267
272static struct spi_imx_master spi0_pdata = { 268static const struct spi_imx_master spi0_pdata __initconst = {
273 .chipselect = spi_internal_chipselect, 269 .chipselect = spi_internal_chipselect,
274 .num_chipselect = ARRAY_SIZE(spi_internal_chipselect), 270 .num_chipselect = ARRAY_SIZE(spi_internal_chipselect),
275}; 271};
276 272
277static struct spi_imx_master spi1_pdata = { 273static const struct spi_imx_master spi1_pdata __initconst = {
278 .chipselect = spi_internal_chipselect, 274 .chipselect = spi_internal_chipselect,
279 .num_chipselect = ARRAY_SIZE(spi_internal_chipselect), 275 .num_chipselect = ARRAY_SIZE(spi_internal_chipselect),
280}; 276};
@@ -289,6 +285,7 @@ static struct spi_board_info mc13783_dev __initdata = {
289 .bus_num = 1, 285 .bus_num = 1,
290 .chip_select = 0, 286 .chip_select = 0,
291 .platform_data = &mc13783_pdata, 287 .platform_data = &mc13783_pdata,
288 .irq = IOMUX_TO_IRQ(MX31_PIN_GPIO1_3),
292}; 289};
293 290
294static struct platform_device *devices[] __initdata = { 291static struct platform_device *devices[] __initdata = {
@@ -331,8 +328,8 @@ static void __init mx31lilly_board_init(void)
331 mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SS1__SS1, "SPI2_SS1"); 328 mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SS1__SS1, "SPI2_SS1");
332 mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SS2__SS2, "SPI2_SS2"); 329 mxc_iomux_alloc_pin(MX31_PIN_CSPI2_SS2__SS2, "SPI2_SS2");
333 330
334 mxc_register_device(&mxc_spi_device0, &spi0_pdata); 331 imx31_add_spi_imx0(&spi0_pdata);
335 mxc_register_device(&mxc_spi_device1, &spi1_pdata); 332 imx31_add_spi_imx1(&spi1_pdata);
336 spi_register_board_info(&mc13783_dev, 1); 333 spi_register_board_info(&mc13783_dev, 1);
337 334
338 platform_add_devices(devices, ARRAY_SIZE(devices)); 335 platform_add_devices(devices, ARRAY_SIZE(devices));
diff --git a/arch/arm/mach-mx3/mach-mx31lite.c b/arch/arm/mach-mx3/mach-mx31lite.c
index 2b6d11400877..da236c497d2a 100644
--- a/arch/arm/mach-mx3/mach-mx31lite.c
+++ b/arch/arm/mach-mx3/mach-mx31lite.c
@@ -13,10 +13,6 @@
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details. 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 */ 16 */
21 17
22#include <linux/types.h> 18#include <linux/types.h>
@@ -42,14 +38,12 @@
42#include <mach/hardware.h> 38#include <mach/hardware.h>
43#include <mach/common.h> 39#include <mach/common.h>
44#include <mach/board-mx31lite.h> 40#include <mach/board-mx31lite.h>
45#include <mach/imx-uart.h>
46#include <mach/iomux-mx3.h> 41#include <mach/iomux-mx3.h>
47#include <mach/irqs.h> 42#include <mach/irqs.h>
48#include <mach/mxc_nand.h>
49#include <mach/spi.h>
50#include <mach/mxc_ehci.h> 43#include <mach/mxc_ehci.h>
51#include <mach/ulpi.h> 44#include <mach/ulpi.h>
52 45
46#include "devices-imx31.h"
53#include "devices.h" 47#include "devices.h"
54 48
55/* 49/*
@@ -69,7 +63,8 @@ static unsigned int mx31lite_pins[] = {
69 MX31_PIN_CSPI2_SS2__SS2, 63 MX31_PIN_CSPI2_SS2__SS2,
70}; 64};
71 65
72static struct mxc_nand_platform_data mx31lite_nand_board_info = { 66static const struct mxc_nand_platform_data
67mx31lite_nand_board_info __initconst = {
73 .width = 1, 68 .width = 1,
74 .hw_ecc = 1, 69 .hw_ecc = 1,
75}; 70};
@@ -112,7 +107,7 @@ static int spi_internal_chipselect[] = {
112 MXC_SPI_CS(0), 107 MXC_SPI_CS(0),
113}; 108};
114 109
115static struct spi_imx_master spi1_pdata = { 110static const struct spi_imx_master spi1_pdata __initconst = {
116 .chipselect = spi_internal_chipselect, 111 .chipselect = spi_internal_chipselect,
117 .num_chipselect = ARRAY_SIZE(spi_internal_chipselect), 112 .num_chipselect = ARRAY_SIZE(spi_internal_chipselect),
118}; 113};
@@ -253,9 +248,9 @@ static void __init mxc_board_init(void)
253 248
254 /* NOR and NAND flash */ 249 /* NOR and NAND flash */
255 platform_device_register(&physmap_flash_device); 250 platform_device_register(&physmap_flash_device);
256 mxc_register_device(&mxc_nand_device, &mx31lite_nand_board_info); 251 imx31_add_mxc_nand(&mx31lite_nand_board_info);
257 252
258 mxc_register_device(&mxc_spi_device1, &spi1_pdata); 253 imx31_add_spi_imx1(&spi1_pdata);
259 spi_register_board_info(&mc13783_spi_dev, 1); 254 spi_register_board_info(&mc13783_spi_dev, 1);
260 255
261#if defined(CONFIG_USB_ULPI) 256#if defined(CONFIG_USB_ULPI)
diff --git a/arch/arm/mach-mx3/mach-mx31moboard.c b/arch/arm/mach-mx3/mach-mx31moboard.c
index 62b5e40165df..67776bc61c33 100644
--- a/arch/arm/mach-mx3/mach-mx31moboard.c
+++ b/arch/arm/mach-mx3/mach-mx31moboard.c
@@ -10,10 +10,6 @@
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
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 *
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 */ 13 */
18 14
19#include <linux/delay.h> 15#include <linux/delay.h>
@@ -42,16 +38,15 @@
42#include <mach/board-mx31moboard.h> 38#include <mach/board-mx31moboard.h>
43#include <mach/common.h> 39#include <mach/common.h>
44#include <mach/hardware.h> 40#include <mach/hardware.h>
45#include <mach/imx-uart.h>
46#include <mach/iomux-mx3.h> 41#include <mach/iomux-mx3.h>
47#include <mach/ipu.h> 42#include <mach/ipu.h>
48#include <mach/i2c.h>
49#include <mach/mmc.h> 43#include <mach/mmc.h>
50#include <mach/mxc_ehci.h> 44#include <mach/mxc_ehci.h>
51#include <mach/mx3_camera.h> 45#include <mach/mx3_camera.h>
52#include <mach/spi.h> 46#include <mach/spi.h>
53#include <mach/ulpi.h> 47#include <mach/ulpi.h>
54 48
49#include "devices-imx31.h"
55#include "devices.h" 50#include "devices.h"
56 51
57static unsigned int moboard_pins[] = { 52static unsigned int moboard_pins[] = {
@@ -130,24 +125,36 @@ static struct platform_device mx31moboard_flash = {
130 125
131static int moboard_uart0_init(struct platform_device *pdev) 126static int moboard_uart0_init(struct platform_device *pdev)
132{ 127{
133 gpio_request(IOMUX_TO_GPIO(MX31_PIN_CTS1), "uart0-cts-hack"); 128 int ret = gpio_request(IOMUX_TO_GPIO(MX31_PIN_CTS1), "uart0-cts-hack");
134 gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_CTS1), 0); 129 if (ret)
135 return 0; 130 return ret;
131
132 ret = gpio_direction_output(IOMUX_TO_GPIO(MX31_PIN_CTS1), 0);
133 if (ret)
134 gpio_free(IOMUX_TO_GPIO(MX31_PIN_CTS1));
135
136 return ret;
137}
138
139static void moboard_uart0_exit(struct platform_device *pdev)
140{
141 gpio_free(IOMUX_TO_GPIO(MX31_PIN_CTS1));
136} 142}
137 143
138static struct imxuart_platform_data uart0_pdata = { 144static const struct imxuart_platform_data uart0_pdata __initconst = {
139 .init = moboard_uart0_init, 145 .init = moboard_uart0_init,
146 .exit = moboard_uart0_exit,
140}; 147};
141 148
142static struct imxuart_platform_data uart4_pdata = { 149static const struct imxuart_platform_data uart4_pdata __initconst = {
143 .flags = IMXUART_HAVE_RTSCTS, 150 .flags = IMXUART_HAVE_RTSCTS,
144}; 151};
145 152
146static struct imxi2c_platform_data moboard_i2c0_pdata = { 153static const struct imxi2c_platform_data moboard_i2c0_data __initconst = {
147 .bitrate = 400000, 154 .bitrate = 400000,
148}; 155};
149 156
150static struct imxi2c_platform_data moboard_i2c1_pdata = { 157static const struct imxi2c_platform_data moboard_i2c1_data __initconst = {
151 .bitrate = 100000, 158 .bitrate = 100000,
152}; 159};
153 160
@@ -156,7 +163,7 @@ static int moboard_spi1_cs[] = {
156 MXC_SPI_CS(2), 163 MXC_SPI_CS(2),
157}; 164};
158 165
159static struct spi_imx_master moboard_spi1_master = { 166static const struct spi_imx_master moboard_spi1_pdata __initconst = {
160 .chipselect = moboard_spi1_cs, 167 .chipselect = moboard_spi1_cs,
161 .num_chipselect = ARRAY_SIZE(moboard_spi1_cs), 168 .num_chipselect = ARRAY_SIZE(moboard_spi1_cs),
162}; 169};
@@ -286,7 +293,7 @@ static int moboard_spi2_cs[] = {
286 MXC_SPI_CS(1), 293 MXC_SPI_CS(1),
287}; 294};
288 295
289static struct spi_imx_master moboard_spi2_master = { 296static const struct spi_imx_master moboard_spi2_pdata __initconst = {
290 .chipselect = moboard_spi2_cs, 297 .chipselect = moboard_spi2_cs,
291 .num_chipselect = ARRAY_SIZE(moboard_spi2_cs), 298 .num_chipselect = ARRAY_SIZE(moboard_spi2_cs),
292}; 299};
@@ -499,15 +506,14 @@ static void __init mxc_board_init(void)
499 506
500 platform_add_devices(devices, ARRAY_SIZE(devices)); 507 platform_add_devices(devices, ARRAY_SIZE(devices));
501 508
502 mxc_register_device(&mxc_uart_device0, &uart0_pdata); 509 imx31_add_imx_uart0(&uart0_pdata);
503 510 imx31_add_imx_uart4(&uart4_pdata);
504 mxc_register_device(&mxc_uart_device4, &uart4_pdata);
505 511
506 mxc_register_device(&mxc_i2c_device0, &moboard_i2c0_pdata); 512 imx31_add_imx_i2c0(&moboard_i2c0_data);
507 mxc_register_device(&mxc_i2c_device1, &moboard_i2c1_pdata); 513 imx31_add_imx_i2c1(&moboard_i2c1_data);
508 514
509 mxc_register_device(&mxc_spi_device1, &moboard_spi1_master); 515 imx31_add_spi_imx1(&moboard_spi1_pdata);
510 mxc_register_device(&mxc_spi_device2, &moboard_spi2_master); 516 imx31_add_spi_imx2(&moboard_spi2_pdata);
511 517
512 gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3), "pmic-irq"); 518 gpio_request(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3), "pmic-irq");
513 gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3)); 519 gpio_direction_input(IOMUX_TO_GPIO(MX31_PIN_GPIO1_3));
diff --git a/arch/arm/mach-mx3/mach-mx35pdk.c b/arch/arm/mach-mx3/mach-mx35_3ds.c
index bcac84d4dca4..1c30d7212f17 100644
--- a/arch/arm/mach-mx3/mach-mx35pdk.c
+++ b/arch/arm/mach-mx3/mach-mx35_3ds.c
@@ -12,10 +12,12 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
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 * You should have received a copy of the GNU General Public License 16
17 * along with this program; if not, write to the Free Software 17/*
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 18 * This machine is known as:
19 * - i.MX35 3-Stack Development System
20 * - i.MX35 Platform Development Kit (i.MX35 PDK)
19 */ 21 */
20 22
21#include <linux/types.h> 23#include <linux/types.h>
@@ -32,12 +34,12 @@
32 34
33#include <mach/hardware.h> 35#include <mach/hardware.h>
34#include <mach/common.h> 36#include <mach/common.h>
35#include <mach/imx-uart.h>
36#include <mach/iomux-mx35.h> 37#include <mach/iomux-mx35.h>
37 38
39#include "devices-imx35.h"
38#include "devices.h" 40#include "devices.h"
39 41
40static struct imxuart_platform_data uart_pdata = { 42static const struct imxuart_platform_data uart_pdata __initconst = {
41 .flags = IMXUART_HAVE_RTSCTS, 43 .flags = IMXUART_HAVE_RTSCTS,
42}; 44};
43 45
@@ -90,7 +92,7 @@ static void __init mxc_board_init(void)
90 92
91 platform_add_devices(devices, ARRAY_SIZE(devices)); 93 platform_add_devices(devices, ARRAY_SIZE(devices));
92 94
93 mxc_register_device(&mxc_uart_device0, &uart_pdata); 95 imx35_add_imx_uart0(&uart_pdata);
94 96
95 mxc_register_device(&mxc_otg_udc_device, &usb_pdata); 97 mxc_register_device(&mxc_otg_udc_device, &usb_pdata);
96} 98}
diff --git a/arch/arm/mach-mx3/mach-pcm037.c b/arch/arm/mach-mx3/mach-pcm037.c
index cce410662383..8a292dd1a714 100644
--- a/arch/arm/mach-mx3/mach-pcm037.c
+++ b/arch/arm/mach-mx3/mach-pcm037.c
@@ -10,10 +10,6 @@
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
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 *
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 */ 13 */
18 14
19#include <linux/types.h> 15#include <linux/types.h>
@@ -43,20 +39,17 @@
43#include <asm/mach/arch.h> 39#include <asm/mach/arch.h>
44#include <asm/mach/time.h> 40#include <asm/mach/time.h>
45#include <asm/mach/map.h> 41#include <asm/mach/map.h>
46#include <mach/board-pcm037.h>
47#include <mach/common.h> 42#include <mach/common.h>
48#include <mach/hardware.h> 43#include <mach/hardware.h>
49#include <mach/i2c.h>
50#include <mach/imx-uart.h>
51#include <mach/iomux-mx3.h> 44#include <mach/iomux-mx3.h>
52#include <mach/ipu.h> 45#include <mach/ipu.h>
53#include <mach/mmc.h> 46#include <mach/mmc.h>
54#include <mach/mx3_camera.h> 47#include <mach/mx3_camera.h>
55#include <mach/mx3fb.h> 48#include <mach/mx3fb.h>
56#include <mach/mxc_nand.h>
57#include <mach/mxc_ehci.h> 49#include <mach/mxc_ehci.h>
58#include <mach/ulpi.h> 50#include <mach/ulpi.h>
59 51
52#include "devices-imx31.h"
60#include "devices.h" 53#include "devices.h"
61#include "pcm037.h" 54#include "pcm037.h"
62 55
@@ -225,7 +218,7 @@ static struct platform_device pcm037_flash = {
225 .num_resources = 1, 218 .num_resources = 1,
226}; 219};
227 220
228static struct imxuart_platform_data uart_pdata = { 221static const struct imxuart_platform_data uart_pdata __initconst = {
229 .flags = IMXUART_HAVE_RTSCTS, 222 .flags = IMXUART_HAVE_RTSCTS,
230}; 223};
231 224
@@ -279,16 +272,17 @@ static struct platform_device pcm037_sram_device = {
279 .resource = &pcm038_sram_resource, 272 .resource = &pcm038_sram_resource,
280}; 273};
281 274
282static struct mxc_nand_platform_data pcm037_nand_board_info = { 275static const struct mxc_nand_platform_data
276pcm037_nand_board_info __initconst = {
283 .width = 1, 277 .width = 1,
284 .hw_ecc = 1, 278 .hw_ecc = 1,
285}; 279};
286 280
287static struct imxi2c_platform_data pcm037_i2c_1_data = { 281static const struct imxi2c_platform_data pcm037_i2c1_data __initconst = {
288 .bitrate = 100000, 282 .bitrate = 100000,
289}; 283};
290 284
291static struct imxi2c_platform_data pcm037_i2c_2_data = { 285static const struct imxi2c_platform_data pcm037_i2c2_data __initconst = {
292 .bitrate = 20000, 286 .bitrate = 20000,
293}; 287};
294 288
@@ -545,6 +539,7 @@ static struct platform_device pcm970_sja1000 = {
545 .num_resources = ARRAY_SIZE(pcm970_sja1000_resources), 539 .num_resources = ARRAY_SIZE(pcm970_sja1000_resources),
546}; 540};
547 541
542#if defined(CONFIG_USB_ULPI)
548static struct mxc_usbh_platform_data otg_pdata = { 543static struct mxc_usbh_platform_data otg_pdata = {
549 .portsc = MXC_EHCI_MODE_ULPI, 544 .portsc = MXC_EHCI_MODE_ULPI,
550 .flags = MXC_EHCI_INTERFACE_DIFF_UNI, 545 .flags = MXC_EHCI_INTERFACE_DIFF_UNI,
@@ -554,6 +549,7 @@ static struct mxc_usbh_platform_data usbh2_pdata = {
554 .portsc = MXC_EHCI_MODE_ULPI, 549 .portsc = MXC_EHCI_MODE_ULPI,
555 .flags = MXC_EHCI_INTERFACE_DIFF_UNI, 550 .flags = MXC_EHCI_INTERFACE_DIFF_UNI,
556}; 551};
552#endif
557 553
558static struct fsl_usb2_platform_data otg_device_pdata = { 554static struct fsl_usb2_platform_data otg_device_pdata = {
559 .operating_mode = FSL_USB2_DR_DEVICE, 555 .operating_mode = FSL_USB2_DR_DEVICE,
@@ -581,7 +577,6 @@ __setup("otg_mode=", pcm037_otg_mode);
581static void __init mxc_board_init(void) 577static void __init mxc_board_init(void)
582{ 578{
583 int ret; 579 int ret;
584 u32 tmp;
585 580
586 mxc_iomux_set_gpr(MUX_PGP_UH2, 1); 581 mxc_iomux_set_gpr(MUX_PGP_UH2, 1);
587 582
@@ -614,9 +609,10 @@ static void __init mxc_board_init(void)
614 609
615 platform_add_devices(devices, ARRAY_SIZE(devices)); 610 platform_add_devices(devices, ARRAY_SIZE(devices));
616 611
617 mxc_register_device(&mxc_uart_device0, &uart_pdata); 612 imx31_add_imx_uart0(&uart_pdata);
618 mxc_register_device(&mxc_uart_device1, &uart_pdata); 613 /* XXX: should't this have .flags = 0 (i.e. no RTSCTS) on PCM037_EET? */
619 mxc_register_device(&mxc_uart_device2, &uart_pdata); 614 imx31_add_imx_uart1(&uart_pdata);
615 imx31_add_imx_uart2(&uart_pdata);
620 616
621 mxc_register_device(&mxc_w1_master_device, NULL); 617 mxc_register_device(&mxc_w1_master_device, NULL);
622 618
@@ -634,10 +630,10 @@ static void __init mxc_board_init(void)
634 i2c_register_board_info(1, pcm037_i2c_devices, 630 i2c_register_board_info(1, pcm037_i2c_devices,
635 ARRAY_SIZE(pcm037_i2c_devices)); 631 ARRAY_SIZE(pcm037_i2c_devices));
636 632
637 mxc_register_device(&mxc_i2c_device1, &pcm037_i2c_1_data); 633 imx31_add_imx_i2c1(&pcm037_i2c1_data);
638 mxc_register_device(&mxc_i2c_device2, &pcm037_i2c_2_data); 634 imx31_add_imx_i2c2(&pcm037_i2c2_data);
639 635
640 mxc_register_device(&mxc_nand_device, &pcm037_nand_board_info); 636 imx31_add_mxc_nand(&pcm037_nand_board_info);
641 mxc_register_device(&mxcsdhc_device0, &sdhc_pdata); 637 mxc_register_device(&mxcsdhc_device0, &sdhc_pdata);
642 mxc_register_device(&mx3_ipu, &mx3_ipu_data); 638 mxc_register_device(&mx3_ipu, &mx3_ipu_data);
643 mxc_register_device(&mx3_fb, &mx3fb_pdata); 639 mxc_register_device(&mx3_fb, &mx3fb_pdata);
diff --git a/arch/arm/mach-mx3/mach-pcm037_eet.c b/arch/arm/mach-mx3/mach-pcm037_eet.c
index 8d386000fc40..c8b98218efee 100644
--- a/arch/arm/mach-mx3/mach-pcm037_eet.c
+++ b/arch/arm/mach-mx3/mach-pcm037_eet.c
@@ -13,9 +13,6 @@
13#include <linux/spi/spi.h> 13#include <linux/spi/spi.h>
14 14
15#include <mach/common.h> 15#include <mach/common.h>
16#if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE)
17#include <mach/spi.h>
18#endif
19#include <mach/iomux-mx3.h> 16#include <mach/iomux-mx3.h>
20 17
21#include <asm/mach-types.h> 18#include <asm/mach-types.h>
@@ -64,7 +61,7 @@ static struct spi_board_info pcm037_spi_dev[] = {
64#if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE) 61#if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE)
65static int pcm037_spi1_cs[] = {MXC_SPI_CS(1), IOMUX_TO_GPIO(MX31_PIN_KEY_COL7)}; 62static int pcm037_spi1_cs[] = {MXC_SPI_CS(1), IOMUX_TO_GPIO(MX31_PIN_KEY_COL7)};
66 63
67struct spi_imx_master pcm037_spi1_master = { 64static const struct spi_imx_master pcm037_spi1_pdata __initconst = {
68 .chipselect = pcm037_spi1_cs, 65 .chipselect = pcm037_spi1_cs,
69 .num_chipselect = ARRAY_SIZE(pcm037_spi1_cs), 66 .num_chipselect = ARRAY_SIZE(pcm037_spi1_cs),
70}; 67};
@@ -184,7 +181,7 @@ static int eet_init_devices(void)
184 /* SPI */ 181 /* SPI */
185 spi_register_board_info(pcm037_spi_dev, ARRAY_SIZE(pcm037_spi_dev)); 182 spi_register_board_info(pcm037_spi_dev, ARRAY_SIZE(pcm037_spi_dev));
186#if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE) 183#if defined(CONFIG_SPI_IMX) || defined(CONFIG_SPI_IMX_MODULE)
187 mxc_register_device(&mxc_spi_device0, &pcm037_spi1_master); 184 imx35_add_spi_imx0(&pcm037_spi1_pdata);
188#endif 185#endif
189 186
190 platform_device_register(&pcm037_gpio_keys_device); 187 platform_device_register(&pcm037_gpio_keys_device);
diff --git a/arch/arm/mach-mx3/mach-pcm043.c b/arch/arm/mach-mx3/mach-pcm043.c
index 78d9185a9d4b..47f5311b301a 100644
--- a/arch/arm/mach-mx3/mach-pcm043.c
+++ b/arch/arm/mach-mx3/mach-pcm043.c
@@ -10,10 +10,6 @@
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
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 *
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 */ 13 */
18 14
19#include <linux/types.h> 15#include <linux/types.h>
@@ -40,19 +36,15 @@
40 36
41#include <mach/hardware.h> 37#include <mach/hardware.h>
42#include <mach/common.h> 38#include <mach/common.h>
43#include <mach/imx-uart.h>
44#if defined CONFIG_I2C_IMX || defined CONFIG_I2C_IMX_MODULE
45#include <mach/i2c.h>
46#endif
47#include <mach/iomux-mx35.h> 39#include <mach/iomux-mx35.h>
48#include <mach/ipu.h> 40#include <mach/ipu.h>
49#include <mach/mx3fb.h> 41#include <mach/mx3fb.h>
50#include <mach/mxc_nand.h>
51#include <mach/mxc_ehci.h> 42#include <mach/mxc_ehci.h>
52#include <mach/ulpi.h> 43#include <mach/ulpi.h>
53#include <mach/audmux.h> 44#include <mach/audmux.h>
54#include <mach/ssi.h> 45#include <mach/ssi.h>
55 46
47#include "devices-imx35.h"
56#include "devices.h" 48#include "devices.h"
57 49
58static const struct fb_videomode fb_modedb[] = { 50static const struct fb_videomode fb_modedb[] = {
@@ -122,12 +114,12 @@ static struct platform_device pcm043_flash = {
122 .num_resources = 1, 114 .num_resources = 1,
123}; 115};
124 116
125static struct imxuart_platform_data uart_pdata = { 117static const struct imxuart_platform_data uart_pdata __initconst = {
126 .flags = IMXUART_HAVE_RTSCTS, 118 .flags = IMXUART_HAVE_RTSCTS,
127}; 119};
128 120
129#if defined CONFIG_I2C_IMX || defined CONFIG_I2C_IMX_MODULE 121#if defined CONFIG_I2C_IMX || defined CONFIG_I2C_IMX_MODULE
130static struct imxi2c_platform_data pcm043_i2c_1_data = { 122static const struct imxi2c_platform_data pcm043_i2c0_data __initconst = {
131 .bitrate = 50000, 123 .bitrate = 50000,
132}; 124};
133 125
@@ -222,6 +214,9 @@ static struct pad_desc pcm043_pads[] = {
222 MX35_PAD_STXD4__AUDMUX_AUD4_TXD, 214 MX35_PAD_STXD4__AUDMUX_AUD4_TXD,
223 MX35_PAD_SRXD4__AUDMUX_AUD4_RXD, 215 MX35_PAD_SRXD4__AUDMUX_AUD4_RXD,
224 MX35_PAD_SCK4__AUDMUX_AUD4_TXC, 216 MX35_PAD_SCK4__AUDMUX_AUD4_TXC,
217 /* CAN2 */
218 MX35_PAD_TX5_RX0__CAN2_TXCAN,
219 MX35_PAD_TX4_RX1__CAN2_RXCAN,
225}; 220};
226 221
227#define AC97_GPIO_TXFS (1 * 32 + 31) 222#define AC97_GPIO_TXFS (1 * 32 + 31)
@@ -304,11 +299,13 @@ static struct imx_ssi_platform_data pcm043_ssi_pdata = {
304 .flags = IMX_SSI_USE_AC97, 299 .flags = IMX_SSI_USE_AC97,
305}; 300};
306 301
307static struct mxc_nand_platform_data pcm037_nand_board_info = { 302static const struct mxc_nand_platform_data
303pcm037_nand_board_info __initconst = {
308 .width = 1, 304 .width = 1,
309 .hw_ecc = 1, 305 .hw_ecc = 1,
310}; 306};
311 307
308#if defined(CONFIG_USB_ULPI)
312static struct mxc_usbh_platform_data otg_pdata = { 309static struct mxc_usbh_platform_data otg_pdata = {
313 .portsc = MXC_EHCI_MODE_UTMI, 310 .portsc = MXC_EHCI_MODE_UTMI,
314 .flags = MXC_EHCI_INTERFACE_DIFF_UNI, 311 .flags = MXC_EHCI_INTERFACE_DIFF_UNI,
@@ -319,6 +316,7 @@ static struct mxc_usbh_platform_data usbh1_pdata = {
319 .flags = MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY | 316 .flags = MXC_EHCI_INTERFACE_SINGLE_UNI | MXC_EHCI_INTERNAL_PHY |
320 MXC_EHCI_IPPUE_DOWN, 317 MXC_EHCI_IPPUE_DOWN,
321}; 318};
319#endif
322 320
323static struct fsl_usb2_platform_data otg_device_pdata = { 321static struct fsl_usb2_platform_data otg_device_pdata = {
324 .operating_mode = FSL_USB2_DR_DEVICE, 322 .operating_mode = FSL_USB2_DR_DEVICE,
@@ -361,17 +359,17 @@ static void __init mxc_board_init(void)
361 359
362 platform_add_devices(devices, ARRAY_SIZE(devices)); 360 platform_add_devices(devices, ARRAY_SIZE(devices));
363 361
364 mxc_register_device(&mxc_uart_device0, &uart_pdata); 362 imx35_add_imx_uart0(&uart_pdata);
365 mxc_register_device(&mxc_nand_device, &pcm037_nand_board_info); 363 imx35_add_mxc_nand(&pcm037_nand_board_info);
366 mxc_register_device(&imx_ssi_device0, &pcm043_ssi_pdata); 364 mxc_register_device(&imx_ssi_device0, &pcm043_ssi_pdata);
367 365
368 mxc_register_device(&mxc_uart_device1, &uart_pdata); 366 imx35_add_imx_uart1(&uart_pdata);
369 367
370#if defined CONFIG_I2C_IMX || defined CONFIG_I2C_IMX_MODULE 368#if defined CONFIG_I2C_IMX || defined CONFIG_I2C_IMX_MODULE
371 i2c_register_board_info(0, pcm043_i2c_devices, 369 i2c_register_board_info(0, pcm043_i2c_devices,
372 ARRAY_SIZE(pcm043_i2c_devices)); 370 ARRAY_SIZE(pcm043_i2c_devices));
373 371
374 mxc_register_device(&mxc_i2c_device0, &pcm043_i2c_1_data); 372 imx35_add_imx_i2c0(&pcm043_i2c0_data);
375#endif 373#endif
376 374
377 mxc_register_device(&mx3_ipu, &mx3_ipu_data); 375 mxc_register_device(&mx3_ipu, &mx3_ipu_data);
@@ -390,6 +388,7 @@ static void __init mxc_board_init(void)
390 if (!otg_mode_host) 388 if (!otg_mode_host)
391 mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata); 389 mxc_register_device(&mxc_otg_udc_device, &otg_device_pdata);
392 390
391 imx35_add_flexcan1(NULL);
393} 392}
394 393
395static void __init pcm043_timer_init(void) 394static void __init pcm043_timer_init(void)
diff --git a/arch/arm/mach-mx3/mach-qong.c b/arch/arm/mach-mx3/mach-qong.c
index e5b5b8323a17..d44ac70222a5 100644
--- a/arch/arm/mach-mx3/mach-qong.c
+++ b/arch/arm/mach-mx3/mach-qong.c
@@ -10,10 +10,6 @@
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
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 *
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 */ 13 */
18 14
19#include <linux/types.h> 15#include <linux/types.h>
@@ -34,9 +30,9 @@
34#include <mach/common.h> 30#include <mach/common.h>
35#include <asm/page.h> 31#include <asm/page.h>
36#include <asm/setup.h> 32#include <asm/setup.h>
37#include <mach/board-qong.h>
38#include <mach/imx-uart.h>
39#include <mach/iomux-mx3.h> 33#include <mach/iomux-mx3.h>
34
35#include "devices-imx31.h"
40#include "devices.h" 36#include "devices.h"
41 37
42/* FPGA defines */ 38/* FPGA defines */
@@ -62,7 +58,7 @@
62 * This file contains the board-specific initialization routines. 58 * This file contains the board-specific initialization routines.
63 */ 59 */
64 60
65static struct imxuart_platform_data uart_pdata = { 61static const struct imxuart_platform_data uart_pdata __initconst = {
66 .flags = IMXUART_HAVE_RTSCTS, 62 .flags = IMXUART_HAVE_RTSCTS,
67}; 63};
68 64
@@ -73,11 +69,11 @@ static int uart_pins[] = {
73 MX31_PIN_RXD1__RXD1 69 MX31_PIN_RXD1__RXD1
74}; 70};
75 71
76static inline void mxc_init_imx_uart(void) 72static inline void __init mxc_init_imx_uart(void)
77{ 73{
78 mxc_iomux_setup_multiple_pins(uart_pins, ARRAY_SIZE(uart_pins), 74 mxc_iomux_setup_multiple_pins(uart_pins, ARRAY_SIZE(uart_pins),
79 "uart-0"); 75 "uart-0");
80 mxc_register_device(&mxc_uart_device0, &uart_pdata); 76 imx31_add_imx_uart0(&uart_pdata);
81} 77}
82 78
83static struct resource dnet_resources[] = { 79static struct resource dnet_resources[] = {
@@ -116,7 +112,7 @@ static struct physmap_flash_data qong_flash_data = {
116 112
117static struct resource qong_flash_resource = { 113static struct resource qong_flash_resource = {
118 .start = MX31_CS0_BASE_ADDR, 114 .start = MX31_CS0_BASE_ADDR,
119 .end = MX31_CS0_BASE_ADDR + QONG_NOR_SIZE - 1, 115 .end = MX31_CS0_BASE_ADDR + SZ_128M - 1,
120 .flags = IORESOURCE_MEM, 116 .flags = IORESOURCE_MEM,
121}; 117};
122 118
diff --git a/arch/arm/mach-mx3/mm.c b/arch/arm/mach-mx3/mm.c
index 6858a4f9806c..20e48c0195c4 100644
--- a/arch/arm/mach-mx3/mm.c
+++ b/arch/arm/mach-mx3/mm.c
@@ -14,10 +14,6 @@
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 17 */
22 18
23#include <linux/mm.h> 19#include <linux/mm.h>
@@ -97,9 +93,12 @@ void __init mx35_map_io(void)
97} 93}
98#endif 94#endif
99 95
96int imx3x_register_gpios(void);
97
100void __init mx31_init_irq(void) 98void __init mx31_init_irq(void)
101{ 99{
102 mxc_init_irq(IO_ADDRESS(AVIC_BASE_ADDR)); 100 mxc_init_irq(IO_ADDRESS(AVIC_BASE_ADDR));
101 imx3x_register_gpios();
103} 102}
104 103
105void __init mx35_init_irq(void) 104void __init mx35_init_irq(void)
diff --git a/arch/arm/mach-mx3/mx31lilly-db.c b/arch/arm/mach-mx3/mx31lilly-db.c
index 7aebd74a12e8..827fd3c80201 100644
--- a/arch/arm/mach-mx3/mx31lilly-db.c
+++ b/arch/arm/mach-mx3/mx31lilly-db.c
@@ -18,10 +18,6 @@
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details. 20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 */ 21 */
26 22
27#include <linux/kernel.h> 23#include <linux/kernel.h>
@@ -36,13 +32,13 @@
36 32
37#include <mach/hardware.h> 33#include <mach/hardware.h>
38#include <mach/common.h> 34#include <mach/common.h>
39#include <mach/imx-uart.h>
40#include <mach/iomux-mx3.h> 35#include <mach/iomux-mx3.h>
41#include <mach/board-mx31lilly.h> 36#include <mach/board-mx31lilly.h>
42#include <mach/mmc.h> 37#include <mach/mmc.h>
43#include <mach/mx3fb.h> 38#include <mach/mx3fb.h>
44#include <mach/ipu.h> 39#include <mach/ipu.h>
45 40
41#include "devices-imx31.h"
46#include "devices.h" 42#include "devices.h"
47 43
48/* 44/*
@@ -96,7 +92,7 @@ static unsigned int lilly_db_board_pins[] __initdata = {
96}; 92};
97 93
98/* UART */ 94/* UART */
99static struct imxuart_platform_data uart_pdata __initdata = { 95static const struct imxuart_platform_data uart_pdata __initconst = {
100 .flags = IMXUART_HAVE_RTSCTS, 96 .flags = IMXUART_HAVE_RTSCTS,
101}; 97};
102 98
@@ -217,9 +213,9 @@ void __init mx31lilly_db_init(void)
217 mxc_iomux_setup_multiple_pins(lilly_db_board_pins, 213 mxc_iomux_setup_multiple_pins(lilly_db_board_pins,
218 ARRAY_SIZE(lilly_db_board_pins), 214 ARRAY_SIZE(lilly_db_board_pins),
219 "development board pins"); 215 "development board pins");
220 mxc_register_device(&mxc_uart_device0, &uart_pdata); 216 imx31_add_imx_uart0(&uart_pdata);
221 mxc_register_device(&mxc_uart_device1, &uart_pdata); 217 imx31_add_imx_uart1(&uart_pdata);
222 mxc_register_device(&mxc_uart_device2, &uart_pdata); 218 imx31_add_imx_uart2(&uart_pdata);
223 mxc_register_device(&mxcsdhc_device0, &mmc_pdata); 219 mxc_register_device(&mxcsdhc_device0, &mmc_pdata);
224 mx31lilly_init_fb(); 220 mx31lilly_init_fb();
225} 221}
diff --git a/arch/arm/mach-mx3/mx31lite-db.c b/arch/arm/mach-mx3/mx31lite-db.c
index 5f05bfbec380..7b0e74e275ba 100644
--- a/arch/arm/mach-mx3/mx31lite-db.c
+++ b/arch/arm/mach-mx3/mx31lite-db.c
@@ -18,10 +18,6 @@
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of 18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details. 20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 */ 21 */
26 22
27#include <linux/kernel.h> 23#include <linux/kernel.h>
@@ -37,12 +33,11 @@
37 33
38#include <mach/hardware.h> 34#include <mach/hardware.h>
39#include <mach/common.h> 35#include <mach/common.h>
40#include <mach/imx-uart.h>
41#include <mach/iomux-mx3.h> 36#include <mach/iomux-mx3.h>
42#include <mach/board-mx31lite.h> 37#include <mach/board-mx31lite.h>
43#include <mach/mmc.h> 38#include <mach/mmc.h>
44#include <mach/spi.h>
45 39
40#include "devices-imx31.h"
46#include "devices.h" 41#include "devices.h"
47 42
48/* 43/*
@@ -76,7 +71,7 @@ static unsigned int litekit_db_board_pins[] __initdata = {
76}; 71};
77 72
78/* UART */ 73/* UART */
79static struct imxuart_platform_data uart_pdata __initdata = { 74static const struct imxuart_platform_data uart_pdata __initconst = {
80 .flags = IMXUART_HAVE_RTSCTS, 75 .flags = IMXUART_HAVE_RTSCTS,
81}; 76};
82 77
@@ -161,7 +156,7 @@ static int spi_internal_chipselect[] = {
161 MXC_SPI_CS(2), 156 MXC_SPI_CS(2),
162}; 157};
163 158
164static struct spi_imx_master spi0_pdata = { 159static const struct spi_imx_master spi0_pdata __initconst = {
165 .chipselect = spi_internal_chipselect, 160 .chipselect = spi_internal_chipselect,
166 .num_chipselect = ARRAY_SIZE(spi_internal_chipselect), 161 .num_chipselect = ARRAY_SIZE(spi_internal_chipselect),
167}; 162};
@@ -201,9 +196,9 @@ void __init mx31lite_db_init(void)
201 mxc_iomux_setup_multiple_pins(litekit_db_board_pins, 196 mxc_iomux_setup_multiple_pins(litekit_db_board_pins,
202 ARRAY_SIZE(litekit_db_board_pins), 197 ARRAY_SIZE(litekit_db_board_pins),
203 "development board pins"); 198 "development board pins");
204 mxc_register_device(&mxc_uart_device0, &uart_pdata); 199 imx31_add_imx_uart0(&uart_pdata);
205 mxc_register_device(&mxcsdhc_device0, &mmc_pdata); 200 mxc_register_device(&mxcsdhc_device0, &mmc_pdata);
206 mxc_register_device(&mxc_spi_device0, &spi0_pdata); 201 imx31_add_spi_imx0(&spi0_pdata);
207 platform_device_register(&litekit_led_device); 202 platform_device_register(&litekit_led_device);
208 mxc_register_device(&imx_wdt_device0, NULL); 203 mxc_register_device(&imx_wdt_device0, NULL);
209 mxc_register_device(&imx_rtc_device0, NULL); 204 mxc_register_device(&imx_rtc_device0, NULL);
diff --git a/arch/arm/mach-mx3/mx31moboard-devboard.c b/arch/arm/mach-mx3/mx31moboard-devboard.c
index 582299cb2c08..fc395a7a8599 100644
--- a/arch/arm/mach-mx3/mx31moboard-devboard.c
+++ b/arch/arm/mach-mx3/mx31moboard-devboard.c
@@ -10,10 +10,6 @@
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
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 *
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 */ 13 */
18 14
19#include <linux/gpio.h> 15#include <linux/gpio.h>
@@ -27,13 +23,13 @@
27#include <linux/usb/otg.h> 23#include <linux/usb/otg.h>
28 24
29#include <mach/common.h> 25#include <mach/common.h>
30#include <mach/imx-uart.h>
31#include <mach/iomux-mx3.h> 26#include <mach/iomux-mx3.h>
32#include <mach/hardware.h> 27#include <mach/hardware.h>
33#include <mach/mmc.h> 28#include <mach/mmc.h>
34#include <mach/mxc_ehci.h> 29#include <mach/mxc_ehci.h>
35#include <mach/ulpi.h> 30#include <mach/ulpi.h>
36 31
32#include "devices-imx31.h"
37#include "devices.h" 33#include "devices.h"
38 34
39static unsigned int devboard_pins[] = { 35static unsigned int devboard_pins[] = {
@@ -56,7 +52,7 @@ static unsigned int devboard_pins[] = {
56 MX31_PIN_RI_DCE1__GPIO2_10, MX31_PIN_DCD_DCE1__GPIO2_11, 52 MX31_PIN_RI_DCE1__GPIO2_10, MX31_PIN_DCD_DCE1__GPIO2_11,
57}; 53};
58 54
59static struct imxuart_platform_data uart_pdata = { 55static const struct imxuart_platform_data uart_pdata __initconst = {
60 .flags = IMXUART_HAVE_RTSCTS, 56 .flags = IMXUART_HAVE_RTSCTS,
61}; 57};
62 58
@@ -230,7 +226,7 @@ void __init mx31moboard_devboard_init(void)
230 mxc_iomux_setup_multiple_pins(devboard_pins, ARRAY_SIZE(devboard_pins), 226 mxc_iomux_setup_multiple_pins(devboard_pins, ARRAY_SIZE(devboard_pins),
231 "devboard"); 227 "devboard");
232 228
233 mxc_register_device(&mxc_uart_device1, &uart_pdata); 229 imx31_add_imx_uart1(&uart_pdata);
234 230
235 mxc_register_device(&mxcsdhc_device1, &sdhc2_pdata); 231 mxc_register_device(&mxcsdhc_device1, &sdhc2_pdata);
236 232
diff --git a/arch/arm/mach-mx3/mx31moboard-marxbot.c b/arch/arm/mach-mx3/mx31moboard-marxbot.c
index 4930f8c27e66..0551eb39d97e 100644
--- a/arch/arm/mach-mx3/mx31moboard-marxbot.c
+++ b/arch/arm/mach-mx3/mx31moboard-marxbot.c
@@ -10,10 +10,6 @@
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
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 *
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 */ 13 */
18 14
19#include <linux/delay.h> 15#include <linux/delay.h>
diff --git a/arch/arm/mach-mx3/mx31moboard-smartbot.c b/arch/arm/mach-mx3/mx31moboard-smartbot.c
index 293eea6d9d97..40c3e7564cb6 100644
--- a/arch/arm/mach-mx3/mx31moboard-smartbot.c
+++ b/arch/arm/mach-mx3/mx31moboard-smartbot.c
@@ -10,10 +10,6 @@
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
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 *
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 */ 13 */
18 14
19#include <linux/delay.h> 15#include <linux/delay.h>
@@ -30,7 +26,6 @@
30 26
31#include <mach/common.h> 27#include <mach/common.h>
32#include <mach/hardware.h> 28#include <mach/hardware.h>
33#include <mach/imx-uart.h>
34#include <mach/iomux-mx3.h> 29#include <mach/iomux-mx3.h>
35#include <mach/board-mx31moboard.h> 30#include <mach/board-mx31moboard.h>
36#include <mach/mxc_ehci.h> 31#include <mach/mxc_ehci.h>
@@ -38,6 +33,7 @@
38 33
39#include <media/soc_camera.h> 34#include <media/soc_camera.h>
40 35
36#include "devices-imx31.h"
41#include "devices.h" 37#include "devices.h"
42 38
43static unsigned int smartbot_pins[] = { 39static unsigned int smartbot_pins[] = {
@@ -59,7 +55,7 @@ static unsigned int smartbot_pins[] = {
59 MX31_PIN_RI_DCE1__GPIO2_10, MX31_PIN_DCD_DCE1__GPIO2_11, 55 MX31_PIN_RI_DCE1__GPIO2_10, MX31_PIN_DCD_DCE1__GPIO2_11,
60}; 56};
61 57
62static struct imxuart_platform_data uart_pdata = { 58static const struct imxuart_platform_data uart_pdata __initconst = {
63 .flags = IMXUART_HAVE_RTSCTS, 59 .flags = IMXUART_HAVE_RTSCTS,
64}; 60};
65 61
@@ -183,8 +179,7 @@ void __init mx31moboard_smartbot_init(int board)
183 mxc_iomux_setup_multiple_pins(smartbot_pins, ARRAY_SIZE(smartbot_pins), 179 mxc_iomux_setup_multiple_pins(smartbot_pins, ARRAY_SIZE(smartbot_pins),
184 "smartbot"); 180 "smartbot");
185 181
186 mxc_register_device(&mxc_uart_device1, &uart_pdata); 182 imx31_add_imx_uart1(&uart_pdata);
187
188 183
189 switch (board) { 184 switch (board) {
190 case MX31SMARTBOT: 185 case MX31SMARTBOT:
diff --git a/arch/arm/mach-mx5/Kconfig b/arch/arm/mach-mx5/Kconfig
index 1576d51e676c..0848db5dd364 100644
--- a/arch/arm/mach-mx5/Kconfig
+++ b/arch/arm/mach-mx5/Kconfig
@@ -15,4 +15,31 @@ config MACH_MX51_BABBAGE
15 u-boot. This includes specific configurations for the board and its 15 u-boot. This includes specific configurations for the board and its
16 peripherals. 16 peripherals.
17 17
18config MACH_MX51_3DS
19 bool "Support MX51PDK (3DS)"
20 select MXC_DEBUG_BOARD
21 help
22 Include support for MX51PDK (3DS) platform. This includes specific
23 configurations for the board and its peripherals.
24
25config MACH_EUKREA_CPUIMX51
26 bool "Support Eukrea CPUIMX51 module"
27 help
28 Include support for Eukrea CPUIMX51 platform. This includes
29 specific configurations for the module and its peripherals.
30
31choice
32 prompt "Baseboard"
33 depends on MACH_EUKREA_CPUIMX51
34 default MACH_EUKREA_MBIMX51_BASEBOARD
35
36config MACH_EUKREA_MBIMX51_BASEBOARD
37 prompt "Eukrea MBIMX51 development board"
38 bool
39 help
40 This adds board specific devices that can be found on Eukrea's
41 MBIMX51 evaluation board.
42
43endchoice
44
18endif 45endif
diff --git a/arch/arm/mach-mx5/Makefile b/arch/arm/mach-mx5/Makefile
index bf23f869ef51..86c66e7f52f3 100644
--- a/arch/arm/mach-mx5/Makefile
+++ b/arch/arm/mach-mx5/Makefile
@@ -6,4 +6,6 @@
6obj-y := cpu.o mm.o clock-mx51.o devices.o 6obj-y := cpu.o mm.o clock-mx51.o devices.o
7 7
8obj-$(CONFIG_MACH_MX51_BABBAGE) += board-mx51_babbage.o 8obj-$(CONFIG_MACH_MX51_BABBAGE) += board-mx51_babbage.o
9 9obj-$(CONFIG_MACH_MX51_3DS) += board-mx51_3ds.o
10obj-$(CONFIG_MACH_EUKREA_CPUIMX51) += board-cpuimx51.o
11obj-$(CONFIG_MACH_EUKREA_MBIMX51_BASEBOARD) += eukrea_mbimx51-baseboard.o
diff --git a/arch/arm/mach-mx5/board-cpuimx51.c b/arch/arm/mach-mx5/board-cpuimx51.c
new file mode 100644
index 000000000000..623607a20f57
--- /dev/null
+++ b/arch/arm/mach-mx5/board-cpuimx51.c
@@ -0,0 +1,293 @@
1/*
2 *
3 * Copyright (C) 2010 Eric Bénard <eric@eukrea.com>
4 *
5 * based on board-mx51_babbage.c which is
6 * Copyright 2009 Freescale Semiconductor, Inc. All Rights Reserved.
7 * Copyright (C) 2009-2010 Amit Kucheria <amit.kucheria@canonical.com>
8 *
9 * The code contained herein is licensed under the GNU General Public
10 * License. You may obtain a copy of the GNU General Public License
11 * Version 2 or later at the following locations:
12 *
13 * http://www.opensource.org/licenses/gpl-license.html
14 * http://www.gnu.org/copyleft/gpl.html
15 */
16
17#include <linux/init.h>
18#include <linux/platform_device.h>
19#include <linux/serial_8250.h>
20#include <linux/i2c.h>
21#include <linux/gpio.h>
22#include <linux/delay.h>
23#include <linux/io.h>
24#include <linux/interrupt.h>
25#include <linux/irq.h>
26#include <linux/fsl_devices.h>
27
28#include <mach/eukrea-baseboards.h>
29#include <mach/common.h>
30#include <mach/hardware.h>
31#include <mach/imx-uart.h>
32#include <mach/iomux-mx51.h>
33#include <mach/i2c.h>
34#include <mach/mxc_ehci.h>
35
36#include <asm/irq.h>
37#include <asm/setup.h>
38#include <asm/mach-types.h>
39#include <asm/mach/arch.h>
40#include <asm/mach/time.h>
41
42#include "devices.h"
43
44#define CPUIMX51_USBH1_STP (0*32 + 27)
45#define CPUIMX51_QUARTA_GPIO (2*32 + 28)
46#define CPUIMX51_QUARTB_GPIO (2*32 + 25)
47#define CPUIMX51_QUARTC_GPIO (2*32 + 26)
48#define CPUIMX51_QUARTD_GPIO (2*32 + 27)
49#define CPUIMX51_QUARTA_IRQ (MXC_INTERNAL_IRQS + CPUIMX51_QUARTA_GPIO)
50#define CPUIMX51_QUARTB_IRQ (MXC_INTERNAL_IRQS + CPUIMX51_QUARTB_GPIO)
51#define CPUIMX51_QUARTC_IRQ (MXC_INTERNAL_IRQS + CPUIMX51_QUARTC_GPIO)
52#define CPUIMX51_QUARTD_IRQ (MXC_INTERNAL_IRQS + CPUIMX51_QUARTD_GPIO)
53#define CPUIMX51_QUART_XTAL 14745600
54#define CPUIMX51_QUART_REGSHIFT 17
55
56/* USB_CTRL_1 */
57#define MX51_USB_CTRL_1_OFFSET 0x10
58#define MX51_USB_CTRL_UH1_EXT_CLK_EN (1 << 25)
59
60#define MX51_USB_PLLDIV_12_MHZ 0x00
61#define MX51_USB_PLL_DIV_19_2_MHZ 0x01
62#define MX51_USB_PLL_DIV_24_MHZ 0x02
63
64#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
65static struct plat_serial8250_port serial_platform_data[] = {
66 {
67 .mapbase = (unsigned long)(MX51_CS1_BASE_ADDR + 0x400000),
68 .irq = CPUIMX51_QUARTA_IRQ,
69 .irqflags = IRQF_TRIGGER_HIGH,
70 .uartclk = CPUIMX51_QUART_XTAL,
71 .regshift = CPUIMX51_QUART_REGSHIFT,
72 .iotype = UPIO_MEM,
73 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
74 }, {
75 .mapbase = (unsigned long)(MX51_CS1_BASE_ADDR + 0x800000),
76 .irq = CPUIMX51_QUARTB_IRQ,
77 .irqflags = IRQF_TRIGGER_HIGH,
78 .uartclk = CPUIMX51_QUART_XTAL,
79 .regshift = CPUIMX51_QUART_REGSHIFT,
80 .iotype = UPIO_MEM,
81 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
82 }, {
83 .mapbase = (unsigned long)(MX51_CS1_BASE_ADDR + 0x1000000),
84 .irq = CPUIMX51_QUARTC_IRQ,
85 .irqflags = IRQF_TRIGGER_HIGH,
86 .uartclk = CPUIMX51_QUART_XTAL,
87 .regshift = CPUIMX51_QUART_REGSHIFT,
88 .iotype = UPIO_MEM,
89 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
90 }, {
91 .mapbase = (unsigned long)(MX51_CS1_BASE_ADDR + 0x2000000),
92 .irq = CPUIMX51_QUARTD_IRQ,
93 .irqflags = IRQF_TRIGGER_HIGH,
94 .uartclk = CPUIMX51_QUART_XTAL,
95 .regshift = CPUIMX51_QUART_REGSHIFT,
96 .iotype = UPIO_MEM,
97 .flags = UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP,
98 }, {
99 }
100};
101
102static struct platform_device serial_device = {
103 .name = "serial8250",
104 .id = 0,
105 .dev = {
106 .platform_data = serial_platform_data,
107 },
108};
109#endif
110
111static struct platform_device *devices[] __initdata = {
112 &mxc_fec_device,
113#if defined(CONFIG_SERIAL_8250) || defined(CONFIG_SERIAL_8250_MODULE)
114 &serial_device,
115#endif
116};
117
118static struct pad_desc eukrea_cpuimx51_pads[] = {
119 /* UART1 */
120 MX51_PAD_UART1_RXD__UART1_RXD,
121 MX51_PAD_UART1_TXD__UART1_TXD,
122 MX51_PAD_UART1_RTS__UART1_RTS,
123 MX51_PAD_UART1_CTS__UART1_CTS,
124
125 /* I2C2 */
126 MX51_PAD_GPIO_1_2__I2C2_SCL,
127 MX51_PAD_GPIO_1_3__I2C2_SDA,
128 MX51_PAD_NANDF_D10__GPIO_3_30,
129
130 /* QUART IRQ */
131 MX51_PAD_NANDF_D15__GPIO_3_25,
132 MX51_PAD_NANDF_D14__GPIO_3_26,
133 MX51_PAD_NANDF_D13__GPIO_3_27,
134 MX51_PAD_NANDF_D12__GPIO_3_28,
135
136 /* USB HOST1 */
137 MX51_PAD_USBH1_CLK__USBH1_CLK,
138 MX51_PAD_USBH1_DIR__USBH1_DIR,
139 MX51_PAD_USBH1_NXT__USBH1_NXT,
140 MX51_PAD_USBH1_DATA0__USBH1_DATA0,
141 MX51_PAD_USBH1_DATA1__USBH1_DATA1,
142 MX51_PAD_USBH1_DATA2__USBH1_DATA2,
143 MX51_PAD_USBH1_DATA3__USBH1_DATA3,
144 MX51_PAD_USBH1_DATA4__USBH1_DATA4,
145 MX51_PAD_USBH1_DATA5__USBH1_DATA5,
146 MX51_PAD_USBH1_DATA6__USBH1_DATA6,
147 MX51_PAD_USBH1_DATA7__USBH1_DATA7,
148 MX51_PAD_USBH1_STP__USBH1_STP,
149};
150
151static struct imxuart_platform_data uart_pdata = {
152 .flags = IMXUART_HAVE_RTSCTS,
153};
154
155static struct imxi2c_platform_data eukrea_cpuimx51_i2c_data = {
156 .bitrate = 100000,
157};
158
159static struct i2c_board_info eukrea_cpuimx51_i2c_devices[] = {
160 {
161 I2C_BOARD_INFO("pcf8563", 0x51),
162 },
163};
164
165/* This function is board specific as the bit mask for the plldiv will also
166be different for other Freescale SoCs, thus a common bitmask is not
167possible and cannot get place in /plat-mxc/ehci.c.*/
168static int initialize_otg_port(struct platform_device *pdev)
169{
170 u32 v;
171 void __iomem *usb_base;
172 void __iomem *usbother_base;
173
174 usb_base = ioremap(MX51_OTG_BASE_ADDR, SZ_4K);
175 usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET;
176
177 /* Set the PHY clock to 19.2MHz */
178 v = __raw_readl(usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
179 v &= ~MX5_USB_UTMI_PHYCTRL1_PLLDIV_MASK;
180 v |= MX51_USB_PLL_DIV_19_2_MHZ;
181 __raw_writel(v, usbother_base + MXC_USB_PHY_CTR_FUNC2_OFFSET);
182 iounmap(usb_base);
183 return 0;
184}
185
186static int initialize_usbh1_port(struct platform_device *pdev)
187{
188 u32 v;
189 void __iomem *usb_base;
190 void __iomem *usbother_base;
191
192 usb_base = ioremap(MX51_OTG_BASE_ADDR, SZ_4K);
193 usbother_base = usb_base + MX5_USBOTHER_REGS_OFFSET;
194
195 /* The clock for the USBH1 ULPI port will come externally from the PHY. */
196 v = __raw_readl(usbother_base + MX51_USB_CTRL_1_OFFSET);
197 __raw_writel(v | MX51_USB_CTRL_UH1_EXT_CLK_EN, usbother_base + MX51_USB_CTRL_1_OFFSET);
198 iounmap(usb_base);
199 return 0;
200}
201
202static struct mxc_usbh_platform_data dr_utmi_config = {
203 .init = initialize_otg_port,
204 .portsc = MXC_EHCI_UTMI_16BIT,
205 .flags = MXC_EHCI_INTERNAL_PHY,
206};
207
208static struct fsl_usb2_platform_data usb_pdata = {
209 .operating_mode = FSL_USB2_DR_DEVICE,
210 .phy_mode = FSL_USB2_PHY_UTMI_WIDE,
211};
212
213static struct mxc_usbh_platform_data usbh1_config = {
214 .init = initialize_usbh1_port,
215 .portsc = MXC_EHCI_MODE_ULPI,
216 .flags = (MXC_EHCI_POWER_PINS_ENABLED | MXC_EHCI_ITC_NO_THRESHOLD),
217};
218
219static int otg_mode_host;
220
221static int __init eukrea_cpuimx51_otg_mode(char *options)
222{
223 if (!strcmp(options, "host"))
224 otg_mode_host = 1;
225 else if (!strcmp(options, "device"))
226 otg_mode_host = 0;
227 else
228 pr_info("otg_mode neither \"host\" nor \"device\". "
229 "Defaulting to device\n");
230 return 0;
231}
232__setup("otg_mode=", eukrea_cpuimx51_otg_mode);
233
234/*
235 * Board specific initialization.
236 */
237static void __init eukrea_cpuimx51_init(void)
238{
239 mxc_iomux_v3_setup_multiple_pads(eukrea_cpuimx51_pads,
240 ARRAY_SIZE(eukrea_cpuimx51_pads));
241
242 mxc_register_device(&mxc_uart_device0, &uart_pdata);
243 gpio_request(CPUIMX51_QUARTA_GPIO, "quarta_irq");
244 gpio_direction_input(CPUIMX51_QUARTA_GPIO);
245 gpio_free(CPUIMX51_QUARTA_GPIO);
246 gpio_request(CPUIMX51_QUARTB_GPIO, "quartb_irq");
247 gpio_direction_input(CPUIMX51_QUARTB_GPIO);
248 gpio_free(CPUIMX51_QUARTB_GPIO);
249 gpio_request(CPUIMX51_QUARTC_GPIO, "quartc_irq");
250 gpio_direction_input(CPUIMX51_QUARTC_GPIO);
251 gpio_free(CPUIMX51_QUARTC_GPIO);
252 gpio_request(CPUIMX51_QUARTD_GPIO, "quartd_irq");
253 gpio_direction_input(CPUIMX51_QUARTD_GPIO);
254 gpio_free(CPUIMX51_QUARTD_GPIO);
255
256 platform_add_devices(devices, ARRAY_SIZE(devices));
257
258 mxc_register_device(&mxc_i2c_device1, &eukrea_cpuimx51_i2c_data);
259 i2c_register_board_info(1, eukrea_cpuimx51_i2c_devices,
260 ARRAY_SIZE(eukrea_cpuimx51_i2c_devices));
261
262 if (otg_mode_host)
263 mxc_register_device(&mxc_usbdr_host_device, &dr_utmi_config);
264 else {
265 initialize_otg_port(NULL);
266 mxc_register_device(&mxc_usbdr_udc_device, &usb_pdata);
267 }
268 mxc_register_device(&mxc_usbh1_device, &usbh1_config);
269
270#ifdef CONFIG_MACH_EUKREA_MBIMX51_BASEBOARD
271 eukrea_mbimx51_baseboard_init();
272#endif
273}
274
275static void __init eukrea_cpuimx51_timer_init(void)
276{
277 mx51_clocks_init(32768, 24000000, 22579200, 0);
278}
279
280static struct sys_timer mxc_timer = {
281 .init = eukrea_cpuimx51_timer_init,
282};
283
284MACHINE_START(EUKREA_CPUIMX51, "Eukrea CPUIMX51 Module")
285 /* Maintainer: Eric Bénard <eric@eukrea.com> */
286 .phys_io = MX51_AIPS1_BASE_ADDR,
287 .io_pg_offst = ((MX51_AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
288 .boot_params = PHYS_OFFSET + 0x100,
289 .map_io = mx51_map_io,
290 .init_irq = mx51_init_irq,
291 .init_machine = eukrea_cpuimx51_init,
292 .timer = &mxc_timer,
293MACHINE_END
diff --git a/arch/arm/mach-mx5/board-mx51_3ds.c b/arch/arm/mach-mx5/board-mx51_3ds.c
new file mode 100644
index 000000000000..f95c2fd94667
--- /dev/null
+++ b/arch/arm/mach-mx5/board-mx51_3ds.c
@@ -0,0 +1,164 @@
1/*
2 * Copyright 2008-2009 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright (C) 2010 Jason Wang <jason77.wang@gmail.com>
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
11 */
12
13#include <linux/irq.h>
14#include <linux/platform_device.h>
15#include <linux/input/matrix_keypad.h>
16
17#include <asm/mach-types.h>
18#include <asm/mach/arch.h>
19#include <asm/mach/time.h>
20
21#include <mach/hardware.h>
22#include <mach/common.h>
23#include <mach/iomux-mx51.h>
24#include <mach/imx-uart.h>
25#include <mach/3ds_debugboard.h>
26
27#include "devices.h"
28
29#define EXPIO_PARENT_INT (MXC_INTERNAL_IRQS + GPIO_PORTA + 6)
30
31static struct pad_desc mx51_3ds_pads[] = {
32 /* UART1 */
33 MX51_PAD_UART1_RXD__UART1_RXD,
34 MX51_PAD_UART1_TXD__UART1_TXD,
35 MX51_PAD_UART1_RTS__UART1_RTS,
36 MX51_PAD_UART1_CTS__UART1_CTS,
37
38 /* UART2 */
39 MX51_PAD_UART2_RXD__UART2_RXD,
40 MX51_PAD_UART2_TXD__UART2_TXD,
41 MX51_PAD_EIM_D25__UART2_CTS,
42 MX51_PAD_EIM_D26__UART2_RTS,
43
44 /* UART3 */
45 MX51_PAD_UART3_RXD__UART3_RXD,
46 MX51_PAD_UART3_TXD__UART3_TXD,
47 MX51_PAD_EIM_D24__UART3_CTS,
48 MX51_PAD_EIM_D27__UART3_RTS,
49
50 /* CPLD PARENT IRQ PIN */
51 MX51_PAD_GPIO_1_6__GPIO_1_6,
52
53 /* KPP */
54 MX51_PAD_KEY_ROW0__KEY_ROW0,
55 MX51_PAD_KEY_ROW1__KEY_ROW1,
56 MX51_PAD_KEY_ROW2__KEY_ROW2,
57 MX51_PAD_KEY_ROW3__KEY_ROW3,
58 MX51_PAD_KEY_COL0__KEY_COL0,
59 MX51_PAD_KEY_COL1__KEY_COL1,
60 MX51_PAD_KEY_COL2__KEY_COL2,
61 MX51_PAD_KEY_COL3__KEY_COL3,
62 MX51_PAD_KEY_COL4__KEY_COL4,
63 MX51_PAD_KEY_COL5__KEY_COL5,
64};
65
66/* Serial ports */
67#if defined(CONFIG_SERIAL_IMX) || defined(CONFIG_SERIAL_IMX_MODULE)
68static struct imxuart_platform_data uart_pdata = {
69 .flags = IMXUART_HAVE_RTSCTS,
70};
71
72static inline void mxc_init_imx_uart(void)
73{
74 mxc_register_device(&mxc_uart_device0, &uart_pdata);
75 mxc_register_device(&mxc_uart_device1, &uart_pdata);
76 mxc_register_device(&mxc_uart_device2, &uart_pdata);
77}
78#else /* !SERIAL_IMX */
79static inline void mxc_init_imx_uart(void)
80{
81}
82#endif /* SERIAL_IMX */
83
84#if defined(CONFIG_KEYBOARD_IMX) || defined(CONFIG_KEYBOARD_IMX_MODULE)
85static int mx51_3ds_board_keymap[] = {
86 KEY(0, 0, KEY_1),
87 KEY(0, 1, KEY_2),
88 KEY(0, 2, KEY_3),
89 KEY(0, 3, KEY_F1),
90 KEY(0, 4, KEY_UP),
91 KEY(0, 5, KEY_F2),
92
93 KEY(1, 0, KEY_4),
94 KEY(1, 1, KEY_5),
95 KEY(1, 2, KEY_6),
96 KEY(1, 3, KEY_LEFT),
97 KEY(1, 4, KEY_SELECT),
98 KEY(1, 5, KEY_RIGHT),
99
100 KEY(2, 0, KEY_7),
101 KEY(2, 1, KEY_8),
102 KEY(2, 2, KEY_9),
103 KEY(2, 3, KEY_F3),
104 KEY(2, 4, KEY_DOWN),
105 KEY(2, 5, KEY_F4),
106
107 KEY(3, 0, KEY_0),
108 KEY(3, 1, KEY_OK),
109 KEY(3, 2, KEY_ESC),
110 KEY(3, 3, KEY_ENTER),
111 KEY(3, 4, KEY_MENU),
112 KEY(3, 5, KEY_BACK)
113};
114
115static struct matrix_keymap_data mx51_3ds_map_data = {
116 .keymap = mx51_3ds_board_keymap,
117 .keymap_size = ARRAY_SIZE(mx51_3ds_board_keymap),
118};
119
120static void mxc_init_keypad(void)
121{
122 mxc_register_device(&mxc_keypad_device, &mx51_3ds_map_data);
123}
124#else
125static inline void mxc_init_keypad(void)
126{
127}
128#endif
129
130/*
131 * Board specific initialization.
132 */
133static void __init mxc_board_init(void)
134{
135 mxc_iomux_v3_setup_multiple_pads(mx51_3ds_pads,
136 ARRAY_SIZE(mx51_3ds_pads));
137 mxc_init_imx_uart();
138
139 if (mxc_expio_init(MX51_CS5_BASE_ADDR, EXPIO_PARENT_INT))
140 printk(KERN_WARNING "Init of the debugboard failed, all "
141 "devices on the board are unusable.\n");
142
143 mxc_init_keypad();
144}
145
146static void __init mx51_3ds_timer_init(void)
147{
148 mx51_clocks_init(32768, 24000000, 22579200, 0);
149}
150
151static struct sys_timer mxc_timer = {
152 .init = mx51_3ds_timer_init,
153};
154
155MACHINE_START(MX51_3DS, "Freescale MX51 3-Stack Board")
156 /* Maintainer: Freescale Semiconductor, Inc. */
157 .phys_io = MX51_AIPS1_BASE_ADDR,
158 .io_pg_offst = ((MX51_AIPS1_BASE_ADDR_VIRT) >> 18) & 0xfffc,
159 .boot_params = PHYS_OFFSET + 0x100,
160 .map_io = mx51_map_io,
161 .init_irq = mx51_init_irq,
162 .init_machine = mxc_board_init,
163 .timer = &mxc_timer,
164MACHINE_END
diff --git a/arch/arm/mach-mx5/board-mx51_babbage.c b/arch/arm/mach-mx5/board-mx51_babbage.c
index ed885f9d7b73..6e384d92e625 100644
--- a/arch/arm/mach-mx5/board-mx51_babbage.c
+++ b/arch/arm/mach-mx5/board-mx51_babbage.c
@@ -12,6 +12,7 @@
12 12
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/i2c.h>
15#include <linux/gpio.h> 16#include <linux/gpio.h>
16#include <linux/delay.h> 17#include <linux/delay.h>
17#include <linux/io.h> 18#include <linux/io.h>
@@ -21,6 +22,7 @@
21#include <mach/hardware.h> 22#include <mach/hardware.h>
22#include <mach/imx-uart.h> 23#include <mach/imx-uart.h>
23#include <mach/iomux-mx51.h> 24#include <mach/iomux-mx51.h>
25#include <mach/i2c.h>
24#include <mach/mxc_ehci.h> 26#include <mach/mxc_ehci.h>
25 27
26#include <asm/irq.h> 28#include <asm/irq.h>
@@ -64,6 +66,18 @@ static struct pad_desc mx51babbage_pads[] = {
64 MX51_PAD_EIM_D27__UART3_RTS, 66 MX51_PAD_EIM_D27__UART3_RTS,
65 MX51_PAD_EIM_D24__UART3_CTS, 67 MX51_PAD_EIM_D24__UART3_CTS,
66 68
69 /* I2C1 */
70 MX51_PAD_EIM_D16__I2C1_SDA,
71 MX51_PAD_EIM_D19__I2C1_SCL,
72
73 /* I2C2 */
74 MX51_PAD_KEY_COL4__I2C2_SCL,
75 MX51_PAD_KEY_COL5__I2C2_SDA,
76
77 /* HSI2C */
78 MX51_PAD_I2C1_CLK__HSI2C_CLK,
79 MX51_PAD_I2C1_DAT__HSI2C_DAT,
80
67 /* USB HOST1 */ 81 /* USB HOST1 */
68 MX51_PAD_USBH1_CLK__USBH1_CLK, 82 MX51_PAD_USBH1_CLK__USBH1_CLK,
69 MX51_PAD_USBH1_DIR__USBH1_DIR, 83 MX51_PAD_USBH1_DIR__USBH1_DIR,
@@ -78,7 +92,7 @@ static struct pad_desc mx51babbage_pads[] = {
78 MX51_PAD_USBH1_DATA7__USBH1_DATA7, 92 MX51_PAD_USBH1_DATA7__USBH1_DATA7,
79 93
80 /* USB HUB reset line*/ 94 /* USB HUB reset line*/
81 MX51_PAD_GPIO_1_7__GPIO1_7, 95 MX51_PAD_GPIO_1_7__GPIO_1_7,
82}; 96};
83 97
84/* Serial ports */ 98/* Serial ports */
@@ -99,6 +113,14 @@ static inline void mxc_init_imx_uart(void)
99} 113}
100#endif /* SERIAL_IMX */ 114#endif /* SERIAL_IMX */
101 115
116static struct imxi2c_platform_data babbage_i2c_data = {
117 .bitrate = 100000,
118};
119
120static struct imxi2c_platform_data babbage_hsi2c_data = {
121 .bitrate = 400000,
122};
123
102static int gpio_usbh1_active(void) 124static int gpio_usbh1_active(void)
103{ 125{
104 struct pad_desc usbh1stp_gpio = MX51_PAD_USBH1_STP__GPIO_1_27; 126 struct pad_desc usbh1stp_gpio = MX51_PAD_USBH1_STP__GPIO_1_27;
@@ -230,6 +252,10 @@ static void __init mxc_board_init(void)
230 mxc_init_imx_uart(); 252 mxc_init_imx_uart();
231 platform_add_devices(devices, ARRAY_SIZE(devices)); 253 platform_add_devices(devices, ARRAY_SIZE(devices));
232 254
255 mxc_register_device(&mxc_i2c_device0, &babbage_i2c_data);
256 mxc_register_device(&mxc_i2c_device1, &babbage_i2c_data);
257 mxc_register_device(&mxc_hsi2c_device, &babbage_hsi2c_data);
258
233 if (otg_mode_host) 259 if (otg_mode_host)
234 mxc_register_device(&mxc_usbdr_host_device, &dr_utmi_config); 260 mxc_register_device(&mxc_usbdr_host_device, &dr_utmi_config);
235 else { 261 else {
diff --git a/arch/arm/mach-mx5/clock-mx51.c b/arch/arm/mach-mx5/clock-mx51.c
index d9f612d3370e..6af69def357f 100644
--- a/arch/arm/mach-mx5/clock-mx51.c
+++ b/arch/arm/mach-mx5/clock-mx51.c
@@ -758,6 +758,10 @@ static struct clk gpt_32k_clk = {
758 .parent = &ckil_clk, 758 .parent = &ckil_clk,
759}; 759};
760 760
761static struct clk kpp_clk = {
762 .id = 0,
763};
764
761#define DEFINE_CLOCK(name, i, er, es, gr, sr, p, s) \ 765#define DEFINE_CLOCK(name, i, er, es, gr, sr, p, s) \
762 static struct clk name = { \ 766 static struct clk name = { \
763 .id = i, \ 767 .id = i, \
@@ -798,6 +802,14 @@ DEFINE_CLOCK(gpt_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG9_OFFSET,
798DEFINE_CLOCK(gpt_ipg_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG10_OFFSET, 802DEFINE_CLOCK(gpt_ipg_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG10_OFFSET,
799 NULL, NULL, &ipg_clk, NULL); 803 NULL, NULL, &ipg_clk, NULL);
800 804
805/* I2C */
806DEFINE_CLOCK(i2c1_clk, 0, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG9_OFFSET,
807 NULL, NULL, &ipg_clk, NULL);
808DEFINE_CLOCK(i2c2_clk, 1, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG10_OFFSET,
809 NULL, NULL, &ipg_clk, NULL);
810DEFINE_CLOCK(hsi2c_clk, 0, MXC_CCM_CCGR1, MXC_CCM_CCGRx_CG11_OFFSET,
811 NULL, NULL, &ipg_clk, NULL);
812
801/* FEC */ 813/* FEC */
802DEFINE_CLOCK(fec_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG12_OFFSET, 814DEFINE_CLOCK(fec_clk, 0, MXC_CCM_CCGR2, MXC_CCM_CCGRx_CG12_OFFSET,
803 NULL, NULL, &ipg_clk, NULL); 815 NULL, NULL, &ipg_clk, NULL);
@@ -815,12 +827,16 @@ static struct clk_lookup lookups[] = {
815 _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk) 827 _REGISTER_CLOCK("imx-uart.2", NULL, uart3_clk)
816 _REGISTER_CLOCK(NULL, "gpt", gpt_clk) 828 _REGISTER_CLOCK(NULL, "gpt", gpt_clk)
817 _REGISTER_CLOCK("fec.0", NULL, fec_clk) 829 _REGISTER_CLOCK("fec.0", NULL, fec_clk)
830 _REGISTER_CLOCK("imx-i2c.0", NULL, i2c1_clk)
831 _REGISTER_CLOCK("imx-i2c.1", NULL, i2c2_clk)
832 _REGISTER_CLOCK("imx-i2c.2", NULL, hsi2c_clk)
818 _REGISTER_CLOCK("mxc-ehci.0", "usb", usboh3_clk) 833 _REGISTER_CLOCK("mxc-ehci.0", "usb", usboh3_clk)
819 _REGISTER_CLOCK("mxc-ehci.0", "usb_ahb", ahb_clk) 834 _REGISTER_CLOCK("mxc-ehci.0", "usb_ahb", ahb_clk)
820 _REGISTER_CLOCK("mxc-ehci.1", "usb", usboh3_clk) 835 _REGISTER_CLOCK("mxc-ehci.1", "usb", usboh3_clk)
821 _REGISTER_CLOCK("mxc-ehci.1", "usb_ahb", ahb_clk) 836 _REGISTER_CLOCK("mxc-ehci.1", "usb_ahb", ahb_clk)
822 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usboh3_clk) 837 _REGISTER_CLOCK("fsl-usb2-udc", "usb", usboh3_clk)
823 _REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", ahb_clk) 838 _REGISTER_CLOCK("fsl-usb2-udc", "usb_ahb", ahb_clk)
839 _REGISTER_CLOCK("imx-keypad.0", NULL, kpp_clk)
824}; 840};
825 841
826static void clk_tree_init(void) 842static void clk_tree_init(void)
diff --git a/arch/arm/mach-mx5/devices.c b/arch/arm/mach-mx5/devices.c
index 7130449aacdc..1920ff4963b2 100644
--- a/arch/arm/mach-mx5/devices.c
+++ b/arch/arm/mach-mx5/devices.c
@@ -93,6 +93,64 @@ struct platform_device mxc_fec_device = {
93 .resource = mxc_fec_resources, 93 .resource = mxc_fec_resources,
94}; 94};
95 95
96static struct resource mxc_i2c0_resources[] = {
97 {
98 .start = MX51_I2C1_BASE_ADDR,
99 .end = MX51_I2C1_BASE_ADDR + SZ_4K - 1,
100 .flags = IORESOURCE_MEM,
101 }, {
102 .start = MX51_MXC_INT_I2C1,
103 .end = MX51_MXC_INT_I2C1,
104 .flags = IORESOURCE_IRQ,
105 },
106};
107
108struct platform_device mxc_i2c_device0 = {
109 .name = "imx-i2c",
110 .id = 0,
111 .num_resources = ARRAY_SIZE(mxc_i2c0_resources),
112 .resource = mxc_i2c0_resources,
113};
114
115static struct resource mxc_i2c1_resources[] = {
116 {
117 .start = MX51_I2C2_BASE_ADDR,
118 .end = MX51_I2C2_BASE_ADDR + SZ_4K - 1,
119 .flags = IORESOURCE_MEM,
120 }, {
121 .start = MX51_MXC_INT_I2C2,
122 .end = MX51_MXC_INT_I2C2,
123 .flags = IORESOURCE_IRQ,
124 },
125};
126
127struct platform_device mxc_i2c_device1 = {
128 .name = "imx-i2c",
129 .id = 1,
130 .num_resources = ARRAY_SIZE(mxc_i2c1_resources),
131 .resource = mxc_i2c1_resources,
132};
133
134static struct resource mxc_hsi2c_resources[] = {
135 {
136 .start = MX51_HSI2C_DMA_BASE_ADDR,
137 .end = MX51_HSI2C_DMA_BASE_ADDR + SZ_16K - 1,
138 .flags = IORESOURCE_MEM,
139 },
140 {
141 .start = MX51_MXC_INT_HS_I2C,
142 .end = MX51_MXC_INT_HS_I2C,
143 .flags = IORESOURCE_IRQ,
144 },
145};
146
147struct platform_device mxc_hsi2c_device = {
148 .name = "imx-i2c",
149 .id = 2,
150 .num_resources = ARRAY_SIZE(mxc_hsi2c_resources),
151 .resource = mxc_hsi2c_resources
152};
153
96static u64 usb_dma_mask = DMA_BIT_MASK(32); 154static u64 usb_dma_mask = DMA_BIT_MASK(32);
97 155
98static struct resource usbotg_resources[] = { 156static struct resource usbotg_resources[] = {
@@ -168,34 +226,57 @@ struct platform_device mxc_wdt = {
168 .resource = mxc_wdt_resources, 226 .resource = mxc_wdt_resources,
169}; 227};
170 228
229static struct resource mxc_kpp_resources[] = {
230 {
231 .start = MX51_MXC_INT_KPP,
232 .end = MX51_MXC_INT_KPP,
233 .flags = IORESOURCE_IRQ,
234 } , {
235 .start = MX51_KPP_BASE_ADDR,
236 .end = MX51_KPP_BASE_ADDR + 0x8 - 1,
237 .flags = IORESOURCE_MEM,
238 },
239};
240
241struct platform_device mxc_keypad_device = {
242 .name = "imx-keypad",
243 .id = 0,
244 .num_resources = ARRAY_SIZE(mxc_kpp_resources),
245 .resource = mxc_kpp_resources,
246};
247
171static struct mxc_gpio_port mxc_gpio_ports[] = { 248static struct mxc_gpio_port mxc_gpio_ports[] = {
172 { 249 {
173 .chip.label = "gpio-0", 250 .chip.label = "gpio-0",
174 .base = MX51_IO_ADDRESS(MX51_GPIO1_BASE_ADDR), 251 .base = MX51_IO_ADDRESS(MX51_GPIO1_BASE_ADDR),
175 .irq = MX51_MXC_INT_GPIO1_LOW, 252 .irq = MX51_MXC_INT_GPIO1_LOW,
253 .irq_high = MX51_MXC_INT_GPIO1_HIGH,
176 .virtual_irq_start = MXC_GPIO_IRQ_START 254 .virtual_irq_start = MXC_GPIO_IRQ_START
177 }, 255 },
178 { 256 {
179 .chip.label = "gpio-1", 257 .chip.label = "gpio-1",
180 .base = MX51_IO_ADDRESS(MX51_GPIO2_BASE_ADDR), 258 .base = MX51_IO_ADDRESS(MX51_GPIO2_BASE_ADDR),
181 .irq = MX51_MXC_INT_GPIO2_LOW, 259 .irq = MX51_MXC_INT_GPIO2_LOW,
260 .irq_high = MX51_MXC_INT_GPIO2_HIGH,
182 .virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 1 261 .virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 1
183 }, 262 },
184 { 263 {
185 .chip.label = "gpio-2", 264 .chip.label = "gpio-2",
186 .base = MX51_IO_ADDRESS(MX51_GPIO3_BASE_ADDR), 265 .base = MX51_IO_ADDRESS(MX51_GPIO3_BASE_ADDR),
187 .irq = MX51_MXC_INT_GPIO3_LOW, 266 .irq = MX51_MXC_INT_GPIO3_LOW,
267 .irq_high = MX51_MXC_INT_GPIO3_HIGH,
188 .virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 2 268 .virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 2
189 }, 269 },
190 { 270 {
191 .chip.label = "gpio-3", 271 .chip.label = "gpio-3",
192 .base = MX51_IO_ADDRESS(MX51_GPIO4_BASE_ADDR), 272 .base = MX51_IO_ADDRESS(MX51_GPIO4_BASE_ADDR),
193 .irq = MX51_MXC_INT_GPIO4_LOW, 273 .irq = MX51_MXC_INT_GPIO4_LOW,
274 .irq_high = MX51_MXC_INT_GPIO4_HIGH,
194 .virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 3 275 .virtual_irq_start = MXC_GPIO_IRQ_START + 32 * 3
195 }, 276 },
196}; 277};
197 278
198int __init mxc_register_gpios(void) 279int __init imx51_register_gpios(void)
199{ 280{
200 return mxc_gpio_init(mxc_gpio_ports, ARRAY_SIZE(mxc_gpio_ports)); 281 return mxc_gpio_init(mxc_gpio_ports, ARRAY_SIZE(mxc_gpio_ports));
201} 282}
diff --git a/arch/arm/mach-mx5/devices.h b/arch/arm/mach-mx5/devices.h
index c879ae71cd5b..e509cfaad1d4 100644
--- a/arch/arm/mach-mx5/devices.h
+++ b/arch/arm/mach-mx5/devices.h
@@ -6,3 +6,7 @@ extern struct platform_device mxc_usbdr_host_device;
6extern struct platform_device mxc_usbh1_device; 6extern struct platform_device mxc_usbh1_device;
7extern struct platform_device mxc_usbdr_udc_device; 7extern struct platform_device mxc_usbdr_udc_device;
8extern struct platform_device mxc_wdt; 8extern struct platform_device mxc_wdt;
9extern struct platform_device mxc_i2c_device0;
10extern struct platform_device mxc_i2c_device1;
11extern struct platform_device mxc_hsi2c_device;
12extern struct platform_device mxc_keypad_device;
diff --git a/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c b/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c
new file mode 100644
index 000000000000..ffa93d1d6ef8
--- /dev/null
+++ b/arch/arm/mach-mx5/eukrea_mbimx51-baseboard.c
@@ -0,0 +1,200 @@
1/*
2 *
3 * Copyright (C) 2010 Eric Bénard <eric@eukrea.com>
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
11 */
12
13#include <linux/init.h>
14#include <linux/platform_device.h>
15#include <linux/serial_8250.h>
16#include <linux/i2c.h>
17#include <linux/gpio.h>
18#include <linux/io.h>
19#include <linux/interrupt.h>
20#include <linux/irq.h>
21#include <linux/fsl_devices.h>
22#include <linux/i2c/tsc2007.h>
23#include <linux/leds.h>
24#include <linux/input/matrix_keypad.h>
25
26#include <mach/common.h>
27#include <mach/hardware.h>
28#include <mach/imx-uart.h>
29#include <mach/iomux-mx51.h>
30
31#include <asm/mach/arch.h>
32
33#include "devices.h"
34
35#define MBIMX51_TSC2007_GPIO (2*32 + 30)
36#define MBIMX51_TSC2007_IRQ (MXC_INTERNAL_IRQS + MBIMX51_TSC2007_GPIO)
37#define MBIMX51_LED0 (2*32 + 5)
38#define MBIMX51_LED1 (2*32 + 6)
39#define MBIMX51_LED2 (2*32 + 7)
40#define MBIMX51_LED3 (2*32 + 8)
41
42static struct gpio_led mbimx51_leds[] = {
43 {
44 .name = "led0",
45 .default_trigger = "heartbeat",
46 .active_low = 1,
47 .gpio = MBIMX51_LED0,
48 },
49 {
50 .name = "led1",
51 .default_trigger = "nand-disk",
52 .active_low = 1,
53 .gpio = MBIMX51_LED1,
54 },
55 {
56 .name = "led2",
57 .default_trigger = "mmc0",
58 .active_low = 1,
59 .gpio = MBIMX51_LED2,
60 },
61 {
62 .name = "led3",
63 .default_trigger = "default-on",
64 .active_low = 1,
65 .gpio = MBIMX51_LED3,
66 },
67};
68
69static struct gpio_led_platform_data mbimx51_leds_info = {
70 .leds = mbimx51_leds,
71 .num_leds = ARRAY_SIZE(mbimx51_leds),
72};
73
74static struct platform_device mbimx51_leds_gpio = {
75 .name = "leds-gpio",
76 .id = -1,
77 .dev = {
78 .platform_data = &mbimx51_leds_info,
79 },
80};
81
82static struct platform_device *devices[] __initdata = {
83 &mbimx51_leds_gpio,
84};
85
86static struct pad_desc mbimx51_pads[] = {
87 /* UART2 */
88 MX51_PAD_UART2_RXD__UART2_RXD,
89 MX51_PAD_UART2_TXD__UART2_TXD,
90
91 /* UART3 */
92 MX51_PAD_UART3_RXD__UART3_RXD,
93 MX51_PAD_UART3_TXD__UART3_TXD,
94 MX51_PAD_KEY_COL4__UART3_RTS,
95 MX51_PAD_KEY_COL5__UART3_CTS,
96
97 /* TSC2007 IRQ */
98 MX51_PAD_NANDF_D10__GPIO_3_30,
99
100 /* LEDS */
101 MX51_PAD_DISPB2_SER_DIN__GPIO_3_5,
102 MX51_PAD_DISPB2_SER_DIO__GPIO_3_6,
103 MX51_PAD_DISPB2_SER_CLK__GPIO_3_7,
104 MX51_PAD_DISPB2_SER_RS__GPIO_3_8,
105
106 /* KPP */
107 MX51_PAD_KEY_ROW0__KEY_ROW0,
108 MX51_PAD_KEY_ROW1__KEY_ROW1,
109 MX51_PAD_KEY_ROW2__KEY_ROW2,
110 MX51_PAD_KEY_ROW3__KEY_ROW3,
111 MX51_PAD_KEY_COL0__KEY_COL0,
112 MX51_PAD_KEY_COL1__KEY_COL1,
113 MX51_PAD_KEY_COL2__KEY_COL2,
114 MX51_PAD_KEY_COL3__KEY_COL3,
115};
116
117static struct imxuart_platform_data uart_pdata = {
118 .flags = IMXUART_HAVE_RTSCTS,
119};
120
121static int mbimx51_keymap[] = {
122 KEY(0, 0, KEY_1),
123 KEY(0, 1, KEY_2),
124 KEY(0, 2, KEY_3),
125 KEY(0, 3, KEY_UP),
126
127 KEY(1, 0, KEY_4),
128 KEY(1, 1, KEY_5),
129 KEY(1, 2, KEY_6),
130 KEY(1, 3, KEY_LEFT),
131
132 KEY(2, 0, KEY_7),
133 KEY(2, 1, KEY_8),
134 KEY(2, 2, KEY_9),
135 KEY(2, 3, KEY_RIGHT),
136
137 KEY(3, 0, KEY_0),
138 KEY(3, 1, KEY_DOWN),
139 KEY(3, 2, KEY_ESC),
140 KEY(3, 3, KEY_ENTER),
141};
142
143static struct matrix_keymap_data mbimx51_map_data = {
144 .keymap = mbimx51_keymap,
145 .keymap_size = ARRAY_SIZE(mbimx51_keymap),
146};
147
148static int tsc2007_get_pendown_state(void)
149{
150 return !gpio_get_value(MBIMX51_TSC2007_GPIO);
151}
152
153struct tsc2007_platform_data tsc2007_data = {
154 .model = 2007,
155 .x_plate_ohms = 180,
156 .get_pendown_state = tsc2007_get_pendown_state,
157};
158
159static struct i2c_board_info mbimx51_i2c_devices[] = {
160 {
161 I2C_BOARD_INFO("tsc2007", 0x48),
162 .irq = MBIMX51_TSC2007_IRQ,
163 .platform_data = &tsc2007_data,
164 },
165};
166
167/*
168 * baseboard initialization.
169 */
170void __init eukrea_mbimx51_baseboard_init(void)
171{
172 mxc_iomux_v3_setup_multiple_pads(mbimx51_pads,
173 ARRAY_SIZE(mbimx51_pads));
174
175 mxc_register_device(&mxc_uart_device1, NULL);
176 mxc_register_device(&mxc_uart_device2, &uart_pdata);
177
178 gpio_request(MBIMX51_LED0, "LED0");
179 gpio_direction_output(MBIMX51_LED0, 1);
180 gpio_free(MBIMX51_LED0);
181 gpio_request(MBIMX51_LED1, "LED1");
182 gpio_direction_output(MBIMX51_LED1, 1);
183 gpio_free(MBIMX51_LED1);
184 gpio_request(MBIMX51_LED2, "LED2");
185 gpio_direction_output(MBIMX51_LED2, 1);
186 gpio_free(MBIMX51_LED2);
187 gpio_request(MBIMX51_LED3, "LED3");
188 gpio_direction_output(MBIMX51_LED3, 1);
189 gpio_free(MBIMX51_LED3);
190
191 platform_add_devices(devices, ARRAY_SIZE(devices));
192
193 mxc_register_device(&mxc_keypad_device, &mbimx51_map_data);
194
195 gpio_request(MBIMX51_TSC2007_GPIO, "tsc2007_irq");
196 gpio_direction_input(MBIMX51_TSC2007_GPIO);
197 set_irq_type(MBIMX51_TSC2007_IRQ, IRQF_TRIGGER_FALLING);
198 i2c_register_board_info(1, mbimx51_i2c_devices,
199 ARRAY_SIZE(mbimx51_i2c_devices));
200}
diff --git a/arch/arm/mach-mx5/mm.c b/arch/arm/mach-mx5/mm.c
index b7677ef80cc4..bc3f30db8d9a 100644
--- a/arch/arm/mach-mx5/mm.c
+++ b/arch/arm/mach-mx5/mm.c
@@ -65,6 +65,8 @@ void __init mx51_map_io(void)
65 iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc)); 65 iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
66} 66}
67 67
68int imx51_register_gpios(void);
69
68void __init mx51_init_irq(void) 70void __init mx51_init_irq(void)
69{ 71{
70 unsigned long tzic_addr; 72 unsigned long tzic_addr;
@@ -80,4 +82,5 @@ void __init mx51_init_irq(void)
80 panic("unable to map TZIC interrupt controller\n"); 82 panic("unable to map TZIC interrupt controller\n");
81 83
82 tzic_init_irq(tzic_virt); 84 tzic_init_irq(tzic_virt);
85 imx51_register_gpios();
83} 86}
diff --git a/arch/arm/mach-mxc91231/crm_regs.h b/arch/arm/mach-mxc91231/crm_regs.h
index ce4f59058189..b989baccd675 100644
--- a/arch/arm/mach-mxc91231/crm_regs.h
+++ b/arch/arm/mach-mxc91231/crm_regs.h
@@ -11,11 +11,6 @@
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * 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 *
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 */ 14 */
20 15
21#ifndef _ARCH_ARM_MACH_MXC91231_CRM_REGS_H_ 16#ifndef _ARCH_ARM_MACH_MXC91231_CRM_REGS_H_
diff --git a/arch/arm/mach-mxc91231/devices.c b/arch/arm/mach-mxc91231/devices.c
index 353bd977b393..027af4f0d18a 100644
--- a/arch/arm/mach-mxc91231/devices.c
+++ b/arch/arm/mach-mxc91231/devices.c
@@ -135,7 +135,7 @@ static struct mxc_gpio_port mxc_gpio_ports[] = {
135 }, 135 },
136}; 136};
137 137
138int __init mxc_register_gpios(void) 138int __init mxc91231_register_gpios(void)
139{ 139{
140 return mxc_gpio_init(mxc_gpio_ports, ARRAY_SIZE(mxc_gpio_ports)); 140 return mxc_gpio_init(mxc_gpio_ports, ARRAY_SIZE(mxc_gpio_ports));
141} 141}
diff --git a/arch/arm/mach-mxc91231/mm.c b/arch/arm/mach-mxc91231/mm.c
index 6becda3ff331..aeccfd755fee 100644
--- a/arch/arm/mach-mxc91231/mm.c
+++ b/arch/arm/mach-mxc91231/mm.c
@@ -15,11 +15,6 @@
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details. 17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 *
23 */ 18 */
24 19
25#include <linux/mm.h> 20#include <linux/mm.h>
@@ -88,7 +83,10 @@ void __init mxc91231_map_io(void)
88 iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc)); 83 iotable_init(mxc_io_desc, ARRAY_SIZE(mxc_io_desc));
89} 84}
90 85
86int mxc91231_register_gpios(void);
87
91void __init mxc91231_init_irq(void) 88void __init mxc91231_init_irq(void)
92{ 89{
90 mxc91231_register_gpios();
93 mxc_init_irq(MXC91231_IO_ADDRESS(MXC91231_AVIC_BASE_ADDR)); 91 mxc_init_irq(MXC91231_IO_ADDRESS(MXC91231_AVIC_BASE_ADDR));
94} 92}
diff --git a/arch/arm/mach-nomadik/clock.c b/arch/arm/mach-nomadik/clock.c
index f035f4185274..89f793adf776 100644
--- a/arch/arm/mach-nomadik/clock.c
+++ b/arch/arm/mach-nomadik/clock.c
@@ -53,6 +53,10 @@ static struct clk clk_default;
53 } 53 }
54 54
55static struct clk_lookup lookups[] = { 55static struct clk_lookup lookups[] = {
56 {
57 .con_id = "apb_pclk",
58 .clk = &clk_default,
59 },
56 CLK(&clk_24, "mtu0"), 60 CLK(&clk_24, "mtu0"),
57 CLK(&clk_24, "mtu1"), 61 CLK(&clk_24, "mtu1"),
58 CLK(&clk_48, "uart0"), 62 CLK(&clk_48, "uart0"),
diff --git a/arch/arm/mach-omap1/board-ams-delta.c b/arch/arm/mach-omap1/board-ams-delta.c
index fdd1dd53fa9c..0a9d61d2d229 100644
--- a/arch/arm/mach-omap1/board-ams-delta.c
+++ b/arch/arm/mach-omap1/board-ams-delta.c
@@ -301,6 +301,7 @@ MACHINE_START(AMS_DELTA, "Amstrad E3 (Delta)")
301 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 301 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
302 .boot_params = 0x10000100, 302 .boot_params = 0x10000100,
303 .map_io = ams_delta_map_io, 303 .map_io = ams_delta_map_io,
304 .reserve = omap_reserve,
304 .init_irq = ams_delta_init_irq, 305 .init_irq = ams_delta_init_irq,
305 .init_machine = ams_delta_init, 306 .init_machine = ams_delta_init,
306 .timer = &omap_timer, 307 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap1/board-fsample.c b/arch/arm/mach-omap1/board-fsample.c
index 096f2ed102cb..059bac60b35a 100644
--- a/arch/arm/mach-omap1/board-fsample.c
+++ b/arch/arm/mach-omap1/board-fsample.c
@@ -378,6 +378,7 @@ MACHINE_START(OMAP_FSAMPLE, "OMAP730 F-Sample")
378 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 378 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
379 .boot_params = 0x10000100, 379 .boot_params = 0x10000100,
380 .map_io = omap_fsample_map_io, 380 .map_io = omap_fsample_map_io,
381 .reserve = omap_reserve,
381 .init_irq = omap_fsample_init_irq, 382 .init_irq = omap_fsample_init_irq,
382 .init_machine = omap_fsample_init, 383 .init_machine = omap_fsample_init,
383 .timer = &omap_timer, 384 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap1/board-generic.c b/arch/arm/mach-omap1/board-generic.c
index e1195a3467b8..7a65684d2a15 100644
--- a/arch/arm/mach-omap1/board-generic.c
+++ b/arch/arm/mach-omap1/board-generic.c
@@ -98,6 +98,7 @@ MACHINE_START(OMAP_GENERIC, "Generic OMAP1510/1610/1710")
98 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 98 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
99 .boot_params = 0x10000100, 99 .boot_params = 0x10000100,
100 .map_io = omap_generic_map_io, 100 .map_io = omap_generic_map_io,
101 .reserve = omap_reserve,
101 .init_irq = omap_generic_init_irq, 102 .init_irq = omap_generic_init_irq,
102 .init_machine = omap_generic_init, 103 .init_machine = omap_generic_init,
103 .timer = &omap_timer, 104 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap1/board-h2.c b/arch/arm/mach-omap1/board-h2.c
index d1100e4f65ac..68b2beda8b99 100644
--- a/arch/arm/mach-omap1/board-h2.c
+++ b/arch/arm/mach-omap1/board-h2.c
@@ -467,6 +467,7 @@ MACHINE_START(OMAP_H2, "TI-H2")
467 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 467 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
468 .boot_params = 0x10000100, 468 .boot_params = 0x10000100,
469 .map_io = h2_map_io, 469 .map_io = h2_map_io,
470 .reserve = omap_reserve,
470 .init_irq = h2_init_irq, 471 .init_irq = h2_init_irq,
471 .init_machine = h2_init, 472 .init_machine = h2_init,
472 .timer = &omap_timer, 473 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap1/board-h3.c b/arch/arm/mach-omap1/board-h3.c
index a53ab8297d25..0b0825fe6751 100644
--- a/arch/arm/mach-omap1/board-h3.c
+++ b/arch/arm/mach-omap1/board-h3.c
@@ -437,6 +437,7 @@ MACHINE_START(OMAP_H3, "TI OMAP1710 H3 board")
437 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 437 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
438 .boot_params = 0x10000100, 438 .boot_params = 0x10000100,
439 .map_io = h3_map_io, 439 .map_io = h3_map_io,
440 .reserve = omap_reserve,
440 .init_irq = h3_init_irq, 441 .init_irq = h3_init_irq,
441 .init_machine = h3_init, 442 .init_machine = h3_init,
442 .timer = &omap_timer, 443 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap1/board-htcherald.c b/arch/arm/mach-omap1/board-htcherald.c
index 8e313b4b99a9..d70a4f0923f5 100644
--- a/arch/arm/mach-omap1/board-htcherald.c
+++ b/arch/arm/mach-omap1/board-htcherald.c
@@ -304,6 +304,7 @@ MACHINE_START(HERALD, "HTC Herald")
304 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 304 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
305 .boot_params = 0x10000100, 305 .boot_params = 0x10000100,
306 .map_io = htcherald_map_io, 306 .map_io = htcherald_map_io,
307 .reserve = omap_reserve,
307 .init_irq = htcherald_init_irq, 308 .init_irq = htcherald_init_irq,
308 .init_machine = htcherald_init, 309 .init_machine = htcherald_init,
309 .timer = &omap_timer, 310 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap1/board-innovator.c b/arch/arm/mach-omap1/board-innovator.c
index 5d12fd35681b..91064b37859a 100644
--- a/arch/arm/mach-omap1/board-innovator.c
+++ b/arch/arm/mach-omap1/board-innovator.c
@@ -463,6 +463,7 @@ MACHINE_START(OMAP_INNOVATOR, "TI-Innovator")
463 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 463 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
464 .boot_params = 0x10000100, 464 .boot_params = 0x10000100,
465 .map_io = innovator_map_io, 465 .map_io = innovator_map_io,
466 .reserve = omap_reserve,
466 .init_irq = innovator_init_irq, 467 .init_irq = innovator_init_irq,
467 .init_machine = innovator_init, 468 .init_machine = innovator_init,
468 .timer = &omap_timer, 469 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap1/board-nokia770.c b/arch/arm/mach-omap1/board-nokia770.c
index 71e1a3fad0ea..8c28b10f3dae 100644
--- a/arch/arm/mach-omap1/board-nokia770.c
+++ b/arch/arm/mach-omap1/board-nokia770.c
@@ -400,6 +400,7 @@ MACHINE_START(NOKIA770, "Nokia 770")
400 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 400 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
401 .boot_params = 0x10000100, 401 .boot_params = 0x10000100,
402 .map_io = omap_nokia770_map_io, 402 .map_io = omap_nokia770_map_io,
403 .reserve = omap_reserve,
403 .init_irq = omap_nokia770_init_irq, 404 .init_irq = omap_nokia770_init_irq,
404 .init_machine = omap_nokia770_init, 405 .init_machine = omap_nokia770_init,
405 .timer = &omap_timer, 406 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap1/board-osk.c b/arch/arm/mach-omap1/board-osk.c
index 80d862001def..e2a72af30890 100644
--- a/arch/arm/mach-omap1/board-osk.c
+++ b/arch/arm/mach-omap1/board-osk.c
@@ -584,6 +584,7 @@ MACHINE_START(OMAP_OSK, "TI-OSK")
584 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 584 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
585 .boot_params = 0x10000100, 585 .boot_params = 0x10000100,
586 .map_io = osk_map_io, 586 .map_io = osk_map_io,
587 .reserve = omap_reserve,
587 .init_irq = osk_init_irq, 588 .init_irq = osk_init_irq,
588 .init_machine = osk_init, 589 .init_machine = osk_init,
589 .timer = &omap_timer, 590 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap1/board-palmte.c b/arch/arm/mach-omap1/board-palmte.c
index 569b4c9085cd..61a2321b9732 100644
--- a/arch/arm/mach-omap1/board-palmte.c
+++ b/arch/arm/mach-omap1/board-palmte.c
@@ -373,6 +373,7 @@ MACHINE_START(OMAP_PALMTE, "OMAP310 based Palm Tungsten E")
373 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 373 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
374 .boot_params = 0x10000100, 374 .boot_params = 0x10000100,
375 .map_io = omap_palmte_map_io, 375 .map_io = omap_palmte_map_io,
376 .reserve = omap_reserve,
376 .init_irq = omap_palmte_init_irq, 377 .init_irq = omap_palmte_init_irq,
377 .init_machine = omap_palmte_init, 378 .init_machine = omap_palmte_init,
378 .timer = &omap_timer, 379 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap1/board-palmtt.c b/arch/arm/mach-omap1/board-palmtt.c
index 6ad49a2cc1a0..21c01c6afcc1 100644
--- a/arch/arm/mach-omap1/board-palmtt.c
+++ b/arch/arm/mach-omap1/board-palmtt.c
@@ -321,6 +321,7 @@ MACHINE_START(OMAP_PALMTT, "OMAP1510 based Palm Tungsten|T")
321 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 321 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
322 .boot_params = 0x10000100, 322 .boot_params = 0x10000100,
323 .map_io = omap_palmtt_map_io, 323 .map_io = omap_palmtt_map_io,
324 .reserve = omap_reserve,
324 .init_irq = omap_palmtt_init_irq, 325 .init_irq = omap_palmtt_init_irq,
325 .init_machine = omap_palmtt_init, 326 .init_machine = omap_palmtt_init,
326 .timer = &omap_timer, 327 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap1/board-palmz71.c b/arch/arm/mach-omap1/board-palmz71.c
index 6641de9257ef..f32492451533 100644
--- a/arch/arm/mach-omap1/board-palmz71.c
+++ b/arch/arm/mach-omap1/board-palmz71.c
@@ -338,10 +338,12 @@ omap_palmz71_map_io(void)
338} 338}
339 339
340MACHINE_START(OMAP_PALMZ71, "OMAP310 based Palm Zire71") 340MACHINE_START(OMAP_PALMZ71, "OMAP310 based Palm Zire71")
341 .phys_io = 0xfff00000, 341 .phys_io = 0xfff00000,
342 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 342 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
343 .boot_params = 0x10000100,.map_io = omap_palmz71_map_io, 343 .boot_params = 0x10000100,
344 .init_irq = omap_palmz71_init_irq, 344 .map_io = omap_palmz71_map_io,
345 .init_machine = omap_palmz71_init, 345 .reserve = omap_reserve,
346 .timer = &omap_timer, 346 .init_irq = omap_palmz71_init_irq,
347 .init_machine = omap_palmz71_init,
348 .timer = &omap_timer,
347MACHINE_END 349MACHINE_END
diff --git a/arch/arm/mach-omap1/board-perseus2.c b/arch/arm/mach-omap1/board-perseus2.c
index e854d5741c88..8b5ab1fcc405 100644
--- a/arch/arm/mach-omap1/board-perseus2.c
+++ b/arch/arm/mach-omap1/board-perseus2.c
@@ -339,6 +339,7 @@ MACHINE_START(OMAP_PERSEUS2, "OMAP730 Perseus2")
339 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 339 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
340 .boot_params = 0x10000100, 340 .boot_params = 0x10000100,
341 .map_io = omap_perseus2_map_io, 341 .map_io = omap_perseus2_map_io,
342 .reserve = omap_reserve,
342 .init_irq = omap_perseus2_init_irq, 343 .init_irq = omap_perseus2_init_irq,
343 .init_machine = omap_perseus2_init, 344 .init_machine = omap_perseus2_init,
344 .timer = &omap_timer, 345 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap1/board-sx1.c b/arch/arm/mach-omap1/board-sx1.c
index 2fb1e5f8e2ec..995566b862bb 100644
--- a/arch/arm/mach-omap1/board-sx1.c
+++ b/arch/arm/mach-omap1/board-sx1.c
@@ -423,7 +423,8 @@ MACHINE_START(SX1, "OMAP310 based Siemens SX1")
423 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 423 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
424 .boot_params = 0x10000100, 424 .boot_params = 0x10000100,
425 .map_io = omap_sx1_map_io, 425 .map_io = omap_sx1_map_io,
426 .init_irq = omap_sx1_init_irq, 426 .reserve = omap_reserve,
427 .init_irq = omap_sx1_init_irq,
427 .init_machine = omap_sx1_init, 428 .init_machine = omap_sx1_init,
428 .timer = &omap_timer, 429 .timer = &omap_timer,
429MACHINE_END 430MACHINE_END
diff --git a/arch/arm/mach-omap1/board-voiceblue.c b/arch/arm/mach-omap1/board-voiceblue.c
index 87b9436fe7c0..4c483dc1de5c 100644
--- a/arch/arm/mach-omap1/board-voiceblue.c
+++ b/arch/arm/mach-omap1/board-voiceblue.c
@@ -287,6 +287,7 @@ MACHINE_START(VOICEBLUE, "VoiceBlue OMAP5910")
287 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc, 287 .io_pg_offst = ((0xfef00000) >> 18) & 0xfffc,
288 .boot_params = 0x10000100, 288 .boot_params = 0x10000100,
289 .map_io = voiceblue_map_io, 289 .map_io = voiceblue_map_io,
290 .reserve = omap_reserve,
290 .init_irq = voiceblue_init_irq, 291 .init_irq = voiceblue_init_irq,
291 .init_machine = voiceblue_init, 292 .init_machine = voiceblue_init,
292 .timer = &omap_timer, 293 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap1/io.c b/arch/arm/mach-omap1/io.c
index d9b8d82530ae..0ce3fec2d257 100644
--- a/arch/arm/mach-omap1/io.c
+++ b/arch/arm/mach-omap1/io.c
@@ -22,7 +22,6 @@
22 22
23extern void omap_check_revision(void); 23extern void omap_check_revision(void);
24extern void omap_sram_init(void); 24extern void omap_sram_init(void);
25extern void omapfb_reserve_sdram(void);
26 25
27/* 26/*
28 * The machine specific code may provide the extra mapping besides the 27 * The machine specific code may provide the extra mapping besides the
@@ -122,7 +121,6 @@ void __init omap1_map_common_io(void)
122#endif 121#endif
123 122
124 omap_sram_init(); 123 omap_sram_init();
125 omapfb_reserve_sdram();
126} 124}
127 125
128/* 126/*
diff --git a/arch/arm/mach-omap2/board-2430sdp.c b/arch/arm/mach-omap2/board-2430sdp.c
index a11a575745e4..42f49f785c93 100644
--- a/arch/arm/mach-omap2/board-2430sdp.c
+++ b/arch/arm/mach-omap2/board-2430sdp.c
@@ -248,6 +248,7 @@ MACHINE_START(OMAP_2430SDP, "OMAP2430 sdp2430 board")
248 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 248 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
249 .boot_params = 0x80000100, 249 .boot_params = 0x80000100,
250 .map_io = omap_2430sdp_map_io, 250 .map_io = omap_2430sdp_map_io,
251 .reserve = omap_reserve,
251 .init_irq = omap_2430sdp_init_irq, 252 .init_irq = omap_2430sdp_init_irq,
252 .init_machine = omap_2430sdp_init, 253 .init_machine = omap_2430sdp_init,
253 .timer = &omap_timer, 254 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-3430sdp.c b/arch/arm/mach-omap2/board-3430sdp.c
index f474a80b8867..dd9c03171a19 100644
--- a/arch/arm/mach-omap2/board-3430sdp.c
+++ b/arch/arm/mach-omap2/board-3430sdp.c
@@ -815,6 +815,7 @@ MACHINE_START(OMAP_3430SDP, "OMAP3430 3430SDP board")
815 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 815 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
816 .boot_params = 0x80000100, 816 .boot_params = 0x80000100,
817 .map_io = omap_3430sdp_map_io, 817 .map_io = omap_3430sdp_map_io,
818 .reserve = omap_reserve,
818 .init_irq = omap_3430sdp_init_irq, 819 .init_irq = omap_3430sdp_init_irq,
819 .init_machine = omap_3430sdp_init, 820 .init_machine = omap_3430sdp_init,
820 .timer = &omap_timer, 821 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-3630sdp.c b/arch/arm/mach-omap2/board-3630sdp.c
index 504d2bd222fe..57290fb3fcd7 100644
--- a/arch/arm/mach-omap2/board-3630sdp.c
+++ b/arch/arm/mach-omap2/board-3630sdp.c
@@ -108,6 +108,7 @@ MACHINE_START(OMAP_3630SDP, "OMAP 3630SDP board")
108 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 108 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
109 .boot_params = 0x80000100, 109 .boot_params = 0x80000100,
110 .map_io = omap_sdp_map_io, 110 .map_io = omap_sdp_map_io,
111 .reserve = omap_reserve,
111 .init_irq = omap_sdp_init_irq, 112 .init_irq = omap_sdp_init_irq,
112 .init_machine = omap_sdp_init, 113 .init_machine = omap_sdp_init,
113 .timer = &omap_timer, 114 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index e4a5d66b83b8..4bb2c5d151ec 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -402,6 +402,7 @@ MACHINE_START(OMAP_4430SDP, "OMAP4430 4430SDP board")
402 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 402 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
403 .boot_params = 0x80000100, 403 .boot_params = 0x80000100,
404 .map_io = omap_4430sdp_map_io, 404 .map_io = omap_4430sdp_map_io,
405 .reserve = omap_reserve,
405 .init_irq = omap_4430sdp_init_irq, 406 .init_irq = omap_4430sdp_init_irq,
406 .init_machine = omap_4430sdp_init, 407 .init_machine = omap_4430sdp_init,
407 .timer = &omap_timer, 408 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-am3517evm.c b/arch/arm/mach-omap2/board-am3517evm.c
index af383a876943..7da92defcde0 100644
--- a/arch/arm/mach-omap2/board-am3517evm.c
+++ b/arch/arm/mach-omap2/board-am3517evm.c
@@ -472,6 +472,7 @@ MACHINE_START(OMAP3517EVM, "OMAP3517/AM3517 EVM")
472 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 472 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
473 .boot_params = 0x80000100, 473 .boot_params = 0x80000100,
474 .map_io = am3517_evm_map_io, 474 .map_io = am3517_evm_map_io,
475 .reserve = omap_reserve,
475 .init_irq = am3517_evm_init_irq, 476 .init_irq = am3517_evm_init_irq,
476 .init_machine = am3517_evm_init, 477 .init_machine = am3517_evm_init,
477 .timer = &omap_timer, 478 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-apollon.c b/arch/arm/mach-omap2/board-apollon.c
index aa69fb999748..bd75642aee65 100644
--- a/arch/arm/mach-omap2/board-apollon.c
+++ b/arch/arm/mach-omap2/board-apollon.c
@@ -346,6 +346,7 @@ MACHINE_START(OMAP_APOLLON, "OMAP24xx Apollon")
346 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 346 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
347 .boot_params = 0x80000100, 347 .boot_params = 0x80000100,
348 .map_io = omap_apollon_map_io, 348 .map_io = omap_apollon_map_io,
349 .reserve = omap_reserve,
349 .init_irq = omap_apollon_init_irq, 350 .init_irq = omap_apollon_init_irq,
350 .init_machine = omap_apollon_init, 351 .init_machine = omap_apollon_init,
351 .timer = &omap_timer, 352 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-cm-t35.c b/arch/arm/mach-omap2/board-cm-t35.c
index e679a2cc86c3..bc4c3f807068 100644
--- a/arch/arm/mach-omap2/board-cm-t35.c
+++ b/arch/arm/mach-omap2/board-cm-t35.c
@@ -837,6 +837,7 @@ MACHINE_START(CM_T35, "Compulab CM-T35")
837 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 837 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
838 .boot_params = 0x80000100, 838 .boot_params = 0x80000100,
839 .map_io = cm_t35_map_io, 839 .map_io = cm_t35_map_io,
840 .reserve = omap_reserve,
840 .init_irq = cm_t35_init_irq, 841 .init_irq = cm_t35_init_irq,
841 .init_machine = cm_t35_init, 842 .init_machine = cm_t35_init,
842 .timer = &omap_timer, 843 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-devkit8000.c b/arch/arm/mach-omap2/board-devkit8000.c
index 77022b588816..922b7464807f 100644
--- a/arch/arm/mach-omap2/board-devkit8000.c
+++ b/arch/arm/mach-omap2/board-devkit8000.c
@@ -825,6 +825,7 @@ MACHINE_START(DEVKIT8000, "OMAP3 Devkit8000")
825 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 825 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
826 .boot_params = 0x80000100, 826 .boot_params = 0x80000100,
827 .map_io = devkit8000_map_io, 827 .map_io = devkit8000_map_io,
828 .reserve = omap_reserve,
828 .init_irq = devkit8000_init_irq, 829 .init_irq = devkit8000_init_irq,
829 .init_machine = devkit8000_init, 830 .init_machine = devkit8000_init,
830 .timer = &omap_timer, 831 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-generic.c b/arch/arm/mach-omap2/board-generic.c
index 16cc06860670..9242902d3a43 100644
--- a/arch/arm/mach-omap2/board-generic.c
+++ b/arch/arm/mach-omap2/board-generic.c
@@ -59,6 +59,7 @@ MACHINE_START(OMAP_GENERIC, "Generic OMAP24xx")
59 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 59 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
60 .boot_params = 0x80000100, 60 .boot_params = 0x80000100,
61 .map_io = omap_generic_map_io, 61 .map_io = omap_generic_map_io,
62 .reserve = omap_reserve,
62 .init_irq = omap_generic_init_irq, 63 .init_irq = omap_generic_init_irq,
63 .init_machine = omap_generic_init, 64 .init_machine = omap_generic_init,
64 .timer = &omap_timer, 65 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-h4.c b/arch/arm/mach-omap2/board-h4.c
index 0665f2c8dc8e..16703fdb3515 100644
--- a/arch/arm/mach-omap2/board-h4.c
+++ b/arch/arm/mach-omap2/board-h4.c
@@ -378,6 +378,7 @@ MACHINE_START(OMAP_H4, "OMAP2420 H4 board")
378 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 378 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
379 .boot_params = 0x80000100, 379 .boot_params = 0x80000100,
380 .map_io = omap_h4_map_io, 380 .map_io = omap_h4_map_io,
381 .reserve = omap_reserve,
381 .init_irq = omap_h4_init_irq, 382 .init_irq = omap_h4_init_irq,
382 .init_machine = omap_h4_init, 383 .init_machine = omap_h4_init,
383 .timer = &omap_timer, 384 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-igep0020.c b/arch/arm/mach-omap2/board-igep0020.c
index d55c57b761a9..759e39d1a702 100644
--- a/arch/arm/mach-omap2/board-igep0020.c
+++ b/arch/arm/mach-omap2/board-igep0020.c
@@ -543,6 +543,7 @@ MACHINE_START(IGEP0020, "IGEP v2 board")
543 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 543 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
544 .boot_params = 0x80000100, 544 .boot_params = 0x80000100,
545 .map_io = igep2_map_io, 545 .map_io = igep2_map_io,
546 .reserve = omap_reserve,
546 .init_irq = igep2_init_irq, 547 .init_irq = igep2_init_irq,
547 .init_machine = igep2_init, 548 .init_machine = igep2_init,
548 .timer = &omap_timer, 549 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index fefd7e6e9779..9cd2669113e4 100644
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -417,6 +417,7 @@ MACHINE_START(OMAP_LDP, "OMAP LDP board")
417 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 417 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
418 .boot_params = 0x80000100, 418 .boot_params = 0x80000100,
419 .map_io = omap_ldp_map_io, 419 .map_io = omap_ldp_map_io,
420 .reserve = omap_reserve,
420 .init_irq = omap_ldp_init_irq, 421 .init_irq = omap_ldp_init_irq,
421 .init_machine = omap_ldp_init, 422 .init_machine = omap_ldp_init,
422 .timer = &omap_timer, 423 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-n8x0.c b/arch/arm/mach-omap2/board-n8x0.c
index 3ccc34ebdcc7..2565ff08a221 100644
--- a/arch/arm/mach-omap2/board-n8x0.c
+++ b/arch/arm/mach-omap2/board-n8x0.c
@@ -667,6 +667,7 @@ MACHINE_START(NOKIA_N800, "Nokia N800")
667 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 667 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
668 .boot_params = 0x80000100, 668 .boot_params = 0x80000100,
669 .map_io = n8x0_map_io, 669 .map_io = n8x0_map_io,
670 .reserve = omap_reserve,
670 .init_irq = n8x0_init_irq, 671 .init_irq = n8x0_init_irq,
671 .init_machine = n8x0_init_machine, 672 .init_machine = n8x0_init_machine,
672 .timer = &omap_timer, 673 .timer = &omap_timer,
@@ -677,6 +678,7 @@ MACHINE_START(NOKIA_N810, "Nokia N810")
677 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 678 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
678 .boot_params = 0x80000100, 679 .boot_params = 0x80000100,
679 .map_io = n8x0_map_io, 680 .map_io = n8x0_map_io,
681 .reserve = omap_reserve,
680 .init_irq = n8x0_init_irq, 682 .init_irq = n8x0_init_irq,
681 .init_machine = n8x0_init_machine, 683 .init_machine = n8x0_init_machine,
682 .timer = &omap_timer, 684 .timer = &omap_timer,
@@ -687,6 +689,7 @@ MACHINE_START(NOKIA_N810_WIMAX, "Nokia N810 WiMAX")
687 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 689 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
688 .boot_params = 0x80000100, 690 .boot_params = 0x80000100,
689 .map_io = n8x0_map_io, 691 .map_io = n8x0_map_io,
692 .reserve = omap_reserve,
690 .init_irq = n8x0_init_irq, 693 .init_irq = n8x0_init_irq,
691 .init_machine = n8x0_init_machine, 694 .init_machine = n8x0_init_machine,
692 .timer = &omap_timer, 695 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c
index 69b154cdc75d..0ab0c26db4dd 100644
--- a/arch/arm/mach-omap2/board-omap3beagle.c
+++ b/arch/arm/mach-omap2/board-omap3beagle.c
@@ -519,6 +519,7 @@ MACHINE_START(OMAP3_BEAGLE, "OMAP3 Beagle Board")
519 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 519 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
520 .boot_params = 0x80000100, 520 .boot_params = 0x80000100,
521 .map_io = omap3_beagle_map_io, 521 .map_io = omap3_beagle_map_io,
522 .reserve = omap_reserve,
522 .init_irq = omap3_beagle_init_irq, 523 .init_irq = omap3_beagle_init_irq,
523 .init_machine = omap3_beagle_init, 524 .init_machine = omap3_beagle_init,
524 .timer = &omap_timer, 525 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-omap3evm.c b/arch/arm/mach-omap2/board-omap3evm.c
index b95261013812..a3d2e285e116 100644
--- a/arch/arm/mach-omap2/board-omap3evm.c
+++ b/arch/arm/mach-omap2/board-omap3evm.c
@@ -727,6 +727,7 @@ MACHINE_START(OMAP3EVM, "OMAP3 EVM")
727 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 727 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
728 .boot_params = 0x80000100, 728 .boot_params = 0x80000100,
729 .map_io = omap3_evm_map_io, 729 .map_io = omap3_evm_map_io,
730 .reserve = omap_reserve,
730 .init_irq = omap3_evm_init_irq, 731 .init_irq = omap3_evm_init_irq,
731 .init_machine = omap3_evm_init, 732 .init_machine = omap3_evm_init,
732 .timer = &omap_timer, 733 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-omap3pandora.c b/arch/arm/mach-omap2/board-omap3pandora.c
index db06dc910ba7..c0f4f12eba54 100644
--- a/arch/arm/mach-omap2/board-omap3pandora.c
+++ b/arch/arm/mach-omap2/board-omap3pandora.c
@@ -601,6 +601,7 @@ MACHINE_START(OMAP3_PANDORA, "Pandora Handheld Console")
601 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 601 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
602 .boot_params = 0x80000100, 602 .boot_params = 0x80000100,
603 .map_io = omap3pandora_map_io, 603 .map_io = omap3pandora_map_io,
604 .reserve = omap_reserve,
604 .init_irq = omap3pandora_init_irq, 605 .init_irq = omap3pandora_init_irq,
605 .init_machine = omap3pandora_init, 606 .init_machine = omap3pandora_init,
606 .timer = &omap_timer, 607 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-omap3touchbook.c b/arch/arm/mach-omap2/board-omap3touchbook.c
index 2f5f8233dd5b..f05b867c5851 100644
--- a/arch/arm/mach-omap2/board-omap3touchbook.c
+++ b/arch/arm/mach-omap2/board-omap3touchbook.c
@@ -571,6 +571,7 @@ MACHINE_START(TOUCHBOOK, "OMAP3 touchbook Board")
571 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc, 571 .io_pg_offst = ((0xd8000000) >> 18) & 0xfffc,
572 .boot_params = 0x80000100, 572 .boot_params = 0x80000100,
573 .map_io = omap3_touchbook_map_io, 573 .map_io = omap3_touchbook_map_io,
574 .reserve = omap_reserve,
574 .init_irq = omap3_touchbook_init_irq, 575 .init_irq = omap3_touchbook_init_irq,
575 .init_machine = omap3_touchbook_init, 576 .init_machine = omap3_touchbook_init,
576 .timer = &omap_timer, 577 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-overo.c b/arch/arm/mach-omap2/board-overo.c
index 79ac41400c21..87acb2f198ec 100644
--- a/arch/arm/mach-omap2/board-overo.c
+++ b/arch/arm/mach-omap2/board-overo.c
@@ -495,6 +495,7 @@ MACHINE_START(OVERO, "Gumstix Overo")
495 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 495 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
496 .boot_params = 0x80000100, 496 .boot_params = 0x80000100,
497 .map_io = overo_map_io, 497 .map_io = overo_map_io,
498 .reserve = omap_reserve,
498 .init_irq = overo_init_irq, 499 .init_irq = overo_init_irq,
499 .init_machine = overo_init, 500 .init_machine = overo_init,
500 .timer = &omap_timer, 501 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-rx51.c b/arch/arm/mach-omap2/board-rx51.c
index 1b86b5bb87a2..3bd956f9e19f 100644
--- a/arch/arm/mach-omap2/board-rx51.c
+++ b/arch/arm/mach-omap2/board-rx51.c
@@ -154,6 +154,7 @@ MACHINE_START(NOKIA_RX51, "Nokia RX-51 board")
154 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc, 154 .io_pg_offst = ((0xfa000000) >> 18) & 0xfffc,
155 .boot_params = 0x80000100, 155 .boot_params = 0x80000100,
156 .map_io = rx51_map_io, 156 .map_io = rx51_map_io,
157 .reserve = omap_reserve,
157 .init_irq = rx51_init_irq, 158 .init_irq = rx51_init_irq,
158 .init_machine = rx51_init, 159 .init_machine = rx51_init,
159 .timer = &omap_timer, 160 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-zoom2.c b/arch/arm/mach-omap2/board-zoom2.c
index 803ef14cbf2d..ffe188cb18e9 100644
--- a/arch/arm/mach-omap2/board-zoom2.c
+++ b/arch/arm/mach-omap2/board-zoom2.c
@@ -95,6 +95,7 @@ MACHINE_START(OMAP_ZOOM2, "OMAP Zoom2 board")
95 .io_pg_offst = (ZOOM_UART_VIRT >> 18) & 0xfffc, 95 .io_pg_offst = (ZOOM_UART_VIRT >> 18) & 0xfffc,
96 .boot_params = 0x80000100, 96 .boot_params = 0x80000100,
97 .map_io = omap_zoom2_map_io, 97 .map_io = omap_zoom2_map_io,
98 .reserve = omap_reserve,
98 .init_irq = omap_zoom2_init_irq, 99 .init_irq = omap_zoom2_init_irq,
99 .init_machine = omap_zoom2_init, 100 .init_machine = omap_zoom2_init,
100 .timer = &omap_timer, 101 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/board-zoom3.c b/arch/arm/mach-omap2/board-zoom3.c
index 33147042485f..5b605eba3e7b 100644
--- a/arch/arm/mach-omap2/board-zoom3.c
+++ b/arch/arm/mach-omap2/board-zoom3.c
@@ -77,6 +77,7 @@ MACHINE_START(OMAP_ZOOM3, "OMAP Zoom3 board")
77 .io_pg_offst = (ZOOM_UART_VIRT >> 18) & 0xfffc, 77 .io_pg_offst = (ZOOM_UART_VIRT >> 18) & 0xfffc,
78 .boot_params = 0x80000100, 78 .boot_params = 0x80000100,
79 .map_io = omap_zoom_map_io, 79 .map_io = omap_zoom_map_io,
80 .reserve = omap_reserve,
80 .init_irq = omap_zoom_init_irq, 81 .init_irq = omap_zoom_init_irq,
81 .init_machine = omap_zoom_init, 82 .init_machine = omap_zoom_init,
82 .timer = &omap_timer, 83 .timer = &omap_timer,
diff --git a/arch/arm/mach-omap2/clock3xxx_data.c b/arch/arm/mach-omap2/clock3xxx_data.c
index 41b155acfca7..d33744117ce2 100644
--- a/arch/arm/mach-omap2/clock3xxx_data.c
+++ b/arch/arm/mach-omap2/clock3xxx_data.c
@@ -3166,6 +3166,10 @@ static struct clk uart4_ick_am35xx = {
3166 .recalc = &followparent_recalc, 3166 .recalc = &followparent_recalc,
3167}; 3167};
3168 3168
3169static struct clk dummy_apb_pclk = {
3170 .name = "apb_pclk",
3171 .ops = &clkops_null,
3172};
3169 3173
3170/* 3174/*
3171 * clkdev 3175 * clkdev
@@ -3173,6 +3177,7 @@ static struct clk uart4_ick_am35xx = {
3173 3177
3174/* XXX At some point we should rename this file to clock3xxx_data.c */ 3178/* XXX At some point we should rename this file to clock3xxx_data.c */
3175static struct omap_clk omap3xxx_clks[] = { 3179static struct omap_clk omap3xxx_clks[] = {
3180 CLK(NULL, "apb_pclk", &dummy_apb_pclk, CK_3XXX),
3176 CLK(NULL, "omap_32k_fck", &omap_32k_fck, CK_3XXX), 3181 CLK(NULL, "omap_32k_fck", &omap_32k_fck, CK_3XXX),
3177 CLK(NULL, "virt_12m_ck", &virt_12m_ck, CK_3XXX), 3182 CLK(NULL, "virt_12m_ck", &virt_12m_ck, CK_3XXX),
3178 CLK(NULL, "virt_13m_ck", &virt_13m_ck, CK_3XXX), 3183 CLK(NULL, "virt_13m_ck", &virt_13m_ck, CK_3XXX),
diff --git a/arch/arm/mach-omap2/dpll3xxx.c b/arch/arm/mach-omap2/dpll3xxx.c
index b32ccd954a1b..ed8d330522f1 100644
--- a/arch/arm/mach-omap2/dpll3xxx.c
+++ b/arch/arm/mach-omap2/dpll3xxx.c
@@ -463,7 +463,7 @@ int omap3_noncore_dpll_set_rate(struct clk *clk, unsigned long rate)
463 } 463 }
464 if (!ret) { 464 if (!ret) {
465 /* 465 /*
466 * Switch the parent clock in the heirarchy, and make sure 466 * Switch the parent clock in the hierarchy, and make sure
467 * that the new parent's usecount is correct. Note: we 467 * that the new parent's usecount is correct. Note: we
468 * enable the new parent before disabling the old to avoid 468 * enable the new parent before disabling the old to avoid
469 * any unnecessary hardware disable->enable transitions. 469 * any unnecessary hardware disable->enable transitions.
diff --git a/arch/arm/mach-omap2/io.c b/arch/arm/mach-omap2/io.c
index 3cfb425ea67e..4e1f53d0b880 100644
--- a/arch/arm/mach-omap2/io.c
+++ b/arch/arm/mach-omap2/io.c
@@ -33,7 +33,6 @@
33#include <plat/sdrc.h> 33#include <plat/sdrc.h>
34#include <plat/gpmc.h> 34#include <plat/gpmc.h>
35#include <plat/serial.h> 35#include <plat/serial.h>
36#include <plat/vram.h>
37 36
38#include "clock2xxx.h" 37#include "clock2xxx.h"
39#include "clock3xxx.h" 38#include "clock3xxx.h"
@@ -241,8 +240,6 @@ static void __init _omap2_map_common_io(void)
241 240
242 omap2_check_revision(); 241 omap2_check_revision();
243 omap_sram_init(); 242 omap_sram_init();
244 omapfb_reserve_sdram();
245 omap_vram_reserve_sdram();
246} 243}
247 244
248#ifdef CONFIG_ARCH_OMAP2420 245#ifdef CONFIG_ARCH_OMAP2420
diff --git a/arch/arm/mach-omap2/sleep34xx.S b/arch/arm/mach-omap2/sleep34xx.S
index d522cd70bf53..ba53191ae4c5 100644
--- a/arch/arm/mach-omap2/sleep34xx.S
+++ b/arch/arm/mach-omap2/sleep34xx.S
@@ -60,7 +60,7 @@
60#define SDRC_DLLA_CTRL_V OMAP34XX_SDRC_REGADDR(SDRC_DLLA_CTRL) 60#define SDRC_DLLA_CTRL_V OMAP34XX_SDRC_REGADDR(SDRC_DLLA_CTRL)
61 61
62 .text 62 .text
63/* Function to aquire the semaphore in scratchpad */ 63/* Function to acquire the semaphore in scratchpad */
64ENTRY(lock_scratchpad_sem) 64ENTRY(lock_scratchpad_sem)
65 stmfd sp!, {lr} @ save registers on stack 65 stmfd sp!, {lr} @ save registers on stack
66wait_sem: 66wait_sem:
diff --git a/arch/arm/mach-orion5x/Kconfig b/arch/arm/mach-orion5x/Kconfig
index 905719a677ae..c897e03e413d 100644
--- a/arch/arm/mach-orion5x/Kconfig
+++ b/arch/arm/mach-orion5x/Kconfig
@@ -26,6 +26,7 @@ config MACH_KUROBOX_PRO
26config MACH_DNS323 26config MACH_DNS323
27 bool "D-Link DNS-323" 27 bool "D-Link DNS-323"
28 select I2C_BOARDINFO 28 select I2C_BOARDINFO
29 select PHYLIB
29 help 30 help
30 Say 'Y' here if you want your kernel to support the 31 Say 'Y' here if you want your kernel to support the
31 D-Link DNS-323 platform. 32 D-Link DNS-323 platform.
diff --git a/arch/arm/mach-orion5x/dns323-setup.c b/arch/arm/mach-orion5x/dns323-setup.c
index fe0de1698edc..a47100d46a4e 100644
--- a/arch/arm/mach-orion5x/dns323-setup.c
+++ b/arch/arm/mach-orion5x/dns323-setup.c
@@ -3,6 +3,10 @@
3 * 3 *
4 * Copyright (C) 2007 Herbert Valerio Riedel <hvr@gnu.org> 4 * Copyright (C) 2007 Herbert Valerio Riedel <hvr@gnu.org>
5 * 5 *
6 * Support for HW Rev C1:
7 *
8 * Copyright (C) 2010 Benjamin Herrenschmidt <benh@kernel.crashing.org>
9 *
6 * This program is free software; you can redistribute it and/or modify 10 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General Public License as 11 * it under the terms of the GNU Lesser General Public License as
8 * published by the Free Software Foundation; either version 2 of the 12 * published by the Free Software Foundation; either version 2 of the
@@ -23,6 +27,8 @@
23#include <linux/input.h> 27#include <linux/input.h>
24#include <linux/i2c.h> 28#include <linux/i2c.h>
25#include <linux/ata_platform.h> 29#include <linux/ata_platform.h>
30#include <linux/phy.h>
31#include <linux/marvell_phy.h>
26#include <asm/mach-types.h> 32#include <asm/mach-types.h>
27#include <asm/gpio.h> 33#include <asm/gpio.h>
28#include <asm/mach/arch.h> 34#include <asm/mach/arch.h>
@@ -31,6 +37,7 @@
31#include "common.h" 37#include "common.h"
32#include "mpp.h" 38#include "mpp.h"
33 39
40/* Rev A1 and B1 */
34#define DNS323_GPIO_LED_RIGHT_AMBER 1 41#define DNS323_GPIO_LED_RIGHT_AMBER 1
35#define DNS323_GPIO_LED_LEFT_AMBER 2 42#define DNS323_GPIO_LED_LEFT_AMBER 2
36#define DNS323_GPIO_SYSTEM_UP 3 43#define DNS323_GPIO_SYSTEM_UP 3
@@ -42,6 +49,23 @@
42#define DNS323_GPIO_KEY_POWER 9 49#define DNS323_GPIO_KEY_POWER 9
43#define DNS323_GPIO_KEY_RESET 10 50#define DNS323_GPIO_KEY_RESET 10
44 51
52/* Rev C1 */
53#define DNS323C_GPIO_KEY_POWER 1
54#define DNS323C_GPIO_POWER_OFF 2
55#define DNS323C_GPIO_LED_RIGHT_AMBER 8
56#define DNS323C_GPIO_LED_LEFT_AMBER 9
57#define DNS323C_GPIO_LED_POWER 17
58#define DNS323C_GPIO_FAN_BIT1 18
59#define DNS323C_GPIO_FAN_BIT0 19
60
61/* Exposed to userspace, do not change */
62enum {
63 DNS323_REV_A1, /* 0 */
64 DNS323_REV_B1, /* 1 */
65 DNS323_REV_C1, /* 2 */
66};
67
68
45/**************************************************************************** 69/****************************************************************************
46 * PCI setup 70 * PCI setup
47 */ 71 */
@@ -68,21 +92,12 @@ static struct hw_pci dns323_pci __initdata = {
68 .map_irq = dns323_pci_map_irq, 92 .map_irq = dns323_pci_map_irq,
69}; 93};
70 94
71static int __init dns323_dev_id(void)
72{
73 u32 dev, rev;
74
75 orion5x_pcie_id(&dev, &rev);
76
77 return dev;
78}
79
80static int __init dns323_pci_init(void) 95static int __init dns323_pci_init(void)
81{ 96{
82 /* The 5182 doesn't really use its PCI bus, and initialising PCI 97 /* Rev B1 and C1 doesn't really use its PCI bus, and initialising PCI
83 * gets in the way of initialising the SATA controller. 98 * gets in the way of initialising the SATA controller.
84 */ 99 */
85 if (machine_is_dns323() && dns323_dev_id() != MV88F5182_DEV_ID) 100 if (machine_is_dns323() && system_rev == DNS323_REV_A1)
86 pci_common_init(&dns323_pci); 101 pci_common_init(&dns323_pci);
87 102
88 return 0; 103 return 0;
@@ -221,7 +236,7 @@ static int __init dns323_read_mac_addr(void)
221 } 236 }
222 237
223 iounmap(mac_page); 238 iounmap(mac_page);
224 printk("DNS323: Found ethernet MAC address: "); 239 printk("DNS-323: Found ethernet MAC address: ");
225 for (i = 0; i < 6; i++) 240 for (i = 0; i < 6; i++)
226 printk("%.2x%s", addr[i], (i < 5) ? ":" : ".\n"); 241 printk("%.2x%s", addr[i], (i < 5) ? ":" : ".\n");
227 242
@@ -259,12 +274,11 @@ static int dns323_gpio_blink_set(unsigned gpio, int state,
259 return 0; 274 return 0;
260} 275}
261 276
262static struct gpio_led dns323_leds[] = { 277static struct gpio_led dns323ab_leds[] = {
263 { 278 {
264 .name = "power:blue", 279 .name = "power:blue",
265 .gpio = DNS323_GPIO_LED_POWER2, 280 .gpio = DNS323_GPIO_LED_POWER2,
266 .default_trigger = "timer", 281 .default_trigger = "default-on",
267 .active_low = 1,
268 }, { 282 }, {
269 .name = "right:amber", 283 .name = "right:amber",
270 .gpio = DNS323_GPIO_LED_RIGHT_AMBER, 284 .gpio = DNS323_GPIO_LED_RIGHT_AMBER,
@@ -276,9 +290,34 @@ static struct gpio_led dns323_leds[] = {
276 }, 290 },
277}; 291};
278 292
279static struct gpio_led_platform_data dns323_led_data = { 293
280 .num_leds = ARRAY_SIZE(dns323_leds), 294static struct gpio_led dns323c_leds[] = {
281 .leds = dns323_leds, 295 {
296 .name = "power:blue",
297 .gpio = DNS323C_GPIO_LED_POWER,
298 .default_trigger = "timer",
299 .active_low = 1,
300 }, {
301 .name = "right:amber",
302 .gpio = DNS323C_GPIO_LED_RIGHT_AMBER,
303 .active_low = 1,
304 }, {
305 .name = "left:amber",
306 .gpio = DNS323C_GPIO_LED_LEFT_AMBER,
307 .active_low = 1,
308 },
309};
310
311
312static struct gpio_led_platform_data dns323ab_led_data = {
313 .num_leds = ARRAY_SIZE(dns323ab_leds),
314 .leds = dns323ab_leds,
315 .gpio_blink_set = dns323_gpio_blink_set,
316};
317
318static struct gpio_led_platform_data dns323c_led_data = {
319 .num_leds = ARRAY_SIZE(dns323c_leds),
320 .leds = dns323c_leds,
282 .gpio_blink_set = dns323_gpio_blink_set, 321 .gpio_blink_set = dns323_gpio_blink_set,
283}; 322};
284 323
@@ -286,7 +325,7 @@ static struct platform_device dns323_gpio_leds = {
286 .name = "leds-gpio", 325 .name = "leds-gpio",
287 .id = -1, 326 .id = -1,
288 .dev = { 327 .dev = {
289 .platform_data = &dns323_led_data, 328 .platform_data = &dns323ab_led_data,
290 }, 329 },
291}; 330};
292 331
@@ -294,7 +333,7 @@ static struct platform_device dns323_gpio_leds = {
294 * GPIO Attached Keys 333 * GPIO Attached Keys
295 */ 334 */
296 335
297static struct gpio_keys_button dns323_buttons[] = { 336static struct gpio_keys_button dns323ab_buttons[] = {
298 { 337 {
299 .code = KEY_RESTART, 338 .code = KEY_RESTART,
300 .gpio = DNS323_GPIO_KEY_RESET, 339 .gpio = DNS323_GPIO_KEY_RESET,
@@ -308,9 +347,23 @@ static struct gpio_keys_button dns323_buttons[] = {
308 }, 347 },
309}; 348};
310 349
311static struct gpio_keys_platform_data dns323_button_data = { 350static struct gpio_keys_platform_data dns323ab_button_data = {
312 .buttons = dns323_buttons, 351 .buttons = dns323ab_buttons,
313 .nbuttons = ARRAY_SIZE(dns323_buttons), 352 .nbuttons = ARRAY_SIZE(dns323ab_buttons),
353};
354
355static struct gpio_keys_button dns323c_buttons[] = {
356 {
357 .code = KEY_POWER,
358 .gpio = DNS323C_GPIO_KEY_POWER,
359 .desc = "Power Button",
360 .active_low = 1,
361 },
362};
363
364static struct gpio_keys_platform_data dns323c_button_data = {
365 .buttons = dns323c_buttons,
366 .nbuttons = ARRAY_SIZE(dns323c_buttons),
314}; 367};
315 368
316static struct platform_device dns323_button_device = { 369static struct platform_device dns323_button_device = {
@@ -318,7 +371,7 @@ static struct platform_device dns323_button_device = {
318 .id = -1, 371 .id = -1,
319 .num_resources = 0, 372 .num_resources = 0,
320 .dev = { 373 .dev = {
321 .platform_data = &dns323_button_data, 374 .platform_data = &dns323ab_button_data,
322 }, 375 },
323}; 376};
324 377
@@ -332,7 +385,7 @@ static struct mv_sata_platform_data dns323_sata_data = {
332/**************************************************************************** 385/****************************************************************************
333 * General Setup 386 * General Setup
334 */ 387 */
335static struct orion5x_mpp_mode dns323_mv88f5181_mpp_modes[] __initdata = { 388static struct orion5x_mpp_mode dns323a_mpp_modes[] __initdata = {
336 { 0, MPP_PCIE_RST_OUTn }, 389 { 0, MPP_PCIE_RST_OUTn },
337 { 1, MPP_GPIO }, /* right amber LED (sata ch0) */ 390 { 1, MPP_GPIO }, /* right amber LED (sata ch0) */
338 { 2, MPP_GPIO }, /* left amber LED (sata ch1) */ 391 { 2, MPP_GPIO }, /* left amber LED (sata ch1) */
@@ -356,7 +409,7 @@ static struct orion5x_mpp_mode dns323_mv88f5181_mpp_modes[] __initdata = {
356 { -1 }, 409 { -1 },
357}; 410};
358 411
359static struct orion5x_mpp_mode dns323_mv88f5182_mpp_modes[] __initdata = { 412static struct orion5x_mpp_mode dns323b_mpp_modes[] __initdata = {
360 { 0, MPP_UNUSED }, 413 { 0, MPP_UNUSED },
361 { 1, MPP_GPIO }, /* right amber LED (sata ch0) */ 414 { 1, MPP_GPIO }, /* right amber LED (sata ch0) */
362 { 2, MPP_GPIO }, /* left amber LED (sata ch1) */ 415 { 2, MPP_GPIO }, /* left amber LED (sata ch1) */
@@ -380,15 +433,57 @@ static struct orion5x_mpp_mode dns323_mv88f5182_mpp_modes[] __initdata = {
380 { -1 }, 433 { -1 },
381}; 434};
382 435
436static struct orion5x_mpp_mode dns323c_mpp_modes[] __initdata = {
437 { 0, MPP_GPIO }, /* ? input */
438 { 1, MPP_GPIO }, /* input power switch (0 = pressed) */
439 { 2, MPP_GPIO }, /* output power off */
440 { 3, MPP_UNUSED }, /* ? output */
441 { 4, MPP_UNUSED }, /* ? output */
442 { 5, MPP_UNUSED }, /* ? output */
443 { 6, MPP_UNUSED }, /* ? output */
444 { 7, MPP_UNUSED }, /* ? output */
445 { 8, MPP_GPIO }, /* i/o right amber LED */
446 { 9, MPP_GPIO }, /* i/o left amber LED */
447 { 10, MPP_GPIO }, /* input */
448 { 11, MPP_UNUSED },
449 { 12, MPP_SATA_LED },
450 { 13, MPP_SATA_LED },
451 { 14, MPP_SATA_LED },
452 { 15, MPP_SATA_LED },
453 { 16, MPP_UNUSED },
454 { 17, MPP_GPIO }, /* power button LED */
455 { 18, MPP_GPIO }, /* fan speed bit 0 */
456 { 19, MPP_GPIO }, /* fan speed bit 1 */
457 { -1 },
458};
459
460/* Rev C1 Fan speed notes:
461 *
462 * The fan is controlled by 2 GPIOs on this board. The settings
463 * of the bits is as follow:
464 *
465 * GPIO 18 GPIO 19 Fan
466 *
467 * 0 0 stopped
468 * 0 1 low speed
469 * 1 0 high speed
470 * 1 1 don't do that (*)
471 *
472 * (*) I think the two bits control two feed-in resistors into a fixed
473 * PWN circuit, setting both bits will basically go a 'bit' faster
474 * than high speed, but d-link doesn't do it and you may get out of
475 * HW spec so don't do it.
476 */
477
383/* 478/*
384 * On the DNS-323 the following devices are attached via I2C: 479 * On the DNS-323 A1 and B1 the following devices are attached via I2C:
385 * 480 *
386 * i2c addr | chip | description 481 * i2c addr | chip | description
387 * 0x3e | GMT G760Af | fan speed PWM controller 482 * 0x3e | GMT G760Af | fan speed PWM controller
388 * 0x48 | GMT G751-2f | temp. sensor and therm. watchdog (LM75 compatible) 483 * 0x48 | GMT G751-2f | temp. sensor and therm. watchdog (LM75 compatible)
389 * 0x68 | ST M41T80 | RTC w/ alarm 484 * 0x68 | ST M41T80 | RTC w/ alarm
390 */ 485 */
391static struct i2c_board_info __initdata dns323_i2c_devices[] = { 486static struct i2c_board_info __initdata dns323ab_i2c_devices[] = {
392 { 487 {
393 I2C_BOARD_INFO("g760a", 0x3e), 488 I2C_BOARD_INFO("g760a", 0x3e),
394 }, { 489 }, {
@@ -398,36 +493,140 @@ static struct i2c_board_info __initdata dns323_i2c_devices[] = {
398 }, 493 },
399}; 494};
400 495
496/*
497 * On the DNS-323 C1 the following devices are attached via I2C:
498 *
499 * i2c addr | chip | description
500 * 0x48 | GMT G751-2f | temp. sensor and therm. watchdog (LM75 compatible)
501 * 0x68 | ST M41T80 | RTC w/ alarm
502 */
503static struct i2c_board_info __initdata dns323c_i2c_devices[] = {
504 {
505 I2C_BOARD_INFO("lm75", 0x48),
506 }, {
507 I2C_BOARD_INFO("m41t80", 0x68),
508 },
509};
510
401/* DNS-323 rev. A specific power off method */ 511/* DNS-323 rev. A specific power off method */
402static void dns323a_power_off(void) 512static void dns323a_power_off(void)
403{ 513{
404 pr_info("%s: triggering power-off...\n", __func__); 514 pr_info("DNS-323: Triggering power-off...\n");
405 gpio_set_value(DNS323_GPIO_POWER_OFF, 1); 515 gpio_set_value(DNS323_GPIO_POWER_OFF, 1);
406} 516}
407 517
408/* DNS-323 rev B specific power off method */ 518/* DNS-323 rev B specific power off method */
409static void dns323b_power_off(void) 519static void dns323b_power_off(void)
410{ 520{
411 pr_info("%s: triggering power-off...\n", __func__); 521 pr_info("DNS-323: Triggering power-off...\n");
412 /* Pin has to be changed to 1 and back to 0 to do actual power off. */ 522 /* Pin has to be changed to 1 and back to 0 to do actual power off. */
413 gpio_set_value(DNS323_GPIO_POWER_OFF, 1); 523 gpio_set_value(DNS323_GPIO_POWER_OFF, 1);
414 mdelay(100); 524 mdelay(100);
415 gpio_set_value(DNS323_GPIO_POWER_OFF, 0); 525 gpio_set_value(DNS323_GPIO_POWER_OFF, 0);
416} 526}
417 527
528/* DNS-323 rev. C specific power off method */
529static void dns323c_power_off(void)
530{
531 pr_info("DNS-323: Triggering power-off...\n");
532 gpio_set_value(DNS323C_GPIO_POWER_OFF, 1);
533}
534
535static int dns323c_phy_fixup(struct phy_device *phy)
536{
537 phy->dev_flags |= MARVELL_PHY_M1118_DNS323_LEDS;
538
539 return 0;
540}
541
542static int __init dns323_identify_rev(void)
543{
544 u32 dev, rev, i, reg;
545
546 pr_debug("DNS-323: Identifying board ... \n");
547
548 /* Rev A1 has a 5181 */
549 orion5x_pcie_id(&dev, &rev);
550 if (dev == MV88F5181_DEV_ID) {
551 pr_debug("DNS-323: 5181 found, board is A1\n");
552 return DNS323_REV_A1;
553 }
554 pr_debug("DNS-323: 5182 found, board is B1 or C1, checking PHY...\n");
555
556 /* Rev B1 and C1 both have 5182, let's poke at the eth PHY. This is
557 * a bit gross but we want to do that without links into the eth
558 * driver so let's poke at it directly. We default to rev B1 in
559 * case the accesses fail
560 */
561
562#define ETH_SMI_REG (ORION5X_ETH_VIRT_BASE + 0x2000 + 0x004)
563#define SMI_BUSY 0x10000000
564#define SMI_READ_VALID 0x08000000
565#define SMI_OPCODE_READ 0x04000000
566#define SMI_OPCODE_WRITE 0x00000000
567
568 for (i = 0; i < 1000; i++) {
569 reg = readl(ETH_SMI_REG);
570 if (!(reg & SMI_BUSY))
571 break;
572 }
573 if (i >= 1000) {
574 pr_warning("DNS-323: Timeout accessing PHY, assuming rev B1\n");
575 return DNS323_REV_B1;
576 }
577 writel((3 << 21) /* phy ID reg */ |
578 (8 << 16) /* phy addr */ |
579 SMI_OPCODE_READ, ETH_SMI_REG);
580 for (i = 0; i < 1000; i++) {
581 reg = readl(ETH_SMI_REG);
582 if (reg & SMI_READ_VALID)
583 break;
584 }
585 if (i >= 1000) {
586 pr_warning("DNS-323: Timeout reading PHY, assuming rev B1\n");
587 return DNS323_REV_B1;
588 }
589 pr_debug("DNS-323: Ethernet PHY ID 0x%x\n", reg & 0xffff);
590
591 /* Note: the Marvell tools mask the ID with 0x3f0 before comparison
592 * but I don't see that making a difference here, at least with
593 * any known Marvell PHY ID
594 */
595 switch(reg & 0xfff0) {
596 case 0x0cc0: /* MV88E1111 */
597 return DNS323_REV_B1;
598 case 0x0e10: /* MV88E1118 */
599 return DNS323_REV_C1;
600 default:
601 pr_warning("DNS-323: Unknown PHY ID 0x%04x, assuming rev B1\n",
602 reg & 0xffff);
603 }
604 return DNS323_REV_B1;
605}
606
418static void __init dns323_init(void) 607static void __init dns323_init(void)
419{ 608{
420 /* Setup basic Orion functions. Need to be called early. */ 609 /* Setup basic Orion functions. Need to be called early. */
421 orion5x_init(); 610 orion5x_init();
422 611
612 /* Identify revision */
613 system_rev = dns323_identify_rev();
614 pr_info("DNS-323: Identified HW revision %c1\n", 'A' + system_rev);
615
423 /* Just to be tricky, the 5182 has a completely different 616 /* Just to be tricky, the 5182 has a completely different
424 * set of MPP modes to the 5181. 617 * set of MPP modes to the 5181.
425 */ 618 */
426 if (dns323_dev_id() == MV88F5182_DEV_ID) 619 switch(system_rev) {
427 orion5x_mpp_conf(dns323_mv88f5182_mpp_modes); 620 case DNS323_REV_A1:
428 else { 621 orion5x_mpp_conf(dns323a_mpp_modes);
429 orion5x_mpp_conf(dns323_mv88f5181_mpp_modes);
430 writel(0, MPP_DEV_CTRL); /* DEV_D[31:16] */ 622 writel(0, MPP_DEV_CTRL); /* DEV_D[31:16] */
623 break;
624 case DNS323_REV_B1:
625 orion5x_mpp_conf(dns323b_mpp_modes);
626 break;
627 case DNS323_REV_C1:
628 orion5x_mpp_conf(dns323c_mpp_modes);
629 break;
431 } 630 }
432 631
433 /* setup flash mapping 632 /* setup flash mapping
@@ -436,53 +635,96 @@ static void __init dns323_init(void)
436 orion5x_setup_dev_boot_win(DNS323_NOR_BOOT_BASE, DNS323_NOR_BOOT_SIZE); 635 orion5x_setup_dev_boot_win(DNS323_NOR_BOOT_BASE, DNS323_NOR_BOOT_SIZE);
437 platform_device_register(&dns323_nor_flash); 636 platform_device_register(&dns323_nor_flash);
438 637
439 /* The 5181 power LED is active low and requires 638 /* Sort out LEDs, Buttons and i2c devices */
440 * DNS323_GPIO_LED_POWER1 to also be low. 639 switch(system_rev) {
441 */ 640 case DNS323_REV_A1:
442 if (dns323_dev_id() == MV88F5181_DEV_ID) { 641 /* The 5181 power LED is active low and requires
443 dns323_leds[0].active_low = 1; 642 * DNS323_GPIO_LED_POWER1 to also be low.
444 gpio_request(DNS323_GPIO_LED_POWER1, "Power Led Enable"); 643 */
445 gpio_direction_output(DNS323_GPIO_LED_POWER1, 0); 644 dns323ab_leds[0].active_low = 1;
645 gpio_request(DNS323_GPIO_LED_POWER1, "Power Led Enable");
646 gpio_direction_output(DNS323_GPIO_LED_POWER1, 0);
647 /* Fall through */
648 case DNS323_REV_B1:
649 i2c_register_board_info(0, dns323ab_i2c_devices,
650 ARRAY_SIZE(dns323ab_i2c_devices));
651 break;
652 case DNS323_REV_C1:
653 /* Hookup LEDs & Buttons */
654 dns323_gpio_leds.dev.platform_data = &dns323c_led_data;
655 dns323_button_device.dev.platform_data = &dns323c_button_data;
656
657 /* Hookup i2c devices and fan driver */
658 i2c_register_board_info(0, dns323c_i2c_devices,
659 ARRAY_SIZE(dns323c_i2c_devices));
660 platform_device_register_simple("dns323c-fan", 0, NULL, 0);
661
662 /* Register fixup for the PHY LEDs */
663 phy_register_fixup_for_uid(MARVELL_PHY_ID_88E1118,
664 MARVELL_PHY_ID_MASK,
665 dns323c_phy_fixup);
446 } 666 }
447 667
448 platform_device_register(&dns323_gpio_leds); 668 platform_device_register(&dns323_gpio_leds);
449
450 platform_device_register(&dns323_button_device); 669 platform_device_register(&dns323_button_device);
451 670
452 i2c_register_board_info(0, dns323_i2c_devices,
453 ARRAY_SIZE(dns323_i2c_devices));
454
455 /* 671 /*
456 * Configure peripherals. 672 * Configure peripherals.
457 */ 673 */
458 if (dns323_read_mac_addr() < 0) 674 if (dns323_read_mac_addr() < 0)
459 printk("DNS323: Failed to read MAC address\n"); 675 printk("DNS-323: Failed to read MAC address\n");
460
461 orion5x_ehci0_init(); 676 orion5x_ehci0_init();
462 orion5x_eth_init(&dns323_eth_data); 677 orion5x_eth_init(&dns323_eth_data);
463 orion5x_i2c_init(); 678 orion5x_i2c_init();
464 orion5x_uart0_init(); 679 orion5x_uart0_init();
465 680
466 /* The 5182 has its SATA controller on-chip, and needs its own little 681 /* Remaining GPIOs */
467 * init routine. 682 switch(system_rev) {
468 */ 683 case DNS323_REV_A1:
469 if (dns323_dev_id() == MV88F5182_DEV_ID) 684 /* Poweroff GPIO */
685 if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 ||
686 gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0)
687 pr_err("DNS-323: failed to setup power-off GPIO\n");
688 pm_power_off = dns323a_power_off;
689 break;
690 case DNS323_REV_B1:
691 /* 5182 built-in SATA init */
470 orion5x_sata_init(&dns323_sata_data); 692 orion5x_sata_init(&dns323_sata_data);
471 693
472 /* The 5182 has flag to indicate the system is up. Without this flag 694 /* The DNS323 rev B1 has flag to indicate the system is up.
473 * set, power LED will flash and cannot be controlled via leds-gpio. 695 * Without this flag set, power LED will flash and cannot be
474 */ 696 * controlled via leds-gpio.
475 if (dns323_dev_id() == MV88F5182_DEV_ID) 697 */
476 gpio_set_value(DNS323_GPIO_SYSTEM_UP, 1); 698 if (gpio_request(DNS323_GPIO_SYSTEM_UP, "SYS_READY") == 0)
477 699 gpio_direction_output(DNS323_GPIO_SYSTEM_UP, 1);
478 /* Register dns323 specific power-off method */ 700
479 if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 || 701 /* Poweroff GPIO */
480 gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0) 702 if (gpio_request(DNS323_GPIO_POWER_OFF, "POWEROFF") != 0 ||
481 pr_err("DNS323: failed to setup power-off GPIO\n"); 703 gpio_direction_output(DNS323_GPIO_POWER_OFF, 0) != 0)
482 if (dns323_dev_id() == MV88F5182_DEV_ID) 704 pr_err("DNS-323: failed to setup power-off GPIO\n");
483 pm_power_off = dns323b_power_off; 705 pm_power_off = dns323b_power_off;
484 else 706 break;
485 pm_power_off = dns323a_power_off; 707 case DNS323_REV_C1:
708 /* 5182 built-in SATA init */
709 orion5x_sata_init(&dns323_sata_data);
710
711 /* Poweroff GPIO */
712 if (gpio_request(DNS323C_GPIO_POWER_OFF, "POWEROFF") != 0 ||
713 gpio_direction_output(DNS323C_GPIO_POWER_OFF, 0) != 0)
714 pr_err("DNS-323: failed to setup power-off GPIO\n");
715 pm_power_off = dns323c_power_off;
716
717 /* Now, -this- should theorically be done by the sata_mv driver
718 * once I figure out what's going on there. Maybe the behaviour
719 * of the LEDs should be somewhat passed via the platform_data.
720 * for now, just whack the register and make the LEDs happy
721 *
722 * Note: AFAIK, rev B1 needs the same treatement but I'll let
723 * somebody else test it.
724 */
725 writel(0x5, ORION5X_SATA_VIRT_BASE | 0x2c);
726 break;
727 }
486} 728}
487 729
488/* Warning: D-Link uses a wrong mach-type (=526) in their bootloader */ 730/* Warning: D-Link uses a wrong mach-type (=526) in their bootloader */
diff --git a/arch/arm/mach-orion5x/include/mach/system.h b/arch/arm/mach-orion5x/include/mach/system.h
index 60e734c10458..a1d6e46ab035 100644
--- a/arch/arm/mach-orion5x/include/mach/system.h
+++ b/arch/arm/mach-orion5x/include/mach/system.h
@@ -25,6 +25,8 @@ static inline void arch_reset(char mode, const char *cmd)
25 */ 25 */
26 orion5x_setbits(RSTOUTn_MASK, (1 << 2)); 26 orion5x_setbits(RSTOUTn_MASK, (1 << 2));
27 orion5x_setbits(CPU_SOFT_RESET, 1); 27 orion5x_setbits(CPU_SOFT_RESET, 1);
28 mdelay(200);
29 orion5x_clrbits(CPU_SOFT_RESET, 1);
28} 30}
29 31
30 32
diff --git a/arch/arm/mach-pxa/cm-x2xx-pci.c b/arch/arm/mach-pxa/cm-x2xx-pci.c
index 161fc2d61207..0f3130599770 100644
--- a/arch/arm/mach-pxa/cm-x2xx-pci.c
+++ b/arch/arm/mach-pxa/cm-x2xx-pci.c
@@ -35,7 +35,7 @@ static int cmx2xx_it8152_irq_gpio;
35 * This is really ugly and we need a better way of specifying 35 * This is really ugly and we need a better way of specifying
36 * DMA-capable regions of memory. 36 * DMA-capable regions of memory.
37 */ 37 */
38void __init cmx2xx_pci_adjust_zones(int node, unsigned long *zone_size, 38void __init cmx2xx_pci_adjust_zones(unsigned long *zone_size,
39 unsigned long *zhole_size) 39 unsigned long *zhole_size)
40{ 40{
41 unsigned int sz = SZ_64M >> PAGE_SHIFT; 41 unsigned int sz = SZ_64M >> PAGE_SHIFT;
@@ -46,7 +46,7 @@ void __init cmx2xx_pci_adjust_zones(int node, unsigned long *zone_size,
46 /* 46 /*
47 * Only adjust if > 64M on current system 47 * Only adjust if > 64M on current system
48 */ 48 */
49 if (node || (zone_size[0] <= sz)) 49 if (zone_size[0] <= sz)
50 return; 50 return;
51 51
52 zone_size[1] = zone_size[0] - sz; 52 zone_size[1] = zone_size[0] - sz;
diff --git a/arch/arm/mach-pxa/corgi.c b/arch/arm/mach-pxa/corgi.c
index 51ffa6afb675..461ba4080155 100644
--- a/arch/arm/mach-pxa/corgi.c
+++ b/arch/arm/mach-pxa/corgi.c
@@ -715,7 +715,6 @@ static void __init fixup_corgi(struct machine_desc *desc,
715 sharpsl_save_param(); 715 sharpsl_save_param();
716 mi->nr_banks=1; 716 mi->nr_banks=1;
717 mi->bank[0].start = 0xa0000000; 717 mi->bank[0].start = 0xa0000000;
718 mi->bank[0].node = 0;
719 if (machine_is_corgi()) 718 if (machine_is_corgi())
720 mi->bank[0].size = (32*1024*1024); 719 mi->bank[0].size = (32*1024*1024);
721 else 720 else
diff --git a/arch/arm/mach-pxa/eseries.c b/arch/arm/mach-pxa/eseries.c
index 96ed13081639..a0ab3082a000 100644
--- a/arch/arm/mach-pxa/eseries.c
+++ b/arch/arm/mach-pxa/eseries.c
@@ -34,7 +34,6 @@ void __init eseries_fixup(struct machine_desc *desc,
34{ 34{
35 mi->nr_banks=1; 35 mi->nr_banks=1;
36 mi->bank[0].start = 0xa0000000; 36 mi->bank[0].start = 0xa0000000;
37 mi->bank[0].node = 0;
38 if (machine_is_e800()) 37 if (machine_is_e800())
39 mi->bank[0].size = (128*1024*1024); 38 mi->bank[0].size = (128*1024*1024);
40 else 39 else
diff --git a/arch/arm/mach-pxa/generic.h b/arch/arm/mach-pxa/generic.h
index 890fb90a672f..c6305c5b8a72 100644
--- a/arch/arm/mach-pxa/generic.h
+++ b/arch/arm/mach-pxa/generic.h
@@ -26,8 +26,7 @@ extern unsigned int get_clk_frequency_khz(int info);
26 26
27#define SET_BANK(__nr,__start,__size) \ 27#define SET_BANK(__nr,__start,__size) \
28 mi->bank[__nr].start = (__start), \ 28 mi->bank[__nr].start = (__start), \
29 mi->bank[__nr].size = (__size), \ 29 mi->bank[__nr].size = (__size)
30 mi->bank[__nr].node = (((unsigned)(__start) - PHYS_OFFSET) >> 27)
31 30
32#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x) 31#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x)
33 32
diff --git a/arch/arm/mach-pxa/include/mach/memory.h b/arch/arm/mach-pxa/include/mach/memory.h
index f626730ee42e..92361a66b223 100644
--- a/arch/arm/mach-pxa/include/mach/memory.h
+++ b/arch/arm/mach-pxa/include/mach/memory.h
@@ -17,24 +17,11 @@
17 */ 17 */
18#define PHYS_OFFSET UL(0xa0000000) 18#define PHYS_OFFSET UL(0xa0000000)
19 19
20/*
21 * The nodes are matched with the physical SDRAM banks as follows:
22 *
23 * node 0: 0xa0000000-0xa3ffffff --> 0xc0000000-0xc3ffffff
24 * node 1: 0xa4000000-0xa7ffffff --> 0xc4000000-0xc7ffffff
25 * node 2: 0xa8000000-0xabffffff --> 0xc8000000-0xcbffffff
26 * node 3: 0xac000000-0xafffffff --> 0xcc000000-0xcfffffff
27 *
28 * This needs a node mem size of 26 bits.
29 */
30#define NODE_MEM_SIZE_BITS 26
31
32#if !defined(__ASSEMBLY__) && defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI) 20#if !defined(__ASSEMBLY__) && defined(CONFIG_MACH_ARMCORE) && defined(CONFIG_PCI)
33void cmx2xx_pci_adjust_zones(int node, unsigned long *size, 21void cmx2xx_pci_adjust_zones(unsigned long *size, unsigned long *holes);
34 unsigned long *holes);
35 22
36#define arch_adjust_zones(node, size, holes) \ 23#define arch_adjust_zones(size, holes) \
37 cmx2xx_pci_adjust_zones(node, size, holes) 24 cmx2xx_pci_adjust_zones(size, holes)
38 25
39#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_64M - 1) 26#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_64M - 1)
40#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_64M) 27#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_64M)
diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c
index 5305a3993e69..5e92d84fe50d 100644
--- a/arch/arm/mach-pxa/palmt5.c
+++ b/arch/arm/mach-pxa/palmt5.c
@@ -21,6 +21,7 @@
21#include <linux/irq.h> 21#include <linux/irq.h>
22#include <linux/gpio_keys.h> 22#include <linux/gpio_keys.h>
23#include <linux/input.h> 23#include <linux/input.h>
24#include <linux/memblock.h>
24#include <linux/pda_power.h> 25#include <linux/pda_power.h>
25#include <linux/pwm_backlight.h> 26#include <linux/pwm_backlight.h>
26#include <linux/gpio.h> 27#include <linux/gpio.h>
@@ -396,6 +397,11 @@ static void __init palmt5_udc_init(void)
396 } 397 }
397} 398}
398 399
400static void __init palmt5_reserve(void)
401{
402 memblock_reserve(0xa0200000, 0x1000);
403}
404
399static void __init palmt5_init(void) 405static void __init palmt5_init(void)
400{ 406{
401 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config)); 407 pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config));
@@ -421,6 +427,7 @@ MACHINE_START(PALMT5, "Palm Tungsten|T5")
421 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc, 427 .io_pg_offst = (io_p2v(0x40000000) >> 18) & 0xfffc,
422 .boot_params = 0xa0000100, 428 .boot_params = 0xa0000100,
423 .map_io = pxa_map_io, 429 .map_io = pxa_map_io,
430 .reserve = palmt5_reserve,
424 .init_irq = pxa27x_init_irq, 431 .init_irq = pxa27x_init_irq,
425 .timer = &pxa_timer, 432 .timer = &pxa_timer,
426 .init_machine = palmt5_init 433 .init_machine = palmt5_init
diff --git a/arch/arm/mach-pxa/palmtreo.c b/arch/arm/mach-pxa/palmtreo.c
index d8b4469607a1..3d0c9cc2a406 100644
--- a/arch/arm/mach-pxa/palmtreo.c
+++ b/arch/arm/mach-pxa/palmtreo.c
@@ -20,6 +20,7 @@
20#include <linux/irq.h> 20#include <linux/irq.h>
21#include <linux/gpio_keys.h> 21#include <linux/gpio_keys.h>
22#include <linux/input.h> 22#include <linux/input.h>
23#include <linux/memblock.h>
23#include <linux/pda_power.h> 24#include <linux/pda_power.h>
24#include <linux/pwm_backlight.h> 25#include <linux/pwm_backlight.h>
25#include <linux/gpio.h> 26#include <linux/gpio.h>
@@ -633,6 +634,12 @@ static void __init treo_lcd_power_init(void)
633 treo_lcd_screen.pxafb_lcd_power = treo_lcd_power; 634 treo_lcd_screen.pxafb_lcd_power = treo_lcd_power;
634} 635}
635 636
637static void __init treo_reserve(void)
638{
639 memblock_reserve(0xa0000000, 0x1000);
640 memblock_reserve(0xa2000000, 0x1000);
641}
642
636static void __init treo_init(void) 643static void __init treo_init(void)
637{ 644{
638 pxa_set_ffuart_info(NULL); 645 pxa_set_ffuart_info(NULL);
@@ -668,6 +675,7 @@ MACHINE_START(TREO680, "Palm Treo 680")
668 .io_pg_offst = io_p2v(0x40000000), 675 .io_pg_offst = io_p2v(0x40000000),
669 .boot_params = 0xa0000100, 676 .boot_params = 0xa0000100,
670 .map_io = pxa_map_io, 677 .map_io = pxa_map_io,
678 .reserve = treo_reserve,
671 .init_irq = pxa27x_init_irq, 679 .init_irq = pxa27x_init_irq,
672 .timer = &pxa_timer, 680 .timer = &pxa_timer,
673 .init_machine = treo680_init, 681 .init_machine = treo680_init,
@@ -691,6 +699,7 @@ MACHINE_START(CENTRO, "Palm Centro 685")
691 .io_pg_offst = io_p2v(0x40000000), 699 .io_pg_offst = io_p2v(0x40000000),
692 .boot_params = 0xa0000100, 700 .boot_params = 0xa0000100,
693 .map_io = pxa_map_io, 701 .map_io = pxa_map_io,
702 .reserve = treo_reserve,
694 .init_irq = pxa27x_init_irq, 703 .init_irq = pxa27x_init_irq,
695 .timer = &pxa_timer, 704 .timer = &pxa_timer,
696 .init_machine = centro_init, 705 .init_machine = centro_init,
diff --git a/arch/arm/mach-pxa/poodle.c b/arch/arm/mach-pxa/poodle.c
index f4abdaafdac4..bc2758b54446 100644
--- a/arch/arm/mach-pxa/poodle.c
+++ b/arch/arm/mach-pxa/poodle.c
@@ -463,7 +463,6 @@ static void __init fixup_poodle(struct machine_desc *desc,
463 sharpsl_save_param(); 463 sharpsl_save_param();
464 mi->nr_banks=1; 464 mi->nr_banks=1;
465 mi->bank[0].start = 0xa0000000; 465 mi->bank[0].start = 0xa0000000;
466 mi->bank[0].node = 0;
467 mi->bank[0].size = (32*1024*1024); 466 mi->bank[0].size = (32*1024*1024);
468} 467}
469 468
diff --git a/arch/arm/mach-pxa/spitz.c b/arch/arm/mach-pxa/spitz.c
index c1048a35f187..51756c723557 100644
--- a/arch/arm/mach-pxa/spitz.c
+++ b/arch/arm/mach-pxa/spitz.c
@@ -847,7 +847,6 @@ static void __init fixup_spitz(struct machine_desc *desc,
847 sharpsl_save_param(); 847 sharpsl_save_param();
848 mi->nr_banks = 1; 848 mi->nr_banks = 1;
849 mi->bank[0].start = 0xa0000000; 849 mi->bank[0].start = 0xa0000000;
850 mi->bank[0].node = 0;
851 mi->bank[0].size = (64*1024*1024); 850 mi->bank[0].size = (64*1024*1024);
852} 851}
853 852
diff --git a/arch/arm/mach-pxa/tosa.c b/arch/arm/mach-pxa/tosa.c
index 7512b822c6ca..83cc3a18c2e9 100644
--- a/arch/arm/mach-pxa/tosa.c
+++ b/arch/arm/mach-pxa/tosa.c
@@ -948,7 +948,6 @@ static void __init fixup_tosa(struct machine_desc *desc,
948 sharpsl_save_param(); 948 sharpsl_save_param();
949 mi->nr_banks=1; 949 mi->nr_banks=1;
950 mi->bank[0].start = 0xa0000000; 950 mi->bank[0].start = 0xa0000000;
951 mi->bank[0].node = 0;
952 mi->bank[0].size = (64*1024*1024); 951 mi->bank[0].size = (64*1024*1024);
953} 952}
954 953
diff --git a/arch/arm/mach-realview/core.c b/arch/arm/mach-realview/core.c
index 595be19f8ad5..2fa38df28414 100644
--- a/arch/arm/mach-realview/core.c
+++ b/arch/arm/mach-realview/core.c
@@ -61,12 +61,11 @@ void __iomem *gic_cpu_base_addr;
61/* 61/*
62 * Adjust the zones if there are restrictions for DMA access. 62 * Adjust the zones if there are restrictions for DMA access.
63 */ 63 */
64void __init realview_adjust_zones(int node, unsigned long *size, 64void __init realview_adjust_zones(unsigned long *size, unsigned long *hole)
65 unsigned long *hole)
66{ 65{
67 unsigned long dma_size = SZ_256M >> PAGE_SHIFT; 66 unsigned long dma_size = SZ_256M >> PAGE_SHIFT;
68 67
69 if (!machine_is_realview_pbx() || node || (size[0] <= dma_size)) 68 if (!machine_is_realview_pbx() || size[0] <= dma_size)
70 return; 69 return;
71 70
72 size[ZONE_NORMAL] = size[0] - dma_size; 71 size[ZONE_NORMAL] = size[0] - dma_size;
@@ -232,12 +231,27 @@ static unsigned int realview_mmc_status(struct device *dev)
232 struct amba_device *adev = container_of(dev, struct amba_device, dev); 231 struct amba_device *adev = container_of(dev, struct amba_device, dev);
233 u32 mask; 232 u32 mask;
234 233
234 if (machine_is_realview_pb1176()) {
235 static bool inserted = false;
236
237 /*
238 * The PB1176 does not have the status register,
239 * assume it is inserted at startup, then invert
240 * for each call so card insertion/removal will
241 * be detected anyway. This will not be called if
242 * GPIO on PL061 is active, which is the proper
243 * way to do this on the PB1176.
244 */
245 inserted = !inserted;
246 return inserted ? 0 : 1;
247 }
248
235 if (adev->res.start == REALVIEW_MMCI0_BASE) 249 if (adev->res.start == REALVIEW_MMCI0_BASE)
236 mask = 1; 250 mask = 1;
237 else 251 else
238 mask = 2; 252 mask = 2;
239 253
240 return !(readl(REALVIEW_SYSMCI) & mask); 254 return readl(REALVIEW_SYSMCI) & mask;
241} 255}
242 256
243struct mmci_platform_data realview_mmc0_plat_data = { 257struct mmci_platform_data realview_mmc0_plat_data = {
@@ -300,8 +314,13 @@ static struct clk ref24_clk = {
300 .rate = 24000000, 314 .rate = 24000000,
301}; 315};
302 316
317static struct clk dummy_apb_pclk;
318
303static struct clk_lookup lookups[] = { 319static struct clk_lookup lookups[] = {
304 { /* UART0 */ 320 { /* Bus clock */
321 .con_id = "apb_pclk",
322 .clk = &dummy_apb_pclk,
323 }, { /* UART0 */
305 .dev_id = "dev:uart0", 324 .dev_id = "dev:uart0",
306 .clk = &ref24_clk, 325 .clk = &ref24_clk,
307 }, { /* UART1 */ 326 }, { /* UART1 */
@@ -313,6 +332,12 @@ static struct clk_lookup lookups[] = {
313 }, { /* UART3 */ 332 }, { /* UART3 */
314 .dev_id = "fpga:uart3", 333 .dev_id = "fpga:uart3",
315 .clk = &ref24_clk, 334 .clk = &ref24_clk,
335 }, { /* UART3 is on the dev chip in PB1176 */
336 .dev_id = "dev:uart3",
337 .clk = &ref24_clk,
338 }, { /* UART4 only exists in PB1176 */
339 .dev_id = "fpga:uart4",
340 .clk = &ref24_clk,
316 }, { /* KMI0 */ 341 }, { /* KMI0 */
317 .dev_id = "fpga:kmi0", 342 .dev_id = "fpga:kmi0",
318 .clk = &ref24_clk, 343 .clk = &ref24_clk,
@@ -322,12 +347,15 @@ static struct clk_lookup lookups[] = {
322 }, { /* MMC0 */ 347 }, { /* MMC0 */
323 .dev_id = "fpga:mmc0", 348 .dev_id = "fpga:mmc0",
324 .clk = &ref24_clk, 349 .clk = &ref24_clk,
325 }, { /* EB:CLCD */ 350 }, { /* CLCD is in the PB1176 and EB DevChip */
326 .dev_id = "dev:clcd", 351 .dev_id = "dev:clcd",
327 .clk = &oscvco_clk, 352 .clk = &oscvco_clk,
328 }, { /* PB:CLCD */ 353 }, { /* PB:CLCD */
329 .dev_id = "issp:clcd", 354 .dev_id = "issp:clcd",
330 .clk = &oscvco_clk, 355 .clk = &oscvco_clk,
356 }, { /* SSP */
357 .dev_id = "dev:ssp0",
358 .clk = &ref24_clk,
331 } 359 }
332}; 360};
333 361
@@ -342,7 +370,7 @@ static int __init clk_init(void)
342 370
343 return 0; 371 return 0;
344} 372}
345arch_initcall(clk_init); 373core_initcall(clk_init);
346 374
347/* 375/*
348 * CLCD support. 376 * CLCD support.
diff --git a/arch/arm/mach-realview/include/mach/board-pb1176.h b/arch/arm/mach-realview/include/mach/board-pb1176.h
index 2f5ccb298858..002ab5d8c11c 100644
--- a/arch/arm/mach-realview/include/mach/board-pb1176.h
+++ b/arch/arm/mach-realview/include/mach/board-pb1176.h
@@ -26,6 +26,7 @@
26/* 26/*
27 * Peripheral addresses 27 * Peripheral addresses
28 */ 28 */
29#define REALVIEW_PB1176_UART4_BASE 0x10009000 /* UART 4 */
29#define REALVIEW_PB1176_SCTL_BASE 0x10100000 /* System controller */ 30#define REALVIEW_PB1176_SCTL_BASE 0x10100000 /* System controller */
30#define REALVIEW_PB1176_SMC_BASE 0x10111000 /* SMC */ 31#define REALVIEW_PB1176_SMC_BASE 0x10111000 /* SMC */
31#define REALVIEW_PB1176_DMC_BASE 0x10109000 /* DMC configuration */ 32#define REALVIEW_PB1176_DMC_BASE 0x10109000 /* DMC configuration */
diff --git a/arch/arm/mach-realview/include/mach/irqs-pb1176.h b/arch/arm/mach-realview/include/mach/irqs-pb1176.h
index 830055bb8628..5c3c625e3e04 100644
--- a/arch/arm/mach-realview/include/mach/irqs-pb1176.h
+++ b/arch/arm/mach-realview/include/mach/irqs-pb1176.h
@@ -40,6 +40,7 @@
40#define IRQ_DC1176_L2CC (IRQ_DC1176_GIC_START + 13) 40#define IRQ_DC1176_L2CC (IRQ_DC1176_GIC_START + 13)
41#define IRQ_DC1176_RTC (IRQ_DC1176_GIC_START + 14) 41#define IRQ_DC1176_RTC (IRQ_DC1176_GIC_START + 14)
42#define IRQ_DC1176_CLCD (IRQ_DC1176_GIC_START + 15) /* CLCD controller */ 42#define IRQ_DC1176_CLCD (IRQ_DC1176_GIC_START + 15) /* CLCD controller */
43#define IRQ_DC1176_SSP (IRQ_DC1176_GIC_START + 17) /* SSP port */
43#define IRQ_DC1176_UART0 (IRQ_DC1176_GIC_START + 18) /* UART 0 on development chip */ 44#define IRQ_DC1176_UART0 (IRQ_DC1176_GIC_START + 18) /* UART 0 on development chip */
44#define IRQ_DC1176_UART1 (IRQ_DC1176_GIC_START + 19) /* UART 1 on development chip */ 45#define IRQ_DC1176_UART1 (IRQ_DC1176_GIC_START + 19) /* UART 1 on development chip */
45#define IRQ_DC1176_UART2 (IRQ_DC1176_GIC_START + 20) /* UART 2 on development chip */ 46#define IRQ_DC1176_UART2 (IRQ_DC1176_GIC_START + 20) /* UART 2 on development chip */
@@ -73,7 +74,6 @@
73#define IRQ_PB1176_RTC (IRQ_PB1176_GIC_START + 25) /* Real Time Clock */ 74#define IRQ_PB1176_RTC (IRQ_PB1176_GIC_START + 25) /* Real Time Clock */
74 75
75#define IRQ_PB1176_GPIO0 -1 76#define IRQ_PB1176_GPIO0 -1
76#define IRQ_PB1176_SSP -1
77#define IRQ_PB1176_SCTL -1 77#define IRQ_PB1176_SCTL -1
78 78
79#define NR_GIC_PB1176 2 79#define NR_GIC_PB1176 2
diff --git a/arch/arm/mach-realview/include/mach/memory.h b/arch/arm/mach-realview/include/mach/memory.h
index 2417bbcf97fd..5dafc157b276 100644
--- a/arch/arm/mach-realview/include/mach/memory.h
+++ b/arch/arm/mach-realview/include/mach/memory.h
@@ -30,10 +30,9 @@
30#endif 30#endif
31 31
32#if !defined(__ASSEMBLY__) && defined(CONFIG_ZONE_DMA) 32#if !defined(__ASSEMBLY__) && defined(CONFIG_ZONE_DMA)
33extern void realview_adjust_zones(int node, unsigned long *size, 33extern void realview_adjust_zones(unsigned long *size, unsigned long *hole);
34 unsigned long *hole); 34#define arch_adjust_zones(size, hole) \
35#define arch_adjust_zones(node, size, hole) \ 35 realview_adjust_zones(size, hole)
36 realview_adjust_zones(node, size, hole)
37 36
38#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_256M - 1) 37#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_256M - 1)
39#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_256M) 38#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_256M)
diff --git a/arch/arm/mach-realview/realview_eb.c b/arch/arm/mach-realview/realview_eb.c
index 4425018fab82..991c1f8390e2 100644
--- a/arch/arm/mach-realview/realview_eb.c
+++ b/arch/arm/mach-realview/realview_eb.c
@@ -25,6 +25,7 @@
25#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
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/io.h> 29#include <linux/io.h>
29 30
30#include <mach/hardware.h> 31#include <mach/hardware.h>
@@ -129,6 +130,12 @@ static struct pl061_platform_data gpio2_plat_data = {
129 .irq_base = -1, 130 .irq_base = -1,
130}; 131};
131 132
133static struct pl022_ssp_controller ssp0_plat_data = {
134 .bus_id = 0,
135 .enable_dma = 0,
136 .num_chipselect = 1,
137};
138
132/* 139/*
133 * RealView EB AMBA devices 140 * RealView EB AMBA devices
134 */ 141 */
@@ -213,7 +220,7 @@ AMBA_DEVICE(sci0, "dev:sci0", SCI, NULL);
213AMBA_DEVICE(uart0, "dev:uart0", EB_UART0, NULL); 220AMBA_DEVICE(uart0, "dev:uart0", EB_UART0, NULL);
214AMBA_DEVICE(uart1, "dev:uart1", EB_UART1, NULL); 221AMBA_DEVICE(uart1, "dev:uart1", EB_UART1, NULL);
215AMBA_DEVICE(uart2, "dev:uart2", EB_UART2, NULL); 222AMBA_DEVICE(uart2, "dev:uart2", EB_UART2, NULL);
216AMBA_DEVICE(ssp0, "dev:ssp0", EB_SSP, NULL); 223AMBA_DEVICE(ssp0, "dev:ssp0", EB_SSP, &ssp0_plat_data);
217 224
218static struct amba_device *amba_devs[] __initdata = { 225static struct amba_device *amba_devs[] __initdata = {
219 &dmac_device, 226 &dmac_device,
@@ -324,6 +331,26 @@ static struct platform_device pmu_device = {
324 .resource = pmu_resources, 331 .resource = pmu_resources,
325}; 332};
326 333
334static struct resource char_lcd_resources[] = {
335 {
336 .start = REALVIEW_CHAR_LCD_BASE,
337 .end = (REALVIEW_CHAR_LCD_BASE + SZ_4K - 1),
338 .flags = IORESOURCE_MEM,
339 },
340 {
341 .start = IRQ_EB_CHARLCD,
342 .end = IRQ_EB_CHARLCD,
343 .flags = IORESOURCE_IRQ,
344 },
345};
346
347static struct platform_device char_lcd_device = {
348 .name = "arm-charlcd",
349 .id = -1,
350 .num_resources = ARRAY_SIZE(char_lcd_resources),
351 .resource = char_lcd_resources,
352};
353
327static void __init gic_init_irq(void) 354static void __init gic_init_irq(void)
328{ 355{
329 if (core_tile_eb11mp() || core_tile_a9mp()) { 356 if (core_tile_eb11mp() || core_tile_a9mp()) {
@@ -442,6 +469,7 @@ static void __init realview_eb_init(void)
442 469
443 realview_flash_register(&realview_eb_flash_resource, 1); 470 realview_flash_register(&realview_eb_flash_resource, 1);
444 platform_device_register(&realview_i2c_device); 471 platform_device_register(&realview_i2c_device);
472 platform_device_register(&char_lcd_device);
445 eth_device_register(); 473 eth_device_register();
446 realview_usb_register(realview_eb_isp1761_resources); 474 realview_usb_register(realview_eb_isp1761_resources);
447 475
diff --git a/arch/arm/mach-realview/realview_pb1176.c b/arch/arm/mach-realview/realview_pb1176.c
index 099a1f125cf8..d2be12eb829e 100644
--- a/arch/arm/mach-realview/realview_pb1176.c
+++ b/arch/arm/mach-realview/realview_pb1176.c
@@ -25,6 +25,7 @@
25#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
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/io.h> 29#include <linux/io.h>
29 30
30#include <mach/hardware.h> 31#include <mach/hardware.h>
@@ -123,6 +124,12 @@ static struct pl061_platform_data gpio2_plat_data = {
123 .irq_base = -1, 124 .irq_base = -1,
124}; 125};
125 126
127static struct pl022_ssp_controller ssp0_plat_data = {
128 .bus_id = 0,
129 .enable_dma = 0,
130 .num_chipselect = 1,
131};
132
126/* 133/*
127 * RealView PB1176 AMBA devices 134 * RealView PB1176 AMBA devices
128 */ 135 */
@@ -144,8 +151,6 @@ static struct pl061_platform_data gpio2_plat_data = {
144#define MPMC_DMA { 0, 0 } 151#define MPMC_DMA { 0, 0 }
145#define PB1176_CLCD_IRQ { IRQ_DC1176_CLCD, NO_IRQ } 152#define PB1176_CLCD_IRQ { IRQ_DC1176_CLCD, NO_IRQ }
146#define PB1176_CLCD_DMA { 0, 0 } 153#define PB1176_CLCD_DMA { 0, 0 }
147#define DMAC_IRQ { IRQ_PB1176_DMAC, NO_IRQ }
148#define DMAC_DMA { 0, 0 }
149#define SCTL_IRQ { NO_IRQ, NO_IRQ } 154#define SCTL_IRQ { NO_IRQ, NO_IRQ }
150#define SCTL_DMA { 0, 0 } 155#define SCTL_DMA { 0, 0 }
151#define PB1176_WATCHDOG_IRQ { IRQ_DC1176_WATCHDOG, NO_IRQ } 156#define PB1176_WATCHDOG_IRQ { IRQ_DC1176_WATCHDOG, NO_IRQ }
@@ -166,7 +171,9 @@ static struct pl061_platform_data gpio2_plat_data = {
166#define PB1176_UART2_DMA { 11, 10 } 171#define PB1176_UART2_DMA { 11, 10 }
167#define PB1176_UART3_IRQ { IRQ_DC1176_UART3, NO_IRQ } 172#define PB1176_UART3_IRQ { IRQ_DC1176_UART3, NO_IRQ }
168#define PB1176_UART3_DMA { 0x86, 0x87 } 173#define PB1176_UART3_DMA { 0x86, 0x87 }
169#define PB1176_SSP_IRQ { IRQ_PB1176_SSP, NO_IRQ } 174#define PB1176_UART4_IRQ { IRQ_PB1176_UART4, NO_IRQ }
175#define PB1176_UART4_DMA { 0, 0 }
176#define PB1176_SSP_IRQ { IRQ_DC1176_SSP, NO_IRQ }
170#define PB1176_SSP_DMA { 9, 8 } 177#define PB1176_SSP_DMA { 9, 8 }
171 178
172/* FPGA Primecells */ 179/* FPGA Primecells */
@@ -174,7 +181,7 @@ AMBA_DEVICE(aaci, "fpga:aaci", AACI, NULL);
174AMBA_DEVICE(mmc0, "fpga:mmc0", MMCI0, &realview_mmc0_plat_data); 181AMBA_DEVICE(mmc0, "fpga:mmc0", MMCI0, &realview_mmc0_plat_data);
175AMBA_DEVICE(kmi0, "fpga:kmi0", KMI0, NULL); 182AMBA_DEVICE(kmi0, "fpga:kmi0", KMI0, NULL);
176AMBA_DEVICE(kmi1, "fpga:kmi1", KMI1, NULL); 183AMBA_DEVICE(kmi1, "fpga:kmi1", KMI1, NULL);
177AMBA_DEVICE(uart3, "fpga:uart3", PB1176_UART3, NULL); 184AMBA_DEVICE(uart4, "fpga:uart4", PB1176_UART4, NULL);
178 185
179/* DevChip Primecells */ 186/* DevChip Primecells */
180AMBA_DEVICE(smc, "dev:smc", PB1176_SMC, NULL); 187AMBA_DEVICE(smc, "dev:smc", PB1176_SMC, NULL);
@@ -188,18 +195,16 @@ AMBA_DEVICE(sci0, "dev:sci0", SCI, NULL);
188AMBA_DEVICE(uart0, "dev:uart0", PB1176_UART0, NULL); 195AMBA_DEVICE(uart0, "dev:uart0", PB1176_UART0, NULL);
189AMBA_DEVICE(uart1, "dev:uart1", PB1176_UART1, NULL); 196AMBA_DEVICE(uart1, "dev:uart1", PB1176_UART1, NULL);
190AMBA_DEVICE(uart2, "dev:uart2", PB1176_UART2, NULL); 197AMBA_DEVICE(uart2, "dev:uart2", PB1176_UART2, NULL);
191AMBA_DEVICE(ssp0, "dev:ssp0", PB1176_SSP, NULL); 198AMBA_DEVICE(uart3, "dev:uart3", PB1176_UART3, NULL);
192 199AMBA_DEVICE(ssp0, "dev:ssp0", PB1176_SSP, &ssp0_plat_data);
193/* Primecells on the NEC ISSP chip */ 200AMBA_DEVICE(clcd, "dev:clcd", PB1176_CLCD, &clcd_plat_data);
194AMBA_DEVICE(clcd, "issp:clcd", PB1176_CLCD, &clcd_plat_data);
195//AMBA_DEVICE(dmac, "issp:dmac", PB1176_DMAC, NULL);
196 201
197static struct amba_device *amba_devs[] __initdata = { 202static struct amba_device *amba_devs[] __initdata = {
198// &dmac_device,
199 &uart0_device, 203 &uart0_device,
200 &uart1_device, 204 &uart1_device,
201 &uart2_device, 205 &uart2_device,
202 &uart3_device, 206 &uart3_device,
207 &uart4_device,
203 &smc_device, 208 &smc_device,
204 &clcd_device, 209 &clcd_device,
205 &sctl_device, 210 &sctl_device,
@@ -276,6 +281,26 @@ static struct platform_device pmu_device = {
276 .resource = &pmu_resource, 281 .resource = &pmu_resource,
277}; 282};
278 283
284static struct resource char_lcd_resources[] = {
285 {
286 .start = REALVIEW_CHAR_LCD_BASE,
287 .end = (REALVIEW_CHAR_LCD_BASE + SZ_4K - 1),
288 .flags = IORESOURCE_MEM,
289 },
290 {
291 .start = IRQ_PB1176_CHARLCD,
292 .end = IRQ_PB1176_CHARLCD,
293 .flags = IORESOURCE_IRQ,
294 },
295};
296
297static struct platform_device char_lcd_device = {
298 .name = "arm-charlcd",
299 .id = -1,
300 .num_resources = ARRAY_SIZE(char_lcd_resources),
301 .resource = char_lcd_resources,
302};
303
279static void __init gic_init_irq(void) 304static void __init gic_init_irq(void)
280{ 305{
281 /* ARM1176 DevChip GIC, primary */ 306 /* ARM1176 DevChip GIC, primary */
@@ -338,6 +363,7 @@ static void __init realview_pb1176_init(void)
338 platform_device_register(&realview_i2c_device); 363 platform_device_register(&realview_i2c_device);
339 realview_usb_register(realview_pb1176_isp1761_resources); 364 realview_usb_register(realview_pb1176_isp1761_resources);
340 platform_device_register(&pmu_device); 365 platform_device_register(&pmu_device);
366 platform_device_register(&char_lcd_device);
341 367
342 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 368 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
343 struct amba_device *d = amba_devs[i]; 369 struct amba_device *d = amba_devs[i];
diff --git a/arch/arm/mach-realview/realview_pb11mp.c b/arch/arm/mach-realview/realview_pb11mp.c
index 0e07a5ccb75f..d591bc00b86e 100644
--- a/arch/arm/mach-realview/realview_pb11mp.c
+++ b/arch/arm/mach-realview/realview_pb11mp.c
@@ -25,6 +25,7 @@
25#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
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/io.h> 29#include <linux/io.h>
29 30
30#include <mach/hardware.h> 31#include <mach/hardware.h>
@@ -124,6 +125,12 @@ static struct pl061_platform_data gpio2_plat_data = {
124 .irq_base = -1, 125 .irq_base = -1,
125}; 126};
126 127
128static struct pl022_ssp_controller ssp0_plat_data = {
129 .bus_id = 0,
130 .enable_dma = 0,
131 .num_chipselect = 1,
132};
133
127/* 134/*
128 * RealView PB11MPCore AMBA devices 135 * RealView PB11MPCore AMBA devices
129 */ 136 */
@@ -190,7 +197,7 @@ AMBA_DEVICE(sci0, "dev:sci0", SCI, NULL);
190AMBA_DEVICE(uart0, "dev:uart0", PB11MP_UART0, NULL); 197AMBA_DEVICE(uart0, "dev:uart0", PB11MP_UART0, NULL);
191AMBA_DEVICE(uart1, "dev:uart1", PB11MP_UART1, NULL); 198AMBA_DEVICE(uart1, "dev:uart1", PB11MP_UART1, NULL);
192AMBA_DEVICE(uart2, "dev:uart2", PB11MP_UART2, NULL); 199AMBA_DEVICE(uart2, "dev:uart2", PB11MP_UART2, NULL);
193AMBA_DEVICE(ssp0, "dev:ssp0", PB11MP_SSP, NULL); 200AMBA_DEVICE(ssp0, "dev:ssp0", PB11MP_SSP, &ssp0_plat_data);
194 201
195/* Primecells on the NEC ISSP chip */ 202/* Primecells on the NEC ISSP chip */
196AMBA_DEVICE(clcd, "issp:clcd", PB11MP_CLCD, &clcd_plat_data); 203AMBA_DEVICE(clcd, "issp:clcd", PB11MP_CLCD, &clcd_plat_data);
diff --git a/arch/arm/mach-realview/realview_pba8.c b/arch/arm/mach-realview/realview_pba8.c
index ac2f06f1ca50..6c37621217bc 100644
--- a/arch/arm/mach-realview/realview_pba8.c
+++ b/arch/arm/mach-realview/realview_pba8.c
@@ -25,6 +25,7 @@
25#include <linux/amba/bus.h> 25#include <linux/amba/bus.h>
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/io.h> 29#include <linux/io.h>
29 30
30#include <asm/irq.h> 31#include <asm/irq.h>
@@ -114,6 +115,12 @@ static struct pl061_platform_data gpio2_plat_data = {
114 .irq_base = -1, 115 .irq_base = -1,
115}; 116};
116 117
118static struct pl022_ssp_controller ssp0_plat_data = {
119 .bus_id = 0,
120 .enable_dma = 0,
121 .num_chipselect = 1,
122};
123
117/* 124/*
118 * RealView PBA8Core AMBA devices 125 * RealView PBA8Core AMBA devices
119 */ 126 */
@@ -180,7 +187,7 @@ AMBA_DEVICE(sci0, "dev:sci0", SCI, NULL);
180AMBA_DEVICE(uart0, "dev:uart0", PBA8_UART0, NULL); 187AMBA_DEVICE(uart0, "dev:uart0", PBA8_UART0, NULL);
181AMBA_DEVICE(uart1, "dev:uart1", PBA8_UART1, NULL); 188AMBA_DEVICE(uart1, "dev:uart1", PBA8_UART1, NULL);
182AMBA_DEVICE(uart2, "dev:uart2", PBA8_UART2, NULL); 189AMBA_DEVICE(uart2, "dev:uart2", PBA8_UART2, NULL);
183AMBA_DEVICE(ssp0, "dev:ssp0", PBA8_SSP, NULL); 190AMBA_DEVICE(ssp0, "dev:ssp0", PBA8_SSP, &ssp0_plat_data);
184 191
185/* Primecells on the NEC ISSP chip */ 192/* Primecells on the NEC ISSP chip */
186AMBA_DEVICE(clcd, "issp:clcd", PBA8_CLCD, &clcd_plat_data); 193AMBA_DEVICE(clcd, "issp:clcd", PBA8_CLCD, &clcd_plat_data);
diff --git a/arch/arm/mach-realview/realview_pbx.c b/arch/arm/mach-realview/realview_pbx.c
index 08fd683adc4c..9428eff0b116 100644
--- a/arch/arm/mach-realview/realview_pbx.c
+++ b/arch/arm/mach-realview/realview_pbx.c
@@ -24,6 +24,7 @@
24#include <linux/amba/bus.h> 24#include <linux/amba/bus.h>
25#include <linux/amba/pl061.h> 25#include <linux/amba/pl061.h>
26#include <linux/amba/mmci.h> 26#include <linux/amba/mmci.h>
27#include <linux/amba/pl022.h>
27#include <linux/io.h> 28#include <linux/io.h>
28 29
29#include <asm/irq.h> 30#include <asm/irq.h>
@@ -136,6 +137,12 @@ static struct pl061_platform_data gpio2_plat_data = {
136 .irq_base = -1, 137 .irq_base = -1,
137}; 138};
138 139
140static struct pl022_ssp_controller ssp0_plat_data = {
141 .bus_id = 0,
142 .enable_dma = 0,
143 .num_chipselect = 1,
144};
145
139/* 146/*
140 * RealView PBXCore AMBA devices 147 * RealView PBXCore AMBA devices
141 */ 148 */
@@ -202,7 +209,7 @@ AMBA_DEVICE(sci0, "dev:sci0", SCI, NULL);
202AMBA_DEVICE(uart0, "dev:uart0", PBX_UART0, NULL); 209AMBA_DEVICE(uart0, "dev:uart0", PBX_UART0, NULL);
203AMBA_DEVICE(uart1, "dev:uart1", PBX_UART1, NULL); 210AMBA_DEVICE(uart1, "dev:uart1", PBX_UART1, NULL);
204AMBA_DEVICE(uart2, "dev:uart2", PBX_UART2, NULL); 211AMBA_DEVICE(uart2, "dev:uart2", PBX_UART2, NULL);
205AMBA_DEVICE(ssp0, "dev:ssp0", PBX_SSP, NULL); 212AMBA_DEVICE(ssp0, "dev:ssp0", PBX_SSP, &ssp0_plat_data);
206 213
207/* Primecells on the NEC ISSP chip */ 214/* Primecells on the NEC ISSP chip */
208AMBA_DEVICE(clcd, "issp:clcd", PBX_CLCD, &clcd_plat_data); 215AMBA_DEVICE(clcd, "issp:clcd", PBX_CLCD, &clcd_plat_data);
diff --git a/arch/arm/mach-s3c2410/mach-h1940.c b/arch/arm/mach-s3c2410/mach-h1940.c
index 779b45b3f80f..3ba3bab139d0 100644
--- a/arch/arm/mach-s3c2410/mach-h1940.c
+++ b/arch/arm/mach-s3c2410/mach-h1940.c
@@ -15,6 +15,7 @@
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/memblock.h>
18#include <linux/timer.h> 19#include <linux/timer.h>
19#include <linux/init.h> 20#include <linux/init.h>
20#include <linux/sysdev.h> 21#include <linux/sysdev.h>
@@ -304,6 +305,13 @@ static void __init h1940_map_io(void)
304 s3c_pm_init(); 305 s3c_pm_init();
305} 306}
306 307
308/* H1940 and RX3715 need to reserve this for suspend */
309static void __init h1940_reserve(void)
310{
311 memblock_reserve(0x30003000, 0x1000);
312 memblock_reserve(0x30081000, 0x1000);
313}
314
307static void __init h1940_init_irq(void) 315static void __init h1940_init_irq(void)
308{ 316{
309 s3c24xx_init_irq(); 317 s3c24xx_init_irq();
@@ -346,6 +354,7 @@ MACHINE_START(H1940, "IPAQ-H1940")
346 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, 354 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
347 .boot_params = S3C2410_SDRAM_PA + 0x100, 355 .boot_params = S3C2410_SDRAM_PA + 0x100,
348 .map_io = h1940_map_io, 356 .map_io = h1940_map_io,
357 .reserve = h1940_reserve,
349 .init_irq = h1940_init_irq, 358 .init_irq = h1940_init_irq,
350 .init_machine = h1940_init, 359 .init_machine = h1940_init,
351 .timer = &s3c24xx_timer, 360 .timer = &s3c24xx_timer,
diff --git a/arch/arm/mach-s3c2412/mach-smdk2413.c b/arch/arm/mach-s3c2412/mach-smdk2413.c
index ba93a356a839..054c9f92232a 100644
--- a/arch/arm/mach-s3c2412/mach-smdk2413.c
+++ b/arch/arm/mach-s3c2412/mach-smdk2413.c
@@ -119,7 +119,6 @@ static void __init smdk2413_fixup(struct machine_desc *desc,
119 mi->nr_banks=1; 119 mi->nr_banks=1;
120 mi->bank[0].start = 0x30000000; 120 mi->bank[0].start = 0x30000000;
121 mi->bank[0].size = SZ_64M; 121 mi->bank[0].size = SZ_64M;
122 mi->bank[0].node = 0;
123 } 122 }
124} 123}
125 124
diff --git a/arch/arm/mach-s3c2412/mach-vstms.c b/arch/arm/mach-s3c2412/mach-vstms.c
index 3ca9265b6997..f291ac25d312 100644
--- a/arch/arm/mach-s3c2412/mach-vstms.c
+++ b/arch/arm/mach-s3c2412/mach-vstms.c
@@ -137,7 +137,6 @@ static void __init vstms_fixup(struct machine_desc *desc,
137 mi->nr_banks=1; 137 mi->nr_banks=1;
138 mi->bank[0].start = 0x30000000; 138 mi->bank[0].start = 0x30000000;
139 mi->bank[0].size = SZ_64M; 139 mi->bank[0].size = SZ_64M;
140 mi->bank[0].node = 0;
141 } 140 }
142} 141}
143 142
diff --git a/arch/arm/mach-s3c2440/mach-rx1950.c b/arch/arm/mach-s3c2440/mach-rx1950.c
index 8603b577a24b..142d1f921176 100644
--- a/arch/arm/mach-s3c2440/mach-rx1950.c
+++ b/arch/arm/mach-s3c2440/mach-rx1950.c
@@ -15,6 +15,7 @@
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/memblock.h>
18#include <linux/delay.h> 19#include <linux/delay.h>
19#include <linux/timer.h> 20#include <linux/timer.h>
20#include <linux/init.h> 21#include <linux/init.h>
@@ -570,12 +571,20 @@ static void __init rx1950_init_machine(void)
570 platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices)); 571 platform_add_devices(rx1950_devices, ARRAY_SIZE(rx1950_devices));
571} 572}
572 573
574/* H1940 and RX3715 need to reserve this for suspend */
575static void __init rx1950_reserve(void)
576{
577 memblock_reserve(0x30003000, 0x1000);
578 memblock_reserve(0x30081000, 0x1000);
579}
580
573MACHINE_START(RX1950, "HP iPAQ RX1950") 581MACHINE_START(RX1950, "HP iPAQ RX1950")
574 /* Maintainers: Vasily Khoruzhick */ 582 /* Maintainers: Vasily Khoruzhick */
575 .phys_io = S3C2410_PA_UART, 583 .phys_io = S3C2410_PA_UART,
576 .io_pg_offst = (((u32) S3C24XX_VA_UART) >> 18) & 0xfffc, 584 .io_pg_offst = (((u32) S3C24XX_VA_UART) >> 18) & 0xfffc,
577 .boot_params = S3C2410_SDRAM_PA + 0x100, 585 .boot_params = S3C2410_SDRAM_PA + 0x100,
578 .map_io = rx1950_map_io, 586 .map_io = rx1950_map_io,
587 .reserve = rx1950_reserve,
579 .init_irq = s3c24xx_init_irq, 588 .init_irq = s3c24xx_init_irq,
580 .init_machine = rx1950_init_machine, 589 .init_machine = rx1950_init_machine,
581 .timer = &s3c24xx_timer, 590 .timer = &s3c24xx_timer,
diff --git a/arch/arm/mach-s3c2440/mach-rx3715.c b/arch/arm/mach-s3c2440/mach-rx3715.c
index d2946de3f365..6bb44f75a9ce 100644
--- a/arch/arm/mach-s3c2440/mach-rx3715.c
+++ b/arch/arm/mach-s3c2440/mach-rx3715.c
@@ -15,6 +15,7 @@
15#include <linux/types.h> 15#include <linux/types.h>
16#include <linux/interrupt.h> 16#include <linux/interrupt.h>
17#include <linux/list.h> 17#include <linux/list.h>
18#include <linux/memblock.h>
18#include <linux/timer.h> 19#include <linux/timer.h>
19#include <linux/init.h> 20#include <linux/init.h>
20#include <linux/tty.h> 21#include <linux/tty.h>
@@ -191,6 +192,13 @@ static void __init rx3715_map_io(void)
191 s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs)); 192 s3c24xx_init_uarts(rx3715_uartcfgs, ARRAY_SIZE(rx3715_uartcfgs));
192} 193}
193 194
195/* H1940 and RX3715 need to reserve this for suspend */
196static void __init rx3715_reserve(void)
197{
198 memblock_reserve(0x30003000, 0x1000);
199 memblock_reserve(0x30081000, 0x1000);
200}
201
194static void __init rx3715_init_irq(void) 202static void __init rx3715_init_irq(void)
195{ 203{
196 s3c24xx_init_irq(); 204 s3c24xx_init_irq();
@@ -214,6 +222,7 @@ MACHINE_START(RX3715, "IPAQ-RX3715")
214 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc, 222 .io_pg_offst = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
215 .boot_params = S3C2410_SDRAM_PA + 0x100, 223 .boot_params = S3C2410_SDRAM_PA + 0x100,
216 .map_io = rx3715_map_io, 224 .map_io = rx3715_map_io,
225 .reserve = rx3715_reserve,
217 .init_irq = rx3715_init_irq, 226 .init_irq = rx3715_init_irq,
218 .init_machine = rx3715_init_machine, 227 .init_machine = rx3715_init_machine,
219 .timer = &s3c24xx_timer, 228 .timer = &s3c24xx_timer,
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c
index 5d5f330c5d94..16e682d5dbb7 100644
--- a/arch/arm/mach-sa1100/collie.c
+++ b/arch/arm/mach-sa1100/collie.c
@@ -11,7 +11,7 @@
11 * published by the Free Software Foundation. 11 * published by the Free Software Foundation.
12 * 12 *
13 * ChangeLog: 13 * ChangeLog:
14 * 2006 Pavel Machek <pavel@suse.cz> 14 * 2006 Pavel Machek <pavel@ucw.cz>
15 * 03-06-2004 John Lenz <lenz@cs.wisc.edu> 15 * 03-06-2004 John Lenz <lenz@cs.wisc.edu>
16 * 06-04-2002 Chris Larson <kergoth@digitalnemesis.net> 16 * 06-04-2002 Chris Larson <kergoth@digitalnemesis.net>
17 * 04-16-2001 Lineo Japan,Inc. ... 17 * 04-16-2001 Lineo Japan,Inc. ...
diff --git a/arch/arm/mach-sa1100/generic.h b/arch/arm/mach-sa1100/generic.h
index ec03f187c52b..b7a9a601c2d1 100644
--- a/arch/arm/mach-sa1100/generic.h
+++ b/arch/arm/mach-sa1100/generic.h
@@ -13,8 +13,7 @@ extern void __init sa1100_init_gpio(void);
13 13
14#define SET_BANK(__nr,__start,__size) \ 14#define SET_BANK(__nr,__start,__size) \
15 mi->bank[__nr].start = (__start), \ 15 mi->bank[__nr].start = (__start), \
16 mi->bank[__nr].size = (__size), \ 16 mi->bank[__nr].size = (__size)
17 mi->bank[__nr].node = (((unsigned)(__start) - PHYS_OFFSET) >> 27)
18 17
19extern void (*sa1100fb_backlight_power)(int on); 18extern void (*sa1100fb_backlight_power)(int on);
20extern void (*sa1100fb_lcd_power)(int on); 19extern void (*sa1100fb_lcd_power)(int on);
diff --git a/arch/arm/mach-sa1100/include/mach/memory.h b/arch/arm/mach-sa1100/include/mach/memory.h
index d5277f9bee77..128a1dfa96b9 100644
--- a/arch/arm/mach-sa1100/include/mach/memory.h
+++ b/arch/arm/mach-sa1100/include/mach/memory.h
@@ -17,10 +17,10 @@
17#ifndef __ASSEMBLY__ 17#ifndef __ASSEMBLY__
18 18
19#ifdef CONFIG_SA1111 19#ifdef CONFIG_SA1111
20void sa1111_adjust_zones(int node, unsigned long *size, unsigned long *holes); 20void sa1111_adjust_zones(unsigned long *size, unsigned long *holes);
21 21
22#define arch_adjust_zones(node, size, holes) \ 22#define arch_adjust_zones(size, holes) \
23 sa1111_adjust_zones(node, size, holes) 23 sa1111_adjust_zones(size, holes)
24 24
25#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_1M - 1) 25#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_1M - 1)
26#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_1M) 26#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_1M)
diff --git a/arch/arm/mach-shark/include/mach/memory.h b/arch/arm/mach-shark/include/mach/memory.h
index 3053e5b7f168..d9c4812f1c31 100644
--- a/arch/arm/mach-shark/include/mach/memory.h
+++ b/arch/arm/mach-shark/include/mach/memory.h
@@ -19,9 +19,8 @@
19 19
20#ifndef __ASSEMBLY__ 20#ifndef __ASSEMBLY__
21 21
22static inline void __arch_adjust_zones(int node, unsigned long *zone_size, unsigned long *zhole_size) 22static inline void __arch_adjust_zones(unsigned long *zone_size, unsigned long *zhole_size)
23{ 23{
24 if (node != 0) return;
25 /* Only the first 4 MB (=1024 Pages) are usable for DMA */ 24 /* Only the first 4 MB (=1024 Pages) are usable for DMA */
26 /* See dev / -> .properties in OpenFirmware. */ 25 /* See dev / -> .properties in OpenFirmware. */
27 zone_size[1] = zone_size[0] - 1024; 26 zone_size[1] = zone_size[0] - 1024;
@@ -30,8 +29,8 @@ static inline void __arch_adjust_zones(int node, unsigned long *zone_size, unsig
30 zhole_size[0] = 0; 29 zhole_size[0] = 0;
31} 30}
32 31
33#define arch_adjust_zones(node, size, holes) \ 32#define arch_adjust_zones(size, holes) \
34 __arch_adjust_zones(node, size, holes) 33 __arch_adjust_zones(size, holes)
35 34
36#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_4M - 1) 35#define ISA_DMA_THRESHOLD (PHYS_OFFSET + SZ_4M - 1)
37#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_4M) 36#define MAX_DMA_ADDRESS (PAGE_OFFSET + SZ_4M)
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index f2b88c5fe142..4c704b4e8b34 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -70,6 +70,18 @@ endmenu
70 70
71menu "Timer and clock configuration" 71menu "Timer and clock configuration"
72 72
73config SHMOBILE_TIMER_HZ
74 int "Kernel HZ (jiffies per second)"
75 range 32 1024
76 default "128"
77 help
78 Allows the configuration of the timer frequency. It is customary
79 to have the timer interrupt run at 1000 Hz or 100 Hz, but in the
80 case of low timer frequencies other values may be more suitable.
81 SH-Mobile systems using a 32768 Hz RCLK for clock events may want
82 to select a HZ value such as 128 that can evenly divide RCLK.
83 A HZ value that does not divide evenly may cause timer drift.
84
73config SH_TIMER_CMT 85config SH_TIMER_CMT
74 bool "CMT timer driver" 86 bool "CMT timer driver"
75 default y 87 default y
diff --git a/arch/arm/mach-shmobile/include/mach/irqs.h b/arch/arm/mach-shmobile/include/mach/irqs.h
index 5179b72e1ee3..132256bb8c81 100644
--- a/arch/arm/mach-shmobile/include/mach/irqs.h
+++ b/arch/arm/mach-shmobile/include/mach/irqs.h
@@ -2,7 +2,6 @@
2#define __ASM_MACH_IRQS_H 2#define __ASM_MACH_IRQS_H
3 3
4#define NR_IRQS 512 4#define NR_IRQS 512
5#define NR_IRQS_LEGACY 8
6 5
7#define evt2irq(evt) (((evt) >> 5) - 16) 6#define evt2irq(evt) (((evt) >> 5) - 16)
8#define irq2evt(irq) (((irq) + 16) << 5) 7#define irq2evt(irq) (((irq) + 16) << 5)
diff --git a/arch/arm/mach-spear3xx/clock.c b/arch/arm/mach-spear3xx/clock.c
index 39f6ccf22294..18febf92f20a 100644
--- a/arch/arm/mach-spear3xx/clock.c
+++ b/arch/arm/mach-spear3xx/clock.c
@@ -341,8 +341,11 @@ static struct clk gpio_clk = {
341 .recalc = &follow_parent, 341 .recalc = &follow_parent,
342}; 342};
343 343
344static struct clk dummy_apb_pclk;
345
344/* array of all spear 3xx clock lookups */ 346/* array of all spear 3xx clock lookups */
345static struct clk_lookup spear_clk_lookups[] = { 347static struct clk_lookup spear_clk_lookups[] = {
348 { .con_id = "apb_pclk", .clk = &dummy_apb_pclk},
346 /* root clks */ 349 /* root clks */
347 { .con_id = "osc_32k_clk", .clk = &osc_32k_clk}, 350 { .con_id = "osc_32k_clk", .clk = &osc_32k_clk},
348 { .con_id = "osc_24m_clk", .clk = &osc_24m_clk}, 351 { .con_id = "osc_24m_clk", .clk = &osc_24m_clk},
diff --git a/arch/arm/mach-spear6xx/clock.c b/arch/arm/mach-spear6xx/clock.c
index 13e27c769685..36ff056b7321 100644
--- a/arch/arm/mach-spear6xx/clock.c
+++ b/arch/arm/mach-spear6xx/clock.c
@@ -428,8 +428,11 @@ static struct clk gpio2_clk = {
428 .recalc = &follow_parent, 428 .recalc = &follow_parent,
429}; 429};
430 430
431static struct clk dummy_apb_pclk;
432
431/* array of all spear 6xx clock lookups */ 433/* array of all spear 6xx clock lookups */
432static struct clk_lookup spear_clk_lookups[] = { 434static struct clk_lookup spear_clk_lookups[] = {
435 { .con_id = "apb_pclk", .clk = &dummy_apb_pclk},
433 /* root clks */ 436 /* root clks */
434 { .con_id = "osc_32k_clk", .clk = &osc_32k_clk}, 437 { .con_id = "osc_32k_clk", .clk = &osc_32k_clk},
435 { .con_id = "osc_30m_clk", .clk = &osc_30m_clk}, 438 { .con_id = "osc_30m_clk", .clk = &osc_30m_clk},
diff --git a/arch/arm/mach-u300/clock.c b/arch/arm/mach-u300/clock.c
index 5af71d5ba665..5d12d547789e 100644
--- a/arch/arm/mach-u300/clock.c
+++ b/arch/arm/mach-u300/clock.c
@@ -1212,6 +1212,8 @@ static struct clk ppm_clk = {
1212}; 1212};
1213#endif 1213#endif
1214 1214
1215static struct clk dummy_apb_pclk;
1216
1215#define DEF_LOOKUP(devid, clkref) \ 1217#define DEF_LOOKUP(devid, clkref) \
1216 { \ 1218 { \
1217 .dev_id = devid, \ 1219 .dev_id = devid, \
@@ -1223,6 +1225,10 @@ static struct clk ppm_clk = {
1223 * look up through clockdevice. 1225 * look up through clockdevice.
1224 */ 1226 */
1225static struct clk_lookup lookups[] = { 1227static struct clk_lookup lookups[] = {
1228 {
1229 .con_id = "apb_pclk",
1230 .clk = &dummy_apb_pclk,
1231 },
1226 /* Connected directly to the AMBA bus */ 1232 /* Connected directly to the AMBA bus */
1227 DEF_LOOKUP("amba", &amba_clk), 1233 DEF_LOOKUP("amba", &amba_clk),
1228 DEF_LOOKUP("cpu", &cpu_clk), 1234 DEF_LOOKUP("cpu", &cpu_clk),
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c
index 5f34eb674d68..653b3e0ab7ba 100644
--- a/arch/arm/mach-u300/core.c
+++ b/arch/arm/mach-u300/core.c
@@ -1561,13 +1561,6 @@ static void __init u300_init_check_chip(void)
1561 printk(KERN_INFO "Initializing U300 system on %s baseband chip " \ 1561 printk(KERN_INFO "Initializing U300 system on %s baseband chip " \
1562 "(chip ID 0x%04x)\n", chipname, val); 1562 "(chip ID 0x%04x)\n", chipname, val);
1563 1563
1564#ifdef CONFIG_MACH_U300_BS26
1565 if ((val & 0xFF00U) != 0xc800) {
1566 printk(KERN_ERR "Platform configured for BS25/BS26 " \
1567 "with DB3150 but %s detected, expect problems!",
1568 chipname);
1569 }
1570#endif
1571#ifdef CONFIG_MACH_U300_BS330 1564#ifdef CONFIG_MACH_U300_BS330
1572 if ((val & 0xFF00U) != 0xd800) { 1565 if ((val & 0xFF00U) != 0xd800) {
1573 printk(KERN_ERR "Platform configured for BS330 " \ 1566 printk(KERN_ERR "Platform configured for BS330 " \
diff --git a/arch/arm/mach-u300/gpio.c b/arch/arm/mach-u300/gpio.c
index 5f61fd45a0c8..d92790140fe5 100644
--- a/arch/arm/mach-u300/gpio.c
+++ b/arch/arm/mach-u300/gpio.c
@@ -523,7 +523,7 @@ static void gpio_set_initial_values(void)
523 523
524 /* 524 /*
525 * Put all pins that are set to either 'GPIO_OUT' or 'GPIO_NOT_USED' 525 * Put all pins that are set to either 'GPIO_OUT' or 'GPIO_NOT_USED'
526 * to output and 'GPIO_IN' to input for each port. And initalize 526 * to output and 'GPIO_IN' to input for each port. And initialize
527 * default value on outputs. 527 * default value on outputs.
528 */ 528 */
529 for (i = 0; i < U300_GPIO_NUM_PORTS; i++) { 529 for (i = 0; i < U300_GPIO_NUM_PORTS; i++) {
diff --git a/arch/arm/mach-u300/include/mach/memory.h b/arch/arm/mach-u300/include/mach/memory.h
index ab000df7fc03..bf134bcc129d 100644
--- a/arch/arm/mach-u300/include/mach/memory.h
+++ b/arch/arm/mach-u300/include/mach/memory.h
@@ -35,14 +35,6 @@
35#endif 35#endif
36 36
37/* 37/*
38 * TCM memory whereabouts
39 */
40#define ITCM_OFFSET 0xffff2000
41#define ITCM_END 0xffff3fff
42#define DTCM_OFFSET 0xffff4000
43#define DTCM_END 0xffff5fff
44
45/*
46 * We enable a real big DMA buffer if need be. 38 * We enable a real big DMA buffer if need be.
47 */ 39 */
48#define CONSISTENT_DMA_SIZE SZ_4M 40#define CONSISTENT_DMA_SIZE SZ_4M
diff --git a/arch/arm/mach-u300/u300.c b/arch/arm/mach-u300/u300.c
index d2a0b8847a18..bfcda9820888 100644
--- a/arch/arm/mach-u300/u300.c
+++ b/arch/arm/mach-u300/u300.c
@@ -14,6 +14,7 @@
14#include <linux/sched.h> 14#include <linux/sched.h>
15#include <linux/interrupt.h> 15#include <linux/interrupt.h>
16#include <linux/ioport.h> 16#include <linux/ioport.h>
17#include <linux/memblock.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 <mach/hardware.h> 20#include <mach/hardware.h>
@@ -22,6 +23,21 @@
22#include <asm/mach-types.h> 23#include <asm/mach-types.h>
23#include <asm/mach/arch.h> 24#include <asm/mach/arch.h>
24 25
26static void __init u300_reserve(void)
27{
28 /*
29 * U300 - This platform family can share physical memory
30 * between two ARM cpus, one running Linux and the other
31 * running another OS.
32 */
33#ifdef CONFIG_MACH_U300_SINGLE_RAM
34#if ((CONFIG_MACH_U300_ACCESS_MEM_SIZE & 1) == 1) && \
35 CONFIG_MACH_U300_2MB_ALIGNMENT_FIX
36 memblock_reserve(PHYS_OFFSET, 0x00100000);
37#endif
38#endif
39}
40
25static void __init u300_init_machine(void) 41static void __init u300_init_machine(void)
26{ 42{
27 u300_init_devices(); 43 u300_init_devices();
@@ -49,6 +65,7 @@ MACHINE_START(U300, MACH_U300_STRING)
49 .io_pg_offst = ((U300_AHB_PER_VIRT_BASE) >> 18) & 0xfffc, 65 .io_pg_offst = ((U300_AHB_PER_VIRT_BASE) >> 18) & 0xfffc,
50 .boot_params = BOOT_PARAMS_OFFSET, 66 .boot_params = BOOT_PARAMS_OFFSET,
51 .map_io = u300_map_io, 67 .map_io = u300_map_io,
68 .reserve = u300_reserve,
52 .init_irq = u300_init_irq, 69 .init_irq = u300_init_irq,
53 .timer = &u300_timer, 70 .timer = &u300_timer,
54 .init_machine = u300_init_machine, 71 .init_machine = u300_init_machine,
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index bb8d7b771817..0e8fd135a57d 100644
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -13,19 +13,42 @@
13#include <linux/interrupt.h> 13#include <linux/interrupt.h>
14#include <linux/platform_device.h> 14#include <linux/platform_device.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/gpio.h>
16#include <linux/amba/bus.h> 17#include <linux/amba/bus.h>
17#include <linux/amba/pl022.h> 18#include <linux/amba/pl022.h>
18#include <linux/spi/spi.h> 19#include <linux/spi/spi.h>
20#include <linux/mfd/ab8500.h>
19 21
20#include <asm/mach-types.h> 22#include <asm/mach-types.h>
21#include <asm/mach/arch.h> 23#include <asm/mach/arch.h>
22 24
25#include <plat/pincfg.h>
23#include <plat/i2c.h> 26#include <plat/i2c.h>
24 27
25#include <mach/hardware.h> 28#include <mach/hardware.h>
26#include <mach/setup.h> 29#include <mach/setup.h>
27#include <mach/devices.h> 30#include <mach/devices.h>
28 31
32#include "pins-db8500.h"
33
34static pin_cfg_t mop500_pins[] = {
35 /* SSP0 */
36 GPIO143_SSP0_CLK,
37 GPIO144_SSP0_FRM,
38 GPIO145_SSP0_RXD,
39 GPIO146_SSP0_TXD,
40
41 /* I2C */
42 GPIO147_I2C0_SCL,
43 GPIO148_I2C0_SDA,
44 GPIO16_I2C1_SCL,
45 GPIO17_I2C1_SDA,
46 GPIO10_I2C2_SDA,
47 GPIO11_I2C2_SCL,
48 GPIO229_I2C3_SDA,
49 GPIO230_I2C3_SCL,
50};
51
29static void ab4500_spi_cs_control(u32 command) 52static void ab4500_spi_cs_control(u32 command)
30{ 53{
31 /* set the FRM signal, which is CS - TODO */ 54 /* set the FRM signal, which is CS - TODO */
@@ -48,15 +71,20 @@ struct pl022_config_chip ab4500_chip_info = {
48 .cs_control = ab4500_spi_cs_control, 71 .cs_control = ab4500_spi_cs_control,
49}; 72};
50 73
74static struct ab8500_platform_data ab8500_platdata = {
75 .irq_base = MOP500_AB8500_IRQ_BASE,
76};
77
51static struct spi_board_info u8500_spi_devices[] = { 78static struct spi_board_info u8500_spi_devices[] = {
52 { 79 {
53 .modalias = "ab8500", 80 .modalias = "ab8500",
54 .controller_data = &ab4500_chip_info, 81 .controller_data = &ab4500_chip_info,
82 .platform_data = &ab8500_platdata,
55 .max_speed_hz = 12000000, 83 .max_speed_hz = 12000000,
56 .bus_num = 0, 84 .bus_num = 0,
57 .chip_select = 0, 85 .chip_select = 0,
58 .mode = SPI_MODE_0, 86 .mode = SPI_MODE_0,
59 .irq = IRQ_AB4500, 87 .irq = IRQ_DB8500_AB8500,
60 }, 88 },
61}; 89};
62 90
@@ -118,6 +146,10 @@ static void __init u8500_init_machine(void)
118{ 146{
119 int i; 147 int i;
120 148
149 u8500_init_devices();
150
151 nmk_config_pins(mop500_pins, ARRAY_SIZE(mop500_pins));
152
121 u8500_i2c0_device.dev.platform_data = &u8500_i2c0_data; 153 u8500_i2c0_device.dev.platform_data = &u8500_i2c0_data;
122 ux500_i2c1_device.dev.platform_data = &u8500_i2c1_data; 154 ux500_i2c1_device.dev.platform_data = &u8500_i2c1_data;
123 ux500_i2c2_device.dev.platform_data = &u8500_i2c2_data; 155 ux500_i2c2_device.dev.platform_data = &u8500_i2c2_data;
@@ -133,8 +165,6 @@ static void __init u8500_init_machine(void)
133 165
134 spi_register_board_info(u8500_spi_devices, 166 spi_register_board_info(u8500_spi_devices,
135 ARRAY_SIZE(u8500_spi_devices)); 167 ARRAY_SIZE(u8500_spi_devices));
136
137 u8500_init_devices();
138} 168}
139 169
140MACHINE_START(U8500, "ST-Ericsson MOP500 platform") 170MACHINE_START(U8500, "ST-Ericsson MOP500 platform")
diff --git a/arch/arm/mach-ux500/clock.c b/arch/arm/mach-ux500/clock.c
index 0a1318fc8e2b..d8ab7f184fe4 100644
--- a/arch/arm/mach-ux500/clock.c
+++ b/arch/arm/mach-ux500/clock.c
@@ -453,7 +453,11 @@ static DEFINE_PRCC_CLK_CUSTOM(7, mtu0_ed, 2, -1, NULL, clk_mtu_get_rate, 0);
453static DEFINE_PRCC_CLK(7, wdg_ed, 1, -1, NULL); 453static DEFINE_PRCC_CLK(7, wdg_ed, 1, -1, NULL);
454static DEFINE_PRCC_CLK(7, cfgreg_ed, 0, -1, NULL); 454static DEFINE_PRCC_CLK(7, cfgreg_ed, 0, -1, NULL);
455 455
456static struct clk clk_dummy_apb_pclk;
457
456static struct clk_lookup u8500_common_clks[] = { 458static struct clk_lookup u8500_common_clks[] = {
459 CLK(dummy_apb_pclk, NULL, "apb_pclk"),
460
457 /* Peripheral Cluster #1 */ 461 /* Peripheral Cluster #1 */
458 CLK(gpio0, "gpio.0", NULL), 462 CLK(gpio0, "gpio.0", NULL),
459 CLK(gpio0, "gpio.1", NULL), 463 CLK(gpio0, "gpio.1", NULL),
diff --git a/arch/arm/mach-ux500/devices-db8500.c b/arch/arm/mach-ux500/devices-db8500.c
index 822903421943..654fca944e65 100644
--- a/arch/arm/mach-ux500/devices-db8500.c
+++ b/arch/arm/mach-ux500/devices-db8500.c
@@ -65,7 +65,7 @@ struct amba_device u8500_ssp0_device = {
65 .end = U8500_SSP0_BASE + SZ_4K - 1, 65 .end = U8500_SSP0_BASE + SZ_4K - 1,
66 .flags = IORESOURCE_MEM, 66 .flags = IORESOURCE_MEM,
67 }, 67 },
68 .irq = {IRQ_SSP0, NO_IRQ }, 68 .irq = {IRQ_DB8500_SSP0, NO_IRQ },
69 /* ST-Ericsson modified id */ 69 /* ST-Ericsson modified id */
70 .periphid = SSP_PER_ID, 70 .periphid = SSP_PER_ID,
71}; 71};
@@ -77,8 +77,8 @@ static struct resource u8500_i2c0_resources[] = {
77 .flags = IORESOURCE_MEM, 77 .flags = IORESOURCE_MEM,
78 }, 78 },
79 [1] = { 79 [1] = {
80 .start = IRQ_I2C0, 80 .start = IRQ_DB8500_I2C0,
81 .end = IRQ_I2C0, 81 .end = IRQ_DB8500_I2C0,
82 .flags = IORESOURCE_IRQ, 82 .flags = IORESOURCE_IRQ,
83 } 83 }
84}; 84};
@@ -97,8 +97,8 @@ static struct resource u8500_i2c4_resources[] = {
97 .flags = IORESOURCE_MEM, 97 .flags = IORESOURCE_MEM,
98 }, 98 },
99 [1] = { 99 [1] = {
100 .start = IRQ_I2C4, 100 .start = IRQ_DB8500_I2C4,
101 .end = IRQ_I2C4, 101 .end = IRQ_DB8500_I2C4,
102 .flags = IORESOURCE_IRQ, 102 .flags = IORESOURCE_IRQ,
103 } 103 }
104}; 104};
@@ -130,8 +130,8 @@ static struct resource dma40_resources[] = {
130 .name = "lcla", 130 .name = "lcla",
131 }, 131 },
132 [3] = { 132 [3] = {
133 .start = IRQ_DMA, 133 .start = IRQ_DB8500_DMA,
134 .end = IRQ_DMA, 134 .end = IRQ_DB8500_DMA,
135 .flags = IORESOURCE_IRQ} 135 .flags = IORESOURCE_IRQ}
136}; 136};
137 137
diff --git a/arch/arm/mach-ux500/include/mach/irqs-board-mop500.h b/arch/arm/mach-ux500/include/mach/irqs-board-mop500.h
new file mode 100644
index 000000000000..cca4f705601e
--- /dev/null
+++ b/arch/arm/mach-ux500/include/mach/irqs-board-mop500.h
@@ -0,0 +1,23 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com>
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8#ifndef __MACH_IRQS_BOARD_MOP500_H
9#define __MACH_IRQS_BOARD_MOP500_H
10
11#define AB8500_NR_IRQS 104
12
13#define MOP500_AB8500_IRQ_BASE IRQ_BOARD_START
14#define MOP500_AB8500_IRQ_END (MOP500_AB8500_IRQ_BASE \
15 + AB8500_NR_IRQS)
16#define MOP500_IRQ_END MOP500_AB8500_IRQ_END
17
18#if MOP500_IRQ_END > IRQ_BOARD_END
19#undef IRQ_BOARD_END
20#define IRQ_BOARD_END MOP500_IRQ_END
21#endif
22
23#endif
diff --git a/arch/arm/mach-ux500/include/mach/irqs-db5500.h b/arch/arm/mach-ux500/include/mach/irqs-db5500.h
new file mode 100644
index 000000000000..6fbfe5e2065a
--- /dev/null
+++ b/arch/arm/mach-ux500/include/mach/irqs-db5500.h
@@ -0,0 +1,85 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com>
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8#ifndef __MACH_IRQS_DB5500_H
9#define __MACH_IRQS_DB5500_H
10
11#define IRQ_DB5500_MTU0 (IRQ_SHPI_START + 4)
12#define IRQ_DB5500_SPI2 (IRQ_SHPI_START + 6)
13#define IRQ_DB5500_PMU0 (IRQ_SHPI_START + 7)
14#define IRQ_DB5500_SPI0 (IRQ_SHPI_START + 8)
15#define IRQ_DB5500_RTT (IRQ_SHPI_START + 9)
16#define IRQ_DB5500_PKA (IRQ_SHPI_START + 10)
17#define IRQ_DB5500_UART0 (IRQ_SHPI_START + 11)
18#define IRQ_DB5500_I2C3 (IRQ_SHPI_START + 12)
19#define IRQ_DB5500_L2CC (IRQ_SHPI_START + 13)
20#define IRQ_DB5500_MSP0 (IRQ_SHPI_START + 14)
21#define IRQ_DB5500_CRYP1 (IRQ_SHPI_START + 15)
22#define IRQ_DB5500_PMU1 (IRQ_SHPI_START + 16)
23#define IRQ_DB5500_MTU1 (IRQ_SHPI_START + 17)
24#define IRQ_DB5500_RTC (IRQ_SHPI_START + 18)
25#define IRQ_DB5500_UART1 (IRQ_SHPI_START + 19)
26#define IRQ_DB5500_USB_WAKEUP (IRQ_SHPI_START + 20)
27#define IRQ_DB5500_I2C0 (IRQ_SHPI_START + 21)
28#define IRQ_DB5500_I2C1 (IRQ_SHPI_START + 22)
29#define IRQ_DB5500_USBOTG (IRQ_SHPI_START + 23)
30#define IRQ_DB5500_DMA_SECURE (IRQ_SHPI_START + 24)
31#define IRQ_DB5500_DMA (IRQ_SHPI_START + 25)
32#define IRQ_DB5500_UART2 (IRQ_SHPI_START + 26)
33#define IRQ_DB5500_ICN_PMU1 (IRQ_SHPI_START + 27)
34#define IRQ_DB5500_ICN_PMU2 (IRQ_SHPI_START + 28)
35#define IRQ_DB5500_UART3 (IRQ_SHPI_START + 29)
36#define IRQ_DB5500_SPI3 (IRQ_SHPI_START + 30)
37#define IRQ_DB5500_SDMMC4 (IRQ_SHPI_START + 31)
38#define IRQ_DB5500_IRRC (IRQ_SHPI_START + 33)
39#define IRQ_DB5500_IRDA_FT (IRQ_SHPI_START + 34)
40#define IRQ_DB5500_IRDA_SD (IRQ_SHPI_START + 35)
41#define IRQ_DB5500_IRDA_FI (IRQ_SHPI_START + 36)
42#define IRQ_DB5500_IRDA_FD (IRQ_SHPI_START + 37)
43#define IRQ_DB5500_FSMC_CODEREADY (IRQ_SHPI_START + 38)
44#define IRQ_DB5500_FSMC_NANDWAIT (IRQ_SHPI_START + 39)
45#define IRQ_DB5500_AB5500 (IRQ_SHPI_START + 40)
46#define IRQ_DB5500_SDMMC2 (IRQ_SHPI_START + 41)
47#define IRQ_DB5500_SIA (IRQ_SHPI_START + 42)
48#define IRQ_DB5500_SIA2 (IRQ_SHPI_START + 43)
49#define IRQ_DB5500_HVA (IRQ_SHPI_START + 44)
50#define IRQ_DB5500_HVA2 (IRQ_SHPI_START + 45)
51#define IRQ_DB5500_PRCMU0 (IRQ_SHPI_START + 46)
52#define IRQ_DB5500_PRCMU1 (IRQ_SHPI_START + 47)
53#define IRQ_DB5500_DISP (IRQ_SHPI_START + 48)
54#define IRQ_DB5500_SDMMC1 (IRQ_SHPI_START + 50)
55#define IRQ_DB5500_MSP1 (IRQ_SHPI_START + 52)
56#define IRQ_DB5500_KBD (IRQ_SHPI_START + 53)
57#define IRQ_DB5500_I2C2 (IRQ_SHPI_START + 55)
58#define IRQ_DB5500_B2R2 (IRQ_SHPI_START + 56)
59#define IRQ_DB5500_CRYP0 (IRQ_SHPI_START + 57)
60#define IRQ_DB5500_SDMMC3 (IRQ_SHPI_START + 59)
61#define IRQ_DB5500_SDMMC0 (IRQ_SHPI_START + 60)
62#define IRQ_DB5500_HSEM (IRQ_SHPI_START + 61)
63#define IRQ_DB5500_SBAG (IRQ_SHPI_START + 63)
64#define IRQ_DB5500_SPI1 (IRQ_SHPI_START + 96)
65#define IRQ_DB5500_MSP2 (IRQ_SHPI_START + 98)
66#define IRQ_DB5500_SRPTIMER (IRQ_SHPI_START + 101)
67#define IRQ_DB5500_CTI0 (IRQ_SHPI_START + 108)
68#define IRQ_DB5500_CTI1 (IRQ_SHPI_START + 109)
69#define IRQ_DB5500_ICN_ERR (IRQ_SHPI_START + 110)
70#define IRQ_DB5500_MALI_PPMMU (IRQ_SHPI_START + 112)
71#define IRQ_DB5500_MALI_PP (IRQ_SHPI_START + 113)
72#define IRQ_DB5500_MALI_GPMMU (IRQ_SHPI_START + 114)
73#define IRQ_DB5500_MALI_GP (IRQ_SHPI_START + 115)
74#define IRQ_DB5500_MALI (IRQ_SHPI_START + 116)
75#define IRQ_DB5500_PRCMU_SEM (IRQ_SHPI_START + 118)
76#define IRQ_DB5500_GPIO0 (IRQ_SHPI_START + 119)
77#define IRQ_DB5500_GPIO1 (IRQ_SHPI_START + 120)
78#define IRQ_DB5500_GPIO2 (IRQ_SHPI_START + 121)
79#define IRQ_DB5500_GPIO3 (IRQ_SHPI_START + 122)
80#define IRQ_DB5500_GPIO4 (IRQ_SHPI_START + 123)
81#define IRQ_DB5500_GPIO5 (IRQ_SHPI_START + 124)
82#define IRQ_DB5500_GPIO6 (IRQ_SHPI_START + 125)
83#define IRQ_DB5500_GPIO7 (IRQ_SHPI_START + 126)
84
85#endif
diff --git a/arch/arm/mach-ux500/include/mach/irqs-db8500.h b/arch/arm/mach-ux500/include/mach/irqs-db8500.h
new file mode 100644
index 000000000000..8b5d9f0a1633
--- /dev/null
+++ b/arch/arm/mach-ux500/include/mach/irqs-db8500.h
@@ -0,0 +1,96 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * Author: Rabin Vincent <rabin.vincent@stericsson.com>
5 * License terms: GNU General Public License (GPL) version 2
6 */
7
8#ifndef __MACH_IRQS_DB8500_H
9#define __MACH_IRQS_DB8500_H
10
11#define IRQ_DB8500_MTU0 (IRQ_SHPI_START + 4)
12#define IRQ_DB8500_SPI2 (IRQ_SHPI_START + 6)
13#define IRQ_DB8500_PMU (IRQ_SHPI_START + 7)
14#define IRQ_DB8500_SPI0 (IRQ_SHPI_START + 8)
15#define IRQ_DB8500_RTT (IRQ_SHPI_START + 9)
16#define IRQ_DB8500_PKA (IRQ_SHPI_START + 10)
17#define IRQ_DB8500_UART0 (IRQ_SHPI_START + 11)
18#define IRQ_DB8500_I2C3 (IRQ_SHPI_START + 12)
19#define IRQ_DB8500_L2CC (IRQ_SHPI_START + 13)
20#define IRQ_DB8500_SSP0 (IRQ_SHPI_START + 14)
21#define IRQ_DB8500_CRYP1 (IRQ_SHPI_START + 15)
22#define IRQ_DB8500_MSP1_RX (IRQ_SHPI_START + 16)
23#define IRQ_DB8500_MTU1 (IRQ_SHPI_START + 17)
24#define IRQ_DB8500_RTC (IRQ_SHPI_START + 18)
25#define IRQ_DB8500_UART1 (IRQ_SHPI_START + 19)
26#define IRQ_DB8500_USB_WAKEUP (IRQ_SHPI_START + 20)
27#define IRQ_DB8500_I2C0 (IRQ_SHPI_START + 21)
28#define IRQ_DB8500_I2C1 (IRQ_SHPI_START + 22)
29#define IRQ_DB8500_USBOTG (IRQ_SHPI_START + 23)
30#define IRQ_DB8500_DMA_SECURE (IRQ_SHPI_START + 24)
31#define IRQ_DB8500_DMA (IRQ_SHPI_START + 25)
32#define IRQ_DB8500_UART2 (IRQ_SHPI_START + 26)
33#define IRQ_DB8500_ICN_PMU1 (IRQ_SHPI_START + 27)
34#define IRQ_DB8500_ICN_PMU2 (IRQ_SHPI_START + 28)
35#define IRQ_DB8500_HSIR_EXCEP (IRQ_SHPI_START + 29)
36#define IRQ_DB8500_MSP0 (IRQ_SHPI_START + 31)
37#define IRQ_DB8500_HSIR_CH0_OVRRUN (IRQ_SHPI_START + 32)
38#define IRQ_DB8500_HSIR_CH1_OVRRUN (IRQ_SHPI_START + 33)
39#define IRQ_DB8500_HSIR_CH2_OVRRUN (IRQ_SHPI_START + 34)
40#define IRQ_DB8500_HSIR_CH3_OVRRUN (IRQ_SHPI_START + 35)
41#define IRQ_DB8500_HSIR_CH4_OVRRUN (IRQ_SHPI_START + 36)
42#define IRQ_DB8500_HSIR_CH5_OVRRUN (IRQ_SHPI_START + 37)
43#define IRQ_DB8500_HSIR_CH6_OVRRUN (IRQ_SHPI_START + 38)
44#define IRQ_DB8500_HSIR_CH7_OVRRUN (IRQ_SHPI_START + 39)
45#define IRQ_DB8500_AB8500 (IRQ_SHPI_START + 40)
46#define IRQ_DB8500_SDMMC2 (IRQ_SHPI_START + 41)
47#define IRQ_DB8500_SIA (IRQ_SHPI_START + 42)
48#define IRQ_DB8500_SIA2 (IRQ_SHPI_START + 43)
49#define IRQ_DB8500_SVA (IRQ_SHPI_START + 44)
50#define IRQ_DB8500_SVA2 (IRQ_SHPI_START + 45)
51#define IRQ_DB8500_PRCMU0 (IRQ_SHPI_START + 46)
52#define IRQ_DB8500_PRCMU1 (IRQ_SHPI_START + 47)
53#define IRQ_DB8500_DISP (IRQ_SHPI_START + 48)
54#define IRQ_DB8500_SPI3 (IRQ_SHPI_START + 49)
55#define IRQ_DB8500_SDMMC1 (IRQ_SHPI_START + 50)
56#define IRQ_DB8500_I2C4 (IRQ_SHPI_START + 51)
57#define IRQ_DB8500_SSP1 (IRQ_SHPI_START + 52)
58#define IRQ_DB8500_SKE (IRQ_SHPI_START + 53)
59#define IRQ_DB8500_KB (IRQ_SHPI_START + 54)
60#define IRQ_DB8500_I2C2 (IRQ_SHPI_START + 55)
61#define IRQ_DB8500_B2R2 (IRQ_SHPI_START + 56)
62#define IRQ_DB8500_CRYP0 (IRQ_SHPI_START + 57)
63#define IRQ_DB8500_SDMMC3 (IRQ_SHPI_START + 59)
64#define IRQ_DB8500_SDMMC0 (IRQ_SHPI_START + 60)
65#define IRQ_DB8500_HSEM (IRQ_SHPI_START + 61)
66#define IRQ_DB8500_MSP1 (IRQ_SHPI_START + 62)
67#define IRQ_DB8500_SBAG (IRQ_SHPI_START + 63)
68#define IRQ_DB8500_SPI1 (IRQ_SHPI_START + 96)
69#define IRQ_DB8500_SRPTIMER (IRQ_SHPI_START + 97)
70#define IRQ_DB8500_MSP2 (IRQ_SHPI_START + 98)
71#define IRQ_DB8500_SDMMC4 (IRQ_SHPI_START + 99)
72#define IRQ_DB8500_SDMMC5 (IRQ_SHPI_START + 100)
73#define IRQ_DB8500_HSIRD0 (IRQ_SHPI_START + 104)
74#define IRQ_DB8500_HSIRD1 (IRQ_SHPI_START + 105)
75#define IRQ_DB8500_HSITD0 (IRQ_SHPI_START + 106)
76#define IRQ_DB8500_HSITD1 (IRQ_SHPI_START + 107)
77#define IRQ_DB8500_CTI0 (IRQ_SHPI_START + 108)
78#define IRQ_DB8500_CTI1 (IRQ_SHPI_START + 109)
79#define IRQ_DB8500_ICN_ERR (IRQ_SHPI_START + 110)
80#define IRQ_DB8500_MALI_PPMMU (IRQ_SHPI_START + 112)
81#define IRQ_DB8500_MALI_PP (IRQ_SHPI_START + 113)
82#define IRQ_DB8500_MALI_GPMMU (IRQ_SHPI_START + 114)
83#define IRQ_DB8500_MALI_GP (IRQ_SHPI_START + 115)
84#define IRQ_DB8500_MALI (IRQ_SHPI_START + 116)
85#define IRQ_DB8500_PRCMU_SEM (IRQ_SHPI_START + 118)
86#define IRQ_DB8500_GPIO0 (IRQ_SHPI_START + 119)
87#define IRQ_DB8500_GPIO1 (IRQ_SHPI_START + 120)
88#define IRQ_DB8500_GPIO2 (IRQ_SHPI_START + 121)
89#define IRQ_DB8500_GPIO3 (IRQ_SHPI_START + 122)
90#define IRQ_DB8500_GPIO4 (IRQ_SHPI_START + 123)
91#define IRQ_DB8500_GPIO5 (IRQ_SHPI_START + 124)
92#define IRQ_DB8500_GPIO6 (IRQ_SHPI_START + 125)
93#define IRQ_DB8500_GPIO7 (IRQ_SHPI_START + 126)
94#define IRQ_DB8500_GPIO8 (IRQ_SHPI_START + 127)
95
96#endif
diff --git a/arch/arm/mach-ux500/include/mach/irqs.h b/arch/arm/mach-ux500/include/mach/irqs.h
index 7970684b1d09..10385bdc2b77 100644
--- a/arch/arm/mach-ux500/include/mach/irqs.h
+++ b/arch/arm/mach-ux500/include/mach/irqs.h
@@ -10,7 +10,8 @@
10#ifndef ASM_ARCH_IRQS_H 10#ifndef ASM_ARCH_IRQS_H
11#define ASM_ARCH_IRQS_H 11#define ASM_ARCH_IRQS_H
12 12
13#include <mach/hardware.h> 13#include <mach/irqs-db5500.h>
14#include <mach/irqs-db8500.h>
14 15
15#define IRQ_LOCALTIMER 29 16#define IRQ_LOCALTIMER 29
16#define IRQ_LOCALWDOG 30 17#define IRQ_LOCALWDOG 30
@@ -67,12 +68,21 @@
67/* There are 128 shared peripheral interrupts assigned to 68/* There are 128 shared peripheral interrupts assigned to
68 * INTID[160:32]. The first 32 interrupts are reserved. 69 * INTID[160:32]. The first 32 interrupts are reserved.
69 */ 70 */
70#define U8500_SOC_NR_IRQS 161 71#define DBX500_NR_INTERNAL_IRQS 161
71 72
72/* After chip-specific IRQ numbers we have the GPIO ones */ 73/* After chip-specific IRQ numbers we have the GPIO ones */
73#define NOMADIK_NR_GPIO 288 74#define NOMADIK_NR_GPIO 288
74#define NOMADIK_GPIO_TO_IRQ(gpio) ((gpio) + U8500_SOC_NR_IRQS) 75#define NOMADIK_GPIO_TO_IRQ(gpio) ((gpio) + DBX500_NR_INTERNAL_IRQS)
75#define NOMADIK_IRQ_TO_GPIO(irq) ((irq) - U8500_SOC_NR_IRQS) 76#define NOMADIK_IRQ_TO_GPIO(irq) ((irq) - DBX500_NR_INTERNAL_IRQS)
76#define NR_IRQS NOMADIK_GPIO_TO_IRQ(NOMADIK_NR_GPIO) 77#define IRQ_BOARD_START NOMADIK_GPIO_TO_IRQ(NOMADIK_NR_GPIO)
77 78
78#endif /*ASM_ARCH_IRQS_H*/ 79/* This will be overridden by board-specific irq headers */
80#define IRQ_BOARD_END IRQ_BOARD_START
81
82#ifdef CONFIG_MACH_U8500_MOP
83#include <mach/irqs-board-mop500.h>
84#endif
85
86#define NR_IRQS IRQ_BOARD_END
87
88#endif /* ASM_ARCH_IRQS_H */
diff --git a/arch/arm/mach-ux500/include/mach/uncompress.h b/arch/arm/mach-ux500/include/mach/uncompress.h
index 8552eb188b50..0271ca0a83df 100644
--- a/arch/arm/mach-ux500/include/mach/uncompress.h
+++ b/arch/arm/mach-ux500/include/mach/uncompress.h
@@ -30,22 +30,22 @@
30static void putc(const char c) 30static void putc(const char c)
31{ 31{
32 /* Do nothing if the UART is not enabled. */ 32 /* Do nothing if the UART is not enabled. */
33 if (!(readb(U8500_UART_CR) & 0x1)) 33 if (!(__raw_readb(U8500_UART_CR) & 0x1))
34 return; 34 return;
35 35
36 if (c == '\n') 36 if (c == '\n')
37 putc('\r'); 37 putc('\r');
38 38
39 while (readb(U8500_UART_FR) & (1 << 5)) 39 while (__raw_readb(U8500_UART_FR) & (1 << 5))
40 barrier(); 40 barrier();
41 writeb(c, U8500_UART_DR); 41 __raw_writeb(c, U8500_UART_DR);
42} 42}
43 43
44static void flush(void) 44static void flush(void)
45{ 45{
46 if (!(readb(U8500_UART_CR) & 0x1)) 46 if (!(__raw_readb(U8500_UART_CR) & 0x1))
47 return; 47 return;
48 while (readb(U8500_UART_FR) & (1 << 3)) 48 while (__raw_readb(U8500_UART_FR) & (1 << 3))
49 barrier(); 49 barrier();
50} 50}
51 51
diff --git a/arch/arm/mach-ux500/pins-db8500.h b/arch/arm/mach-ux500/pins-db8500.h
new file mode 100644
index 000000000000..9055d5d3233c
--- /dev/null
+++ b/arch/arm/mach-ux500/pins-db8500.h
@@ -0,0 +1,742 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License terms: GNU General Public License, version 2
5 * Author: Rabin Vincent <rabin.vincent@stericsson.com>
6 */
7
8#ifndef __MACH_PINS_DB8500_H
9#define __MACH_PINS_DB8500_H
10
11/*
12 * TODO: Eventually encode all non-board specific pull up/down configuration
13 * here.
14 */
15
16#define GPIO0_GPIO PIN_CFG(0, GPIO)
17#define GPIO0_U0_CTSn PIN_CFG(0, ALT_A)
18#define GPIO0_TRIG_OUT PIN_CFG(0, ALT_B)
19#define GPIO0_IP_TDO PIN_CFG(0, ALT_C)
20
21#define GPIO1_GPIO PIN_CFG(1, GPIO)
22#define GPIO1_U0_RTSn PIN_CFG(1, ALT_A)
23#define GPIO1_TRIG_IN PIN_CFG(1, ALT_B)
24#define GPIO1_IP_TDI PIN_CFG(1, ALT_C)
25
26#define GPIO2_GPIO PIN_CFG(2, GPIO)
27#define GPIO2_U0_RXD PIN_CFG(2, ALT_A)
28#define GPIO2_NONE PIN_CFG(2, ALT_B)
29#define GPIO2_IP_TMS PIN_CFG(2, ALT_C)
30
31#define GPIO3_GPIO PIN_CFG(3, GPIO)
32#define GPIO3_U0_TXD PIN_CFG(3, ALT_A)
33#define GPIO3_NONE PIN_CFG(3, ALT_B)
34#define GPIO3_IP_TCK PIN_CFG(3, ALT_C)
35
36#define GPIO4_GPIO PIN_CFG(4, GPIO)
37#define GPIO4_U1_RXD PIN_CFG(4, ALT_A)
38#define GPIO4_I2C4_SCL PIN_CFG_PULL(4, ALT_B, UP)
39#define GPIO4_IP_TRSTn PIN_CFG(4, ALT_C)
40
41#define GPIO5_GPIO PIN_CFG(5, GPIO)
42#define GPIO5_U1_TXD PIN_CFG(5, ALT_A)
43#define GPIO5_I2C4_SDA PIN_CFG_PULL(5, ALT_B, UP)
44#define GPIO5_IP_GPIO6 PIN_CFG(5, ALT_C)
45
46#define GPIO6_GPIO PIN_CFG(6, GPIO)
47#define GPIO6_U1_CTSn PIN_CFG(6, ALT_A)
48#define GPIO6_I2C1_SCL PIN_CFG_PULL(6, ALT_B, UP)
49#define GPIO6_IP_GPIO0 PIN_CFG(6, ALT_C)
50
51#define GPIO7_GPIO PIN_CFG(7, GPIO)
52#define GPIO7_U1_RTSn PIN_CFG(7, ALT_A)
53#define GPIO7_I2C1_SDA PIN_CFG_PULL(7, ALT_B, UP)
54#define GPIO7_IP_GPIO1 PIN_CFG(7, ALT_C)
55
56#define GPIO8_GPIO PIN_CFG(8, GPIO)
57#define GPIO8_IPI2C_SDA PIN_CFG_PULL(8, ALT_A, UP)
58#define GPIO8_I2C2_SDA PIN_CFG_PULL(8, ALT_B, UP)
59
60#define GPIO9_GPIO PIN_CFG(9, GPIO)
61#define GPIO9_IPI2C_SCL PIN_CFG_PULL(9, ALT_A, UP)
62#define GPIO9_I2C2_SCL PIN_CFG_PULL(9, ALT_B, UP)
63
64#define GPIO10_GPIO PIN_CFG(10, GPIO)
65#define GPIO10_IPI2C_SDA PIN_CFG_PULL(10, ALT_A, UP)
66#define GPIO10_I2C2_SDA PIN_CFG_PULL(10, ALT_B, UP)
67#define GPIO10_IP_GPIO3 PIN_CFG(10, ALT_C)
68
69#define GPIO11_GPIO PIN_CFG(11, GPIO)
70#define GPIO11_IPI2C_SCL PIN_CFG_PULL(11, ALT_A, UP)
71#define GPIO11_I2C2_SCL PIN_CFG_PULL(11, ALT_B, UP)
72#define GPIO11_IP_GPIO2 PIN_CFG(11, ALT_C)
73
74#define GPIO12_GPIO PIN_CFG(12, GPIO)
75#define GPIO12_MSP0_TXD PIN_CFG(12, ALT_A)
76#define GPIO12_MSP0_RXD PIN_CFG(12, ALT_B)
77
78#define GPIO13_GPIO PIN_CFG(13, GPIO)
79#define GPIO13_MSP0_TFS PIN_CFG(13, ALT_A)
80
81#define GPIO14_GPIO PIN_CFG(14, GPIO)
82#define GPIO14_MSP0_TCK PIN_CFG(14, ALT_A)
83
84#define GPIO15_GPIO PIN_CFG(15, GPIO)
85#define GPIO15_MSP0_RXD PIN_CFG(15, ALT_A)
86#define GPIO15_MSP0_TXD PIN_CFG(15, ALT_B)
87
88#define GPIO16_GPIO PIN_CFG(16, GPIO)
89#define GPIO16_MSP0_RFS PIN_CFG(16, ALT_A)
90#define GPIO16_I2C1_SCL PIN_CFG_PULL(16, ALT_B, UP)
91#define GPIO16_SLIM0_DAT PIN_CFG(16, ALT_C)
92
93#define GPIO17_GPIO PIN_CFG(17, GPIO)
94#define GPIO17_MSP0_RCK PIN_CFG(17, ALT_A)
95#define GPIO17_I2C1_SDA PIN_CFG_PULL(17, ALT_B, UP)
96#define GPIO17_SLIM0_CLK PIN_CFG(17, ALT_C)
97
98#define GPIO18_GPIO PIN_CFG(18, GPIO)
99#define GPIO18_MC0_CMDDIR PIN_CFG(18, ALT_A)
100#define GPIO18_U2_RXD PIN_CFG(18, ALT_B)
101#define GPIO18_MS_IEP PIN_CFG(18, ALT_C)
102
103#define GPIO19_GPIO PIN_CFG(19, GPIO)
104#define GPIO19_MC0_DAT0DIR PIN_CFG(19, ALT_A)
105#define GPIO19_U2_TXD PIN_CFG(19, ALT_B)
106#define GPIO19_MS_DAT0DIR PIN_CFG(19, ALT_C)
107
108#define GPIO20_GPIO PIN_CFG(20, GPIO)
109#define GPIO20_MC0_DAT2DIR PIN_CFG(20, ALT_A)
110#define GPIO20_UARTMOD_TXD PIN_CFG(20, ALT_B)
111#define GPIO20_IP_TRIGOUT PIN_CFG(20, ALT_C)
112
113#define GPIO21_GPIO PIN_CFG(21, GPIO)
114#define GPIO21_MC0_DAT31DIR PIN_CFG(21, ALT_A)
115#define GPIO21_MSP0_SCK PIN_CFG(21, ALT_B)
116#define GPIO21_MS_DAT31DIR PIN_CFG(21, ALT_C)
117
118#define GPIO22_GPIO PIN_CFG(22, GPIO)
119#define GPIO22_MC0_FBCLK PIN_CFG(22, ALT_A)
120#define GPIO22_UARTMOD_RXD PIN_CFG(22, ALT_B)
121#define GPIO22_MS_FBCLK PIN_CFG(22, ALT_C)
122
123#define GPIO23_GPIO PIN_CFG(23, GPIO)
124#define GPIO23_MC0_CLK PIN_CFG(23, ALT_A)
125#define GPIO23_STMMOD_CLK PIN_CFG(23, ALT_B)
126#define GPIO23_MS_CLK PIN_CFG(23, ALT_C)
127
128#define GPIO24_GPIO PIN_CFG(24, GPIO)
129#define GPIO24_MC0_CMD PIN_CFG(24, ALT_A)
130#define GPIO24_UARTMOD_RXD PIN_CFG(24, ALT_B)
131#define GPIO24_MS_BS PIN_CFG(24, ALT_C)
132
133#define GPIO25_GPIO PIN_CFG(25, GPIO)
134#define GPIO25_MC0_DAT0 PIN_CFG(25, ALT_A)
135#define GPIO25_STMMOD_DAT0 PIN_CFG(25, ALT_B)
136#define GPIO25_MS_DAT0 PIN_CFG(25, ALT_C)
137
138#define GPIO26_GPIO PIN_CFG(26, GPIO)
139#define GPIO26_MC0_DAT1 PIN_CFG(26, ALT_A)
140#define GPIO26_STMMOD_DAT1 PIN_CFG(26, ALT_B)
141#define GPIO26_MS_DAT1 PIN_CFG(26, ALT_C)
142
143#define GPIO27_GPIO PIN_CFG(27, GPIO)
144#define GPIO27_MC0_DAT2 PIN_CFG(27, ALT_A)
145#define GPIO27_STMMOD_DAT2 PIN_CFG(27, ALT_B)
146#define GPIO27_MS_DAT2 PIN_CFG(27, ALT_C)
147
148#define GPIO28_GPIO PIN_CFG(28, GPIO)
149#define GPIO28_MC0_DAT3 PIN_CFG(28, ALT_A)
150#define GPIO28_STMMOD_DAT3 PIN_CFG(28, ALT_B)
151#define GPIO28_MS_DAT3 PIN_CFG(28, ALT_C)
152
153#define GPIO29_GPIO PIN_CFG(29, GPIO)
154#define GPIO29_MC0_DAT4 PIN_CFG(29, ALT_A)
155#define GPIO29_SPI3_CLK PIN_CFG(29, ALT_B)
156#define GPIO29_U2_RXD PIN_CFG(29, ALT_C)
157
158#define GPIO30_GPIO PIN_CFG(30, GPIO)
159#define GPIO30_MC0_DAT5 PIN_CFG(30, ALT_A)
160#define GPIO30_SPI3_RXD PIN_CFG(30, ALT_B)
161#define GPIO30_U2_TXD PIN_CFG(30, ALT_C)
162
163#define GPIO31_GPIO PIN_CFG(31, GPIO)
164#define GPIO31_MC0_DAT6 PIN_CFG(31, ALT_A)
165#define GPIO31_SPI3_FRM PIN_CFG(31, ALT_B)
166#define GPIO31_U2_CTSn PIN_CFG(31, ALT_C)
167
168#define GPIO32_GPIO PIN_CFG(32, GPIO)
169#define GPIO32_MC0_DAT7 PIN_CFG(32, ALT_A)
170#define GPIO32_SPI3_TXD PIN_CFG(32, ALT_B)
171#define GPIO32_U2_RTSn PIN_CFG(32, ALT_C)
172
173#define GPIO33_GPIO PIN_CFG(33, GPIO)
174#define GPIO33_MSP1_TXD PIN_CFG(33, ALT_A)
175#define GPIO33_MSP1_RXD PIN_CFG(33, ALT_B)
176#define GPIO33_U0_DTRn PIN_CFG(33, ALT_C)
177
178#define GPIO34_GPIO PIN_CFG(34, GPIO)
179#define GPIO34_MSP1_TFS PIN_CFG(34, ALT_A)
180#define GPIO34_NONE PIN_CFG(34, ALT_B)
181#define GPIO34_U0_DCDn PIN_CFG(34, ALT_C)
182
183#define GPIO35_GPIO PIN_CFG(35, GPIO)
184#define GPIO35_MSP1_TCK PIN_CFG(35, ALT_A)
185#define GPIO35_NONE PIN_CFG(35, ALT_B)
186#define GPIO35_U0_DSRn PIN_CFG(35, ALT_C)
187
188#define GPIO36_GPIO PIN_CFG(36, GPIO)
189#define GPIO36_MSP1_RXD PIN_CFG(36, ALT_A)
190#define GPIO36_MSP1_TXD PIN_CFG(36, ALT_B)
191#define GPIO36_U0_RIn PIN_CFG(36, ALT_C)
192
193#define GPIO64_GPIO PIN_CFG(64, GPIO)
194#define GPIO64_LCDB_DE PIN_CFG(64, ALT_A)
195#define GPIO64_KP_O1 PIN_CFG(64, ALT_B)
196#define GPIO64_IP_GPIO4 PIN_CFG(64, ALT_C)
197
198#define GPIO65_GPIO PIN_CFG(65, GPIO)
199#define GPIO65_LCDB_HSO PIN_CFG(65, ALT_A)
200#define GPIO65_KP_O0 PIN_CFG(65, ALT_B)
201#define GPIO65_IP_GPIO5 PIN_CFG(65, ALT_C)
202
203#define GPIO66_GPIO PIN_CFG(66, GPIO)
204#define GPIO66_LCDB_VSO PIN_CFG(66, ALT_A)
205#define GPIO66_KP_I1 PIN_CFG(66, ALT_B)
206#define GPIO66_IP_GPIO6 PIN_CFG(66, ALT_C)
207
208#define GPIO67_GPIO PIN_CFG(67, GPIO)
209#define GPIO67_LCDB_CLK PIN_CFG(67, ALT_A)
210#define GPIO67_KP_I0 PIN_CFG(67, ALT_B)
211#define GPIO67_IP_GPIO7 PIN_CFG(67, ALT_C)
212
213#define GPIO68_GPIO PIN_CFG(68, GPIO)
214#define GPIO68_LCD_VSI0 PIN_CFG(68, ALT_A)
215#define GPIO68_KP_O7 PIN_CFG(68, ALT_B)
216#define GPIO68_SM_CLE PIN_CFG(68, ALT_C)
217
218#define GPIO69_GPIO PIN_CFG(69, GPIO)
219#define GPIO69_LCD_VSI1 PIN_CFG(69, ALT_A)
220#define GPIO69_KP_I7 PIN_CFG(69, ALT_B)
221#define GPIO69_SM_ALE PIN_CFG(69, ALT_C)
222
223#define GPIO70_GPIO PIN_CFG(70, GPIO)
224#define GPIO70_LCD_D0 PIN_CFG(70, ALT_A)
225#define GPIO70_KP_O5 PIN_CFG(70, ALT_B)
226#define GPIO70_STMAPE_CLK PIN_CFG(70, ALT_C)
227
228#define GPIO71_GPIO PIN_CFG(71, GPIO)
229#define GPIO71_LCD_D1 PIN_CFG(71, ALT_A)
230#define GPIO71_KP_O4 PIN_CFG(71, ALT_B)
231#define GPIO71_STMAPE_DAT3 PIN_CFG(71, ALT_C)
232
233#define GPIO72_GPIO PIN_CFG(72, GPIO)
234#define GPIO72_LCD_D2 PIN_CFG(72, ALT_A)
235#define GPIO72_KP_O3 PIN_CFG(72, ALT_B)
236#define GPIO72_STMAPE_DAT2 PIN_CFG(72, ALT_C)
237
238#define GPIO73_GPIO PIN_CFG(73, GPIO)
239#define GPIO73_LCD_D3 PIN_CFG(73, ALT_A)
240#define GPIO73_KP_O2 PIN_CFG(73, ALT_B)
241#define GPIO73_STMAPE_DAT1 PIN_CFG(73, ALT_C)
242
243#define GPIO74_GPIO PIN_CFG(74, GPIO)
244#define GPIO74_LCD_D4 PIN_CFG(74, ALT_A)
245#define GPIO74_KP_I5 PIN_CFG(74, ALT_B)
246#define GPIO74_STMAPE_DAT0 PIN_CFG(74, ALT_C)
247
248#define GPIO75_GPIO PIN_CFG(75, GPIO)
249#define GPIO75_LCD_D5 PIN_CFG(75, ALT_A)
250#define GPIO75_KP_I4 PIN_CFG(75, ALT_B)
251#define GPIO75_U2_RXD PIN_CFG(75, ALT_C)
252
253#define GPIO76_GPIO PIN_CFG(76, GPIO)
254#define GPIO76_LCD_D6 PIN_CFG(76, ALT_A)
255#define GPIO76_KP_I3 PIN_CFG(76, ALT_B)
256#define GPIO76_U2_TXD PIN_CFG(76, ALT_C)
257
258#define GPIO77_GPIO PIN_CFG(77, GPIO)
259#define GPIO77_LCD_D7 PIN_CFG(77, ALT_A)
260#define GPIO77_KP_I2 PIN_CFG(77, ALT_B)
261#define GPIO77_NONE PIN_CFG(77, ALT_C)
262
263#define GPIO78_GPIO PIN_CFG(78, GPIO)
264#define GPIO78_LCD_D8 PIN_CFG(78, ALT_A)
265#define GPIO78_KP_O6 PIN_CFG(78, ALT_B)
266#define GPIO78_IP_GPIO2 PIN_CFG(78, ALT_C)
267
268#define GPIO79_GPIO PIN_CFG(79, GPIO)
269#define GPIO79_LCD_D9 PIN_CFG(79, ALT_A)
270#define GPIO79_KP_I6 PIN_CFG(79, ALT_B)
271#define GPIO79_IP_GPIO3 PIN_CFG(79, ALT_C)
272
273#define GPIO80_GPIO PIN_CFG(80, GPIO)
274#define GPIO80_LCD_D10 PIN_CFG(80, ALT_A)
275#define GPIO80_KP_SKA0 PIN_CFG(80, ALT_B)
276#define GPIO80_IP_GPIO4 PIN_CFG(80, ALT_C)
277
278#define GPIO81_GPIO PIN_CFG(81, GPIO)
279#define GPIO81_LCD_D11 PIN_CFG(81, ALT_A)
280#define GPIO81_KP_SKB0 PIN_CFG(81, ALT_B)
281#define GPIO81_IP_GPIO5 PIN_CFG(81, ALT_C)
282
283#define GPIO82_GPIO PIN_CFG(82, GPIO)
284#define GPIO82_LCD_D12 PIN_CFG(82, ALT_A)
285#define GPIO82_KP_O5 PIN_CFG(82, ALT_B)
286
287#define GPIO83_GPIO PIN_CFG(83, GPIO)
288#define GPIO83_LCD_D13 PIN_CFG(83, ALT_A)
289#define GPIO83_KP_O4 PIN_CFG(83, ALT_B)
290
291#define GPIO84_GPIO PIN_CFG(84, GPIO)
292#define GPIO84_LCD_D14 PIN_CFG(84, ALT_A)
293#define GPIO84_KP_I5 PIN_CFG(84, ALT_B)
294
295#define GPIO85_GPIO PIN_CFG(85, GPIO)
296#define GPIO85_LCD_D15 PIN_CFG(85, ALT_A)
297#define GPIO85_KP_I4 PIN_CFG(85, ALT_B)
298
299#define GPIO86_GPIO PIN_CFG(86, GPIO)
300#define GPIO86_LCD_D16 PIN_CFG(86, ALT_A)
301#define GPIO86_SM_ADQ0 PIN_CFG(86, ALT_B)
302#define GPIO86_MC5_DAT0 PIN_CFG(86, ALT_C)
303
304#define GPIO87_GPIO PIN_CFG(87, GPIO)
305#define GPIO87_LCD_D17 PIN_CFG(87, ALT_A)
306#define GPIO87_SM_ADQ1 PIN_CFG(87, ALT_B)
307#define GPIO87_MC5_DAT1 PIN_CFG(87, ALT_C)
308
309#define GPIO88_GPIO PIN_CFG(88, GPIO)
310#define GPIO88_LCD_D18 PIN_CFG(88, ALT_A)
311#define GPIO88_SM_ADQ2 PIN_CFG(88, ALT_B)
312#define GPIO88_MC5_DAT2 PIN_CFG(88, ALT_C)
313
314#define GPIO89_GPIO PIN_CFG(89, GPIO)
315#define GPIO89_LCD_D19 PIN_CFG(89, ALT_A)
316#define GPIO89_SM_ADQ3 PIN_CFG(89, ALT_B)
317#define GPIO89_MC5_DAT3 PIN_CFG(89, ALT_C)
318
319#define GPIO90_GPIO PIN_CFG(90, GPIO)
320#define GPIO90_LCD_D20 PIN_CFG(90, ALT_A)
321#define GPIO90_SM_ADQ4 PIN_CFG(90, ALT_B)
322#define GPIO90_MC5_CMD PIN_CFG(90, ALT_C)
323
324#define GPIO91_GPIO PIN_CFG(91, GPIO)
325#define GPIO91_LCD_D21 PIN_CFG(91, ALT_A)
326#define GPIO91_SM_ADQ5 PIN_CFG(91, ALT_B)
327#define GPIO91_MC5_FBCLK PIN_CFG(91, ALT_C)
328
329#define GPIO92_GPIO PIN_CFG(92, GPIO)
330#define GPIO92_LCD_D22 PIN_CFG(92, ALT_A)
331#define GPIO92_SM_ADQ6 PIN_CFG(92, ALT_B)
332#define GPIO92_MC5_CLK PIN_CFG(92, ALT_C)
333
334#define GPIO93_GPIO PIN_CFG(93, GPIO)
335#define GPIO93_LCD_D23 PIN_CFG(93, ALT_A)
336#define GPIO93_SM_ADQ7 PIN_CFG(93, ALT_B)
337#define GPIO93_MC5_DAT4 PIN_CFG(93, ALT_C)
338
339#define GPIO94_GPIO PIN_CFG(94, GPIO)
340#define GPIO94_KP_O7 PIN_CFG(94, ALT_A)
341#define GPIO94_SM_ADVn PIN_CFG(94, ALT_B)
342#define GPIO94_MC5_DAT5 PIN_CFG(94, ALT_C)
343
344#define GPIO95_GPIO PIN_CFG(95, GPIO)
345#define GPIO95_KP_I7 PIN_CFG(95, ALT_A)
346#define GPIO95_SM_CS0n PIN_CFG(95, ALT_B)
347#define GPIO95_SM_PS0n PIN_CFG(95, ALT_C)
348
349#define GPIO96_GPIO PIN_CFG(96, GPIO)
350#define GPIO96_KP_O6 PIN_CFG(96, ALT_A)
351#define GPIO96_SM_OEn PIN_CFG(96, ALT_B)
352#define GPIO96_MC5_DAT6 PIN_CFG(96, ALT_C)
353
354#define GPIO97_GPIO PIN_CFG(97, GPIO)
355#define GPIO97_KP_I6 PIN_CFG(97, ALT_A)
356#define GPIO97_SM_WEn PIN_CFG(97, ALT_B)
357#define GPIO97_MC5_DAT7 PIN_CFG(97, ALT_C)
358
359#define GPIO128_GPIO PIN_CFG(128, GPIO)
360#define GPIO128_MC2_CLK PIN_CFG(128, ALT_A)
361#define GPIO128_SM_CKO PIN_CFG(128, ALT_B)
362
363#define GPIO129_GPIO PIN_CFG(129, GPIO)
364#define GPIO129_MC2_CMD PIN_CFG(129, ALT_A)
365#define GPIO129_SM_WAIT0n PIN_CFG(129, ALT_B)
366
367#define GPIO130_GPIO PIN_CFG(130, GPIO)
368#define GPIO130_MC2_FBCLK PIN_CFG(130, ALT_A)
369#define GPIO130_SM_FBCLK PIN_CFG(130, ALT_B)
370#define GPIO130_MC2_RSTN PIN_CFG(130, ALT_C)
371
372#define GPIO131_GPIO PIN_CFG(131, GPIO)
373#define GPIO131_MC2_DAT0 PIN_CFG(131, ALT_A)
374#define GPIO131_SM_ADQ8 PIN_CFG(131, ALT_B)
375
376#define GPIO132_GPIO PIN_CFG(132, GPIO)
377#define GPIO132_MC2_DAT1 PIN_CFG(132, ALT_A)
378#define GPIO132_SM_ADQ9 PIN_CFG(132, ALT_B)
379
380#define GPIO133_GPIO PIN_CFG(133, GPIO)
381#define GPIO133_MC2_DAT2 PIN_CFG(133, ALT_A)
382#define GPIO133_SM_ADQ10 PIN_CFG(133, ALT_B)
383
384#define GPIO134_GPIO PIN_CFG(134, GPIO)
385#define GPIO134_MC2_DAT3 PIN_CFG(134, ALT_A)
386#define GPIO134_SM_ADQ11 PIN_CFG(134, ALT_B)
387
388#define GPIO135_GPIO PIN_CFG(135, GPIO)
389#define GPIO135_MC2_DAT4 PIN_CFG(135, ALT_A)
390#define GPIO135_SM_ADQ12 PIN_CFG(135, ALT_B)
391
392#define GPIO136_GPIO PIN_CFG(136, GPIO)
393#define GPIO136_MC2_DAT5 PIN_CFG(136, ALT_A)
394#define GPIO136_SM_ADQ13 PIN_CFG(136, ALT_B)
395
396#define GPIO137_GPIO PIN_CFG(137, GPIO)
397#define GPIO137_MC2_DAT6 PIN_CFG(137, ALT_A)
398#define GPIO137_SM_ADQ14 PIN_CFG(137, ALT_B)
399
400#define GPIO138_GPIO PIN_CFG(138, GPIO)
401#define GPIO138_MC2_DAT7 PIN_CFG(138, ALT_A)
402#define GPIO138_SM_ADQ15 PIN_CFG(138, ALT_B)
403
404#define GPIO139_GPIO PIN_CFG(139, GPIO)
405#define GPIO139_SSP1_RXD PIN_CFG(139, ALT_A)
406#define GPIO139_SM_WAIT1n PIN_CFG(139, ALT_B)
407#define GPIO139_KP_O8 PIN_CFG(139, ALT_C)
408
409#define GPIO140_GPIO PIN_CFG(140, GPIO)
410#define GPIO140_SSP1_TXD PIN_CFG(140, ALT_A)
411#define GPIO140_IP_GPIO7 PIN_CFG(140, ALT_B)
412#define GPIO140_KP_SKA1 PIN_CFG(140, ALT_C)
413
414#define GPIO141_GPIO PIN_CFG(141, GPIO)
415#define GPIO141_SSP1_CLK PIN_CFG(141, ALT_A)
416#define GPIO141_IP_GPIO2 PIN_CFG(141, ALT_B)
417#define GPIO141_KP_O9 PIN_CFG(141, ALT_C)
418
419#define GPIO142_GPIO PIN_CFG(142, GPIO)
420#define GPIO142_SSP1_FRM PIN_CFG(142, ALT_A)
421#define GPIO142_IP_GPIO3 PIN_CFG(142, ALT_B)
422#define GPIO142_KP_SKB1 PIN_CFG(142, ALT_C)
423
424#define GPIO143_GPIO PIN_CFG(143, GPIO)
425#define GPIO143_SSP0_CLK PIN_CFG(143, ALT_A)
426
427#define GPIO144_GPIO PIN_CFG(144, GPIO)
428#define GPIO144_SSP0_FRM PIN_CFG(144, ALT_A)
429
430#define GPIO145_GPIO PIN_CFG(145, GPIO)
431#define GPIO145_SSP0_RXD PIN_CFG(145, ALT_A)
432
433#define GPIO146_GPIO PIN_CFG(146, GPIO)
434#define GPIO146_SSP0_TXD PIN_CFG(146, ALT_A)
435
436#define GPIO147_GPIO PIN_CFG(147, GPIO)
437#define GPIO147_I2C0_SCL PIN_CFG_PULL(147, ALT_A, UP)
438
439#define GPIO148_GPIO PIN_CFG(148, GPIO)
440#define GPIO148_I2C0_SDA PIN_CFG_PULL(148, ALT_A, UP)
441
442#define GPIO149_GPIO PIN_CFG(149, GPIO)
443#define GPIO149_IP_GPIO0 PIN_CFG(149, ALT_A)
444#define GPIO149_SM_CS1n PIN_CFG(149, ALT_B)
445#define GPIO149_SM_PS1n PIN_CFG(149, ALT_C)
446
447#define GPIO150_GPIO PIN_CFG(150, GPIO)
448#define GPIO150_IP_GPIO1 PIN_CFG(150, ALT_A)
449#define GPIO150_LCDA_CLK PIN_CFG(150, ALT_B)
450
451#define GPIO151_GPIO PIN_CFG(151, GPIO)
452#define GPIO151_KP_SKA0 PIN_CFG(151, ALT_A)
453#define GPIO151_LCD_VSI0 PIN_CFG(151, ALT_B)
454#define GPIO151_KP_O8 PIN_CFG(151, ALT_C)
455
456#define GPIO152_GPIO PIN_CFG(152, GPIO)
457#define GPIO152_KP_SKB0 PIN_CFG(152, ALT_A)
458#define GPIO152_LCD_VSI1 PIN_CFG(152, ALT_B)
459#define GPIO152_KP_O9 PIN_CFG(152, ALT_C)
460
461#define GPIO153_GPIO PIN_CFG(153, GPIO)
462#define GPIO153_KP_I7 PIN_CFG(153, ALT_A)
463#define GPIO153_LCD_D24 PIN_CFG(153, ALT_B)
464#define GPIO153_U2_RXD PIN_CFG(153, ALT_C)
465
466#define GPIO154_GPIO PIN_CFG(154, GPIO)
467#define GPIO154_KP_I6 PIN_CFG(154, ALT_A)
468#define GPIO154_LCD_D25 PIN_CFG(154, ALT_B)
469#define GPIO154_U2_TXD PIN_CFG(154, ALT_C)
470
471#define GPIO155_GPIO PIN_CFG(155, GPIO)
472#define GPIO155_KP_I5 PIN_CFG(155, ALT_A)
473#define GPIO155_LCD_D26 PIN_CFG(155, ALT_B)
474#define GPIO155_STMAPE_CLK PIN_CFG(155, ALT_C)
475
476#define GPIO156_GPIO PIN_CFG(156, GPIO)
477#define GPIO156_KP_I4 PIN_CFG(156, ALT_A)
478#define GPIO156_LCD_D27 PIN_CFG(156, ALT_B)
479#define GPIO156_STMAPE_DAT3 PIN_CFG(156, ALT_C)
480
481#define GPIO157_GPIO PIN_CFG(157, GPIO)
482#define GPIO157_KP_O7 PIN_CFG(157, ALT_A)
483#define GPIO157_LCD_D28 PIN_CFG(157, ALT_B)
484#define GPIO157_STMAPE_DAT2 PIN_CFG(157, ALT_C)
485
486#define GPIO158_GPIO PIN_CFG(158, GPIO)
487#define GPIO158_KP_O6 PIN_CFG(158, ALT_A)
488#define GPIO158_LCD_D29 PIN_CFG(158, ALT_B)
489#define GPIO158_STMAPE_DAT1 PIN_CFG(158, ALT_C)
490
491#define GPIO159_GPIO PIN_CFG(159, GPIO)
492#define GPIO159_KP_O5 PIN_CFG(159, ALT_A)
493#define GPIO159_LCD_D30 PIN_CFG(159, ALT_B)
494#define GPIO159_STMAPE_DAT0 PIN_CFG(159, ALT_C)
495
496#define GPIO160_GPIO PIN_CFG(160, GPIO)
497#define GPIO160_KP_O4 PIN_CFG(160, ALT_A)
498#define GPIO160_LCD_D31 PIN_CFG(160, ALT_B)
499#define GPIO160_NONE PIN_CFG(160, ALT_C)
500
501#define GPIO161_GPIO PIN_CFG(161, GPIO)
502#define GPIO161_KP_I3 PIN_CFG(161, ALT_A)
503#define GPIO161_LCD_D32 PIN_CFG(161, ALT_B)
504#define GPIO161_UARTMOD_RXD PIN_CFG(161, ALT_C)
505
506#define GPIO162_GPIO PIN_CFG(162, GPIO)
507#define GPIO162_KP_I2 PIN_CFG(162, ALT_A)
508#define GPIO162_LCD_D33 PIN_CFG(162, ALT_B)
509#define GPIO162_UARTMOD_TXD PIN_CFG(162, ALT_C)
510
511#define GPIO163_GPIO PIN_CFG(163, GPIO)
512#define GPIO163_KP_I1 PIN_CFG(163, ALT_A)
513#define GPIO163_LCD_D34 PIN_CFG(163, ALT_B)
514#define GPIO163_STMMOD_CLK PIN_CFG(163, ALT_C)
515
516#define GPIO164_GPIO PIN_CFG(164, GPIO)
517#define GPIO164_KP_I0 PIN_CFG(164, ALT_A)
518#define GPIO164_LCD_D35 PIN_CFG(164, ALT_B)
519#define GPIO164_STMMOD_DAT3 PIN_CFG(164, ALT_C)
520
521#define GPIO165_GPIO PIN_CFG(165, GPIO)
522#define GPIO165_KP_O3 PIN_CFG(165, ALT_A)
523#define GPIO165_LCD_D36 PIN_CFG(165, ALT_B)
524#define GPIO165_STMMOD_DAT2 PIN_CFG(165, ALT_C)
525
526#define GPIO166_GPIO PIN_CFG(166, GPIO)
527#define GPIO166_KP_O2 PIN_CFG(166, ALT_A)
528#define GPIO166_LCD_D37 PIN_CFG(166, ALT_B)
529#define GPIO166_STMMOD_DAT1 PIN_CFG(166, ALT_C)
530
531#define GPIO167_GPIO PIN_CFG(167, GPIO)
532#define GPIO167_KP_O1 PIN_CFG(167, ALT_A)
533#define GPIO167_LCD_D38 PIN_CFG(167, ALT_B)
534#define GPIO167_STMMOD_DAT0 PIN_CFG(167, ALT_C)
535
536#define GPIO168_GPIO PIN_CFG(168, GPIO)
537#define GPIO168_KP_O0 PIN_CFG(168, ALT_A)
538#define GPIO168_LCD_D39 PIN_CFG(168, ALT_B)
539#define GPIO168_NONE PIN_CFG(168, ALT_C)
540
541#define GPIO169_GPIO PIN_CFG(169, GPIO)
542#define GPIO169_RF_PURn PIN_CFG(169, ALT_A)
543#define GPIO169_LCDA_DE PIN_CFG(169, ALT_B)
544#define GPIO169_USBSIM_PDC PIN_CFG(169, ALT_C)
545
546#define GPIO170_GPIO PIN_CFG(170, GPIO)
547#define GPIO170_MODEM_STATE PIN_CFG(170, ALT_A)
548#define GPIO170_LCDA_VSO PIN_CFG(170, ALT_B)
549#define GPIO170_KP_SKA1 PIN_CFG(170, ALT_C)
550
551#define GPIO171_GPIO PIN_CFG(171, GPIO)
552#define GPIO171_MODEM_PWREN PIN_CFG(171, ALT_A)
553#define GPIO171_LCDA_HSO PIN_CFG(171, ALT_B)
554#define GPIO171_KP_SKB1 PIN_CFG(171, ALT_C)
555
556#define GPIO192_GPIO PIN_CFG(192, GPIO)
557#define GPIO192_MSP2_SCK PIN_CFG(192, ALT_A)
558
559#define GPIO193_GPIO PIN_CFG(193, GPIO)
560#define GPIO193_MSP2_TXD PIN_CFG(193, ALT_A)
561
562#define GPIO194_GPIO PIN_CFG(194, GPIO)
563#define GPIO194_MSP2_TCK PIN_CFG(194, ALT_A)
564
565#define GPIO195_GPIO PIN_CFG(195, GPIO)
566#define GPIO195_MSP2_TFS PIN_CFG(195, ALT_A)
567
568#define GPIO196_GPIO PIN_CFG(196, GPIO)
569#define GPIO196_MSP2_RXD PIN_CFG(196, ALT_A)
570
571#define GPIO197_GPIO PIN_CFG(197, GPIO)
572#define GPIO197_MC4_DAT3 PIN_CFG(197, ALT_A)
573
574#define GPIO198_GPIO PIN_CFG(198, GPIO)
575#define GPIO198_MC4_DAT2 PIN_CFG(198, ALT_A)
576
577#define GPIO199_GPIO PIN_CFG(199, GPIO)
578#define GPIO199_MC4_DAT1 PIN_CFG(199, ALT_A)
579
580#define GPIO200_GPIO PIN_CFG(200, GPIO)
581#define GPIO200_MC4_DAT0 PIN_CFG(200, ALT_A)
582
583#define GPIO201_GPIO PIN_CFG(201, GPIO)
584#define GPIO201_MC4_CMD PIN_CFG(201, ALT_A)
585
586#define GPIO202_GPIO PIN_CFG(202, GPIO)
587#define GPIO202_MC4_FBCLK PIN_CFG(202, ALT_A)
588#define GPIO202_PWL PIN_CFG(202, ALT_B)
589#define GPIO202_MC4_RSTN PIN_CFG(202, ALT_C)
590
591#define GPIO203_GPIO PIN_CFG(203, GPIO)
592#define GPIO203_MC4_CLK PIN_CFG(203, ALT_A)
593
594#define GPIO204_GPIO PIN_CFG(204, GPIO)
595#define GPIO204_MC4_DAT7 PIN_CFG(204, ALT_A)
596
597#define GPIO205_GPIO PIN_CFG(205, GPIO)
598#define GPIO205_MC4_DAT6 PIN_CFG(205, ALT_A)
599
600#define GPIO206_GPIO PIN_CFG(206, GPIO)
601#define GPIO206_MC4_DAT5 PIN_CFG(206, ALT_A)
602
603#define GPIO207_GPIO PIN_CFG(207, GPIO)
604#define GPIO207_MC4_DAT4 PIN_CFG(207, ALT_A)
605
606#define GPIO208_GPIO PIN_CFG(208, GPIO)
607#define GPIO208_MC1_CLK PIN_CFG(208, ALT_A)
608
609#define GPIO209_GPIO PIN_CFG(209, GPIO)
610#define GPIO209_MC1_FBCLK PIN_CFG(209, ALT_A)
611#define GPIO209_SPI1_CLK PIN_CFG(209, ALT_B)
612
613#define GPIO210_GPIO PIN_CFG(210, GPIO)
614#define GPIO210_MC1_CMD PIN_CFG(210, ALT_A)
615
616#define GPIO211_GPIO PIN_CFG(211, GPIO)
617#define GPIO211_MC1_DAT0 PIN_CFG(211, ALT_A)
618
619#define GPIO212_GPIO PIN_CFG(212, GPIO)
620#define GPIO212_MC1_DAT1 PIN_CFG(212, ALT_A)
621#define GPIO212_SPI1_FRM PIN_CFG(212, ALT_B)
622
623#define GPIO213_GPIO PIN_CFG(213, GPIO)
624#define GPIO213_MC1_DAT2 PIN_CFG(213, ALT_A)
625#define GPIO213_SPI1_TXD PIN_CFG(213, ALT_B)
626
627#define GPIO214_GPIO PIN_CFG(214, GPIO)
628#define GPIO214_MC1_DAT3 PIN_CFG(214, ALT_A)
629#define GPIO214_SPI1_RXD PIN_CFG(214, ALT_B)
630
631#define GPIO215_GPIO PIN_CFG(215, GPIO)
632#define GPIO215_MC1_CMDDIR PIN_CFG(215, ALT_A)
633#define GPIO215_MC3_DAT2DIR PIN_CFG(215, ALT_B)
634#define GPIO215_CLKOUT1 PIN_CFG(215, ALT_C)
635
636#define GPIO216_GPIO PIN_CFG(216, GPIO)
637#define GPIO216_MC1_DAT2DIR PIN_CFG(216, ALT_A)
638#define GPIO216_MC3_CMDDIR PIN_CFG(216, ALT_B)
639#define GPIO216_I2C3_SDA PIN_CFG_PULL(216, ALT_C, UP)
640
641#define GPIO217_GPIO PIN_CFG(217, GPIO)
642#define GPIO217_MC1_DAT0DIR PIN_CFG(217, ALT_A)
643#define GPIO217_MC3_DAT31DIR PIN_CFG(217, ALT_B)
644#define GPIO217_CLKOUT2 PIN_CFG(217, ALT_C)
645
646#define GPIO218_GPIO PIN_CFG(218, GPIO)
647#define GPIO218_MC1_DAT31DIR PIN_CFG(218, ALT_A)
648#define GPIO218_MC3_DAT0DIR PIN_CFG(218, ALT_B)
649#define GPIO218_I2C3_SCL PIN_CFG_PULL(218, ALT_C, UP)
650
651#define GPIO219_GPIO PIN_CFG(219, GPIO)
652#define GPIO219_HSIR_FLA0 PIN_CFG(219, ALT_A)
653#define GPIO219_MC3_CLK PIN_CFG(219, ALT_B)
654
655#define GPIO220_GPIO PIN_CFG(220, GPIO)
656#define GPIO220_HSIR_DAT0 PIN_CFG(220, ALT_A)
657#define GPIO220_MC3_FBCLK PIN_CFG(220, ALT_B)
658#define GPIO220_SPI0_CLK PIN_CFG(220, ALT_C)
659
660#define GPIO221_GPIO PIN_CFG(221, GPIO)
661#define GPIO221_HSIR_RDY0 PIN_CFG(221, ALT_A)
662#define GPIO221_MC3_CMD PIN_CFG(221, ALT_B)
663
664#define GPIO222_GPIO PIN_CFG(222, GPIO)
665#define GPIO222_HSIT_FLA0 PIN_CFG(222, ALT_A)
666#define GPIO222_MC3_DAT0 PIN_CFG(222, ALT_B)
667
668#define GPIO223_GPIO PIN_CFG(223, GPIO)
669#define GPIO223_HSIT_DAT0 PIN_CFG(223, ALT_A)
670#define GPIO223_MC3_DAT1 PIN_CFG(223, ALT_B)
671#define GPIO223_SPI0_FRM PIN_CFG(223, ALT_C)
672
673#define GPIO224_GPIO PIN_CFG(224, GPIO)
674#define GPIO224_HSIT_RDY0 PIN_CFG(224, ALT_A)
675#define GPIO224_MC3_DAT2 PIN_CFG(224, ALT_B)
676#define GPIO224_SPI0_TXD PIN_CFG(224, ALT_C)
677
678#define GPIO225_GPIO PIN_CFG(225, GPIO)
679#define GPIO225_HSIT_CAWAKE0 PIN_CFG(225, ALT_A)
680#define GPIO225_MC3_DAT3 PIN_CFG(225, ALT_B)
681#define GPIO225_SPI0_RXD PIN_CFG(225, ALT_C)
682
683#define GPIO226_GPIO PIN_CFG(226, GPIO)
684#define GPIO226_HSIT_ACWAKE0 PIN_CFG(226, ALT_A)
685#define GPIO226_PWL PIN_CFG(226, ALT_B)
686#define GPIO226_USBSIM_PDC PIN_CFG(226, ALT_C)
687
688#define GPIO227_GPIO PIN_CFG(227, GPIO)
689#define GPIO227_CLKOUT1 PIN_CFG(227, ALT_A)
690
691#define GPIO228_GPIO PIN_CFG(228, GPIO)
692#define GPIO228_CLKOUT2 PIN_CFG(228, ALT_A)
693
694#define GPIO229_GPIO PIN_CFG(229, GPIO)
695#define GPIO229_CLKOUT1 PIN_CFG(229, ALT_A)
696#define GPIO229_PWL PIN_CFG(229, ALT_B)
697#define GPIO229_I2C3_SDA PIN_CFG_PULL(229, ALT_C, UP)
698
699#define GPIO230_GPIO PIN_CFG(230, GPIO)
700#define GPIO230_CLKOUT2 PIN_CFG(230, ALT_A)
701#define GPIO230_PWL PIN_CFG(230, ALT_B)
702#define GPIO230_I2C3_SCL PIN_CFG_PULL(230, ALT_C, UP)
703
704#define GPIO256_GPIO PIN_CFG(256, GPIO)
705#define GPIO256_USB_NXT PIN_CFG(256, ALT_A)
706
707#define GPIO257_GPIO PIN_CFG(257, GPIO)
708#define GPIO257_USB_STP PIN_CFG(257, ALT_A)
709
710#define GPIO258_GPIO PIN_CFG(258, GPIO)
711#define GPIO258_USB_XCLK PIN_CFG(258, ALT_A)
712#define GPIO258_NONE PIN_CFG(258, ALT_B)
713#define GPIO258_DDR_TRIG PIN_CFG(258, ALT_C)
714
715#define GPIO259_GPIO PIN_CFG(259, GPIO)
716#define GPIO259_USB_DIR PIN_CFG(259, ALT_A)
717
718#define GPIO260_GPIO PIN_CFG(260, GPIO)
719#define GPIO260_USB_DAT7 PIN_CFG(260, ALT_A)
720
721#define GPIO261_GPIO PIN_CFG(261, GPIO)
722#define GPIO261_USB_DAT6 PIN_CFG(261, ALT_A)
723
724#define GPIO262_GPIO PIN_CFG(262, GPIO)
725#define GPIO262_USB_DAT5 PIN_CFG(262, ALT_A)
726
727#define GPIO263_GPIO PIN_CFG(263, GPIO)
728#define GPIO263_USB_DAT4 PIN_CFG(263, ALT_A)
729
730#define GPIO264_GPIO PIN_CFG(264, GPIO)
731#define GPIO264_USB_DAT3 PIN_CFG(264, ALT_A)
732
733#define GPIO265_GPIO PIN_CFG(265, GPIO)
734#define GPIO265_USB_DAT2 PIN_CFG(265, ALT_A)
735
736#define GPIO266_GPIO PIN_CFG(266, GPIO)
737#define GPIO266_USB_DAT1 PIN_CFG(266, ALT_A)
738
739#define GPIO267_GPIO PIN_CFG(267, GPIO)
740#define GPIO267_USB_DAT0 PIN_CFG(267, ALT_A)
741
742#endif
diff --git a/arch/arm/mach-versatile/core.c b/arch/arm/mach-versatile/core.c
index 3dff8641b03f..e38acb0f89c8 100644
--- a/arch/arm/mach-versatile/core.c
+++ b/arch/arm/mach-versatile/core.c
@@ -28,6 +28,7 @@
28#include <linux/amba/clcd.h> 28#include <linux/amba/clcd.h>
29#include <linux/amba/pl061.h> 29#include <linux/amba/pl061.h>
30#include <linux/amba/mmci.h> 30#include <linux/amba/mmci.h>
31#include <linux/amba/pl022.h>
31#include <linux/io.h> 32#include <linux/io.h>
32#include <linux/gfp.h> 33#include <linux/gfp.h>
33 34
@@ -354,6 +355,21 @@ static struct mmci_platform_data mmc0_plat_data = {
354 .gpio_cd = -1, 355 .gpio_cd = -1,
355}; 356};
356 357
358static struct resource char_lcd_resources[] = {
359 {
360 .start = VERSATILE_CHAR_LCD_BASE,
361 .end = (VERSATILE_CHAR_LCD_BASE + SZ_4K - 1),
362 .flags = IORESOURCE_MEM,
363 },
364};
365
366static struct platform_device char_lcd_device = {
367 .name = "arm-charlcd",
368 .id = -1,
369 .num_resources = ARRAY_SIZE(char_lcd_resources),
370 .resource = char_lcd_resources,
371};
372
357/* 373/*
358 * Clock handling 374 * Clock handling
359 */ 375 */
@@ -400,8 +416,13 @@ static struct clk ref24_clk = {
400 .rate = 24000000, 416 .rate = 24000000,
401}; 417};
402 418
419static struct clk dummy_apb_pclk;
420
403static struct clk_lookup lookups[] = { 421static struct clk_lookup lookups[] = {
404 { /* UART0 */ 422 { /* AMBA bus clock */
423 .con_id = "apb_pclk",
424 .clk = &dummy_apb_pclk,
425 }, { /* UART0 */
405 .dev_id = "dev:f1", 426 .dev_id = "dev:f1",
406 .clk = &ref24_clk, 427 .clk = &ref24_clk,
407 }, { /* UART1 */ 428 }, { /* UART1 */
@@ -425,6 +446,9 @@ static struct clk_lookup lookups[] = {
425 }, { /* MMC1 */ 446 }, { /* MMC1 */
426 .dev_id = "fpga:0b", 447 .dev_id = "fpga:0b",
427 .clk = &ref24_clk, 448 .clk = &ref24_clk,
449 }, { /* SSP */
450 .dev_id = "dev:f4",
451 .clk = &ref24_clk,
428 }, { /* CLCD */ 452 }, { /* CLCD */
429 .dev_id = "dev:20", 453 .dev_id = "dev:20",
430 .clk = &osc4_clk, 454 .clk = &osc4_clk,
@@ -703,6 +727,12 @@ static struct pl061_platform_data gpio1_plat_data = {
703 .irq_base = IRQ_GPIO1_START, 727 .irq_base = IRQ_GPIO1_START,
704}; 728};
705 729
730static struct pl022_ssp_controller ssp0_plat_data = {
731 .bus_id = 0,
732 .enable_dma = 0,
733 .num_chipselect = 1,
734};
735
706#define AACI_IRQ { IRQ_AACI, NO_IRQ } 736#define AACI_IRQ { IRQ_AACI, NO_IRQ }
707#define AACI_DMA { 0x80, 0x81 } 737#define AACI_DMA { 0x80, 0x81 }
708#define MMCI0_IRQ { IRQ_MMCI0A,IRQ_SIC_MMCI0B } 738#define MMCI0_IRQ { IRQ_MMCI0A,IRQ_SIC_MMCI0B }
@@ -772,7 +802,7 @@ AMBA_DEVICE(sci0, "dev:f0", SCI, NULL);
772AMBA_DEVICE(uart0, "dev:f1", UART0, NULL); 802AMBA_DEVICE(uart0, "dev:f1", UART0, NULL);
773AMBA_DEVICE(uart1, "dev:f2", UART1, NULL); 803AMBA_DEVICE(uart1, "dev:f2", UART1, NULL);
774AMBA_DEVICE(uart2, "dev:f3", UART2, NULL); 804AMBA_DEVICE(uart2, "dev:f3", UART2, NULL);
775AMBA_DEVICE(ssp0, "dev:f4", SSP, NULL); 805AMBA_DEVICE(ssp0, "dev:f4", SSP, &ssp0_plat_data);
776 806
777static struct amba_device *amba_devs[] __initdata = { 807static struct amba_device *amba_devs[] __initdata = {
778 &dmac_device, 808 &dmac_device,
@@ -843,6 +873,7 @@ void __init versatile_init(void)
843 platform_device_register(&versatile_flash_device); 873 platform_device_register(&versatile_flash_device);
844 platform_device_register(&versatile_i2c_device); 874 platform_device_register(&versatile_i2c_device);
845 platform_device_register(&smc91x_device); 875 platform_device_register(&smc91x_device);
876 platform_device_register(&char_lcd_device);
846 877
847 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) { 878 for (i = 0; i < ARRAY_SIZE(amba_devs); i++) {
848 struct amba_device *d = amba_devs[i]; 879 struct amba_device *d = amba_devs[i];
diff --git a/arch/arm/mach-versatile/pci.c b/arch/arm/mach-versatile/pci.c
index 334f0df4e948..13c7e5f90a82 100644
--- a/arch/arm/mach-versatile/pci.c
+++ b/arch/arm/mach-versatile/pci.c
@@ -304,7 +304,7 @@ int __init pci_versatile_setup(int nr, struct pci_sys_data *sys)
304} 304}
305 305
306 306
307struct pci_bus *pci_versatile_scan_bus(int nr, struct pci_sys_data *sys) 307struct pci_bus * __init pci_versatile_scan_bus(int nr, struct pci_sys_data *sys)
308{ 308{
309 return pci_scan_bus(sys->busnr, &pci_versatile_ops, sys); 309 return pci_scan_bus(sys->busnr, &pci_versatile_ops, sys);
310} 310}
diff --git a/arch/arm/mach-vexpress/ct-ca9x4.c b/arch/arm/mach-vexpress/ct-ca9x4.c
index 6353459bb567..577df6cccb08 100644
--- a/arch/arm/mach-vexpress/ct-ca9x4.c
+++ b/arch/arm/mach-vexpress/ct-ca9x4.c
@@ -16,6 +16,7 @@
16#include <asm/hardware/gic.h> 16#include <asm/hardware/gic.h>
17#include <asm/mach-types.h> 17#include <asm/mach-types.h>
18#include <asm/pmu.h> 18#include <asm/pmu.h>
19#include <asm/smp_twd.h>
19 20
20#include <mach/clkdev.h> 21#include <mach/clkdev.h>
21#include <mach/ct-ca9x4.h> 22#include <mach/ct-ca9x4.h>
@@ -53,6 +54,7 @@ static struct map_desc ct_ca9x4_io_desc[] __initdata = {
53 54
54static void __init ct_ca9x4_map_io(void) 55static void __init ct_ca9x4_map_io(void)
55{ 56{
57 twd_base = MMIO_P2V(A9_MPCORE_TWD);
56 v2m_map_io(ct_ca9x4_io_desc, ARRAY_SIZE(ct_ca9x4_io_desc)); 58 v2m_map_io(ct_ca9x4_io_desc, ARRAY_SIZE(ct_ca9x4_io_desc));
57} 59}
58 60
diff --git a/arch/arm/mach-vexpress/include/mach/ct-ca9x4.h b/arch/arm/mach-vexpress/include/mach/ct-ca9x4.h
index 8650f04136ef..f9e2f8d22962 100644
--- a/arch/arm/mach-vexpress/include/mach/ct-ca9x4.h
+++ b/arch/arm/mach-vexpress/include/mach/ct-ca9x4.h
@@ -28,6 +28,7 @@
28#define A9_MPCORE_SCU (CT_CA9X4_MPIC + 0x0000) 28#define A9_MPCORE_SCU (CT_CA9X4_MPIC + 0x0000)
29#define A9_MPCORE_GIC_CPU (CT_CA9X4_MPIC + 0x0100) 29#define A9_MPCORE_GIC_CPU (CT_CA9X4_MPIC + 0x0100)
30#define A9_MPCORE_GIT (CT_CA9X4_MPIC + 0x0200) 30#define A9_MPCORE_GIT (CT_CA9X4_MPIC + 0x0200)
31#define A9_MPCORE_TWD (CT_CA9X4_MPIC + 0x0600)
31#define A9_MPCORE_GIC_DIST (CT_CA9X4_MPIC + 0x1000) 32#define A9_MPCORE_GIC_DIST (CT_CA9X4_MPIC + 0x1000)
32 33
33/* 34/*
diff --git a/arch/arm/mach-vexpress/v2m.c b/arch/arm/mach-vexpress/v2m.c
index d250711b8c7a..817f0ad38a0b 100644
--- a/arch/arm/mach-vexpress/v2m.c
+++ b/arch/arm/mach-vexpress/v2m.c
@@ -241,7 +241,7 @@ static struct platform_device v2m_flash_device = {
241 241
242static unsigned int v2m_mmci_status(struct device *dev) 242static unsigned int v2m_mmci_status(struct device *dev)
243{ 243{
244 return !(readl(MMIO_P2V(V2M_SYS_MCI)) & (1 << 0)); 244 return readl(MMIO_P2V(V2M_SYS_MCI)) & (1 << 0);
245} 245}
246 246
247static struct mmci_platform_data v2m_mmci_data = { 247static struct mmci_platform_data v2m_mmci_data = {
@@ -298,8 +298,13 @@ static struct clk osc2_clk = {
298 .rate = 24000000, 298 .rate = 24000000,
299}; 299};
300 300
301static struct clk dummy_apb_pclk;
302
301static struct clk_lookup v2m_lookups[] = { 303static struct clk_lookup v2m_lookups[] = {
302 { /* UART0 */ 304 { /* AMBA bus clock */
305 .con_id = "apb_pclk",
306 .clk = &dummy_apb_pclk,
307 }, { /* UART0 */
303 .dev_id = "mb:uart0", 308 .dev_id = "mb:uart0",
304 .clk = &osc2_clk, 309 .clk = &osc2_clk,
305 }, { /* UART1 */ 310 }, { /* UART1 */
diff --git a/arch/arm/mach-w90x900/dev.c b/arch/arm/mach-w90x900/dev.c
index b2eda4dc1c34..7a1fa6adb7c3 100644
--- a/arch/arm/mach-w90x900/dev.c
+++ b/arch/arm/mach-w90x900/dev.c
@@ -36,6 +36,8 @@
36#include <mach/nuc900_spi.h> 36#include <mach/nuc900_spi.h>
37#include <mach/map.h> 37#include <mach/map.h>
38#include <mach/fb.h> 38#include <mach/fb.h>
39#include <mach/regs-ldm.h>
40#include <mach/w90p910_keypad.h>
39 41
40#include "cpu.h" 42#include "cpu.h"
41 43
@@ -207,7 +209,7 @@ static struct nuc900_spi_info nuc900_spiflash_data = {
207 .divider = 24, 209 .divider = 24,
208 .sleep = 0, 210 .sleep = 0,
209 .txnum = 0, 211 .txnum = 0,
210 .txbitlen = 1, 212 .txbitlen = 8,
211 .bus_num = 0, 213 .bus_num = 0,
212}; 214};
213 215
@@ -256,7 +258,7 @@ static struct spi_board_info nuc900_spi_board_info[] __initdata = {
256 .modalias = "m25p80", 258 .modalias = "m25p80",
257 .max_speed_hz = 20000000, 259 .max_speed_hz = 20000000,
258 .bus_num = 0, 260 .bus_num = 0,
259 .chip_select = 1, 261 .chip_select = 0,
260 .platform_data = &nuc900_spi_flash_data, 262 .platform_data = &nuc900_spi_flash_data,
261 .mode = SPI_MODE_0, 263 .mode = SPI_MODE_0,
262 }, 264 },
@@ -361,6 +363,39 @@ struct platform_device nuc900_device_fmi = {
361 363
362/* KPI controller*/ 364/* KPI controller*/
363 365
366static int nuc900_keymap[] = {
367 KEY(0, 0, KEY_A),
368 KEY(0, 1, KEY_B),
369 KEY(0, 2, KEY_C),
370 KEY(0, 3, KEY_D),
371
372 KEY(1, 0, KEY_E),
373 KEY(1, 1, KEY_F),
374 KEY(1, 2, KEY_G),
375 KEY(1, 3, KEY_H),
376
377 KEY(2, 0, KEY_I),
378 KEY(2, 1, KEY_J),
379 KEY(2, 2, KEY_K),
380 KEY(2, 3, KEY_L),
381
382 KEY(3, 0, KEY_M),
383 KEY(3, 1, KEY_N),
384 KEY(3, 2, KEY_O),
385 KEY(3, 3, KEY_P),
386};
387
388static struct matrix_keymap_data nuc900_map_data = {
389 .keymap = nuc900_keymap,
390 .keymap_size = ARRAY_SIZE(nuc900_keymap),
391};
392
393struct w90p910_keypad_platform_data nuc900_keypad_info = {
394 .keymap_data = &nuc900_map_data,
395 .prescale = 0xfa,
396 .debounce = 0x50,
397};
398
364static struct resource nuc900_kpi_resource[] = { 399static struct resource nuc900_kpi_resource[] = {
365 [0] = { 400 [0] = {
366 .start = W90X900_PA_KPI, 401 .start = W90X900_PA_KPI,
@@ -380,9 +415,49 @@ struct platform_device nuc900_device_kpi = {
380 .id = -1, 415 .id = -1,
381 .num_resources = ARRAY_SIZE(nuc900_kpi_resource), 416 .num_resources = ARRAY_SIZE(nuc900_kpi_resource),
382 .resource = nuc900_kpi_resource, 417 .resource = nuc900_kpi_resource,
418 .dev = {
419 .platform_data = &nuc900_keypad_info,
420 }
383}; 421};
384 422
385#ifdef CONFIG_FB_NUC900 423/* LCD controller*/
424
425static struct nuc900fb_display __initdata nuc900_lcd_info[] = {
426 /* Giantplus Technology GPM1040A0 320x240 Color TFT LCD */
427 [0] = {
428 .type = LCM_DCCS_VA_SRC_RGB565,
429 .width = 320,
430 .height = 240,
431 .xres = 320,
432 .yres = 240,
433 .bpp = 16,
434 .pixclock = 200000,
435 .left_margin = 34,
436 .right_margin = 54,
437 .hsync_len = 10,
438 .upper_margin = 18,
439 .lower_margin = 4,
440 .vsync_len = 1,
441 .dccs = 0x8e00041a,
442 .devctl = 0x060800c0,
443 .fbctrl = 0x00a000a0,
444 .scale = 0x04000400,
445 },
446};
447
448static struct nuc900fb_mach_info nuc900_fb_info __initdata = {
449#if defined(CONFIG_GPM1040A0_320X240)
450 .displays = &nuc900_lcd_info[0],
451#else
452 .displays = nuc900_lcd_info,
453#endif
454 .num_displays = ARRAY_SIZE(nuc900_lcd_info),
455 .default_display = 0,
456 .gpio_dir = 0x00000004,
457 .gpio_dir_mask = 0xFFFFFFFD,
458 .gpio_data = 0x00000004,
459 .gpio_data_mask = 0xFFFFFFFD,
460};
386 461
387static struct resource nuc900_lcd_resource[] = { 462static struct resource nuc900_lcd_resource[] = {
388 [0] = { 463 [0] = {
@@ -406,23 +481,10 @@ struct platform_device nuc900_device_lcd = {
406 .dev = { 481 .dev = {
407 .dma_mask = &nuc900_device_lcd_dmamask, 482 .dma_mask = &nuc900_device_lcd_dmamask,
408 .coherent_dma_mask = -1, 483 .coherent_dma_mask = -1,
484 .platform_data = &nuc900_fb_info,
409 } 485 }
410}; 486};
411 487
412void nuc900_fb_set_platdata(struct nuc900fb_mach_info *pd)
413{
414 struct nuc900fb_mach_info *npd;
415
416 npd = kmalloc(sizeof(*npd), GFP_KERNEL);
417 if (npd) {
418 memcpy(npd, pd, sizeof(*npd));
419 nuc900_device_lcd.dev.platform_data = npd;
420 } else {
421 printk(KERN_ERR "no memory for LCD platform data\n");
422 }
423}
424#endif
425
426/* AUDIO controller*/ 488/* AUDIO controller*/
427static u64 nuc900_device_audio_dmamask = -1; 489static u64 nuc900_device_audio_dmamask = -1;
428static struct resource nuc900_ac97_resource[] = { 490static struct resource nuc900_ac97_resource[] = {
diff --git a/arch/arm/mach-w90x900/include/mach/regs-gcr.h b/arch/arm/mach-w90x900/include/mach/regs-gcr.h
new file mode 100644
index 000000000000..6087abd93ef5
--- /dev/null
+++ b/arch/arm/mach-w90x900/include/mach/regs-gcr.h
@@ -0,0 +1,39 @@
1/*
2 * arch/arm/mach-w90x900/include/mach/regs-gcr.h
3 *
4 * Copyright (c) 2010 Nuvoton technology corporation
5 * All rights reserved.
6 *
7 * Wan ZongShun <mcuos.com@gmail.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 */
15
16#ifndef __ASM_ARCH_REGS_GCR_H
17#define __ASM_ARCH_REGS_GCR_H
18
19/* Global control registers */
20
21#define GCR_BA W90X900_VA_GCR
22#define REG_PDID (GCR_BA+0x000)
23#define REG_PWRON (GCR_BA+0x004)
24#define REG_ARBCON (GCR_BA+0x008)
25#define REG_MFSEL (GCR_BA+0x00C)
26#define REG_EBIDPE (GCR_BA+0x010)
27#define REG_LCDDPE (GCR_BA+0x014)
28#define REG_GPIOCPE (GCR_BA+0x018)
29#define REG_GPIODPE (GCR_BA+0x01C)
30#define REG_GPIOEPE (GCR_BA+0x020)
31#define REG_GPIOFPE (GCR_BA+0x024)
32#define REG_GPIOGPE (GCR_BA+0x028)
33#define REG_GPIOHPE (GCR_BA+0x02C)
34#define REG_GPIOIPE (GCR_BA+0x030)
35#define REG_GTMP1 (GCR_BA+0x034)
36#define REG_GTMP2 (GCR_BA+0x038)
37#define REG_GTMP3 (GCR_BA+0x03C)
38
39#endif /* __ASM_ARCH_REGS_GCR_H */
diff --git a/arch/arm/mach-w90x900/mach-nuc950evb.c b/arch/arm/mach-w90x900/mach-nuc950evb.c
index b3edc3cccf52..04d295f89eb0 100644
--- a/arch/arm/mach-w90x900/mach-nuc950evb.c
+++ b/arch/arm/mach-w90x900/mach-nuc950evb.c
@@ -20,51 +20,10 @@
20#include <asm/mach/map.h> 20#include <asm/mach/map.h>
21#include <asm/mach-types.h> 21#include <asm/mach-types.h>
22#include <mach/map.h> 22#include <mach/map.h>
23#include <mach/regs-ldm.h>
24#include <mach/fb.h> 23#include <mach/fb.h>
25 24
26#include "nuc950.h" 25#include "nuc950.h"
27 26
28#ifdef CONFIG_FB_NUC900
29/* LCD Controller */
30static struct nuc900fb_display __initdata nuc950_lcd_info[] = {
31 /* Giantplus Technology GPM1040A0 320x240 Color TFT LCD */
32 [0] = {
33 .type = LCM_DCCS_VA_SRC_RGB565,
34 .width = 320,
35 .height = 240,
36 .xres = 320,
37 .yres = 240,
38 .bpp = 16,
39 .pixclock = 200000,
40 .left_margin = 34,
41 .right_margin = 54,
42 .hsync_len = 10,
43 .upper_margin = 18,
44 .lower_margin = 4,
45 .vsync_len = 1,
46 .dccs = 0x8e00041a,
47 .devctl = 0x060800c0,
48 .fbctrl = 0x00a000a0,
49 .scale = 0x04000400,
50 },
51};
52
53static struct nuc900fb_mach_info nuc950_fb_info __initdata = {
54#if defined(CONFIG_GPM1040A0_320X240)
55 .displays = &nuc950_lcd_info[0],
56#else
57 .displays = nuc950_lcd_info,
58#endif
59 .num_displays = ARRAY_SIZE(nuc950_lcd_info),
60 .default_display = 0,
61 .gpio_dir = 0x00000004,
62 .gpio_dir_mask = 0xFFFFFFFD,
63 .gpio_data = 0x00000004,
64 .gpio_data_mask = 0xFFFFFFFD,
65};
66#endif
67
68static void __init nuc950evb_map_io(void) 27static void __init nuc950evb_map_io(void)
69{ 28{
70 nuc950_map_io(); 29 nuc950_map_io();
@@ -74,9 +33,6 @@ static void __init nuc950evb_map_io(void)
74static void __init nuc950evb_init(void) 33static void __init nuc950evb_init(void)
75{ 34{
76 nuc950_board_init(); 35 nuc950_board_init();
77#ifdef CONFIG_FB_NUC900
78 nuc900_fb_set_platdata(&nuc950_fb_info);
79#endif
80} 36}
81 37
82MACHINE_START(W90P950EVB, "W90P950EVB") 38MACHINE_START(W90P950EVB, "W90P950EVB")
diff --git a/arch/arm/mach-w90x900/nuc910.c b/arch/arm/mach-w90x900/nuc910.c
index 656f03b3b629..1523f4136985 100644
--- a/arch/arm/mach-w90x900/nuc910.c
+++ b/arch/arm/mach-w90x900/nuc910.c
@@ -26,6 +26,8 @@
26static struct platform_device *nuc910_dev[] __initdata = { 26static struct platform_device *nuc910_dev[] __initdata = {
27 &nuc900_device_ts, 27 &nuc900_device_ts,
28 &nuc900_device_rtc, 28 &nuc900_device_rtc,
29 &nuc900_device_lcd,
30 &nuc900_device_kpi,
29}; 31};
30 32
31/* define specific CPU platform io map */ 33/* define specific CPU platform io map */
diff --git a/arch/arm/mach-w90x900/nuc950.c b/arch/arm/mach-w90x900/nuc950.c
index 4d1f1ab044c4..5704f74a50ee 100644
--- a/arch/arm/mach-w90x900/nuc950.c
+++ b/arch/arm/mach-w90x900/nuc950.c
@@ -26,9 +26,7 @@
26static struct platform_device *nuc950_dev[] __initdata = { 26static struct platform_device *nuc950_dev[] __initdata = {
27 &nuc900_device_kpi, 27 &nuc900_device_kpi,
28 &nuc900_device_fmi, 28 &nuc900_device_fmi,
29#ifdef CONFIG_FB_NUC900
30 &nuc900_device_lcd, 29 &nuc900_device_lcd,
31#endif
32}; 30};
33 31
34/* define specific CPU platform io map */ 32/* define specific CPU platform io map */
diff --git a/arch/arm/mm/Kconfig b/arch/arm/mm/Kconfig
index 101105e52610..87ec141fcaa6 100644
--- a/arch/arm/mm/Kconfig
+++ b/arch/arm/mm/Kconfig
@@ -717,17 +717,6 @@ config TLS_REG_EMUL
717 a few prototypes like that in existence) and therefore access to 717 a few prototypes like that in existence) and therefore access to
718 that required register must be emulated. 718 that required register must be emulated.
719 719
720config HAS_TLS_REG
721 bool
722 depends on !TLS_REG_EMUL
723 default y if SMP || CPU_32v7
724 help
725 This selects support for the CP15 thread register.
726 It is defined to be available on some ARMv6 processors (including
727 all SMP capable ARMv6's) or later processors. User space may
728 assume directly accessing that register and always obtain the
729 expected value only on ARMv7 and above.
730
731config NEEDS_SYSCALL_FOR_CMPXCHG 720config NEEDS_SYSCALL_FOR_CMPXCHG
732 bool 721 bool
733 help 722 help
diff --git a/arch/arm/mm/Makefile b/arch/arm/mm/Makefile
index e8d34a80851c..d63b6c413758 100644
--- a/arch/arm/mm/Makefile
+++ b/arch/arm/mm/Makefile
@@ -15,7 +15,6 @@ endif
15obj-$(CONFIG_MODULES) += proc-syms.o 15obj-$(CONFIG_MODULES) += proc-syms.o
16 16
17obj-$(CONFIG_ALIGNMENT_TRAP) += alignment.o 17obj-$(CONFIG_ALIGNMENT_TRAP) += alignment.o
18obj-$(CONFIG_DISCONTIGMEM) += discontig.o
19obj-$(CONFIG_HIGHMEM) += highmem.o 18obj-$(CONFIG_HIGHMEM) += highmem.o
20 19
21obj-$(CONFIG_CPU_ABRT_NOMMU) += abort-nommu.o 20obj-$(CONFIG_CPU_ABRT_NOMMU) += abort-nommu.o
diff --git a/arch/arm/mm/alignment.c b/arch/arm/mm/alignment.c
index 6f98c358989a..d073b64ae87e 100644
--- a/arch/arm/mm/alignment.c
+++ b/arch/arm/mm/alignment.c
@@ -924,8 +924,20 @@ static int __init alignment_init(void)
924 ai_usermode = UM_FIXUP; 924 ai_usermode = UM_FIXUP;
925 } 925 }
926 926
927 hook_fault_code(1, do_alignment, SIGILL, "alignment exception"); 927 hook_fault_code(1, do_alignment, SIGBUS, BUS_ADRALN,
928 hook_fault_code(3, do_alignment, SIGILL, "alignment exception"); 928 "alignment exception");
929
930 /*
931 * ARMv6K and ARMv7 use fault status 3 (0b00011) as Access Flag section
932 * fault, not as alignment error.
933 *
934 * TODO: handle ARMv6K properly. Runtime check for 'K' extension is
935 * needed.
936 */
937 if (cpu_architecture() <= CPU_ARCH_ARMv6) {
938 hook_fault_code(3, do_alignment, SIGBUS, BUS_ADRALN,
939 "alignment exception");
940 }
929 941
930 return 0; 942 return 0;
931} 943}
diff --git a/arch/arm/mm/cache-l2x0.c b/arch/arm/mm/cache-l2x0.c
index df4955885b21..9982eb385c0f 100644
--- a/arch/arm/mm/cache-l2x0.c
+++ b/arch/arm/mm/cache-l2x0.c
@@ -32,14 +32,14 @@ static uint32_t l2x0_way_mask; /* Bitmask of active ways */
32static inline void cache_wait(void __iomem *reg, unsigned long mask) 32static inline void cache_wait(void __iomem *reg, unsigned long mask)
33{ 33{
34 /* wait for the operation to complete */ 34 /* wait for the operation to complete */
35 while (readl(reg) & mask) 35 while (readl_relaxed(reg) & mask)
36 ; 36 ;
37} 37}
38 38
39static inline void cache_sync(void) 39static inline void cache_sync(void)
40{ 40{
41 void __iomem *base = l2x0_base; 41 void __iomem *base = l2x0_base;
42 writel(0, base + L2X0_CACHE_SYNC); 42 writel_relaxed(0, base + L2X0_CACHE_SYNC);
43 cache_wait(base + L2X0_CACHE_SYNC, 1); 43 cache_wait(base + L2X0_CACHE_SYNC, 1);
44} 44}
45 45
@@ -47,14 +47,14 @@ static inline void l2x0_clean_line(unsigned long addr)
47{ 47{
48 void __iomem *base = l2x0_base; 48 void __iomem *base = l2x0_base;
49 cache_wait(base + L2X0_CLEAN_LINE_PA, 1); 49 cache_wait(base + L2X0_CLEAN_LINE_PA, 1);
50 writel(addr, base + L2X0_CLEAN_LINE_PA); 50 writel_relaxed(addr, base + L2X0_CLEAN_LINE_PA);
51} 51}
52 52
53static inline void l2x0_inv_line(unsigned long addr) 53static inline void l2x0_inv_line(unsigned long addr)
54{ 54{
55 void __iomem *base = l2x0_base; 55 void __iomem *base = l2x0_base;
56 cache_wait(base + L2X0_INV_LINE_PA, 1); 56 cache_wait(base + L2X0_INV_LINE_PA, 1);
57 writel(addr, base + L2X0_INV_LINE_PA); 57 writel_relaxed(addr, base + L2X0_INV_LINE_PA);
58} 58}
59 59
60#ifdef CONFIG_PL310_ERRATA_588369 60#ifdef CONFIG_PL310_ERRATA_588369
@@ -75,9 +75,9 @@ static inline void l2x0_flush_line(unsigned long addr)
75 75
76 /* Clean by PA followed by Invalidate by PA */ 76 /* Clean by PA followed by Invalidate by PA */
77 cache_wait(base + L2X0_CLEAN_LINE_PA, 1); 77 cache_wait(base + L2X0_CLEAN_LINE_PA, 1);
78 writel(addr, base + L2X0_CLEAN_LINE_PA); 78 writel_relaxed(addr, base + L2X0_CLEAN_LINE_PA);
79 cache_wait(base + L2X0_INV_LINE_PA, 1); 79 cache_wait(base + L2X0_INV_LINE_PA, 1);
80 writel(addr, base + L2X0_INV_LINE_PA); 80 writel_relaxed(addr, base + L2X0_INV_LINE_PA);
81} 81}
82#else 82#else
83 83
@@ -90,7 +90,7 @@ static inline void l2x0_flush_line(unsigned long addr)
90{ 90{
91 void __iomem *base = l2x0_base; 91 void __iomem *base = l2x0_base;
92 cache_wait(base + L2X0_CLEAN_INV_LINE_PA, 1); 92 cache_wait(base + L2X0_CLEAN_INV_LINE_PA, 1);
93 writel(addr, base + L2X0_CLEAN_INV_LINE_PA); 93 writel_relaxed(addr, base + L2X0_CLEAN_INV_LINE_PA);
94} 94}
95#endif 95#endif
96 96
@@ -109,7 +109,7 @@ static inline void l2x0_inv_all(void)
109 109
110 /* invalidate all ways */ 110 /* invalidate all ways */
111 spin_lock_irqsave(&l2x0_lock, flags); 111 spin_lock_irqsave(&l2x0_lock, flags);
112 writel(l2x0_way_mask, l2x0_base + L2X0_INV_WAY); 112 writel_relaxed(l2x0_way_mask, l2x0_base + L2X0_INV_WAY);
113 cache_wait(l2x0_base + L2X0_INV_WAY, l2x0_way_mask); 113 cache_wait(l2x0_base + L2X0_INV_WAY, l2x0_way_mask);
114 cache_sync(); 114 cache_sync();
115 spin_unlock_irqrestore(&l2x0_lock, flags); 115 spin_unlock_irqrestore(&l2x0_lock, flags);
@@ -215,8 +215,8 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
215 215
216 l2x0_base = base; 216 l2x0_base = base;
217 217
218 cache_id = readl(l2x0_base + L2X0_CACHE_ID); 218 cache_id = readl_relaxed(l2x0_base + L2X0_CACHE_ID);
219 aux = readl(l2x0_base + L2X0_AUX_CTRL); 219 aux = readl_relaxed(l2x0_base + L2X0_AUX_CTRL);
220 220
221 aux &= aux_mask; 221 aux &= aux_mask;
222 aux |= aux_val; 222 aux |= aux_val;
@@ -248,15 +248,15 @@ void __init l2x0_init(void __iomem *base, __u32 aux_val, __u32 aux_mask)
248 * If you are booting from non-secure mode 248 * If you are booting from non-secure mode
249 * accessing the below registers will fault. 249 * accessing the below registers will fault.
250 */ 250 */
251 if (!(readl(l2x0_base + L2X0_CTRL) & 1)) { 251 if (!(readl_relaxed(l2x0_base + L2X0_CTRL) & 1)) {
252 252
253 /* l2x0 controller is disabled */ 253 /* l2x0 controller is disabled */
254 writel(aux, l2x0_base + L2X0_AUX_CTRL); 254 writel_relaxed(aux, l2x0_base + L2X0_AUX_CTRL);
255 255
256 l2x0_inv_all(); 256 l2x0_inv_all();
257 257
258 /* enable L2X0 */ 258 /* enable L2X0 */
259 writel(1, l2x0_base + L2X0_CTRL); 259 writel_relaxed(1, l2x0_base + L2X0_CTRL);
260 } 260 }
261 261
262 outer_cache.inv_range = l2x0_inv_range; 262 outer_cache.inv_range = l2x0_inv_range;
diff --git a/arch/arm/mm/discontig.c b/arch/arm/mm/discontig.c
deleted file mode 100644
index c8c0c4b0f0a3..000000000000
--- a/arch/arm/mm/discontig.c
+++ /dev/null
@@ -1,45 +0,0 @@
1/*
2 * linux/arch/arm/mm/discontig.c
3 *
4 * Discontiguous memory support.
5 *
6 * Initial code: Copyright (C) 1999-2000 Nicolas Pitre
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License version 2 as
10 * published by the Free Software Foundation.
11 */
12#include <linux/module.h>
13#include <linux/mmzone.h>
14#include <linux/bootmem.h>
15
16#if MAX_NUMNODES != 4 && MAX_NUMNODES != 16
17# error Fix Me Please
18#endif
19
20/*
21 * Our node_data structure for discontiguous memory.
22 */
23
24pg_data_t discontig_node_data[MAX_NUMNODES] = {
25 { .bdata = &bootmem_node_data[0] },
26 { .bdata = &bootmem_node_data[1] },
27 { .bdata = &bootmem_node_data[2] },
28 { .bdata = &bootmem_node_data[3] },
29#if MAX_NUMNODES == 16
30 { .bdata = &bootmem_node_data[4] },
31 { .bdata = &bootmem_node_data[5] },
32 { .bdata = &bootmem_node_data[6] },
33 { .bdata = &bootmem_node_data[7] },
34 { .bdata = &bootmem_node_data[8] },
35 { .bdata = &bootmem_node_data[9] },
36 { .bdata = &bootmem_node_data[10] },
37 { .bdata = &bootmem_node_data[11] },
38 { .bdata = &bootmem_node_data[12] },
39 { .bdata = &bootmem_node_data[13] },
40 { .bdata = &bootmem_node_data[14] },
41 { .bdata = &bootmem_node_data[15] },
42#endif
43};
44
45EXPORT_SYMBOL(discontig_node_data);
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index 9e7742f0a102..c704eed63c5d 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -183,6 +183,8 @@ static void *
183__dma_alloc_remap(struct page *page, size_t size, gfp_t gfp, pgprot_t prot) 183__dma_alloc_remap(struct page *page, size_t size, gfp_t gfp, pgprot_t prot)
184{ 184{
185 struct arm_vmregion *c; 185 struct arm_vmregion *c;
186 size_t align;
187 int bit;
186 188
187 if (!consistent_pte[0]) { 189 if (!consistent_pte[0]) {
188 printk(KERN_ERR "%s: not initialised\n", __func__); 190 printk(KERN_ERR "%s: not initialised\n", __func__);
@@ -191,9 +193,20 @@ __dma_alloc_remap(struct page *page, size_t size, gfp_t gfp, pgprot_t prot)
191 } 193 }
192 194
193 /* 195 /*
196 * Align the virtual region allocation - maximum alignment is
197 * a section size, minimum is a page size. This helps reduce
198 * fragmentation of the DMA space, and also prevents allocations
199 * smaller than a section from crossing a section boundary.
200 */
201 bit = fls(size - 1) + 1;
202 if (bit > SECTION_SHIFT)
203 bit = SECTION_SHIFT;
204 align = 1 << bit;
205
206 /*
194 * Allocate a virtual address in the consistent mapping region. 207 * Allocate a virtual address in the consistent mapping region.
195 */ 208 */
196 c = arm_vmregion_alloc(&consistent_head, size, 209 c = arm_vmregion_alloc(&consistent_head, align, size,
197 gfp & ~(__GFP_DMA | __GFP_HIGHMEM)); 210 gfp & ~(__GFP_DMA | __GFP_HIGHMEM));
198 if (c) { 211 if (c) {
199 pte_t *pte; 212 pte_t *pte;
diff --git a/arch/arm/mm/fault.c b/arch/arm/mm/fault.c
index cbfb2edcf7d1..23b0b03af5ea 100644
--- a/arch/arm/mm/fault.c
+++ b/arch/arm/mm/fault.c
@@ -413,7 +413,16 @@ do_translation_fault(unsigned long addr, unsigned int fsr,
413 pmd_k = pmd_offset(pgd_k, addr); 413 pmd_k = pmd_offset(pgd_k, addr);
414 pmd = pmd_offset(pgd, addr); 414 pmd = pmd_offset(pgd, addr);
415 415
416 if (pmd_none(*pmd_k)) 416 /*
417 * On ARM one Linux PGD entry contains two hardware entries (see page
418 * tables layout in pgtable.h). We normally guarantee that we always
419 * fill both L1 entries. But create_mapping() doesn't follow the rule.
420 * It can create inidividual L1 entries, so here we have to call
421 * pmd_none() check for the entry really corresponded to address, not
422 * for the first of pair.
423 */
424 index = (addr >> SECTION_SHIFT) & 1;
425 if (pmd_none(pmd_k[index]))
417 goto bad_area; 426 goto bad_area;
418 427
419 copy_pmd(pmd, pmd_k); 428 copy_pmd(pmd, pmd_k);
@@ -463,15 +472,10 @@ static struct fsr_info {
463 * defines these to be "precise" aborts. 472 * defines these to be "precise" aborts.
464 */ 473 */
465 { do_bad, SIGSEGV, 0, "vector exception" }, 474 { do_bad, SIGSEGV, 0, "vector exception" },
466 { do_bad, SIGILL, BUS_ADRALN, "alignment exception" }, 475 { do_bad, SIGBUS, BUS_ADRALN, "alignment exception" },
467 { do_bad, SIGKILL, 0, "terminal exception" }, 476 { do_bad, SIGKILL, 0, "terminal exception" },
468 { do_bad, SIGILL, BUS_ADRALN, "alignment exception" }, 477 { do_bad, SIGBUS, BUS_ADRALN, "alignment exception" },
469/* Do we need runtime check ? */
470#if __LINUX_ARM_ARCH__ < 6
471 { do_bad, SIGBUS, 0, "external abort on linefetch" }, 478 { do_bad, SIGBUS, 0, "external abort on linefetch" },
472#else
473 { do_translation_fault, SIGSEGV, SEGV_MAPERR, "I-cache maintenance fault" },
474#endif
475 { do_translation_fault, SIGSEGV, SEGV_MAPERR, "section translation fault" }, 479 { do_translation_fault, SIGSEGV, SEGV_MAPERR, "section translation fault" },
476 { do_bad, SIGBUS, 0, "external abort on linefetch" }, 480 { do_bad, SIGBUS, 0, "external abort on linefetch" },
477 { do_page_fault, SIGSEGV, SEGV_MAPERR, "page translation fault" }, 481 { do_page_fault, SIGSEGV, SEGV_MAPERR, "page translation fault" },
@@ -508,13 +512,15 @@ static struct fsr_info {
508 512
509void __init 513void __init
510hook_fault_code(int nr, int (*fn)(unsigned long, unsigned int, struct pt_regs *), 514hook_fault_code(int nr, int (*fn)(unsigned long, unsigned int, struct pt_regs *),
511 int sig, const char *name) 515 int sig, int code, const char *name)
512{ 516{
513 if (nr >= 0 && nr < ARRAY_SIZE(fsr_info)) { 517 if (nr < 0 || nr >= ARRAY_SIZE(fsr_info))
514 fsr_info[nr].fn = fn; 518 BUG();
515 fsr_info[nr].sig = sig; 519
516 fsr_info[nr].name = name; 520 fsr_info[nr].fn = fn;
517 } 521 fsr_info[nr].sig = sig;
522 fsr_info[nr].code = code;
523 fsr_info[nr].name = name;
518} 524}
519 525
520/* 526/*
@@ -594,3 +600,25 @@ do_PrefetchAbort(unsigned long addr, unsigned int ifsr, struct pt_regs *regs)
594 arm_notify_die("", regs, &info, ifsr, 0); 600 arm_notify_die("", regs, &info, ifsr, 0);
595} 601}
596 602
603static int __init exceptions_init(void)
604{
605 if (cpu_architecture() >= CPU_ARCH_ARMv6) {
606 hook_fault_code(4, do_translation_fault, SIGSEGV, SEGV_MAPERR,
607 "I-cache maintenance fault");
608 }
609
610 if (cpu_architecture() >= CPU_ARCH_ARMv7) {
611 /*
612 * TODO: Access flag faults introduced in ARMv6K.
613 * Runtime check for 'K' extension is needed
614 */
615 hook_fault_code(3, do_bad, SIGSEGV, SEGV_MAPERR,
616 "section access flag fault");
617 hook_fault_code(6, do_bad, SIGSEGV, SEGV_MAPERR,
618 "section access flag fault");
619 }
620
621 return 0;
622}
623
624arch_initcall(exceptions_init);
diff --git a/arch/arm/mm/highmem.c b/arch/arm/mm/highmem.c
index 086816b205b8..6ab244062b4a 100644
--- a/arch/arm/mm/highmem.c
+++ b/arch/arm/mm/highmem.c
@@ -163,19 +163,22 @@ static DEFINE_PER_CPU(int, kmap_high_l1_vipt_depth);
163 163
164void *kmap_high_l1_vipt(struct page *page, pte_t *saved_pte) 164void *kmap_high_l1_vipt(struct page *page, pte_t *saved_pte)
165{ 165{
166 unsigned int idx, cpu = smp_processor_id(); 166 unsigned int idx, cpu;
167 int *depth = &per_cpu(kmap_high_l1_vipt_depth, cpu); 167 int *depth;
168 unsigned long vaddr, flags; 168 unsigned long vaddr, flags;
169 pte_t pte, *ptep; 169 pte_t pte, *ptep;
170 170
171 if (!in_interrupt())
172 preempt_disable();
173
174 cpu = smp_processor_id();
175 depth = &per_cpu(kmap_high_l1_vipt_depth, cpu);
176
171 idx = KM_L1_CACHE + KM_TYPE_NR * cpu; 177 idx = KM_L1_CACHE + KM_TYPE_NR * cpu;
172 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx); 178 vaddr = __fix_to_virt(FIX_KMAP_BEGIN + idx);
173 ptep = TOP_PTE(vaddr); 179 ptep = TOP_PTE(vaddr);
174 pte = mk_pte(page, kmap_prot); 180 pte = mk_pte(page, kmap_prot);
175 181
176 if (!in_interrupt())
177 preempt_disable();
178
179 raw_local_irq_save(flags); 182 raw_local_irq_save(flags);
180 (*depth)++; 183 (*depth)++;
181 if (pte_val(*ptep) == pte_val(pte)) { 184 if (pte_val(*ptep) == pte_val(pte)) {
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index f6a999465323..7185b00650fe 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -17,6 +17,7 @@
17#include <linux/initrd.h> 17#include <linux/initrd.h>
18#include <linux/highmem.h> 18#include <linux/highmem.h>
19#include <linux/gfp.h> 19#include <linux/gfp.h>
20#include <linux/memblock.h>
20 21
21#include <asm/mach-types.h> 22#include <asm/mach-types.h>
22#include <asm/sections.h> 23#include <asm/sections.h>
@@ -79,38 +80,37 @@ struct meminfo meminfo;
79void show_mem(void) 80void show_mem(void)
80{ 81{
81 int free = 0, total = 0, reserved = 0; 82 int free = 0, total = 0, reserved = 0;
82 int shared = 0, cached = 0, slab = 0, node, i; 83 int shared = 0, cached = 0, slab = 0, i;
83 struct meminfo * mi = &meminfo; 84 struct meminfo * mi = &meminfo;
84 85
85 printk("Mem-info:\n"); 86 printk("Mem-info:\n");
86 show_free_areas(); 87 show_free_areas();
87 for_each_online_node(node) { 88
88 for_each_nodebank (i,mi,node) { 89 for_each_bank (i, mi) {
89 struct membank *bank = &mi->bank[i]; 90 struct membank *bank = &mi->bank[i];
90 unsigned int pfn1, pfn2; 91 unsigned int pfn1, pfn2;
91 struct page *page, *end; 92 struct page *page, *end;
92 93
93 pfn1 = bank_pfn_start(bank); 94 pfn1 = bank_pfn_start(bank);
94 pfn2 = bank_pfn_end(bank); 95 pfn2 = bank_pfn_end(bank);
95 96
96 page = pfn_to_page(pfn1); 97 page = pfn_to_page(pfn1);
97 end = pfn_to_page(pfn2 - 1) + 1; 98 end = pfn_to_page(pfn2 - 1) + 1;
98 99
99 do { 100 do {
100 total++; 101 total++;
101 if (PageReserved(page)) 102 if (PageReserved(page))
102 reserved++; 103 reserved++;
103 else if (PageSwapCache(page)) 104 else if (PageSwapCache(page))
104 cached++; 105 cached++;
105 else if (PageSlab(page)) 106 else if (PageSlab(page))
106 slab++; 107 slab++;
107 else if (!page_count(page)) 108 else if (!page_count(page))
108 free++; 109 free++;
109 else 110 else
110 shared += page_count(page) - 1; 111 shared += page_count(page) - 1;
111 page++; 112 page++;
112 } while (page < end); 113 } while (page < end);
113 }
114 } 114 }
115 115
116 printk("%d pages of RAM\n", total); 116 printk("%d pages of RAM\n", total);
@@ -121,7 +121,7 @@ void show_mem(void)
121 printk("%d pages swap cached\n", cached); 121 printk("%d pages swap cached\n", cached);
122} 122}
123 123
124static void __init find_node_limits(int node, struct meminfo *mi, 124static void __init find_limits(struct meminfo *mi,
125 unsigned long *min, unsigned long *max_low, unsigned long *max_high) 125 unsigned long *min, unsigned long *max_low, unsigned long *max_high)
126{ 126{
127 int i; 127 int i;
@@ -129,7 +129,7 @@ static void __init find_node_limits(int node, struct meminfo *mi,
129 *min = -1UL; 129 *min = -1UL;
130 *max_low = *max_high = 0; 130 *max_low = *max_high = 0;
131 131
132 for_each_nodebank(i, mi, node) { 132 for_each_bank (i, mi) {
133 struct membank *bank = &mi->bank[i]; 133 struct membank *bank = &mi->bank[i];
134 unsigned long start, end; 134 unsigned long start, end;
135 135
@@ -147,155 +147,64 @@ static void __init find_node_limits(int node, struct meminfo *mi,
147 } 147 }
148} 148}
149 149
150/* 150static void __init arm_bootmem_init(struct meminfo *mi,
151 * FIXME: We really want to avoid allocating the bootmap bitmap
152 * over the top of the initrd. Hopefully, this is located towards
153 * the start of a bank, so if we allocate the bootmap bitmap at
154 * the end, we won't clash.
155 */
156static unsigned int __init
157find_bootmap_pfn(int node, struct meminfo *mi, unsigned int bootmap_pages)
158{
159 unsigned int start_pfn, i, bootmap_pfn;
160
161 start_pfn = PAGE_ALIGN(__pa(_end)) >> PAGE_SHIFT;
162 bootmap_pfn = 0;
163
164 for_each_nodebank(i, mi, node) {
165 struct membank *bank = &mi->bank[i];
166 unsigned int start, end;
167
168 start = bank_pfn_start(bank);
169 end = bank_pfn_end(bank);
170
171 if (end < start_pfn)
172 continue;
173
174 if (start < start_pfn)
175 start = start_pfn;
176
177 if (end <= start)
178 continue;
179
180 if (end - start >= bootmap_pages) {
181 bootmap_pfn = start;
182 break;
183 }
184 }
185
186 if (bootmap_pfn == 0)
187 BUG();
188
189 return bootmap_pfn;
190}
191
192static int __init check_initrd(struct meminfo *mi)
193{
194 int initrd_node = -2;
195#ifdef CONFIG_BLK_DEV_INITRD
196 unsigned long end = phys_initrd_start + phys_initrd_size;
197
198 /*
199 * Make sure that the initrd is within a valid area of
200 * memory.
201 */
202 if (phys_initrd_size) {
203 unsigned int i;
204
205 initrd_node = -1;
206
207 for (i = 0; i < mi->nr_banks; i++) {
208 struct membank *bank = &mi->bank[i];
209 if (bank_phys_start(bank) <= phys_initrd_start &&
210 end <= bank_phys_end(bank))
211 initrd_node = bank->node;
212 }
213 }
214
215 if (initrd_node == -1) {
216 printk(KERN_ERR "INITRD: 0x%08lx+0x%08lx extends beyond "
217 "physical memory - disabling initrd\n",
218 phys_initrd_start, phys_initrd_size);
219 phys_initrd_start = phys_initrd_size = 0;
220 }
221#endif
222
223 return initrd_node;
224}
225
226static void __init bootmem_init_node(int node, struct meminfo *mi,
227 unsigned long start_pfn, unsigned long end_pfn) 151 unsigned long start_pfn, unsigned long end_pfn)
228{ 152{
229 unsigned long boot_pfn;
230 unsigned int boot_pages; 153 unsigned int boot_pages;
154 phys_addr_t bitmap;
231 pg_data_t *pgdat; 155 pg_data_t *pgdat;
232 int i; 156 int i;
233 157
234 /* 158 /*
235 * Allocate the bootmem bitmap page. 159 * Allocate the bootmem bitmap page. This must be in a region
160 * of memory which has already been mapped.
236 */ 161 */
237 boot_pages = bootmem_bootmap_pages(end_pfn - start_pfn); 162 boot_pages = bootmem_bootmap_pages(end_pfn - start_pfn);
238 boot_pfn = find_bootmap_pfn(node, mi, boot_pages); 163 bitmap = memblock_alloc_base(boot_pages << PAGE_SHIFT, L1_CACHE_BYTES,
164 __pfn_to_phys(end_pfn));
239 165
240 /* 166 /*
241 * Initialise the bootmem allocator for this node, handing the 167 * Initialise the bootmem allocator, handing the
242 * memory banks over to bootmem. 168 * memory banks over to bootmem.
243 */ 169 */
244 node_set_online(node); 170 node_set_online(0);
245 pgdat = NODE_DATA(node); 171 pgdat = NODE_DATA(0);
246 init_bootmem_node(pgdat, boot_pfn, start_pfn, end_pfn); 172 init_bootmem_node(pgdat, __phys_to_pfn(bitmap), start_pfn, end_pfn);
247 173
248 for_each_nodebank(i, mi, node) { 174 for_each_bank(i, mi) {
249 struct membank *bank = &mi->bank[i]; 175 struct membank *bank = &mi->bank[i];
250 if (!bank->highmem) 176 if (!bank->highmem)
251 free_bootmem_node(pgdat, bank_phys_start(bank), bank_phys_size(bank)); 177 free_bootmem(bank_phys_start(bank), bank_phys_size(bank));
252 } 178 }
253 179
254 /* 180 /*
255 * Reserve the bootmem bitmap for this node. 181 * Reserve the memblock reserved regions in bootmem.
256 */ 182 */
257 reserve_bootmem_node(pgdat, boot_pfn << PAGE_SHIFT, 183 for (i = 0; i < memblock.reserved.cnt; i++) {
258 boot_pages << PAGE_SHIFT, BOOTMEM_DEFAULT); 184 phys_addr_t start = memblock_start_pfn(&memblock.reserved, i);
259} 185 if (start >= start_pfn &&
260 186 memblock_end_pfn(&memblock.reserved, i) <= end_pfn)
261static void __init bootmem_reserve_initrd(int node) 187 reserve_bootmem_node(pgdat, __pfn_to_phys(start),
262{ 188 memblock_size_bytes(&memblock.reserved, i),
263#ifdef CONFIG_BLK_DEV_INITRD 189 BOOTMEM_DEFAULT);
264 pg_data_t *pgdat = NODE_DATA(node);
265 int res;
266
267 res = reserve_bootmem_node(pgdat, phys_initrd_start,
268 phys_initrd_size, BOOTMEM_EXCLUSIVE);
269
270 if (res == 0) {
271 initrd_start = __phys_to_virt(phys_initrd_start);
272 initrd_end = initrd_start + phys_initrd_size;
273 } else {
274 printk(KERN_ERR
275 "INITRD: 0x%08lx+0x%08lx overlaps in-use "
276 "memory region - disabling initrd\n",
277 phys_initrd_start, phys_initrd_size);
278 } 190 }
279#endif
280} 191}
281 192
282static void __init bootmem_free_node(int node, struct meminfo *mi) 193static void __init arm_bootmem_free(struct meminfo *mi, unsigned long min,
194 unsigned long max_low, unsigned long max_high)
283{ 195{
284 unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES]; 196 unsigned long zone_size[MAX_NR_ZONES], zhole_size[MAX_NR_ZONES];
285 unsigned long min, max_low, max_high;
286 int i; 197 int i;
287 198
288 find_node_limits(node, mi, &min, &max_low, &max_high);
289
290 /* 199 /*
291 * initialise the zones within this node. 200 * initialise the zones.
292 */ 201 */
293 memset(zone_size, 0, sizeof(zone_size)); 202 memset(zone_size, 0, sizeof(zone_size));
294 203
295 /* 204 /*
296 * The size of this node has already been determined. If we need 205 * The memory size has already been determined. If we need
297 * to do anything fancy with the allocation of this memory to the 206 * to do anything fancy with the allocation of this memory
298 * zones, now is the time to do it. 207 * to the zones, now is the time to do it.
299 */ 208 */
300 zone_size[0] = max_low - min; 209 zone_size[0] = max_low - min;
301#ifdef CONFIG_HIGHMEM 210#ifdef CONFIG_HIGHMEM
@@ -303,11 +212,11 @@ static void __init bootmem_free_node(int node, struct meminfo *mi)
303#endif 212#endif
304 213
305 /* 214 /*
306 * For each bank in this node, calculate the size of the holes. 215 * Calculate the size of the holes.
307 * holes = node_size - sum(bank_sizes_in_node) 216 * holes = node_size - sum(bank_sizes)
308 */ 217 */
309 memcpy(zhole_size, zone_size, sizeof(zhole_size)); 218 memcpy(zhole_size, zone_size, sizeof(zhole_size));
310 for_each_nodebank(i, mi, node) { 219 for_each_bank(i, mi) {
311 int idx = 0; 220 int idx = 0;
312#ifdef CONFIG_HIGHMEM 221#ifdef CONFIG_HIGHMEM
313 if (mi->bank[i].highmem) 222 if (mi->bank[i].highmem)
@@ -320,24 +229,23 @@ static void __init bootmem_free_node(int node, struct meminfo *mi)
320 * Adjust the sizes according to any special requirements for 229 * Adjust the sizes according to any special requirements for
321 * this machine type. 230 * this machine type.
322 */ 231 */
323 arch_adjust_zones(node, zone_size, zhole_size); 232 arch_adjust_zones(zone_size, zhole_size);
324 233
325 free_area_init_node(node, zone_size, min, zhole_size); 234 free_area_init_node(0, zone_size, min, zhole_size);
326} 235}
327 236
328#ifndef CONFIG_SPARSEMEM 237#ifndef CONFIG_SPARSEMEM
329int pfn_valid(unsigned long pfn) 238int pfn_valid(unsigned long pfn)
330{ 239{
331 struct meminfo *mi = &meminfo; 240 struct memblock_region *mem = &memblock.memory;
332 unsigned int left = 0, right = mi->nr_banks; 241 unsigned int left = 0, right = mem->cnt;
333 242
334 do { 243 do {
335 unsigned int mid = (right + left) / 2; 244 unsigned int mid = (right + left) / 2;
336 struct membank *bank = &mi->bank[mid];
337 245
338 if (pfn < bank_pfn_start(bank)) 246 if (pfn < memblock_start_pfn(mem, mid))
339 right = mid; 247 right = mid;
340 else if (pfn >= bank_pfn_end(bank)) 248 else if (pfn >= memblock_end_pfn(mem, mid))
341 left = mid + 1; 249 left = mid + 1;
342 else 250 else
343 return 1; 251 return 1;
@@ -346,73 +254,69 @@ int pfn_valid(unsigned long pfn)
346} 254}
347EXPORT_SYMBOL(pfn_valid); 255EXPORT_SYMBOL(pfn_valid);
348 256
349static void arm_memory_present(struct meminfo *mi, int node) 257static void arm_memory_present(void)
350{ 258{
351} 259}
352#else 260#else
353static void arm_memory_present(struct meminfo *mi, int node) 261static void arm_memory_present(void)
354{ 262{
355 int i; 263 int i;
356 for_each_nodebank(i, mi, node) { 264 for (i = 0; i < memblock.memory.cnt; i++)
357 struct membank *bank = &mi->bank[i]; 265 memory_present(0, memblock_start_pfn(&memblock.memory, i),
358 memory_present(node, bank_pfn_start(bank), bank_pfn_end(bank)); 266 memblock_end_pfn(&memblock.memory, i));
359 }
360} 267}
361#endif 268#endif
362 269
363void __init bootmem_init(void) 270void __init arm_memblock_init(struct meminfo *mi, struct machine_desc *mdesc)
364{ 271{
365 struct meminfo *mi = &meminfo; 272 int i;
366 unsigned long min, max_low, max_high;
367 int node, initrd_node;
368 273
369 /* 274 memblock_init();
370 * Locate which node contains the ramdisk image, if any. 275 for (i = 0; i < mi->nr_banks; i++)
371 */ 276 memblock_add(mi->bank[i].start, mi->bank[i].size);
372 initrd_node = check_initrd(mi);
373 277
374 max_low = max_high = 0; 278 /* Register the kernel text, kernel data and initrd with memblock. */
279#ifdef CONFIG_XIP_KERNEL
280 memblock_reserve(__pa(_data), _end - _data);
281#else
282 memblock_reserve(__pa(_stext), _end - _stext);
283#endif
284#ifdef CONFIG_BLK_DEV_INITRD
285 if (phys_initrd_size) {
286 memblock_reserve(phys_initrd_start, phys_initrd_size);
375 287
376 /* 288 /* Now convert initrd to virtual addresses */
377 * Run through each node initialising the bootmem allocator. 289 initrd_start = __phys_to_virt(phys_initrd_start);
378 */ 290 initrd_end = initrd_start + phys_initrd_size;
379 for_each_node(node) { 291 }
380 unsigned long node_low, node_high; 292#endif
381 293
382 find_node_limits(node, mi, &min, &node_low, &node_high); 294 arm_mm_memblock_reserve();
383 295
384 if (node_low > max_low) 296 /* reserve any platform specific memblock areas */
385 max_low = node_low; 297 if (mdesc->reserve)
386 if (node_high > max_high) 298 mdesc->reserve();
387 max_high = node_high;
388 299
389 /* 300 memblock_analyze();
390 * If there is no memory in this node, ignore it. 301 memblock_dump_all();
391 * (We can't have nodes which have no lowmem) 302}
392 */
393 if (node_low == 0)
394 continue;
395 303
396 bootmem_init_node(node, mi, min, node_low); 304void __init bootmem_init(void)
305{
306 struct meminfo *mi = &meminfo;
307 unsigned long min, max_low, max_high;
397 308
398 /* 309 max_low = max_high = 0;
399 * Reserve any special node zero regions.
400 */
401 if (node == 0)
402 reserve_node_zero(NODE_DATA(node));
403 310
404 /* 311 find_limits(mi, &min, &max_low, &max_high);
405 * If the initrd is in this node, reserve its memory.
406 */
407 if (node == initrd_node)
408 bootmem_reserve_initrd(node);
409 312
410 /* 313 arm_bootmem_init(mi, min, max_low);
411 * Sparsemem tries to allocate bootmem in memory_present(), 314
412 * so must be done after the fixed reservations 315 /*
413 */ 316 * Sparsemem tries to allocate bootmem in memory_present(),
414 arm_memory_present(mi, node); 317 * so must be done after the fixed reservations
415 } 318 */
319 arm_memory_present();
416 320
417 /* 321 /*
418 * sparse_init() needs the bootmem allocator up and running. 322 * sparse_init() needs the bootmem allocator up and running.
@@ -420,12 +324,11 @@ void __init bootmem_init(void)
420 sparse_init(); 324 sparse_init();
421 325
422 /* 326 /*
423 * Now free memory in each node - free_area_init_node needs 327 * Now free the memory - free_area_init_node needs
424 * the sparse mem_map arrays initialized by sparse_init() 328 * the sparse mem_map arrays initialized by sparse_init()
425 * for memmap_init_zone(), otherwise all PFNs are invalid. 329 * for memmap_init_zone(), otherwise all PFNs are invalid.
426 */ 330 */
427 for_each_node(node) 331 arm_bootmem_free(mi, min, max_low, max_high);
428 bootmem_free_node(node, mi);
429 332
430 high_memory = __va((max_low << PAGE_SHIFT) - 1) + 1; 333 high_memory = __va((max_low << PAGE_SHIFT) - 1) + 1;
431 334
@@ -460,7 +363,7 @@ static inline int free_area(unsigned long pfn, unsigned long end, char *s)
460} 363}
461 364
462static inline void 365static inline void
463free_memmap(int node, unsigned long start_pfn, unsigned long end_pfn) 366free_memmap(unsigned long start_pfn, unsigned long end_pfn)
464{ 367{
465 struct page *start_pg, *end_pg; 368 struct page *start_pg, *end_pg;
466 unsigned long pg, pgend; 369 unsigned long pg, pgend;
@@ -483,40 +386,39 @@ free_memmap(int node, unsigned long start_pfn, unsigned long end_pfn)
483 * free the section of the memmap array. 386 * free the section of the memmap array.
484 */ 387 */
485 if (pg < pgend) 388 if (pg < pgend)
486 free_bootmem_node(NODE_DATA(node), pg, pgend - pg); 389 free_bootmem(pg, pgend - pg);
487} 390}
488 391
489/* 392/*
490 * The mem_map array can get very big. Free the unused area of the memory map. 393 * The mem_map array can get very big. Free the unused area of the memory map.
491 */ 394 */
492static void __init free_unused_memmap_node(int node, struct meminfo *mi) 395static void __init free_unused_memmap(struct meminfo *mi)
493{ 396{
494 unsigned long bank_start, prev_bank_end = 0; 397 unsigned long bank_start, prev_bank_end = 0;
495 unsigned int i; 398 unsigned int i;
496 399
497 /* 400 /*
498 * [FIXME] This relies on each bank being in address order. This 401 * This relies on each bank being in address order.
499 * may not be the case, especially if the user has provided the 402 * The banks are sorted previously in bootmem_init().
500 * information on the command line.
501 */ 403 */
502 for_each_nodebank(i, mi, node) { 404 for_each_bank(i, mi) {
503 struct membank *bank = &mi->bank[i]; 405 struct membank *bank = &mi->bank[i];
504 406
505 bank_start = bank_pfn_start(bank); 407 bank_start = bank_pfn_start(bank);
506 if (bank_start < prev_bank_end) {
507 printk(KERN_ERR "MEM: unordered memory banks. "
508 "Not freeing memmap.\n");
509 break;
510 }
511 408
512 /* 409 /*
513 * If we had a previous bank, and there is a space 410 * If we had a previous bank, and there is a space
514 * between the current bank and the previous, free it. 411 * between the current bank and the previous, free it.
515 */ 412 */
516 if (prev_bank_end && prev_bank_end != bank_start) 413 if (prev_bank_end && prev_bank_end < bank_start)
517 free_memmap(node, prev_bank_end, bank_start); 414 free_memmap(prev_bank_end, bank_start);
518 415
519 prev_bank_end = bank_pfn_end(bank); 416 /*
417 * Align up here since the VM subsystem insists that the
418 * memmap entries are valid from the bank end aligned to
419 * MAX_ORDER_NR_PAGES.
420 */
421 prev_bank_end = ALIGN(bank_pfn_end(bank), MAX_ORDER_NR_PAGES);
520 } 422 }
521} 423}
522 424
@@ -528,21 +430,19 @@ static void __init free_unused_memmap_node(int node, struct meminfo *mi)
528void __init mem_init(void) 430void __init mem_init(void)
529{ 431{
530 unsigned long reserved_pages, free_pages; 432 unsigned long reserved_pages, free_pages;
531 int i, node; 433 int i;
434#ifdef CONFIG_HAVE_TCM
435 /* These pointers are filled in on TCM detection */
436 extern u32 dtcm_end;
437 extern u32 itcm_end;
438#endif
532 439
533#ifndef CONFIG_DISCONTIGMEM
534 max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map; 440 max_mapnr = pfn_to_page(max_pfn + PHYS_PFN_OFFSET) - mem_map;
535#endif
536 441
537 /* this will put all unused low memory onto the freelists */ 442 /* this will put all unused low memory onto the freelists */
538 for_each_online_node(node) { 443 free_unused_memmap(&meminfo);
539 pg_data_t *pgdat = NODE_DATA(node);
540 444
541 free_unused_memmap_node(node, &meminfo); 445 totalram_pages += free_all_bootmem();
542
543 if (pgdat->node_spanned_pages != 0)
544 totalram_pages += free_all_bootmem_node(pgdat);
545 }
546 446
547#ifdef CONFIG_SA1111 447#ifdef CONFIG_SA1111
548 /* now that our DMA memory is actually so designated, we can free it */ 448 /* now that our DMA memory is actually so designated, we can free it */
@@ -552,39 +452,35 @@ void __init mem_init(void)
552 452
553#ifdef CONFIG_HIGHMEM 453#ifdef CONFIG_HIGHMEM
554 /* set highmem page free */ 454 /* set highmem page free */
555 for_each_online_node(node) { 455 for_each_bank (i, &meminfo) {
556 for_each_nodebank (i, &meminfo, node) { 456 unsigned long start = bank_pfn_start(&meminfo.bank[i]);
557 unsigned long start = bank_pfn_start(&meminfo.bank[i]); 457 unsigned long end = bank_pfn_end(&meminfo.bank[i]);
558 unsigned long end = bank_pfn_end(&meminfo.bank[i]); 458 if (start >= max_low_pfn + PHYS_PFN_OFFSET)
559 if (start >= max_low_pfn + PHYS_PFN_OFFSET) 459 totalhigh_pages += free_area(start, end, NULL);
560 totalhigh_pages += free_area(start, end, NULL);
561 }
562 } 460 }
563 totalram_pages += totalhigh_pages; 461 totalram_pages += totalhigh_pages;
564#endif 462#endif
565 463
566 reserved_pages = free_pages = 0; 464 reserved_pages = free_pages = 0;
567 465
568 for_each_online_node(node) { 466 for_each_bank(i, &meminfo) {
569 for_each_nodebank(i, &meminfo, node) { 467 struct membank *bank = &meminfo.bank[i];
570 struct membank *bank = &meminfo.bank[i]; 468 unsigned int pfn1, pfn2;
571 unsigned int pfn1, pfn2; 469 struct page *page, *end;
572 struct page *page, *end; 470
573 471 pfn1 = bank_pfn_start(bank);
574 pfn1 = bank_pfn_start(bank); 472 pfn2 = bank_pfn_end(bank);
575 pfn2 = bank_pfn_end(bank); 473
576 474 page = pfn_to_page(pfn1);
577 page = pfn_to_page(pfn1); 475 end = pfn_to_page(pfn2 - 1) + 1;
578 end = pfn_to_page(pfn2 - 1) + 1; 476
579 477 do {
580 do { 478 if (PageReserved(page))
581 if (PageReserved(page)) 479 reserved_pages++;
582 reserved_pages++; 480 else if (!page_count(page))
583 else if (!page_count(page)) 481 free_pages++;
584 free_pages++; 482 page++;
585 page++; 483 } while (page < end);
586 } while (page < end);
587 }
588 } 484 }
589 485
590 /* 486 /*
@@ -611,6 +507,10 @@ void __init mem_init(void)
611 507
612 printk(KERN_NOTICE "Virtual kernel memory layout:\n" 508 printk(KERN_NOTICE "Virtual kernel memory layout:\n"
613 " vector : 0x%08lx - 0x%08lx (%4ld kB)\n" 509 " vector : 0x%08lx - 0x%08lx (%4ld kB)\n"
510#ifdef CONFIG_HAVE_TCM
511 " DTCM : 0x%08lx - 0x%08lx (%4ld kB)\n"
512 " ITCM : 0x%08lx - 0x%08lx (%4ld kB)\n"
513#endif
614 " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n" 514 " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n"
615#ifdef CONFIG_MMU 515#ifdef CONFIG_MMU
616 " DMA : 0x%08lx - 0x%08lx (%4ld MB)\n" 516 " DMA : 0x%08lx - 0x%08lx (%4ld MB)\n"
@@ -627,6 +527,10 @@ void __init mem_init(void)
627 527
628 MLK(UL(CONFIG_VECTORS_BASE), UL(CONFIG_VECTORS_BASE) + 528 MLK(UL(CONFIG_VECTORS_BASE), UL(CONFIG_VECTORS_BASE) +
629 (PAGE_SIZE)), 529 (PAGE_SIZE)),
530#ifdef CONFIG_HAVE_TCM
531 MLK(DTCM_OFFSET, (unsigned long) dtcm_end),
532 MLK(ITCM_OFFSET, (unsigned long) itcm_end),
533#endif
630 MLK(FIXADDR_START, FIXADDR_TOP), 534 MLK(FIXADDR_START, FIXADDR_TOP),
631#ifdef CONFIG_MMU 535#ifdef CONFIG_MMU
632 MLM(CONSISTENT_BASE, CONSISTENT_END), 536 MLM(CONSISTENT_BASE, CONSISTENT_END),
diff --git a/arch/arm/mm/ioremap.c b/arch/arm/mm/ioremap.c
index 28c8b950ef04..ab506272b2d3 100644
--- a/arch/arm/mm/ioremap.c
+++ b/arch/arm/mm/ioremap.c
@@ -42,78 +42,11 @@
42 */ 42 */
43#define VM_ARM_SECTION_MAPPING 0x80000000 43#define VM_ARM_SECTION_MAPPING 0x80000000
44 44
45static int remap_area_pte(pmd_t *pmd, unsigned long addr, unsigned long end,
46 unsigned long phys_addr, const struct mem_type *type)
47{
48 pgprot_t prot = __pgprot(type->prot_pte);
49 pte_t *pte;
50
51 pte = pte_alloc_kernel(pmd, addr);
52 if (!pte)
53 return -ENOMEM;
54
55 do {
56 if (!pte_none(*pte))
57 goto bad;
58
59 set_pte_ext(pte, pfn_pte(phys_addr >> PAGE_SHIFT, prot), 0);
60 phys_addr += PAGE_SIZE;
61 } while (pte++, addr += PAGE_SIZE, addr != end);
62 return 0;
63
64 bad:
65 printk(KERN_CRIT "remap_area_pte: page already exists\n");
66 BUG();
67}
68
69static inline int remap_area_pmd(pgd_t *pgd, unsigned long addr,
70 unsigned long end, unsigned long phys_addr,
71 const struct mem_type *type)
72{
73 unsigned long next;
74 pmd_t *pmd;
75 int ret = 0;
76
77 pmd = pmd_alloc(&init_mm, pgd, addr);
78 if (!pmd)
79 return -ENOMEM;
80
81 do {
82 next = pmd_addr_end(addr, end);
83 ret = remap_area_pte(pmd, addr, next, phys_addr, type);
84 if (ret)
85 return ret;
86 phys_addr += next - addr;
87 } while (pmd++, addr = next, addr != end);
88 return ret;
89}
90
91static int remap_area_pages(unsigned long start, unsigned long pfn,
92 size_t size, const struct mem_type *type)
93{
94 unsigned long addr = start;
95 unsigned long next, end = start + size;
96 unsigned long phys_addr = __pfn_to_phys(pfn);
97 pgd_t *pgd;
98 int err = 0;
99
100 BUG_ON(addr >= end);
101 pgd = pgd_offset_k(addr);
102 do {
103 next = pgd_addr_end(addr, end);
104 err = remap_area_pmd(pgd, addr, next, phys_addr, type);
105 if (err)
106 break;
107 phys_addr += next - addr;
108 } while (pgd++, addr = next, addr != end);
109
110 return err;
111}
112
113int ioremap_page(unsigned long virt, unsigned long phys, 45int ioremap_page(unsigned long virt, unsigned long phys,
114 const struct mem_type *mtype) 46 const struct mem_type *mtype)
115{ 47{
116 return remap_area_pages(virt, __phys_to_pfn(phys), PAGE_SIZE, mtype); 48 return ioremap_page_range(virt, virt + PAGE_SIZE, phys,
49 __pgprot(mtype->prot_pte));
117} 50}
118EXPORT_SYMBOL(ioremap_page); 51EXPORT_SYMBOL(ioremap_page);
119 52
@@ -268,6 +201,12 @@ void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn,
268 if (pfn >= 0x100000 && (__pfn_to_phys(pfn) & ~SUPERSECTION_MASK)) 201 if (pfn >= 0x100000 && (__pfn_to_phys(pfn) & ~SUPERSECTION_MASK))
269 return NULL; 202 return NULL;
270 203
204 /*
205 * Don't allow RAM to be mapped - this causes problems with ARMv6+
206 */
207 if (WARN_ON(pfn_valid(pfn)))
208 return NULL;
209
271 type = get_mem_type(mtype); 210 type = get_mem_type(mtype);
272 if (!type) 211 if (!type)
273 return NULL; 212 return NULL;
@@ -294,7 +233,8 @@ void __iomem * __arm_ioremap_pfn_caller(unsigned long pfn,
294 err = remap_area_sections(addr, pfn, size, type); 233 err = remap_area_sections(addr, pfn, size, type);
295 } else 234 } else
296#endif 235#endif
297 err = remap_area_pages(addr, pfn, size, type); 236 err = ioremap_page_range(addr, addr + size, __pfn_to_phys(pfn),
237 __pgprot(type->prot_pte));
298 238
299 if (err) { 239 if (err) {
300 vunmap((void *)addr); 240 vunmap((void *)addr);
diff --git a/arch/arm/mm/mm.h b/arch/arm/mm/mm.h
index 815d08eecbb0..6630620380a4 100644
--- a/arch/arm/mm/mm.h
+++ b/arch/arm/mm/mm.h
@@ -28,7 +28,5 @@ extern void __flush_dcache_page(struct address_space *mapping, struct page *page
28 28
29#endif 29#endif
30 30
31struct pglist_data;
32
33void __init bootmem_init(void); 31void __init bootmem_init(void);
34void reserve_node_zero(struct pglist_data *pgdat); 32void arm_mm_memblock_reserve(void);
diff --git a/arch/arm/mm/mmap.c b/arch/arm/mm/mmap.c
index f5abc51c5a07..4f5b39687df5 100644
--- a/arch/arm/mm/mmap.c
+++ b/arch/arm/mm/mmap.c
@@ -7,6 +7,7 @@
7#include <linux/shm.h> 7#include <linux/shm.h>
8#include <linux/sched.h> 8#include <linux/sched.h>
9#include <linux/io.h> 9#include <linux/io.h>
10#include <linux/random.h>
10#include <asm/cputype.h> 11#include <asm/cputype.h>
11#include <asm/system.h> 12#include <asm/system.h>
12 13
@@ -80,6 +81,9 @@ arch_get_unmapped_area(struct file *filp, unsigned long addr,
80 start_addr = addr = TASK_UNMAPPED_BASE; 81 start_addr = addr = TASK_UNMAPPED_BASE;
81 mm->cached_hole_size = 0; 82 mm->cached_hole_size = 0;
82 } 83 }
84 /* 8 bits of randomness in 20 address space bits */
85 if (current->flags & PF_RANDOMIZE)
86 addr += (get_random_int() % (1 << 8)) << PAGE_SHIFT;
83 87
84full_search: 88full_search:
85 if (do_align) 89 if (do_align)
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 285894171186..6e1c4f6a2b3f 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -11,13 +11,12 @@
11#include <linux/kernel.h> 11#include <linux/kernel.h>
12#include <linux/errno.h> 12#include <linux/errno.h>
13#include <linux/init.h> 13#include <linux/init.h>
14#include <linux/bootmem.h>
15#include <linux/mman.h> 14#include <linux/mman.h>
16#include <linux/nodemask.h> 15#include <linux/nodemask.h>
16#include <linux/memblock.h>
17#include <linux/sort.h> 17#include <linux/sort.h>
18 18
19#include <asm/cputype.h> 19#include <asm/cputype.h>
20#include <asm/mach-types.h>
21#include <asm/sections.h> 20#include <asm/sections.h>
22#include <asm/cachetype.h> 21#include <asm/cachetype.h>
23#include <asm/setup.h> 22#include <asm/setup.h>
@@ -258,6 +257,19 @@ static struct mem_type mem_types[] = {
258 .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE, 257 .prot_sect = PMD_TYPE_SECT | PMD_SECT_AP_WRITE,
259 .domain = DOMAIN_KERNEL, 258 .domain = DOMAIN_KERNEL,
260 }, 259 },
260 [MT_MEMORY_DTCM] = {
261 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG |
262 L_PTE_DIRTY | L_PTE_WRITE,
263 .prot_l1 = PMD_TYPE_TABLE,
264 .prot_sect = PMD_TYPE_SECT | PMD_SECT_XN,
265 .domain = DOMAIN_KERNEL,
266 },
267 [MT_MEMORY_ITCM] = {
268 .prot_pte = L_PTE_PRESENT | L_PTE_YOUNG | L_PTE_DIRTY |
269 L_PTE_USER | L_PTE_EXEC,
270 .prot_l1 = PMD_TYPE_TABLE,
271 .domain = DOMAIN_IO,
272 },
261}; 273};
262 274
263const struct mem_type *get_mem_type(unsigned int type) 275const struct mem_type *get_mem_type(unsigned int type)
@@ -488,18 +500,28 @@ static void __init build_mem_type_table(void)
488 500
489#define vectors_base() (vectors_high() ? 0xffff0000 : 0) 501#define vectors_base() (vectors_high() ? 0xffff0000 : 0)
490 502
491static void __init alloc_init_pte(pmd_t *pmd, unsigned long addr, 503static void __init *early_alloc(unsigned long sz)
492 unsigned long end, unsigned long pfn,
493 const struct mem_type *type)
494{ 504{
495 pte_t *pte; 505 void *ptr = __va(memblock_alloc(sz, sz));
506 memset(ptr, 0, sz);
507 return ptr;
508}
496 509
510static pte_t * __init early_pte_alloc(pmd_t *pmd, unsigned long addr, unsigned long prot)
511{
497 if (pmd_none(*pmd)) { 512 if (pmd_none(*pmd)) {
498 pte = alloc_bootmem_low_pages(2 * PTRS_PER_PTE * sizeof(pte_t)); 513 pte_t *pte = early_alloc(2 * PTRS_PER_PTE * sizeof(pte_t));
499 __pmd_populate(pmd, __pa(pte) | type->prot_l1); 514 __pmd_populate(pmd, __pa(pte) | prot);
500 } 515 }
516 BUG_ON(pmd_bad(*pmd));
517 return pte_offset_kernel(pmd, addr);
518}
501 519
502 pte = pte_offset_kernel(pmd, addr); 520static void __init alloc_init_pte(pmd_t *pmd, unsigned long addr,
521 unsigned long end, unsigned long pfn,
522 const struct mem_type *type)
523{
524 pte_t *pte = early_pte_alloc(pmd, addr, type->prot_l1);
503 do { 525 do {
504 set_pte_ext(pte, pfn_pte(pfn, __pgprot(type->prot_pte)), 0); 526 set_pte_ext(pte, pfn_pte(pfn, __pgprot(type->prot_pte)), 0);
505 pfn++; 527 pfn++;
@@ -668,7 +690,7 @@ void __init iotable_init(struct map_desc *io_desc, int nr)
668 create_mapping(io_desc + i); 690 create_mapping(io_desc + i);
669} 691}
670 692
671static unsigned long __initdata vmalloc_reserve = SZ_128M; 693static void * __initdata vmalloc_min = (void *)(VMALLOC_END - SZ_128M);
672 694
673/* 695/*
674 * vmalloc=size forces the vmalloc area to be exactly 'size' 696 * vmalloc=size forces the vmalloc area to be exactly 'size'
@@ -677,7 +699,7 @@ static unsigned long __initdata vmalloc_reserve = SZ_128M;
677 */ 699 */
678static int __init early_vmalloc(char *arg) 700static int __init early_vmalloc(char *arg)
679{ 701{
680 vmalloc_reserve = memparse(arg, NULL); 702 unsigned long vmalloc_reserve = memparse(arg, NULL);
681 703
682 if (vmalloc_reserve < SZ_16M) { 704 if (vmalloc_reserve < SZ_16M) {
683 vmalloc_reserve = SZ_16M; 705 vmalloc_reserve = SZ_16M;
@@ -692,22 +714,26 @@ static int __init early_vmalloc(char *arg)
692 "vmalloc area is too big, limiting to %luMB\n", 714 "vmalloc area is too big, limiting to %luMB\n",
693 vmalloc_reserve >> 20); 715 vmalloc_reserve >> 20);
694 } 716 }
717
718 vmalloc_min = (void *)(VMALLOC_END - vmalloc_reserve);
695 return 0; 719 return 0;
696} 720}
697early_param("vmalloc", early_vmalloc); 721early_param("vmalloc", early_vmalloc);
698 722
699#define VMALLOC_MIN (void *)(VMALLOC_END - vmalloc_reserve) 723phys_addr_t lowmem_end_addr;
700 724
701static void __init sanity_check_meminfo(void) 725static void __init sanity_check_meminfo(void)
702{ 726{
703 int i, j, highmem = 0; 727 int i, j, highmem = 0;
704 728
729 lowmem_end_addr = __pa(vmalloc_min - 1) + 1;
730
705 for (i = 0, j = 0; i < meminfo.nr_banks; i++) { 731 for (i = 0, j = 0; i < meminfo.nr_banks; i++) {
706 struct membank *bank = &meminfo.bank[j]; 732 struct membank *bank = &meminfo.bank[j];
707 *bank = meminfo.bank[i]; 733 *bank = meminfo.bank[i];
708 734
709#ifdef CONFIG_HIGHMEM 735#ifdef CONFIG_HIGHMEM
710 if (__va(bank->start) > VMALLOC_MIN || 736 if (__va(bank->start) > vmalloc_min ||
711 __va(bank->start) < (void *)PAGE_OFFSET) 737 __va(bank->start) < (void *)PAGE_OFFSET)
712 highmem = 1; 738 highmem = 1;
713 739
@@ -717,8 +743,8 @@ static void __init sanity_check_meminfo(void)
717 * Split those memory banks which are partially overlapping 743 * Split those memory banks which are partially overlapping
718 * the vmalloc area greatly simplifying things later. 744 * the vmalloc area greatly simplifying things later.
719 */ 745 */
720 if (__va(bank->start) < VMALLOC_MIN && 746 if (__va(bank->start) < vmalloc_min &&
721 bank->size > VMALLOC_MIN - __va(bank->start)) { 747 bank->size > vmalloc_min - __va(bank->start)) {
722 if (meminfo.nr_banks >= NR_BANKS) { 748 if (meminfo.nr_banks >= NR_BANKS) {
723 printk(KERN_CRIT "NR_BANKS too low, " 749 printk(KERN_CRIT "NR_BANKS too low, "
724 "ignoring high memory\n"); 750 "ignoring high memory\n");
@@ -727,12 +753,12 @@ static void __init sanity_check_meminfo(void)
727 (meminfo.nr_banks - i) * sizeof(*bank)); 753 (meminfo.nr_banks - i) * sizeof(*bank));
728 meminfo.nr_banks++; 754 meminfo.nr_banks++;
729 i++; 755 i++;
730 bank[1].size -= VMALLOC_MIN - __va(bank->start); 756 bank[1].size -= vmalloc_min - __va(bank->start);
731 bank[1].start = __pa(VMALLOC_MIN - 1) + 1; 757 bank[1].start = __pa(vmalloc_min - 1) + 1;
732 bank[1].highmem = highmem = 1; 758 bank[1].highmem = highmem = 1;
733 j++; 759 j++;
734 } 760 }
735 bank->size = VMALLOC_MIN - __va(bank->start); 761 bank->size = vmalloc_min - __va(bank->start);
736 } 762 }
737#else 763#else
738 bank->highmem = highmem; 764 bank->highmem = highmem;
@@ -741,7 +767,7 @@ static void __init sanity_check_meminfo(void)
741 * Check whether this memory bank would entirely overlap 767 * Check whether this memory bank would entirely overlap
742 * the vmalloc area. 768 * the vmalloc area.
743 */ 769 */
744 if (__va(bank->start) >= VMALLOC_MIN || 770 if (__va(bank->start) >= vmalloc_min ||
745 __va(bank->start) < (void *)PAGE_OFFSET) { 771 __va(bank->start) < (void *)PAGE_OFFSET) {
746 printk(KERN_NOTICE "Ignoring RAM at %.8lx-%.8lx " 772 printk(KERN_NOTICE "Ignoring RAM at %.8lx-%.8lx "
747 "(vmalloc region overlap).\n", 773 "(vmalloc region overlap).\n",
@@ -753,9 +779,9 @@ static void __init sanity_check_meminfo(void)
753 * Check whether this memory bank would partially overlap 779 * Check whether this memory bank would partially overlap
754 * the vmalloc area. 780 * the vmalloc area.
755 */ 781 */
756 if (__va(bank->start + bank->size) > VMALLOC_MIN || 782 if (__va(bank->start + bank->size) > vmalloc_min ||
757 __va(bank->start + bank->size) < __va(bank->start)) { 783 __va(bank->start + bank->size) < __va(bank->start)) {
758 unsigned long newsize = VMALLOC_MIN - __va(bank->start); 784 unsigned long newsize = vmalloc_min - __va(bank->start);
759 printk(KERN_NOTICE "Truncating RAM at %.8lx-%.8lx " 785 printk(KERN_NOTICE "Truncating RAM at %.8lx-%.8lx "
760 "to -%.8lx (vmalloc region overlap).\n", 786 "to -%.8lx (vmalloc region overlap).\n",
761 bank->start, bank->start + bank->size - 1, 787 bank->start, bank->start + bank->size - 1,
@@ -827,101 +853,23 @@ static inline void prepare_page_table(void)
827} 853}
828 854
829/* 855/*
830 * Reserve the various regions of node 0 856 * Reserve the special regions of memory
831 */ 857 */
832void __init reserve_node_zero(pg_data_t *pgdat) 858void __init arm_mm_memblock_reserve(void)
833{ 859{
834 unsigned long res_size = 0;
835
836 /*
837 * Register the kernel text and data with bootmem.
838 * Note that this can only be in node 0.
839 */
840#ifdef CONFIG_XIP_KERNEL
841 reserve_bootmem_node(pgdat, __pa(_data), _end - _data,
842 BOOTMEM_DEFAULT);
843#else
844 reserve_bootmem_node(pgdat, __pa(_stext), _end - _stext,
845 BOOTMEM_DEFAULT);
846#endif
847
848 /* 860 /*
849 * Reserve the page tables. These are already in use, 861 * Reserve the page tables. These are already in use,
850 * and can only be in node 0. 862 * and can only be in node 0.
851 */ 863 */
852 reserve_bootmem_node(pgdat, __pa(swapper_pg_dir), 864 memblock_reserve(__pa(swapper_pg_dir), PTRS_PER_PGD * sizeof(pgd_t));
853 PTRS_PER_PGD * sizeof(pgd_t), BOOTMEM_DEFAULT);
854
855 /*
856 * Hmm... This should go elsewhere, but we really really need to
857 * stop things allocating the low memory; ideally we need a better
858 * implementation of GFP_DMA which does not assume that DMA-able
859 * memory starts at zero.
860 */
861 if (machine_is_integrator() || machine_is_cintegrator())
862 res_size = __pa(swapper_pg_dir) - PHYS_OFFSET;
863
864 /*
865 * These should likewise go elsewhere. They pre-reserve the
866 * screen memory region at the start of main system memory.
867 */
868 if (machine_is_edb7211())
869 res_size = 0x00020000;
870 if (machine_is_p720t())
871 res_size = 0x00014000;
872
873 /* H1940, RX3715 and RX1950 need to reserve this for suspend */
874
875 if (machine_is_h1940() || machine_is_rx3715()
876 || machine_is_rx1950()) {
877 reserve_bootmem_node(pgdat, 0x30003000, 0x1000,
878 BOOTMEM_DEFAULT);
879 reserve_bootmem_node(pgdat, 0x30081000, 0x1000,
880 BOOTMEM_DEFAULT);
881 }
882
883 if (machine_is_palmld() || machine_is_palmtx()) {
884 reserve_bootmem_node(pgdat, 0xa0000000, 0x1000,
885 BOOTMEM_EXCLUSIVE);
886 reserve_bootmem_node(pgdat, 0xa0200000, 0x1000,
887 BOOTMEM_EXCLUSIVE);
888 }
889
890 if (machine_is_treo680() || machine_is_centro()) {
891 reserve_bootmem_node(pgdat, 0xa0000000, 0x1000,
892 BOOTMEM_EXCLUSIVE);
893 reserve_bootmem_node(pgdat, 0xa2000000, 0x1000,
894 BOOTMEM_EXCLUSIVE);
895 }
896
897 if (machine_is_palmt5())
898 reserve_bootmem_node(pgdat, 0xa0200000, 0x1000,
899 BOOTMEM_EXCLUSIVE);
900
901 /*
902 * U300 - This platform family can share physical memory
903 * between two ARM cpus, one running Linux and the other
904 * running another OS.
905 */
906 if (machine_is_u300()) {
907#ifdef CONFIG_MACH_U300_SINGLE_RAM
908#if ((CONFIG_MACH_U300_ACCESS_MEM_SIZE & 1) == 1) && \
909 CONFIG_MACH_U300_2MB_ALIGNMENT_FIX
910 res_size = 0x00100000;
911#endif
912#endif
913 }
914 865
915#ifdef CONFIG_SA1111 866#ifdef CONFIG_SA1111
916 /* 867 /*
917 * Because of the SA1111 DMA bug, we want to preserve our 868 * Because of the SA1111 DMA bug, we want to preserve our
918 * precious DMA-able memory... 869 * precious DMA-able memory...
919 */ 870 */
920 res_size = __pa(swapper_pg_dir) - PHYS_OFFSET; 871 memblock_reserve(PHYS_OFFSET, __pa(swapper_pg_dir) - PHYS_OFFSET);
921#endif 872#endif
922 if (res_size)
923 reserve_bootmem_node(pgdat, PHYS_OFFSET, res_size,
924 BOOTMEM_DEFAULT);
925} 873}
926 874
927/* 875/*
@@ -940,7 +888,7 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
940 /* 888 /*
941 * Allocate the vector page early. 889 * Allocate the vector page early.
942 */ 890 */
943 vectors = alloc_bootmem_low_pages(PAGE_SIZE); 891 vectors = early_alloc(PAGE_SIZE);
944 892
945 for (addr = VMALLOC_END; addr; addr += PGDIR_SIZE) 893 for (addr = VMALLOC_END; addr; addr += PGDIR_SIZE)
946 pmd_clear(pmd_off_k(addr)); 894 pmd_clear(pmd_off_k(addr));
@@ -1011,11 +959,8 @@ static void __init devicemaps_init(struct machine_desc *mdesc)
1011static void __init kmap_init(void) 959static void __init kmap_init(void)
1012{ 960{
1013#ifdef CONFIG_HIGHMEM 961#ifdef CONFIG_HIGHMEM
1014 pmd_t *pmd = pmd_off_k(PKMAP_BASE); 962 pkmap_page_table = early_pte_alloc(pmd_off_k(PKMAP_BASE),
1015 pte_t *pte = alloc_bootmem_low_pages(2 * PTRS_PER_PTE * sizeof(pte_t)); 963 PKMAP_BASE, _PAGE_KERNEL_TABLE);
1016 BUG_ON(!pmd_none(*pmd) || !pte);
1017 __pmd_populate(pmd, __pa(pte) | _PAGE_KERNEL_TABLE);
1018 pkmap_page_table = pte + PTRS_PER_PTE;
1019#endif 964#endif
1020} 965}
1021 966
@@ -1066,17 +1011,16 @@ void __init paging_init(struct machine_desc *mdesc)
1066 sanity_check_meminfo(); 1011 sanity_check_meminfo();
1067 prepare_page_table(); 1012 prepare_page_table();
1068 map_lowmem(); 1013 map_lowmem();
1069 bootmem_init();
1070 devicemaps_init(mdesc); 1014 devicemaps_init(mdesc);
1071 kmap_init(); 1015 kmap_init();
1072 1016
1073 top_pmd = pmd_off_k(0xffff0000); 1017 top_pmd = pmd_off_k(0xffff0000);
1074 1018
1075 /* 1019 /* allocate the zero page. */
1076 * allocate the zero page. Note that this always succeeds and 1020 zero_page = early_alloc(PAGE_SIZE);
1077 * returns a zeroed result. 1021
1078 */ 1022 bootmem_init();
1079 zero_page = alloc_bootmem_low_pages(PAGE_SIZE); 1023
1080 empty_zero_page = virt_to_page(zero_page); 1024 empty_zero_page = virt_to_page(zero_page);
1081 __flush_dcache_page(NULL, empty_zero_page); 1025 __flush_dcache_page(NULL, empty_zero_page);
1082} 1026}
diff --git a/arch/arm/mm/nommu.c b/arch/arm/mm/nommu.c
index 33b327379f07..687d02319a41 100644
--- a/arch/arm/mm/nommu.c
+++ b/arch/arm/mm/nommu.c
@@ -6,8 +6,8 @@
6#include <linux/module.h> 6#include <linux/module.h>
7#include <linux/mm.h> 7#include <linux/mm.h>
8#include <linux/pagemap.h> 8#include <linux/pagemap.h>
9#include <linux/bootmem.h>
10#include <linux/io.h> 9#include <linux/io.h>
10#include <linux/memblock.h>
11 11
12#include <asm/cacheflush.h> 12#include <asm/cacheflush.h>
13#include <asm/sections.h> 13#include <asm/sections.h>
@@ -17,30 +17,14 @@
17 17
18#include "mm.h" 18#include "mm.h"
19 19
20/* 20void __init arm_mm_memblock_reserve(void)
21 * Reserve the various regions of node 0
22 */
23void __init reserve_node_zero(pg_data_t *pgdat)
24{ 21{
25 /* 22 /*
26 * Register the kernel text and data with bootmem.
27 * Note that this can only be in node 0.
28 */
29#ifdef CONFIG_XIP_KERNEL
30 reserve_bootmem_node(pgdat, __pa(_data), _end - _data,
31 BOOTMEM_DEFAULT);
32#else
33 reserve_bootmem_node(pgdat, __pa(_stext), _end - _stext,
34 BOOTMEM_DEFAULT);
35#endif
36
37 /*
38 * Register the exception vector page. 23 * Register the exception vector page.
39 * some architectures which the DRAM is the exception vector to trap, 24 * some architectures which the DRAM is the exception vector to trap,
40 * alloc_page breaks with error, although it is not NULL, but "0." 25 * alloc_page breaks with error, although it is not NULL, but "0."
41 */ 26 */
42 reserve_bootmem_node(pgdat, CONFIG_VECTORS_BASE, PAGE_SIZE, 27 memblock_reserve(CONFIG_VECTORS_BASE, PAGE_SIZE);
43 BOOTMEM_DEFAULT);
44} 28}
45 29
46/* 30/*
diff --git a/arch/arm/mm/proc-arm1020.S b/arch/arm/mm/proc-arm1020.S
index 72507c630ceb..203a4e944d9e 100644
--- a/arch/arm/mm/proc-arm1020.S
+++ b/arch/arm/mm/proc-arm1020.S
@@ -79,15 +79,11 @@ ENTRY(cpu_arm1020_proc_init)
79 * cpu_arm1020_proc_fin() 79 * cpu_arm1020_proc_fin()
80 */ 80 */
81ENTRY(cpu_arm1020_proc_fin) 81ENTRY(cpu_arm1020_proc_fin)
82 stmfd sp!, {lr}
83 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
84 msr cpsr_c, ip
85 bl arm1020_flush_kern_cache_all
86 mrc p15, 0, r0, c1, c0, 0 @ ctrl register 82 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
87 bic r0, r0, #0x1000 @ ...i............ 83 bic r0, r0, #0x1000 @ ...i............
88 bic r0, r0, #0x000e @ ............wca. 84 bic r0, r0, #0x000e @ ............wca.
89 mcr p15, 0, r0, c1, c0, 0 @ disable caches 85 mcr p15, 0, r0, c1, c0, 0 @ disable caches
90 ldmfd sp!, {pc} 86 mov pc, lr
91 87
92/* 88/*
93 * cpu_arm1020_reset(loc) 89 * cpu_arm1020_reset(loc)
diff --git a/arch/arm/mm/proc-arm1020e.S b/arch/arm/mm/proc-arm1020e.S
index d27829805609..1a511e765909 100644
--- a/arch/arm/mm/proc-arm1020e.S
+++ b/arch/arm/mm/proc-arm1020e.S
@@ -79,15 +79,11 @@ ENTRY(cpu_arm1020e_proc_init)
79 * cpu_arm1020e_proc_fin() 79 * cpu_arm1020e_proc_fin()
80 */ 80 */
81ENTRY(cpu_arm1020e_proc_fin) 81ENTRY(cpu_arm1020e_proc_fin)
82 stmfd sp!, {lr}
83 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
84 msr cpsr_c, ip
85 bl arm1020e_flush_kern_cache_all
86 mrc p15, 0, r0, c1, c0, 0 @ ctrl register 82 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
87 bic r0, r0, #0x1000 @ ...i............ 83 bic r0, r0, #0x1000 @ ...i............
88 bic r0, r0, #0x000e @ ............wca. 84 bic r0, r0, #0x000e @ ............wca.
89 mcr p15, 0, r0, c1, c0, 0 @ disable caches 85 mcr p15, 0, r0, c1, c0, 0 @ disable caches
90 ldmfd sp!, {pc} 86 mov pc, lr
91 87
92/* 88/*
93 * cpu_arm1020e_reset(loc) 89 * cpu_arm1020e_reset(loc)
diff --git a/arch/arm/mm/proc-arm1022.S b/arch/arm/mm/proc-arm1022.S
index ce13e4a827de..1ffa4eb9c34f 100644
--- a/arch/arm/mm/proc-arm1022.S
+++ b/arch/arm/mm/proc-arm1022.S
@@ -68,15 +68,11 @@ ENTRY(cpu_arm1022_proc_init)
68 * cpu_arm1022_proc_fin() 68 * cpu_arm1022_proc_fin()
69 */ 69 */
70ENTRY(cpu_arm1022_proc_fin) 70ENTRY(cpu_arm1022_proc_fin)
71 stmfd sp!, {lr}
72 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
73 msr cpsr_c, ip
74 bl arm1022_flush_kern_cache_all
75 mrc p15, 0, r0, c1, c0, 0 @ ctrl register 71 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
76 bic r0, r0, #0x1000 @ ...i............ 72 bic r0, r0, #0x1000 @ ...i............
77 bic r0, r0, #0x000e @ ............wca. 73 bic r0, r0, #0x000e @ ............wca.
78 mcr p15, 0, r0, c1, c0, 0 @ disable caches 74 mcr p15, 0, r0, c1, c0, 0 @ disable caches
79 ldmfd sp!, {pc} 75 mov pc, lr
80 76
81/* 77/*
82 * cpu_arm1022_reset(loc) 78 * cpu_arm1022_reset(loc)
diff --git a/arch/arm/mm/proc-arm1026.S b/arch/arm/mm/proc-arm1026.S
index 636672a29c6d..5697c34b95b0 100644
--- a/arch/arm/mm/proc-arm1026.S
+++ b/arch/arm/mm/proc-arm1026.S
@@ -68,15 +68,11 @@ ENTRY(cpu_arm1026_proc_init)
68 * cpu_arm1026_proc_fin() 68 * cpu_arm1026_proc_fin()
69 */ 69 */
70ENTRY(cpu_arm1026_proc_fin) 70ENTRY(cpu_arm1026_proc_fin)
71 stmfd sp!, {lr}
72 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
73 msr cpsr_c, ip
74 bl arm1026_flush_kern_cache_all
75 mrc p15, 0, r0, c1, c0, 0 @ ctrl register 71 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
76 bic r0, r0, #0x1000 @ ...i............ 72 bic r0, r0, #0x1000 @ ...i............
77 bic r0, r0, #0x000e @ ............wca. 73 bic r0, r0, #0x000e @ ............wca.
78 mcr p15, 0, r0, c1, c0, 0 @ disable caches 74 mcr p15, 0, r0, c1, c0, 0 @ disable caches
79 ldmfd sp!, {pc} 75 mov pc, lr
80 76
81/* 77/*
82 * cpu_arm1026_reset(loc) 78 * cpu_arm1026_reset(loc)
diff --git a/arch/arm/mm/proc-arm6_7.S b/arch/arm/mm/proc-arm6_7.S
index 795dc615f43b..64e0b327c7c5 100644
--- a/arch/arm/mm/proc-arm6_7.S
+++ b/arch/arm/mm/proc-arm6_7.S
@@ -184,8 +184,6 @@ ENTRY(cpu_arm7_proc_init)
184 184
185ENTRY(cpu_arm6_proc_fin) 185ENTRY(cpu_arm6_proc_fin)
186ENTRY(cpu_arm7_proc_fin) 186ENTRY(cpu_arm7_proc_fin)
187 mov r0, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
188 msr cpsr_c, r0
189 mov r0, #0x31 @ ....S..DP...M 187 mov r0, #0x31 @ ....S..DP...M
190 mcr p15, 0, r0, c1, c0, 0 @ disable caches 188 mcr p15, 0, r0, c1, c0, 0 @ disable caches
191 mov pc, lr 189 mov pc, lr
diff --git a/arch/arm/mm/proc-arm720.S b/arch/arm/mm/proc-arm720.S
index 0b62de244666..9d96824134fc 100644
--- a/arch/arm/mm/proc-arm720.S
+++ b/arch/arm/mm/proc-arm720.S
@@ -54,15 +54,11 @@ ENTRY(cpu_arm720_proc_init)
54 mov pc, lr 54 mov pc, lr
55 55
56ENTRY(cpu_arm720_proc_fin) 56ENTRY(cpu_arm720_proc_fin)
57 stmfd sp!, {lr}
58 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
59 msr cpsr_c, ip
60 mrc p15, 0, r0, c1, c0, 0 57 mrc p15, 0, r0, c1, c0, 0
61 bic r0, r0, #0x1000 @ ...i............ 58 bic r0, r0, #0x1000 @ ...i............
62 bic r0, r0, #0x000e @ ............wca. 59 bic r0, r0, #0x000e @ ............wca.
63 mcr p15, 0, r0, c1, c0, 0 @ disable caches 60 mcr p15, 0, r0, c1, c0, 0 @ disable caches
64 mcr p15, 0, r1, c7, c7, 0 @ invalidate cache 61 mov pc, lr
65 ldmfd sp!, {pc}
66 62
67/* 63/*
68 * Function: arm720_proc_do_idle(void) 64 * Function: arm720_proc_do_idle(void)
diff --git a/arch/arm/mm/proc-arm740.S b/arch/arm/mm/proc-arm740.S
index 01860cdeb2ec..6c1a9ab059ae 100644
--- a/arch/arm/mm/proc-arm740.S
+++ b/arch/arm/mm/proc-arm740.S
@@ -36,15 +36,11 @@ ENTRY(cpu_arm740_switch_mm)
36 * cpu_arm740_proc_fin() 36 * cpu_arm740_proc_fin()
37 */ 37 */
38ENTRY(cpu_arm740_proc_fin) 38ENTRY(cpu_arm740_proc_fin)
39 stmfd sp!, {lr}
40 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
41 msr cpsr_c, ip
42 mrc p15, 0, r0, c1, c0, 0 39 mrc p15, 0, r0, c1, c0, 0
43 bic r0, r0, #0x3f000000 @ bank/f/lock/s 40 bic r0, r0, #0x3f000000 @ bank/f/lock/s
44 bic r0, r0, #0x0000000c @ w-buffer/cache 41 bic r0, r0, #0x0000000c @ w-buffer/cache
45 mcr p15, 0, r0, c1, c0, 0 @ disable caches 42 mcr p15, 0, r0, c1, c0, 0 @ disable caches
46 mcr p15, 0, r0, c7, c0, 0 @ invalidate cache 43 mov pc, lr
47 ldmfd sp!, {pc}
48 44
49/* 45/*
50 * cpu_arm740_reset(loc) 46 * cpu_arm740_reset(loc)
diff --git a/arch/arm/mm/proc-arm7tdmi.S b/arch/arm/mm/proc-arm7tdmi.S
index 1201b9863829..6a850dbba22e 100644
--- a/arch/arm/mm/proc-arm7tdmi.S
+++ b/arch/arm/mm/proc-arm7tdmi.S
@@ -36,8 +36,6 @@ ENTRY(cpu_arm7tdmi_switch_mm)
36 * cpu_arm7tdmi_proc_fin() 36 * cpu_arm7tdmi_proc_fin()
37 */ 37 */
38ENTRY(cpu_arm7tdmi_proc_fin) 38ENTRY(cpu_arm7tdmi_proc_fin)
39 mov r0, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
40 msr cpsr_c, r0
41 mov pc, lr 39 mov pc, lr
42 40
43/* 41/*
diff --git a/arch/arm/mm/proc-arm920.S b/arch/arm/mm/proc-arm920.S
index 8be81992645d..86f80aa56216 100644
--- a/arch/arm/mm/proc-arm920.S
+++ b/arch/arm/mm/proc-arm920.S
@@ -69,19 +69,11 @@ ENTRY(cpu_arm920_proc_init)
69 * cpu_arm920_proc_fin() 69 * cpu_arm920_proc_fin()
70 */ 70 */
71ENTRY(cpu_arm920_proc_fin) 71ENTRY(cpu_arm920_proc_fin)
72 stmfd sp!, {lr}
73 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
74 msr cpsr_c, ip
75#ifndef CONFIG_CPU_DCACHE_WRITETHROUGH
76 bl arm920_flush_kern_cache_all
77#else
78 bl v4wt_flush_kern_cache_all
79#endif
80 mrc p15, 0, r0, c1, c0, 0 @ ctrl register 72 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
81 bic r0, r0, #0x1000 @ ...i............ 73 bic r0, r0, #0x1000 @ ...i............
82 bic r0, r0, #0x000e @ ............wca. 74 bic r0, r0, #0x000e @ ............wca.
83 mcr p15, 0, r0, c1, c0, 0 @ disable caches 75 mcr p15, 0, r0, c1, c0, 0 @ disable caches
84 ldmfd sp!, {pc} 76 mov pc, lr
85 77
86/* 78/*
87 * cpu_arm920_reset(loc) 79 * cpu_arm920_reset(loc)
diff --git a/arch/arm/mm/proc-arm922.S b/arch/arm/mm/proc-arm922.S
index c0ff8e4b1074..f76ce9b62883 100644
--- a/arch/arm/mm/proc-arm922.S
+++ b/arch/arm/mm/proc-arm922.S
@@ -71,19 +71,11 @@ ENTRY(cpu_arm922_proc_init)
71 * cpu_arm922_proc_fin() 71 * cpu_arm922_proc_fin()
72 */ 72 */
73ENTRY(cpu_arm922_proc_fin) 73ENTRY(cpu_arm922_proc_fin)
74 stmfd sp!, {lr}
75 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
76 msr cpsr_c, ip
77#ifndef CONFIG_CPU_DCACHE_WRITETHROUGH
78 bl arm922_flush_kern_cache_all
79#else
80 bl v4wt_flush_kern_cache_all
81#endif
82 mrc p15, 0, r0, c1, c0, 0 @ ctrl register 74 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
83 bic r0, r0, #0x1000 @ ...i............ 75 bic r0, r0, #0x1000 @ ...i............
84 bic r0, r0, #0x000e @ ............wca. 76 bic r0, r0, #0x000e @ ............wca.
85 mcr p15, 0, r0, c1, c0, 0 @ disable caches 77 mcr p15, 0, r0, c1, c0, 0 @ disable caches
86 ldmfd sp!, {pc} 78 mov pc, lr
87 79
88/* 80/*
89 * cpu_arm922_reset(loc) 81 * cpu_arm922_reset(loc)
diff --git a/arch/arm/mm/proc-arm925.S b/arch/arm/mm/proc-arm925.S
index 3c6cffe400f6..657bd3f7c153 100644
--- a/arch/arm/mm/proc-arm925.S
+++ b/arch/arm/mm/proc-arm925.S
@@ -92,15 +92,11 @@ ENTRY(cpu_arm925_proc_init)
92 * cpu_arm925_proc_fin() 92 * cpu_arm925_proc_fin()
93 */ 93 */
94ENTRY(cpu_arm925_proc_fin) 94ENTRY(cpu_arm925_proc_fin)
95 stmfd sp!, {lr}
96 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
97 msr cpsr_c, ip
98 bl arm925_flush_kern_cache_all
99 mrc p15, 0, r0, c1, c0, 0 @ ctrl register 95 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
100 bic r0, r0, #0x1000 @ ...i............ 96 bic r0, r0, #0x1000 @ ...i............
101 bic r0, r0, #0x000e @ ............wca. 97 bic r0, r0, #0x000e @ ............wca.
102 mcr p15, 0, r0, c1, c0, 0 @ disable caches 98 mcr p15, 0, r0, c1, c0, 0 @ disable caches
103 ldmfd sp!, {pc} 99 mov pc, lr
104 100
105/* 101/*
106 * cpu_arm925_reset(loc) 102 * cpu_arm925_reset(loc)
diff --git a/arch/arm/mm/proc-arm926.S b/arch/arm/mm/proc-arm926.S
index 75b707c9cce1..73f1f3c68910 100644
--- a/arch/arm/mm/proc-arm926.S
+++ b/arch/arm/mm/proc-arm926.S
@@ -61,15 +61,11 @@ ENTRY(cpu_arm926_proc_init)
61 * cpu_arm926_proc_fin() 61 * cpu_arm926_proc_fin()
62 */ 62 */
63ENTRY(cpu_arm926_proc_fin) 63ENTRY(cpu_arm926_proc_fin)
64 stmfd sp!, {lr}
65 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
66 msr cpsr_c, ip
67 bl arm926_flush_kern_cache_all
68 mrc p15, 0, r0, c1, c0, 0 @ ctrl register 64 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
69 bic r0, r0, #0x1000 @ ...i............ 65 bic r0, r0, #0x1000 @ ...i............
70 bic r0, r0, #0x000e @ ............wca. 66 bic r0, r0, #0x000e @ ............wca.
71 mcr p15, 0, r0, c1, c0, 0 @ disable caches 67 mcr p15, 0, r0, c1, c0, 0 @ disable caches
72 ldmfd sp!, {pc} 68 mov pc, lr
73 69
74/* 70/*
75 * cpu_arm926_reset(loc) 71 * cpu_arm926_reset(loc)
diff --git a/arch/arm/mm/proc-arm940.S b/arch/arm/mm/proc-arm940.S
index 1af1657819eb..fffb061a45a5 100644
--- a/arch/arm/mm/proc-arm940.S
+++ b/arch/arm/mm/proc-arm940.S
@@ -37,15 +37,11 @@ ENTRY(cpu_arm940_switch_mm)
37 * cpu_arm940_proc_fin() 37 * cpu_arm940_proc_fin()
38 */ 38 */
39ENTRY(cpu_arm940_proc_fin) 39ENTRY(cpu_arm940_proc_fin)
40 stmfd sp!, {lr}
41 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
42 msr cpsr_c, ip
43 bl arm940_flush_kern_cache_all
44 mrc p15, 0, r0, c1, c0, 0 @ ctrl register 40 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
45 bic r0, r0, #0x00001000 @ i-cache 41 bic r0, r0, #0x00001000 @ i-cache
46 bic r0, r0, #0x00000004 @ d-cache 42 bic r0, r0, #0x00000004 @ d-cache
47 mcr p15, 0, r0, c1, c0, 0 @ disable caches 43 mcr p15, 0, r0, c1, c0, 0 @ disable caches
48 ldmfd sp!, {pc} 44 mov pc, lr
49 45
50/* 46/*
51 * cpu_arm940_reset(loc) 47 * cpu_arm940_reset(loc)
diff --git a/arch/arm/mm/proc-arm946.S b/arch/arm/mm/proc-arm946.S
index 1664b6aaff79..249a6053760a 100644
--- a/arch/arm/mm/proc-arm946.S
+++ b/arch/arm/mm/proc-arm946.S
@@ -44,15 +44,11 @@ ENTRY(cpu_arm946_switch_mm)
44 * cpu_arm946_proc_fin() 44 * cpu_arm946_proc_fin()
45 */ 45 */
46ENTRY(cpu_arm946_proc_fin) 46ENTRY(cpu_arm946_proc_fin)
47 stmfd sp!, {lr}
48 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
49 msr cpsr_c, ip
50 bl arm946_flush_kern_cache_all
51 mrc p15, 0, r0, c1, c0, 0 @ ctrl register 47 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
52 bic r0, r0, #0x00001000 @ i-cache 48 bic r0, r0, #0x00001000 @ i-cache
53 bic r0, r0, #0x00000004 @ d-cache 49 bic r0, r0, #0x00000004 @ d-cache
54 mcr p15, 0, r0, c1, c0, 0 @ disable caches 50 mcr p15, 0, r0, c1, c0, 0 @ disable caches
55 ldmfd sp!, {pc} 51 mov pc, lr
56 52
57/* 53/*
58 * cpu_arm946_reset(loc) 54 * cpu_arm946_reset(loc)
diff --git a/arch/arm/mm/proc-arm9tdmi.S b/arch/arm/mm/proc-arm9tdmi.S
index 28545c29dbcd..db475667fac2 100644
--- a/arch/arm/mm/proc-arm9tdmi.S
+++ b/arch/arm/mm/proc-arm9tdmi.S
@@ -36,8 +36,6 @@ ENTRY(cpu_arm9tdmi_switch_mm)
36 * cpu_arm9tdmi_proc_fin() 36 * cpu_arm9tdmi_proc_fin()
37 */ 37 */
38ENTRY(cpu_arm9tdmi_proc_fin) 38ENTRY(cpu_arm9tdmi_proc_fin)
39 mov r0, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
40 msr cpsr_c, r0
41 mov pc, lr 39 mov pc, lr
42 40
43/* 41/*
diff --git a/arch/arm/mm/proc-fa526.S b/arch/arm/mm/proc-fa526.S
index 08f5ac237ad4..7803fdf70029 100644
--- a/arch/arm/mm/proc-fa526.S
+++ b/arch/arm/mm/proc-fa526.S
@@ -39,17 +39,13 @@ ENTRY(cpu_fa526_proc_init)
39 * cpu_fa526_proc_fin() 39 * cpu_fa526_proc_fin()
40 */ 40 */
41ENTRY(cpu_fa526_proc_fin) 41ENTRY(cpu_fa526_proc_fin)
42 stmfd sp!, {lr}
43 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
44 msr cpsr_c, ip
45 bl fa_flush_kern_cache_all
46 mrc p15, 0, r0, c1, c0, 0 @ ctrl register 42 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
47 bic r0, r0, #0x1000 @ ...i............ 43 bic r0, r0, #0x1000 @ ...i............
48 bic r0, r0, #0x000e @ ............wca. 44 bic r0, r0, #0x000e @ ............wca.
49 mcr p15, 0, r0, c1, c0, 0 @ disable caches 45 mcr p15, 0, r0, c1, c0, 0 @ disable caches
50 nop 46 nop
51 nop 47 nop
52 ldmfd sp!, {pc} 48 mov pc, lr
53 49
54/* 50/*
55 * cpu_fa526_reset(loc) 51 * cpu_fa526_reset(loc)
diff --git a/arch/arm/mm/proc-feroceon.S b/arch/arm/mm/proc-feroceon.S
index 53e632343849..b304d0104a4e 100644
--- a/arch/arm/mm/proc-feroceon.S
+++ b/arch/arm/mm/proc-feroceon.S
@@ -75,11 +75,6 @@ ENTRY(cpu_feroceon_proc_init)
75 * cpu_feroceon_proc_fin() 75 * cpu_feroceon_proc_fin()
76 */ 76 */
77ENTRY(cpu_feroceon_proc_fin) 77ENTRY(cpu_feroceon_proc_fin)
78 stmfd sp!, {lr}
79 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
80 msr cpsr_c, ip
81 bl feroceon_flush_kern_cache_all
82
83#if defined(CONFIG_CACHE_FEROCEON_L2) && \ 78#if defined(CONFIG_CACHE_FEROCEON_L2) && \
84 !defined(CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH) 79 !defined(CONFIG_CACHE_FEROCEON_L2_WRITETHROUGH)
85 mov r0, #0 80 mov r0, #0
@@ -91,7 +86,7 @@ ENTRY(cpu_feroceon_proc_fin)
91 bic r0, r0, #0x1000 @ ...i............ 86 bic r0, r0, #0x1000 @ ...i............
92 bic r0, r0, #0x000e @ ............wca. 87 bic r0, r0, #0x000e @ ............wca.
93 mcr p15, 0, r0, c1, c0, 0 @ disable caches 88 mcr p15, 0, r0, c1, c0, 0 @ disable caches
94 ldmfd sp!, {pc} 89 mov pc, lr
95 90
96/* 91/*
97 * cpu_feroceon_reset(loc) 92 * cpu_feroceon_reset(loc)
diff --git a/arch/arm/mm/proc-mohawk.S b/arch/arm/mm/proc-mohawk.S
index caa31154e7db..5f6892fcc167 100644
--- a/arch/arm/mm/proc-mohawk.S
+++ b/arch/arm/mm/proc-mohawk.S
@@ -51,15 +51,11 @@ ENTRY(cpu_mohawk_proc_init)
51 * cpu_mohawk_proc_fin() 51 * cpu_mohawk_proc_fin()
52 */ 52 */
53ENTRY(cpu_mohawk_proc_fin) 53ENTRY(cpu_mohawk_proc_fin)
54 stmfd sp!, {lr}
55 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
56 msr cpsr_c, ip
57 bl mohawk_flush_kern_cache_all
58 mrc p15, 0, r0, c1, c0, 0 @ ctrl register 54 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
59 bic r0, r0, #0x1800 @ ...iz........... 55 bic r0, r0, #0x1800 @ ...iz...........
60 bic r0, r0, #0x0006 @ .............ca. 56 bic r0, r0, #0x0006 @ .............ca.
61 mcr p15, 0, r0, c1, c0, 0 @ disable caches 57 mcr p15, 0, r0, c1, c0, 0 @ disable caches
62 ldmfd sp!, {pc} 58 mov pc, lr
63 59
64/* 60/*
65 * cpu_mohawk_reset(loc) 61 * cpu_mohawk_reset(loc)
diff --git a/arch/arm/mm/proc-sa110.S b/arch/arm/mm/proc-sa110.S
index 7b706b389906..a201eb04b5e1 100644
--- a/arch/arm/mm/proc-sa110.S
+++ b/arch/arm/mm/proc-sa110.S
@@ -44,17 +44,13 @@ ENTRY(cpu_sa110_proc_init)
44 * cpu_sa110_proc_fin() 44 * cpu_sa110_proc_fin()
45 */ 45 */
46ENTRY(cpu_sa110_proc_fin) 46ENTRY(cpu_sa110_proc_fin)
47 stmfd sp!, {lr} 47 mov r0, #0
48 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
49 msr cpsr_c, ip
50 bl v4wb_flush_kern_cache_all @ clean caches
511: mov r0, #0
52 mcr p15, 0, r0, c15, c2, 2 @ Disable clock switching 48 mcr p15, 0, r0, c15, c2, 2 @ Disable clock switching
53 mrc p15, 0, r0, c1, c0, 0 @ ctrl register 49 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
54 bic r0, r0, #0x1000 @ ...i............ 50 bic r0, r0, #0x1000 @ ...i............
55 bic r0, r0, #0x000e @ ............wca. 51 bic r0, r0, #0x000e @ ............wca.
56 mcr p15, 0, r0, c1, c0, 0 @ disable caches 52 mcr p15, 0, r0, c1, c0, 0 @ disable caches
57 ldmfd sp!, {pc} 53 mov pc, lr
58 54
59/* 55/*
60 * cpu_sa110_reset(loc) 56 * cpu_sa110_reset(loc)
diff --git a/arch/arm/mm/proc-sa1100.S b/arch/arm/mm/proc-sa1100.S
index 5c47760c2064..7ddc4805bf97 100644
--- a/arch/arm/mm/proc-sa1100.S
+++ b/arch/arm/mm/proc-sa1100.S
@@ -55,16 +55,12 @@ ENTRY(cpu_sa1100_proc_init)
55 * - Clean and turn off caches. 55 * - Clean and turn off caches.
56 */ 56 */
57ENTRY(cpu_sa1100_proc_fin) 57ENTRY(cpu_sa1100_proc_fin)
58 stmfd sp!, {lr}
59 mov ip, #PSR_F_BIT | PSR_I_BIT | SVC_MODE
60 msr cpsr_c, ip
61 bl v4wb_flush_kern_cache_all
62 mcr p15, 0, ip, c15, c2, 2 @ Disable clock switching 58 mcr p15, 0, ip, c15, c2, 2 @ Disable clock switching
63 mrc p15, 0, r0, c1, c0, 0 @ ctrl register 59 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
64 bic r0, r0, #0x1000 @ ...i............ 60 bic r0, r0, #0x1000 @ ...i............
65 bic r0, r0, #0x000e @ ............wca. 61 bic r0, r0, #0x000e @ ............wca.
66 mcr p15, 0, r0, c1, c0, 0 @ disable caches 62 mcr p15, 0, r0, c1, c0, 0 @ disable caches
67 ldmfd sp!, {pc} 63 mov pc, lr
68 64
69/* 65/*
70 * cpu_sa1100_reset(loc) 66 * cpu_sa1100_reset(loc)
diff --git a/arch/arm/mm/proc-v6.S b/arch/arm/mm/proc-v6.S
index 7a5337ed7d68..22aac8515196 100644
--- a/arch/arm/mm/proc-v6.S
+++ b/arch/arm/mm/proc-v6.S
@@ -42,14 +42,11 @@ ENTRY(cpu_v6_proc_init)
42 mov pc, lr 42 mov pc, lr
43 43
44ENTRY(cpu_v6_proc_fin) 44ENTRY(cpu_v6_proc_fin)
45 stmfd sp!, {lr}
46 cpsid if @ disable interrupts
47 bl v6_flush_kern_cache_all
48 mrc p15, 0, r0, c1, c0, 0 @ ctrl register 45 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
49 bic r0, r0, #0x1000 @ ...i............ 46 bic r0, r0, #0x1000 @ ...i............
50 bic r0, r0, #0x0006 @ .............ca. 47 bic r0, r0, #0x0006 @ .............ca.
51 mcr p15, 0, r0, c1, c0, 0 @ disable caches 48 mcr p15, 0, r0, c1, c0, 0 @ disable caches
52 ldmfd sp!, {pc} 49 mov pc, lr
53 50
54/* 51/*
55 * cpu_v6_reset(loc) 52 * cpu_v6_reset(loc)
@@ -239,7 +236,8 @@ __v6_proc_info:
239 b __v6_setup 236 b __v6_setup
240 .long cpu_arch_name 237 .long cpu_arch_name
241 .long cpu_elf_name 238 .long cpu_elf_name
242 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP|HWCAP_JAVA 239 /* See also feat_v6_fixup() for HWCAP_TLS */
240 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP|HWCAP_JAVA|HWCAP_TLS
243 .long cpu_v6_name 241 .long cpu_v6_name
244 .long v6_processor_functions 242 .long v6_processor_functions
245 .long v6wbi_tlb_fns 243 .long v6wbi_tlb_fns
@@ -262,7 +260,7 @@ __pj4_v6_proc_info:
262 b __v6_setup 260 b __v6_setup
263 .long cpu_arch_name 261 .long cpu_arch_name
264 .long cpu_elf_name 262 .long cpu_elf_name
265 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP 263 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP|HWCAP_TLS
266 .long cpu_pj4_name 264 .long cpu_pj4_name
267 .long v6_processor_functions 265 .long v6_processor_functions
268 .long v6wbi_tlb_fns 266 .long v6wbi_tlb_fns
diff --git a/arch/arm/mm/proc-v7.S b/arch/arm/mm/proc-v7.S
index 7aaf88a3b7aa..6a8506d99ee9 100644
--- a/arch/arm/mm/proc-v7.S
+++ b/arch/arm/mm/proc-v7.S
@@ -45,14 +45,11 @@ ENTRY(cpu_v7_proc_init)
45ENDPROC(cpu_v7_proc_init) 45ENDPROC(cpu_v7_proc_init)
46 46
47ENTRY(cpu_v7_proc_fin) 47ENTRY(cpu_v7_proc_fin)
48 stmfd sp!, {lr}
49 cpsid if @ disable interrupts
50 bl v7_flush_kern_cache_all
51 mrc p15, 0, r0, c1, c0, 0 @ ctrl register 48 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
52 bic r0, r0, #0x1000 @ ...i............ 49 bic r0, r0, #0x1000 @ ...i............
53 bic r0, r0, #0x0006 @ .............ca. 50 bic r0, r0, #0x0006 @ .............ca.
54 mcr p15, 0, r0, c1, c0, 0 @ disable caches 51 mcr p15, 0, r0, c1, c0, 0 @ disable caches
55 ldmfd sp!, {pc} 52 mov pc, lr
56ENDPROC(cpu_v7_proc_fin) 53ENDPROC(cpu_v7_proc_fin)
57 54
58/* 55/*
@@ -344,7 +341,7 @@ __v7_proc_info:
344 b __v7_setup 341 b __v7_setup
345 .long cpu_arch_name 342 .long cpu_arch_name
346 .long cpu_elf_name 343 .long cpu_elf_name
347 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP 344 .long HWCAP_SWP|HWCAP_HALF|HWCAP_THUMB|HWCAP_FAST_MULT|HWCAP_EDSP|HWCAP_TLS
348 .long cpu_v7_name 345 .long cpu_v7_name
349 .long v7_processor_functions 346 .long v7_processor_functions
350 .long v7wbi_tlb_fns 347 .long v7wbi_tlb_fns
diff --git a/arch/arm/mm/proc-xsc3.S b/arch/arm/mm/proc-xsc3.S
index e5797f1c1db7..361a51e49030 100644
--- a/arch/arm/mm/proc-xsc3.S
+++ b/arch/arm/mm/proc-xsc3.S
@@ -90,15 +90,11 @@ ENTRY(cpu_xsc3_proc_init)
90 * cpu_xsc3_proc_fin() 90 * cpu_xsc3_proc_fin()
91 */ 91 */
92ENTRY(cpu_xsc3_proc_fin) 92ENTRY(cpu_xsc3_proc_fin)
93 str lr, [sp, #-4]!
94 mov r0, #PSR_F_BIT|PSR_I_BIT|SVC_MODE
95 msr cpsr_c, r0
96 bl xsc3_flush_kern_cache_all @ clean caches
97 mrc p15, 0, r0, c1, c0, 0 @ ctrl register 93 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
98 bic r0, r0, #0x1800 @ ...IZ........... 94 bic r0, r0, #0x1800 @ ...IZ...........
99 bic r0, r0, #0x0006 @ .............CA. 95 bic r0, r0, #0x0006 @ .............CA.
100 mcr p15, 0, r0, c1, c0, 0 @ disable caches 96 mcr p15, 0, r0, c1, c0, 0 @ disable caches
101 ldr pc, [sp], #4 97 mov pc, lr
102 98
103/* 99/*
104 * cpu_xsc3_reset(loc) 100 * cpu_xsc3_reset(loc)
diff --git a/arch/arm/mm/proc-xscale.S b/arch/arm/mm/proc-xscale.S
index 63037e2162f2..14075979bcba 100644
--- a/arch/arm/mm/proc-xscale.S
+++ b/arch/arm/mm/proc-xscale.S
@@ -124,15 +124,11 @@ ENTRY(cpu_xscale_proc_init)
124 * cpu_xscale_proc_fin() 124 * cpu_xscale_proc_fin()
125 */ 125 */
126ENTRY(cpu_xscale_proc_fin) 126ENTRY(cpu_xscale_proc_fin)
127 str lr, [sp, #-4]!
128 mov r0, #PSR_F_BIT|PSR_I_BIT|SVC_MODE
129 msr cpsr_c, r0
130 bl xscale_flush_kern_cache_all @ clean caches
131 mrc p15, 0, r0, c1, c0, 0 @ ctrl register 127 mrc p15, 0, r0, c1, c0, 0 @ ctrl register
132 bic r0, r0, #0x1800 @ ...IZ........... 128 bic r0, r0, #0x1800 @ ...IZ...........
133 bic r0, r0, #0x0006 @ .............CA. 129 bic r0, r0, #0x0006 @ .............CA.
134 mcr p15, 0, r0, c1, c0, 0 @ disable caches 130 mcr p15, 0, r0, c1, c0, 0 @ disable caches
135 ldr pc, [sp], #4 131 mov pc, lr
136 132
137/* 133/*
138 * cpu_xscale_reset(loc) 134 * cpu_xscale_reset(loc)
diff --git a/arch/arm/mm/vmregion.c b/arch/arm/mm/vmregion.c
index 19e09bdb1b8a..935993e1b1ef 100644
--- a/arch/arm/mm/vmregion.c
+++ b/arch/arm/mm/vmregion.c
@@ -35,7 +35,8 @@
35 */ 35 */
36 36
37struct arm_vmregion * 37struct arm_vmregion *
38arm_vmregion_alloc(struct arm_vmregion_head *head, size_t size, gfp_t gfp) 38arm_vmregion_alloc(struct arm_vmregion_head *head, size_t align,
39 size_t size, gfp_t gfp)
39{ 40{
40 unsigned long addr = head->vm_start, end = head->vm_end - size; 41 unsigned long addr = head->vm_start, end = head->vm_end - size;
41 unsigned long flags; 42 unsigned long flags;
@@ -58,7 +59,7 @@ arm_vmregion_alloc(struct arm_vmregion_head *head, size_t size, gfp_t gfp)
58 goto nospc; 59 goto nospc;
59 if ((addr + size) <= c->vm_start) 60 if ((addr + size) <= c->vm_start)
60 goto found; 61 goto found;
61 addr = c->vm_end; 62 addr = ALIGN(c->vm_end, align);
62 if (addr > end) 63 if (addr > end)
63 goto nospc; 64 goto nospc;
64 } 65 }
diff --git a/arch/arm/mm/vmregion.h b/arch/arm/mm/vmregion.h
index 6b2cdbdf3a85..15e9f044db9f 100644
--- a/arch/arm/mm/vmregion.h
+++ b/arch/arm/mm/vmregion.h
@@ -21,7 +21,7 @@ struct arm_vmregion {
21 int vm_active; 21 int vm_active;
22}; 22};
23 23
24struct arm_vmregion *arm_vmregion_alloc(struct arm_vmregion_head *, size_t, gfp_t); 24struct arm_vmregion *arm_vmregion_alloc(struct arm_vmregion_head *, size_t, size_t, gfp_t);
25struct arm_vmregion *arm_vmregion_find(struct arm_vmregion_head *, unsigned long); 25struct arm_vmregion *arm_vmregion_find(struct arm_vmregion_head *, unsigned long);
26struct arm_vmregion *arm_vmregion_find_remove(struct arm_vmregion_head *, unsigned long); 26struct arm_vmregion *arm_vmregion_find_remove(struct arm_vmregion_head *, unsigned long);
27void arm_vmregion_free(struct arm_vmregion_head *, struct arm_vmregion *); 27void arm_vmregion_free(struct arm_vmregion_head *, struct arm_vmregion *);
diff --git a/arch/arm/plat-iop/pci.c b/arch/arm/plat-iop/pci.c
index ce31f316ac75..43f2b158237c 100644
--- a/arch/arm/plat-iop/pci.c
+++ b/arch/arm/plat-iop/pci.c
@@ -359,7 +359,7 @@ static void __init iop3xx_atu_debug(void)
359 DBG("ATU: IOP3XX_ATUCMD=0x%04x\n", *IOP3XX_ATUCMD); 359 DBG("ATU: IOP3XX_ATUCMD=0x%04x\n", *IOP3XX_ATUCMD);
360 DBG("ATU: IOP3XX_ATUCR=0x%08x\n", *IOP3XX_ATUCR); 360 DBG("ATU: IOP3XX_ATUCR=0x%08x\n", *IOP3XX_ATUCR);
361 361
362 hook_fault_code(16+6, iop3xx_pci_abort, SIGBUS, "imprecise external abort"); 362 hook_fault_code(16+6, iop3xx_pci_abort, SIGBUS, 0, "imprecise external abort");
363} 363}
364 364
365/* for platforms that might be host-bus-adapters */ 365/* for platforms that might be host-bus-adapters */
diff --git a/arch/arm/plat-iop/time.c b/arch/arm/plat-iop/time.c
index 6c8a02ad98e3..85d3e55ca4a9 100644
--- a/arch/arm/plat-iop/time.c
+++ b/arch/arm/plat-iop/time.c
@@ -29,6 +29,11 @@
29#include <mach/time.h> 29#include <mach/time.h>
30 30
31/* 31/*
32 * Minimum clocksource/clockevent timer range in seconds
33 */
34#define IOP_MIN_RANGE 4
35
36/*
32 * IOP clocksource (free-running timer 1). 37 * IOP clocksource (free-running timer 1).
33 */ 38 */
34static cycle_t iop_clocksource_read(struct clocksource *unused) 39static cycle_t iop_clocksource_read(struct clocksource *unused)
@@ -44,27 +49,6 @@ static struct clocksource iop_clocksource = {
44 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 49 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
45}; 50};
46 51
47static void __init iop_clocksource_set_hz(struct clocksource *cs, unsigned int hz)
48{
49 u64 temp;
50 u32 shift;
51
52 /* Find shift and mult values for hz. */
53 shift = 32;
54 do {
55 temp = (u64) NSEC_PER_SEC << shift;
56 do_div(temp, hz);
57 if ((temp >> 32) == 0)
58 break;
59 } while (--shift != 0);
60
61 cs->shift = shift;
62 cs->mult = (u32) temp;
63
64 printk(KERN_INFO "clocksource: %s uses shift %u mult %#x\n",
65 cs->name, cs->shift, cs->mult);
66}
67
68/* 52/*
69 * IOP sched_clock() implementation via its clocksource. 53 * IOP sched_clock() implementation via its clocksource.
70 */ 54 */
@@ -130,27 +114,6 @@ static struct clock_event_device iop_clockevent = {
130 .set_mode = iop_set_mode, 114 .set_mode = iop_set_mode,
131}; 115};
132 116
133static void __init iop_clockevent_set_hz(struct clock_event_device *ce, unsigned int hz)
134{
135 u64 temp;
136 u32 shift;
137
138 /* Find shift and mult values for hz. */
139 shift = 32;
140 do {
141 temp = (u64) hz << shift;
142 do_div(temp, NSEC_PER_SEC);
143 if ((temp >> 32) == 0)
144 break;
145 } while (--shift != 0);
146
147 ce->shift = shift;
148 ce->mult = (u32) temp;
149
150 printk(KERN_INFO "clockevent: %s uses shift %u mult %#lx\n",
151 ce->name, ce->shift, ce->mult);
152}
153
154static irqreturn_t 117static irqreturn_t
155iop_timer_interrupt(int irq, void *dev_id) 118iop_timer_interrupt(int irq, void *dev_id)
156{ 119{
@@ -190,7 +153,8 @@ void __init iop_init_time(unsigned long tick_rate)
190 */ 153 */
191 write_tmr0(timer_ctl & ~IOP_TMR_EN); 154 write_tmr0(timer_ctl & ~IOP_TMR_EN);
192 setup_irq(IRQ_IOP_TIMER0, &iop_timer_irq); 155 setup_irq(IRQ_IOP_TIMER0, &iop_timer_irq);
193 iop_clockevent_set_hz(&iop_clockevent, tick_rate); 156 clockevents_calc_mult_shift(&iop_clockevent,
157 tick_rate, IOP_MIN_RANGE);
194 iop_clockevent.max_delta_ns = 158 iop_clockevent.max_delta_ns =
195 clockevent_delta2ns(0xfffffffe, &iop_clockevent); 159 clockevent_delta2ns(0xfffffffe, &iop_clockevent);
196 iop_clockevent.min_delta_ns = 160 iop_clockevent.min_delta_ns =
@@ -207,6 +171,7 @@ void __init iop_init_time(unsigned long tick_rate)
207 write_trr1(0xffffffff); 171 write_trr1(0xffffffff);
208 write_tcr1(0xffffffff); 172 write_tcr1(0xffffffff);
209 write_tmr1(timer_ctl); 173 write_tmr1(timer_ctl);
210 iop_clocksource_set_hz(&iop_clocksource, tick_rate); 174 clocksource_calc_mult_shift(&iop_clocksource, tick_rate,
175 IOP_MIN_RANGE);
211 clocksource_register(&iop_clocksource); 176 clocksource_register(&iop_clocksource);
212} 177}
diff --git a/arch/arm/plat-mxc/3ds_debugboard.c b/arch/arm/plat-mxc/3ds_debugboard.c
new file mode 100644
index 000000000000..639c54a07992
--- /dev/null
+++ b/arch/arm/plat-mxc/3ds_debugboard.c
@@ -0,0 +1,202 @@
1/*
2 * Copyright 2008-2009 Freescale Semiconductor, Inc. All Rights Reserved.
3 * Copyright (C) 2010 Jason Wang <jason77.wang@gmail.com>
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
11 */
12
13#include <linux/interrupt.h>
14#include <linux/irq.h>
15#include <linux/io.h>
16#include <linux/platform_device.h>
17#include <linux/gpio.h>
18#include <linux/smsc911x.h>
19
20#include <mach/hardware.h>
21
22/* LAN9217 ethernet base address */
23#define LAN9217_BASE_ADDR(n) (n + 0x0)
24/* External UART */
25#define UARTA_BASE_ADDR(n) (n + 0x8000)
26#define UARTB_BASE_ADDR(n) (n + 0x10000)
27
28#define BOARD_IO_ADDR(n) (n + 0x20000)
29/* LED switchs */
30#define LED_SWITCH_REG 0x00
31/* buttons */
32#define SWITCH_BUTTONS_REG 0x08
33/* status, interrupt */
34#define INTR_STATUS_REG 0x10
35#define INTR_MASK_REG 0x38
36#define INTR_RESET_REG 0x20
37/* magic word for debug CPLD */
38#define MAGIC_NUMBER1_REG 0x40
39#define MAGIC_NUMBER2_REG 0x48
40/* CPLD code version */
41#define CPLD_CODE_VER_REG 0x50
42/* magic word for debug CPLD */
43#define MAGIC_NUMBER3_REG 0x58
44/* module reset register*/
45#define MODULE_RESET_REG 0x60
46/* CPU ID and Personality ID */
47#define MCU_BOARD_ID_REG 0x68
48
49#define MXC_IRQ_TO_EXPIO(irq) ((irq) - MXC_BOARD_IRQ_START)
50#define MXC_IRQ_TO_GPIO(irq) ((irq) - MXC_INTERNAL_IRQS)
51
52#define MXC_EXP_IO_BASE (MXC_BOARD_IRQ_START)
53#define MXC_MAX_EXP_IO_LINES 16
54
55/* interrupts like external uart , external ethernet etc*/
56#define EXPIO_INT_ENET (MXC_BOARD_IRQ_START + 0)
57#define EXPIO_INT_XUART_A (MXC_BOARD_IRQ_START + 1)
58#define EXPIO_INT_XUART_B (MXC_BOARD_IRQ_START + 2)
59#define EXPIO_INT_BUTTON_A (MXC_BOARD_IRQ_START + 3)
60#define EXPIO_INT_BUTTON_B (MXC_BOARD_IRQ_START + 4)
61
62static void __iomem *brd_io;
63static void expio_ack_irq(u32 irq);
64
65static struct resource smsc911x_resources[] = {
66 {
67 .flags = IORESOURCE_MEM,
68 } , {
69 .start = EXPIO_INT_ENET,
70 .end = EXPIO_INT_ENET,
71 .flags = IORESOURCE_IRQ,
72 },
73};
74
75static struct smsc911x_platform_config smsc911x_config = {
76 .irq_polarity = SMSC911X_IRQ_POLARITY_ACTIVE_LOW,
77 .flags = SMSC911X_USE_32BIT | SMSC911X_FORCE_INTERNAL_PHY,
78};
79
80static struct platform_device smsc_lan9217_device = {
81 .name = "smsc911x",
82 .id = 0,
83 .dev = {
84 .platform_data = &smsc911x_config,
85 },
86 .num_resources = ARRAY_SIZE(smsc911x_resources),
87 .resource = smsc911x_resources,
88};
89
90static void mxc_expio_irq_handler(u32 irq, struct irq_desc *desc)
91{
92 u32 imr_val;
93 u32 int_valid;
94 u32 expio_irq;
95
96 desc->chip->mask(irq); /* irq = gpio irq number */
97
98 imr_val = __raw_readw(brd_io + INTR_MASK_REG);
99 int_valid = __raw_readw(brd_io + INTR_STATUS_REG) & ~imr_val;
100
101 expio_irq = MXC_BOARD_IRQ_START;
102 for (; int_valid != 0; int_valid >>= 1, expio_irq++) {
103 struct irq_desc *d;
104 if ((int_valid & 1) == 0)
105 continue;
106 d = irq_desc + expio_irq;
107 if (unlikely(!(d->handle_irq)))
108 pr_err("\nEXPIO irq: %d unhandled\n", expio_irq);
109 else
110 d->handle_irq(expio_irq, d);
111 }
112
113 desc->chip->ack(irq);
114 desc->chip->unmask(irq);
115}
116
117/*
118 * Disable an expio pin's interrupt by setting the bit in the imr.
119 * Irq is an expio virtual irq number
120 */
121static void expio_mask_irq(u32 irq)
122{
123 u16 reg;
124 u32 expio = MXC_IRQ_TO_EXPIO(irq);
125
126 reg = __raw_readw(brd_io + INTR_MASK_REG);
127 reg |= (1 << expio);
128 __raw_writew(reg, brd_io + INTR_MASK_REG);
129}
130
131static void expio_ack_irq(u32 irq)
132{
133 u32 expio = MXC_IRQ_TO_EXPIO(irq);
134
135 __raw_writew(1 << expio, brd_io + INTR_RESET_REG);
136 __raw_writew(0, brd_io + INTR_RESET_REG);
137 expio_mask_irq(irq);
138}
139
140static void expio_unmask_irq(u32 irq)
141{
142 u16 reg;
143 u32 expio = MXC_IRQ_TO_EXPIO(irq);
144
145 reg = __raw_readw(brd_io + INTR_MASK_REG);
146 reg &= ~(1 << expio);
147 __raw_writew(reg, brd_io + INTR_MASK_REG);
148}
149
150static struct irq_chip expio_irq_chip = {
151 .ack = expio_ack_irq,
152 .mask = expio_mask_irq,
153 .unmask = expio_unmask_irq,
154};
155
156int __init mxc_expio_init(u32 base, u32 p_irq)
157{
158 int i;
159
160 brd_io = ioremap(BOARD_IO_ADDR(base), SZ_4K);
161 if (brd_io == NULL)
162 return -ENOMEM;
163
164 if ((__raw_readw(brd_io + MAGIC_NUMBER1_REG) != 0xAAAA) ||
165 (__raw_readw(brd_io + MAGIC_NUMBER2_REG) != 0x5555) ||
166 (__raw_readw(brd_io + MAGIC_NUMBER3_REG) != 0xCAFE)) {
167 pr_info("3-Stack Debug board not detected\n");
168 iounmap(brd_io);
169 brd_io = NULL;
170 return -ENODEV;
171 }
172
173 pr_info("3-Stack Debug board detected, rev = 0x%04X\n",
174 readw(brd_io + CPLD_CODE_VER_REG));
175
176 /*
177 * Configure INT line as GPIO input
178 */
179 gpio_request(MXC_IRQ_TO_GPIO(p_irq), "expio_pirq");
180 gpio_direction_input(MXC_IRQ_TO_GPIO(p_irq));
181
182 /* disable the interrupt and clear the status */
183 __raw_writew(0, brd_io + INTR_MASK_REG);
184 __raw_writew(0xFFFF, brd_io + INTR_RESET_REG);
185 __raw_writew(0, brd_io + INTR_RESET_REG);
186 __raw_writew(0x1F, brd_io + INTR_MASK_REG);
187 for (i = MXC_EXP_IO_BASE;
188 i < (MXC_EXP_IO_BASE + MXC_MAX_EXP_IO_LINES); i++) {
189 set_irq_chip(i, &expio_irq_chip);
190 set_irq_handler(i, handle_level_irq);
191 set_irq_flags(i, IRQF_VALID);
192 }
193 set_irq_type(p_irq, IRQF_TRIGGER_LOW);
194 set_irq_chained_handler(p_irq, mxc_expio_irq_handler);
195
196 /* Register Lan device on the debugboard */
197 smsc911x_resources[0].start = LAN9217_BASE_ADDR(base);
198 smsc911x_resources[0].end = LAN9217_BASE_ADDR(base) + 0x100 - 1;
199 platform_device_register(&smsc_lan9217_device);
200
201 return 0;
202}
diff --git a/arch/arm/plat-mxc/Kconfig b/arch/arm/plat-mxc/Kconfig
index 7f7ad6f289bd..0527e65318f4 100644
--- a/arch/arm/plat-mxc/Kconfig
+++ b/arch/arm/plat-mxc/Kconfig
@@ -1,5 +1,7 @@
1if ARCH_MXC 1if ARCH_MXC
2 2
3source "arch/arm/plat-mxc/devices/Kconfig"
4
3menu "Freescale MXC Implementations" 5menu "Freescale MXC Implementations"
4 6
5choice 7choice
@@ -8,15 +10,12 @@ choice
8 10
9config ARCH_MX1 11config ARCH_MX1
10 bool "MX1-based" 12 bool "MX1-based"
11 select CPU_ARM920T 13 select SOC_IMX1
12 select IMX_HAVE_IOMUX_V1
13 help 14 help
14 This enables support for systems based on the Freescale i.MX1 family 15 This enables support for systems based on the Freescale i.MX1 family
15 16
16config ARCH_MX2 17config ARCH_MX2
17 bool "MX2-based" 18 bool "MX2-based"
18 select CPU_ARM926T
19 select IMX_HAVE_IOMUX_V1
20 help 19 help
21 This enables support for systems based on the Freescale i.MX2 family 20 This enables support for systems based on the Freescale i.MX2 family
22 21
@@ -25,6 +24,7 @@ config ARCH_MX25
25 select CPU_ARM926T 24 select CPU_ARM926T
26 select ARCH_MXC_IOMUX_V3 25 select ARCH_MXC_IOMUX_V3
27 select HAVE_FB_IMX 26 select HAVE_FB_IMX
27 select ARCH_MXC_AUDMUX_V2
28 help 28 help
29 This enables support for systems based on the Freescale i.MX25 family 29 This enables support for systems based on the Freescale i.MX25 family
30 30
@@ -48,8 +48,7 @@ config ARCH_MX5
48 48
49endchoice 49endchoice
50 50
51source "arch/arm/mach-mx1/Kconfig" 51source "arch/arm/mach-imx/Kconfig"
52source "arch/arm/mach-mx2/Kconfig"
53source "arch/arm/mach-mx3/Kconfig" 52source "arch/arm/mach-mx3/Kconfig"
54source "arch/arm/mach-mx25/Kconfig" 53source "arch/arm/mach-mx25/Kconfig"
55source "arch/arm/mach-mxc91231/Kconfig" 54source "arch/arm/mach-mxc91231/Kconfig"
@@ -81,6 +80,17 @@ config MXC_PWM
81 help 80 help
82 Enable support for the i.MX PWM controller(s). 81 Enable support for the i.MX PWM controller(s).
83 82
83config MXC_DEBUG_BOARD
84 bool "Enable MXC debug board(for 3-stack)"
85 help
86 The debug board is an integral part of the MXC 3-stack(PDK)
87 platforms, it can be attached or removed from the peripheral
88 board. On debug board, several debug devices(ethernet, UART,
89 buttons, LEDs and JTAG) are implemented. Between the MCU and
90 these devices, a CPLD is added as a bridge which performs
91 data/address de-multiplexing and decode, signal level shift,
92 interrupt control and various board functions.
93
84config MXC_ULPI 94config MXC_ULPI
85 bool 95 bool
86 96
diff --git a/arch/arm/plat-mxc/Makefile b/arch/arm/plat-mxc/Makefile
index 895bc3c5e0c0..78d405ed8616 100644
--- a/arch/arm/plat-mxc/Makefile
+++ b/arch/arm/plat-mxc/Makefile
@@ -8,8 +8,6 @@ obj-y := irq.o clock.o gpio.o time.o devices.o cpu.o system.o
8# MX51 uses the TZIC interrupt controller, older platforms use AVIC (irq.o) 8# MX51 uses the TZIC interrupt controller, older platforms use AVIC (irq.o)
9obj-$(CONFIG_MXC_TZIC) += tzic.o 9obj-$(CONFIG_MXC_TZIC) += tzic.o
10 10
11obj-$(CONFIG_ARCH_MX1) += dma-mx1-mx2.o
12obj-$(CONFIG_ARCH_MX2) += dma-mx1-mx2.o
13obj-$(CONFIG_IMX_HAVE_IOMUX_V1) += iomux-v1.o 11obj-$(CONFIG_IMX_HAVE_IOMUX_V1) += iomux-v1.o
14obj-$(CONFIG_ARCH_MXC_IOMUX_V3) += iomux-v3.o 12obj-$(CONFIG_ARCH_MXC_IOMUX_V3) += iomux-v3.o
15obj-$(CONFIG_MXC_PWM) += pwm.o 13obj-$(CONFIG_MXC_PWM) += pwm.o
@@ -17,7 +15,10 @@ obj-$(CONFIG_USB_EHCI_MXC) += ehci.o
17obj-$(CONFIG_MXC_ULPI) += ulpi.o 15obj-$(CONFIG_MXC_ULPI) += ulpi.o
18obj-$(CONFIG_ARCH_MXC_AUDMUX_V1) += audmux-v1.o 16obj-$(CONFIG_ARCH_MXC_AUDMUX_V1) += audmux-v1.o
19obj-$(CONFIG_ARCH_MXC_AUDMUX_V2) += audmux-v2.o 17obj-$(CONFIG_ARCH_MXC_AUDMUX_V2) += audmux-v2.o
18obj-$(CONFIG_MXC_DEBUG_BOARD) += 3ds_debugboard.o
20ifdef CONFIG_SND_IMX_SOC 19ifdef CONFIG_SND_IMX_SOC
21obj-y += ssi-fiq.o 20obj-y += ssi-fiq.o
22obj-y += ssi-fiq-ksym.o 21obj-y += ssi-fiq-ksym.o
23endif 22endif
23
24obj-y += devices/
diff --git a/arch/arm/plat-mxc/audmux-v1.c b/arch/arm/plat-mxc/audmux-v1.c
index b62917ca3f95..1180bef7664b 100644
--- a/arch/arm/plat-mxc/audmux-v1.c
+++ b/arch/arm/plat-mxc/audmux-v1.c
@@ -13,10 +13,6 @@
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details. 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., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 16 */
21 17
22#include <linux/module.h> 18#include <linux/module.h>
diff --git a/arch/arm/plat-mxc/audmux-v2.c b/arch/arm/plat-mxc/audmux-v2.c
index 0c2cc5cd4d83..f9e7cdbd0005 100644
--- a/arch/arm/plat-mxc/audmux-v2.c
+++ b/arch/arm/plat-mxc/audmux-v2.c
@@ -13,10 +13,6 @@
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details. 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., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 16 */
21 17
22#include <linux/module.h> 18#include <linux/module.h>
@@ -191,6 +187,7 @@ static int mxc_audmux_v2_init(void)
191{ 187{
192 int ret; 188 int ret;
193 189
190#if defined(CONFIG_ARCH_MX3)
194 if (cpu_is_mx31()) 191 if (cpu_is_mx31())
195 audmux_base = MX31_IO_ADDRESS(MX31_AUDMUX_BASE_ADDR); 192 audmux_base = MX31_IO_ADDRESS(MX31_AUDMUX_BASE_ADDR);
196 193
@@ -204,7 +201,19 @@ static int mxc_audmux_v2_init(void)
204 } 201 }
205 audmux_base = MX35_IO_ADDRESS(MX35_AUDMUX_BASE_ADDR); 202 audmux_base = MX35_IO_ADDRESS(MX35_AUDMUX_BASE_ADDR);
206 } 203 }
207 204#endif
205#if defined(CONFIG_ARCH_MX25)
206 if (cpu_is_mx25()) {
207 audmux_clk = clk_get(NULL, "audmux");
208 if (IS_ERR(audmux_clk)) {
209 ret = PTR_ERR(audmux_clk);
210 printk(KERN_ERR "%s: cannot get clock: %d\n", __func__,
211 ret);
212 return ret;
213 }
214 audmux_base = MX25_IO_ADDRESS(MX25_AUDMUX_BASE_ADDR);
215 }
216#endif
208 audmux_debugfs_init(); 217 audmux_debugfs_init();
209 218
210 return 0; 219 return 0;
diff --git a/arch/arm/plat-mxc/clock.c b/arch/arm/plat-mxc/clock.c
index 323ff8ccc877..2ed3ab173add 100644
--- a/arch/arm/plat-mxc/clock.c
+++ b/arch/arm/plat-mxc/clock.c
@@ -52,13 +52,14 @@ static void __clk_disable(struct clk *clk)
52{ 52{
53 if (clk == NULL || IS_ERR(clk)) 53 if (clk == NULL || IS_ERR(clk))
54 return; 54 return;
55
56 __clk_disable(clk->parent);
57 __clk_disable(clk->secondary);
58
59 WARN_ON(!clk->usecount); 55 WARN_ON(!clk->usecount);
60 if (!(--clk->usecount) && clk->disable) 56
61 clk->disable(clk); 57 if (!(--clk->usecount)) {
58 if (clk->disable)
59 clk->disable(clk);
60 __clk_disable(clk->parent);
61 __clk_disable(clk->secondary);
62 }
62} 63}
63 64
64static int __clk_enable(struct clk *clk) 65static int __clk_enable(struct clk *clk)
@@ -66,12 +67,13 @@ static int __clk_enable(struct clk *clk)
66 if (clk == NULL || IS_ERR(clk)) 67 if (clk == NULL || IS_ERR(clk))
67 return -EINVAL; 68 return -EINVAL;
68 69
69 __clk_enable(clk->parent); 70 if (clk->usecount++ == 0) {
70 __clk_enable(clk->secondary); 71 __clk_enable(clk->parent);
71 72 __clk_enable(clk->secondary);
72 if (clk->usecount++ == 0 && clk->enable)
73 clk->enable(clk);
74 73
74 if (clk->enable)
75 clk->enable(clk);
76 }
75 return 0; 77 return 0;
76} 78}
77 79
@@ -160,17 +162,28 @@ EXPORT_SYMBOL(clk_set_rate);
160int clk_set_parent(struct clk *clk, struct clk *parent) 162int clk_set_parent(struct clk *clk, struct clk *parent)
161{ 163{
162 int ret = -EINVAL; 164 int ret = -EINVAL;
165 struct clk *old;
163 166
164 if (clk == NULL || IS_ERR(clk) || parent == NULL || 167 if (clk == NULL || IS_ERR(clk) || parent == NULL ||
165 IS_ERR(parent) || clk->set_parent == NULL) 168 IS_ERR(parent) || clk->set_parent == NULL)
166 return ret; 169 return ret;
167 170
171 if (clk->usecount)
172 clk_enable(parent);
173
168 mutex_lock(&clocks_mutex); 174 mutex_lock(&clocks_mutex);
169 ret = clk->set_parent(clk, parent); 175 ret = clk->set_parent(clk, parent);
170 if (ret == 0) 176 if (ret == 0) {
177 old = clk->parent;
171 clk->parent = parent; 178 clk->parent = parent;
179 } else {
180 old = parent;
181 }
172 mutex_unlock(&clocks_mutex); 182 mutex_unlock(&clocks_mutex);
173 183
184 if (clk->usecount)
185 clk_disable(old);
186
174 return ret; 187 return ret;
175} 188}
176EXPORT_SYMBOL(clk_set_parent); 189EXPORT_SYMBOL(clk_set_parent);
diff --git a/arch/arm/plat-mxc/devices.c b/arch/arm/plat-mxc/devices.c
index 56f2fb5cc456..735776d84956 100644
--- a/arch/arm/plat-mxc/devices.c
+++ b/arch/arm/plat-mxc/devices.c
@@ -18,6 +18,7 @@
18 18
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/err.h>
21#include <linux/platform_device.h> 22#include <linux/platform_device.h>
22#include <mach/common.h> 23#include <mach/common.h>
23 24
@@ -35,3 +36,35 @@ int __init mxc_register_device(struct platform_device *pdev, void *data)
35 return ret; 36 return ret;
36} 37}
37 38
39struct platform_device *__init imx_add_platform_device(const char *name, int id,
40 const struct resource *res, unsigned int num_resources,
41 const void *data, size_t size_data)
42{
43 int ret = -ENOMEM;
44 struct platform_device *pdev;
45
46 pdev = platform_device_alloc(name, id);
47 if (!pdev)
48 goto err;
49
50 if (res) {
51 ret = platform_device_add_resources(pdev, res, num_resources);
52 if (ret)
53 goto err;
54 }
55
56 if (data) {
57 ret = platform_device_add_data(pdev, data, size_data);
58 if (ret)
59 goto err;
60 }
61
62 ret = platform_device_add(pdev);
63 if (ret) {
64err:
65 platform_device_put(pdev);
66 return ERR_PTR(ret);
67 }
68
69 return pdev;
70}
diff --git a/arch/arm/plat-mxc/devices/Kconfig b/arch/arm/plat-mxc/devices/Kconfig
new file mode 100644
index 000000000000..9ab784b776f9
--- /dev/null
+++ b/arch/arm/plat-mxc/devices/Kconfig
@@ -0,0 +1,15 @@
1config IMX_HAVE_PLATFORM_FLEXCAN
2 select HAVE_CAN_FLEXCAN
3 bool
4
5config IMX_HAVE_PLATFORM_IMX_I2C
6 bool
7
8config IMX_HAVE_PLATFORM_IMX_UART
9 bool
10
11config IMX_HAVE_PLATFORM_MXC_NAND
12 bool
13
14config IMX_HAVE_PLATFORM_SPI_IMX
15 bool
diff --git a/arch/arm/plat-mxc/devices/Makefile b/arch/arm/plat-mxc/devices/Makefile
new file mode 100644
index 000000000000..347da5161f7e
--- /dev/null
+++ b/arch/arm/plat-mxc/devices/Makefile
@@ -0,0 +1,8 @@
1ifdef CONFIG_CAN_FLEXCAN
2# the ifdef can be removed once the flexcan driver has been merged
3obj-$(CONFIG_IMX_HAVE_PLATFORM_FLEXCAN) += platform-flexcan.o
4endif
5obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_I2C) += platform-imx-i2c.o
6obj-$(CONFIG_IMX_HAVE_PLATFORM_IMX_UART) += platform-imx-uart.o
7obj-$(CONFIG_IMX_HAVE_PLATFORM_MXC_NAND) += platform-mxc_nand.o
8obj-$(CONFIG_IMX_HAVE_PLATFORM_SPI_IMX) += platform-spi_imx.o
diff --git a/arch/arm/plat-mxc/devices/platform-flexcan.c b/arch/arm/plat-mxc/devices/platform-flexcan.c
new file mode 100644
index 000000000000..5e97a01f14f3
--- /dev/null
+++ b/arch/arm/plat-mxc/devices/platform-flexcan.c
@@ -0,0 +1,30 @@
1/*
2 * Copyright (C) 2010 Pengutronix, Marc Kleine-Budde <kernel@pengutronix.de>
3 *
4 * This program is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License version 2 as published by the
6 * Free Software Foundation.
7 */
8
9#include <mach/devices-common.h>
10
11struct platform_device *__init imx_add_flexcan(int id,
12 resource_size_t iobase, resource_size_t iosize,
13 resource_size_t irq,
14 const struct flexcan_platform_data *pdata)
15{
16 struct resource res[] = {
17 {
18 .start = iobase,
19 .end = iobase + iosize - 1,
20 .flags = IORESOURCE_MEM,
21 }, {
22 .start = irq,
23 .end = irq,
24 .flags = IORESOURCE_IRQ,
25 },
26 };
27
28 return imx_add_platform_device("flexcan", id, res, ARRAY_SIZE(res),
29 pdata, sizeof(*pdata));
30}
diff --git a/arch/arm/plat-mxc/devices/platform-imx-i2c.c b/arch/arm/plat-mxc/devices/platform-imx-i2c.c
new file mode 100644
index 000000000000..d0af9f7d8aed
--- /dev/null
+++ b/arch/arm/plat-mxc/devices/platform-imx-i2c.c
@@ -0,0 +1,29 @@
1/*
2 * Copyright (C) 2009-2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#include <mach/devices-common.h>
10
11struct platform_device *__init imx_add_imx_i2c(int id,
12 resource_size_t iobase, resource_size_t iosize, int irq,
13 const struct imxi2c_platform_data *pdata)
14{
15 struct resource res[] = {
16 {
17 .start = iobase,
18 .end = iobase + iosize - 1,
19 .flags = IORESOURCE_MEM,
20 }, {
21 .start = irq,
22 .end = irq,
23 .flags = IORESOURCE_IRQ,
24 },
25 };
26
27 return imx_add_platform_device("imx-i2c", id, res, ARRAY_SIZE(res),
28 pdata, sizeof(*pdata));
29}
diff --git a/arch/arm/plat-mxc/devices/platform-imx-uart.c b/arch/arm/plat-mxc/devices/platform-imx-uart.c
new file mode 100644
index 000000000000..fa3dff1433e8
--- /dev/null
+++ b/arch/arm/plat-mxc/devices/platform-imx-uart.c
@@ -0,0 +1,60 @@
1/*
2 * Copyright (C) 2009-2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#include <mach/devices-common.h>
10
11struct platform_device *__init imx_add_imx_uart_3irq(int id,
12 resource_size_t iobase, resource_size_t iosize,
13 resource_size_t irqrx, resource_size_t irqtx,
14 resource_size_t irqrts,
15 const struct imxuart_platform_data *pdata)
16{
17 struct resource res[] = {
18 {
19 .start = iobase,
20 .end = iobase + iosize - 1,
21 .flags = IORESOURCE_MEM,
22 }, {
23 .start = irqrx,
24 .end = irqrx,
25 .flags = IORESOURCE_IRQ,
26 }, {
27 .start = irqtx,
28 .end = irqtx,
29 .flags = IORESOURCE_IRQ,
30 }, {
31 .start = irqrts,
32 .end = irqrx,
33 .flags = IORESOURCE_IRQ,
34 },
35 };
36
37 return imx_add_platform_device("imx-uart", id, res, ARRAY_SIZE(res),
38 pdata, sizeof(*pdata));
39}
40
41struct platform_device *__init imx_add_imx_uart_1irq(int id,
42 resource_size_t iobase, resource_size_t iosize,
43 resource_size_t irq,
44 const struct imxuart_platform_data *pdata)
45{
46 struct resource res[] = {
47 {
48 .start = iobase,
49 .end = iobase + iosize - 1,
50 .flags = IORESOURCE_MEM,
51 }, {
52 .start = irq,
53 .end = irq,
54 .flags = IORESOURCE_IRQ,
55 },
56 };
57
58 return imx_add_platform_device("imx-uart", id, res, ARRAY_SIZE(res),
59 pdata, sizeof(*pdata));
60}
diff --git a/arch/arm/plat-mxc/devices/platform-mxc_nand.c b/arch/arm/plat-mxc/devices/platform-mxc_nand.c
new file mode 100644
index 000000000000..1c286418d123
--- /dev/null
+++ b/arch/arm/plat-mxc/devices/platform-mxc_nand.c
@@ -0,0 +1,44 @@
1/*
2 * Copyright (C) 2009-2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#include <asm/sizes.h>
10#include <mach/devices-common.h>
11
12static struct platform_device *__init imx_add_mxc_nand(resource_size_t iobase,
13 int irq, const struct mxc_nand_platform_data *pdata,
14 resource_size_t iosize)
15{
16 static int id = 0;
17
18 struct resource res[] = {
19 {
20 .start = iobase,
21 .end = iobase + iosize - 1,
22 .flags = IORESOURCE_MEM,
23 }, {
24 .start = irq,
25 .end = irq,
26 .flags = IORESOURCE_IRQ,
27 },
28 };
29
30 return imx_add_platform_device("mxc_nand", id++, res, ARRAY_SIZE(res),
31 pdata, sizeof(*pdata));
32}
33
34struct platform_device *__init imx_add_mxc_nand_v1(resource_size_t iobase,
35 int irq, const struct mxc_nand_platform_data *pdata)
36{
37 return imx_add_mxc_nand(iobase, irq, pdata, SZ_4K);
38}
39
40struct platform_device *__init imx_add_mxc_nand_v21(resource_size_t iobase,
41 int irq, const struct mxc_nand_platform_data *pdata)
42{
43 return imx_add_mxc_nand(iobase, irq, pdata, SZ_8K);
44}
diff --git a/arch/arm/plat-mxc/devices/platform-spi_imx.c b/arch/arm/plat-mxc/devices/platform-spi_imx.c
new file mode 100644
index 000000000000..2831a6d3eb4b
--- /dev/null
+++ b/arch/arm/plat-mxc/devices/platform-spi_imx.c
@@ -0,0 +1,30 @@
1/*
2 * Copyright (C) 2009-2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#include <asm/sizes.h>
10#include <mach/devices-common.h>
11
12struct platform_device *__init imx_add_spi_imx(int id,
13 resource_size_t iobase, resource_size_t iosize, int irq,
14 const struct spi_imx_master *pdata)
15{
16 struct resource res[] = {
17 {
18 .start = iobase,
19 .end = iobase + iosize - 1,
20 .flags = IORESOURCE_MEM,
21 }, {
22 .start = irq,
23 .end = irq,
24 .flags = IORESOURCE_IRQ,
25 },
26 };
27
28 return imx_add_platform_device("spi_imx", id, res, ARRAY_SIZE(res),
29 pdata, sizeof(*pdata));
30}
diff --git a/arch/arm/plat-mxc/ehci.c b/arch/arm/plat-mxc/ehci.c
index 2a8646173c2f..35a064ff02ba 100644
--- a/arch/arm/plat-mxc/ehci.c
+++ b/arch/arm/plat-mxc/ehci.c
@@ -11,10 +11,6 @@
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details. 13 * 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 Foundation,
17 * Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */ 14 */
19 15
20#include <linux/platform_device.h> 16#include <linux/platform_device.h>
@@ -73,7 +69,51 @@
73int mxc_initialize_usb_hw(int port, unsigned int flags) 69int mxc_initialize_usb_hw(int port, unsigned int flags)
74{ 70{
75 unsigned int v; 71 unsigned int v;
76#ifdef CONFIG_ARCH_MX3 72#if defined(CONFIG_ARCH_MX25)
73 if (cpu_is_mx25()) {
74 v = readl(MX25_IO_ADDRESS(MX25_OTG_BASE_ADDR +
75 USBCTRL_OTGBASE_OFFSET));
76
77 switch (port) {
78 case 0: /* OTG port */
79 v &= ~(MX35_OTG_SIC_MASK | MX35_OTG_PM_BIT);
80 v |= (flags & MXC_EHCI_INTERFACE_MASK)
81 << MX35_OTG_SIC_SHIFT;
82 if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
83 v |= MX35_OTG_PM_BIT;
84
85 break;
86 case 1: /* H1 port */
87 v &= ~(MX35_H1_SIC_MASK | MX35_H1_PM_BIT | MX35_H1_TLL_BIT |
88 MX35_H1_USBTE_BIT | MX35_H1_IPPUE_DOWN_BIT | MX35_H1_IPPUE_UP_BIT);
89 v |= (flags & MXC_EHCI_INTERFACE_MASK)
90 << MX35_H1_SIC_SHIFT;
91 if (!(flags & MXC_EHCI_POWER_PINS_ENABLED))
92 v |= MX35_H1_PM_BIT;
93
94 if (!(flags & MXC_EHCI_TTL_ENABLED))
95 v |= MX35_H1_TLL_BIT;
96
97 if (flags & MXC_EHCI_INTERNAL_PHY)
98 v |= MX35_H1_USBTE_BIT;
99
100 if (flags & MXC_EHCI_IPPUE_DOWN)
101 v |= MX35_H1_IPPUE_DOWN_BIT;
102
103 if (flags & MXC_EHCI_IPPUE_UP)
104 v |= MX35_H1_IPPUE_UP_BIT;
105
106 break;
107 default:
108 return -EINVAL;
109 }
110
111 writel(v, MX25_IO_ADDRESS(MX25_OTG_BASE_ADDR +
112 USBCTRL_OTGBASE_OFFSET));
113 return 0;
114 }
115#endif /* CONFIG_ARCH_MX25 */
116#if defined(CONFIG_ARCH_MX3)
77 if (cpu_is_mx31()) { 117 if (cpu_is_mx31()) {
78 v = readl(MX31_IO_ADDRESS(MX31_OTG_BASE_ADDR + 118 v = readl(MX31_IO_ADDRESS(MX31_OTG_BASE_ADDR +
79 USBCTRL_OTGBASE_OFFSET)); 119 USBCTRL_OTGBASE_OFFSET));
diff --git a/arch/arm/plat-mxc/gpio.c b/arch/arm/plat-mxc/gpio.c
index 71437c61cfd7..57ec4a896a5d 100644
--- a/arch/arm/plat-mxc/gpio.c
+++ b/arch/arm/plat-mxc/gpio.c
@@ -214,13 +214,16 @@ static void _set_gpio_direction(struct gpio_chip *chip, unsigned offset,
214 struct mxc_gpio_port *port = 214 struct mxc_gpio_port *port =
215 container_of(chip, struct mxc_gpio_port, chip); 215 container_of(chip, struct mxc_gpio_port, chip);
216 u32 l; 216 u32 l;
217 unsigned long flags;
217 218
219 spin_lock_irqsave(&port->lock, flags);
218 l = __raw_readl(port->base + GPIO_GDIR); 220 l = __raw_readl(port->base + GPIO_GDIR);
219 if (dir) 221 if (dir)
220 l |= 1 << offset; 222 l |= 1 << offset;
221 else 223 else
222 l &= ~(1 << offset); 224 l &= ~(1 << offset);
223 __raw_writel(l, port->base + GPIO_GDIR); 225 __raw_writel(l, port->base + GPIO_GDIR);
226 spin_unlock_irqrestore(&port->lock, flags);
224} 227}
225 228
226static void mxc_gpio_set(struct gpio_chip *chip, unsigned offset, int value) 229static void mxc_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
@@ -229,9 +232,12 @@ static void mxc_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
229 container_of(chip, struct mxc_gpio_port, chip); 232 container_of(chip, struct mxc_gpio_port, chip);
230 void __iomem *reg = port->base + GPIO_DR; 233 void __iomem *reg = port->base + GPIO_DR;
231 u32 l; 234 u32 l;
235 unsigned long flags;
232 236
237 spin_lock_irqsave(&port->lock, flags);
233 l = (__raw_readl(reg) & (~(1 << offset))) | (value << offset); 238 l = (__raw_readl(reg) & (~(1 << offset))) | (value << offset);
234 __raw_writel(l, reg); 239 __raw_writel(l, reg);
240 spin_unlock_irqrestore(&port->lock, flags);
235} 241}
236 242
237static int mxc_gpio_get(struct gpio_chip *chip, unsigned offset) 243static int mxc_gpio_get(struct gpio_chip *chip, unsigned offset)
@@ -285,6 +291,8 @@ int __init mxc_gpio_init(struct mxc_gpio_port *port, int cnt)
285 port[i].chip.base = i * 32; 291 port[i].chip.base = i * 32;
286 port[i].chip.ngpio = 32; 292 port[i].chip.ngpio = 32;
287 293
294 spin_lock_init(&port[i].lock);
295
288 /* its a serious configuration bug when it fails */ 296 /* its a serious configuration bug when it fails */
289 BUG_ON( gpiochip_add(&port[i].chip) < 0 ); 297 BUG_ON( gpiochip_add(&port[i].chip) < 0 );
290 298
@@ -292,6 +300,12 @@ int __init mxc_gpio_init(struct mxc_gpio_port *port, int cnt)
292 /* setup one handler for each entry */ 300 /* setup one handler for each entry */
293 set_irq_chained_handler(port[i].irq, mx3_gpio_irq_handler); 301 set_irq_chained_handler(port[i].irq, mx3_gpio_irq_handler);
294 set_irq_data(port[i].irq, &port[i]); 302 set_irq_data(port[i].irq, &port[i]);
303 if (port[i].irq_high) {
304 /* setup handler for GPIO 16 to 31 */
305 set_irq_chained_handler(port[i].irq_high,
306 mx3_gpio_irq_handler);
307 set_irq_data(port[i].irq_high, &port[i]);
308 }
295 } 309 }
296 } 310 }
297 311
diff --git a/arch/arm/plat-mxc/include/mach/3ds_debugboard.h b/arch/arm/plat-mxc/include/mach/3ds_debugboard.h
new file mode 100644
index 000000000000..a384fdd49c62
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/3ds_debugboard.h
@@ -0,0 +1,18 @@
1/*
2 * Copyright 2008-2009 Freescale Semiconductor, Inc. All Rights Reserved.
3 *
4 *
5 * The code contained herein is licensed under the GNU General Public
6 * License. You may obtain a copy of the GNU General Public License
7 * Version 2 or later at the following locations:
8 *
9 * http://www.opensource.org/licenses/gpl-license.html
10 * http://www.gnu.org/copyleft/gpl.html
11 */
12
13#ifndef __ASM_ARCH_MXC_3DS_DB_H__
14#define __ASM_ARCH_MXC_3DS_DB_H__
15
16extern int __init mxc_expio_init(u32 base, u32 p_irq);
17
18#endif /* __ASM_ARCH_MXC_3DS_DB_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/board-armadillo5x0.h b/arch/arm/plat-mxc/include/mach/board-armadillo5x0.h
deleted file mode 100644
index 0376c133c9f4..000000000000
--- a/arch/arm/plat-mxc/include/mach/board-armadillo5x0.h
+++ /dev/null
@@ -1,15 +0,0 @@
1/*
2 * Copyright 2009 Alberto Panizzo <maramaopercheseimorto@gmail.com>.
3 * All Rights Reserved.
4 */
5
6/*
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 */
11
12#ifndef __ASM_ARCH_MXC_BOARD_ARMADILLO5X0_H__
13#define __ASM_ARCH_MXC_BOARD_ARMADILLO5X0_H__
14
15#endif
diff --git a/arch/arm/plat-mxc/include/mach/board-kzmarm11.h b/arch/arm/plat-mxc/include/mach/board-kzmarm11.h
deleted file mode 100644
index 93cc66f104c7..000000000000
--- a/arch/arm/plat-mxc/include/mach/board-kzmarm11.h
+++ /dev/null
@@ -1,39 +0,0 @@
1/*
2 * Copyright (C) 2009 Yoichi Yuasa <yuasa@linux-mips.org>
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 */
18#ifndef __ARM_ARCH_BOARD_KZM_ARM11_H
19#define __ARM_ARCH_BOARD_KZM_ARM11_H
20
21/*
22 * KZM-ARM11-01 Board Control Registers on FPGA
23 */
24#define KZM_ARM11_CTL1 (MX31_CS4_BASE_ADDR + 0x1000)
25#define KZM_ARM11_CTL2 (MX31_CS4_BASE_ADDR + 0x1001)
26#define KZM_ARM11_RSW1 (MX31_CS4_BASE_ADDR + 0x1002)
27#define KZM_ARM11_BACK_LIGHT (MX31_CS4_BASE_ADDR + 0x1004)
28#define KZM_ARM11_FPGA_REV (MX31_CS4_BASE_ADDR + 0x1008)
29#define KZM_ARM11_7SEG_LED (MX31_CS4_BASE_ADDR + 0x1010)
30#define KZM_ARM11_LEDS (MX31_CS4_BASE_ADDR + 0x1020)
31#define KZM_ARM11_DIPSW2 (MX31_CS4_BASE_ADDR + 0x1003)
32
33/*
34 * External UART for touch panel on FPGA
35 */
36#define KZM_ARM11_16550 (MX31_CS4_BASE_ADDR + 0x1050)
37
38#endif /* __ARM_ARCH_BOARD_KZM_ARM11_H */
39
diff --git a/arch/arm/plat-mxc/include/mach/board-mx21ads.h b/arch/arm/plat-mxc/include/mach/board-mx21ads.h
deleted file mode 100644
index 0cf4fa29510c..000000000000
--- a/arch/arm/plat-mxc/include/mach/board-mx21ads.h
+++ /dev/null
@@ -1,52 +0,0 @@
1/*
2 * Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
5/*
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14#ifndef __ASM_ARCH_MXC_BOARD_MX21ADS_H__
15#define __ASM_ARCH_MXC_BOARD_MX21ADS_H__
16
17/*
18 * Memory-mapped I/O on MX21ADS base board
19 */
20#define MX21ADS_MMIO_BASE_ADDR 0xF5000000
21#define MX21ADS_MMIO_SIZE SZ_16M
22
23#define MX21ADS_REG_ADDR(offset) (void __force __iomem *) \
24 (MX21ADS_MMIO_BASE_ADDR + (offset))
25
26#define MX21ADS_CS8900A_IRQ IRQ_GPIOE(11)
27#define MX21ADS_CS8900A_IOBASE_REG MX21ADS_REG_ADDR(0x000000)
28#define MX21ADS_ST16C255_IOBASE_REG MX21ADS_REG_ADDR(0x200000)
29#define MX21ADS_VERSION_REG MX21ADS_REG_ADDR(0x400000)
30#define MX21ADS_IO_REG MX21ADS_REG_ADDR(0x800000)
31
32/* MX21ADS_IO_REG bit definitions */
33#define MX21ADS_IO_SD_WP 0x0001 /* read */
34#define MX21ADS_IO_TP6 0x0001 /* write */
35#define MX21ADS_IO_SW_SEL 0x0002 /* read */
36#define MX21ADS_IO_TP7 0x0002 /* write */
37#define MX21ADS_IO_RESET_E_UART 0x0004
38#define MX21ADS_IO_RESET_BASE 0x0008
39#define MX21ADS_IO_CSI_CTL2 0x0010
40#define MX21ADS_IO_CSI_CTL1 0x0020
41#define MX21ADS_IO_CSI_CTL0 0x0040
42#define MX21ADS_IO_UART1_EN 0x0080
43#define MX21ADS_IO_UART4_EN 0x0100
44#define MX21ADS_IO_LCDON 0x0200
45#define MX21ADS_IO_IRDA_EN 0x0400
46#define MX21ADS_IO_IRDA_FIR_SEL 0x0800
47#define MX21ADS_IO_IRDA_MD0_B 0x1000
48#define MX21ADS_IO_IRDA_MD1 0x2000
49#define MX21ADS_IO_LED4_ON 0x4000
50#define MX21ADS_IO_LED3_ON 0x8000
51
52#endif /* __ASM_ARCH_MXC_BOARD_MX21ADS_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/board-mx27ads.h b/arch/arm/plat-mxc/include/mach/board-mx27ads.h
deleted file mode 100644
index 7776d230327f..000000000000
--- a/arch/arm/plat-mxc/include/mach/board-mx27ads.h
+++ /dev/null
@@ -1,344 +0,0 @@
1/*
2 * Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
5/*
6 * The code contained herein is licensed under the GNU General Public
7 * License. You may obtain a copy of the GNU General Public License
8 * Version 2 or later at the following locations:
9 *
10 * http://www.opensource.org/licenses/gpl-license.html
11 * http://www.gnu.org/copyleft/gpl.html
12 */
13
14#ifndef __ASM_ARCH_MXC_BOARD_MX27ADS_H__
15#define __ASM_ARCH_MXC_BOARD_MX27ADS_H__
16
17/* external interrupt multiplexer */
18#define MXC_EXP_IO_BASE (MXC_BOARD_IRQ_START)
19
20#define MXC_VIRTUAL_INTS_BASE (MXC_EXP_IO_BASE + MXC_MAX_EXP_IO_LINES)
21#define MXC_SDIO1_CARD_IRQ MXC_VIRTUAL_INTS_BASE
22#define MXC_SDIO2_CARD_IRQ (MXC_VIRTUAL_INTS_BASE + 1)
23#define MXC_SDIO3_CARD_IRQ (MXC_VIRTUAL_INTS_BASE + 2)
24
25#define MXC_MAX_BOARD_INTS (MXC_MAX_EXP_IO_LINES + \
26 MXC_MAX_VIRTUAL_INTS)
27
28/*
29 * @name Memory Size parameters
30 */
31
32/*
33 * Size of SDRAM memory
34 */
35#define SDRAM_MEM_SIZE SZ_128M
36
37/*
38 * PBC Controller parameters
39 */
40
41/*
42 * Base address of PBC controller, CS4
43 */
44#define PBC_BASE_ADDRESS 0xf4300000
45#define PBC_REG_ADDR(offset) (void __force __iomem *) \
46 (PBC_BASE_ADDRESS + (offset))
47
48/*
49 * PBC Interupt name definitions
50 */
51#define PBC_GPIO1_0 0
52#define PBC_GPIO1_1 1
53#define PBC_GPIO1_2 2
54#define PBC_GPIO1_3 3
55#define PBC_GPIO1_4 4
56#define PBC_GPIO1_5 5
57
58#define PBC_INTR_MAX_NUM 6
59#define PBC_INTR_SHARED_MAX_NUM 8
60
61/* When the PBC address connection is fixed in h/w, defined as 1 */
62#define PBC_ADDR_SH 0
63
64/* Offsets for the PBC Controller register */
65/*
66 * PBC Board version register offset
67 */
68#define PBC_VERSION_REG PBC_REG_ADDR(0x00000 >> PBC_ADDR_SH)
69/*
70 * PBC Board control register 1 set address.
71 */
72#define PBC_BCTRL1_SET_REG PBC_REG_ADDR(0x00008 >> PBC_ADDR_SH)
73/*
74 * PBC Board control register 1 clear address.
75 */
76#define PBC_BCTRL1_CLEAR_REG PBC_REG_ADDR(0x0000C >> PBC_ADDR_SH)
77/*
78 * PBC Board control register 2 set address.
79 */
80#define PBC_BCTRL2_SET_REG PBC_REG_ADDR(0x00010 >> PBC_ADDR_SH)
81/*
82 * PBC Board control register 2 clear address.
83 */
84#define PBC_BCTRL2_CLEAR_REG PBC_REG_ADDR(0x00014 >> PBC_ADDR_SH)
85/*
86 * PBC Board control register 3 set address.
87 */
88#define PBC_BCTRL3_SET_REG PBC_REG_ADDR(0x00018 >> PBC_ADDR_SH)
89/*
90 * PBC Board control register 3 clear address.
91 */
92#define PBC_BCTRL3_CLEAR_REG PBC_REG_ADDR(0x0001C >> PBC_ADDR_SH)
93/*
94 * PBC Board control register 3 set address.
95 */
96#define PBC_BCTRL4_SET_REG PBC_REG_ADDR(0x00020 >> PBC_ADDR_SH)
97/*
98 * PBC Board control register 4 clear address.
99 */
100#define PBC_BCTRL4_CLEAR_REG PBC_REG_ADDR(0x00024 >> PBC_ADDR_SH)
101/*PBC_ADDR_SH
102 * PBC Board status register 1.
103 */
104#define PBC_BSTAT1_REG PBC_REG_ADDR(0x00028 >> PBC_ADDR_SH)
105/*
106 * PBC Board interrupt status register.
107 */
108#define PBC_INTSTATUS_REG PBC_REG_ADDR(0x0002C >> PBC_ADDR_SH)
109/*
110 * PBC Board interrupt current status register.
111 */
112#define PBC_INTCURR_STATUS_REG PBC_REG_ADDR(0x00034 >> PBC_ADDR_SH)
113/*
114 * PBC Interrupt mask register set address.
115 */
116#define PBC_INTMASK_SET_REG PBC_REG_ADDR(0x00038 >> PBC_ADDR_SH)
117/*
118 * PBC Interrupt mask register clear address.
119 */
120#define PBC_INTMASK_CLEAR_REG PBC_REG_ADDR(0x0003C >> PBC_ADDR_SH)
121/*
122 * External UART A.
123 */
124#define PBC_SC16C652_UARTA_REG PBC_REG_ADDR(0x20000 >> PBC_ADDR_SH)
125/*
126 * UART 4 Expanding Signal Status.
127 */
128#define PBC_UART_STATUS_REG PBC_REG_ADDR(0x22000 >> PBC_ADDR_SH)
129/*
130 * UART 4 Expanding Signal Control Set.
131 */
132#define PBC_UCTRL_SET_REG PBC_REG_ADDR(0x24000 >> PBC_ADDR_SH)
133/*
134 * UART 4 Expanding Signal Control Clear.
135 */
136#define PBC_UCTRL_CLR_REG PBC_REG_ADDR(0x26000 >> PBC_ADDR_SH)
137/*
138 * Ethernet Controller IO base address.
139 */
140#define PBC_CS8900A_IOBASE_REG PBC_REG_ADDR(0x40000 >> PBC_ADDR_SH)
141/*
142 * Ethernet Controller Memory base address.
143 */
144#define PBC_CS8900A_MEMBASE_REG PBC_REG_ADDR(0x42000 >> PBC_ADDR_SH)
145/*
146 * Ethernet Controller DMA base address.
147 */
148#define PBC_CS8900A_DMABASE_REG PBC_REG_ADDR(0x44000 >> PBC_ADDR_SH)
149
150/* PBC Board Version Register bit definition */
151#define PBC_VERSION_ADS 0x8000 /* Bit15=1 means version for ads */
152#define PBC_VERSION_EVB_REVB 0x4000 /* BIT14=1 means version for evb revb */
153
154/* PBC Board Control Register 1 bit definitions */
155#define PBC_BCTRL1_ERST 0x0001 /* Ethernet Reset */
156#define PBC_BCTRL1_URST 0x0002 /* Reset External UART controller */
157#define PBC_BCTRL1_FRST 0x0004 /* FEC Reset */
158#define PBC_BCTRL1_ESLEEP 0x0010 /* Enable ethernet Sleep */
159#define PBC_BCTRL1_LCDON 0x0800 /* Enable the LCD */
160
161/* PBC Board Control Register 2 bit definitions */
162#define PBC_BCTRL2_VCC_EN 0x0004 /* Enable VCC */
163#define PBC_BCTRL2_VPP_EN 0x0008 /* Enable Vpp */
164#define PBC_BCTRL2_ATAFEC_EN 0X0010
165#define PBC_BCTRL2_ATAFEC_SEL 0X0020
166#define PBC_BCTRL2_ATA_EN 0X0040
167#define PBC_BCTRL2_IRDA_SD 0X0080
168#define PBC_BCTRL2_IRDA_EN 0X0100
169#define PBC_BCTRL2_CCTL10 0X0200
170#define PBC_BCTRL2_CCTL11 0X0400
171
172/* PBC Board Control Register 3 bit definitions */
173#define PBC_BCTRL3_HSH_EN 0X0020
174#define PBC_BCTRL3_FSH_MOD 0X0040
175#define PBC_BCTRL3_OTG_HS_EN 0X0080
176#define PBC_BCTRL3_OTG_VBUS_EN 0X0100
177#define PBC_BCTRL3_FSH_VBUS_EN 0X0200
178#define PBC_BCTRL3_USB_OTG_ON 0X0800
179#define PBC_BCTRL3_USB_FSH_ON 0X1000
180
181/* PBC Board Control Register 4 bit definitions */
182#define PBC_BCTRL4_REGEN_SEL 0X0001
183#define PBC_BCTRL4_USER_OFF 0X0002
184#define PBC_BCTRL4_VIB_EN 0X0004
185#define PBC_BCTRL4_PWRGT1_EN 0X0008
186#define PBC_BCTRL4_PWRGT2_EN 0X0010
187#define PBC_BCTRL4_STDBY_PRI 0X0020
188
189#ifndef __ASSEMBLY__
190/*
191 * Enumerations for SD cards and memory stick card. This corresponds to
192 * the card EN bits in the IMR: SD1_EN | MS_EN | SD3_EN | SD2_EN.
193 */
194enum mxc_card_no {
195 MXC_CARD_SD2 = 0,
196 MXC_CARD_SD3,
197 MXC_CARD_MS,
198 MXC_CARD_SD1,
199 MXC_CARD_MIN = MXC_CARD_SD2,
200 MXC_CARD_MAX = MXC_CARD_SD1,
201};
202#endif
203
204#define MXC_CPLD_VER_1_50 0x01
205
206/*
207 * PBC BSTAT Register bit definitions
208 */
209#define PBC_BSTAT_PRI_INT 0X0001
210#define PBC_BSTAT_USB_BYP 0X0002
211#define PBC_BSTAT_ATA_IOCS16 0X0004
212#define PBC_BSTAT_ATA_CBLID 0X0008
213#define PBC_BSTAT_ATA_DASP 0X0010
214#define PBC_BSTAT_PWR_RDY 0X0020
215#define PBC_BSTAT_SD3_WP 0X0100
216#define PBC_BSTAT_SD2_WP 0X0200
217#define PBC_BSTAT_SD1_WP 0X0400
218#define PBC_BSTAT_SD3_DET 0X0800
219#define PBC_BSTAT_SD2_DET 0X1000
220#define PBC_BSTAT_SD1_DET 0X2000
221#define PBC_BSTAT_MS_DET 0X4000
222#define PBC_BSTAT_SD3_DET_BIT 11
223#define PBC_BSTAT_SD2_DET_BIT 12
224#define PBC_BSTAT_SD1_DET_BIT 13
225#define PBC_BSTAT_MS_DET_BIT 14
226#define MXC_BSTAT_BIT(n) ((n == MXC_CARD_SD2) ? PBC_BSTAT_SD2_DET : \
227 ((n == MXC_CARD_SD3) ? PBC_BSTAT_SD3_DET : \
228 ((n == MXC_CARD_SD1) ? PBC_BSTAT_SD1_DET : \
229 ((n == MXC_CARD_MS) ? PBC_BSTAT_MS_DET : \
230 0x0))))
231
232/*
233 * PBC UART Control Register bit definitions
234 */
235#define PBC_UCTRL_DCE_DCD 0X0001
236#define PBC_UCTRL_DCE_DSR 0X0002
237#define PBC_UCTRL_DCE_RI 0X0004
238#define PBC_UCTRL_DTE_DTR 0X0100
239
240/*
241 * PBC UART Status Register bit definitions
242 */
243#define PBC_USTAT_DTE_DCD 0X0001
244#define PBC_USTAT_DTE_DSR 0X0002
245#define PBC_USTAT_DTE_RI 0X0004
246#define PBC_USTAT_DCE_DTR 0X0100
247
248/*
249 * PBC Interupt mask register bit definitions
250 */
251#define PBC_INTR_SD3_R_EN_BIT 4
252#define PBC_INTR_SD2_R_EN_BIT 0
253#define PBC_INTR_SD1_R_EN_BIT 6
254#define PBC_INTR_MS_R_EN_BIT 5
255#define PBC_INTR_SD3_EN_BIT 13
256#define PBC_INTR_SD2_EN_BIT 12
257#define PBC_INTR_MS_EN_BIT 14
258#define PBC_INTR_SD1_EN_BIT 15
259
260#define PBC_INTR_SD2_R_EN 0x0001
261#define PBC_INTR_LOW_BAT 0X0002
262#define PBC_INTR_OTG_FSOVER 0X0004
263#define PBC_INTR_FSH_OVER 0X0008
264#define PBC_INTR_SD3_R_EN 0x0010
265#define PBC_INTR_MS_R_EN 0x0020
266#define PBC_INTR_SD1_R_EN 0x0040
267#define PBC_INTR_FEC_INT 0X0080
268#define PBC_INTR_ENET_INT 0X0100
269#define PBC_INTR_OTGFS_INT 0X0200
270#define PBC_INTR_XUART_INT 0X0400
271#define PBC_INTR_CCTL12 0X0800
272#define PBC_INTR_SD2_EN 0x1000
273#define PBC_INTR_SD3_EN 0x2000
274#define PBC_INTR_MS_EN 0x4000
275#define PBC_INTR_SD1_EN 0x8000
276
277
278
279/* For interrupts like xuart, enet etc */
280#define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX27_PIN_TIN)
281#define MXC_MAX_EXP_IO_LINES 16
282
283/*
284 * This corresponds to PBC_INTMASK_SET_REG at offset 0x38.
285 *
286 */
287#define EXPIO_INT_LOW_BAT (MXC_EXP_IO_BASE + 1)
288#define EXPIO_INT_OTG_FS_OVR (MXC_EXP_IO_BASE + 2)
289#define EXPIO_INT_FSH_OVR (MXC_EXP_IO_BASE + 3)
290#define EXPIO_INT_RES4 (MXC_EXP_IO_BASE + 4)
291#define EXPIO_INT_RES5 (MXC_EXP_IO_BASE + 5)
292#define EXPIO_INT_RES6 (MXC_EXP_IO_BASE + 6)
293#define EXPIO_INT_FEC (MXC_EXP_IO_BASE + 7)
294#define EXPIO_INT_ENET_INT (MXC_EXP_IO_BASE + 8)
295#define EXPIO_INT_OTG_FS_INT (MXC_EXP_IO_BASE + 9)
296#define EXPIO_INT_XUART_INTA (MXC_EXP_IO_BASE + 10)
297#define EXPIO_INT_CCTL12_INT (MXC_EXP_IO_BASE + 11)
298#define EXPIO_INT_SD2_EN (MXC_EXP_IO_BASE + 12)
299#define EXPIO_INT_SD3_EN (MXC_EXP_IO_BASE + 13)
300#define EXPIO_INT_MS_EN (MXC_EXP_IO_BASE + 14)
301#define EXPIO_INT_SD1_EN (MXC_EXP_IO_BASE + 15)
302
303/*
304 * This is System IRQ used by CS8900A for interrupt generation
305 * taken from platform.h
306 */
307#define CS8900AIRQ EXPIO_INT_ENET_INT
308/* This is I/O Base address used to access registers of CS8900A on MXC ADS */
309#define CS8900A_BASE_ADDRESS (PBC_CS8900A_IOBASE_REG + 0x300)
310
311#define MXC_PMIC_INT_LINE IOMUX_TO_IRQ(MX27_PIN_TOUT)
312
313/*
314* This is used to detect if the CPLD version is for mx27 evb board rev-a
315*/
316#define PBC_CPLD_VERSION_IS_REVA() \
317 ((__raw_readw(PBC_VERSION_REG) & \
318 (PBC_VERSION_ADS | PBC_VERSION_EVB_REVB))\
319 == 0)
320
321/* This is used to active or inactive ata signal in CPLD .
322 * It is dependent with hardware
323 */
324#define PBC_ATA_SIGNAL_ACTIVE() \
325 __raw_writew( \
326 PBC_BCTRL2_ATAFEC_EN|PBC_BCTRL2_ATAFEC_SEL|PBC_BCTRL2_ATA_EN, \
327 PBC_BCTRL2_CLEAR_REG)
328
329#define PBC_ATA_SIGNAL_INACTIVE() \
330 __raw_writew( \
331 PBC_BCTRL2_ATAFEC_EN|PBC_BCTRL2_ATAFEC_SEL|PBC_BCTRL2_ATA_EN, \
332 PBC_BCTRL2_SET_REG)
333
334#define MXC_BD_LED1 (1 << 5)
335#define MXC_BD_LED2 (1 << 6)
336#define MXC_BD_LED_ON(led) \
337 __raw_writew(led, PBC_BCTRL1_SET_REG)
338#define MXC_BD_LED_OFF(led) \
339 __raw_writew(led, PBC_BCTRL1_CLEAR_REG)
340
341/* to determine the correct external crystal reference */
342#define CKIH_27MHZ_BIT_SET (1 << 3)
343
344#endif /* __ASM_ARCH_MXC_BOARD_MX27ADS_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/board-mx27lite.h b/arch/arm/plat-mxc/include/mach/board-mx27lite.h
deleted file mode 100644
index ea87551d2736..000000000000
--- a/arch/arm/plat-mxc/include/mach/board-mx27lite.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * Copyright 2009 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
5/*
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ASM_ARCH_MXC_BOARD_MX27LITE_H__
12#define __ASM_ARCH_MXC_BOARD_MX27LITE_H__
13
14#endif /* __ASM_ARCH_MXC_BOARD_MX27LITE_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/board-mx27pdk.h b/arch/arm/plat-mxc/include/mach/board-mx27pdk.h
deleted file mode 100644
index fec1bcfa9164..000000000000
--- a/arch/arm/plat-mxc/include/mach/board-mx27pdk.h
+++ /dev/null
@@ -1,14 +0,0 @@
1/*
2 * Copyright 2009 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
5/*
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ASM_ARCH_MXC_BOARD_MX27PDK_H__
12#define __ASM_ARCH_MXC_BOARD_MX27PDK_H__
13
14#endif /* __ASM_ARCH_MXC_BOARD_MX27PDK_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31_3ds.h b/arch/arm/plat-mxc/include/mach/board-mx31_3ds.h
deleted file mode 100644
index da92933a233b..000000000000
--- a/arch/arm/plat-mxc/include/mach/board-mx31_3ds.h
+++ /dev/null
@@ -1,59 +0,0 @@
1/*
2 * Copyright 2008 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
5/*
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ASM_ARCH_MXC_BOARD_MX31_3DS_H__
12#define __ASM_ARCH_MXC_BOARD_MX31_3DS_H__
13
14/* Definitions for components on the Debug board */
15
16/* Base address of CPLD controller on the Debug board */
17#define DEBUG_BASE_ADDRESS CS5_IO_ADDRESS(CS5_BASE_ADDR)
18
19/* LAN9217 ethernet base address */
20#define LAN9217_BASE_ADDR CS5_BASE_ADDR
21
22/* CPLD config and interrupt base address */
23#define CPLD_ADDR (DEBUG_BASE_ADDRESS + 0x20000)
24
25/* LED switchs */
26#define CPLD_LED_REG (CPLD_ADDR + 0x00)
27/* buttons */
28#define CPLD_SWITCH_BUTTONS_REG (EXPIO_ADDR + 0x08)
29/* status, interrupt */
30#define CPLD_INT_STATUS_REG (CPLD_ADDR + 0x10)
31#define CPLD_INT_MASK_REG (CPLD_ADDR + 0x38)
32#define CPLD_INT_RESET_REG (CPLD_ADDR + 0x20)
33/* magic word for debug CPLD */
34#define CPLD_MAGIC_NUMBER1_REG (CPLD_ADDR + 0x40)
35#define CPLD_MAGIC_NUMBER2_REG (CPLD_ADDR + 0x48)
36/* CPLD code version */
37#define CPLD_CODE_VER_REG (CPLD_ADDR + 0x50)
38/* magic word for debug CPLD */
39#define CPLD_MAGIC_NUMBER3_REG (CPLD_ADDR + 0x58)
40/* module reset register */
41#define CPLD_MODULE_RESET_REG (CPLD_ADDR + 0x60)
42/* CPU ID and Personality ID */
43#define CPLD_MCU_BOARD_ID_REG (CPLD_ADDR + 0x68)
44
45/* CPLD IRQ line for external uart, external ethernet etc */
46#define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_1)
47
48#define MXC_EXP_IO_BASE (MXC_BOARD_IRQ_START)
49#define MXC_IRQ_TO_EXPIO(irq) ((irq) - MXC_EXP_IO_BASE)
50
51#define EXPIO_INT_ENET (MXC_EXP_IO_BASE + 0)
52#define EXPIO_INT_XUART_A (MXC_EXP_IO_BASE + 1)
53#define EXPIO_INT_XUART_B (MXC_EXP_IO_BASE + 2)
54#define EXPIO_INT_BUTTON_A (MXC_EXP_IO_BASE + 3)
55#define EXPIO_INT_BUTTON_B (MXC_EXP_IO_BASE + 4)
56
57#define MXC_MAX_EXP_IO_LINES 16
58
59#endif /* __ASM_ARCH_MXC_BOARD_MX31_3DS_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31ads.h b/arch/arm/plat-mxc/include/mach/board-mx31ads.h
deleted file mode 100644
index 095a199591c6..000000000000
--- a/arch/arm/plat-mxc/include/mach/board-mx31ads.h
+++ /dev/null
@@ -1,117 +0,0 @@
1/*
2 * Copyright 2005-2007 Freescale Semiconductor, Inc. All Rights Reserved.
3 */
4
5/*
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ASM_ARCH_MXC_BOARD_MX31ADS_H__
12#define __ASM_ARCH_MXC_BOARD_MX31ADS_H__
13
14#include <mach/hardware.h>
15
16/* Base address of PBC controller */
17#define PBC_BASE_ADDRESS MX31_CS4_BASE_ADDR_VIRT
18/* Offsets for the PBC Controller register */
19
20/* PBC Board status register offset */
21#define PBC_BSTAT 0x000002
22
23/* PBC Board control register 1 set address */
24#define PBC_BCTRL1_SET 0x000004
25
26/* PBC Board control register 1 clear address */
27#define PBC_BCTRL1_CLEAR 0x000006
28
29/* PBC Board control register 2 set address */
30#define PBC_BCTRL2_SET 0x000008
31
32/* PBC Board control register 2 clear address */
33#define PBC_BCTRL2_CLEAR 0x00000A
34
35/* PBC Board control register 3 set address */
36#define PBC_BCTRL3_SET 0x00000C
37
38/* PBC Board control register 3 clear address */
39#define PBC_BCTRL3_CLEAR 0x00000E
40
41/* PBC Board control register 4 set address */
42#define PBC_BCTRL4_SET 0x000010
43
44/* PBC Board control register 4 clear address */
45#define PBC_BCTRL4_CLEAR 0x000012
46
47/* PBC Board status register 1 */
48#define PBC_BSTAT1 0x000014
49
50/* PBC Board interrupt status register */
51#define PBC_INTSTATUS 0x000016
52
53/* PBC Board interrupt current status register */
54#define PBC_INTCURR_STATUS 0x000018
55
56/* PBC Interrupt mask register set address */
57#define PBC_INTMASK_SET 0x00001A
58
59/* PBC Interrupt mask register clear address */
60#define PBC_INTMASK_CLEAR 0x00001C
61
62/* External UART A */
63#define PBC_SC16C652_UARTA 0x010000
64
65/* External UART B */
66#define PBC_SC16C652_UARTB 0x010010
67
68/* Ethernet Controller IO base address */
69#define PBC_CS8900A_IOBASE 0x020000
70
71/* Ethernet Controller Memory base address */
72#define PBC_CS8900A_MEMBASE 0x021000
73
74/* Ethernet Controller DMA base address */
75#define PBC_CS8900A_DMABASE 0x022000
76
77/* External chip select 0 */
78#define PBC_XCS0 0x040000
79
80/* LCD Display enable */
81#define PBC_LCD_EN_B 0x060000
82
83/* Code test debug enable */
84#define PBC_CODE_B 0x070000
85
86/* PSRAM memory select */
87#define PBC_PSRAM_B 0x5000000
88
89#define PBC_INTSTATUS_REG (PBC_INTSTATUS + PBC_BASE_ADDRESS)
90#define PBC_INTCURR_STATUS_REG (PBC_INTCURR_STATUS + PBC_BASE_ADDRESS)
91#define PBC_INTMASK_SET_REG (PBC_INTMASK_SET + PBC_BASE_ADDRESS)
92#define PBC_INTMASK_CLEAR_REG (PBC_INTMASK_CLEAR + PBC_BASE_ADDRESS)
93#define EXPIO_PARENT_INT IOMUX_TO_IRQ(MX31_PIN_GPIO1_4)
94
95#define MXC_EXP_IO_BASE (MXC_BOARD_IRQ_START)
96#define MXC_IRQ_TO_EXPIO(irq) ((irq) - MXC_EXP_IO_BASE)
97
98#define EXPIO_INT_LOW_BAT (MXC_EXP_IO_BASE + 0)
99#define EXPIO_INT_PB_IRQ (MXC_EXP_IO_BASE + 1)
100#define EXPIO_INT_OTG_FS_OVR (MXC_EXP_IO_BASE + 2)
101#define EXPIO_INT_FSH_OVR (MXC_EXP_IO_BASE + 3)
102#define EXPIO_INT_RES4 (MXC_EXP_IO_BASE + 4)
103#define EXPIO_INT_RES5 (MXC_EXP_IO_BASE + 5)
104#define EXPIO_INT_RES6 (MXC_EXP_IO_BASE + 6)
105#define EXPIO_INT_RES7 (MXC_EXP_IO_BASE + 7)
106#define EXPIO_INT_ENET_INT (MXC_EXP_IO_BASE + 8)
107#define EXPIO_INT_OTG_FS_INT (MXC_EXP_IO_BASE + 9)
108#define EXPIO_INT_XUART_INTA (MXC_EXP_IO_BASE + 10)
109#define EXPIO_INT_XUART_INTB (MXC_EXP_IO_BASE + 11)
110#define EXPIO_INT_SYNTH_IRQ (MXC_EXP_IO_BASE + 12)
111#define EXPIO_INT_CE_INT1 (MXC_EXP_IO_BASE + 13)
112#define EXPIO_INT_CE_INT2 (MXC_EXP_IO_BASE + 14)
113#define EXPIO_INT_RES15 (MXC_EXP_IO_BASE + 15)
114
115#define MXC_MAX_EXP_IO_LINES 16
116
117#endif /* __ASM_ARCH_MXC_BOARD_MX31ADS_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31lilly.h b/arch/arm/plat-mxc/include/mach/board-mx31lilly.h
index eb5a5024622e..0df71bfefbb1 100644
--- a/arch/arm/plat-mxc/include/mach/board-mx31lilly.h
+++ b/arch/arm/plat-mxc/include/mach/board-mx31lilly.h
@@ -31,7 +31,7 @@ enum mx31lilly_boards {
31 31
32/* 32/*
33 * This CPU module needs a baseboard to work. After basic initializing 33 * This CPU module needs a baseboard to work. After basic initializing
34 * its own devices, it calls baseboard's init function. 34 * its own devices, it calls the baseboard's init function.
35 */ 35 */
36 36
37extern void mx31lilly_db_init(void); 37extern void mx31lilly_db_init(void);
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31lite.h b/arch/arm/plat-mxc/include/mach/board-mx31lite.h
index 2b2da0367578..c1ad0ae807cc 100644
--- a/arch/arm/plat-mxc/include/mach/board-mx31lite.h
+++ b/arch/arm/plat-mxc/include/mach/board-mx31lite.h
@@ -32,7 +32,7 @@ enum mx31lite_boards {
32 32
33/* 33/*
34 * This CPU module needs a baseboard to work. After basic initializing 34 * This CPU module needs a baseboard to work. After basic initializing
35 * its own devices, it calls baseboard's init function. 35 * its own devices, it calls the baseboard's init function.
36 */ 36 */
37 37
38extern void mx31lite_db_init(void); 38extern void mx31lite_db_init(void);
diff --git a/arch/arm/plat-mxc/include/mach/board-mx31moboard.h b/arch/arm/plat-mxc/include/mach/board-mx31moboard.h
index 36ff3cedee1a..de14543891cf 100644
--- a/arch/arm/plat-mxc/include/mach/board-mx31moboard.h
+++ b/arch/arm/plat-mxc/include/mach/board-mx31moboard.h
@@ -31,7 +31,7 @@ enum mx31moboard_boards {
31 31
32/* 32/*
33 * This CPU module needs a baseboard to work. After basic initializing 33 * This CPU module needs a baseboard to work. After basic initializing
34 * its own devices, it calls baseboard's init function. 34 * its own devices, it calls the baseboard's init function.
35 */ 35 */
36 36
37extern void mx31moboard_devboard_init(void); 37extern void mx31moboard_devboard_init(void);
diff --git a/arch/arm/plat-mxc/include/mach/board-pcm038.h b/arch/arm/plat-mxc/include/mach/board-pcm038.h
index 410f9786ed22..6f371e35753d 100644
--- a/arch/arm/plat-mxc/include/mach/board-pcm038.h
+++ b/arch/arm/plat-mxc/include/mach/board-pcm038.h
@@ -22,7 +22,7 @@
22#ifndef __ASSEMBLY__ 22#ifndef __ASSEMBLY__
23/* 23/*
24 * This CPU module needs a baseboard to work. After basic initializing 24 * This CPU module needs a baseboard to work. After basic initializing
25 * its own devices, it calls baseboard's init function. 25 * its own devices, it calls the baseboard's init function.
26 * TODO: Add your own baseboard init function and call it from 26 * TODO: Add your own baseboard init function and call it from
27 * inside pcm038_init(). 27 * inside pcm038_init().
28 * 28 *
diff --git a/arch/arm/plat-mxc/include/mach/board-qong.h b/arch/arm/plat-mxc/include/mach/board-qong.h
deleted file mode 100644
index 6d88c7af4b23..000000000000
--- a/arch/arm/plat-mxc/include/mach/board-qong.h
+++ /dev/null
@@ -1,17 +0,0 @@
1/*
2 * Copyright 2009 Ilya Yanok, Emcraft Systems Ltd, <yanok@emcraft.com>
3 */
4
5/*
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
9 */
10
11#ifndef __ASM_ARCH_MXC_BOARD_QONG_H__
12#define __ASM_ARCH_MXC_BOARD_QONG_H__
13
14/* NOR FLASH */
15#define QONG_NOR_SIZE (128*1024*1024)
16
17#endif /* __ASM_ARCH_MXC_BOARD_QONG_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/debug-macro.S b/arch/arm/plat-mxc/include/mach/debug-macro.S
index 0b6e11eaeb8c..25606409aabc 100644
--- a/arch/arm/plat-mxc/include/mach/debug-macro.S
+++ b/arch/arm/plat-mxc/include/mach/debug-macro.S
@@ -23,8 +23,8 @@
23#error "CONFIG_DEBUG_LL is incompatible with multiple archs" 23#error "CONFIG_DEBUG_LL is incompatible with multiple archs"
24#endif 24#endif
25#include <mach/mx25.h> 25#include <mach/mx25.h>
26#define UART_PADDR UART1_BASE_ADDR 26#define UART_PADDR MX25_UART1_BASE_ADDR
27#define UART_VADDR MX25_AIPS1_IO_ADDRESS(UART1_BASE_ADDR) 27#define UART_VADDR MX25_AIPS1_IO_ADDRESS(MX25_UART1_BASE_ADDR)
28#endif 28#endif
29 29
30#ifdef CONFIG_ARCH_MX2 30#ifdef CONFIG_ARCH_MX2
diff --git a/arch/arm/plat-mxc/include/mach/devices-common.h b/arch/arm/plat-mxc/include/mach/devices-common.h
new file mode 100644
index 000000000000..c5f68c587309
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/devices-common.h
@@ -0,0 +1,60 @@
1/*
2 * Copyright (C) 2009-2010 Pengutronix
3 * Uwe Kleine-Koenig <u.kleine-koenig@pengutronix.de>
4 *
5 * This program is free software; you can redistribute it and/or modify it under
6 * the terms of the GNU General Public License version 2 as published by the
7 * Free Software Foundation.
8 */
9#include <linux/kernel.h>
10#include <linux/platform_device.h>
11#include <linux/init.h>
12
13struct platform_device *imx_add_platform_device(const char *name, int id,
14 const struct resource *res, unsigned int num_resources,
15 const void *data, size_t size_data);
16
17#if defined (CONFIG_CAN_FLEXCAN) || defined (CONFIG_CAN_FLEXCAN_MODULE)
18#include <linux/can/platform/flexcan.h>
19struct platform_device *__init imx_add_flexcan(int id,
20 resource_size_t iobase, resource_size_t iosize,
21 resource_size_t irq,
22 const struct flexcan_platform_data *pdata);
23#else
24/* the ifdef can be removed once the flexcan driver has been merged */
25struct flexcan_platform_data;
26static inline struct platform_device *__init imx_add_flexcan(int id,
27 resource_size_t iobase, resource_size_t iosize,
28 resource_size_t irq,
29 const struct flexcan_platform_data *pdata)
30{
31 return NULL;
32}
33#endif
34
35#include <mach/i2c.h>
36struct platform_device *__init imx_add_imx_i2c(int id,
37 resource_size_t iobase, resource_size_t iosize, int irq,
38 const struct imxi2c_platform_data *pdata);
39
40#include <mach/imx-uart.h>
41struct platform_device *__init imx_add_imx_uart_3irq(int id,
42 resource_size_t iobase, resource_size_t iosize,
43 resource_size_t irqrx, resource_size_t irqtx,
44 resource_size_t irqrts,
45 const struct imxuart_platform_data *pdata);
46struct platform_device *__init imx_add_imx_uart_1irq(int id,
47 resource_size_t iobase, resource_size_t iosize,
48 resource_size_t irq,
49 const struct imxuart_platform_data *pdata);
50
51#include <mach/mxc_nand.h>
52struct platform_device *__init imx_add_mxc_nand_v1(resource_size_t iobase,
53 int irq, const struct mxc_nand_platform_data *pdata);
54struct platform_device *__init imx_add_mxc_nand_v21(resource_size_t iobase,
55 int irq, const struct mxc_nand_platform_data *pdata);
56
57#include <mach/spi.h>
58struct platform_device *__init imx_add_spi_imx(int id,
59 resource_size_t iobase, resource_size_t iosize, int irq,
60 const struct spi_imx_master *pdata);
diff --git a/arch/arm/plat-mxc/include/mach/board-eukrea_cpuimx27.h b/arch/arm/plat-mxc/include/mach/eukrea-baseboards.h
index a1fd5830af48..634e3f4c454d 100644
--- a/arch/arm/plat-mxc/include/mach/board-eukrea_cpuimx27.h
+++ b/arch/arm/plat-mxc/include/mach/eukrea-baseboards.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * Copyright (C) 2009 Eric Benard - eric@eukrea.com 2 * Copyright (C) 2010 Eric Benard - eric@eukrea.com
3 * 3 *
4 * Based on board-pcm038.h which is : 4 * Based on board-pcm038.h which is :
5 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de) 5 * Copyright (C) 2008 Juergen Beisert (kernel@pengutronix.de)
@@ -19,22 +19,29 @@
19 * MA 02110-1301, USA. 19 * MA 02110-1301, USA.
20 */ 20 */
21 21
22#ifndef __ASM_ARCH_MXC_BOARD_EUKREA_CPUIMX27_H__ 22#ifndef __MACH_EUKREA_BASEBOARDS_H__
23#define __ASM_ARCH_MXC_BOARD_EUKREA_CPUIMX27_H__ 23#define __MACH_EUKREA_BASEBOARDS_H__
24 24
25#ifndef __ASSEMBLY__ 25#ifndef __ASSEMBLY__
26/* 26/*
27 * This CPU module needs a baseboard to work. After basic initializing 27 * This CPU module needs a baseboard to work. After basic initializing
28 * its own devices, it calls baseboard's init function. 28 * its own devices, it calls baseboard's init function.
29 * TODO: Add your own baseboard init function and call it from 29 * TODO: Add your own baseboard init function and call it from
30 * inside eukrea_cpuimx27_init(). 30 * inside eukrea_cpuimx25_init() eukrea_cpuimx27_init()
31 * eukrea_cpuimx35_init() or eukrea_cpuimx51_init().
31 * 32 *
32 * This example here is for the development board. Refer 33 * This example here is for the development board. Refer
33 * eukrea_mbimx27-baseboard.c 34 * mach-mx25/eukrea_mbimxsd-baseboard.c for cpuimx25
35 * mach-imx/eukrea_mbimx27-baseboard.c for cpuimx27
36 * mach-mx3/eukrea_mbimxsd-baseboard.c for cpuimx35
37 * mach-mx5/eukrea_mbimx51-baseboard.c for cpuimx51
34 */ 38 */
35 39
40extern void eukrea_mbimx25_baseboard_init(void);
36extern void eukrea_mbimx27_baseboard_init(void); 41extern void eukrea_mbimx27_baseboard_init(void);
42extern void eukrea_mbimx35_baseboard_init(void);
43extern void eukrea_mbimx51_baseboard_init(void);
37 44
38#endif 45#endif
39 46
40#endif /* __ASM_ARCH_MXC_BOARD_EUKREA_CPUIMX27_H__ */ 47#endif /* __MACH_EUKREA_BASEBOARDS_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/gpio.h b/arch/arm/plat-mxc/include/mach/gpio.h
index 894d2f87c856..661fbc605759 100644
--- a/arch/arm/plat-mxc/include/mach/gpio.h
+++ b/arch/arm/plat-mxc/include/mach/gpio.h
@@ -33,9 +33,11 @@
33struct mxc_gpio_port { 33struct mxc_gpio_port {
34 void __iomem *base; 34 void __iomem *base;
35 int irq; 35 int irq;
36 int irq_high;
36 int virtual_irq_start; 37 int virtual_irq_start;
37 struct gpio_chip chip; 38 struct gpio_chip chip;
38 u32 both_edges; 39 u32 both_edges;
40 spinlock_t lock;
39}; 41};
40 42
41int mxc_gpio_init(struct mxc_gpio_port*, int); 43int mxc_gpio_init(struct mxc_gpio_port*, int);
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx25.h b/arch/arm/plat-mxc/include/mach/iomux-mx25.h
index f39220d1b67a..d7f52c91f82e 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx25.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-mx25.h
@@ -252,6 +252,7 @@
252#define MX25_PAD_OE_ACD__GPIO_1_25 IOMUX_PAD(0x30c, 0x114, 0x15, 0, 0, NO_PAD_CTRL) 252#define MX25_PAD_OE_ACD__GPIO_1_25 IOMUX_PAD(0x30c, 0x114, 0x15, 0, 0, NO_PAD_CTRL)
253 253
254#define MX25_PAD_CONTRAST__CONTRAST IOMUX_PAD(0x310, 0x118, 0x10, 0, 0, NO_PAD_CTRL) 254#define MX25_PAD_CONTRAST__CONTRAST IOMUX_PAD(0x310, 0x118, 0x10, 0, 0, NO_PAD_CTRL)
255#define MX25_PAD_CONTRAST__PWM4_PWMO IOMUX_PAD(0x310, 0x118, 0x14, 0, 0, NO_PAD_CTRL)
255#define MX25_PAD_CONTRAST__FEC_CRS IOMUX_PAD(0x310, 0x118, 0x15, 0x508, 1, NO_PAD_CTRL) 256#define MX25_PAD_CONTRAST__FEC_CRS IOMUX_PAD(0x310, 0x118, 0x15, 0x508, 1, NO_PAD_CTRL)
256 257
257#define MX25_PAD_PWM__PWM IOMUX_PAD(0x314, 0x11c, 0x10, 0, 0, NO_PAD_CTRL) 258#define MX25_PAD_PWM__PWM IOMUX_PAD(0x314, 0x11c, 0x10, 0, 0, NO_PAD_CTRL)
@@ -371,30 +372,41 @@
371#define MX25_PAD_SD1_DATA3__FEC_CRS IOMUX_PAD(0x39c, 0x1a4, 0x10, 0x508, 2, NO_PAD_CTRL) 372#define MX25_PAD_SD1_DATA3__FEC_CRS IOMUX_PAD(0x39c, 0x1a4, 0x10, 0x508, 2, NO_PAD_CTRL)
372#define MX25_PAD_SD1_DATA3__GPIO_2_28 IOMUX_PAD(0x39c, 0x1a4, 0x15, 0, 0, NO_PAD_CTRL) 373#define MX25_PAD_SD1_DATA3__GPIO_2_28 IOMUX_PAD(0x39c, 0x1a4, 0x15, 0, 0, NO_PAD_CTRL)
373 374
374#define MX25_PAD_KPP_ROW0__KPP_ROW0 IOMUX_PAD(0x3a0, 0x1a8, 0x10, 0, 0, PAD_CTL_PKE) 375#define KPP_CTL_ROW (PAD_CTL_PKE | PAD_CTL_PUE | PAD_CTL_PUS_100K_UP)
376#define KPP_CTL_COL (PAD_CTL_PKE | PAD_CTL_PUE | PAD_CTL_PUS_100K_UP | PAD_CTL_ODE)
377
378#define MX25_PAD_KPP_ROW0__KPP_ROW0 IOMUX_PAD(0x3a0, 0x1a8, 0x10, 0, 0, KPP_CTL_ROW)
375#define MX25_PAD_KPP_ROW0__GPIO_2_29 IOMUX_PAD(0x3a0, 0x1a8, 0x15, 0, 0, NO_PAD_CTRL) 379#define MX25_PAD_KPP_ROW0__GPIO_2_29 IOMUX_PAD(0x3a0, 0x1a8, 0x15, 0, 0, NO_PAD_CTRL)
376 380
377#define MX25_PAD_KPP_ROW1__KPP_ROW1 IOMUX_PAD(0x3a4, 0x1ac, 0x10, 0, 0, PAD_CTL_PKE) 381#define MX25_PAD_KPP_ROW1__KPP_ROW1 IOMUX_PAD(0x3a4, 0x1ac, 0x10, 0, 0, KPP_CTL_ROW)
378#define MX25_PAD_KPP_ROW1__GPIO_2_30 IOMUX_PAD(0x3a4, 0x1ac, 0x15, 0, 0, NO_PAD_CTRL) 382#define MX25_PAD_KPP_ROW1__GPIO_2_30 IOMUX_PAD(0x3a4, 0x1ac, 0x15, 0, 0, NO_PAD_CTRL)
379 383
380#define MX25_PAD_KPP_ROW2__KPP_ROW2 IOMUX_PAD(0x3a8, 0x1b0, 0x10, 0, 0, PAD_CTL_PKE) 384#define MX25_PAD_KPP_ROW2__KPP_ROW2 IOMUX_PAD(0x3a8, 0x1b0, 0x10, 0, 0, KPP_CTL_ROW)
381#define MX25_PAD_KPP_ROW2__CSI_D0 IOMUX_PAD(0x3a8, 0x1b0, 0x13, 0x488, 2, NO_PAD_CTRL) 385#define MX25_PAD_KPP_ROW2__CSI_D0 IOMUX_PAD(0x3a8, 0x1b0, 0x13, 0x488, 2, NO_PAD_CTRL)
382#define MX25_PAD_KPP_ROW2__GPIO_2_31 IOMUX_PAD(0x3a8, 0x1b0, 0x15, 0, 0, NO_PAD_CTRL) 386#define MX25_PAD_KPP_ROW2__GPIO_2_31 IOMUX_PAD(0x3a8, 0x1b0, 0x15, 0, 0, NO_PAD_CTRL)
383 387
384#define MX25_PAD_KPP_ROW3__KPP_ROW3 IOMUX_PAD(0x3ac, 0x1b4, 0x10, 0, 0, PAD_CTL_PKE) 388#define MX25_PAD_KPP_ROW3__KPP_ROW3 IOMUX_PAD(0x3ac, 0x1b4, 0x10, 0, 0, KPP_CTL_ROW)
385#define MX25_PAD_KPP_ROW3__CSI_LD1 IOMUX_PAD(0x3ac, 0x1b4, 0x13, 0x48c, 2, NO_PAD_CTRL) 389#define MX25_PAD_KPP_ROW3__CSI_LD1 IOMUX_PAD(0x3ac, 0x1b4, 0x13, 0x48c, 2, NO_PAD_CTRL)
386#define MX25_PAD_KPP_ROW3__GPIO_3_0 IOMUX_PAD(0x3ac, 0x1b4, 0x15, 0, 0, NO_PAD_CTRL) 390#define MX25_PAD_KPP_ROW3__GPIO_3_0 IOMUX_PAD(0x3ac, 0x1b4, 0x15, 0, 0, NO_PAD_CTRL)
387 391
388#define MX25_PAD_KPP_COL0__KPP_COL0 IOMUX_PAD(0x3b0, 0x1b8, 0x10, 0, 0, PAD_CTL_PKE | PAD_CTL_ODE) 392#define MX25_PAD_KPP_COL0__KPP_COL0 IOMUX_PAD(0x3b0, 0x1b8, 0x10, 0, 0, KPP_CTL_COL)
393#define MX25_PAD_KPP_COL0__UART4_RXD_MUX IOMUX_PAD(0x3b0, 0x1b8, 0x11, 0x570, 1, NO_PAD_CTRL)
394#define MX25_PAD_KPP_COL0__AUD5_TXD IOMUX_PAD(0x3b0, 0x1b8, 0x12, 0, 0, PAD_CTL_PKE | PAD_CTL_PUS_100K_UP)
389#define MX25_PAD_KPP_COL0__GPIO_3_1 IOMUX_PAD(0x3b0, 0x1b8, 0x15, 0, 0, NO_PAD_CTRL) 395#define MX25_PAD_KPP_COL0__GPIO_3_1 IOMUX_PAD(0x3b0, 0x1b8, 0x15, 0, 0, NO_PAD_CTRL)
390 396
391#define MX25_PAD_KPP_COL1__KPP_COL1 IOMUX_PAD(0x3b4, 0x1bc, 0x10, 0, 0, PAD_CTL_PKE | PAD_CTL_ODE) 397#define MX25_PAD_KPP_COL1__KPP_COL1 IOMUX_PAD(0x3b4, 0x1bc, 0x10, 0, 0, KPP_CTL_COL)
398#define MX25_PAD_KPP_COL1__UART4_TXD_MUX IOMUX_PAD(0x3b4, 0x1bc, 0x11, 0, 0, NO_PAD_CTRL)
399#define MX25_PAD_KPP_COL1__AUD5_RXD IOMUX_PAD(0x3b4, 0x1bc, 0x12, 0, 0, PAD_CTL_PKE | PAD_CTL_PUS_100K_UP)
392#define MX25_PAD_KPP_COL1__GPIO_3_2 IOMUX_PAD(0x3b4, 0x1bc, 0x15, 0, 0, NO_PAD_CTRL) 400#define MX25_PAD_KPP_COL1__GPIO_3_2 IOMUX_PAD(0x3b4, 0x1bc, 0x15, 0, 0, NO_PAD_CTRL)
393 401
394#define MX25_PAD_KPP_COL2__KPP_COL2 IOMUX_PAD(0x3b8, 0x1c0, 0x10, 0, 0, PAD_CTL_PKE | PAD_CTL_ODE) 402#define MX25_PAD_KPP_COL2__KPP_COL2 IOMUX_PAD(0x3b8, 0x1c0, 0x10, 0, 0, KPP_CTL_COL)
403#define MX25_PAD_KPP_COL2__UART4_RTS IOMUX_PAD(0x3b8, 0x1c0, 0x11, 0, 0, NO_PAD_CTRL)
404#define MX25_PAD_KPP_COL2__AUD5_TXC IOMUX_PAD(0x3b8, 0x1c0, 0x12, 0, 0, PAD_CTL_PKE | PAD_CTL_PUS_100K_UP)
395#define MX25_PAD_KPP_COL2__GPIO_3_3 IOMUX_PAD(0x3b8, 0x1c0, 0x15, 0, 0, NO_PAD_CTRL) 405#define MX25_PAD_KPP_COL2__GPIO_3_3 IOMUX_PAD(0x3b8, 0x1c0, 0x15, 0, 0, NO_PAD_CTRL)
396 406
397#define MX25_PAD_KPP_COL3__KPP_COL3 IOMUX_PAD(0x3bc, 0x1c4, 0x10, 0, 0, PAD_CTL_PKE | PAD_CTL_ODE) 407#define MX25_PAD_KPP_COL3__KPP_COL3 IOMUX_PAD(0x3bc, 0x1c4, 0x10, 0, 0, KPP_CTL_COL)
408#define MX25_PAD_KPP_COL3__UART4_CTS IOMUX_PAD(0x3bc, 0x1c4, 0x11, 0, 0, NO_PAD_CTRL)
409#define MX25_PAD_KPP_COL3__AUD5_TXFS IOMUX_PAD(0x3bc, 0x1c4, 0x12, 0, 0, PAD_CTL_PKE | PAD_CTL_PUS_100K_UP)
398#define MX25_PAD_KPP_COL3__GPIO_3_4 IOMUX_PAD(0x3bc, 0x1c4, 0x15, 0, 0, NO_PAD_CTRL) 410#define MX25_PAD_KPP_COL3__GPIO_3_4 IOMUX_PAD(0x3bc, 0x1c4, 0x15, 0, 0, NO_PAD_CTRL)
399 411
400#define MX25_PAD_FEC_MDC__FEC_MDC IOMUX_PAD(0x3c0, 0x1c8, 0x10, 0, 0, NO_PAD_CTRL) 412#define MX25_PAD_FEC_MDC__FEC_MDC IOMUX_PAD(0x3c0, 0x1c8, 0x10, 0, 0, NO_PAD_CTRL)
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mx51.h b/arch/arm/plat-mxc/include/mach/iomux-mx51.h
index ab0f95d953d0..21bfa46785bb 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mx51.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-mx51.h
@@ -27,8 +27,8 @@ typedef enum iomux_config {
27 IOMUX_CONFIG_ALT5, 27 IOMUX_CONFIG_ALT5,
28 IOMUX_CONFIG_ALT6, 28 IOMUX_CONFIG_ALT6,
29 IOMUX_CONFIG_ALT7, 29 IOMUX_CONFIG_ALT7,
30 IOMUX_CONFIG_GPIO, /* added to help user use GPIO mode */ 30 IOMUX_CONFIG_GPIO, /* added to help user use GPIO mode */
31 IOMUX_CONFIG_SION = 0x1 << 4, /* LOOPBACK:MUX SION bit */ 31 IOMUX_CONFIG_SION = 0x1 << 4, /* LOOPBACK:MUX SION bit */
32} iomux_pin_cfg_t; 32} iomux_pin_cfg_t;
33 33
34/* Pad control groupings */ 34/* Pad control groupings */
@@ -38,6 +38,8 @@ typedef enum iomux_config {
38 PAD_CTL_SRE_FAST) 38 PAD_CTL_SRE_FAST)
39#define MX51_UART3_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_DSE_HIGH | \ 39#define MX51_UART3_PAD_CTRL (PAD_CTL_PKE | PAD_CTL_DSE_HIGH | \
40 PAD_CTL_SRE_FAST) 40 PAD_CTL_SRE_FAST)
41#define MX51_I2C_PAD_CTRL (PAD_CTL_SRE_FAST | PAD_CTL_ODE | \
42 PAD_CTL_DSE_HIGH | PAD_CTL_PUS_100K_UP | PAD_CTL_HYS)
41#define MX51_USBH1_PAD_CTRL (PAD_CTL_SRE_FAST | PAD_CTL_DSE_HIGH | \ 43#define MX51_USBH1_PAD_CTRL (PAD_CTL_SRE_FAST | PAD_CTL_DSE_HIGH | \
42 PAD_CTL_PUS_100K_UP | PAD_CTL_PUE | \ 44 PAD_CTL_PUS_100K_UP | PAD_CTL_PUE | \
43 PAD_CTL_PKE | PAD_CTL_HYS) 45 PAD_CTL_PKE | PAD_CTL_HYS)
@@ -46,289 +48,278 @@ typedef enum iomux_config {
46 48
47/* 49/*
48 * The naming convention for the pad modes is MX51_PAD_<padname>__<padmode> 50 * The naming convention for the pad modes is MX51_PAD_<padname>__<padmode>
49 * If <padname> or <padmode> refers to a GPIO, it is named 51 * If <padname> or <padmode> refers to a GPIO, it is named GPIO_<unit>_<num>
50 * GPIO_<unit>_<num> see also iomux-v3.h 52 * See also iomux-v3.h
51 */ 53 */
52 54
53/* 55/* PAD MUX ALT INPSE PATH PADCTRL */
54 * FIXME: This was converted using scripts from existing Freescale code to 56#define MX51_PAD_EIM_DA0__EIM_DA0 IOMUX_PAD(0x7a8, 0x01c, 0, 0x0, 0, NO_PAD_CTRL)
55 * this form used upstream. Need to verify the name format. 57#define MX51_PAD_EIM_DA1__EIM_DA1 IOMUX_PAD(0x7a8, 0x020, 0, 0x0, 0, NO_PAD_CTRL)
56 */ 58#define MX51_PAD_EIM_DA2__EIM_DA2 IOMUX_PAD(0x7a8, 0x024, 0, 0x0, 0, NO_PAD_CTRL)
57 59#define MX51_PAD_EIM_DA3__EIM_DA3 IOMUX_PAD(0x7a8, 0x028, 0, 0x0, 0, NO_PAD_CTRL)
58/* PAD MUX ALT INPSE PATH PADCTRL */ 60#define MX51_PAD_EIM_DA4__EIM_DA4 IOMUX_PAD(0x7ac, 0x02c, 0, 0x0, 0, NO_PAD_CTRL)
59 61#define MX51_PAD_EIM_DA5__EIM_DA5 IOMUX_PAD(0x7ac, 0x030, 0, 0x0, 0, NO_PAD_CTRL)
60#define MX51_PAD_GPIO_2_0__EIM_D16 IOMUX_PAD(0x3f0, 0x05c, 1, 0x0, 0, NO_PAD_CTRL) 62#define MX51_PAD_EIM_DA6__EIM_DA6 IOMUX_PAD(0x7ac, 0x034, 0, 0x0, 0, NO_PAD_CTRL)
61#define MX51_PAD_GPIO_2_1__EIM_D17 IOMUX_PAD(0x3f4, 0x060, 1, 0x0, 0, NO_PAD_CTRL) 63#define MX51_PAD_EIM_DA7__EIM_DA7 IOMUX_PAD(0x7ac, 0x038, 0, 0x0, 0, NO_PAD_CTRL)
62#define MX51_PAD_GPIO_2_2__EIM_D18 IOMUX_PAD(0x3f8, 0x064, 1, 0x0, 0, NO_PAD_CTRL) 64#define MX51_PAD_EIM_DA8__EIM_DA8 IOMUX_PAD(0x7b0, 0x03c, 0, 0x0, 0, NO_PAD_CTRL)
63#define MX51_PAD_GPIO_2_3__EIM_D19 IOMUX_PAD(0x3fc, 0x068, 1, 0x0, 0, NO_PAD_CTRL) 65#define MX51_PAD_EIM_DA9__EIM_DA9 IOMUX_PAD(0x7b0, 0x040, 0, 0x0, 0, NO_PAD_CTRL)
64#define MX51_PAD_GPIO_2_4__EIM_D20 IOMUX_PAD(0x400, 0x06c, 1, 0x0, 0, NO_PAD_CTRL) 66#define MX51_PAD_EIM_DA10__EIM_DA10 IOMUX_PAD(0x7b0, 0x044, 0, 0x0, 0, NO_PAD_CTRL)
65#define MX51_PAD_GPIO_2_5__EIM_D21 IOMUX_PAD(0x404, 0x070, 1, 0x0, 0, NO_PAD_CTRL) 67#define MX51_PAD_EIM_DA11__EIM_DA11 IOMUX_PAD(0x7b0, 0x048, 0, 0x0, 0, NO_PAD_CTRL)
66#define MX51_PAD_EIM_D21__GPIO_2_5 IOMUX_PAD(0x404, 0x070, IOMUX_CONFIG_ALT1, 0x0, 0, MX51_GPIO_PAD_CTRL) 68#define MX51_PAD_EIM_DA12__EIM_DA12 IOMUX_PAD(0x7bc, 0x04c, 0, 0x0, 0, NO_PAD_CTRL)
67#define MX51_PAD_GPIO_2_6__EIM_D22 IOMUX_PAD(0x408, 0x074, 1, 0x0, 0, NO_PAD_CTRL) 69#define MX51_PAD_EIM_DA13__EIM_DA13 IOMUX_PAD(0x7bc, 0x050, 0, 0x0, 0, NO_PAD_CTRL)
68#define MX51_PAD_GPIO_2_7__EIM_D23 IOMUX_PAD(0x40c, 0x078, 1, 0x0, 0, NO_PAD_CTRL) 70#define MX51_PAD_EIM_DA14__EIM_DA14 IOMUX_PAD(0x7bc, 0x054, 0, 0x0, 0, NO_PAD_CTRL)
69 71#define MX51_PAD_EIM_DA15__EIM_DA15 IOMUX_PAD(0x7bc, 0x058, 0, 0x0, 0, NO_PAD_CTRL)
70/* Babbage UART3 */ 72#define MX51_PAD_EIM_D16__GPIO_2_0 IOMUX_PAD(0x3f0, 0x05c, 1, 0x0, 0, NO_PAD_CTRL)
71#define MX51_PAD_EIM_D24__UART3_CTS IOMUX_PAD(0x410, 0x07c, IOMUX_CONFIG_ALT3, 0x0, 0, MX51_UART3_PAD_CTRL) 73#define MX51_PAD_EIM_D16__I2C1_SDA IOMUX_PAD(0x3f0, 0x05c, (4 | IOMUX_CONFIG_SION), \
72#define MX51_PAD_EIM_D25__UART3_RXD IOMUX_PAD(0x414, 0x080, IOMUX_CONFIG_ALT3, 0x9f4, 0, MX51_UART3_PAD_CTRL) 74 0x09b4, 0, MX51_I2C_PAD_CTRL)
73#define MX51_PAD_EIM_D26__UART3_TXD IOMUX_PAD(0x418, 0x084, IOMUX_CONFIG_ALT3, 0x0, 0, MX51_UART3_PAD_CTRL) 75#define MX51_PAD_EIM_D17__GPIO_2_1 IOMUX_PAD(0x3f4, 0x060, 1, 0x0, 0, NO_PAD_CTRL)
74#define MX51_PAD_EIM_D27__UART3_RTS IOMUX_PAD(0x41c, 0x088, IOMUX_CONFIG_ALT3, 0x9f0, 0, MX51_UART3_PAD_CTRL) 76#define MX51_PAD_EIM_D18__GPIO_2_2 IOMUX_PAD(0x3f8, 0x064, 1, 0x0, 0, NO_PAD_CTRL)
75 77#define MX51_PAD_EIM_D19__GPIO_2_3 IOMUX_PAD(0x3fc, 0x068, 1, 0x0, 0, NO_PAD_CTRL)
76#define MX51_PAD_EIM_D28__EIM_D28 IOMUX_PAD(0x420, 0x08c, 0, 0x0, 0, NO_PAD_CTRL) 78#define MX51_PAD_EIM_D19__I2C1_SCL IOMUX_PAD(0x3fc, 0x068, (4 | IOMUX_CONFIG_SION), \
77#define MX51_PAD_EIM_D29__EIM_D29 IOMUX_PAD(0x424, 0x090, 0, 0x0, 0, NO_PAD_CTRL) 79 0x09b0, 0, MX51_I2C_PAD_CTRL)
78#define MX51_PAD_EIM_D30__EIM_D30 IOMUX_PAD(0x428, 0x094, 0, 0x0, 0, NO_PAD_CTRL) 80#define MX51_PAD_EIM_D20__GPIO_2_4 IOMUX_PAD(0x400, 0x06c, 1, 0x0, 0, NO_PAD_CTRL)
79#define MX51_PAD_EIM_D31__EIM_D31 IOMUX_PAD(0x42c, 0x09c, 0, 0x0, 0, NO_PAD_CTRL) 81#define MX51_PAD_EIM_D21__GPIO_2_5 IOMUX_PAD(0x404, 0x070, 1, 0x0, 0, MX51_GPIO_PAD_CTRL)
80 82#define MX51_PAD_EIM_D22__GPIO_2_6 IOMUX_PAD(0x408, 0x074, 1, 0x0, 0, NO_PAD_CTRL)
81#define MX51_PAD_GPIO_2_10__EIM_A16 IOMUX_PAD(0x430, 0x09c, 1, 0x0, 0, NO_PAD_CTRL) 83#define MX51_PAD_EIM_D23__GPIO_2_7 IOMUX_PAD(0x40c, 0x078, 1, 0x0, 0, NO_PAD_CTRL)
82#define MX51_PAD_GPIO_2_11__EIM_A17 IOMUX_PAD(0x434, 0x0a0, 1, 0x0, 0, NO_PAD_CTRL) 84#define MX51_PAD_EIM_D24__UART3_CTS IOMUX_PAD(0x410, 0x07c, 3, 0x0, 0, MX51_UART3_PAD_CTRL)
83#define MX51_PAD_GPIO_2_12__EIM_A18 IOMUX_PAD(0x438, 0x0a4, 1, 0x0, 0, NO_PAD_CTRL) 85#define MX51_PAD_EIM_D25__UART3_RXD IOMUX_PAD(0x414, 0x080, 3, 0x9f4, 0, MX51_UART3_PAD_CTRL)
84#define MX51_PAD_GPIO_2_13__EIM_A19 IOMUX_PAD(0x43c, 0x0a8, 1, 0x0, 0, NO_PAD_CTRL) 86#define MX51_PAD_EIM_D25__UART2_CTS IOMUX_PAD(0x414, 0x080, 4, 0x0, 0, MX51_UART2_PAD_CTRL)
85#define MX51_PAD_GPIO_2_14__EIM_A20 IOMUX_PAD(0x440, 0x0ac, 1, 0x0, 0, NO_PAD_CTRL) 87#define MX51_PAD_EIM_D26__UART3_TXD IOMUX_PAD(0x418, 0x084, 3, 0x0, 0, MX51_UART3_PAD_CTRL)
86#define MX51_PAD_GPIO_2_15__EIM_A21 IOMUX_PAD(0x444, 0x0b0, 1, 0x0, 0, NO_PAD_CTRL) 88#define MX51_PAD_EIM_D26__UART2_RTS IOMUX_PAD(0x418, 0x084, 4, 0x9e8, 3, MX51_UART2_PAD_CTRL)
87#define MX51_PAD_GPIO_2_16__EIM_A22 IOMUX_PAD(0x448, 0x0b4, 1, 0x0, 0, NO_PAD_CTRL) 89#define MX51_PAD_EIM_D27__UART3_RTS IOMUX_PAD(0x41c, 0x088, 3, 0x9f0, 3, MX51_UART3_PAD_CTRL)
88#define MX51_PAD_GPIO_2_17__EIM_A23 IOMUX_PAD(0x44c, 0x0b8, 1, 0x0, 0, NO_PAD_CTRL) 90#define MX51_PAD_EIM_D28__EIM_D28 IOMUX_PAD(0x420, 0x08c, 0, 0x0, 0, NO_PAD_CTRL)
89 91#define MX51_PAD_EIM_D29__EIM_D29 IOMUX_PAD(0x424, 0x090, 0, 0x0, 0, NO_PAD_CTRL)
90#define MX51_PAD_GPIO_2_18__EIM_A24 IOMUX_PAD(0x450, 0x0bc, 1, 0x0, 0, NO_PAD_CTRL) 92#define MX51_PAD_EIM_D30__EIM_D30 IOMUX_PAD(0x428, 0x094, 0, 0x0, 0, NO_PAD_CTRL)
91#define MX51_PAD_GPIO_2_19__EIM_A25 IOMUX_PAD(0x454, 0x0c0, 1, 0x0, 0, NO_PAD_CTRL) 93#define MX51_PAD_EIM_D31__EIM_D31 IOMUX_PAD(0x42c, 0x09c, 0, 0x0, 0, NO_PAD_CTRL)
92#define MX51_PAD_GPIO_2_20__EIM_A26 IOMUX_PAD(0x458, 0x0c4, 1, 0x0, 0, NO_PAD_CTRL) 94#define MX51_PAD_EIM_A16__GPIO_2_10 IOMUX_PAD(0x430, 0x09c, 1, 0x0, 0, NO_PAD_CTRL)
93#define MX51_PAD_GPIO_2_21__EIM_A27 IOMUX_PAD(0x45c, 0x0c8, 1, 0x0, 0, NO_PAD_CTRL) 95#define MX51_PAD_EIM_A17__GPIO_2_11 IOMUX_PAD(0x434, 0x0a0, 1, 0x0, 0, NO_PAD_CTRL)
94#define MX51_PAD_EIM_EB0__EIM_EB0 IOMUX_PAD(0x460, 0x0cc, 0, 0x0, 0, NO_PAD_CTRL) 96#define MX51_PAD_EIM_A18__GPIO_2_12 IOMUX_PAD(0x438, 0x0a4, 1, 0x0, 0, NO_PAD_CTRL)
95#define MX51_PAD_EIM_EB1__EIM_EB1 IOMUX_PAD(0x464, 0x0d0, 0, 0x0, 0, NO_PAD_CTRL) 97#define MX51_PAD_EIM_A19__GPIO_2_13 IOMUX_PAD(0x43c, 0x0a8, 1, 0x0, 0, NO_PAD_CTRL)
96#define MX51_PAD_GPIO_2_22__EIM_EB2 IOMUX_PAD(0x468, 0x0d4, 1, 0x0, 0, NO_PAD_CTRL) 98#define MX51_PAD_EIM_A20__GPIO_2_14 IOMUX_PAD(0x440, 0x0ac, 1, 0x0, 0, NO_PAD_CTRL)
97#define MX51_PAD_GPIO_2_23__EIM_EB3 IOMUX_PAD(0x46c, 0x0d8, 1, 0x0, 0, NO_PAD_CTRL) 99#define MX51_PAD_EIM_A21__GPIO_2_15 IOMUX_PAD(0x444, 0x0b0, 1, 0x0, 0, NO_PAD_CTRL)
98 100#define MX51_PAD_EIM_A22__GPIO_2_16 IOMUX_PAD(0x448, 0x0b4, 1, 0x0, 0, NO_PAD_CTRL)
99#define MX51_PAD_GPIO_2_24__EIM_OE IOMUX_PAD(0x470, 0x0dc, 1, 0x0, 0, NO_PAD_CTRL) 101#define MX51_PAD_EIM_A23__GPIO_2_17 IOMUX_PAD(0x44c, 0x0b8, 1, 0x0, 0, NO_PAD_CTRL)
100#define MX51_PAD_GPIO_2_25__EIM_CS0 IOMUX_PAD(0x474, 0x0e0, 1, 0x0, 0, NO_PAD_CTRL) 102#define MX51_PAD_EIM_A24__GPIO_2_18 IOMUX_PAD(0x450, 0x0bc, 1, 0x0, 0, NO_PAD_CTRL)
101#define MX51_PAD_GPIO_2_26__EIM_CS1 IOMUX_PAD(0x478, 0x0e4, 1, 0x0, 0, NO_PAD_CTRL) 103#define MX51_PAD_EIM_A25__GPIO_2_19 IOMUX_PAD(0x454, 0x0c0, 1, 0x0, 0, NO_PAD_CTRL)
102#define MX51_PAD_GPIO_2_27__EIM_CS2 IOMUX_PAD(0x47c, 0x0e8, 1, 0x0, 0, NO_PAD_CTRL) 104#define MX51_PAD_EIM_A26__GPIO_2_20 IOMUX_PAD(0x458, 0x0c4, 1, 0x0, 0, NO_PAD_CTRL)
103#define MX51_PAD_GPIO_2_28__EIM_CS3 IOMUX_PAD(0x480, 0x0ec, 1, 0x0, 0, NO_PAD_CTRL) 105#define MX51_PAD_EIM_A27__GPIO_2_21 IOMUX_PAD(0x45c, 0x0c8, 1, 0x0, 0, NO_PAD_CTRL)
104#define MX51_PAD_GPIO_2_29__EIM_CS4 IOMUX_PAD(0x484, 0x0f0, 1, 0x0, 0, NO_PAD_CTRL) 106#define MX51_PAD_EIM_EB0__EIM_EB0 IOMUX_PAD(0x460, 0x0cc, 0, 0x0, 0, NO_PAD_CTRL)
105#define MX51_PAD_GPIO_2_30__EIM_CS5 IOMUX_PAD(0x488, 0x0f4, 1, 0x0, 0, NO_PAD_CTRL) 107#define MX51_PAD_EIM_EB1__EIM_EB1 IOMUX_PAD(0x464, 0x0d0, 0, 0x0, 0, NO_PAD_CTRL)
106#define MX51_PAD_GPIO_2_31__EIM_DTACK IOMUX_PAD(0x48c, 0x0f8, 1, 0x0, 0, NO_PAD_CTRL) 108#define MX51_PAD_EIM_EB2__GPIO_2_22 IOMUX_PAD(0x468, 0x0d4, 1, 0x0, 0, NO_PAD_CTRL)
107 109#define MX51_PAD_EIM_EB3__GPIO_2_23 IOMUX_PAD(0x46c, 0x0d8, 1, 0x0, 0, NO_PAD_CTRL)
108#define MX51_PAD_GPIO_3_1__EIM_LBA IOMUX_PAD(0x494, 0xFC, 1, 0x0, 0, NO_PAD_CTRL) 110#define MX51_PAD_EIM_OE__GPIO_2_24 IOMUX_PAD(0x470, 0x0dc, 1, 0x0, 0, NO_PAD_CTRL)
109#define MX51_PAD_GPIO_3_2__EIM_CRE IOMUX_PAD(0x4A0, 0x100, 1, 0x0, 0, NO_PAD_CTRL) 111#define MX51_PAD_EIM_CS0__GPIO_2_25 IOMUX_PAD(0x474, 0x0e0, 1, 0x0, 0, NO_PAD_CTRL)
110#define MX51_PAD_DRAM_CS1__DRAM_CS1 IOMUX_PAD(0x4D0, 0x104, 0, 0x0, 0, NO_PAD_CTRL) 112#define MX51_PAD_EIM_CS1__GPIO_2_26 IOMUX_PAD(0x478, 0x0e4, 1, 0x0, 0, NO_PAD_CTRL)
111#define MX51_PAD_GPIO_3_3__NANDF_WE_B IOMUX_PAD(0x4E4, 0x108, 3, 0x0, 0, NO_PAD_CTRL) 113#define MX51_PAD_EIM_CS2__GPIO_2_27 IOMUX_PAD(0x47c, 0x0e8, 1, 0x0, 0, NO_PAD_CTRL)
112#define MX51_PAD_GPIO_3_4__NANDF_RE_B IOMUX_PAD(0x4E8, 0x10C, 3, 0x0, 0, NO_PAD_CTRL) 114#define MX51_PAD_EIM_CS3__GPIO_2_28 IOMUX_PAD(0x480, 0x0ec, 1, 0x0, 0, NO_PAD_CTRL)
113#define MX51_PAD_GPIO_3_5__NANDF_ALE IOMUX_PAD(0x4EC, 0x110, 3, 0x0, 0, NO_PAD_CTRL) 115#define MX51_PAD_EIM_CS4__GPIO_2_29 IOMUX_PAD(0x484, 0x0f0, 1, 0x0, 0, NO_PAD_CTRL)
114#define MX51_PAD_GPIO_3_6__NANDF_CLE IOMUX_PAD(0x4F0, 0x114, 3, 0x0, 0, NO_PAD_CTRL) 116#define MX51_PAD_EIM_CS5__GPIO_2_30 IOMUX_PAD(0x488, 0x0f4, 1, 0x0, 0, NO_PAD_CTRL)
115#define MX51_PAD_GPIO_3_7__NANDF_WP_B IOMUX_PAD(0x4F4, 0x118, 3, 0x0, 0, NO_PAD_CTRL) 117#define MX51_PAD_EIM_DTACK__GPIO_2_31 IOMUX_PAD(0x48c, 0x0f8, 1, 0x0, 0, NO_PAD_CTRL)
116#define MX51_PAD_GPIO_3_8__NANDF_RB0 IOMUX_PAD(0x4F8, 0x11C, 3, 0x0, 0, NO_PAD_CTRL) 118#define MX51_PAD_EIM_LBA__GPIO_3_1 IOMUX_PAD(0x494, 0x0FC, 1, 0x0, 0, NO_PAD_CTRL)
117#define MX51_PAD_GPIO_3_9__NANDF_RB1 IOMUX_PAD(0x4FC, 0x120, 3, 0x0, 0, NO_PAD_CTRL) 119#define MX51_PAD_EIM_CRE__GPIO_3_2 IOMUX_PAD(0x4A0, 0x100, 1, 0x0, 0, NO_PAD_CTRL)
118#define MX51_PAD_GPIO_3_10__NANDF_RB2 IOMUX_PAD(0x500, 0x124, 3, 0x0, 0, NO_PAD_CTRL) 120#define MX51_PAD_DRAM_CS1__DRAM_CS1 IOMUX_PAD(0x4D0, 0x104, 0, 0x0, 0, NO_PAD_CTRL)
119#define MX51_PAD_GPIO_3_11__NANDF_RB3 IOMUX_PAD(0x504, 0x128, 3, 0x0, 0, NO_PAD_CTRL) 121#define MX51_PAD_NANDF_WE_B__GPIO_3_3 IOMUX_PAD(0x4E4, 0x108, 3, 0x0, 0, NO_PAD_CTRL)
120#define MX51_PAD_GPIO_3_12__GPIO_NAND IOMUX_PAD(0x514, 0x12C, 3, 0x0, 0, NO_PAD_CTRL) 122#define MX51_PAD_NANDF_RE_B__GPIO_3_4 IOMUX_PAD(0x4E8, 0x10C, 3, 0x0, 0, NO_PAD_CTRL)
121/* REVISIT: Not sure of these values 123#define MX51_PAD_NANDF_ALE__GPIO_3_5 IOMUX_PAD(0x4EC, 0x110, 3, 0x0, 0, NO_PAD_CTRL)
122 124#define MX51_PAD_NANDF_CLE__GPIO_3_6 IOMUX_PAD(0x4F0, 0x114, 3, 0x0, 0, NO_PAD_CTRL)
123 #define MX51_PAD_GPIO_1___NANDF_RB4 IOMUX_PAD(, , , 0x0, 0, NO_PAD_CTRL) 125#define MX51_PAD_NANDF_WP_B__GPIO_3_7 IOMUX_PAD(0x4F4, 0x118, 3, 0x0, 0, NO_PAD_CTRL)
124 #define MX51_PAD_GPIO_3_13__NANDF_RB5 IOMUX_PAD(0x5D8, 0x130, 3, 0x0, 0, NO_PAD_CTRL) 126#define MX51_PAD_NANDF_RB0__GPIO_3_8 IOMUX_PAD(0x4F8, 0x11C, 3, 0x0, 0, NO_PAD_CTRL)
125 #define MX51_PAD_GPIO_3_15__NANDF_RB7 IOMUX_PAD(0x5E0, 0x138, 3, 0x0, 0, NO_PAD_CTRL) 127#define MX51_PAD_NANDF_RB1__GPIO_3_9 IOMUX_PAD(0x4FC, 0x120, 3, 0x0, 0, NO_PAD_CTRL)
126*/ 128#define MX51_PAD_NANDF_RB2__GPIO_3_10 IOMUX_PAD(0x500, 0x124, 3, 0x0, 0, NO_PAD_CTRL)
127#define MX51_PAD_GPIO_3_14__NANDF_RB6 IOMUX_PAD(0x5DC, 0x134, 3, 0x0, 0, NO_PAD_CTRL) 129#define MX51_PAD_NANDF_RB3__GPIO_3_11 IOMUX_PAD(0x504, 0x128, 3, 0x0, 0, NO_PAD_CTRL)
128#define MX51_PAD_GPIO_3_16__NANDF_CS0 IOMUX_PAD(0x518, 0x130, 3, 0x0, 0, NO_PAD_CTRL) 130#define MX51_PAD_GPIO_NAND__GPIO_3_12 IOMUX_PAD(0x514, 0x12C, 3, 0x0, 0, NO_PAD_CTRL)
129#define MX51_PAD_GPIO_3_17__NANDF_CS1 IOMUX_PAD(0x51C, 0x134, 3, 0x0, 0, NO_PAD_CTRL) 131#define MX51_PAD_NANDF_CS0__GPIO_3_16 IOMUX_PAD(0x518, 0x130, 3, 0x0, 0, NO_PAD_CTRL)
130#define MX51_PAD_GPIO_3_18__NANDF_CS2 IOMUX_PAD(0x520, 0x138, 3, 0x0, 0, NO_PAD_CTRL) 132#define MX51_PAD_NANDF_CS1__GPIO_3_17 IOMUX_PAD(0x51C, 0x134, 3, 0x0, 0, NO_PAD_CTRL)
131#define MX51_PAD_GPIO_3_19__NANDF_CS3 IOMUX_PAD(0x524, 0x13C, 3, 0x0, 0, NO_PAD_CTRL) 133#define MX51_PAD_NANDF_CS2__GPIO_3_18 IOMUX_PAD(0x520, 0x138, 3, 0x0, 0, NO_PAD_CTRL)
132#define MX51_PAD_GPIO_3_20__NANDF_CS4 IOMUX_PAD(0x528, 0x140, 3, 0x0, 0, NO_PAD_CTRL) 134#define MX51_PAD_NANDF_CS3__GPIO_3_19 IOMUX_PAD(0x524, 0x13C, 3, 0x0, 0, NO_PAD_CTRL)
133#define MX51_PAD_GPIO_3_21__NANDF_CS5 IOMUX_PAD(0x52C, 0x144, 3, 0x0, 0, NO_PAD_CTRL) 135#define MX51_PAD_NANDF_CS4__GPIO_3_20 IOMUX_PAD(0x528, 0x140, 3, 0x0, 0, NO_PAD_CTRL)
134#define MX51_PAD_GPIO_3_22__NANDF_CS6 IOMUX_PAD(0x530, 0x148, 3, 0x0, 0, NO_PAD_CTRL) 136#define MX51_PAD_NANDF_CS5__GPIO_3_21 IOMUX_PAD(0x52C, 0x144, 3, 0x0, 0, NO_PAD_CTRL)
135#define MX51_PAD_GPIO_3_23__NANDF_CS7 IOMUX_PAD(0x534, 0x14C, 3, 0x0, 0, NO_PAD_CTRL) 137#define MX51_PAD_NANDF_CS6__GPIO_3_22 IOMUX_PAD(0x530, 0x148, 3, 0x0, 0, NO_PAD_CTRL)
136#define MX51_PAD_GPIO_3_24__NANDF_RDY_INT IOMUX_PAD(0x538, 0x150, 3, 0x0, 0, NO_PAD_CTRL) 138#define MX51_PAD_NANDF_CS7__GPIO_3_23 IOMUX_PAD(0x534, 0x14C, 3, 0x0, 0, NO_PAD_CTRL)
137#define MX51_PAD_GPIO_3_25__NANDF_D15 IOMUX_PAD(0x53C, 0x154, 3, 0x0, 0, NO_PAD_CTRL) 139#define MX51_PAD_NANDF_RDY_INT__GPIO_3_24 IOMUX_PAD(0x538, 0x150, 3, 0x0, 0, NO_PAD_CTRL)
138#define MX51_PAD_GPIO_3_26__NANDF_D14 IOMUX_PAD(0x540, 0x158, 3, 0x0, 0, NO_PAD_CTRL) 140#define MX51_PAD_NANDF_D15__GPIO_3_25 IOMUX_PAD(0x53C, 0x154, 3, 0x0, 0, NO_PAD_CTRL)
139#define MX51_PAD_GPIO_3_27__NANDF_D13 IOMUX_PAD(0x544, 0x15C, 3, 0x0, 0, NO_PAD_CTRL) 141#define MX51_PAD_NANDF_D14__GPIO_3_26 IOMUX_PAD(0x540, 0x158, 3, 0x0, 0, NO_PAD_CTRL)
140#define MX51_PAD_GPIO_3_28__NANDF_D12 IOMUX_PAD(0x548, 0x160, 3, 0x0, 0, NO_PAD_CTRL) 142#define MX51_PAD_NANDF_D13__GPIO_3_27 IOMUX_PAD(0x544, 0x15C, 3, 0x0, 0, NO_PAD_CTRL)
141#define MX51_PAD_GPIO_3_29__NANDF_D11 IOMUX_PAD(0x54C, 0x164, 3, 0x0, 0, NO_PAD_CTRL) 143#define MX51_PAD_NANDF_D12__GPIO_3_28 IOMUX_PAD(0x548, 0x160, 3, 0x0, 0, NO_PAD_CTRL)
142#define MX51_PAD_GPIO_3_30__NANDF_D10 IOMUX_PAD(0x550, 0x168, 3, 0x0, 0, NO_PAD_CTRL) 144#define MX51_PAD_NANDF_D11__GPIO_3_29 IOMUX_PAD(0x54C, 0x164, 3, 0x0, 0, NO_PAD_CTRL)
143#define MX51_PAD_GPIO_3_31__NANDF_D9 IOMUX_PAD(0x554, 0x16C, 3, 0x0, 0, NO_PAD_CTRL) 145#define MX51_PAD_NANDF_D10__GPIO_3_30 IOMUX_PAD(0x550, 0x168, 3, 0x0, 0, NO_PAD_CTRL)
144#define MX51_PAD_GPIO_4_0__NANDF_D8 IOMUX_PAD(0x558, 0x170, 3, 0x0, 0, NO_PAD_CTRL) 146#define MX51_PAD_NANDF_D9__GPIO_3_31 IOMUX_PAD(0x554, 0x16C, 3, 0x0, 0, NO_PAD_CTRL)
145#define MX51_PAD_GPIO_4_1__NANDF_D7 IOMUX_PAD(0x55C, 0x174, 3, 0x0, 0, NO_PAD_CTRL) 147#define MX51_PAD_NANDF_D8__GPIO_4_0 IOMUX_PAD(0x558, 0x170, 3, 0x0, 0, NO_PAD_CTRL)
146#define MX51_PAD_GPIO_4_2__NANDF_D6 IOMUX_PAD(0x560, 0x178, 3, 0x0, 0, NO_PAD_CTRL) 148#define MX51_PAD_NANDF_D7__GPIO_4_1 IOMUX_PAD(0x55C, 0x174, 3, 0x0, 0, NO_PAD_CTRL)
147#define MX51_PAD_GPIO_4_3__NANDF_D5 IOMUX_PAD(0x564, 0x17C, 3, 0x0, 0, NO_PAD_CTRL) 149#define MX51_PAD_NANDF_D6__GPIO_4_2 IOMUX_PAD(0x560, 0x178, 3, 0x0, 0, NO_PAD_CTRL)
148#define MX51_PAD_GPIO_4_4__NANDF_D4 IOMUX_PAD(0x568, 0x180, 3, 0x0, 0, NO_PAD_CTRL) 150#define MX51_PAD_NANDF_D5__GPIO_4_3 IOMUX_PAD(0x564, 0x17C, 3, 0x0, 0, NO_PAD_CTRL)
149#define MX51_PAD_GPIO_4_5__NANDF_D3 IOMUX_PAD(0x56C, 0x184, 3, 0x0, 0, NO_PAD_CTRL) 151#define MX51_PAD_NANDF_D4__GPIO_4_4 IOMUX_PAD(0x568, 0x180, 3, 0x0, 0, NO_PAD_CTRL)
150#define MX51_PAD_GPIO_4_6__NANDF_D2 IOMUX_PAD(0x570, 0x188, 3, 0x0, 0, NO_PAD_CTRL) 152#define MX51_PAD_NANDF_D3__GPIO_4_5 IOMUX_PAD(0x56C, 0x184, 3, 0x0, 0, NO_PAD_CTRL)
151#define MX51_PAD_GPIO_4_7__NANDF_D1 IOMUX_PAD(0x574, 0x18C, 3, 0x0, 0, NO_PAD_CTRL) 153#define MX51_PAD_NANDF_D2__GPIO_4_6 IOMUX_PAD(0x570, 0x188, 3, 0x0, 0, NO_PAD_CTRL)
152#define MX51_PAD_GPIO_4_8__NANDF_D0 IOMUX_PAD(0x578, 0x190, 3, 0x0, 0, NO_PAD_CTRL) 154#define MX51_PAD_NANDF_D1__GPIO_4_7 IOMUX_PAD(0x574, 0x18C, 3, 0x0, 0, NO_PAD_CTRL)
153#define MX51_PAD_GPIO_3_12__CSI1_D8 IOMUX_PAD(0x57C, 0x194, 3, 0x0, 0, NO_PAD_CTRL) 155#define MX51_PAD_NANDF_D0__GPIO_4_8 IOMUX_PAD(0x578, 0x190, 3, 0x0, 0, NO_PAD_CTRL)
154#define MX51_PAD_GPIO_3_13__CSI1_D9 IOMUX_PAD(0x580, 0x198, 3, 0x0, 0, NO_PAD_CTRL) 156#define MX51_PAD_CSI1_D8__GPIO_3_12 IOMUX_PAD(0x57C, 0x194, 3, 0x0, 0, NO_PAD_CTRL)
155#define MX51_PAD_CSI1_D10__CSI1_D10 IOMUX_PAD(0x584, 0x19C, 0, 0x0, 0, NO_PAD_CTRL) 157#define MX51_PAD_CSI1_D9__GPIO_3_13 IOMUX_PAD(0x580, 0x198, 3, 0x0, 0, NO_PAD_CTRL)
156#define MX51_PAD_CSI1_D11__CSI1_D11 IOMUX_PAD(0x588, 0x1A0, 0, 0x0, 0, NO_PAD_CTRL) 158#define MX51_PAD_CSI1_D10__CSI1_D10 IOMUX_PAD(0x584, 0x19C, 0, 0x0, 0, NO_PAD_CTRL)
157#define MX51_PAD_CSI1_D12__CSI1_D12 IOMUX_PAD(0x58C, 0x1A4, 0, 0x0, 0, NO_PAD_CTRL) 159#define MX51_PAD_CSI1_D11__CSI1_D11 IOMUX_PAD(0x588, 0x1A0, 0, 0x0, 0, NO_PAD_CTRL)
158#define MX51_PAD_CSI1_D13__CSI1_D13 IOMUX_PAD(0x590, 0x1A8, 0, 0x0, 0, NO_PAD_CTRL) 160#define MX51_PAD_CSI1_D12__CSI1_D12 IOMUX_PAD(0x58C, 0x1A4, 0, 0x0, 0, NO_PAD_CTRL)
159#define MX51_PAD_CSI1_D14__CSI1_D14 IOMUX_PAD(0x594, 0x1AC, 0, 0x0, 0, NO_PAD_CTRL) 161#define MX51_PAD_CSI1_D13__CSI1_D13 IOMUX_PAD(0x590, 0x1A8, 0, 0x0, 0, NO_PAD_CTRL)
160#define MX51_PAD_CSI1_D15__CSI1_D15 IOMUX_PAD(0x598, 0x1B0, 0, 0x0, 0, NO_PAD_CTRL) 162#define MX51_PAD_CSI1_D14__CSI1_D14 IOMUX_PAD(0x594, 0x1AC, 0, 0x0, 0, NO_PAD_CTRL)
161#define MX51_PAD_CSI1_D16__CSI1_D16 IOMUX_PAD(0x59C, 0x1B4, 0, 0x0, 0, NO_PAD_CTRL) 163#define MX51_PAD_CSI1_D15__CSI1_D15 IOMUX_PAD(0x598, 0x1B0, 0, 0x0, 0, NO_PAD_CTRL)
162#define MX51_PAD_CSI1_D17__CSI1_D17 IOMUX_PAD(0x5A0, 0x1B8, 0, 0x0, 0, NO_PAD_CTRL) 164#define MX51_PAD_CSI1_D16__CSI1_D16 IOMUX_PAD(0x59C, 0x1B4, 0, 0x0, 0, NO_PAD_CTRL)
163#define MX51_PAD_CSI1_D18__CSI1_D18 IOMUX_PAD(0x5A4, 0x1BC, 0, 0x0, 0, NO_PAD_CTRL) 165#define MX51_PAD_CSI1_D17__CSI1_D17 IOMUX_PAD(0x5A0, 0x1B8, 0, 0x0, 0, NO_PAD_CTRL)
164#define MX51_PAD_CSI1_D19__CSI1_D19 IOMUX_PAD(0x5A8, 0x1C0, 0, 0x0, 0, NO_PAD_CTRL) 166#define MX51_PAD_CSI1_D18__CSI1_D18 IOMUX_PAD(0x5A4, 0x1BC, 0, 0x0, 0, NO_PAD_CTRL)
165#define MX51_PAD_CSI1_VSYNC__CSI1_VSYNC IOMUX_PAD(0x5AC, 0x1C4, 0, 0x0, 0, NO_PAD_CTRL) 167#define MX51_PAD_CSI1_D19__CSI1_D19 IOMUX_PAD(0x5A8, 0x1C0, 0, 0x0, 0, NO_PAD_CTRL)
166#define MX51_PAD_CSI1_HSYNC__CSI1_HSYNC IOMUX_PAD(0x5B0, 0x1C8, 0, 0x0, 0, NO_PAD_CTRL) 168#define MX51_PAD_CSI1_VSYNC__CSI1_VSYNC IOMUX_PAD(0x5AC, 0x1C4, 0, 0x0, 0, NO_PAD_CTRL)
167#define MX51_PAD_CSI1_PIXCLK__CSI1_PIXCLK IOMUX_PAD(0x5B4, 0x0, 0, 0x0, 0, NO_PAD_CTRL) 169#define MX51_PAD_CSI1_HSYNC__CSI1_HSYNC IOMUX_PAD(0x5B0, 0x1C8, 0, 0x0, 0, NO_PAD_CTRL)
168#define MX51_PAD_CSI1_MCLK__CSI1_MCLK IOMUX_PAD(0x5B8, 0x0, 0, 0x0, 0, NO_PAD_CTRL) 170#define MX51_PAD_CSI1_PIXCLK__CSI1_PIXCLK IOMUX_PAD(0x5B4, 0x000, 0, 0x0, 0, NO_PAD_CTRL)
169#define MX51_PAD_CSI1_PKE0__CSI1_PKE0 IOMUX_PAD(0x860, 0x0, 0, 0x0, 0, NO_PAD_CTRL) 171#define MX51_PAD_CSI1_MCLK__CSI1_MCLK IOMUX_PAD(0x5B8, 0x000, 0, 0x0, 0, NO_PAD_CTRL)
170#define MX51_PAD_GPIO_4_9__CSI2_D12 IOMUX_PAD(0x5BC, 0x1CC, 3, 0x0, 0, NO_PAD_CTRL) 172#define MX51_PAD_CSI1_PKE0__CSI1_PKE0 IOMUX_PAD(0x860, 0x000, 0, 0x0, 0, NO_PAD_CTRL)
171#define MX51_PAD_GPIO_4_10__CSI2_D13 IOMUX_PAD(0x5C0, 0x1D0, 3, 0x0, 0, NO_PAD_CTRL) 173#define MX51_PAD_CSI2_D12__GPIO_4_9 IOMUX_PAD(0x5BC, 0x1CC, 3, 0x0, 0, NO_PAD_CTRL)
172#define MX51_PAD_GPIO_4_11__CSI2_D14 IOMUX_PAD(0x5C4, 0x1D4, 3, 0x0, 0, NO_PAD_CTRL) 174#define MX51_PAD_CSI2_D13__GPIO_4_10 IOMUX_PAD(0x5C0, 0x1D0, 3, 0x0, 0, NO_PAD_CTRL)
173#define MX51_PAD_GPIO_4_12__CSI2_D15 IOMUX_PAD(0x5C8, 0x1D8, 3, 0x0, 0, NO_PAD_CTRL) 175#define MX51_PAD_CSI2_D14__GPIO_4_11 IOMUX_PAD(0x5C4, 0x1D4, 3, 0x0, 0, NO_PAD_CTRL)
174#define MX51_PAD_GPIO_4_11__CSI2_D16 IOMUX_PAD(0x5CC, 0x1DC, 3, 0x0, 0, NO_PAD_CTRL) 176#define MX51_PAD_CSI2_D15__GPIO_4_12 IOMUX_PAD(0x5C8, 0x1D8, 3, 0x0, 0, NO_PAD_CTRL)
175#define MX51_PAD_GPIO_4_12__CSI2_D17 IOMUX_PAD(0x5D0, 0x1E0, 3, 0x0, 0, NO_PAD_CTRL) 177#define MX51_PAD_CSI2_D16__GPIO_4_11 IOMUX_PAD(0x5CC, 0x1DC, 3, 0x0, 0, NO_PAD_CTRL)
176#define MX51_PAD_GPIO_4_11__CSI2_D18 IOMUX_PAD(0x5D4, 0x1E4, 3, 0x0, 0, NO_PAD_CTRL) 178#define MX51_PAD_CSI2_D17__GPIO_4_12 IOMUX_PAD(0x5D0, 0x1E0, 3, 0x0, 0, NO_PAD_CTRL)
177#define MX51_PAD_GPIO_4_12__CSI2_D19 IOMUX_PAD(0x5D8, 0x1E8, 3, 0x0, 0, NO_PAD_CTRL) 179#define MX51_PAD_CSI2_D18__GPIO_4_11 IOMUX_PAD(0x5D4, 0x1E4, 3, 0x0, 0, NO_PAD_CTRL)
178#define MX51_PAD_GPIO_4_13__CSI2_VSYNC IOMUX_PAD(0x5DC, 0x1EC, 3, 0x0, 0, NO_PAD_CTRL) 180#define MX51_PAD_CSI2_D19__GPIO_4_12 IOMUX_PAD(0x5D8, 0x1E8, 3, 0x0, 0, NO_PAD_CTRL)
179#define MX51_PAD_GPIO_4_14__CSI2_HSYNC IOMUX_PAD(0x5E0, 0x1F0, 3, 0x0, 0, NO_PAD_CTRL) 181#define MX51_PAD_CSI2_VSYNC__GPIO_4_13 IOMUX_PAD(0x5DC, 0x1EC, 3, 0x0, 0, NO_PAD_CTRL)
180#define MX51_PAD_GPIO_4_15__CSI2_PIXCLK IOMUX_PAD(0x5E4, 0x1F4, 3, 0x0, 0, NO_PAD_CTRL) 182#define MX51_PAD_CSI2_HSYNC__GPIO_4_14 IOMUX_PAD(0x5E0, 0x1F0, 3, 0x0, 0, NO_PAD_CTRL)
181#define MX51_PAD_CSI2_PKE0__CSI2_PKE0 IOMUX_PAD(0x81C, 0x0, 0, 0x0, 0, NO_PAD_CTRL) 183#define MX51_PAD_CSI2_PIXCLK__GPIO_4_15 IOMUX_PAD(0x5E4, 0x1F4, 3, 0x0, 0, NO_PAD_CTRL)
182#define MX51_PAD_GPIO_4_16__I2C1_CLK IOMUX_PAD(0x5E8, 0x1F8, 3, 0x0, 0, NO_PAD_CTRL) 184#define MX51_PAD_I2C1_CLK__GPIO_4_16 IOMUX_PAD(0x5E8, 0x1F8, 3, 0x0, 0, NO_PAD_CTRL)
183#define MX51_PAD_GPIO_4_17__I2C1_DAT IOMUX_PAD(0x5EC, 0x1FC, 3, 0x0, 0, NO_PAD_CTRL) 185#define MX51_PAD_I2C1_CLK__HSI2C_CLK IOMUX_PAD(0x5E8, 0x1F8, 0, 0x0, 0, NO_PAD_CTRL)
184#define MX51_PAD_GPIO_4_18__AUD3_BB_TXD IOMUX_PAD(0x5F0, 0x200, 3, 0x0, 0, NO_PAD_CTRL) 186#define MX51_PAD_I2C1_DAT__GPIO_4_17 IOMUX_PAD(0x5EC, 0x1FC, 3, 0x0, 0, NO_PAD_CTRL)
185#define MX51_PAD_GPIO_4_19__AUD3_BB_RXD IOMUX_PAD(0x5F4, 0x204, 3, 0x0, 0, NO_PAD_CTRL) 187#define MX51_PAD_I2C1_DAT__HSI2C_DAT IOMUX_PAD(0x5EC, 0x1FC, 0, 0x0, 0, NO_PAD_CTRL)
186#define MX51_PAD_GPIO_4_20__AUD3_BB_CK IOMUX_PAD(0x5F8, 0x208, 3, 0x0, 0, NO_PAD_CTRL) 188#define MX51_PAD_AUD3_BB_TXD__GPIO_4_18 IOMUX_PAD(0x5F0, 0x200, 3, 0x0, 0, NO_PAD_CTRL)
187#define MX51_PAD_GPIO_4_21__AUD3_BB_FS IOMUX_PAD(0x5FC, 0x20C, 3, 0x0, 0, NO_PAD_CTRL) 189#define MX51_PAD_AUD3_BB_RXD__GPIO_4_19 IOMUX_PAD(0x5F4, 0x204, 3, 0x0, 0, NO_PAD_CTRL)
188#define MX51_PAD_GPIO_4_22__CSPI1_MOSI IOMUX_PAD(0x600, 0x210, 3, 0x0, 0, NO_PAD_CTRL) 190#define MX51_PAD_AUD3_BB_CK__GPIO_4_20 IOMUX_PAD(0x5F8, 0x208, 3, 0x0, 0, NO_PAD_CTRL)
189#define MX51_PAD_GPIO_4_23__CSPI1_MISO IOMUX_PAD(0x604, 0x214, 3, 0x0, 0, NO_PAD_CTRL) 191#define MX51_PAD_AUD3_BB_FS__GPIO_4_21 IOMUX_PAD(0x5FC, 0x20C, 3, 0x0, 0, NO_PAD_CTRL)
190#define MX51_PAD_GPIO_4_24__CSPI1_SS0 IOMUX_PAD(0x608, 0x218, 3, 0x0, 0, NO_PAD_CTRL) 192#define MX51_PAD_CSPI1_MOSI__GPIO_4_22 IOMUX_PAD(0x600, 0x210, 3, 0x0, 0, NO_PAD_CTRL)
191#define MX51_PAD_GPIO_4_25__CSPI1_SS1 IOMUX_PAD(0x60C, 0x21C, 3, 0x0, 0, NO_PAD_CTRL) 193#define MX51_PAD_CSPI1_MISO__GPIO_4_23 IOMUX_PAD(0x604, 0x214, 3, 0x0, 0, NO_PAD_CTRL)
192#define MX51_PAD_GPIO_4_26__CSPI1_RDY IOMUX_PAD(0x610, 0x220, 3, 0x0, 0, NO_PAD_CTRL) 194#define MX51_PAD_CSPI1_SS0__GPIO_4_24 IOMUX_PAD(0x608, 0x218, 3, 0x0, 0, NO_PAD_CTRL)
193#define MX51_PAD_GPIO_4_27__CSPI1_SCLK IOMUX_PAD(0x614, 0x224, 3, 0x0, 0, NO_PAD_CTRL) 195#define MX51_PAD_CSPI1_SS1__GPIO_4_25 IOMUX_PAD(0x60C, 0x21C, 3, 0x0, 0, NO_PAD_CTRL)
194 196#define MX51_PAD_CSPI1_RDY__GPIO_4_26 IOMUX_PAD(0x610, 0x220, 3, 0x0, 0, NO_PAD_CTRL)
195/* Babbage UART1 */ 197#define MX51_PAD_CSPI1_SCLK__GPIO_4_27 IOMUX_PAD(0x614, 0x224, 3, 0x0, 0, NO_PAD_CTRL)
196#define MX51_PAD_UART1_RXD__UART1_RXD IOMUX_PAD(0x618, 0x228, IOMUX_CONFIG_ALT0, 0x9e4, 0, MX51_UART1_PAD_CTRL | PAD_CTL_SRE_FAST) 198#define MX51_PAD_UART1_RXD__UART1_RXD IOMUX_PAD(0x618, 0x228, 0, 0x9e4, 0, MX51_UART1_PAD_CTRL | PAD_CTL_SRE_FAST)
197#define MX51_PAD_UART1_TXD__UART1_TXD IOMUX_PAD(0x61C, 0x22C, IOMUX_CONFIG_ALT0, 0x0, 0, MX51_UART1_PAD_CTRL | PAD_CTL_SRE_FAST) 199#define MX51_PAD_UART1_TXD__UART1_TXD IOMUX_PAD(0x61C, 0x22C, 0, 0x0, 0, MX51_UART1_PAD_CTRL | PAD_CTL_SRE_FAST)
198#define MX51_PAD_UART1_RTS__UART1_RTS IOMUX_PAD(0x620, 0x230, IOMUX_CONFIG_ALT0, 0x9e0, 0, MX51_UART1_PAD_CTRL) 200#define MX51_PAD_UART1_RTS__UART1_RTS IOMUX_PAD(0x620, 0x230, 0, 0x9e0, 0, MX51_UART1_PAD_CTRL)
199#define MX51_PAD_UART1_CTS__UART1_CTS IOMUX_PAD(0x624, 0x234, IOMUX_CONFIG_ALT0, 0x0, 0, MX51_UART1_PAD_CTRL) 201#define MX51_PAD_UART1_CTS__UART1_CTS IOMUX_PAD(0x624, 0x234, 0, 0x0, 0, MX51_UART1_PAD_CTRL)
200 202#define MX51_PAD_UART2_RXD__UART2_RXD IOMUX_PAD(0x628, 0x238, 0, 0x9ec, 2, MX51_UART2_PAD_CTRL)
201/* Babbage UART2 */ 203#define MX51_PAD_UART2_TXD__UART2_TXD IOMUX_PAD(0x62C, 0x23C, 0, 0x0, 0, MX51_UART2_PAD_CTRL)
202#define MX51_PAD_UART2_RXD__UART2_RXD IOMUX_PAD(0x628, 0x238, IOMUX_CONFIG_ALT0, 0x9ec, 2, MX51_UART2_PAD_CTRL) 204#define MX51_PAD_UART3_RXD__UART3_RXD IOMUX_PAD(0x630, 0x240, 1, 0x9f4, 4, MX51_UART3_PAD_CTRL)
203#define MX51_PAD_UART2_TXD__UART2_TXD IOMUX_PAD(0x62C, 0x23C, IOMUX_CONFIG_ALT0, 0x0, 0, MX51_UART2_PAD_CTRL) 205#define MX51_PAD_UART3_RXD__GPIO_1_22 IOMUX_PAD(0x630, 0x240, 3, 0x0, 0, NO_PAD_CTRL)
204 206#define MX51_PAD_UART3_TXD__UART3_TXD IOMUX_PAD(0x634, 0x244, 1, 0x0, 0, MX51_UART3_PAD_CTRL)
205#define MX51_PAD_GPIO_1_22__UART3_RXD IOMUX_PAD(0x630, 0x240, 3, 0x0, 0, NO_PAD_CTRL) 207#define MX51_PAD_UART3_TXD__GPIO_1_23 IOMUX_PAD(0x634, 0x244, 3, 0x0, 0, NO_PAD_CTRL)
206#define MX51_PAD_GPIO_1_23__UART3_TXD IOMUX_PAD(0x634, 0x244, 3, 0x0, 0, NO_PAD_CTRL) 208#define MX51_PAD_OWIRE_LINE__GPIO_1_24 IOMUX_PAD(0x638, 0x248, 3, 0x0, 0, NO_PAD_CTRL)
207#define MX51_PAD_GPIO_1_24__OWIRE_LINE IOMUX_PAD(0x638, 0x248, 3, 0x0, 0, NO_PAD_CTRL) 209#define MX51_PAD_KEY_ROW0__KEY_ROW0 IOMUX_PAD(0x63C, 0x24C, 0, 0x0, 0, NO_PAD_CTRL)
208#define MX51_PAD_KEY_ROW0__KEY_ROW0 IOMUX_PAD(0x63C, 0x24C, 0, 0x0, 0, NO_PAD_CTRL) 210#define MX51_PAD_KEY_ROW1__KEY_ROW1 IOMUX_PAD(0x640, 0x250, 0, 0x0, 0, NO_PAD_CTRL)
209#define MX51_PAD_KEY_ROW1__KEY_ROW1 IOMUX_PAD(0x640, 0x250, 0, 0x0, 0, NO_PAD_CTRL) 211#define MX51_PAD_KEY_ROW2__KEY_ROW2 IOMUX_PAD(0x644, 0x254, 0, 0x0, 0, NO_PAD_CTRL)
210#define MX51_PAD_KEY_ROW2__KEY_ROW2 IOMUX_PAD(0x644, 0x254, 0, 0x0, 0, NO_PAD_CTRL) 212#define MX51_PAD_KEY_ROW3__KEY_ROW3 IOMUX_PAD(0x648, 0x258, 0, 0x0, 0, NO_PAD_CTRL)
211#define MX51_PAD_KEY_ROW3__KEY_ROW3 IOMUX_PAD(0x648, 0x258, 0, 0x0, 0, NO_PAD_CTRL) 213#define MX51_PAD_KEY_COL0__KEY_COL0 IOMUX_PAD(0x64C, 0x25C, 0, 0x0, 0, NO_PAD_CTRL)
212#define MX51_PAD_KEY_COL0__KEY_COL0 IOMUX_PAD(0x64C, 0x25C, 0, 0x0, 0, NO_PAD_CTRL) 214#define MX51_PAD_KEY_COL1__KEY_COL1 IOMUX_PAD(0x650, 0x260, 0, 0x0, 0, NO_PAD_CTRL)
213#define MX51_PAD_KEY_COL1__KEY_COL1 IOMUX_PAD(0x650, 0x260, 0, 0x0, 0, NO_PAD_CTRL) 215#define MX51_PAD_KEY_COL2__KEY_COL2 IOMUX_PAD(0x654, 0x264, 0, 0x0, 0, NO_PAD_CTRL)
214#define MX51_PAD_KEY_COL2__KEY_COL2 IOMUX_PAD(0x654, 0x264, 0, 0x0, 0, NO_PAD_CTRL) 216#define MX51_PAD_KEY_COL3__KEY_COL3 IOMUX_PAD(0x658, 0x268, 0, 0x0, 0, NO_PAD_CTRL)
215#define MX51_PAD_KEY_COL3__KEY_COL3 IOMUX_PAD(0x658, 0x268, 0, 0x0, 0, NO_PAD_CTRL) 217#define MX51_PAD_KEY_COL4__KEY_COL4 IOMUX_PAD(0x65C, 0x26C, 0, 0x0, 0, NO_PAD_CTRL)
216#define MX51_PAD_KEY_COL4__KEY_COL4 IOMUX_PAD(0x65C, 0x26C, 0, 0x0, 0, NO_PAD_CTRL) 218#define MX51_PAD_KEY_COL4__UART3_RTS IOMUX_PAD(0x65C, 0x26C, 2, 0x9f0, 4, MX51_UART3_PAD_CTRL)
217#define MX51_PAD_KEY_COL5__KEY_COL5 IOMUX_PAD(0x660, 0x270, 0, 0x0, 0, NO_PAD_CTRL) 219#define MX51_PAD_KEY_COL4__I2C2_SCL IOMUX_PAD(0x65C, 0x26C, (3 | IOMUX_CONFIG_SION), \
218#define MX51_PAD_USBH1_CLK__USBH1_CLK IOMUX_PAD(0x678, 0x278, IOMUX_CONFIG_ALT0, 0x0, 0, MX51_USBH1_PAD_CTRL) 220 0x09b8, 1, MX51_I2C_PAD_CTRL)
219#define MX51_PAD_USBH1_DIR__USBH1_DIR IOMUX_PAD(0x67C, 0x27C, IOMUX_CONFIG_ALT0, 0x0, 0, MX51_USBH1_PAD_CTRL) 221#define MX51_PAD_KEY_COL5__KEY_COL5 IOMUX_PAD(0x660, 0x270, 0, 0x0, 0, NO_PAD_CTRL)
220#define MX51_PAD_USBH1_STP__USBH1_STP IOMUX_PAD(0x680, 0x280, IOMUX_CONFIG_ALT0, 0x0, 0, MX51_USBH1_PAD_CTRL) 222#define MX51_PAD_KEY_COL5__UART3_CTS IOMUX_PAD(0x660, 0x270, 2, 0, 0, MX51_UART3_PAD_CTRL)
221#define MX51_PAD_USBH1_STP__GPIO_1_27 IOMUX_PAD(0x680, 0x280, IOMUX_CONFIG_GPIO, 0x0, 0, MX51_USBH1_PAD_CTRL) 223#define MX51_PAD_KEY_COL5__I2C2_SDA IOMUX_PAD(0x660, 0x270, (3 | IOMUX_CONFIG_SION), \
222#define MX51_PAD_USBH1_NXT__USBH1_NXT IOMUX_PAD(0x684, 0x284, IOMUX_CONFIG_ALT0, 0x0, 0, MX51_USBH1_PAD_CTRL) 224 0x09bc, 1, MX51_I2C_PAD_CTRL)
223#define MX51_PAD_USBH1_DATA0__USBH1_DATA0 IOMUX_PAD(0x688, 0x288, IOMUX_CONFIG_ALT0, 0x0, 0, MX51_USBH1_PAD_CTRL) 225#define MX51_PAD_USBH1_CLK__USBH1_CLK IOMUX_PAD(0x678, 0x278, 0, 0x0, 0, MX51_USBH1_PAD_CTRL)
224#define MX51_PAD_USBH1_DATA1__USBH1_DATA1 IOMUX_PAD(0x68C, 0x28C, IOMUX_CONFIG_ALT0, 0x0, 0, MX51_USBH1_PAD_CTRL) 226#define MX51_PAD_USBH1_DIR__USBH1_DIR IOMUX_PAD(0x67C, 0x27C, 0, 0x0, 0, MX51_USBH1_PAD_CTRL)
225#define MX51_PAD_USBH1_DATA2__USBH1_DATA2 IOMUX_PAD(0x690, 0x290, IOMUX_CONFIG_ALT0, 0x0, 0, MX51_USBH1_PAD_CTRL) 227#define MX51_PAD_USBH1_STP__USBH1_STP IOMUX_PAD(0x680, 0x280, 0, 0x0, 0, MX51_USBH1_PAD_CTRL)
226#define MX51_PAD_USBH1_DATA3__USBH1_DATA3 IOMUX_PAD(0x694, 0x294, IOMUX_CONFIG_ALT0, 0x0, 0, MX51_USBH1_PAD_CTRL) 228#define MX51_PAD_USBH1_STP__GPIO_1_27 IOMUX_PAD(0x680, 0x280, 2, 0x0, 0, MX51_USBH1_PAD_CTRL)
227#define MX51_PAD_USBH1_DATA4__USBH1_DATA4 IOMUX_PAD(0x698, 0x298, IOMUX_CONFIG_ALT0, 0x0, 0, MX51_USBH1_PAD_CTRL) 229#define MX51_PAD_USBH1_NXT__USBH1_NXT IOMUX_PAD(0x684, 0x284, 0, 0x0, 0, MX51_USBH1_PAD_CTRL)
228#define MX51_PAD_USBH1_DATA5__USBH1_DATA5 IOMUX_PAD(0x69C, 0x29C, IOMUX_CONFIG_ALT0, 0x0, 0, MX51_USBH1_PAD_CTRL) 230#define MX51_PAD_USBH1_DATA0__USBH1_DATA0 IOMUX_PAD(0x688, 0x288, 0, 0x0, 0, MX51_USBH1_PAD_CTRL)
229#define MX51_PAD_USBH1_DATA6__USBH1_DATA6 IOMUX_PAD(0x6A0, 0x2A0, IOMUX_CONFIG_ALT0, 0x0, 0, MX51_USBH1_PAD_CTRL) 231#define MX51_PAD_USBH1_DATA1__USBH1_DATA1 IOMUX_PAD(0x68C, 0x28C, 0, 0x0, 0, MX51_USBH1_PAD_CTRL)
230#define MX51_PAD_USBH1_DATA7__USBH1_DATA7 IOMUX_PAD(0x6A4, 0x2A4, IOMUX_CONFIG_ALT0, 0x0, 0, MX51_USBH1_PAD_CTRL) 232#define MX51_PAD_USBH1_DATA2__USBH1_DATA2 IOMUX_PAD(0x690, 0x290, 0, 0x0, 0, MX51_USBH1_PAD_CTRL)
231#define MX51_PAD_GPIO_3_0__DI1_PIN11 IOMUX_PAD(0x6A8, 0x2A8, 4, 0x0, 0, NO_PAD_CTRL) 233#define MX51_PAD_USBH1_DATA3__USBH1_DATA3 IOMUX_PAD(0x694, 0x294, 0, 0x0, 0, MX51_USBH1_PAD_CTRL)
232#define MX51_PAD_GPIO_3_1__DI1_PIN12 IOMUX_PAD(0x6AC, 0x2AC, 4, 0x0, 0, NO_PAD_CTRL) 234#define MX51_PAD_USBH1_DATA4__USBH1_DATA4 IOMUX_PAD(0x698, 0x298, 0, 0x0, 0, MX51_USBH1_PAD_CTRL)
233#define MX51_PAD_GPIO_3_2__DI1_PIN13 IOMUX_PAD(0x6B0, 0x2B0, 4, 0x0, 0, NO_PAD_CTRL) 235#define MX51_PAD_USBH1_DATA5__USBH1_DATA5 IOMUX_PAD(0x69C, 0x29C, 0, 0x0, 0, MX51_USBH1_PAD_CTRL)
234#define MX51_PAD_GPIO_3_3__DI1_D0_CS IOMUX_PAD(0x6B4, 0x2B4, 4, 0x0, 0, NO_PAD_CTRL) 236#define MX51_PAD_USBH1_DATA6__USBH1_DATA6 IOMUX_PAD(0x6A0, 0x2A0, 0, 0x0, 0, MX51_USBH1_PAD_CTRL)
235#define MX51_PAD_GPIO_3_4__DI1_D1_CS IOMUX_PAD(0x6B8, 0x2B8, 4, 0x0, 0, NO_PAD_CTRL) 237#define MX51_PAD_USBH1_DATA7__USBH1_DATA7 IOMUX_PAD(0x6A4, 0x2A4, 0, 0x0, 0, MX51_USBH1_PAD_CTRL)
236#define MX51_PAD_GPIO_3_5__DISPB2_SER_DIN IOMUX_PAD(0x6BC, 0x2BC, 4, 0x0, 0, NO_PAD_CTRL) 238#define MX51_PAD_DI1_PIN11__GPIO_3_0 IOMUX_PAD(0x6A8, 0x2A8, 4, 0x0, 0, NO_PAD_CTRL)
237#define MX51_PAD_GPIO_3_6__DISPB2_SER_DIO IOMUX_PAD(0x6C0, 0x2C0, 4, 0x0, 0, NO_PAD_CTRL) 239#define MX51_PAD_DI1_PIN12__GPIO_3_1 IOMUX_PAD(0x6AC, 0x2AC, 4, 0x0, 0, NO_PAD_CTRL)
238#define MX51_PAD_GPIO_3_7__DISPB2_SER_CLK IOMUX_PAD(0x6C4, 0x2C4, 4, 0x0, 0, NO_PAD_CTRL) 240#define MX51_PAD_DI1_PIN13__GPIO_3_2 IOMUX_PAD(0x6B0, 0x2B0, 4, 0x0, 0, NO_PAD_CTRL)
239#define MX51_PAD_GPIO_3_8__DISPB2_SER_RS IOMUX_PAD(0x6C8, 0x2C8, 4, 0x0, 0, NO_PAD_CTRL) 241#define MX51_PAD_DI1_D0_CS__GPIO_3_3 IOMUX_PAD(0x6B4, 0x2B4, 4, 0x0, 0, NO_PAD_CTRL)
240#define MX51_PAD_DISP1_DAT0__DISP1_DAT0 IOMUX_PAD(0x6CC, 0x2CC, 0, 0x0, 0, NO_PAD_CTRL) 242#define MX51_PAD_DI1_D1_CS__GPIO_3_4 IOMUX_PAD(0x6B8, 0x2B8, 4, 0x0, 0, NO_PAD_CTRL)
241#define MX51_PAD_DISP1_DAT1__DISP1_DAT1 IOMUX_PAD(0x6D0, 0x2D0, 0, 0x0, 0, NO_PAD_CTRL) 243#define MX51_PAD_DISPB2_SER_DIN__GPIO_3_5 IOMUX_PAD(0x6BC, 0x2BC, 4, 0x0, 0, NO_PAD_CTRL)
242#define MX51_PAD_DISP1_DAT2__DISP1_DAT2 IOMUX_PAD(0x6D4, 0x2D4, 0, 0x0, 0, NO_PAD_CTRL) 244#define MX51_PAD_DISPB2_SER_DIO__GPIO_3_6 IOMUX_PAD(0x6C0, 0x2C0, 4, 0x0, 0, NO_PAD_CTRL)
243#define MX51_PAD_DISP1_DAT3__DISP1_DAT3 IOMUX_PAD(0x6D8, 0x2D8, 0, 0x0, 0, NO_PAD_CTRL) 245#define MX51_PAD_DISPB2_SER_CLK__GPIO_3_7 IOMUX_PAD(0x6C4, 0x2C4, 4, 0x0, 0, NO_PAD_CTRL)
244#define MX51_PAD_DISP1_DAT4__DISP1_DAT4 IOMUX_PAD(0x6DC, 0x2DC, 0, 0x0, 0, NO_PAD_CTRL) 246#define MX51_PAD_DISPB2_SER_RS__GPIO_3_8 IOMUX_PAD(0x6C8, 0x2C8, 4, 0x0, 0, NO_PAD_CTRL)
245#define MX51_PAD_DISP1_DAT5__DISP1_DAT5 IOMUX_PAD(0x6E0, 0x2E0, 0, 0x0, 0, NO_PAD_CTRL) 247#define MX51_PAD_DISP1_DAT0__DISP1_DAT0 IOMUX_PAD(0x6CC, 0x2CC, 0, 0x0, 0, NO_PAD_CTRL)
246#define MX51_PAD_DISP1_DAT6__DISP1_DAT6 IOMUX_PAD(0x6E4, 0x2E4, 0, 0x0, 0, NO_PAD_CTRL) 248#define MX51_PAD_DISP1_DAT1__DISP1_DAT1 IOMUX_PAD(0x6D0, 0x2D0, 0, 0x0, 0, NO_PAD_CTRL)
247#define MX51_PAD_DISP1_DAT7__DISP1_DAT7 IOMUX_PAD(0x6E8, 0x2E8, 0, 0x0, 0, NO_PAD_CTRL) 249#define MX51_PAD_DISP1_DAT2__DISP1_DAT2 IOMUX_PAD(0x6D4, 0x2D4, 0, 0x0, 0, NO_PAD_CTRL)
248#define MX51_PAD_DISP1_DAT8__DISP1_DAT8 IOMUX_PAD(0x6EC, 0x2EC, 0, 0x0, 0, NO_PAD_CTRL) 250#define MX51_PAD_DISP1_DAT3__DISP1_DAT3 IOMUX_PAD(0x6D8, 0x2D8, 0, 0x0, 0, NO_PAD_CTRL)
249#define MX51_PAD_DISP1_DAT9__DISP1_DAT9 IOMUX_PAD(0x6F0, 0x2F0, 0, 0x0, 0, NO_PAD_CTRL) 251#define MX51_PAD_DISP1_DAT4__DISP1_DAT4 IOMUX_PAD(0x6DC, 0x2DC, 0, 0x0, 0, NO_PAD_CTRL)
250#define MX51_PAD_DISP1_DAT10__DISP1_DAT10 IOMUX_PAD(0x6F4, 0x2F4, 0, 0x0, 0, NO_PAD_CTRL) 252#define MX51_PAD_DISP1_DAT5__DISP1_DAT5 IOMUX_PAD(0x6E0, 0x2E0, 0, 0x0, 0, NO_PAD_CTRL)
251#define MX51_PAD_DISP1_DAT11__DISP1_DAT11 IOMUX_PAD(0x6F8, 0x2F8, 0, 0x0, 0, NO_PAD_CTRL) 253#define MX51_PAD_DISP1_DAT6__DISP1_DAT6 IOMUX_PAD(0x6E4, 0x2E4, 0, 0x0, 0, NO_PAD_CTRL)
252#define MX51_PAD_DISP1_DAT12__DISP1_DAT12 IOMUX_PAD(0x6FC, 0x2FC, 0, 0x0, 0, NO_PAD_CTRL) 254#define MX51_PAD_DISP1_DAT7__DISP1_DAT7 IOMUX_PAD(0x6E8, 0x2E8, 0, 0x0, 0, NO_PAD_CTRL)
253#define MX51_PAD_DISP1_DAT13__DISP1_DAT13 IOMUX_PAD(0x700, 0x300, 0, 0x0, 0, NO_PAD_CTRL) 255#define MX51_PAD_DISP1_DAT8__DISP1_DAT8 IOMUX_PAD(0x6EC, 0x2EC, 0, 0x0, 0, NO_PAD_CTRL)
254#define MX51_PAD_DISP1_DAT14__DISP1_DAT14 IOMUX_PAD(0x704, 0x304, 0, 0x0, 0, NO_PAD_CTRL) 256#define MX51_PAD_DISP1_DAT9__DISP1_DAT9 IOMUX_PAD(0x6F0, 0x2F0, 0, 0x0, 0, NO_PAD_CTRL)
255#define MX51_PAD_DISP1_DAT15__DISP1_DAT15 IOMUX_PAD(0x708, 0x308, 0, 0x0, 0, NO_PAD_CTRL) 257#define MX51_PAD_DISP1_DAT10__DISP1_DAT10 IOMUX_PAD(0x6F4, 0x2F4, 0, 0x0, 0, NO_PAD_CTRL)
256#define MX51_PAD_DISP1_DAT16__DISP1_DAT16 IOMUX_PAD(0x70C, 0x30C, 0, 0x0, 0, NO_PAD_CTRL) 258#define MX51_PAD_DISP1_DAT11__DISP1_DAT11 IOMUX_PAD(0x6F8, 0x2F8, 0, 0x0, 0, NO_PAD_CTRL)
257#define MX51_PAD_DISP1_DAT17__DISP1_DAT17 IOMUX_PAD(0x710, 0x310, 0, 0x0, 0, NO_PAD_CTRL) 259#define MX51_PAD_DISP1_DAT12__DISP1_DAT12 IOMUX_PAD(0x6FC, 0x2FC, 0, 0x0, 0, NO_PAD_CTRL)
258#define MX51_PAD_DISP1_DAT18__DISP1_DAT18 IOMUX_PAD(0x714, 0x314, 0, 0x0, 0, NO_PAD_CTRL) 260#define MX51_PAD_DISP1_DAT13__DISP1_DAT13 IOMUX_PAD(0x700, 0x300, 0, 0x0, 0, NO_PAD_CTRL)
259#define MX51_PAD_DISP1_DAT19__DISP1_DAT19 IOMUX_PAD(0x718, 0x318, 0, 0x0, 0, NO_PAD_CTRL) 261#define MX51_PAD_DISP1_DAT14__DISP1_DAT14 IOMUX_PAD(0x704, 0x304, 0, 0x0, 0, NO_PAD_CTRL)
260#define MX51_PAD_DISP1_DAT20__DISP1_DAT20 IOMUX_PAD(0x71C, 0x31C, 0, 0x0, 0, NO_PAD_CTRL) 262#define MX51_PAD_DISP1_DAT15__DISP1_DAT15 IOMUX_PAD(0x708, 0x308, 0, 0x0, 0, NO_PAD_CTRL)
261#define MX51_PAD_DISP1_DAT21__DISP1_DAT21 IOMUX_PAD(0x720, 0x320, 0, 0x0, 0, NO_PAD_CTRL) 263#define MX51_PAD_DISP1_DAT16__DISP1_DAT16 IOMUX_PAD(0x70C, 0x30C, 0, 0x0, 0, NO_PAD_CTRL)
262#define MX51_PAD_DISP1_DAT22__DISP1_DAT22 IOMUX_PAD(0x724, 0x324, 0, 0x0, 0, NO_PAD_CTRL) 264#define MX51_PAD_DISP1_DAT17__DISP1_DAT17 IOMUX_PAD(0x710, 0x310, 0, 0x0, 0, NO_PAD_CTRL)
263#define MX51_PAD_DISP1_DAT23__DISP1_DAT23 IOMUX_PAD(0x728, 0x328, 0, 0x0, 0, NO_PAD_CTRL) 265#define MX51_PAD_DISP1_DAT18__DISP1_DAT18 IOMUX_PAD(0x714, 0x314, 0, 0x0, 0, NO_PAD_CTRL)
264#define MX51_PAD_DI1_PIN3__DI1_PIN3 IOMUX_PAD(0x72C, 0x32C, 0, 0x0, 0, NO_PAD_CTRL) 266#define MX51_PAD_DISP1_DAT19__DISP1_DAT19 IOMUX_PAD(0x718, 0x318, 0, 0x0, 0, NO_PAD_CTRL)
265#define MX51_PAD_DI1_PIN2__DI1_PIN2 IOMUX_PAD(0x734, 0x330, 0, 0x0, 0, NO_PAD_CTRL) 267#define MX51_PAD_DISP1_DAT20__DISP1_DAT20 IOMUX_PAD(0x71C, 0x31C, 0, 0x0, 0, NO_PAD_CTRL)
266#define MX51_PAD_DI_GP1__DI_GP1 IOMUX_PAD(0x73C, 0x334, 0, 0x0, 0, NO_PAD_CTRL) 268#define MX51_PAD_DISP1_DAT21__DISP1_DAT21 IOMUX_PAD(0x720, 0x320, 0, 0x0, 0, NO_PAD_CTRL)
267#define MX51_PAD_DI_GP2__DI_GP2 IOMUX_PAD(0x740, 0x338, 0, 0x0, 0, NO_PAD_CTRL) 269#define MX51_PAD_DISP1_DAT22__DISP1_DAT22 IOMUX_PAD(0x724, 0x324, 0, 0x0, 0, NO_PAD_CTRL)
268#define MX51_PAD_DI_GP3__DI_GP3 IOMUX_PAD(0x744, 0x33C, 0, 0x0, 0, NO_PAD_CTRL) 270#define MX51_PAD_DISP1_DAT23__DISP1_DAT23 IOMUX_PAD(0x728, 0x328, 0, 0x0, 0, NO_PAD_CTRL)
269#define MX51_PAD_DI2_PIN4__DI2_PIN4 IOMUX_PAD(0x748, 0x340, 0, 0x0, 0, NO_PAD_CTRL) 271#define MX51_PAD_DI1_PIN3__DI1_PIN3 IOMUX_PAD(0x72C, 0x32C, 0, 0x0, 0, NO_PAD_CTRL)
270#define MX51_PAD_DI2_PIN2__DI2_PIN2 IOMUX_PAD(0x74C, 0x344, 0, 0x0, 0, NO_PAD_CTRL) 272#define MX51_PAD_DI1_PIN2__DI1_PIN2 IOMUX_PAD(0x734, 0x330, 0, 0x0, 0, NO_PAD_CTRL)
271#define MX51_PAD_DI2_PIN3__DI2_PIN3 IOMUX_PAD(0x750, 0x348, 0, 0x0, 0, NO_PAD_CTRL) 273#define MX51_PAD_DI_GP1__DI_GP1 IOMUX_PAD(0x73C, 0x334, 0, 0x0, 0, NO_PAD_CTRL)
272#define MX51_PAD_DI2_DISP_CLK__DI2_DISP_CLK IOMUX_PAD(0x754, 0x34C, 0, 0x0, 0, NO_PAD_CTRL) 274#define MX51_PAD_DI_GP2__DI_GP2 IOMUX_PAD(0x740, 0x338, 0, 0x0, 0, NO_PAD_CTRL)
273#define MX51_PAD_DI_GP4__DI_GP4 IOMUX_PAD(0x758, 0x350, 0, 0x0, 0, NO_PAD_CTRL) 275#define MX51_PAD_DI_GP3__DI_GP3 IOMUX_PAD(0x744, 0x33C, 0, 0x0, 0, NO_PAD_CTRL)
274#define MX51_PAD_DISP2_DAT0__DISP2_DAT0 IOMUX_PAD(0x75C, 0x354, 0, 0x0, 0, NO_PAD_CTRL) 276#define MX51_PAD_DI2_PIN4__DI2_PIN4 IOMUX_PAD(0x748, 0x340, 0, 0x0, 0, NO_PAD_CTRL)
275#define MX51_PAD_DISP2_DAT1__DISP2_DAT1 IOMUX_PAD(0x760, 0x358, 0, 0x0, 0, NO_PAD_CTRL) 277#define MX51_PAD_DI2_PIN2__DI2_PIN2 IOMUX_PAD(0x74C, 0x344, 0, 0x0, 0, NO_PAD_CTRL)
276#define MX51_PAD_DISP2_DAT2__DISP2_DAT2 IOMUX_PAD(0x764, 0x35C, 0, 0x0, 0, NO_PAD_CTRL) 278#define MX51_PAD_DI2_PIN3__DI2_PIN3 IOMUX_PAD(0x750, 0x348, 0, 0x0, 0, NO_PAD_CTRL)
277#define MX51_PAD_DISP2_DAT3__DISP2_DAT3 IOMUX_PAD(0x768, 0x360, 0, 0x0, 0, NO_PAD_CTRL) 279#define MX51_PAD_DI2_DISP_CLK__DI2_DISP_CLK IOMUX_PAD(0x754, 0x34C, 0, 0x0, 0, NO_PAD_CTRL)
278#define MX51_PAD_DISP2_DAT4__DISP2_DAT4 IOMUX_PAD(0x76C, 0x364, 0, 0x0, 0, NO_PAD_CTRL) 280#define MX51_PAD_DI_GP4__DI_GP4 IOMUX_PAD(0x758, 0x350, 0, 0x0, 0, NO_PAD_CTRL)
279#define MX51_PAD_DISP2_DAT5__DISP2_DAT5 IOMUX_PAD(0x770, 0x368, 0, 0x0, 0, NO_PAD_CTRL) 281#define MX51_PAD_DISP2_DAT0__DISP2_DAT0 IOMUX_PAD(0x75C, 0x354, 0, 0x0, 0, NO_PAD_CTRL)
280#define MX51_PAD_GPIO_1_19__DISP2_DAT6 IOMUX_PAD(0x774, 0x36C, 5, 0x0, 0, NO_PAD_CTRL) 282#define MX51_PAD_DISP2_DAT1__DISP2_DAT1 IOMUX_PAD(0x760, 0x358, 0, 0x0, 0, NO_PAD_CTRL)
281#define MX51_PAD_GPIO_1_29__DISP2_DAT7 IOMUX_PAD(0x778, 0x370, 5, 0x0, 0, NO_PAD_CTRL) 283#define MX51_PAD_DISP2_DAT2__DISP2_DAT2 IOMUX_PAD(0x764, 0x35C, 0, 0x0, 0, NO_PAD_CTRL)
282#define MX51_PAD_GPIO_1_30__DISP2_DAT8 IOMUX_PAD(0x77C, 0x374, 5, 0x0, 0, NO_PAD_CTRL) 284#define MX51_PAD_DISP2_DAT3__DISP2_DAT3 IOMUX_PAD(0x768, 0x360, 0, 0x0, 0, NO_PAD_CTRL)
283#define MX51_PAD_GPIO_1_31__DISP2_DAT9 IOMUX_PAD(0x780, 0x378, 5, 0x0, 0, NO_PAD_CTRL) 285#define MX51_PAD_DISP2_DAT4__DISP2_DAT4 IOMUX_PAD(0x76C, 0x364, 0, 0x0, 0, NO_PAD_CTRL)
284#define MX51_PAD_DISP2_DAT10__DISP2_DAT10 IOMUX_PAD(0x784, 0x37C, 0, 0x0, 0, NO_PAD_CTRL) 286#define MX51_PAD_DISP2_DAT5__DISP2_DAT5 IOMUX_PAD(0x770, 0x368, 0, 0x0, 0, NO_PAD_CTRL)
285#define MX51_PAD_DISP2_DAT11__DISP2_DAT11 IOMUX_PAD(0x788, 0x380, 0, 0x0, 0, NO_PAD_CTRL) 287#define MX51_PAD_DISP2_DAT6__GPIO_1_19 IOMUX_PAD(0x774, 0x36C, 5, 0x0, 0, NO_PAD_CTRL)
286#define MX51_PAD_DISP2_DAT12__DISP2_DAT12 IOMUX_PAD(0x78C, 0x384, 0, 0x0, 0, NO_PAD_CTRL) 288#define MX51_PAD_DISP2_DAT7__GPIO_1_29 IOMUX_PAD(0x778, 0x370, 5, 0x0, 0, NO_PAD_CTRL)
287#define MX51_PAD_DISP2_DAT13__DISP2_DAT13 IOMUX_PAD(0x790, 0x388, 0, 0x0, 0, NO_PAD_CTRL) 289#define MX51_PAD_DISP2_DAT8__GPIO_1_30 IOMUX_PAD(0x77C, 0x374, 5, 0x0, 0, NO_PAD_CTRL)
288#define MX51_PAD_DISP2_DAT14__DISP2_DAT14 IOMUX_PAD(0x794, 0x38C, 0, 0x0, 0, NO_PAD_CTRL) 290#define MX51_PAD_DISP2_DAT9__GPIO_1_31 IOMUX_PAD(0x780, 0x378, 5, 0x0, 0, NO_PAD_CTRL)
289#define MX51_PAD_DISP2_DAT15__DISP2_DAT15 IOMUX_PAD(0x798, 0x390, 0, 0x0, 0, NO_PAD_CTRL) 291#define MX51_PAD_DISP2_DAT10__DISP2_DAT10 IOMUX_PAD(0x784, 0x37C, 0, 0x0, 0, NO_PAD_CTRL)
290#define MX51_PAD_SD1_CMD__SD1_CMD IOMUX_PAD(0x79C, 0x394, 0, 0x0, 0, NO_PAD_CTRL) 292#define MX51_PAD_DISP2_DAT11__DISP2_DAT11 IOMUX_PAD(0x788, 0x380, 0, 0x0, 0, NO_PAD_CTRL)
291#define MX51_PAD_SD1_CLK__SD1_CLK IOMUX_PAD(0x7A0, 0x398, 0, 0x0, 0, NO_PAD_CTRL) 293#define MX51_PAD_DISP2_DAT12__DISP2_DAT12 IOMUX_PAD(0x78C, 0x384, 0, 0x0, 0, NO_PAD_CTRL)
292#define MX51_PAD_SD1_DATA0__SD1_DATA0 IOMUX_PAD(0x7A4, 0x39C, 0, 0x0, 0, NO_PAD_CTRL) 294#define MX51_PAD_DISP2_DAT13__DISP2_DAT13 IOMUX_PAD(0x790, 0x388, 0, 0x0, 0, NO_PAD_CTRL)
293#define MX51_PAD_SD1_DATA1__SD1_DATA1 IOMUX_PAD(0x7A8, 0x3A0, 0, 0x0, 0, NO_PAD_CTRL) 295#define MX51_PAD_DISP2_DAT14__DISP2_DAT14 IOMUX_PAD(0x794, 0x38C, 0, 0x0, 0, NO_PAD_CTRL)
294#define MX51_PAD_SD1_DATA2__SD1_DATA2 IOMUX_PAD(0x7AC, 0x3A4, 0, 0x0, 0, NO_PAD_CTRL) 296#define MX51_PAD_DISP2_DAT15__DISP2_DAT15 IOMUX_PAD(0x798, 0x390, 0, 0x0, 0, NO_PAD_CTRL)
295#define MX51_PAD_SD1_DATA3__SD1_DATA3 IOMUX_PAD(0x7B0, 0x3A8, 0, 0x0, 0, NO_PAD_CTRL) 297#define MX51_PAD_SD1_CMD__SD1_CMD IOMUX_PAD(0x79C, 0x394, 0, 0x0, 0, NO_PAD_CTRL)
296#define MX51_PAD_GPIO_1_0__GPIO1_0 IOMUX_PAD(0x7B4, 0x3AC, 1, 0x0, 0, NO_PAD_CTRL) 298#define MX51_PAD_SD1_CLK__SD1_CLK IOMUX_PAD(0x7A0, 0x398, 0, 0x0, 0, NO_PAD_CTRL)
297#define MX51_PAD_GPIO_1_1__GPIO1_1 IOMUX_PAD(0x7B8, 0x3B0, 1, 0x0, 0, NO_PAD_CTRL) 299#define MX51_PAD_SD1_DATA0__SD1_DATA0 IOMUX_PAD(0x7A4, 0x39C, 0, 0x0, 0, NO_PAD_CTRL)
298#define MX51_PAD_SD2_CMD__SD2_CMD IOMUX_PAD(0x7BC, 0x3B4, 0, 0x0, 0, NO_PAD_CTRL) 300#define MX51_PAD_SD1_DATA1__SD1_DATA1 IOMUX_PAD(0x7A8, 0x3A0, 0, 0x0, 0, NO_PAD_CTRL)
299#define MX51_PAD_SD2_CLK__SD2_CLK IOMUX_PAD(0x7C0, 0x3B8, 0, 0x0, 0, NO_PAD_CTRL) 301#define MX51_PAD_SD1_DATA2__SD1_DATA2 IOMUX_PAD(0x7AC, 0x3A4, 0, 0x0, 0, NO_PAD_CTRL)
300#define MX51_PAD_SD2_DATA0__SD2_DATA0 IOMUX_PAD(0x7C4, 0x3BC, 0, 0x0, 0, NO_PAD_CTRL) 302#define MX51_PAD_SD1_DATA3__SD1_DATA3 IOMUX_PAD(0x7B0, 0x3A8, 0, 0x0, 0, NO_PAD_CTRL)
301#define MX51_PAD_SD2_DATA1__SD2_DATA1 IOMUX_PAD(0x7C8, 0x3C0, 0, 0x0, 0, NO_PAD_CTRL) 303#define MX51_PAD_GPIO_1_0__GPIO_1_0 IOMUX_PAD(0x7B4, 0x3AC, 1, 0x0, 0, NO_PAD_CTRL)
302#define MX51_PAD_SD2_DATA2__SD2_DATA2 IOMUX_PAD(0x7CC, 0x3C4, 0, 0x0, 0, NO_PAD_CTRL) 304#define MX51_PAD_GPIO_1_1__GPIO_1_1 IOMUX_PAD(0x7B8, 0x3B0, 1, 0x0, 0, NO_PAD_CTRL)
303#define MX51_PAD_SD2_DATA3__SD2_DATA3 IOMUX_PAD(0x7D0, 0x3C8, 0, 0x0, 0, NO_PAD_CTRL) 305#define MX51_PAD_SD2_CMD__SD2_CMD IOMUX_PAD(0x7BC, 0x3B4, 0, 0x0, 0, NO_PAD_CTRL)
304#define MX51_PAD_GPIO_1_2__GPIO1_2 IOMUX_PAD(0x7D4, 0x3CC, 0, 0x0, 0, NO_PAD_CTRL) 306#define MX51_PAD_SD2_CLK__SD2_CLK IOMUX_PAD(0x7C0, 0x3B8, 0, 0x0, 0, NO_PAD_CTRL)
305#define MX51_PAD_GPIO_1_3__GPIO1_3 IOMUX_PAD(0x7D8, 0x3D0, 0, 0x0, 0, NO_PAD_CTRL) 307#define MX51_PAD_SD2_DATA0__SD2_DATA0 IOMUX_PAD(0x7C4, 0x3BC, 0, 0x0, 0, NO_PAD_CTRL)
306#define MX51_PAD_PMIC_INT_REQ__PMIC_INT_REQ IOMUX_PAD(0x7FC, 0x3D4, 0, 0x0, 0, NO_PAD_CTRL) 308#define MX51_PAD_SD2_DATA1__SD2_DATA1 IOMUX_PAD(0x7C8, 0x3C0, 0, 0x0, 0, NO_PAD_CTRL)
307#define MX51_PAD_GPIO_1_4__GPIO1_4 IOMUX_PAD(0x804, 0x3D8, 0, 0x0, 0, NO_PAD_CTRL) 309#define MX51_PAD_SD2_DATA2__SD2_DATA2 IOMUX_PAD(0x7CC, 0x3C4, 0, 0x0, 0, NO_PAD_CTRL)
308#define MX51_PAD_GPIO_1_5__GPIO1_5 IOMUX_PAD(0x808, 0x3DC, 0, 0x0, 0, NO_PAD_CTRL) 310#define MX51_PAD_SD2_DATA3__SD2_DATA3 IOMUX_PAD(0x7D0, 0x3C8, 0, 0x0, 0, NO_PAD_CTRL)
309#define MX51_PAD_GPIO_1_6__GPIO1_6 IOMUX_PAD(0x80C, 0x3E0, 0, 0x0, 0, NO_PAD_CTRL) 311#define MX51_PAD_GPIO_1_2__GPIO_1_2 IOMUX_PAD(0x7D4, 0x3CC, 0, 0x0, 0, NO_PAD_CTRL)
310#define MX51_PAD_GPIO_1_7__GPIO1_7 IOMUX_PAD(0x810, 0x3E4, 0, 0x0, 0, MX51_GPIO_PAD_CTRL) 312#define MX51_PAD_GPIO_1_2__I2C2_SCL IOMUX_PAD(0x7D4, 0x3CC, (2 | IOMUX_CONFIG_SION), \
311#define MX51_PAD_GPIO_1_8__GPIO1_8 IOMUX_PAD(0x814, 0x3E8, 0, 0x0, 1, \ 313 0x9b8, 3, MX51_I2C_PAD_CTRL)
312 (PAD_CTL_SRE_SLOW | PAD_CTL_DSE_MED | PAD_CTL_PUS_100K_UP | PAD_CTL_HYS)) 314#define MX51_PAD_GPIO_1_3__GPIO_1_3 IOMUX_PAD(0x7D8, 0x3D0, 0, 0x0, 0, NO_PAD_CTRL)
313#define MX51_PAD_GPIO_1_9__GPIO1_9 IOMUX_PAD(0x818, 0x3EC, 0, 0x0, 0, NO_PAD_CTRL) 315#define MX51_PAD_GPIO_1_3__I2C2_SDA IOMUX_PAD(0x7D8, 0x3D0, (2 | IOMUX_CONFIG_SION), \
314 316 0x9bc, 3, MX51_I2C_PAD_CTRL)
315/* EIM */ 317#define MX51_PAD_PMIC_INT_REQ__PMIC_INT_REQ IOMUX_PAD(0x7FC, 0x3D4, 0, 0x0, 0, NO_PAD_CTRL)
316#define MX51_PAD_EIM_DA0__EIM_DA0 IOMUX_PAD(0x7a8, 0x01c, 0, 0x0, 0, NO_PAD_CTRL) 318#define MX51_PAD_GPIO_1_4__GPIO_1_4 IOMUX_PAD(0x804, 0x3D8, 0, 0x0, 0, NO_PAD_CTRL)
317#define MX51_PAD_EIM_DA1__EIM_DA1 IOMUX_PAD(0x7a8, 0x020, 0, 0x0, 0, NO_PAD_CTRL) 319#define MX51_PAD_GPIO_1_5__GPIO_1_5 IOMUX_PAD(0x808, 0x3DC, 0, 0x0, 0, NO_PAD_CTRL)
318#define MX51_PAD_EIM_DA2__EIM_DA2 IOMUX_PAD(0x7a8, 0x024, 0, 0x0, 0, NO_PAD_CTRL) 320#define MX51_PAD_GPIO_1_6__GPIO_1_6 IOMUX_PAD(0x80C, 0x3E0, 0, 0x0, 0, MX51_GPIO_PAD_CTRL)
319#define MX51_PAD_EIM_DA3__EIM_DA3 IOMUX_PAD(0x7a8, 0x028, 0, 0x0, 0, NO_PAD_CTRL) 321#define MX51_PAD_GPIO_1_7__GPIO_1_7 IOMUX_PAD(0x810, 0x3E4, 0, 0x0, 0, MX51_GPIO_PAD_CTRL)
320#define MX51_PAD_EIM_DA4__EIM_DA4 IOMUX_PAD(0x7ac, 0x02c, 0, 0x0, 0, NO_PAD_CTRL) 322#define MX51_PAD_GPIO_1_8__GPIO_1_8 IOMUX_PAD(0x814, 0x3E8, 0, 0x0, 1, MX51_GPIO_PAD_CTRL)
321#define MX51_PAD_EIM_DA5__EIM_DA5 IOMUX_PAD(0x7ac, 0x030, 0, 0x0, 0, NO_PAD_CTRL) 323#define MX51_PAD_GPIO_1_9__GPIO_1_9 IOMUX_PAD(0x818, 0x3EC, 0, 0x0, 0, NO_PAD_CTRL)
322#define MX51_PAD_EIM_DA6__EIM_DA6 IOMUX_PAD(0x7ac, 0x034, 0, 0x0, 0, NO_PAD_CTRL)
323#define MX51_PAD_EIM_DA7__EIM_DA7 IOMUX_PAD(0x7ac, 0x038, 0, 0x0, 0, NO_PAD_CTRL)
324
325#define MX51_PAD_EIM_DA8__EIM_DA8 IOMUX_PAD(0x7b0, 0x03c, 0, 0x0, 0, NO_PAD_CTRL)
326#define MX51_PAD_EIM_DA9__EIM_DA9 IOMUX_PAD(0x7b0, 0x040, 0, 0x0, 0, NO_PAD_CTRL)
327#define MX51_PAD_EIM_DA10__EIM_DA10 IOMUX_PAD(0x7b0, 0x044, 0, 0x0, 0, NO_PAD_CTRL)
328#define MX51_PAD_EIM_DA11__EIM_DA11 IOMUX_PAD(0x7b0, 0x048, 0, 0x0, 0, NO_PAD_CTRL)
329#define MX51_PAD_EIM_DA12__EIM_DA12 IOMUX_PAD(0x7bc, 0x04c, 0, 0x0, 0, NO_PAD_CTRL)
330#define MX51_PAD_EIM_DA13__EIM_DA13 IOMUX_PAD(0x7bc, 0x050, 0, 0x0, 0, NO_PAD_CTRL)
331#define MX51_PAD_EIM_DA14__EIM_DA14 IOMUX_PAD(0x7bc, 0x054, 0, 0x0, 0, NO_PAD_CTRL)
332#define MX51_PAD_EIM_DA15__EIM_DA15 IOMUX_PAD(0x7bc, 0x058, 0, 0x0, 0, NO_PAD_CTRL)
333 324
334#endif /* __MACH_IOMUX_MX51_H__ */ 325#endif /* __MACH_IOMUX_MX51_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/iomux-mxc91231.h b/arch/arm/plat-mxc/include/mach/iomux-mxc91231.h
index 3887f3fe29d4..15d59510f597 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-mxc91231.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-mxc91231.h
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
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 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 15 */
20 16
21#ifndef __MACH_IOMUX_MXC91231_H__ 17#ifndef __MACH_IOMUX_MXC91231_H__
diff --git a/arch/arm/plat-mxc/include/mach/iomux-v3.h b/arch/arm/plat-mxc/include/mach/iomux-v3.h
index f2f73d31d5ba..0880a4a1aed1 100644
--- a/arch/arm/plat-mxc/include/mach/iomux-v3.h
+++ b/arch/arm/plat-mxc/include/mach/iomux-v3.h
@@ -89,6 +89,21 @@ struct pad_desc {
89#define PAD_CTL_SRE_FAST (1 << 0) 89#define PAD_CTL_SRE_FAST (1 << 0)
90#define PAD_CTL_SRE_SLOW (0 << 0) 90#define PAD_CTL_SRE_SLOW (0 << 0)
91 91
92
93#define MX51_NUM_GPIO_PORT 4
94
95#define GPIO_PIN_MASK 0x1f
96
97#define GPIO_PORT_SHIFT 5
98#define GPIO_PORT_MASK (0x7 << GPIO_PORT_SHIFT)
99
100#define GPIO_PORTA (0 << GPIO_PORT_SHIFT)
101#define GPIO_PORTB (1 << GPIO_PORT_SHIFT)
102#define GPIO_PORTC (2 << GPIO_PORT_SHIFT)
103#define GPIO_PORTD (3 << GPIO_PORT_SHIFT)
104#define GPIO_PORTE (4 << GPIO_PORT_SHIFT)
105#define GPIO_PORTF (5 << GPIO_PORT_SHIFT)
106
92/* 107/*
93 * setups a single pad in the iomuxer 108 * setups a single pad in the iomuxer
94 */ 109 */
diff --git a/arch/arm/plat-mxc/include/mach/memory.h b/arch/arm/plat-mxc/include/mach/memory.h
index c4b40c35a6a1..564ec9dbc93d 100644
--- a/arch/arm/plat-mxc/include/mach/memory.h
+++ b/arch/arm/plat-mxc/include/mach/memory.h
@@ -44,12 +44,12 @@
44 */ 44 */
45#define CONSISTENT_DMA_SIZE SZ_8M 45#define CONSISTENT_DMA_SIZE SZ_8M
46 46
47#elif defined(CONFIG_MX1_VIDEO) 47#elif defined(CONFIG_MX1_VIDEO) || defined(CONFIG_VIDEO_MX2_HOSTSUPPORT)
48/* 48/*
49 * Increase size of DMA-consistent memory region. 49 * Increase size of DMA-consistent memory region.
50 * This is required for i.MX camera driver to capture at least four VGA frames. 50 * This is required for i.MX camera driver to capture at least four VGA frames.
51 */ 51 */
52#define CONSISTENT_DMA_SIZE SZ_4M 52#define CONSISTENT_DMA_SIZE SZ_4M
53#endif /* CONFIG_MX1_VIDEO */ 53#endif /* CONFIG_MX1_VIDEO || CONFIG_VIDEO_MX2_HOSTSUPPORT */
54 54
55#endif /* __ASM_ARCH_MXC_MEMORY_H__ */ 55#endif /* __ASM_ARCH_MXC_MEMORY_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/mmc.h b/arch/arm/plat-mxc/include/mach/mmc.h
index de2128dada5c..29115f405af9 100644
--- a/arch/arm/plat-mxc/include/mach/mmc.h
+++ b/arch/arm/plat-mxc/include/mach/mmc.h
@@ -31,6 +31,9 @@ struct imxmmc_platform_data {
31 31
32 /* adjust slot voltage */ 32 /* adjust slot voltage */
33 void (*setpower)(struct device *, unsigned int vdd); 33 void (*setpower)(struct device *, unsigned int vdd);
34
35 /* enable card detect using DAT3 */
36 int dat3_card_detect;
34}; 37};
35 38
36#endif 39#endif
diff --git a/arch/arm/plat-mxc/include/mach/mx1.h b/arch/arm/plat-mxc/include/mach/mx1.h
index 5eba7e6785de..641b24618239 100644
--- a/arch/arm/plat-mxc/include/mach/mx1.h
+++ b/arch/arm/plat-mxc/include/mach/mx1.h
@@ -91,24 +91,24 @@
91#define MX1_SIM_DATA_INT 16 91#define MX1_SIM_DATA_INT 16
92#define MX1_RTC_INT 17 92#define MX1_RTC_INT 17
93#define MX1_RTC_SAMINT 18 93#define MX1_RTC_SAMINT 18
94#define MX1_UART2_MINT_PFERR 19 94#define MX1_INT_UART2PFERR 19
95#define MX1_UART2_MINT_RTS 20 95#define MX1_INT_UART2RTS 20
96#define MX1_UART2_MINT_DTR 21 96#define MX1_INT_UART2DTR 21
97#define MX1_UART2_MINT_UARTC 22 97#define MX1_INT_UART2UARTC 22
98#define MX1_UART2_MINT_TX 23 98#define MX1_INT_UART2TX 23
99#define MX1_UART2_MINT_RX 24 99#define MX1_INT_UART2RX 24
100#define MX1_UART1_MINT_PFERR 25 100#define MX1_INT_UART1PFERR 25
101#define MX1_UART1_MINT_RTS 26 101#define MX1_INT_UART1RTS 26
102#define MX1_UART1_MINT_DTR 27 102#define MX1_INT_UART1DTR 27
103#define MX1_UART1_MINT_UARTC 28 103#define MX1_INT_UART1UARTC 28
104#define MX1_UART1_MINT_TX 29 104#define MX1_INT_UART1TX 29
105#define MX1_UART1_MINT_RX 30 105#define MX1_INT_UART1RX 30
106#define MX1_VOICE_DAC_INT 31 106#define MX1_VOICE_DAC_INT 31
107#define MX1_VOICE_ADC_INT 32 107#define MX1_VOICE_ADC_INT 32
108#define MX1_PEN_DATA_INT 33 108#define MX1_PEN_DATA_INT 33
109#define MX1_PWM_INT 34 109#define MX1_PWM_INT 34
110#define MX1_SDHC_INT 35 110#define MX1_SDHC_INT 35
111#define MX1_I2C_INT 39 111#define MX1_INT_I2C 39
112#define MX1_CSPI_INT 41 112#define MX1_CSPI_INT 41
113#define MX1_SSI_TX_INT 42 113#define MX1_SSI_TX_INT 42
114#define MX1_SSI_TX_ERR_INT 43 114#define MX1_SSI_TX_ERR_INT 43
@@ -245,7 +245,7 @@
245#define PEN_DATA_INT MX1_PEN_DATA_INT 245#define PEN_DATA_INT MX1_PEN_DATA_INT
246#define PWM_INT MX1_PWM_INT 246#define PWM_INT MX1_PWM_INT
247#define SDHC_INT MX1_SDHC_INT 247#define SDHC_INT MX1_SDHC_INT
248#define I2C_INT MX1_I2C_INT 248#define I2C_INT MX1_INT_I2C
249#define CSPI_INT MX1_CSPI_INT 249#define CSPI_INT MX1_CSPI_INT
250#define SSI_TX_INT MX1_SSI_TX_INT 250#define SSI_TX_INT MX1_SSI_TX_INT
251#define SSI_TX_ERR_INT MX1_SSI_TX_ERR_INT 251#define SSI_TX_ERR_INT MX1_SSI_TX_ERR_INT
diff --git a/arch/arm/plat-mxc/include/mach/mx25.h b/arch/arm/plat-mxc/include/mach/mx25.h
index 4eb6e334bda5..4a6f800990f8 100644
--- a/arch/arm/plat-mxc/include/mach/mx25.h
+++ b/arch/arm/plat-mxc/include/mach/mx25.h
@@ -11,6 +11,12 @@
11#define MX25_AVIC_BASE_ADDR_VIRT 0xfc400000 11#define MX25_AVIC_BASE_ADDR_VIRT 0xfc400000
12#define MX25_AVIC_SIZE SZ_1M 12#define MX25_AVIC_SIZE SZ_1M
13 13
14#define MX25_I2C1_BASE_ADDR (MX25_AIPS1_BASE_ADDR + 0x80000)
15#define MX25_I2C3_BASE_ADDR (MX25_AIPS1_BASE_ADDR + 0x84000)
16#define MX25_CAN1_BASE_ADDR (MX25_AIPS1_BASE_ADDR + 0x88000)
17#define MX25_CAN2_BASE_ADDR (MX25_AIPS1_BASE_ADDR + 0x8c000)
18#define MX25_I2C2_BASE_ADDR (MX25_AIPS1_BASE_ADDR + 0x98000)
19#define MX25_CSPI1_BASE_ADDR (MX25_AIPS1_BASE_ADDR + 0xa4000)
14#define MX25_IOMUXC_BASE_ADDR (MX25_AIPS1_BASE_ADDR + 0xac000) 20#define MX25_IOMUXC_BASE_ADDR (MX25_AIPS1_BASE_ADDR + 0xac000)
15 21
16#define MX25_CRM_BASE_ADDR (MX25_AIPS2_BASE_ADDR + 0x80000) 22#define MX25_CRM_BASE_ADDR (MX25_AIPS2_BASE_ADDR + 0x80000)
@@ -27,22 +33,48 @@
27 IMX_IO_ADDRESS(x, MX25_AIPS2) ?: \ 33 IMX_IO_ADDRESS(x, MX25_AIPS2) ?: \
28 IMX_IO_ADDRESS(x, MX25_AVIC)) 34 IMX_IO_ADDRESS(x, MX25_AVIC))
29 35
36#define MX25_AIPS1_IO_ADDRESS(x) \
37 (((x) - MX25_AIPS1_BASE_ADDR) + MX25_AIPS1_BASE_ADDR_VIRT)
38
30#define MX25_UART1_BASE_ADDR 0x43f90000 39#define MX25_UART1_BASE_ADDR 0x43f90000
31#define MX25_UART2_BASE_ADDR 0x43f94000 40#define MX25_UART2_BASE_ADDR 0x43f94000
41#define MX25_AUDMUX_BASE_ADDR 0x43fb0000
42#define MX25_UART3_BASE_ADDR 0x5000c000
43#define MX25_UART4_BASE_ADDR 0x50008000
44#define MX25_UART5_BASE_ADDR 0x5002c000
32 45
46#define MX25_CSPI3_BASE_ADDR 0x50004000
47#define MX25_CSPI2_BASE_ADDR 0x50010000
33#define MX25_FEC_BASE_ADDR 0x50038000 48#define MX25_FEC_BASE_ADDR 0x50038000
49#define MX25_SSI2_BASE_ADDR 0x50014000
50#define MX25_SSI1_BASE_ADDR 0x50034000
34#define MX25_NFC_BASE_ADDR 0xbb000000 51#define MX25_NFC_BASE_ADDR 0xbb000000
35#define MX25_DRYICE_BASE_ADDR 0x53ffc000 52#define MX25_DRYICE_BASE_ADDR 0x53ffc000
36#define MX25_LCDC_BASE_ADDR 0x53fbc000 53#define MX25_LCDC_BASE_ADDR 0x53fbc000
54#define MX25_KPP_BASE_ADDR 0x43fa8000
55#define MX25_OTG_BASE_ADDR 0x53ff4000
56#define MX25_CSI_BASE_ADDR 0x53ff8000
37 57
38#define MX25_INT_DRYICE 25 58#define MX25_INT_CSPI3 0
39#define MX25_INT_FEC 57 59#define MX25_INT_I2C1 3
40#define MX25_INT_NANDFC 33 60#define MX25_INT_I2C2 4
41#define MX25_INT_LCDC 39 61#define MX25_INT_UART4 5
42 62#define MX25_INT_I2C3 10
43#if defined(IMX_NEEDS_DEPRECATED_SYMBOLS) 63#define MX25_INT_SSI2 11
44#define UART1_BASE_ADDR MX25_UART1_BASE_ADDR 64#define MX25_INT_SSI1 12
45#define UART2_BASE_ADDR MX25_UART2_BASE_ADDR 65#define MX25_INT_CSPI2 13
46#endif 66#define MX25_INT_CSPI1 14
67#define MX25_INT_CSI 17
68#define MX25_INT_UART3 18
69#define MX25_INT_KPP 24
70#define MX25_INT_DRYICE 25
71#define MX25_INT_UART2 32
72#define MX25_INT_NANDFC 33
73#define MX25_INT_LCDC 39
74#define MX25_INT_UART5 40
75#define MX25_INT_CAN1 43
76#define MX25_INT_CAN2 44
77#define MX25_INT_UART1 45
78#define MX25_INT_FEC 57
47 79
48#endif /* ifndef __MACH_MX25_H__ */ 80#endif /* ifndef __MACH_MX25_H__ */
diff --git a/arch/arm/plat-mxc/include/mach/mx27.h b/arch/arm/plat-mxc/include/mach/mx27.h
index bae9cd75beee..a8ab2e02a8ca 100644
--- a/arch/arm/plat-mxc/include/mach/mx27.h
+++ b/arch/arm/plat-mxc/include/mach/mx27.h
@@ -48,7 +48,7 @@
48#define MX27_CSPI2_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x0f000) 48#define MX27_CSPI2_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x0f000)
49#define MX27_SSI1_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x10000) 49#define MX27_SSI1_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x10000)
50#define MX27_SSI2_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x11000) 50#define MX27_SSI2_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x11000)
51#define MX27_I2C_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x12000) 51#define MX27_I2C1_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x12000)
52#define MX27_SDHC1_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x13000) 52#define MX27_SDHC1_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x13000)
53#define MX27_SDHC2_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x14000) 53#define MX27_SDHC2_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x14000)
54#define MX27_GPIO_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x15000) 54#define MX27_GPIO_BASE_ADDR (MX27_AIPI_BASE_ADDR + 0x15000)
@@ -150,7 +150,7 @@ static inline void mx27_setup_weimcs(size_t cs,
150#define MX27_INT_SDHC3 9 150#define MX27_INT_SDHC3 9
151#define MX27_INT_SDHC2 10 151#define MX27_INT_SDHC2 10
152#define MX27_INT_SDHC1 11 152#define MX27_INT_SDHC1 11
153#define MX27_INT_I2C 12 153#define MX27_INT_I2C1 12
154#define MX27_INT_SSI2 13 154#define MX27_INT_SSI2 13
155#define MX27_INT_SSI1 14 155#define MX27_INT_SSI1 14
156#define MX27_INT_CSPI2 15 156#define MX27_INT_CSPI2 15
diff --git a/arch/arm/plat-mxc/include/mach/mx2_cam.h b/arch/arm/plat-mxc/include/mach/mx2_cam.h
new file mode 100644
index 000000000000..3c080a32dbf5
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/mx2_cam.h
@@ -0,0 +1,46 @@
1/*
2 * mx2-cam.h - i.MX27/i.MX25 camera driver header file
3 *
4 * Copyright (C) 2003, Intel Corporation
5 * Copyright (C) 2008, Sascha Hauer <s.hauer@pengutronix.de>
6 * Copyright (C) 2010, Baruch Siach <baruch@tkos.co.il>
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA.
21 */
22
23#ifndef __MACH_MX2_CAM_H_
24#define __MACH_MX2_CAM_H_
25
26#define MX2_CAMERA_SWAP16 (1 << 0)
27#define MX2_CAMERA_EXT_VSYNC (1 << 1)
28#define MX2_CAMERA_CCIR (1 << 2)
29#define MX2_CAMERA_CCIR_INTERLACE (1 << 3)
30#define MX2_CAMERA_HSYNC_HIGH (1 << 4)
31#define MX2_CAMERA_GATED_CLOCK (1 << 5)
32#define MX2_CAMERA_INV_DATA (1 << 6)
33#define MX2_CAMERA_PCLK_SAMPLE_RISING (1 << 7)
34#define MX2_CAMERA_PACK_DIR_MSB (1 << 8)
35
36/**
37 * struct mx2_camera_platform_data - optional platform data for mx2_camera
38 * @flags: any combination of MX2_CAMERA_*
39 * @clk: clock rate of the csi block / 2
40 */
41struct mx2_camera_platform_data {
42 unsigned long flags;
43 unsigned long clk;
44};
45
46#endif /* __MACH_MX2_CAM_H_ */
diff --git a/arch/arm/plat-mxc/include/mach/mx31.h b/arch/arm/plat-mxc/include/mach/mx31.h
index fb90e119c2b5..afee3ab9d62e 100644
--- a/arch/arm/plat-mxc/include/mach/mx31.h
+++ b/arch/arm/plat-mxc/include/mach/mx31.h
@@ -23,7 +23,7 @@
23#define MX31_ETB_SLOT4_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x10000) 23#define MX31_ETB_SLOT4_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x10000)
24#define MX31_ETB_SLOT5_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x14000) 24#define MX31_ETB_SLOT5_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x14000)
25#define MX31_ECT_CTIO_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x18000) 25#define MX31_ECT_CTIO_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x18000)
26#define MX31_I2C_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x80000) 26#define MX31_I2C1_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x80000)
27#define MX31_I2C3_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x84000) 27#define MX31_I2C3_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x84000)
28#define MX31_OTG_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x88000) 28#define MX31_OTG_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x88000)
29#define MX31_ATA_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x8c000) 29#define MX31_ATA_BASE_ADDR (MX31_AIPS1_BASE_ADDR + 0x8c000)
@@ -145,7 +145,7 @@ static inline void mx31_setup_weimcs(size_t cs,
145#define MX31_INT_FIRI 7 145#define MX31_INT_FIRI 7
146#define MX31_INT_MMC_SDHC2 8 146#define MX31_INT_MMC_SDHC2 8
147#define MX31_INT_MMC_SDHC1 9 147#define MX31_INT_MMC_SDHC1 9
148#define MX31_INT_I2C 10 148#define MX31_INT_I2C1 10
149#define MX31_INT_SSI2 11 149#define MX31_INT_SSI2 11
150#define MX31_INT_SSI1 12 150#define MX31_INT_SSI1 12
151#define MX31_INT_CSPI2 13 151#define MX31_INT_CSPI2 13
diff --git a/arch/arm/plat-mxc/include/mach/mx35.h b/arch/arm/plat-mxc/include/mach/mx35.h
index 526a55842ae5..af3038c12e39 100644
--- a/arch/arm/plat-mxc/include/mach/mx35.h
+++ b/arch/arm/plat-mxc/include/mach/mx35.h
@@ -18,7 +18,7 @@
18#define MX35_ETB_SLOT4_BASE_ADDR (MX35_AIPS1_BASE_ADDR + 0x10000) 18#define MX35_ETB_SLOT4_BASE_ADDR (MX35_AIPS1_BASE_ADDR + 0x10000)
19#define MX35_ETB_SLOT5_BASE_ADDR (MX35_AIPS1_BASE_ADDR + 0x14000) 19#define MX35_ETB_SLOT5_BASE_ADDR (MX35_AIPS1_BASE_ADDR + 0x14000)
20#define MX35_ECT_CTIO_BASE_ADDR (MX35_AIPS1_BASE_ADDR + 0x18000) 20#define MX35_ECT_CTIO_BASE_ADDR (MX35_AIPS1_BASE_ADDR + 0x18000)
21#define MX35_I2C_BASE_ADDR (MX35_AIPS1_BASE_ADDR + 0x80000) 21#define MX35_I2C1_BASE_ADDR (MX35_AIPS1_BASE_ADDR + 0x80000)
22#define MX35_I2C3_BASE_ADDR (MX35_AIPS1_BASE_ADDR + 0x84000) 22#define MX35_I2C3_BASE_ADDR (MX35_AIPS1_BASE_ADDR + 0x84000)
23#define MX35_UART1_BASE_ADDR (MX35_AIPS1_BASE_ADDR + 0x90000) 23#define MX35_UART1_BASE_ADDR (MX35_AIPS1_BASE_ADDR + 0x90000)
24#define MX35_UART2_BASE_ADDR (MX35_AIPS1_BASE_ADDR + 0x94000) 24#define MX35_UART2_BASE_ADDR (MX35_AIPS1_BASE_ADDR + 0x94000)
@@ -60,6 +60,8 @@
60#define MX35_RTC_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xd8000) 60#define MX35_RTC_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xd8000)
61#define MX35_WDOG_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xdc000) 61#define MX35_WDOG_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xdc000)
62#define MX35_PWM_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xe0000) 62#define MX35_PWM_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xe0000)
63#define MX35_CAN1_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xe4000)
64#define MX35_CAN2_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xe8000)
63#define MX35_RTIC_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xec000) 65#define MX35_RTIC_BASE_ADDR (MX35_AIPS2_BASE_ADDR + 0xec000)
64#define MX35_OTG_BASE_ADDR 0x53ff4000 66#define MX35_OTG_BASE_ADDR 0x53ff4000
65 67
@@ -123,7 +125,7 @@
123#define MX35_INT_MMC_SDHC1 7 125#define MX35_INT_MMC_SDHC1 7
124#define MX35_INT_MMC_SDHC2 8 126#define MX35_INT_MMC_SDHC2 8
125#define MX35_INT_MMC_SDHC3 9 127#define MX35_INT_MMC_SDHC3 9
126#define MX35_INT_I2C 10 128#define MX35_INT_I2C1 10
127#define MX35_INT_SSI1 11 129#define MX35_INT_SSI1 11
128#define MX35_INT_SSI2 12 130#define MX35_INT_SSI2 12
129#define MX35_INT_CSPI2 13 131#define MX35_INT_CSPI2 13
diff --git a/arch/arm/plat-mxc/include/mach/mx3_camera.h b/arch/arm/plat-mxc/include/mach/mx3_camera.h
index 36d7ff27b5e2..f226ee3777e1 100644
--- a/arch/arm/plat-mxc/include/mach/mx3_camera.h
+++ b/arch/arm/plat-mxc/include/mach/mx3_camera.h
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
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 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 */ 15 */
20 16
21#ifndef _MX3_CAMERA_H_ 17#ifndef _MX3_CAMERA_H_
diff --git a/arch/arm/plat-mxc/include/mach/mxc91231.h b/arch/arm/plat-mxc/include/mach/mxc91231.h
index 5182b986b785..0ca3101ebf36 100644
--- a/arch/arm/plat-mxc/include/mach/mxc91231.h
+++ b/arch/arm/plat-mxc/include/mach/mxc91231.h
@@ -13,10 +13,6 @@
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details. 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 */ 16 */
21#ifndef __MACH_MXC91231_H__ 17#ifndef __MACH_MXC91231_H__
22#define __MACH_MXC91231_H__ 18#define __MACH_MXC91231_H__
diff --git a/arch/arm/plat-mxc/include/mach/mxc_nand.h b/arch/arm/plat-mxc/include/mach/mxc_nand.h
index 5d2d21d414e0..04c0d060d814 100644
--- a/arch/arm/plat-mxc/include/mach/mxc_nand.h
+++ b/arch/arm/plat-mxc/include/mach/mxc_nand.h
@@ -20,9 +20,13 @@
20#ifndef __ASM_ARCH_NAND_H 20#ifndef __ASM_ARCH_NAND_H
21#define __ASM_ARCH_NAND_H 21#define __ASM_ARCH_NAND_H
22 22
23#include <linux/mtd/partitions.h>
24
23struct mxc_nand_platform_data { 25struct mxc_nand_platform_data {
24 int width; /* data bus width in bytes */ 26 unsigned int width; /* data bus width in bytes */
25 int hw_ecc:1; /* 0 if supress hardware ECC */ 27 unsigned int hw_ecc:1; /* 0 if supress hardware ECC */
26 int flash_bbt:1; /* set to 1 to use a flash based bbt */ 28 unsigned int flash_bbt:1; /* set to 1 to use a flash based bbt */
29 struct mtd_partition *parts; /* partition table */
30 int nr_parts; /* size of parts */
27}; 31};
28#endif /* __ASM_ARCH_NAND_H */ 32#endif /* __ASM_ARCH_NAND_H */
diff --git a/arch/arm/plat-mxc/include/mach/system.h b/arch/arm/plat-mxc/include/mach/system.h
index ef00199568de..4acd1143a9bd 100644
--- a/arch/arm/plat-mxc/include/mach/system.h
+++ b/arch/arm/plat-mxc/include/mach/system.h
@@ -12,10 +12,6 @@
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
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 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */ 15 */
20 16
21#ifndef __ASM_ARCH_MXC_SYSTEM_H__ 17#ifndef __ASM_ARCH_MXC_SYSTEM_H__
diff --git a/arch/arm/plat-mxc/include/mach/timex.h b/arch/arm/plat-mxc/include/mach/timex.h
index 024416ed11cd..2d9624697cc9 100644
--- a/arch/arm/plat-mxc/include/mach/timex.h
+++ b/arch/arm/plat-mxc/include/mach/timex.h
@@ -11,10 +11,6 @@
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * 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 *
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 */ 14 */
19 15
20#ifndef __ASM_ARCH_MXC_TIMEX_H__ 16#ifndef __ASM_ARCH_MXC_TIMEX_H__
diff --git a/arch/arm/plat-mxc/include/mach/uncompress.h b/arch/arm/plat-mxc/include/mach/uncompress.h
index b6d3d0fddc48..d9bd37e4667a 100644
--- a/arch/arm/plat-mxc/include/mach/uncompress.h
+++ b/arch/arm/plat-mxc/include/mach/uncompress.h
@@ -13,10 +13,6 @@
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details. 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 */ 16 */
21#ifndef __ASM_ARCH_MXC_UNCOMPRESS_H__ 17#ifndef __ASM_ARCH_MXC_UNCOMPRESS_H__
22#define __ASM_ARCH_MXC_UNCOMPRESS_H__ 18#define __ASM_ARCH_MXC_UNCOMPRESS_H__
diff --git a/arch/arm/plat-mxc/include/mach/vmalloc.h b/arch/arm/plat-mxc/include/mach/vmalloc.h
index 44243a278434..ef6379c474be 100644
--- a/arch/arm/plat-mxc/include/mach/vmalloc.h
+++ b/arch/arm/plat-mxc/include/mach/vmalloc.h
@@ -11,10 +11,6 @@
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * 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 *
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 */ 14 */
19 15
20#ifndef __ASM_ARCH_MXC_VMALLOC_H__ 16#ifndef __ASM_ARCH_MXC_VMALLOC_H__
diff --git a/arch/arm/plat-mxc/irq.c b/arch/arm/plat-mxc/irq.c
index 778ddfe57d89..7331f2ace5fe 100644
--- a/arch/arm/plat-mxc/irq.c
+++ b/arch/arm/plat-mxc/irq.c
@@ -142,9 +142,6 @@ void __init mxc_init_irq(void __iomem *irqbase)
142 for (i = 0; i < 8; i++) 142 for (i = 0; i < 8; i++)
143 __raw_writel(0, avic_base + AVIC_NIPRIORITY(i)); 143 __raw_writel(0, avic_base + AVIC_NIPRIORITY(i));
144 144
145 /* init architectures chained interrupt handler */
146 mxc_register_gpios();
147
148#ifdef CONFIG_FIQ 145#ifdef CONFIG_FIQ
149 /* Initialize FIQ */ 146 /* Initialize FIQ */
150 init_FIQ(); 147 init_FIQ();
diff --git a/arch/arm/plat-mxc/system.c b/arch/arm/plat-mxc/system.c
index 97f42799fa58..925bce4607e7 100644
--- a/arch/arm/plat-mxc/system.c
+++ b/arch/arm/plat-mxc/system.c
@@ -14,10 +14,6 @@
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 17 */
22 18
23#include <linux/kernel.h> 19#include <linux/kernel.h>
diff --git a/arch/arm/plat-mxc/tzic.c b/arch/arm/plat-mxc/tzic.c
index 9b86d2a60d43..b3da9aad4295 100644
--- a/arch/arm/plat-mxc/tzic.c
+++ b/arch/arm/plat-mxc/tzic.c
@@ -145,8 +145,6 @@ void __init tzic_init_irq(void __iomem *irqbase)
145 set_irq_handler(i, handle_level_irq); 145 set_irq_handler(i, handle_level_irq);
146 set_irq_flags(i, IRQF_VALID); 146 set_irq_flags(i, IRQF_VALID);
147 } 147 }
148 mxc_register_gpios();
149
150 pr_info("TrustZone Interrupt Controller (TZIC) initialized\n"); 148 pr_info("TrustZone Interrupt Controller (TZIC) initialized\n");
151} 149}
152 150
diff --git a/arch/arm/plat-nomadik/gpio.c b/arch/arm/plat-nomadik/gpio.c
index 5a6ef252c38b..977c8f9a07a2 100644
--- a/arch/arm/plat-nomadik/gpio.c
+++ b/arch/arm/plat-nomadik/gpio.c
@@ -23,6 +23,7 @@
23#include <linux/irq.h> 23#include <linux/irq.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25 25
26#include <plat/pincfg.h>
26#include <mach/hardware.h> 27#include <mach/hardware.h>
27#include <mach/gpio.h> 28#include <mach/gpio.h>
28 29
@@ -46,28 +47,217 @@ struct nmk_gpio_chip {
46 u32 edge_falling; 47 u32 edge_falling;
47}; 48};
48 49
50static void __nmk_gpio_set_mode(struct nmk_gpio_chip *nmk_chip,
51 unsigned offset, int gpio_mode)
52{
53 u32 bit = 1 << offset;
54 u32 afunc, bfunc;
55
56 afunc = readl(nmk_chip->addr + NMK_GPIO_AFSLA) & ~bit;
57 bfunc = readl(nmk_chip->addr + NMK_GPIO_AFSLB) & ~bit;
58 if (gpio_mode & NMK_GPIO_ALT_A)
59 afunc |= bit;
60 if (gpio_mode & NMK_GPIO_ALT_B)
61 bfunc |= bit;
62 writel(afunc, nmk_chip->addr + NMK_GPIO_AFSLA);
63 writel(bfunc, nmk_chip->addr + NMK_GPIO_AFSLB);
64}
65
66static void __nmk_gpio_set_slpm(struct nmk_gpio_chip *nmk_chip,
67 unsigned offset, enum nmk_gpio_slpm mode)
68{
69 u32 bit = 1 << offset;
70 u32 slpm;
71
72 slpm = readl(nmk_chip->addr + NMK_GPIO_SLPC);
73 if (mode == NMK_GPIO_SLPM_NOCHANGE)
74 slpm |= bit;
75 else
76 slpm &= ~bit;
77 writel(slpm, nmk_chip->addr + NMK_GPIO_SLPC);
78}
79
80static void __nmk_gpio_set_pull(struct nmk_gpio_chip *nmk_chip,
81 unsigned offset, enum nmk_gpio_pull pull)
82{
83 u32 bit = 1 << offset;
84 u32 pdis;
85
86 pdis = readl(nmk_chip->addr + NMK_GPIO_PDIS);
87 if (pull == NMK_GPIO_PULL_NONE)
88 pdis |= bit;
89 else
90 pdis &= ~bit;
91 writel(pdis, nmk_chip->addr + NMK_GPIO_PDIS);
92
93 if (pull == NMK_GPIO_PULL_UP)
94 writel(bit, nmk_chip->addr + NMK_GPIO_DATS);
95 else if (pull == NMK_GPIO_PULL_DOWN)
96 writel(bit, nmk_chip->addr + NMK_GPIO_DATC);
97}
98
99static void __nmk_gpio_make_input(struct nmk_gpio_chip *nmk_chip,
100 unsigned offset)
101{
102 writel(1 << offset, nmk_chip->addr + NMK_GPIO_DIRC);
103}
104
105static void __nmk_config_pin(struct nmk_gpio_chip *nmk_chip, unsigned offset,
106 pin_cfg_t cfg)
107{
108 static const char *afnames[] = {
109 [NMK_GPIO_ALT_GPIO] = "GPIO",
110 [NMK_GPIO_ALT_A] = "A",
111 [NMK_GPIO_ALT_B] = "B",
112 [NMK_GPIO_ALT_C] = "C"
113 };
114 static const char *pullnames[] = {
115 [NMK_GPIO_PULL_NONE] = "none",
116 [NMK_GPIO_PULL_UP] = "up",
117 [NMK_GPIO_PULL_DOWN] = "down",
118 [3] /* illegal */ = "??"
119 };
120 static const char *slpmnames[] = {
121 [NMK_GPIO_SLPM_INPUT] = "input",
122 [NMK_GPIO_SLPM_NOCHANGE] = "no-change",
123 };
124
125 int pin = PIN_NUM(cfg);
126 int pull = PIN_PULL(cfg);
127 int af = PIN_ALT(cfg);
128 int slpm = PIN_SLPM(cfg);
129
130 dev_dbg(nmk_chip->chip.dev, "pin %d: af %s, pull %s, slpm %s\n",
131 pin, afnames[af], pullnames[pull], slpmnames[slpm]);
132
133 __nmk_gpio_make_input(nmk_chip, offset);
134 __nmk_gpio_set_pull(nmk_chip, offset, pull);
135 __nmk_gpio_set_slpm(nmk_chip, offset, slpm);
136 __nmk_gpio_set_mode(nmk_chip, offset, af);
137}
138
139/**
140 * nmk_config_pin - configure a pin's mux attributes
141 * @cfg: pin confguration
142 *
143 * Configures a pin's mode (alternate function or GPIO), its pull up status,
144 * and its sleep mode based on the specified configuration. The @cfg is
145 * usually one of the SoC specific macros defined in mach/<soc>-pins.h. These
146 * are constructed using, and can be further enhanced with, the macros in
147 * plat/pincfg.h.
148 *
149 * If a pin's mode is set to GPIO, it is configured as an input to avoid
150 * side-effects. The gpio can be manipulated later using standard GPIO API
151 * calls.
152 */
153int nmk_config_pin(pin_cfg_t cfg)
154{
155 struct nmk_gpio_chip *nmk_chip;
156 int gpio = PIN_NUM(cfg);
157 unsigned long flags;
158
159 nmk_chip = get_irq_chip_data(NOMADIK_GPIO_TO_IRQ(gpio));
160 if (!nmk_chip)
161 return -EINVAL;
162
163 spin_lock_irqsave(&nmk_chip->lock, flags);
164 __nmk_config_pin(nmk_chip, gpio - nmk_chip->chip.base, cfg);
165 spin_unlock_irqrestore(&nmk_chip->lock, flags);
166
167 return 0;
168}
169EXPORT_SYMBOL(nmk_config_pin);
170
171/**
172 * nmk_config_pins - configure several pins at once
173 * @cfgs: array of pin configurations
174 * @num: number of elments in the array
175 *
176 * Configures several pins using nmk_config_pin(). Refer to that function for
177 * further information.
178 */
179int nmk_config_pins(pin_cfg_t *cfgs, int num)
180{
181 int ret = 0;
182 int i;
183
184 for (i = 0; i < num; i++) {
185 int ret = nmk_config_pin(cfgs[i]);
186 if (ret)
187 break;
188 }
189
190 return ret;
191}
192EXPORT_SYMBOL(nmk_config_pins);
193
194/**
195 * nmk_gpio_set_slpm() - configure the sleep mode of a pin
196 * @gpio: pin number
197 * @mode: NMK_GPIO_SLPM_INPUT or NMK_GPIO_SLPM_NOCHANGE,
198 *
199 * Sets the sleep mode of a pin. If @mode is NMK_GPIO_SLPM_INPUT, the pin is
200 * changed to an input (with pullup/down enabled) in sleep and deep sleep. If
201 * @mode is NMK_GPIO_SLPM_NOCHANGE, the pin remains in the state it was
202 * configured even when in sleep and deep sleep.
203 */
204int nmk_gpio_set_slpm(int gpio, enum nmk_gpio_slpm mode)
205{
206 struct nmk_gpio_chip *nmk_chip;
207 unsigned long flags;
208
209 nmk_chip = get_irq_chip_data(NOMADIK_GPIO_TO_IRQ(gpio));
210 if (!nmk_chip)
211 return -EINVAL;
212
213 spin_lock_irqsave(&nmk_chip->lock, flags);
214 __nmk_gpio_set_slpm(nmk_chip, gpio - nmk_chip->chip.base, mode);
215 spin_unlock_irqrestore(&nmk_chip->lock, flags);
216
217 return 0;
218}
219
220/**
221 * nmk_gpio_set_pull() - enable/disable pull up/down on a gpio
222 * @gpio: pin number
223 * @pull: one of NMK_GPIO_PULL_DOWN, NMK_GPIO_PULL_UP, and NMK_GPIO_PULL_NONE
224 *
225 * Enables/disables pull up/down on a specified pin. This only takes effect if
226 * the pin is configured as an input (either explicitly or by the alternate
227 * function).
228 *
229 * NOTE: If enabling the pull up/down, the caller must ensure that the GPIO is
230 * configured as an input. Otherwise, due to the way the controller registers
231 * work, this function will change the value output on the pin.
232 */
233int nmk_gpio_set_pull(int gpio, enum nmk_gpio_pull pull)
234{
235 struct nmk_gpio_chip *nmk_chip;
236 unsigned long flags;
237
238 nmk_chip = get_irq_chip_data(NOMADIK_GPIO_TO_IRQ(gpio));
239 if (!nmk_chip)
240 return -EINVAL;
241
242 spin_lock_irqsave(&nmk_chip->lock, flags);
243 __nmk_gpio_set_pull(nmk_chip, gpio - nmk_chip->chip.base, pull);
244 spin_unlock_irqrestore(&nmk_chip->lock, flags);
245
246 return 0;
247}
248
49/* Mode functions */ 249/* Mode functions */
50int nmk_gpio_set_mode(int gpio, int gpio_mode) 250int nmk_gpio_set_mode(int gpio, int gpio_mode)
51{ 251{
52 struct nmk_gpio_chip *nmk_chip; 252 struct nmk_gpio_chip *nmk_chip;
53 unsigned long flags; 253 unsigned long flags;
54 u32 afunc, bfunc, bit;
55 254
56 nmk_chip = get_irq_chip_data(NOMADIK_GPIO_TO_IRQ(gpio)); 255 nmk_chip = get_irq_chip_data(NOMADIK_GPIO_TO_IRQ(gpio));
57 if (!nmk_chip) 256 if (!nmk_chip)
58 return -EINVAL; 257 return -EINVAL;
59 258
60 bit = 1 << (gpio - nmk_chip->chip.base);
61
62 spin_lock_irqsave(&nmk_chip->lock, flags); 259 spin_lock_irqsave(&nmk_chip->lock, flags);
63 afunc = readl(nmk_chip->addr + NMK_GPIO_AFSLA) & ~bit; 260 __nmk_gpio_set_mode(nmk_chip, gpio - nmk_chip->chip.base, gpio_mode);
64 bfunc = readl(nmk_chip->addr + NMK_GPIO_AFSLB) & ~bit;
65 if (gpio_mode & NMK_GPIO_ALT_A)
66 afunc |= bit;
67 if (gpio_mode & NMK_GPIO_ALT_B)
68 bfunc |= bit;
69 writel(afunc, nmk_chip->addr + NMK_GPIO_AFSLA);
70 writel(bfunc, nmk_chip->addr + NMK_GPIO_AFSLB);
71 spin_unlock_irqrestore(&nmk_chip->lock, flags); 261 spin_unlock_irqrestore(&nmk_chip->lock, flags);
72 262
73 return 0; 263 return 0;
@@ -111,32 +301,41 @@ static void nmk_gpio_irq_ack(unsigned int irq)
111 writel(nmk_gpio_get_bitmask(gpio), nmk_chip->addr + NMK_GPIO_IC); 301 writel(nmk_gpio_get_bitmask(gpio), nmk_chip->addr + NMK_GPIO_IC);
112} 302}
113 303
304enum nmk_gpio_irq_type {
305 NORMAL,
306 WAKE,
307};
308
114static void __nmk_gpio_irq_modify(struct nmk_gpio_chip *nmk_chip, 309static void __nmk_gpio_irq_modify(struct nmk_gpio_chip *nmk_chip,
115 int gpio, bool enable) 310 int gpio, enum nmk_gpio_irq_type which,
311 bool enable)
116{ 312{
313 u32 rimsc = which == WAKE ? NMK_GPIO_RWIMSC : NMK_GPIO_RIMSC;
314 u32 fimsc = which == WAKE ? NMK_GPIO_FWIMSC : NMK_GPIO_FIMSC;
117 u32 bitmask = nmk_gpio_get_bitmask(gpio); 315 u32 bitmask = nmk_gpio_get_bitmask(gpio);
118 u32 reg; 316 u32 reg;
119 317
120 /* we must individually set/clear the two edges */ 318 /* we must individually set/clear the two edges */
121 if (nmk_chip->edge_rising & bitmask) { 319 if (nmk_chip->edge_rising & bitmask) {
122 reg = readl(nmk_chip->addr + NMK_GPIO_RIMSC); 320 reg = readl(nmk_chip->addr + rimsc);
123 if (enable) 321 if (enable)
124 reg |= bitmask; 322 reg |= bitmask;
125 else 323 else
126 reg &= ~bitmask; 324 reg &= ~bitmask;
127 writel(reg, nmk_chip->addr + NMK_GPIO_RIMSC); 325 writel(reg, nmk_chip->addr + rimsc);
128 } 326 }
129 if (nmk_chip->edge_falling & bitmask) { 327 if (nmk_chip->edge_falling & bitmask) {
130 reg = readl(nmk_chip->addr + NMK_GPIO_FIMSC); 328 reg = readl(nmk_chip->addr + fimsc);
131 if (enable) 329 if (enable)
132 reg |= bitmask; 330 reg |= bitmask;
133 else 331 else
134 reg &= ~bitmask; 332 reg &= ~bitmask;
135 writel(reg, nmk_chip->addr + NMK_GPIO_FIMSC); 333 writel(reg, nmk_chip->addr + fimsc);
136 } 334 }
137} 335}
138 336
139static void nmk_gpio_irq_modify(unsigned int irq, bool enable) 337static int nmk_gpio_irq_modify(unsigned int irq, enum nmk_gpio_irq_type which,
338 bool enable)
140{ 339{
141 int gpio; 340 int gpio;
142 struct nmk_gpio_chip *nmk_chip; 341 struct nmk_gpio_chip *nmk_chip;
@@ -147,26 +346,35 @@ static void nmk_gpio_irq_modify(unsigned int irq, bool enable)
147 nmk_chip = get_irq_chip_data(irq); 346 nmk_chip = get_irq_chip_data(irq);
148 bitmask = nmk_gpio_get_bitmask(gpio); 347 bitmask = nmk_gpio_get_bitmask(gpio);
149 if (!nmk_chip) 348 if (!nmk_chip)
150 return; 349 return -EINVAL;
151 350
152 spin_lock_irqsave(&nmk_chip->lock, flags); 351 spin_lock_irqsave(&nmk_chip->lock, flags);
153 __nmk_gpio_irq_modify(nmk_chip, gpio, enable); 352 __nmk_gpio_irq_modify(nmk_chip, gpio, which, enable);
154 spin_unlock_irqrestore(&nmk_chip->lock, flags); 353 spin_unlock_irqrestore(&nmk_chip->lock, flags);
354
355 return 0;
155} 356}
156 357
157static void nmk_gpio_irq_mask(unsigned int irq) 358static void nmk_gpio_irq_mask(unsigned int irq)
158{ 359{
159 nmk_gpio_irq_modify(irq, false); 360 nmk_gpio_irq_modify(irq, NORMAL, false);
160}; 361}
161 362
162static void nmk_gpio_irq_unmask(unsigned int irq) 363static void nmk_gpio_irq_unmask(unsigned int irq)
163{ 364{
164 nmk_gpio_irq_modify(irq, true); 365 nmk_gpio_irq_modify(irq, NORMAL, true);
366}
367
368static int nmk_gpio_irq_set_wake(unsigned int irq, unsigned int on)
369{
370 return nmk_gpio_irq_modify(irq, WAKE, on);
165} 371}
166 372
167static int nmk_gpio_irq_set_type(unsigned int irq, unsigned int type) 373static int nmk_gpio_irq_set_type(unsigned int irq, unsigned int type)
168{ 374{
169 bool enabled = !(irq_to_desc(irq)->status & IRQ_DISABLED); 375 struct irq_desc *desc = irq_to_desc(irq);
376 bool enabled = !(desc->status & IRQ_DISABLED);
377 bool wake = desc->wake_depth;
170 int gpio; 378 int gpio;
171 struct nmk_gpio_chip *nmk_chip; 379 struct nmk_gpio_chip *nmk_chip;
172 unsigned long flags; 380 unsigned long flags;
@@ -186,7 +394,10 @@ static int nmk_gpio_irq_set_type(unsigned int irq, unsigned int type)
186 spin_lock_irqsave(&nmk_chip->lock, flags); 394 spin_lock_irqsave(&nmk_chip->lock, flags);
187 395
188 if (enabled) 396 if (enabled)
189 __nmk_gpio_irq_modify(nmk_chip, gpio, false); 397 __nmk_gpio_irq_modify(nmk_chip, gpio, NORMAL, false);
398
399 if (wake)
400 __nmk_gpio_irq_modify(nmk_chip, gpio, WAKE, false);
190 401
191 nmk_chip->edge_rising &= ~bitmask; 402 nmk_chip->edge_rising &= ~bitmask;
192 if (type & IRQ_TYPE_EDGE_RISING) 403 if (type & IRQ_TYPE_EDGE_RISING)
@@ -197,7 +408,10 @@ static int nmk_gpio_irq_set_type(unsigned int irq, unsigned int type)
197 nmk_chip->edge_falling |= bitmask; 408 nmk_chip->edge_falling |= bitmask;
198 409
199 if (enabled) 410 if (enabled)
200 __nmk_gpio_irq_modify(nmk_chip, gpio, true); 411 __nmk_gpio_irq_modify(nmk_chip, gpio, NORMAL, true);
412
413 if (wake)
414 __nmk_gpio_irq_modify(nmk_chip, gpio, WAKE, true);
201 415
202 spin_unlock_irqrestore(&nmk_chip->lock, flags); 416 spin_unlock_irqrestore(&nmk_chip->lock, flags);
203 417
@@ -210,6 +424,7 @@ static struct irq_chip nmk_gpio_irq_chip = {
210 .mask = nmk_gpio_irq_mask, 424 .mask = nmk_gpio_irq_mask,
211 .unmask = nmk_gpio_irq_unmask, 425 .unmask = nmk_gpio_irq_unmask,
212 .set_type = nmk_gpio_irq_set_type, 426 .set_type = nmk_gpio_irq_set_type,
427 .set_wake = nmk_gpio_irq_set_wake,
213}; 428};
214 429
215static void nmk_gpio_irq_handler(unsigned int irq, struct irq_desc *desc) 430static void nmk_gpio_irq_handler(unsigned int irq, struct irq_desc *desc)
@@ -266,16 +481,6 @@ static int nmk_gpio_make_input(struct gpio_chip *chip, unsigned offset)
266 return 0; 481 return 0;
267} 482}
268 483
269static int nmk_gpio_make_output(struct gpio_chip *chip, unsigned offset,
270 int val)
271{
272 struct nmk_gpio_chip *nmk_chip =
273 container_of(chip, struct nmk_gpio_chip, chip);
274
275 writel(1 << offset, nmk_chip->addr + NMK_GPIO_DIRS);
276 return 0;
277}
278
279static int nmk_gpio_get_input(struct gpio_chip *chip, unsigned offset) 484static int nmk_gpio_get_input(struct gpio_chip *chip, unsigned offset)
280{ 485{
281 struct nmk_gpio_chip *nmk_chip = 486 struct nmk_gpio_chip *nmk_chip =
@@ -298,12 +503,33 @@ static void nmk_gpio_set_output(struct gpio_chip *chip, unsigned offset,
298 writel(bit, nmk_chip->addr + NMK_GPIO_DATC); 503 writel(bit, nmk_chip->addr + NMK_GPIO_DATC);
299} 504}
300 505
506static int nmk_gpio_make_output(struct gpio_chip *chip, unsigned offset,
507 int val)
508{
509 struct nmk_gpio_chip *nmk_chip =
510 container_of(chip, struct nmk_gpio_chip, chip);
511
512 writel(1 << offset, nmk_chip->addr + NMK_GPIO_DIRS);
513 nmk_gpio_set_output(chip, offset, val);
514
515 return 0;
516}
517
518static int nmk_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
519{
520 struct nmk_gpio_chip *nmk_chip =
521 container_of(chip, struct nmk_gpio_chip, chip);
522
523 return NOMADIK_GPIO_TO_IRQ(nmk_chip->chip.base) + offset;
524}
525
301/* This structure is replicated for each GPIO block allocated at probe time */ 526/* This structure is replicated for each GPIO block allocated at probe time */
302static struct gpio_chip nmk_gpio_template = { 527static struct gpio_chip nmk_gpio_template = {
303 .direction_input = nmk_gpio_make_input, 528 .direction_input = nmk_gpio_make_input,
304 .get = nmk_gpio_get_input, 529 .get = nmk_gpio_get_input,
305 .direction_output = nmk_gpio_make_output, 530 .direction_output = nmk_gpio_make_output,
306 .set = nmk_gpio_set_output, 531 .set = nmk_gpio_set_output,
532 .to_irq = nmk_gpio_to_irq,
307 .ngpio = NMK_GPIO_PER_CHIP, 533 .ngpio = NMK_GPIO_PER_CHIP,
308 .can_sleep = 0, 534 .can_sleep = 0,
309}; 535};
@@ -393,30 +619,12 @@ out:
393 return ret; 619 return ret;
394} 620}
395 621
396static int __exit nmk_gpio_remove(struct platform_device *dev)
397{
398 struct nmk_gpio_chip *nmk_chip;
399 struct resource *res;
400
401 res = platform_get_resource(dev, IORESOURCE_MEM, 0);
402
403 nmk_chip = platform_get_drvdata(dev);
404 gpiochip_remove(&nmk_chip->chip);
405 clk_disable(nmk_chip->clk);
406 clk_put(nmk_chip->clk);
407 kfree(nmk_chip);
408 release_mem_region(res->start, resource_size(res));
409 return 0;
410}
411
412
413static struct platform_driver nmk_gpio_driver = { 622static struct platform_driver nmk_gpio_driver = {
414 .driver = { 623 .driver = {
415 .owner = THIS_MODULE, 624 .owner = THIS_MODULE,
416 .name = "gpio", 625 .name = "gpio",
417 }, 626 },
418 .probe = nmk_gpio_probe, 627 .probe = nmk_gpio_probe,
419 .remove = __exit_p(nmk_gpio_remove),
420 .suspend = NULL, /* to be done */ 628 .suspend = NULL, /* to be done */
421 .resume = NULL, 629 .resume = NULL,
422}; 630};
@@ -426,7 +634,7 @@ static int __init nmk_gpio_init(void)
426 return platform_driver_register(&nmk_gpio_driver); 634 return platform_driver_register(&nmk_gpio_driver);
427} 635}
428 636
429arch_initcall(nmk_gpio_init); 637core_initcall(nmk_gpio_init);
430 638
431MODULE_AUTHOR("Prafulla WADASKAR and Alessandro Rubini"); 639MODULE_AUTHOR("Prafulla WADASKAR and Alessandro Rubini");
432MODULE_DESCRIPTION("Nomadik GPIO Driver"); 640MODULE_DESCRIPTION("Nomadik GPIO Driver");
diff --git a/arch/arm/plat-nomadik/include/plat/gpio.h b/arch/arm/plat-nomadik/include/plat/gpio.h
index 4200811249ca..aba355101f49 100644
--- a/arch/arm/plat-nomadik/include/plat/gpio.h
+++ b/arch/arm/plat-nomadik/include/plat/gpio.h
@@ -55,6 +55,21 @@
55#define NMK_GPIO_ALT_B 2 55#define NMK_GPIO_ALT_B 2
56#define NMK_GPIO_ALT_C (NMK_GPIO_ALT_A | NMK_GPIO_ALT_B) 56#define NMK_GPIO_ALT_C (NMK_GPIO_ALT_A | NMK_GPIO_ALT_B)
57 57
58/* Pull up/down values */
59enum nmk_gpio_pull {
60 NMK_GPIO_PULL_NONE,
61 NMK_GPIO_PULL_UP,
62 NMK_GPIO_PULL_DOWN,
63};
64
65/* Sleep mode */
66enum nmk_gpio_slpm {
67 NMK_GPIO_SLPM_INPUT,
68 NMK_GPIO_SLPM_NOCHANGE,
69};
70
71extern int nmk_gpio_set_slpm(int gpio, enum nmk_gpio_slpm mode);
72extern int nmk_gpio_set_pull(int gpio, enum nmk_gpio_pull pull);
58extern int nmk_gpio_set_mode(int gpio, int gpio_mode); 73extern int nmk_gpio_set_mode(int gpio, int gpio_mode);
59extern int nmk_gpio_get_mode(int gpio); 74extern int nmk_gpio_get_mode(int gpio);
60 75
diff --git a/arch/arm/plat-nomadik/include/plat/mtu.h b/arch/arm/plat-nomadik/include/plat/mtu.h
index 42c907258b14..65704a3d4241 100644
--- a/arch/arm/plat-nomadik/include/plat/mtu.h
+++ b/arch/arm/plat-nomadik/include/plat/mtu.h
@@ -1,6 +1,12 @@
1#ifndef __PLAT_MTU_H 1#ifndef __PLAT_MTU_H
2#define __PLAT_MTU_H 2#define __PLAT_MTU_H
3 3
4/*
5 * Guaranteed runtime conversion range in seconds for
6 * the clocksource and clockevent.
7 */
8#define MTU_MIN_RANGE 4
9
4/* should be set by the platform code */ 10/* should be set by the platform code */
5extern void __iomem *mtu_base; 11extern void __iomem *mtu_base;
6 12
diff --git a/arch/arm/plat-nomadik/include/plat/pincfg.h b/arch/arm/plat-nomadik/include/plat/pincfg.h
new file mode 100644
index 000000000000..7eed11c1038d
--- /dev/null
+++ b/arch/arm/plat-nomadik/include/plat/pincfg.h
@@ -0,0 +1,72 @@
1/*
2 * Copyright (C) ST-Ericsson SA 2010
3 *
4 * License terms: GNU General Public License, version 2
5 * Author: Rabin Vincent <rabin.vincent@stericsson.com> for ST-Ericsson
6 *
7 * Based on arch/arm/mach-pxa/include/mach/mfp.h:
8 * Copyright (C) 2007 Marvell International Ltd.
9 * eric miao <eric.miao@marvell.com>
10 */
11
12#ifndef __PLAT_PINCFG_H
13#define __PLAT_PINCFG_H
14
15/*
16 * pin configurations are represented by 32-bit integers:
17 *
18 * bit 0.. 8 - Pin Number (512 Pins Maximum)
19 * bit 9..10 - Alternate Function Selection
20 * bit 11..12 - Pull up/down state
21 * bit 13 - Sleep mode behaviour
22 *
23 * to facilitate the definition, the following macros are provided
24 *
25 * PIN_CFG_DEFAULT - default config (0):
26 * pull up/down = disabled
27 * sleep mode = input
28 *
29 * PIN_CFG - default config with alternate function
30 * PIN_CFG_PULL - default config with alternate function and pull up/down
31 */
32
33typedef unsigned long pin_cfg_t;
34
35#define PIN_NUM_MASK 0x1ff
36#define PIN_NUM(x) ((x) & PIN_NUM_MASK)
37
38#define PIN_ALT_SHIFT 9
39#define PIN_ALT_MASK (0x3 << PIN_ALT_SHIFT)
40#define PIN_ALT(x) (((x) & PIN_ALT_MASK) >> PIN_ALT_SHIFT)
41#define PIN_GPIO (NMK_GPIO_ALT_GPIO << PIN_ALT_SHIFT)
42#define PIN_ALT_A (NMK_GPIO_ALT_A << PIN_ALT_SHIFT)
43#define PIN_ALT_B (NMK_GPIO_ALT_B << PIN_ALT_SHIFT)
44#define PIN_ALT_C (NMK_GPIO_ALT_C << PIN_ALT_SHIFT)
45
46#define PIN_PULL_SHIFT 11
47#define PIN_PULL_MASK (0x3 << PIN_PULL_SHIFT)
48#define PIN_PULL(x) (((x) & PIN_PULL_MASK) >> PIN_PULL_SHIFT)
49#define PIN_PULL_NONE (NMK_GPIO_PULL_NONE << PIN_PULL_SHIFT)
50#define PIN_PULL_UP (NMK_GPIO_PULL_UP << PIN_PULL_SHIFT)
51#define PIN_PULL_DOWN (NMK_GPIO_PULL_DOWN << PIN_PULL_SHIFT)
52
53#define PIN_SLPM_SHIFT 13
54#define PIN_SLPM_MASK (0x1 << PIN_SLPM_SHIFT)
55#define PIN_SLPM(x) (((x) & PIN_SLPM_MASK) >> PIN_SLPM_SHIFT)
56#define PIN_SLPM_INPUT (NMK_GPIO_SLPM_INPUT << PIN_SLPM_SHIFT)
57#define PIN_SLPM_NOCHANGE (NMK_GPIO_SLPM_NOCHANGE << PIN_SLPM_SHIFT)
58
59#define PIN_CFG_DEFAULT (PIN_PULL_NONE | PIN_SLPM_INPUT)
60
61#define PIN_CFG(num, alt) \
62 (PIN_CFG_DEFAULT |\
63 (PIN_NUM(num) | PIN_##alt))
64
65#define PIN_CFG_PULL(num, alt, pull) \
66 ((PIN_CFG_DEFAULT & ~PIN_PULL_MASK) |\
67 (PIN_NUM(num) | PIN_##alt | PIN_PULL_##pull))
68
69extern int nmk_config_pin(pin_cfg_t cfg);
70extern int nmk_config_pins(pin_cfg_t *cfgs, int num);
71
72#endif
diff --git a/arch/arm/plat-nomadik/timer.c b/arch/arm/plat-nomadik/timer.c
index 08aaa4a7f65f..ea3ca86c5283 100644
--- a/arch/arm/plat-nomadik/timer.c
+++ b/arch/arm/plat-nomadik/timer.c
@@ -42,7 +42,6 @@ static struct clocksource nmdk_clksrc = {
42 .rating = 200, 42 .rating = 200,
43 .read = nmdk_read_timer_dummy, 43 .read = nmdk_read_timer_dummy,
44 .mask = CLOCKSOURCE_MASK(32), 44 .mask = CLOCKSOURCE_MASK(32),
45 .shift = 20,
46 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 45 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
47}; 46};
48 47
@@ -82,6 +81,12 @@ static void nmdk_clkevt_mode(enum clock_event_mode mode,
82 case CLOCK_EVT_MODE_UNUSED: 81 case CLOCK_EVT_MODE_UNUSED:
83 /* disable irq */ 82 /* disable irq */
84 writel(0, mtu_base + MTU_IMSC); 83 writel(0, mtu_base + MTU_IMSC);
84 /* disable timer */
85 cr = readl(mtu_base + MTU_CR(1));
86 cr &= ~MTU_CRn_ENA;
87 writel(cr, mtu_base + MTU_CR(1));
88 /* load some high default value */
89 writel(0xffffffff, mtu_base + MTU_LR(1));
85 break; 90 break;
86 case CLOCK_EVT_MODE_RESUME: 91 case CLOCK_EVT_MODE_RESUME:
87 break; 92 break;
@@ -98,7 +103,6 @@ static int nmdk_clkevt_next(unsigned long evt, struct clock_event_device *ev)
98static struct clock_event_device nmdk_clkevt = { 103static struct clock_event_device nmdk_clkevt = {
99 .name = "mtu_1", 104 .name = "mtu_1",
100 .features = CLOCK_EVT_FEAT_ONESHOT, 105 .features = CLOCK_EVT_FEAT_ONESHOT,
101 .shift = 32,
102 .rating = 200, 106 .rating = 200,
103 .set_mode = nmdk_clkevt_mode, 107 .set_mode = nmdk_clkevt_mode,
104 .set_next_event = nmdk_clkevt_next, 108 .set_next_event = nmdk_clkevt_next,
@@ -151,6 +155,7 @@ void __init nmdk_timer_init(void)
151 } else { 155 } else {
152 cr |= MTU_CRn_PRESCALE_1; 156 cr |= MTU_CRn_PRESCALE_1;
153 } 157 }
158 clocksource_calc_mult_shift(&nmdk_clksrc, rate, MTU_MIN_RANGE);
154 159
155 /* Timer 0 is the free running clocksource */ 160 /* Timer 0 is the free running clocksource */
156 writel(cr, mtu_base + MTU_CR(0)); 161 writel(cr, mtu_base + MTU_CR(0));
@@ -158,7 +163,6 @@ void __init nmdk_timer_init(void)
158 writel(0, mtu_base + MTU_BGLR(0)); 163 writel(0, mtu_base + MTU_BGLR(0));
159 writel(cr | MTU_CRn_ENA, mtu_base + MTU_CR(0)); 164 writel(cr | MTU_CRn_ENA, mtu_base + MTU_CR(0));
160 165
161 nmdk_clksrc.mult = clocksource_hz2mult(rate, nmdk_clksrc.shift);
162 /* Now the scheduling clock is ready */ 166 /* Now the scheduling clock is ready */
163 nmdk_clksrc.read = nmdk_read_timer; 167 nmdk_clksrc.read = nmdk_read_timer;
164 168
@@ -175,8 +179,10 @@ void __init nmdk_timer_init(void)
175 } else { 179 } else {
176 cr |= MTU_CRn_PRESCALE_1; 180 cr |= MTU_CRn_PRESCALE_1;
177 } 181 }
182 clockevents_calc_mult_shift(&nmdk_clkevt, rate, MTU_MIN_RANGE);
183
178 writel(cr | MTU_CRn_ONESHOT, mtu_base + MTU_CR(1)); /* off, currently */ 184 writel(cr | MTU_CRn_ONESHOT, mtu_base + MTU_CR(1)); /* off, currently */
179 nmdk_clkevt.mult = div_sc(rate, NSEC_PER_SEC, nmdk_clkevt.shift); 185
180 nmdk_clkevt.max_delta_ns = 186 nmdk_clkevt.max_delta_ns =
181 clockevent_delta2ns(0xffffffff, &nmdk_clkevt); 187 clockevent_delta2ns(0xffffffff, &nmdk_clkevt);
182 nmdk_clkevt.min_delta_ns = 188 nmdk_clkevt.min_delta_ns =
diff --git a/arch/arm/plat-omap/common.c b/arch/arm/plat-omap/common.c
index 219c01e82bc5..ebed82699eb2 100644
--- a/arch/arm/plat-omap/common.c
+++ b/arch/arm/plat-omap/common.c
@@ -22,6 +22,7 @@
22#include <linux/serial_reg.h> 22#include <linux/serial_reg.h>
23#include <linux/clk.h> 23#include <linux/clk.h>
24#include <linux/io.h> 24#include <linux/io.h>
25#include <linux/omapfb.h>
25 26
26#include <mach/hardware.h> 27#include <mach/hardware.h>
27#include <asm/system.h> 28#include <asm/system.h>
@@ -35,6 +36,7 @@
35#include <plat/mux.h> 36#include <plat/mux.h>
36#include <plat/fpga.h> 37#include <plat/fpga.h>
37#include <plat/serial.h> 38#include <plat/serial.h>
39#include <plat/vram.h>
38 40
39#include <plat/clock.h> 41#include <plat/clock.h>
40 42
@@ -81,6 +83,12 @@ const void *omap_get_var_config(u16 tag, size_t *len)
81} 83}
82EXPORT_SYMBOL(omap_get_var_config); 84EXPORT_SYMBOL(omap_get_var_config);
83 85
86void __init omap_reserve(void)
87{
88 omapfb_reserve_sdram_memblock();
89 omap_vram_reserve_sdram_memblock();
90}
91
84/* 92/*
85 * 32KHz clocksource ... always available, on pretty most chips except 93 * 32KHz clocksource ... always available, on pretty most chips except
86 * OMAP 730 and 1510. Other timers could be used as clocksources, with 94 * OMAP 730 and 1510. Other timers could be used as clocksources, with
diff --git a/arch/arm/plat-omap/fb.c b/arch/arm/plat-omap/fb.c
index d3eea4f47533..0054b9501a53 100644
--- a/arch/arm/plat-omap/fb.c
+++ b/arch/arm/plat-omap/fb.c
@@ -26,7 +26,7 @@
26#include <linux/mm.h> 26#include <linux/mm.h>
27#include <linux/init.h> 27#include <linux/init.h>
28#include <linux/platform_device.h> 28#include <linux/platform_device.h>
29#include <linux/bootmem.h> 29#include <linux/memblock.h>
30#include <linux/io.h> 30#include <linux/io.h>
31#include <linux/omapfb.h> 31#include <linux/omapfb.h>
32 32
@@ -171,49 +171,78 @@ static int check_fbmem_region(int region_idx, struct omapfb_mem_region *rg,
171 return 0; 171 return 0;
172} 172}
173 173
174static int valid_sdram(unsigned long addr, unsigned long size)
175{
176 struct memblock_property res;
177
178 res.base = addr;
179 res.size = size;
180 return !memblock_find(&res) && res.base == addr && res.size == size;
181}
182
183static int reserve_sdram(unsigned long addr, unsigned long size)
184{
185 if (memblock_is_region_reserved(addr, size))
186 return -EBUSY;
187 if (memblock_reserve(addr, size))
188 return -ENOMEM;
189 return 0;
190}
191
174/* 192/*
175 * Called from map_io. We need to call to this early enough so that we 193 * Called from map_io. We need to call to this early enough so that we
176 * can reserve the fixed SDRAM regions before VM could get hold of them. 194 * can reserve the fixed SDRAM regions before VM could get hold of them.
177 */ 195 */
178void __init omapfb_reserve_sdram(void) 196void __init omapfb_reserve_sdram_memblock(void)
179{ 197{
180 struct bootmem_data *bdata; 198 unsigned long reserved = 0;
181 unsigned long sdram_start, sdram_size; 199 int i;
182 unsigned long reserved;
183 int i;
184 200
185 if (config_invalid) 201 if (config_invalid)
186 return; 202 return;
187 203
188 bdata = NODE_DATA(0)->bdata;
189 sdram_start = bdata->node_min_pfn << PAGE_SHIFT;
190 sdram_size = (bdata->node_low_pfn << PAGE_SHIFT) - sdram_start;
191 reserved = 0;
192 for (i = 0; ; i++) { 204 for (i = 0; ; i++) {
193 struct omapfb_mem_region rg; 205 struct omapfb_mem_region rg;
194 206
195 if (get_fbmem_region(i, &rg) < 0) 207 if (get_fbmem_region(i, &rg) < 0)
196 break; 208 break;
209
197 if (i == OMAPFB_PLANE_NUM) { 210 if (i == OMAPFB_PLANE_NUM) {
198 printk(KERN_ERR 211 pr_err("Extraneous FB mem configuration entries\n");
199 "Extraneous FB mem configuration entries\n");
200 config_invalid = 1; 212 config_invalid = 1;
201 return; 213 return;
202 } 214 }
215
203 /* Check if it's our memory type. */ 216 /* Check if it's our memory type. */
204 if (set_fbmem_region_type(&rg, OMAPFB_MEMTYPE_SDRAM, 217 if (rg.type != OMAPFB_MEMTYPE_SDRAM)
205 sdram_start, sdram_size) < 0 ||
206 (rg.type != OMAPFB_MEMTYPE_SDRAM))
207 continue; 218 continue;
208 BUG_ON(omapfb_config.mem_desc.region[i].size); 219
209 if (check_fbmem_region(i, &rg, sdram_start, sdram_size) < 0) { 220 /* Check if the region falls within SDRAM */
221 if (rg.paddr && !valid_sdram(rg.paddr, rg.size))
222 continue;
223
224 if (rg.size == 0) {
225 pr_err("Zero size for FB region %d\n", i);
210 config_invalid = 1; 226 config_invalid = 1;
211 return; 227 return;
212 } 228 }
229
213 if (rg.paddr) { 230 if (rg.paddr) {
214 reserve_bootmem(rg.paddr, rg.size, BOOTMEM_DEFAULT); 231 if (reserve_sdram(rg.paddr, rg.size)) {
232 pr_err("Trying to use reserved memory for FB region %d\n",
233 i);
234 config_invalid = 1;
235 return;
236 }
215 reserved += rg.size; 237 reserved += rg.size;
216 } 238 }
239
240 if (omapfb_config.mem_desc.region[i].size) {
241 pr_err("FB region %d already set\n", i);
242 config_invalid = 1;
243 return;
244 }
245
217 omapfb_config.mem_desc.region[i] = rg; 246 omapfb_config.mem_desc.region[i] = rg;
218 configured_regions++; 247 configured_regions++;
219 } 248 }
@@ -359,7 +388,10 @@ static inline int omap_init_fb(void)
359 388
360arch_initcall(omap_init_fb); 389arch_initcall(omap_init_fb);
361 390
362void omapfb_reserve_sdram(void) {} 391void omapfb_reserve_sdram_memblock(void)
392{
393}
394
363unsigned long omapfb_reserve_sram(unsigned long sram_pstart, 395unsigned long omapfb_reserve_sram(unsigned long sram_pstart,
364 unsigned long sram_vstart, 396 unsigned long sram_vstart,
365 unsigned long sram_size, 397 unsigned long sram_size,
@@ -375,7 +407,10 @@ void omapfb_set_platform_data(struct omapfb_platform_data *data)
375{ 407{
376} 408}
377 409
378void omapfb_reserve_sdram(void) {} 410void omapfb_reserve_sdram_memblock(void)
411{
412}
413
379unsigned long omapfb_reserve_sram(unsigned long sram_pstart, 414unsigned long omapfb_reserve_sram(unsigned long sram_pstart,
380 unsigned long sram_vstart, 415 unsigned long sram_vstart,
381 unsigned long sram_size, 416 unsigned long sram_size,
diff --git a/arch/arm/plat-omap/include/plat/common.h b/arch/arm/plat-omap/include/plat/common.h
index d265018f5e6b..5e4afbee0fd7 100644
--- a/arch/arm/plat-omap/include/plat/common.h
+++ b/arch/arm/plat-omap/include/plat/common.h
@@ -34,6 +34,8 @@ struct sys_timer;
34extern void omap_map_common_io(void); 34extern void omap_map_common_io(void);
35extern struct sys_timer omap_timer; 35extern struct sys_timer omap_timer;
36 36
37extern void omap_reserve(void);
38
37/* 39/*
38 * IO bases for various OMAP processors 40 * IO bases for various OMAP processors
39 * Except the tap base, rest all the io bases 41 * Except the tap base, rest all the io bases
diff --git a/arch/arm/plat-omap/include/plat/vram.h b/arch/arm/plat-omap/include/plat/vram.h
index edd4987758a6..0aa4ecd12c7d 100644
--- a/arch/arm/plat-omap/include/plat/vram.h
+++ b/arch/arm/plat-omap/include/plat/vram.h
@@ -38,7 +38,7 @@ extern void omap_vram_get_info(unsigned long *vram, unsigned long *free_vram,
38extern void omap_vram_set_sdram_vram(u32 size, u32 start); 38extern void omap_vram_set_sdram_vram(u32 size, u32 start);
39extern void omap_vram_set_sram_vram(u32 size, u32 start); 39extern void omap_vram_set_sram_vram(u32 size, u32 start);
40 40
41extern void omap_vram_reserve_sdram(void); 41extern void omap_vram_reserve_sdram_memblock(void);
42extern unsigned long omap_vram_reserve_sram(unsigned long sram_pstart, 42extern unsigned long omap_vram_reserve_sram(unsigned long sram_pstart,
43 unsigned long sram_vstart, 43 unsigned long sram_vstart,
44 unsigned long sram_size, 44 unsigned long sram_size,
@@ -48,7 +48,7 @@ extern unsigned long omap_vram_reserve_sram(unsigned long sram_pstart,
48static inline void omap_vram_set_sdram_vram(u32 size, u32 start) { } 48static inline void omap_vram_set_sdram_vram(u32 size, u32 start) { }
49static inline void omap_vram_set_sram_vram(u32 size, u32 start) { } 49static inline void omap_vram_set_sram_vram(u32 size, u32 start) { }
50 50
51static inline void omap_vram_reserve_sdram(void) { } 51static inline void omap_vram_reserve_sdram_memblock(void) { }
52static inline unsigned long omap_vram_reserve_sram(unsigned long sram_pstart, 52static inline unsigned long omap_vram_reserve_sram(unsigned long sram_pstart,
53 unsigned long sram_vstart, 53 unsigned long sram_vstart,
54 unsigned long sram_size, 54 unsigned long sram_size,
diff --git a/arch/arm/plat-orion/pcie.c b/arch/arm/plat-orion/pcie.c
index 54c84a492a0f..779553a1595e 100644
--- a/arch/arm/plat-orion/pcie.c
+++ b/arch/arm/plat-orion/pcie.c
@@ -13,6 +13,7 @@
13#include <linux/mbus.h> 13#include <linux/mbus.h>
14#include <asm/mach/pci.h> 14#include <asm/mach/pci.h>
15#include <plat/pcie.h> 15#include <plat/pcie.h>
16#include <linux/delay.h>
16 17
17/* 18/*
18 * PCIe unit register offsets. 19 * PCIe unit register offsets.
@@ -46,6 +47,8 @@
46#define PCIE_STAT_BUS_OFFS 8 47#define PCIE_STAT_BUS_OFFS 8
47#define PCIE_STAT_BUS_MASK 0xff 48#define PCIE_STAT_BUS_MASK 0xff
48#define PCIE_STAT_LINK_DOWN 1 49#define PCIE_STAT_LINK_DOWN 1
50#define PCIE_DEBUG_CTRL 0x1a60
51#define PCIE_DEBUG_SOFT_RESET (1<<20)
49 52
50 53
51u32 __init orion_pcie_dev_id(void __iomem *base) 54u32 __init orion_pcie_dev_id(void __iomem *base)
@@ -85,6 +88,32 @@ void __init orion_pcie_set_local_bus_nr(void __iomem *base, int nr)
85 writel(stat, base + PCIE_STAT_OFF); 88 writel(stat, base + PCIE_STAT_OFF);
86} 89}
87 90
91void __init orion_pcie_reset(void __iomem *base)
92{
93 u32 reg;
94 int i;
95
96 /*
97 * MV-S104860-U0, Rev. C:
98 * PCI Express Unit Soft Reset
99 * When set, generates an internal reset in the PCI Express unit.
100 * This bit should be cleared after the link is re-established.
101 */
102 reg = readl(base + PCIE_DEBUG_CTRL);
103 reg |= PCIE_DEBUG_SOFT_RESET;
104 writel(reg, base + PCIE_DEBUG_CTRL);
105
106 for (i = 0; i < 20; i++) {
107 mdelay(10);
108
109 if (orion_pcie_link_up(base))
110 break;
111 }
112
113 reg &= ~(PCIE_DEBUG_SOFT_RESET);
114 writel(reg, base + PCIE_DEBUG_CTRL);
115}
116
88/* 117/*
89 * Setup PCIE BARs and Address Decode Wins: 118 * Setup PCIE BARs and Address Decode Wins:
90 * BAR[0,2] -> disabled, BAR[1] -> covers all DRAM banks 119 * BAR[0,2] -> disabled, BAR[1] -> covers all DRAM banks
@@ -153,6 +182,11 @@ void __init orion_pcie_setup(void __iomem *base,
153 u32 mask; 182 u32 mask;
154 183
155 /* 184 /*
185 * soft reset PCIe unit
186 */
187 orion_pcie_reset(base);
188
189 /*
156 * Point PCIe unit MBUS decode windows to DRAM space. 190 * Point PCIe unit MBUS decode windows to DRAM space.
157 */ 191 */
158 orion_pcie_setup_wins(base, dram); 192 orion_pcie_setup_wins(base, dram);
diff --git a/arch/arm/plat-s3c24xx/clock.c b/arch/arm/plat-s3c24xx/clock.c
index 8474d05274bd..931d26d1a54b 100644
--- a/arch/arm/plat-s3c24xx/clock.c
+++ b/arch/arm/plat-s3c24xx/clock.c
@@ -43,7 +43,7 @@
43#include <plat/cpu.h> 43#include <plat/cpu.h>
44#include <plat/pll.h> 44#include <plat/pll.h>
45 45
46/* initalise all the clocks */ 46/* initialise all the clocks */
47 47
48void __init_or_cpufreq s3c24xx_setup_clocks(unsigned long fclk, 48void __init_or_cpufreq s3c24xx_setup_clocks(unsigned long fclk,
49 unsigned long hclk, 49 unsigned long hclk,
diff --git a/arch/arm/plat-samsung/clock.c b/arch/arm/plat-samsung/clock.c
index 8bf79f3efdfb..90a20512d68d 100644
--- a/arch/arm/plat-samsung/clock.c
+++ b/arch/arm/plat-samsung/clock.c
@@ -391,7 +391,7 @@ void __init s3c_disable_clocks(struct clk *clkp, int nr_clks)
391 (clkp->enable)(clkp, 0); 391 (clkp->enable)(clkp, 0);
392} 392}
393 393
394/* initalise all the clocks */ 394/* initialise all the clocks */
395 395
396int __init s3c24xx_register_baseclocks(unsigned long xtal) 396int __init s3c24xx_register_baseclocks(unsigned long xtal)
397{ 397{
diff --git a/arch/arm/plat-samsung/include/plat/keypad.h b/arch/arm/plat-samsung/include/plat/keypad.h
new file mode 100644
index 000000000000..3a70c125fe51
--- /dev/null
+++ b/arch/arm/plat-samsung/include/plat/keypad.h
@@ -0,0 +1,43 @@
1/*
2 * Samsung Platform - Keypad platform data definitions
3 *
4 * Copyright (C) 2010 Samsung Electronics Co.Ltd
5 * Author: Joonyoung Shim <jy0922.shim@samsung.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13#ifndef __PLAT_SAMSUNG_KEYPAD_H
14#define __PLAT_SAMSUNG_KEYPAD_H
15
16#include <linux/input/matrix_keypad.h>
17
18#define SAMSUNG_MAX_ROWS 8
19#define SAMSUNG_MAX_COLS 8
20
21/**
22 * struct samsung_keypad_platdata - Platform device data for Samsung Keypad.
23 * @keymap_data: pointer to &matrix_keymap_data.
24 * @rows: number of keypad row supported.
25 * @cols: number of keypad col supported.
26 * @no_autorepeat: disable key autorepeat.
27 * @wakeup: controls whether the device should be set up as wakeup source.
28 * @cfg_gpio: configure the GPIO.
29 *
30 * Initialisation data specific to either the machine or the platform
31 * for the device driver to use or call-back when configuring gpio.
32 */
33struct samsung_keypad_platdata {
34 const struct matrix_keymap_data *keymap_data;
35 unsigned int rows;
36 unsigned int cols;
37 bool no_autorepeat;
38 bool wakeup;
39
40 void (*cfg_gpio)(unsigned int rows, unsigned int cols);
41};
42
43#endif /* __PLAT_SAMSUNG_KEYPAD_H */
diff --git a/arch/arm/plat-spear/padmux.c b/arch/arm/plat-spear/padmux.c
index d2aab3adcdeb..555eec6dc1cb 100644
--- a/arch/arm/plat-spear/padmux.c
+++ b/arch/arm/plat-spear/padmux.c
@@ -66,7 +66,7 @@ static int pmx_mode_set(struct pmx_mode *mode)
66 * If peripheral is not supported by current mode then request is rejected. 66 * If peripheral is not supported by current mode then request is rejected.
67 * Conflicts between peripherals are not handled and peripherals will be 67 * Conflicts between peripherals are not handled and peripherals will be
68 * enabled in the order they are present in pmx_dev array. 68 * enabled in the order they are present in pmx_dev array.
69 * In case of conflicts last peripheral enalbed will be present. 69 * In case of conflicts last peripheral enabled will be present.
70 * Returns -ve on Err otherwise 0 70 * Returns -ve on Err otherwise 0
71 */ 71 */
72static int pmx_devs_enable(struct pmx_dev **devs, u8 count) 72static int pmx_devs_enable(struct pmx_dev **devs, u8 count)
diff --git a/arch/arm/plat-spear/time.c b/arch/arm/plat-spear/time.c
index a1025d38f383..ab211652e4ca 100644
--- a/arch/arm/plat-spear/time.c
+++ b/arch/arm/plat-spear/time.c
@@ -58,6 +58,11 @@
58 58
59#define INT_STATUS 0x1 59#define INT_STATUS 0x1
60 60
61/*
62 * Minimum clocksource/clockevent timer range in seconds
63 */
64#define SPEAR_MIN_RANGE 4
65
61static __iomem void *gpt_base; 66static __iomem void *gpt_base;
62static struct clk *gpt_clk; 67static struct clk *gpt_clk;
63 68
@@ -66,44 +71,6 @@ static void clockevent_set_mode(enum clock_event_mode mode,
66static int clockevent_next_event(unsigned long evt, 71static int clockevent_next_event(unsigned long evt,
67 struct clock_event_device *clk_event_dev); 72 struct clock_event_device *clk_event_dev);
68 73
69/*
70 * Following clocksource_set_clock and clockevent_set_clock picked
71 * from arch/mips/kernel/time.c
72 */
73
74void __init clocksource_set_clock(struct clocksource *cs, unsigned int clock)
75{
76 u64 temp;
77 u32 shift;
78
79 /* Find a shift value */
80 for (shift = 32; shift > 0; shift--) {
81 temp = (u64) NSEC_PER_SEC << shift;
82 do_div(temp, clock);
83 if ((temp >> 32) == 0)
84 break;
85 }
86 cs->shift = shift;
87 cs->mult = (u32) temp;
88}
89
90void __init clockevent_set_clock(struct clock_event_device *cd,
91 unsigned int clock)
92{
93 u64 temp;
94 u32 shift;
95
96 /* Find a shift value */
97 for (shift = 32; shift > 0; shift--) {
98 temp = (u64) clock << shift;
99 do_div(temp, NSEC_PER_SEC);
100 if ((temp >> 32) == 0)
101 break;
102 }
103 cd->shift = shift;
104 cd->mult = (u32) temp;
105}
106
107static cycle_t clocksource_read_cycles(struct clocksource *cs) 74static cycle_t clocksource_read_cycles(struct clocksource *cs)
108{ 75{
109 return (cycle_t) readw(gpt_base + COUNT(CLKSRC)); 76 return (cycle_t) readw(gpt_base + COUNT(CLKSRC));
@@ -138,7 +105,7 @@ static void spear_clocksource_init(void)
138 val |= CTRL_ENABLE ; 105 val |= CTRL_ENABLE ;
139 writew(val, gpt_base + CR(CLKSRC)); 106 writew(val, gpt_base + CR(CLKSRC));
140 107
141 clocksource_set_clock(&clksrc, tick_rate); 108 clocksource_calc_mult_shift(&clksrc, tick_rate, SPEAR_MIN_RANGE);
142 109
143 /* register the clocksource */ 110 /* register the clocksource */
144 clocksource_register(&clksrc); 111 clocksource_register(&clksrc);
@@ -233,7 +200,7 @@ static void __init spear_clockevent_init(void)
233 tick_rate = clk_get_rate(gpt_clk); 200 tick_rate = clk_get_rate(gpt_clk);
234 tick_rate >>= CTRL_PRESCALER16; 201 tick_rate >>= CTRL_PRESCALER16;
235 202
236 clockevent_set_clock(&clkevt, tick_rate); 203 clockevents_calc_mult_shift(&clkevt, tick_rate, SPEAR_MIN_RANGE);
237 204
238 clkevt.max_delta_ns = clockevent_delta2ns(0xfff0, 205 clkevt.max_delta_ns = clockevent_delta2ns(0xfff0,
239 &clkevt); 206 &clkevt);
diff --git a/arch/arm/plat-versatile/Makefile b/arch/arm/plat-versatile/Makefile
index 9b1a66816aa6..5cf88e8427b1 100644
--- a/arch/arm/plat-versatile/Makefile
+++ b/arch/arm/plat-versatile/Makefile
@@ -2,3 +2,7 @@ obj-y := clock.o
2obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o 2obj-$(CONFIG_ARM_TIMER_SP804) += timer-sp.o
3obj-$(CONFIG_ARCH_REALVIEW) += sched-clock.o 3obj-$(CONFIG_ARCH_REALVIEW) += sched-clock.o
4obj-$(CONFIG_ARCH_VERSATILE) += sched-clock.o 4obj-$(CONFIG_ARCH_VERSATILE) += sched-clock.o
5ifeq ($(CONFIG_LEDS_CLASS),y)
6obj-$(CONFIG_ARCH_REALVIEW) += leds.o
7obj-$(CONFIG_ARCH_VERSATILE) += leds.o
8endif
diff --git a/arch/arm/plat-versatile/leds.c b/arch/arm/plat-versatile/leds.c
new file mode 100644
index 000000000000..3169fa555ea6
--- /dev/null
+++ b/arch/arm/plat-versatile/leds.c
@@ -0,0 +1,103 @@
1/*
2 * Driver for the 8 user LEDs found on the RealViews and Versatiles
3 * Based on DaVinci's DM365 board code
4 *
5 * License terms: GNU General Public License (GPL) version 2
6 * Author: Linus Walleij <triad@df.lth.se>
7 */
8#include <linux/kernel.h>
9#include <linux/init.h>
10#include <linux/io.h>
11#include <linux/slab.h>
12#include <linux/leds.h>
13
14#include <mach/hardware.h>
15#include <mach/platform.h>
16
17#ifdef VERSATILE_SYS_BASE
18#define LEDREG (__io_address(VERSATILE_SYS_BASE) + VERSATILE_SYS_LED_OFFSET)
19#endif
20
21#ifdef REALVIEW_SYS_BASE
22#define LEDREG (__io_address(REALVIEW_SYS_BASE) + REALVIEW_SYS_LED_OFFSET)
23#endif
24
25struct versatile_led {
26 struct led_classdev cdev;
27 u8 mask;
28};
29
30/*
31 * The triggers lines up below will only be used if the
32 * LED triggers are compiled in.
33 */
34static const struct {
35 const char *name;
36 const char *trigger;
37} versatile_leds[] = {
38 { "versatile:0", "heartbeat", },
39 { "versatile:1", "mmc0", },
40 { "versatile:2", },
41 { "versatile:3", },
42 { "versatile:4", },
43 { "versatile:5", },
44 { "versatile:6", },
45 { "versatile:7", },
46};
47
48static void versatile_led_set(struct led_classdev *cdev,
49 enum led_brightness b)
50{
51 struct versatile_led *led = container_of(cdev,
52 struct versatile_led, cdev);
53 u32 reg = readl(LEDREG);
54
55 if (b != LED_OFF)
56 reg |= led->mask;
57 else
58 reg &= ~led->mask;
59 writel(reg, LEDREG);
60}
61
62static enum led_brightness versatile_led_get(struct led_classdev *cdev)
63{
64 struct versatile_led *led = container_of(cdev,
65 struct versatile_led, cdev);
66 u32 reg = readl(LEDREG);
67
68 return (reg & led->mask) ? LED_FULL : LED_OFF;
69}
70
71static int __init versatile_leds_init(void)
72{
73 int i;
74
75 /* All ON */
76 writel(0xff, LEDREG);
77 for (i = 0; i < ARRAY_SIZE(versatile_leds); i++) {
78 struct versatile_led *led;
79
80 led = kzalloc(sizeof(*led), GFP_KERNEL);
81 if (!led)
82 break;
83
84 led->cdev.name = versatile_leds[i].name;
85 led->cdev.brightness_set = versatile_led_set;
86 led->cdev.brightness_get = versatile_led_get;
87 led->cdev.default_trigger = versatile_leds[i].trigger;
88 led->mask = BIT(i);
89
90 if (led_classdev_register(NULL, &led->cdev) < 0) {
91 kfree(led);
92 break;
93 }
94 }
95
96 return 0;
97}
98
99/*
100 * Since we may have triggers on any subsystem, defer registration
101 * until after subsystem_init.
102 */
103fs_initcall(versatile_leds_init);
diff --git a/arch/arm/vfp/vfpmodule.c b/arch/arm/vfp/vfpmodule.c
index 315a540c7ce5..8063a322c790 100644
--- a/arch/arm/vfp/vfpmodule.c
+++ b/arch/arm/vfp/vfpmodule.c
@@ -15,6 +15,7 @@
15#include <linux/sched.h> 15#include <linux/sched.h>
16#include <linux/init.h> 16#include <linux/init.h>
17 17
18#include <asm/cputype.h>
18#include <asm/thread_notify.h> 19#include <asm/thread_notify.h>
19#include <asm/vfp.h> 20#include <asm/vfp.h>
20 21
@@ -549,10 +550,13 @@ static int __init vfp_init(void)
549 /* 550 /*
550 * Check for the presence of the Advanced SIMD 551 * Check for the presence of the Advanced SIMD
551 * load/store instructions, integer and single 552 * load/store instructions, integer and single
552 * precision floating point operations. 553 * precision floating point operations. Only check
554 * for NEON if the hardware has the MVFR registers.
553 */ 555 */
554 if ((fmrx(MVFR1) & 0x000fff00) == 0x00011100) 556 if ((read_cpuid_id() & 0x000f0000) == 0x000f0000) {
555 elf_hwcap |= HWCAP_NEON; 557 if ((fmrx(MVFR1) & 0x000fff00) == 0x00011100)
558 elf_hwcap |= HWCAP_NEON;
559 }
556#endif 560#endif
557 } 561 }
558 return 0; 562 return 0;
diff --git a/arch/avr32/Kconfig b/arch/avr32/Kconfig
index f2b319333184..f51572772e21 100644
--- a/arch/avr32/Kconfig
+++ b/arch/avr32/Kconfig
@@ -45,9 +45,6 @@ config GENERIC_IRQ_PROBE
45config RWSEM_GENERIC_SPINLOCK 45config RWSEM_GENERIC_SPINLOCK
46 def_bool y 46 def_bool y
47 47
48config GENERIC_TIME
49 def_bool y
50
51config GENERIC_CLOCKEVENTS 48config GENERIC_CLOCKEVENTS
52 def_bool y 49 def_bool y
53 50
diff --git a/arch/avr32/Makefile b/arch/avr32/Makefile
index ead8a75203a9..22fb66590dcd 100644
--- a/arch/avr32/Makefile
+++ b/arch/avr32/Makefile
@@ -13,7 +13,7 @@ KBUILD_DEFCONFIG := atstk1002_defconfig
13 13
14KBUILD_CFLAGS += -pipe -fno-builtin -mno-pic 14KBUILD_CFLAGS += -pipe -fno-builtin -mno-pic
15KBUILD_AFLAGS += -mrelax -mno-pic 15KBUILD_AFLAGS += -mrelax -mno-pic
16CFLAGS_MODULE += -mno-relax 16KBUILD_CFLAGS_MODULE += -mno-relax
17LDFLAGS_vmlinux += --relax 17LDFLAGS_vmlinux += --relax
18 18
19cpuflags-$(CONFIG_PLATFORM_AT32AP) += -march=ap 19cpuflags-$(CONFIG_PLATFORM_AT32AP) += -march=ap
diff --git a/arch/avr32/include/asm/local64.h b/arch/avr32/include/asm/local64.h
new file mode 100644
index 000000000000..36c93b5cc239
--- /dev/null
+++ b/arch/avr32/include/asm/local64.h
@@ -0,0 +1 @@
#include <asm-generic/local64.h>
diff --git a/arch/blackfin/Kconfig b/arch/blackfin/Kconfig
index f66294b4f9d2..c88fd3584122 100644
--- a/arch/blackfin/Kconfig
+++ b/arch/blackfin/Kconfig
@@ -614,9 +614,6 @@ comment "Kernel Timer/Scheduler"
614 614
615source kernel/Kconfig.hz 615source kernel/Kconfig.hz
616 616
617config GENERIC_TIME
618 def_bool y
619
620config GENERIC_CLOCKEVENTS 617config GENERIC_CLOCKEVENTS
621 bool "Generic clock events" 618 bool "Generic clock events"
622 default y 619 default y
diff --git a/arch/blackfin/Makefile b/arch/blackfin/Makefile
index 5a97a31d4bbd..9d5ffaf5492a 100644
--- a/arch/blackfin/Makefile
+++ b/arch/blackfin/Makefile
@@ -18,8 +18,8 @@ ifeq ($(CONFIG_ROMKERNEL),y)
18KBUILD_CFLAGS += -mlong-calls 18KBUILD_CFLAGS += -mlong-calls
19endif 19endif
20KBUILD_AFLAGS += $(call cc-option,-mno-fdpic) 20KBUILD_AFLAGS += $(call cc-option,-mno-fdpic)
21CFLAGS_MODULE += -mlong-calls 21KBUILD_CFLAGS_MODULE += -mlong-calls
22LDFLAGS_MODULE += -m elf32bfin 22KBUILD_LDFLAGS_MODULE += -m elf32bfin
23KALLSYMS += --symbol-prefix=_ 23KALLSYMS += --symbol-prefix=_
24 24
25KBUILD_DEFCONFIG := BF537-STAMP_defconfig 25KBUILD_DEFCONFIG := BF537-STAMP_defconfig
diff --git a/arch/blackfin/include/asm/local64.h b/arch/blackfin/include/asm/local64.h
new file mode 100644
index 000000000000..36c93b5cc239
--- /dev/null
+++ b/arch/blackfin/include/asm/local64.h
@@ -0,0 +1 @@
#include <asm-generic/local64.h>
diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig
index e25bf4440b51..887ef855be2a 100644
--- a/arch/cris/Kconfig
+++ b/arch/cris/Kconfig
@@ -20,9 +20,6 @@ config RWSEM_GENERIC_SPINLOCK
20config RWSEM_XCHGADD_ALGORITHM 20config RWSEM_XCHGADD_ALGORITHM
21 bool 21 bool
22 22
23config GENERIC_TIME
24 def_bool y
25
26config GENERIC_CMOS_UPDATE 23config GENERIC_CMOS_UPDATE
27 def_bool y 24 def_bool y
28 25
diff --git a/arch/cris/arch-v32/mm/intmem.c b/arch/cris/arch-v32/mm/intmem.c
index 9e8b69cdf19e..1b17d92cef8e 100644
--- a/arch/cris/arch-v32/mm/intmem.c
+++ b/arch/cris/arch-v32/mm/intmem.c
@@ -33,8 +33,8 @@ static void crisv32_intmem_init(void)
33{ 33{
34 static int initiated = 0; 34 static int initiated = 0;
35 if (!initiated) { 35 if (!initiated) {
36 struct intmem_allocation* alloc = 36 struct intmem_allocation* alloc;
37 (struct intmem_allocation*)kmalloc(sizeof *alloc, GFP_KERNEL); 37 alloc = kmalloc(sizeof *alloc, GFP_KERNEL);
38 INIT_LIST_HEAD(&intmem_allocations); 38 INIT_LIST_HEAD(&intmem_allocations);
39 intmem_virtual = ioremap(MEM_INTMEM_START + RESERVED_SIZE, 39 intmem_virtual = ioremap(MEM_INTMEM_START + RESERVED_SIZE,
40 MEM_INTMEM_SIZE - RESERVED_SIZE); 40 MEM_INTMEM_SIZE - RESERVED_SIZE);
@@ -62,9 +62,8 @@ void* crisv32_intmem_alloc(unsigned size, unsigned align)
62 if (allocation->status == STATUS_FREE && 62 if (allocation->status == STATUS_FREE &&
63 allocation->size >= size + alignment) { 63 allocation->size >= size + alignment) {
64 if (allocation->size > size + alignment) { 64 if (allocation->size > size + alignment) {
65 struct intmem_allocation* alloc = 65 struct intmem_allocation* alloc;
66 (struct intmem_allocation*) 66 alloc = kmalloc(sizeof *alloc, GFP_ATOMIC);
67 kmalloc(sizeof *alloc, GFP_ATOMIC);
68 alloc->status = STATUS_FREE; 67 alloc->status = STATUS_FREE;
69 alloc->size = allocation->size - size - 68 alloc->size = allocation->size - size -
70 alignment; 69 alignment;
@@ -74,9 +73,7 @@ void* crisv32_intmem_alloc(unsigned size, unsigned align)
74 73
75 if (alignment) { 74 if (alignment) {
76 struct intmem_allocation *tmp; 75 struct intmem_allocation *tmp;
77 tmp = (struct intmem_allocation *) 76 tmp = kmalloc(sizeof *tmp, GFP_ATOMIC);
78 kmalloc(sizeof *tmp,
79 GFP_ATOMIC);
80 tmp->offset = allocation->offset; 77 tmp->offset = allocation->offset;
81 tmp->size = alignment; 78 tmp->size = alignment;
82 tmp->status = STATUS_FREE; 79 tmp->status = STATUS_FREE;
diff --git a/arch/cris/include/asm/local64.h b/arch/cris/include/asm/local64.h
new file mode 100644
index 000000000000..36c93b5cc239
--- /dev/null
+++ b/arch/cris/include/asm/local64.h
@@ -0,0 +1 @@
#include <asm-generic/local64.h>
diff --git a/arch/frv/Kconfig b/arch/frv/Kconfig
index 4b5830bcbe2e..16399bd24993 100644
--- a/arch/frv/Kconfig
+++ b/arch/frv/Kconfig
@@ -40,10 +40,6 @@ config GENERIC_HARDIRQS_NO__DO_IRQ
40 bool 40 bool
41 default y 41 default y
42 42
43config GENERIC_TIME
44 bool
45 default y
46
47config TIME_LOW_RES 43config TIME_LOW_RES
48 bool 44 bool
49 default y 45 default y
diff --git a/arch/frv/Makefile b/arch/frv/Makefile
index 310c47a663f8..7ff84575b186 100644
--- a/arch/frv/Makefile
+++ b/arch/frv/Makefile
@@ -23,20 +23,14 @@
23# Copyright (C) 1994 by Hamish Macdonald 23# Copyright (C) 1994 by Hamish Macdonald
24# 24#
25 25
26CCSPECS := $(shell $(CC) -v 2>&1 | grep "^Reading specs from " | head -1 | cut -c20-)
27CCDIR := $(strip $(patsubst %/specs,%,$(CCSPECS)))
28CPUCLASS := fr400
29
30# test for cross compiling
31COMPILE_ARCH = $(shell uname -m)
32
33ifdef CONFIG_MMU 26ifdef CONFIG_MMU
34UTS_SYSNAME = -DUTS_SYSNAME=\"Linux\" 27UTS_SYSNAME = -DUTS_SYSNAME=\"Linux\"
35else 28else
36UTS_SYSNAME = -DUTS_SYSNAME=\"uClinux\" 29UTS_SYSNAME = -DUTS_SYSNAME=\"uClinux\"
37endif 30endif
38 31
39ARCHMODFLAGS += -G0 -mlong-calls 32KBUILD_AFLAGS_MODULE += -G0 -mlong-calls
33KBUILD_CFLAGS_MODULE += -G0 -mlong-calls
40 34
41ifdef CONFIG_GPREL_DATA_8 35ifdef CONFIG_GPREL_DATA_8
42KBUILD_CFLAGS += -G8 36KBUILD_CFLAGS += -G8
@@ -54,7 +48,6 @@ endif
54 48
55ifdef CONFIG_GC_SECTIONS 49ifdef CONFIG_GC_SECTIONS
56KBUILD_CFLAGS += -ffunction-sections -fdata-sections 50KBUILD_CFLAGS += -ffunction-sections -fdata-sections
57LINKFLAGS += --gc-sections
58endif 51endif
59 52
60ifndef CONFIG_FRAME_POINTER 53ifndef CONFIG_FRAME_POINTER
@@ -64,16 +57,13 @@ endif
64ifdef CONFIG_CPU_FR451_COMPILE 57ifdef CONFIG_CPU_FR451_COMPILE
65KBUILD_CFLAGS += -mcpu=fr450 58KBUILD_CFLAGS += -mcpu=fr450
66KBUILD_AFLAGS += -mcpu=fr450 59KBUILD_AFLAGS += -mcpu=fr450
67ASFLAGS += -mcpu=fr450
68else 60else
69ifdef CONFIG_CPU_FR551_COMPILE 61ifdef CONFIG_CPU_FR551_COMPILE
70KBUILD_CFLAGS += -mcpu=fr550 62KBUILD_CFLAGS += -mcpu=fr550
71KBUILD_AFLAGS += -mcpu=fr550 63KBUILD_AFLAGS += -mcpu=fr550
72ASFLAGS += -mcpu=fr550
73else 64else
74KBUILD_CFLAGS += -mcpu=fr400 65KBUILD_CFLAGS += -mcpu=fr400
75KBUILD_AFLAGS += -mcpu=fr400 66KBUILD_AFLAGS += -mcpu=fr400
76ASFLAGS += -mcpu=fr400
77endif 67endif
78endif 68endif
79 69
@@ -83,14 +73,12 @@ endif
83KBUILD_CFLAGS += -mno-fdpic -mgpr-32 -msoft-float -mno-media 73KBUILD_CFLAGS += -mno-fdpic -mgpr-32 -msoft-float -mno-media
84KBUILD_CFLAGS += -ffixed-fcc3 -ffixed-cc3 -ffixed-gr15 -ffixed-icc2 74KBUILD_CFLAGS += -ffixed-fcc3 -ffixed-cc3 -ffixed-gr15 -ffixed-icc2
85KBUILD_AFLAGS += -mno-fdpic 75KBUILD_AFLAGS += -mno-fdpic
86ASFLAGS += -mno-fdpic
87 76
88# make sure the .S files get compiled with debug info 77# make sure the .S files get compiled with debug info
89# and disable optimisations that are unhelpful whilst debugging 78# and disable optimisations that are unhelpful whilst debugging
90ifdef CONFIG_DEBUG_INFO 79ifdef CONFIG_DEBUG_INFO
91#KBUILD_CFLAGS += -O1 80#KBUILD_CFLAGS += -O1
92KBUILD_AFLAGS += -Wa,--gdwarf2 81KBUILD_AFLAGS += -Wa,--gdwarf2
93ASFLAGS += -Wa,--gdwarf2
94endif 82endif
95 83
96head-y := arch/frv/kernel/head.o arch/frv/kernel/init_task.o 84head-y := arch/frv/kernel/head.o arch/frv/kernel/init_task.o
@@ -105,11 +93,5 @@ all: Image
105Image: vmlinux 93Image: vmlinux
106 $(Q)$(MAKE) $(build)=arch/frv/boot $@ 94 $(Q)$(MAKE) $(build)=arch/frv/boot $@
107 95
108bootstrap:
109 $(Q)$(MAKEBOOT) bootstrap
110
111archclean: 96archclean:
112 $(Q)$(MAKE) $(clean)=arch/frv/boot 97 $(Q)$(MAKE) $(clean)=arch/frv/boot
113
114archdep: scripts/mkdep symlinks
115 $(Q)$(MAKE) $(build)=arch/frv/boot dep
diff --git a/arch/frv/include/asm/local64.h b/arch/frv/include/asm/local64.h
new file mode 100644
index 000000000000..36c93b5cc239
--- /dev/null
+++ b/arch/frv/include/asm/local64.h
@@ -0,0 +1 @@
#include <asm-generic/local64.h>
diff --git a/arch/frv/kernel/local64.h b/arch/frv/kernel/local64.h
new file mode 100644
index 000000000000..36c93b5cc239
--- /dev/null
+++ b/arch/frv/kernel/local64.h
@@ -0,0 +1 @@
#include <asm-generic/local64.h>
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index 53cc669e6d59..988b6ff34cc4 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -62,10 +62,6 @@ config GENERIC_CALIBRATE_DELAY
62 bool 62 bool
63 default y 63 default y
64 64
65config GENERIC_TIME
66 bool
67 default y
68
69config GENERIC_BUG 65config GENERIC_BUG
70 bool 66 bool
71 depends on BUG 67 depends on BUG
diff --git a/arch/h8300/include/asm/local64.h b/arch/h8300/include/asm/local64.h
new file mode 100644
index 000000000000..36c93b5cc239
--- /dev/null
+++ b/arch/h8300/include/asm/local64.h
@@ -0,0 +1 @@
#include <asm-generic/local64.h>
diff --git a/arch/h8300/kernel/timer/itu.c b/arch/h8300/kernel/timer/itu.c
index 4883ba7103a8..a2ae5e952137 100644
--- a/arch/h8300/kernel/timer/itu.c
+++ b/arch/h8300/kernel/timer/itu.c
@@ -73,7 +73,7 @@ void __init h8300_timer_setup(void)
73 73
74 setup_irq(ITUIRQ, &itu_irq); 74 setup_irq(ITUIRQ, &itu_irq);
75 75
76 /* initalize timer */ 76 /* initialize timer */
77 ctrl_outb(0, TSTR); 77 ctrl_outb(0, TSTR);
78 ctrl_outb(CCLR0 | div, ITUBASE + TCR); 78 ctrl_outb(CCLR0 | div, ITUBASE + TCR);
79 ctrl_outb(0x01, ITUBASE + TIER); 79 ctrl_outb(0x01, ITUBASE + TIER);
diff --git a/arch/h8300/kernel/timer/timer16.c b/arch/h8300/kernel/timer/timer16.c
index 042dbb53f3fb..ae0d38161139 100644
--- a/arch/h8300/kernel/timer/timer16.c
+++ b/arch/h8300/kernel/timer/timer16.c
@@ -68,7 +68,7 @@ void __init h8300_timer_setup(void)
68 68
69 setup_irq(_16IRQ, &timer16_irq); 69 setup_irq(_16IRQ, &timer16_irq);
70 70
71 /* initalize timer */ 71 /* initialize timer */
72 ctrl_outb(0, TSTR); 72 ctrl_outb(0, TSTR);
73 ctrl_outb(CCLR0 | div, _16BASE + TCR); 73 ctrl_outb(CCLR0 | div, _16BASE + TCR);
74 ctrl_outw(cnt, _16BASE + GRA); 74 ctrl_outw(cnt, _16BASE + GRA);
diff --git a/arch/h8300/kernel/timer/timer8.c b/arch/h8300/kernel/timer/timer8.c
index 38be0cabef0d..3946c0fa8374 100644
--- a/arch/h8300/kernel/timer/timer8.c
+++ b/arch/h8300/kernel/timer/timer8.c
@@ -94,7 +94,7 @@ void __init h8300_timer_setup(void)
94 ctrl_bclr(0, MSTPCRL) 94 ctrl_bclr(0, MSTPCRL)
95#endif 95#endif
96 96
97 /* initalize timer */ 97 /* initialize timer */
98 ctrl_outw(cnt, _8BASE + TCORA); 98 ctrl_outw(cnt, _8BASE + TCORA);
99 ctrl_outw(0x0000, _8BASE + _8TCSR); 99 ctrl_outw(0x0000, _8BASE + _8TCSR);
100 ctrl_outw((CMIEA|CCLR_CMA|CKS2) << 8 | div, 100 ctrl_outw((CMIEA|CCLR_CMA|CKS2) << 8 | div,
diff --git a/arch/ia64/Kconfig b/arch/ia64/Kconfig
index 95610820041e..8711d13cd79f 100644
--- a/arch/ia64/Kconfig
+++ b/arch/ia64/Kconfig
@@ -82,10 +82,6 @@ config GENERIC_CALIBRATE_DELAY
82 bool 82 bool
83 default y 83 default y
84 84
85config GENERIC_TIME
86 bool
87 default y
88
89config GENERIC_TIME_VSYSCALL 85config GENERIC_TIME_VSYSCALL
90 bool 86 bool
91 default y 87 default y
diff --git a/arch/ia64/Makefile b/arch/ia64/Makefile
index 8ae0d2604ce1..be7bfa12b705 100644
--- a/arch/ia64/Makefile
+++ b/arch/ia64/Makefile
@@ -22,13 +22,13 @@ CHECKFLAGS += -m64 -D__ia64=1 -D__ia64__=1 -D_LP64 -D__LP64__
22 22
23OBJCOPYFLAGS := --strip-all 23OBJCOPYFLAGS := --strip-all
24LDFLAGS_vmlinux := -static 24LDFLAGS_vmlinux := -static
25LDFLAGS_MODULE += -T $(srctree)/arch/ia64/module.lds 25KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/ia64/module.lds
26AFLAGS_KERNEL := -mconstant-gp 26KBUILD_AFLAGS_KERNEL := -mconstant-gp
27EXTRA := 27EXTRA :=
28 28
29cflags-y := -pipe $(EXTRA) -ffixed-r13 -mfixed-range=f12-f15,f32-f127 \ 29cflags-y := -pipe $(EXTRA) -ffixed-r13 -mfixed-range=f12-f15,f32-f127 \
30 -falign-functions=32 -frename-registers -fno-optimize-sibling-calls 30 -falign-functions=32 -frename-registers -fno-optimize-sibling-calls
31CFLAGS_KERNEL := -mconstant-gp 31KBUILD_CFLAGS_KERNEL := -mconstant-gp
32 32
33GAS_STATUS = $(shell $(srctree)/arch/ia64/scripts/check-gas "$(CC)" "$(OBJDUMP)") 33GAS_STATUS = $(shell $(srctree)/arch/ia64/scripts/check-gas "$(CC)" "$(OBJDUMP)")
34KBUILD_CPPFLAGS += $(shell $(srctree)/arch/ia64/scripts/toolchain-flags "$(CC)" "$(OBJDUMP)" "$(READELF)") 34KBUILD_CPPFLAGS += $(shell $(srctree)/arch/ia64/scripts/toolchain-flags "$(CC)" "$(OBJDUMP)" "$(READELF)")
diff --git a/arch/ia64/configs/bigsur_defconfig b/arch/ia64/configs/bigsur_defconfig
index 312b12094a1d..c5fe20553dad 100644
--- a/arch/ia64/configs/bigsur_defconfig
+++ b/arch/ia64/configs/bigsur_defconfig
@@ -1,1358 +1,118 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.16-rc5
4# Mon Feb 27 16:10:42 2006
5#
6
7#
8# Code maturity level options
9#
10CONFIG_EXPERIMENTAL=y
11CONFIG_LOCK_KERNEL=y
12CONFIG_INIT_ENV_ARG_LIMIT=32
13
14#
15# General setup
16#
17CONFIG_LOCALVERSION=""
18CONFIG_LOCALVERSION_AUTO=y
19CONFIG_SWAP=y
20CONFIG_SYSVIPC=y
21CONFIG_POSIX_MQUEUE=y
22# CONFIG_BSD_PROCESS_ACCT is not set
23CONFIG_SYSCTL=y
24# CONFIG_AUDIT is not set
25# CONFIG_IKCONFIG is not set
26# CONFIG_CPUSETS is not set
27CONFIG_INITRAMFS_SOURCE=""
28CONFIG_CC_OPTIMIZE_FOR_SIZE=y
29# CONFIG_EMBEDDED is not set
30CONFIG_KALLSYMS=y
31# CONFIG_KALLSYMS_ALL is not set
32# CONFIG_KALLSYMS_EXTRA_PASS is not set
33CONFIG_HOTPLUG=y
34CONFIG_PRINTK=y
35CONFIG_BUG=y
36CONFIG_ELF_CORE=y
37CONFIG_BASE_FULL=y
38CONFIG_FUTEX=y
39CONFIG_EPOLL=y
40CONFIG_SHMEM=y
41CONFIG_CC_ALIGN_FUNCTIONS=0
42CONFIG_CC_ALIGN_LABELS=0
43CONFIG_CC_ALIGN_LOOPS=0
44CONFIG_CC_ALIGN_JUMPS=0
45CONFIG_SLUB=y
46# CONFIG_TINY_SHMEM is not set
47CONFIG_BASE_SMALL=0
48# CONFIG_SLOB is not set
49
50#
51# Loadable module support
52#
53CONFIG_MODULES=y
54CONFIG_MODULE_UNLOAD=y
55# CONFIG_MODULE_FORCE_UNLOAD is not set
56CONFIG_OBSOLETE_MODPARM=y
57# CONFIG_MODVERSIONS is not set
58# CONFIG_MODULE_SRCVERSION_ALL is not set
59CONFIG_KMOD=y
60CONFIG_STOP_MACHINE=y
61
62#
63# Block layer
64#
65
66#
67# IO Schedulers
68#
69CONFIG_IOSCHED_NOOP=y
70CONFIG_IOSCHED_AS=y
71CONFIG_IOSCHED_DEADLINE=y
72CONFIG_IOSCHED_CFQ=y
73CONFIG_DEFAULT_AS=y
74# CONFIG_DEFAULT_DEADLINE is not set
75# CONFIG_DEFAULT_CFQ is not set
76# CONFIG_DEFAULT_NOOP is not set
77CONFIG_DEFAULT_IOSCHED="anticipatory"
78
79#
80# Processor type and features
81#
82CONFIG_IA64=y
83CONFIG_64BIT=y
84CONFIG_MMU=y
85CONFIG_SWIOTLB=y
86CONFIG_RWSEM_XCHGADD_ALGORITHM=y
87CONFIG_GENERIC_CALIBRATE_DELAY=y
88CONFIG_GENERIC_TIME=y
89CONFIG_EFI=y
90CONFIG_GENERIC_IOMAP=y
91CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
92CONFIG_DMA_IS_DMA32=y
93# CONFIG_IA64_GENERIC is not set
94CONFIG_IA64_DIG=y
95# CONFIG_IA64_HP_ZX1 is not set
96# CONFIG_IA64_HP_ZX1_SWIOTLB is not set
97# CONFIG_IA64_SGI_SN2 is not set
98# CONFIG_IA64_HP_SIM is not set
99CONFIG_ITANIUM=y
100# CONFIG_MCKINLEY is not set
101# CONFIG_IA64_PAGE_SIZE_4KB is not set
102# CONFIG_IA64_PAGE_SIZE_8KB is not set
103CONFIG_IA64_PAGE_SIZE_16KB=y
104# CONFIG_IA64_PAGE_SIZE_64KB is not set
105CONFIG_PGTABLE_3=y
106# CONFIG_PGTABLE_4 is not set
107# CONFIG_HZ_100 is not set
108CONFIG_HZ_250=y
109# CONFIG_HZ_1000 is not set
110CONFIG_HZ=250
111CONFIG_IA64_BRL_EMU=y
112CONFIG_IA64_L1_CACHE_SHIFT=6
113# CONFIG_IA64_CYCLONE is not set
114CONFIG_IOSAPIC=y
115CONFIG_FORCE_MAX_ZONEORDER=17
116CONFIG_SMP=y
117CONFIG_NR_CPUS=2
118# CONFIG_HOTPLUG_CPU is not set
119# CONFIG_SCHED_SMT is not set
120CONFIG_PREEMPT=y
121CONFIG_SELECT_MEMORY_MODEL=y
122CONFIG_FLATMEM_MANUAL=y
123# CONFIG_DISCONTIGMEM_MANUAL is not set
124# CONFIG_SPARSEMEM_MANUAL is not set
125CONFIG_FLATMEM=y
126CONFIG_FLAT_NODE_MEM_MAP=y
127# CONFIG_SPARSEMEM_STATIC is not set
128CONFIG_SPLIT_PTLOCK_CPUS=4
129CONFIG_ARCH_SELECT_MEMORY_MODEL=y
130CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
131CONFIG_ARCH_FLATMEM_ENABLE=y
132CONFIG_ARCH_SPARSEMEM_ENABLE=y
133# CONFIG_VIRTUAL_MEM_MAP is not set
134# CONFIG_IA64_MCA_RECOVERY is not set
135CONFIG_PERFMON=y
136CONFIG_IA64_PALINFO=y
137
138#
139# Firmware Drivers
140#
141CONFIG_EFI_VARS=y
142CONFIG_EFI_PCDP=y
143CONFIG_BINFMT_ELF=y
144CONFIG_BINFMT_MISC=m
145
146#
147# Power management and ACPI
148#
149CONFIG_PM=y
150CONFIG_PM_LEGACY=y
151# CONFIG_PM_DEBUG is not set
152
153#
154# ACPI (Advanced Configuration and Power Interface) Support
155#
156CONFIG_ACPI=y
157CONFIG_ACPI_BUTTON=m 1CONFIG_ACPI_BUTTON=m
158CONFIG_ACPI_FAN=m 2CONFIG_ACPI_FAN=m
159CONFIG_ACPI_PROCESSOR=m 3CONFIG_ACPI_PROCESSOR=m
160CONFIG_ACPI_THERMAL=m 4CONFIG_AGP_I460=m
161CONFIG_ACPI_BLACKLIST_YEAR=0 5CONFIG_AGP=m
162# CONFIG_ACPI_DEBUG is not set 6CONFIG_AUTOFS4_FS=m
163CONFIG_ACPI_EC=y 7CONFIG_AUTOFS_FS=m
164CONFIG_ACPI_POWER=y 8CONFIG_BINFMT_MISC=m
165CONFIG_ACPI_SYSTEM=y
166# CONFIG_ACPI_CONTAINER is not set
167
168#
169# CPU Frequency scaling
170#
171# CONFIG_CPU_FREQ is not set
172
173#
174# Bus options (PCI, PCMCIA)
175#
176CONFIG_PCI=y
177CONFIG_PCI_DOMAINS=y
178# CONFIG_PCI_MSI is not set
179CONFIG_PCI_LEGACY_PROC=y
180# CONFIG_PCI_DEBUG is not set
181
182#
183# PCI Hotplug Support
184#
185# CONFIG_HOTPLUG_PCI is not set
186
187#
188# PCCARD (PCMCIA/CardBus) support
189#
190# CONFIG_PCCARD is not set
191
192#
193# Networking
194#
195CONFIG_NET=y
196
197#
198# Networking options
199#
200# CONFIG_NETDEBUG is not set
201CONFIG_PACKET=y
202CONFIG_PACKET_MMAP=y
203CONFIG_UNIX=y
204# CONFIG_NET_KEY is not set
205CONFIG_INET=y
206# CONFIG_IP_MULTICAST is not set
207# CONFIG_IP_ADVANCED_ROUTER is not set
208CONFIG_IP_FIB_HASH=y
209# CONFIG_IP_PNP is not set
210# CONFIG_NET_IPIP is not set
211# CONFIG_NET_IPGRE is not set
212# CONFIG_ARPD is not set
213# CONFIG_SYN_COOKIES is not set
214# CONFIG_INET_AH is not set
215# CONFIG_INET_ESP is not set
216# CONFIG_INET_IPCOMP is not set
217# CONFIG_INET_TUNNEL is not set
218CONFIG_INET_DIAG=y
219CONFIG_INET_TCP_DIAG=y
220# CONFIG_TCP_CONG_ADVANCED is not set
221CONFIG_TCP_CONG_BIC=y
222# CONFIG_IPV6 is not set
223# CONFIG_NETFILTER is not set
224
225#
226# DCCP Configuration (EXPERIMENTAL)
227#
228# CONFIG_IP_DCCP is not set
229
230#
231# SCTP Configuration (EXPERIMENTAL)
232#
233# CONFIG_IP_SCTP is not set
234
235#
236# TIPC Configuration (EXPERIMENTAL)
237#
238# CONFIG_TIPC is not set
239# CONFIG_ATM is not set
240# CONFIG_BRIDGE is not set
241# CONFIG_VLAN_8021Q is not set
242# CONFIG_DECNET is not set
243# CONFIG_LLC2 is not set
244# CONFIG_IPX is not set
245# CONFIG_ATALK is not set
246# CONFIG_X25 is not set
247# CONFIG_LAPB is not set
248# CONFIG_NET_DIVERT is not set
249# CONFIG_ECONET is not set
250# CONFIG_WAN_ROUTER is not set
251
252#
253# QoS and/or fair queueing
254#
255# CONFIG_NET_SCHED is not set
256
257#
258# Network testing
259#
260# CONFIG_NET_PKTGEN is not set
261# CONFIG_HAMRADIO is not set
262# CONFIG_IRDA is not set
263# CONFIG_BT is not set
264# CONFIG_IEEE80211 is not set
265
266#
267# Device Drivers
268#
269
270#
271# Generic Driver Options
272#
273CONFIG_STANDALONE=y
274CONFIG_PREVENT_FIRMWARE_BUILD=y
275# CONFIG_FW_LOADER is not set
276# CONFIG_DEBUG_DRIVER is not set
277
278#
279# Connector - unified userspace <-> kernelspace linker
280#
281# CONFIG_CONNECTOR is not set
282
283#
284# Memory Technology Devices (MTD)
285#
286# CONFIG_MTD is not set
287
288#
289# Parallel port support
290#
291# CONFIG_PARPORT is not set
292
293#
294# Plug and Play support
295#
296CONFIG_PNP=y
297# CONFIG_PNP_DEBUG is not set
298
299#
300# Protocols
301#
302CONFIG_PNPACPI=y
303
304#
305# Block devices
306#
307# CONFIG_BLK_CPQ_DA is not set
308# CONFIG_BLK_CPQ_CISS_DA is not set
309# CONFIG_BLK_DEV_DAC960 is not set
310# CONFIG_BLK_DEV_UMEM is not set
311# CONFIG_BLK_DEV_COW_COMMON is not set
312CONFIG_BLK_DEV_LOOP=m
313CONFIG_BLK_DEV_CRYPTOLOOP=m 9CONFIG_BLK_DEV_CRYPTOLOOP=m
314CONFIG_BLK_DEV_NBD=m 10CONFIG_BLK_DEV_DM=m
315# CONFIG_BLK_DEV_SX8 is not set
316# CONFIG_BLK_DEV_UB is not set
317CONFIG_BLK_DEV_RAM=m
318CONFIG_BLK_DEV_RAM_COUNT=16
319CONFIG_BLK_DEV_RAM_SIZE=4096
320# CONFIG_CDROM_PKTCDVD is not set
321# CONFIG_ATA_OVER_ETH is not set
322
323#
324# ATA/ATAPI/MFM/RLL support
325#
326CONFIG_IDE=m
327CONFIG_IDE_MAX_HWIFS=4
328CONFIG_BLK_DEV_IDE=m
329
330#
331# Please see Documentation/ide.txt for help/info on IDE drives
332#
333# CONFIG_BLK_DEV_IDE_SATA is not set
334CONFIG_BLK_DEV_IDEDISK=m
335# CONFIG_IDEDISK_MULTI_MODE is not set
336CONFIG_BLK_DEV_IDECD=m
337# CONFIG_BLK_DEV_IDETAPE is not set
338CONFIG_BLK_DEV_IDEFLOPPY=m
339# CONFIG_BLK_DEV_IDESCSI is not set
340# CONFIG_IDE_TASK_IOCTL is not set
341
342#
343# IDE chipset support/bugfixes
344#
345# CONFIG_IDE_GENERIC is not set
346# CONFIG_BLK_DEV_IDEPNP is not set
347CONFIG_BLK_DEV_IDEPCI=y
348CONFIG_IDEPCI_SHARE_IRQ=y
349# CONFIG_BLK_DEV_OFFBOARD is not set
350CONFIG_BLK_DEV_GENERIC=m 11CONFIG_BLK_DEV_GENERIC=m
351# CONFIG_BLK_DEV_OPTI621 is not set 12CONFIG_BLK_DEV_IDECD=m
352CONFIG_BLK_DEV_IDEDMA_PCI=y 13CONFIG_BLK_DEV_LOOP=m
353# CONFIG_BLK_DEV_IDEDMA_FORCED is not set 14CONFIG_BLK_DEV_MD=m
354CONFIG_IDEDMA_PCI_AUTO=y 15CONFIG_BLK_DEV_NBD=m
355# CONFIG_IDEDMA_ONLYDISK is not set
356# CONFIG_BLK_DEV_AEC62XX is not set
357# CONFIG_BLK_DEV_ALI15X3 is not set
358# CONFIG_BLK_DEV_AMD74XX is not set
359# CONFIG_BLK_DEV_CMD64X is not set
360# CONFIG_BLK_DEV_TRIFLEX is not set
361# CONFIG_BLK_DEV_CY82C693 is not set
362# CONFIG_BLK_DEV_CS5520 is not set
363# CONFIG_BLK_DEV_CS5530 is not set
364# CONFIG_BLK_DEV_HPT34X is not set
365# CONFIG_BLK_DEV_HPT366 is not set
366# CONFIG_BLK_DEV_SC1200 is not set
367CONFIG_BLK_DEV_PIIX=m 16CONFIG_BLK_DEV_PIIX=m
368# CONFIG_BLK_DEV_IT821X is not set 17CONFIG_BLK_DEV_RAM=m
369# CONFIG_BLK_DEV_NS87415 is not set
370# CONFIG_BLK_DEV_PDC202XX_OLD is not set
371# CONFIG_BLK_DEV_PDC202XX_NEW is not set
372# CONFIG_BLK_DEV_SVWKS is not set
373# CONFIG_BLK_DEV_SIIMAGE is not set
374# CONFIG_BLK_DEV_SLC90E66 is not set
375# CONFIG_BLK_DEV_TRM290 is not set
376# CONFIG_BLK_DEV_VIA82CXXX is not set
377# CONFIG_IDE_ARM is not set
378CONFIG_BLK_DEV_IDEDMA=y
379# CONFIG_IDEDMA_IVB is not set
380CONFIG_IDEDMA_AUTO=y
381# CONFIG_BLK_DEV_HD is not set
382
383#
384# SCSI device support
385#
386# CONFIG_RAID_ATTRS is not set
387CONFIG_SCSI=y
388CONFIG_SCSI_PROC_FS=y
389
390#
391# SCSI support type (disk, tape, CD-ROM)
392#
393CONFIG_BLK_DEV_SD=y 18CONFIG_BLK_DEV_SD=y
394# CONFIG_CHR_DEV_ST is not set 19CONFIG_CIFS=m
395# CONFIG_CHR_DEV_OSST is not set 20CONFIG_CIFS_POSIX=y
396# CONFIG_BLK_DEV_SR is not set 21CONFIG_CIFS_STATS=y
397# CONFIG_CHR_DEV_SG is not set 22CONFIG_CIFS_XATTR=y
398# CONFIG_CHR_DEV_SCH is not set 23CONFIG_CRYPTO_DES=y
399 24CONFIG_CRYPTO_MD5=y
400# 25CONFIG_DEBUG_KERNEL=y
401# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 26CONFIG_DEBUG_MUTEXES=y
402#
403# CONFIG_SCSI_MULTI_LUN is not set
404CONFIG_SCSI_CONSTANTS=y
405CONFIG_SCSI_LOGGING=y
406
407#
408# SCSI Transport Attributes
409#
410CONFIG_SCSI_SPI_ATTRS=m
411# CONFIG_SCSI_FC_ATTRS is not set
412# CONFIG_SCSI_ISCSI_ATTRS is not set
413# CONFIG_SCSI_SAS_ATTRS is not set
414
415#
416# SCSI low-level drivers
417#
418# CONFIG_ISCSI_TCP is not set
419# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
420# CONFIG_SCSI_3W_9XXX is not set
421# CONFIG_SCSI_ACARD is not set
422# CONFIG_SCSI_AACRAID is not set
423# CONFIG_SCSI_AIC7XXX is not set
424# CONFIG_SCSI_AIC7XXX_OLD is not set
425# CONFIG_SCSI_AIC79XX is not set
426# CONFIG_MEGARAID_NEWGEN is not set
427# CONFIG_MEGARAID_LEGACY is not set
428# CONFIG_MEGARAID_SAS is not set
429# CONFIG_SCSI_SATA is not set
430# CONFIG_SCSI_DMX3191D is not set
431# CONFIG_SCSI_FUTURE_DOMAIN is not set
432# CONFIG_SCSI_IPS is not set
433# CONFIG_SCSI_INITIO is not set
434# CONFIG_SCSI_INIA100 is not set
435# CONFIG_SCSI_SYM53C8XX_2 is not set
436# CONFIG_SCSI_IPR is not set
437# CONFIG_SCSI_QLOGIC_FC is not set
438CONFIG_SCSI_QLOGIC_1280=y
439# CONFIG_SCSI_QLA_FC is not set
440# CONFIG_SCSI_LPFC is not set
441# CONFIG_SCSI_DC395x is not set
442# CONFIG_SCSI_DC390T is not set
443# CONFIG_SCSI_DEBUG is not set
444
445#
446# Multi-device support (RAID and LVM)
447#
448CONFIG_MD=y
449CONFIG_BLK_DEV_MD=m
450CONFIG_MD_LINEAR=m
451CONFIG_MD_RAID0=m
452CONFIG_MD_RAID1=m
453CONFIG_MD_RAID10=m
454CONFIG_MD_RAID5=m
455CONFIG_MD_RAID6=m
456CONFIG_MD_MULTIPATH=m
457# CONFIG_MD_FAULTY is not set
458CONFIG_BLK_DEV_DM=m
459CONFIG_DM_CRYPT=m 27CONFIG_DM_CRYPT=m
460CONFIG_DM_SNAPSHOT=m
461CONFIG_DM_MIRROR=m 28CONFIG_DM_MIRROR=m
29CONFIG_DM_SNAPSHOT=m
462CONFIG_DM_ZERO=m 30CONFIG_DM_ZERO=m
463# CONFIG_DM_MULTIPATH is not set
464
465#
466# Fusion MPT device support
467#
468# CONFIG_FUSION is not set
469# CONFIG_FUSION_SPI is not set
470# CONFIG_FUSION_FC is not set
471# CONFIG_FUSION_SAS is not set
472
473#
474# IEEE 1394 (FireWire) support
475#
476# CONFIG_IEEE1394 is not set
477
478#
479# I2O device support
480#
481# CONFIG_I2O is not set
482
483#
484# Network device support
485#
486CONFIG_NETDEVICES=y
487CONFIG_DUMMY=y
488# CONFIG_BONDING is not set
489# CONFIG_EQUALIZER is not set
490# CONFIG_TUN is not set
491# CONFIG_NET_SB1000 is not set
492
493#
494# ARCnet devices
495#
496# CONFIG_ARCNET is not set
497
498#
499# PHY device support
500#
501# CONFIG_PHYLIB is not set
502
503#
504# Ethernet (10 or 100Mbit)
505#
506CONFIG_NET_ETHERNET=y
507CONFIG_MII=y
508# CONFIG_HAPPYMEAL is not set
509# CONFIG_SUNGEM is not set
510# CONFIG_CASSINI is not set
511# CONFIG_NET_VENDOR_3COM is not set
512
513#
514# Tulip family network device support
515#
516# CONFIG_NET_TULIP is not set
517# CONFIG_HP100 is not set
518CONFIG_NET_PCI=y
519# CONFIG_PCNET32 is not set
520# CONFIG_AMD8111_ETH is not set
521# CONFIG_ADAPTEC_STARFIRE is not set
522# CONFIG_B44 is not set
523# CONFIG_FORCEDETH is not set
524# CONFIG_DGRS is not set
525CONFIG_EEPRO100=y
526# CONFIG_E100 is not set
527# CONFIG_FEALNX is not set
528# CONFIG_NATSEMI is not set
529# CONFIG_NE2K_PCI is not set
530# CONFIG_8139CP is not set
531# CONFIG_8139TOO is not set
532# CONFIG_SIS900 is not set
533# CONFIG_EPIC100 is not set
534# CONFIG_SUNDANCE is not set
535# CONFIG_VIA_RHINE is not set
536
537#
538# Ethernet (1000 Mbit)
539#
540# CONFIG_ACENIC is not set
541# CONFIG_DL2K is not set
542# CONFIG_E1000 is not set
543# CONFIG_NS83820 is not set
544# CONFIG_HAMACHI is not set
545# CONFIG_YELLOWFIN is not set
546# CONFIG_R8169 is not set
547# CONFIG_SIS190 is not set
548# CONFIG_SKGE is not set
549# CONFIG_SKY2 is not set
550# CONFIG_SK98LIN is not set
551# CONFIG_VIA_VELOCITY is not set
552# CONFIG_TIGON3 is not set
553# CONFIG_BNX2 is not set
554
555#
556# Ethernet (10000 Mbit)
557#
558# CONFIG_CHELSIO_T1 is not set
559# CONFIG_IXGB is not set
560# CONFIG_S2IO is not set
561
562#
563# Token Ring devices
564#
565# CONFIG_TR is not set
566
567#
568# Wireless LAN (non-hamradio)
569#
570# CONFIG_NET_RADIO is not set
571
572#
573# Wan interfaces
574#
575# CONFIG_WAN is not set
576# CONFIG_FDDI is not set
577# CONFIG_HIPPI is not set
578# CONFIG_PPP is not set
579# CONFIG_SLIP is not set
580# CONFIG_NET_FC is not set
581# CONFIG_SHAPER is not set
582# CONFIG_NETCONSOLE is not set
583# CONFIG_NETPOLL is not set
584# CONFIG_NET_POLL_CONTROLLER is not set
585
586#
587# ISDN subsystem
588#
589# CONFIG_ISDN is not set
590
591#
592# Telephony Support
593#
594# CONFIG_PHONE is not set
595
596#
597# Input device support
598#
599CONFIG_INPUT=y
600
601#
602# Userland interfaces
603#
604CONFIG_INPUT_MOUSEDEV=y
605CONFIG_INPUT_MOUSEDEV_PSAUX=y
606CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
607CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
608# CONFIG_INPUT_JOYDEV is not set
609# CONFIG_INPUT_TSDEV is not set
610CONFIG_INPUT_EVDEV=y
611# CONFIG_INPUT_EVBUG is not set
612
613#
614# Input Device Drivers
615#
616CONFIG_INPUT_KEYBOARD=y
617CONFIG_KEYBOARD_ATKBD=y
618# CONFIG_KEYBOARD_SUNKBD is not set
619# CONFIG_KEYBOARD_LKKBD is not set
620# CONFIG_KEYBOARD_XTKBD is not set
621# CONFIG_KEYBOARD_NEWTON is not set
622CONFIG_INPUT_MOUSE=y
623CONFIG_MOUSE_PS2=y
624# CONFIG_MOUSE_SERIAL is not set
625# CONFIG_MOUSE_VSXXXAA is not set
626# CONFIG_INPUT_JOYSTICK is not set
627# CONFIG_INPUT_TOUCHSCREEN is not set
628# CONFIG_INPUT_MISC is not set
629
630#
631# Hardware I/O ports
632#
633CONFIG_SERIO=y
634CONFIG_SERIO_I8042=y
635CONFIG_SERIO_SERPORT=y
636# CONFIG_SERIO_PCIPS2 is not set
637CONFIG_SERIO_LIBPS2=y
638# CONFIG_SERIO_RAW is not set
639# CONFIG_GAMEPORT is not set
640
641#
642# Character devices
643#
644CONFIG_VT=y
645CONFIG_VT_CONSOLE=y
646CONFIG_HW_CONSOLE=y
647# CONFIG_SERIAL_NONSTANDARD is not set
648
649#
650# Serial drivers
651#
652CONFIG_SERIAL_8250=y
653CONFIG_SERIAL_8250_CONSOLE=y
654CONFIG_SERIAL_8250_ACPI=y
655CONFIG_SERIAL_8250_NR_UARTS=4
656CONFIG_SERIAL_8250_RUNTIME_UARTS=4
657CONFIG_SERIAL_8250_EXTENDED=y
658CONFIG_SERIAL_8250_SHARE_IRQ=y
659# CONFIG_SERIAL_8250_DETECT_IRQ is not set
660# CONFIG_SERIAL_8250_RSA is not set
661
662#
663# Non-8250 serial port support
664#
665CONFIG_SERIAL_CORE=y
666CONFIG_SERIAL_CORE_CONSOLE=y
667# CONFIG_SERIAL_JSM is not set
668CONFIG_UNIX98_PTYS=y
669CONFIG_LEGACY_PTYS=y
670CONFIG_LEGACY_PTY_COUNT=256
671
672#
673# IPMI
674#
675# CONFIG_IPMI_HANDLER is not set
676
677#
678# Watchdog Cards
679#
680# CONFIG_WATCHDOG is not set
681# CONFIG_HW_RANDOM is not set
682CONFIG_EFI_RTC=y
683# CONFIG_DTLK is not set
684# CONFIG_R3964 is not set
685# CONFIG_APPLICOM is not set
686
687#
688# Ftape, the floppy tape device driver
689#
690CONFIG_AGP=m
691CONFIG_AGP_I460=m
692CONFIG_DRM=m 31CONFIG_DRM=m
693# CONFIG_DRM_TDFX is not set
694CONFIG_DRM_R128=m 32CONFIG_DRM_R128=m
695# CONFIG_DRM_RADEON is not set 33CONFIG_DUMMY=y
696# CONFIG_DRM_MGA is not set 34CONFIG_EFI_PARTITION=y
697# CONFIG_DRM_SIS is not set 35CONFIG_EFI_RTC=y
698# CONFIG_DRM_VIA is not set 36CONFIG_EFI_VARS=y
699# CONFIG_DRM_SAVAGE is not set 37CONFIG_EXPERIMENTAL=y
700# CONFIG_RAW_DRIVER is not set
701# CONFIG_HPET is not set
702# CONFIG_HANGCHECK_TIMER is not set
703
704#
705# TPM devices
706#
707# CONFIG_TCG_TPM is not set
708# CONFIG_TELCLOCK is not set
709
710#
711# I2C support
712#
713CONFIG_I2C=y
714CONFIG_I2C_CHARDEV=y
715
716#
717# I2C Algorithms
718#
719CONFIG_I2C_ALGOBIT=y
720# CONFIG_I2C_ALGOPCF is not set
721# CONFIG_I2C_ALGOPCA is not set
722
723#
724# I2C Hardware Bus support
725#
726# CONFIG_I2C_ALI1535 is not set
727# CONFIG_I2C_ALI1563 is not set
728# CONFIG_I2C_ALI15X3 is not set
729# CONFIG_I2C_AMD756 is not set
730# CONFIG_I2C_AMD8111 is not set
731# CONFIG_I2C_I801 is not set
732# CONFIG_I2C_I810 is not set
733# CONFIG_I2C_PIIX4 is not set
734# CONFIG_I2C_NFORCE2 is not set
735# CONFIG_I2C_PARPORT_LIGHT is not set
736# CONFIG_I2C_PROSAVAGE is not set
737# CONFIG_I2C_SAVAGE4 is not set
738# CONFIG_SCx200_ACB is not set
739# CONFIG_I2C_SIS5595 is not set
740# CONFIG_I2C_SIS630 is not set
741# CONFIG_I2C_SIS96X is not set
742# CONFIG_I2C_STUB is not set
743# CONFIG_I2C_VIA is not set
744# CONFIG_I2C_VIAPRO is not set
745# CONFIG_I2C_VOODOO3 is not set
746# CONFIG_I2C_PCA_ISA is not set
747
748#
749# Miscellaneous I2C Chip support
750#
751# CONFIG_SENSORS_DS1337 is not set
752# CONFIG_SENSORS_DS1374 is not set
753# CONFIG_EEPROM_LEGACY is not set
754# CONFIG_SENSORS_PCF8574 is not set
755# CONFIG_SENSORS_PCA9539 is not set
756# CONFIG_SENSORS_PCF8591 is not set
757# CONFIG_SENSORS_RTC8564 is not set
758# CONFIG_SENSORS_MAX6875 is not set
759# CONFIG_RTC_X1205_I2C is not set
760# CONFIG_I2C_DEBUG_CORE is not set
761# CONFIG_I2C_DEBUG_ALGO is not set
762# CONFIG_I2C_DEBUG_BUS is not set
763# CONFIG_I2C_DEBUG_CHIP is not set
764
765#
766# SPI support
767#
768# CONFIG_SPI is not set
769# CONFIG_SPI_MASTER is not set
770
771#
772# Dallas's 1-wire bus
773#
774# CONFIG_W1 is not set
775
776#
777# Hardware Monitoring support
778#
779CONFIG_HWMON=y
780# CONFIG_HWMON_VID is not set
781# CONFIG_SENSORS_ADM1021 is not set
782# CONFIG_SENSORS_ADM1025 is not set
783# CONFIG_SENSORS_ADM1026 is not set
784# CONFIG_SENSORS_ADM1031 is not set
785# CONFIG_SENSORS_ADM9240 is not set
786# CONFIG_SENSORS_ASB100 is not set
787# CONFIG_SENSORS_ATXP1 is not set
788# CONFIG_SENSORS_DS1621 is not set
789# CONFIG_SENSORS_F71805F is not set
790# CONFIG_SENSORS_FSCHER is not set
791# CONFIG_SENSORS_FSCPOS is not set
792# CONFIG_SENSORS_GL518SM is not set
793# CONFIG_SENSORS_GL520SM is not set
794# CONFIG_SENSORS_IT87 is not set
795# CONFIG_SENSORS_LM63 is not set
796# CONFIG_SENSORS_LM75 is not set
797# CONFIG_SENSORS_LM77 is not set
798# CONFIG_SENSORS_LM78 is not set
799# CONFIG_SENSORS_LM80 is not set
800# CONFIG_SENSORS_LM83 is not set
801# CONFIG_SENSORS_LM85 is not set
802# CONFIG_SENSORS_LM87 is not set
803# CONFIG_SENSORS_LM90 is not set
804# CONFIG_SENSORS_LM92 is not set
805# CONFIG_SENSORS_MAX1619 is not set
806# CONFIG_SENSORS_PC87360 is not set
807# CONFIG_SENSORS_SIS5595 is not set
808# CONFIG_SENSORS_SMSC47M1 is not set
809# CONFIG_SENSORS_SMSC47B397 is not set
810# CONFIG_SENSORS_VIA686A is not set
811# CONFIG_SENSORS_VT8231 is not set
812# CONFIG_SENSORS_W83781D is not set
813# CONFIG_SENSORS_W83792D is not set
814# CONFIG_SENSORS_W83L785TS is not set
815# CONFIG_SENSORS_W83627HF is not set
816# CONFIG_SENSORS_W83627EHF is not set
817# CONFIG_HWMON_DEBUG_CHIP is not set
818
819#
820# Misc devices
821#
822
823#
824# Multimedia Capabilities Port drivers
825#
826
827#
828# Multimedia devices
829#
830# CONFIG_VIDEO_DEV is not set
831
832#
833# Digital Video Broadcasting Devices
834#
835# CONFIG_DVB is not set
836
837#
838# Graphics support
839#
840# CONFIG_FB is not set
841
842#
843# Console display driver support
844#
845CONFIG_VGA_CONSOLE=y
846CONFIG_DUMMY_CONSOLE=y
847
848#
849# Sound
850#
851CONFIG_SOUND=m
852
853#
854# Advanced Linux Sound Architecture
855#
856CONFIG_SND=m
857CONFIG_SND_TIMER=m
858CONFIG_SND_PCM=m
859CONFIG_SND_HWDEP=m
860CONFIG_SND_RAWMIDI=m
861CONFIG_SND_SEQUENCER=m
862# CONFIG_SND_SEQ_DUMMY is not set
863CONFIG_SND_OSSEMUL=y
864CONFIG_SND_MIXER_OSS=m
865CONFIG_SND_PCM_OSS=m
866# CONFIG_SND_SEQUENCER_OSS is not set
867# CONFIG_SND_DYNAMIC_MINORS is not set
868CONFIG_SND_SUPPORT_OLD_API=y
869# CONFIG_SND_VERBOSE_PRINTK is not set
870# CONFIG_SND_DEBUG is not set
871
872#
873# Generic devices
874#
875CONFIG_SND_OPL3_LIB=m
876CONFIG_SND_AC97_CODEC=m
877CONFIG_SND_AC97_BUS=m
878# CONFIG_SND_DUMMY is not set
879# CONFIG_SND_VIRMIDI is not set
880# CONFIG_SND_MTPAV is not set
881# CONFIG_SND_SERIAL_U16550 is not set
882# CONFIG_SND_MPU401 is not set
883
884#
885# PCI devices
886#
887# CONFIG_SND_AD1889 is not set
888# CONFIG_SND_ALI5451 is not set
889# CONFIG_SND_ATIIXP is not set
890# CONFIG_SND_ATIIXP_MODEM is not set
891# CONFIG_SND_AU8810 is not set
892# CONFIG_SND_AU8820 is not set
893# CONFIG_SND_AU8830 is not set
894# CONFIG_SND_AZT3328 is not set
895# CONFIG_SND_BT87X is not set
896# CONFIG_SND_CA0106 is not set
897# CONFIG_SND_CMIPCI is not set
898CONFIG_SND_CS4281=m
899# CONFIG_SND_CS46XX is not set
900# CONFIG_SND_EMU10K1 is not set
901# CONFIG_SND_EMU10K1X is not set
902# CONFIG_SND_ENS1370 is not set
903# CONFIG_SND_ENS1371 is not set
904# CONFIG_SND_ES1938 is not set
905# CONFIG_SND_ES1968 is not set
906# CONFIG_SND_FM801 is not set
907# CONFIG_SND_HDA_INTEL is not set
908# CONFIG_SND_HDSP is not set
909# CONFIG_SND_HDSPM is not set
910# CONFIG_SND_ICE1712 is not set
911# CONFIG_SND_ICE1724 is not set
912# CONFIG_SND_INTEL8X0 is not set
913# CONFIG_SND_INTEL8X0M is not set
914# CONFIG_SND_KORG1212 is not set
915# CONFIG_SND_MAESTRO3 is not set
916# CONFIG_SND_MIXART is not set
917# CONFIG_SND_NM256 is not set
918# CONFIG_SND_PCXHR is not set
919# CONFIG_SND_RME32 is not set
920# CONFIG_SND_RME96 is not set
921# CONFIG_SND_RME9652 is not set
922# CONFIG_SND_SONICVIBES is not set
923# CONFIG_SND_TRIDENT is not set
924# CONFIG_SND_VIA82XX is not set
925# CONFIG_SND_VIA82XX_MODEM is not set
926# CONFIG_SND_VX222 is not set
927# CONFIG_SND_YMFPCI is not set
928
929#
930# USB devices
931#
932# CONFIG_SND_USB_AUDIO is not set
933
934#
935# Open Sound System
936#
937# CONFIG_SOUND_PRIME is not set
938
939#
940# USB support
941#
942CONFIG_USB_ARCH_HAS_HCD=y
943CONFIG_USB_ARCH_HAS_OHCI=y
944CONFIG_USB=m
945# CONFIG_USB_DEBUG is not set
946
947#
948# Miscellaneous USB options
949#
950CONFIG_USB_DEVICEFS=y
951# CONFIG_USB_BANDWIDTH is not set
952# CONFIG_USB_DYNAMIC_MINORS is not set
953# CONFIG_USB_SUSPEND is not set
954# CONFIG_USB_OTG is not set
955
956#
957# USB Host Controller Drivers
958#
959# CONFIG_USB_EHCI_HCD is not set
960# CONFIG_USB_ISP116X_HCD is not set
961# CONFIG_USB_OHCI_HCD is not set
962CONFIG_USB_UHCI_HCD=m
963# CONFIG_USB_SL811_HCD is not set
964
965#
966# USB Device Class drivers
967#
968# CONFIG_OBSOLETE_OSS_USB_DRIVER is not set
969CONFIG_USB_ACM=m
970CONFIG_USB_PRINTER=m
971
972#
973# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
974#
975
976#
977# may also be needed; see USB_STORAGE Help for more information
978#
979CONFIG_USB_STORAGE=m
980# CONFIG_USB_STORAGE_DEBUG is not set
981# CONFIG_USB_STORAGE_DATAFAB is not set
982# CONFIG_USB_STORAGE_FREECOM is not set
983# CONFIG_USB_STORAGE_ISD200 is not set
984# CONFIG_USB_STORAGE_DPCM is not set
985# CONFIG_USB_STORAGE_USBAT is not set
986# CONFIG_USB_STORAGE_SDDR09 is not set
987# CONFIG_USB_STORAGE_SDDR55 is not set
988# CONFIG_USB_STORAGE_JUMPSHOT is not set
989# CONFIG_USB_STORAGE_ALAUDA is not set
990# CONFIG_USB_LIBUSUAL is not set
991
992#
993# USB Input Devices
994#
995CONFIG_USB_HID=m
996CONFIG_USB_HIDINPUT=y
997# CONFIG_USB_HIDINPUT_POWERBOOK is not set
998# CONFIG_HID_FF is not set
999CONFIG_USB_HIDDEV=y
1000
1001#
1002# USB HID Boot Protocol drivers
1003#
1004# CONFIG_USB_KBD is not set
1005# CONFIG_USB_MOUSE is not set
1006# CONFIG_USB_AIPTEK is not set
1007# CONFIG_USB_WACOM is not set
1008# CONFIG_USB_ACECAD is not set
1009# CONFIG_USB_KBTAB is not set
1010# CONFIG_USB_POWERMATE is not set
1011# CONFIG_USB_MTOUCH is not set
1012# CONFIG_USB_ITMTOUCH is not set
1013# CONFIG_USB_EGALAX is not set
1014# CONFIG_USB_YEALINK is not set
1015# CONFIG_USB_XPAD is not set
1016# CONFIG_USB_ATI_REMOTE is not set
1017# CONFIG_USB_ATI_REMOTE2 is not set
1018# CONFIG_USB_KEYSPAN_REMOTE is not set
1019# CONFIG_USB_APPLETOUCH is not set
1020
1021#
1022# USB Imaging devices
1023#
1024# CONFIG_USB_MDC800 is not set
1025# CONFIG_USB_MICROTEK is not set
1026
1027#
1028# USB Multimedia devices
1029#
1030# CONFIG_USB_DABUSB is not set
1031
1032#
1033# Video4Linux support is needed for USB Multimedia device support
1034#
1035
1036#
1037# USB Network Adapters
1038#
1039# CONFIG_USB_CATC is not set
1040# CONFIG_USB_KAWETH is not set
1041# CONFIG_USB_PEGASUS is not set
1042# CONFIG_USB_RTL8150 is not set
1043# CONFIG_USB_USBNET is not set
1044CONFIG_USB_MON=y
1045
1046#
1047# USB port drivers
1048#
1049
1050#
1051# USB Serial Converter support
1052#
1053# CONFIG_USB_SERIAL is not set
1054
1055#
1056# USB Miscellaneous drivers
1057#
1058# CONFIG_USB_EMI62 is not set
1059# CONFIG_USB_EMI26 is not set
1060# CONFIG_USB_AUERSWALD is not set
1061# CONFIG_USB_RIO500 is not set
1062# CONFIG_USB_LEGOTOWER is not set
1063# CONFIG_USB_LCD is not set
1064# CONFIG_USB_LED is not set
1065# CONFIG_USB_CYTHERM is not set
1066# CONFIG_USB_PHIDGETKIT is not set
1067# CONFIG_USB_PHIDGETSERVO is not set
1068# CONFIG_USB_IDMOUSE is not set
1069# CONFIG_USB_LD is not set
1070# CONFIG_USB_TEST is not set
1071
1072#
1073# USB DSL modem support
1074#
1075
1076#
1077# USB Gadget Support
1078#
1079# CONFIG_USB_GADGET is not set
1080
1081#
1082# MMC/SD Card support
1083#
1084# CONFIG_MMC is not set
1085
1086#
1087# InfiniBand support
1088#
1089# CONFIG_INFINIBAND is not set
1090
1091#
1092# EDAC - error detection and reporting (RAS)
1093#
1094
1095#
1096# File systems
1097#
1098CONFIG_EXT2_FS=y 38CONFIG_EXT2_FS=y
1099# CONFIG_EXT2_FS_XATTR is not set
1100# CONFIG_EXT2_FS_XIP is not set
1101CONFIG_EXT3_FS=y 39CONFIG_EXT3_FS=y
1102CONFIG_EXT3_FS_XATTR=y 40CONFIG_HUGETLBFS=y
1103# CONFIG_EXT3_FS_POSIX_ACL is not set 41# CONFIG_HW_RANDOM is not set
1104# CONFIG_EXT3_FS_SECURITY is not set 42CONFIG_I2C_CHARDEV=y
1105CONFIG_JBD=y 43CONFIG_I2C=y
1106# CONFIG_JBD_DEBUG is not set 44CONFIG_IA64_DIG=y
1107CONFIG_FS_MBCACHE=y 45CONFIG_IA64_PALINFO=y
1108# CONFIG_REISERFS_FS is not set 46CONFIG_IDE=m
1109# CONFIG_JFS_FS is not set 47CONFIG_INET=y
1110CONFIG_FS_POSIX_ACL=y
1111CONFIG_XFS_FS=y
1112CONFIG_XFS_EXPORT=y
1113CONFIG_XFS_QUOTA=y
1114CONFIG_XFS_SECURITY=y
1115CONFIG_XFS_POSIX_ACL=y
1116# CONFIG_XFS_RT is not set
1117# CONFIG_OCFS2_FS is not set
1118# CONFIG_MINIX_FS is not set
1119# CONFIG_ROMFS_FS is not set
1120CONFIG_INOTIFY=y 48CONFIG_INOTIFY=y
1121# CONFIG_QUOTA is not set 49CONFIG_INPUT_EVDEV=y
1122CONFIG_QUOTACTL=y 50# CONFIG_IPV6 is not set
1123CONFIG_DNOTIFY=y
1124CONFIG_AUTOFS_FS=m
1125CONFIG_AUTOFS4_FS=m
1126# CONFIG_FUSE_FS is not set
1127
1128#
1129# CD-ROM/DVD Filesystems
1130#
1131CONFIG_ISO9660_FS=m 51CONFIG_ISO9660_FS=m
1132CONFIG_JOLIET=y 52CONFIG_JOLIET=y
1133# CONFIG_ZISOFS is not set 53CONFIG_LOG_BUF_SHIFT=16
1134CONFIG_UDF_FS=m 54CONFIG_MAGIC_SYSRQ=y
1135CONFIG_UDF_NLS=y 55CONFIG_MD_LINEAR=m
1136 56CONFIG_MD_MULTIPATH=m
1137# 57CONFIG_MD_RAID0=m
1138# DOS/FAT/NT Filesystems 58CONFIG_MD_RAID10=m
1139# 59CONFIG_MD_RAID1=m
1140CONFIG_FAT_FS=y 60CONFIG_MD=y
1141# CONFIG_MSDOS_FS is not set 61CONFIG_MII=y
1142CONFIG_VFAT_FS=y 62CONFIG_MODULES=y
1143CONFIG_FAT_DEFAULT_CODEPAGE=437 63CONFIG_MODULE_UNLOAD=y
1144CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" 64CONFIG_NETDEVICES=y
1145# CONFIG_NTFS_FS is not set 65CONFIG_NET_ETHERNET=y
1146 66CONFIG_NET_PCI=y
1147# 67CONFIG_NET=y
1148# Pseudo filesystems 68CONFIG_NFSD=m
1149# 69CONFIG_NFSD_V4=y
1150CONFIG_PROC_FS=y
1151CONFIG_PROC_KCORE=y
1152CONFIG_SYSFS=y
1153CONFIG_TMPFS=y
1154CONFIG_HUGETLBFS=y
1155CONFIG_HUGETLB_PAGE=y
1156CONFIG_RAMFS=y
1157# CONFIG_RELAYFS_FS is not set
1158# CONFIG_CONFIGFS_FS is not set
1159
1160#
1161# Miscellaneous filesystems
1162#
1163# CONFIG_ADFS_FS is not set
1164# CONFIG_AFFS_FS is not set
1165# CONFIG_HFS_FS is not set
1166# CONFIG_HFSPLUS_FS is not set
1167# CONFIG_BEFS_FS is not set
1168# CONFIG_BFS_FS is not set
1169# CONFIG_EFS_FS is not set
1170# CONFIG_CRAMFS is not set
1171# CONFIG_VXFS_FS is not set
1172# CONFIG_HPFS_FS is not set
1173# CONFIG_QNX4FS_FS is not set
1174# CONFIG_SYSV_FS is not set
1175# CONFIG_UFS_FS is not set
1176
1177#
1178# Network File Systems
1179#
1180CONFIG_NFS_FS=m 70CONFIG_NFS_FS=m
1181CONFIG_NFS_V3=y 71CONFIG_NFS_V3=y
1182# CONFIG_NFS_V3_ACL is not set
1183CONFIG_NFS_V4=y 72CONFIG_NFS_V4=y
1184# CONFIG_NFS_DIRECTIO is not set
1185CONFIG_NFSD=m
1186CONFIG_NFSD_V3=y
1187# CONFIG_NFSD_V3_ACL is not set
1188CONFIG_NFSD_V4=y
1189CONFIG_NFSD_TCP=y
1190CONFIG_LOCKD=m
1191CONFIG_LOCKD_V4=y
1192CONFIG_EXPORTFS=y
1193CONFIG_NFS_COMMON=y
1194CONFIG_SUNRPC=m
1195CONFIG_SUNRPC_GSS=m
1196CONFIG_RPCSEC_GSS_KRB5=m
1197# CONFIG_RPCSEC_GSS_SPKM3 is not set
1198# CONFIG_SMB_FS is not set
1199CONFIG_CIFS=m
1200CONFIG_CIFS_STATS=y
1201# CONFIG_CIFS_STATS2 is not set
1202CONFIG_CIFS_XATTR=y
1203CONFIG_CIFS_POSIX=y
1204# CONFIG_CIFS_EXPERIMENTAL is not set
1205# CONFIG_NCP_FS is not set
1206# CONFIG_CODA_FS is not set
1207# CONFIG_AFS_FS is not set
1208# CONFIG_9P_FS is not set
1209
1210#
1211# Partition Types
1212#
1213CONFIG_PARTITION_ADVANCED=y
1214# CONFIG_ACORN_PARTITION is not set
1215# CONFIG_OSF_PARTITION is not set
1216# CONFIG_AMIGA_PARTITION is not set
1217# CONFIG_ATARI_PARTITION is not set
1218# CONFIG_MAC_PARTITION is not set
1219CONFIG_MSDOS_PARTITION=y
1220# CONFIG_BSD_DISKLABEL is not set
1221# CONFIG_MINIX_SUBPARTITION is not set
1222# CONFIG_SOLARIS_X86_PARTITION is not set
1223# CONFIG_UNIXWARE_DISKLABEL is not set
1224# CONFIG_LDM_PARTITION is not set
1225CONFIG_SGI_PARTITION=y
1226# CONFIG_ULTRIX_PARTITION is not set
1227# CONFIG_SUN_PARTITION is not set
1228# CONFIG_KARMA_PARTITION is not set
1229CONFIG_EFI_PARTITION=y
1230
1231#
1232# Native Language Support
1233#
1234CONFIG_NLS=y
1235CONFIG_NLS_DEFAULT="iso8859-1"
1236CONFIG_NLS_CODEPAGE_437=y 73CONFIG_NLS_CODEPAGE_437=y
1237# CONFIG_NLS_CODEPAGE_737 is not set
1238# CONFIG_NLS_CODEPAGE_775 is not set
1239# CONFIG_NLS_CODEPAGE_850 is not set
1240# CONFIG_NLS_CODEPAGE_852 is not set
1241# CONFIG_NLS_CODEPAGE_855 is not set
1242# CONFIG_NLS_CODEPAGE_857 is not set
1243# CONFIG_NLS_CODEPAGE_860 is not set
1244# CONFIG_NLS_CODEPAGE_861 is not set
1245# CONFIG_NLS_CODEPAGE_862 is not set
1246# CONFIG_NLS_CODEPAGE_863 is not set
1247# CONFIG_NLS_CODEPAGE_864 is not set
1248# CONFIG_NLS_CODEPAGE_865 is not set
1249# CONFIG_NLS_CODEPAGE_866 is not set
1250# CONFIG_NLS_CODEPAGE_869 is not set
1251# CONFIG_NLS_CODEPAGE_936 is not set
1252# CONFIG_NLS_CODEPAGE_950 is not set
1253# CONFIG_NLS_CODEPAGE_932 is not set
1254# CONFIG_NLS_CODEPAGE_949 is not set
1255# CONFIG_NLS_CODEPAGE_874 is not set
1256# CONFIG_NLS_ISO8859_8 is not set
1257# CONFIG_NLS_CODEPAGE_1250 is not set
1258# CONFIG_NLS_CODEPAGE_1251 is not set
1259# CONFIG_NLS_ASCII is not set
1260CONFIG_NLS_ISO8859_1=y 74CONFIG_NLS_ISO8859_1=y
1261# CONFIG_NLS_ISO8859_2 is not set
1262# CONFIG_NLS_ISO8859_3 is not set
1263# CONFIG_NLS_ISO8859_4 is not set
1264# CONFIG_NLS_ISO8859_5 is not set
1265# CONFIG_NLS_ISO8859_6 is not set
1266# CONFIG_NLS_ISO8859_7 is not set
1267# CONFIG_NLS_ISO8859_9 is not set
1268# CONFIG_NLS_ISO8859_13 is not set
1269# CONFIG_NLS_ISO8859_14 is not set
1270# CONFIG_NLS_ISO8859_15 is not set
1271# CONFIG_NLS_KOI8_R is not set
1272# CONFIG_NLS_KOI8_U is not set
1273CONFIG_NLS_UTF8=m 75CONFIG_NLS_UTF8=m
1274 76CONFIG_NR_CPUS=2
1275#
1276# Library routines
1277#
1278# CONFIG_CRC_CCITT is not set
1279# CONFIG_CRC16 is not set
1280CONFIG_CRC32=y
1281# CONFIG_LIBCRC32C is not set
1282CONFIG_GENERIC_HARDIRQS=y
1283CONFIG_GENERIC_IRQ_PROBE=y
1284CONFIG_GENERIC_PENDING_IRQ=y
1285
1286#
1287# Instrumentation Support
1288#
1289CONFIG_PROFILING=y
1290CONFIG_OPROFILE=y 77CONFIG_OPROFILE=y
1291# CONFIG_KPROBES is not set 78CONFIG_PACKET=y
1292 79CONFIG_PARTITION_ADVANCED=y
1293# 80CONFIG_PERFMON=y
1294# Kernel hacking 81CONFIG_POSIX_MQUEUE=y
1295# 82CONFIG_PREEMPT=y
1296# CONFIG_PRINTK_TIME is not set 83CONFIG_PROC_KCORE=y
1297CONFIG_MAGIC_SYSRQ=y 84CONFIG_PROFILING=y
1298CONFIG_DEBUG_KERNEL=y 85CONFIG_SCSI_CONSTANTS=y
1299CONFIG_LOG_BUF_SHIFT=16 86CONFIG_SCSI_LOGGING=y
1300CONFIG_DETECT_SOFTLOCKUP=y 87CONFIG_SCSI_QLOGIC_1280=y
1301# CONFIG_SCHEDSTATS is not set 88CONFIG_SCSI_SPI_ATTRS=m
1302# CONFIG_DEBUG_SLAB is not set 89CONFIG_SCSI=y
1303CONFIG_DEBUG_PREEMPT=y 90CONFIG_SERIAL_8250_CONSOLE=y
1304CONFIG_DEBUG_MUTEXES=y 91CONFIG_SERIAL_8250_EXTENDED=y
1305# CONFIG_DEBUG_SPINLOCK is not set 92CONFIG_SERIAL_8250_SHARE_IRQ=y
1306# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 93CONFIG_SERIAL_8250=y
1307# CONFIG_DEBUG_KOBJECT is not set 94CONFIG_SGI_PARTITION=y
1308# CONFIG_DEBUG_INFO is not set 95CONFIG_SMP=y
1309# CONFIG_DEBUG_FS is not set 96CONFIG_SND_CS4281=m
1310# CONFIG_DEBUG_VM is not set 97CONFIG_SND=m
1311CONFIG_FORCED_INLINING=y 98CONFIG_SND_MIXER_OSS=m
1312# CONFIG_RCU_TORTURE_TEST is not set 99CONFIG_SND_PCM_OSS=m
1313# CONFIG_IA64_GRANULE_16MB is not set 100CONFIG_SND_SEQUENCER=m
1314CONFIG_IA64_GRANULE_64MB=y 101CONFIG_SOUND=m
1315# CONFIG_IA64_PRINT_HAZARDS is not set 102CONFIG_SYSVIPC=y
1316# CONFIG_DISABLE_VHPT is not set 103CONFIG_TMPFS=y
1317# CONFIG_IA64_DEBUG_CMPXCHG is not set 104CONFIG_UDF_FS=m
1318# CONFIG_IA64_DEBUG_IRQ is not set 105CONFIG_UNIX=y
1319CONFIG_SYSVIPC_COMPAT=y 106CONFIG_USB_ACM=m
1320 107CONFIG_USB_DEVICEFS=y
1321# 108CONFIG_USB_HIDDEV=y
1322# Security options 109CONFIG_USB=m
1323# 110CONFIG_USB_MON=m
1324# CONFIG_KEYS is not set 111CONFIG_USB_PRINTER=m
1325# CONFIG_SECURITY is not set 112CONFIG_USB_STORAGE=m
1326 113CONFIG_USB_UHCI_HCD=m
1327# 114CONFIG_VFAT_FS=y
1328# Cryptographic options 115# CONFIG_VIRTUAL_MEM_MAP is not set
1329# 116CONFIG_XFS_FS=y
1330CONFIG_CRYPTO=y 117CONFIG_XFS_POSIX_ACL=y
1331# CONFIG_CRYPTO_HMAC is not set 118CONFIG_XFS_QUOTA=y
1332# CONFIG_CRYPTO_NULL is not set
1333# CONFIG_CRYPTO_MD4 is not set
1334CONFIG_CRYPTO_MD5=y
1335# CONFIG_CRYPTO_SHA1 is not set
1336# CONFIG_CRYPTO_SHA256 is not set
1337# CONFIG_CRYPTO_SHA512 is not set
1338# CONFIG_CRYPTO_WP512 is not set
1339# CONFIG_CRYPTO_TGR192 is not set
1340CONFIG_CRYPTO_DES=y
1341# CONFIG_CRYPTO_BLOWFISH is not set
1342# CONFIG_CRYPTO_TWOFISH is not set
1343# CONFIG_CRYPTO_SERPENT is not set
1344# CONFIG_CRYPTO_AES is not set
1345# CONFIG_CRYPTO_CAST5 is not set
1346# CONFIG_CRYPTO_CAST6 is not set
1347# CONFIG_CRYPTO_TEA is not set
1348# CONFIG_CRYPTO_ARC4 is not set
1349# CONFIG_CRYPTO_KHAZAD is not set
1350# CONFIG_CRYPTO_ANUBIS is not set
1351# CONFIG_CRYPTO_DEFLATE is not set
1352# CONFIG_CRYPTO_MICHAEL_MIC is not set
1353# CONFIG_CRYPTO_CRC32C is not set
1354# CONFIG_CRYPTO_TEST is not set
1355
1356#
1357# Hardware crypto devices
1358#
diff --git a/arch/ia64/configs/generic_defconfig b/arch/ia64/configs/generic_defconfig
index 6a4cc506fb5f..01ba5305e98c 100644
--- a/arch/ia64/configs/generic_defconfig
+++ b/arch/ia64/configs/generic_defconfig
@@ -1,1455 +1,133 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.28-rc7
4# Mon Dec 8 08:12:07 2008
5#
6CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
7
8#
9# General setup
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_LOCK_KERNEL=y
13CONFIG_INIT_ENV_ARG_LIMIT=32
14CONFIG_LOCALVERSION=""
15CONFIG_LOCALVERSION_AUTO=y
16CONFIG_SWAP=y
17CONFIG_SYSVIPC=y
18CONFIG_SYSVIPC_SYSCTL=y
19CONFIG_POSIX_MQUEUE=y
20# CONFIG_BSD_PROCESS_ACCT is not set
21# CONFIG_TASKSTATS is not set
22# CONFIG_AUDIT is not set
23CONFIG_IKCONFIG=y
24CONFIG_IKCONFIG_PROC=y
25CONFIG_LOG_BUF_SHIFT=20
26CONFIG_CGROUPS=y
27# CONFIG_CGROUP_DEBUG is not set
28# CONFIG_CGROUP_NS is not set
29# CONFIG_CGROUP_FREEZER is not set
30# CONFIG_CGROUP_DEVICE is not set
31CONFIG_CPUSETS=y
32# CONFIG_GROUP_SCHED is not set
33# CONFIG_CGROUP_CPUACCT is not set
34# CONFIG_RESOURCE_COUNTERS is not set
35CONFIG_SYSFS_DEPRECATED=y
36CONFIG_SYSFS_DEPRECATED_V2=y
37CONFIG_PROC_PID_CPUSET=y
38# CONFIG_RELAY is not set
39CONFIG_NAMESPACES=y
40# CONFIG_UTS_NS is not set
41# CONFIG_IPC_NS is not set
42# CONFIG_USER_NS is not set
43# CONFIG_PID_NS is not set
44CONFIG_BLK_DEV_INITRD=y
45CONFIG_INITRAMFS_SOURCE=""
46CONFIG_CC_OPTIMIZE_FOR_SIZE=y
47CONFIG_SYSCTL=y
48# CONFIG_EMBEDDED is not set
49CONFIG_SYSCTL_SYSCALL=y
50CONFIG_KALLSYMS=y
51CONFIG_KALLSYMS_ALL=y
52# CONFIG_KALLSYMS_EXTRA_PASS is not set
53CONFIG_HOTPLUG=y
54CONFIG_PRINTK=y
55CONFIG_BUG=y
56CONFIG_ELF_CORE=y
57CONFIG_COMPAT_BRK=y
58CONFIG_BASE_FULL=y
59CONFIG_FUTEX=y
60CONFIG_ANON_INODES=y
61CONFIG_EPOLL=y
62CONFIG_SIGNALFD=y
63CONFIG_TIMERFD=y
64CONFIG_EVENTFD=y
65CONFIG_SHMEM=y
66CONFIG_AIO=y
67CONFIG_VM_EVENT_COUNTERS=y
68CONFIG_PCI_QUIRKS=y
69CONFIG_SLUB_DEBUG=y
70# CONFIG_SLAB is not set
71CONFIG_SLUB=y
72# CONFIG_SLOB is not set
73# CONFIG_PROFILING is not set
74# CONFIG_MARKERS is not set
75CONFIG_HAVE_OPROFILE=y
76# CONFIG_KPROBES is not set
77CONFIG_HAVE_KPROBES=y
78CONFIG_HAVE_KRETPROBES=y
79CONFIG_HAVE_ARCH_TRACEHOOK=y
80CONFIG_HAVE_DMA_ATTRS=y
81CONFIG_USE_GENERIC_SMP_HELPERS=y
82# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
83CONFIG_SLABINFO=y
84CONFIG_RT_MUTEXES=y
85# CONFIG_TINY_SHMEM is not set
86CONFIG_BASE_SMALL=0
87CONFIG_MODULES=y
88# CONFIG_MODULE_FORCE_LOAD is not set
89CONFIG_MODULE_UNLOAD=y
90# CONFIG_MODULE_FORCE_UNLOAD is not set
91CONFIG_MODVERSIONS=y
92# CONFIG_MODULE_SRCVERSION_ALL is not set
93CONFIG_KMOD=y
94CONFIG_STOP_MACHINE=y
95CONFIG_BLOCK=y
96# CONFIG_BLK_DEV_IO_TRACE is not set
97# CONFIG_BLK_DEV_BSG is not set
98# CONFIG_BLK_DEV_INTEGRITY is not set
99CONFIG_BLOCK_COMPAT=y
100
101#
102# IO Schedulers
103#
104CONFIG_IOSCHED_NOOP=y
105CONFIG_IOSCHED_AS=y
106CONFIG_IOSCHED_DEADLINE=y
107CONFIG_IOSCHED_CFQ=y
108CONFIG_DEFAULT_AS=y
109# CONFIG_DEFAULT_DEADLINE is not set
110# CONFIG_DEFAULT_CFQ is not set
111# CONFIG_DEFAULT_NOOP is not set
112CONFIG_DEFAULT_IOSCHED="anticipatory"
113CONFIG_CLASSIC_RCU=y
114# CONFIG_FREEZER is not set
115
116#
117# Processor type and features
118#
119CONFIG_IA64=y
120CONFIG_64BIT=y
121CONFIG_ZONE_DMA=y
122CONFIG_QUICKLIST=y
123CONFIG_MMU=y
124CONFIG_SWIOTLB=y
125CONFIG_IOMMU_HELPER=y
126CONFIG_RWSEM_XCHGADD_ALGORITHM=y
127CONFIG_HUGETLB_PAGE_SIZE_VARIABLE=y
128CONFIG_GENERIC_FIND_NEXT_BIT=y
129CONFIG_GENERIC_CALIBRATE_DELAY=y
130CONFIG_GENERIC_TIME=y
131CONFIG_GENERIC_TIME_VSYSCALL=y
132CONFIG_HAVE_SETUP_PER_CPU_AREA=y
133CONFIG_DMI=y
134CONFIG_EFI=y
135CONFIG_GENERIC_IOMAP=y
136CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
137CONFIG_IA64_UNCACHED_ALLOCATOR=y
138CONFIG_AUDIT_ARCH=y
139# CONFIG_PARAVIRT_GUEST is not set
140CONFIG_IA64_GENERIC=y
141# CONFIG_IA64_DIG is not set
142# CONFIG_IA64_DIG_VTD is not set
143# CONFIG_IA64_HP_ZX1 is not set
144# CONFIG_IA64_HP_ZX1_SWIOTLB is not set
145# CONFIG_IA64_SGI_SN2 is not set
146# CONFIG_IA64_SGI_UV is not set
147# CONFIG_IA64_HP_SIM is not set
148# CONFIG_IA64_XEN_GUEST is not set
149# CONFIG_ITANIUM is not set
150CONFIG_MCKINLEY=y
151# CONFIG_IA64_PAGE_SIZE_4KB is not set
152# CONFIG_IA64_PAGE_SIZE_8KB is not set
153# CONFIG_IA64_PAGE_SIZE_16KB is not set
154CONFIG_IA64_PAGE_SIZE_64KB=y
155CONFIG_PGTABLE_3=y
156# CONFIG_PGTABLE_4 is not set
157CONFIG_HZ=250
158# CONFIG_HZ_100 is not set
159CONFIG_HZ_250=y
160# CONFIG_HZ_300 is not set
161# CONFIG_HZ_1000 is not set
162# CONFIG_SCHED_HRTICK is not set
163CONFIG_IA64_L1_CACHE_SHIFT=7
164CONFIG_IA64_CYCLONE=y
165CONFIG_IOSAPIC=y
166CONFIG_FORCE_MAX_ZONEORDER=17
167# CONFIG_VIRT_CPU_ACCOUNTING is not set
168CONFIG_SMP=y
169CONFIG_NR_CPUS=4096
170CONFIG_HOTPLUG_CPU=y
171CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
172CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
173# CONFIG_SCHED_SMT is not set
174# CONFIG_PERMIT_BSP_REMOVE is not set
175CONFIG_PREEMPT_NONE=y
176# CONFIG_PREEMPT_VOLUNTARY is not set
177# CONFIG_PREEMPT is not set
178CONFIG_SELECT_MEMORY_MODEL=y
179# CONFIG_FLATMEM_MANUAL is not set
180CONFIG_DISCONTIGMEM_MANUAL=y
181# CONFIG_SPARSEMEM_MANUAL is not set
182CONFIG_DISCONTIGMEM=y
183CONFIG_FLAT_NODE_MEM_MAP=y
184CONFIG_NEED_MULTIPLE_NODES=y
185CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
186CONFIG_PAGEFLAGS_EXTENDED=y
187CONFIG_SPLIT_PTLOCK_CPUS=4
188CONFIG_MIGRATION=y
189CONFIG_RESOURCES_64BIT=y
190CONFIG_PHYS_ADDR_T_64BIT=y
191CONFIG_ZONE_DMA_FLAG=1
192CONFIG_BOUNCE=y
193CONFIG_NR_QUICK=1
194CONFIG_VIRT_TO_BUS=y
195CONFIG_UNEVICTABLE_LRU=y
196CONFIG_ARCH_SELECT_MEMORY_MODEL=y
197CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
198CONFIG_ARCH_FLATMEM_ENABLE=y
199CONFIG_ARCH_SPARSEMEM_ENABLE=y
200CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y
201CONFIG_NUMA=y
202CONFIG_NODES_SHIFT=10
203CONFIG_ARCH_POPULATES_NODE_MAP=y
204CONFIG_VIRTUAL_MEM_MAP=y
205CONFIG_HOLES_IN_ZONE=y
206CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
207CONFIG_HAVE_ARCH_NODEDATA_EXTENSION=y
208CONFIG_COMPAT_FOR_U64_ALIGNMENT=y
209CONFIG_IA64_MCA_RECOVERY=y
210CONFIG_PERFMON=y
211CONFIG_IA64_PALINFO=y
212# CONFIG_IA64_MC_ERR_INJECT is not set
213CONFIG_SGI_SN=y
214# CONFIG_IA64_ESI is not set
215# CONFIG_IA64_HP_AML_NFW is not set
216
217#
218# SN Devices
219#
220CONFIG_SGI_IOC3=m
221CONFIG_KEXEC=y
222CONFIG_CRASH_DUMP=y
223
224#
225# Firmware Drivers
226#
227# CONFIG_FIRMWARE_MEMMAP is not set
228CONFIG_EFI_VARS=y
229CONFIG_EFI_PCDP=y
230CONFIG_DMIID=y
231CONFIG_BINFMT_ELF=y
232# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
233# CONFIG_HAVE_AOUT is not set
234CONFIG_BINFMT_MISC=m
235
236#
237# Power management and ACPI options
238#
239CONFIG_PM=y
240# CONFIG_PM_DEBUG is not set
241CONFIG_ACPI=y
242CONFIG_ACPI_PROCFS=y
243CONFIG_ACPI_PROCFS_POWER=y
244CONFIG_ACPI_SYSFS_POWER=y
245CONFIG_ACPI_PROC_EVENT=y
246CONFIG_ACPI_BUTTON=m 1CONFIG_ACPI_BUTTON=m
247CONFIG_ACPI_FAN=m 2CONFIG_ACPI_CONTAINER=m
248CONFIG_ACPI_DOCK=y 3CONFIG_ACPI_DOCK=y
4CONFIG_ACPI_FAN=m
249CONFIG_ACPI_PROCESSOR=m 5CONFIG_ACPI_PROCESSOR=m
250CONFIG_ACPI_HOTPLUG_CPU=y 6CONFIG_ACPI_PROCFS=y
251CONFIG_ACPI_THERMAL=m 7CONFIG_AGP_HP_ZX1=m
252CONFIG_ACPI_NUMA=y 8CONFIG_AGP_I460=m
253# CONFIG_ACPI_CUSTOM_DSDT is not set 9CONFIG_AGP=m
254CONFIG_ACPI_BLACKLIST_YEAR=0 10CONFIG_AGP_SGI_TIOCA=m
255# CONFIG_ACPI_DEBUG is not set
256# CONFIG_ACPI_PCI_SLOT is not set
257CONFIG_ACPI_SYSTEM=y
258CONFIG_ACPI_CONTAINER=m
259
260#
261# CPU Frequency scaling
262#
263# CONFIG_CPU_FREQ is not set
264
265#
266# Bus options (PCI, PCMCIA)
267#
268CONFIG_PCI=y
269CONFIG_PCI_DOMAINS=y
270CONFIG_PCI_SYSCALL=y
271# CONFIG_PCIEPORTBUS is not set
272CONFIG_ARCH_SUPPORTS_MSI=y
273CONFIG_PCI_MSI=y
274CONFIG_PCI_LEGACY=y
275# CONFIG_PCI_DEBUG is not set
276CONFIG_HOTPLUG_PCI=m
277# CONFIG_HOTPLUG_PCI_FAKE is not set
278CONFIG_HOTPLUG_PCI_ACPI=m
279# CONFIG_HOTPLUG_PCI_ACPI_IBM is not set
280# CONFIG_HOTPLUG_PCI_CPCI is not set
281# CONFIG_HOTPLUG_PCI_SHPC is not set
282# CONFIG_HOTPLUG_PCI_SGI is not set
283# CONFIG_PCCARD is not set
284CONFIG_DMAR=y
285CONFIG_NET=y
286
287#
288# Networking options
289#
290CONFIG_PACKET=y
291# CONFIG_PACKET_MMAP is not set
292CONFIG_UNIX=y
293CONFIG_XFRM=y
294# CONFIG_XFRM_USER is not set
295# CONFIG_XFRM_SUB_POLICY is not set
296# CONFIG_XFRM_MIGRATE is not set
297# CONFIG_XFRM_STATISTICS is not set
298# CONFIG_NET_KEY is not set
299CONFIG_INET=y
300CONFIG_IP_MULTICAST=y
301# CONFIG_IP_ADVANCED_ROUTER is not set
302CONFIG_IP_FIB_HASH=y
303# CONFIG_IP_PNP is not set
304# CONFIG_NET_IPIP is not set
305# CONFIG_NET_IPGRE is not set
306# CONFIG_IP_MROUTE is not set
307CONFIG_ARPD=y 11CONFIG_ARPD=y
308CONFIG_SYN_COOKIES=y 12CONFIG_ATA_PIIX=y
309# CONFIG_INET_AH is not set 13CONFIG_ATA=y
310# CONFIG_INET_ESP is not set 14CONFIG_AUTOFS4_FS=m
311# CONFIG_INET_IPCOMP is not set 15CONFIG_AUTOFS_FS=m
312# CONFIG_INET_XFRM_TUNNEL is not set 16CONFIG_BINFMT_MISC=m
313# CONFIG_INET_TUNNEL is not set 17# CONFIG_BLK_DEV_BSG is not set
314CONFIG_INET_XFRM_MODE_TRANSPORT=y 18CONFIG_BLK_DEV_CMD64X=y
315CONFIG_INET_XFRM_MODE_TUNNEL=y
316CONFIG_INET_XFRM_MODE_BEET=y
317CONFIG_INET_LRO=m
318CONFIG_INET_DIAG=y
319CONFIG_INET_TCP_DIAG=y
320# CONFIG_TCP_CONG_ADVANCED is not set
321CONFIG_TCP_CONG_CUBIC=y
322CONFIG_DEFAULT_TCP_CONG="cubic"
323# CONFIG_TCP_MD5SIG is not set
324# CONFIG_IPV6 is not set
325# CONFIG_NETWORK_SECMARK is not set
326# CONFIG_NETFILTER is not set
327# CONFIG_IP_DCCP is not set
328# CONFIG_IP_SCTP is not set
329# CONFIG_TIPC is not set
330# CONFIG_ATM is not set
331# CONFIG_BRIDGE is not set
332# CONFIG_NET_DSA is not set
333# CONFIG_VLAN_8021Q is not set
334# CONFIG_DECNET is not set
335# CONFIG_LLC2 is not set
336# CONFIG_IPX is not set
337# CONFIG_ATALK is not set
338# CONFIG_X25 is not set
339# CONFIG_LAPB is not set
340# CONFIG_ECONET is not set
341# CONFIG_WAN_ROUTER is not set
342# CONFIG_NET_SCHED is not set
343
344#
345# Network testing
346#
347# CONFIG_NET_PKTGEN is not set
348# CONFIG_HAMRADIO is not set
349# CONFIG_CAN is not set
350# CONFIG_IRDA is not set
351# CONFIG_BT is not set
352# CONFIG_AF_RXRPC is not set
353# CONFIG_PHONET is not set
354CONFIG_WIRELESS=y
355# CONFIG_CFG80211 is not set
356CONFIG_WIRELESS_OLD_REGULATORY=y
357# CONFIG_WIRELESS_EXT is not set
358# CONFIG_MAC80211 is not set
359# CONFIG_IEEE80211 is not set
360# CONFIG_RFKILL is not set
361# CONFIG_NET_9P is not set
362
363#
364# Device Drivers
365#
366
367#
368# Generic Driver Options
369#
370CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
371CONFIG_STANDALONE=y
372CONFIG_PREVENT_FIRMWARE_BUILD=y
373CONFIG_FW_LOADER=y
374CONFIG_FIRMWARE_IN_KERNEL=y
375CONFIG_EXTRA_FIRMWARE=""
376# CONFIG_DEBUG_DRIVER is not set
377# CONFIG_DEBUG_DEVRES is not set
378# CONFIG_SYS_HYPERVISOR is not set
379CONFIG_CONNECTOR=y
380CONFIG_PROC_EVENTS=y
381# CONFIG_MTD is not set
382# CONFIG_PARPORT is not set
383CONFIG_PNP=y
384# CONFIG_PNP_DEBUG_MESSAGES is not set
385
386#
387# Protocols
388#
389CONFIG_PNPACPI=y
390CONFIG_BLK_DEV=y
391# CONFIG_BLK_CPQ_DA is not set
392# CONFIG_BLK_CPQ_CISS_DA is not set
393# CONFIG_BLK_DEV_DAC960 is not set
394# CONFIG_BLK_DEV_UMEM is not set
395# CONFIG_BLK_DEV_COW_COMMON is not set
396CONFIG_BLK_DEV_LOOP=m
397CONFIG_BLK_DEV_CRYPTOLOOP=m 19CONFIG_BLK_DEV_CRYPTOLOOP=m
398CONFIG_BLK_DEV_NBD=m 20CONFIG_BLK_DEV_DM=m
399# CONFIG_BLK_DEV_SX8 is not set
400# CONFIG_BLK_DEV_UB is not set
401CONFIG_BLK_DEV_RAM=y
402CONFIG_BLK_DEV_RAM_COUNT=16
403CONFIG_BLK_DEV_RAM_SIZE=4096
404# CONFIG_BLK_DEV_XIP is not set
405# CONFIG_CDROM_PKTCDVD is not set
406# CONFIG_ATA_OVER_ETH is not set
407# CONFIG_BLK_DEV_HD is not set
408CONFIG_MISC_DEVICES=y
409# CONFIG_PHANTOM is not set
410# CONFIG_EEPROM_93CX6 is not set
411CONFIG_SGI_IOC4=y
412# CONFIG_TIFM_CORE is not set
413# CONFIG_ENCLOSURE_SERVICES is not set
414CONFIG_SGI_XP=m
415# CONFIG_HP_ILO is not set
416# CONFIG_C2PORT is not set
417CONFIG_HAVE_IDE=y
418CONFIG_IDE=y
419
420#
421# Please see Documentation/ide/ide.txt for help/info on IDE drives
422#
423CONFIG_IDE_TIMINGS=y
424CONFIG_IDE_ATAPI=y
425# CONFIG_BLK_DEV_IDE_SATA is not set
426CONFIG_IDE_GD=y
427CONFIG_IDE_GD_ATA=y
428# CONFIG_IDE_GD_ATAPI is not set
429CONFIG_BLK_DEV_IDECD=y
430CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y
431# CONFIG_BLK_DEV_IDETAPE is not set
432CONFIG_BLK_DEV_IDESCSI=m
433# CONFIG_BLK_DEV_IDEACPI is not set
434# CONFIG_IDE_TASK_IOCTL is not set
435CONFIG_IDE_PROC_FS=y
436
437#
438# IDE chipset support/bugfixes
439#
440# CONFIG_IDE_GENERIC is not set
441# CONFIG_BLK_DEV_PLATFORM is not set
442# CONFIG_BLK_DEV_IDEPNP is not set
443CONFIG_BLK_DEV_IDEDMA_SFF=y
444
445#
446# PCI IDE chipsets support
447#
448CONFIG_BLK_DEV_IDEPCI=y
449CONFIG_IDEPCI_PCIBUS_ORDER=y
450# CONFIG_BLK_DEV_OFFBOARD is not set
451CONFIG_BLK_DEV_GENERIC=y 21CONFIG_BLK_DEV_GENERIC=y
452# CONFIG_BLK_DEV_OPTI621 is not set 22CONFIG_BLK_DEV_IDECD=y
453CONFIG_BLK_DEV_IDEDMA_PCI=y 23CONFIG_BLK_DEV_INITRD=y
454# CONFIG_BLK_DEV_AEC62XX is not set 24CONFIG_BLK_DEV_LOOP=m
455# CONFIG_BLK_DEV_ALI15X3 is not set 25CONFIG_BLK_DEV_MD=m
456# CONFIG_BLK_DEV_AMD74XX is not set 26CONFIG_BLK_DEV_NBD=m
457CONFIG_BLK_DEV_CMD64X=y
458# CONFIG_BLK_DEV_TRIFLEX is not set
459# CONFIG_BLK_DEV_CS5520 is not set
460# CONFIG_BLK_DEV_CS5530 is not set
461# CONFIG_BLK_DEV_HPT366 is not set
462# CONFIG_BLK_DEV_JMICRON is not set
463# CONFIG_BLK_DEV_SC1200 is not set
464CONFIG_BLK_DEV_PIIX=y 27CONFIG_BLK_DEV_PIIX=y
465# CONFIG_BLK_DEV_IT8213 is not set 28CONFIG_BLK_DEV_RAM=y
466# CONFIG_BLK_DEV_IT821X is not set
467# CONFIG_BLK_DEV_NS87415 is not set
468# CONFIG_BLK_DEV_PDC202XX_OLD is not set
469# CONFIG_BLK_DEV_PDC202XX_NEW is not set
470# CONFIG_BLK_DEV_SVWKS is not set
471CONFIG_BLK_DEV_SGIIOC4=y
472# CONFIG_BLK_DEV_SIIMAGE is not set
473# CONFIG_BLK_DEV_SLC90E66 is not set
474# CONFIG_BLK_DEV_TRM290 is not set
475# CONFIG_BLK_DEV_VIA82CXXX is not set
476# CONFIG_BLK_DEV_TC86C001 is not set
477CONFIG_BLK_DEV_IDEDMA=y
478
479#
480# SCSI device support
481#
482# CONFIG_RAID_ATTRS is not set
483CONFIG_SCSI=y
484CONFIG_SCSI_DMA=y
485# CONFIG_SCSI_TGT is not set
486CONFIG_SCSI_NETLINK=y
487CONFIG_SCSI_PROC_FS=y
488
489#
490# SCSI support type (disk, tape, CD-ROM)
491#
492CONFIG_BLK_DEV_SD=y 29CONFIG_BLK_DEV_SD=y
493CONFIG_CHR_DEV_ST=m 30CONFIG_BLK_DEV_SGIIOC4=y
494# CONFIG_CHR_DEV_OSST is not set
495CONFIG_BLK_DEV_SR=m 31CONFIG_BLK_DEV_SR=m
496# CONFIG_BLK_DEV_SR_VENDOR is not set 32CONFIG_CGROUPS=y
497CONFIG_CHR_DEV_SG=m 33CONFIG_CHR_DEV_SG=m
498# CONFIG_CHR_DEV_SCH is not set 34CONFIG_CHR_DEV_ST=m
499 35CONFIG_CIFS=m
500# 36CONFIG_CONNECTOR=y
501# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 37CONFIG_CPUSETS=y
502# 38CONFIG_CRASH_DUMP=y
503# CONFIG_SCSI_MULTI_LUN is not set 39CONFIG_CRC_T10DIF=y
504# CONFIG_SCSI_CONSTANTS is not set 40# CONFIG_CRYPTO_ANSI_CPRNG is not set
505# CONFIG_SCSI_LOGGING is not set 41CONFIG_CRYPTO_ECB=m
506# CONFIG_SCSI_SCAN_ASYNC is not set 42CONFIG_CRYPTO_MD5=y
507CONFIG_SCSI_WAIT_SCAN=m 43CONFIG_CRYPTO_PCBC=m
508 44CONFIG_DEBUG_KERNEL=y
509# 45CONFIG_DEBUG_MUTEXES=y
510# SCSI Transports
511#
512CONFIG_SCSI_SPI_ATTRS=y
513CONFIG_SCSI_FC_ATTRS=y
514# CONFIG_SCSI_ISCSI_ATTRS is not set
515CONFIG_SCSI_SAS_ATTRS=y
516# CONFIG_SCSI_SAS_LIBSAS is not set
517# CONFIG_SCSI_SRP_ATTRS is not set
518CONFIG_SCSI_LOWLEVEL=y
519# CONFIG_ISCSI_TCP is not set
520# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
521# CONFIG_SCSI_3W_9XXX is not set
522# CONFIG_SCSI_ACARD is not set
523# CONFIG_SCSI_AACRAID is not set
524# CONFIG_SCSI_AIC7XXX is not set
525# CONFIG_SCSI_AIC7XXX_OLD is not set
526# CONFIG_SCSI_AIC79XX is not set
527# CONFIG_SCSI_AIC94XX is not set
528# CONFIG_SCSI_DPT_I2O is not set
529# CONFIG_SCSI_ADVANSYS is not set
530# CONFIG_SCSI_ARCMSR is not set
531# CONFIG_MEGARAID_NEWGEN is not set
532# CONFIG_MEGARAID_LEGACY is not set
533# CONFIG_MEGARAID_SAS is not set
534# CONFIG_SCSI_HPTIOP is not set
535# CONFIG_SCSI_DMX3191D is not set
536# CONFIG_SCSI_FUTURE_DOMAIN is not set
537# CONFIG_SCSI_IPS is not set
538# CONFIG_SCSI_INITIO is not set
539# CONFIG_SCSI_INIA100 is not set
540# CONFIG_SCSI_MVSAS is not set
541# CONFIG_SCSI_STEX is not set
542CONFIG_SCSI_SYM53C8XX_2=y
543CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
544CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
545CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
546CONFIG_SCSI_SYM53C8XX_MMIO=y
547# CONFIG_SCSI_IPR is not set
548CONFIG_SCSI_QLOGIC_1280=y
549# CONFIG_SCSI_QLA_FC is not set
550# CONFIG_SCSI_QLA_ISCSI is not set
551# CONFIG_SCSI_LPFC is not set
552# CONFIG_SCSI_DC395x is not set
553# CONFIG_SCSI_DC390T is not set
554# CONFIG_SCSI_DEBUG is not set
555# CONFIG_SCSI_SRP is not set
556# CONFIG_SCSI_DH is not set
557CONFIG_ATA=y
558CONFIG_ATA_NONSTANDARD=y
559CONFIG_ATA_ACPI=y
560CONFIG_SATA_PMP=y
561# CONFIG_SATA_AHCI is not set
562# CONFIG_SATA_SIL24 is not set
563CONFIG_ATA_SFF=y
564# CONFIG_SATA_SVW is not set
565CONFIG_ATA_PIIX=y
566# CONFIG_SATA_MV is not set
567# CONFIG_SATA_NV is not set
568# CONFIG_PDC_ADMA is not set
569# CONFIG_SATA_QSTOR is not set
570# CONFIG_SATA_PROMISE is not set
571# CONFIG_SATA_SX4 is not set
572# CONFIG_SATA_SIL is not set
573# CONFIG_SATA_SIS is not set
574# CONFIG_SATA_ULI is not set
575# CONFIG_SATA_VIA is not set
576CONFIG_SATA_VITESSE=y
577# CONFIG_SATA_INIC162X is not set
578# CONFIG_PATA_ACPI is not set
579# CONFIG_PATA_ALI is not set
580# CONFIG_PATA_AMD is not set
581# CONFIG_PATA_ARTOP is not set
582# CONFIG_PATA_ATIIXP is not set
583# CONFIG_PATA_CMD640_PCI is not set
584# CONFIG_PATA_CMD64X is not set
585# CONFIG_PATA_CS5520 is not set
586# CONFIG_PATA_CS5530 is not set
587# CONFIG_PATA_CYPRESS is not set
588# CONFIG_PATA_EFAR is not set
589# CONFIG_ATA_GENERIC is not set
590# CONFIG_PATA_HPT366 is not set
591# CONFIG_PATA_HPT37X is not set
592# CONFIG_PATA_HPT3X2N is not set
593# CONFIG_PATA_HPT3X3 is not set
594# CONFIG_PATA_IT821X is not set
595# CONFIG_PATA_IT8213 is not set
596# CONFIG_PATA_JMICRON is not set
597# CONFIG_PATA_TRIFLEX is not set
598# CONFIG_PATA_MARVELL is not set
599# CONFIG_PATA_MPIIX is not set
600# CONFIG_PATA_OLDPIIX is not set
601# CONFIG_PATA_NETCELL is not set
602# CONFIG_PATA_NINJA32 is not set
603# CONFIG_PATA_NS87410 is not set
604# CONFIG_PATA_NS87415 is not set
605# CONFIG_PATA_OPTI is not set
606# CONFIG_PATA_OPTIDMA is not set
607# CONFIG_PATA_PDC_OLD is not set
608# CONFIG_PATA_RADISYS is not set
609# CONFIG_PATA_RZ1000 is not set
610# CONFIG_PATA_SC1200 is not set
611# CONFIG_PATA_SERVERWORKS is not set
612# CONFIG_PATA_PDC2027X is not set
613# CONFIG_PATA_SIL680 is not set
614# CONFIG_PATA_SIS is not set
615# CONFIG_PATA_VIA is not set
616# CONFIG_PATA_WINBOND is not set
617# CONFIG_PATA_SCH is not set
618CONFIG_MD=y
619CONFIG_BLK_DEV_MD=m
620CONFIG_MD_LINEAR=m
621CONFIG_MD_RAID0=m
622CONFIG_MD_RAID1=m
623# CONFIG_MD_RAID10 is not set
624# CONFIG_MD_RAID456 is not set
625CONFIG_MD_MULTIPATH=m
626# CONFIG_MD_FAULTY is not set
627CONFIG_BLK_DEV_DM=m
628# CONFIG_DM_DEBUG is not set
629CONFIG_DM_CRYPT=m 46CONFIG_DM_CRYPT=m
630CONFIG_DM_SNAPSHOT=m
631CONFIG_DM_MIRROR=m 47CONFIG_DM_MIRROR=m
632CONFIG_DM_ZERO=m
633CONFIG_DM_MULTIPATH=m 48CONFIG_DM_MULTIPATH=m
634# CONFIG_DM_DELAY is not set 49CONFIG_DM_SNAPSHOT=m
635# CONFIG_DM_UEVENT is not set 50CONFIG_DM_ZERO=m
636CONFIG_FUSION=y
637CONFIG_FUSION_SPI=y
638CONFIG_FUSION_FC=m
639CONFIG_FUSION_SAS=y
640CONFIG_FUSION_MAX_SGE=128
641# CONFIG_FUSION_CTL is not set
642# CONFIG_FUSION_LOGGING is not set
643
644#
645# IEEE 1394 (FireWire) support
646#
647
648#
649# Enable only one of the two stacks, unless you know what you are doing
650#
651# CONFIG_FIREWIRE is not set
652# CONFIG_IEEE1394 is not set
653# CONFIG_I2O is not set
654CONFIG_NETDEVICES=y
655CONFIG_DUMMY=m
656# CONFIG_BONDING is not set
657# CONFIG_MACVLAN is not set
658# CONFIG_EQUALIZER is not set
659# CONFIG_TUN is not set
660# CONFIG_VETH is not set
661# CONFIG_NET_SB1000 is not set
662# CONFIG_ARCNET is not set
663CONFIG_PHYLIB=y
664
665#
666# MII PHY device drivers
667#
668# CONFIG_MARVELL_PHY is not set
669# CONFIG_DAVICOM_PHY is not set
670# CONFIG_QSEMI_PHY is not set
671# CONFIG_LXT_PHY is not set
672# CONFIG_CICADA_PHY is not set
673# CONFIG_VITESSE_PHY is not set
674# CONFIG_SMSC_PHY is not set
675# CONFIG_BROADCOM_PHY is not set
676# CONFIG_ICPLUS_PHY is not set
677# CONFIG_REALTEK_PHY is not set
678# CONFIG_FIXED_PHY is not set
679# CONFIG_MDIO_BITBANG is not set
680CONFIG_NET_ETHERNET=y
681CONFIG_MII=m
682# CONFIG_HAPPYMEAL is not set
683# CONFIG_SUNGEM is not set
684# CONFIG_CASSINI is not set
685# CONFIG_NET_VENDOR_3COM is not set
686CONFIG_NET_TULIP=y
687# CONFIG_DE2104X is not set
688CONFIG_TULIP=m
689# CONFIG_TULIP_MWI is not set
690# CONFIG_TULIP_MMIO is not set
691# CONFIG_TULIP_NAPI is not set
692# CONFIG_DE4X5 is not set
693# CONFIG_WINBOND_840 is not set
694# CONFIG_DM9102 is not set
695# CONFIG_ULI526X is not set
696# CONFIG_HP100 is not set
697# CONFIG_IBM_NEW_EMAC_ZMII is not set
698# CONFIG_IBM_NEW_EMAC_RGMII is not set
699# CONFIG_IBM_NEW_EMAC_TAH is not set
700# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
701# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
702# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
703# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
704CONFIG_NET_PCI=y
705# CONFIG_PCNET32 is not set
706# CONFIG_AMD8111_ETH is not set
707# CONFIG_ADAPTEC_STARFIRE is not set
708# CONFIG_B44 is not set
709# CONFIG_FORCEDETH is not set
710CONFIG_EEPRO100=m
711CONFIG_E100=m
712# CONFIG_FEALNX is not set
713# CONFIG_NATSEMI is not set
714# CONFIG_NE2K_PCI is not set
715# CONFIG_8139CP is not set
716# CONFIG_8139TOO is not set
717# CONFIG_R6040 is not set
718# CONFIG_SIS900 is not set
719# CONFIG_EPIC100 is not set
720# CONFIG_SUNDANCE is not set
721# CONFIG_TLAN is not set
722# CONFIG_VIA_RHINE is not set
723# CONFIG_SC92031 is not set
724# CONFIG_ATL2 is not set
725CONFIG_NETDEV_1000=y
726# CONFIG_ACENIC is not set
727# CONFIG_DL2K is not set
728CONFIG_E1000=y
729# CONFIG_E1000E is not set
730# CONFIG_IP1000 is not set
731CONFIG_IGB=y
732# CONFIG_IGB_LRO is not set
733# CONFIG_NS83820 is not set
734# CONFIG_HAMACHI is not set
735# CONFIG_YELLOWFIN is not set
736# CONFIG_R8169 is not set
737# CONFIG_SIS190 is not set
738# CONFIG_SKGE is not set
739# CONFIG_SKY2 is not set
740# CONFIG_VIA_VELOCITY is not set
741CONFIG_TIGON3=y
742# CONFIG_BNX2 is not set
743# CONFIG_QLA3XXX is not set
744# CONFIG_ATL1 is not set
745# CONFIG_ATL1E is not set
746# CONFIG_JME is not set
747CONFIG_NETDEV_10000=y
748# CONFIG_CHELSIO_T1 is not set
749# CONFIG_CHELSIO_T3 is not set
750# CONFIG_ENIC is not set
751# CONFIG_IXGBE is not set
752# CONFIG_IXGB is not set
753# CONFIG_S2IO is not set
754# CONFIG_MYRI10GE is not set
755# CONFIG_NETXEN_NIC is not set
756# CONFIG_NIU is not set
757# CONFIG_MLX4_EN is not set
758# CONFIG_MLX4_CORE is not set
759# CONFIG_TEHUTI is not set
760# CONFIG_BNX2X is not set
761# CONFIG_QLGE is not set
762# CONFIG_SFC is not set
763# CONFIG_TR is not set
764
765#
766# Wireless LAN
767#
768# CONFIG_WLAN_PRE80211 is not set
769# CONFIG_WLAN_80211 is not set
770# CONFIG_IWLWIFI_LEDS is not set
771
772#
773# USB Network Adapters
774#
775# CONFIG_USB_CATC is not set
776# CONFIG_USB_KAWETH is not set
777# CONFIG_USB_PEGASUS is not set
778# CONFIG_USB_RTL8150 is not set
779# CONFIG_USB_USBNET is not set
780# CONFIG_WAN is not set
781# CONFIG_FDDI is not set
782# CONFIG_HIPPI is not set
783# CONFIG_PPP is not set
784# CONFIG_SLIP is not set
785# CONFIG_NET_FC is not set
786CONFIG_NETCONSOLE=y
787# CONFIG_NETCONSOLE_DYNAMIC is not set
788CONFIG_NETPOLL=y
789# CONFIG_NETPOLL_TRAP is not set
790CONFIG_NET_POLL_CONTROLLER=y
791# CONFIG_ISDN is not set
792# CONFIG_PHONE is not set
793
794#
795# Input device support
796#
797CONFIG_INPUT=y
798# CONFIG_INPUT_FF_MEMLESS is not set
799# CONFIG_INPUT_POLLDEV is not set
800
801#
802# Userland interfaces
803#
804CONFIG_INPUT_MOUSEDEV=y
805CONFIG_INPUT_MOUSEDEV_PSAUX=y
806CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
807CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
808# CONFIG_INPUT_JOYDEV is not set
809# CONFIG_INPUT_EVDEV is not set
810# CONFIG_INPUT_EVBUG is not set
811
812#
813# Input Device Drivers
814#
815CONFIG_INPUT_KEYBOARD=y
816CONFIG_KEYBOARD_ATKBD=y
817# CONFIG_KEYBOARD_SUNKBD is not set
818# CONFIG_KEYBOARD_LKKBD is not set
819# CONFIG_KEYBOARD_XTKBD is not set
820# CONFIG_KEYBOARD_NEWTON is not set
821# CONFIG_KEYBOARD_STOWAWAY is not set
822CONFIG_INPUT_MOUSE=y
823CONFIG_MOUSE_PS2=y
824CONFIG_MOUSE_PS2_ALPS=y
825CONFIG_MOUSE_PS2_LOGIPS2PP=y
826CONFIG_MOUSE_PS2_SYNAPTICS=y
827CONFIG_MOUSE_PS2_LIFEBOOK=y
828CONFIG_MOUSE_PS2_TRACKPOINT=y
829# CONFIG_MOUSE_PS2_ELANTECH is not set
830# CONFIG_MOUSE_PS2_TOUCHKIT is not set
831# CONFIG_MOUSE_SERIAL is not set
832# CONFIG_MOUSE_APPLETOUCH is not set
833# CONFIG_MOUSE_BCM5974 is not set
834# CONFIG_MOUSE_VSXXXAA is not set
835# CONFIG_INPUT_JOYSTICK is not set
836# CONFIG_INPUT_TABLET is not set
837# CONFIG_INPUT_TOUCHSCREEN is not set
838# CONFIG_INPUT_MISC is not set
839
840#
841# Hardware I/O ports
842#
843CONFIG_SERIO=y
844CONFIG_SERIO_I8042=y
845# CONFIG_SERIO_SERPORT is not set
846# CONFIG_SERIO_PCIPS2 is not set
847CONFIG_SERIO_LIBPS2=y
848# CONFIG_SERIO_RAW is not set
849CONFIG_GAMEPORT=m
850# CONFIG_GAMEPORT_NS558 is not set
851# CONFIG_GAMEPORT_L4 is not set
852# CONFIG_GAMEPORT_EMU10K1 is not set
853# CONFIG_GAMEPORT_FM801 is not set
854
855#
856# Character devices
857#
858CONFIG_VT=y
859CONFIG_CONSOLE_TRANSLATIONS=y
860CONFIG_VT_CONSOLE=y
861CONFIG_HW_CONSOLE=y
862# CONFIG_VT_HW_CONSOLE_BINDING is not set
863CONFIG_DEVKMEM=y
864CONFIG_SERIAL_NONSTANDARD=y
865# CONFIG_COMPUTONE is not set
866# CONFIG_ROCKETPORT is not set
867# CONFIG_CYCLADES is not set
868# CONFIG_DIGIEPCA is not set
869# CONFIG_MOXA_INTELLIO is not set
870# CONFIG_MOXA_SMARTIO is not set
871# CONFIG_ISI is not set
872# CONFIG_SYNCLINKMP is not set
873# CONFIG_SYNCLINK_GT is not set
874# CONFIG_N_HDLC is not set
875# CONFIG_RISCOM8 is not set
876# CONFIG_SPECIALIX is not set
877# CONFIG_SX is not set
878# CONFIG_RIO is not set
879# CONFIG_STALDRV is not set
880# CONFIG_NOZOMI is not set
881CONFIG_SGI_SNSC=y
882CONFIG_SGI_TIOCX=y
883CONFIG_SGI_MBCS=m
884
885#
886# Serial drivers
887#
888CONFIG_SERIAL_8250=y
889CONFIG_SERIAL_8250_CONSOLE=y
890CONFIG_SERIAL_8250_PCI=y
891CONFIG_SERIAL_8250_PNP=y
892CONFIG_SERIAL_8250_NR_UARTS=6
893CONFIG_SERIAL_8250_RUNTIME_UARTS=4
894CONFIG_SERIAL_8250_EXTENDED=y
895CONFIG_SERIAL_8250_SHARE_IRQ=y
896# CONFIG_SERIAL_8250_DETECT_IRQ is not set
897# CONFIG_SERIAL_8250_RSA is not set
898
899#
900# Non-8250 serial port support
901#
902CONFIG_SERIAL_CORE=y
903CONFIG_SERIAL_CORE_CONSOLE=y
904CONFIG_SERIAL_SGI_L1_CONSOLE=y
905# CONFIG_SERIAL_JSM is not set
906CONFIG_SERIAL_SGI_IOC4=y
907# CONFIG_SERIAL_SGI_IOC3 is not set
908CONFIG_UNIX98_PTYS=y
909CONFIG_LEGACY_PTYS=y
910CONFIG_LEGACY_PTY_COUNT=256
911# CONFIG_IPMI_HANDLER is not set
912# CONFIG_HW_RANDOM is not set
913CONFIG_EFI_RTC=y
914# CONFIG_R3964 is not set
915# CONFIG_APPLICOM is not set
916CONFIG_RAW_DRIVER=m
917CONFIG_MAX_RAW_DEVS=256
918CONFIG_HPET=y
919CONFIG_HPET_MMAP=y
920# CONFIG_HANGCHECK_TIMER is not set
921CONFIG_MMTIMER=y
922# CONFIG_TCG_TPM is not set
923CONFIG_DEVPORT=y
924# CONFIG_I2C is not set
925# CONFIG_SPI is not set
926# CONFIG_W1 is not set
927CONFIG_POWER_SUPPLY=y
928# CONFIG_POWER_SUPPLY_DEBUG is not set
929# CONFIG_PDA_POWER is not set
930# CONFIG_BATTERY_DS2760 is not set
931CONFIG_HWMON=y
932# CONFIG_HWMON_VID is not set
933# CONFIG_SENSORS_I5K_AMB is not set
934# CONFIG_SENSORS_F71805F is not set
935# CONFIG_SENSORS_F71882FG is not set
936# CONFIG_SENSORS_IT87 is not set
937# CONFIG_SENSORS_PC87360 is not set
938# CONFIG_SENSORS_PC87427 is not set
939# CONFIG_SENSORS_SIS5595 is not set
940# CONFIG_SENSORS_SMSC47M1 is not set
941# CONFIG_SENSORS_SMSC47B397 is not set
942# CONFIG_SENSORS_VIA686A is not set
943# CONFIG_SENSORS_VT1211 is not set
944# CONFIG_SENSORS_VT8231 is not set
945# CONFIG_SENSORS_W83627HF is not set
946# CONFIG_SENSORS_W83627EHF is not set
947# CONFIG_SENSORS_LIS3LV02D is not set
948# CONFIG_HWMON_DEBUG_CHIP is not set
949CONFIG_THERMAL=m
950# CONFIG_THERMAL_HWMON is not set
951# CONFIG_WATCHDOG is not set
952CONFIG_SSB_POSSIBLE=y
953
954#
955# Sonics Silicon Backplane
956#
957# CONFIG_SSB is not set
958
959#
960# Multifunction device drivers
961#
962# CONFIG_MFD_CORE is not set
963# CONFIG_MFD_SM501 is not set
964# CONFIG_HTC_PASIC3 is not set
965# CONFIG_MFD_TMIO is not set
966# CONFIG_REGULATOR is not set
967
968#
969# Multimedia devices
970#
971
972#
973# Multimedia core support
974#
975# CONFIG_VIDEO_DEV is not set
976# CONFIG_DVB_CORE is not set
977# CONFIG_VIDEO_MEDIA is not set
978
979#
980# Multimedia drivers
981#
982CONFIG_DAB=y
983# CONFIG_USB_DABUSB is not set
984
985#
986# Graphics support
987#
988CONFIG_AGP=m
989CONFIG_AGP_I460=m
990CONFIG_AGP_HP_ZX1=m
991CONFIG_AGP_SGI_TIOCA=m
992CONFIG_DRM=m 51CONFIG_DRM=m
993CONFIG_DRM_TDFX=m 52CONFIG_DRM_MGA=m
994CONFIG_DRM_R128=m 53CONFIG_DRM_R128=m
995CONFIG_DRM_RADEON=m 54CONFIG_DRM_RADEON=m
996CONFIG_DRM_MGA=m
997CONFIG_DRM_SIS=m 55CONFIG_DRM_SIS=m
998# CONFIG_DRM_VIA is not set 56CONFIG_DRM_TDFX=m
999# CONFIG_DRM_SAVAGE is not set 57CONFIG_DUMMY=m
1000# CONFIG_VGASTATE is not set 58CONFIG_E1000=y
1001# CONFIG_VIDEO_OUTPUT_CONTROL is not set 59CONFIG_E100=m
1002# CONFIG_FB is not set 60CONFIG_EFI_PARTITION=y
1003# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 61CONFIG_EFI_RTC=y
1004 62CONFIG_EFI_VARS=y
1005# 63CONFIG_EXPERIMENTAL=y
1006# Display device support 64CONFIG_EXT2_FS_POSIX_ACL=y
1007# 65CONFIG_EXT2_FS_SECURITY=y
1008# CONFIG_DISPLAY_SUPPORT is not set 66CONFIG_EXT2_FS_XATTR=y
1009 67CONFIG_EXT2_FS=y
1010# 68CONFIG_EXT3_FS_POSIX_ACL=y
1011# Console display driver support 69CONFIG_EXT3_FS_SECURITY=y
1012# 70CONFIG_EXT3_FS=y
1013CONFIG_VGA_CONSOLE=y 71CONFIG_FUSION_FC=m
1014# CONFIG_VGACON_SOFT_SCROLLBACK is not set 72CONFIG_FUSION_SAS=y
1015CONFIG_DUMMY_CONSOLE=y 73CONFIG_FUSION_SPI=y
1016CONFIG_SOUND=m 74CONFIG_FUSION=y
1017CONFIG_SOUND_OSS_CORE=y 75CONFIG_GAMEPORT=m
1018CONFIG_SND=m
1019CONFIG_SND_TIMER=m
1020CONFIG_SND_PCM=m
1021CONFIG_SND_HWDEP=m
1022CONFIG_SND_RAWMIDI=m
1023CONFIG_SND_SEQUENCER=m
1024CONFIG_SND_SEQ_DUMMY=m
1025CONFIG_SND_OSSEMUL=y
1026CONFIG_SND_MIXER_OSS=m
1027CONFIG_SND_PCM_OSS=m
1028CONFIG_SND_PCM_OSS_PLUGINS=y
1029CONFIG_SND_SEQUENCER_OSS=y
1030# CONFIG_SND_DYNAMIC_MINORS is not set
1031CONFIG_SND_SUPPORT_OLD_API=y
1032CONFIG_SND_VERBOSE_PROCFS=y
1033CONFIG_SND_VERBOSE_PRINTK=y
1034# CONFIG_SND_DEBUG is not set
1035CONFIG_SND_VMASTER=y
1036CONFIG_SND_MPU401_UART=m
1037CONFIG_SND_OPL3_LIB=m
1038CONFIG_SND_AC97_CODEC=m
1039CONFIG_SND_DRIVERS=y
1040CONFIG_SND_DUMMY=m
1041CONFIG_SND_VIRMIDI=m
1042CONFIG_SND_MTPAV=m
1043CONFIG_SND_SERIAL_U16550=m
1044CONFIG_SND_MPU401=m
1045# CONFIG_SND_AC97_POWER_SAVE is not set
1046CONFIG_SND_PCI=y
1047# CONFIG_SND_AD1889 is not set
1048# CONFIG_SND_ALS300 is not set
1049# CONFIG_SND_ALI5451 is not set
1050# CONFIG_SND_ATIIXP is not set
1051# CONFIG_SND_ATIIXP_MODEM is not set
1052# CONFIG_SND_AU8810 is not set
1053# CONFIG_SND_AU8820 is not set
1054# CONFIG_SND_AU8830 is not set
1055# CONFIG_SND_AW2 is not set
1056# CONFIG_SND_AZT3328 is not set
1057# CONFIG_SND_BT87X is not set
1058# CONFIG_SND_CA0106 is not set
1059# CONFIG_SND_CMIPCI is not set
1060# CONFIG_SND_OXYGEN is not set
1061CONFIG_SND_CS4281=m
1062CONFIG_SND_CS46XX=m
1063CONFIG_SND_CS46XX_NEW_DSP=y
1064# CONFIG_SND_DARLA20 is not set
1065# CONFIG_SND_GINA20 is not set
1066# CONFIG_SND_LAYLA20 is not set
1067# CONFIG_SND_DARLA24 is not set
1068# CONFIG_SND_GINA24 is not set
1069# CONFIG_SND_LAYLA24 is not set
1070# CONFIG_SND_MONA is not set
1071# CONFIG_SND_MIA is not set
1072# CONFIG_SND_ECHO3G is not set
1073# CONFIG_SND_INDIGO is not set
1074# CONFIG_SND_INDIGOIO is not set
1075# CONFIG_SND_INDIGODJ is not set
1076CONFIG_SND_EMU10K1=m
1077# CONFIG_SND_EMU10K1X is not set
1078# CONFIG_SND_ENS1370 is not set
1079# CONFIG_SND_ENS1371 is not set
1080# CONFIG_SND_ES1938 is not set
1081# CONFIG_SND_ES1968 is not set
1082CONFIG_SND_FM801=m
1083# CONFIG_SND_HDA_INTEL is not set
1084# CONFIG_SND_HDSP is not set
1085# CONFIG_SND_HDSPM is not set
1086# CONFIG_SND_HIFIER is not set
1087# CONFIG_SND_ICE1712 is not set
1088# CONFIG_SND_ICE1724 is not set
1089# CONFIG_SND_INTEL8X0 is not set
1090# CONFIG_SND_INTEL8X0M is not set
1091# CONFIG_SND_KORG1212 is not set
1092# CONFIG_SND_MAESTRO3 is not set
1093# CONFIG_SND_MIXART is not set
1094# CONFIG_SND_NM256 is not set
1095# CONFIG_SND_PCXHR is not set
1096# CONFIG_SND_RIPTIDE is not set
1097# CONFIG_SND_RME32 is not set
1098# CONFIG_SND_RME96 is not set
1099# CONFIG_SND_RME9652 is not set
1100# CONFIG_SND_SONICVIBES is not set
1101# CONFIG_SND_TRIDENT is not set
1102# CONFIG_SND_VIA82XX is not set
1103# CONFIG_SND_VIA82XX_MODEM is not set
1104# CONFIG_SND_VIRTUOSO is not set
1105# CONFIG_SND_VX222 is not set
1106# CONFIG_SND_YMFPCI is not set
1107CONFIG_SND_USB=y
1108# CONFIG_SND_USB_AUDIO is not set
1109# CONFIG_SND_USB_CAIAQ is not set
1110# CONFIG_SND_SOC is not set
1111# CONFIG_SOUND_PRIME is not set
1112CONFIG_AC97_BUS=m
1113CONFIG_HID_SUPPORT=y
1114CONFIG_HID=y
1115# CONFIG_HID_DEBUG is not set
1116# CONFIG_HIDRAW is not set
1117
1118#
1119# USB Input Devices
1120#
1121CONFIG_USB_HID=m
1122# CONFIG_HID_PID is not set
1123# CONFIG_USB_HIDDEV is not set
1124
1125#
1126# USB HID Boot Protocol drivers
1127#
1128# CONFIG_USB_KBD is not set
1129# CONFIG_USB_MOUSE is not set
1130
1131#
1132# Special HID drivers
1133#
1134CONFIG_HID_COMPAT=y
1135CONFIG_HID_A4TECH=m
1136CONFIG_HID_APPLE=m
1137CONFIG_HID_BELKIN=m
1138CONFIG_HID_BRIGHT=m
1139CONFIG_HID_CHERRY=m
1140CONFIG_HID_CHICONY=m
1141CONFIG_HID_CYPRESS=m
1142CONFIG_HID_DELL=m
1143CONFIG_HID_EZKEY=m
1144CONFIG_HID_GYRATION=m 76CONFIG_HID_GYRATION=m
1145CONFIG_HID_LOGITECH=m
1146# CONFIG_LOGITECH_FF is not set
1147# CONFIG_LOGIRUMBLEPAD2_FF is not set
1148CONFIG_HID_MICROSOFT=m
1149CONFIG_HID_MONTEREY=m
1150CONFIG_HID_PANTHERLORD=m 77CONFIG_HID_PANTHERLORD=m
1151# CONFIG_PANTHERLORD_FF is not set
1152CONFIG_HID_PETALYNX=m 78CONFIG_HID_PETALYNX=m
1153CONFIG_HID_SAMSUNG=m 79CONFIG_HID_SAMSUNG=m
1154CONFIG_HID_SONY=m 80CONFIG_HID_SONY=m
1155CONFIG_HID_SUNPLUS=m 81CONFIG_HID_SUNPLUS=m
1156# CONFIG_THRUSTMASTER_FF is not set 82CONFIG_HOTPLUG_CPU=y
1157# CONFIG_ZEROPLUS_FF is not set 83CONFIG_HOTPLUG_PCI_ACPI=m
1158CONFIG_USB_SUPPORT=y 84CONFIG_HOTPLUG_PCI=m
1159CONFIG_USB_ARCH_HAS_HCD=y 85CONFIG_HPET=y
1160CONFIG_USB_ARCH_HAS_OHCI=y 86CONFIG_HUGETLBFS=y
1161CONFIG_USB_ARCH_HAS_EHCI=y 87# CONFIG_HW_RANDOM is not set
1162CONFIG_USB=m 88CONFIG_IA64_CYCLONE=y
1163# CONFIG_USB_DEBUG is not set 89CONFIG_IA64_MCA_RECOVERY=y
1164# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set 90CONFIG_IA64_PAGE_SIZE_64KB=y
1165 91CONFIG_IA64_PALINFO=y
1166# 92CONFIG_IDE=y
1167# Miscellaneous USB options 93CONFIG_IGB=y
1168# 94CONFIG_IKCONFIG_PROC=y
1169CONFIG_USB_DEVICEFS=y 95CONFIG_IKCONFIG=y
1170CONFIG_USB_DEVICE_CLASS=y 96CONFIG_INET=y
1171# CONFIG_USB_DYNAMIC_MINORS is not set 97CONFIG_INFINIBAND_IPOIB=m
1172# CONFIG_USB_SUSPEND is not set
1173# CONFIG_USB_OTG is not set
1174CONFIG_USB_MON=y
1175# CONFIG_USB_WUSB is not set
1176# CONFIG_USB_WUSB_CBAF is not set
1177
1178#
1179# USB Host Controller Drivers
1180#
1181# CONFIG_USB_C67X00_HCD is not set
1182CONFIG_USB_EHCI_HCD=m
1183# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1184# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1185# CONFIG_USB_ISP116X_HCD is not set
1186# CONFIG_USB_ISP1760_HCD is not set
1187CONFIG_USB_OHCI_HCD=m
1188# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1189# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
1190CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1191CONFIG_USB_UHCI_HCD=m
1192# CONFIG_USB_SL811_HCD is not set
1193# CONFIG_USB_R8A66597_HCD is not set
1194# CONFIG_USB_WHCI_HCD is not set
1195# CONFIG_USB_HWA_HCD is not set
1196
1197#
1198# Enable Host or Gadget support to see Inventra options
1199#
1200
1201#
1202# USB Device Class drivers
1203#
1204# CONFIG_USB_ACM is not set
1205# CONFIG_USB_PRINTER is not set
1206# CONFIG_USB_WDM is not set
1207# CONFIG_USB_TMC is not set
1208
1209#
1210# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
1211#
1212
1213#
1214# see USB_STORAGE Help for more information
1215#
1216CONFIG_USB_STORAGE=m
1217# CONFIG_USB_STORAGE_DEBUG is not set
1218# CONFIG_USB_STORAGE_DATAFAB is not set
1219# CONFIG_USB_STORAGE_FREECOM is not set
1220# CONFIG_USB_STORAGE_ISD200 is not set
1221# CONFIG_USB_STORAGE_DPCM is not set
1222# CONFIG_USB_STORAGE_USBAT is not set
1223# CONFIG_USB_STORAGE_SDDR09 is not set
1224# CONFIG_USB_STORAGE_SDDR55 is not set
1225# CONFIG_USB_STORAGE_JUMPSHOT is not set
1226# CONFIG_USB_STORAGE_ALAUDA is not set
1227# CONFIG_USB_STORAGE_ONETOUCH is not set
1228# CONFIG_USB_STORAGE_KARMA is not set
1229# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1230# CONFIG_USB_LIBUSUAL is not set
1231
1232#
1233# USB Imaging devices
1234#
1235# CONFIG_USB_MDC800 is not set
1236# CONFIG_USB_MICROTEK is not set
1237
1238#
1239# USB port drivers
1240#
1241# CONFIG_USB_SERIAL is not set
1242
1243#
1244# USB Miscellaneous drivers
1245#
1246# CONFIG_USB_EMI62 is not set
1247# CONFIG_USB_EMI26 is not set
1248# CONFIG_USB_ADUTUX is not set
1249# CONFIG_USB_SEVSEG is not set
1250# CONFIG_USB_RIO500 is not set
1251# CONFIG_USB_LEGOTOWER is not set
1252# CONFIG_USB_LCD is not set
1253# CONFIG_USB_BERRY_CHARGE is not set
1254# CONFIG_USB_LED is not set
1255# CONFIG_USB_CYPRESS_CY7C63 is not set
1256# CONFIG_USB_CYTHERM is not set
1257# CONFIG_USB_PHIDGET is not set
1258# CONFIG_USB_IDMOUSE is not set
1259# CONFIG_USB_FTDI_ELAN is not set
1260# CONFIG_USB_APPLEDISPLAY is not set
1261# CONFIG_USB_SISUSBVGA is not set
1262# CONFIG_USB_LD is not set
1263# CONFIG_USB_TRANCEVIBRATOR is not set
1264# CONFIG_USB_IOWARRIOR is not set
1265# CONFIG_USB_TEST is not set
1266# CONFIG_USB_ISIGHTFW is not set
1267# CONFIG_USB_VST is not set
1268# CONFIG_USB_GADGET is not set
1269# CONFIG_UWB is not set
1270# CONFIG_MMC is not set
1271# CONFIG_MEMSTICK is not set
1272# CONFIG_NEW_LEDS is not set
1273# CONFIG_ACCESSIBILITY is not set
1274CONFIG_INFINIBAND=m 98CONFIG_INFINIBAND=m
1275# CONFIG_INFINIBAND_USER_MAD is not set
1276# CONFIG_INFINIBAND_USER_ACCESS is not set
1277CONFIG_INFINIBAND_ADDR_TRANS=y
1278CONFIG_INFINIBAND_MTHCA=m 99CONFIG_INFINIBAND_MTHCA=m
1279CONFIG_INFINIBAND_MTHCA_DEBUG=y
1280# CONFIG_INFINIBAND_IPATH is not set
1281# CONFIG_INFINIBAND_AMSO1100 is not set
1282# CONFIG_MLX4_INFINIBAND is not set
1283# CONFIG_INFINIBAND_NES is not set
1284CONFIG_INFINIBAND_IPOIB=m
1285# CONFIG_INFINIBAND_IPOIB_CM is not set
1286CONFIG_INFINIBAND_IPOIB_DEBUG=y
1287# CONFIG_INFINIBAND_IPOIB_DEBUG_DATA is not set
1288# CONFIG_INFINIBAND_SRP is not set
1289# CONFIG_INFINIBAND_ISER is not set
1290# CONFIG_RTC_CLASS is not set
1291# CONFIG_DMADEVICES is not set
1292# CONFIG_UIO is not set
1293# CONFIG_STAGING is not set
1294CONFIG_STAGING_EXCLUDE_BUILD=y
1295
1296#
1297# HP Simulator drivers
1298#
1299# CONFIG_HP_SIMETH is not set
1300# CONFIG_HP_SIMSERIAL is not set
1301# CONFIG_HP_SIMSCSI is not set
1302CONFIG_MSPEC=m
1303
1304#
1305# File systems
1306#
1307CONFIG_EXT2_FS=y
1308CONFIG_EXT2_FS_XATTR=y
1309CONFIG_EXT2_FS_POSIX_ACL=y
1310CONFIG_EXT2_FS_SECURITY=y
1311# CONFIG_EXT2_FS_XIP is not set
1312CONFIG_EXT3_FS=y
1313CONFIG_EXT3_FS_XATTR=y
1314CONFIG_EXT3_FS_POSIX_ACL=y
1315CONFIG_EXT3_FS_SECURITY=y
1316# CONFIG_EXT4_FS is not set
1317CONFIG_JBD=y
1318CONFIG_FS_MBCACHE=y
1319CONFIG_REISERFS_FS=y
1320# CONFIG_REISERFS_CHECK is not set
1321# CONFIG_REISERFS_PROC_INFO is not set
1322CONFIG_REISERFS_FS_XATTR=y
1323CONFIG_REISERFS_FS_POSIX_ACL=y
1324CONFIG_REISERFS_FS_SECURITY=y
1325# CONFIG_JFS_FS is not set
1326CONFIG_FS_POSIX_ACL=y
1327CONFIG_FILE_LOCKING=y
1328CONFIG_XFS_FS=y
1329# CONFIG_XFS_QUOTA is not set
1330# CONFIG_XFS_POSIX_ACL is not set
1331# CONFIG_XFS_RT is not set
1332# CONFIG_XFS_DEBUG is not set
1333# CONFIG_GFS2_FS is not set
1334# CONFIG_OCFS2_FS is not set
1335CONFIG_DNOTIFY=y
1336CONFIG_INOTIFY=y 100CONFIG_INOTIFY=y
1337CONFIG_INOTIFY_USER=y 101CONFIG_IP_MULTICAST=y
1338# CONFIG_QUOTA is not set 102# CONFIG_IPV6 is not set
1339CONFIG_AUTOFS_FS=m
1340CONFIG_AUTOFS4_FS=m
1341# CONFIG_FUSE_FS is not set
1342
1343#
1344# CD-ROM/DVD Filesystems
1345#
1346CONFIG_ISO9660_FS=m 103CONFIG_ISO9660_FS=m
1347CONFIG_JOLIET=y 104CONFIG_JOLIET=y
1348# CONFIG_ZISOFS is not set 105CONFIG_KALLSYMS_ALL=y
1349CONFIG_UDF_FS=m 106CONFIG_KEXEC=y
1350CONFIG_UDF_NLS=y 107CONFIG_LOG_BUF_SHIFT=20
1351 108CONFIG_MAGIC_SYSRQ=y
1352# 109CONFIG_MCKINLEY=y
1353# DOS/FAT/NT Filesystems 110CONFIG_MD_LINEAR=m
1354# 111CONFIG_MD_MULTIPATH=m
1355CONFIG_FAT_FS=y 112CONFIG_MD_RAID0=m
1356# CONFIG_MSDOS_FS is not set 113CONFIG_MD_RAID1=m
1357CONFIG_VFAT_FS=y 114CONFIG_MD=y
1358CONFIG_FAT_DEFAULT_CODEPAGE=437 115CONFIG_MODULES=y
1359CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" 116CONFIG_MODULE_UNLOAD=y
1360CONFIG_NTFS_FS=m 117CONFIG_MODVERSIONS=y
1361# CONFIG_NTFS_DEBUG is not set 118CONFIG_MSPEC=m
1362# CONFIG_NTFS_RW is not set 119CONFIG_NETCONSOLE=y
1363 120CONFIG_NETDEVICES=y
1364# 121CONFIG_NET_ETHERNET=y
1365# Pseudo filesystems 122CONFIG_NET_PCI=y
1366# 123CONFIG_NET_TULIP=y
1367CONFIG_PROC_FS=y 124CONFIG_NFSD=m
1368CONFIG_PROC_KCORE=y 125CONFIG_NFSD_V4=y
1369CONFIG_PROC_VMCORE=y
1370CONFIG_PROC_SYSCTL=y
1371CONFIG_PROC_PAGE_MONITOR=y
1372CONFIG_SYSFS=y
1373CONFIG_TMPFS=y
1374# CONFIG_TMPFS_POSIX_ACL is not set
1375CONFIG_HUGETLBFS=y
1376CONFIG_HUGETLB_PAGE=y
1377# CONFIG_CONFIGFS_FS is not set
1378
1379#
1380# Miscellaneous filesystems
1381#
1382# CONFIG_ADFS_FS is not set
1383# CONFIG_AFFS_FS is not set
1384# CONFIG_HFS_FS is not set
1385# CONFIG_HFSPLUS_FS is not set
1386# CONFIG_BEFS_FS is not set
1387# CONFIG_BFS_FS is not set
1388# CONFIG_EFS_FS is not set
1389# CONFIG_CRAMFS is not set
1390# CONFIG_VXFS_FS is not set
1391# CONFIG_MINIX_FS is not set
1392# CONFIG_OMFS_FS is not set
1393# CONFIG_HPFS_FS is not set
1394# CONFIG_QNX4FS_FS is not set
1395# CONFIG_ROMFS_FS is not set
1396# CONFIG_SYSV_FS is not set
1397# CONFIG_UFS_FS is not set
1398CONFIG_NETWORK_FILESYSTEMS=y
1399CONFIG_NFS_FS=m 126CONFIG_NFS_FS=m
1400CONFIG_NFS_V3=y 127CONFIG_NFS_V3=y
1401# CONFIG_NFS_V3_ACL is not set
1402CONFIG_NFS_V4=y 128CONFIG_NFS_V4=y
1403CONFIG_NFSD=m 129CONFIG_NLS_CODEPAGE_1250=m
1404CONFIG_NFSD_V3=y 130CONFIG_NLS_CODEPAGE_1251=m
1405# CONFIG_NFSD_V3_ACL is not set
1406CONFIG_NFSD_V4=y
1407CONFIG_LOCKD=m
1408CONFIG_LOCKD_V4=y
1409CONFIG_EXPORTFS=m
1410CONFIG_NFS_COMMON=y
1411CONFIG_SUNRPC=m
1412CONFIG_SUNRPC_GSS=m
1413CONFIG_SUNRPC_XPRT_RDMA=m
1414# CONFIG_SUNRPC_REGISTER_V4 is not set
1415CONFIG_RPCSEC_GSS_KRB5=m
1416# CONFIG_RPCSEC_GSS_SPKM3 is not set
1417CONFIG_SMB_FS=m
1418CONFIG_SMB_NLS_DEFAULT=y
1419CONFIG_SMB_NLS_REMOTE="cp437"
1420CONFIG_CIFS=m
1421# CONFIG_CIFS_STATS is not set
1422# CONFIG_CIFS_WEAK_PW_HASH is not set
1423# CONFIG_CIFS_XATTR is not set
1424# CONFIG_CIFS_DEBUG2 is not set
1425# CONFIG_CIFS_EXPERIMENTAL is not set
1426# CONFIG_NCP_FS is not set
1427# CONFIG_CODA_FS is not set
1428# CONFIG_AFS_FS is not set
1429
1430#
1431# Partition Types
1432#
1433CONFIG_PARTITION_ADVANCED=y
1434# CONFIG_ACORN_PARTITION is not set
1435# CONFIG_OSF_PARTITION is not set
1436# CONFIG_AMIGA_PARTITION is not set
1437# CONFIG_ATARI_PARTITION is not set
1438# CONFIG_MAC_PARTITION is not set
1439CONFIG_MSDOS_PARTITION=y
1440# CONFIG_BSD_DISKLABEL is not set
1441# CONFIG_MINIX_SUBPARTITION is not set
1442# CONFIG_SOLARIS_X86_PARTITION is not set
1443# CONFIG_UNIXWARE_DISKLABEL is not set
1444# CONFIG_LDM_PARTITION is not set
1445CONFIG_SGI_PARTITION=y
1446# CONFIG_ULTRIX_PARTITION is not set
1447# CONFIG_SUN_PARTITION is not set
1448# CONFIG_KARMA_PARTITION is not set
1449CONFIG_EFI_PARTITION=y
1450# CONFIG_SYSV68_PARTITION is not set
1451CONFIG_NLS=y
1452CONFIG_NLS_DEFAULT="iso8859-1"
1453CONFIG_NLS_CODEPAGE_437=y 131CONFIG_NLS_CODEPAGE_437=y
1454CONFIG_NLS_CODEPAGE_737=m 132CONFIG_NLS_CODEPAGE_737=m
1455CONFIG_NLS_CODEPAGE_775=m 133CONFIG_NLS_CODEPAGE_775=m
@@ -1465,15 +143,14 @@ CONFIG_NLS_CODEPAGE_864=m
1465CONFIG_NLS_CODEPAGE_865=m 143CONFIG_NLS_CODEPAGE_865=m
1466CONFIG_NLS_CODEPAGE_866=m 144CONFIG_NLS_CODEPAGE_866=m
1467CONFIG_NLS_CODEPAGE_869=m 145CONFIG_NLS_CODEPAGE_869=m
1468CONFIG_NLS_CODEPAGE_936=m 146CONFIG_NLS_CODEPAGE_874=m
1469CONFIG_NLS_CODEPAGE_950=m
1470CONFIG_NLS_CODEPAGE_932=m 147CONFIG_NLS_CODEPAGE_932=m
148CONFIG_NLS_CODEPAGE_936=m
1471CONFIG_NLS_CODEPAGE_949=m 149CONFIG_NLS_CODEPAGE_949=m
1472CONFIG_NLS_CODEPAGE_874=m 150CONFIG_NLS_CODEPAGE_950=m
1473CONFIG_NLS_ISO8859_8=m 151CONFIG_NLS_ISO8859_13=m
1474CONFIG_NLS_CODEPAGE_1250=m 152CONFIG_NLS_ISO8859_14=m
1475CONFIG_NLS_CODEPAGE_1251=m 153CONFIG_NLS_ISO8859_15=m
1476# CONFIG_NLS_ASCII is not set
1477CONFIG_NLS_ISO8859_1=y 154CONFIG_NLS_ISO8859_1=y
1478CONFIG_NLS_ISO8859_2=m 155CONFIG_NLS_ISO8859_2=m
1479CONFIG_NLS_ISO8859_3=m 156CONFIG_NLS_ISO8859_3=m
@@ -1481,194 +158,79 @@ CONFIG_NLS_ISO8859_4=m
1481CONFIG_NLS_ISO8859_5=m 158CONFIG_NLS_ISO8859_5=m
1482CONFIG_NLS_ISO8859_6=m 159CONFIG_NLS_ISO8859_6=m
1483CONFIG_NLS_ISO8859_7=m 160CONFIG_NLS_ISO8859_7=m
161CONFIG_NLS_ISO8859_8=m
1484CONFIG_NLS_ISO8859_9=m 162CONFIG_NLS_ISO8859_9=m
1485CONFIG_NLS_ISO8859_13=m
1486CONFIG_NLS_ISO8859_14=m
1487CONFIG_NLS_ISO8859_15=m
1488CONFIG_NLS_KOI8_R=m 163CONFIG_NLS_KOI8_R=m
1489CONFIG_NLS_KOI8_U=m 164CONFIG_NLS_KOI8_U=m
1490CONFIG_NLS_UTF8=m 165CONFIG_NLS_UTF8=m
1491# CONFIG_DLM is not set 166CONFIG_NTFS_FS=m
1492 167CONFIG_PACKET=y
1493# 168CONFIG_PARTITION_ADVANCED=y
1494# Kernel hacking 169CONFIG_PERFMON=y
1495# 170# CONFIG_PNP_DEBUG_MESSAGES is not set
1496# CONFIG_PRINTK_TIME is not set 171CONFIG_POSIX_MQUEUE=y
1497CONFIG_ENABLE_WARN_DEPRECATED=y 172CONFIG_PROC_KCORE=y
1498CONFIG_ENABLE_MUST_CHECK=y 173CONFIG_RAW_DRIVER=m
1499CONFIG_FRAME_WARN=2048
1500CONFIG_MAGIC_SYSRQ=y
1501# CONFIG_UNUSED_SYMBOLS is not set
1502# CONFIG_DEBUG_FS is not set
1503# CONFIG_HEADERS_CHECK is not set
1504CONFIG_DEBUG_KERNEL=y
1505# CONFIG_DEBUG_SHIRQ is not set
1506CONFIG_DETECT_SOFTLOCKUP=y
1507# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1508CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1509CONFIG_SCHED_DEBUG=y
1510# CONFIG_SCHEDSTATS is not set
1511# CONFIG_TIMER_STATS is not set
1512# CONFIG_DEBUG_OBJECTS is not set
1513# CONFIG_SLUB_DEBUG_ON is not set
1514# CONFIG_SLUB_STATS is not set
1515# CONFIG_DEBUG_RT_MUTEXES is not set
1516# CONFIG_RT_MUTEX_TESTER is not set
1517# CONFIG_DEBUG_SPINLOCK is not set
1518CONFIG_DEBUG_MUTEXES=y
1519# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1520# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1521# CONFIG_DEBUG_KOBJECT is not set
1522# CONFIG_DEBUG_INFO is not set
1523# CONFIG_DEBUG_VM is not set
1524# CONFIG_DEBUG_WRITECOUNT is not set
1525CONFIG_DEBUG_MEMORY_INIT=y
1526# CONFIG_DEBUG_LIST is not set
1527# CONFIG_DEBUG_SG is not set
1528# CONFIG_BOOT_PRINTK_DELAY is not set
1529# CONFIG_RCU_TORTURE_TEST is not set
1530# CONFIG_RCU_CPU_STALL_DETECTOR is not set 174# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1531# CONFIG_BACKTRACE_SELF_TEST is not set 175CONFIG_REISERFS_FS_POSIX_ACL=y
1532# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set 176CONFIG_REISERFS_FS_SECURITY=y
1533# CONFIG_FAULT_INJECTION is not set 177CONFIG_REISERFS_FS_XATTR=y
178CONFIG_REISERFS_FS=y
179CONFIG_SATA_VITESSE=y
180CONFIG_SCSI_FC_ATTRS=y
181CONFIG_SCSI_QLOGIC_1280=y
182CONFIG_SCSI_SYM53C8XX_2=y
183CONFIG_SERIAL_8250_CONSOLE=y
184CONFIG_SERIAL_8250_EXTENDED=y
185CONFIG_SERIAL_8250_NR_UARTS=6
186CONFIG_SERIAL_8250_SHARE_IRQ=y
187CONFIG_SERIAL_8250=y
188CONFIG_SERIAL_NONSTANDARD=y
189CONFIG_SERIAL_SGI_IOC4=y
190CONFIG_SERIAL_SGI_L1_CONSOLE=y
191# CONFIG_SERIO_SERPORT is not set
192CONFIG_SGI_IOC4=y
193CONFIG_SGI_MBCS=m
194CONFIG_SGI_PARTITION=y
195CONFIG_SGI_SNSC=y
196CONFIG_SGI_TIOCX=y
197CONFIG_SGI_XP=m
198CONFIG_SMB_FS=m
199CONFIG_SMB_NLS_DEFAULT=y
200CONFIG_SMP=y
201CONFIG_SND_CS4281=m
202CONFIG_SND_CS46XX=m
203CONFIG_SND_DUMMY=m
204CONFIG_SND_EMU10K1=m
205CONFIG_SND_FM801=m
206CONFIG_SND=m
207CONFIG_SND_MIXER_OSS=m
208CONFIG_SND_MPU401=m
209CONFIG_SND_MTPAV=m
210CONFIG_SND_PCM_OSS=m
211CONFIG_SND_SEQ_DUMMY=m
212CONFIG_SND_SEQUENCER=m
213CONFIG_SND_SEQUENCER_OSS=y
214CONFIG_SND_SERIAL_U16550=m
215CONFIG_SND_VERBOSE_PRINTK=y
216CONFIG_SND_VIRMIDI=m
217CONFIG_SOUND=m
218CONFIG_SYN_COOKIES=y
1534CONFIG_SYSCTL_SYSCALL_CHECK=y 219CONFIG_SYSCTL_SYSCALL_CHECK=y
1535 220CONFIG_SYSFS_DEPRECATED_V2=y
1536# 221CONFIG_SYSVIPC=y
1537# Tracers 222CONFIG_TIGON3=y
1538# 223CONFIG_TMPFS=y
1539# CONFIG_SCHED_TRACER is not set 224CONFIG_TULIP=m
1540# CONFIG_CONTEXT_SWITCH_TRACER is not set 225CONFIG_UDF_FS=m
1541# CONFIG_BOOT_TRACER is not set 226CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
1542# CONFIG_DYNAMIC_PRINTK_DEBUG is not set 227CONFIG_UNIX=y
1543# CONFIG_SAMPLES is not set 228CONFIG_USB_DEVICEFS=y
1544CONFIG_IA64_GRANULE_16MB=y 229CONFIG_USB_EHCI_HCD=m
1545# CONFIG_IA64_GRANULE_64MB is not set 230CONFIG_USB=m
1546# CONFIG_IA64_PRINT_HAZARDS is not set 231CONFIG_USB_MON=m
1547# CONFIG_DISABLE_VHPT is not set 232CONFIG_USB_OHCI_HCD=m
1548# CONFIG_IA64_DEBUG_CMPXCHG is not set 233CONFIG_USB_STORAGE=m
1549# CONFIG_IA64_DEBUG_IRQ is not set 234CONFIG_USB_UHCI_HCD=m
1550CONFIG_SYSVIPC_COMPAT=y 235CONFIG_VFAT_FS=y
1551 236CONFIG_XFS_FS=y
1552#
1553# Security options
1554#
1555# CONFIG_KEYS is not set
1556# CONFIG_SECURITY is not set
1557# CONFIG_SECURITYFS is not set
1558# CONFIG_SECURITY_FILE_CAPABILITIES is not set
1559CONFIG_CRYPTO=y
1560
1561#
1562# Crypto core or helper
1563#
1564# CONFIG_CRYPTO_FIPS is not set
1565CONFIG_CRYPTO_ALGAPI=y
1566CONFIG_CRYPTO_AEAD=m
1567CONFIG_CRYPTO_BLKCIPHER=m
1568CONFIG_CRYPTO_HASH=m
1569CONFIG_CRYPTO_RNG=m
1570CONFIG_CRYPTO_MANAGER=m
1571# CONFIG_CRYPTO_GF128MUL is not set
1572# CONFIG_CRYPTO_NULL is not set
1573# CONFIG_CRYPTO_CRYPTD is not set
1574# CONFIG_CRYPTO_AUTHENC is not set
1575# CONFIG_CRYPTO_TEST is not set
1576
1577#
1578# Authenticated Encryption with Associated Data
1579#
1580# CONFIG_CRYPTO_CCM is not set
1581# CONFIG_CRYPTO_GCM is not set
1582# CONFIG_CRYPTO_SEQIV is not set
1583
1584#
1585# Block modes
1586#
1587CONFIG_CRYPTO_CBC=m
1588# CONFIG_CRYPTO_CTR is not set
1589# CONFIG_CRYPTO_CTS is not set
1590CONFIG_CRYPTO_ECB=m
1591# CONFIG_CRYPTO_LRW is not set
1592CONFIG_CRYPTO_PCBC=m
1593# CONFIG_CRYPTO_XTS is not set
1594
1595#
1596# Hash modes
1597#
1598# CONFIG_CRYPTO_HMAC is not set
1599# CONFIG_CRYPTO_XCBC is not set
1600
1601#
1602# Digest
1603#
1604# CONFIG_CRYPTO_CRC32C is not set
1605# CONFIG_CRYPTO_MD4 is not set
1606CONFIG_CRYPTO_MD5=y
1607# CONFIG_CRYPTO_MICHAEL_MIC is not set
1608# CONFIG_CRYPTO_RMD128 is not set
1609# CONFIG_CRYPTO_RMD160 is not set
1610# CONFIG_CRYPTO_RMD256 is not set
1611# CONFIG_CRYPTO_RMD320 is not set
1612# CONFIG_CRYPTO_SHA1 is not set
1613# CONFIG_CRYPTO_SHA256 is not set
1614# CONFIG_CRYPTO_SHA512 is not set
1615# CONFIG_CRYPTO_TGR192 is not set
1616# CONFIG_CRYPTO_WP512 is not set
1617
1618#
1619# Ciphers
1620#
1621# CONFIG_CRYPTO_AES is not set
1622# CONFIG_CRYPTO_ANUBIS is not set
1623# CONFIG_CRYPTO_ARC4 is not set
1624# CONFIG_CRYPTO_BLOWFISH is not set
1625# CONFIG_CRYPTO_CAMELLIA is not set
1626# CONFIG_CRYPTO_CAST5 is not set
1627# CONFIG_CRYPTO_CAST6 is not set
1628CONFIG_CRYPTO_DES=m
1629# CONFIG_CRYPTO_FCRYPT is not set
1630# CONFIG_CRYPTO_KHAZAD is not set
1631# CONFIG_CRYPTO_SALSA20 is not set
1632# CONFIG_CRYPTO_SEED is not set
1633# CONFIG_CRYPTO_SERPENT is not set
1634# CONFIG_CRYPTO_TEA is not set
1635# CONFIG_CRYPTO_TWOFISH is not set
1636
1637#
1638# Compression
1639#
1640# CONFIG_CRYPTO_DEFLATE is not set
1641# CONFIG_CRYPTO_LZO is not set
1642
1643#
1644# Random Number Generation
1645#
1646# CONFIG_CRYPTO_ANSI_CPRNG is not set
1647CONFIG_CRYPTO_HW=y
1648# CONFIG_CRYPTO_DEV_HIFN_795X is not set
1649CONFIG_HAVE_KVM=y
1650CONFIG_VIRTUALIZATION=y
1651# CONFIG_KVM is not set
1652# CONFIG_VIRTIO_PCI is not set
1653# CONFIG_VIRTIO_BALLOON is not set
1654
1655#
1656# Library routines
1657#
1658CONFIG_BITREVERSE=y
1659# CONFIG_CRC_CCITT is not set
1660# CONFIG_CRC16 is not set
1661CONFIG_CRC_T10DIF=y
1662CONFIG_CRC_ITU_T=m
1663CONFIG_CRC32=y
1664# CONFIG_CRC7 is not set
1665# CONFIG_LIBCRC32C is not set
1666CONFIG_GENERIC_ALLOCATOR=y
1667CONFIG_PLIST=y
1668CONFIG_HAS_IOMEM=y
1669CONFIG_HAS_IOPORT=y
1670CONFIG_HAS_DMA=y
1671CONFIG_GENERIC_HARDIRQS=y
1672CONFIG_GENERIC_IRQ_PROBE=y
1673CONFIG_GENERIC_PENDING_IRQ=y
1674CONFIG_IRQ_PER_CPU=y
diff --git a/arch/ia64/configs/gensparse_defconfig b/arch/ia64/configs/gensparse_defconfig
index 2dc185b0f9a3..18989a084143 100644
--- a/arch/ia64/configs/gensparse_defconfig
+++ b/arch/ia64/configs/gensparse_defconfig
@@ -1,1267 +1,110 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.16-rc5
4# Thu Mar 2 16:39:10 2006
5#
6
7#
8# Code maturity level options
9#
10CONFIG_EXPERIMENTAL=y
11CONFIG_LOCK_KERNEL=y
12CONFIG_INIT_ENV_ARG_LIMIT=32
13
14#
15# General setup
16#
17CONFIG_LOCALVERSION=""
18CONFIG_LOCALVERSION_AUTO=y
19CONFIG_SWAP=y
20CONFIG_SYSVIPC=y
21CONFIG_POSIX_MQUEUE=y
22# CONFIG_BSD_PROCESS_ACCT is not set
23CONFIG_SYSCTL=y
24# CONFIG_AUDIT is not set
25CONFIG_IKCONFIG=y
26CONFIG_IKCONFIG_PROC=y
27# CONFIG_CPUSETS is not set
28CONFIG_INITRAMFS_SOURCE=""
29CONFIG_CC_OPTIMIZE_FOR_SIZE=y
30# CONFIG_EMBEDDED is not set
31CONFIG_KALLSYMS=y
32CONFIG_KALLSYMS_ALL=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set
34CONFIG_HOTPLUG=y
35CONFIG_PRINTK=y
36CONFIG_BUG=y
37CONFIG_ELF_CORE=y
38CONFIG_BASE_FULL=y
39CONFIG_FUTEX=y
40CONFIG_EPOLL=y
41CONFIG_SHMEM=y
42CONFIG_CC_ALIGN_FUNCTIONS=0
43CONFIG_CC_ALIGN_LABELS=0
44CONFIG_CC_ALIGN_LOOPS=0
45CONFIG_CC_ALIGN_JUMPS=0
46CONFIG_SLUB=y
47# CONFIG_TINY_SHMEM is not set
48CONFIG_BASE_SMALL=0
49# CONFIG_SLOB is not set
50
51#
52# Loadable module support
53#
54CONFIG_MODULES=y
55CONFIG_MODULE_UNLOAD=y
56# CONFIG_MODULE_FORCE_UNLOAD is not set
57CONFIG_OBSOLETE_MODPARM=y
58CONFIG_MODVERSIONS=y
59# CONFIG_MODULE_SRCVERSION_ALL is not set
60CONFIG_KMOD=y
61CONFIG_STOP_MACHINE=y
62
63#
64# Block layer
65#
66
67#
68# IO Schedulers
69#
70CONFIG_IOSCHED_NOOP=y
71CONFIG_IOSCHED_AS=y
72CONFIG_IOSCHED_DEADLINE=y
73CONFIG_IOSCHED_CFQ=y
74CONFIG_DEFAULT_AS=y
75# CONFIG_DEFAULT_DEADLINE is not set
76# CONFIG_DEFAULT_CFQ is not set
77# CONFIG_DEFAULT_NOOP is not set
78CONFIG_DEFAULT_IOSCHED="anticipatory"
79
80#
81# Processor type and features
82#
83CONFIG_IA64=y
84CONFIG_64BIT=y
85CONFIG_MMU=y
86CONFIG_SWIOTLB=y
87CONFIG_RWSEM_XCHGADD_ALGORITHM=y
88CONFIG_GENERIC_CALIBRATE_DELAY=y
89CONFIG_GENERIC_TIME=y
90CONFIG_EFI=y
91CONFIG_GENERIC_IOMAP=y
92CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
93CONFIG_DMA_IS_DMA32=y
94CONFIG_IA64_GENERIC=y
95# CONFIG_IA64_DIG is not set
96# CONFIG_IA64_HP_ZX1 is not set
97# CONFIG_IA64_HP_ZX1_SWIOTLB is not set
98# CONFIG_IA64_SGI_SN2 is not set
99# CONFIG_IA64_HP_SIM is not set
100# CONFIG_ITANIUM is not set
101CONFIG_MCKINLEY=y
102# CONFIG_IA64_PAGE_SIZE_4KB is not set
103# CONFIG_IA64_PAGE_SIZE_8KB is not set
104CONFIG_IA64_PAGE_SIZE_16KB=y
105# CONFIG_IA64_PAGE_SIZE_64KB is not set
106CONFIG_PGTABLE_3=y
107# CONFIG_PGTABLE_4 is not set
108# CONFIG_HZ_100 is not set
109CONFIG_HZ_250=y
110# CONFIG_HZ_1000 is not set
111CONFIG_HZ=250
112CONFIG_IA64_L1_CACHE_SHIFT=7
113CONFIG_IA64_CYCLONE=y
114CONFIG_IOSAPIC=y
115# CONFIG_IA64_SGI_SN_XP is not set
116CONFIG_FORCE_MAX_ZONEORDER=17
117CONFIG_SMP=y
118CONFIG_NR_CPUS=512
119CONFIG_IA64_NR_NODES=256
120CONFIG_HOTPLUG_CPU=y
121# CONFIG_SCHED_SMT is not set
122# CONFIG_PREEMPT is not set
123CONFIG_SELECT_MEMORY_MODEL=y
124# CONFIG_FLATMEM_MANUAL is not set
125# CONFIG_DISCONTIGMEM_MANUAL is not set
126CONFIG_SPARSEMEM_MANUAL=y
127CONFIG_SPARSEMEM=y
128CONFIG_NEED_MULTIPLE_NODES=y
129CONFIG_HAVE_MEMORY_PRESENT=y
130# CONFIG_SPARSEMEM_STATIC is not set
131CONFIG_SPARSEMEM_EXTREME=y
132# CONFIG_MEMORY_HOTPLUG is not set
133CONFIG_SPLIT_PTLOCK_CPUS=4
134CONFIG_MIGRATION=y
135CONFIG_ARCH_SELECT_MEMORY_MODEL=y
136CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
137CONFIG_ARCH_FLATMEM_ENABLE=y
138CONFIG_ARCH_SPARSEMEM_ENABLE=y
139CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y
140CONFIG_NUMA=y
141CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
142CONFIG_IA64_MCA_RECOVERY=y
143CONFIG_PERFMON=y
144CONFIG_IA64_PALINFO=y
145CONFIG_SGI_SN=y
146
147#
148# Firmware Drivers
149#
150CONFIG_EFI_VARS=y
151CONFIG_EFI_PCDP=y
152CONFIG_BINFMT_ELF=y
153CONFIG_BINFMT_MISC=m
154
155#
156# Power management and ACPI
157#
158CONFIG_PM=y
159CONFIG_PM_LEGACY=y
160# CONFIG_PM_DEBUG is not set
161
162#
163# ACPI (Advanced Configuration and Power Interface) Support
164#
165CONFIG_ACPI=y
166CONFIG_ACPI_BUTTON=m 1CONFIG_ACPI_BUTTON=m
2CONFIG_ACPI_CONTAINER=m
167CONFIG_ACPI_FAN=m 3CONFIG_ACPI_FAN=m
168CONFIG_ACPI_PROCESSOR=m 4CONFIG_ACPI_PROCESSOR=m
169CONFIG_ACPI_HOTPLUG_CPU=y 5CONFIG_AGP_HP_ZX1=m
170CONFIG_ACPI_THERMAL=m 6CONFIG_AGP_I460=m
171CONFIG_ACPI_NUMA=y 7CONFIG_AGP=m
172CONFIG_ACPI_BLACKLIST_YEAR=0 8CONFIG_AGP_SGI_TIOCA=m
173# CONFIG_ACPI_DEBUG is not set
174CONFIG_ACPI_EC=y
175CONFIG_ACPI_POWER=y
176CONFIG_ACPI_SYSTEM=y
177CONFIG_ACPI_CONTAINER=m
178
179#
180# CPU Frequency scaling
181#
182# CONFIG_CPU_FREQ is not set
183
184#
185# Bus options (PCI, PCMCIA)
186#
187CONFIG_PCI=y
188CONFIG_PCI_DOMAINS=y
189# CONFIG_PCI_MSI is not set
190CONFIG_PCI_LEGACY_PROC=y
191# CONFIG_PCI_DEBUG is not set
192
193#
194# PCI Hotplug Support
195#
196CONFIG_HOTPLUG_PCI=m
197# CONFIG_HOTPLUG_PCI_FAKE is not set
198CONFIG_HOTPLUG_PCI_ACPI=m
199# CONFIG_HOTPLUG_PCI_ACPI_IBM is not set
200# CONFIG_HOTPLUG_PCI_CPCI is not set
201# CONFIG_HOTPLUG_PCI_SHPC is not set
202# CONFIG_HOTPLUG_PCI_SGI is not set
203
204#
205# PCCARD (PCMCIA/CardBus) support
206#
207# CONFIG_PCCARD is not set
208
209#
210# Networking
211#
212CONFIG_NET=y
213
214#
215# Networking options
216#
217# CONFIG_NETDEBUG is not set
218CONFIG_PACKET=y
219# CONFIG_PACKET_MMAP is not set
220CONFIG_UNIX=y
221# CONFIG_NET_KEY is not set
222CONFIG_INET=y
223CONFIG_IP_MULTICAST=y
224# CONFIG_IP_ADVANCED_ROUTER is not set
225CONFIG_IP_FIB_HASH=y
226# CONFIG_IP_PNP is not set
227# CONFIG_NET_IPIP is not set
228# CONFIG_NET_IPGRE is not set
229# CONFIG_IP_MROUTE is not set
230CONFIG_ARPD=y 9CONFIG_ARPD=y
231CONFIG_SYN_COOKIES=y 10CONFIG_AUTOFS4_FS=y
232# CONFIG_INET_AH is not set 11CONFIG_AUTOFS_FS=y
233# CONFIG_INET_ESP is not set 12CONFIG_BINFMT_MISC=m
234# CONFIG_INET_IPCOMP is not set 13CONFIG_BLK_DEV_CMD64X=y
235# CONFIG_INET_TUNNEL is not set
236CONFIG_INET_DIAG=y
237CONFIG_INET_TCP_DIAG=y
238# CONFIG_TCP_CONG_ADVANCED is not set
239CONFIG_TCP_CONG_BIC=y
240# CONFIG_IPV6 is not set
241# CONFIG_NETFILTER is not set
242
243#
244# DCCP Configuration (EXPERIMENTAL)
245#
246# CONFIG_IP_DCCP is not set
247
248#
249# SCTP Configuration (EXPERIMENTAL)
250#
251# CONFIG_IP_SCTP is not set
252
253#
254# TIPC Configuration (EXPERIMENTAL)
255#
256# CONFIG_TIPC is not set
257# CONFIG_ATM is not set
258# CONFIG_BRIDGE is not set
259# CONFIG_VLAN_8021Q is not set
260# CONFIG_DECNET is not set
261# CONFIG_LLC2 is not set
262# CONFIG_IPX is not set
263# CONFIG_ATALK is not set
264# CONFIG_X25 is not set
265# CONFIG_LAPB is not set
266# CONFIG_NET_DIVERT is not set
267# CONFIG_ECONET is not set
268# CONFIG_WAN_ROUTER is not set
269
270#
271# QoS and/or fair queueing
272#
273# CONFIG_NET_SCHED is not set
274
275#
276# Network testing
277#
278# CONFIG_NET_PKTGEN is not set
279# CONFIG_HAMRADIO is not set
280# CONFIG_IRDA is not set
281# CONFIG_BT is not set
282# CONFIG_IEEE80211 is not set
283
284#
285# Device Drivers
286#
287
288#
289# Generic Driver Options
290#
291CONFIG_STANDALONE=y
292CONFIG_PREVENT_FIRMWARE_BUILD=y
293CONFIG_FW_LOADER=m
294# CONFIG_DEBUG_DRIVER is not set
295
296#
297# Connector - unified userspace <-> kernelspace linker
298#
299# CONFIG_CONNECTOR is not set
300
301#
302# Memory Technology Devices (MTD)
303#
304# CONFIG_MTD is not set
305
306#
307# Parallel port support
308#
309# CONFIG_PARPORT is not set
310
311#
312# Plug and Play support
313#
314CONFIG_PNP=y
315# CONFIG_PNP_DEBUG is not set
316
317#
318# Protocols
319#
320CONFIG_PNPACPI=y
321
322#
323# Block devices
324#
325# CONFIG_BLK_CPQ_DA is not set
326# CONFIG_BLK_CPQ_CISS_DA is not set
327# CONFIG_BLK_DEV_DAC960 is not set
328# CONFIG_BLK_DEV_UMEM is not set
329# CONFIG_BLK_DEV_COW_COMMON is not set
330CONFIG_BLK_DEV_LOOP=m
331CONFIG_BLK_DEV_CRYPTOLOOP=m 14CONFIG_BLK_DEV_CRYPTOLOOP=m
332CONFIG_BLK_DEV_NBD=m 15CONFIG_BLK_DEV_DM=m
333# CONFIG_BLK_DEV_SX8 is not set
334# CONFIG_BLK_DEV_UB is not set
335CONFIG_BLK_DEV_RAM=y
336CONFIG_BLK_DEV_RAM_COUNT=16
337CONFIG_BLK_DEV_RAM_SIZE=4096
338CONFIG_BLK_DEV_INITRD=y
339# CONFIG_CDROM_PKTCDVD is not set
340# CONFIG_ATA_OVER_ETH is not set
341
342#
343# ATA/ATAPI/MFM/RLL support
344#
345CONFIG_IDE=y
346CONFIG_IDE_MAX_HWIFS=4
347CONFIG_BLK_DEV_IDE=y
348
349#
350# Please see Documentation/ide.txt for help/info on IDE drives
351#
352# CONFIG_BLK_DEV_IDE_SATA is not set
353CONFIG_BLK_DEV_IDEDISK=y
354# CONFIG_IDEDISK_MULTI_MODE is not set
355CONFIG_BLK_DEV_IDECD=y
356# CONFIG_BLK_DEV_IDETAPE is not set
357CONFIG_BLK_DEV_IDEFLOPPY=y
358CONFIG_BLK_DEV_IDESCSI=m
359# CONFIG_IDE_TASK_IOCTL is not set
360
361#
362# IDE chipset support/bugfixes
363#
364CONFIG_IDE_GENERIC=y
365# CONFIG_BLK_DEV_IDEPNP is not set
366CONFIG_BLK_DEV_IDEPCI=y
367# CONFIG_IDEPCI_SHARE_IRQ is not set
368# CONFIG_BLK_DEV_OFFBOARD is not set
369CONFIG_BLK_DEV_GENERIC=y 16CONFIG_BLK_DEV_GENERIC=y
370# CONFIG_BLK_DEV_OPTI621 is not set 17CONFIG_BLK_DEV_IDECD=y
371CONFIG_BLK_DEV_IDEDMA_PCI=y 18CONFIG_BLK_DEV_INITRD=y
372# CONFIG_BLK_DEV_IDEDMA_FORCED is not set 19CONFIG_BLK_DEV_LOOP=m
373CONFIG_IDEDMA_PCI_AUTO=y 20CONFIG_BLK_DEV_MD=m
374# CONFIG_IDEDMA_ONLYDISK is not set 21CONFIG_BLK_DEV_NBD=m
375# CONFIG_BLK_DEV_AEC62XX is not set
376# CONFIG_BLK_DEV_ALI15X3 is not set
377# CONFIG_BLK_DEV_AMD74XX is not set
378CONFIG_BLK_DEV_CMD64X=y
379# CONFIG_BLK_DEV_TRIFLEX is not set
380# CONFIG_BLK_DEV_CY82C693 is not set
381# CONFIG_BLK_DEV_CS5520 is not set
382# CONFIG_BLK_DEV_CS5530 is not set
383# CONFIG_BLK_DEV_HPT34X is not set
384# CONFIG_BLK_DEV_HPT366 is not set
385# CONFIG_BLK_DEV_SC1200 is not set
386CONFIG_BLK_DEV_PIIX=y 22CONFIG_BLK_DEV_PIIX=y
387# CONFIG_BLK_DEV_IT821X is not set 23CONFIG_BLK_DEV_RAM=y
388# CONFIG_BLK_DEV_NS87415 is not set
389# CONFIG_BLK_DEV_PDC202XX_OLD is not set
390# CONFIG_BLK_DEV_PDC202XX_NEW is not set
391# CONFIG_BLK_DEV_SVWKS is not set
392CONFIG_BLK_DEV_SGIIOC4=y
393# CONFIG_BLK_DEV_SIIMAGE is not set
394# CONFIG_BLK_DEV_SLC90E66 is not set
395# CONFIG_BLK_DEV_TRM290 is not set
396# CONFIG_BLK_DEV_VIA82CXXX is not set
397# CONFIG_IDE_ARM is not set
398CONFIG_BLK_DEV_IDEDMA=y
399# CONFIG_IDEDMA_IVB is not set
400CONFIG_IDEDMA_AUTO=y
401# CONFIG_BLK_DEV_HD is not set
402
403#
404# SCSI device support
405#
406# CONFIG_RAID_ATTRS is not set
407CONFIG_SCSI=y
408CONFIG_SCSI_PROC_FS=y
409
410#
411# SCSI support type (disk, tape, CD-ROM)
412#
413CONFIG_BLK_DEV_SD=y 24CONFIG_BLK_DEV_SD=y
414CONFIG_CHR_DEV_ST=m 25CONFIG_BLK_DEV_SGIIOC4=y
415# CONFIG_CHR_DEV_OSST is not set
416CONFIG_BLK_DEV_SR=m 26CONFIG_BLK_DEV_SR=m
417# CONFIG_BLK_DEV_SR_VENDOR is not set
418CONFIG_CHR_DEV_SG=m 27CONFIG_CHR_DEV_SG=m
419# CONFIG_CHR_DEV_SCH is not set 28CONFIG_CHR_DEV_ST=m
420 29CONFIG_CIFS=m
421# 30CONFIG_CRYPTO_MD5=y
422# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 31CONFIG_DEBUG_KERNEL=y
423# 32CONFIG_DEBUG_MUTEXES=y
424# CONFIG_SCSI_MULTI_LUN is not set
425# CONFIG_SCSI_CONSTANTS is not set
426# CONFIG_SCSI_LOGGING is not set
427
428#
429# SCSI Transport Attributes
430#
431CONFIG_SCSI_SPI_ATTRS=y
432CONFIG_SCSI_FC_ATTRS=y
433# CONFIG_SCSI_ISCSI_ATTRS is not set
434# CONFIG_SCSI_SAS_ATTRS is not set
435
436#
437# SCSI low-level drivers
438#
439# CONFIG_ISCSI_TCP is not set
440# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
441# CONFIG_SCSI_3W_9XXX is not set
442# CONFIG_SCSI_ACARD is not set
443# CONFIG_SCSI_AACRAID is not set
444# CONFIG_SCSI_AIC7XXX is not set
445# CONFIG_SCSI_AIC7XXX_OLD is not set
446# CONFIG_SCSI_AIC79XX is not set
447# CONFIG_MEGARAID_NEWGEN is not set
448# CONFIG_MEGARAID_LEGACY is not set
449# CONFIG_MEGARAID_SAS is not set
450CONFIG_SCSI_SATA=y
451# CONFIG_SCSI_SATA_AHCI is not set
452# CONFIG_SCSI_SATA_SVW is not set
453# CONFIG_SCSI_ATA_PIIX is not set
454# CONFIG_SCSI_SATA_MV is not set
455# CONFIG_SCSI_SATA_NV is not set
456# CONFIG_SCSI_PDC_ADMA is not set
457# CONFIG_SCSI_SATA_QSTOR is not set
458# CONFIG_SCSI_SATA_PROMISE is not set
459# CONFIG_SCSI_SATA_SX4 is not set
460# CONFIG_SCSI_SATA_SIL is not set
461# CONFIG_SCSI_SATA_SIL24 is not set
462# CONFIG_SCSI_SATA_SIS is not set
463# CONFIG_SCSI_SATA_ULI is not set
464# CONFIG_SCSI_SATA_VIA is not set
465CONFIG_SCSI_SATA_VITESSE=y
466# CONFIG_SCSI_DMX3191D is not set
467# CONFIG_SCSI_FUTURE_DOMAIN is not set
468# CONFIG_SCSI_IPS is not set
469# CONFIG_SCSI_INITIO is not set
470# CONFIG_SCSI_INIA100 is not set
471CONFIG_SCSI_SYM53C8XX_2=y
472CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
473CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
474CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
475# CONFIG_SCSI_SYM53C8XX_IOMAPPED is not set
476# CONFIG_SCSI_IPR is not set
477# CONFIG_SCSI_QLOGIC_FC is not set
478CONFIG_SCSI_QLOGIC_1280=y
479# CONFIG_SCSI_QLA_FC is not set
480# CONFIG_SCSI_LPFC is not set
481# CONFIG_SCSI_DC395x is not set
482# CONFIG_SCSI_DC390T is not set
483# CONFIG_SCSI_DEBUG is not set
484
485#
486# Multi-device support (RAID and LVM)
487#
488CONFIG_MD=y
489CONFIG_BLK_DEV_MD=m
490CONFIG_MD_LINEAR=m
491CONFIG_MD_RAID0=m
492CONFIG_MD_RAID1=m
493# CONFIG_MD_RAID10 is not set
494CONFIG_MD_RAID5=m
495CONFIG_MD_RAID6=m
496CONFIG_MD_MULTIPATH=m
497# CONFIG_MD_FAULTY is not set
498CONFIG_BLK_DEV_DM=m
499CONFIG_DM_CRYPT=m 33CONFIG_DM_CRYPT=m
500CONFIG_DM_SNAPSHOT=m
501CONFIG_DM_MIRROR=m 34CONFIG_DM_MIRROR=m
502CONFIG_DM_ZERO=m
503CONFIG_DM_MULTIPATH=m 35CONFIG_DM_MULTIPATH=m
504# CONFIG_DM_MULTIPATH_EMC is not set 36CONFIG_DM_SNAPSHOT=m
505 37CONFIG_DM_ZERO=m
506#
507# Fusion MPT device support
508#
509CONFIG_FUSION=y
510CONFIG_FUSION_SPI=y
511CONFIG_FUSION_FC=m
512# CONFIG_FUSION_SAS is not set
513CONFIG_FUSION_MAX_SGE=128
514# CONFIG_FUSION_CTL is not set
515
516#
517# IEEE 1394 (FireWire) support
518#
519# CONFIG_IEEE1394 is not set
520
521#
522# I2O device support
523#
524# CONFIG_I2O is not set
525
526#
527# Network device support
528#
529CONFIG_NETDEVICES=y
530CONFIG_DUMMY=m
531# CONFIG_BONDING is not set
532# CONFIG_EQUALIZER is not set
533# CONFIG_TUN is not set
534# CONFIG_NET_SB1000 is not set
535
536#
537# ARCnet devices
538#
539# CONFIG_ARCNET is not set
540
541#
542# PHY device support
543#
544# CONFIG_PHYLIB is not set
545
546#
547# Ethernet (10 or 100Mbit)
548#
549CONFIG_NET_ETHERNET=y
550CONFIG_MII=m
551# CONFIG_HAPPYMEAL is not set
552# CONFIG_SUNGEM is not set
553# CONFIG_CASSINI is not set
554# CONFIG_NET_VENDOR_3COM is not set
555
556#
557# Tulip family network device support
558#
559CONFIG_NET_TULIP=y
560# CONFIG_DE2104X is not set
561CONFIG_TULIP=m
562# CONFIG_TULIP_MWI is not set
563# CONFIG_TULIP_MMIO is not set
564# CONFIG_TULIP_NAPI is not set
565# CONFIG_DE4X5 is not set
566# CONFIG_WINBOND_840 is not set
567# CONFIG_DM9102 is not set
568# CONFIG_ULI526X is not set
569# CONFIG_HP100 is not set
570CONFIG_NET_PCI=y
571# CONFIG_PCNET32 is not set
572# CONFIG_AMD8111_ETH is not set
573# CONFIG_ADAPTEC_STARFIRE is not set
574# CONFIG_B44 is not set
575# CONFIG_FORCEDETH is not set
576# CONFIG_DGRS is not set
577CONFIG_EEPRO100=m
578CONFIG_E100=m
579# CONFIG_FEALNX is not set
580# CONFIG_NATSEMI is not set
581# CONFIG_NE2K_PCI is not set
582# CONFIG_8139CP is not set
583# CONFIG_8139TOO is not set
584# CONFIG_SIS900 is not set
585# CONFIG_EPIC100 is not set
586# CONFIG_SUNDANCE is not set
587# CONFIG_VIA_RHINE is not set
588
589#
590# Ethernet (1000 Mbit)
591#
592# CONFIG_ACENIC is not set
593# CONFIG_DL2K is not set
594CONFIG_E1000=y
595# CONFIG_E1000_NAPI is not set
596# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
597# CONFIG_NS83820 is not set
598# CONFIG_HAMACHI is not set
599# CONFIG_YELLOWFIN is not set
600# CONFIG_R8169 is not set
601# CONFIG_SIS190 is not set
602# CONFIG_SKGE is not set
603# CONFIG_SKY2 is not set
604# CONFIG_SK98LIN is not set
605# CONFIG_VIA_VELOCITY is not set
606CONFIG_TIGON3=y
607# CONFIG_BNX2 is not set
608
609#
610# Ethernet (10000 Mbit)
611#
612# CONFIG_CHELSIO_T1 is not set
613# CONFIG_IXGB is not set
614# CONFIG_S2IO is not set
615
616#
617# Token Ring devices
618#
619# CONFIG_TR is not set
620
621#
622# Wireless LAN (non-hamradio)
623#
624# CONFIG_NET_RADIO is not set
625
626#
627# Wan interfaces
628#
629# CONFIG_WAN is not set
630# CONFIG_FDDI is not set
631# CONFIG_HIPPI is not set
632# CONFIG_PPP is not set
633# CONFIG_SLIP is not set
634# CONFIG_NET_FC is not set
635# CONFIG_SHAPER is not set
636CONFIG_NETCONSOLE=y
637CONFIG_NETPOLL=y
638# CONFIG_NETPOLL_RX is not set
639# CONFIG_NETPOLL_TRAP is not set
640CONFIG_NET_POLL_CONTROLLER=y
641
642#
643# ISDN subsystem
644#
645# CONFIG_ISDN is not set
646
647#
648# Telephony Support
649#
650# CONFIG_PHONE is not set
651
652#
653# Input device support
654#
655CONFIG_INPUT=y
656
657#
658# Userland interfaces
659#
660CONFIG_INPUT_MOUSEDEV=y
661CONFIG_INPUT_MOUSEDEV_PSAUX=y
662CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
663CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
664# CONFIG_INPUT_JOYDEV is not set
665# CONFIG_INPUT_TSDEV is not set
666# CONFIG_INPUT_EVDEV is not set
667# CONFIG_INPUT_EVBUG is not set
668
669#
670# Input Device Drivers
671#
672CONFIG_INPUT_KEYBOARD=y
673CONFIG_KEYBOARD_ATKBD=y
674# CONFIG_KEYBOARD_SUNKBD is not set
675# CONFIG_KEYBOARD_LKKBD is not set
676# CONFIG_KEYBOARD_XTKBD is not set
677# CONFIG_KEYBOARD_NEWTON is not set
678CONFIG_INPUT_MOUSE=y
679CONFIG_MOUSE_PS2=y
680# CONFIG_MOUSE_SERIAL is not set
681# CONFIG_MOUSE_VSXXXAA is not set
682# CONFIG_INPUT_JOYSTICK is not set
683# CONFIG_INPUT_TOUCHSCREEN is not set
684# CONFIG_INPUT_MISC is not set
685
686#
687# Hardware I/O ports
688#
689CONFIG_SERIO=y
690CONFIG_SERIO_I8042=y
691# CONFIG_SERIO_SERPORT is not set
692# CONFIG_SERIO_PCIPS2 is not set
693CONFIG_SERIO_LIBPS2=y
694# CONFIG_SERIO_RAW is not set
695CONFIG_GAMEPORT=m
696# CONFIG_GAMEPORT_NS558 is not set
697# CONFIG_GAMEPORT_L4 is not set
698# CONFIG_GAMEPORT_EMU10K1 is not set
699# CONFIG_GAMEPORT_FM801 is not set
700
701#
702# Character devices
703#
704CONFIG_VT=y
705CONFIG_VT_CONSOLE=y
706CONFIG_HW_CONSOLE=y
707CONFIG_SERIAL_NONSTANDARD=y
708# CONFIG_COMPUTONE is not set
709# CONFIG_ROCKETPORT is not set
710# CONFIG_CYCLADES is not set
711# CONFIG_DIGIEPCA is not set
712# CONFIG_MOXA_INTELLIO is not set
713# CONFIG_MOXA_SMARTIO is not set
714# CONFIG_ISI is not set
715# CONFIG_SYNCLINKMP is not set
716# CONFIG_SYNCLINK_GT is not set
717# CONFIG_N_HDLC is not set
718# CONFIG_SPECIALIX is not set
719# CONFIG_SX is not set
720# CONFIG_STALDRV is not set
721CONFIG_SGI_SNSC=y
722CONFIG_SGI_TIOCX=y
723CONFIG_SGI_MBCS=m
724
725#
726# Serial drivers
727#
728CONFIG_SERIAL_8250=y
729CONFIG_SERIAL_8250_CONSOLE=y
730CONFIG_SERIAL_8250_ACPI=y
731CONFIG_SERIAL_8250_NR_UARTS=6
732CONFIG_SERIAL_8250_RUNTIME_UARTS=4
733CONFIG_SERIAL_8250_EXTENDED=y
734CONFIG_SERIAL_8250_SHARE_IRQ=y
735# CONFIG_SERIAL_8250_DETECT_IRQ is not set
736# CONFIG_SERIAL_8250_RSA is not set
737
738#
739# Non-8250 serial port support
740#
741CONFIG_SERIAL_CORE=y
742CONFIG_SERIAL_CORE_CONSOLE=y
743CONFIG_SERIAL_SGI_L1_CONSOLE=y
744# CONFIG_SERIAL_JSM is not set
745CONFIG_SERIAL_SGI_IOC4=y
746CONFIG_SERIAL_SGI_IOC3=y
747CONFIG_UNIX98_PTYS=y
748CONFIG_LEGACY_PTYS=y
749CONFIG_LEGACY_PTY_COUNT=256
750
751#
752# IPMI
753#
754# CONFIG_IPMI_HANDLER is not set
755
756#
757# Watchdog Cards
758#
759# CONFIG_WATCHDOG is not set
760# CONFIG_HW_RANDOM is not set
761CONFIG_EFI_RTC=y
762# CONFIG_DTLK is not set
763# CONFIG_R3964 is not set
764# CONFIG_APPLICOM is not set
765
766#
767# Ftape, the floppy tape device driver
768#
769CONFIG_AGP=m
770CONFIG_AGP_I460=m
771CONFIG_AGP_HP_ZX1=m
772CONFIG_AGP_SGI_TIOCA=m
773CONFIG_DRM=m 38CONFIG_DRM=m
774CONFIG_DRM_TDFX=m 39CONFIG_DRM_MGA=m
775CONFIG_DRM_R128=m 40CONFIG_DRM_R128=m
776CONFIG_DRM_RADEON=m 41CONFIG_DRM_RADEON=m
777CONFIG_DRM_MGA=m
778CONFIG_DRM_SIS=m 42CONFIG_DRM_SIS=m
779# CONFIG_DRM_VIA is not set 43CONFIG_DRM_TDFX=m
780# CONFIG_DRM_SAVAGE is not set 44CONFIG_DUMMY=m
781CONFIG_RAW_DRIVER=m 45CONFIG_E1000=y
782CONFIG_MAX_RAW_DEVS=256 46CONFIG_E100=m
783CONFIG_HPET=y 47CONFIG_EFI_PARTITION=y
784# CONFIG_HPET_RTC_IRQ is not set 48CONFIG_EFI_RTC=y
785CONFIG_HPET_MMAP=y 49CONFIG_EFI_VARS=y
786# CONFIG_HANGCHECK_TIMER is not set 50CONFIG_EXPERIMENTAL=y
787CONFIG_MMTIMER=y
788
789#
790# TPM devices
791#
792# CONFIG_TCG_TPM is not set
793# CONFIG_TELCLOCK is not set
794
795#
796# I2C support
797#
798# CONFIG_I2C is not set
799
800#
801# SPI support
802#
803# CONFIG_SPI is not set
804# CONFIG_SPI_MASTER is not set
805
806#
807# Dallas's 1-wire bus
808#
809# CONFIG_W1 is not set
810
811#
812# Hardware Monitoring support
813#
814CONFIG_HWMON=y
815# CONFIG_HWMON_VID is not set
816# CONFIG_SENSORS_F71805F is not set
817# CONFIG_HWMON_DEBUG_CHIP is not set
818
819#
820# Misc devices
821#
822
823#
824# Multimedia Capabilities Port drivers
825#
826
827#
828# Multimedia devices
829#
830# CONFIG_VIDEO_DEV is not set
831
832#
833# Digital Video Broadcasting Devices
834#
835# CONFIG_DVB is not set
836
837#
838# Graphics support
839#
840# CONFIG_FB is not set
841
842#
843# Console display driver support
844#
845CONFIG_VGA_CONSOLE=y
846CONFIG_DUMMY_CONSOLE=y
847
848#
849# Sound
850#
851CONFIG_SOUND=m
852
853#
854# Advanced Linux Sound Architecture
855#
856CONFIG_SND=m
857CONFIG_SND_TIMER=m
858CONFIG_SND_PCM=m
859CONFIG_SND_HWDEP=m
860CONFIG_SND_RAWMIDI=m
861CONFIG_SND_SEQUENCER=m
862CONFIG_SND_SEQ_DUMMY=m
863CONFIG_SND_OSSEMUL=y
864CONFIG_SND_MIXER_OSS=m
865CONFIG_SND_PCM_OSS=m
866CONFIG_SND_SEQUENCER_OSS=y
867# CONFIG_SND_DYNAMIC_MINORS is not set
868CONFIG_SND_SUPPORT_OLD_API=y
869CONFIG_SND_VERBOSE_PRINTK=y
870# CONFIG_SND_DEBUG is not set
871
872#
873# Generic devices
874#
875CONFIG_SND_MPU401_UART=m
876CONFIG_SND_OPL3_LIB=m
877CONFIG_SND_AC97_CODEC=m
878CONFIG_SND_AC97_BUS=m
879CONFIG_SND_DUMMY=m
880CONFIG_SND_VIRMIDI=m
881CONFIG_SND_MTPAV=m
882CONFIG_SND_SERIAL_U16550=m
883CONFIG_SND_MPU401=m
884
885#
886# PCI devices
887#
888# CONFIG_SND_AD1889 is not set
889# CONFIG_SND_ALI5451 is not set
890# CONFIG_SND_ATIIXP is not set
891# CONFIG_SND_ATIIXP_MODEM is not set
892# CONFIG_SND_AU8810 is not set
893# CONFIG_SND_AU8820 is not set
894# CONFIG_SND_AU8830 is not set
895# CONFIG_SND_AZT3328 is not set
896# CONFIG_SND_BT87X is not set
897# CONFIG_SND_CA0106 is not set
898# CONFIG_SND_CMIPCI is not set
899CONFIG_SND_CS4281=m
900CONFIG_SND_CS46XX=m
901CONFIG_SND_CS46XX_NEW_DSP=y
902CONFIG_SND_EMU10K1=m
903# CONFIG_SND_EMU10K1X is not set
904# CONFIG_SND_ENS1370 is not set
905# CONFIG_SND_ENS1371 is not set
906# CONFIG_SND_ES1938 is not set
907# CONFIG_SND_ES1968 is not set
908CONFIG_SND_FM801=m
909# CONFIG_SND_FM801_TEA575X is not set
910# CONFIG_SND_HDA_INTEL is not set
911# CONFIG_SND_HDSP is not set
912# CONFIG_SND_HDSPM is not set
913# CONFIG_SND_ICE1712 is not set
914# CONFIG_SND_ICE1724 is not set
915# CONFIG_SND_INTEL8X0 is not set
916# CONFIG_SND_INTEL8X0M is not set
917# CONFIG_SND_KORG1212 is not set
918# CONFIG_SND_MAESTRO3 is not set
919# CONFIG_SND_MIXART is not set
920# CONFIG_SND_NM256 is not set
921# CONFIG_SND_PCXHR is not set
922# CONFIG_SND_RME32 is not set
923# CONFIG_SND_RME96 is not set
924# CONFIG_SND_RME9652 is not set
925# CONFIG_SND_SONICVIBES is not set
926# CONFIG_SND_TRIDENT is not set
927# CONFIG_SND_VIA82XX is not set
928# CONFIG_SND_VIA82XX_MODEM is not set
929# CONFIG_SND_VX222 is not set
930# CONFIG_SND_YMFPCI is not set
931
932#
933# USB devices
934#
935# CONFIG_SND_USB_AUDIO is not set
936
937#
938# Open Sound System
939#
940# CONFIG_SOUND_PRIME is not set
941
942#
943# USB support
944#
945CONFIG_USB_ARCH_HAS_HCD=y
946CONFIG_USB_ARCH_HAS_OHCI=y
947CONFIG_USB=m
948# CONFIG_USB_DEBUG is not set
949
950#
951# Miscellaneous USB options
952#
953CONFIG_USB_DEVICEFS=y
954# CONFIG_USB_BANDWIDTH is not set
955# CONFIG_USB_DYNAMIC_MINORS is not set
956# CONFIG_USB_SUSPEND is not set
957# CONFIG_USB_OTG is not set
958
959#
960# USB Host Controller Drivers
961#
962CONFIG_USB_EHCI_HCD=m
963# CONFIG_USB_EHCI_SPLIT_ISO is not set
964# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
965# CONFIG_USB_ISP116X_HCD is not set
966CONFIG_USB_OHCI_HCD=m
967# CONFIG_USB_OHCI_BIG_ENDIAN is not set
968CONFIG_USB_OHCI_LITTLE_ENDIAN=y
969CONFIG_USB_UHCI_HCD=m
970# CONFIG_USB_SL811_HCD is not set
971
972#
973# USB Device Class drivers
974#
975# CONFIG_OBSOLETE_OSS_USB_DRIVER is not set
976# CONFIG_USB_ACM is not set
977# CONFIG_USB_PRINTER is not set
978
979#
980# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
981#
982
983#
984# may also be needed; see USB_STORAGE Help for more information
985#
986CONFIG_USB_STORAGE=m
987# CONFIG_USB_STORAGE_DEBUG is not set
988# CONFIG_USB_STORAGE_DATAFAB is not set
989# CONFIG_USB_STORAGE_FREECOM is not set
990# CONFIG_USB_STORAGE_ISD200 is not set
991# CONFIG_USB_STORAGE_DPCM is not set
992# CONFIG_USB_STORAGE_USBAT is not set
993# CONFIG_USB_STORAGE_SDDR09 is not set
994# CONFIG_USB_STORAGE_SDDR55 is not set
995# CONFIG_USB_STORAGE_JUMPSHOT is not set
996# CONFIG_USB_STORAGE_ALAUDA is not set
997# CONFIG_USB_LIBUSUAL is not set
998
999#
1000# USB Input Devices
1001#
1002CONFIG_USB_HID=m
1003CONFIG_USB_HIDINPUT=y
1004# CONFIG_USB_HIDINPUT_POWERBOOK is not set
1005# CONFIG_HID_FF is not set
1006# CONFIG_USB_HIDDEV is not set
1007
1008#
1009# USB HID Boot Protocol drivers
1010#
1011# CONFIG_USB_KBD is not set
1012# CONFIG_USB_MOUSE is not set
1013# CONFIG_USB_AIPTEK is not set
1014# CONFIG_USB_WACOM is not set
1015# CONFIG_USB_ACECAD is not set
1016# CONFIG_USB_KBTAB is not set
1017# CONFIG_USB_POWERMATE is not set
1018# CONFIG_USB_MTOUCH is not set
1019# CONFIG_USB_ITMTOUCH is not set
1020# CONFIG_USB_EGALAX is not set
1021# CONFIG_USB_YEALINK is not set
1022# CONFIG_USB_XPAD is not set
1023# CONFIG_USB_ATI_REMOTE is not set
1024# CONFIG_USB_ATI_REMOTE2 is not set
1025# CONFIG_USB_KEYSPAN_REMOTE is not set
1026# CONFIG_USB_APPLETOUCH is not set
1027
1028#
1029# USB Imaging devices
1030#
1031# CONFIG_USB_MDC800 is not set
1032# CONFIG_USB_MICROTEK is not set
1033
1034#
1035# USB Multimedia devices
1036#
1037# CONFIG_USB_DABUSB is not set
1038
1039#
1040# Video4Linux support is needed for USB Multimedia device support
1041#
1042
1043#
1044# USB Network Adapters
1045#
1046# CONFIG_USB_CATC is not set
1047# CONFIG_USB_KAWETH is not set
1048# CONFIG_USB_PEGASUS is not set
1049# CONFIG_USB_RTL8150 is not set
1050# CONFIG_USB_USBNET is not set
1051CONFIG_USB_MON=y
1052
1053#
1054# USB port drivers
1055#
1056
1057#
1058# USB Serial Converter support
1059#
1060# CONFIG_USB_SERIAL is not set
1061
1062#
1063# USB Miscellaneous drivers
1064#
1065# CONFIG_USB_EMI62 is not set
1066# CONFIG_USB_EMI26 is not set
1067# CONFIG_USB_AUERSWALD is not set
1068# CONFIG_USB_RIO500 is not set
1069# CONFIG_USB_LEGOTOWER is not set
1070# CONFIG_USB_LCD is not set
1071# CONFIG_USB_LED is not set
1072# CONFIG_USB_CYTHERM is not set
1073# CONFIG_USB_PHIDGETKIT is not set
1074# CONFIG_USB_PHIDGETSERVO is not set
1075# CONFIG_USB_IDMOUSE is not set
1076# CONFIG_USB_SISUSBVGA is not set
1077# CONFIG_USB_LD is not set
1078# CONFIG_USB_TEST is not set
1079
1080#
1081# USB DSL modem support
1082#
1083
1084#
1085# USB Gadget Support
1086#
1087# CONFIG_USB_GADGET is not set
1088
1089#
1090# MMC/SD Card support
1091#
1092# CONFIG_MMC is not set
1093
1094#
1095# InfiniBand support
1096#
1097CONFIG_INFINIBAND=m
1098# CONFIG_INFINIBAND_USER_MAD is not set
1099# CONFIG_INFINIBAND_USER_ACCESS is not set
1100CONFIG_INFINIBAND_MTHCA=m
1101# CONFIG_INFINIBAND_MTHCA_DEBUG is not set
1102CONFIG_INFINIBAND_IPOIB=m
1103# CONFIG_INFINIBAND_IPOIB_DEBUG is not set
1104# CONFIG_INFINIBAND_SRP is not set
1105
1106#
1107# SN Devices
1108#
1109CONFIG_SGI_IOC4=y
1110CONFIG_SGI_IOC3=y
1111
1112#
1113# EDAC - error detection and reporting (RAS)
1114#
1115
1116#
1117# File systems
1118#
1119CONFIG_EXT2_FS=y
1120CONFIG_EXT2_FS_XATTR=y
1121CONFIG_EXT2_FS_POSIX_ACL=y 51CONFIG_EXT2_FS_POSIX_ACL=y
1122CONFIG_EXT2_FS_SECURITY=y 52CONFIG_EXT2_FS_SECURITY=y
1123# CONFIG_EXT2_FS_XIP is not set 53CONFIG_EXT2_FS_XATTR=y
1124CONFIG_EXT3_FS=y 54CONFIG_EXT2_FS=y
1125CONFIG_EXT3_FS_XATTR=y
1126CONFIG_EXT3_FS_POSIX_ACL=y 55CONFIG_EXT3_FS_POSIX_ACL=y
1127CONFIG_EXT3_FS_SECURITY=y 56CONFIG_EXT3_FS_SECURITY=y
1128CONFIG_JBD=y 57CONFIG_EXT3_FS=y
1129# CONFIG_JBD_DEBUG is not set 58CONFIG_FUSION_FC=m
1130CONFIG_FS_MBCACHE=y 59CONFIG_FUSION_SPI=y
1131CONFIG_REISERFS_FS=y 60CONFIG_FUSION=y
1132# CONFIG_REISERFS_CHECK is not set 61CONFIG_GAMEPORT=m
1133# CONFIG_REISERFS_PROC_INFO is not set 62CONFIG_HOTPLUG_CPU=y
1134CONFIG_REISERFS_FS_XATTR=y 63CONFIG_HOTPLUG_PCI_ACPI=m
1135CONFIG_REISERFS_FS_POSIX_ACL=y 64CONFIG_HOTPLUG_PCI=m
1136CONFIG_REISERFS_FS_SECURITY=y 65CONFIG_HPET=y
1137# CONFIG_JFS_FS is not set 66CONFIG_HUGETLBFS=y
1138CONFIG_FS_POSIX_ACL=y 67# CONFIG_HW_RANDOM is not set
1139CONFIG_XFS_FS=y 68CONFIG_IA64_CYCLONE=y
1140CONFIG_XFS_EXPORT=y 69CONFIG_IA64_MCA_RECOVERY=y
1141# CONFIG_XFS_QUOTA is not set 70CONFIG_IA64_PALINFO=y
1142# CONFIG_XFS_SECURITY is not set 71CONFIG_IDE_GENERIC=y
1143# CONFIG_XFS_POSIX_ACL is not set 72CONFIG_IDE=y
1144# CONFIG_XFS_RT is not set 73CONFIG_IKCONFIG_PROC=y
1145# CONFIG_OCFS2_FS is not set 74CONFIG_IKCONFIG=y
1146# CONFIG_MINIX_FS is not set 75CONFIG_INET=y
1147# CONFIG_ROMFS_FS is not set 76CONFIG_INFINIBAND_IPOIB=m
77CONFIG_INFINIBAND=m
78CONFIG_INFINIBAND_MTHCA=m
1148CONFIG_INOTIFY=y 79CONFIG_INOTIFY=y
1149# CONFIG_QUOTA is not set 80CONFIG_IP_MULTICAST=y
1150CONFIG_DNOTIFY=y 81# CONFIG_IPV6 is not set
1151CONFIG_AUTOFS_FS=y
1152CONFIG_AUTOFS4_FS=y
1153# CONFIG_FUSE_FS is not set
1154
1155#
1156# CD-ROM/DVD Filesystems
1157#
1158CONFIG_ISO9660_FS=m 82CONFIG_ISO9660_FS=m
1159CONFIG_JOLIET=y 83CONFIG_JOLIET=y
1160# CONFIG_ZISOFS is not set 84CONFIG_KALLSYMS_ALL=y
1161CONFIG_UDF_FS=m 85CONFIG_LOG_BUF_SHIFT=20
1162CONFIG_UDF_NLS=y 86CONFIG_MAGIC_SYSRQ=y
1163 87CONFIG_MCKINLEY=y
1164# 88CONFIG_MD_LINEAR=m
1165# DOS/FAT/NT Filesystems 89CONFIG_MD_MULTIPATH=m
1166# 90CONFIG_MD_RAID0=m
1167CONFIG_FAT_FS=y 91CONFIG_MD_RAID1=m
1168# CONFIG_MSDOS_FS is not set 92CONFIG_MD=y
1169CONFIG_VFAT_FS=y 93CONFIG_MODULES=y
1170CONFIG_FAT_DEFAULT_CODEPAGE=437 94CONFIG_MODULE_UNLOAD=y
1171CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" 95CONFIG_MODVERSIONS=y
1172CONFIG_NTFS_FS=m 96CONFIG_NETCONSOLE=y
1173# CONFIG_NTFS_DEBUG is not set 97CONFIG_NETDEVICES=y
1174# CONFIG_NTFS_RW is not set 98CONFIG_NET_ETHERNET=y
1175 99CONFIG_NET_PCI=y
1176# 100CONFIG_NET_TULIP=y
1177# Pseudo filesystems 101CONFIG_NFSD=m
1178# 102CONFIG_NFSD_V4=y
1179CONFIG_PROC_FS=y
1180CONFIG_PROC_KCORE=y
1181CONFIG_SYSFS=y
1182CONFIG_TMPFS=y
1183CONFIG_HUGETLBFS=y
1184CONFIG_HUGETLB_PAGE=y
1185CONFIG_RAMFS=y
1186# CONFIG_RELAYFS_FS is not set
1187# CONFIG_CONFIGFS_FS is not set
1188
1189#
1190# Miscellaneous filesystems
1191#
1192# CONFIG_ADFS_FS is not set
1193# CONFIG_AFFS_FS is not set
1194# CONFIG_HFS_FS is not set
1195# CONFIG_HFSPLUS_FS is not set
1196# CONFIG_BEFS_FS is not set
1197# CONFIG_BFS_FS is not set
1198# CONFIG_EFS_FS is not set
1199# CONFIG_CRAMFS is not set
1200# CONFIG_VXFS_FS is not set
1201# CONFIG_HPFS_FS is not set
1202# CONFIG_QNX4FS_FS is not set
1203# CONFIG_SYSV_FS is not set
1204# CONFIG_UFS_FS is not set
1205
1206#
1207# Network File Systems
1208#
1209CONFIG_NFS_FS=m 103CONFIG_NFS_FS=m
1210CONFIG_NFS_V3=y 104CONFIG_NFS_V3=y
1211# CONFIG_NFS_V3_ACL is not set
1212CONFIG_NFS_V4=y 105CONFIG_NFS_V4=y
1213CONFIG_NFS_DIRECTIO=y 106CONFIG_NLS_CODEPAGE_1250=m
1214CONFIG_NFSD=m 107CONFIG_NLS_CODEPAGE_1251=m
1215CONFIG_NFSD_V3=y
1216# CONFIG_NFSD_V3_ACL is not set
1217CONFIG_NFSD_V4=y
1218CONFIG_NFSD_TCP=y
1219CONFIG_LOCKD=m
1220CONFIG_LOCKD_V4=y
1221CONFIG_EXPORTFS=y
1222CONFIG_NFS_COMMON=y
1223CONFIG_SUNRPC=m
1224CONFIG_SUNRPC_GSS=m
1225CONFIG_RPCSEC_GSS_KRB5=m
1226# CONFIG_RPCSEC_GSS_SPKM3 is not set
1227CONFIG_SMB_FS=m
1228CONFIG_SMB_NLS_DEFAULT=y
1229CONFIG_SMB_NLS_REMOTE="cp437"
1230CONFIG_CIFS=m
1231# CONFIG_CIFS_STATS is not set
1232# CONFIG_CIFS_XATTR is not set
1233# CONFIG_CIFS_EXPERIMENTAL is not set
1234# CONFIG_NCP_FS is not set
1235# CONFIG_CODA_FS is not set
1236# CONFIG_AFS_FS is not set
1237# CONFIG_9P_FS is not set
1238
1239#
1240# Partition Types
1241#
1242CONFIG_PARTITION_ADVANCED=y
1243# CONFIG_ACORN_PARTITION is not set
1244# CONFIG_OSF_PARTITION is not set
1245# CONFIG_AMIGA_PARTITION is not set
1246# CONFIG_ATARI_PARTITION is not set
1247# CONFIG_MAC_PARTITION is not set
1248CONFIG_MSDOS_PARTITION=y
1249# CONFIG_BSD_DISKLABEL is not set
1250# CONFIG_MINIX_SUBPARTITION is not set
1251# CONFIG_SOLARIS_X86_PARTITION is not set
1252# CONFIG_UNIXWARE_DISKLABEL is not set
1253# CONFIG_LDM_PARTITION is not set
1254CONFIG_SGI_PARTITION=y
1255# CONFIG_ULTRIX_PARTITION is not set
1256# CONFIG_SUN_PARTITION is not set
1257# CONFIG_KARMA_PARTITION is not set
1258CONFIG_EFI_PARTITION=y
1259
1260#
1261# Native Language Support
1262#
1263CONFIG_NLS=y
1264CONFIG_NLS_DEFAULT="iso8859-1"
1265CONFIG_NLS_CODEPAGE_437=y 108CONFIG_NLS_CODEPAGE_437=y
1266CONFIG_NLS_CODEPAGE_737=m 109CONFIG_NLS_CODEPAGE_737=m
1267CONFIG_NLS_CODEPAGE_775=m 110CONFIG_NLS_CODEPAGE_775=m
@@ -1277,15 +120,14 @@ CONFIG_NLS_CODEPAGE_864=m
1277CONFIG_NLS_CODEPAGE_865=m 120CONFIG_NLS_CODEPAGE_865=m
1278CONFIG_NLS_CODEPAGE_866=m 121CONFIG_NLS_CODEPAGE_866=m
1279CONFIG_NLS_CODEPAGE_869=m 122CONFIG_NLS_CODEPAGE_869=m
1280CONFIG_NLS_CODEPAGE_936=m 123CONFIG_NLS_CODEPAGE_874=m
1281CONFIG_NLS_CODEPAGE_950=m
1282CONFIG_NLS_CODEPAGE_932=m 124CONFIG_NLS_CODEPAGE_932=m
125CONFIG_NLS_CODEPAGE_936=m
1283CONFIG_NLS_CODEPAGE_949=m 126CONFIG_NLS_CODEPAGE_949=m
1284CONFIG_NLS_CODEPAGE_874=m 127CONFIG_NLS_CODEPAGE_950=m
1285CONFIG_NLS_ISO8859_8=m 128CONFIG_NLS_ISO8859_13=m
1286CONFIG_NLS_CODEPAGE_1250=m 129CONFIG_NLS_ISO8859_14=m
1287CONFIG_NLS_CODEPAGE_1251=m 130CONFIG_NLS_ISO8859_15=m
1288# CONFIG_NLS_ASCII is not set
1289CONFIG_NLS_ISO8859_1=y 131CONFIG_NLS_ISO8859_1=y
1290CONFIG_NLS_ISO8859_2=m 132CONFIG_NLS_ISO8859_2=m
1291CONFIG_NLS_ISO8859_3=m 133CONFIG_NLS_ISO8859_3=m
@@ -1293,100 +135,77 @@ CONFIG_NLS_ISO8859_4=m
1293CONFIG_NLS_ISO8859_5=m 135CONFIG_NLS_ISO8859_5=m
1294CONFIG_NLS_ISO8859_6=m 136CONFIG_NLS_ISO8859_6=m
1295CONFIG_NLS_ISO8859_7=m 137CONFIG_NLS_ISO8859_7=m
138CONFIG_NLS_ISO8859_8=m
1296CONFIG_NLS_ISO8859_9=m 139CONFIG_NLS_ISO8859_9=m
1297CONFIG_NLS_ISO8859_13=m
1298CONFIG_NLS_ISO8859_14=m
1299CONFIG_NLS_ISO8859_15=m
1300CONFIG_NLS_KOI8_R=m 140CONFIG_NLS_KOI8_R=m
1301CONFIG_NLS_KOI8_U=m 141CONFIG_NLS_KOI8_U=m
1302CONFIG_NLS_UTF8=m 142CONFIG_NLS_UTF8=m
1303 143CONFIG_NR_CPUS=512
1304# 144CONFIG_NTFS_FS=m
1305# Library routines 145CONFIG_PACKET=y
1306# 146CONFIG_PARTITION_ADVANCED=y
1307# CONFIG_CRC_CCITT is not set 147CONFIG_PERFMON=y
1308# CONFIG_CRC16 is not set 148CONFIG_POSIX_MQUEUE=y
1309CONFIG_CRC32=y 149CONFIG_PROC_KCORE=y
1310# CONFIG_LIBCRC32C is not set 150CONFIG_RAW_DRIVER=m
1311CONFIG_GENERIC_HARDIRQS=y 151CONFIG_REISERFS_FS_POSIX_ACL=y
1312CONFIG_GENERIC_IRQ_PROBE=y 152CONFIG_REISERFS_FS_SECURITY=y
1313CONFIG_GENERIC_PENDING_IRQ=y 153CONFIG_REISERFS_FS_XATTR=y
1314 154CONFIG_REISERFS_FS=y
1315# 155CONFIG_SCSI_FC_ATTRS=y
1316# HP Simulator drivers 156CONFIG_SCSI_QLOGIC_1280=y
1317# 157CONFIG_SCSI_SYM53C8XX_2=y
1318# CONFIG_HP_SIMETH is not set 158CONFIG_SCSI=y
1319# CONFIG_HP_SIMSERIAL is not set 159CONFIG_SERIAL_8250_CONSOLE=y
1320# CONFIG_HP_SIMSCSI is not set 160CONFIG_SERIAL_8250_EXTENDED=y
1321 161CONFIG_SERIAL_8250_NR_UARTS=6
1322# 162CONFIG_SERIAL_8250_SHARE_IRQ=y
1323# Instrumentation Support 163CONFIG_SERIAL_8250=y
1324# 164CONFIG_SERIAL_NONSTANDARD=y
1325# CONFIG_PROFILING is not set 165CONFIG_SERIAL_SGI_IOC3=y
1326# CONFIG_KPROBES is not set 166CONFIG_SERIAL_SGI_IOC4=y
1327 167CONFIG_SERIAL_SGI_L1_CONSOLE=y
1328# 168# CONFIG_SERIO_SERPORT is not set
1329# Kernel hacking 169CONFIG_SGI_IOC3=y
1330# 170CONFIG_SGI_IOC4=y
1331# CONFIG_PRINTK_TIME is not set 171CONFIG_SGI_MBCS=m
1332CONFIG_MAGIC_SYSRQ=y 172CONFIG_SGI_PARTITION=y
1333CONFIG_DEBUG_KERNEL=y 173CONFIG_SGI_SNSC=y
1334CONFIG_LOG_BUF_SHIFT=20 174CONFIG_SGI_TIOCX=y
1335CONFIG_DETECT_SOFTLOCKUP=y 175CONFIG_SMB_FS=m
1336# CONFIG_SCHEDSTATS is not set 176CONFIG_SMB_NLS_DEFAULT=y
1337# CONFIG_DEBUG_SLAB is not set 177CONFIG_SMP=y
1338CONFIG_DEBUG_MUTEXES=y 178CONFIG_SND_CS4281=m
1339# CONFIG_DEBUG_SPINLOCK is not set 179CONFIG_SND_CS46XX=m
1340# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 180CONFIG_SND_DUMMY=m
1341# CONFIG_DEBUG_KOBJECT is not set 181CONFIG_SND_EMU10K1=m
1342# CONFIG_DEBUG_INFO is not set 182CONFIG_SND_FM801=m
1343# CONFIG_DEBUG_FS is not set 183CONFIG_SND=m
1344# CONFIG_DEBUG_VM is not set 184CONFIG_SND_MIXER_OSS=m
1345CONFIG_FORCED_INLINING=y 185CONFIG_SND_MPU401=m
1346# CONFIG_RCU_TORTURE_TEST is not set 186CONFIG_SND_MTPAV=m
1347CONFIG_IA64_GRANULE_16MB=y 187CONFIG_SND_PCM_OSS=m
1348# CONFIG_IA64_GRANULE_64MB is not set 188CONFIG_SND_SEQ_DUMMY=m
1349# CONFIG_IA64_PRINT_HAZARDS is not set 189CONFIG_SND_SEQUENCER=m
1350# CONFIG_DISABLE_VHPT is not set 190CONFIG_SND_SEQUENCER_OSS=y
1351# CONFIG_IA64_DEBUG_CMPXCHG is not set 191CONFIG_SND_SERIAL_U16550=m
1352# CONFIG_IA64_DEBUG_IRQ is not set 192CONFIG_SND_VERBOSE_PRINTK=y
1353CONFIG_SYSVIPC_COMPAT=y 193CONFIG_SND_VIRMIDI=m
1354 194CONFIG_SOUND=m
1355# 195CONFIG_SPARSEMEM_MANUAL=y
1356# Security options 196CONFIG_SYN_COOKIES=y
1357# 197CONFIG_SYSVIPC=y
1358# CONFIG_KEYS is not set 198CONFIG_TIGON3=y
1359# CONFIG_SECURITY is not set 199CONFIG_TMPFS=y
1360 200CONFIG_TULIP=m
1361# 201CONFIG_UDF_FS=m
1362# Cryptographic options 202CONFIG_UNIX=y
1363# 203CONFIG_USB_DEVICEFS=y
1364CONFIG_CRYPTO=y 204CONFIG_USB_EHCI_HCD=m
1365# CONFIG_CRYPTO_HMAC is not set 205CONFIG_USB=m
1366# CONFIG_CRYPTO_NULL is not set 206CONFIG_USB_MON=m
1367# CONFIG_CRYPTO_MD4 is not set 207CONFIG_USB_OHCI_HCD=m
1368CONFIG_CRYPTO_MD5=y 208CONFIG_USB_STORAGE=m
1369# CONFIG_CRYPTO_SHA1 is not set 209CONFIG_USB_UHCI_HCD=m
1370# CONFIG_CRYPTO_SHA256 is not set 210CONFIG_VFAT_FS=y
1371# CONFIG_CRYPTO_SHA512 is not set 211CONFIG_XFS_FS=y
1372# CONFIG_CRYPTO_WP512 is not set
1373# CONFIG_CRYPTO_TGR192 is not set
1374CONFIG_CRYPTO_DES=m
1375# CONFIG_CRYPTO_BLOWFISH is not set
1376# CONFIG_CRYPTO_TWOFISH is not set
1377# CONFIG_CRYPTO_SERPENT is not set
1378# CONFIG_CRYPTO_AES is not set
1379# CONFIG_CRYPTO_CAST5 is not set
1380# CONFIG_CRYPTO_CAST6 is not set
1381# CONFIG_CRYPTO_TEA is not set
1382# CONFIG_CRYPTO_ARC4 is not set
1383# CONFIG_CRYPTO_KHAZAD is not set
1384# CONFIG_CRYPTO_ANUBIS is not set
1385# CONFIG_CRYPTO_DEFLATE is not set
1386# CONFIG_CRYPTO_MICHAEL_MIC is not set
1387# CONFIG_CRYPTO_CRC32C is not set
1388# CONFIG_CRYPTO_TEST is not set
1389
1390#
1391# Hardware crypto devices
1392#
diff --git a/arch/ia64/configs/sim_defconfig b/arch/ia64/configs/sim_defconfig
index 21a23cdfd41c..585222b368c3 100644
--- a/arch/ia64/configs/sim_defconfig
+++ b/arch/ia64/configs/sim_defconfig
@@ -1,723 +1,57 @@
1# 1CONFIG_BINFMT_MISC=y
2# Automatically generated make config: don't edit 2CONFIG_BLK_DEV_LOOP=y
3# Linux kernel version: 2.6.16-rc5 3CONFIG_BLK_DEV_RAM=y
4# Mon Feb 27 16:13:41 2006 4CONFIG_BLK_DEV_SD=y
5#
6
7#
8# Code maturity level options
9#
10CONFIG_EXPERIMENTAL=y
11CONFIG_LOCK_KERNEL=y
12CONFIG_INIT_ENV_ARG_LIMIT=32
13
14#
15# General setup
16#
17CONFIG_LOCALVERSION=""
18CONFIG_LOCALVERSION_AUTO=y
19CONFIG_SWAP=y
20CONFIG_SYSVIPC=y
21# CONFIG_POSIX_MQUEUE is not set
22# CONFIG_BSD_PROCESS_ACCT is not set
23CONFIG_SYSCTL=y
24# CONFIG_AUDIT is not set
25CONFIG_IKCONFIG=y
26CONFIG_IKCONFIG_PROC=y
27# CONFIG_CPUSETS is not set
28CONFIG_INITRAMFS_SOURCE=""
29# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 5# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
30# CONFIG_EMBEDDED is not set 6CONFIG_DEBUG_INFO=y
31CONFIG_KALLSYMS=y 7CONFIG_DEBUG_KERNEL=y
32# CONFIG_KALLSYMS_ALL is not set 8CONFIG_DEBUG_MUTEXES=y
33# CONFIG_KALLSYMS_EXTRA_PASS is not set 9CONFIG_EFI_PARTITION=y
34CONFIG_HOTPLUG=y 10CONFIG_EFI_RTC=y
35CONFIG_PRINTK=y 11CONFIG_EFI_VARS=y
36CONFIG_BUG=y 12CONFIG_EXPERIMENTAL=y
37CONFIG_ELF_CORE=y 13CONFIG_EXT2_FS=y
38CONFIG_BASE_FULL=y 14# CONFIG_EXT3_FS_XATTR is not set
39CONFIG_FUTEX=y 15CONFIG_EXT3_FS=y
40CONFIG_EPOLL=y 16CONFIG_HP_SIMETH=y
41CONFIG_SHMEM=y 17CONFIG_HP_SIMSCSI=y
42CONFIG_CC_ALIGN_FUNCTIONS=0 18CONFIG_HP_SIMSERIAL_CONSOLE=y
43CONFIG_CC_ALIGN_LABELS=0 19CONFIG_HP_SIMSERIAL=y
44CONFIG_CC_ALIGN_LOOPS=0 20CONFIG_HUGETLBFS=y
45CONFIG_CC_ALIGN_JUMPS=0
46CONFIG_SLUB=y
47# CONFIG_TINY_SHMEM is not set
48CONFIG_BASE_SMALL=0
49# CONFIG_SLOB is not set
50
51#
52# Loadable module support
53#
54CONFIG_MODULES=y
55CONFIG_MODULE_UNLOAD=y
56CONFIG_MODULE_FORCE_UNLOAD=y
57CONFIG_OBSOLETE_MODPARM=y
58CONFIG_MODVERSIONS=y
59# CONFIG_MODULE_SRCVERSION_ALL is not set
60CONFIG_KMOD=y
61CONFIG_STOP_MACHINE=y
62
63#
64# Block layer
65#
66
67#
68# IO Schedulers
69#
70CONFIG_IOSCHED_NOOP=y
71CONFIG_IOSCHED_AS=y
72CONFIG_IOSCHED_DEADLINE=y
73CONFIG_IOSCHED_CFQ=y
74CONFIG_DEFAULT_AS=y
75# CONFIG_DEFAULT_DEADLINE is not set
76# CONFIG_DEFAULT_CFQ is not set
77# CONFIG_DEFAULT_NOOP is not set
78CONFIG_DEFAULT_IOSCHED="anticipatory"
79
80#
81# Processor type and features
82#
83CONFIG_IA64=y
84CONFIG_64BIT=y
85CONFIG_MMU=y
86CONFIG_SWIOTLB=y
87CONFIG_RWSEM_XCHGADD_ALGORITHM=y
88CONFIG_GENERIC_CALIBRATE_DELAY=y
89CONFIG_GENERIC_TIME=y
90CONFIG_EFI=y
91CONFIG_GENERIC_IOMAP=y
92CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
93CONFIG_DMA_IS_DMA32=y
94# CONFIG_IA64_GENERIC is not set
95# CONFIG_IA64_DIG is not set
96# CONFIG_IA64_HP_ZX1 is not set
97# CONFIG_IA64_HP_ZX1_SWIOTLB is not set
98# CONFIG_IA64_SGI_SN2 is not set
99CONFIG_IA64_HP_SIM=y 21CONFIG_IA64_HP_SIM=y
100# CONFIG_ITANIUM is not set
101CONFIG_MCKINLEY=y
102# CONFIG_IA64_PAGE_SIZE_4KB is not set
103# CONFIG_IA64_PAGE_SIZE_8KB is not set
104# CONFIG_IA64_PAGE_SIZE_16KB is not set
105CONFIG_IA64_PAGE_SIZE_64KB=y 22CONFIG_IA64_PAGE_SIZE_64KB=y
106CONFIG_PGTABLE_3=y
107# CONFIG_PGTABLE_4 is not set
108# CONFIG_HZ_100 is not set
109CONFIG_HZ_250=y
110# CONFIG_HZ_1000 is not set
111CONFIG_HZ=250
112CONFIG_IA64_L1_CACHE_SHIFT=7
113# CONFIG_IA64_CYCLONE is not set
114CONFIG_FORCE_MAX_ZONEORDER=17
115CONFIG_SMP=y
116CONFIG_NR_CPUS=64
117# CONFIG_HOTPLUG_CPU is not set
118# CONFIG_SCHED_SMT is not set
119CONFIG_PREEMPT=y
120CONFIG_SELECT_MEMORY_MODEL=y
121CONFIG_FLATMEM_MANUAL=y
122# CONFIG_DISCONTIGMEM_MANUAL is not set
123# CONFIG_SPARSEMEM_MANUAL is not set
124CONFIG_FLATMEM=y
125CONFIG_FLAT_NODE_MEM_MAP=y
126# CONFIG_SPARSEMEM_STATIC is not set
127CONFIG_SPLIT_PTLOCK_CPUS=4
128CONFIG_ARCH_SELECT_MEMORY_MODEL=y
129CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
130CONFIG_ARCH_FLATMEM_ENABLE=y
131CONFIG_ARCH_SPARSEMEM_ENABLE=y
132# CONFIG_VIRTUAL_MEM_MAP is not set
133# CONFIG_IA64_MCA_RECOVERY is not set
134# CONFIG_PERFMON is not set
135CONFIG_IA64_PALINFO=m 23CONFIG_IA64_PALINFO=m
136 24CONFIG_IKCONFIG_PROC=y
137# 25CONFIG_IKCONFIG=y
138# Firmware Drivers
139#
140CONFIG_EFI_VARS=y
141CONFIG_BINFMT_ELF=y
142CONFIG_BINFMT_MISC=y
143
144#
145# Power management and ACPI
146#
147
148#
149# Networking
150#
151CONFIG_NET=y
152
153#
154# Networking options
155#
156# CONFIG_NETDEBUG is not set
157CONFIG_PACKET=y
158# CONFIG_PACKET_MMAP is not set
159# CONFIG_UNIX is not set
160# CONFIG_NET_KEY is not set
161CONFIG_INET=y 26CONFIG_INET=y
27CONFIG_INOTIFY=y
28# CONFIG_INPUT_KEYBOARD is not set
29# CONFIG_INPUT_MOUSE is not set
162CONFIG_IP_MULTICAST=y 30CONFIG_IP_MULTICAST=y
163# CONFIG_IP_ADVANCED_ROUTER is not set
164CONFIG_IP_FIB_HASH=y
165# CONFIG_IP_PNP is not set
166# CONFIG_NET_IPIP is not set
167# CONFIG_NET_IPGRE is not set
168# CONFIG_IP_MROUTE is not set
169# CONFIG_ARPD is not set
170# CONFIG_SYN_COOKIES is not set
171# CONFIG_INET_AH is not set
172# CONFIG_INET_ESP is not set
173# CONFIG_INET_IPCOMP is not set
174# CONFIG_INET_TUNNEL is not set
175CONFIG_INET_DIAG=y
176CONFIG_INET_TCP_DIAG=y
177# CONFIG_TCP_CONG_ADVANCED is not set
178CONFIG_TCP_CONG_BIC=y
179# CONFIG_IPV6 is not set 31# CONFIG_IPV6 is not set
180# CONFIG_NETFILTER is not set 32# CONFIG_LEGACY_PTYS is not set
181 33CONFIG_LOG_BUF_SHIFT=16
182# 34CONFIG_MCKINLEY=y
183# DCCP Configuration (EXPERIMENTAL) 35CONFIG_MODULE_FORCE_UNLOAD=y
184# 36CONFIG_MODULES=y
185# CONFIG_IP_DCCP is not set 37CONFIG_MODULE_UNLOAD=y
186 38CONFIG_MODVERSIONS=y
187# 39CONFIG_NET=y
188# SCTP Configuration (EXPERIMENTAL) 40CONFIG_NFSD_V3=y
189# 41CONFIG_NFSD=y
190# CONFIG_IP_SCTP is not set 42CONFIG_NFS_FS=y
191 43CONFIG_NR_CPUS=64
192# 44CONFIG_PACKET=y
193# TIPC Configuration (EXPERIMENTAL) 45CONFIG_PARTITION_ADVANCED=y
194# 46CONFIG_PREEMPT=y
195# CONFIG_TIPC is not set 47CONFIG_PROC_KCORE=y
196# CONFIG_ATM is not set
197# CONFIG_BRIDGE is not set
198# CONFIG_VLAN_8021Q is not set
199# CONFIG_DECNET is not set
200# CONFIG_LLC2 is not set
201# CONFIG_IPX is not set
202# CONFIG_ATALK is not set
203# CONFIG_X25 is not set
204# CONFIG_LAPB is not set
205# CONFIG_NET_DIVERT is not set
206# CONFIG_ECONET is not set
207# CONFIG_WAN_ROUTER is not set
208
209#
210# QoS and/or fair queueing
211#
212# CONFIG_NET_SCHED is not set
213
214#
215# Network testing
216#
217# CONFIG_NET_PKTGEN is not set
218# CONFIG_HAMRADIO is not set
219# CONFIG_IRDA is not set
220# CONFIG_BT is not set
221# CONFIG_IEEE80211 is not set
222
223#
224# Device Drivers
225#
226
227#
228# Generic Driver Options
229#
230# CONFIG_STANDALONE is not set
231CONFIG_PREVENT_FIRMWARE_BUILD=y
232# CONFIG_FW_LOADER is not set
233# CONFIG_DEBUG_DRIVER is not set
234
235#
236# Connector - unified userspace <-> kernelspace linker
237#
238# CONFIG_CONNECTOR is not set
239
240#
241# Memory Technology Devices (MTD)
242#
243# CONFIG_MTD is not set
244
245#
246# Parallel port support
247#
248# CONFIG_PARPORT is not set
249
250#
251# Plug and Play support
252#
253
254#
255# Block devices
256#
257# CONFIG_BLK_DEV_COW_COMMON is not set
258CONFIG_BLK_DEV_LOOP=y
259# CONFIG_BLK_DEV_CRYPTOLOOP is not set
260# CONFIG_BLK_DEV_NBD is not set
261CONFIG_BLK_DEV_RAM=y
262CONFIG_BLK_DEV_RAM_COUNT=16
263CONFIG_BLK_DEV_RAM_SIZE=4096
264# CONFIG_BLK_DEV_INITRD is not set
265# CONFIG_CDROM_PKTCDVD is not set
266# CONFIG_ATA_OVER_ETH is not set
267
268#
269# ATA/ATAPI/MFM/RLL support
270#
271# CONFIG_IDE is not set
272
273#
274# SCSI device support
275#
276# CONFIG_RAID_ATTRS is not set
277CONFIG_SCSI=y
278CONFIG_SCSI_PROC_FS=y
279
280#
281# SCSI support type (disk, tape, CD-ROM)
282#
283CONFIG_BLK_DEV_SD=y
284# CONFIG_CHR_DEV_ST is not set
285# CONFIG_CHR_DEV_OSST is not set
286# CONFIG_BLK_DEV_SR is not set
287# CONFIG_CHR_DEV_SG is not set
288# CONFIG_CHR_DEV_SCH is not set
289
290#
291# Some SCSI devices (e.g. CD jukebox) support multiple LUNs
292#
293CONFIG_SCSI_MULTI_LUN=y
294CONFIG_SCSI_CONSTANTS=y 48CONFIG_SCSI_CONSTANTS=y
295CONFIG_SCSI_LOGGING=y 49CONFIG_SCSI_LOGGING=y
296 50CONFIG_SCSI_MULTI_LUN=y
297#
298# SCSI Transport Attributes
299#
300CONFIG_SCSI_SPI_ATTRS=y 51CONFIG_SCSI_SPI_ATTRS=y
301# CONFIG_SCSI_FC_ATTRS is not set 52CONFIG_SCSI=y
302# CONFIG_SCSI_ISCSI_ATTRS is not set
303# CONFIG_SCSI_SAS_ATTRS is not set
304
305#
306# SCSI low-level drivers
307#
308# CONFIG_ISCSI_TCP is not set
309# CONFIG_SCSI_SATA is not set
310# CONFIG_SCSI_DEBUG is not set
311
312#
313# Multi-device support (RAID and LVM)
314#
315# CONFIG_MD is not set
316
317#
318# Fusion MPT device support
319#
320# CONFIG_FUSION is not set
321
322#
323# IEEE 1394 (FireWire) support
324#
325
326#
327# I2O device support
328#
329
330#
331# Network device support
332#
333# CONFIG_NETDEVICES is not set
334# CONFIG_DUMMY is not set
335# CONFIG_BONDING is not set
336# CONFIG_EQUALIZER is not set
337# CONFIG_TUN is not set
338
339#
340# PHY device support
341#
342
343#
344# Ethernet (10 or 100Mbit)
345#
346# CONFIG_NET_ETHERNET is not set
347
348#
349# Ethernet (1000 Mbit)
350#
351
352#
353# Ethernet (10000 Mbit)
354#
355# CONFIG_PPP is not set
356# CONFIG_SLIP is not set
357# CONFIG_SHAPER is not set
358# CONFIG_NETCONSOLE is not set
359# CONFIG_NETPOLL is not set
360# CONFIG_NET_POLL_CONTROLLER is not set
361
362#
363# ISDN subsystem
364#
365# CONFIG_ISDN is not set
366
367#
368# Telephony Support
369#
370# CONFIG_PHONE is not set
371
372#
373# Input device support
374#
375CONFIG_INPUT=y
376
377#
378# Userland interfaces
379#
380CONFIG_INPUT_MOUSEDEV=y
381CONFIG_INPUT_MOUSEDEV_PSAUX=y
382CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
383CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
384# CONFIG_INPUT_JOYDEV is not set
385# CONFIG_INPUT_TSDEV is not set
386# CONFIG_INPUT_EVDEV is not set
387# CONFIG_INPUT_EVBUG is not set
388
389#
390# Input Device Drivers
391#
392# CONFIG_INPUT_KEYBOARD is not set
393# CONFIG_INPUT_MOUSE is not set
394# CONFIG_INPUT_JOYSTICK is not set
395# CONFIG_INPUT_TOUCHSCREEN is not set
396# CONFIG_INPUT_MISC is not set
397
398#
399# Hardware I/O ports
400#
401CONFIG_SERIO=y
402# CONFIG_SERIO_I8042 is not set 53# CONFIG_SERIO_I8042 is not set
403CONFIG_SERIO_SERPORT=y 54CONFIG_SMP=y
404# CONFIG_SERIO_RAW is not set 55# CONFIG_STANDALONE is not set
405# CONFIG_GAMEPORT is not set 56CONFIG_SYSVIPC=y
406
407#
408# Character devices
409#
410CONFIG_VT=y
411CONFIG_VT_CONSOLE=y
412CONFIG_HW_CONSOLE=y
413# CONFIG_SERIAL_NONSTANDARD is not set
414
415#
416# Serial drivers
417#
418# CONFIG_SERIAL_8250 is not set
419
420#
421# Non-8250 serial port support
422#
423CONFIG_UNIX98_PTYS=y
424# CONFIG_LEGACY_PTYS is not set
425
426#
427# IPMI
428#
429# CONFIG_IPMI_HANDLER is not set
430
431#
432# Watchdog Cards
433#
434# CONFIG_WATCHDOG is not set
435CONFIG_EFI_RTC=y
436# CONFIG_DTLK is not set
437# CONFIG_R3964 is not set
438
439#
440# Ftape, the floppy tape device driver
441#
442# CONFIG_AGP is not set
443# CONFIG_RAW_DRIVER is not set
444# CONFIG_HANGCHECK_TIMER is not set
445
446#
447# TPM devices
448#
449# CONFIG_TCG_TPM is not set
450# CONFIG_TELCLOCK is not set
451
452#
453# I2C support
454#
455# CONFIG_I2C is not set
456
457#
458# SPI support
459#
460# CONFIG_SPI is not set
461# CONFIG_SPI_MASTER is not set
462
463#
464# Dallas's 1-wire bus
465#
466# CONFIG_W1 is not set
467
468#
469# Hardware Monitoring support
470#
471CONFIG_HWMON=y
472# CONFIG_HWMON_VID is not set
473# CONFIG_SENSORS_F71805F is not set
474# CONFIG_HWMON_DEBUG_CHIP is not set
475
476#
477# Misc devices
478#
479
480#
481# Multimedia Capabilities Port drivers
482#
483
484#
485# Multimedia devices
486#
487# CONFIG_VIDEO_DEV is not set
488
489#
490# Digital Video Broadcasting Devices
491#
492# CONFIG_DVB is not set
493
494#
495# Graphics support
496#
497# CONFIG_FB is not set
498
499#
500# Console display driver support
501#
502# CONFIG_VGA_CONSOLE is not set 57# CONFIG_VGA_CONSOLE is not set
503CONFIG_DUMMY_CONSOLE=y
504
505#
506# Sound
507#
508# CONFIG_SOUND is not set
509
510#
511# USB support
512#
513# CONFIG_USB_ARCH_HAS_HCD is not set
514# CONFIG_USB_ARCH_HAS_OHCI is not set
515
516#
517# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
518#
519
520#
521# USB Gadget Support
522#
523# CONFIG_USB_GADGET is not set
524
525#
526# MMC/SD Card support
527#
528# CONFIG_MMC is not set
529
530#
531# InfiniBand support
532#
533
534#
535# EDAC - error detection and reporting (RAS)
536#
537
538#
539# File systems
540#
541CONFIG_EXT2_FS=y
542# CONFIG_EXT2_FS_XATTR is not set
543# CONFIG_EXT2_FS_XIP is not set
544CONFIG_EXT3_FS=y
545# CONFIG_EXT3_FS_XATTR is not set
546CONFIG_JBD=y
547# CONFIG_JBD_DEBUG is not set
548# CONFIG_REISERFS_FS is not set
549# CONFIG_JFS_FS is not set
550# CONFIG_FS_POSIX_ACL is not set
551# CONFIG_XFS_FS is not set
552# CONFIG_OCFS2_FS is not set
553# CONFIG_MINIX_FS is not set
554# CONFIG_ROMFS_FS is not set
555CONFIG_INOTIFY=y
556# CONFIG_QUOTA is not set
557CONFIG_DNOTIFY=y
558# CONFIG_AUTOFS_FS is not set
559# CONFIG_AUTOFS4_FS is not set
560# CONFIG_FUSE_FS is not set
561
562#
563# CD-ROM/DVD Filesystems
564#
565# CONFIG_ISO9660_FS is not set
566# CONFIG_UDF_FS is not set
567
568#
569# DOS/FAT/NT Filesystems
570#
571# CONFIG_MSDOS_FS is not set
572# CONFIG_VFAT_FS is not set
573# CONFIG_NTFS_FS is not set
574
575#
576# Pseudo filesystems
577#
578CONFIG_PROC_FS=y
579CONFIG_PROC_KCORE=y
580CONFIG_SYSFS=y
581# CONFIG_TMPFS is not set
582CONFIG_HUGETLBFS=y
583CONFIG_HUGETLB_PAGE=y
584CONFIG_RAMFS=y
585# CONFIG_RELAYFS_FS is not set
586# CONFIG_CONFIGFS_FS is not set
587
588#
589# Miscellaneous filesystems
590#
591# CONFIG_ADFS_FS is not set
592# CONFIG_AFFS_FS is not set
593# CONFIG_HFS_FS is not set
594# CONFIG_HFSPLUS_FS is not set
595# CONFIG_BEFS_FS is not set
596# CONFIG_BFS_FS is not set
597# CONFIG_EFS_FS is not set
598# CONFIG_CRAMFS is not set
599# CONFIG_VXFS_FS is not set
600# CONFIG_HPFS_FS is not set
601# CONFIG_QNX4FS_FS is not set
602# CONFIG_SYSV_FS is not set
603# CONFIG_UFS_FS is not set
604
605#
606# Network File Systems
607#
608CONFIG_NFS_FS=y
609# CONFIG_NFS_V3 is not set
610# CONFIG_NFS_V4 is not set
611CONFIG_NFS_DIRECTIO=y
612CONFIG_NFSD=y
613CONFIG_NFSD_V3=y
614# CONFIG_NFSD_V3_ACL is not set
615# CONFIG_NFSD_V4 is not set
616# CONFIG_NFSD_TCP is not set
617CONFIG_LOCKD=y
618CONFIG_LOCKD_V4=y
619CONFIG_EXPORTFS=y
620CONFIG_NFS_COMMON=y
621CONFIG_SUNRPC=y
622# CONFIG_RPCSEC_GSS_KRB5 is not set
623# CONFIG_RPCSEC_GSS_SPKM3 is not set
624# CONFIG_SMB_FS is not set
625# CONFIG_CIFS is not set
626# CONFIG_NCP_FS is not set
627# CONFIG_CODA_FS is not set
628# CONFIG_AFS_FS is not set
629# CONFIG_9P_FS is not set
630
631#
632# Partition Types
633#
634CONFIG_PARTITION_ADVANCED=y
635# CONFIG_ACORN_PARTITION is not set
636# CONFIG_OSF_PARTITION is not set
637# CONFIG_AMIGA_PARTITION is not set
638# CONFIG_ATARI_PARTITION is not set
639# CONFIG_MAC_PARTITION is not set
640CONFIG_MSDOS_PARTITION=y
641# CONFIG_BSD_DISKLABEL is not set
642# CONFIG_MINIX_SUBPARTITION is not set
643# CONFIG_SOLARIS_X86_PARTITION is not set
644# CONFIG_UNIXWARE_DISKLABEL is not set
645# CONFIG_LDM_PARTITION is not set
646# CONFIG_SGI_PARTITION is not set
647# CONFIG_ULTRIX_PARTITION is not set
648# CONFIG_SUN_PARTITION is not set
649# CONFIG_KARMA_PARTITION is not set
650CONFIG_EFI_PARTITION=y
651
652#
653# Native Language Support
654#
655# CONFIG_NLS is not set
656
657#
658# Library routines
659#
660# CONFIG_CRC_CCITT is not set
661# CONFIG_CRC16 is not set
662CONFIG_CRC32=y
663# CONFIG_LIBCRC32C is not set
664CONFIG_GENERIC_HARDIRQS=y
665CONFIG_GENERIC_IRQ_PROBE=y
666CONFIG_GENERIC_PENDING_IRQ=y
667
668#
669# HP Simulator drivers
670#
671CONFIG_HP_SIMETH=y
672CONFIG_HP_SIMSERIAL=y
673CONFIG_HP_SIMSERIAL_CONSOLE=y
674CONFIG_HP_SIMSCSI=y
675
676#
677# Instrumentation Support
678#
679# CONFIG_PROFILING is not set
680# CONFIG_KPROBES is not set
681
682#
683# Kernel hacking
684#
685# CONFIG_PRINTK_TIME is not set
686# CONFIG_MAGIC_SYSRQ is not set
687CONFIG_DEBUG_KERNEL=y
688CONFIG_LOG_BUF_SHIFT=16
689CONFIG_DETECT_SOFTLOCKUP=y
690# CONFIG_SCHEDSTATS is not set
691# CONFIG_DEBUG_SLAB is not set
692CONFIG_DEBUG_PREEMPT=y
693CONFIG_DEBUG_MUTEXES=y
694# CONFIG_DEBUG_SPINLOCK is not set
695# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
696# CONFIG_DEBUG_KOBJECT is not set
697CONFIG_DEBUG_INFO=y
698# CONFIG_DEBUG_FS is not set
699# CONFIG_DEBUG_VM is not set
700CONFIG_FORCED_INLINING=y
701# CONFIG_RCU_TORTURE_TEST is not set
702# CONFIG_IA64_GRANULE_16MB is not set
703CONFIG_IA64_GRANULE_64MB=y
704# CONFIG_IA64_PRINT_HAZARDS is not set
705# CONFIG_DISABLE_VHPT is not set
706# CONFIG_IA64_DEBUG_CMPXCHG is not set
707# CONFIG_IA64_DEBUG_IRQ is not set
708CONFIG_SYSVIPC_COMPAT=y
709
710#
711# Security options
712#
713# CONFIG_KEYS is not set
714# CONFIG_SECURITY is not set
715
716#
717# Cryptographic options
718#
719# CONFIG_CRYPTO is not set
720
721#
722# Hardware crypto devices
723#
diff --git a/arch/ia64/configs/tiger_defconfig b/arch/ia64/configs/tiger_defconfig
index c5a5ea9d54ae..498618ea00ea 100644
--- a/arch/ia64/configs/tiger_defconfig
+++ b/arch/ia64/configs/tiger_defconfig
@@ -1,1134 +1,113 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.22
4# Thu Jul 19 13:54:47 2007
5#
6CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
7
8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_LOCK_KERNEL=y
13CONFIG_INIT_ENV_ARG_LIMIT=32
14
15#
16# General setup
17#
18CONFIG_LOCALVERSION=""
19CONFIG_LOCALVERSION_AUTO=y
20CONFIG_SWAP=y
21CONFIG_SYSVIPC=y
22CONFIG_SYSVIPC_SYSCTL=y
23CONFIG_POSIX_MQUEUE=y
24# CONFIG_BSD_PROCESS_ACCT is not set
25# CONFIG_TASKSTATS is not set
26# CONFIG_USER_NS is not set
27# CONFIG_AUDIT is not set
28CONFIG_IKCONFIG=y
29CONFIG_IKCONFIG_PROC=y
30CONFIG_LOG_BUF_SHIFT=20
31# CONFIG_CPUSETS is not set
32CONFIG_SYSFS_DEPRECATED=y
33# CONFIG_RELAY is not set
34CONFIG_BLK_DEV_INITRD=y
35CONFIG_INITRAMFS_SOURCE=""
36CONFIG_CC_OPTIMIZE_FOR_SIZE=y
37CONFIG_SYSCTL=y
38# CONFIG_EMBEDDED is not set
39CONFIG_SYSCTL_SYSCALL=y
40CONFIG_KALLSYMS=y
41CONFIG_KALLSYMS_ALL=y
42# CONFIG_KALLSYMS_EXTRA_PASS is not set
43CONFIG_HOTPLUG=y
44CONFIG_PRINTK=y
45CONFIG_BUG=y
46CONFIG_ELF_CORE=y
47CONFIG_BASE_FULL=y
48CONFIG_FUTEX=y
49CONFIG_ANON_INODES=y
50CONFIG_EPOLL=y
51CONFIG_SIGNALFD=y
52CONFIG_TIMERFD=y
53CONFIG_EVENTFD=y
54CONFIG_SHMEM=y
55CONFIG_VM_EVENT_COUNTERS=y
56CONFIG_SLUB=y
57# CONFIG_SLUB is not set
58# CONFIG_SLOB is not set
59CONFIG_RT_MUTEXES=y
60# CONFIG_TINY_SHMEM is not set
61CONFIG_BASE_SMALL=0
62CONFIG_MODULES=y
63CONFIG_MODULE_UNLOAD=y
64# CONFIG_MODULE_FORCE_UNLOAD is not set
65CONFIG_MODVERSIONS=y
66CONFIG_MODULE_SRCVERSION_ALL=y
67CONFIG_KMOD=y
68CONFIG_STOP_MACHINE=y
69CONFIG_BLOCK=y
70# CONFIG_BLK_DEV_IO_TRACE is not set
71# CONFIG_BLK_DEV_BSG is not set
72
73#
74# IO Schedulers
75#
76CONFIG_IOSCHED_NOOP=y
77CONFIG_IOSCHED_AS=y
78CONFIG_IOSCHED_DEADLINE=y
79CONFIG_IOSCHED_CFQ=y
80CONFIG_DEFAULT_AS=y
81# CONFIG_DEFAULT_DEADLINE is not set
82# CONFIG_DEFAULT_CFQ is not set
83# CONFIG_DEFAULT_NOOP is not set
84CONFIG_DEFAULT_IOSCHED="anticipatory"
85
86#
87# Processor type and features
88#
89CONFIG_IA64=y
90CONFIG_64BIT=y
91CONFIG_ZONE_DMA=y
92CONFIG_QUICKLIST=y
93CONFIG_MMU=y
94CONFIG_SWIOTLB=y
95CONFIG_RWSEM_XCHGADD_ALGORITHM=y
96# CONFIG_ARCH_HAS_ILOG2_U32 is not set
97# CONFIG_ARCH_HAS_ILOG2_U64 is not set
98CONFIG_GENERIC_FIND_NEXT_BIT=y
99CONFIG_GENERIC_CALIBRATE_DELAY=y
100CONFIG_GENERIC_TIME=y
101CONFIG_DMI=y
102CONFIG_EFI=y
103CONFIG_GENERIC_IOMAP=y
104CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
105CONFIG_AUDIT_ARCH=y
106# CONFIG_IA64_GENERIC is not set
107CONFIG_IA64_DIG=y
108# CONFIG_IA64_HP_ZX1 is not set
109# CONFIG_IA64_HP_ZX1_SWIOTLB is not set
110# CONFIG_IA64_SGI_SN2 is not set
111# CONFIG_IA64_HP_SIM is not set
112# CONFIG_ITANIUM is not set
113CONFIG_MCKINLEY=y
114# CONFIG_IA64_PAGE_SIZE_4KB is not set
115# CONFIG_IA64_PAGE_SIZE_8KB is not set
116# CONFIG_IA64_PAGE_SIZE_16KB is not set
117CONFIG_IA64_PAGE_SIZE_64KB=y
118CONFIG_PGTABLE_3=y
119# CONFIG_PGTABLE_4 is not set
120# CONFIG_HZ_100 is not set
121CONFIG_HZ_250=y
122# CONFIG_HZ_300 is not set
123# CONFIG_HZ_1000 is not set
124CONFIG_HZ=250
125CONFIG_IA64_L1_CACHE_SHIFT=7
126CONFIG_IA64_CYCLONE=y
127CONFIG_IOSAPIC=y
128CONFIG_FORCE_MAX_ZONEORDER=17
129CONFIG_SMP=y
130CONFIG_NR_CPUS=16
131CONFIG_HOTPLUG_CPU=y
132CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
133# CONFIG_SCHED_SMT is not set
134CONFIG_PERMIT_BSP_REMOVE=y
135CONFIG_FORCE_CPEI_RETARGET=y
136# CONFIG_PREEMPT is not set
137CONFIG_SELECT_MEMORY_MODEL=y
138CONFIG_FLATMEM_MANUAL=y
139# CONFIG_DISCONTIGMEM_MANUAL is not set
140# CONFIG_SPARSEMEM_MANUAL is not set
141CONFIG_FLATMEM=y
142CONFIG_FLAT_NODE_MEM_MAP=y
143# CONFIG_SPARSEMEM_STATIC is not set
144CONFIG_SPLIT_PTLOCK_CPUS=4
145CONFIG_RESOURCES_64BIT=y
146CONFIG_ZONE_DMA_FLAG=1
147CONFIG_BOUNCE=y
148CONFIG_NR_QUICK=1
149CONFIG_VIRT_TO_BUS=y
150CONFIG_ARCH_SELECT_MEMORY_MODEL=y
151CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
152CONFIG_ARCH_FLATMEM_ENABLE=y
153CONFIG_ARCH_SPARSEMEM_ENABLE=y
154CONFIG_ARCH_POPULATES_NODE_MAP=y
155CONFIG_VIRTUAL_MEM_MAP=y
156CONFIG_HOLES_IN_ZONE=y
157CONFIG_IA64_MCA_RECOVERY=y
158CONFIG_PERFMON=y
159CONFIG_IA64_PALINFO=y
160# CONFIG_IA64_MC_ERR_INJECT is not set
161# CONFIG_IA64_ESI is not set
162CONFIG_KEXEC=y
163# CONFIG_CRASH_DUMP is not set
164
165#
166# Firmware Drivers
167#
168CONFIG_EFI_VARS=y
169CONFIG_EFI_PCDP=y
170CONFIG_DMIID=y
171CONFIG_BINFMT_ELF=y
172CONFIG_BINFMT_MISC=m
173
174# CONFIG_DMAR is not set
175
176#
177# Power management and ACPI
178#
179CONFIG_PM=y
180CONFIG_PM_LEGACY=y
181# CONFIG_PM_DEBUG is not set
182
183#
184# ACPI (Advanced Configuration and Power Interface) Support
185#
186CONFIG_ACPI=y
187CONFIG_ACPI_PROCFS=y
188CONFIG_ACPI_BUTTON=m 1CONFIG_ACPI_BUTTON=m
2CONFIG_ACPI_CONTAINER=m
189CONFIG_ACPI_FAN=m 3CONFIG_ACPI_FAN=m
190# CONFIG_ACPI_DOCK is not set
191CONFIG_ACPI_PROCESSOR=m 4CONFIG_ACPI_PROCESSOR=m
192CONFIG_ACPI_HOTPLUG_CPU=y 5CONFIG_ACPI_PROCFS=y
193CONFIG_ACPI_THERMAL=m 6CONFIG_AGP_I460=m
194CONFIG_ACPI_BLACKLIST_YEAR=0 7CONFIG_AGP=m
195# CONFIG_ACPI_DEBUG is not set
196CONFIG_ACPI_EC=y
197CONFIG_ACPI_POWER=y
198CONFIG_ACPI_SYSTEM=y
199CONFIG_ACPI_CONTAINER=m
200
201#
202# CPU Frequency scaling
203#
204# CONFIG_CPU_FREQ is not set
205
206#
207# Bus options (PCI, PCMCIA)
208#
209CONFIG_PCI=y
210CONFIG_PCI_DOMAINS=y
211CONFIG_PCI_SYSCALL=y
212# CONFIG_PCIEPORTBUS is not set
213CONFIG_ARCH_SUPPORTS_MSI=y
214# CONFIG_PCI_MSI is not set
215# CONFIG_PCI_DEBUG is not set
216CONFIG_HOTPLUG_PCI=m
217# CONFIG_HOTPLUG_PCI_FAKE is not set
218CONFIG_HOTPLUG_PCI_ACPI=m
219# CONFIG_HOTPLUG_PCI_ACPI_IBM is not set
220# CONFIG_HOTPLUG_PCI_CPCI is not set
221# CONFIG_HOTPLUG_PCI_SHPC is not set
222
223#
224# PCCARD (PCMCIA/CardBus) support
225#
226# CONFIG_PCCARD is not set
227
228#
229# Networking
230#
231CONFIG_NET=y
232
233#
234# Networking options
235#
236CONFIG_PACKET=y
237# CONFIG_PACKET_MMAP is not set
238CONFIG_UNIX=y
239CONFIG_XFRM=y
240# CONFIG_XFRM_USER is not set
241# CONFIG_XFRM_SUB_POLICY is not set
242# CONFIG_XFRM_MIGRATE is not set
243# CONFIG_NET_KEY is not set
244CONFIG_INET=y
245CONFIG_IP_MULTICAST=y
246# CONFIG_IP_ADVANCED_ROUTER is not set
247CONFIG_IP_FIB_HASH=y
248# CONFIG_IP_PNP is not set
249# CONFIG_NET_IPIP is not set
250# CONFIG_NET_IPGRE is not set
251# CONFIG_IP_MROUTE is not set
252CONFIG_ARPD=y 8CONFIG_ARPD=y
253CONFIG_SYN_COOKIES=y 9CONFIG_AUTOFS4_FS=y
254# CONFIG_INET_AH is not set 10CONFIG_AUTOFS_FS=y
255# CONFIG_INET_ESP is not set 11CONFIG_BINFMT_MISC=m
256# CONFIG_INET_IPCOMP is not set 12# CONFIG_BLK_DEV_BSG is not set
257# CONFIG_INET_XFRM_TUNNEL is not set 13CONFIG_BLK_DEV_CMD64X=y
258# CONFIG_INET_TUNNEL is not set
259CONFIG_INET_XFRM_MODE_TRANSPORT=y
260CONFIG_INET_XFRM_MODE_TUNNEL=y
261CONFIG_INET_XFRM_MODE_BEET=y
262CONFIG_INET_DIAG=y
263CONFIG_INET_TCP_DIAG=y
264# CONFIG_TCP_CONG_ADVANCED is not set
265CONFIG_TCP_CONG_CUBIC=y
266CONFIG_DEFAULT_TCP_CONG="cubic"
267# CONFIG_TCP_MD5SIG is not set
268# CONFIG_IPV6 is not set
269# CONFIG_INET6_XFRM_TUNNEL is not set
270# CONFIG_INET6_TUNNEL is not set
271# CONFIG_NETWORK_SECMARK is not set
272# CONFIG_NETFILTER is not set
273# CONFIG_IP_DCCP is not set
274# CONFIG_IP_SCTP is not set
275# CONFIG_TIPC is not set
276# CONFIG_ATM is not set
277# CONFIG_BRIDGE is not set
278# CONFIG_VLAN_8021Q is not set
279# CONFIG_DECNET is not set
280# CONFIG_LLC2 is not set
281# CONFIG_IPX is not set
282# CONFIG_ATALK is not set
283# CONFIG_X25 is not set
284# CONFIG_LAPB is not set
285# CONFIG_ECONET is not set
286# CONFIG_WAN_ROUTER is not set
287
288#
289# QoS and/or fair queueing
290#
291# CONFIG_NET_SCHED is not set
292
293#
294# Network testing
295#
296# CONFIG_NET_PKTGEN is not set
297# CONFIG_HAMRADIO is not set
298# CONFIG_IRDA is not set
299# CONFIG_BT is not set
300# CONFIG_AF_RXRPC is not set
301
302#
303# Wireless
304#
305# CONFIG_CFG80211 is not set
306# CONFIG_WIRELESS_EXT is not set
307# CONFIG_MAC80211 is not set
308# CONFIG_IEEE80211 is not set
309# CONFIG_RFKILL is not set
310# CONFIG_NET_9P is not set
311
312#
313# Device Drivers
314#
315
316#
317# Generic Driver Options
318#
319CONFIG_STANDALONE=y
320CONFIG_PREVENT_FIRMWARE_BUILD=y
321CONFIG_FW_LOADER=m
322# CONFIG_DEBUG_DRIVER is not set
323# CONFIG_DEBUG_DEVRES is not set
324# CONFIG_SYS_HYPERVISOR is not set
325# CONFIG_CONNECTOR is not set
326# CONFIG_MTD is not set
327# CONFIG_PARPORT is not set
328CONFIG_PNP=y
329# CONFIG_PNP_DEBUG is not set
330
331#
332# Protocols
333#
334CONFIG_PNPACPI=y
335CONFIG_BLK_DEV=y
336# CONFIG_BLK_CPQ_DA is not set
337# CONFIG_BLK_CPQ_CISS_DA is not set
338# CONFIG_BLK_DEV_DAC960 is not set
339# CONFIG_BLK_DEV_UMEM is not set
340# CONFIG_BLK_DEV_COW_COMMON is not set
341CONFIG_BLK_DEV_LOOP=m
342CONFIG_BLK_DEV_CRYPTOLOOP=m 14CONFIG_BLK_DEV_CRYPTOLOOP=m
343CONFIG_BLK_DEV_NBD=m 15CONFIG_BLK_DEV_DM=m
344# CONFIG_BLK_DEV_SX8 is not set
345# CONFIG_BLK_DEV_UB is not set
346CONFIG_BLK_DEV_RAM=y
347CONFIG_BLK_DEV_RAM_COUNT=16
348CONFIG_BLK_DEV_RAM_SIZE=4096
349CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
350# CONFIG_CDROM_PKTCDVD is not set
351# CONFIG_ATA_OVER_ETH is not set
352CONFIG_MISC_DEVICES=y
353# CONFIG_PHANTOM is not set
354# CONFIG_EEPROM_93CX6 is not set
355# CONFIG_SGI_IOC4 is not set
356# CONFIG_TIFM_CORE is not set
357CONFIG_IDE=y
358CONFIG_IDE_MAX_HWIFS=4
359CONFIG_BLK_DEV_IDE=y
360
361#
362# Please see Documentation/ide.txt for help/info on IDE drives
363#
364# CONFIG_BLK_DEV_IDE_SATA is not set
365CONFIG_BLK_DEV_IDEDISK=y
366# CONFIG_IDEDISK_MULTI_MODE is not set
367CONFIG_BLK_DEV_IDECD=y
368# CONFIG_BLK_DEV_IDETAPE is not set
369CONFIG_BLK_DEV_IDEFLOPPY=y
370CONFIG_BLK_DEV_IDESCSI=m
371# CONFIG_BLK_DEV_IDEACPI is not set
372# CONFIG_IDE_TASK_IOCTL is not set
373CONFIG_IDE_PROC_FS=y
374
375#
376# IDE chipset support/bugfixes
377#
378# CONFIG_IDE_GENERIC is not set
379# CONFIG_BLK_DEV_IDEPNP is not set
380CONFIG_BLK_DEV_IDEPCI=y
381# CONFIG_IDEPCI_SHARE_IRQ is not set
382CONFIG_IDEPCI_PCIBUS_ORDER=y
383# CONFIG_BLK_DEV_OFFBOARD is not set
384CONFIG_BLK_DEV_GENERIC=y 16CONFIG_BLK_DEV_GENERIC=y
385# CONFIG_BLK_DEV_OPTI621 is not set 17CONFIG_BLK_DEV_IDECD=y
386CONFIG_BLK_DEV_IDEDMA_PCI=y 18CONFIG_BLK_DEV_INITRD=y
387# CONFIG_BLK_DEV_IDEDMA_FORCED is not set 19CONFIG_BLK_DEV_LOOP=m
388# CONFIG_IDEDMA_ONLYDISK is not set 20CONFIG_BLK_DEV_MD=m
389# CONFIG_BLK_DEV_AEC62XX is not set 21CONFIG_BLK_DEV_NBD=m
390# CONFIG_BLK_DEV_ALI15X3 is not set
391# CONFIG_BLK_DEV_AMD74XX is not set
392CONFIG_BLK_DEV_CMD64X=y
393# CONFIG_BLK_DEV_TRIFLEX is not set
394# CONFIG_BLK_DEV_CY82C693 is not set
395# CONFIG_BLK_DEV_CS5520 is not set
396# CONFIG_BLK_DEV_CS5530 is not set
397# CONFIG_BLK_DEV_HPT34X is not set
398# CONFIG_BLK_DEV_HPT366 is not set
399# CONFIG_BLK_DEV_JMICRON is not set
400# CONFIG_BLK_DEV_SC1200 is not set
401CONFIG_BLK_DEV_PIIX=y 22CONFIG_BLK_DEV_PIIX=y
402# CONFIG_BLK_DEV_IT8213 is not set 23CONFIG_BLK_DEV_RAM=y
403# CONFIG_BLK_DEV_IT821X is not set
404# CONFIG_BLK_DEV_NS87415 is not set
405# CONFIG_BLK_DEV_PDC202XX_OLD is not set
406# CONFIG_BLK_DEV_PDC202XX_NEW is not set
407# CONFIG_BLK_DEV_SVWKS is not set
408# CONFIG_BLK_DEV_SIIMAGE is not set
409# CONFIG_BLK_DEV_SLC90E66 is not set
410# CONFIG_BLK_DEV_TRM290 is not set
411# CONFIG_BLK_DEV_VIA82CXXX is not set
412# CONFIG_BLK_DEV_TC86C001 is not set
413# CONFIG_IDE_ARM is not set
414CONFIG_BLK_DEV_IDEDMA=y
415# CONFIG_IDEDMA_IVB is not set
416# CONFIG_BLK_DEV_HD is not set
417
418#
419# SCSI device support
420#
421# CONFIG_RAID_ATTRS is not set
422CONFIG_SCSI=y
423CONFIG_SCSI_DMA=y
424# CONFIG_SCSI_TGT is not set
425CONFIG_SCSI_NETLINK=y
426CONFIG_SCSI_PROC_FS=y
427
428#
429# SCSI support type (disk, tape, CD-ROM)
430#
431CONFIG_BLK_DEV_SD=y 24CONFIG_BLK_DEV_SD=y
432CONFIG_CHR_DEV_ST=m
433# CONFIG_CHR_DEV_OSST is not set
434CONFIG_BLK_DEV_SR=m 25CONFIG_BLK_DEV_SR=m
435# CONFIG_BLK_DEV_SR_VENDOR is not set
436CONFIG_CHR_DEV_SG=m 26CONFIG_CHR_DEV_SG=m
437# CONFIG_CHR_DEV_SCH is not set 27CONFIG_CHR_DEV_ST=m
438 28CONFIG_CIFS=m
439# 29CONFIG_CRYPTO_ECB=m
440# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 30CONFIG_CRYPTO_MD5=y
441# 31CONFIG_CRYPTO_PCBC=m
442# CONFIG_SCSI_MULTI_LUN is not set 32CONFIG_DEBUG_KERNEL=y
443# CONFIG_SCSI_CONSTANTS is not set 33CONFIG_DEBUG_MUTEXES=y
444# CONFIG_SCSI_LOGGING is not set
445# CONFIG_SCSI_SCAN_ASYNC is not set
446CONFIG_SCSI_WAIT_SCAN=m
447
448#
449# SCSI Transports
450#
451CONFIG_SCSI_SPI_ATTRS=y
452CONFIG_SCSI_FC_ATTRS=y
453# CONFIG_SCSI_ISCSI_ATTRS is not set
454# CONFIG_SCSI_SAS_ATTRS is not set
455# CONFIG_SCSI_SAS_LIBSAS is not set
456
457#
458# SCSI low-level drivers
459#
460# CONFIG_ISCSI_TCP is not set
461# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
462# CONFIG_SCSI_3W_9XXX is not set
463# CONFIG_SCSI_ACARD is not set
464# CONFIG_SCSI_AACRAID is not set
465# CONFIG_SCSI_AIC7XXX is not set
466# CONFIG_SCSI_AIC7XXX_OLD is not set
467# CONFIG_SCSI_AIC79XX is not set
468# CONFIG_SCSI_AIC94XX is not set
469# CONFIG_SCSI_ARCMSR is not set
470# CONFIG_MEGARAID_NEWGEN is not set
471# CONFIG_MEGARAID_LEGACY is not set
472# CONFIG_MEGARAID_SAS is not set
473# CONFIG_SCSI_HPTIOP is not set
474# CONFIG_SCSI_DMX3191D is not set
475# CONFIG_SCSI_FUTURE_DOMAIN is not set
476# CONFIG_SCSI_IPS is not set
477# CONFIG_SCSI_INITIO is not set
478# CONFIG_SCSI_INIA100 is not set
479# CONFIG_SCSI_STEX is not set
480CONFIG_SCSI_SYM53C8XX_2=y
481CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
482CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
483CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
484CONFIG_SCSI_SYM53C8XX_MMIO=y
485CONFIG_SCSI_QLOGIC_1280=y
486# CONFIG_SCSI_QLA_FC is not set
487# CONFIG_SCSI_QLA_ISCSI is not set
488# CONFIG_SCSI_LPFC is not set
489# CONFIG_SCSI_DC395x is not set
490# CONFIG_SCSI_DC390T is not set
491# CONFIG_SCSI_DEBUG is not set
492# CONFIG_SCSI_SRP is not set
493# CONFIG_ATA is not set
494CONFIG_MD=y
495CONFIG_BLK_DEV_MD=m
496CONFIG_MD_LINEAR=m
497CONFIG_MD_RAID0=m
498CONFIG_MD_RAID1=m
499# CONFIG_MD_RAID10 is not set
500# CONFIG_MD_RAID456 is not set
501CONFIG_MD_MULTIPATH=m
502# CONFIG_MD_FAULTY is not set
503CONFIG_BLK_DEV_DM=m
504# CONFIG_DM_DEBUG is not set
505CONFIG_DM_CRYPT=m 34CONFIG_DM_CRYPT=m
506CONFIG_DM_SNAPSHOT=m
507CONFIG_DM_MIRROR=m 35CONFIG_DM_MIRROR=m
36CONFIG_DM_SNAPSHOT=m
508CONFIG_DM_ZERO=m 37CONFIG_DM_ZERO=m
509# CONFIG_DM_MULTIPATH is not set
510# CONFIG_DM_DELAY is not set
511
512#
513# Fusion MPT device support
514#
515CONFIG_FUSION=y
516CONFIG_FUSION_SPI=y
517CONFIG_FUSION_FC=y
518# CONFIG_FUSION_SAS is not set
519CONFIG_FUSION_MAX_SGE=128
520CONFIG_FUSION_CTL=y
521
522#
523# IEEE 1394 (FireWire) support
524#
525# CONFIG_FIREWIRE is not set
526# CONFIG_IEEE1394 is not set
527# CONFIG_I2O is not set
528CONFIG_NETDEVICES=y
529# CONFIG_NETDEVICES_MULTIQUEUE is not set
530CONFIG_DUMMY=m
531# CONFIG_BONDING is not set
532# CONFIG_MACVLAN is not set
533# CONFIG_EQUALIZER is not set
534# CONFIG_TUN is not set
535# CONFIG_NET_SB1000 is not set
536# CONFIG_ARCNET is not set
537# CONFIG_PHYLIB is not set
538CONFIG_NET_ETHERNET=y
539CONFIG_MII=m
540# CONFIG_HAPPYMEAL is not set
541# CONFIG_SUNGEM is not set
542# CONFIG_CASSINI is not set
543# CONFIG_NET_VENDOR_3COM is not set
544CONFIG_NET_TULIP=y
545# CONFIG_DE2104X is not set
546CONFIG_TULIP=m
547# CONFIG_TULIP_MWI is not set
548# CONFIG_TULIP_MMIO is not set
549# CONFIG_TULIP_NAPI is not set
550# CONFIG_DE4X5 is not set
551# CONFIG_WINBOND_840 is not set
552# CONFIG_DM9102 is not set
553# CONFIG_ULI526X is not set
554# CONFIG_HP100 is not set
555CONFIG_NET_PCI=y
556# CONFIG_PCNET32 is not set
557# CONFIG_AMD8111_ETH is not set
558# CONFIG_ADAPTEC_STARFIRE is not set
559# CONFIG_B44 is not set
560# CONFIG_FORCEDETH is not set
561# CONFIG_DGRS is not set
562CONFIG_EEPRO100=m
563CONFIG_E100=m
564# CONFIG_FEALNX is not set
565# CONFIG_NATSEMI is not set
566# CONFIG_NE2K_PCI is not set
567# CONFIG_8139CP is not set
568# CONFIG_8139TOO is not set
569# CONFIG_SIS900 is not set
570# CONFIG_EPIC100 is not set
571# CONFIG_SUNDANCE is not set
572# CONFIG_VIA_RHINE is not set
573# CONFIG_SC92031 is not set
574CONFIG_NETDEV_1000=y
575# CONFIG_ACENIC is not set
576# CONFIG_DL2K is not set
577CONFIG_E1000=y
578# CONFIG_E1000_NAPI is not set
579# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
580# CONFIG_NS83820 is not set
581# CONFIG_HAMACHI is not set
582# CONFIG_YELLOWFIN is not set
583# CONFIG_R8169 is not set
584# CONFIG_SIS190 is not set
585# CONFIG_SKGE is not set
586# CONFIG_SKY2 is not set
587# CONFIG_VIA_VELOCITY is not set
588CONFIG_TIGON3=y
589# CONFIG_BNX2 is not set
590# CONFIG_QLA3XXX is not set
591# CONFIG_ATL1 is not set
592CONFIG_NETDEV_10000=y
593# CONFIG_CHELSIO_T1 is not set
594# CONFIG_CHELSIO_T3 is not set
595# CONFIG_IXGB is not set
596# CONFIG_S2IO is not set
597# CONFIG_MYRI10GE is not set
598# CONFIG_NETXEN_NIC is not set
599# CONFIG_MLX4_CORE is not set
600# CONFIG_TR is not set
601
602#
603# Wireless LAN
604#
605# CONFIG_WLAN_PRE80211 is not set
606# CONFIG_WLAN_80211 is not set
607
608#
609# USB Network Adapters
610#
611# CONFIG_USB_CATC is not set
612# CONFIG_USB_KAWETH is not set
613# CONFIG_USB_PEGASUS is not set
614# CONFIG_USB_RTL8150 is not set
615# CONFIG_USB_USBNET_MII is not set
616# CONFIG_USB_USBNET is not set
617# CONFIG_WAN is not set
618# CONFIG_FDDI is not set
619# CONFIG_HIPPI is not set
620# CONFIG_PPP is not set
621# CONFIG_SLIP is not set
622# CONFIG_NET_FC is not set
623# CONFIG_SHAPER is not set
624CONFIG_NETCONSOLE=y
625CONFIG_NETPOLL=y
626# CONFIG_NETPOLL_TRAP is not set
627CONFIG_NET_POLL_CONTROLLER=y
628# CONFIG_ISDN is not set
629# CONFIG_PHONE is not set
630
631#
632# Input device support
633#
634CONFIG_INPUT=y
635# CONFIG_INPUT_FF_MEMLESS is not set
636# CONFIG_INPUT_POLLDEV is not set
637
638#
639# Userland interfaces
640#
641CONFIG_INPUT_MOUSEDEV=y
642CONFIG_INPUT_MOUSEDEV_PSAUX=y
643CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
644CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
645# CONFIG_INPUT_JOYDEV is not set
646# CONFIG_INPUT_TSDEV is not set
647# CONFIG_INPUT_EVDEV is not set
648# CONFIG_INPUT_EVBUG is not set
649
650#
651# Input Device Drivers
652#
653CONFIG_INPUT_KEYBOARD=y
654CONFIG_KEYBOARD_ATKBD=y
655# CONFIG_KEYBOARD_SUNKBD is not set
656# CONFIG_KEYBOARD_LKKBD is not set
657# CONFIG_KEYBOARD_XTKBD is not set
658# CONFIG_KEYBOARD_NEWTON is not set
659# CONFIG_KEYBOARD_STOWAWAY is not set
660CONFIG_INPUT_MOUSE=y
661CONFIG_MOUSE_PS2=y
662CONFIG_MOUSE_PS2_ALPS=y
663CONFIG_MOUSE_PS2_LOGIPS2PP=y
664CONFIG_MOUSE_PS2_SYNAPTICS=y
665CONFIG_MOUSE_PS2_LIFEBOOK=y
666CONFIG_MOUSE_PS2_TRACKPOINT=y
667# CONFIG_MOUSE_PS2_TOUCHKIT is not set
668# CONFIG_MOUSE_SERIAL is not set
669# CONFIG_MOUSE_APPLETOUCH is not set
670# CONFIG_MOUSE_VSXXXAA is not set
671# CONFIG_INPUT_JOYSTICK is not set
672# CONFIG_INPUT_TABLET is not set
673# CONFIG_INPUT_TOUCHSCREEN is not set
674# CONFIG_INPUT_MISC is not set
675
676#
677# Hardware I/O ports
678#
679CONFIG_SERIO=y
680CONFIG_SERIO_I8042=y
681# CONFIG_SERIO_SERPORT is not set
682# CONFIG_SERIO_PCIPS2 is not set
683CONFIG_SERIO_LIBPS2=y
684# CONFIG_SERIO_RAW is not set
685CONFIG_GAMEPORT=m
686# CONFIG_GAMEPORT_NS558 is not set
687# CONFIG_GAMEPORT_L4 is not set
688# CONFIG_GAMEPORT_EMU10K1 is not set
689# CONFIG_GAMEPORT_FM801 is not set
690
691#
692# Character devices
693#
694CONFIG_VT=y
695CONFIG_VT_CONSOLE=y
696CONFIG_HW_CONSOLE=y
697# CONFIG_VT_HW_CONSOLE_BINDING is not set
698CONFIG_SERIAL_NONSTANDARD=y
699# CONFIG_COMPUTONE is not set
700# CONFIG_ROCKETPORT is not set
701# CONFIG_CYCLADES is not set
702# CONFIG_DIGIEPCA is not set
703# CONFIG_MOXA_INTELLIO is not set
704# CONFIG_MOXA_SMARTIO is not set
705# CONFIG_MOXA_SMARTIO_NEW is not set
706# CONFIG_ISI is not set
707# CONFIG_SYNCLINKMP is not set
708# CONFIG_SYNCLINK_GT is not set
709# CONFIG_N_HDLC is not set
710# CONFIG_SPECIALIX is not set
711# CONFIG_SX is not set
712# CONFIG_RIO is not set
713# CONFIG_STALDRV is not set
714
715#
716# Serial drivers
717#
718CONFIG_SERIAL_8250=y
719CONFIG_SERIAL_8250_CONSOLE=y
720CONFIG_SERIAL_8250_PCI=y
721CONFIG_SERIAL_8250_PNP=y
722CONFIG_SERIAL_8250_NR_UARTS=6
723CONFIG_SERIAL_8250_RUNTIME_UARTS=4
724CONFIG_SERIAL_8250_EXTENDED=y
725CONFIG_SERIAL_8250_SHARE_IRQ=y
726# CONFIG_SERIAL_8250_DETECT_IRQ is not set
727# CONFIG_SERIAL_8250_RSA is not set
728
729#
730# Non-8250 serial port support
731#
732CONFIG_SERIAL_CORE=y
733CONFIG_SERIAL_CORE_CONSOLE=y
734# CONFIG_SERIAL_JSM is not set
735CONFIG_UNIX98_PTYS=y
736CONFIG_LEGACY_PTYS=y
737CONFIG_LEGACY_PTY_COUNT=256
738# CONFIG_IPMI_HANDLER is not set
739# CONFIG_WATCHDOG is not set
740# CONFIG_HW_RANDOM is not set
741CONFIG_EFI_RTC=y
742# CONFIG_R3964 is not set
743# CONFIG_APPLICOM is not set
744CONFIG_AGP=m
745CONFIG_AGP_I460=m
746CONFIG_DRM=m 38CONFIG_DRM=m
747CONFIG_DRM_TDFX=m 39CONFIG_DRM_MGA=m
748CONFIG_DRM_R128=m 40CONFIG_DRM_R128=m
749CONFIG_DRM_RADEON=m 41CONFIG_DRM_RADEON=m
750CONFIG_DRM_MGA=m
751CONFIG_DRM_SIS=m 42CONFIG_DRM_SIS=m
752# CONFIG_DRM_VIA is not set 43CONFIG_DRM_TDFX=m
753# CONFIG_DRM_SAVAGE is not set 44CONFIG_DUMMY=m
754CONFIG_RAW_DRIVER=m 45CONFIG_E1000=y
755CONFIG_MAX_RAW_DEVS=256 46CONFIG_E100=m
756CONFIG_HPET=y 47CONFIG_EFI_PARTITION=y
757# CONFIG_HPET_RTC_IRQ is not set 48CONFIG_EFI_RTC=y
758CONFIG_HPET_MMAP=y 49CONFIG_EFI_VARS=y
759# CONFIG_HANGCHECK_TIMER is not set 50CONFIG_EXPERIMENTAL=y
760# CONFIG_TCG_TPM is not set
761CONFIG_DEVPORT=y
762# CONFIG_I2C is not set
763
764#
765# SPI support
766#
767# CONFIG_SPI is not set
768# CONFIG_SPI_MASTER is not set
769# CONFIG_W1 is not set
770# CONFIG_POWER_SUPPLY is not set
771CONFIG_HWMON=y
772# CONFIG_HWMON_VID is not set
773# CONFIG_SENSORS_ABITUGURU is not set
774# CONFIG_SENSORS_F71805F is not set
775# CONFIG_SENSORS_PC87427 is not set
776# CONFIG_SENSORS_SMSC47M1 is not set
777# CONFIG_SENSORS_SMSC47B397 is not set
778# CONFIG_SENSORS_VT1211 is not set
779# CONFIG_SENSORS_W83627HF is not set
780# CONFIG_HWMON_DEBUG_CHIP is not set
781
782#
783# Multifunction device drivers
784#
785# CONFIG_MFD_SM501 is not set
786
787#
788# Multimedia devices
789#
790# CONFIG_VIDEO_DEV is not set
791# CONFIG_DVB_CORE is not set
792CONFIG_DAB=y
793# CONFIG_USB_DABUSB is not set
794
795#
796# Graphics support
797#
798# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
799
800#
801# Display device support
802#
803# CONFIG_DISPLAY_SUPPORT is not set
804# CONFIG_VGASTATE is not set
805# CONFIG_FB is not set
806
807#
808# Console display driver support
809#
810CONFIG_VGA_CONSOLE=y
811# CONFIG_VGACON_SOFT_SCROLLBACK is not set
812CONFIG_DUMMY_CONSOLE=y
813
814#
815# Sound
816#
817# CONFIG_SOUND is not set
818CONFIG_HID_SUPPORT=y
819CONFIG_HID=y
820# CONFIG_HID_DEBUG is not set
821
822#
823# USB Input Devices
824#
825CONFIG_USB_HID=y
826# CONFIG_USB_HIDINPUT_POWERBOOK is not set
827# CONFIG_HID_FF is not set
828# CONFIG_USB_HIDDEV is not set
829CONFIG_USB_SUPPORT=y
830CONFIG_USB_ARCH_HAS_HCD=y
831CONFIG_USB_ARCH_HAS_OHCI=y
832CONFIG_USB_ARCH_HAS_EHCI=y
833CONFIG_USB=y
834# CONFIG_USB_DEBUG is not set
835
836#
837# Miscellaneous USB options
838#
839CONFIG_USB_DEVICEFS=y
840CONFIG_USB_DEVICE_CLASS=y
841# CONFIG_USB_DYNAMIC_MINORS is not set
842# CONFIG_USB_SUSPEND is not set
843# CONFIG_USB_PERSIST is not set
844# CONFIG_USB_OTG is not set
845
846#
847# USB Host Controller Drivers
848#
849CONFIG_USB_EHCI_HCD=m
850# CONFIG_USB_EHCI_SPLIT_ISO is not set
851# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
852# CONFIG_USB_EHCI_TT_NEWSCHED is not set
853# CONFIG_USB_ISP116X_HCD is not set
854CONFIG_USB_OHCI_HCD=m
855# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
856# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
857CONFIG_USB_OHCI_LITTLE_ENDIAN=y
858CONFIG_USB_UHCI_HCD=y
859# CONFIG_USB_SL811_HCD is not set
860# CONFIG_USB_R8A66597_HCD is not set
861
862#
863# USB Device Class drivers
864#
865# CONFIG_USB_ACM is not set
866# CONFIG_USB_PRINTER is not set
867
868#
869# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
870#
871
872#
873# may also be needed; see USB_STORAGE Help for more information
874#
875CONFIG_USB_STORAGE=m
876# CONFIG_USB_STORAGE_DEBUG is not set
877# CONFIG_USB_STORAGE_DATAFAB is not set
878# CONFIG_USB_STORAGE_FREECOM is not set
879# CONFIG_USB_STORAGE_ISD200 is not set
880# CONFIG_USB_STORAGE_DPCM is not set
881# CONFIG_USB_STORAGE_USBAT is not set
882# CONFIG_USB_STORAGE_SDDR09 is not set
883# CONFIG_USB_STORAGE_SDDR55 is not set
884# CONFIG_USB_STORAGE_JUMPSHOT is not set
885# CONFIG_USB_STORAGE_ALAUDA is not set
886# CONFIG_USB_STORAGE_KARMA is not set
887# CONFIG_USB_LIBUSUAL is not set
888
889#
890# USB Imaging devices
891#
892# CONFIG_USB_MDC800 is not set
893# CONFIG_USB_MICROTEK is not set
894# CONFIG_USB_MON is not set
895
896#
897# USB port drivers
898#
899
900#
901# USB Serial Converter support
902#
903# CONFIG_USB_SERIAL is not set
904
905#
906# USB Miscellaneous drivers
907#
908# CONFIG_USB_EMI62 is not set
909# CONFIG_USB_EMI26 is not set
910# CONFIG_USB_ADUTUX is not set
911# CONFIG_USB_AUERSWALD is not set
912# CONFIG_USB_RIO500 is not set
913# CONFIG_USB_LEGOTOWER is not set
914# CONFIG_USB_LCD is not set
915# CONFIG_USB_BERRY_CHARGE is not set
916# CONFIG_USB_LED is not set
917# CONFIG_USB_CYPRESS_CY7C63 is not set
918# CONFIG_USB_CYTHERM is not set
919# CONFIG_USB_PHIDGET is not set
920# CONFIG_USB_IDMOUSE is not set
921# CONFIG_USB_FTDI_ELAN is not set
922# CONFIG_USB_APPLEDISPLAY is not set
923# CONFIG_USB_SISUSBVGA is not set
924# CONFIG_USB_LD is not set
925# CONFIG_USB_TRANCEVIBRATOR is not set
926# CONFIG_USB_IOWARRIOR is not set
927# CONFIG_USB_TEST is not set
928
929#
930# USB DSL modem support
931#
932
933#
934# USB Gadget Support
935#
936# CONFIG_USB_GADGET is not set
937# CONFIG_MMC is not set
938
939#
940# LED devices
941#
942# CONFIG_NEW_LEDS is not set
943
944#
945# LED drivers
946#
947
948#
949# LED Triggers
950#
951# CONFIG_INFINIBAND is not set
952
953#
954# Real Time Clock
955#
956# CONFIG_RTC_CLASS is not set
957
958#
959# DMA Engine support
960#
961# CONFIG_DMA_ENGINE is not set
962
963#
964# DMA Clients
965#
966
967#
968# DMA Devices
969#
970
971#
972# Userspace I/O
973#
974# CONFIG_UIO is not set
975# CONFIG_MSPEC is not set
976
977#
978# File systems
979#
980CONFIG_EXT2_FS=y
981CONFIG_EXT2_FS_XATTR=y
982CONFIG_EXT2_FS_POSIX_ACL=y 51CONFIG_EXT2_FS_POSIX_ACL=y
983CONFIG_EXT2_FS_SECURITY=y 52CONFIG_EXT2_FS_SECURITY=y
984# CONFIG_EXT2_FS_XIP is not set 53CONFIG_EXT2_FS_XATTR=y
985CONFIG_EXT3_FS=y 54CONFIG_EXT2_FS=y
986CONFIG_EXT3_FS_XATTR=y
987CONFIG_EXT3_FS_POSIX_ACL=y 55CONFIG_EXT3_FS_POSIX_ACL=y
988CONFIG_EXT3_FS_SECURITY=y 56CONFIG_EXT3_FS_SECURITY=y
989# CONFIG_EXT4DEV_FS is not set 57CONFIG_EXT3_FS=y
990CONFIG_JBD=y 58CONFIG_FORCE_CPEI_RETARGET=y
991# CONFIG_JBD_DEBUG is not set 59CONFIG_FUSION_CTL=y
992CONFIG_FS_MBCACHE=y 60CONFIG_FUSION_FC=y
993CONFIG_REISERFS_FS=y 61CONFIG_FUSION_SPI=y
994# CONFIG_REISERFS_CHECK is not set 62CONFIG_FUSION=y
995# CONFIG_REISERFS_PROC_INFO is not set 63CONFIG_GAMEPORT=m
996CONFIG_REISERFS_FS_XATTR=y 64CONFIG_HOTPLUG_CPU=y
997CONFIG_REISERFS_FS_POSIX_ACL=y 65CONFIG_HOTPLUG_PCI_ACPI=m
998CONFIG_REISERFS_FS_SECURITY=y 66CONFIG_HOTPLUG_PCI=m
999# CONFIG_JFS_FS is not set 67CONFIG_HPET=y
1000CONFIG_FS_POSIX_ACL=y 68CONFIG_HUGETLBFS=y
1001CONFIG_XFS_FS=y 69# CONFIG_HW_RANDOM is not set
1002# CONFIG_XFS_QUOTA is not set 70CONFIG_IA64_CYCLONE=y
1003# CONFIG_XFS_SECURITY is not set 71CONFIG_IA64_DIG=y
1004# CONFIG_XFS_POSIX_ACL is not set 72CONFIG_IA64_GRANULE_16MB=y
1005# CONFIG_XFS_RT is not set 73CONFIG_IA64_MCA_RECOVERY=y
1006# CONFIG_GFS2_FS is not set 74CONFIG_IA64_PAGE_SIZE_64KB=y
1007# CONFIG_OCFS2_FS is not set 75CONFIG_IA64_PALINFO=y
1008# CONFIG_MINIX_FS is not set 76CONFIG_IDE=y
1009# CONFIG_ROMFS_FS is not set 77CONFIG_IKCONFIG_PROC=y
78CONFIG_IKCONFIG=y
79CONFIG_INET=y
1010CONFIG_INOTIFY=y 80CONFIG_INOTIFY=y
1011CONFIG_INOTIFY_USER=y 81CONFIG_IP_MULTICAST=y
1012# CONFIG_QUOTA is not set 82# CONFIG_IPV6 is not set
1013CONFIG_DNOTIFY=y
1014CONFIG_AUTOFS_FS=y
1015CONFIG_AUTOFS4_FS=y
1016# CONFIG_FUSE_FS is not set
1017
1018#
1019# CD-ROM/DVD Filesystems
1020#
1021CONFIG_ISO9660_FS=m 83CONFIG_ISO9660_FS=m
1022CONFIG_JOLIET=y 84CONFIG_JOLIET=y
1023# CONFIG_ZISOFS is not set 85CONFIG_KALLSYMS_ALL=y
1024CONFIG_UDF_FS=m 86CONFIG_KEXEC=y
1025CONFIG_UDF_NLS=y 87CONFIG_LOG_BUF_SHIFT=20
1026 88CONFIG_MAGIC_SYSRQ=y
1027# 89CONFIG_MCKINLEY=y
1028# DOS/FAT/NT Filesystems 90CONFIG_MD_LINEAR=m
1029# 91CONFIG_MD_MULTIPATH=m
1030CONFIG_FAT_FS=y 92CONFIG_MD_RAID0=m
1031# CONFIG_MSDOS_FS is not set 93CONFIG_MD_RAID1=m
1032CONFIG_VFAT_FS=y 94CONFIG_MD=y
1033CONFIG_FAT_DEFAULT_CODEPAGE=437 95CONFIG_MODULE_SRCVERSION_ALL=y
1034CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" 96CONFIG_MODULES=y
1035CONFIG_NTFS_FS=m 97CONFIG_MODULE_UNLOAD=y
1036# CONFIG_NTFS_DEBUG is not set 98CONFIG_MODVERSIONS=y
1037# CONFIG_NTFS_RW is not set 99CONFIG_NETCONSOLE=y
1038 100CONFIG_NETDEVICES=y
1039# 101CONFIG_NET_ETHERNET=y
1040# Pseudo filesystems 102CONFIG_NET_PCI=y
1041# 103CONFIG_NET_TULIP=y
1042CONFIG_PROC_FS=y 104CONFIG_NFSD=m
1043CONFIG_PROC_KCORE=y 105CONFIG_NFSD_V4=y
1044CONFIG_PROC_SYSCTL=y
1045CONFIG_SYSFS=y
1046CONFIG_TMPFS=y
1047# CONFIG_TMPFS_POSIX_ACL is not set
1048CONFIG_HUGETLBFS=y
1049CONFIG_HUGETLB_PAGE=y
1050CONFIG_RAMFS=y
1051# CONFIG_CONFIGFS_FS is not set
1052
1053#
1054# Miscellaneous filesystems
1055#
1056# CONFIG_ADFS_FS is not set
1057# CONFIG_AFFS_FS is not set
1058# CONFIG_HFS_FS is not set
1059# CONFIG_HFSPLUS_FS is not set
1060# CONFIG_BEFS_FS is not set
1061# CONFIG_BFS_FS is not set
1062# CONFIG_EFS_FS is not set
1063# CONFIG_CRAMFS is not set
1064# CONFIG_VXFS_FS is not set
1065# CONFIG_HPFS_FS is not set
1066# CONFIG_QNX4FS_FS is not set
1067# CONFIG_SYSV_FS is not set
1068# CONFIG_UFS_FS is not set
1069
1070#
1071# Network File Systems
1072#
1073CONFIG_NFS_FS=m 106CONFIG_NFS_FS=m
1074CONFIG_NFS_V3=y 107CONFIG_NFS_V3=y
1075# CONFIG_NFS_V3_ACL is not set
1076CONFIG_NFS_V4=y 108CONFIG_NFS_V4=y
1077CONFIG_NFS_DIRECTIO=y 109CONFIG_NLS_CODEPAGE_1250=m
1078CONFIG_NFSD=m 110CONFIG_NLS_CODEPAGE_1251=m
1079CONFIG_NFSD_V3=y
1080# CONFIG_NFSD_V3_ACL is not set
1081CONFIG_NFSD_V4=y
1082CONFIG_NFSD_TCP=y
1083CONFIG_LOCKD=m
1084CONFIG_LOCKD_V4=y
1085CONFIG_EXPORTFS=m
1086CONFIG_NFS_COMMON=y
1087CONFIG_SUNRPC=m
1088CONFIG_SUNRPC_GSS=m
1089# CONFIG_SUNRPC_BIND34 is not set
1090CONFIG_RPCSEC_GSS_KRB5=y
1091# CONFIG_RPCSEC_GSS_SPKM3 is not set
1092CONFIG_SMB_FS=m
1093CONFIG_SMB_NLS_DEFAULT=y
1094CONFIG_SMB_NLS_REMOTE="cp437"
1095CONFIG_CIFS=m
1096# CONFIG_CIFS_STATS is not set
1097# CONFIG_CIFS_WEAK_PW_HASH is not set
1098# CONFIG_CIFS_XATTR is not set
1099# CONFIG_CIFS_DEBUG2 is not set
1100# CONFIG_CIFS_EXPERIMENTAL is not set
1101# CONFIG_NCP_FS is not set
1102# CONFIG_CODA_FS is not set
1103# CONFIG_AFS_FS is not set
1104
1105#
1106# Partition Types
1107#
1108CONFIG_PARTITION_ADVANCED=y
1109# CONFIG_ACORN_PARTITION is not set
1110# CONFIG_OSF_PARTITION is not set
1111# CONFIG_AMIGA_PARTITION is not set
1112# CONFIG_ATARI_PARTITION is not set
1113# CONFIG_MAC_PARTITION is not set
1114CONFIG_MSDOS_PARTITION=y
1115# CONFIG_BSD_DISKLABEL is not set
1116# CONFIG_MINIX_SUBPARTITION is not set
1117# CONFIG_SOLARIS_X86_PARTITION is not set
1118# CONFIG_UNIXWARE_DISKLABEL is not set
1119# CONFIG_LDM_PARTITION is not set
1120CONFIG_SGI_PARTITION=y
1121# CONFIG_ULTRIX_PARTITION is not set
1122# CONFIG_SUN_PARTITION is not set
1123# CONFIG_KARMA_PARTITION is not set
1124CONFIG_EFI_PARTITION=y
1125# CONFIG_SYSV68_PARTITION is not set
1126
1127#
1128# Native Language Support
1129#
1130CONFIG_NLS=y
1131CONFIG_NLS_DEFAULT="iso8859-1"
1132CONFIG_NLS_CODEPAGE_437=y 111CONFIG_NLS_CODEPAGE_437=y
1133CONFIG_NLS_CODEPAGE_737=m 112CONFIG_NLS_CODEPAGE_737=m
1134CONFIG_NLS_CODEPAGE_775=m 113CONFIG_NLS_CODEPAGE_775=m
@@ -1144,15 +123,14 @@ CONFIG_NLS_CODEPAGE_864=m
1144CONFIG_NLS_CODEPAGE_865=m 123CONFIG_NLS_CODEPAGE_865=m
1145CONFIG_NLS_CODEPAGE_866=m 124CONFIG_NLS_CODEPAGE_866=m
1146CONFIG_NLS_CODEPAGE_869=m 125CONFIG_NLS_CODEPAGE_869=m
1147CONFIG_NLS_CODEPAGE_936=m 126CONFIG_NLS_CODEPAGE_874=m
1148CONFIG_NLS_CODEPAGE_950=m
1149CONFIG_NLS_CODEPAGE_932=m 127CONFIG_NLS_CODEPAGE_932=m
128CONFIG_NLS_CODEPAGE_936=m
1150CONFIG_NLS_CODEPAGE_949=m 129CONFIG_NLS_CODEPAGE_949=m
1151CONFIG_NLS_CODEPAGE_874=m 130CONFIG_NLS_CODEPAGE_950=m
1152CONFIG_NLS_ISO8859_8=m 131CONFIG_NLS_ISO8859_13=m
1153CONFIG_NLS_CODEPAGE_1250=m 132CONFIG_NLS_ISO8859_14=m
1154CONFIG_NLS_CODEPAGE_1251=m 133CONFIG_NLS_ISO8859_15=m
1155# CONFIG_NLS_ASCII is not set
1156CONFIG_NLS_ISO8859_1=y 134CONFIG_NLS_ISO8859_1=y
1157CONFIG_NLS_ISO8859_2=m 135CONFIG_NLS_ISO8859_2=m
1158CONFIG_NLS_ISO8859_3=m 136CONFIG_NLS_ISO8859_3=m
@@ -1160,120 +138,50 @@ CONFIG_NLS_ISO8859_4=m
1160CONFIG_NLS_ISO8859_5=m 138CONFIG_NLS_ISO8859_5=m
1161CONFIG_NLS_ISO8859_6=m 139CONFIG_NLS_ISO8859_6=m
1162CONFIG_NLS_ISO8859_7=m 140CONFIG_NLS_ISO8859_7=m
141CONFIG_NLS_ISO8859_8=m
1163CONFIG_NLS_ISO8859_9=m 142CONFIG_NLS_ISO8859_9=m
1164CONFIG_NLS_ISO8859_13=m
1165CONFIG_NLS_ISO8859_14=m
1166CONFIG_NLS_ISO8859_15=m
1167CONFIG_NLS_KOI8_R=m 143CONFIG_NLS_KOI8_R=m
1168CONFIG_NLS_KOI8_U=m 144CONFIG_NLS_KOI8_U=m
1169CONFIG_NLS_UTF8=m 145CONFIG_NLS_UTF8=m
1170 146CONFIG_NR_CPUS=16
1171# 147CONFIG_NTFS_FS=m
1172# Distributed Lock Manager 148CONFIG_PACKET=y
1173# 149CONFIG_PARTITION_ADVANCED=y
1174# CONFIG_DLM is not set 150CONFIG_PERFMON=y
1175 151CONFIG_PERMIT_BSP_REMOVE=y
1176# 152CONFIG_POSIX_MQUEUE=y
1177# Library routines 153CONFIG_PROC_KCORE=y
1178# 154CONFIG_RAW_DRIVER=m
1179CONFIG_BITREVERSE=y 155CONFIG_REISERFS_FS_POSIX_ACL=y
1180# CONFIG_CRC_CCITT is not set 156CONFIG_REISERFS_FS_SECURITY=y
1181# CONFIG_CRC16 is not set 157CONFIG_REISERFS_FS_XATTR=y
1182# CONFIG_CRC_ITU_T is not set 158CONFIG_REISERFS_FS=y
1183CONFIG_CRC32=y 159CONFIG_SCSI_QLOGIC_1280=y
1184# CONFIG_CRC7 is not set 160CONFIG_SCSI_SYM53C8XX_2=y
1185# CONFIG_LIBCRC32C is not set 161CONFIG_SCSI=y
1186CONFIG_PLIST=y 162CONFIG_SERIAL_8250_CONSOLE=y
1187CONFIG_HAS_IOMEM=y 163CONFIG_SERIAL_8250_EXTENDED=y
1188CONFIG_HAS_IOPORT=y 164CONFIG_SERIAL_8250_NR_UARTS=6
1189CONFIG_HAS_DMA=y 165CONFIG_SERIAL_8250_SHARE_IRQ=y
1190CONFIG_GENERIC_HARDIRQS=y 166CONFIG_SERIAL_8250=y
1191CONFIG_GENERIC_IRQ_PROBE=y 167CONFIG_SERIAL_NONSTANDARD=y
1192CONFIG_GENERIC_PENDING_IRQ=y 168# CONFIG_SERIO_SERPORT is not set
1193CONFIG_IRQ_PER_CPU=y 169CONFIG_SGI_PARTITION=y
1194 170CONFIG_SMB_FS=m
1195# 171CONFIG_SMB_NLS_DEFAULT=y
1196# Instrumentation Support 172CONFIG_SMP=y
1197# 173CONFIG_SYN_COOKIES=y
1198# CONFIG_PROFILING is not set 174CONFIG_SYSVIPC=y
1199# CONFIG_KPROBES is not set 175CONFIG_TIGON3=y
1200 176CONFIG_TMPFS=y
1201# 177CONFIG_TULIP=m
1202# Kernel hacking 178CONFIG_UDF_FS=m
1203# 179CONFIG_UNIX=y
1204# CONFIG_PRINTK_TIME is not set 180CONFIG_USB_DEVICEFS=y
1205CONFIG_ENABLE_MUST_CHECK=y 181CONFIG_USB_EHCI_HCD=m
1206CONFIG_MAGIC_SYSRQ=y 182CONFIG_USB_OHCI_HCD=m
1207# CONFIG_UNUSED_SYMBOLS is not set 183CONFIG_USB_STORAGE=m
1208# CONFIG_DEBUG_FS is not set 184CONFIG_USB_UHCI_HCD=y
1209# CONFIG_HEADERS_CHECK is not set 185CONFIG_USB=y
1210CONFIG_DEBUG_KERNEL=y 186CONFIG_VFAT_FS=y
1211# CONFIG_DEBUG_SHIRQ is not set 187CONFIG_XFS_FS=y
1212CONFIG_DETECT_SOFTLOCKUP=y
1213CONFIG_SCHED_DEBUG=y
1214# CONFIG_SCHEDSTATS is not set
1215# CONFIG_TIMER_STATS is not set
1216# CONFIG_DEBUG_SLAB is not set
1217# CONFIG_DEBUG_RT_MUTEXES is not set
1218# CONFIG_RT_MUTEX_TESTER is not set
1219# CONFIG_DEBUG_SPINLOCK is not set
1220CONFIG_DEBUG_MUTEXES=y
1221# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1222# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1223# CONFIG_DEBUG_KOBJECT is not set
1224# CONFIG_DEBUG_INFO is not set
1225# CONFIG_DEBUG_VM is not set
1226# CONFIG_DEBUG_LIST is not set
1227CONFIG_FORCED_INLINING=y
1228# CONFIG_RCU_TORTURE_TEST is not set
1229# CONFIG_FAULT_INJECTION is not set
1230CONFIG_IA64_GRANULE_16MB=y
1231# CONFIG_IA64_GRANULE_64MB is not set
1232# CONFIG_IA64_PRINT_HAZARDS is not set
1233# CONFIG_DISABLE_VHPT is not set
1234# CONFIG_IA64_DEBUG_CMPXCHG is not set
1235# CONFIG_IA64_DEBUG_IRQ is not set
1236
1237#
1238# Security options
1239#
1240# CONFIG_KEYS is not set
1241# CONFIG_SECURITY is not set
1242CONFIG_CRYPTO=y
1243CONFIG_CRYPTO_ALGAPI=y
1244CONFIG_CRYPTO_BLKCIPHER=m
1245CONFIG_CRYPTO_MANAGER=m
1246# CONFIG_CRYPTO_HMAC is not set
1247# CONFIG_CRYPTO_XCBC is not set
1248# CONFIG_CRYPTO_NULL is not set
1249# CONFIG_CRYPTO_MD4 is not set
1250CONFIG_CRYPTO_MD5=y
1251# CONFIG_CRYPTO_SHA1 is not set
1252# CONFIG_CRYPTO_SHA256 is not set
1253# CONFIG_CRYPTO_SHA512 is not set
1254# CONFIG_CRYPTO_WP512 is not set
1255# CONFIG_CRYPTO_TGR192 is not set
1256# CONFIG_CRYPTO_GF128MUL is not set
1257CONFIG_CRYPTO_ECB=m
1258CONFIG_CRYPTO_CBC=m
1259CONFIG_CRYPTO_PCBC=m
1260# CONFIG_CRYPTO_LRW is not set
1261# CONFIG_CRYPTO_CRYPTD is not set
1262CONFIG_CRYPTO_DES=m
1263# CONFIG_CRYPTO_FCRYPT is not set
1264# CONFIG_CRYPTO_BLOWFISH is not set
1265# CONFIG_CRYPTO_TWOFISH is not set
1266# CONFIG_CRYPTO_SERPENT is not set
1267# CONFIG_CRYPTO_AES is not set
1268# CONFIG_CRYPTO_CAST5 is not set
1269# CONFIG_CRYPTO_CAST6 is not set
1270# CONFIG_CRYPTO_TEA is not set
1271# CONFIG_CRYPTO_ARC4 is not set
1272# CONFIG_CRYPTO_KHAZAD is not set
1273# CONFIG_CRYPTO_ANUBIS is not set
1274# CONFIG_CRYPTO_DEFLATE is not set
1275# CONFIG_CRYPTO_MICHAEL_MIC is not set
1276# CONFIG_CRYPTO_CRC32C is not set
1277# CONFIG_CRYPTO_CAMELLIA is not set
1278# CONFIG_CRYPTO_TEST is not set
1279CONFIG_CRYPTO_HW=y
diff --git a/arch/ia64/configs/xen_domu_defconfig b/arch/ia64/configs/xen_domu_defconfig
index c67eafc4bb38..5f6d284723a4 100644
--- a/arch/ia64/configs/xen_domu_defconfig
+++ b/arch/ia64/configs/xen_domu_defconfig
@@ -1,1374 +1,121 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.29-rc1
4# Fri Jan 16 11:49:59 2009
5#
6CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
7
8#
9# General setup
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_LOCK_KERNEL=y
13CONFIG_INIT_ENV_ARG_LIMIT=32
14CONFIG_LOCALVERSION=""
15CONFIG_LOCALVERSION_AUTO=y
16CONFIG_SWAP=y
17CONFIG_SYSVIPC=y
18CONFIG_SYSVIPC_SYSCTL=y
19CONFIG_POSIX_MQUEUE=y
20# CONFIG_BSD_PROCESS_ACCT is not set
21# CONFIG_TASKSTATS is not set
22# CONFIG_AUDIT is not set
23CONFIG_IKCONFIG=y
24CONFIG_IKCONFIG_PROC=y
25CONFIG_LOG_BUF_SHIFT=20
26CONFIG_HAVE_UNSTABLE_SCHED_CLOCK=y
27# CONFIG_GROUP_SCHED is not set
28
29#
30# Control Group support
31#
32# CONFIG_CGROUPS is not set
33CONFIG_SYSFS_DEPRECATED=y
34CONFIG_SYSFS_DEPRECATED_V2=y
35# CONFIG_RELAY is not set
36CONFIG_NAMESPACES=y
37# CONFIG_UTS_NS is not set
38# CONFIG_IPC_NS is not set
39# CONFIG_USER_NS is not set
40# CONFIG_PID_NS is not set
41CONFIG_BLK_DEV_INITRD=y
42CONFIG_INITRAMFS_SOURCE=""
43CONFIG_CC_OPTIMIZE_FOR_SIZE=y
44CONFIG_SYSCTL=y
45# CONFIG_EMBEDDED is not set
46CONFIG_SYSCTL_SYSCALL=y
47CONFIG_KALLSYMS=y
48CONFIG_KALLSYMS_ALL=y
49CONFIG_KALLSYMS_STRIP_GENERATED=y
50# CONFIG_KALLSYMS_EXTRA_PASS is not set
51CONFIG_HOTPLUG=y
52CONFIG_PRINTK=y
53CONFIG_BUG=y
54CONFIG_ELF_CORE=y
55CONFIG_COMPAT_BRK=y
56CONFIG_BASE_FULL=y
57CONFIG_FUTEX=y
58CONFIG_ANON_INODES=y
59CONFIG_EPOLL=y
60CONFIG_SIGNALFD=y
61CONFIG_TIMERFD=y
62CONFIG_EVENTFD=y
63CONFIG_SHMEM=y
64CONFIG_AIO=y
65CONFIG_VM_EVENT_COUNTERS=y
66CONFIG_PCI_QUIRKS=y
67CONFIG_SLUB_DEBUG=y
68# CONFIG_SLAB is not set
69CONFIG_SLUB=y
70# CONFIG_SLOB is not set
71# CONFIG_PROFILING is not set
72CONFIG_HAVE_OPROFILE=y
73# CONFIG_KPROBES is not set
74CONFIG_HAVE_KPROBES=y
75CONFIG_HAVE_KRETPROBES=y
76CONFIG_HAVE_ARCH_TRACEHOOK=y
77CONFIG_HAVE_DMA_ATTRS=y
78CONFIG_USE_GENERIC_SMP_HELPERS=y
79# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
80CONFIG_SLABINFO=y
81CONFIG_RT_MUTEXES=y
82CONFIG_BASE_SMALL=0
83CONFIG_MODULES=y
84# CONFIG_MODULE_FORCE_LOAD is not set
85CONFIG_MODULE_UNLOAD=y
86# CONFIG_MODULE_FORCE_UNLOAD is not set
87CONFIG_MODVERSIONS=y
88CONFIG_MODULE_SRCVERSION_ALL=y
89CONFIG_STOP_MACHINE=y
90CONFIG_BLOCK=y
91# CONFIG_BLK_DEV_IO_TRACE is not set
92# CONFIG_BLK_DEV_BSG is not set
93# CONFIG_BLK_DEV_INTEGRITY is not set
94
95#
96# IO Schedulers
97#
98CONFIG_IOSCHED_NOOP=y
99CONFIG_IOSCHED_AS=y
100CONFIG_IOSCHED_DEADLINE=y
101CONFIG_IOSCHED_CFQ=y
102CONFIG_DEFAULT_AS=y
103# CONFIG_DEFAULT_DEADLINE is not set
104# CONFIG_DEFAULT_CFQ is not set
105# CONFIG_DEFAULT_NOOP is not set
106CONFIG_DEFAULT_IOSCHED="anticipatory"
107CONFIG_CLASSIC_RCU=y
108# CONFIG_TREE_RCU is not set
109# CONFIG_PREEMPT_RCU is not set
110# CONFIG_TREE_RCU_TRACE is not set
111# CONFIG_PREEMPT_RCU_TRACE is not set
112CONFIG_FREEZER=y
113
114#
115# Processor type and features
116#
117CONFIG_IA64=y
118CONFIG_64BIT=y
119CONFIG_ZONE_DMA=y
120CONFIG_QUICKLIST=y
121CONFIG_MMU=y
122CONFIG_SWIOTLB=y
123CONFIG_IOMMU_HELPER=y
124CONFIG_RWSEM_XCHGADD_ALGORITHM=y
125CONFIG_HUGETLB_PAGE_SIZE_VARIABLE=y
126CONFIG_GENERIC_FIND_NEXT_BIT=y
127CONFIG_GENERIC_CALIBRATE_DELAY=y
128CONFIG_GENERIC_TIME=y
129CONFIG_GENERIC_TIME_VSYSCALL=y
130CONFIG_HAVE_SETUP_PER_CPU_AREA=y
131CONFIG_DMI=y
132CONFIG_EFI=y
133CONFIG_GENERIC_IOMAP=y
134CONFIG_SCHED_OMIT_FRAME_POINTER=y
135CONFIG_AUDIT_ARCH=y
136CONFIG_PARAVIRT_GUEST=y
137CONFIG_PARAVIRT=y
138CONFIG_XEN=y
139CONFIG_XEN_XENCOMM=y
140CONFIG_NO_IDLE_HZ=y
141# CONFIG_IA64_GENERIC is not set
142# CONFIG_IA64_DIG is not set
143# CONFIG_IA64_DIG_VTD is not set
144# CONFIG_IA64_HP_ZX1 is not set
145# CONFIG_IA64_HP_ZX1_SWIOTLB is not set
146# CONFIG_IA64_SGI_SN2 is not set
147# CONFIG_IA64_SGI_UV is not set
148# CONFIG_IA64_HP_SIM is not set
149CONFIG_IA64_XEN_GUEST=y
150# CONFIG_ITANIUM is not set
151CONFIG_MCKINLEY=y
152# CONFIG_IA64_PAGE_SIZE_4KB is not set
153# CONFIG_IA64_PAGE_SIZE_8KB is not set
154CONFIG_IA64_PAGE_SIZE_16KB=y
155# CONFIG_IA64_PAGE_SIZE_64KB is not set
156CONFIG_PGTABLE_3=y
157# CONFIG_PGTABLE_4 is not set
158CONFIG_HZ=250
159# CONFIG_HZ_100 is not set
160CONFIG_HZ_250=y
161# CONFIG_HZ_300 is not set
162# CONFIG_HZ_1000 is not set
163# CONFIG_SCHED_HRTICK is not set
164CONFIG_IA64_L1_CACHE_SHIFT=7
165CONFIG_IA64_CYCLONE=y
166CONFIG_IOSAPIC=y
167CONFIG_FORCE_MAX_ZONEORDER=17
168# CONFIG_VIRT_CPU_ACCOUNTING is not set
169CONFIG_SMP=y
170CONFIG_NR_CPUS=16
171CONFIG_HOTPLUG_CPU=y
172CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
173CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
174# CONFIG_SCHED_SMT is not set
175CONFIG_PERMIT_BSP_REMOVE=y
176CONFIG_FORCE_CPEI_RETARGET=y
177CONFIG_PREEMPT_NONE=y
178# CONFIG_PREEMPT_VOLUNTARY is not set
179# CONFIG_PREEMPT is not set
180CONFIG_SELECT_MEMORY_MODEL=y
181CONFIG_FLATMEM_MANUAL=y
182# CONFIG_DISCONTIGMEM_MANUAL is not set
183# CONFIG_SPARSEMEM_MANUAL is not set
184CONFIG_FLATMEM=y
185CONFIG_FLAT_NODE_MEM_MAP=y
186CONFIG_SPARSEMEM_VMEMMAP_ENABLE=y
187CONFIG_PAGEFLAGS_EXTENDED=y
188CONFIG_SPLIT_PTLOCK_CPUS=4
189CONFIG_MIGRATION=y
190CONFIG_PHYS_ADDR_T_64BIT=y
191CONFIG_ZONE_DMA_FLAG=1
192CONFIG_BOUNCE=y
193CONFIG_NR_QUICK=1
194CONFIG_VIRT_TO_BUS=y
195CONFIG_UNEVICTABLE_LRU=y
196CONFIG_ARCH_SELECT_MEMORY_MODEL=y
197CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
198CONFIG_ARCH_FLATMEM_ENABLE=y
199CONFIG_ARCH_SPARSEMEM_ENABLE=y
200CONFIG_ARCH_POPULATES_NODE_MAP=y
201CONFIG_VIRTUAL_MEM_MAP=y
202CONFIG_HOLES_IN_ZONE=y
203CONFIG_IA64_MCA_RECOVERY=y
204CONFIG_PERFMON=y
205CONFIG_IA64_PALINFO=y
206# CONFIG_IA64_MC_ERR_INJECT is not set
207# CONFIG_IA64_ESI is not set
208# CONFIG_IA64_HP_AML_NFW is not set
209CONFIG_KEXEC=y
210# CONFIG_CRASH_DUMP is not set
211
212#
213# Firmware Drivers
214#
215# CONFIG_FIRMWARE_MEMMAP is not set
216CONFIG_EFI_VARS=y
217CONFIG_EFI_PCDP=y
218CONFIG_DMIID=y
219CONFIG_BINFMT_ELF=y
220# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
221# CONFIG_HAVE_AOUT is not set
222CONFIG_BINFMT_MISC=m
223
224#
225# Power management and ACPI options
226#
227CONFIG_PM=y
228# CONFIG_PM_DEBUG is not set
229CONFIG_PM_SLEEP=y
230CONFIG_SUSPEND=y
231CONFIG_SUSPEND_FREEZER=y
232CONFIG_ACPI=y
233CONFIG_ACPI_SLEEP=y
234CONFIG_ACPI_PROCFS=y
235CONFIG_ACPI_PROCFS_POWER=y
236CONFIG_ACPI_SYSFS_POWER=y
237CONFIG_ACPI_PROC_EVENT=y
238CONFIG_ACPI_BUTTON=m 1CONFIG_ACPI_BUTTON=m
2CONFIG_ACPI_CONTAINER=m
239CONFIG_ACPI_FAN=m 3CONFIG_ACPI_FAN=m
240# CONFIG_ACPI_DOCK is not set
241CONFIG_ACPI_PROCESSOR=m 4CONFIG_ACPI_PROCESSOR=m
242CONFIG_ACPI_HOTPLUG_CPU=y 5CONFIG_ACPI_PROCFS=y
243CONFIG_ACPI_THERMAL=m 6CONFIG_AGP=m
244# CONFIG_ACPI_CUSTOM_DSDT is not set
245CONFIG_ACPI_BLACKLIST_YEAR=0
246# CONFIG_ACPI_DEBUG is not set
247# CONFIG_ACPI_PCI_SLOT is not set
248CONFIG_ACPI_SYSTEM=y
249CONFIG_ACPI_CONTAINER=m
250
251#
252# CPU Frequency scaling
253#
254# CONFIG_CPU_FREQ is not set
255
256#
257# Bus options (PCI, PCMCIA)
258#
259CONFIG_PCI=y
260CONFIG_PCI_DOMAINS=y
261CONFIG_PCI_SYSCALL=y
262# CONFIG_PCIEPORTBUS is not set
263CONFIG_ARCH_SUPPORTS_MSI=y
264# CONFIG_PCI_MSI is not set
265CONFIG_PCI_LEGACY=y
266# CONFIG_PCI_DEBUG is not set
267# CONFIG_PCI_STUB is not set
268CONFIG_HOTPLUG_PCI=m
269# CONFIG_HOTPLUG_PCI_FAKE is not set
270CONFIG_HOTPLUG_PCI_ACPI=m
271# CONFIG_HOTPLUG_PCI_ACPI_IBM is not set
272# CONFIG_HOTPLUG_PCI_CPCI is not set
273# CONFIG_HOTPLUG_PCI_SHPC is not set
274# CONFIG_PCCARD is not set
275CONFIG_NET=y
276
277#
278# Networking options
279#
280# CONFIG_NET_NS is not set
281CONFIG_COMPAT_NET_DEV_OPS=y
282CONFIG_PACKET=y
283# CONFIG_PACKET_MMAP is not set
284CONFIG_UNIX=y
285CONFIG_XFRM=y
286# CONFIG_XFRM_USER is not set
287# CONFIG_XFRM_SUB_POLICY is not set
288# CONFIG_XFRM_MIGRATE is not set
289# CONFIG_XFRM_STATISTICS is not set
290# CONFIG_NET_KEY is not set
291CONFIG_INET=y
292CONFIG_IP_MULTICAST=y
293# CONFIG_IP_ADVANCED_ROUTER is not set
294CONFIG_IP_FIB_HASH=y
295# CONFIG_IP_PNP is not set
296# CONFIG_NET_IPIP is not set
297# CONFIG_NET_IPGRE is not set
298# CONFIG_IP_MROUTE is not set
299CONFIG_ARPD=y 7CONFIG_ARPD=y
300CONFIG_SYN_COOKIES=y 8CONFIG_AUTOFS4_FS=y
301# CONFIG_INET_AH is not set 9CONFIG_AUTOFS_FS=y
302# CONFIG_INET_ESP is not set 10CONFIG_BINFMT_MISC=m
303# CONFIG_INET_IPCOMP is not set 11# CONFIG_BLK_DEV_BSG is not set
304# CONFIG_INET_XFRM_TUNNEL is not set 12CONFIG_BLK_DEV_CMD64X=y
305# CONFIG_INET_TUNNEL is not set
306CONFIG_INET_XFRM_MODE_TRANSPORT=y
307CONFIG_INET_XFRM_MODE_TUNNEL=y
308CONFIG_INET_XFRM_MODE_BEET=y
309# CONFIG_INET_LRO is not set
310CONFIG_INET_DIAG=y
311CONFIG_INET_TCP_DIAG=y
312# CONFIG_TCP_CONG_ADVANCED is not set
313CONFIG_TCP_CONG_CUBIC=y
314CONFIG_DEFAULT_TCP_CONG="cubic"
315# CONFIG_TCP_MD5SIG is not set
316# CONFIG_IPV6 is not set
317# CONFIG_NETWORK_SECMARK is not set
318# CONFIG_NETFILTER is not set
319# CONFIG_IP_DCCP is not set
320# CONFIG_IP_SCTP is not set
321# CONFIG_TIPC is not set
322# CONFIG_ATM is not set
323# CONFIG_BRIDGE is not set
324# CONFIG_NET_DSA is not set
325# CONFIG_VLAN_8021Q is not set
326# CONFIG_DECNET is not set
327# CONFIG_LLC2 is not set
328# CONFIG_IPX is not set
329# CONFIG_ATALK is not set
330# CONFIG_X25 is not set
331# CONFIG_LAPB is not set
332# CONFIG_ECONET is not set
333# CONFIG_WAN_ROUTER is not set
334# CONFIG_NET_SCHED is not set
335# CONFIG_DCB is not set
336
337#
338# Network testing
339#
340# CONFIG_NET_PKTGEN is not set
341# CONFIG_HAMRADIO is not set
342# CONFIG_CAN is not set
343# CONFIG_IRDA is not set
344# CONFIG_BT is not set
345# CONFIG_AF_RXRPC is not set
346# CONFIG_PHONET is not set
347# CONFIG_WIRELESS is not set
348# CONFIG_WIMAX is not set
349# CONFIG_RFKILL is not set
350# CONFIG_NET_9P is not set
351
352#
353# Device Drivers
354#
355
356#
357# Generic Driver Options
358#
359CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
360CONFIG_STANDALONE=y
361CONFIG_PREVENT_FIRMWARE_BUILD=y
362CONFIG_FW_LOADER=y
363CONFIG_FIRMWARE_IN_KERNEL=y
364CONFIG_EXTRA_FIRMWARE=""
365# CONFIG_DEBUG_DRIVER is not set
366# CONFIG_DEBUG_DEVRES is not set
367# CONFIG_SYS_HYPERVISOR is not set
368# CONFIG_CONNECTOR is not set
369# CONFIG_MTD is not set
370# CONFIG_PARPORT is not set
371CONFIG_PNP=y
372CONFIG_PNP_DEBUG_MESSAGES=y
373
374#
375# Protocols
376#
377CONFIG_PNPACPI=y
378CONFIG_BLK_DEV=y
379# CONFIG_BLK_CPQ_DA is not set
380# CONFIG_BLK_CPQ_CISS_DA is not set
381# CONFIG_BLK_DEV_DAC960 is not set
382# CONFIG_BLK_DEV_UMEM is not set
383# CONFIG_BLK_DEV_COW_COMMON is not set
384CONFIG_BLK_DEV_LOOP=m
385CONFIG_BLK_DEV_CRYPTOLOOP=m 13CONFIG_BLK_DEV_CRYPTOLOOP=m
386CONFIG_BLK_DEV_NBD=m 14CONFIG_BLK_DEV_DM=m
387# CONFIG_BLK_DEV_SX8 is not set
388# CONFIG_BLK_DEV_UB is not set
389CONFIG_BLK_DEV_RAM=y
390CONFIG_BLK_DEV_RAM_COUNT=16
391CONFIG_BLK_DEV_RAM_SIZE=4096
392# CONFIG_BLK_DEV_XIP is not set
393# CONFIG_CDROM_PKTCDVD is not set
394# CONFIG_ATA_OVER_ETH is not set
395CONFIG_XEN_BLKDEV_FRONTEND=y
396# CONFIG_BLK_DEV_HD is not set
397CONFIG_MISC_DEVICES=y
398# CONFIG_PHANTOM is not set
399# CONFIG_EEPROM_93CX6 is not set
400# CONFIG_SGI_IOC4 is not set
401# CONFIG_TIFM_CORE is not set
402# CONFIG_ICS932S401 is not set
403# CONFIG_ENCLOSURE_SERVICES is not set
404# CONFIG_HP_ILO is not set
405# CONFIG_C2PORT is not set
406CONFIG_HAVE_IDE=y
407CONFIG_IDE=y
408
409#
410# Please see Documentation/ide/ide.txt for help/info on IDE drives
411#
412CONFIG_IDE_TIMINGS=y
413CONFIG_IDE_ATAPI=y
414# CONFIG_BLK_DEV_IDE_SATA is not set
415CONFIG_IDE_GD=y
416CONFIG_IDE_GD_ATA=y
417# CONFIG_IDE_GD_ATAPI is not set
418CONFIG_BLK_DEV_IDECD=y
419CONFIG_BLK_DEV_IDECD_VERBOSE_ERRORS=y
420# CONFIG_BLK_DEV_IDETAPE is not set
421# CONFIG_BLK_DEV_IDEACPI is not set
422# CONFIG_IDE_TASK_IOCTL is not set
423CONFIG_IDE_PROC_FS=y
424
425#
426# IDE chipset support/bugfixes
427#
428# CONFIG_IDE_GENERIC is not set
429# CONFIG_BLK_DEV_PLATFORM is not set
430# CONFIG_BLK_DEV_IDEPNP is not set
431CONFIG_BLK_DEV_IDEDMA_SFF=y
432
433#
434# PCI IDE chipsets support
435#
436CONFIG_BLK_DEV_IDEPCI=y
437CONFIG_IDEPCI_PCIBUS_ORDER=y
438# CONFIG_BLK_DEV_OFFBOARD is not set
439CONFIG_BLK_DEV_GENERIC=y 15CONFIG_BLK_DEV_GENERIC=y
440# CONFIG_BLK_DEV_OPTI621 is not set 16CONFIG_BLK_DEV_IDECD=y
441CONFIG_BLK_DEV_IDEDMA_PCI=y 17CONFIG_BLK_DEV_INITRD=y
442# CONFIG_BLK_DEV_AEC62XX is not set 18CONFIG_BLK_DEV_LOOP=m
443# CONFIG_BLK_DEV_ALI15X3 is not set 19CONFIG_BLK_DEV_MD=m
444# CONFIG_BLK_DEV_AMD74XX is not set 20CONFIG_BLK_DEV_NBD=m
445CONFIG_BLK_DEV_CMD64X=y
446# CONFIG_BLK_DEV_TRIFLEX is not set
447# CONFIG_BLK_DEV_CS5520 is not set
448# CONFIG_BLK_DEV_CS5530 is not set
449# CONFIG_BLK_DEV_HPT366 is not set
450# CONFIG_BLK_DEV_JMICRON is not set
451# CONFIG_BLK_DEV_SC1200 is not set
452CONFIG_BLK_DEV_PIIX=y 21CONFIG_BLK_DEV_PIIX=y
453# CONFIG_BLK_DEV_IT8172 is not set 22CONFIG_BLK_DEV_RAM=y
454# CONFIG_BLK_DEV_IT8213 is not set
455# CONFIG_BLK_DEV_IT821X is not set
456# CONFIG_BLK_DEV_NS87415 is not set
457# CONFIG_BLK_DEV_PDC202XX_OLD is not set
458# CONFIG_BLK_DEV_PDC202XX_NEW is not set
459# CONFIG_BLK_DEV_SVWKS is not set
460# CONFIG_BLK_DEV_SIIMAGE is not set
461# CONFIG_BLK_DEV_SLC90E66 is not set
462# CONFIG_BLK_DEV_TRM290 is not set
463# CONFIG_BLK_DEV_VIA82CXXX is not set
464# CONFIG_BLK_DEV_TC86C001 is not set
465CONFIG_BLK_DEV_IDEDMA=y
466
467#
468# SCSI device support
469#
470# CONFIG_RAID_ATTRS is not set
471CONFIG_SCSI=y
472CONFIG_SCSI_DMA=y
473# CONFIG_SCSI_TGT is not set
474CONFIG_SCSI_NETLINK=y
475CONFIG_SCSI_PROC_FS=y
476
477#
478# SCSI support type (disk, tape, CD-ROM)
479#
480CONFIG_BLK_DEV_SD=y 23CONFIG_BLK_DEV_SD=y
481CONFIG_CHR_DEV_ST=m
482# CONFIG_CHR_DEV_OSST is not set
483CONFIG_BLK_DEV_SR=m 24CONFIG_BLK_DEV_SR=m
484# CONFIG_BLK_DEV_SR_VENDOR is not set
485CONFIG_CHR_DEV_SG=m 25CONFIG_CHR_DEV_SG=m
486# CONFIG_CHR_DEV_SCH is not set 26CONFIG_CHR_DEV_ST=m
487 27CONFIG_CIFS=m
488# 28# CONFIG_CRYPTO_ANSI_CPRNG is not set
489# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 29CONFIG_CRYPTO_ECB=m
490# 30CONFIG_CRYPTO_MD5=y
491# CONFIG_SCSI_MULTI_LUN is not set 31CONFIG_CRYPTO_PCBC=m
492# CONFIG_SCSI_CONSTANTS is not set 32CONFIG_DEBUG_KERNEL=y
493# CONFIG_SCSI_LOGGING is not set 33CONFIG_DEBUG_MUTEXES=y
494# CONFIG_SCSI_SCAN_ASYNC is not set
495CONFIG_SCSI_WAIT_SCAN=m
496
497#
498# SCSI Transports
499#
500CONFIG_SCSI_SPI_ATTRS=y
501CONFIG_SCSI_FC_ATTRS=y
502# CONFIG_SCSI_ISCSI_ATTRS is not set
503# CONFIG_SCSI_SAS_LIBSAS is not set
504# CONFIG_SCSI_SRP_ATTRS is not set
505CONFIG_SCSI_LOWLEVEL=y
506# CONFIG_ISCSI_TCP is not set
507# CONFIG_SCSI_CXGB3_ISCSI is not set
508# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
509# CONFIG_SCSI_3W_9XXX is not set
510# CONFIG_SCSI_ACARD is not set
511# CONFIG_SCSI_AACRAID is not set
512# CONFIG_SCSI_AIC7XXX is not set
513# CONFIG_SCSI_AIC7XXX_OLD is not set
514# CONFIG_SCSI_AIC79XX is not set
515# CONFIG_SCSI_AIC94XX is not set
516# CONFIG_SCSI_DPT_I2O is not set
517# CONFIG_SCSI_ADVANSYS is not set
518# CONFIG_SCSI_ARCMSR is not set
519# CONFIG_MEGARAID_NEWGEN is not set
520# CONFIG_MEGARAID_LEGACY is not set
521# CONFIG_MEGARAID_SAS is not set
522# CONFIG_SCSI_HPTIOP is not set
523# CONFIG_LIBFC is not set
524# CONFIG_FCOE is not set
525# CONFIG_SCSI_DMX3191D is not set
526# CONFIG_SCSI_FUTURE_DOMAIN is not set
527# CONFIG_SCSI_IPS is not set
528# CONFIG_SCSI_INITIO is not set
529# CONFIG_SCSI_INIA100 is not set
530# CONFIG_SCSI_MVSAS is not set
531# CONFIG_SCSI_STEX is not set
532CONFIG_SCSI_SYM53C8XX_2=y
533CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
534CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
535CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
536CONFIG_SCSI_SYM53C8XX_MMIO=y
537CONFIG_SCSI_QLOGIC_1280=y
538# CONFIG_SCSI_QLA_FC is not set
539# CONFIG_SCSI_QLA_ISCSI is not set
540# CONFIG_SCSI_LPFC is not set
541# CONFIG_SCSI_DC395x is not set
542# CONFIG_SCSI_DC390T is not set
543# CONFIG_SCSI_DEBUG is not set
544# CONFIG_SCSI_SRP is not set
545# CONFIG_SCSI_DH is not set
546# CONFIG_ATA is not set
547CONFIG_MD=y
548CONFIG_BLK_DEV_MD=m
549CONFIG_MD_LINEAR=m
550CONFIG_MD_RAID0=m
551CONFIG_MD_RAID1=m
552# CONFIG_MD_RAID10 is not set
553# CONFIG_MD_RAID456 is not set
554CONFIG_MD_MULTIPATH=m
555# CONFIG_MD_FAULTY is not set
556CONFIG_BLK_DEV_DM=m
557# CONFIG_DM_DEBUG is not set
558CONFIG_DM_CRYPT=m 34CONFIG_DM_CRYPT=m
559CONFIG_DM_SNAPSHOT=m
560CONFIG_DM_MIRROR=m 35CONFIG_DM_MIRROR=m
36CONFIG_DM_SNAPSHOT=m
561CONFIG_DM_ZERO=m 37CONFIG_DM_ZERO=m
562# CONFIG_DM_MULTIPATH is not set
563# CONFIG_DM_DELAY is not set
564# CONFIG_DM_UEVENT is not set
565CONFIG_FUSION=y
566CONFIG_FUSION_SPI=y
567CONFIG_FUSION_FC=y
568# CONFIG_FUSION_SAS is not set
569CONFIG_FUSION_MAX_SGE=128
570CONFIG_FUSION_CTL=y
571# CONFIG_FUSION_LOGGING is not set
572
573#
574# IEEE 1394 (FireWire) support
575#
576
577#
578# Enable only one of the two stacks, unless you know what you are doing
579#
580# CONFIG_FIREWIRE is not set
581# CONFIG_IEEE1394 is not set
582# CONFIG_I2O is not set
583CONFIG_NETDEVICES=y
584CONFIG_DUMMY=m
585# CONFIG_BONDING is not set
586# CONFIG_MACVLAN is not set
587# CONFIG_EQUALIZER is not set
588# CONFIG_TUN is not set
589# CONFIG_VETH is not set
590# CONFIG_NET_SB1000 is not set
591# CONFIG_ARCNET is not set
592CONFIG_PHYLIB=y
593
594#
595# MII PHY device drivers
596#
597# CONFIG_MARVELL_PHY is not set
598# CONFIG_DAVICOM_PHY is not set
599# CONFIG_QSEMI_PHY is not set
600# CONFIG_LXT_PHY is not set
601# CONFIG_CICADA_PHY is not set
602# CONFIG_VITESSE_PHY is not set
603# CONFIG_SMSC_PHY is not set
604# CONFIG_BROADCOM_PHY is not set
605# CONFIG_ICPLUS_PHY is not set
606# CONFIG_REALTEK_PHY is not set
607# CONFIG_NATIONAL_PHY is not set
608# CONFIG_STE10XP is not set
609# CONFIG_LSI_ET1011C_PHY is not set
610# CONFIG_FIXED_PHY is not set
611# CONFIG_MDIO_BITBANG is not set
612CONFIG_NET_ETHERNET=y
613CONFIG_MII=m
614# CONFIG_HAPPYMEAL is not set
615# CONFIG_SUNGEM is not set
616# CONFIG_CASSINI is not set
617# CONFIG_NET_VENDOR_3COM is not set
618CONFIG_NET_TULIP=y
619# CONFIG_DE2104X is not set
620CONFIG_TULIP=m
621# CONFIG_TULIP_MWI is not set
622# CONFIG_TULIP_MMIO is not set
623# CONFIG_TULIP_NAPI is not set
624# CONFIG_DE4X5 is not set
625# CONFIG_WINBOND_840 is not set
626# CONFIG_DM9102 is not set
627# CONFIG_ULI526X is not set
628# CONFIG_HP100 is not set
629# CONFIG_IBM_NEW_EMAC_ZMII is not set
630# CONFIG_IBM_NEW_EMAC_RGMII is not set
631# CONFIG_IBM_NEW_EMAC_TAH is not set
632# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
633# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
634# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
635# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
636CONFIG_NET_PCI=y
637# CONFIG_PCNET32 is not set
638# CONFIG_AMD8111_ETH is not set
639# CONFIG_ADAPTEC_STARFIRE is not set
640# CONFIG_B44 is not set
641# CONFIG_FORCEDETH is not set
642CONFIG_E100=m
643# CONFIG_FEALNX is not set
644# CONFIG_NATSEMI is not set
645# CONFIG_NE2K_PCI is not set
646# CONFIG_8139CP is not set
647# CONFIG_8139TOO is not set
648# CONFIG_R6040 is not set
649# CONFIG_SIS900 is not set
650# CONFIG_EPIC100 is not set
651# CONFIG_SMSC9420 is not set
652# CONFIG_SUNDANCE is not set
653# CONFIG_TLAN is not set
654# CONFIG_VIA_RHINE is not set
655# CONFIG_SC92031 is not set
656# CONFIG_ATL2 is not set
657CONFIG_NETDEV_1000=y
658# CONFIG_ACENIC is not set
659# CONFIG_DL2K is not set
660CONFIG_E1000=y
661# CONFIG_E1000E is not set
662# CONFIG_IP1000 is not set
663# CONFIG_IGB is not set
664# CONFIG_NS83820 is not set
665# CONFIG_HAMACHI is not set
666# CONFIG_YELLOWFIN is not set
667# CONFIG_R8169 is not set
668# CONFIG_SIS190 is not set
669# CONFIG_SKGE is not set
670# CONFIG_SKY2 is not set
671# CONFIG_VIA_VELOCITY is not set
672CONFIG_TIGON3=y
673# CONFIG_BNX2 is not set
674# CONFIG_QLA3XXX is not set
675# CONFIG_ATL1 is not set
676# CONFIG_ATL1E is not set
677# CONFIG_JME is not set
678CONFIG_NETDEV_10000=y
679# CONFIG_CHELSIO_T1 is not set
680CONFIG_CHELSIO_T3_DEPENDS=y
681# CONFIG_CHELSIO_T3 is not set
682# CONFIG_ENIC is not set
683# CONFIG_IXGBE is not set
684# CONFIG_IXGB is not set
685# CONFIG_S2IO is not set
686# CONFIG_MYRI10GE is not set
687# CONFIG_NETXEN_NIC is not set
688# CONFIG_NIU is not set
689# CONFIG_MLX4_EN is not set
690# CONFIG_MLX4_CORE is not set
691# CONFIG_TEHUTI is not set
692# CONFIG_BNX2X is not set
693# CONFIG_QLGE is not set
694# CONFIG_SFC is not set
695# CONFIG_TR is not set
696
697#
698# Wireless LAN
699#
700# CONFIG_WLAN_PRE80211 is not set
701# CONFIG_WLAN_80211 is not set
702# CONFIG_IWLWIFI_LEDS is not set
703
704#
705# Enable WiMAX (Networking options) to see the WiMAX drivers
706#
707
708#
709# USB Network Adapters
710#
711# CONFIG_USB_CATC is not set
712# CONFIG_USB_KAWETH is not set
713# CONFIG_USB_PEGASUS is not set
714# CONFIG_USB_RTL8150 is not set
715# CONFIG_USB_USBNET is not set
716# CONFIG_WAN is not set
717CONFIG_XEN_NETDEV_FRONTEND=y
718# CONFIG_FDDI is not set
719# CONFIG_HIPPI is not set
720# CONFIG_PPP is not set
721# CONFIG_SLIP is not set
722# CONFIG_NET_FC is not set
723CONFIG_NETCONSOLE=y
724# CONFIG_NETCONSOLE_DYNAMIC is not set
725CONFIG_NETPOLL=y
726# CONFIG_NETPOLL_TRAP is not set
727CONFIG_NET_POLL_CONTROLLER=y
728# CONFIG_ISDN is not set
729# CONFIG_PHONE is not set
730
731#
732# Input device support
733#
734CONFIG_INPUT=y
735# CONFIG_INPUT_FF_MEMLESS is not set
736# CONFIG_INPUT_POLLDEV is not set
737
738#
739# Userland interfaces
740#
741CONFIG_INPUT_MOUSEDEV=y
742CONFIG_INPUT_MOUSEDEV_PSAUX=y
743CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
744CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
745# CONFIG_INPUT_JOYDEV is not set
746# CONFIG_INPUT_EVDEV is not set
747# CONFIG_INPUT_EVBUG is not set
748
749#
750# Input Device Drivers
751#
752CONFIG_INPUT_KEYBOARD=y
753CONFIG_KEYBOARD_ATKBD=y
754# CONFIG_KEYBOARD_SUNKBD is not set
755# CONFIG_KEYBOARD_LKKBD is not set
756# CONFIG_KEYBOARD_XTKBD is not set
757# CONFIG_KEYBOARD_NEWTON is not set
758# CONFIG_KEYBOARD_STOWAWAY is not set
759CONFIG_INPUT_MOUSE=y
760CONFIG_MOUSE_PS2=y
761CONFIG_MOUSE_PS2_ALPS=y
762CONFIG_MOUSE_PS2_LOGIPS2PP=y
763CONFIG_MOUSE_PS2_SYNAPTICS=y
764CONFIG_MOUSE_PS2_LIFEBOOK=y
765CONFIG_MOUSE_PS2_TRACKPOINT=y
766# CONFIG_MOUSE_PS2_ELANTECH is not set
767# CONFIG_MOUSE_PS2_TOUCHKIT is not set
768# CONFIG_MOUSE_SERIAL is not set
769# CONFIG_MOUSE_APPLETOUCH is not set
770# CONFIG_MOUSE_BCM5974 is not set
771# CONFIG_MOUSE_VSXXXAA is not set
772# CONFIG_INPUT_JOYSTICK is not set
773# CONFIG_INPUT_TABLET is not set
774# CONFIG_INPUT_TOUCHSCREEN is not set
775# CONFIG_INPUT_MISC is not set
776
777#
778# Hardware I/O ports
779#
780CONFIG_SERIO=y
781CONFIG_SERIO_I8042=y
782# CONFIG_SERIO_SERPORT is not set
783# CONFIG_SERIO_PCIPS2 is not set
784CONFIG_SERIO_LIBPS2=y
785# CONFIG_SERIO_RAW is not set
786CONFIG_GAMEPORT=m
787# CONFIG_GAMEPORT_NS558 is not set
788# CONFIG_GAMEPORT_L4 is not set
789# CONFIG_GAMEPORT_EMU10K1 is not set
790# CONFIG_GAMEPORT_FM801 is not set
791
792#
793# Character devices
794#
795CONFIG_VT=y
796CONFIG_CONSOLE_TRANSLATIONS=y
797CONFIG_VT_CONSOLE=y
798CONFIG_HW_CONSOLE=y
799# CONFIG_VT_HW_CONSOLE_BINDING is not set
800CONFIG_DEVKMEM=y
801CONFIG_SERIAL_NONSTANDARD=y
802# CONFIG_COMPUTONE is not set
803# CONFIG_ROCKETPORT is not set
804# CONFIG_CYCLADES is not set
805# CONFIG_DIGIEPCA is not set
806# CONFIG_MOXA_INTELLIO is not set
807# CONFIG_MOXA_SMARTIO is not set
808# CONFIG_ISI is not set
809# CONFIG_SYNCLINKMP is not set
810# CONFIG_SYNCLINK_GT is not set
811# CONFIG_N_HDLC is not set
812# CONFIG_RISCOM8 is not set
813# CONFIG_SPECIALIX is not set
814# CONFIG_SX is not set
815# CONFIG_RIO is not set
816# CONFIG_STALDRV is not set
817# CONFIG_NOZOMI is not set
818
819#
820# Serial drivers
821#
822CONFIG_SERIAL_8250=y
823CONFIG_SERIAL_8250_CONSOLE=y
824CONFIG_SERIAL_8250_PCI=y
825CONFIG_SERIAL_8250_PNP=y
826CONFIG_SERIAL_8250_NR_UARTS=6
827CONFIG_SERIAL_8250_RUNTIME_UARTS=4
828CONFIG_SERIAL_8250_EXTENDED=y
829CONFIG_SERIAL_8250_SHARE_IRQ=y
830# CONFIG_SERIAL_8250_DETECT_IRQ is not set
831# CONFIG_SERIAL_8250_RSA is not set
832
833#
834# Non-8250 serial port support
835#
836CONFIG_SERIAL_CORE=y
837CONFIG_SERIAL_CORE_CONSOLE=y
838# CONFIG_SERIAL_JSM is not set
839CONFIG_UNIX98_PTYS=y
840# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
841CONFIG_LEGACY_PTYS=y
842CONFIG_LEGACY_PTY_COUNT=256
843CONFIG_HVC_DRIVER=y
844CONFIG_HVC_IRQ=y
845CONFIG_HVC_XEN=y
846# CONFIG_IPMI_HANDLER is not set
847# CONFIG_HW_RANDOM is not set
848CONFIG_EFI_RTC=y
849# CONFIG_R3964 is not set
850# CONFIG_APPLICOM is not set
851CONFIG_RAW_DRIVER=m
852CONFIG_MAX_RAW_DEVS=256
853CONFIG_HPET=y
854CONFIG_HPET_MMAP=y
855# CONFIG_HANGCHECK_TIMER is not set
856# CONFIG_TCG_TPM is not set
857CONFIG_DEVPORT=y
858CONFIG_I2C=m
859CONFIG_I2C_BOARDINFO=y
860# CONFIG_I2C_CHARDEV is not set
861CONFIG_I2C_HELPER_AUTO=y
862CONFIG_I2C_ALGOBIT=m
863
864#
865# I2C Hardware Bus support
866#
867
868#
869# PC SMBus host controller drivers
870#
871# CONFIG_I2C_ALI1535 is not set
872# CONFIG_I2C_ALI1563 is not set
873# CONFIG_I2C_ALI15X3 is not set
874# CONFIG_I2C_AMD756 is not set
875# CONFIG_I2C_AMD8111 is not set
876# CONFIG_I2C_I801 is not set
877# CONFIG_I2C_ISCH is not set
878# CONFIG_I2C_PIIX4 is not set
879# CONFIG_I2C_NFORCE2 is not set
880# CONFIG_I2C_SIS5595 is not set
881# CONFIG_I2C_SIS630 is not set
882# CONFIG_I2C_SIS96X is not set
883# CONFIG_I2C_VIA is not set
884# CONFIG_I2C_VIAPRO is not set
885
886#
887# I2C system bus drivers (mostly embedded / system-on-chip)
888#
889# CONFIG_I2C_OCORES is not set
890# CONFIG_I2C_SIMTEC is not set
891
892#
893# External I2C/SMBus adapter drivers
894#
895# CONFIG_I2C_PARPORT_LIGHT is not set
896# CONFIG_I2C_TAOS_EVM is not set
897# CONFIG_I2C_TINY_USB is not set
898
899#
900# Graphics adapter I2C/DDC channel drivers
901#
902# CONFIG_I2C_VOODOO3 is not set
903
904#
905# Other I2C/SMBus bus drivers
906#
907# CONFIG_I2C_PCA_PLATFORM is not set
908# CONFIG_I2C_STUB is not set
909
910#
911# Miscellaneous I2C Chip support
912#
913# CONFIG_DS1682 is not set
914# CONFIG_AT24 is not set
915# CONFIG_SENSORS_EEPROM is not set
916# CONFIG_SENSORS_PCF8574 is not set
917# CONFIG_PCF8575 is not set
918# CONFIG_SENSORS_PCA9539 is not set
919# CONFIG_SENSORS_PCF8591 is not set
920# CONFIG_SENSORS_MAX6875 is not set
921# CONFIG_SENSORS_TSL2550 is not set
922# CONFIG_I2C_DEBUG_CORE is not set
923# CONFIG_I2C_DEBUG_ALGO is not set
924# CONFIG_I2C_DEBUG_BUS is not set
925# CONFIG_I2C_DEBUG_CHIP is not set
926# CONFIG_SPI is not set
927# CONFIG_W1 is not set
928CONFIG_POWER_SUPPLY=y
929# CONFIG_POWER_SUPPLY_DEBUG is not set
930# CONFIG_PDA_POWER is not set
931# CONFIG_BATTERY_DS2760 is not set
932# CONFIG_BATTERY_BQ27x00 is not set
933CONFIG_HWMON=y
934# CONFIG_HWMON_VID is not set
935# CONFIG_SENSORS_AD7414 is not set
936# CONFIG_SENSORS_AD7418 is not set
937# CONFIG_SENSORS_ADM1021 is not set
938# CONFIG_SENSORS_ADM1025 is not set
939# CONFIG_SENSORS_ADM1026 is not set
940# CONFIG_SENSORS_ADM1029 is not set
941# CONFIG_SENSORS_ADM1031 is not set
942# CONFIG_SENSORS_ADM9240 is not set
943# CONFIG_SENSORS_ADT7462 is not set
944# CONFIG_SENSORS_ADT7470 is not set
945# CONFIG_SENSORS_ADT7473 is not set
946# CONFIG_SENSORS_ATXP1 is not set
947# CONFIG_SENSORS_DS1621 is not set
948# CONFIG_SENSORS_I5K_AMB is not set
949# CONFIG_SENSORS_F71805F is not set
950# CONFIG_SENSORS_F71882FG is not set
951# CONFIG_SENSORS_F75375S is not set
952# CONFIG_SENSORS_GL518SM is not set
953# CONFIG_SENSORS_GL520SM is not set
954# CONFIG_SENSORS_IT87 is not set
955# CONFIG_SENSORS_LM63 is not set
956# CONFIG_SENSORS_LM75 is not set
957# CONFIG_SENSORS_LM77 is not set
958# CONFIG_SENSORS_LM78 is not set
959# CONFIG_SENSORS_LM80 is not set
960# CONFIG_SENSORS_LM83 is not set
961# CONFIG_SENSORS_LM85 is not set
962# CONFIG_SENSORS_LM87 is not set
963# CONFIG_SENSORS_LM90 is not set
964# CONFIG_SENSORS_LM92 is not set
965# CONFIG_SENSORS_LM93 is not set
966# CONFIG_SENSORS_LTC4245 is not set
967# CONFIG_SENSORS_MAX1619 is not set
968# CONFIG_SENSORS_MAX6650 is not set
969# CONFIG_SENSORS_PC87360 is not set
970# CONFIG_SENSORS_PC87427 is not set
971# CONFIG_SENSORS_SIS5595 is not set
972# CONFIG_SENSORS_DME1737 is not set
973# CONFIG_SENSORS_SMSC47M1 is not set
974# CONFIG_SENSORS_SMSC47M192 is not set
975# CONFIG_SENSORS_SMSC47B397 is not set
976# CONFIG_SENSORS_ADS7828 is not set
977# CONFIG_SENSORS_THMC50 is not set
978# CONFIG_SENSORS_VIA686A is not set
979# CONFIG_SENSORS_VT1211 is not set
980# CONFIG_SENSORS_VT8231 is not set
981# CONFIG_SENSORS_W83781D is not set
982# CONFIG_SENSORS_W83791D is not set
983# CONFIG_SENSORS_W83792D is not set
984# CONFIG_SENSORS_W83793 is not set
985# CONFIG_SENSORS_W83L785TS is not set
986# CONFIG_SENSORS_W83L786NG is not set
987# CONFIG_SENSORS_W83627HF is not set
988# CONFIG_SENSORS_W83627EHF is not set
989# CONFIG_SENSORS_LIS3LV02D is not set
990# CONFIG_HWMON_DEBUG_CHIP is not set
991CONFIG_THERMAL=m
992# CONFIG_THERMAL_HWMON is not set
993# CONFIG_WATCHDOG is not set
994CONFIG_SSB_POSSIBLE=y
995
996#
997# Sonics Silicon Backplane
998#
999# CONFIG_SSB is not set
1000
1001#
1002# Multifunction device drivers
1003#
1004# CONFIG_MFD_CORE is not set
1005# CONFIG_MFD_SM501 is not set
1006# CONFIG_HTC_PASIC3 is not set
1007# CONFIG_MFD_TMIO is not set
1008# CONFIG_MFD_WM8400 is not set
1009# CONFIG_MFD_WM8350_I2C is not set
1010# CONFIG_MFD_PCF50633 is not set
1011# CONFIG_REGULATOR is not set
1012
1013#
1014# Multimedia devices
1015#
1016
1017#
1018# Multimedia core support
1019#
1020# CONFIG_VIDEO_DEV is not set
1021# CONFIG_DVB_CORE is not set
1022# CONFIG_VIDEO_MEDIA is not set
1023
1024#
1025# Multimedia drivers
1026#
1027CONFIG_DAB=y
1028# CONFIG_USB_DABUSB is not set
1029
1030#
1031# Graphics support
1032#
1033CONFIG_AGP=m
1034CONFIG_DRM=m 38CONFIG_DRM=m
1035CONFIG_DRM_TDFX=m 39CONFIG_DRM_MGA=m
1036CONFIG_DRM_R128=m 40CONFIG_DRM_R128=m
1037CONFIG_DRM_RADEON=m 41CONFIG_DRM_RADEON=m
1038CONFIG_DRM_MGA=m
1039CONFIG_DRM_SIS=m 42CONFIG_DRM_SIS=m
1040# CONFIG_DRM_VIA is not set 43CONFIG_DRM_TDFX=m
1041# CONFIG_DRM_SAVAGE is not set 44CONFIG_DUMMY=m
1042# CONFIG_VGASTATE is not set 45CONFIG_E1000=y
1043# CONFIG_VIDEO_OUTPUT_CONTROL is not set 46CONFIG_E100=m
1044# CONFIG_FB is not set 47CONFIG_EFI_PARTITION=y
1045# CONFIG_BACKLIGHT_LCD_SUPPORT is not set 48CONFIG_EFI_RTC=y
1046 49CONFIG_EFI_VARS=y
1047# 50CONFIG_EXPERIMENTAL=y
1048# Display device support 51CONFIG_EXT2_FS_POSIX_ACL=y
1049# 52CONFIG_EXT2_FS_SECURITY=y
1050# CONFIG_DISPLAY_SUPPORT is not set 53CONFIG_EXT2_FS_XATTR=y
1051 54CONFIG_EXT2_FS=y
1052# 55CONFIG_EXT3_FS_POSIX_ACL=y
1053# Console display driver support 56CONFIG_EXT3_FS_SECURITY=y
1054# 57CONFIG_EXT3_FS=y
1055CONFIG_VGA_CONSOLE=y 58CONFIG_FORCE_CPEI_RETARGET=y
1056# CONFIG_VGACON_SOFT_SCROLLBACK is not set 59CONFIG_FUSION_CTL=y
1057CONFIG_DUMMY_CONSOLE=y 60CONFIG_FUSION_FC=y
1058# CONFIG_SOUND is not set 61CONFIG_FUSION_SPI=y
1059CONFIG_HID_SUPPORT=y 62CONFIG_FUSION=y
1060CONFIG_HID=y 63CONFIG_GAMEPORT=m
1061# CONFIG_HID_DEBUG is not set
1062# CONFIG_HIDRAW is not set
1063
1064#
1065# USB Input Devices
1066#
1067CONFIG_USB_HID=y
1068# CONFIG_HID_PID is not set
1069# CONFIG_USB_HIDDEV is not set
1070
1071#
1072# Special HID drivers
1073#
1074CONFIG_HID_COMPAT=y
1075CONFIG_HID_A4TECH=y
1076CONFIG_HID_APPLE=y
1077CONFIG_HID_BELKIN=y
1078CONFIG_HID_CHERRY=y
1079CONFIG_HID_CHICONY=y
1080CONFIG_HID_CYPRESS=y
1081CONFIG_HID_EZKEY=y
1082CONFIG_HID_GYRATION=y 64CONFIG_HID_GYRATION=y
1083CONFIG_HID_LOGITECH=y
1084# CONFIG_LOGITECH_FF is not set
1085# CONFIG_LOGIRUMBLEPAD2_FF is not set
1086CONFIG_HID_MICROSOFT=y
1087CONFIG_HID_MONTEREY=y
1088CONFIG_HID_NTRIG=y 65CONFIG_HID_NTRIG=y
1089CONFIG_HID_PANTHERLORD=y 66CONFIG_HID_PANTHERLORD=y
1090# CONFIG_PANTHERLORD_FF is not set
1091CONFIG_HID_PETALYNX=y 67CONFIG_HID_PETALYNX=y
1092CONFIG_HID_SAMSUNG=y 68CONFIG_HID_SAMSUNG=y
1093CONFIG_HID_SONY=y 69CONFIG_HID_SONY=y
1094CONFIG_HID_SUNPLUS=y 70CONFIG_HID_SUNPLUS=y
1095# CONFIG_GREENASIA_FF is not set
1096CONFIG_HID_TOPSEED=y 71CONFIG_HID_TOPSEED=y
1097# CONFIG_THRUSTMASTER_FF is not set 72CONFIG_HOTPLUG_CPU=y
1098# CONFIG_ZEROPLUS_FF is not set 73CONFIG_HOTPLUG_PCI_ACPI=m
1099CONFIG_USB_SUPPORT=y 74CONFIG_HOTPLUG_PCI=m
1100CONFIG_USB_ARCH_HAS_HCD=y 75CONFIG_HPET=y
1101CONFIG_USB_ARCH_HAS_OHCI=y 76CONFIG_HUGETLBFS=y
1102CONFIG_USB_ARCH_HAS_EHCI=y 77# CONFIG_HW_RANDOM is not set
1103CONFIG_USB=y 78CONFIG_IA64_CYCLONE=y
1104# CONFIG_USB_DEBUG is not set 79CONFIG_IA64_GRANULE_16MB=y
1105# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set 80CONFIG_IA64_MCA_RECOVERY=y
1106 81CONFIG_IA64_PALINFO=y
1107# 82CONFIG_IA64_XEN_GUEST=y
1108# Miscellaneous USB options 83CONFIG_IDE=y
1109# 84CONFIG_IKCONFIG_PROC=y
1110CONFIG_USB_DEVICEFS=y 85CONFIG_IKCONFIG=y
1111CONFIG_USB_DEVICE_CLASS=y 86# CONFIG_INET_LRO is not set
1112# CONFIG_USB_DYNAMIC_MINORS is not set 87CONFIG_INET=y
1113# CONFIG_USB_SUSPEND is not set
1114# CONFIG_USB_OTG is not set
1115# CONFIG_USB_MON is not set
1116# CONFIG_USB_WUSB is not set
1117# CONFIG_USB_WUSB_CBAF is not set
1118
1119#
1120# USB Host Controller Drivers
1121#
1122# CONFIG_USB_C67X00_HCD is not set
1123CONFIG_USB_EHCI_HCD=m
1124# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1125# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1126# CONFIG_USB_OXU210HP_HCD is not set
1127# CONFIG_USB_ISP116X_HCD is not set
1128# CONFIG_USB_ISP1760_HCD is not set
1129CONFIG_USB_OHCI_HCD=m
1130# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1131# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
1132CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1133CONFIG_USB_UHCI_HCD=y
1134# CONFIG_USB_SL811_HCD is not set
1135# CONFIG_USB_R8A66597_HCD is not set
1136# CONFIG_USB_WHCI_HCD is not set
1137# CONFIG_USB_HWA_HCD is not set
1138
1139#
1140# USB Device Class drivers
1141#
1142# CONFIG_USB_ACM is not set
1143# CONFIG_USB_PRINTER is not set
1144# CONFIG_USB_WDM is not set
1145# CONFIG_USB_TMC is not set
1146
1147#
1148# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may also be needed;
1149#
1150
1151#
1152# see USB_STORAGE Help for more information
1153#
1154CONFIG_USB_STORAGE=m
1155# CONFIG_USB_STORAGE_DEBUG is not set
1156# CONFIG_USB_STORAGE_DATAFAB is not set
1157# CONFIG_USB_STORAGE_FREECOM is not set
1158# CONFIG_USB_STORAGE_ISD200 is not set
1159# CONFIG_USB_STORAGE_USBAT is not set
1160# CONFIG_USB_STORAGE_SDDR09 is not set
1161# CONFIG_USB_STORAGE_SDDR55 is not set
1162# CONFIG_USB_STORAGE_JUMPSHOT is not set
1163# CONFIG_USB_STORAGE_ALAUDA is not set
1164# CONFIG_USB_STORAGE_ONETOUCH is not set
1165# CONFIG_USB_STORAGE_KARMA is not set
1166# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1167# CONFIG_USB_LIBUSUAL is not set
1168
1169#
1170# USB Imaging devices
1171#
1172# CONFIG_USB_MDC800 is not set
1173# CONFIG_USB_MICROTEK is not set
1174
1175#
1176# USB port drivers
1177#
1178# CONFIG_USB_SERIAL is not set
1179
1180#
1181# USB Miscellaneous drivers
1182#
1183# CONFIG_USB_EMI62 is not set
1184# CONFIG_USB_EMI26 is not set
1185# CONFIG_USB_ADUTUX is not set
1186# CONFIG_USB_SEVSEG is not set
1187# CONFIG_USB_RIO500 is not set
1188# CONFIG_USB_LEGOTOWER is not set
1189# CONFIG_USB_LCD is not set
1190# CONFIG_USB_BERRY_CHARGE is not set
1191# CONFIG_USB_LED is not set
1192# CONFIG_USB_CYPRESS_CY7C63 is not set
1193# CONFIG_USB_CYTHERM is not set
1194# CONFIG_USB_PHIDGET is not set
1195# CONFIG_USB_IDMOUSE is not set
1196# CONFIG_USB_FTDI_ELAN is not set
1197# CONFIG_USB_APPLEDISPLAY is not set
1198# CONFIG_USB_SISUSBVGA is not set
1199# CONFIG_USB_LD is not set
1200# CONFIG_USB_TRANCEVIBRATOR is not set
1201# CONFIG_USB_IOWARRIOR is not set
1202# CONFIG_USB_TEST is not set
1203# CONFIG_USB_ISIGHTFW is not set
1204# CONFIG_USB_VST is not set
1205# CONFIG_USB_GADGET is not set
1206
1207#
1208# OTG and related infrastructure
1209#
1210# CONFIG_UWB is not set
1211# CONFIG_MMC is not set
1212# CONFIG_MEMSTICK is not set
1213# CONFIG_NEW_LEDS is not set
1214# CONFIG_ACCESSIBILITY is not set
1215# CONFIG_INFINIBAND is not set
1216# CONFIG_RTC_CLASS is not set
1217# CONFIG_DMADEVICES is not set
1218# CONFIG_UIO is not set
1219CONFIG_XEN_BALLOON=y
1220CONFIG_XEN_SCRUB_PAGES=y
1221CONFIG_XENFS=y
1222CONFIG_XEN_COMPAT_XENFS=y
1223# CONFIG_STAGING is not set
1224# CONFIG_MSPEC is not set
1225
1226#
1227# File systems
1228#
1229CONFIG_EXT2_FS=y
1230CONFIG_EXT2_FS_XATTR=y
1231CONFIG_EXT2_FS_POSIX_ACL=y
1232CONFIG_EXT2_FS_SECURITY=y
1233# CONFIG_EXT2_FS_XIP is not set
1234CONFIG_EXT3_FS=y
1235CONFIG_EXT3_FS_XATTR=y
1236CONFIG_EXT3_FS_POSIX_ACL=y
1237CONFIG_EXT3_FS_SECURITY=y
1238# CONFIG_EXT4_FS is not set
1239CONFIG_JBD=y
1240CONFIG_FS_MBCACHE=y
1241CONFIG_REISERFS_FS=y
1242# CONFIG_REISERFS_CHECK is not set
1243# CONFIG_REISERFS_PROC_INFO is not set
1244CONFIG_REISERFS_FS_XATTR=y
1245CONFIG_REISERFS_FS_POSIX_ACL=y
1246CONFIG_REISERFS_FS_SECURITY=y
1247# CONFIG_JFS_FS is not set
1248CONFIG_FS_POSIX_ACL=y
1249CONFIG_FILE_LOCKING=y
1250CONFIG_XFS_FS=y
1251# CONFIG_XFS_QUOTA is not set
1252# CONFIG_XFS_POSIX_ACL is not set
1253# CONFIG_XFS_RT is not set
1254# CONFIG_XFS_DEBUG is not set
1255# CONFIG_GFS2_FS is not set
1256# CONFIG_OCFS2_FS is not set
1257# CONFIG_BTRFS_FS is not set
1258CONFIG_DNOTIFY=y
1259CONFIG_INOTIFY=y 88CONFIG_INOTIFY=y
1260CONFIG_INOTIFY_USER=y 89CONFIG_IP_MULTICAST=y
1261# CONFIG_QUOTA is not set 90# CONFIG_IPV6 is not set
1262CONFIG_AUTOFS_FS=y
1263CONFIG_AUTOFS4_FS=y
1264# CONFIG_FUSE_FS is not set
1265
1266#
1267# CD-ROM/DVD Filesystems
1268#
1269CONFIG_ISO9660_FS=m 91CONFIG_ISO9660_FS=m
1270CONFIG_JOLIET=y 92CONFIG_JOLIET=y
1271# CONFIG_ZISOFS is not set 93CONFIG_KALLSYMS_ALL=y
1272CONFIG_UDF_FS=m 94CONFIG_KEXEC=y
1273CONFIG_UDF_NLS=y 95CONFIG_LOG_BUF_SHIFT=20
1274 96CONFIG_MAGIC_SYSRQ=y
1275# 97CONFIG_MCKINLEY=y
1276# DOS/FAT/NT Filesystems 98CONFIG_MD_LINEAR=m
1277# 99CONFIG_MD_MULTIPATH=m
1278CONFIG_FAT_FS=y 100CONFIG_MD_RAID0=m
1279# CONFIG_MSDOS_FS is not set 101CONFIG_MD_RAID1=m
1280CONFIG_VFAT_FS=y 102CONFIG_MD=y
1281CONFIG_FAT_DEFAULT_CODEPAGE=437 103CONFIG_MODULE_SRCVERSION_ALL=y
1282CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" 104CONFIG_MODULES=y
1283CONFIG_NTFS_FS=m 105CONFIG_MODULE_UNLOAD=y
1284# CONFIG_NTFS_DEBUG is not set 106CONFIG_MODVERSIONS=y
1285# CONFIG_NTFS_RW is not set 107CONFIG_NETCONSOLE=y
1286 108CONFIG_NETDEVICES=y
1287# 109CONFIG_NET_ETHERNET=y
1288# Pseudo filesystems 110CONFIG_NET_PCI=y
1289# 111CONFIG_NET_TULIP=y
1290CONFIG_PROC_FS=y 112CONFIG_NFSD=m
1291CONFIG_PROC_KCORE=y 113CONFIG_NFSD_V4=y
1292CONFIG_PROC_SYSCTL=y
1293CONFIG_PROC_PAGE_MONITOR=y
1294CONFIG_SYSFS=y
1295CONFIG_TMPFS=y
1296# CONFIG_TMPFS_POSIX_ACL is not set
1297CONFIG_HUGETLBFS=y
1298CONFIG_HUGETLB_PAGE=y
1299# CONFIG_CONFIGFS_FS is not set
1300CONFIG_MISC_FILESYSTEMS=y
1301# CONFIG_ADFS_FS is not set
1302# CONFIG_AFFS_FS is not set
1303# CONFIG_HFS_FS is not set
1304# CONFIG_HFSPLUS_FS is not set
1305# CONFIG_BEFS_FS is not set
1306# CONFIG_BFS_FS is not set
1307# CONFIG_EFS_FS is not set
1308# CONFIG_CRAMFS is not set
1309# CONFIG_SQUASHFS is not set
1310# CONFIG_VXFS_FS is not set
1311# CONFIG_MINIX_FS is not set
1312# CONFIG_OMFS_FS is not set
1313# CONFIG_HPFS_FS is not set
1314# CONFIG_QNX4FS_FS is not set
1315# CONFIG_ROMFS_FS is not set
1316# CONFIG_SYSV_FS is not set
1317# CONFIG_UFS_FS is not set
1318CONFIG_NETWORK_FILESYSTEMS=y
1319CONFIG_NFS_FS=m 114CONFIG_NFS_FS=m
1320CONFIG_NFS_V3=y 115CONFIG_NFS_V3=y
1321# CONFIG_NFS_V3_ACL is not set
1322CONFIG_NFS_V4=y 116CONFIG_NFS_V4=y
1323CONFIG_NFSD=m 117CONFIG_NLS_CODEPAGE_1250=m
1324CONFIG_NFSD_V3=y 118CONFIG_NLS_CODEPAGE_1251=m
1325# CONFIG_NFSD_V3_ACL is not set
1326CONFIG_NFSD_V4=y
1327CONFIG_LOCKD=m
1328CONFIG_LOCKD_V4=y
1329CONFIG_EXPORTFS=m
1330CONFIG_NFS_COMMON=y
1331CONFIG_SUNRPC=m
1332CONFIG_SUNRPC_GSS=m
1333# CONFIG_SUNRPC_REGISTER_V4 is not set
1334CONFIG_RPCSEC_GSS_KRB5=m
1335# CONFIG_RPCSEC_GSS_SPKM3 is not set
1336CONFIG_SMB_FS=m
1337CONFIG_SMB_NLS_DEFAULT=y
1338CONFIG_SMB_NLS_REMOTE="cp437"
1339CONFIG_CIFS=m
1340# CONFIG_CIFS_STATS is not set
1341# CONFIG_CIFS_WEAK_PW_HASH is not set
1342# CONFIG_CIFS_XATTR is not set
1343# CONFIG_CIFS_DEBUG2 is not set
1344# CONFIG_CIFS_EXPERIMENTAL is not set
1345# CONFIG_NCP_FS is not set
1346# CONFIG_CODA_FS is not set
1347# CONFIG_AFS_FS is not set
1348
1349#
1350# Partition Types
1351#
1352CONFIG_PARTITION_ADVANCED=y
1353# CONFIG_ACORN_PARTITION is not set
1354# CONFIG_OSF_PARTITION is not set
1355# CONFIG_AMIGA_PARTITION is not set
1356# CONFIG_ATARI_PARTITION is not set
1357# CONFIG_MAC_PARTITION is not set
1358CONFIG_MSDOS_PARTITION=y
1359# CONFIG_BSD_DISKLABEL is not set
1360# CONFIG_MINIX_SUBPARTITION is not set
1361# CONFIG_SOLARIS_X86_PARTITION is not set
1362# CONFIG_UNIXWARE_DISKLABEL is not set
1363# CONFIG_LDM_PARTITION is not set
1364CONFIG_SGI_PARTITION=y
1365# CONFIG_ULTRIX_PARTITION is not set
1366# CONFIG_SUN_PARTITION is not set
1367# CONFIG_KARMA_PARTITION is not set
1368CONFIG_EFI_PARTITION=y
1369# CONFIG_SYSV68_PARTITION is not set
1370CONFIG_NLS=y
1371CONFIG_NLS_DEFAULT="iso8859-1"
1372CONFIG_NLS_CODEPAGE_437=y 119CONFIG_NLS_CODEPAGE_437=y
1373CONFIG_NLS_CODEPAGE_737=m 120CONFIG_NLS_CODEPAGE_737=m
1374CONFIG_NLS_CODEPAGE_775=m 121CONFIG_NLS_CODEPAGE_775=m
@@ -1384,15 +131,14 @@ CONFIG_NLS_CODEPAGE_864=m
1384CONFIG_NLS_CODEPAGE_865=m 131CONFIG_NLS_CODEPAGE_865=m
1385CONFIG_NLS_CODEPAGE_866=m 132CONFIG_NLS_CODEPAGE_866=m
1386CONFIG_NLS_CODEPAGE_869=m 133CONFIG_NLS_CODEPAGE_869=m
1387CONFIG_NLS_CODEPAGE_936=m 134CONFIG_NLS_CODEPAGE_874=m
1388CONFIG_NLS_CODEPAGE_950=m
1389CONFIG_NLS_CODEPAGE_932=m 135CONFIG_NLS_CODEPAGE_932=m
136CONFIG_NLS_CODEPAGE_936=m
1390CONFIG_NLS_CODEPAGE_949=m 137CONFIG_NLS_CODEPAGE_949=m
1391CONFIG_NLS_CODEPAGE_874=m 138CONFIG_NLS_CODEPAGE_950=m
1392CONFIG_NLS_ISO8859_8=m 139CONFIG_NLS_ISO8859_13=m
1393CONFIG_NLS_CODEPAGE_1250=m 140CONFIG_NLS_ISO8859_14=m
1394CONFIG_NLS_CODEPAGE_1251=m 141CONFIG_NLS_ISO8859_15=m
1395# CONFIG_NLS_ASCII is not set
1396CONFIG_NLS_ISO8859_1=y 142CONFIG_NLS_ISO8859_1=y
1397CONFIG_NLS_ISO8859_2=m 143CONFIG_NLS_ISO8859_2=m
1398CONFIG_NLS_ISO8859_3=m 144CONFIG_NLS_ISO8859_3=m
@@ -1400,200 +146,54 @@ CONFIG_NLS_ISO8859_4=m
1400CONFIG_NLS_ISO8859_5=m 146CONFIG_NLS_ISO8859_5=m
1401CONFIG_NLS_ISO8859_6=m 147CONFIG_NLS_ISO8859_6=m
1402CONFIG_NLS_ISO8859_7=m 148CONFIG_NLS_ISO8859_7=m
149CONFIG_NLS_ISO8859_8=m
1403CONFIG_NLS_ISO8859_9=m 150CONFIG_NLS_ISO8859_9=m
1404CONFIG_NLS_ISO8859_13=m
1405CONFIG_NLS_ISO8859_14=m
1406CONFIG_NLS_ISO8859_15=m
1407CONFIG_NLS_KOI8_R=m 151CONFIG_NLS_KOI8_R=m
1408CONFIG_NLS_KOI8_U=m 152CONFIG_NLS_KOI8_U=m
1409CONFIG_NLS_UTF8=m 153CONFIG_NLS_UTF8=m
1410# CONFIG_DLM is not set 154CONFIG_NR_CPUS=16
1411 155CONFIG_NTFS_FS=m
1412# 156CONFIG_PACKET=y
1413# Kernel hacking 157CONFIG_PARAVIRT_GUEST=y
1414# 158CONFIG_PARTITION_ADVANCED=y
1415# CONFIG_PRINTK_TIME is not set 159CONFIG_PERFMON=y
1416CONFIG_ENABLE_WARN_DEPRECATED=y 160CONFIG_PERMIT_BSP_REMOVE=y
1417CONFIG_ENABLE_MUST_CHECK=y 161CONFIG_POSIX_MQUEUE=y
1418CONFIG_FRAME_WARN=2048 162CONFIG_PROC_KCORE=y
1419CONFIG_MAGIC_SYSRQ=y 163CONFIG_RAW_DRIVER=m
1420# CONFIG_UNUSED_SYMBOLS is not set
1421# CONFIG_DEBUG_FS is not set
1422# CONFIG_HEADERS_CHECK is not set
1423CONFIG_DEBUG_KERNEL=y
1424# CONFIG_DEBUG_SHIRQ is not set
1425CONFIG_DETECT_SOFTLOCKUP=y
1426# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
1427CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
1428CONFIG_SCHED_DEBUG=y
1429# CONFIG_SCHEDSTATS is not set
1430# CONFIG_TIMER_STATS is not set
1431# CONFIG_DEBUG_OBJECTS is not set
1432# CONFIG_SLUB_DEBUG_ON is not set
1433# CONFIG_SLUB_STATS is not set
1434# CONFIG_DEBUG_RT_MUTEXES is not set
1435# CONFIG_RT_MUTEX_TESTER is not set
1436# CONFIG_DEBUG_SPINLOCK is not set
1437CONFIG_DEBUG_MUTEXES=y
1438# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1439# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1440# CONFIG_DEBUG_KOBJECT is not set
1441# CONFIG_DEBUG_INFO is not set
1442# CONFIG_DEBUG_VM is not set
1443# CONFIG_DEBUG_WRITECOUNT is not set
1444CONFIG_DEBUG_MEMORY_INIT=y
1445# CONFIG_DEBUG_LIST is not set
1446# CONFIG_DEBUG_SG is not set
1447# CONFIG_DEBUG_NOTIFIERS is not set
1448# CONFIG_BOOT_PRINTK_DELAY is not set
1449# CONFIG_RCU_TORTURE_TEST is not set
1450# CONFIG_RCU_CPU_STALL_DETECTOR is not set 164# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1451# CONFIG_BACKTRACE_SELF_TEST is not set 165CONFIG_REISERFS_FS_POSIX_ACL=y
1452# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set 166CONFIG_REISERFS_FS_SECURITY=y
1453# CONFIG_FAULT_INJECTION is not set 167CONFIG_REISERFS_FS_XATTR=y
1454# CONFIG_SYSCTL_SYSCALL_CHECK is not set 168CONFIG_REISERFS_FS=y
1455 169CONFIG_SCSI_QLOGIC_1280=y
1456# 170CONFIG_SCSI_SYM53C8XX_2=y
1457# Tracers 171CONFIG_SCSI=y
1458# 172CONFIG_SERIAL_8250_CONSOLE=y
1459# CONFIG_SCHED_TRACER is not set 173CONFIG_SERIAL_8250_EXTENDED=y
1460# CONFIG_CONTEXT_SWITCH_TRACER is not set 174CONFIG_SERIAL_8250_NR_UARTS=6
1461# CONFIG_BOOT_TRACER is not set 175CONFIG_SERIAL_8250_SHARE_IRQ=y
1462# CONFIG_TRACE_BRANCH_PROFILING is not set 176CONFIG_SERIAL_8250=y
1463# CONFIG_DYNAMIC_PRINTK_DEBUG is not set 177CONFIG_SERIAL_NONSTANDARD=y
1464# CONFIG_SAMPLES is not set 178# CONFIG_SERIO_SERPORT is not set
1465CONFIG_IA64_GRANULE_16MB=y 179CONFIG_SGI_PARTITION=y
1466# CONFIG_IA64_GRANULE_64MB is not set 180CONFIG_SMB_FS=m
1467# CONFIG_IA64_PRINT_HAZARDS is not set 181CONFIG_SMB_NLS_DEFAULT=y
1468# CONFIG_DISABLE_VHPT is not set 182CONFIG_SMP=y
1469# CONFIG_IA64_DEBUG_CMPXCHG is not set 183CONFIG_SYN_COOKIES=y
1470# CONFIG_IA64_DEBUG_IRQ is not set 184CONFIG_SYSFS_DEPRECATED_V2=y
1471 185CONFIG_SYSVIPC=y
1472# 186CONFIG_TIGON3=y
1473# Security options 187CONFIG_TMPFS=y
1474# 188CONFIG_TULIP=m
1475# CONFIG_KEYS is not set 189CONFIG_UDF_FS=m
1476# CONFIG_SECURITY is not set 190CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
1477# CONFIG_SECURITYFS is not set 191CONFIG_UNIX=y
1478# CONFIG_SECURITY_FILE_CAPABILITIES is not set 192CONFIG_USB_DEVICEFS=y
1479CONFIG_CRYPTO=y 193CONFIG_USB_EHCI_HCD=m
1480 194CONFIG_USB_OHCI_HCD=m
1481# 195CONFIG_USB_STORAGE=m
1482# Crypto core or helper 196CONFIG_USB_UHCI_HCD=y
1483# 197CONFIG_USB=y
1484# CONFIG_CRYPTO_FIPS is not set 198CONFIG_VFAT_FS=y
1485CONFIG_CRYPTO_ALGAPI=y 199CONFIG_XFS_FS=y
1486CONFIG_CRYPTO_ALGAPI2=y
1487CONFIG_CRYPTO_AEAD2=y
1488CONFIG_CRYPTO_BLKCIPHER=m
1489CONFIG_CRYPTO_BLKCIPHER2=y
1490CONFIG_CRYPTO_HASH=y
1491CONFIG_CRYPTO_HASH2=y
1492CONFIG_CRYPTO_RNG2=y
1493CONFIG_CRYPTO_MANAGER=m
1494CONFIG_CRYPTO_MANAGER2=y
1495# CONFIG_CRYPTO_GF128MUL is not set
1496# CONFIG_CRYPTO_NULL is not set
1497# CONFIG_CRYPTO_CRYPTD is not set
1498# CONFIG_CRYPTO_AUTHENC is not set
1499# CONFIG_CRYPTO_TEST is not set
1500
1501#
1502# Authenticated Encryption with Associated Data
1503#
1504# CONFIG_CRYPTO_CCM is not set
1505# CONFIG_CRYPTO_GCM is not set
1506# CONFIG_CRYPTO_SEQIV is not set
1507
1508#
1509# Block modes
1510#
1511CONFIG_CRYPTO_CBC=m
1512# CONFIG_CRYPTO_CTR is not set
1513# CONFIG_CRYPTO_CTS is not set
1514CONFIG_CRYPTO_ECB=m
1515# CONFIG_CRYPTO_LRW is not set
1516CONFIG_CRYPTO_PCBC=m
1517# CONFIG_CRYPTO_XTS is not set
1518
1519#
1520# Hash modes
1521#
1522# CONFIG_CRYPTO_HMAC is not set
1523# CONFIG_CRYPTO_XCBC is not set
1524
1525#
1526# Digest
1527#
1528# CONFIG_CRYPTO_CRC32C is not set
1529# CONFIG_CRYPTO_MD4 is not set
1530CONFIG_CRYPTO_MD5=y
1531# CONFIG_CRYPTO_MICHAEL_MIC is not set
1532# CONFIG_CRYPTO_RMD128 is not set
1533# CONFIG_CRYPTO_RMD160 is not set
1534# CONFIG_CRYPTO_RMD256 is not set
1535# CONFIG_CRYPTO_RMD320 is not set
1536# CONFIG_CRYPTO_SHA1 is not set
1537# CONFIG_CRYPTO_SHA256 is not set
1538# CONFIG_CRYPTO_SHA512 is not set
1539# CONFIG_CRYPTO_TGR192 is not set
1540# CONFIG_CRYPTO_WP512 is not set
1541
1542#
1543# Ciphers
1544#
1545# CONFIG_CRYPTO_AES is not set
1546# CONFIG_CRYPTO_ANUBIS is not set
1547# CONFIG_CRYPTO_ARC4 is not set
1548# CONFIG_CRYPTO_BLOWFISH is not set
1549# CONFIG_CRYPTO_CAMELLIA is not set
1550# CONFIG_CRYPTO_CAST5 is not set
1551# CONFIG_CRYPTO_CAST6 is not set
1552CONFIG_CRYPTO_DES=m
1553# CONFIG_CRYPTO_FCRYPT is not set
1554# CONFIG_CRYPTO_KHAZAD is not set
1555# CONFIG_CRYPTO_SALSA20 is not set
1556# CONFIG_CRYPTO_SEED is not set
1557# CONFIG_CRYPTO_SERPENT is not set
1558# CONFIG_CRYPTO_TEA is not set
1559# CONFIG_CRYPTO_TWOFISH is not set
1560
1561#
1562# Compression
1563#
1564# CONFIG_CRYPTO_DEFLATE is not set
1565# CONFIG_CRYPTO_LZO is not set
1566
1567#
1568# Random Number Generation
1569#
1570# CONFIG_CRYPTO_ANSI_CPRNG is not set
1571CONFIG_CRYPTO_HW=y
1572# CONFIG_CRYPTO_DEV_HIFN_795X is not set
1573CONFIG_HAVE_KVM=y
1574CONFIG_VIRTUALIZATION=y
1575# CONFIG_KVM is not set
1576# CONFIG_VIRTIO_PCI is not set
1577# CONFIG_VIRTIO_BALLOON is not set
1578
1579#
1580# Library routines
1581#
1582CONFIG_BITREVERSE=y
1583CONFIG_GENERIC_FIND_LAST_BIT=y
1584# CONFIG_CRC_CCITT is not set
1585# CONFIG_CRC16 is not set
1586# CONFIG_CRC_T10DIF is not set
1587CONFIG_CRC_ITU_T=m
1588CONFIG_CRC32=y
1589# CONFIG_CRC7 is not set
1590# CONFIG_LIBCRC32C is not set
1591CONFIG_PLIST=y
1592CONFIG_HAS_IOMEM=y
1593CONFIG_HAS_IOPORT=y
1594CONFIG_HAS_DMA=y
1595CONFIG_GENERIC_HARDIRQS=y
1596CONFIG_GENERIC_IRQ_PROBE=y
1597CONFIG_GENERIC_PENDING_IRQ=y
1598CONFIG_IRQ_PER_CPU=y
1599# CONFIG_IOMMU_API is not set
diff --git a/arch/ia64/configs/zx1_defconfig b/arch/ia64/configs/zx1_defconfig
index 3cec65b534c2..de0b68e0d48e 100644
--- a/arch/ia64/configs/zx1_defconfig
+++ b/arch/ia64/configs/zx1_defconfig
@@ -1,1460 +1,85 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.21-rc3
4# Thu Mar 8 11:04:20 2007
5#
6CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
7
8#
9# Code maturity level options
10#
11CONFIG_EXPERIMENTAL=y
12CONFIG_LOCK_KERNEL=y
13CONFIG_INIT_ENV_ARG_LIMIT=32
14
15#
16# General setup
17#
18CONFIG_LOCALVERSION=""
19CONFIG_LOCALVERSION_AUTO=y
20CONFIG_SWAP=y
21CONFIG_SYSVIPC=y
22# CONFIG_IPC_NS is not set
23CONFIG_SYSVIPC_SYSCTL=y
24# CONFIG_POSIX_MQUEUE is not set
25CONFIG_BSD_PROCESS_ACCT=y
26# CONFIG_BSD_PROCESS_ACCT_V3 is not set
27# CONFIG_TASKSTATS is not set
28# CONFIG_UTS_NS is not set
29# CONFIG_AUDIT is not set
30# CONFIG_IKCONFIG is not set
31# CONFIG_CPUSETS is not set
32CONFIG_SYSFS_DEPRECATED=y
33# CONFIG_RELAY is not set
34CONFIG_BLK_DEV_INITRD=y
35CONFIG_INITRAMFS_SOURCE=""
36CONFIG_CC_OPTIMIZE_FOR_SIZE=y
37CONFIG_SYSCTL=y
38# CONFIG_EMBEDDED is not set
39CONFIG_SYSCTL_SYSCALL=y
40CONFIG_KALLSYMS=y
41# CONFIG_KALLSYMS_ALL is not set
42# CONFIG_KALLSYMS_EXTRA_PASS is not set
43CONFIG_HOTPLUG=y
44CONFIG_PRINTK=y
45CONFIG_BUG=y
46CONFIG_ELF_CORE=y
47CONFIG_BASE_FULL=y
48CONFIG_FUTEX=y
49CONFIG_EPOLL=y
50CONFIG_SHMEM=y
51CONFIG_SLUB=y
52CONFIG_VM_EVENT_COUNTERS=y
53CONFIG_RT_MUTEXES=y
54# CONFIG_TINY_SHMEM is not set
55CONFIG_BASE_SMALL=0
56# CONFIG_SLOB is not set
57
58#
59# Loadable module support
60#
61CONFIG_MODULES=y
62# CONFIG_MODULE_UNLOAD is not set
63# CONFIG_MODVERSIONS is not set
64# CONFIG_MODULE_SRCVERSION_ALL is not set
65# CONFIG_KMOD is not set
66CONFIG_STOP_MACHINE=y
67
68#
69# Block layer
70#
71CONFIG_BLOCK=y
72# CONFIG_BLK_DEV_IO_TRACE is not set
73
74#
75# IO Schedulers
76#
77CONFIG_IOSCHED_NOOP=y
78CONFIG_IOSCHED_AS=y
79CONFIG_IOSCHED_DEADLINE=y
80CONFIG_IOSCHED_CFQ=y
81CONFIG_DEFAULT_AS=y
82# CONFIG_DEFAULT_DEADLINE is not set
83# CONFIG_DEFAULT_CFQ is not set
84# CONFIG_DEFAULT_NOOP is not set
85CONFIG_DEFAULT_IOSCHED="anticipatory"
86
87#
88# Processor type and features
89#
90CONFIG_IA64=y
91CONFIG_64BIT=y
92CONFIG_ZONE_DMA=y
93CONFIG_MMU=y
94CONFIG_RWSEM_XCHGADD_ALGORITHM=y
95# CONFIG_ARCH_HAS_ILOG2_U32 is not set
96# CONFIG_ARCH_HAS_ILOG2_U64 is not set
97CONFIG_GENERIC_FIND_NEXT_BIT=y
98CONFIG_GENERIC_CALIBRATE_DELAY=y
99CONFIG_GENERIC_TIME=y
100CONFIG_DMI=y
101CONFIG_EFI=y
102CONFIG_GENERIC_IOMAP=y
103CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
104CONFIG_AUDIT_ARCH=y
105# CONFIG_IA64_GENERIC is not set
106# CONFIG_IA64_DIG is not set
107CONFIG_IA64_HP_ZX1=y
108# CONFIG_IA64_HP_ZX1_SWIOTLB is not set
109# CONFIG_IA64_SGI_SN2 is not set
110# CONFIG_IA64_HP_SIM is not set
111# CONFIG_ITANIUM is not set
112CONFIG_MCKINLEY=y
113# CONFIG_IA64_PAGE_SIZE_4KB is not set
114# CONFIG_IA64_PAGE_SIZE_8KB is not set
115CONFIG_IA64_PAGE_SIZE_16KB=y
116# CONFIG_IA64_PAGE_SIZE_64KB is not set
117CONFIG_PGTABLE_3=y
118# CONFIG_PGTABLE_4 is not set
119# CONFIG_HZ_100 is not set
120CONFIG_HZ_250=y
121# CONFIG_HZ_300 is not set
122# CONFIG_HZ_1000 is not set
123CONFIG_HZ=250
124CONFIG_IA64_L1_CACHE_SHIFT=7
125# CONFIG_IA64_CYCLONE is not set
126CONFIG_IOSAPIC=y
127CONFIG_FORCE_MAX_ZONEORDER=17
128CONFIG_SMP=y
129CONFIG_NR_CPUS=16
130CONFIG_HOTPLUG_CPU=y
131CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
132# CONFIG_SCHED_SMT is not set
133# CONFIG_PERMIT_BSP_REMOVE is not set
134# CONFIG_PREEMPT is not set
135CONFIG_SELECT_MEMORY_MODEL=y
136CONFIG_FLATMEM_MANUAL=y
137# CONFIG_DISCONTIGMEM_MANUAL is not set
138# CONFIG_SPARSEMEM_MANUAL is not set
139CONFIG_FLATMEM=y
140CONFIG_FLAT_NODE_MEM_MAP=y
141# CONFIG_SPARSEMEM_STATIC is not set
142CONFIG_SPLIT_PTLOCK_CPUS=4
143CONFIG_RESOURCES_64BIT=y
144CONFIG_ZONE_DMA_FLAG=1
145CONFIG_ARCH_SELECT_MEMORY_MODEL=y
146CONFIG_ARCH_DISCONTIGMEM_ENABLE=y
147CONFIG_ARCH_FLATMEM_ENABLE=y
148CONFIG_ARCH_SPARSEMEM_ENABLE=y
149CONFIG_ARCH_DISCONTIGMEM_DEFAULT=y
150CONFIG_ARCH_POPULATES_NODE_MAP=y
151CONFIG_VIRTUAL_MEM_MAP=y
152CONFIG_HOLES_IN_ZONE=y
153CONFIG_IA64_MCA_RECOVERY=y
154CONFIG_PERFMON=y
155CONFIG_IA64_PALINFO=y
156# CONFIG_IA64_ESI is not set
157# CONFIG_KEXEC is not set
158CONFIG_CRASH_DUMP=y
159
160#
161# Firmware Drivers
162#
163CONFIG_EFI_VARS=y
164CONFIG_EFI_PCDP=y
165CONFIG_BINFMT_ELF=y
166CONFIG_BINFMT_MISC=y
167
168#
169# Power management and ACPI
170#
171CONFIG_PM=y
172CONFIG_PM_LEGACY=y
173# CONFIG_PM_DEBUG is not set
174# CONFIG_PM_SYSFS_DEPRECATED is not set
175
176#
177# ACPI (Advanced Configuration and Power Interface) Support
178#
179CONFIG_ACPI=y
180CONFIG_ACPI_PROCFS=y 1CONFIG_ACPI_PROCFS=y
181CONFIG_ACPI_BUTTON=y 2CONFIG_AGP_HP_ZX1=y
182CONFIG_ACPI_FAN=y 3CONFIG_AGP=y
183# CONFIG_ACPI_DOCK is not set 4CONFIG_AUTOFS_FS=y
184CONFIG_ACPI_PROCESSOR=y 5CONFIG_BINFMT_MISC=y
185CONFIG_ACPI_HOTPLUG_CPU=y 6CONFIG_BLK_DEV_CMD64X=y
186CONFIG_ACPI_THERMAL=y 7CONFIG_BLK_DEV_GENERIC=y
187CONFIG_ACPI_BLACKLIST_YEAR=0 8CONFIG_BLK_DEV_IDECD=y
188# CONFIG_ACPI_DEBUG is not set 9CONFIG_BLK_DEV_INITRD=y
189CONFIG_ACPI_EC=y
190CONFIG_ACPI_POWER=y
191CONFIG_ACPI_SYSTEM=y
192CONFIG_ACPI_CONTAINER=y
193
194#
195# CPU Frequency scaling
196#
197# CONFIG_CPU_FREQ is not set
198
199#
200# Bus options (PCI, PCMCIA)
201#
202CONFIG_PCI=y
203CONFIG_PCI_DOMAINS=y
204# CONFIG_PCIEPORTBUS is not set
205# CONFIG_PCI_MSI is not set
206# CONFIG_PCI_DEBUG is not set
207
208#
209# PCI Hotplug Support
210#
211CONFIG_HOTPLUG_PCI=y
212# CONFIG_HOTPLUG_PCI_FAKE is not set
213CONFIG_HOTPLUG_PCI_ACPI=y
214# CONFIG_HOTPLUG_PCI_ACPI_IBM is not set
215# CONFIG_HOTPLUG_PCI_CPCI is not set
216# CONFIG_HOTPLUG_PCI_SHPC is not set
217
218#
219# PCCARD (PCMCIA/CardBus) support
220#
221# CONFIG_PCCARD is not set
222
223#
224# Networking
225#
226CONFIG_NET=y
227
228#
229# Networking options
230#
231# CONFIG_NETDEBUG is not set
232CONFIG_PACKET=y
233# CONFIG_PACKET_MMAP is not set
234CONFIG_UNIX=y
235CONFIG_XFRM=y
236# CONFIG_XFRM_USER is not set
237# CONFIG_XFRM_SUB_POLICY is not set
238# CONFIG_XFRM_MIGRATE is not set
239# CONFIG_NET_KEY is not set
240CONFIG_INET=y
241CONFIG_IP_MULTICAST=y
242# CONFIG_IP_ADVANCED_ROUTER is not set
243CONFIG_IP_FIB_HASH=y
244# CONFIG_IP_PNP is not set
245# CONFIG_NET_IPIP is not set
246# CONFIG_NET_IPGRE is not set
247# CONFIG_IP_MROUTE is not set
248# CONFIG_ARPD is not set
249# CONFIG_SYN_COOKIES is not set
250# CONFIG_INET_AH is not set
251# CONFIG_INET_ESP is not set
252# CONFIG_INET_IPCOMP is not set
253# CONFIG_INET_XFRM_TUNNEL is not set
254# CONFIG_INET_TUNNEL is not set
255CONFIG_INET_XFRM_MODE_TRANSPORT=y
256CONFIG_INET_XFRM_MODE_TUNNEL=y
257CONFIG_INET_XFRM_MODE_BEET=y
258CONFIG_INET_DIAG=y
259CONFIG_INET_TCP_DIAG=y
260# CONFIG_TCP_CONG_ADVANCED is not set
261CONFIG_TCP_CONG_CUBIC=y
262CONFIG_DEFAULT_TCP_CONG="cubic"
263# CONFIG_TCP_MD5SIG is not set
264
265#
266# IP: Virtual Server Configuration
267#
268# CONFIG_IP_VS is not set
269# CONFIG_IPV6 is not set
270# CONFIG_INET6_XFRM_TUNNEL is not set
271# CONFIG_INET6_TUNNEL is not set
272# CONFIG_NETWORK_SECMARK is not set
273CONFIG_NETFILTER=y
274# CONFIG_NETFILTER_DEBUG is not set
275
276#
277# Core Netfilter Configuration
278#
279# CONFIG_NETFILTER_NETLINK is not set
280# CONFIG_NF_CONNTRACK_ENABLED is not set
281# CONFIG_NETFILTER_XTABLES is not set
282
283#
284# IP: Netfilter Configuration
285#
286# CONFIG_IP_NF_QUEUE is not set
287# CONFIG_IP_NF_IPTABLES is not set
288# CONFIG_IP_NF_ARPTABLES is not set
289
290#
291# DCCP Configuration (EXPERIMENTAL)
292#
293# CONFIG_IP_DCCP is not set
294
295#
296# SCTP Configuration (EXPERIMENTAL)
297#
298# CONFIG_IP_SCTP is not set
299
300#
301# TIPC Configuration (EXPERIMENTAL)
302#
303# CONFIG_TIPC is not set
304# CONFIG_ATM is not set
305# CONFIG_BRIDGE is not set
306# CONFIG_VLAN_8021Q is not set
307# CONFIG_DECNET is not set
308# CONFIG_LLC2 is not set
309# CONFIG_IPX is not set
310# CONFIG_ATALK is not set
311# CONFIG_X25 is not set
312# CONFIG_LAPB is not set
313# CONFIG_ECONET is not set
314# CONFIG_WAN_ROUTER is not set
315
316#
317# QoS and/or fair queueing
318#
319# CONFIG_NET_SCHED is not set
320
321#
322# Network testing
323#
324# CONFIG_NET_PKTGEN is not set
325# CONFIG_NET_TCPPROBE is not set
326# CONFIG_HAMRADIO is not set
327# CONFIG_IRDA is not set
328# CONFIG_BT is not set
329# CONFIG_IEEE80211 is not set
330
331#
332# Device Drivers
333#
334
335#
336# Generic Driver Options
337#
338CONFIG_STANDALONE=y
339CONFIG_PREVENT_FIRMWARE_BUILD=y
340# CONFIG_FW_LOADER is not set
341# CONFIG_DEBUG_DRIVER is not set
342# CONFIG_DEBUG_DEVRES is not set
343# CONFIG_SYS_HYPERVISOR is not set
344
345#
346# Connector - unified userspace <-> kernelspace linker
347#
348# CONFIG_CONNECTOR is not set
349
350#
351# Memory Technology Devices (MTD)
352#
353# CONFIG_MTD is not set
354
355#
356# Parallel port support
357#
358# CONFIG_PARPORT is not set
359
360#
361# Plug and Play support
362#
363CONFIG_PNP=y
364# CONFIG_PNP_DEBUG is not set
365
366#
367# Protocols
368#
369CONFIG_PNPACPI=y
370
371#
372# Block devices
373#
374# CONFIG_BLK_CPQ_DA is not set
375# CONFIG_BLK_CPQ_CISS_DA is not set
376# CONFIG_BLK_DEV_DAC960 is not set
377# CONFIG_BLK_DEV_UMEM is not set
378# CONFIG_BLK_DEV_COW_COMMON is not set
379CONFIG_BLK_DEV_LOOP=y 10CONFIG_BLK_DEV_LOOP=y
380# CONFIG_BLK_DEV_CRYPTOLOOP is not set
381# CONFIG_BLK_DEV_NBD is not set
382# CONFIG_BLK_DEV_SX8 is not set
383# CONFIG_BLK_DEV_UB is not set
384CONFIG_BLK_DEV_RAM=y 11CONFIG_BLK_DEV_RAM=y
385CONFIG_BLK_DEV_RAM_COUNT=16
386CONFIG_BLK_DEV_RAM_SIZE=4096
387CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
388# CONFIG_CDROM_PKTCDVD is not set
389# CONFIG_ATA_OVER_ETH is not set
390
391#
392# Misc devices
393#
394# CONFIG_SGI_IOC4 is not set
395# CONFIG_TIFM_CORE is not set
396
397#
398# ATA/ATAPI/MFM/RLL support
399#
400CONFIG_IDE=y
401CONFIG_IDE_MAX_HWIFS=4
402CONFIG_BLK_DEV_IDE=y
403
404#
405# Please see Documentation/ide.txt for help/info on IDE drives
406#
407# CONFIG_BLK_DEV_IDE_SATA is not set
408CONFIG_BLK_DEV_IDEDISK=y
409# CONFIG_IDEDISK_MULTI_MODE is not set
410CONFIG_BLK_DEV_IDECD=y
411# CONFIG_BLK_DEV_IDETAPE is not set
412# CONFIG_BLK_DEV_IDEFLOPPY is not set
413# CONFIG_BLK_DEV_IDESCSI is not set
414# CONFIG_BLK_DEV_IDEACPI is not set
415# CONFIG_IDE_TASK_IOCTL is not set
416
417#
418# IDE chipset support/bugfixes
419#
420# CONFIG_IDE_GENERIC is not set
421# CONFIG_BLK_DEV_IDEPNP is not set
422CONFIG_BLK_DEV_IDEPCI=y
423CONFIG_IDEPCI_SHARE_IRQ=y
424# CONFIG_BLK_DEV_OFFBOARD is not set
425CONFIG_BLK_DEV_GENERIC=y
426# CONFIG_BLK_DEV_OPTI621 is not set
427CONFIG_BLK_DEV_IDEDMA_PCI=y
428# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
429# CONFIG_IDEDMA_PCI_AUTO is not set
430# CONFIG_BLK_DEV_AEC62XX is not set
431# CONFIG_BLK_DEV_ALI15X3 is not set
432# CONFIG_BLK_DEV_AMD74XX is not set
433CONFIG_BLK_DEV_CMD64X=y
434# CONFIG_BLK_DEV_TRIFLEX is not set
435# CONFIG_BLK_DEV_CY82C693 is not set
436# CONFIG_BLK_DEV_CS5520 is not set
437# CONFIG_BLK_DEV_CS5530 is not set
438# CONFIG_BLK_DEV_HPT34X is not set
439# CONFIG_BLK_DEV_HPT366 is not set
440# CONFIG_BLK_DEV_JMICRON is not set
441# CONFIG_BLK_DEV_SC1200 is not set
442# CONFIG_BLK_DEV_PIIX is not set
443# CONFIG_BLK_DEV_IT8213 is not set
444# CONFIG_BLK_DEV_IT821X is not set
445# CONFIG_BLK_DEV_NS87415 is not set
446# CONFIG_BLK_DEV_PDC202XX_OLD is not set
447# CONFIG_BLK_DEV_PDC202XX_NEW is not set
448# CONFIG_BLK_DEV_SVWKS is not set
449# CONFIG_BLK_DEV_SIIMAGE is not set
450# CONFIG_BLK_DEV_SLC90E66 is not set
451# CONFIG_BLK_DEV_TRM290 is not set
452# CONFIG_BLK_DEV_VIA82CXXX is not set
453# CONFIG_BLK_DEV_TC86C001 is not set
454# CONFIG_IDE_ARM is not set
455CONFIG_BLK_DEV_IDEDMA=y
456# CONFIG_IDEDMA_IVB is not set
457# CONFIG_IDEDMA_AUTO is not set
458# CONFIG_BLK_DEV_HD is not set
459
460#
461# SCSI device support
462#
463# CONFIG_RAID_ATTRS is not set
464CONFIG_SCSI=y
465# CONFIG_SCSI_TGT is not set
466CONFIG_SCSI_NETLINK=y
467CONFIG_SCSI_PROC_FS=y
468
469#
470# SCSI support type (disk, tape, CD-ROM)
471#
472CONFIG_BLK_DEV_SD=y 12CONFIG_BLK_DEV_SD=y
473CONFIG_CHR_DEV_ST=y
474CONFIG_CHR_DEV_OSST=y
475CONFIG_BLK_DEV_SR=y
476CONFIG_BLK_DEV_SR_VENDOR=y 13CONFIG_BLK_DEV_SR_VENDOR=y
14CONFIG_BLK_DEV_SR=y
15CONFIG_BSD_PROCESS_ACCT=y
16CONFIG_CHR_DEV_OSST=y
477CONFIG_CHR_DEV_SG=y 17CONFIG_CHR_DEV_SG=y
478# CONFIG_CHR_DEV_SCH is not set 18CONFIG_CHR_DEV_ST=y
479 19CONFIG_CRASH_DUMP=y
480# 20CONFIG_CRYPTO_ECB=m
481# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 21CONFIG_CRYPTO_PCBC=m
482# 22CONFIG_DEBUG_KERNEL=y
483CONFIG_SCSI_MULTI_LUN=y 23CONFIG_DEBUG_MUTEXES=y
484CONFIG_SCSI_CONSTANTS=y 24CONFIG_DRM_RADEON=y
485CONFIG_SCSI_LOGGING=y 25CONFIG_DRM=y
486# CONFIG_SCSI_SCAN_ASYNC is not set
487
488#
489# SCSI Transports
490#
491CONFIG_SCSI_SPI_ATTRS=y
492CONFIG_SCSI_FC_ATTRS=y
493# CONFIG_SCSI_ISCSI_ATTRS is not set
494# CONFIG_SCSI_SAS_ATTRS is not set
495# CONFIG_SCSI_SAS_LIBSAS is not set
496
497#
498# SCSI low-level drivers
499#
500# CONFIG_ISCSI_TCP is not set
501# CONFIG_BLK_DEV_3W_XXXX_RAID is not set
502# CONFIG_SCSI_3W_9XXX is not set
503# CONFIG_SCSI_ACARD is not set
504# CONFIG_SCSI_AACRAID is not set
505# CONFIG_SCSI_AIC7XXX is not set
506# CONFIG_SCSI_AIC7XXX_OLD is not set
507# CONFIG_SCSI_AIC79XX is not set
508# CONFIG_SCSI_AIC94XX is not set
509# CONFIG_SCSI_ARCMSR is not set
510# CONFIG_MEGARAID_NEWGEN is not set
511# CONFIG_MEGARAID_LEGACY is not set
512# CONFIG_MEGARAID_SAS is not set
513# CONFIG_SCSI_HPTIOP is not set
514# CONFIG_SCSI_DMX3191D is not set
515# CONFIG_SCSI_FUTURE_DOMAIN is not set
516# CONFIG_SCSI_IPS is not set
517# CONFIG_SCSI_INITIO is not set
518# CONFIG_SCSI_INIA100 is not set
519# CONFIG_SCSI_STEX is not set
520CONFIG_SCSI_SYM53C8XX_2=y
521CONFIG_SCSI_SYM53C8XX_DMA_ADDRESSING_MODE=1
522CONFIG_SCSI_SYM53C8XX_DEFAULT_TAGS=16
523CONFIG_SCSI_SYM53C8XX_MAX_TAGS=64
524CONFIG_SCSI_SYM53C8XX_MMIO=y
525CONFIG_SCSI_QLOGIC_1280=y
526# CONFIG_SCSI_QLA_FC is not set
527# CONFIG_SCSI_QLA_ISCSI is not set
528# CONFIG_SCSI_LPFC is not set
529# CONFIG_SCSI_DC395x is not set
530# CONFIG_SCSI_DC390T is not set
531# CONFIG_SCSI_DEBUG is not set
532# CONFIG_SCSI_SRP is not set
533
534#
535# Serial ATA (prod) and Parallel ATA (experimental) drivers
536#
537# CONFIG_ATA is not set
538
539#
540# Multi-device support (RAID and LVM)
541#
542# CONFIG_MD is not set
543
544#
545# Fusion MPT device support
546#
547CONFIG_FUSION=y
548CONFIG_FUSION_SPI=y
549CONFIG_FUSION_FC=y
550# CONFIG_FUSION_SAS is not set
551CONFIG_FUSION_MAX_SGE=128
552CONFIG_FUSION_CTL=m
553
554#
555# IEEE 1394 (FireWire) support
556#
557# CONFIG_IEEE1394 is not set
558
559#
560# I2O device support
561#
562# CONFIG_I2O is not set
563
564#
565# Network device support
566#
567CONFIG_NETDEVICES=y
568CONFIG_DUMMY=y 26CONFIG_DUMMY=y
569# CONFIG_BONDING is not set
570# CONFIG_EQUALIZER is not set
571# CONFIG_TUN is not set
572# CONFIG_NET_SB1000 is not set
573
574#
575# ARCnet devices
576#
577# CONFIG_ARCNET is not set
578
579#
580# PHY device support
581#
582# CONFIG_PHYLIB is not set
583
584#
585# Ethernet (10 or 100Mbit)
586#
587CONFIG_NET_ETHERNET=y
588CONFIG_MII=y
589# CONFIG_HAPPYMEAL is not set
590# CONFIG_SUNGEM is not set
591# CONFIG_CASSINI is not set
592# CONFIG_NET_VENDOR_3COM is not set
593
594#
595# Tulip family network device support
596#
597CONFIG_NET_TULIP=y
598# CONFIG_DE2104X is not set
599CONFIG_TULIP=y
600CONFIG_TULIP_MWI=y
601CONFIG_TULIP_MMIO=y
602CONFIG_TULIP_NAPI=y
603CONFIG_TULIP_NAPI_HW_MITIGATION=y
604# CONFIG_DE4X5 is not set
605# CONFIG_WINBOND_840 is not set
606# CONFIG_DM9102 is not set
607# CONFIG_ULI526X is not set
608# CONFIG_HP100 is not set
609CONFIG_NET_PCI=y
610# CONFIG_PCNET32 is not set
611# CONFIG_AMD8111_ETH is not set
612# CONFIG_ADAPTEC_STARFIRE is not set
613# CONFIG_B44 is not set
614# CONFIG_FORCEDETH is not set
615# CONFIG_DGRS is not set
616# CONFIG_EEPRO100 is not set
617CONFIG_E100=y
618# CONFIG_FEALNX is not set
619# CONFIG_NATSEMI is not set
620# CONFIG_NE2K_PCI is not set
621# CONFIG_8139CP is not set
622# CONFIG_8139TOO is not set
623# CONFIG_SIS900 is not set
624# CONFIG_EPIC100 is not set
625# CONFIG_SUNDANCE is not set
626# CONFIG_VIA_RHINE is not set
627# CONFIG_SC92031 is not set
628
629#
630# Ethernet (1000 Mbit)
631#
632# CONFIG_ACENIC is not set
633# CONFIG_DL2K is not set
634CONFIG_E1000=y 27CONFIG_E1000=y
635# CONFIG_E1000_NAPI is not set 28CONFIG_E100=y
636# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set 29CONFIG_EFI_PARTITION=y
637# CONFIG_NS83820 is not set
638# CONFIG_HAMACHI is not set
639# CONFIG_YELLOWFIN is not set
640# CONFIG_R8169 is not set
641# CONFIG_SIS190 is not set
642# CONFIG_SKGE is not set
643# CONFIG_SKY2 is not set
644# CONFIG_SK98LIN is not set
645# CONFIG_VIA_VELOCITY is not set
646CONFIG_TIGON3=y
647# CONFIG_BNX2 is not set
648# CONFIG_QLA3XXX is not set
649# CONFIG_ATL1 is not set
650
651#
652# Ethernet (10000 Mbit)
653#
654# CONFIG_CHELSIO_T1 is not set
655# CONFIG_CHELSIO_T3 is not set
656# CONFIG_IXGB is not set
657# CONFIG_S2IO is not set
658# CONFIG_MYRI10GE is not set
659# CONFIG_NETXEN_NIC is not set
660
661#
662# Token Ring devices
663#
664# CONFIG_TR is not set
665
666#
667# Wireless LAN (non-hamradio)
668#
669# CONFIG_NET_RADIO is not set
670
671#
672# Wan interfaces
673#
674# CONFIG_WAN is not set
675# CONFIG_FDDI is not set
676# CONFIG_HIPPI is not set
677# CONFIG_PPP is not set
678# CONFIG_SLIP is not set
679# CONFIG_NET_FC is not set
680# CONFIG_SHAPER is not set
681# CONFIG_NETCONSOLE is not set
682# CONFIG_NETPOLL is not set
683# CONFIG_NET_POLL_CONTROLLER is not set
684
685#
686# ISDN subsystem
687#
688# CONFIG_ISDN is not set
689
690#
691# Telephony Support
692#
693# CONFIG_PHONE is not set
694
695#
696# Input device support
697#
698CONFIG_INPUT=y
699# CONFIG_INPUT_FF_MEMLESS is not set
700
701#
702# Userland interfaces
703#
704CONFIG_INPUT_MOUSEDEV=y
705CONFIG_INPUT_MOUSEDEV_PSAUX=y
706CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
707CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
708CONFIG_INPUT_JOYDEV=y
709# CONFIG_INPUT_TSDEV is not set
710CONFIG_INPUT_EVDEV=y
711# CONFIG_INPUT_EVBUG is not set
712
713#
714# Input Device Drivers
715#
716# CONFIG_INPUT_KEYBOARD is not set
717# CONFIG_INPUT_MOUSE is not set
718# CONFIG_INPUT_JOYSTICK is not set
719# CONFIG_INPUT_TOUCHSCREEN is not set
720# CONFIG_INPUT_MISC is not set
721
722#
723# Hardware I/O ports
724#
725CONFIG_SERIO=y
726# CONFIG_SERIO_I8042 is not set
727# CONFIG_SERIO_SERPORT is not set
728# CONFIG_SERIO_PCIPS2 is not set
729# CONFIG_SERIO_RAW is not set
730# CONFIG_GAMEPORT is not set
731
732#
733# Character devices
734#
735CONFIG_VT=y
736CONFIG_VT_CONSOLE=y
737CONFIG_HW_CONSOLE=y
738# CONFIG_VT_HW_CONSOLE_BINDING is not set
739# CONFIG_SERIAL_NONSTANDARD is not set
740
741#
742# Serial drivers
743#
744CONFIG_SERIAL_8250=y
745CONFIG_SERIAL_8250_CONSOLE=y
746CONFIG_SERIAL_8250_PCI=y
747CONFIG_SERIAL_8250_PNP=y
748CONFIG_SERIAL_8250_NR_UARTS=8
749CONFIG_SERIAL_8250_RUNTIME_UARTS=4
750CONFIG_SERIAL_8250_EXTENDED=y
751CONFIG_SERIAL_8250_SHARE_IRQ=y
752# CONFIG_SERIAL_8250_DETECT_IRQ is not set
753# CONFIG_SERIAL_8250_RSA is not set
754
755#
756# Non-8250 serial port support
757#
758CONFIG_SERIAL_CORE=y
759CONFIG_SERIAL_CORE_CONSOLE=y
760# CONFIG_SERIAL_JSM is not set
761CONFIG_UNIX98_PTYS=y
762CONFIG_LEGACY_PTYS=y
763CONFIG_LEGACY_PTY_COUNT=256
764
765#
766# IPMI
767#
768# CONFIG_IPMI_HANDLER is not set
769
770#
771# Watchdog Cards
772#
773# CONFIG_WATCHDOG is not set
774# CONFIG_HW_RANDOM is not set
775CONFIG_EFI_RTC=y 30CONFIG_EFI_RTC=y
776# CONFIG_DTLK is not set 31CONFIG_EFI_VARS=y
777# CONFIG_R3964 is not set 32CONFIG_EXPERIMENTAL=y
778# CONFIG_APPLICOM is not set
779CONFIG_AGP=y
780CONFIG_AGP_HP_ZX1=y
781CONFIG_DRM=y
782# CONFIG_DRM_TDFX is not set
783# CONFIG_DRM_R128 is not set
784CONFIG_DRM_RADEON=y
785# CONFIG_DRM_MGA is not set
786# CONFIG_DRM_SIS is not set
787# CONFIG_DRM_VIA is not set
788# CONFIG_DRM_SAVAGE is not set
789# CONFIG_RAW_DRIVER is not set
790# CONFIG_HPET is not set
791# CONFIG_HANGCHECK_TIMER is not set
792
793#
794# TPM devices
795#
796# CONFIG_TCG_TPM is not set
797
798#
799# I2C support
800#
801CONFIG_I2C=y
802CONFIG_I2C_CHARDEV=y
803
804#
805# I2C Algorithms
806#
807CONFIG_I2C_ALGOBIT=y
808CONFIG_I2C_ALGOPCF=y
809# CONFIG_I2C_ALGOPCA is not set
810
811#
812# I2C Hardware Bus support
813#
814# CONFIG_I2C_ALI1535 is not set
815# CONFIG_I2C_ALI1563 is not set
816# CONFIG_I2C_ALI15X3 is not set
817# CONFIG_I2C_AMD756 is not set
818# CONFIG_I2C_AMD8111 is not set
819# CONFIG_I2C_I801 is not set
820# CONFIG_I2C_I810 is not set
821# CONFIG_I2C_PIIX4 is not set
822# CONFIG_I2C_NFORCE2 is not set
823# CONFIG_I2C_OCORES is not set
824# CONFIG_I2C_PARPORT_LIGHT is not set
825# CONFIG_I2C_PASEMI is not set
826# CONFIG_I2C_PROSAVAGE is not set
827# CONFIG_I2C_SAVAGE4 is not set
828# CONFIG_I2C_SIS5595 is not set
829# CONFIG_I2C_SIS630 is not set
830# CONFIG_I2C_SIS96X is not set
831# CONFIG_I2C_STUB is not set
832# CONFIG_I2C_VIA is not set
833# CONFIG_I2C_VIAPRO is not set
834# CONFIG_I2C_VOODOO3 is not set
835# CONFIG_I2C_PCA_ISA is not set
836
837#
838# Miscellaneous I2C Chip support
839#
840# CONFIG_SENSORS_DS1337 is not set
841# CONFIG_SENSORS_DS1374 is not set
842# CONFIG_EEPROM_LEGACY is not set
843# CONFIG_SENSORS_PCF8574 is not set
844# CONFIG_SENSORS_PCA9539 is not set
845# CONFIG_SENSORS_PCF8591 is not set
846# CONFIG_SENSORS_MAX6875 is not set
847# CONFIG_I2C_DEBUG_CORE is not set
848# CONFIG_I2C_DEBUG_ALGO is not set
849# CONFIG_I2C_DEBUG_BUS is not set
850# CONFIG_I2C_DEBUG_CHIP is not set
851
852#
853# SPI support
854#
855# CONFIG_SPI is not set
856# CONFIG_SPI_MASTER is not set
857
858#
859# Dallas's 1-wire bus
860#
861# CONFIG_W1 is not set
862
863#
864# Hardware Monitoring support
865#
866# CONFIG_HWMON is not set
867# CONFIG_HWMON_VID is not set
868
869#
870# Multifunction device drivers
871#
872# CONFIG_MFD_SM501 is not set
873
874#
875# Multimedia devices
876#
877CONFIG_VIDEO_DEV=y
878CONFIG_VIDEO_V4L1=y
879CONFIG_VIDEO_V4L1_COMPAT=y
880CONFIG_VIDEO_V4L2=y
881
882#
883# Video Capture Adapters
884#
885
886#
887# Video Capture Adapters
888#
889# CONFIG_VIDEO_ADV_DEBUG is not set
890CONFIG_VIDEO_HELPER_CHIPS_AUTO=y
891# CONFIG_VIDEO_VIVI is not set
892# CONFIG_VIDEO_BT848 is not set
893# CONFIG_VIDEO_CPIA is not set
894# CONFIG_VIDEO_CPIA2 is not set
895# CONFIG_VIDEO_SAA5246A is not set
896# CONFIG_VIDEO_SAA5249 is not set
897# CONFIG_TUNER_3036 is not set
898# CONFIG_VIDEO_STRADIS is not set
899# CONFIG_VIDEO_ZORAN is not set
900# CONFIG_VIDEO_SAA7134 is not set
901# CONFIG_VIDEO_MXB is not set
902# CONFIG_VIDEO_DPC is not set
903# CONFIG_VIDEO_HEXIUM_ORION is not set
904# CONFIG_VIDEO_HEXIUM_GEMINI is not set
905# CONFIG_VIDEO_CX88 is not set
906# CONFIG_VIDEO_CAFE_CCIC is not set
907
908#
909# V4L USB devices
910#
911# CONFIG_VIDEO_PVRUSB2 is not set
912# CONFIG_VIDEO_EM28XX is not set
913# CONFIG_VIDEO_USBVISION is not set
914# CONFIG_USB_VICAM is not set
915# CONFIG_USB_IBMCAM is not set
916# CONFIG_USB_KONICAWC is not set
917# CONFIG_USB_QUICKCAM_MESSENGER is not set
918# CONFIG_USB_ET61X251 is not set
919# CONFIG_VIDEO_OVCAMCHIP is not set
920# CONFIG_USB_W9968CF is not set
921# CONFIG_USB_OV511 is not set
922# CONFIG_USB_SE401 is not set
923# CONFIG_USB_SN9C102 is not set
924# CONFIG_USB_STV680 is not set
925# CONFIG_USB_ZC0301 is not set
926# CONFIG_USB_PWC is not set
927
928#
929# Radio Adapters
930#
931# CONFIG_RADIO_GEMTEK_PCI is not set
932# CONFIG_RADIO_MAXIRADIO is not set
933# CONFIG_RADIO_MAESTRO is not set
934# CONFIG_USB_DSBR is not set
935
936#
937# Digital Video Broadcasting Devices
938#
939# CONFIG_DVB is not set
940# CONFIG_USB_DABUSB is not set
941
942#
943# Graphics support
944#
945CONFIG_BACKLIGHT_LCD_SUPPORT=y
946CONFIG_BACKLIGHT_CLASS_DEVICE=y
947CONFIG_LCD_CLASS_DEVICE=m
948CONFIG_FB=y
949# CONFIG_FIRMWARE_EDID is not set
950CONFIG_FB_DDC=y
951CONFIG_FB_CFB_FILLRECT=y
952CONFIG_FB_CFB_COPYAREA=y
953CONFIG_FB_CFB_IMAGEBLIT=y
954# CONFIG_FB_SVGALIB is not set
955# CONFIG_FB_MACMODES is not set
956CONFIG_FB_BACKLIGHT=y
957CONFIG_FB_MODE_HELPERS=y
958# CONFIG_FB_TILEBLITTING is not set
959
960#
961# Frambuffer hardware drivers
962#
963# CONFIG_FB_CIRRUS is not set
964# CONFIG_FB_PM2 is not set
965# CONFIG_FB_CYBER2000 is not set
966# CONFIG_FB_ASILIANT is not set
967# CONFIG_FB_IMSTT is not set
968# CONFIG_FB_S1D13XXX is not set
969# CONFIG_FB_NVIDIA is not set
970# CONFIG_FB_RIVA is not set
971# CONFIG_FB_MATROX is not set
972CONFIG_FB_RADEON=y
973CONFIG_FB_RADEON_I2C=y
974CONFIG_FB_RADEON_BACKLIGHT=y
975CONFIG_FB_RADEON_DEBUG=y
976# CONFIG_FB_ATY128 is not set
977# CONFIG_FB_ATY is not set
978# CONFIG_FB_S3 is not set
979# CONFIG_FB_SAVAGE is not set
980# CONFIG_FB_SIS is not set
981# CONFIG_FB_NEOMAGIC is not set
982# CONFIG_FB_KYRO is not set
983# CONFIG_FB_3DFX is not set
984# CONFIG_FB_VOODOO1 is not set
985# CONFIG_FB_TRIDENT is not set
986# CONFIG_FB_VIRTUAL is not set
987
988#
989# Console display driver support
990#
991CONFIG_VGA_CONSOLE=y
992# CONFIG_VGACON_SOFT_SCROLLBACK is not set
993CONFIG_DUMMY_CONSOLE=y
994CONFIG_FRAMEBUFFER_CONSOLE=y
995# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
996# CONFIG_FONTS is not set
997CONFIG_FONT_8x8=y
998CONFIG_FONT_8x16=y
999
1000#
1001# Logo configuration
1002#
1003CONFIG_LOGO=y
1004# CONFIG_LOGO_LINUX_MONO is not set
1005# CONFIG_LOGO_LINUX_VGA16 is not set
1006CONFIG_LOGO_LINUX_CLUT224=y
1007
1008#
1009# Sound
1010#
1011CONFIG_SOUND=y
1012
1013#
1014# Advanced Linux Sound Architecture
1015#
1016CONFIG_SND=y
1017CONFIG_SND_TIMER=y
1018CONFIG_SND_PCM=y
1019CONFIG_SND_HWDEP=y
1020CONFIG_SND_RAWMIDI=y
1021CONFIG_SND_SEQUENCER=y
1022# CONFIG_SND_SEQ_DUMMY is not set
1023CONFIG_SND_OSSEMUL=y
1024CONFIG_SND_MIXER_OSS=y
1025CONFIG_SND_PCM_OSS=y
1026CONFIG_SND_PCM_OSS_PLUGINS=y
1027CONFIG_SND_SEQUENCER_OSS=y
1028# CONFIG_SND_DYNAMIC_MINORS is not set
1029CONFIG_SND_SUPPORT_OLD_API=y
1030CONFIG_SND_VERBOSE_PROCFS=y
1031# CONFIG_SND_VERBOSE_PRINTK is not set
1032# CONFIG_SND_DEBUG is not set
1033
1034#
1035# Generic devices
1036#
1037CONFIG_SND_MPU401_UART=y
1038CONFIG_SND_OPL3_LIB=y
1039CONFIG_SND_AC97_CODEC=y
1040# CONFIG_SND_DUMMY is not set
1041# CONFIG_SND_VIRMIDI is not set
1042# CONFIG_SND_MTPAV is not set
1043# CONFIG_SND_SERIAL_U16550 is not set
1044# CONFIG_SND_MPU401 is not set
1045
1046#
1047# PCI devices
1048#
1049# CONFIG_SND_AD1889 is not set
1050# CONFIG_SND_ALS300 is not set
1051# CONFIG_SND_ALI5451 is not set
1052# CONFIG_SND_ATIIXP is not set
1053# CONFIG_SND_ATIIXP_MODEM is not set
1054# CONFIG_SND_AU8810 is not set
1055# CONFIG_SND_AU8820 is not set
1056# CONFIG_SND_AU8830 is not set
1057# CONFIG_SND_AZT3328 is not set
1058# CONFIG_SND_BT87X is not set
1059# CONFIG_SND_CA0106 is not set
1060# CONFIG_SND_CMIPCI is not set
1061# CONFIG_SND_CS4281 is not set
1062# CONFIG_SND_CS46XX is not set
1063# CONFIG_SND_DARLA20 is not set
1064# CONFIG_SND_GINA20 is not set
1065# CONFIG_SND_LAYLA20 is not set
1066# CONFIG_SND_DARLA24 is not set
1067# CONFIG_SND_GINA24 is not set
1068# CONFIG_SND_LAYLA24 is not set
1069# CONFIG_SND_MONA is not set
1070# CONFIG_SND_MIA is not set
1071# CONFIG_SND_ECHO3G is not set
1072# CONFIG_SND_INDIGO is not set
1073# CONFIG_SND_INDIGOIO is not set
1074# CONFIG_SND_INDIGODJ is not set
1075# CONFIG_SND_EMU10K1 is not set
1076# CONFIG_SND_EMU10K1X is not set
1077# CONFIG_SND_ENS1370 is not set
1078# CONFIG_SND_ENS1371 is not set
1079# CONFIG_SND_ES1938 is not set
1080# CONFIG_SND_ES1968 is not set
1081CONFIG_SND_FM801=y
1082# CONFIG_SND_FM801_TEA575X_BOOL is not set
1083# CONFIG_SND_HDA_INTEL is not set
1084# CONFIG_SND_HDSP is not set
1085# CONFIG_SND_HDSPM is not set
1086# CONFIG_SND_ICE1712 is not set
1087# CONFIG_SND_ICE1724 is not set
1088# CONFIG_SND_INTEL8X0 is not set
1089# CONFIG_SND_INTEL8X0M is not set
1090# CONFIG_SND_KORG1212 is not set
1091# CONFIG_SND_MAESTRO3 is not set
1092# CONFIG_SND_MIXART is not set
1093# CONFIG_SND_NM256 is not set
1094# CONFIG_SND_PCXHR is not set
1095# CONFIG_SND_RIPTIDE is not set
1096# CONFIG_SND_RME32 is not set
1097# CONFIG_SND_RME96 is not set
1098# CONFIG_SND_RME9652 is not set
1099# CONFIG_SND_SONICVIBES is not set
1100# CONFIG_SND_TRIDENT is not set
1101# CONFIG_SND_VIA82XX is not set
1102# CONFIG_SND_VIA82XX_MODEM is not set
1103# CONFIG_SND_VX222 is not set
1104# CONFIG_SND_YMFPCI is not set
1105# CONFIG_SND_AC97_POWER_SAVE is not set
1106
1107#
1108# USB devices
1109#
1110# CONFIG_SND_USB_AUDIO is not set
1111
1112#
1113# SoC audio support
1114#
1115# CONFIG_SND_SOC is not set
1116
1117#
1118# Open Sound System
1119#
1120# CONFIG_SOUND_PRIME is not set
1121CONFIG_AC97_BUS=y
1122
1123#
1124# HID Devices
1125#
1126CONFIG_HID=y
1127# CONFIG_HID_DEBUG is not set
1128
1129#
1130# USB support
1131#
1132CONFIG_USB_ARCH_HAS_HCD=y
1133CONFIG_USB_ARCH_HAS_OHCI=y
1134CONFIG_USB_ARCH_HAS_EHCI=y
1135CONFIG_USB=y
1136# CONFIG_USB_DEBUG is not set
1137
1138#
1139# Miscellaneous USB options
1140#
1141# CONFIG_USB_DEVICEFS is not set
1142# CONFIG_USB_DYNAMIC_MINORS is not set
1143# CONFIG_USB_SUSPEND is not set
1144# CONFIG_USB_OTG is not set
1145
1146#
1147# USB Host Controller Drivers
1148#
1149CONFIG_USB_EHCI_HCD=y
1150# CONFIG_USB_EHCI_SPLIT_ISO is not set
1151# CONFIG_USB_EHCI_ROOT_HUB_TT is not set
1152# CONFIG_USB_EHCI_TT_NEWSCHED is not set
1153# CONFIG_USB_EHCI_BIG_ENDIAN_MMIO is not set
1154# CONFIG_USB_ISP116X_HCD is not set
1155CONFIG_USB_OHCI_HCD=y
1156# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1157# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
1158CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1159CONFIG_USB_UHCI_HCD=y
1160# CONFIG_USB_SL811_HCD is not set
1161
1162#
1163# USB Device Class drivers
1164#
1165# CONFIG_USB_ACM is not set
1166# CONFIG_USB_PRINTER is not set
1167
1168#
1169# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
1170#
1171
1172#
1173# may also be needed; see USB_STORAGE Help for more information
1174#
1175CONFIG_USB_STORAGE=y
1176# CONFIG_USB_STORAGE_DEBUG is not set
1177# CONFIG_USB_STORAGE_DATAFAB is not set
1178# CONFIG_USB_STORAGE_FREECOM is not set
1179# CONFIG_USB_STORAGE_ISD200 is not set
1180# CONFIG_USB_STORAGE_DPCM is not set
1181# CONFIG_USB_STORAGE_USBAT is not set
1182# CONFIG_USB_STORAGE_SDDR09 is not set
1183# CONFIG_USB_STORAGE_SDDR55 is not set
1184# CONFIG_USB_STORAGE_JUMPSHOT is not set
1185# CONFIG_USB_STORAGE_ALAUDA is not set
1186# CONFIG_USB_STORAGE_KARMA is not set
1187# CONFIG_USB_LIBUSUAL is not set
1188
1189#
1190# USB Input Devices
1191#
1192CONFIG_USB_HID=y
1193# CONFIG_USB_HIDINPUT_POWERBOOK is not set
1194# CONFIG_HID_FF is not set
1195CONFIG_USB_HIDDEV=y
1196# CONFIG_USB_AIPTEK is not set
1197# CONFIG_USB_WACOM is not set
1198# CONFIG_USB_ACECAD is not set
1199# CONFIG_USB_KBTAB is not set
1200# CONFIG_USB_POWERMATE is not set
1201# CONFIG_USB_TOUCHSCREEN is not set
1202# CONFIG_USB_YEALINK is not set
1203# CONFIG_USB_XPAD is not set
1204# CONFIG_USB_ATI_REMOTE is not set
1205# CONFIG_USB_ATI_REMOTE2 is not set
1206# CONFIG_USB_KEYSPAN_REMOTE is not set
1207# CONFIG_USB_APPLETOUCH is not set
1208# CONFIG_USB_GTCO is not set
1209
1210#
1211# USB Imaging devices
1212#
1213# CONFIG_USB_MDC800 is not set
1214# CONFIG_USB_MICROTEK is not set
1215
1216#
1217# USB Network Adapters
1218#
1219# CONFIG_USB_CATC is not set
1220# CONFIG_USB_KAWETH is not set
1221# CONFIG_USB_PEGASUS is not set
1222# CONFIG_USB_RTL8150 is not set
1223# CONFIG_USB_USBNET_MII is not set
1224# CONFIG_USB_USBNET is not set
1225CONFIG_USB_MON=y
1226
1227#
1228# USB port drivers
1229#
1230
1231#
1232# USB Serial Converter support
1233#
1234# CONFIG_USB_SERIAL is not set
1235
1236#
1237# USB Miscellaneous drivers
1238#
1239# CONFIG_USB_EMI62 is not set
1240# CONFIG_USB_EMI26 is not set
1241# CONFIG_USB_ADUTUX is not set
1242# CONFIG_USB_AUERSWALD is not set
1243# CONFIG_USB_RIO500 is not set
1244# CONFIG_USB_LEGOTOWER is not set
1245# CONFIG_USB_LCD is not set
1246# CONFIG_USB_BERRY_CHARGE is not set
1247# CONFIG_USB_LED is not set
1248# CONFIG_USB_CYPRESS_CY7C63 is not set
1249# CONFIG_USB_CYTHERM is not set
1250# CONFIG_USB_PHIDGET is not set
1251# CONFIG_USB_IDMOUSE is not set
1252# CONFIG_USB_FTDI_ELAN is not set
1253# CONFIG_USB_APPLEDISPLAY is not set
1254# CONFIG_USB_SISUSBVGA is not set
1255# CONFIG_USB_LD is not set
1256# CONFIG_USB_TRANCEVIBRATOR is not set
1257# CONFIG_USB_IOWARRIOR is not set
1258
1259#
1260# USB DSL modem support
1261#
1262
1263#
1264# USB Gadget Support
1265#
1266# CONFIG_USB_GADGET is not set
1267
1268#
1269# MMC/SD Card support
1270#
1271# CONFIG_MMC is not set
1272
1273#
1274# LED devices
1275#
1276# CONFIG_NEW_LEDS is not set
1277
1278#
1279# LED drivers
1280#
1281
1282#
1283# LED Triggers
1284#
1285
1286#
1287# InfiniBand support
1288#
1289# CONFIG_INFINIBAND is not set
1290
1291#
1292# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
1293#
1294
1295#
1296# Real Time Clock
1297#
1298# CONFIG_RTC_CLASS is not set
1299
1300#
1301# DMA Engine support
1302#
1303# CONFIG_DMA_ENGINE is not set
1304
1305#
1306# DMA Clients
1307#
1308
1309#
1310# DMA Devices
1311#
1312
1313#
1314# Auxiliary Display support
1315#
1316
1317#
1318# Virtualization
1319#
1320# CONFIG_MSPEC is not set
1321
1322#
1323# File systems
1324#
1325CONFIG_EXT2_FS=y
1326CONFIG_EXT2_FS_XATTR=y 33CONFIG_EXT2_FS_XATTR=y
1327# CONFIG_EXT2_FS_POSIX_ACL is not set 34CONFIG_EXT2_FS=y
1328# CONFIG_EXT2_FS_SECURITY is not set
1329# CONFIG_EXT2_FS_XIP is not set
1330CONFIG_EXT3_FS=y 35CONFIG_EXT3_FS=y
1331CONFIG_EXT3_FS_XATTR=y 36CONFIG_FB_RADEON_DEBUG=y
1332# CONFIG_EXT3_FS_POSIX_ACL is not set 37CONFIG_FB_RADEON=y
1333# CONFIG_EXT3_FS_SECURITY is not set 38CONFIG_FLATMEM_MANUAL=y
1334# CONFIG_EXT4DEV_FS is not set 39CONFIG_FUSION_CTL=m
1335CONFIG_JBD=y 40CONFIG_FUSION_FC=y
1336# CONFIG_JBD_DEBUG is not set 41CONFIG_FUSION_SPI=y
1337CONFIG_FS_MBCACHE=y 42CONFIG_FUSION=y
1338# CONFIG_REISERFS_FS is not set 43CONFIG_HOTPLUG_CPU=y
1339# CONFIG_JFS_FS is not set 44CONFIG_HOTPLUG_PCI_ACPI=y
1340# CONFIG_FS_POSIX_ACL is not set 45CONFIG_HOTPLUG_PCI=y
1341# CONFIG_XFS_FS is not set 46CONFIG_HUGETLBFS=y
1342# CONFIG_GFS2_FS is not set 47# CONFIG_HWMON is not set
1343# CONFIG_OCFS2_FS is not set 48# CONFIG_HW_RANDOM is not set
1344# CONFIG_MINIX_FS is not set 49CONFIG_I2C_CHARDEV=y
1345# CONFIG_ROMFS_FS is not set 50CONFIG_IA64_HP_ZX1=y
1346# CONFIG_INOTIFY is not set 51CONFIG_IA64_MCA_RECOVERY=y
1347# CONFIG_QUOTA is not set 52CONFIG_IA64_PALINFO=y
1348CONFIG_DNOTIFY=y 53CONFIG_IA64_PRINT_HAZARDS=y
1349CONFIG_AUTOFS_FS=y 54CONFIG_IDE=y
1350# CONFIG_AUTOFS4_FS is not set 55CONFIG_INET=y
1351# CONFIG_FUSE_FS is not set 56CONFIG_INPUT_EVDEV=y
1352 57CONFIG_INPUT_JOYDEV=y
1353# 58# CONFIG_INPUT_KEYBOARD is not set
1354# CD-ROM/DVD Filesystems 59# CONFIG_INPUT_MOUSE is not set
1355# 60CONFIG_IP_MULTICAST=y
61# CONFIG_IPV6 is not set
1356CONFIG_ISO9660_FS=y 62CONFIG_ISO9660_FS=y
1357CONFIG_JOLIET=y 63CONFIG_JOLIET=y
1358# CONFIG_ZISOFS is not set 64CONFIG_KPROBES=y
1359CONFIG_UDF_FS=y 65# CONFIG_LOGO_LINUX_MONO is not set
1360CONFIG_UDF_NLS=y 66# CONFIG_LOGO_LINUX_VGA16 is not set
1361 67CONFIG_LOGO=y
1362# 68CONFIG_MAGIC_SYSRQ=y
1363# DOS/FAT/NT Filesystems 69CONFIG_MCKINLEY=y
1364# 70CONFIG_MODULES=y
1365CONFIG_FAT_FS=y
1366CONFIG_MSDOS_FS=y 71CONFIG_MSDOS_FS=y
1367CONFIG_VFAT_FS=y 72CONFIG_NETDEVICES=y
1368CONFIG_FAT_DEFAULT_CODEPAGE=437 73CONFIG_NET_ETHERNET=y
1369CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1" 74CONFIG_NETFILTER=y
1370# CONFIG_NTFS_FS is not set 75CONFIG_NET_PCI=y
1371 76CONFIG_NET_TULIP=y
1372# 77CONFIG_NFSD_V3=y
1373# Pseudo filesystems 78CONFIG_NFSD=y
1374#
1375CONFIG_PROC_FS=y
1376CONFIG_PROC_KCORE=y
1377CONFIG_PROC_VMCORE=y
1378CONFIG_PROC_SYSCTL=y
1379CONFIG_SYSFS=y
1380CONFIG_TMPFS=y
1381# CONFIG_TMPFS_POSIX_ACL is not set
1382CONFIG_HUGETLBFS=y
1383CONFIG_HUGETLB_PAGE=y
1384CONFIG_RAMFS=y
1385# CONFIG_CONFIGFS_FS is not set
1386
1387#
1388# Miscellaneous filesystems
1389#
1390# CONFIG_ADFS_FS is not set
1391# CONFIG_AFFS_FS is not set
1392# CONFIG_HFS_FS is not set
1393# CONFIG_HFSPLUS_FS is not set
1394# CONFIG_BEFS_FS is not set
1395# CONFIG_BFS_FS is not set
1396# CONFIG_EFS_FS is not set
1397# CONFIG_CRAMFS is not set
1398# CONFIG_VXFS_FS is not set
1399# CONFIG_HPFS_FS is not set
1400# CONFIG_QNX4FS_FS is not set
1401# CONFIG_SYSV_FS is not set
1402# CONFIG_UFS_FS is not set
1403
1404#
1405# Network File Systems
1406#
1407CONFIG_NFS_FS=y 79CONFIG_NFS_FS=y
1408CONFIG_NFS_V3=y 80CONFIG_NFS_V3=y
1409# CONFIG_NFS_V3_ACL is not set
1410CONFIG_NFS_V4=y 81CONFIG_NFS_V4=y
1411# CONFIG_NFS_DIRECTIO is not set 82CONFIG_NLS_CODEPAGE_1251=y
1412CONFIG_NFSD=y
1413CONFIG_NFSD_V3=y
1414# CONFIG_NFSD_V3_ACL is not set
1415# CONFIG_NFSD_V4 is not set
1416# CONFIG_NFSD_TCP is not set
1417CONFIG_LOCKD=y
1418CONFIG_LOCKD_V4=y
1419CONFIG_EXPORTFS=y
1420CONFIG_NFS_COMMON=y
1421CONFIG_SUNRPC=y
1422CONFIG_SUNRPC_GSS=y
1423CONFIG_RPCSEC_GSS_KRB5=y
1424# CONFIG_RPCSEC_GSS_SPKM3 is not set
1425# CONFIG_SMB_FS is not set
1426# CONFIG_CIFS is not set
1427# CONFIG_NCP_FS is not set
1428# CONFIG_CODA_FS is not set
1429# CONFIG_AFS_FS is not set
1430# CONFIG_9P_FS is not set
1431
1432#
1433# Partition Types
1434#
1435CONFIG_PARTITION_ADVANCED=y
1436# CONFIG_ACORN_PARTITION is not set
1437# CONFIG_OSF_PARTITION is not set
1438# CONFIG_AMIGA_PARTITION is not set
1439# CONFIG_ATARI_PARTITION is not set
1440# CONFIG_MAC_PARTITION is not set
1441CONFIG_MSDOS_PARTITION=y
1442# CONFIG_BSD_DISKLABEL is not set
1443# CONFIG_MINIX_SUBPARTITION is not set
1444# CONFIG_SOLARIS_X86_PARTITION is not set
1445# CONFIG_UNIXWARE_DISKLABEL is not set
1446# CONFIG_LDM_PARTITION is not set
1447# CONFIG_SGI_PARTITION is not set
1448# CONFIG_ULTRIX_PARTITION is not set
1449# CONFIG_SUN_PARTITION is not set
1450# CONFIG_KARMA_PARTITION is not set
1451CONFIG_EFI_PARTITION=y
1452
1453#
1454# Native Language Support
1455#
1456CONFIG_NLS=y
1457CONFIG_NLS_DEFAULT="iso8859-1"
1458CONFIG_NLS_CODEPAGE_437=y 83CONFIG_NLS_CODEPAGE_437=y
1459CONFIG_NLS_CODEPAGE_737=y 84CONFIG_NLS_CODEPAGE_737=y
1460CONFIG_NLS_CODEPAGE_775=y 85CONFIG_NLS_CODEPAGE_775=y
@@ -1470,15 +95,14 @@ CONFIG_NLS_CODEPAGE_864=y
1470CONFIG_NLS_CODEPAGE_865=y 95CONFIG_NLS_CODEPAGE_865=y
1471CONFIG_NLS_CODEPAGE_866=y 96CONFIG_NLS_CODEPAGE_866=y
1472CONFIG_NLS_CODEPAGE_869=y 97CONFIG_NLS_CODEPAGE_869=y
1473CONFIG_NLS_CODEPAGE_936=y 98CONFIG_NLS_CODEPAGE_874=y
1474CONFIG_NLS_CODEPAGE_950=y
1475CONFIG_NLS_CODEPAGE_932=y 99CONFIG_NLS_CODEPAGE_932=y
100CONFIG_NLS_CODEPAGE_936=y
1476CONFIG_NLS_CODEPAGE_949=y 101CONFIG_NLS_CODEPAGE_949=y
1477CONFIG_NLS_CODEPAGE_874=y 102CONFIG_NLS_CODEPAGE_950=y
1478CONFIG_NLS_ISO8859_8=y 103CONFIG_NLS_ISO8859_13=y
1479# CONFIG_NLS_CODEPAGE_1250 is not set 104CONFIG_NLS_ISO8859_14=y
1480CONFIG_NLS_CODEPAGE_1251=y 105CONFIG_NLS_ISO8859_15=y
1481# CONFIG_NLS_ASCII is not set
1482CONFIG_NLS_ISO8859_1=y 106CONFIG_NLS_ISO8859_1=y
1483CONFIG_NLS_ISO8859_2=y 107CONFIG_NLS_ISO8859_2=y
1484CONFIG_NLS_ISO8859_3=y 108CONFIG_NLS_ISO8859_3=y
@@ -1486,125 +110,52 @@ CONFIG_NLS_ISO8859_4=y
1486CONFIG_NLS_ISO8859_5=y 110CONFIG_NLS_ISO8859_5=y
1487CONFIG_NLS_ISO8859_6=y 111CONFIG_NLS_ISO8859_6=y
1488CONFIG_NLS_ISO8859_7=y 112CONFIG_NLS_ISO8859_7=y
113CONFIG_NLS_ISO8859_8=y
1489CONFIG_NLS_ISO8859_9=y 114CONFIG_NLS_ISO8859_9=y
1490CONFIG_NLS_ISO8859_13=y
1491CONFIG_NLS_ISO8859_14=y
1492CONFIG_NLS_ISO8859_15=y
1493CONFIG_NLS_KOI8_R=y 115CONFIG_NLS_KOI8_R=y
1494CONFIG_NLS_KOI8_U=y 116CONFIG_NLS_KOI8_U=y
1495CONFIG_NLS_UTF8=y 117CONFIG_NLS_UTF8=y
1496 118CONFIG_NR_CPUS=16
1497# 119CONFIG_PACKET=y
1498# Distributed Lock Manager 120CONFIG_PARTITION_ADVANCED=y
1499# 121CONFIG_PERFMON=y
1500# CONFIG_DLM is not set 122CONFIG_PROC_KCORE=y
1501 123CONFIG_SCSI_CONSTANTS=y
1502# 124CONFIG_SCSI_LOGGING=y
1503# Library routines 125CONFIG_SCSI_MULTI_LUN=y
1504# 126CONFIG_SCSI_QLOGIC_1280=y
1505CONFIG_BITREVERSE=y 127CONFIG_SCSI_SYM53C8XX_2=y
1506# CONFIG_CRC_CCITT is not set 128CONFIG_SCSI=y
1507# CONFIG_CRC16 is not set 129CONFIG_SERIAL_8250_CONSOLE=y
1508CONFIG_CRC32=y 130CONFIG_SERIAL_8250_EXTENDED=y
1509# CONFIG_LIBCRC32C is not set 131CONFIG_SERIAL_8250_NR_UARTS=8
1510CONFIG_PLIST=y 132CONFIG_SERIAL_8250_SHARE_IRQ=y
1511CONFIG_HAS_IOMEM=y 133CONFIG_SERIAL_8250=y
1512CONFIG_HAS_IOPORT=y 134# CONFIG_SERIO_I8042 is not set
1513CONFIG_GENERIC_HARDIRQS=y 135# CONFIG_SERIO_SERPORT is not set
1514CONFIG_GENERIC_IRQ_PROBE=y 136CONFIG_SMP=y
1515CONFIG_GENERIC_PENDING_IRQ=y 137CONFIG_SND_FM801=y
1516CONFIG_IRQ_PER_CPU=y 138CONFIG_SND_MIXER_OSS=y
1517 139CONFIG_SND_PCM_OSS=y
1518# 140CONFIG_SND_SEQUENCER_OSS=y
1519# Instrumentation Support 141CONFIG_SND_SEQUENCER=y
1520# 142CONFIG_SND=y
1521# CONFIG_PROFILING is not set 143CONFIG_SOUND=y
1522CONFIG_KPROBES=y 144CONFIG_SYSVIPC=y
1523 145CONFIG_TIGON3=y
1524# 146CONFIG_TMPFS=y
1525# Kernel hacking 147CONFIG_TULIP_MMIO=y
1526# 148CONFIG_TULIP_MWI=y
1527# CONFIG_PRINTK_TIME is not set 149CONFIG_TULIP_NAPI_HW_MITIGATION=y
1528CONFIG_ENABLE_MUST_CHECK=y 150CONFIG_TULIP_NAPI=y
1529CONFIG_MAGIC_SYSRQ=y 151CONFIG_TULIP=y
1530# CONFIG_UNUSED_SYMBOLS is not set 152CONFIG_UDF_FS=y
1531# CONFIG_DEBUG_FS is not set 153CONFIG_UNIX=y
1532# CONFIG_HEADERS_CHECK is not set 154CONFIG_USB_EHCI_HCD=y
1533CONFIG_DEBUG_KERNEL=y 155CONFIG_USB_HIDDEV=y
1534# CONFIG_DEBUG_SHIRQ is not set 156CONFIG_USB_MON=y
1535CONFIG_LOG_BUF_SHIFT=17 157CONFIG_USB_OHCI_HCD=y
1536CONFIG_DETECT_SOFTLOCKUP=y 158CONFIG_USB_STORAGE=y
1537# CONFIG_SCHEDSTATS is not set 159CONFIG_USB_UHCI_HCD=y
1538# CONFIG_TIMER_STATS is not set 160CONFIG_USB=y
1539# CONFIG_DEBUG_SLAB is not set 161CONFIG_VFAT_FS=y
1540# CONFIG_DEBUG_RT_MUTEXES is not set
1541# CONFIG_RT_MUTEX_TESTER is not set
1542# CONFIG_DEBUG_SPINLOCK is not set
1543CONFIG_DEBUG_MUTEXES=y
1544# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
1545# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
1546# CONFIG_DEBUG_KOBJECT is not set
1547# CONFIG_DEBUG_INFO is not set
1548# CONFIG_DEBUG_VM is not set
1549# CONFIG_DEBUG_LIST is not set
1550CONFIG_FORCED_INLINING=y
1551# CONFIG_RCU_TORTURE_TEST is not set
1552# CONFIG_LKDTM is not set
1553# CONFIG_FAULT_INJECTION is not set
1554CONFIG_IA64_GRANULE_16MB=y
1555# CONFIG_IA64_GRANULE_64MB is not set
1556CONFIG_IA64_PRINT_HAZARDS=y
1557# CONFIG_DISABLE_VHPT is not set
1558# CONFIG_IA64_DEBUG_CMPXCHG is not set
1559# CONFIG_IA64_DEBUG_IRQ is not set
1560CONFIG_SYSVIPC_COMPAT=y
1561
1562#
1563# Security options
1564#
1565# CONFIG_KEYS is not set
1566# CONFIG_SECURITY is not set
1567
1568#
1569# Cryptographic options
1570#
1571CONFIG_CRYPTO=y
1572CONFIG_CRYPTO_ALGAPI=y
1573CONFIG_CRYPTO_BLKCIPHER=y
1574CONFIG_CRYPTO_MANAGER=y
1575# CONFIG_CRYPTO_HMAC is not set
1576# CONFIG_CRYPTO_XCBC is not set
1577# CONFIG_CRYPTO_NULL is not set
1578# CONFIG_CRYPTO_MD4 is not set
1579CONFIG_CRYPTO_MD5=y
1580# CONFIG_CRYPTO_SHA1 is not set
1581# CONFIG_CRYPTO_SHA256 is not set
1582# CONFIG_CRYPTO_SHA512 is not set
1583# CONFIG_CRYPTO_WP512 is not set
1584# CONFIG_CRYPTO_TGR192 is not set
1585# CONFIG_CRYPTO_GF128MUL is not set
1586CONFIG_CRYPTO_ECB=m
1587CONFIG_CRYPTO_CBC=y
1588CONFIG_CRYPTO_PCBC=m
1589# CONFIG_CRYPTO_LRW is not set
1590CONFIG_CRYPTO_DES=y
1591# CONFIG_CRYPTO_FCRYPT is not set
1592# CONFIG_CRYPTO_BLOWFISH is not set
1593# CONFIG_CRYPTO_TWOFISH is not set
1594# CONFIG_CRYPTO_SERPENT is not set
1595# CONFIG_CRYPTO_AES is not set
1596# CONFIG_CRYPTO_CAST5 is not set
1597# CONFIG_CRYPTO_CAST6 is not set
1598# CONFIG_CRYPTO_TEA is not set
1599# CONFIG_CRYPTO_ARC4 is not set
1600# CONFIG_CRYPTO_KHAZAD is not set
1601# CONFIG_CRYPTO_ANUBIS is not set
1602# CONFIG_CRYPTO_DEFLATE is not set
1603# CONFIG_CRYPTO_MICHAEL_MIC is not set
1604# CONFIG_CRYPTO_CRC32C is not set
1605# CONFIG_CRYPTO_CAMELLIA is not set
1606# CONFIG_CRYPTO_TEST is not set
1607
1608#
1609# Hardware crypto devices
1610#
diff --git a/arch/ia64/include/asm/kvm_host.h b/arch/ia64/include/asm/kvm_host.h
index a362e67e0ca6..2f229e5de498 100644
--- a/arch/ia64/include/asm/kvm_host.h
+++ b/arch/ia64/include/asm/kvm_host.h
@@ -235,6 +235,7 @@ struct kvm_vm_data {
235#define KVM_REQ_PTC_G 32 235#define KVM_REQ_PTC_G 32
236#define KVM_REQ_RESUME 33 236#define KVM_REQ_RESUME 33
237 237
238#define KVM_HPAGE_GFN_SHIFT(x) 0
238#define KVM_NR_PAGE_SIZES 1 239#define KVM_NR_PAGE_SIZES 1
239#define KVM_PAGES_PER_HPAGE(x) 1 240#define KVM_PAGES_PER_HPAGE(x) 1
240 241
diff --git a/arch/ia64/include/asm/local64.h b/arch/ia64/include/asm/local64.h
new file mode 100644
index 000000000000..36c93b5cc239
--- /dev/null
+++ b/arch/ia64/include/asm/local64.h
@@ -0,0 +1 @@
#include <asm-generic/local64.h>
diff --git a/arch/ia64/include/asm/page.h b/arch/ia64/include/asm/page.h
index 5f271bc712ee..41b6d31110fd 100644
--- a/arch/ia64/include/asm/page.h
+++ b/arch/ia64/include/asm/page.h
@@ -41,7 +41,7 @@
41#define PAGE_SIZE (__IA64_UL_CONST(1) << PAGE_SHIFT) 41#define PAGE_SIZE (__IA64_UL_CONST(1) << PAGE_SHIFT)
42#define PAGE_MASK (~(PAGE_SIZE - 1)) 42#define PAGE_MASK (~(PAGE_SIZE - 1))
43 43
44#define PERCPU_PAGE_SHIFT 16 /* log2() of max. size of per-CPU area */ 44#define PERCPU_PAGE_SHIFT 18 /* log2() of max. size of per-CPU area */
45#define PERCPU_PAGE_SIZE (__IA64_UL_CONST(1) << PERCPU_PAGE_SHIFT) 45#define PERCPU_PAGE_SIZE (__IA64_UL_CONST(1) << PERCPU_PAGE_SHIFT)
46 46
47 47
diff --git a/arch/ia64/kernel/msi_ia64.c b/arch/ia64/kernel/msi_ia64.c
index 6c8922856049..4a746ea838ff 100644
--- a/arch/ia64/kernel/msi_ia64.c
+++ b/arch/ia64/kernel/msi_ia64.c
@@ -25,7 +25,7 @@ static int ia64_set_msi_irq_affinity(unsigned int irq,
25 if (irq_prepare_move(irq, cpu)) 25 if (irq_prepare_move(irq, cpu))
26 return -1; 26 return -1;
27 27
28 read_msi_msg(irq, &msg); 28 get_cached_msi_msg(irq, &msg);
29 29
30 addr = msg.address_lo; 30 addr = msg.address_lo;
31 addr &= MSI_ADDR_DEST_ID_MASK; 31 addr &= MSI_ADDR_DEST_ID_MASK;
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index ab985f785c14..744329072f33 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -1696,8 +1696,8 @@ pfm_poll(struct file *filp, poll_table * wait)
1696 return mask; 1696 return mask;
1697} 1697}
1698 1698
1699static int 1699static long
1700pfm_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) 1700pfm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1701{ 1701{
1702 DPRINT(("pfm_ioctl called\n")); 1702 DPRINT(("pfm_ioctl called\n"));
1703 return -EINVAL; 1703 return -EINVAL;
@@ -2174,15 +2174,15 @@ pfm_no_open(struct inode *irrelevant, struct file *dontcare)
2174 2174
2175 2175
2176static const struct file_operations pfm_file_ops = { 2176static const struct file_operations pfm_file_ops = {
2177 .llseek = no_llseek, 2177 .llseek = no_llseek,
2178 .read = pfm_read, 2178 .read = pfm_read,
2179 .write = pfm_write, 2179 .write = pfm_write,
2180 .poll = pfm_poll, 2180 .poll = pfm_poll,
2181 .ioctl = pfm_ioctl, 2181 .unlocked_ioctl = pfm_ioctl,
2182 .open = pfm_no_open, /* special open code to disallow open via /proc */ 2182 .open = pfm_no_open, /* special open code to disallow open via /proc */
2183 .fasync = pfm_fasync, 2183 .fasync = pfm_fasync,
2184 .release = pfm_close, 2184 .release = pfm_close,
2185 .flush = pfm_flush 2185 .flush = pfm_flush
2186}; 2186};
2187 2187
2188static int 2188static int
diff --git a/arch/ia64/kernel/time.c b/arch/ia64/kernel/time.c
index 653b3c46ea82..ed6f22eb5b12 100644
--- a/arch/ia64/kernel/time.c
+++ b/arch/ia64/kernel/time.c
@@ -471,7 +471,8 @@ void update_vsyscall_tz(void)
471{ 471{
472} 472}
473 473
474void update_vsyscall(struct timespec *wall, struct clocksource *c, u32 mult) 474void update_vsyscall(struct timespec *wall, struct timespec *wtm,
475 struct clocksource *c, u32 mult)
475{ 476{
476 unsigned long flags; 477 unsigned long flags;
477 478
@@ -487,9 +488,9 @@ void update_vsyscall(struct timespec *wall, struct clocksource *c, u32 mult)
487 /* copy kernel time structures */ 488 /* copy kernel time structures */
488 fsyscall_gtod_data.wall_time.tv_sec = wall->tv_sec; 489 fsyscall_gtod_data.wall_time.tv_sec = wall->tv_sec;
489 fsyscall_gtod_data.wall_time.tv_nsec = wall->tv_nsec; 490 fsyscall_gtod_data.wall_time.tv_nsec = wall->tv_nsec;
490 fsyscall_gtod_data.monotonic_time.tv_sec = wall_to_monotonic.tv_sec 491 fsyscall_gtod_data.monotonic_time.tv_sec = wtm->tv_sec
491 + wall->tv_sec; 492 + wall->tv_sec;
492 fsyscall_gtod_data.monotonic_time.tv_nsec = wall_to_monotonic.tv_nsec 493 fsyscall_gtod_data.monotonic_time.tv_nsec = wtm->tv_nsec
493 + wall->tv_nsec; 494 + wall->tv_nsec;
494 495
495 /* normalize */ 496 /* normalize */
diff --git a/arch/ia64/kernel/vmlinux.lds.S b/arch/ia64/kernel/vmlinux.lds.S
index e07218a2577f..5a4d044dcb1c 100644
--- a/arch/ia64/kernel/vmlinux.lds.S
+++ b/arch/ia64/kernel/vmlinux.lds.S
@@ -6,204 +6,209 @@
6 6
7#include <asm-generic/vmlinux.lds.h> 7#include <asm-generic/vmlinux.lds.h>
8 8
9#define IVT_TEXT \
10 VMLINUX_SYMBOL(__start_ivt_text) = .; \
11 *(.text..ivt) \
12 VMLINUX_SYMBOL(__end_ivt_text) = .;
13
14OUTPUT_FORMAT("elf64-ia64-little") 9OUTPUT_FORMAT("elf64-ia64-little")
15OUTPUT_ARCH(ia64) 10OUTPUT_ARCH(ia64)
16ENTRY(phys_start) 11ENTRY(phys_start)
17jiffies = jiffies_64; 12jiffies = jiffies_64;
13
18PHDRS { 14PHDRS {
19 code PT_LOAD; 15 code PT_LOAD;
20 percpu PT_LOAD; 16 percpu PT_LOAD;
21 data PT_LOAD; 17 data PT_LOAD;
22 note PT_NOTE; 18 note PT_NOTE;
23 unwind 0x70000001; /* PT_IA_64_UNWIND, but ld doesn't match the name */ 19 unwind 0x70000001; /* PT_IA_64_UNWIND, but ld doesn't match the name */
24} 20}
25SECTIONS
26{
27 /* unwind exit sections must be discarded before the rest of the
28 sections get included. */
29 /DISCARD/ : {
30 *(.IA_64.unwind.exit.text)
31 *(.IA_64.unwind_info.exit.text)
32 *(.comment)
33 *(.note)
34 }
35
36 v = PAGE_OFFSET; /* this symbol is here to make debugging easier... */
37 phys_start = _start - LOAD_OFFSET;
38
39 code : { } :code
40 . = KERNEL_START;
41
42 _text = .;
43 _stext = .;
44
45 .text : AT(ADDR(.text) - LOAD_OFFSET)
46 {
47 IVT_TEXT
48 TEXT_TEXT
49 SCHED_TEXT
50 LOCK_TEXT
51 KPROBES_TEXT
52 *(.gnu.linkonce.t*)
53 }
54 .text2 : AT(ADDR(.text2) - LOAD_OFFSET)
55 { *(.text2) }
56#ifdef CONFIG_SMP
57 .text..lock : AT(ADDR(.text..lock) - LOAD_OFFSET)
58 { *(.text..lock) }
59#endif
60 _etext = .;
61 21
62 /* Read-only data */ 22SECTIONS {
23 /*
24 * unwind exit sections must be discarded before
25 * the rest of the sections get included.
26 */
27 /DISCARD/ : {
28 *(.IA_64.unwind.exit.text)
29 *(.IA_64.unwind_info.exit.text)
30 *(.comment)
31 *(.note)
32 }
63 33
64 NOTES :code :note /* put .notes in text and mark in PT_NOTE */ 34 v = PAGE_OFFSET; /* this symbol is here to make debugging easier... */
65 code_continues : {} :code /* switch back to regular program... */ 35 phys_start = _start - LOAD_OFFSET;
36
37 code : {
38 } :code
39 . = KERNEL_START;
40
41 _text = .;
42 _stext = .;
43
44 .text : AT(ADDR(.text) - LOAD_OFFSET) {
45 __start_ivt_text = .;
46 *(.text..ivt)
47 __end_ivt_text = .;
48 TEXT_TEXT
49 SCHED_TEXT
50 LOCK_TEXT
51 KPROBES_TEXT
52 *(.gnu.linkonce.t*)
53 }
66 54
67 EXCEPTION_TABLE(16) 55 .text2 : AT(ADDR(.text2) - LOAD_OFFSET) {
56 *(.text2)
57 }
68 58
69 /* MCA table */ 59#ifdef CONFIG_SMP
70 . = ALIGN(16); 60 .text..lock : AT(ADDR(.text..lock) - LOAD_OFFSET) {
71 __mca_table : AT(ADDR(__mca_table) - LOAD_OFFSET) 61 *(.text..lock)
72 { 62 }
73 __start___mca_table = .; 63#endif
74 *(__mca_table) 64 _etext = .;
75 __stop___mca_table = .; 65
66 /*
67 * Read-only data
68 */
69 NOTES :code :note /* put .notes in text and mark in PT_NOTE */
70 code_continues : {
71 } : code /* switch back to regular program... */
72
73 EXCEPTION_TABLE(16)
74
75 /* MCA table */
76 . = ALIGN(16);
77 __mca_table : AT(ADDR(__mca_table) - LOAD_OFFSET) {
78 __start___mca_table = .;
79 *(__mca_table)
80 __stop___mca_table = .;
76 } 81 }
77 82
78 .data..patch.phys_stack_reg : AT(ADDR(.data..patch.phys_stack_reg) - LOAD_OFFSET) 83 .data..patch.phys_stack_reg : AT(ADDR(.data..patch.phys_stack_reg) - LOAD_OFFSET) {
79 { 84 __start___phys_stack_reg_patchlist = .;
80 __start___phys_stack_reg_patchlist = .; 85 *(.data..patch.phys_stack_reg)
81 *(.data..patch.phys_stack_reg) 86 __end___phys_stack_reg_patchlist = .;
82 __end___phys_stack_reg_patchlist = .;
83 } 87 }
84 88
85 /* Global data */ 89 /*
86 _data = .; 90 * Global data
91 */
92 _data = .;
87 93
88 /* Unwind info & table: */ 94 /* Unwind info & table: */
89 . = ALIGN(8); 95 . = ALIGN(8);
90 .IA_64.unwind_info : AT(ADDR(.IA_64.unwind_info) - LOAD_OFFSET) 96 .IA_64.unwind_info : AT(ADDR(.IA_64.unwind_info) - LOAD_OFFSET) {
91 { *(.IA_64.unwind_info*) } 97 *(.IA_64.unwind_info*)
92 .IA_64.unwind : AT(ADDR(.IA_64.unwind) - LOAD_OFFSET) 98 }
93 { 99 .IA_64.unwind : AT(ADDR(.IA_64.unwind) - LOAD_OFFSET) {
94 __start_unwind = .; 100 __start_unwind = .;
95 *(.IA_64.unwind*) 101 *(.IA_64.unwind*)
96 __end_unwind = .; 102 __end_unwind = .;
97 } :code :unwind 103 } :code :unwind
98 code_continues2 : {} : code 104 code_continues2 : {
105 } : code
99 106
100 RODATA 107 RODATA
101 108
102 .opd : AT(ADDR(.opd) - LOAD_OFFSET) 109 .opd : AT(ADDR(.opd) - LOAD_OFFSET) {
103 { *(.opd) } 110 *(.opd)
104 111 }
105 /* Initialization code and data: */
106 112
107 . = ALIGN(PAGE_SIZE); 113 /*
108 __init_begin = .; 114 * Initialization code and data:
115 */
116 . = ALIGN(PAGE_SIZE);
117 __init_begin = .;
109 118
110 INIT_TEXT_SECTION(PAGE_SIZE) 119 INIT_TEXT_SECTION(PAGE_SIZE)
111 INIT_DATA_SECTION(16) 120 INIT_DATA_SECTION(16)
112 121
113 .data..patch.vtop : AT(ADDR(.data..patch.vtop) - LOAD_OFFSET) 122 .data..patch.vtop : AT(ADDR(.data..patch.vtop) - LOAD_OFFSET) {
114 { 123 __start___vtop_patchlist = .;
115 __start___vtop_patchlist = .; 124 *(.data..patch.vtop)
116 *(.data..patch.vtop) 125 __end___vtop_patchlist = .;
117 __end___vtop_patchlist = .;
118 } 126 }
119 127
120 .data..patch.rse : AT(ADDR(.data..patch.rse) - LOAD_OFFSET) 128 .data..patch.rse : AT(ADDR(.data..patch.rse) - LOAD_OFFSET) {
121 { 129 __start___rse_patchlist = .;
122 __start___rse_patchlist = .; 130 *(.data..patch.rse)
123 *(.data..patch.rse) 131 __end___rse_patchlist = .;
124 __end___rse_patchlist = .;
125 } 132 }
126 133
127 .data..patch.mckinley_e9 : AT(ADDR(.data..patch.mckinley_e9) - LOAD_OFFSET) 134 .data..patch.mckinley_e9 : AT(ADDR(.data..patch.mckinley_e9) - LOAD_OFFSET) {
128 { 135 __start___mckinley_e9_bundles = .;
129 __start___mckinley_e9_bundles = .; 136 *(.data..patch.mckinley_e9)
130 *(.data..patch.mckinley_e9) 137 __end___mckinley_e9_bundles = .;
131 __end___mckinley_e9_bundles = .;
132 } 138 }
133 139
134#if defined(CONFIG_PARAVIRT) 140#if defined(CONFIG_PARAVIRT)
135 . = ALIGN(16); 141 . = ALIGN(16);
136 .paravirt_bundles : AT(ADDR(.paravirt_bundles) - LOAD_OFFSET) 142 .paravirt_bundles : AT(ADDR(.paravirt_bundles) - LOAD_OFFSET) {
137 { 143 __start_paravirt_bundles = .;
138 __start_paravirt_bundles = .; 144 *(.paravirt_bundles)
139 *(.paravirt_bundles) 145 __stop_paravirt_bundles = .;
140 __stop_paravirt_bundles = .; 146 }
141 } 147 . = ALIGN(16);
142 . = ALIGN(16); 148 .paravirt_insts : AT(ADDR(.paravirt_insts) - LOAD_OFFSET) {
143 .paravirt_insts : AT(ADDR(.paravirt_insts) - LOAD_OFFSET) 149 __start_paravirt_insts = .;
144 { 150 *(.paravirt_insts)
145 __start_paravirt_insts = .; 151 __stop_paravirt_insts = .;
146 *(.paravirt_insts) 152 }
147 __stop_paravirt_insts = .; 153 . = ALIGN(16);
148 } 154 .paravirt_branches : AT(ADDR(.paravirt_branches) - LOAD_OFFSET) {
149 . = ALIGN(16); 155 __start_paravirt_branches = .;
150 .paravirt_branches : AT(ADDR(.paravirt_branches) - LOAD_OFFSET) 156 *(.paravirt_branches)
151 { 157 __stop_paravirt_branches = .;
152 __start_paravirt_branches = .;
153 *(.paravirt_branches)
154 __stop_paravirt_branches = .;
155 } 158 }
156#endif 159#endif
157 160
158#if defined(CONFIG_IA64_GENERIC) 161#if defined(CONFIG_IA64_GENERIC)
159 /* Machine Vector */ 162 /* Machine Vector */
160 . = ALIGN(16); 163 . = ALIGN(16);
161 .machvec : AT(ADDR(.machvec) - LOAD_OFFSET) 164 .machvec : AT(ADDR(.machvec) - LOAD_OFFSET) {
162 { 165 machvec_start = .;
163 machvec_start = .; 166 *(.machvec)
164 *(.machvec) 167 machvec_end = .;
165 machvec_end = .;
166 } 168 }
167#endif 169#endif
168 170
169#ifdef CONFIG_SMP 171#ifdef CONFIG_SMP
170 . = ALIGN(PERCPU_PAGE_SIZE); 172 . = ALIGN(PERCPU_PAGE_SIZE);
171 __cpu0_per_cpu = .; 173 __cpu0_per_cpu = .;
172 . = . + PERCPU_PAGE_SIZE; /* cpu0 per-cpu space */ 174 . = . + PERCPU_PAGE_SIZE; /* cpu0 per-cpu space */
173#endif 175#endif
174 176
175 . = ALIGN(PAGE_SIZE); 177 . = ALIGN(PAGE_SIZE);
176 __init_end = .; 178 __init_end = .;
177 179
178 .data..page_aligned : AT(ADDR(.data..page_aligned) - LOAD_OFFSET) 180 .data..page_aligned : AT(ADDR(.data..page_aligned) - LOAD_OFFSET) {
179 { 181 PAGE_ALIGNED_DATA(PAGE_SIZE)
180 PAGE_ALIGNED_DATA(PAGE_SIZE) 182 . = ALIGN(PAGE_SIZE);
181 . = ALIGN(PAGE_SIZE); 183 __start_gate_section = .;
182 __start_gate_section = .; 184 *(.data..gate)
183 *(.data..gate) 185 __stop_gate_section = .;
184 __stop_gate_section = .;
185#ifdef CONFIG_XEN 186#ifdef CONFIG_XEN
186 . = ALIGN(PAGE_SIZE); 187 . = ALIGN(PAGE_SIZE);
187 __xen_start_gate_section = .; 188 __xen_start_gate_section = .;
188 *(.data..gate.xen) 189 *(.data..gate.xen)
189 __xen_stop_gate_section = .; 190 __xen_stop_gate_section = .;
190#endif 191#endif
191 } 192 }
192 . = ALIGN(PAGE_SIZE); /* make sure the gate page doesn't expose 193 /*
193 * kernel data 194 * make sure the gate page doesn't expose
194 */ 195 * kernel data
195 196 */
196 /* Per-cpu data: */ 197 . = ALIGN(PAGE_SIZE);
197 . = ALIGN(PERCPU_PAGE_SIZE); 198
198 PERCPU_VADDR(PERCPU_ADDR, :percpu) 199 /* Per-cpu data: */
199 __phys_per_cpu_start = __per_cpu_load; 200 . = ALIGN(PERCPU_PAGE_SIZE);
200 . = __phys_per_cpu_start + PERCPU_PAGE_SIZE; /* ensure percpu data fits 201 PERCPU_VADDR(PERCPU_ADDR, :percpu)
201 * into percpu page size 202 __phys_per_cpu_start = __per_cpu_load;
202 */ 203 /*
203 204 * ensure percpu data fits
204 data : { } :data 205 * into percpu page size
205 .data : AT(ADDR(.data) - LOAD_OFFSET) 206 */
206 { 207 . = __phys_per_cpu_start + PERCPU_PAGE_SIZE;
208
209 data : {
210 } :data
211 .data : AT(ADDR(.data) - LOAD_OFFSET) {
207 INIT_TASK_DATA(PAGE_SIZE) 212 INIT_TASK_DATA(PAGE_SIZE)
208 CACHELINE_ALIGNED_DATA(SMP_CACHE_BYTES) 213 CACHELINE_ALIGNED_DATA(SMP_CACHE_BYTES)
209 READ_MOSTLY_DATA(SMP_CACHE_BYTES) 214 READ_MOSTLY_DATA(SMP_CACHE_BYTES)
@@ -213,26 +218,37 @@ SECTIONS
213 CONSTRUCTORS 218 CONSTRUCTORS
214 } 219 }
215 220
216 . = ALIGN(16); /* gp must be 16-byte aligned for exc. table */ 221 . = ALIGN(16); /* gp must be 16-byte aligned for exc. table */
217 .got : AT(ADDR(.got) - LOAD_OFFSET) 222 .got : AT(ADDR(.got) - LOAD_OFFSET) {
218 { *(.got.plt) *(.got) } 223 *(.got.plt)
219 __gp = ADDR(.got) + 0x200000; 224 *(.got)
220 /* We want the small data sections together, so single-instruction offsets 225 }
221 can access them all, and initialized data all before uninitialized, so 226 __gp = ADDR(.got) + 0x200000;
222 we can shorten the on-disk segment size. */ 227
223 .sdata : AT(ADDR(.sdata) - LOAD_OFFSET) 228 /*
224 { *(.sdata) *(.sdata1) *(.srdata) } 229 * We want the small data sections together,
225 _edata = .; 230 * so single-instruction offsets can access
231 * them all, and initialized data all before
232 * uninitialized, so we can shorten the
233 * on-disk segment size.
234 */
235 .sdata : AT(ADDR(.sdata) - LOAD_OFFSET) {
236 *(.sdata)
237 *(.sdata1)
238 *(.srdata)
239 }
240 _edata = .;
226 241
227 BSS_SECTION(0, 0, 0) 242 BSS_SECTION(0, 0, 0)
228 243
229 _end = .; 244 _end = .;
230 245
231 code : { } :code 246 code : {
247 } :code
232 248
233 STABS_DEBUG 249 STABS_DEBUG
234 DWARF_DEBUG 250 DWARF_DEBUG
235 251
236 /* Default discards */ 252 /* Default discards */
237 DISCARDS 253 DISCARDS
238} 254}
diff --git a/arch/ia64/kvm/kvm-ia64.c b/arch/ia64/kvm/kvm-ia64.c
index 21b701374f72..f56a6316e134 100644
--- a/arch/ia64/kvm/kvm-ia64.c
+++ b/arch/ia64/kvm/kvm-ia64.c
@@ -725,8 +725,6 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
725 int r; 725 int r;
726 sigset_t sigsaved; 726 sigset_t sigsaved;
727 727
728 vcpu_load(vcpu);
729
730 if (vcpu->sigset_active) 728 if (vcpu->sigset_active)
731 sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved); 729 sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved);
732 730
@@ -748,7 +746,6 @@ out:
748 if (vcpu->sigset_active) 746 if (vcpu->sigset_active)
749 sigprocmask(SIG_SETMASK, &sigsaved, NULL); 747 sigprocmask(SIG_SETMASK, &sigsaved, NULL);
750 748
751 vcpu_put(vcpu);
752 return r; 749 return r;
753} 750}
754 751
@@ -883,8 +880,6 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
883 struct vpd *vpd = to_host(vcpu->kvm, vcpu->arch.vpd); 880 struct vpd *vpd = to_host(vcpu->kvm, vcpu->arch.vpd);
884 int i; 881 int i;
885 882
886 vcpu_load(vcpu);
887
888 for (i = 0; i < 16; i++) { 883 for (i = 0; i < 16; i++) {
889 vpd->vgr[i] = regs->vpd.vgr[i]; 884 vpd->vgr[i] = regs->vpd.vgr[i];
890 vpd->vbgr[i] = regs->vpd.vbgr[i]; 885 vpd->vbgr[i] = regs->vpd.vbgr[i];
@@ -931,8 +926,6 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
931 vcpu->arch.itc_offset = regs->saved_itc - kvm_get_itc(vcpu); 926 vcpu->arch.itc_offset = regs->saved_itc - kvm_get_itc(vcpu);
932 set_bit(KVM_REQ_RESUME, &vcpu->requests); 927 set_bit(KVM_REQ_RESUME, &vcpu->requests);
933 928
934 vcpu_put(vcpu);
935
936 return 0; 929 return 0;
937} 930}
938 931
@@ -1237,7 +1230,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
1237 p_ctx->cr[2] = (unsigned long)kvm_vmm_info->vmm_ivt; 1230 p_ctx->cr[2] = (unsigned long)kvm_vmm_info->vmm_ivt;
1238 p_ctx->cr[8] = 0x3c; 1231 p_ctx->cr[8] = 0x3c;
1239 1232
1240 /*Initilize region register*/ 1233 /*Initialize region register*/
1241 p_ctx->rr[0] = 0x30; 1234 p_ctx->rr[0] = 0x30;
1242 p_ctx->rr[1] = 0x30; 1235 p_ctx->rr[1] = 0x30;
1243 p_ctx->rr[2] = 0x30; 1236 p_ctx->rr[2] = 0x30;
@@ -1246,7 +1239,7 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
1246 p_ctx->rr[5] = 0x30; 1239 p_ctx->rr[5] = 0x30;
1247 p_ctx->rr[7] = 0x30; 1240 p_ctx->rr[7] = 0x30;
1248 1241
1249 /*Initilize branch register 0*/ 1242 /*Initialize branch register 0*/
1250 p_ctx->br[0] = *(unsigned long *)kvm_vmm_info->vmm_entry; 1243 p_ctx->br[0] = *(unsigned long *)kvm_vmm_info->vmm_entry;
1251 1244
1252 vcpu->arch.vmm_rr = kvm->arch.vmm_init_rr; 1245 vcpu->arch.vmm_rr = kvm->arch.vmm_init_rr;
@@ -1707,7 +1700,7 @@ static int kvm_relocate_vmm(struct kvm_vmm_info *vmm_info,
1707 BUG_ON(!module); 1700 BUG_ON(!module);
1708 1701
1709 if (!kvm_vmm_base) { 1702 if (!kvm_vmm_base) {
1710 printk("kvm: kvm area hasn't been initilized yet!!\n"); 1703 printk("kvm: kvm area hasn't been initialized yet!!\n");
1711 return -EFAULT; 1704 return -EFAULT;
1712 } 1705 }
1713 1706
@@ -1802,35 +1795,24 @@ void kvm_arch_exit(void)
1802 kvm_vmm_info = NULL; 1795 kvm_vmm_info = NULL;
1803} 1796}
1804 1797
1805static int kvm_ia64_sync_dirty_log(struct kvm *kvm, 1798static void kvm_ia64_sync_dirty_log(struct kvm *kvm,
1806 struct kvm_dirty_log *log) 1799 struct kvm_memory_slot *memslot)
1807{ 1800{
1808 struct kvm_memory_slot *memslot; 1801 int i;
1809 int r, i;
1810 long base; 1802 long base;
1811 unsigned long n; 1803 unsigned long n;
1812 unsigned long *dirty_bitmap = (unsigned long *)(kvm->arch.vm_base + 1804 unsigned long *dirty_bitmap = (unsigned long *)(kvm->arch.vm_base +
1813 offsetof(struct kvm_vm_data, kvm_mem_dirty_log)); 1805 offsetof(struct kvm_vm_data, kvm_mem_dirty_log));
1814 1806
1815 r = -EINVAL;
1816 if (log->slot >= KVM_MEMORY_SLOTS)
1817 goto out;
1818
1819 memslot = &kvm->memslots->memslots[log->slot];
1820 r = -ENOENT;
1821 if (!memslot->dirty_bitmap)
1822 goto out;
1823
1824 n = kvm_dirty_bitmap_bytes(memslot); 1807 n = kvm_dirty_bitmap_bytes(memslot);
1825 base = memslot->base_gfn / BITS_PER_LONG; 1808 base = memslot->base_gfn / BITS_PER_LONG;
1826 1809
1810 spin_lock(&kvm->arch.dirty_log_lock);
1827 for (i = 0; i < n/sizeof(long); ++i) { 1811 for (i = 0; i < n/sizeof(long); ++i) {
1828 memslot->dirty_bitmap[i] = dirty_bitmap[base + i]; 1812 memslot->dirty_bitmap[i] = dirty_bitmap[base + i];
1829 dirty_bitmap[base + i] = 0; 1813 dirty_bitmap[base + i] = 0;
1830 } 1814 }
1831 r = 0; 1815 spin_unlock(&kvm->arch.dirty_log_lock);
1832out:
1833 return r;
1834} 1816}
1835 1817
1836int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, 1818int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
@@ -1842,12 +1824,17 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
1842 int is_dirty = 0; 1824 int is_dirty = 0;
1843 1825
1844 mutex_lock(&kvm->slots_lock); 1826 mutex_lock(&kvm->slots_lock);
1845 spin_lock(&kvm->arch.dirty_log_lock);
1846 1827
1847 r = kvm_ia64_sync_dirty_log(kvm, log); 1828 r = -EINVAL;
1848 if (r) 1829 if (log->slot >= KVM_MEMORY_SLOTS)
1830 goto out;
1831
1832 memslot = &kvm->memslots->memslots[log->slot];
1833 r = -ENOENT;
1834 if (!memslot->dirty_bitmap)
1849 goto out; 1835 goto out;
1850 1836
1837 kvm_ia64_sync_dirty_log(kvm, memslot);
1851 r = kvm_get_dirty_log(kvm, log, &is_dirty); 1838 r = kvm_get_dirty_log(kvm, log, &is_dirty);
1852 if (r) 1839 if (r)
1853 goto out; 1840 goto out;
@@ -1855,14 +1842,12 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
1855 /* If nothing is dirty, don't bother messing with page tables. */ 1842 /* If nothing is dirty, don't bother messing with page tables. */
1856 if (is_dirty) { 1843 if (is_dirty) {
1857 kvm_flush_remote_tlbs(kvm); 1844 kvm_flush_remote_tlbs(kvm);
1858 memslot = &kvm->memslots->memslots[log->slot];
1859 n = kvm_dirty_bitmap_bytes(memslot); 1845 n = kvm_dirty_bitmap_bytes(memslot);
1860 memset(memslot->dirty_bitmap, 0, n); 1846 memset(memslot->dirty_bitmap, 0, n);
1861 } 1847 }
1862 r = 0; 1848 r = 0;
1863out: 1849out:
1864 mutex_unlock(&kvm->slots_lock); 1850 mutex_unlock(&kvm->slots_lock);
1865 spin_unlock(&kvm->arch.dirty_log_lock);
1866 return r; 1851 return r;
1867} 1852}
1868 1853
@@ -1953,11 +1938,6 @@ int kvm_cpu_has_pending_timer(struct kvm_vcpu *vcpu)
1953 return vcpu->arch.timer_fired; 1938 return vcpu->arch.timer_fired;
1954} 1939}
1955 1940
1956gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn)
1957{
1958 return gfn;
1959}
1960
1961int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu) 1941int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
1962{ 1942{
1963 return (vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE) || 1943 return (vcpu->arch.mp_state == KVM_MP_STATE_RUNNABLE) ||
@@ -1967,9 +1947,7 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
1967int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu, 1947int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
1968 struct kvm_mp_state *mp_state) 1948 struct kvm_mp_state *mp_state)
1969{ 1949{
1970 vcpu_load(vcpu);
1971 mp_state->mp_state = vcpu->arch.mp_state; 1950 mp_state->mp_state = vcpu->arch.mp_state;
1972 vcpu_put(vcpu);
1973 return 0; 1951 return 0;
1974} 1952}
1975 1953
@@ -2000,10 +1978,8 @@ int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
2000{ 1978{
2001 int r = 0; 1979 int r = 0;
2002 1980
2003 vcpu_load(vcpu);
2004 vcpu->arch.mp_state = mp_state->mp_state; 1981 vcpu->arch.mp_state = mp_state->mp_state;
2005 if (vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED) 1982 if (vcpu->arch.mp_state == KVM_MP_STATE_UNINITIALIZED)
2006 r = vcpu_reset(vcpu); 1983 r = vcpu_reset(vcpu);
2007 vcpu_put(vcpu);
2008 return r; 1984 return r;
2009} 1985}
diff --git a/arch/ia64/sn/kernel/msi_sn.c b/arch/ia64/sn/kernel/msi_sn.c
index ebfdd6a9ae1a..0c72dd463831 100644
--- a/arch/ia64/sn/kernel/msi_sn.c
+++ b/arch/ia64/sn/kernel/msi_sn.c
@@ -175,7 +175,7 @@ static int sn_set_msi_irq_affinity(unsigned int irq,
175 * Release XIO resources for the old MSI PCI address 175 * Release XIO resources for the old MSI PCI address
176 */ 176 */
177 177
178 read_msi_msg(irq, &msg); 178 get_cached_msi_msg(irq, &msg);
179 sn_pdev = (struct pcidev_info *)sn_irq_info->irq_pciioinfo; 179 sn_pdev = (struct pcidev_info *)sn_irq_info->irq_pciioinfo;
180 pdev = sn_pdev->pdi_linux_pcidev; 180 pdev = sn_pdev->pdi_linux_pcidev;
181 provider = SN_PCIDEV_BUSPROVIDER(pdev); 181 provider = SN_PCIDEV_BUSPROVIDER(pdev);
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
index d00dfc180021..dbc4cbecb5ed 100644
--- a/arch/ia64/sn/kernel/setup.c
+++ b/arch/ia64/sn/kernel/setup.c
@@ -507,7 +507,7 @@ static void __init sn_init_pdas(char **cmdline_p)
507 cnodeid_t cnode; 507 cnodeid_t cnode;
508 508
509 /* 509 /*
510 * Allocate & initalize the nodepda for each node. 510 * Allocate & initialize the nodepda for each node.
511 */ 511 */
512 for_each_online_node(cnode) { 512 for_each_online_node(cnode) {
513 nodepdaindr[cnode] = 513 nodepdaindr[cnode] =
diff --git a/arch/m32r/Kconfig b/arch/m32r/Kconfig
index 3a9319f93e89..836abbbc9c04 100644
--- a/arch/m32r/Kconfig
+++ b/arch/m32r/Kconfig
@@ -44,9 +44,6 @@ config HZ
44 int 44 int
45 default 100 45 default 100
46 46
47config GENERIC_TIME
48 def_bool y
49
50config ARCH_USES_GETTIMEOFFSET 47config ARCH_USES_GETTIMEOFFSET
51 def_bool y 48 def_bool y
52 49
diff --git a/arch/m32r/Makefile b/arch/m32r/Makefile
index 469766b24e22..8ff5ba0ea26c 100644
--- a/arch/m32r/Makefile
+++ b/arch/m32r/Makefile
@@ -12,8 +12,8 @@ OBJCOPYFLAGS := -O binary -R .note -R .comment -S
12LDFLAGS_vmlinux := 12LDFLAGS_vmlinux :=
13 13
14KBUILD_CFLAGS += -pipe -fno-schedule-insns 14KBUILD_CFLAGS += -pipe -fno-schedule-insns
15CFLAGS_KERNEL += -mmodel=medium 15KBUILD_CFLAGS_KERNEL += -mmodel=medium
16CFLAGS_MODULE += -mmodel=large 16KBUILD_CFLAGS_MODULE += -mmodel=large
17 17
18ifdef CONFIG_CHIP_VDEC2 18ifdef CONFIG_CHIP_VDEC2
19cflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -Wa,-bitinst 19cflags-$(CONFIG_ISA_M32R2) += -DNO_FPU -Wa,-bitinst
diff --git a/arch/m32r/include/asm/local64.h b/arch/m32r/include/asm/local64.h
new file mode 100644
index 000000000000..36c93b5cc239
--- /dev/null
+++ b/arch/m32r/include/asm/local64.h
@@ -0,0 +1 @@
#include <asm-generic/local64.h>
diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig
index 2e3737b92ffc..8030e2481d97 100644
--- a/arch/m68k/Kconfig
+++ b/arch/m68k/Kconfig
@@ -59,9 +59,6 @@ config HZ
59 int 59 int
60 default 100 60 default 100
61 61
62config GENERIC_TIME
63 def_bool y
64
65config ARCH_USES_GETTIMEOFFSET 62config ARCH_USES_GETTIMEOFFSET
66 def_bool y 63 def_bool y
67 64
diff --git a/arch/m68k/Makefile b/arch/m68k/Makefile
index 570d85c3f97f..b06a7e3cbcd6 100644
--- a/arch/m68k/Makefile
+++ b/arch/m68k/Makefile
@@ -18,7 +18,7 @@ KBUILD_DEFCONFIG := multi_defconfig
18# override top level makefile 18# override top level makefile
19AS += -m68020 19AS += -m68020
20LDFLAGS := -m m68kelf 20LDFLAGS := -m m68kelf
21LDFLAGS_MODULE += -T $(srctree)/arch/m68k/kernel/module.lds 21KBUILD_LDFLAGS_MODULE += -T $(srctree)/arch/m68k/kernel/module.lds
22ifneq ($(SUBARCH),$(ARCH)) 22ifneq ($(SUBARCH),$(ARCH))
23 ifeq ($(CROSS_COMPILE),) 23 ifeq ($(CROSS_COMPILE),)
24 CROSS_COMPILE := $(call cc-cross-prefix, \ 24 CROSS_COMPILE := $(call cc-cross-prefix, \
diff --git a/arch/m68k/include/asm/local64.h b/arch/m68k/include/asm/local64.h
new file mode 100644
index 000000000000..36c93b5cc239
--- /dev/null
+++ b/arch/m68k/include/asm/local64.h
@@ -0,0 +1 @@
#include <asm-generic/local64.h>
diff --git a/arch/m68knommu/Kconfig b/arch/m68knommu/Kconfig
index efeb6033fc17..2609c394e1df 100644
--- a/arch/m68knommu/Kconfig
+++ b/arch/m68knommu/Kconfig
@@ -63,10 +63,6 @@ config GENERIC_CALIBRATE_DELAY
63 bool 63 bool
64 default y 64 default y
65 65
66config GENERIC_TIME
67 bool
68 default y
69
70config GENERIC_CMOS_UPDATE 66config GENERIC_CMOS_UPDATE
71 bool 67 bool
72 default y 68 default y
diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig
index 505a08592423..692fdfce2a23 100644
--- a/arch/microblaze/Kconfig
+++ b/arch/microblaze/Kconfig
@@ -14,9 +14,12 @@ config MICROBLAZE
14 select USB_ARCH_HAS_EHCI 14 select USB_ARCH_HAS_EHCI
15 select ARCH_WANT_OPTIONAL_GPIOLIB 15 select ARCH_WANT_OPTIONAL_GPIOLIB
16 select HAVE_OPROFILE 16 select HAVE_OPROFILE
17 select HAVE_ARCH_KGDB
17 select HAVE_DMA_ATTRS 18 select HAVE_DMA_ATTRS
18 select HAVE_DMA_API_DEBUG 19 select HAVE_DMA_API_DEBUG
19 select TRACING_SUPPORT 20 select TRACING_SUPPORT
21 select OF
22 select OF_FLATTREE
20 23
21config SWAP 24config SWAP
22 def_bool n 25 def_bool n
@@ -48,9 +51,6 @@ config GENERIC_IRQ_PROBE
48config GENERIC_CALIBRATE_DELAY 51config GENERIC_CALIBRATE_DELAY
49 def_bool y 52 def_bool y
50 53
51config GENERIC_TIME
52 def_bool y
53
54config GENERIC_TIME_VSYSCALL 54config GENERIC_TIME_VSYSCALL
55 def_bool n 55 def_bool n
56 56
@@ -75,9 +75,6 @@ config LOCKDEP_SUPPORT
75config HAVE_LATENCYTOP_SUPPORT 75config HAVE_LATENCYTOP_SUPPORT
76 def_bool y 76 def_bool y
77 77
78config DTC
79 def_bool y
80
81source "init/Kconfig" 78source "init/Kconfig"
82 79
83source "kernel/Kconfig.freezer" 80source "kernel/Kconfig.freezer"
@@ -124,18 +121,6 @@ config CMDLINE_FORCE
124 Set this to have arguments from the default kernel command string 121 Set this to have arguments from the default kernel command string
125 override those passed by the boot loader. 122 override those passed by the boot loader.
126 123
127config OF
128 def_bool y
129 select OF_FLATTREE
130
131config PROC_DEVICETREE
132 bool "Support for device tree in /proc"
133 depends on PROC_FS
134 help
135 This option adds a device-tree directory under /proc which contains
136 an image of the device tree that the kernel copies from Open
137 Firmware or other boot firmware. If unsure, say Y here.
138
139endmenu 124endmenu
140 125
141menu "Advanced setup" 126menu "Advanced setup"
@@ -223,6 +208,36 @@ config TASK_SIZE
223 hex "Size of user task space" if TASK_SIZE_BOOL 208 hex "Size of user task space" if TASK_SIZE_BOOL
224 default "0x80000000" 209 default "0x80000000"
225 210
211choice
212 prompt "Page size"
213 default MICROBLAZE_4K_PAGES
214 depends on ADVANCED_OPTIONS && !MMU
215 help
216 Select the kernel logical page size. Increasing the page size
217 will reduce software overhead at each page boundary, allow
218 hardware prefetch mechanisms to be more effective, and allow
219 larger dma transfers increasing IO efficiency and reducing
220 overhead. However the utilization of memory will increase.
221 For example, each cached file will using a multiple of the
222 page size to hold its contents and the difference between the
223 end of file and the end of page is wasted.
224
225 If unsure, choose 4K_PAGES.
226
227config MICROBLAZE_4K_PAGES
228 bool "4k page size"
229
230config MICROBLAZE_8K_PAGES
231 bool "8k page size"
232
233config MICROBLAZE_16K_PAGES
234 bool "16k page size"
235
236config MICROBLAZE_32K_PAGES
237 bool "32k page size"
238
239endchoice
240
226endmenu 241endmenu
227 242
228source "mm/Kconfig" 243source "mm/Kconfig"
diff --git a/arch/microblaze/Kconfig.debug b/arch/microblaze/Kconfig.debug
index 9dc708a7f700..e6e5e0da28c3 100644
--- a/arch/microblaze/Kconfig.debug
+++ b/arch/microblaze/Kconfig.debug
@@ -10,6 +10,7 @@ source "lib/Kconfig.debug"
10 10
11config EARLY_PRINTK 11config EARLY_PRINTK
12 bool "Early printk function for kernel" 12 bool "Early printk function for kernel"
13 depends on SERIAL_UARTLITE_CONSOLE
13 default n 14 default n
14 help 15 help
15 This option turns on/off early printk messages to console. 16 This option turns on/off early printk messages to console.
diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile
index 72f6e8583746..592c7079de88 100644
--- a/arch/microblaze/Makefile
+++ b/arch/microblaze/Makefile
@@ -25,7 +25,7 @@ ifeq (,$(findstring spartan2,$(CONFIG_XILINX_MICROBLAZE0_FAMILY)))
25 ifeq ($(CPU_MAJOR),3) 25 ifeq ($(CPU_MAJOR),3)
26 CPUFLAGS-1 += -mno-xl-soft-mul 26 CPUFLAGS-1 += -mno-xl-soft-mul
27 else 27 else
28 # USE_HW_MUL can be 0, 1, or 2, defining a heirarchy of HW Mul support. 28 # USE_HW_MUL can be 0, 1, or 2, defining a hierarchy of HW Mul support.
29 CPUFLAGS-$(subst 1,,$(CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL)) += -mxl-multiply-high 29 CPUFLAGS-$(subst 1,,$(CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL)) += -mxl-multiply-high
30 CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL) += -mno-xl-soft-mul 30 CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL) += -mno-xl-soft-mul
31 endif 31 endif
diff --git a/arch/microblaze/boot/Makefile b/arch/microblaze/boot/Makefile
index 57f50c2371c6..be01d78750d9 100644
--- a/arch/microblaze/boot/Makefile
+++ b/arch/microblaze/boot/Makefile
@@ -35,13 +35,14 @@ quiet_cmd_cp = CP $< $@$2
35 cmd_cp = cat $< >$@$2 || (rm -f $@ && echo false) 35 cmd_cp = cat $< >$@$2 || (rm -f $@ && echo false)
36 36
37quiet_cmd_strip = STRIP $@ 37quiet_cmd_strip = STRIP $@
38 cmd_strip = $(STRIP) -K _start -K _end -K __log_buf -K _fdt_start vmlinux -o $@ 38 cmd_strip = $(STRIP) -K microblaze_start -K _end -K __log_buf \
39 -K _fdt_start vmlinux -o $@
39 40
40quiet_cmd_uimage = UIMAGE $@.ub 41quiet_cmd_uimage = UIMAGE $@.ub
41 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A microblaze -O linux -T kernel \ 42 cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A microblaze -O linux -T kernel \
42 -C none -n 'Linux-$(KERNELRELEASE)' \ 43 -C none -n 'Linux-$(KERNELRELEASE)' \
43 -a $(CONFIG_KERNEL_BASE_ADDR) -e $(CONFIG_KERNEL_BASE_ADDR) \ 44 -a $(CONFIG_KERNEL_BASE_ADDR) -e $(CONFIG_KERNEL_BASE_ADDR) \
44 -d $@ $@.ub 45 -d $@ $@.ub
45 46
46$(obj)/simpleImage.%: vmlinux FORCE 47$(obj)/simpleImage.%: vmlinux FORCE
47 $(call if_changed,cp,.unstrip) 48 $(call if_changed,cp,.unstrip)
diff --git a/arch/microblaze/include/asm/cacheflush.h b/arch/microblaze/include/asm/cacheflush.h
index a6edd356cd08..7ebd955460d9 100644
--- a/arch/microblaze/include/asm/cacheflush.h
+++ b/arch/microblaze/include/asm/cacheflush.h
@@ -17,6 +17,7 @@
17 17
18/* Somebody depends on this; sigh... */ 18/* Somebody depends on this; sigh... */
19#include <linux/mm.h> 19#include <linux/mm.h>
20#include <linux/io.h>
20 21
21/* Look at Documentation/cachetlb.txt */ 22/* Look at Documentation/cachetlb.txt */
22 23
@@ -60,7 +61,6 @@ void microblaze_cache_init(void);
60#define invalidate_icache() mbc->iin(); 61#define invalidate_icache() mbc->iin();
61#define invalidate_icache_range(start, end) mbc->iinr(start, end); 62#define invalidate_icache_range(start, end) mbc->iinr(start, end);
62 63
63
64#define flush_icache_user_range(vma, pg, adr, len) flush_icache(); 64#define flush_icache_user_range(vma, pg, adr, len) flush_icache();
65#define flush_icache_page(vma, pg) do { } while (0) 65#define flush_icache_page(vma, pg) do { } while (0)
66 66
@@ -72,9 +72,15 @@ void microblaze_cache_init(void);
72#define flush_dcache() mbc->dfl(); 72#define flush_dcache() mbc->dfl();
73#define flush_dcache_range(start, end) mbc->dflr(start, end); 73#define flush_dcache_range(start, end) mbc->dflr(start, end);
74 74
75#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0 75#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 1
76/* D-cache aliasing problem can't happen - cache is between MMU and ram */ 76/* MS: We have to implement it because of rootfs-jffs2 issue on WB */
77#define flush_dcache_page(page) do { } while (0) 77#define flush_dcache_page(page) \
78do { \
79 unsigned long addr = (unsigned long) page_address(page); /* virtual */ \
80 addr = (u32)virt_to_phys((void *)addr); \
81 flush_dcache_range((unsigned) (addr), (unsigned) (addr) + PAGE_SIZE); \
82} while (0);
83
78#define flush_dcache_mmap_lock(mapping) do { } while (0) 84#define flush_dcache_mmap_lock(mapping) do { } while (0)
79#define flush_dcache_mmap_unlock(mapping) do { } while (0) 85#define flush_dcache_mmap_unlock(mapping) do { } while (0)
80 86
@@ -97,8 +103,10 @@ void microblaze_cache_init(void);
97 103
98#define copy_to_user_page(vma, page, vaddr, dst, src, len) \ 104#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
99do { \ 105do { \
106 u32 addr = virt_to_phys(dst); \
107 invalidate_icache_range((unsigned) (addr), (unsigned) (addr) + (len));\
100 memcpy((dst), (src), (len)); \ 108 memcpy((dst), (src), (len)); \
101 flush_icache_range((unsigned) (dst), (unsigned) (dst) + (len)); \ 109 flush_dcache_range((unsigned) (addr), (unsigned) (addr) + (len));\
102} while (0) 110} while (0)
103 111
104#define copy_from_user_page(vma, page, vaddr, dst, src, len) \ 112#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
diff --git a/arch/microblaze/include/asm/dma-mapping.h b/arch/microblaze/include/asm/dma-mapping.h
index 18b3731c8509..507389580709 100644
--- a/arch/microblaze/include/asm/dma-mapping.h
+++ b/arch/microblaze/include/asm/dma-mapping.h
@@ -79,12 +79,6 @@ static inline int dma_supported(struct device *dev, u64 mask)
79 return ops->dma_supported(dev, mask); 79 return ops->dma_supported(dev, mask);
80} 80}
81 81
82#ifdef CONFIG_PCI
83/* We have our own implementation of pci_set_dma_mask() */
84#define HAVE_ARCH_PCI_SET_DMA_MASK
85
86#endif
87
88static inline int dma_set_mask(struct device *dev, u64 dma_mask) 82static inline int dma_set_mask(struct device *dev, u64 dma_mask)
89{ 83{
90 struct dma_map_ops *ops = get_dma_ops(dev); 84 struct dma_map_ops *ops = get_dma_ops(dev);
diff --git a/arch/microblaze/include/asm/elf.h b/arch/microblaze/include/asm/elf.h
index 7d4acf2b278e..732caf1be741 100644
--- a/arch/microblaze/include/asm/elf.h
+++ b/arch/microblaze/include/asm/elf.h
@@ -77,7 +77,7 @@ typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
77#define ELF_DATA ELFDATA2MSB 77#define ELF_DATA ELFDATA2MSB
78#endif 78#endif
79 79
80#define ELF_EXEC_PAGESIZE 4096 80#define ELF_EXEC_PAGESIZE PAGE_SIZE
81 81
82 82
83#define ELF_CORE_COPY_REGS(_dest, _regs) \ 83#define ELF_CORE_COPY_REGS(_dest, _regs) \
diff --git a/arch/microblaze/include/asm/exceptions.h b/arch/microblaze/include/asm/exceptions.h
index 4c7b5d037c88..6479097b802b 100644
--- a/arch/microblaze/include/asm/exceptions.h
+++ b/arch/microblaze/include/asm/exceptions.h
@@ -14,6 +14,11 @@
14#define _ASM_MICROBLAZE_EXCEPTIONS_H 14#define _ASM_MICROBLAZE_EXCEPTIONS_H
15 15
16#ifdef __KERNEL__ 16#ifdef __KERNEL__
17
18#ifndef CONFIG_MMU
19#define EX_HANDLER_STACK_SIZ (4*19)
20#endif
21
17#ifndef __ASSEMBLY__ 22#ifndef __ASSEMBLY__
18 23
19/* Macros to enable and disable HW exceptions in the MSR */ 24/* Macros to enable and disable HW exceptions in the MSR */
@@ -64,22 +69,6 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type,
64void die(const char *str, struct pt_regs *fp, long err); 69void die(const char *str, struct pt_regs *fp, long err);
65void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr); 70void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr);
66 71
67#if defined(CONFIG_KGDB)
68void (*debugger)(struct pt_regs *regs);
69int (*debugger_bpt)(struct pt_regs *regs);
70int (*debugger_sstep)(struct pt_regs *regs);
71int (*debugger_iabr_match)(struct pt_regs *regs);
72int (*debugger_dabr_match)(struct pt_regs *regs);
73void (*debugger_fault_handler)(struct pt_regs *regs);
74#else
75#define debugger(regs) do { } while (0)
76#define debugger_bpt(regs) 0
77#define debugger_sstep(regs) 0
78#define debugger_iabr_match(regs) 0
79#define debugger_dabr_match(regs) 0
80#define debugger_fault_handler ((void (*)(struct pt_regs *))0)
81#endif
82
83#endif /*__ASSEMBLY__ */ 72#endif /*__ASSEMBLY__ */
84#endif /* __KERNEL__ */ 73#endif /* __KERNEL__ */
85#endif /* _ASM_MICROBLAZE_EXCEPTIONS_H */ 74#endif /* _ASM_MICROBLAZE_EXCEPTIONS_H */
diff --git a/arch/microblaze/include/asm/irq.h b/arch/microblaze/include/asm/irq.h
index 31a35c33df63..ec5583d6111c 100644
--- a/arch/microblaze/include/asm/irq.h
+++ b/arch/microblaze/include/asm/irq.h
@@ -27,17 +27,6 @@ extern unsigned int nr_irq;
27struct pt_regs; 27struct pt_regs;
28extern void do_IRQ(struct pt_regs *regs); 28extern void do_IRQ(struct pt_regs *regs);
29 29
30/**
31 * irq_of_parse_and_map - Parse and Map an interrupt into linux virq space
32 * @device: Device node of the device whose interrupt is to be mapped
33 * @index: Index of the interrupt to map
34 *
35 * This function is a wrapper that chains of_irq_map_one() and
36 * irq_create_of_mapping() to make things easier to callers
37 */
38struct device_node;
39extern unsigned int irq_of_parse_and_map(struct device_node *dev, int index);
40
41/** FIXME - not implement 30/** FIXME - not implement
42 * irq_dispose_mapping - Unmap an interrupt 31 * irq_dispose_mapping - Unmap an interrupt
43 * @virq: linux virq number of the interrupt to unmap 32 * @virq: linux virq number of the interrupt to unmap
@@ -62,17 +51,4 @@ struct irq_host;
62extern unsigned int irq_create_mapping(struct irq_host *host, 51extern unsigned int irq_create_mapping(struct irq_host *host,
63 irq_hw_number_t hwirq); 52 irq_hw_number_t hwirq);
64 53
65/**
66 * irq_create_of_mapping - Map a hardware interrupt into linux virq space
67 * @controller: Device node of the interrupt controller
68 * @inspec: Interrupt specifier from the device-tree
69 * @intsize: Size of the interrupt specifier from the device-tree
70 *
71 * This function is identical to irq_create_mapping except that it takes
72 * as input informations straight from the device-tree (typically the results
73 * of the of_irq_map_*() functions.
74 */
75extern unsigned int irq_create_of_mapping(struct device_node *controller,
76 u32 *intspec, unsigned int intsize);
77
78#endif /* _ASM_MICROBLAZE_IRQ_H */ 54#endif /* _ASM_MICROBLAZE_IRQ_H */
diff --git a/arch/microblaze/include/asm/kgdb.h b/arch/microblaze/include/asm/kgdb.h
new file mode 100644
index 000000000000..78b17d40b235
--- /dev/null
+++ b/arch/microblaze/include/asm/kgdb.h
@@ -0,0 +1,28 @@
1#ifdef __KERNEL__
2#ifndef __MICROBLAZE_KGDB_H__
3#define __MICROBLAZE_KGDB_H__
4
5#ifndef __ASSEMBLY__
6
7#define CACHE_FLUSH_IS_SAFE 1
8#define BUFMAX 2048
9
10/*
11 * 32 32-bit general purpose registers (r0-r31)
12 * 6 32-bit special registers (pc, msr, ear, esr, fsr, btr)
13 * 12 32-bit PVR
14 * 7 32-bit MMU Regs (redr, rpid, rzpr, rtlbx, rtlbsx, rtlblo, rtlbhi)
15 * ------
16 * 57 registers
17 */
18#define NUMREGBYTES (57 * 4)
19
20#define BREAK_INSTR_SIZE 4
21static inline void arch_kgdb_breakpoint(void)
22{
23 __asm__ __volatile__("brki r16, 0x18;");
24}
25
26#endif /* __ASSEMBLY__ */
27#endif /* __MICROBLAZE_KGDB_H__ */
28#endif /* __KERNEL__ */
diff --git a/arch/microblaze/include/asm/local64.h b/arch/microblaze/include/asm/local64.h
new file mode 100644
index 000000000000..36c93b5cc239
--- /dev/null
+++ b/arch/microblaze/include/asm/local64.h
@@ -0,0 +1 @@
#include <asm-generic/local64.h>
diff --git a/arch/microblaze/include/asm/of_device.h b/arch/microblaze/include/asm/of_device.h
deleted file mode 100644
index 73cb98040982..000000000000
--- a/arch/microblaze/include/asm/of_device.h
+++ /dev/null
@@ -1,44 +0,0 @@
1/*
2 * Copyright (C) 2007-2008 Michal Simek <monstr@monstr.eu>
3 *
4 * based on PowerPC of_device.h
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#ifndef _ASM_MICROBLAZE_OF_DEVICE_H
12#define _ASM_MICROBLAZE_OF_DEVICE_H
13#ifdef __KERNEL__
14
15#include <linux/device.h>
16#include <linux/of.h>
17
18/*
19 * The of_device is a kind of "base class" that is a superset of
20 * struct device for use by devices attached to an OF node and
21 * probed using OF properties.
22 */
23struct of_device {
24 struct device dev; /* Generic device interface */
25 struct pdev_archdata archdata;
26};
27
28extern ssize_t of_device_get_modalias(struct of_device *ofdev,
29 char *str, ssize_t len);
30
31extern struct of_device *of_device_alloc(struct device_node *np,
32 const char *bus_id,
33 struct device *parent);
34
35extern int of_device_uevent(struct device *dev,
36 struct kobj_uevent_env *env);
37
38extern void of_device_make_bus_id(struct of_device *dev);
39
40/* This is just here during the transition */
41#include <linux/of_device.h>
42
43#endif /* __KERNEL__ */
44#endif /* _ASM_MICROBLAZE_OF_DEVICE_H */
diff --git a/arch/microblaze/include/asm/of_platform.h b/arch/microblaze/include/asm/of_platform.h
deleted file mode 100644
index 37491276c6ca..000000000000
--- a/arch/microblaze/include/asm/of_platform.h
+++ /dev/null
@@ -1,54 +0,0 @@
1/*
2 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
3 * <benh@kernel.crashing.org>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version
8 * 2 of the License, or (at your option) any later version.
9 */
10
11#ifndef _ASM_MICROBLAZE_OF_PLATFORM_H
12#define _ASM_MICROBLAZE_OF_PLATFORM_H
13
14/* This is just here during the transition */
15#include <linux/of_platform.h>
16
17/*
18 * The list of OF IDs below is used for matching bus types in the
19 * system whose devices are to be exposed as of_platform_devices.
20 *
21 * This is the default list valid for most platforms. This file provides
22 * functions who can take an explicit list if necessary though
23 *
24 * The search is always performed recursively looking for children of
25 * the provided device_node and recursively if such a children matches
26 * a bus type in the list
27 */
28
29static const struct of_device_id of_default_bus_ids[] = {
30 { .type = "soc", },
31 { .compatible = "soc", },
32 { .type = "plb5", },
33 { .type = "plb4", },
34 { .type = "opb", },
35 { .type = "simple", },
36 {},
37};
38
39/* Platform devices and busses creation */
40extern struct of_device *of_platform_device_create(struct device_node *np,
41 const char *bus_id,
42 struct device *parent);
43/* pseudo "matches" value to not do deep probe */
44#define OF_NO_DEEP_PROBE ((struct of_device_id *)-1)
45
46extern int of_platform_bus_probe(struct device_node *root,
47 const struct of_device_id *matches,
48 struct device *parent);
49
50extern struct of_device *of_find_device_by_phandle(phandle ph);
51
52extern void of_instantiate_rtc(void);
53
54#endif /* _ASM_MICROBLAZE_OF_PLATFORM_H */
diff --git a/arch/microblaze/include/asm/page.h b/arch/microblaze/include/asm/page.h
index 464ff32bee3d..4f268faa0126 100644
--- a/arch/microblaze/include/asm/page.h
+++ b/arch/microblaze/include/asm/page.h
@@ -23,8 +23,16 @@
23#ifdef __KERNEL__ 23#ifdef __KERNEL__
24 24
25/* PAGE_SHIFT determines the page size */ 25/* PAGE_SHIFT determines the page size */
26#define PAGE_SHIFT (12) 26#if defined(CONFIG_MICROBLAZE_32K_PAGES)
27#define PAGE_SIZE (_AC(1, UL) << PAGE_SHIFT) 27#define PAGE_SHIFT 15
28#elif defined(CONFIG_MICROBLAZE_16K_PAGES)
29#define PAGE_SHIFT 14
30#elif defined(CONFIG_MICROBLAZE_8K_PAGES)
31#define PAGE_SHIFT 13
32#else
33#define PAGE_SHIFT 12
34#endif
35#define PAGE_SIZE (ASM_CONST(1) << PAGE_SHIFT)
28#define PAGE_MASK (~(PAGE_SIZE-1)) 36#define PAGE_MASK (~(PAGE_SIZE-1))
29 37
30#define LOAD_OFFSET ASM_CONST((CONFIG_KERNEL_START-CONFIG_KERNEL_BASE_ADDR)) 38#define LOAD_OFFSET ASM_CONST((CONFIG_KERNEL_START-CONFIG_KERNEL_BASE_ADDR))
@@ -39,13 +47,6 @@
39#define PAGE_UP(addr) (((addr)+((PAGE_SIZE)-1))&(~((PAGE_SIZE)-1))) 47#define PAGE_UP(addr) (((addr)+((PAGE_SIZE)-1))&(~((PAGE_SIZE)-1)))
40#define PAGE_DOWN(addr) ((addr)&(~((PAGE_SIZE)-1))) 48#define PAGE_DOWN(addr) ((addr)&(~((PAGE_SIZE)-1)))
41 49
42/* align addr on a size boundary - adjust address up/down if needed */
43#define _ALIGN_UP(addr, size) (((addr)+((size)-1))&(~((size)-1)))
44#define _ALIGN_DOWN(addr, size) ((addr)&(~((size)-1)))
45
46/* align addr on a size boundary - adjust address up if needed */
47#define _ALIGN(addr, size) _ALIGN_UP(addr, size)
48
49#ifndef CONFIG_MMU 50#ifndef CONFIG_MMU
50/* 51/*
51 * PAGE_OFFSET -- the first address of the first page of memory. When not 52 * PAGE_OFFSET -- the first address of the first page of memory. When not
diff --git a/arch/microblaze/include/asm/pci-bridge.h b/arch/microblaze/include/asm/pci-bridge.h
index 0c77cda9f5d8..0c68764ab547 100644
--- a/arch/microblaze/include/asm/pci-bridge.h
+++ b/arch/microblaze/include/asm/pci-bridge.h
@@ -172,13 +172,8 @@ static inline int pci_has_flag(int flag)
172 172
173extern struct list_head hose_list; 173extern struct list_head hose_list;
174 174
175extern unsigned long pci_address_to_pio(phys_addr_t address);
176extern int pcibios_vaddr_is_ioport(void __iomem *address); 175extern int pcibios_vaddr_is_ioport(void __iomem *address);
177#else 176#else
178static inline unsigned long pci_address_to_pio(phys_addr_t address)
179{
180 return (unsigned long)-1;
181}
182static inline int pcibios_vaddr_is_ioport(void __iomem *address) 177static inline int pcibios_vaddr_is_ioport(void __iomem *address)
183{ 178{
184 return 0; 179 return 0;
diff --git a/arch/microblaze/include/asm/prom.h b/arch/microblaze/include/asm/prom.h
index e7d67a329bd7..101fa098f62a 100644
--- a/arch/microblaze/include/asm/prom.h
+++ b/arch/microblaze/include/asm/prom.h
@@ -20,9 +20,6 @@
20#ifndef __ASSEMBLY__ 20#ifndef __ASSEMBLY__
21 21
22#include <linux/types.h> 22#include <linux/types.h>
23#include <linux/of_fdt.h>
24#include <linux/proc_fs.h>
25#include <linux/platform_device.h>
26#include <asm/irq.h> 23#include <asm/irq.h>
27#include <asm/atomic.h> 24#include <asm/atomic.h>
28 25
@@ -50,29 +47,10 @@ extern void pci_create_OF_bus_map(void);
50 * OF address retreival & translation 47 * OF address retreival & translation
51 */ 48 */
52 49
53/* Translate an OF address block into a CPU physical address 50#ifdef CONFIG_PCI
54 */ 51extern unsigned long pci_address_to_pio(phys_addr_t address);
55extern u64 of_translate_address(struct device_node *np, const u32 *addr); 52#define pci_address_to_pio pci_address_to_pio
56 53#endif /* CONFIG_PCI */
57/* Extract an address from a device, returns the region size and
58 * the address space flags too. The PCI version uses a BAR number
59 * instead of an absolute index
60 */
61extern const u32 *of_get_address(struct device_node *dev, int index,
62 u64 *size, unsigned int *flags);
63extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no,
64 u64 *size, unsigned int *flags);
65
66/* Get an address as a resource. Note that if your address is
67 * a PIO address, the conversion will fail if the physical address
68 * can't be internally converted to an IO token with
69 * pci_address_to_pio(), that is because it's either called to early
70 * or it can't be matched to any host bridge IO space
71 */
72extern int of_address_to_resource(struct device_node *dev, int index,
73 struct resource *r);
74extern int of_pci_address_to_resource(struct device_node *dev, int bar,
75 struct resource *r);
76 54
77/* Parse the ibm,dma-window property of an OF node into the busno, phys and 55/* Parse the ibm,dma-window property of an OF node into the busno, phys and
78 * size parameters. 56 * size parameters.
@@ -88,69 +66,6 @@ struct device_node *of_get_cpu_node(int cpu, unsigned int *thread);
88/* Get the MAC address */ 66/* Get the MAC address */
89extern const void *of_get_mac_address(struct device_node *np); 67extern const void *of_get_mac_address(struct device_node *np);
90 68
91/*
92 * OF interrupt mapping
93 */
94
95/* This structure is returned when an interrupt is mapped. The controller
96 * field needs to be put() after use
97 */
98
99#define OF_MAX_IRQ_SPEC 4 /* We handle specifiers of at most 4 cells */
100
101struct of_irq {
102 struct device_node *controller; /* Interrupt controller node */
103 u32 size; /* Specifier size */
104 u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */
105};
106
107/**
108 * of_irq_map_init - Initialize the irq remapper
109 * @flags: flags defining workarounds to enable
110 *
111 * Some machines have bugs in the device-tree which require certain workarounds
112 * to be applied. Call this before any interrupt mapping attempts to enable
113 * those workarounds.
114 */
115#define OF_IMAP_OLDWORLD_MAC 0x00000001
116#define OF_IMAP_NO_PHANDLE 0x00000002
117
118extern void of_irq_map_init(unsigned int flags);
119
120/**
121 * of_irq_map_raw - Low level interrupt tree parsing
122 * @parent: the device interrupt parent
123 * @intspec: interrupt specifier ("interrupts" property of the device)
124 * @ointsize: size of the passed in interrupt specifier
125 * @addr: address specifier (start of "reg" property of the device)
126 * @out_irq: structure of_irq filled by this function
127 *
128 * Returns 0 on success and a negative number on error
129 *
130 * This function is a low-level interrupt tree walking function. It
131 * can be used to do a partial walk with synthetized reg and interrupts
132 * properties, for example when resolving PCI interrupts when no device
133 * node exist for the parent.
134 *
135 */
136
137extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec,
138 u32 ointsize, const u32 *addr,
139 struct of_irq *out_irq);
140
141/**
142 * of_irq_map_one - Resolve an interrupt for a device
143 * @device: the device whose interrupt is to be resolved
144 * @index: index of the interrupt to resolve
145 * @out_irq: structure of_irq filled by this function
146 *
147 * This function resolves an interrupt, walking the tree, for a given
148 * device-tree node. It's the high level pendant to of_irq_map_raw().
149 * It also implements the workarounds for OldWolrd Macs.
150 */
151extern int of_irq_map_one(struct device_node *device, int index,
152 struct of_irq *out_irq);
153
154/** 69/**
155 * of_irq_map_pci - Resolve the interrupt for a PCI device 70 * of_irq_map_pci - Resolve the interrupt for a PCI device
156 * @pdev: the device whose interrupt is to be resolved 71 * @pdev: the device whose interrupt is to be resolved
@@ -163,20 +78,18 @@ extern int of_irq_map_one(struct device_node *device, int index,
163 * resolving using the OF tree walking. 78 * resolving using the OF tree walking.
164 */ 79 */
165struct pci_dev; 80struct pci_dev;
81struct of_irq;
166extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq); 82extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq);
167 83
168extern int of_irq_to_resource(struct device_node *dev, int index,
169 struct resource *r);
170
171/**
172 * of_iomap - Maps the memory mapped IO for a given device_node
173 * @device: the device whose io range will be mapped
174 * @index: index of the io range
175 *
176 * Returns a pointer to the mapped memory
177 */
178extern void __iomem *of_iomap(struct device_node *device, int index);
179
180#endif /* __ASSEMBLY__ */ 84#endif /* __ASSEMBLY__ */
181#endif /* __KERNEL__ */ 85#endif /* __KERNEL__ */
86
87/* These includes are put at the bottom because they may contain things
88 * that are overridden by this file. Ideally they shouldn't be included
89 * by this file, but there are a bunch of .c files that currently depend
90 * on it. Eventually they will be cleaned up. */
91#include <linux/of_fdt.h>
92#include <linux/of_irq.h>
93#include <linux/platform_device.h>
94
182#endif /* _ASM_MICROBLAZE_PROM_H */ 95#endif /* _ASM_MICROBLAZE_PROM_H */
diff --git a/arch/microblaze/include/asm/pvr.h b/arch/microblaze/include/asm/pvr.h
index e38abc7714b6..9578666e98ba 100644
--- a/arch/microblaze/include/asm/pvr.h
+++ b/arch/microblaze/include/asm/pvr.h
@@ -16,7 +16,7 @@
16#define PVR_MSR_BIT 0x400 16#define PVR_MSR_BIT 0x400
17 17
18struct pvr_s { 18struct pvr_s {
19 unsigned pvr[16]; 19 unsigned pvr[12];
20}; 20};
21 21
22/* The following taken from Xilinx's standalone BSP pvr.h */ 22/* The following taken from Xilinx's standalone BSP pvr.h */
diff --git a/arch/microblaze/include/asm/setup.h b/arch/microblaze/include/asm/setup.h
index 7f31394985e0..782b5c89248e 100644
--- a/arch/microblaze/include/asm/setup.h
+++ b/arch/microblaze/include/asm/setup.h
@@ -28,8 +28,6 @@ void disable_early_printk(void);
28void heartbeat(void); 28void heartbeat(void);
29void setup_heartbeat(void); 29void setup_heartbeat(void);
30 30
31unsigned long long sched_clock(void);
32
33# ifdef CONFIG_MMU 31# ifdef CONFIG_MMU
34extern void mmu_reset(void); 32extern void mmu_reset(void);
35extern void early_console_reg_tlb_alloc(unsigned int addr); 33extern void early_console_reg_tlb_alloc(unsigned int addr);
diff --git a/arch/microblaze/include/asm/system.h b/arch/microblaze/include/asm/system.h
index 48c4f0335e3f..e6a2284571dc 100644
--- a/arch/microblaze/include/asm/system.h
+++ b/arch/microblaze/include/asm/system.h
@@ -45,7 +45,6 @@ extern struct task_struct *_switch_to(struct thread_info *prev,
45#define smp_rmb() rmb() 45#define smp_rmb() rmb()
46#define smp_wmb() wmb() 46#define smp_wmb() wmb()
47 47
48void show_trace(struct task_struct *task, unsigned long *stack);
49void __bad_xchg(volatile void *ptr, int size); 48void __bad_xchg(volatile void *ptr, int size);
50 49
51static inline unsigned long __xchg(unsigned long x, volatile void *ptr, 50static inline unsigned long __xchg(unsigned long x, volatile void *ptr,
@@ -101,10 +100,7 @@ extern struct dentry *of_debugfs_root;
101 * MicroBlaze doesn't handle unaligned accesses in hardware. 100 * MicroBlaze doesn't handle unaligned accesses in hardware.
102 * 101 *
103 * Based on this we force the IP header alignment in network drivers. 102 * Based on this we force the IP header alignment in network drivers.
104 * We also modify NET_SKB_PAD to be a cacheline in size, thus maintaining
105 * cacheline alignment of buffers.
106 */ 103 */
107#define NET_IP_ALIGN 2 104#define NET_IP_ALIGN 2
108#define NET_SKB_PAD L1_CACHE_BYTES
109 105
110#endif /* _ASM_MICROBLAZE_SYSTEM_H */ 106#endif /* _ASM_MICROBLAZE_SYSTEM_H */
diff --git a/arch/microblaze/include/asm/topology.h b/arch/microblaze/include/asm/topology.h
index 96bcea5a9920..5428f333a02c 100644
--- a/arch/microblaze/include/asm/topology.h
+++ b/arch/microblaze/include/asm/topology.h
@@ -1,11 +1 @@
1#include <asm-generic/topology.h> #include <asm-generic/topology.h>
2
3#ifndef _ASM_MICROBLAZE_TOPOLOGY_H
4#define _ASM_MICROBLAZE_TOPOLOGY_H
5
6struct device_node;
7static inline int of_node_to_nid(struct device_node *device)
8{
9 return 0;
10}
11#endif /* _ASM_MICROBLAZE_TOPOLOGY_H */
diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/include/asm/uaccess.h
index 26460d15b338..d840f4a2d3c9 100644
--- a/arch/microblaze/include/asm/uaccess.h
+++ b/arch/microblaze/include/asm/uaccess.h
@@ -359,7 +359,7 @@ extern long __user_bad(void);
359 __copy_tofrom_user((__force void __user *)(to), \ 359 __copy_tofrom_user((__force void __user *)(to), \
360 (void __user *)(from), (n)) 360 (void __user *)(from), (n))
361#define __copy_from_user_inatomic(to, from, n) \ 361#define __copy_from_user_inatomic(to, from, n) \
362 copy_from_user((to), (from), (n)) 362 __copy_from_user((to), (from), (n))
363 363
364static inline long copy_from_user(void *to, 364static inline long copy_from_user(void *to,
365 const void __user *from, unsigned long n) 365 const void __user *from, unsigned long n)
@@ -373,7 +373,7 @@ static inline long copy_from_user(void *to,
373#define __copy_to_user(to, from, n) \ 373#define __copy_to_user(to, from, n) \
374 __copy_tofrom_user((void __user *)(to), \ 374 __copy_tofrom_user((void __user *)(to), \
375 (__force const void __user *)(from), (n)) 375 (__force const void __user *)(from), (n))
376#define __copy_to_user_inatomic(to, from, n) copy_to_user((to), (from), (n)) 376#define __copy_to_user_inatomic(to, from, n) __copy_to_user((to), (from), (n))
377 377
378static inline long copy_to_user(void __user *to, 378static inline long copy_to_user(void __user *to,
379 const void *from, unsigned long n) 379 const void *from, unsigned long n)
diff --git a/arch/microblaze/include/asm/unwind.h b/arch/microblaze/include/asm/unwind.h
new file mode 100644
index 000000000000..d248b7de4b13
--- /dev/null
+++ b/arch/microblaze/include/asm/unwind.h
@@ -0,0 +1,29 @@
1/*
2 * Backtrace support for Microblaze
3 *
4 * Copyright (C) 2010 Digital Design Corporation
5 *
6 * This file is subject to the terms and conditions of the GNU General Public
7 * License. See the file "COPYING" in the main directory of this archive
8 * for more details.
9 */
10
11#ifndef __MICROBLAZE_UNWIND_H
12#define __MICROBLAZE_UNWIND_H
13
14struct stack_trace;
15
16struct trap_handler_info {
17 unsigned long start_addr;
18 unsigned long end_addr;
19 const char *trap_name;
20};
21extern struct trap_handler_info microblaze_trap_handlers;
22
23extern const char _hw_exception_handler;
24extern const char ex_handler_unhandled;
25
26void microblaze_unwind(struct task_struct *task, struct stack_trace *trace);
27
28#endif /* __MICROBLAZE_UNWIND_H */
29
diff --git a/arch/microblaze/kernel/Makefile b/arch/microblaze/kernel/Makefile
index e51bc1520825..f0cb5c26c81c 100644
--- a/arch/microblaze/kernel/Makefile
+++ b/arch/microblaze/kernel/Makefile
@@ -15,9 +15,9 @@ endif
15extra-y := head.o vmlinux.lds 15extra-y := head.o vmlinux.lds
16 16
17obj-y += dma.o exceptions.o \ 17obj-y += dma.o exceptions.o \
18 hw_exception_handler.o init_task.o intc.o irq.o of_device.o \ 18 hw_exception_handler.o init_task.o intc.o irq.o \
19 of_platform.o process.o prom.o prom_parse.o ptrace.o \ 19 process.o prom.o prom_parse.o ptrace.o \
20 setup.o signal.o sys_microblaze.o timer.o traps.o reset.o 20 reset.o setup.o signal.o sys_microblaze.o timer.o traps.o unwind.o
21 21
22obj-y += cpu/ 22obj-y += cpu/
23 23
@@ -28,5 +28,6 @@ obj-$(CONFIG_MODULES) += microblaze_ksyms.o module.o
28obj-$(CONFIG_MMU) += misc.o 28obj-$(CONFIG_MMU) += misc.o
29obj-$(CONFIG_STACKTRACE) += stacktrace.o 29obj-$(CONFIG_STACKTRACE) += stacktrace.o
30obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o mcount.o 30obj-$(CONFIG_FUNCTION_TRACER) += ftrace.o mcount.o
31obj-$(CONFIG_KGDB) += kgdb.o
31 32
32obj-y += entry$(MMU).o 33obj-y += entry$(MMU).o
diff --git a/arch/microblaze/kernel/cpu/mb.c b/arch/microblaze/kernel/cpu/mb.c
index 4216eb1eaa32..7086e3564281 100644
--- a/arch/microblaze/kernel/cpu/mb.c
+++ b/arch/microblaze/kernel/cpu/mb.c
@@ -126,6 +126,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
126 cpuinfo.pvr_user1, 126 cpuinfo.pvr_user1,
127 cpuinfo.pvr_user2); 127 cpuinfo.pvr_user2);
128 128
129 count += seq_printf(m, "Page size:\t%lu\n", PAGE_SIZE);
129 return 0; 130 return 0;
130} 131}
131 132
diff --git a/arch/microblaze/kernel/entry-nommu.S b/arch/microblaze/kernel/entry-nommu.S
index 8cc18cd2cce6..ca84368570b6 100644
--- a/arch/microblaze/kernel/entry-nommu.S
+++ b/arch/microblaze/kernel/entry-nommu.S
@@ -588,3 +588,31 @@ sys_rt_sigsuspend_wrapper:
588#include "syscall_table.S" 588#include "syscall_table.S"
589 589
590syscall_table_size=(.-sys_call_table) 590syscall_table_size=(.-sys_call_table)
591
592type_SYSCALL:
593 .ascii "SYSCALL\0"
594type_IRQ:
595 .ascii "IRQ\0"
596type_IRQ_PREEMPT:
597 .ascii "IRQ (PREEMPTED)\0"
598type_SYSCALL_PREEMPT:
599 .ascii " SYSCALL (PREEMPTED)\0"
600
601 /*
602 * Trap decoding for stack unwinder
603 * Tuples are (start addr, end addr, string)
604 * If return address lies on [start addr, end addr],
605 * unwinder displays 'string'
606 */
607
608 .align 4
609.global microblaze_trap_handlers
610microblaze_trap_handlers:
611 /* Exact matches come first */
612 .word ret_to_user ; .word ret_to_user ; .word type_SYSCALL
613 .word ret_from_intr; .word ret_from_intr ; .word type_IRQ
614 /* Fuzzy matches go here */
615 .word ret_from_intr; .word no_intr_resched; .word type_IRQ_PREEMPT
616 .word work_pending ; .word no_work_pending; .word type_SYSCALL_PREEMPT
617 /* End of table */
618 .word 0 ; .word 0 ; .word 0
diff --git a/arch/microblaze/kernel/entry.S b/arch/microblaze/kernel/entry.S
index c0ede25c5b99..304882e56459 100644
--- a/arch/microblaze/kernel/entry.S
+++ b/arch/microblaze/kernel/entry.S
@@ -48,128 +48,107 @@
48 */ 48 */
49#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR 49#if CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR
50 .macro clear_bip 50 .macro clear_bip
51 msrclr r11, MSR_BIP 51 msrclr r0, MSR_BIP
52 nop
53 .endm 52 .endm
54 53
55 .macro set_bip 54 .macro set_bip
56 msrset r11, MSR_BIP 55 msrset r0, MSR_BIP
57 nop
58 .endm 56 .endm
59 57
60 .macro clear_eip 58 .macro clear_eip
61 msrclr r11, MSR_EIP 59 msrclr r0, MSR_EIP
62 nop
63 .endm 60 .endm
64 61
65 .macro set_ee 62 .macro set_ee
66 msrset r11, MSR_EE 63 msrset r0, MSR_EE
67 nop
68 .endm 64 .endm
69 65
70 .macro disable_irq 66 .macro disable_irq
71 msrclr r11, MSR_IE 67 msrclr r0, MSR_IE
72 nop
73 .endm 68 .endm
74 69
75 .macro enable_irq 70 .macro enable_irq
76 msrset r11, MSR_IE 71 msrset r0, MSR_IE
77 nop
78 .endm 72 .endm
79 73
80 .macro set_ums 74 .macro set_ums
81 msrset r11, MSR_UMS 75 msrset r0, MSR_UMS
82 nop 76 msrclr r0, MSR_VMS
83 msrclr r11, MSR_VMS
84 nop
85 .endm 77 .endm
86 78
87 .macro set_vms 79 .macro set_vms
88 msrclr r11, MSR_UMS 80 msrclr r0, MSR_UMS
89 nop 81 msrset r0, MSR_VMS
90 msrset r11, MSR_VMS 82 .endm
91 nop 83
84 .macro clear_ums
85 msrclr r0, MSR_UMS
92 .endm 86 .endm
93 87
94 .macro clear_vms_ums 88 .macro clear_vms_ums
95 msrclr r11, MSR_VMS 89 msrclr r0, MSR_VMS | MSR_UMS
96 nop
97 msrclr r11, MSR_UMS
98 nop
99 .endm 90 .endm
100#else 91#else
101 .macro clear_bip 92 .macro clear_bip
102 mfs r11, rmsr 93 mfs r11, rmsr
103 nop
104 andi r11, r11, ~MSR_BIP 94 andi r11, r11, ~MSR_BIP
105 mts rmsr, r11 95 mts rmsr, r11
106 nop
107 .endm 96 .endm
108 97
109 .macro set_bip 98 .macro set_bip
110 mfs r11, rmsr 99 mfs r11, rmsr
111 nop
112 ori r11, r11, MSR_BIP 100 ori r11, r11, MSR_BIP
113 mts rmsr, r11 101 mts rmsr, r11
114 nop
115 .endm 102 .endm
116 103
117 .macro clear_eip 104 .macro clear_eip
118 mfs r11, rmsr 105 mfs r11, rmsr
119 nop
120 andi r11, r11, ~MSR_EIP 106 andi r11, r11, ~MSR_EIP
121 mts rmsr, r11 107 mts rmsr, r11
122 nop
123 .endm 108 .endm
124 109
125 .macro set_ee 110 .macro set_ee
126 mfs r11, rmsr 111 mfs r11, rmsr
127 nop
128 ori r11, r11, MSR_EE 112 ori r11, r11, MSR_EE
129 mts rmsr, r11 113 mts rmsr, r11
130 nop
131 .endm 114 .endm
132 115
133 .macro disable_irq 116 .macro disable_irq
134 mfs r11, rmsr 117 mfs r11, rmsr
135 nop
136 andi r11, r11, ~MSR_IE 118 andi r11, r11, ~MSR_IE
137 mts rmsr, r11 119 mts rmsr, r11
138 nop
139 .endm 120 .endm
140 121
141 .macro enable_irq 122 .macro enable_irq
142 mfs r11, rmsr 123 mfs r11, rmsr
143 nop
144 ori r11, r11, MSR_IE 124 ori r11, r11, MSR_IE
145 mts rmsr, r11 125 mts rmsr, r11
146 nop
147 .endm 126 .endm
148 127
149 .macro set_ums 128 .macro set_ums
150 mfs r11, rmsr 129 mfs r11, rmsr
151 nop
152 ori r11, r11, MSR_VMS 130 ori r11, r11, MSR_VMS
153 andni r11, r11, MSR_UMS 131 andni r11, r11, MSR_UMS
154 mts rmsr, r11 132 mts rmsr, r11
155 nop
156 .endm 133 .endm
157 134
158 .macro set_vms 135 .macro set_vms
159 mfs r11, rmsr 136 mfs r11, rmsr
160 nop
161 ori r11, r11, MSR_VMS 137 ori r11, r11, MSR_VMS
162 andni r11, r11, MSR_UMS 138 andni r11, r11, MSR_UMS
163 mts rmsr, r11 139 mts rmsr, r11
164 nop 140 .endm
141
142 .macro clear_ums
143 mfs r11, rmsr
144 andni r11, r11, MSR_UMS
145 mts rmsr,r11
165 .endm 146 .endm
166 147
167 .macro clear_vms_ums 148 .macro clear_vms_ums
168 mfs r11, rmsr 149 mfs r11, rmsr
169 nop
170 andni r11, r11, (MSR_VMS|MSR_UMS) 150 andni r11, r11, (MSR_VMS|MSR_UMS)
171 mts rmsr,r11 151 mts rmsr,r11
172 nop
173 .endm 152 .endm
174#endif 153#endif
175 154
@@ -180,18 +159,22 @@
180 159
181/* turn on virtual protected mode save */ 160/* turn on virtual protected mode save */
182#define VM_ON \ 161#define VM_ON \
183 set_ums; \ 162 set_ums; \
184 rted r0, 2f; \ 163 rted r0, 2f; \
1852: nop; 164 nop; \
1652:
186 166
187/* turn off virtual protected mode save and user mode save*/ 167/* turn off virtual protected mode save and user mode save*/
188#define VM_OFF \ 168#define VM_OFF \
189 clear_vms_ums; \ 169 clear_vms_ums; \
190 rted r0, TOPHYS(1f); \ 170 rted r0, TOPHYS(1f); \
1911: nop; 171 nop; \
1721:
192 173
193#define SAVE_REGS \ 174#define SAVE_REGS \
194 swi r2, r1, PTO+PT_R2; /* Save SDA */ \ 175 swi r2, r1, PTO+PT_R2; /* Save SDA */ \
176 swi r3, r1, PTO+PT_R3; \
177 swi r4, r1, PTO+PT_R4; \
195 swi r5, r1, PTO+PT_R5; \ 178 swi r5, r1, PTO+PT_R5; \
196 swi r6, r1, PTO+PT_R6; \ 179 swi r6, r1, PTO+PT_R6; \
197 swi r7, r1, PTO+PT_R7; \ 180 swi r7, r1, PTO+PT_R7; \
@@ -218,14 +201,14 @@
218 swi r30, r1, PTO+PT_R30; \ 201 swi r30, r1, PTO+PT_R30; \
219 swi r31, r1, PTO+PT_R31; /* Save current task reg */ \ 202 swi r31, r1, PTO+PT_R31; /* Save current task reg */ \
220 mfs r11, rmsr; /* save MSR */ \ 203 mfs r11, rmsr; /* save MSR */ \
221 nop; \
222 swi r11, r1, PTO+PT_MSR; 204 swi r11, r1, PTO+PT_MSR;
223 205
224#define RESTORE_REGS \ 206#define RESTORE_REGS \
225 lwi r11, r1, PTO+PT_MSR; \ 207 lwi r11, r1, PTO+PT_MSR; \
226 mts rmsr , r11; \ 208 mts rmsr , r11; \
227 nop; \
228 lwi r2, r1, PTO+PT_R2; /* restore SDA */ \ 209 lwi r2, r1, PTO+PT_R2; /* restore SDA */ \
210 lwi r3, r1, PTO+PT_R3; \
211 lwi r4, r1, PTO+PT_R4; \
229 lwi r5, r1, PTO+PT_R5; \ 212 lwi r5, r1, PTO+PT_R5; \
230 lwi r6, r1, PTO+PT_R6; \ 213 lwi r6, r1, PTO+PT_R6; \
231 lwi r7, r1, PTO+PT_R7; \ 214 lwi r7, r1, PTO+PT_R7; \
@@ -252,6 +235,39 @@
252 lwi r30, r1, PTO+PT_R30; \ 235 lwi r30, r1, PTO+PT_R30; \
253 lwi r31, r1, PTO+PT_R31; /* Restore cur task reg */ 236 lwi r31, r1, PTO+PT_R31; /* Restore cur task reg */
254 237
238#define SAVE_STATE \
239 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* save stack */ \
240 /* See if already in kernel mode.*/ \
241 mfs r1, rmsr; \
242 andi r1, r1, MSR_UMS; \
243 bnei r1, 1f; \
244 /* Kernel-mode state save. */ \
245 /* Reload kernel stack-ptr. */ \
246 lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); \
247 /* FIXME: I can add these two lines to one */ \
248 /* tophys(r1,r1); */ \
249 /* addik r1, r1, -STATE_SAVE_SIZE; */ \
250 addik r1, r1, CONFIG_KERNEL_BASE_ADDR - CONFIG_KERNEL_START - STATE_SAVE_SIZE; \
251 SAVE_REGS \
252 brid 2f; \
253 swi r1, r1, PTO+PT_MODE; \
2541: /* User-mode state save. */ \
255 lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */\
256 tophys(r1,r1); \
257 lwi r1, r1, TS_THREAD_INFO; /* get the thread info */ \
258 /* MS these three instructions can be added to one */ \
259 /* addik r1, r1, THREAD_SIZE; */ \
260 /* tophys(r1,r1); */ \
261 /* addik r1, r1, -STATE_SAVE_SIZE; */ \
262 addik r1, r1, THREAD_SIZE + CONFIG_KERNEL_BASE_ADDR - CONFIG_KERNEL_START - STATE_SAVE_SIZE; \
263 SAVE_REGS \
264 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); \
265 swi r11, r1, PTO+PT_R1; /* Store user SP. */ \
266 swi r0, r1, PTO + PT_MODE; /* Was in user-mode. */ \
267 /* MS: I am clearing UMS even in case when I come from kernel space */ \
268 clear_ums; \
2692: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE));
270
255.text 271.text
256 272
257/* 273/*
@@ -267,45 +283,23 @@
267 * are masked. This is nice, means we don't have to CLI before state save 283 * are masked. This is nice, means we don't have to CLI before state save
268 */ 284 */
269C_ENTRY(_user_exception): 285C_ENTRY(_user_exception):
270 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) /* save stack */
271 addi r14, r14, 4 /* return address is 4 byte after call */ 286 addi r14, r14, 4 /* return address is 4 byte after call */
272 swi r11, r0, TOPHYS(r0_ram + PTO + PT_R11); /* Save r11 */ 287 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) /* save stack */
273
274 lwi r11, r0, TOPHYS(PER_CPU(KM));/* See if already in kernel mode.*/
275 beqi r11, 1f; /* Jump ahead if coming from user */
276/* Kernel-mode state save. */
277 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* Reload kernel stack-ptr*/
278 tophys(r1,r11);
279 swi r11, r1, (PT_R1-PT_SIZE); /* Save original SP. */
280 lwi r11, r0, TOPHYS(r0_ram + PTO + PT_R11); /* restore r11 */
281
282 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */
283 SAVE_REGS
284
285 addi r11, r0, 1; /* Was in kernel-mode. */
286 swi r11, r1, PTO+PT_MODE; /* pt_regs -> kernel mode */
287 brid 2f;
288 nop; /* Fill delay slot */
289 288
290/* User-mode state save. */
2911:
292 lwi r11, r0, TOPHYS(r0_ram + PTO + PT_R11); /* restore r11 */
293 lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */ 289 lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */
294 tophys(r1,r1); 290 tophys(r1,r1);
295 lwi r1, r1, TS_THREAD_INFO; /* get stack from task_struct */ 291 lwi r1, r1, TS_THREAD_INFO; /* get stack from task_struct */
296/* calculate kernel stack pointer from task struct 8k */ 292 /* MS these three instructions can be added to one */
297 addik r1, r1, THREAD_SIZE; 293 /* addik r1, r1, THREAD_SIZE; */
298 tophys(r1,r1); 294 /* tophys(r1,r1); */
299 295 /* addik r1, r1, -STATE_SAVE_SIZE; */
300 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */ 296 addik r1, r1, THREAD_SIZE + CONFIG_KERNEL_BASE_ADDR - CONFIG_KERNEL_START - STATE_SAVE_SIZE;
301 SAVE_REGS 297 SAVE_REGS
302 298
303 swi r0, r1, PTO+PT_MODE; /* Was in user-mode. */
304 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); 299 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP));
305 swi r11, r1, PTO+PT_R1; /* Store user SP. */ 300 swi r11, r1, PTO+PT_R1; /* Store user SP. */
306 addi r11, r0, 1; 301 clear_ums;
307 swi r11, r0, TOPHYS(PER_CPU(KM)); /* Now we're in kernel-mode. */ 302 lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE));
3082: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE));
309 /* Save away the syscall number. */ 303 /* Save away the syscall number. */
310 swi r12, r1, PTO+PT_R0; 304 swi r12, r1, PTO+PT_R0;
311 tovirt(r1,r1) 305 tovirt(r1,r1)
@@ -316,10 +310,8 @@ C_ENTRY(_user_exception):
316 * register should point to the location where 310 * register should point to the location where
317 * the called function should return. [note that MAKE_SYS_CALL uses label 1] */ 311 * the called function should return. [note that MAKE_SYS_CALL uses label 1] */
318 312
319 # Step into virtual mode. 313 /* Step into virtual mode */
320 set_vms; 314 rtbd r0, 3f
321 addik r11, r0, 3f
322 rtid r11, 0
323 nop 315 nop
3243: 3163:
325 lwi r11, CURRENT_TASK, TS_THREAD_INFO /* get thread info */ 317 lwi r11, CURRENT_TASK, TS_THREAD_INFO /* get thread info */
@@ -363,24 +355,17 @@ C_ENTRY(_user_exception):
363 # Find and jump into the syscall handler. 355 # Find and jump into the syscall handler.
364 lwi r12, r12, sys_call_table 356 lwi r12, r12, sys_call_table
365 /* where the trap should return need -8 to adjust for rtsd r15, 8 */ 357 /* where the trap should return need -8 to adjust for rtsd r15, 8 */
366 la r15, r0, ret_from_trap-8 358 addi r15, r0, ret_from_trap-8
367 bra r12 359 bra r12
368 360
369 /* The syscall number is invalid, return an error. */ 361 /* The syscall number is invalid, return an error. */
3705: 3625:
363 rtsd r15, 8; /* looks like a normal subroutine return */
371 addi r3, r0, -ENOSYS; 364 addi r3, r0, -ENOSYS;
372 rtsd r15,8; /* looks like a normal subroutine return */
373 or r0, r0, r0
374
375 365
376/* Entry point used to return from a syscall/trap */ 366/* Entry point used to return from a syscall/trap */
377/* We re-enable BIP bit before state restore */ 367/* We re-enable BIP bit before state restore */
378C_ENTRY(ret_from_trap): 368C_ENTRY(ret_from_trap):
379 set_bip; /* Ints masked for state restore*/
380 lwi r11, r1, PTO+PT_MODE;
381/* See if returning to kernel mode, if so, skip resched &c. */
382 bnei r11, 2f;
383
384 swi r3, r1, PTO + PT_R3 369 swi r3, r1, PTO + PT_R3
385 swi r4, r1, PTO + PT_R4 370 swi r4, r1, PTO + PT_R4
386 371
@@ -413,32 +398,19 @@ C_ENTRY(ret_from_trap):
413 andi r11, r11, _TIF_SIGPENDING; 398 andi r11, r11, _TIF_SIGPENDING;
414 beqi r11, 1f; /* Signals to handle, handle them */ 399 beqi r11, 1f; /* Signals to handle, handle them */
415 400
416 la r5, r1, PTO; /* Arg 1: struct pt_regs *regs */ 401 addik r5, r1, PTO; /* Arg 1: struct pt_regs *regs */
417 addi r7, r0, 1; /* Arg 3: int in_syscall */ 402 addi r7, r0, 1; /* Arg 3: int in_syscall */
418 bralid r15, do_signal; /* Handle any signals */ 403 bralid r15, do_signal; /* Handle any signals */
419 add r6, r0, r0; /* Arg 2: sigset_t *oldset */ 404 add r6, r0, r0; /* Arg 2: sigset_t *oldset */
420 405
421/* Finally, return to user state. */ 406/* Finally, return to user state. */
4221: 4071: set_bip; /* Ints masked for state restore */
423 lwi r3, r1, PTO + PT_R3; /* restore syscall result */
424 lwi r4, r1, PTO + PT_R4;
425
426 swi r0, r0, PER_CPU(KM); /* Now officially in user state. */
427 swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE); /* save current */ 408 swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE); /* save current */
428 VM_OFF; 409 VM_OFF;
429 tophys(r1,r1); 410 tophys(r1,r1);
430 RESTORE_REGS; 411 RESTORE_REGS;
431 addik r1, r1, STATE_SAVE_SIZE /* Clean up stack space. */ 412 addik r1, r1, STATE_SAVE_SIZE /* Clean up stack space. */
432 lwi r1, r1, PT_R1 - PT_SIZE;/* Restore user stack pointer. */ 413 lwi r1, r1, PT_R1 - PT_SIZE;/* Restore user stack pointer. */
433 bri 6f;
434
435/* Return to kernel state. */
4362: VM_OFF;
437 tophys(r1,r1);
438 RESTORE_REGS;
439 addik r1, r1, STATE_SAVE_SIZE /* Clean up stack space. */
440 tovirt(r1,r1);
4416:
442TRAP_return: /* Make global symbol for debugging */ 414TRAP_return: /* Make global symbol for debugging */
443 rtbd r14, 0; /* Instructions to return from an IRQ */ 415 rtbd r14, 0; /* Instructions to return from an IRQ */
444 nop; 416 nop;
@@ -450,12 +422,11 @@ TRAP_return: /* Make global symbol for debugging */
450C_ENTRY(sys_fork_wrapper): 422C_ENTRY(sys_fork_wrapper):
451 addi r5, r0, SIGCHLD /* Arg 0: flags */ 423 addi r5, r0, SIGCHLD /* Arg 0: flags */
452 lwi r6, r1, PTO+PT_R1 /* Arg 1: child SP (use parent's) */ 424 lwi r6, r1, PTO+PT_R1 /* Arg 1: child SP (use parent's) */
453 la r7, r1, PTO /* Arg 2: parent context */ 425 addik r7, r1, PTO /* Arg 2: parent context */
454 add r8. r0, r0 /* Arg 3: (unused) */ 426 add r8. r0, r0 /* Arg 3: (unused) */
455 add r9, r0, r0; /* Arg 4: (unused) */ 427 add r9, r0, r0; /* Arg 4: (unused) */
456 add r10, r0, r0; /* Arg 5: (unused) */
457 brid do_fork /* Do real work (tail-call) */ 428 brid do_fork /* Do real work (tail-call) */
458 nop; 429 add r10, r0, r0; /* Arg 5: (unused) */
459 430
460/* This the initial entry point for a new child thread, with an appropriate 431/* This the initial entry point for a new child thread, with an appropriate
461 stack in place that makes it look the the child is in the middle of an 432 stack in place that makes it look the the child is in the middle of an
@@ -466,35 +437,31 @@ C_ENTRY(ret_from_fork):
466 bralid r15, schedule_tail; /* ...which is schedule_tail's arg */ 437 bralid r15, schedule_tail; /* ...which is schedule_tail's arg */
467 add r3, r5, r0; /* switch_thread returns the prev task */ 438 add r3, r5, r0; /* switch_thread returns the prev task */
468 /* ( in the delay slot ) */ 439 /* ( in the delay slot ) */
469 add r3, r0, r0; /* Child's fork call should return 0. */
470 brid ret_from_trap; /* Do normal trap return */ 440 brid ret_from_trap; /* Do normal trap return */
471 nop; 441 add r3, r0, r0; /* Child's fork call should return 0. */
472 442
473C_ENTRY(sys_vfork): 443C_ENTRY(sys_vfork):
474 brid microblaze_vfork /* Do real work (tail-call) */ 444 brid microblaze_vfork /* Do real work (tail-call) */
475 la r5, r1, PTO 445 addik r5, r1, PTO
476 446
477C_ENTRY(sys_clone): 447C_ENTRY(sys_clone):
478 bnei r6, 1f; /* See if child SP arg (arg 1) is 0. */ 448 bnei r6, 1f; /* See if child SP arg (arg 1) is 0. */
479 lwi r6, r1, PTO+PT_R1; /* If so, use paret's stack ptr */ 449 lwi r6, r1, PTO + PT_R1; /* If so, use paret's stack ptr */
4801: la r7, r1, PTO; /* Arg 2: parent context */ 4501: addik r7, r1, PTO; /* Arg 2: parent context */
481 add r8, r0, r0; /* Arg 3: (unused) */ 451 add r8, r0, r0; /* Arg 3: (unused) */
482 add r9, r0, r0; /* Arg 4: (unused) */ 452 add r9, r0, r0; /* Arg 4: (unused) */
483 add r10, r0, r0; /* Arg 5: (unused) */
484 brid do_fork /* Do real work (tail-call) */ 453 brid do_fork /* Do real work (tail-call) */
485 nop; 454 add r10, r0, r0; /* Arg 5: (unused) */
486 455
487C_ENTRY(sys_execve): 456C_ENTRY(sys_execve):
488 la r8, r1, PTO; /* add user context as 4th arg */
489 brid microblaze_execve; /* Do real work (tail-call).*/ 457 brid microblaze_execve; /* Do real work (tail-call).*/
490 nop; 458 addik r8, r1, PTO; /* add user context as 4th arg */
491 459
492C_ENTRY(sys_rt_sigreturn_wrapper): 460C_ENTRY(sys_rt_sigreturn_wrapper):
493 swi r3, r1, PTO+PT_R3; /* restore saved r3, r4 registers */ 461 swi r3, r1, PTO+PT_R3; /* restore saved r3, r4 registers */
494 swi r4, r1, PTO+PT_R4; 462 swi r4, r1, PTO+PT_R4;
495 la r5, r1, PTO; /* add user context as 1st arg */
496 brlid r15, sys_rt_sigreturn /* Do real work */ 463 brlid r15, sys_rt_sigreturn /* Do real work */
497 nop; 464 addik r5, r1, PTO; /* add user context as 1st arg */
498 lwi r3, r1, PTO+PT_R3; /* restore saved r3, r4 registers */ 465 lwi r3, r1, PTO+PT_R3; /* restore saved r3, r4 registers */
499 lwi r4, r1, PTO+PT_R4; 466 lwi r4, r1, PTO+PT_R4;
500 bri ret_from_trap /* fall through will not work here due to align */ 467 bri ret_from_trap /* fall through will not work here due to align */
@@ -503,83 +470,23 @@ C_ENTRY(sys_rt_sigreturn_wrapper):
503/* 470/*
504 * HW EXCEPTION rutine start 471 * HW EXCEPTION rutine start
505 */ 472 */
506
507#define SAVE_STATE \
508 swi r11, r0, TOPHYS(r0_ram + PTO + PT_R11); /* Save r11 */ \
509 set_bip; /*equalize initial state for all possible entries*/\
510 clear_eip; \
511 enable_irq; \
512 set_ee; \
513 /* See if already in kernel mode.*/ \
514 lwi r11, r0, TOPHYS(PER_CPU(KM)); \
515 beqi r11, 1f; /* Jump ahead if coming from user */\
516 /* Kernel-mode state save. */ \
517 /* Reload kernel stack-ptr. */ \
518 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); \
519 tophys(r1,r11); \
520 swi r11, r1, (PT_R1-PT_SIZE); /* Save original SP. */ \
521 lwi r11, r0, TOPHYS(r0_ram + PTO + PT_R11); /* restore r11 */\
522 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */\
523 /* store return registers separately because \
524 * this macros is use for others exceptions */ \
525 swi r3, r1, PTO + PT_R3; \
526 swi r4, r1, PTO + PT_R4; \
527 SAVE_REGS \
528 /* PC, before IRQ/trap - this is one instruction above */ \
529 swi r17, r1, PTO+PT_PC; \
530 \
531 addi r11, r0, 1; /* Was in kernel-mode. */ \
532 swi r11, r1, PTO+PT_MODE; \
533 brid 2f; \
534 nop; /* Fill delay slot */ \
5351: /* User-mode state save. */ \
536 lwi r11, r0, TOPHYS(r0_ram + PTO + PT_R11); /* restore r11 */\
537 lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */\
538 tophys(r1,r1); \
539 lwi r1, r1, TS_THREAD_INFO; /* get the thread info */ \
540 addik r1, r1, THREAD_SIZE; /* calculate kernel stack pointer */\
541 tophys(r1,r1); \
542 \
543 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */\
544 /* store return registers separately because this macros \
545 * is use for others exceptions */ \
546 swi r3, r1, PTO + PT_R3; \
547 swi r4, r1, PTO + PT_R4; \
548 SAVE_REGS \
549 /* PC, before IRQ/trap - this is one instruction above FIXME*/ \
550 swi r17, r1, PTO+PT_PC; \
551 \
552 swi r0, r1, PTO+PT_MODE; /* Was in user-mode. */ \
553 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); \
554 swi r11, r1, PTO+PT_R1; /* Store user SP. */ \
555 addi r11, r0, 1; \
556 swi r11, r0, TOPHYS(PER_CPU(KM)); /* Now we're in kernel-mode.*/\
5572: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); \
558 /* Save away the syscall number. */ \
559 swi r0, r1, PTO+PT_R0; \
560 tovirt(r1,r1)
561
562C_ENTRY(full_exception_trap): 473C_ENTRY(full_exception_trap):
563 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) /* save stack */
564 /* adjust exception address for privileged instruction 474 /* adjust exception address for privileged instruction
565 * for finding where is it */ 475 * for finding where is it */
566 addik r17, r17, -4 476 addik r17, r17, -4
567 SAVE_STATE /* Save registers */ 477 SAVE_STATE /* Save registers */
478 /* PC, before IRQ/trap - this is one instruction above */
479 swi r17, r1, PTO+PT_PC;
480 tovirt(r1,r1)
568 /* FIXME this can be store directly in PT_ESR reg. 481 /* FIXME this can be store directly in PT_ESR reg.
569 * I tested it but there is a fault */ 482 * I tested it but there is a fault */
570 /* where the trap should return need -8 to adjust for rtsd r15, 8 */ 483 /* where the trap should return need -8 to adjust for rtsd r15, 8 */
571 la r15, r0, ret_from_exc - 8 484 addik r15, r0, ret_from_exc - 8
572 la r5, r1, PTO /* parameter struct pt_regs * regs */
573 mfs r6, resr 485 mfs r6, resr
574 nop
575 mfs r7, rfsr; /* save FSR */ 486 mfs r7, rfsr; /* save FSR */
576 nop
577 mts rfsr, r0; /* Clear sticky fsr */ 487 mts rfsr, r0; /* Clear sticky fsr */
578 nop 488 rted r0, full_exception
579 la r12, r0, full_exception 489 addik r5, r1, PTO /* parameter struct pt_regs * regs */
580 set_vms;
581 rtbd r12, 0;
582 nop;
583 490
584/* 491/*
585 * Unaligned data trap. 492 * Unaligned data trap.
@@ -592,19 +499,27 @@ C_ENTRY(full_exception_trap):
592 * The assembler routine is in "arch/microblaze/kernel/hw_exception_handler.S" 499 * The assembler routine is in "arch/microblaze/kernel/hw_exception_handler.S"
593 */ 500 */
594C_ENTRY(unaligned_data_trap): 501C_ENTRY(unaligned_data_trap):
595 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) /* save stack */ 502 /* MS: I have to save r11 value and then restore it because
503 * set_bit, clear_eip, set_ee use r11 as temp register if MSR
504 * instructions are not used. We don't need to do if MSR instructions
505 * are used and they use r0 instead of r11.
506 * I am using ENTRY_SP which should be primary used only for stack
507 * pointer saving. */
508 swi r11, r0, TOPHYS(PER_CPU(ENTRY_SP));
509 set_bip; /* equalize initial state for all possible entries */
510 clear_eip;
511 set_ee;
512 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP));
596 SAVE_STATE /* Save registers.*/ 513 SAVE_STATE /* Save registers.*/
514 /* PC, before IRQ/trap - this is one instruction above */
515 swi r17, r1, PTO+PT_PC;
516 tovirt(r1,r1)
597 /* where the trap should return need -8 to adjust for rtsd r15, 8 */ 517 /* where the trap should return need -8 to adjust for rtsd r15, 8 */
598 la r15, r0, ret_from_exc-8 518 addik r15, r0, ret_from_exc-8
599 mfs r3, resr /* ESR */ 519 mfs r3, resr /* ESR */
600 nop
601 mfs r4, rear /* EAR */ 520 mfs r4, rear /* EAR */
602 nop 521 rtbd r0, _unaligned_data_exception
603 la r7, r1, PTO /* parameter struct pt_regs * regs */ 522 addik r7, r1, PTO /* parameter struct pt_regs * regs */
604 la r12, r0, _unaligned_data_exception
605 set_vms;
606 rtbd r12, 0; /* interrupts enabled */
607 nop;
608 523
609/* 524/*
610 * Page fault traps. 525 * Page fault traps.
@@ -625,38 +540,32 @@ C_ENTRY(unaligned_data_trap):
625 */ 540 */
626/* data and intruction trap - which is choose is resolved int fault.c */ 541/* data and intruction trap - which is choose is resolved int fault.c */
627C_ENTRY(page_fault_data_trap): 542C_ENTRY(page_fault_data_trap):
628 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) /* save stack */
629 SAVE_STATE /* Save registers.*/ 543 SAVE_STATE /* Save registers.*/
544 /* PC, before IRQ/trap - this is one instruction above */
545 swi r17, r1, PTO+PT_PC;
546 tovirt(r1,r1)
630 /* where the trap should return need -8 to adjust for rtsd r15, 8 */ 547 /* where the trap should return need -8 to adjust for rtsd r15, 8 */
631 la r15, r0, ret_from_exc-8 548 addik r15, r0, ret_from_exc-8
632 la r5, r1, PTO /* parameter struct pt_regs * regs */
633 mfs r6, rear /* parameter unsigned long address */ 549 mfs r6, rear /* parameter unsigned long address */
634 nop
635 mfs r7, resr /* parameter unsigned long error_code */ 550 mfs r7, resr /* parameter unsigned long error_code */
636 nop 551 rted r0, do_page_fault
637 la r12, r0, do_page_fault 552 addik r5, r1, PTO /* parameter struct pt_regs * regs */
638 set_vms;
639 rtbd r12, 0; /* interrupts enabled */
640 nop;
641 553
642C_ENTRY(page_fault_instr_trap): 554C_ENTRY(page_fault_instr_trap):
643 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) /* save stack */
644 SAVE_STATE /* Save registers.*/ 555 SAVE_STATE /* Save registers.*/
556 /* PC, before IRQ/trap - this is one instruction above */
557 swi r17, r1, PTO+PT_PC;
558 tovirt(r1,r1)
645 /* where the trap should return need -8 to adjust for rtsd r15, 8 */ 559 /* where the trap should return need -8 to adjust for rtsd r15, 8 */
646 la r15, r0, ret_from_exc-8 560 addik r15, r0, ret_from_exc-8
647 la r5, r1, PTO /* parameter struct pt_regs * regs */
648 mfs r6, rear /* parameter unsigned long address */ 561 mfs r6, rear /* parameter unsigned long address */
649 nop
650 ori r7, r0, 0 /* parameter unsigned long error_code */ 562 ori r7, r0, 0 /* parameter unsigned long error_code */
651 la r12, r0, do_page_fault 563 rted r0, do_page_fault
652 set_vms; 564 addik r5, r1, PTO /* parameter struct pt_regs * regs */
653 rtbd r12, 0; /* interrupts enabled */
654 nop;
655 565
656/* Entry point used to return from an exception. */ 566/* Entry point used to return from an exception. */
657C_ENTRY(ret_from_exc): 567C_ENTRY(ret_from_exc):
658 set_bip; /* Ints masked for state restore*/ 568 lwi r11, r1, PTO + PT_MODE;
659 lwi r11, r1, PTO+PT_MODE;
660 bnei r11, 2f; /* See if returning to kernel mode, */ 569 bnei r11, 2f; /* See if returning to kernel mode, */
661 /* ... if so, skip resched &c. */ 570 /* ... if so, skip resched &c. */
662 571
@@ -687,32 +596,27 @@ C_ENTRY(ret_from_exc):
687 * traps), but signal handlers may want to examine or change the 596 * traps), but signal handlers may want to examine or change the
688 * complete register state. Here we save anything not saved by 597 * complete register state. Here we save anything not saved by
689 * the normal entry sequence, so that it may be safely restored 598 * the normal entry sequence, so that it may be safely restored
690 * (in a possibly modified form) after do_signal returns. 599 * (in a possibly modified form) after do_signal returns. */
691 * store return registers separately because this macros is use 600 addik r5, r1, PTO; /* Arg 1: struct pt_regs *regs */
692 * for others exceptions */
693 la r5, r1, PTO; /* Arg 1: struct pt_regs *regs */
694 addi r7, r0, 0; /* Arg 3: int in_syscall */ 601 addi r7, r0, 0; /* Arg 3: int in_syscall */
695 bralid r15, do_signal; /* Handle any signals */ 602 bralid r15, do_signal; /* Handle any signals */
696 add r6, r0, r0; /* Arg 2: sigset_t *oldset */ 603 add r6, r0, r0; /* Arg 2: sigset_t *oldset */
697 604
698/* Finally, return to user state. */ 605/* Finally, return to user state. */
6991: swi r0, r0, PER_CPU(KM); /* Now officially in user state. */ 6061: set_bip; /* Ints masked for state restore */
700 swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE); /* save current */ 607 swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE); /* save current */
701 VM_OFF; 608 VM_OFF;
702 tophys(r1,r1); 609 tophys(r1,r1);
703 610
704 lwi r3, r1, PTO+PT_R3; /* restore saved r3, r4 registers */
705 lwi r4, r1, PTO+PT_R4;
706 RESTORE_REGS; 611 RESTORE_REGS;
707 addik r1, r1, STATE_SAVE_SIZE /* Clean up stack space. */ 612 addik r1, r1, STATE_SAVE_SIZE /* Clean up stack space. */
708 613
709 lwi r1, r1, PT_R1 - PT_SIZE; /* Restore user stack pointer. */ 614 lwi r1, r1, PT_R1 - PT_SIZE; /* Restore user stack pointer. */
710 bri 6f; 615 bri 6f;
711/* Return to kernel state. */ 616/* Return to kernel state. */
7122: VM_OFF; 6172: set_bip; /* Ints masked for state restore */
618 VM_OFF;
713 tophys(r1,r1); 619 tophys(r1,r1);
714 lwi r3, r1, PTO+PT_R3; /* restore saved r3, r4 registers */
715 lwi r4, r1, PTO+PT_R4;
716 RESTORE_REGS; 620 RESTORE_REGS;
717 addik r1, r1, STATE_SAVE_SIZE /* Clean up stack space. */ 621 addik r1, r1, STATE_SAVE_SIZE /* Clean up stack space. */
718 622
@@ -736,36 +640,23 @@ C_ENTRY(_interrupt):
736/* MS: we are in physical address */ 640/* MS: we are in physical address */
737/* Save registers, switch to proper stack, convert SP to virtual.*/ 641/* Save registers, switch to proper stack, convert SP to virtual.*/
738 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) 642 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP))
739 swi r11, r0, TOPHYS(PER_CPU(R11_SAVE));
740 /* MS: See if already in kernel mode. */ 643 /* MS: See if already in kernel mode. */
741 lwi r11, r0, TOPHYS(PER_CPU(KM)); 644 mfs r1, rmsr
742 beqi r11, 1f; /* MS: Jump ahead if coming from user */ 645 nop
646 andi r1, r1, MSR_UMS
647 bnei r1, 1f
743 648
744/* Kernel-mode state save. */ 649/* Kernel-mode state save. */
745 or r11, r1, r0 650 lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP))
746 tophys(r1,r11); /* MS: I have in r1 physical address where stack is */ 651 tophys(r1,r1); /* MS: I have in r1 physical address where stack is */
747/* MS: Save original SP - position PT_R1 to next stack frame 4 *1 - 152*/
748 swi r11, r1, (PT_R1 - PT_SIZE);
749/* MS: restore r11 because of saving in SAVE_REGS */
750 lwi r11, r0, TOPHYS(PER_CPU(R11_SAVE));
751 /* save registers */ 652 /* save registers */
752/* MS: Make room on the stack -> activation record */ 653/* MS: Make room on the stack -> activation record */
753 addik r1, r1, -STATE_SAVE_SIZE; 654 addik r1, r1, -STATE_SAVE_SIZE;
754/* MS: store return registers separately because
755 * this macros is use for others exceptions */
756 swi r3, r1, PTO + PT_R3;
757 swi r4, r1, PTO + PT_R4;
758 SAVE_REGS 655 SAVE_REGS
759 /* MS: store mode */
760 addi r11, r0, 1; /* MS: Was in kernel-mode. */
761 swi r11, r1, PTO + PT_MODE; /* MS: and save it */
762 brid 2f; 656 brid 2f;
763 nop; /* MS: Fill delay slot */ 657 swi r1, r1, PTO + PT_MODE; /* 0 - user mode, 1 - kernel mode */
764
7651: 6581:
766/* User-mode state save. */ 659/* User-mode state save. */
767/* MS: restore r11 -> FIXME move before SAVE_REG */
768 lwi r11, r0, TOPHYS(PER_CPU(R11_SAVE));
769 /* MS: get the saved current */ 660 /* MS: get the saved current */
770 lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); 661 lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE));
771 tophys(r1,r1); 662 tophys(r1,r1);
@@ -774,27 +665,18 @@ C_ENTRY(_interrupt):
774 tophys(r1,r1); 665 tophys(r1,r1);
775 /* save registers */ 666 /* save registers */
776 addik r1, r1, -STATE_SAVE_SIZE; 667 addik r1, r1, -STATE_SAVE_SIZE;
777 swi r3, r1, PTO+PT_R3;
778 swi r4, r1, PTO+PT_R4;
779 SAVE_REGS 668 SAVE_REGS
780 /* calculate mode */ 669 /* calculate mode */
781 swi r0, r1, PTO + PT_MODE; 670 swi r0, r1, PTO + PT_MODE;
782 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); 671 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP));
783 swi r11, r1, PTO+PT_R1; 672 swi r11, r1, PTO+PT_R1;
784 /* setup kernel mode to KM */ 673 clear_ums;
785 addi r11, r0, 1;
786 swi r11, r0, TOPHYS(PER_CPU(KM));
787
7882: 6742:
789 lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); 675 lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE));
790 swi r0, r1, PTO + PT_R0;
791 tovirt(r1,r1) 676 tovirt(r1,r1)
792 la r5, r1, PTO; 677 addik r15, r0, irq_call;
793 set_vms; 678irq_call:rtbd r0, do_IRQ;
794 la r11, r0, do_IRQ; 679 addik r5, r1, PTO;
795 la r15, r0, irq_call;
796irq_call:rtbd r11, 0;
797 nop;
798 680
799/* MS: we are in virtual mode */ 681/* MS: we are in virtual mode */
800ret_from_irq: 682ret_from_irq:
@@ -815,7 +697,7 @@ ret_from_irq:
815 beqid r11, no_intr_resched 697 beqid r11, no_intr_resched
816/* Handle a signal return; Pending signals should be in r18. */ 698/* Handle a signal return; Pending signals should be in r18. */
817 addi r7, r0, 0; /* Arg 3: int in_syscall */ 699 addi r7, r0, 0; /* Arg 3: int in_syscall */
818 la r5, r1, PTO; /* Arg 1: struct pt_regs *regs */ 700 addik r5, r1, PTO; /* Arg 1: struct pt_regs *regs */
819 bralid r15, do_signal; /* Handle any signals */ 701 bralid r15, do_signal; /* Handle any signals */
820 add r6, r0, r0; /* Arg 2: sigset_t *oldset */ 702 add r6, r0, r0; /* Arg 2: sigset_t *oldset */
821 703
@@ -823,12 +705,9 @@ ret_from_irq:
823no_intr_resched: 705no_intr_resched:
824 /* Disable interrupts, we are now committed to the state restore */ 706 /* Disable interrupts, we are now committed to the state restore */
825 disable_irq 707 disable_irq
826 swi r0, r0, PER_CPU(KM); /* MS: Now officially in user state. */
827 swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE); 708 swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE);
828 VM_OFF; 709 VM_OFF;
829 tophys(r1,r1); 710 tophys(r1,r1);
830 lwi r3, r1, PTO + PT_R3; /* MS: restore saved r3, r4 registers */
831 lwi r4, r1, PTO + PT_R4;
832 RESTORE_REGS 711 RESTORE_REGS
833 addik r1, r1, STATE_SAVE_SIZE /* MS: Clean up stack space. */ 712 addik r1, r1, STATE_SAVE_SIZE /* MS: Clean up stack space. */
834 lwi r1, r1, PT_R1 - PT_SIZE; 713 lwi r1, r1, PT_R1 - PT_SIZE;
@@ -857,8 +736,6 @@ restore:
857#endif 736#endif
858 VM_OFF /* MS: turn off MMU */ 737 VM_OFF /* MS: turn off MMU */
859 tophys(r1,r1) 738 tophys(r1,r1)
860 lwi r3, r1, PTO + PT_R3; /* MS: restore saved r3, r4 registers */
861 lwi r4, r1, PTO + PT_R4;
862 RESTORE_REGS 739 RESTORE_REGS
863 addik r1, r1, STATE_SAVE_SIZE /* MS: Clean up stack space. */ 740 addik r1, r1, STATE_SAVE_SIZE /* MS: Clean up stack space. */
864 tovirt(r1,r1); 741 tovirt(r1,r1);
@@ -868,86 +745,91 @@ IRQ_return: /* MS: Make global symbol for debugging */
868 nop 745 nop
869 746
870/* 747/*
871 * `Debug' trap 748 * Debug trap for KGDB. Enter to _debug_exception by brki r16, 0x18
872 * We enter dbtrap in "BIP" (breakpoint) mode. 749 * and call handling function with saved pt_regs
873 * So we exit the breakpoint mode with an 'rtbd' and proceed with the
874 * original dbtrap.
875 * however, wait to save state first
876 */ 750 */
877C_ENTRY(_debug_exception): 751C_ENTRY(_debug_exception):
878 /* BIP bit is set on entry, no interrupts can occur */ 752 /* BIP bit is set on entry, no interrupts can occur */
879 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)) 753 swi r1, r0, TOPHYS(PER_CPU(ENTRY_SP))
880 754
881 swi r11, r0, TOPHYS(r0_ram + PTO + PT_R11); /* Save r11 */ 755 mfs r1, rmsr
882 set_bip; /*equalize initial state for all possible entries*/ 756 nop
883 clear_eip; 757 andi r1, r1, MSR_UMS
884 enable_irq; 758 bnei r1, 1f
885 lwi r11, r0, TOPHYS(PER_CPU(KM));/* See if already in kernel mode.*/ 759/* MS: Kernel-mode state save - kgdb */
886 beqi r11, 1f; /* Jump ahead if coming from user */ 760 lwi r1, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* Reload kernel stack-ptr*/
887 /* Kernel-mode state save. */
888 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); /* Reload kernel stack-ptr*/
889 tophys(r1,r11);
890 swi r11, r1, (PT_R1-PT_SIZE); /* Save original SP. */
891 lwi r11, r0, TOPHYS(r0_ram + PTO + PT_R11); /* restore r11 */
892 761
893 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */ 762 /* BIP bit is set on entry, no interrupts can occur */
894 swi r3, r1, PTO + PT_R3; 763 addik r1, r1, CONFIG_KERNEL_BASE_ADDR - CONFIG_KERNEL_START - STATE_SAVE_SIZE;
895 swi r4, r1, PTO + PT_R4;
896 SAVE_REGS; 764 SAVE_REGS;
765 /* save all regs to pt_reg structure */
766 swi r0, r1, PTO+PT_R0; /* R0 must be saved too */
767 swi r14, r1, PTO+PT_R14 /* rewrite saved R14 value */
768 swi r16, r1, PTO+PT_R16
769 swi r16, r1, PTO+PT_PC; /* PC and r16 are the same */
770 swi r17, r1, PTO+PT_R17
771 /* save special purpose registers to pt_regs */
772 mfs r11, rear;
773 swi r11, r1, PTO+PT_EAR;
774 mfs r11, resr;
775 swi r11, r1, PTO+PT_ESR;
776 mfs r11, rfsr;
777 swi r11, r1, PTO+PT_FSR;
778
779 /* stack pointer is in physical address at it is decrease
780 * by STATE_SAVE_SIZE but we need to get correct R1 value */
781 addik r11, r1, CONFIG_KERNEL_START - CONFIG_KERNEL_BASE_ADDR + STATE_SAVE_SIZE;
782 swi r11, r1, PTO+PT_R1
783 /* MS: r31 - current pointer isn't changed */
784 tovirt(r1,r1)
785#ifdef CONFIG_KGDB
786 addi r5, r1, PTO /* pass pt_reg address as the first arg */
787 la r15, r0, dbtrap_call; /* return address */
788 rtbd r0, microblaze_kgdb_break
789 nop;
790#endif
791 /* MS: Place handler for brki from kernel space if KGDB is OFF.
792 * It is very unlikely that another brki instruction is called. */
793 bri 0
897 794
898 addi r11, r0, 1; /* Was in kernel-mode. */ 795/* MS: User-mode state save - gdb */
899 swi r11, r1, PTO + PT_MODE; 7961: lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */
900 brid 2f;
901 nop; /* Fill delay slot */
9021: /* User-mode state save. */
903 lwi r11, r0, TOPHYS(r0_ram + PTO + PT_R11); /* restore r11 */
904 lwi r1, r0, TOPHYS(PER_CPU(CURRENT_SAVE)); /* get saved current */
905 tophys(r1,r1); 797 tophys(r1,r1);
906 lwi r1, r1, TS_THREAD_INFO; /* get the thread info */ 798 lwi r1, r1, TS_THREAD_INFO; /* get the thread info */
907 addik r1, r1, THREAD_SIZE; /* calculate kernel stack pointer */ 799 addik r1, r1, THREAD_SIZE; /* calculate kernel stack pointer */
908 tophys(r1,r1); 800 tophys(r1,r1);
909 801
910 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */ 802 addik r1, r1, -STATE_SAVE_SIZE; /* Make room on the stack. */
911 swi r3, r1, PTO + PT_R3;
912 swi r4, r1, PTO + PT_R4;
913 SAVE_REGS; 803 SAVE_REGS;
914 804 swi r17, r1, PTO+PT_R17;
915 swi r0, r1, PTO+PT_MODE; /* Was in user-mode. */ 805 swi r16, r1, PTO+PT_R16;
806 swi r16, r1, PTO+PT_PC; /* Save LP */
807 swi r0, r1, PTO + PT_MODE; /* Was in user-mode. */
916 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP)); 808 lwi r11, r0, TOPHYS(PER_CPU(ENTRY_SP));
917 swi r11, r1, PTO+PT_R1; /* Store user SP. */ 809 swi r11, r1, PTO+PT_R1; /* Store user SP. */
918 addi r11, r0, 1; 810 lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE));
919 swi r11, r0, TOPHYS(PER_CPU(KM)); /* Now we're in kernel-mode. */
9202: lwi CURRENT_TASK, r0, TOPHYS(PER_CPU(CURRENT_SAVE));
921 /* Save away the syscall number. */
922 swi r0, r1, PTO+PT_R0;
923 tovirt(r1,r1) 811 tovirt(r1,r1)
924
925 addi r5, r0, SIGTRAP /* send the trap signal */
926 add r6, r0, CURRENT_TASK; /* Get current task ptr into r11 */
927 addk r7, r0, r0 /* 3rd param zero */
928
929 set_vms; 812 set_vms;
930 la r11, r0, send_sig; 813 addik r5, r1, PTO;
931 la r15, r0, dbtrap_call; 814 addik r15, r0, dbtrap_call;
932dbtrap_call: rtbd r11, 0; 815dbtrap_call: /* Return point for kernel/user entry + 8 because of rtsd r15, 8 */
933 nop; 816 rtbd r0, sw_exception
817 nop
934 818
935 set_bip; /* Ints masked for state restore*/ 819 /* MS: The first instruction for the second part of the gdb/kgdb */
936 lwi r11, r1, PTO+PT_MODE; 820 set_bip; /* Ints masked for state restore */
821 lwi r11, r1, PTO + PT_MODE;
937 bnei r11, 2f; 822 bnei r11, 2f;
938 823/* MS: Return to user space - gdb */
939 /* Get current task ptr into r11 */ 824 /* Get current task ptr into r11 */
940 lwi r11, CURRENT_TASK, TS_THREAD_INFO; /* get thread info */ 825 lwi r11, CURRENT_TASK, TS_THREAD_INFO; /* get thread info */
941 lwi r11, r11, TI_FLAGS; /* get flags in thread info */ 826 lwi r11, r11, TI_FLAGS; /* get flags in thread info */
942 andi r11, r11, _TIF_NEED_RESCHED; 827 andi r11, r11, _TIF_NEED_RESCHED;
943 beqi r11, 5f; 828 beqi r11, 5f;
944 829
945/* Call the scheduler before returning from a syscall/trap. */ 830 /* Call the scheduler before returning from a syscall/trap. */
946
947 bralid r15, schedule; /* Call scheduler */ 831 bralid r15, schedule; /* Call scheduler */
948 nop; /* delay slot */ 832 nop; /* delay slot */
949 /* XXX Is PT_DTRACE handling needed here? */
950 /* XXX m68knommu also checks TASK_STATE & TASK_COUNTER here. */
951 833
952 /* Maybe handle a signal */ 834 /* Maybe handle a signal */
9535: lwi r11, CURRENT_TASK, TS_THREAD_INFO; /* get thread info */ 8355: lwi r11, CURRENT_TASK, TS_THREAD_INFO; /* get thread info */
@@ -955,54 +837,40 @@ dbtrap_call: rtbd r11, 0;
955 andi r11, r11, _TIF_SIGPENDING; 837 andi r11, r11, _TIF_SIGPENDING;
956 beqi r11, 1f; /* Signals to handle, handle them */ 838 beqi r11, 1f; /* Signals to handle, handle them */
957 839
958/* Handle a signal return; Pending signals should be in r18. */ 840 addik r5, r1, PTO; /* Arg 1: struct pt_regs *regs */
959 /* Not all registers are saved by the normal trap/interrupt entry
960 points (for instance, call-saved registers (because the normal
961 C-compiler calling sequence in the kernel makes sure they're
962 preserved), and call-clobbered registers in the case of
963 traps), but signal handlers may want to examine or change the
964 complete register state. Here we save anything not saved by
965 the normal entry sequence, so that it may be safely restored
966 (in a possibly modified form) after do_signal returns. */
967
968 la r5, r1, PTO; /* Arg 1: struct pt_regs *regs */
969 addi r7, r0, 0; /* Arg 3: int in_syscall */ 841 addi r7, r0, 0; /* Arg 3: int in_syscall */
970 bralid r15, do_signal; /* Handle any signals */ 842 bralid r15, do_signal; /* Handle any signals */
971 add r6, r0, r0; /* Arg 2: sigset_t *oldset */ 843 add r6, r0, r0; /* Arg 2: sigset_t *oldset */
972 844
973
974/* Finally, return to user state. */ 845/* Finally, return to user state. */
9751: swi r0, r0, PER_CPU(KM); /* Now officially in user state. */ 8461: swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE); /* save current */
976 swi CURRENT_TASK, r0, PER_CPU(CURRENT_SAVE); /* save current */
977 VM_OFF; 847 VM_OFF;
978 tophys(r1,r1); 848 tophys(r1,r1);
979 849 /* MS: Restore all regs */
980 lwi r3, r1, PTO+PT_R3; /* restore saved r3, r4 registers */
981 lwi r4, r1, PTO+PT_R4;
982 RESTORE_REGS 850 RESTORE_REGS
983 addik r1, r1, STATE_SAVE_SIZE /* Clean up stack space. */ 851 lwi r17, r1, PTO+PT_R17;
984 852 lwi r16, r1, PTO+PT_R16;
985 853 addik r1, r1, STATE_SAVE_SIZE /* Clean up stack space */
986 lwi r1, r1, PT_R1 - PT_SIZE; 854 lwi r1, r1, PT_R1 - PT_SIZE; /* Restore user stack pointer */
987 /* Restore user stack pointer. */ 855DBTRAP_return_user: /* MS: Make global symbol for debugging */
988 bri 6f; 856 rtbd r16, 0; /* MS: Instructions to return from a debug trap */
857 nop;
989 858
990/* Return to kernel state. */ 859/* MS: Return to kernel state - kgdb */
9912: VM_OFF; 8602: VM_OFF;
992 tophys(r1,r1); 861 tophys(r1,r1);
993 lwi r3, r1, PTO+PT_R3; /* restore saved r3, r4 registers */ 862 /* MS: Restore all regs */
994 lwi r4, r1, PTO+PT_R4;
995 RESTORE_REGS 863 RESTORE_REGS
996 addik r1, r1, STATE_SAVE_SIZE /* Clean up stack space. */ 864 lwi r14, r1, PTO+PT_R14;
997 865 lwi r16, r1, PTO+PT_PC;
866 lwi r17, r1, PTO+PT_R17;
867 addik r1, r1, STATE_SAVE_SIZE; /* MS: Clean up stack space */
998 tovirt(r1,r1); 868 tovirt(r1,r1);
9996: 869DBTRAP_return_kernel: /* MS: Make global symbol for debugging */
1000DBTRAP_return: /* Make global symbol for debugging */ 870 rtbd r16, 0; /* MS: Instructions to return from a debug trap */
1001 rtbd r14, 0; /* Instructions to return from an IRQ */
1002 nop; 871 nop;
1003 872
1004 873
1005
1006ENTRY(_switch_to) 874ENTRY(_switch_to)
1007 /* prepare return value */ 875 /* prepare return value */
1008 addk r3, r0, CURRENT_TASK 876 addk r3, r0, CURRENT_TASK
@@ -1037,16 +905,12 @@ ENTRY(_switch_to)
1037 swi r30, r11, CC_R30 905 swi r30, r11, CC_R30
1038 /* special purpose registers */ 906 /* special purpose registers */
1039 mfs r12, rmsr 907 mfs r12, rmsr
1040 nop
1041 swi r12, r11, CC_MSR 908 swi r12, r11, CC_MSR
1042 mfs r12, rear 909 mfs r12, rear
1043 nop
1044 swi r12, r11, CC_EAR 910 swi r12, r11, CC_EAR
1045 mfs r12, resr 911 mfs r12, resr
1046 nop
1047 swi r12, r11, CC_ESR 912 swi r12, r11, CC_ESR
1048 mfs r12, rfsr 913 mfs r12, rfsr
1049 nop
1050 swi r12, r11, CC_FSR 914 swi r12, r11, CC_FSR
1051 915
1052 /* update r31, the current-give me pointer to task which will be next */ 916 /* update r31, the current-give me pointer to task which will be next */
@@ -1085,10 +949,8 @@ ENTRY(_switch_to)
1085 /* special purpose registers */ 949 /* special purpose registers */
1086 lwi r12, r11, CC_FSR 950 lwi r12, r11, CC_FSR
1087 mts rfsr, r12 951 mts rfsr, r12
1088 nop
1089 lwi r12, r11, CC_MSR 952 lwi r12, r11, CC_MSR
1090 mts rmsr, r12 953 mts rmsr, r12
1091 nop
1092 954
1093 rtsd r15, 8 955 rtsd r15, 8
1094 nop 956 nop
@@ -1096,15 +958,6 @@ ENTRY(_switch_to)
1096ENTRY(_reset) 958ENTRY(_reset)
1097 brai 0x70; /* Jump back to FS-boot */ 959 brai 0x70; /* Jump back to FS-boot */
1098 960
1099ENTRY(_break)
1100 mfs r5, rmsr
1101 nop
1102 swi r5, r0, 0x250 + TOPHYS(r0_ram)
1103 mfs r5, resr
1104 nop
1105 swi r5, r0, 0x254 + TOPHYS(r0_ram)
1106 bri 0
1107
1108 /* These are compiled and loaded into high memory, then 961 /* These are compiled and loaded into high memory, then
1109 * copied into place in mach_early_setup */ 962 * copied into place in mach_early_setup */
1110 .section .init.ivt, "ax" 963 .section .init.ivt, "ax"
@@ -1116,14 +969,38 @@ ENTRY(_break)
1116 nop 969 nop
1117 brai TOPHYS(_user_exception); /* syscall handler */ 970 brai TOPHYS(_user_exception); /* syscall handler */
1118 brai TOPHYS(_interrupt); /* Interrupt handler */ 971 brai TOPHYS(_interrupt); /* Interrupt handler */
1119 brai TOPHYS(_break); /* nmi trap handler */ 972 brai TOPHYS(_debug_exception); /* debug trap handler */
1120 brai TOPHYS(_hw_exception_handler); /* HW exception handler */ 973 brai TOPHYS(_hw_exception_handler); /* HW exception handler */
1121 974
1122 .org 0x60
1123 brai TOPHYS(_debug_exception); /* debug trap handler*/
1124
1125.section .rodata,"a" 975.section .rodata,"a"
1126#include "syscall_table.S" 976#include "syscall_table.S"
1127 977
1128syscall_table_size=(.-sys_call_table) 978syscall_table_size=(.-sys_call_table)
1129 979
980type_SYSCALL:
981 .ascii "SYSCALL\0"
982type_IRQ:
983 .ascii "IRQ\0"
984type_IRQ_PREEMPT:
985 .ascii "IRQ (PREEMPTED)\0"
986type_SYSCALL_PREEMPT:
987 .ascii " SYSCALL (PREEMPTED)\0"
988
989 /*
990 * Trap decoding for stack unwinder
991 * Tuples are (start addr, end addr, string)
992 * If return address lies on [start addr, end addr],
993 * unwinder displays 'string'
994 */
995
996 .align 4
997.global microblaze_trap_handlers
998microblaze_trap_handlers:
999 /* Exact matches come first */
1000 .word ret_from_trap; .word ret_from_trap ; .word type_SYSCALL
1001 .word ret_from_irq ; .word ret_from_irq ; .word type_IRQ
1002 /* Fuzzy matches go here */
1003 .word ret_from_irq ; .word no_intr_resched ; .word type_IRQ_PREEMPT
1004 .word ret_from_trap; .word TRAP_return ; .word type_SYSCALL_PREEMPT
1005 /* End of table */
1006 .word 0 ; .word 0 ; .word 0
diff --git a/arch/microblaze/kernel/exceptions.c b/arch/microblaze/kernel/exceptions.c
index 02cbdfe5aa8d..b98ee8d0c1cd 100644
--- a/arch/microblaze/kernel/exceptions.c
+++ b/arch/microblaze/kernel/exceptions.c
@@ -48,12 +48,17 @@ void die(const char *str, struct pt_regs *fp, long err)
48 do_exit(err); 48 do_exit(err);
49} 49}
50 50
51/* for user application debugging */
52void sw_exception(struct pt_regs *regs)
53{
54 _exception(SIGTRAP, regs, TRAP_BRKPT, regs->r16);
55}
56
51void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr) 57void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
52{ 58{
53 siginfo_t info; 59 siginfo_t info;
54 60
55 if (kernel_mode(regs)) { 61 if (kernel_mode(regs)) {
56 debugger(regs);
57 die("Exception in kernel mode", regs, signr); 62 die("Exception in kernel mode", regs, signr);
58 } 63 }
59 info.si_signo = signr; 64 info.si_signo = signr;
@@ -143,7 +148,7 @@ asmlinkage void full_exception(struct pt_regs *regs, unsigned int type,
143#ifdef CONFIG_MMU 148#ifdef CONFIG_MMU
144 case MICROBLAZE_PRIVILEGED_EXCEPTION: 149 case MICROBLAZE_PRIVILEGED_EXCEPTION:
145 pr_debug(KERN_WARNING "Privileged exception\n"); 150 pr_debug(KERN_WARNING "Privileged exception\n");
146 /* "brk r0,r0" - used as debug breakpoint */ 151 /* "brk r0,r0" - used as debug breakpoint - old toolchain */
147 if (get_user(code, (unsigned long *)regs->pc) == 0 152 if (get_user(code, (unsigned long *)regs->pc) == 0
148 && code == 0x980c0000) { 153 && code == 0x980c0000) {
149 _exception(SIGTRAP, regs, TRAP_BRKPT, addr); 154 _exception(SIGTRAP, regs, TRAP_BRKPT, addr);
diff --git a/arch/microblaze/kernel/head.S b/arch/microblaze/kernel/head.S
index 1bf739888260..42434008209e 100644
--- a/arch/microblaze/kernel/head.S
+++ b/arch/microblaze/kernel/head.S
@@ -43,10 +43,10 @@
43.global empty_zero_page 43.global empty_zero_page
44.align 12 44.align 12
45empty_zero_page: 45empty_zero_page:
46 .space 4096 46 .space PAGE_SIZE
47.global swapper_pg_dir 47.global swapper_pg_dir
48swapper_pg_dir: 48swapper_pg_dir:
49 .space 4096 49 .space PAGE_SIZE
50 50
51#endif /* CONFIG_MMU */ 51#endif /* CONFIG_MMU */
52 52
diff --git a/arch/microblaze/kernel/hw_exception_handler.S b/arch/microblaze/kernel/hw_exception_handler.S
index 995a2123635b..781195438ee6 100644
--- a/arch/microblaze/kernel/hw_exception_handler.S
+++ b/arch/microblaze/kernel/hw_exception_handler.S
@@ -78,9 +78,6 @@
78#include <asm/asm-offsets.h> 78#include <asm/asm-offsets.h>
79 79
80/* Helpful Macros */ 80/* Helpful Macros */
81#ifndef CONFIG_MMU
82#define EX_HANDLER_STACK_SIZ (4*19)
83#endif
84#define NUM_TO_REG(num) r ## num 81#define NUM_TO_REG(num) r ## num
85 82
86#ifdef CONFIG_MMU 83#ifdef CONFIG_MMU
@@ -988,6 +985,7 @@ ex_unaligned_fixup:
988.end _unaligned_data_exception 985.end _unaligned_data_exception
989#endif /* CONFIG_MMU */ 986#endif /* CONFIG_MMU */
990 987
988.global ex_handler_unhandled
991ex_handler_unhandled: 989ex_handler_unhandled:
992/* FIXME add handle function for unhandled exception - dump register */ 990/* FIXME add handle function for unhandled exception - dump register */
993 bri 0 991 bri 0
diff --git a/arch/microblaze/kernel/irq.c b/arch/microblaze/kernel/irq.c
index 8f120aca123d..a9345fb4906a 100644
--- a/arch/microblaze/kernel/irq.c
+++ b/arch/microblaze/kernel/irq.c
@@ -17,26 +17,17 @@
17#include <linux/seq_file.h> 17#include <linux/seq_file.h>
18#include <linux/kernel_stat.h> 18#include <linux/kernel_stat.h>
19#include <linux/irq.h> 19#include <linux/irq.h>
20#include <linux/of_irq.h>
20 21
21#include <asm/prom.h> 22#include <asm/prom.h>
22 23
23unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
24{
25 struct of_irq oirq;
26
27 if (of_irq_map_one(dev, index, &oirq))
28 return NO_IRQ;
29
30 return oirq.specifier[0];
31}
32EXPORT_SYMBOL_GPL(irq_of_parse_and_map);
33
34static u32 concurrent_irq; 24static u32 concurrent_irq;
35 25
36void __irq_entry do_IRQ(struct pt_regs *regs) 26void __irq_entry do_IRQ(struct pt_regs *regs)
37{ 27{
38 unsigned int irq; 28 unsigned int irq;
39 struct pt_regs *old_regs = set_irq_regs(regs); 29 struct pt_regs *old_regs = set_irq_regs(regs);
30 trace_hardirqs_off();
40 31
41 irq_enter(); 32 irq_enter();
42 irq = get_irq(regs); 33 irq = get_irq(regs);
@@ -53,6 +44,7 @@ next_irq:
53 44
54 irq_exit(); 45 irq_exit();
55 set_irq_regs(old_regs); 46 set_irq_regs(old_regs);
47 trace_hardirqs_on();
56} 48}
57 49
58int show_interrupts(struct seq_file *p, void *v) 50int show_interrupts(struct seq_file *p, void *v)
@@ -104,7 +96,7 @@ unsigned int irq_create_mapping(struct irq_host *host, irq_hw_number_t hwirq)
104EXPORT_SYMBOL_GPL(irq_create_mapping); 96EXPORT_SYMBOL_GPL(irq_create_mapping);
105 97
106unsigned int irq_create_of_mapping(struct device_node *controller, 98unsigned int irq_create_of_mapping(struct device_node *controller,
107 u32 *intspec, unsigned int intsize) 99 const u32 *intspec, unsigned int intsize)
108{ 100{
109 return intspec[0]; 101 return intspec[0];
110} 102}
diff --git a/arch/microblaze/kernel/kgdb.c b/arch/microblaze/kernel/kgdb.c
new file mode 100644
index 000000000000..bfc006b7f2d8
--- /dev/null
+++ b/arch/microblaze/kernel/kgdb.c
@@ -0,0 +1,147 @@
1/*
2 * Microblaze KGDB support
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
9#include <linux/kgdb.h>
10#include <linux/kdebug.h>
11#include <linux/irq.h>
12#include <linux/io.h>
13#include <asm/cacheflush.h>
14#include <asm/asm-offsets.h>
15#include <asm/pvr.h>
16
17#define GDB_REG 0
18#define GDB_PC 32
19#define GDB_MSR 33
20#define GDB_EAR 34
21#define GDB_ESR 35
22#define GDB_FSR 36
23#define GDB_BTR 37
24#define GDB_PVR 38
25#define GDB_REDR 50
26#define GDB_RPID 51
27#define GDB_RZPR 52
28#define GDB_RTLBX 53
29#define GDB_RTLBSX 54 /* mfs can't read it */
30#define GDB_RTLBLO 55
31#define GDB_RTLBHI 56
32
33/* keep pvr separately because it is unchangeble */
34struct pvr_s pvr;
35
36void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
37{
38 int i;
39 unsigned long *pt_regb = (unsigned long *)regs;
40 int temp;
41 /* registers r0 - r31, pc, msr, ear, esr, fsr + do not save pt_mode */
42 for (i = 0; i < (sizeof(struct pt_regs) / 4) - 1; i++)
43 gdb_regs[i] = pt_regb[i];
44
45 /* Branch target register can't be changed */
46 __asm__ __volatile__ ("mfs %0, rbtr;" : "=r"(temp) : );
47 gdb_regs[GDB_BTR] = temp;
48
49 /* pvr part - we have 11 pvr regs */
50 for (i = 0; i < sizeof(struct pvr_s)/4; i++)
51 gdb_regs[GDB_PVR + i] = pvr.pvr[i];
52
53 /* read special registers - can't be changed */
54 __asm__ __volatile__ ("mfs %0, redr;" : "=r"(temp) : );
55 gdb_regs[GDB_REDR] = temp;
56 __asm__ __volatile__ ("mfs %0, rpid;" : "=r"(temp) : );
57 gdb_regs[GDB_RPID] = temp;
58 __asm__ __volatile__ ("mfs %0, rzpr;" : "=r"(temp) : );
59 gdb_regs[GDB_RZPR] = temp;
60 __asm__ __volatile__ ("mfs %0, rtlbx;" : "=r"(temp) : );
61 gdb_regs[GDB_RTLBX] = temp;
62 __asm__ __volatile__ ("mfs %0, rtlblo;" : "=r"(temp) : );
63 gdb_regs[GDB_RTLBLO] = temp;
64 __asm__ __volatile__ ("mfs %0, rtlbhi;" : "=r"(temp) : );
65 gdb_regs[GDB_RTLBHI] = temp;
66}
67
68void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
69{
70 int i;
71 unsigned long *pt_regb = (unsigned long *)regs;
72
73 /* pt_regs and gdb_regs have the same 37 values.
74 * The rest of gdb_regs are unused and can't be changed.
75 * r0 register value can't be changed too. */
76 for (i = 1; i < (sizeof(struct pt_regs) / 4) - 1; i++)
77 pt_regb[i] = gdb_regs[i];
78}
79
80void microblaze_kgdb_break(struct pt_regs *regs)
81{
82 if (kgdb_handle_exception(1, SIGTRAP, 0, regs) != 0)
83 return 0;
84
85 /* Jump over the first arch_kgdb_breakpoint which is barrier to
86 * get kgdb work. The same solution is used for powerpc */
87 if (*(u32 *) (regs->pc) == *(u32 *) (&arch_kgdb_ops.gdb_bpt_instr))
88 regs->pc += BREAK_INSTR_SIZE;
89}
90
91/* untested */
92void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
93{
94 int i;
95 unsigned long *pt_regb = (unsigned long *)(p->thread.regs);
96
97 /* registers r0 - r31, pc, msr, ear, esr, fsr + do not save pt_mode */
98 for (i = 0; i < (sizeof(struct pt_regs) / 4) - 1; i++)
99 gdb_regs[i] = pt_regb[i];
100
101 /* pvr part - we have 11 pvr regs */
102 for (i = 0; i < sizeof(struct pvr_s)/4; i++)
103 gdb_regs[GDB_PVR + i] = pvr.pvr[i];
104}
105
106void kgdb_arch_set_pc(struct pt_regs *regs, unsigned long ip)
107{
108 regs->pc = ip;
109}
110
111int kgdb_arch_handle_exception(int vector, int signo, int err_code,
112 char *remcom_in_buffer, char *remcom_out_buffer,
113 struct pt_regs *regs)
114{
115 char *ptr;
116 unsigned long address;
117 int cpu = smp_processor_id();
118
119 switch (remcom_in_buffer[0]) {
120 case 'c':
121 /* handle the optional parameter */
122 ptr = &remcom_in_buffer[1];
123 if (kgdb_hex2long(&ptr, &address))
124 regs->pc = address;
125
126 return 0;
127 }
128 return -1; /* this means that we do not want to exit from the handler */
129}
130
131int kgdb_arch_init(void)
132{
133 get_pvr(&pvr); /* Fill PVR structure */
134 return 0;
135}
136
137void kgdb_arch_exit(void)
138{
139 /* Nothing to do */
140}
141
142/*
143 * Global data
144 */
145struct kgdb_arch arch_kgdb_ops = {
146 .gdb_bpt_instr = {0xba, 0x0c, 0x00, 0x18}, /* brki r16, 0x18 */
147};
diff --git a/arch/microblaze/kernel/misc.S b/arch/microblaze/kernel/misc.S
index 0fb5fc6c1fc2..206da3da361f 100644
--- a/arch/microblaze/kernel/misc.S
+++ b/arch/microblaze/kernel/misc.S
@@ -76,7 +76,7 @@ early_console_reg_tlb_alloc:
76 * the UARTs nice and early. We use a 4k real==virtual mapping. 76 * the UARTs nice and early. We use a 4k real==virtual mapping.
77 */ 77 */
78 ori r4, r0, MICROBLAZE_TLB_SIZE - 1 78 ori r4, r0, MICROBLAZE_TLB_SIZE - 1
79 mts rtlbx, r4 /* TLB slot 2 */ 79 mts rtlbx, r4 /* TLB slot 63 */
80 80
81 or r4,r5,r0 81 or r4,r5,r0
82 andi r4,r4,0xfffff000 82 andi r4,r4,0xfffff000
diff --git a/arch/microblaze/kernel/of_device.c b/arch/microblaze/kernel/of_device.c
deleted file mode 100644
index b372787886ed..000000000000
--- a/arch/microblaze/kernel/of_device.c
+++ /dev/null
@@ -1,112 +0,0 @@
1#include <linux/string.h>
2#include <linux/kernel.h>
3#include <linux/of.h>
4#include <linux/init.h>
5#include <linux/module.h>
6#include <linux/mod_devicetable.h>
7#include <linux/slab.h>
8#include <linux/of_device.h>
9
10#include <linux/errno.h>
11
12void of_device_make_bus_id(struct of_device *dev)
13{
14 static atomic_t bus_no_reg_magic;
15 struct device_node *node = dev->dev.of_node;
16 const u32 *reg;
17 u64 addr;
18 int magic;
19
20 /*
21 * For MMIO, get the physical address
22 */
23 reg = of_get_property(node, "reg", NULL);
24 if (reg) {
25 addr = of_translate_address(node, reg);
26 if (addr != OF_BAD_ADDR) {
27 dev_set_name(&dev->dev, "%llx.%s",
28 (unsigned long long)addr, node->name);
29 return;
30 }
31 }
32
33 /*
34 * No BusID, use the node name and add a globally incremented
35 * counter (and pray...)
36 */
37 magic = atomic_add_return(1, &bus_no_reg_magic);
38 dev_set_name(&dev->dev, "%s.%d", node->name, magic - 1);
39}
40EXPORT_SYMBOL(of_device_make_bus_id);
41
42struct of_device *of_device_alloc(struct device_node *np,
43 const char *bus_id,
44 struct device *parent)
45{
46 struct of_device *dev;
47
48 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
49 if (!dev)
50 return NULL;
51
52 dev->dev.of_node = of_node_get(np);
53 dev->dev.dma_mask = &dev->archdata.dma_mask;
54 dev->dev.parent = parent;
55 dev->dev.release = of_release_dev;
56
57 if (bus_id)
58 dev_set_name(&dev->dev, bus_id);
59 else
60 of_device_make_bus_id(dev);
61
62 return dev;
63}
64EXPORT_SYMBOL(of_device_alloc);
65
66int of_device_uevent(struct device *dev, struct kobj_uevent_env *env)
67{
68 struct of_device *ofdev;
69 const char *compat;
70 int seen = 0, cplen, sl;
71
72 if (!dev)
73 return -ENODEV;
74
75 ofdev = to_of_device(dev);
76
77 if (add_uevent_var(env, "OF_NAME=%s", ofdev->dev.of_node->name))
78 return -ENOMEM;
79
80 if (add_uevent_var(env, "OF_TYPE=%s", ofdev->dev.of_node->type))
81 return -ENOMEM;
82
83 /* Since the compatible field can contain pretty much anything
84 * it's not really legal to split it out with commas. We split it
85 * up using a number of environment variables instead. */
86
87 compat = of_get_property(ofdev->dev.of_node, "compatible", &cplen);
88 while (compat && *compat && cplen > 0) {
89 if (add_uevent_var(env, "OF_COMPATIBLE_%d=%s", seen, compat))
90 return -ENOMEM;
91
92 sl = strlen(compat) + 1;
93 compat += sl;
94 cplen -= sl;
95 seen++;
96 }
97
98 if (add_uevent_var(env, "OF_COMPATIBLE_N=%d", seen))
99 return -ENOMEM;
100
101 /* modalias is trickier, we add it in 2 steps */
102 if (add_uevent_var(env, "MODALIAS="))
103 return -ENOMEM;
104 sl = of_device_get_modalias(ofdev, &env->buf[env->buflen-1],
105 sizeof(env->buf) - env->buflen);
106 if (sl >= (sizeof(env->buf) - env->buflen))
107 return -ENOMEM;
108 env->buflen += sl;
109
110 return 0;
111}
112EXPORT_SYMBOL(of_device_uevent);
diff --git a/arch/microblaze/kernel/of_platform.c b/arch/microblaze/kernel/of_platform.c
deleted file mode 100644
index ccf6f4257f4b..000000000000
--- a/arch/microblaze/kernel/of_platform.c
+++ /dev/null
@@ -1,200 +0,0 @@
1/*
2 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
3 * <benh@kernel.crashing.org>
4 * and Arnd Bergmann, IBM Corp.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 */
12
13#undef DEBUG
14
15#include <linux/string.h>
16#include <linux/kernel.h>
17#include <linux/init.h>
18#include <linux/module.h>
19#include <linux/mod_devicetable.h>
20#include <linux/pci.h>
21#include <linux/of.h>
22#include <linux/of_device.h>
23#include <linux/of_platform.h>
24
25#include <linux/errno.h>
26#include <linux/topology.h>
27#include <asm/atomic.h>
28
29struct bus_type of_platform_bus_type = {
30 .uevent = of_device_uevent,
31};
32EXPORT_SYMBOL(of_platform_bus_type);
33
34static int __init of_bus_driver_init(void)
35{
36 return of_bus_type_init(&of_platform_bus_type, "of_platform");
37}
38postcore_initcall(of_bus_driver_init);
39
40struct of_device *of_platform_device_create(struct device_node *np,
41 const char *bus_id,
42 struct device *parent)
43{
44 struct of_device *dev;
45
46 dev = of_device_alloc(np, bus_id, parent);
47 if (!dev)
48 return NULL;
49
50 dev->archdata.dma_mask = 0xffffffffUL;
51 dev->dev.bus = &of_platform_bus_type;
52
53 /* We do not fill the DMA ops for platform devices by default.
54 * This is currently the responsibility of the platform code
55 * to do such, possibly using a device notifier
56 */
57
58 if (of_device_register(dev) != 0) {
59 of_device_free(dev);
60 return NULL;
61 }
62
63 return dev;
64}
65EXPORT_SYMBOL(of_platform_device_create);
66
67/**
68 * of_platform_bus_create - Create an OF device for a bus node and all its
69 * children. Optionally recursively instanciate matching busses.
70 * @bus: device node of the bus to instanciate
71 * @matches: match table, NULL to use the default, OF_NO_DEEP_PROBE to
72 * disallow recursive creation of child busses
73 */
74static int of_platform_bus_create(const struct device_node *bus,
75 const struct of_device_id *matches,
76 struct device *parent)
77{
78 struct device_node *child;
79 struct of_device *dev;
80 int rc = 0;
81
82 for_each_child_of_node(bus, child) {
83 pr_debug(" create child: %s\n", child->full_name);
84 dev = of_platform_device_create(child, NULL, parent);
85 if (dev == NULL)
86 rc = -ENOMEM;
87 else if (!of_match_node(matches, child))
88 continue;
89 if (rc == 0) {
90 pr_debug(" and sub busses\n");
91 rc = of_platform_bus_create(child, matches, &dev->dev);
92 }
93 if (rc) {
94 of_node_put(child);
95 break;
96 }
97 }
98 return rc;
99}
100
101
102/**
103 * of_platform_bus_probe - Probe the device-tree for platform busses
104 * @root: parent of the first level to probe or NULL for the root of the tree
105 * @matches: match table, NULL to use the default
106 * @parent: parent to hook devices from, NULL for toplevel
107 *
108 * Note that children of the provided root are not instanciated as devices
109 * unless the specified root itself matches the bus list and is not NULL.
110 */
111
112int of_platform_bus_probe(struct device_node *root,
113 const struct of_device_id *matches,
114 struct device *parent)
115{
116 struct device_node *child;
117 struct of_device *dev;
118 int rc = 0;
119
120 if (matches == NULL)
121 matches = of_default_bus_ids;
122 if (matches == OF_NO_DEEP_PROBE)
123 return -EINVAL;
124 if (root == NULL)
125 root = of_find_node_by_path("/");
126 else
127 of_node_get(root);
128
129 pr_debug("of_platform_bus_probe()\n");
130 pr_debug(" starting at: %s\n", root->full_name);
131
132 /* Do a self check of bus type, if there's a match, create
133 * children
134 */
135 if (of_match_node(matches, root)) {
136 pr_debug(" root match, create all sub devices\n");
137 dev = of_platform_device_create(root, NULL, parent);
138 if (dev == NULL) {
139 rc = -ENOMEM;
140 goto bail;
141 }
142 pr_debug(" create all sub busses\n");
143 rc = of_platform_bus_create(root, matches, &dev->dev);
144 goto bail;
145 }
146 for_each_child_of_node(root, child) {
147 if (!of_match_node(matches, child))
148 continue;
149
150 pr_debug(" match: %s\n", child->full_name);
151 dev = of_platform_device_create(child, NULL, parent);
152 if (dev == NULL)
153 rc = -ENOMEM;
154 else
155 rc = of_platform_bus_create(child, matches, &dev->dev);
156 if (rc) {
157 of_node_put(child);
158 break;
159 }
160 }
161 bail:
162 of_node_put(root);
163 return rc;
164}
165EXPORT_SYMBOL(of_platform_bus_probe);
166
167static int of_dev_node_match(struct device *dev, void *data)
168{
169 return to_of_device(dev)->dev.of_node == data;
170}
171
172struct of_device *of_find_device_by_node(struct device_node *np)
173{
174 struct device *dev;
175
176 dev = bus_find_device(&of_platform_bus_type,
177 NULL, np, of_dev_node_match);
178 if (dev)
179 return to_of_device(dev);
180 return NULL;
181}
182EXPORT_SYMBOL(of_find_device_by_node);
183
184static int of_dev_phandle_match(struct device *dev, void *data)
185{
186 phandle *ph = data;
187 return to_of_device(dev)->dev.of_node->phandle == *ph;
188}
189
190struct of_device *of_find_device_by_phandle(phandle ph)
191{
192 struct device *dev;
193
194 dev = bus_find_device(&of_platform_bus_type,
195 NULL, &ph, of_dev_phandle_match);
196 if (dev)
197 return to_of_device(dev);
198 return NULL;
199}
200EXPORT_SYMBOL(of_find_device_by_phandle);
diff --git a/arch/microblaze/kernel/process.c b/arch/microblaze/kernel/process.c
index 09bed44dfcd3..ba7c4b16ed35 100644
--- a/arch/microblaze/kernel/process.c
+++ b/arch/microblaze/kernel/process.c
@@ -76,8 +76,11 @@ __setup("hlt", hlt_setup);
76void default_idle(void) 76void default_idle(void)
77{ 77{
78 if (likely(hlt_counter)) { 78 if (likely(hlt_counter)) {
79 while (!need_resched()) 79 local_irq_disable();
80 cpu_relax(); 80 stop_critical_timings();
81 cpu_relax();
82 start_critical_timings();
83 local_irq_enable();
81 } else { 84 } else {
82 clear_thread_flag(TIF_POLLING_NRFLAG); 85 clear_thread_flag(TIF_POLLING_NRFLAG);
83 smp_mb__after_clear_bit(); 86 smp_mb__after_clear_bit();
diff --git a/arch/microblaze/kernel/prom_parse.c b/arch/microblaze/kernel/prom_parse.c
index bf7e6c27e318..d33ba17601fa 100644
--- a/arch/microblaze/kernel/prom_parse.c
+++ b/arch/microblaze/kernel/prom_parse.c
@@ -6,219 +6,11 @@
6#include <linux/module.h> 6#include <linux/module.h>
7#include <linux/ioport.h> 7#include <linux/ioport.h>
8#include <linux/etherdevice.h> 8#include <linux/etherdevice.h>
9#include <linux/of_address.h>
9#include <asm/prom.h> 10#include <asm/prom.h>
10#include <asm/pci-bridge.h> 11#include <asm/pci-bridge.h>
11 12
12#define PRu64 "%llx"
13
14/* Max address size we deal with */
15#define OF_MAX_ADDR_CELLS 4
16#define OF_CHECK_COUNTS(na, ns) ((na) > 0 && (na) <= OF_MAX_ADDR_CELLS && \
17 (ns) > 0)
18
19static struct of_bus *of_match_bus(struct device_node *np);
20static int __of_address_to_resource(struct device_node *dev,
21 const u32 *addrp, u64 size, unsigned int flags,
22 struct resource *r);
23
24/* Debug utility */
25#ifdef DEBUG
26static void of_dump_addr(const char *s, const u32 *addr, int na)
27{
28 printk(KERN_INFO "%s", s);
29 while (na--)
30 printk(KERN_INFO " %08x", *(addr++));
31 printk(KERN_INFO "\n");
32}
33#else
34static void of_dump_addr(const char *s, const u32 *addr, int na) { }
35#endif
36
37/* Callbacks for bus specific translators */
38struct of_bus {
39 const char *name;
40 const char *addresses;
41 int (*match)(struct device_node *parent);
42 void (*count_cells)(struct device_node *child,
43 int *addrc, int *sizec);
44 u64 (*map)(u32 *addr, const u32 *range,
45 int na, int ns, int pna);
46 int (*translate)(u32 *addr, u64 offset, int na);
47 unsigned int (*get_flags)(const u32 *addr);
48};
49
50/*
51 * Default translator (generic bus)
52 */
53
54static void of_bus_default_count_cells(struct device_node *dev,
55 int *addrc, int *sizec)
56{
57 if (addrc)
58 *addrc = of_n_addr_cells(dev);
59 if (sizec)
60 *sizec = of_n_size_cells(dev);
61}
62
63static u64 of_bus_default_map(u32 *addr, const u32 *range,
64 int na, int ns, int pna)
65{
66 u64 cp, s, da;
67
68 cp = of_read_number(range, na);
69 s = of_read_number(range + na + pna, ns);
70 da = of_read_number(addr, na);
71
72 pr_debug("OF: default map, cp="PRu64", s="PRu64", da="PRu64"\n",
73 cp, s, da);
74
75 if (da < cp || da >= (cp + s))
76 return OF_BAD_ADDR;
77 return da - cp;
78}
79
80static int of_bus_default_translate(u32 *addr, u64 offset, int na)
81{
82 u64 a = of_read_number(addr, na);
83 memset(addr, 0, na * 4);
84 a += offset;
85 if (na > 1)
86 addr[na - 2] = a >> 32;
87 addr[na - 1] = a & 0xffffffffu;
88
89 return 0;
90}
91
92static unsigned int of_bus_default_get_flags(const u32 *addr)
93{
94 return IORESOURCE_MEM;
95}
96
97#ifdef CONFIG_PCI 13#ifdef CONFIG_PCI
98/*
99 * PCI bus specific translator
100 */
101
102static int of_bus_pci_match(struct device_node *np)
103{
104 /* "vci" is for the /chaos bridge on 1st-gen PCI powermacs */
105 return !strcmp(np->type, "pci") || !strcmp(np->type, "vci");
106}
107
108static void of_bus_pci_count_cells(struct device_node *np,
109 int *addrc, int *sizec)
110{
111 if (addrc)
112 *addrc = 3;
113 if (sizec)
114 *sizec = 2;
115}
116
117static u64 of_bus_pci_map(u32 *addr, const u32 *range, int na, int ns, int pna)
118{
119 u64 cp, s, da;
120
121 /* Check address type match */
122 if ((addr[0] ^ range[0]) & 0x03000000)
123 return OF_BAD_ADDR;
124
125 /* Read address values, skipping high cell */
126 cp = of_read_number(range + 1, na - 1);
127 s = of_read_number(range + na + pna, ns);
128 da = of_read_number(addr + 1, na - 1);
129
130 pr_debug("OF: PCI map, cp="PRu64", s="PRu64", da="PRu64"\n", cp, s, da);
131
132 if (da < cp || da >= (cp + s))
133 return OF_BAD_ADDR;
134 return da - cp;
135}
136
137static int of_bus_pci_translate(u32 *addr, u64 offset, int na)
138{
139 return of_bus_default_translate(addr + 1, offset, na - 1);
140}
141
142static unsigned int of_bus_pci_get_flags(const u32 *addr)
143{
144 unsigned int flags = 0;
145 u32 w = addr[0];
146
147 switch ((w >> 24) & 0x03) {
148 case 0x01:
149 flags |= IORESOURCE_IO;
150 break;
151 case 0x02: /* 32 bits */
152 case 0x03: /* 64 bits */
153 flags |= IORESOURCE_MEM;
154 break;
155 }
156 if (w & 0x40000000)
157 flags |= IORESOURCE_PREFETCH;
158 return flags;
159}
160
161const u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size,
162 unsigned int *flags)
163{
164 const u32 *prop;
165 unsigned int psize;
166 struct device_node *parent;
167 struct of_bus *bus;
168 int onesize, i, na, ns;
169
170 /* Get parent & match bus type */
171 parent = of_get_parent(dev);
172 if (parent == NULL)
173 return NULL;
174 bus = of_match_bus(parent);
175 if (strcmp(bus->name, "pci")) {
176 of_node_put(parent);
177 return NULL;
178 }
179 bus->count_cells(dev, &na, &ns);
180 of_node_put(parent);
181 if (!OF_CHECK_COUNTS(na, ns))
182 return NULL;
183
184 /* Get "reg" or "assigned-addresses" property */
185 prop = of_get_property(dev, bus->addresses, &psize);
186 if (prop == NULL)
187 return NULL;
188 psize /= 4;
189
190 onesize = na + ns;
191 for (i = 0; psize >= onesize; psize -= onesize, prop += onesize, i++)
192 if ((prop[0] & 0xff) == ((bar_no * 4) + PCI_BASE_ADDRESS_0)) {
193 if (size)
194 *size = of_read_number(prop + na, ns);
195 if (flags)
196 *flags = bus->get_flags(prop);
197 return prop;
198 }
199 return NULL;
200}
201EXPORT_SYMBOL(of_get_pci_address);
202
203int of_pci_address_to_resource(struct device_node *dev, int bar,
204 struct resource *r)
205{
206 const u32 *addrp;
207 u64 size;
208 unsigned int flags;
209
210 addrp = of_get_pci_address(dev, bar, &size, &flags);
211 if (addrp == NULL)
212 return -EINVAL;
213 return __of_address_to_resource(dev, addrp, size, flags, r);
214}
215EXPORT_SYMBOL_GPL(of_pci_address_to_resource);
216
217static u8 of_irq_pci_swizzle(u8 slot, u8 pin)
218{
219 return (((pin - 1) + slot) % 4) + 1;
220}
221
222int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq) 14int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq)
223{ 15{
224 struct device_node *dn, *ppnode; 16 struct device_node *dn, *ppnode;
@@ -293,331 +85,6 @@ int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq)
293EXPORT_SYMBOL_GPL(of_irq_map_pci); 85EXPORT_SYMBOL_GPL(of_irq_map_pci);
294#endif /* CONFIG_PCI */ 86#endif /* CONFIG_PCI */
295 87
296/*
297 * ISA bus specific translator
298 */
299
300static int of_bus_isa_match(struct device_node *np)
301{
302 return !strcmp(np->name, "isa");
303}
304
305static void of_bus_isa_count_cells(struct device_node *child,
306 int *addrc, int *sizec)
307{
308 if (addrc)
309 *addrc = 2;
310 if (sizec)
311 *sizec = 1;
312}
313
314static u64 of_bus_isa_map(u32 *addr, const u32 *range, int na, int ns, int pna)
315{
316 u64 cp, s, da;
317
318 /* Check address type match */
319 if ((addr[0] ^ range[0]) & 0x00000001)
320 return OF_BAD_ADDR;
321
322 /* Read address values, skipping high cell */
323 cp = of_read_number(range + 1, na - 1);
324 s = of_read_number(range + na + pna, ns);
325 da = of_read_number(addr + 1, na - 1);
326
327 pr_debug("OF: ISA map, cp="PRu64", s="PRu64", da="PRu64"\n", cp, s, da);
328
329 if (da < cp || da >= (cp + s))
330 return OF_BAD_ADDR;
331 return da - cp;
332}
333
334static int of_bus_isa_translate(u32 *addr, u64 offset, int na)
335{
336 return of_bus_default_translate(addr + 1, offset, na - 1);
337}
338
339static unsigned int of_bus_isa_get_flags(const u32 *addr)
340{
341 unsigned int flags = 0;
342 u32 w = addr[0];
343
344 if (w & 1)
345 flags |= IORESOURCE_IO;
346 else
347 flags |= IORESOURCE_MEM;
348 return flags;
349}
350
351/*
352 * Array of bus specific translators
353 */
354
355static struct of_bus of_busses[] = {
356#ifdef CONFIG_PCI
357 /* PCI */
358 {
359 .name = "pci",
360 .addresses = "assigned-addresses",
361 .match = of_bus_pci_match,
362 .count_cells = of_bus_pci_count_cells,
363 .map = of_bus_pci_map,
364 .translate = of_bus_pci_translate,
365 .get_flags = of_bus_pci_get_flags,
366 },
367#endif /* CONFIG_PCI */
368 /* ISA */
369 {
370 .name = "isa",
371 .addresses = "reg",
372 .match = of_bus_isa_match,
373 .count_cells = of_bus_isa_count_cells,
374 .map = of_bus_isa_map,
375 .translate = of_bus_isa_translate,
376 .get_flags = of_bus_isa_get_flags,
377 },
378 /* Default */
379 {
380 .name = "default",
381 .addresses = "reg",
382 .match = NULL,
383 .count_cells = of_bus_default_count_cells,
384 .map = of_bus_default_map,
385 .translate = of_bus_default_translate,
386 .get_flags = of_bus_default_get_flags,
387 },
388};
389
390static struct of_bus *of_match_bus(struct device_node *np)
391{
392 int i;
393
394 for (i = 0; i < ARRAY_SIZE(of_busses); i++)
395 if (!of_busses[i].match || of_busses[i].match(np))
396 return &of_busses[i];
397 BUG();
398 return NULL;
399}
400
401static int of_translate_one(struct device_node *parent, struct of_bus *bus,
402 struct of_bus *pbus, u32 *addr,
403 int na, int ns, int pna)
404{
405 const u32 *ranges;
406 unsigned int rlen;
407 int rone;
408 u64 offset = OF_BAD_ADDR;
409
410 /* Normally, an absence of a "ranges" property means we are
411 * crossing a non-translatable boundary, and thus the addresses
412 * below the current not cannot be converted to CPU physical ones.
413 * Unfortunately, while this is very clear in the spec, it's not
414 * what Apple understood, and they do have things like /uni-n or
415 * /ht nodes with no "ranges" property and a lot of perfectly
416 * useable mapped devices below them. Thus we treat the absence of
417 * "ranges" as equivalent to an empty "ranges" property which means
418 * a 1:1 translation at that level. It's up to the caller not to try
419 * to translate addresses that aren't supposed to be translated in
420 * the first place. --BenH.
421 */
422 ranges = of_get_property(parent, "ranges", (int *) &rlen);
423 if (ranges == NULL || rlen == 0) {
424 offset = of_read_number(addr, na);
425 memset(addr, 0, pna * 4);
426 pr_debug("OF: no ranges, 1:1 translation\n");
427 goto finish;
428 }
429
430 pr_debug("OF: walking ranges...\n");
431
432 /* Now walk through the ranges */
433 rlen /= 4;
434 rone = na + pna + ns;
435 for (; rlen >= rone; rlen -= rone, ranges += rone) {
436 offset = bus->map(addr, ranges, na, ns, pna);
437 if (offset != OF_BAD_ADDR)
438 break;
439 }
440 if (offset == OF_BAD_ADDR) {
441 pr_debug("OF: not found !\n");
442 return 1;
443 }
444 memcpy(addr, ranges + na, 4 * pna);
445
446 finish:
447 of_dump_addr("OF: parent translation for:", addr, pna);
448 pr_debug("OF: with offset: "PRu64"\n", offset);
449
450 /* Translate it into parent bus space */
451 return pbus->translate(addr, offset, pna);
452}
453
454/*
455 * Translate an address from the device-tree into a CPU physical address,
456 * this walks up the tree and applies the various bus mappings on the
457 * way.
458 *
459 * Note: We consider that crossing any level with #size-cells == 0 to mean
460 * that translation is impossible (that is we are not dealing with a value
461 * that can be mapped to a cpu physical address). This is not really specified
462 * that way, but this is traditionally the way IBM at least do things
463 */
464u64 of_translate_address(struct device_node *dev, const u32 *in_addr)
465{
466 struct device_node *parent = NULL;
467 struct of_bus *bus, *pbus;
468 u32 addr[OF_MAX_ADDR_CELLS];
469 int na, ns, pna, pns;
470 u64 result = OF_BAD_ADDR;
471
472 pr_debug("OF: ** translation for device %s **\n", dev->full_name);
473
474 /* Increase refcount at current level */
475 of_node_get(dev);
476
477 /* Get parent & match bus type */
478 parent = of_get_parent(dev);
479 if (parent == NULL)
480 goto bail;
481 bus = of_match_bus(parent);
482
483 /* Cound address cells & copy address locally */
484 bus->count_cells(dev, &na, &ns);
485 if (!OF_CHECK_COUNTS(na, ns)) {
486 printk(KERN_ERR "prom_parse: Bad cell count for %s\n",
487 dev->full_name);
488 goto bail;
489 }
490 memcpy(addr, in_addr, na * 4);
491
492 pr_debug("OF: bus is %s (na=%d, ns=%d) on %s\n",
493 bus->name, na, ns, parent->full_name);
494 of_dump_addr("OF: translating address:", addr, na);
495
496 /* Translate */
497 for (;;) {
498 /* Switch to parent bus */
499 of_node_put(dev);
500 dev = parent;
501 parent = of_get_parent(dev);
502
503 /* If root, we have finished */
504 if (parent == NULL) {
505 pr_debug("OF: reached root node\n");
506 result = of_read_number(addr, na);
507 break;
508 }
509
510 /* Get new parent bus and counts */
511 pbus = of_match_bus(parent);
512 pbus->count_cells(dev, &pna, &pns);
513 if (!OF_CHECK_COUNTS(pna, pns)) {
514 printk(KERN_ERR "prom_parse: Bad cell count for %s\n",
515 dev->full_name);
516 break;
517 }
518
519 pr_debug("OF: parent bus is %s (na=%d, ns=%d) on %s\n",
520 pbus->name, pna, pns, parent->full_name);
521
522 /* Apply bus translation */
523 if (of_translate_one(dev, bus, pbus, addr, na, ns, pna))
524 break;
525
526 /* Complete the move up one level */
527 na = pna;
528 ns = pns;
529 bus = pbus;
530
531 of_dump_addr("OF: one level translation:", addr, na);
532 }
533 bail:
534 of_node_put(parent);
535 of_node_put(dev);
536
537 return result;
538}
539EXPORT_SYMBOL(of_translate_address);
540
541const u32 *of_get_address(struct device_node *dev, int index, u64 *size,
542 unsigned int *flags)
543{
544 const u32 *prop;
545 unsigned int psize;
546 struct device_node *parent;
547 struct of_bus *bus;
548 int onesize, i, na, ns;
549
550 /* Get parent & match bus type */
551 parent = of_get_parent(dev);
552 if (parent == NULL)
553 return NULL;
554 bus = of_match_bus(parent);
555 bus->count_cells(dev, &na, &ns);
556 of_node_put(parent);
557 if (!OF_CHECK_COUNTS(na, ns))
558 return NULL;
559
560 /* Get "reg" or "assigned-addresses" property */
561 prop = of_get_property(dev, bus->addresses, (int *) &psize);
562 if (prop == NULL)
563 return NULL;
564 psize /= 4;
565
566 onesize = na + ns;
567 for (i = 0; psize >= onesize; psize -= onesize, prop += onesize, i++)
568 if (i == index) {
569 if (size)
570 *size = of_read_number(prop + na, ns);
571 if (flags)
572 *flags = bus->get_flags(prop);
573 return prop;
574 }
575 return NULL;
576}
577EXPORT_SYMBOL(of_get_address);
578
579static int __of_address_to_resource(struct device_node *dev, const u32 *addrp,
580 u64 size, unsigned int flags,
581 struct resource *r)
582{
583 u64 taddr;
584
585 if ((flags & (IORESOURCE_IO | IORESOURCE_MEM)) == 0)
586 return -EINVAL;
587 taddr = of_translate_address(dev, addrp);
588 if (taddr == OF_BAD_ADDR)
589 return -EINVAL;
590 memset(r, 0, sizeof(struct resource));
591 if (flags & IORESOURCE_IO) {
592 unsigned long port;
593 port = -1; /* pci_address_to_pio(taddr); */
594 if (port == (unsigned long)-1)
595 return -EINVAL;
596 r->start = port;
597 r->end = port + size - 1;
598 } else {
599 r->start = taddr;
600 r->end = taddr + size - 1;
601 }
602 r->flags = flags;
603 r->name = dev->name;
604 return 0;
605}
606
607int of_address_to_resource(struct device_node *dev, int index,
608 struct resource *r)
609{
610 const u32 *addrp;
611 u64 size;
612 unsigned int flags;
613
614 addrp = of_get_address(dev, index, &size, &flags);
615 if (addrp == NULL)
616 return -EINVAL;
617 return __of_address_to_resource(dev, addrp, size, flags, r);
618}
619EXPORT_SYMBOL_GPL(of_address_to_resource);
620
621void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop, 88void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
622 unsigned long *busno, unsigned long *phys, unsigned long *size) 89 unsigned long *busno, unsigned long *phys, unsigned long *size)
623{ 90{
@@ -644,308 +111,6 @@ void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
644 *size = of_read_number(dma_window, cells); 111 *size = of_read_number(dma_window, cells);
645} 112}
646 113
647/*
648 * Interrupt remapper
649 */
650
651static unsigned int of_irq_workarounds;
652static struct device_node *of_irq_dflt_pic;
653
654static struct device_node *of_irq_find_parent(struct device_node *child)
655{
656 struct device_node *p;
657 const phandle *parp;
658
659 if (!of_node_get(child))
660 return NULL;
661
662 do {
663 parp = of_get_property(child, "interrupt-parent", NULL);
664 if (parp == NULL)
665 p = of_get_parent(child);
666 else {
667 if (of_irq_workarounds & OF_IMAP_NO_PHANDLE)
668 p = of_node_get(of_irq_dflt_pic);
669 else
670 p = of_find_node_by_phandle(*parp);
671 }
672 of_node_put(child);
673 child = p;
674 } while (p && of_get_property(p, "#interrupt-cells", NULL) == NULL);
675
676 return p;
677}
678
679/* This doesn't need to be called if you don't have any special workaround
680 * flags to pass
681 */
682void of_irq_map_init(unsigned int flags)
683{
684 of_irq_workarounds = flags;
685
686 /* OldWorld, don't bother looking at other things */
687 if (flags & OF_IMAP_OLDWORLD_MAC)
688 return;
689
690 /* If we don't have phandles, let's try to locate a default interrupt
691 * controller (happens when booting with BootX). We do a first match
692 * here, hopefully, that only ever happens on machines with one
693 * controller.
694 */
695 if (flags & OF_IMAP_NO_PHANDLE) {
696 struct device_node *np;
697
698 for (np = NULL; (np = of_find_all_nodes(np)) != NULL;) {
699 if (of_get_property(np, "interrupt-controller", NULL)
700 == NULL)
701 continue;
702 /* Skip /chosen/interrupt-controller */
703 if (strcmp(np->name, "chosen") == 0)
704 continue;
705 /* It seems like at least one person on this planet
706 * wants to use BootX on a machine with an AppleKiwi
707 * controller which happens to pretend to be an
708 * interrupt controller too.
709 */
710 if (strcmp(np->name, "AppleKiwi") == 0)
711 continue;
712 /* I think we found one ! */
713 of_irq_dflt_pic = np;
714 break;
715 }
716 }
717
718}
719
720int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize,
721 const u32 *addr, struct of_irq *out_irq)
722{
723 struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL;
724 const u32 *tmp, *imap, *imask;
725 u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0;
726 int imaplen, match, i;
727
728 pr_debug("of_irq_map_raw: par=%s,intspec=[0x%08x 0x%08x...],"
729 "ointsize=%d\n",
730 parent->full_name, intspec[0], intspec[1], ointsize);
731
732 ipar = of_node_get(parent);
733
734 /* First get the #interrupt-cells property of the current cursor
735 * that tells us how to interpret the passed-in intspec. If there
736 * is none, we are nice and just walk up the tree
737 */
738 do {
739 tmp = of_get_property(ipar, "#interrupt-cells", NULL);
740 if (tmp != NULL) {
741 intsize = *tmp;
742 break;
743 }
744 tnode = ipar;
745 ipar = of_irq_find_parent(ipar);
746 of_node_put(tnode);
747 } while (ipar);
748 if (ipar == NULL) {
749 pr_debug(" -> no parent found !\n");
750 goto fail;
751 }
752
753 pr_debug("of_irq_map_raw: ipar=%s, size=%d\n",
754 ipar->full_name, intsize);
755
756 if (ointsize != intsize)
757 return -EINVAL;
758
759 /* Look for this #address-cells. We have to implement the old linux
760 * trick of looking for the parent here as some device-trees rely on it
761 */
762 old = of_node_get(ipar);
763 do {
764 tmp = of_get_property(old, "#address-cells", NULL);
765 tnode = of_get_parent(old);
766 of_node_put(old);
767 old = tnode;
768 } while (old && tmp == NULL);
769 of_node_put(old);
770 old = NULL;
771 addrsize = (tmp == NULL) ? 2 : *tmp;
772
773 pr_debug(" -> addrsize=%d\n", addrsize);
774
775 /* Now start the actual "proper" walk of the interrupt tree */
776 while (ipar != NULL) {
777 /* Now check if cursor is an interrupt-controller and if it is
778 * then we are done
779 */
780 if (of_get_property(ipar, "interrupt-controller", NULL) !=
781 NULL) {
782 pr_debug(" -> got it !\n");
783 memcpy(out_irq->specifier, intspec,
784 intsize * sizeof(u32));
785 out_irq->size = intsize;
786 out_irq->controller = ipar;
787 of_node_put(old);
788 return 0;
789 }
790
791 /* Now look for an interrupt-map */
792 imap = of_get_property(ipar, "interrupt-map", &imaplen);
793 /* No interrupt map, check for an interrupt parent */
794 if (imap == NULL) {
795 pr_debug(" -> no map, getting parent\n");
796 newpar = of_irq_find_parent(ipar);
797 goto skiplevel;
798 }
799 imaplen /= sizeof(u32);
800
801 /* Look for a mask */
802 imask = of_get_property(ipar, "interrupt-map-mask", NULL);
803
804 /* If we were passed no "reg" property and we attempt to parse
805 * an interrupt-map, then #address-cells must be 0.
806 * Fail if it's not.
807 */
808 if (addr == NULL && addrsize != 0) {
809 pr_debug(" -> no reg passed in when needed !\n");
810 goto fail;
811 }
812
813 /* Parse interrupt-map */
814 match = 0;
815 while (imaplen > (addrsize + intsize + 1) && !match) {
816 /* Compare specifiers */
817 match = 1;
818 for (i = 0; i < addrsize && match; ++i) {
819 u32 mask = imask ? imask[i] : 0xffffffffu;
820 match = ((addr[i] ^ imap[i]) & mask) == 0;
821 }
822 for (; i < (addrsize + intsize) && match; ++i) {
823 u32 mask = imask ? imask[i] : 0xffffffffu;
824 match =
825 ((intspec[i-addrsize] ^ imap[i])
826 & mask) == 0;
827 }
828 imap += addrsize + intsize;
829 imaplen -= addrsize + intsize;
830
831 pr_debug(" -> match=%d (imaplen=%d)\n", match, imaplen);
832
833 /* Get the interrupt parent */
834 if (of_irq_workarounds & OF_IMAP_NO_PHANDLE)
835 newpar = of_node_get(of_irq_dflt_pic);
836 else
837 newpar =
838 of_find_node_by_phandle((phandle)*imap);
839 imap++;
840 --imaplen;
841
842 /* Check if not found */
843 if (newpar == NULL) {
844 pr_debug(" -> imap parent not found !\n");
845 goto fail;
846 }
847
848 /* Get #interrupt-cells and #address-cells of new
849 * parent
850 */
851 tmp = of_get_property(newpar, "#interrupt-cells", NULL);
852 if (tmp == NULL) {
853 pr_debug(" -> parent lacks "
854 "#interrupt-cells!\n");
855 goto fail;
856 }
857 newintsize = *tmp;
858 tmp = of_get_property(newpar, "#address-cells", NULL);
859 newaddrsize = (tmp == NULL) ? 0 : *tmp;
860
861 pr_debug(" -> newintsize=%d, newaddrsize=%d\n",
862 newintsize, newaddrsize);
863
864 /* Check for malformed properties */
865 if (imaplen < (newaddrsize + newintsize))
866 goto fail;
867
868 imap += newaddrsize + newintsize;
869 imaplen -= newaddrsize + newintsize;
870
871 pr_debug(" -> imaplen=%d\n", imaplen);
872 }
873 if (!match)
874 goto fail;
875
876 of_node_put(old);
877 old = of_node_get(newpar);
878 addrsize = newaddrsize;
879 intsize = newintsize;
880 intspec = imap - intsize;
881 addr = intspec - addrsize;
882
883skiplevel:
884 /* Iterate again with new parent */
885 pr_debug(" -> new parent: %s\n",
886 newpar ? newpar->full_name : "<>");
887 of_node_put(ipar);
888 ipar = newpar;
889 newpar = NULL;
890 }
891fail:
892 of_node_put(ipar);
893 of_node_put(old);
894 of_node_put(newpar);
895
896 return -EINVAL;
897}
898EXPORT_SYMBOL_GPL(of_irq_map_raw);
899
900int of_irq_map_one(struct device_node *device,
901 int index, struct of_irq *out_irq)
902{
903 struct device_node *p;
904 const u32 *intspec, *tmp, *addr;
905 u32 intsize, intlen;
906 int res;
907
908 pr_debug("of_irq_map_one: dev=%s, index=%d\n",
909 device->full_name, index);
910
911 /* Get the interrupts property */
912 intspec = of_get_property(device, "interrupts", (int *) &intlen);
913 if (intspec == NULL)
914 return -EINVAL;
915 intlen /= sizeof(u32);
916
917 pr_debug(" intspec=%d intlen=%d\n", *intspec, intlen);
918
919 /* Get the reg property (if any) */
920 addr = of_get_property(device, "reg", NULL);
921
922 /* Look for the interrupt parent. */
923 p = of_irq_find_parent(device);
924 if (p == NULL)
925 return -EINVAL;
926
927 /* Get size of interrupt specifier */
928 tmp = of_get_property(p, "#interrupt-cells", NULL);
929 if (tmp == NULL) {
930 of_node_put(p);
931 return -EINVAL;
932 }
933 intsize = *tmp;
934
935 pr_debug(" intsize=%d intlen=%d\n", intsize, intlen);
936
937 /* Check index */
938 if ((index + 1) * intsize > intlen)
939 return -EINVAL;
940
941 /* Get new specifier and map it */
942 res = of_irq_map_raw(p, intspec + index * intsize, intsize,
943 addr, out_irq);
944 of_node_put(p);
945 return res;
946}
947EXPORT_SYMBOL_GPL(of_irq_map_one);
948
949/** 114/**
950 * Search the device tree for the best MAC address to use. 'mac-address' is 115 * Search the device tree for the best MAC address to use. 'mac-address' is
951 * checked first, because that is supposed to contain to "most recent" MAC 116 * checked first, because that is supposed to contain to "most recent" MAC
@@ -983,43 +148,3 @@ const void *of_get_mac_address(struct device_node *np)
983 return NULL; 148 return NULL;
984} 149}
985EXPORT_SYMBOL(of_get_mac_address); 150EXPORT_SYMBOL(of_get_mac_address);
986
987int of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
988{
989 struct of_irq out_irq;
990 int irq;
991 int res;
992
993 res = of_irq_map_one(dev, index, &out_irq);
994
995 /* Get irq for the device */
996 if (res) {
997 pr_debug("IRQ not found... code = %d", res);
998 return NO_IRQ;
999 }
1000 /* Assuming single interrupt controller... */
1001 irq = out_irq.specifier[0];
1002
1003 pr_debug("IRQ found = %d", irq);
1004
1005 /* Only dereference the resource if both the
1006 * resource and the irq are valid. */
1007 if (r && irq != NO_IRQ) {
1008 r->start = r->end = irq;
1009 r->flags = IORESOURCE_IRQ;
1010 }
1011
1012 return irq;
1013}
1014EXPORT_SYMBOL_GPL(of_irq_to_resource);
1015
1016void __iomem *of_iomap(struct device_node *np, int index)
1017{
1018 struct resource res;
1019
1020 if (of_address_to_resource(np, index, &res))
1021 return NULL;
1022
1023 return ioremap(res.start, 1 + res.end - res.start);
1024}
1025EXPORT_SYMBOL(of_iomap);
diff --git a/arch/microblaze/kernel/ptrace.c b/arch/microblaze/kernel/ptrace.c
index a4a7770c6140..dc03ffc8174a 100644
--- a/arch/microblaze/kernel/ptrace.c
+++ b/arch/microblaze/kernel/ptrace.c
@@ -38,6 +38,8 @@
38#include <asm/processor.h> 38#include <asm/processor.h>
39#include <linux/uaccess.h> 39#include <linux/uaccess.h>
40#include <asm/asm-offsets.h> 40#include <asm/asm-offsets.h>
41#include <asm/cacheflush.h>
42#include <asm/io.h>
41 43
42/* Returns the address where the register at REG_OFFS in P is stashed away. */ 44/* Returns the address where the register at REG_OFFS in P is stashed away. */
43static microblaze_reg_t *reg_save_addr(unsigned reg_offs, 45static microblaze_reg_t *reg_save_addr(unsigned reg_offs,
@@ -101,8 +103,21 @@ long arch_ptrace(struct task_struct *child, long request, long addr, long data)
101 microblaze_reg_t *reg_addr = reg_save_addr(addr, child); 103 microblaze_reg_t *reg_addr = reg_save_addr(addr, child);
102 if (request == PTRACE_PEEKUSR) 104 if (request == PTRACE_PEEKUSR)
103 val = *reg_addr; 105 val = *reg_addr;
104 else 106 else {
107#if 1
105 *reg_addr = data; 108 *reg_addr = data;
109#else
110 /* MS potential problem on WB system
111 * Be aware that reg_addr is virtual address
112 * virt_to_phys conversion is necessary.
113 * This could be sensible solution.
114 */
115 u32 paddr = virt_to_phys((u32)reg_addr);
116 invalidate_icache_range(paddr, paddr + 4);
117 *reg_addr = data;
118 flush_dcache_range(paddr, paddr + 4);
119#endif
120 }
106 } else 121 } else
107 rval = -EIO; 122 rval = -EIO;
108 123
diff --git a/arch/microblaze/kernel/reset.c b/arch/microblaze/kernel/reset.c
index a1721a33042e..bd8ccab5ceff 100644
--- a/arch/microblaze/kernel/reset.c
+++ b/arch/microblaze/kernel/reset.c
@@ -24,8 +24,8 @@ static int of_reset_gpio_handle(void)
24 int ret; /* variable which stored handle reset gpio pin */ 24 int ret; /* variable which stored handle reset gpio pin */
25 struct device_node *root; /* root node */ 25 struct device_node *root; /* root node */
26 struct device_node *gpio; /* gpio node */ 26 struct device_node *gpio; /* gpio node */
27 struct of_gpio_chip *of_gc = NULL; 27 struct gpio_chip *gc;
28 enum of_gpio_flags flags ; 28 u32 flags;
29 const void *gpio_spec; 29 const void *gpio_spec;
30 30
31 /* find out root node */ 31 /* find out root node */
@@ -39,19 +39,19 @@ static int of_reset_gpio_handle(void)
39 goto err0; 39 goto err0;
40 } 40 }
41 41
42 of_gc = gpio->data; 42 gc = of_node_to_gpiochip(gpio);
43 if (!of_gc) { 43 if (!gc) {
44 pr_debug("%s: gpio controller %s isn't registered\n", 44 pr_debug("%s: gpio controller %s isn't registered\n",
45 root->full_name, gpio->full_name); 45 root->full_name, gpio->full_name);
46 ret = -ENODEV; 46 ret = -ENODEV;
47 goto err1; 47 goto err1;
48 } 48 }
49 49
50 ret = of_gc->xlate(of_gc, root, gpio_spec, &flags); 50 ret = gc->of_xlate(gc, root, gpio_spec, &flags);
51 if (ret < 0) 51 if (ret < 0)
52 goto err1; 52 goto err1;
53 53
54 ret += of_gc->gc.base; 54 ret += gc->base;
55err1: 55err1:
56 of_node_put(gpio); 56 of_node_put(gpio);
57err0: 57err0:
diff --git a/arch/microblaze/kernel/setup.c b/arch/microblaze/kernel/setup.c
index 17c98dbcec88..f5f768842354 100644
--- a/arch/microblaze/kernel/setup.c
+++ b/arch/microblaze/kernel/setup.c
@@ -213,15 +213,9 @@ static struct notifier_block dflt_plat_bus_notifier = {
213 .priority = INT_MAX, 213 .priority = INT_MAX,
214}; 214};
215 215
216static struct notifier_block dflt_of_bus_notifier = {
217 .notifier_call = dflt_bus_notify,
218 .priority = INT_MAX,
219};
220
221static int __init setup_bus_notifier(void) 216static int __init setup_bus_notifier(void)
222{ 217{
223 bus_register_notifier(&platform_bus_type, &dflt_plat_bus_notifier); 218 bus_register_notifier(&platform_bus_type, &dflt_plat_bus_notifier);
224 bus_register_notifier(&of_platform_bus_type, &dflt_of_bus_notifier);
225 219
226 return 0; 220 return 0;
227} 221}
diff --git a/arch/microblaze/kernel/stacktrace.c b/arch/microblaze/kernel/stacktrace.c
index 123692f22647..84bc6686102c 100644
--- a/arch/microblaze/kernel/stacktrace.c
+++ b/arch/microblaze/kernel/stacktrace.c
@@ -14,52 +14,18 @@
14#include <linux/thread_info.h> 14#include <linux/thread_info.h>
15#include <linux/ptrace.h> 15#include <linux/ptrace.h>
16#include <linux/module.h> 16#include <linux/module.h>
17#include <asm/unwind.h>
17 18
18/* FIXME initial support */
19void save_stack_trace(struct stack_trace *trace) 19void save_stack_trace(struct stack_trace *trace)
20{ 20{
21 unsigned long *sp; 21 /* Exclude our helper functions from the trace*/
22 unsigned long addr; 22 trace->skip += 2;
23 asm("addik %0, r1, 0" : "=r" (sp)); 23 microblaze_unwind(NULL, trace);
24
25 while (!kstack_end(sp)) {
26 addr = *sp++;
27 if (__kernel_text_address(addr)) {
28 if (trace->skip > 0)
29 trace->skip--;
30 else
31 trace->entries[trace->nr_entries++] = addr;
32
33 if (trace->nr_entries >= trace->max_entries)
34 break;
35 }
36 }
37} 24}
38EXPORT_SYMBOL_GPL(save_stack_trace); 25EXPORT_SYMBOL_GPL(save_stack_trace);
39 26
40void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace) 27void save_stack_trace_tsk(struct task_struct *tsk, struct stack_trace *trace)
41{ 28{
42 unsigned int *sp; 29 microblaze_unwind(tsk, trace);
43 unsigned long addr;
44
45 struct thread_info *ti = task_thread_info(tsk);
46
47 if (tsk == current)
48 asm("addik %0, r1, 0" : "=r" (sp));
49 else
50 sp = (unsigned int *)ti->cpu_context.r1;
51
52 while (!kstack_end(sp)) {
53 addr = *sp++;
54 if (__kernel_text_address(addr)) {
55 if (trace->skip > 0)
56 trace->skip--;
57 else
58 trace->entries[trace->nr_entries++] = addr;
59
60 if (trace->nr_entries >= trace->max_entries)
61 break;
62 }
63 }
64} 30}
65EXPORT_SYMBOL_GPL(save_stack_trace_tsk); 31EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
diff --git a/arch/microblaze/kernel/timer.c b/arch/microblaze/kernel/timer.c
index ed61b2f17719..b1380ae93ae1 100644
--- a/arch/microblaze/kernel/timer.c
+++ b/arch/microblaze/kernel/timer.c
@@ -28,6 +28,7 @@
28#include <asm/prom.h> 28#include <asm/prom.h>
29#include <asm/irq.h> 29#include <asm/irq.h>
30#include <asm/system.h> 30#include <asm/system.h>
31#include <linux/cnt32_to_63.h>
31 32
32#ifdef CONFIG_SELFMOD_TIMER 33#ifdef CONFIG_SELFMOD_TIMER
33#include <asm/selfmod.h> 34#include <asm/selfmod.h>
@@ -135,7 +136,7 @@ static void microblaze_timer_set_mode(enum clock_event_mode mode,
135static struct clock_event_device clockevent_microblaze_timer = { 136static struct clock_event_device clockevent_microblaze_timer = {
136 .name = "microblaze_clockevent", 137 .name = "microblaze_clockevent",
137 .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC, 138 .features = CLOCK_EVT_FEAT_ONESHOT | CLOCK_EVT_FEAT_PERIODIC,
138 .shift = 24, 139 .shift = 8,
139 .rating = 300, 140 .rating = 300,
140 .set_next_event = microblaze_timer_set_next_event, 141 .set_next_event = microblaze_timer_set_next_event,
141 .set_mode = microblaze_timer_set_mode, 142 .set_mode = microblaze_timer_set_mode,
@@ -195,7 +196,7 @@ static cycle_t microblaze_cc_read(const struct cyclecounter *cc)
195static struct cyclecounter microblaze_cc = { 196static struct cyclecounter microblaze_cc = {
196 .read = microblaze_cc_read, 197 .read = microblaze_cc_read,
197 .mask = CLOCKSOURCE_MASK(32), 198 .mask = CLOCKSOURCE_MASK(32),
198 .shift = 24, 199 .shift = 8,
199}; 200};
200 201
201int __init init_microblaze_timecounter(void) 202int __init init_microblaze_timecounter(void)
@@ -213,7 +214,7 @@ static struct clocksource clocksource_microblaze = {
213 .rating = 300, 214 .rating = 300,
214 .read = microblaze_read, 215 .read = microblaze_read,
215 .mask = CLOCKSOURCE_MASK(32), 216 .mask = CLOCKSOURCE_MASK(32),
216 .shift = 24, /* I can shift it */ 217 .shift = 8, /* I can shift it */
217 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 218 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
218}; 219};
219 220
@@ -235,6 +236,12 @@ static int __init microblaze_clocksource_init(void)
235 return 0; 236 return 0;
236} 237}
237 238
239/*
240 * We have to protect accesses before timer initialization
241 * and return 0 for sched_clock function below.
242 */
243static int timer_initialized;
244
238void __init time_init(void) 245void __init time_init(void)
239{ 246{
240 u32 irq, i = 0; 247 u32 irq, i = 0;
@@ -289,4 +296,15 @@ void __init time_init(void)
289#endif 296#endif
290 microblaze_clocksource_init(); 297 microblaze_clocksource_init();
291 microblaze_clockevent_init(); 298 microblaze_clockevent_init();
299 timer_initialized = 1;
300}
301
302unsigned long long notrace sched_clock(void)
303{
304 if (timer_initialized) {
305 struct clocksource *cs = &clocksource_microblaze;
306 cycle_t cyc = cnt32_to_63(cs->read(NULL));
307 return clocksource_cyc2ns(cyc, cs->mult, cs->shift);
308 }
309 return 0;
292} 310}
diff --git a/arch/microblaze/kernel/traps.c b/arch/microblaze/kernel/traps.c
index 75e49202a5ed..ba034d421ec2 100644
--- a/arch/microblaze/kernel/traps.c
+++ b/arch/microblaze/kernel/traps.c
@@ -16,13 +16,14 @@
16 16
17#include <asm/exceptions.h> 17#include <asm/exceptions.h>
18#include <asm/system.h> 18#include <asm/system.h>
19#include <asm/unwind.h>
19 20
20void trap_init(void) 21void trap_init(void)
21{ 22{
22 __enable_hw_exceptions(); 23 __enable_hw_exceptions();
23} 24}
24 25
25static unsigned long kstack_depth_to_print = 24; 26static unsigned long kstack_depth_to_print; /* 0 == entire stack */
26 27
27static int __init kstack_setup(char *s) 28static int __init kstack_setup(char *s)
28{ 29{
@@ -30,31 +31,47 @@ static int __init kstack_setup(char *s)
30} 31}
31__setup("kstack=", kstack_setup); 32__setup("kstack=", kstack_setup);
32 33
33void show_trace(struct task_struct *task, unsigned long *stack) 34void show_stack(struct task_struct *task, unsigned long *sp)
34{ 35{
35 unsigned long addr; 36 unsigned long words_to_show;
36 37 u32 fp = (u32) sp;
37 if (!stack) 38
38 stack = (unsigned long *)&stack; 39 if (fp == 0) {
40 if (task) {
41 fp = ((struct thread_info *)
42 (task->stack))->cpu_context.r1;
43 } else {
44 /* Pick up caller of dump_stack() */
45 fp = (u32)&sp - 8;
46 }
47 }
39 48
40 printk(KERN_NOTICE "Call Trace: "); 49 words_to_show = (THREAD_SIZE - (fp & (THREAD_SIZE - 1))) >> 2;
41#ifdef CONFIG_KALLSYMS 50 if (kstack_depth_to_print && (words_to_show > kstack_depth_to_print))
42 printk(KERN_NOTICE "\n"); 51 words_to_show = kstack_depth_to_print;
43#endif 52
44 while (!kstack_end(stack)) { 53 pr_info("Kernel Stack:\n");
45 addr = *stack++; 54
46 /* 55 /*
47 * If the address is either in the text segment of the 56 * Make the first line an 'odd' size if necessary to get
48 * kernel, or in the region which contains vmalloc'ed 57 * remaining lines to start at an address multiple of 0x10
49 * memory, it *may* be the address of a calling 58 */
50 * routine; if so, print it so that someone tracing 59 if (fp & 0xF) {
51 * down the cause of the crash will be able to figure 60 unsigned long line1_words = (0x10 - (fp & 0xF)) >> 2;
52 * out the call path that was taken. 61 if (line1_words < words_to_show) {
53 */ 62 print_hex_dump(KERN_INFO, "", DUMP_PREFIX_ADDRESS, 32,
54 if (kernel_text_address(addr)) 63 4, (void *)fp, line1_words << 2, 0);
55 print_ip_sym(addr); 64 fp += line1_words << 2;
65 words_to_show -= line1_words;
66 }
56 } 67 }
57 printk(KERN_NOTICE "\n"); 68 print_hex_dump(KERN_INFO, "", DUMP_PREFIX_ADDRESS, 32, 4, (void *)fp,
69 words_to_show << 2, 0);
70 printk(KERN_INFO "\n\n");
71
72 pr_info("Call Trace:\n");
73 microblaze_unwind(task, NULL);
74 pr_info("\n");
58 75
59 if (!task) 76 if (!task)
60 task = current; 77 task = current;
@@ -62,34 +79,6 @@ void show_trace(struct task_struct *task, unsigned long *stack)
62 debug_show_held_locks(task); 79 debug_show_held_locks(task);
63} 80}
64 81
65void show_stack(struct task_struct *task, unsigned long *sp)
66{
67 unsigned long *stack;
68 int i;
69
70 if (sp == NULL) {
71 if (task)
72 sp = (unsigned long *) ((struct thread_info *)
73 (task->stack))->cpu_context.r1;
74 else
75 sp = (unsigned long *)&sp;
76 }
77
78 stack = sp;
79
80 printk(KERN_INFO "\nStack:\n ");
81
82 for (i = 0; i < kstack_depth_to_print; i++) {
83 if (kstack_end(sp))
84 break;
85 if (i && ((i % 8) == 0))
86 printk("\n ");
87 printk("%08lx ", *sp++);
88 }
89 printk("\n");
90 show_trace(task, stack);
91}
92
93void dump_stack(void) 82void dump_stack(void)
94{ 83{
95 show_stack(NULL, NULL); 84 show_stack(NULL, NULL);
diff --git a/arch/microblaze/kernel/unwind.c b/arch/microblaze/kernel/unwind.c
new file mode 100644
index 000000000000..fefac5c33586
--- /dev/null
+++ b/arch/microblaze/kernel/unwind.c
@@ -0,0 +1,318 @@
1/*
2 * Backtrace support for Microblaze
3 *
4 * Copyright (C) 2010 Digital Design Corporation
5 *
6 * Based on arch/sh/kernel/cpu/sh5/unwind.c code which is:
7 * Copyright (C) 2004 Paul Mundt
8 * Copyright (C) 2004 Richard Curnow
9 *
10 * This file is subject to the terms and conditions of the GNU General Public
11 * License. See the file "COPYING" in the main directory of this archive
12 * for more details.
13 */
14
15/* #define DEBUG 1 */
16#include <linux/kallsyms.h>
17#include <linux/kernel.h>
18#include <linux/sched.h>
19#include <linux/stacktrace.h>
20#include <linux/types.h>
21#include <linux/errno.h>
22#include <linux/module.h>
23#include <linux/io.h>
24#include <asm/sections.h>
25#include <asm/exceptions.h>
26#include <asm/unwind.h>
27
28struct stack_trace;
29
30/*
31 * On Microblaze, finding the previous stack frame is a little tricky.
32 * At this writing (3/2010), Microblaze does not support CONFIG_FRAME_POINTERS,
33 * and even if it did, gcc (4.1.2) does not store the frame pointer at
34 * a consistent offset within each frame. To determine frame size, it is
35 * necessary to search for the assembly instruction that creates or reclaims
36 * the frame and extract the size from it.
37 *
38 * Microblaze stores the stack pointer in r1, and creates a frame via
39 *
40 * addik r1, r1, -FRAME_SIZE
41 *
42 * The frame is reclaimed via
43 *
44 * addik r1, r1, FRAME_SIZE
45 *
46 * Frame creation occurs at or near the top of a function.
47 * Depending on the compiler, reclaim may occur at the end, or before
48 * a mid-function return.
49 *
50 * A stack frame is usually not created in a leaf function.
51 *
52 */
53
54/**
55 * get_frame_size - Extract the stack adjustment from an
56 * "addik r1, r1, adjust" instruction
57 * @instr : Microblaze instruction
58 *
59 * Return - Number of stack bytes the instruction reserves or reclaims
60 */
61inline long get_frame_size(unsigned long instr)
62{
63 return abs((s16)(instr & 0xFFFF));
64}
65
66/**
67 * find_frame_creation - Search backward to find the instruction that creates
68 * the stack frame (hopefully, for the same function the
69 * initial PC is in).
70 * @pc : Program counter at which to begin the search
71 *
72 * Return - PC at which stack frame creation occurs
73 * NULL if this cannot be found, i.e. a leaf function
74 */
75static unsigned long *find_frame_creation(unsigned long *pc)
76{
77 int i;
78
79 /* NOTE: Distance to search is arbitrary
80 * 250 works well for most things,
81 * 750 picks up things like tcp_recvmsg(),
82 * 1000 needed for fat_fill_super()
83 */
84 for (i = 0; i < 1000; i++, pc--) {
85 unsigned long instr;
86 s16 frame_size;
87
88 if (!kernel_text_address((unsigned long) pc))
89 return NULL;
90
91 instr = *pc;
92
93 /* addik r1, r1, foo ? */
94 if ((instr & 0xFFFF0000) != 0x30210000)
95 continue; /* No */
96
97 frame_size = get_frame_size(instr);
98 if ((frame_size < 8) || (frame_size & 3)) {
99 pr_debug(" Invalid frame size %d at 0x%p\n",
100 frame_size, pc);
101 return NULL;
102 }
103
104 pr_debug(" Found frame creation at 0x%p, size %d\n", pc,
105 frame_size);
106 return pc;
107 }
108
109 return NULL;
110}
111
112/**
113 * lookup_prev_stack_frame - Find the stack frame of the previous function.
114 * @fp : Frame (stack) pointer for current function
115 * @pc : Program counter within current function
116 * @leaf_return : r15 value within current function. If the current function
117 * is a leaf, this is the caller's return address.
118 * @pprev_fp : On exit, set to frame (stack) pointer for previous function
119 * @pprev_pc : On exit, set to current function caller's return address
120 *
121 * Return - 0 on success, -EINVAL if the previous frame cannot be found
122 */
123static int lookup_prev_stack_frame(unsigned long fp, unsigned long pc,
124 unsigned long leaf_return,
125 unsigned long *pprev_fp,
126 unsigned long *pprev_pc)
127{
128 unsigned long *prologue = NULL;
129
130 /* _switch_to is a special leaf function */
131 if (pc != (unsigned long) &_switch_to)
132 prologue = find_frame_creation((unsigned long *)pc);
133
134 if (prologue) {
135 long frame_size = get_frame_size(*prologue);
136
137 *pprev_fp = fp + frame_size;
138 *pprev_pc = *(unsigned long *)fp;
139 } else {
140 if (!leaf_return)
141 return -EINVAL;
142 *pprev_pc = leaf_return;
143 *pprev_fp = fp;
144 }
145
146 /* NOTE: don't check kernel_text_address here, to allow display
147 * of userland return address
148 */
149 return (!*pprev_pc || (*pprev_pc & 3)) ? -EINVAL : 0;
150}
151
152static void microblaze_unwind_inner(struct task_struct *task,
153 unsigned long pc, unsigned long fp,
154 unsigned long leaf_return,
155 struct stack_trace *trace);
156
157/**
158 * unwind_trap - Unwind through a system trap, that stored previous state
159 * on the stack.
160 */
161#ifdef CONFIG_MMU
162static inline void unwind_trap(struct task_struct *task, unsigned long pc,
163 unsigned long fp, struct stack_trace *trace)
164{
165 /* To be implemented */
166}
167#else
168static inline void unwind_trap(struct task_struct *task, unsigned long pc,
169 unsigned long fp, struct stack_trace *trace)
170{
171 const struct pt_regs *regs = (const struct pt_regs *) fp;
172 microblaze_unwind_inner(task, regs->pc, regs->r1, regs->r15, trace);
173}
174#endif
175
176/**
177 * microblaze_unwind_inner - Unwind the stack from the specified point
178 * @task : Task whose stack we are to unwind (may be NULL)
179 * @pc : Program counter from which we start unwinding
180 * @fp : Frame (stack) pointer from which we start unwinding
181 * @leaf_return : Value of r15 at pc. If the function is a leaf, this is
182 * the caller's return address.
183 * @trace : Where to store stack backtrace (PC values).
184 * NULL == print backtrace to kernel log
185 */
186void microblaze_unwind_inner(struct task_struct *task,
187 unsigned long pc, unsigned long fp,
188 unsigned long leaf_return,
189 struct stack_trace *trace)
190{
191 int ofs = 0;
192
193 pr_debug(" Unwinding with PC=%p, FP=%p\n", (void *)pc, (void *)fp);
194 if (!pc || !fp || (pc & 3) || (fp & 3)) {
195 pr_debug(" Invalid state for unwind, aborting\n");
196 return;
197 }
198 for (; pc != 0;) {
199 unsigned long next_fp, next_pc = 0;
200 unsigned long return_to = pc + 2 * sizeof(unsigned long);
201 const struct trap_handler_info *handler =
202 &microblaze_trap_handlers;
203
204 /* Is previous function the HW exception handler? */
205 if ((return_to >= (unsigned long)&_hw_exception_handler)
206 &&(return_to < (unsigned long)&ex_handler_unhandled)) {
207 /*
208 * HW exception handler doesn't save all registers,
209 * so we open-code a special case of unwind_trap()
210 */
211#ifndef CONFIG_MMU
212 const struct pt_regs *regs =
213 (const struct pt_regs *) fp;
214#endif
215 pr_info("HW EXCEPTION\n");
216#ifndef CONFIG_MMU
217 microblaze_unwind_inner(task, regs->r17 - 4,
218 fp + EX_HANDLER_STACK_SIZ,
219 regs->r15, trace);
220#endif
221 return;
222 }
223
224 /* Is previous function a trap handler? */
225 for (; handler->start_addr; ++handler) {
226 if ((return_to >= handler->start_addr)
227 && (return_to <= handler->end_addr)) {
228 if (!trace)
229 pr_info("%s\n", handler->trap_name);
230 unwind_trap(task, pc, fp, trace);
231 return;
232 }
233 }
234 pc -= ofs;
235
236 if (trace) {
237#ifdef CONFIG_STACKTRACE
238 if (trace->skip > 0)
239 trace->skip--;
240 else
241 trace->entries[trace->nr_entries++] = pc;
242
243 if (trace->nr_entries >= trace->max_entries)
244 break;
245#endif
246 } else {
247 /* Have we reached userland? */
248 if (unlikely(pc == task_pt_regs(task)->pc)) {
249 pr_info("[<%p>] PID %lu [%s]\n",
250 (void *) pc,
251 (unsigned long) task->pid,
252 task->comm);
253 break;
254 } else
255 print_ip_sym(pc);
256 }
257
258 /* Stop when we reach anything not part of the kernel */
259 if (!kernel_text_address(pc))
260 break;
261
262 if (lookup_prev_stack_frame(fp, pc, leaf_return, &next_fp,
263 &next_pc) == 0) {
264 ofs = sizeof(unsigned long);
265 pc = next_pc & ~3;
266 fp = next_fp;
267 leaf_return = 0;
268 } else {
269 pr_debug(" Failed to find previous stack frame\n");
270 break;
271 }
272
273 pr_debug(" Next PC=%p, next FP=%p\n",
274 (void *)next_pc, (void *)next_fp);
275 }
276}
277
278/**
279 * microblaze_unwind - Stack unwinder for Microblaze (external entry point)
280 * @task : Task whose stack we are to unwind (NULL == current)
281 * @trace : Where to store stack backtrace (PC values).
282 * NULL == print backtrace to kernel log
283 */
284void microblaze_unwind(struct task_struct *task, struct stack_trace *trace)
285{
286 if (task) {
287 if (task == current) {
288 const struct pt_regs *regs = task_pt_regs(task);
289 microblaze_unwind_inner(task, regs->pc, regs->r1,
290 regs->r15, trace);
291 } else {
292 struct thread_info *thread_info =
293 (struct thread_info *)(task->stack);
294 const struct cpu_context *cpu_context =
295 &thread_info->cpu_context;
296
297 microblaze_unwind_inner(task,
298 (unsigned long) &_switch_to,
299 cpu_context->r1,
300 cpu_context->r15, trace);
301 }
302 } else {
303 unsigned long pc, fp;
304
305 __asm__ __volatile__ ("or %0, r1, r0" : "=r" (fp));
306
307 __asm__ __volatile__ (
308 "brlid %0, 0f;"
309 "nop;"
310 "0:"
311 : "=r" (pc)
312 );
313
314 /* Since we are not a leaf function, use leaf_return = 0 */
315 microblaze_unwind_inner(current, pc, fp, 0, trace);
316 }
317}
318
diff --git a/arch/microblaze/kernel/vmlinux.lds.S b/arch/microblaze/kernel/vmlinux.lds.S
index db72d7124602..a09f2962fbec 100644
--- a/arch/microblaze/kernel/vmlinux.lds.S
+++ b/arch/microblaze/kernel/vmlinux.lds.S
@@ -10,7 +10,7 @@
10 10
11OUTPUT_FORMAT("elf32-microblaze", "elf32-microblaze", "elf32-microblaze") 11OUTPUT_FORMAT("elf32-microblaze", "elf32-microblaze", "elf32-microblaze")
12OUTPUT_ARCH(microblaze) 12OUTPUT_ARCH(microblaze)
13ENTRY(_start) 13ENTRY(microblaze_start)
14 14
15#include <asm/page.h> 15#include <asm/page.h>
16#include <asm-generic/vmlinux.lds.h> 16#include <asm-generic/vmlinux.lds.h>
@@ -20,7 +20,7 @@ jiffies = jiffies_64 + 4;
20 20
21SECTIONS { 21SECTIONS {
22 . = CONFIG_KERNEL_START; 22 . = CONFIG_KERNEL_START;
23 _start = CONFIG_KERNEL_BASE_ADDR; 23 microblaze_start = CONFIG_KERNEL_BASE_ADDR;
24 .text : AT(ADDR(.text) - LOAD_OFFSET) { 24 .text : AT(ADDR(.text) - LOAD_OFFSET) {
25 _text = . ; 25 _text = . ;
26 _stext = . ; 26 _stext = . ;
@@ -55,7 +55,7 @@ SECTIONS {
55 */ 55 */
56 .sdata2 : AT(ADDR(.sdata2) - LOAD_OFFSET) { 56 .sdata2 : AT(ADDR(.sdata2) - LOAD_OFFSET) {
57 _ssrw = .; 57 _ssrw = .;
58 . = ALIGN(4096); /* page aligned when MMU used - origin 0x8 */ 58 . = ALIGN(PAGE_SIZE); /* page aligned when MMU used */
59 *(.sdata2) 59 *(.sdata2)
60 . = ALIGN(8); 60 . = ALIGN(8);
61 _essrw = .; 61 _essrw = .;
@@ -70,7 +70,7 @@ SECTIONS {
70 /* Reserve some low RAM for r0 based memory references */ 70 /* Reserve some low RAM for r0 based memory references */
71 . = ALIGN(0x4) ; 71 . = ALIGN(0x4) ;
72 r0_ram = . ; 72 r0_ram = . ;
73 . = . + 4096; /* a page should be enough */ 73 . = . + PAGE_SIZE; /* a page should be enough */
74 74
75 /* Under the microblaze ABI, .sdata and .sbss must be contiguous */ 75 /* Under the microblaze ABI, .sdata and .sbss must be contiguous */
76 . = ALIGN(8); 76 . = ALIGN(8);
@@ -120,7 +120,7 @@ SECTIONS {
120 120
121 __init_end_before_initramfs = .; 121 __init_end_before_initramfs = .;
122 122
123 .init.ramfs ALIGN(4096) : AT(ADDR(.init.ramfs) - LOAD_OFFSET) { 123 .init.ramfs ALIGN(PAGE_SIZE) : AT(ADDR(.init.ramfs) - LOAD_OFFSET) {
124 __initramfs_start = .; 124 __initramfs_start = .;
125 *(.init.ramfs) 125 *(.init.ramfs)
126 __initramfs_end = .; 126 __initramfs_end = .;
@@ -132,11 +132,11 @@ SECTIONS {
132 * so that __init_end == __bss_start. This will make image.elf 132 * so that __init_end == __bss_start. This will make image.elf
133 * consistent with the image.bin 133 * consistent with the image.bin
134 */ 134 */
135 /* . = ALIGN(4096); */ 135 /* . = ALIGN(PAGE_SIZE); */
136 } 136 }
137 __init_end = .; 137 __init_end = .;
138 138
139 .bss ALIGN (4096) : AT(ADDR(.bss) - LOAD_OFFSET) { 139 .bss ALIGN (PAGE_SIZE) : AT(ADDR(.bss) - LOAD_OFFSET) {
140 /* page aligned when MMU used */ 140 /* page aligned when MMU used */
141 __bss_start = . ; 141 __bss_start = . ;
142 *(.bss*) 142 *(.bss*)
@@ -145,7 +145,7 @@ SECTIONS {
145 __bss_stop = . ; 145 __bss_stop = . ;
146 _ebss = . ; 146 _ebss = . ;
147 } 147 }
148 . = ALIGN(4096); 148 . = ALIGN(PAGE_SIZE);
149 _end = .; 149 _end = .;
150 150
151 DISCARDS 151 DISCARDS
diff --git a/arch/microblaze/mm/fault.c b/arch/microblaze/mm/fault.c
index bab922993185..57bd2a09610c 100644
--- a/arch/microblaze/mm/fault.c
+++ b/arch/microblaze/mm/fault.c
@@ -37,10 +37,6 @@
37#include <linux/uaccess.h> 37#include <linux/uaccess.h>
38#include <asm/exceptions.h> 38#include <asm/exceptions.h>
39 39
40#if defined(CONFIG_KGDB)
41int debugger_kernel_faults = 1;
42#endif
43
44static unsigned long pte_misses; /* updated by do_page_fault() */ 40static unsigned long pte_misses; /* updated by do_page_fault() */
45static unsigned long pte_errors; /* updated by do_page_fault() */ 41static unsigned long pte_errors; /* updated by do_page_fault() */
46 42
@@ -81,10 +77,6 @@ void bad_page_fault(struct pt_regs *regs, unsigned long address, int sig)
81 } 77 }
82 78
83 /* kernel has accessed a bad area */ 79 /* kernel has accessed a bad area */
84#if defined(CONFIG_KGDB)
85 if (debugger_kernel_faults)
86 debugger(regs);
87#endif
88 die("kernel access of bad area", regs, sig); 80 die("kernel access of bad area", regs, sig);
89} 81}
90 82
@@ -115,13 +107,6 @@ void do_page_fault(struct pt_regs *regs, unsigned long address,
115 if ((error_code & 0x13) == 0x13 || (error_code & 0x11) == 0x11) 107 if ((error_code & 0x13) == 0x13 || (error_code & 0x11) == 0x11)
116 is_write = 0; 108 is_write = 0;
117 109
118#if defined(CONFIG_KGDB)
119 if (debugger_fault_handler && regs->trap == 0x300) {
120 debugger_fault_handler(regs);
121 return;
122 }
123#endif /* CONFIG_KGDB */
124
125 if (unlikely(in_atomic() || !mm)) { 110 if (unlikely(in_atomic() || !mm)) {
126 if (kernel_mode(regs)) 111 if (kernel_mode(regs))
127 goto bad_area_nosemaphore; 112 goto bad_area_nosemaphore;
@@ -226,7 +211,6 @@ good_area:
226 * make sure we exit gracefully rather than endlessly redo 211 * make sure we exit gracefully rather than endlessly redo
227 * the fault. 212 * the fault.
228 */ 213 */
229survive:
230 fault = handle_mm_fault(mm, vma, address, is_write ? FAULT_FLAG_WRITE : 0); 214 fault = handle_mm_fault(mm, vma, address, is_write ? FAULT_FLAG_WRITE : 0);
231 if (unlikely(fault & VM_FAULT_ERROR)) { 215 if (unlikely(fault & VM_FAULT_ERROR)) {
232 if (fault & VM_FAULT_OOM) 216 if (fault & VM_FAULT_OOM)
diff --git a/arch/microblaze/mm/init.c b/arch/microblaze/mm/init.c
index db5934989926..65eb00419d19 100644
--- a/arch/microblaze/mm/init.c
+++ b/arch/microblaze/mm/init.c
@@ -134,13 +134,8 @@ void __init setup_memory(void)
134 * for 4GB of memory, using 4kB pages), plus 1 page 134 * for 4GB of memory, using 4kB pages), plus 1 page
135 * (in case the address isn't page-aligned). 135 * (in case the address isn't page-aligned).
136 */ 136 */
137#ifndef CONFIG_MMU 137 map_size = init_bootmem_node(NODE_DATA(0),
138 map_size = init_bootmem_node(NODE_DATA(0), PFN_UP(TOPHYS((u32)klimit)),
139 min_low_pfn, max_low_pfn);
140#else
141 map_size = init_bootmem_node(&contig_page_data,
142 PFN_UP(TOPHYS((u32)klimit)), min_low_pfn, max_low_pfn); 138 PFN_UP(TOPHYS((u32)klimit)), min_low_pfn, max_low_pfn);
143#endif
144 memblock_reserve(PFN_UP(TOPHYS((u32)klimit)) << PAGE_SHIFT, map_size); 139 memblock_reserve(PFN_UP(TOPHYS((u32)klimit)) << PAGE_SHIFT, map_size);
145 140
146 /* free bootmem is whole main memory */ 141 /* free bootmem is whole main memory */
diff --git a/arch/mips/Kbuild b/arch/mips/Kbuild
new file mode 100644
index 000000000000..e322d65f33a4
--- /dev/null
+++ b/arch/mips/Kbuild
@@ -0,0 +1,15 @@
1# Fail on warnings - also for files referenced in subdirs
2# -Werror can be disabled for specific files using:
3# CFLAGS_<file.o> := -Wno-error
4subdir-ccflags-y := -Werror
5
6# platform specific definitions
7include arch/mips/Kbuild.platforms
8obj-y := $(platform-y)
9
10# mips object files
11# The object files are linked as core-y files would be linked
12
13obj-y += kernel/
14obj-y += mm/
15obj-y += math-emu/
diff --git a/arch/mips/Kbuild.platforms b/arch/mips/Kbuild.platforms
new file mode 100644
index 000000000000..78439b8a83c4
--- /dev/null
+++ b/arch/mips/Kbuild.platforms
@@ -0,0 +1,32 @@
1# All platforms listed in alphabetic order
2
3platforms += alchemy
4platforms += ar7
5platforms += bcm47xx
6platforms += bcm63xx
7platforms += cavium-octeon
8platforms += cobalt
9platforms += dec
10platforms += emma
11platforms += jazz
12platforms += jz4740
13platforms += lasat
14platforms += loongson
15platforms += mipssim
16platforms += mti-malta
17platforms += pmc-sierra
18platforms += pnx833x
19platforms += pnx8550
20platforms += powertv
21platforms += rb532
22platforms += sgi-ip22
23platforms += sgi-ip27
24platforms += sgi-ip32
25platforms += sibyte
26platforms += sni
27platforms += txx9
28platforms += vr41xx
29platforms += wrppmc
30
31# include the platform specific files
32include $(patsubst %, $(srctree)/arch/mips/%/Platform, $(platforms))
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index cdaae942623d..3ad59dde4852 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -10,6 +10,8 @@ config MIPS
10 select HAVE_DYNAMIC_FTRACE 10 select HAVE_DYNAMIC_FTRACE
11 select HAVE_FTRACE_MCOUNT_RECORD 11 select HAVE_FTRACE_MCOUNT_RECORD
12 select HAVE_FUNCTION_GRAPH_TRACER 12 select HAVE_FUNCTION_GRAPH_TRACER
13 select HAVE_KPROBES
14 select HAVE_KRETPROBES
13 select RTC_LIB if !MACH_LOONGSON 15 select RTC_LIB if !MACH_LOONGSON
14 16
15mainmenu "Linux/MIPS Kernel Configuration" 17mainmenu "Linux/MIPS Kernel Configuration"
@@ -23,8 +25,17 @@ choice
23 prompt "System type" 25 prompt "System type"
24 default SGI_IP22 26 default SGI_IP22
25 27
26config MACH_ALCHEMY 28config MIPS_ALCHEMY
27 bool "Alchemy processor based machines" 29 bool "Alchemy processor based machines"
30 select 64BIT_PHYS_ADDR
31 select CEVT_R4K_LIB
32 select CSRC_R4K_LIB
33 select IRQ_CPU
34 select SYS_HAS_CPU_MIPS32_R1
35 select SYS_SUPPORTS_32BIT_KERNEL
36 select SYS_SUPPORTS_APM_EMULATION
37 select GENERIC_GPIO
38 select ARCH_WANT_OPTIONAL_GPIOLIB
28 select SYS_SUPPORTS_ZBOOT 39 select SYS_SUPPORTS_ZBOOT
29 40
30config AR7 41config AR7
@@ -62,6 +73,7 @@ config BCM47XX
62 select SSB_DRIVER_MIPS 73 select SSB_DRIVER_MIPS
63 select SSB_DRIVER_EXTIF 74 select SSB_DRIVER_EXTIF
64 select SSB_EMBEDDED 75 select SSB_EMBEDDED
76 select SSB_B43_PCI_BRIDGE if PCI
65 select SSB_PCICORE_HOSTMODE if PCI 77 select SSB_PCICORE_HOSTMODE if PCI
66 select GENERIC_GPIO 78 select GENERIC_GPIO
67 select SYS_HAS_EARLY_PRINTK 79 select SYS_HAS_EARLY_PRINTK
@@ -162,6 +174,18 @@ config MACH_JAZZ
162 Members include the Acer PICA, MIPS Magnum 4000, MIPS Millennium and 174 Members include the Acer PICA, MIPS Magnum 4000, MIPS Millennium and
163 Olivetti M700-10 workstations. 175 Olivetti M700-10 workstations.
164 176
177config MACH_JZ4740
178 bool "Ingenic JZ4740 based machines"
179 select SYS_HAS_CPU_MIPS32_R1
180 select SYS_SUPPORTS_32BIT_KERNEL
181 select SYS_SUPPORTS_LITTLE_ENDIAN
182 select DMA_NONCOHERENT
183 select IRQ_CPU
184 select GENERIC_GPIO
185 select ARCH_REQUIRE_GPIOLIB
186 select SYS_HAS_EARLY_PRINTK
187 select HAVE_PWM
188
165config LASAT 189config LASAT
166 bool "LASAT Networks platforms" 190 bool "LASAT Networks platforms"
167 select CEVT_R4K 191 select CEVT_R4K
@@ -686,6 +710,7 @@ endchoice
686source "arch/mips/alchemy/Kconfig" 710source "arch/mips/alchemy/Kconfig"
687source "arch/mips/bcm63xx/Kconfig" 711source "arch/mips/bcm63xx/Kconfig"
688source "arch/mips/jazz/Kconfig" 712source "arch/mips/jazz/Kconfig"
713source "arch/mips/jz4740/Kconfig"
689source "arch/mips/lasat/Kconfig" 714source "arch/mips/lasat/Kconfig"
690source "arch/mips/pmc-sierra/Kconfig" 715source "arch/mips/pmc-sierra/Kconfig"
691source "arch/mips/powertv/Kconfig" 716source "arch/mips/powertv/Kconfig"
@@ -733,10 +758,6 @@ config GENERIC_CLOCKEVENTS
733 bool 758 bool
734 default y 759 default y
735 760
736config GENERIC_TIME
737 bool
738 default y
739
740config GENERIC_CMOS_UPDATE 761config GENERIC_CMOS_UPDATE
741 bool 762 bool
742 default y 763 default y
@@ -892,6 +913,9 @@ config CPU_LITTLE_ENDIAN
892 913
893endchoice 914endchoice
894 915
916config EXPORT_UASM
917 bool
918
895config SYS_SUPPORTS_APM_EMULATION 919config SYS_SUPPORTS_APM_EMULATION
896 bool 920 bool
897 921
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index 0b9c01add0a0..f4a4b663ebb3 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -93,7 +93,8 @@ all-$(CONFIG_SYS_SUPPORTS_ZBOOT)+= vmlinuz
93cflags-y += -G 0 -mno-abicalls -fno-pic -pipe 93cflags-y += -G 0 -mno-abicalls -fno-pic -pipe
94cflags-y += -msoft-float 94cflags-y += -msoft-float
95LDFLAGS_vmlinux += -G 0 -static -n -nostdlib 95LDFLAGS_vmlinux += -G 0 -static -n -nostdlib
96MODFLAGS += -mlong-calls 96KBUILD_AFLAGS_MODULE += -mlong-calls
97KBUILD_CFLAGS_MODULE += -mlong-calls
97 98
98cflags-y += -ffreestanding 99cflags-y += -ffreestanding
99 100
@@ -130,26 +131,6 @@ cflags-$(CONFIG_CPU_R4300) += -march=r4300 -Wa,--trap
130cflags-$(CONFIG_CPU_VR41XX) += -march=r4100 -Wa,--trap 131cflags-$(CONFIG_CPU_VR41XX) += -march=r4100 -Wa,--trap
131cflags-$(CONFIG_CPU_R4X00) += -march=r4600 -Wa,--trap 132cflags-$(CONFIG_CPU_R4X00) += -march=r4600 -Wa,--trap
132cflags-$(CONFIG_CPU_TX49XX) += -march=r4600 -Wa,--trap 133cflags-$(CONFIG_CPU_TX49XX) += -march=r4600 -Wa,--trap
133# only gcc >= 4.4 have the loongson-specific support
134cflags-$(CONFIG_CPU_LOONGSON2) += -Wa,--trap
135cflags-$(CONFIG_CPU_LOONGSON2E) += \
136 $(call cc-option,-march=loongson2e,-march=r4600)
137cflags-$(CONFIG_CPU_LOONGSON2F) += \
138 $(call cc-option,-march=loongson2f,-march=r4600)
139# enable the workarounds for loongson2f
140ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS
141 ifeq ($(call as-option,-Wa$(comma)-mfix-loongson2f-nop,),)
142 $(error only binutils >= 2.20.2 have needed option -mfix-loongson2f-nop)
143 else
144 cflags-$(CONFIG_CPU_NOP_WORKAROUNDS) += -Wa$(comma)-mfix-loongson2f-nop
145 endif
146 ifeq ($(call as-option,-Wa$(comma)-mfix-loongson2f-jump,),)
147 $(error only binutils >= 2.20.2 have needed option -mfix-loongson2f-jump)
148 else
149 cflags-$(CONFIG_CPU_JUMP_WORKAROUNDS) += -Wa$(comma)-mfix-loongson2f-jump
150 endif
151endif
152
153cflags-$(CONFIG_CPU_MIPS32_R1) += $(call cc-option,-march=mips32,-mips32 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \ 134cflags-$(CONFIG_CPU_MIPS32_R1) += $(call cc-option,-march=mips32,-mips32 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \
154 -Wa,-mips32 -Wa,--trap 135 -Wa,-mips32 -Wa,--trap
155cflags-$(CONFIG_CPU_MIPS32_R2) += $(call cc-option,-march=mips32r2,-mips32r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \ 136cflags-$(CONFIG_CPU_MIPS32_R2) += $(call cc-option,-march=mips32r2,-mips32r2 -U_MIPS_ISA -D_MIPS_ISA=_MIPS_ISA_MIPS32) \
@@ -185,7 +166,8 @@ cflags-$(CONFIG_CPU_DADDI_WORKAROUNDS) += $(call cc-option,-mno-daddi,)
185 166
186ifdef CONFIG_CPU_SB1 167ifdef CONFIG_CPU_SB1
187ifdef CONFIG_SB1_PASS_1_WORKAROUNDS 168ifdef CONFIG_SB1_PASS_1_WORKAROUNDS
188MODFLAGS += -msb1-pass1-workarounds 169KBUILD_AFLAGS_MODULE += -msb1-pass1-workarounds
170KBUILD_CFLAGS_MODULE += -msb1-pass1-workarounds
189endif 171endif
190endif 172endif
191 173
@@ -209,455 +191,7 @@ endif
209# 191#
210# Board-dependent options and extra files 192# Board-dependent options and extra files
211# 193#
212 194include $(srctree)/arch/mips/Kbuild.platforms
213#
214# Texas Instruments AR7
215#
216core-$(CONFIG_AR7) += arch/mips/ar7/
217cflags-$(CONFIG_AR7) += -I$(srctree)/arch/mips/include/asm/mach-ar7
218load-$(CONFIG_AR7) += 0xffffffff94100000
219
220#
221# Acer PICA 61, Mips Magnum 4000 and Olivetti M700.
222#
223core-$(CONFIG_MACH_JAZZ) += arch/mips/jazz/
224cflags-$(CONFIG_MACH_JAZZ) += -I$(srctree)/arch/mips/include/asm/mach-jazz
225load-$(CONFIG_MACH_JAZZ) += 0xffffffff80080000
226
227#
228# Common Alchemy Au1x00 stuff
229#
230core-$(CONFIG_SOC_AU1X00) += arch/mips/alchemy/common/
231
232#
233# AMD Alchemy Pb1000 eval board
234#
235core-$(CONFIG_MIPS_PB1000) += arch/mips/alchemy/devboards/
236cflags-$(CONFIG_MIPS_PB1000) += -I$(srctree)/arch/mips/include/asm/mach-pb1x00
237load-$(CONFIG_MIPS_PB1000) += 0xffffffff80100000
238
239#
240# AMD Alchemy Pb1100 eval board
241#
242core-$(CONFIG_MIPS_PB1100) += arch/mips/alchemy/devboards/
243cflags-$(CONFIG_MIPS_PB1100) += -I$(srctree)/arch/mips/include/asm/mach-pb1x00
244load-$(CONFIG_MIPS_PB1100) += 0xffffffff80100000
245
246#
247# AMD Alchemy Pb1500 eval board
248#
249core-$(CONFIG_MIPS_PB1500) += arch/mips/alchemy/devboards/
250cflags-$(CONFIG_MIPS_PB1500) += -I$(srctree)/arch/mips/include/asm/mach-pb1x00
251load-$(CONFIG_MIPS_PB1500) += 0xffffffff80100000
252
253#
254# AMD Alchemy Pb1550 eval board
255#
256core-$(CONFIG_MIPS_PB1550) += arch/mips/alchemy/devboards/
257cflags-$(CONFIG_MIPS_PB1550) += -I$(srctree)/arch/mips/include/asm/mach-pb1x00
258load-$(CONFIG_MIPS_PB1550) += 0xffffffff80100000
259
260#
261# AMD Alchemy Pb1200 eval board
262#
263core-$(CONFIG_MIPS_PB1200) += arch/mips/alchemy/devboards/
264cflags-$(CONFIG_MIPS_PB1200) += -I$(srctree)/arch/mips/include/asm/mach-pb1x00
265load-$(CONFIG_MIPS_PB1200) += 0xffffffff80100000
266
267#
268# AMD Alchemy Db1000 eval board
269#
270core-$(CONFIG_MIPS_DB1000) += arch/mips/alchemy/devboards/
271cflags-$(CONFIG_MIPS_DB1000) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
272load-$(CONFIG_MIPS_DB1000) += 0xffffffff80100000
273
274#
275# AMD Alchemy Db1100 eval board
276#
277core-$(CONFIG_MIPS_DB1100) += arch/mips/alchemy/devboards/
278cflags-$(CONFIG_MIPS_DB1100) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
279load-$(CONFIG_MIPS_DB1100) += 0xffffffff80100000
280
281#
282# AMD Alchemy Db1500 eval board
283#
284core-$(CONFIG_MIPS_DB1500) += arch/mips/alchemy/devboards/
285cflags-$(CONFIG_MIPS_DB1500) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
286load-$(CONFIG_MIPS_DB1500) += 0xffffffff80100000
287
288#
289# AMD Alchemy Db1550 eval board
290#
291core-$(CONFIG_MIPS_DB1550) += arch/mips/alchemy/devboards/
292cflags-$(CONFIG_MIPS_DB1550) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
293load-$(CONFIG_MIPS_DB1550) += 0xffffffff80100000
294
295#
296# AMD Alchemy Db1200 eval board
297#
298core-$(CONFIG_MIPS_DB1200) += arch/mips/alchemy/devboards/
299cflags-$(CONFIG_MIPS_DB1200) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
300load-$(CONFIG_MIPS_DB1200) += 0xffffffff80100000
301
302#
303# AMD Alchemy Bosporus eval board
304#
305core-$(CONFIG_MIPS_BOSPORUS) += arch/mips/alchemy/devboards/
306cflags-$(CONFIG_MIPS_BOSPORUS) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
307load-$(CONFIG_MIPS_BOSPORUS) += 0xffffffff80100000
308
309#
310# AMD Alchemy Mirage eval board
311#
312core-$(CONFIG_MIPS_MIRAGE) += arch/mips/alchemy/devboards/
313cflags-$(CONFIG_MIPS_MIRAGE) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
314load-$(CONFIG_MIPS_MIRAGE) += 0xffffffff80100000
315
316#
317# 4G-Systems eval board
318#
319libs-$(CONFIG_MIPS_MTX1) += arch/mips/alchemy/mtx-1/
320load-$(CONFIG_MIPS_MTX1) += 0xffffffff80100000
321
322#
323# MyCable eval board
324#
325libs-$(CONFIG_MIPS_XXS1500) += arch/mips/alchemy/xxs1500/
326load-$(CONFIG_MIPS_XXS1500) += 0xffffffff80100000
327
328# must be last for Alchemy systems for GPIO to work properly
329cflags-$(CONFIG_SOC_AU1X00) += -I$(srctree)/arch/mips/include/asm/mach-au1x00
330
331
332#
333# Cobalt Server
334#
335core-$(CONFIG_MIPS_COBALT) += arch/mips/cobalt/
336cflags-$(CONFIG_MIPS_COBALT) += -I$(srctree)/arch/mips/include/asm/mach-cobalt
337load-$(CONFIG_MIPS_COBALT) += 0xffffffff80080000
338
339#
340# DECstation family
341#
342core-$(CONFIG_MACH_DECSTATION) += arch/mips/dec/
343cflags-$(CONFIG_MACH_DECSTATION)+= -I$(srctree)/arch/mips/include/asm/mach-dec
344libs-$(CONFIG_MACH_DECSTATION) += arch/mips/dec/prom/
345load-$(CONFIG_MACH_DECSTATION) += 0xffffffff80040000
346
347#
348# Wind River PPMC Board (4KC + GT64120)
349#
350core-$(CONFIG_WR_PPMC) += arch/mips/gt64120/wrppmc/
351cflags-$(CONFIG_WR_PPMC) += -I$(srctree)/arch/mips/include/asm/mach-wrppmc
352load-$(CONFIG_WR_PPMC) += 0xffffffff80100000
353
354#
355# Loongson family
356#
357core-$(CONFIG_MACH_LOONGSON) += arch/mips/loongson/
358cflags-$(CONFIG_MACH_LOONGSON) += -I$(srctree)/arch/mips/include/asm/mach-loongson \
359 -mno-branch-likely
360load-$(CONFIG_LEMOTE_FULOONG2E) += 0xffffffff80100000
361load-$(CONFIG_LEMOTE_MACH2F) += 0xffffffff80200000
362
363#
364# MIPS Malta board
365#
366core-$(CONFIG_MIPS_MALTA) += arch/mips/mti-malta/
367cflags-$(CONFIG_MIPS_MALTA) += -I$(srctree)/arch/mips/include/asm/mach-malta
368load-$(CONFIG_MIPS_MALTA) += 0xffffffff80100000
369all-$(CONFIG_MIPS_MALTA) := $(COMPRESSION_FNAME).bin
370
371#
372# MIPS SIM
373#
374core-$(CONFIG_MIPS_SIM) += arch/mips/mipssim/
375cflags-$(CONFIG_MIPS_SIM) += -I$(srctree)/arch/mips/include/asm/mach-mipssim
376load-$(CONFIG_MIPS_SIM) += 0x80100000
377
378#
379# PMC-Sierra MSP SOCs
380#
381core-$(CONFIG_PMC_MSP) += arch/mips/pmc-sierra/msp71xx/
382cflags-$(CONFIG_PMC_MSP) += -I$(srctree)/arch/mips/include/asm/pmc-sierra/msp71xx \
383 -mno-branch-likely
384load-$(CONFIG_PMC_MSP) += 0xffffffff80100000
385
386#
387# PMC-Sierra Yosemite
388#
389core-$(CONFIG_PMC_YOSEMITE) += arch/mips/pmc-sierra/yosemite/
390cflags-$(CONFIG_PMC_YOSEMITE) += -I$(srctree)/arch/mips/include/asm/mach-yosemite
391load-$(CONFIG_PMC_YOSEMITE) += 0xffffffff80100000
392
393#
394# LASAT platforms
395#
396core-$(CONFIG_LASAT) += arch/mips/lasat/
397cflags-$(CONFIG_LASAT) += -I$(srctree)/arch/mips/include/asm/mach-lasat
398load-$(CONFIG_LASAT) += 0xffffffff80000000
399
400#
401# Common VR41xx
402#
403core-$(CONFIG_MACH_VR41XX) += arch/mips/vr41xx/common/
404cflags-$(CONFIG_MACH_VR41XX) += -I$(srctree)/arch/mips/include/asm/mach-vr41xx
405
406#
407# ZAO Networks Capcella (VR4131)
408#
409load-$(CONFIG_ZAO_CAPCELLA) += 0xffffffff80000000
410
411#
412# Victor MP-C303/304 (VR4122)
413#
414load-$(CONFIG_VICTOR_MPC30X) += 0xffffffff80001000
415
416#
417# IBM WorkPad z50 (VR4121)
418#
419core-$(CONFIG_IBM_WORKPAD) += arch/mips/vr41xx/ibm-workpad/
420load-$(CONFIG_IBM_WORKPAD) += 0xffffffff80004000
421
422#
423# CASIO CASSIPEIA E-55/65 (VR4111)
424#
425core-$(CONFIG_CASIO_E55) += arch/mips/vr41xx/casio-e55/
426load-$(CONFIG_CASIO_E55) += 0xffffffff80004000
427
428#
429# TANBAC VR4131 multichip module(TB0225) and TANBAC VR4131DIMM(TB0229) (VR4131)
430#
431load-$(CONFIG_TANBAC_TB022X) += 0xffffffff80000000
432
433# NXP STB225
434core-$(CONFIG_SOC_PNX833X) += arch/mips/nxp/pnx833x/common/
435cflags-$(CONFIG_SOC_PNX833X) += -Iarch/mips/include/asm/mach-pnx833x
436libs-$(CONFIG_NXP_STB220) += arch/mips/nxp/pnx833x/stb22x/
437load-$(CONFIG_NXP_STB220) += 0xffffffff80001000
438libs-$(CONFIG_NXP_STB225) += arch/mips/nxp/pnx833x/stb22x/
439load-$(CONFIG_NXP_STB225) += 0xffffffff80001000
440
441#
442# Common NXP PNX8550
443#
444core-$(CONFIG_SOC_PNX8550) += arch/mips/nxp/pnx8550/common/
445cflags-$(CONFIG_SOC_PNX8550) += -I$(srctree)/arch/mips/include/asm/mach-pnx8550
446
447#
448# NXP PNX8550 JBS board
449#
450libs-$(CONFIG_PNX8550_JBS) += arch/mips/nxp/pnx8550/jbs/
451#cflags-$(CONFIG_PNX8550_JBS) += -I$(srctree)/arch/mips/include/asm/mach-pnx8550
452load-$(CONFIG_PNX8550_JBS) += 0xffffffff80060000
453
454# NXP PNX8550 STB810 board
455#
456libs-$(CONFIG_PNX8550_STB810) += arch/mips/nxp/pnx8550/stb810/
457load-$(CONFIG_PNX8550_STB810) += 0xffffffff80060000
458
459#
460# Common NEC EMMAXXX
461#
462core-$(CONFIG_SOC_EMMA2RH) += arch/mips/emma/common/
463cflags-$(CONFIG_SOC_EMMA2RH) += -I$(srctree)/arch/mips/include/asm/mach-emma2rh
464
465#
466# NEC EMMA2RH Mark-eins
467#
468core-$(CONFIG_NEC_MARKEINS) += arch/mips/emma/markeins/
469load-$(CONFIG_NEC_MARKEINS) += 0xffffffff88100000
470
471#
472# Cisco PowerTV Platform
473#
474core-$(CONFIG_POWERTV) += arch/mips/powertv/
475cflags-$(CONFIG_POWERTV) += -I$(srctree)/arch/mips/include/asm/mach-powertv
476load-$(CONFIG_POWERTV) += 0xffffffff90800000
477
478#
479# SGI IP22 (Indy/Indigo2)
480#
481# Set the load address to >= 0xffffffff88069000 if you want to leave space for
482# symmon, 0xffffffff80002000 for production kernels. Note that the value must
483# be aligned to a multiple of the kernel stack size or the handling of the
484# current variable will break so for 64-bit kernels we have to raise the start
485# address by 8kb.
486#
487core-$(CONFIG_SGI_IP22) += arch/mips/sgi-ip22/
488cflags-$(CONFIG_SGI_IP22) += -I$(srctree)/arch/mips/include/asm/mach-ip22
489ifdef CONFIG_32BIT
490load-$(CONFIG_SGI_IP22) += 0xffffffff88002000
491endif
492ifdef CONFIG_64BIT
493load-$(CONFIG_SGI_IP22) += 0xffffffff88004000
494endif
495
496#
497# SGI-IP27 (Origin200/2000)
498#
499# Set the load address to >= 0xc000000000300000 if you want to leave space for
500# symmon, 0xc00000000001c000 for production kernels. Note that the value must
501# be 16kb aligned or the handling of the current variable will break.
502#
503ifdef CONFIG_SGI_IP27
504core-$(CONFIG_SGI_IP27) += arch/mips/sgi-ip27/
505cflags-$(CONFIG_SGI_IP27) += -I$(srctree)/arch/mips/include/asm/mach-ip27
506ifdef CONFIG_MAPPED_KERNEL
507load-$(CONFIG_SGI_IP27) += 0xc00000004001c000
508OBJCOPYFLAGS := --change-addresses=0x3fffffff80000000
509dataoffset-$(CONFIG_SGI_IP27) += 0x01000000
510else
511load-$(CONFIG_SGI_IP27) += 0xa80000000001c000
512OBJCOPYFLAGS := --change-addresses=0x57ffffff80000000
513endif
514endif
515
516#
517# SGI IP28 (Indigo2 R10k)
518#
519# Set the load address to >= 0xa800000020080000 if you want to leave space for
520# symmon, 0xa800000020004000 for production kernels ? Note that the value must
521# be 16kb aligned or the handling of the current variable will break.
522# Simplified: what IP22 does at 128MB+ in ksegN, IP28 does at 512MB+ in xkphys
523#
524ifdef CONFIG_SGI_IP28
525 ifeq ($(call cc-option-yn,-mr10k-cache-barrier=store), n)
526 $(error gcc doesn't support needed option -mr10k-cache-barrier=store)
527 endif
528endif
529core-$(CONFIG_SGI_IP28) += arch/mips/sgi-ip22/
530cflags-$(CONFIG_SGI_IP28) += -mr10k-cache-barrier=store -I$(srctree)/arch/mips/include/asm/mach-ip28
531load-$(CONFIG_SGI_IP28) += 0xa800000020004000
532
533#
534# SGI-IP32 (O2)
535#
536# Set the load address to >= 80069000 if you want to leave space for symmon,
537# 0xffffffff80004000 for production kernels. Note that the value must be aligned to
538# a multiple of the kernel stack size or the handling of the current variable
539# will break.
540#
541core-$(CONFIG_SGI_IP32) += arch/mips/sgi-ip32/
542cflags-$(CONFIG_SGI_IP32) += -I$(srctree)/arch/mips/include/asm/mach-ip32
543load-$(CONFIG_SGI_IP32) += 0xffffffff80004000
544
545#
546# Sibyte SB1250/BCM1480 SOC
547#
548# This is a LIB so that it links at the end, and initcalls are later
549# the sequence; but it is built as an object so that modules don't get
550# removed (as happens, even if they have __initcall/module_init)
551#
552core-$(CONFIG_SIBYTE_BCM112X) += arch/mips/sibyte/sb1250/
553core-$(CONFIG_SIBYTE_BCM112X) += arch/mips/sibyte/common/
554cflags-$(CONFIG_SIBYTE_BCM112X) += -I$(srctree)/arch/mips/include/asm/mach-sibyte \
555 -DSIBYTE_HDR_FEATURES=SIBYTE_HDR_FMASK_1250_112x_ALL
556
557core-$(CONFIG_SIBYTE_SB1250) += arch/mips/sibyte/sb1250/
558core-$(CONFIG_SIBYTE_SB1250) += arch/mips/sibyte/common/
559cflags-$(CONFIG_SIBYTE_SB1250) += -I$(srctree)/arch/mips/include/asm/mach-sibyte \
560 -DSIBYTE_HDR_FEATURES=SIBYTE_HDR_FMASK_1250_112x_ALL
561
562core-$(CONFIG_SIBYTE_BCM1x55) += arch/mips/sibyte/bcm1480/
563core-$(CONFIG_SIBYTE_BCM1x55) += arch/mips/sibyte/common/
564cflags-$(CONFIG_SIBYTE_BCM1x55) += -I$(srctree)/arch/mips/include/asm/mach-sibyte \
565 -DSIBYTE_HDR_FEATURES=SIBYTE_HDR_FMASK_1480_ALL
566
567core-$(CONFIG_SIBYTE_BCM1x80) += arch/mips/sibyte/bcm1480/
568core-$(CONFIG_SIBYTE_BCM1x80) += arch/mips/sibyte/common/
569cflags-$(CONFIG_SIBYTE_BCM1x80) += -I$(srctree)/arch/mips/include/asm/mach-sibyte \
570 -DSIBYTE_HDR_FEATURES=SIBYTE_HDR_FMASK_1480_ALL
571
572#
573# Sibyte BCM91120x (Carmel) board
574# Sibyte BCM91120C (CRhine) board
575# Sibyte BCM91125C (CRhone) board
576# Sibyte BCM91125E (Rhone) board
577# Sibyte SWARM board
578# Sibyte BCM91x80 (BigSur) board
579#
580core-$(CONFIG_SIBYTE_CARMEL) += arch/mips/sibyte/swarm/
581load-$(CONFIG_SIBYTE_CARMEL) := 0xffffffff80100000
582core-$(CONFIG_SIBYTE_CRHINE) += arch/mips/sibyte/swarm/
583load-$(CONFIG_SIBYTE_CRHINE) := 0xffffffff80100000
584core-$(CONFIG_SIBYTE_CRHONE) += arch/mips/sibyte/swarm/
585load-$(CONFIG_SIBYTE_CRHONE) := 0xffffffff80100000
586core-$(CONFIG_SIBYTE_RHONE) += arch/mips/sibyte/swarm/
587load-$(CONFIG_SIBYTE_RHONE) := 0xffffffff80100000
588core-$(CONFIG_SIBYTE_SENTOSA) += arch/mips/sibyte/swarm/
589load-$(CONFIG_SIBYTE_SENTOSA) := 0xffffffff80100000
590core-$(CONFIG_SIBYTE_SWARM) += arch/mips/sibyte/swarm/
591load-$(CONFIG_SIBYTE_SWARM) := 0xffffffff80100000
592core-$(CONFIG_SIBYTE_BIGSUR) += arch/mips/sibyte/swarm/
593load-$(CONFIG_SIBYTE_BIGSUR) := 0xffffffff80100000
594
595#
596# Broadcom BCM47XX boards
597#
598core-$(CONFIG_BCM47XX) += arch/mips/bcm47xx/
599cflags-$(CONFIG_BCM47XX) += -I$(srctree)/arch/mips/include/asm/mach-bcm47xx
600load-$(CONFIG_BCM47XX) := 0xffffffff80001000
601
602#
603# Broadcom BCM63XX boards
604#
605core-$(CONFIG_BCM63XX) += arch/mips/bcm63xx/
606cflags-$(CONFIG_BCM63XX) += -I$(srctree)/arch/mips/include/asm/mach-bcm63xx/
607load-$(CONFIG_BCM63XX) := 0xffffffff80010000
608
609#
610# SNI RM
611#
612core-$(CONFIG_SNI_RM) += arch/mips/sni/
613cflags-$(CONFIG_SNI_RM) += -I$(srctree)/arch/mips/include/asm/mach-rm
614ifdef CONFIG_CPU_LITTLE_ENDIAN
615load-$(CONFIG_SNI_RM) += 0xffffffff80600000
616else
617load-$(CONFIG_SNI_RM) += 0xffffffff80030000
618endif
619all-$(CONFIG_SNI_RM) := $(COMPRESSION_FNAME).ecoff
620
621#
622# Common TXx9
623#
624core-$(CONFIG_MACH_TX39XX) += arch/mips/txx9/generic/
625cflags-$(CONFIG_MACH_TX39XX) += -I$(srctree)/arch/mips/include/asm/mach-tx39xx
626load-$(CONFIG_MACH_TX39XX) += 0xffffffff80050000
627core-$(CONFIG_MACH_TX49XX) += arch/mips/txx9/generic/
628cflags-$(CONFIG_MACH_TX49XX) += -I$(srctree)/arch/mips/include/asm/mach-tx49xx
629load-$(CONFIG_MACH_TX49XX) += 0xffffffff80100000
630
631#
632# Toshiba JMR-TX3927 board
633#
634core-$(CONFIG_TOSHIBA_JMR3927) += arch/mips/txx9/jmr3927/
635
636#
637# Routerboard 532 board
638#
639core-$(CONFIG_MIKROTIK_RB532) += arch/mips/rb532/
640cflags-$(CONFIG_MIKROTIK_RB532) += -I$(srctree)/arch/mips/include/asm/mach-rc32434
641load-$(CONFIG_MIKROTIK_RB532) += 0xffffffff80101000
642
643#
644# Toshiba RBTX49XX boards
645#
646core-$(CONFIG_TOSHIBA_RBTX4927) += arch/mips/txx9/rbtx4927/
647core-$(CONFIG_TOSHIBA_RBTX4938) += arch/mips/txx9/rbtx4938/
648core-$(CONFIG_TOSHIBA_RBTX4939) += arch/mips/txx9/rbtx4939/
649
650#
651# Cavium Octeon
652#
653core-$(CONFIG_CPU_CAVIUM_OCTEON) += arch/mips/cavium-octeon/
654cflags-$(CONFIG_CPU_CAVIUM_OCTEON) += -I$(srctree)/arch/mips/include/asm/mach-cavium-octeon
655core-$(CONFIG_CPU_CAVIUM_OCTEON) += arch/mips/cavium-octeon/executive/
656ifdef CONFIG_CAVIUM_OCTEON_2ND_KERNEL
657load-$(CONFIG_CPU_CAVIUM_OCTEON) += 0xffffffff84100000
658else
659load-$(CONFIG_CPU_CAVIUM_OCTEON) += 0xffffffff81100000
660endif
661 195
662cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic 196cflags-y += -I$(srctree)/arch/mips/include/asm/mach-generic
663drivers-$(CONFIG_PCI) += arch/mips/pci/ 197drivers-$(CONFIG_PCI) += arch/mips/pci/
@@ -706,7 +240,8 @@ head-y := arch/mips/kernel/head.o arch/mips/kernel/init_task.o
706 240
707libs-y += arch/mips/lib/ 241libs-y += arch/mips/lib/
708 242
709core-y += arch/mips/kernel/ arch/mips/mm/ arch/mips/math-emu/ 243# See arch/mips/Kbuild for content of core part of the kernel
244core-y += arch/mips/
710 245
711drivers-$(CONFIG_OPROFILE) += arch/mips/oprofile/ 246drivers-$(CONFIG_OPROFILE) += arch/mips/oprofile/
712 247
@@ -726,6 +261,9 @@ endif
726vmlinux.32: vmlinux 261vmlinux.32: vmlinux
727 $(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@ 262 $(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@
728 263
264
265#obj-$(CONFIG_KPROBES) += kprobes.o
266
729# 267#
730# The 64-bit ELF tools are pretty broken so at this time we generate 64-bit 268# The 64-bit ELF tools are pretty broken so at this time we generate 64-bit
731# ELF files from 32-bit files by conversion. 269# ELF files from 32-bit files by conversion.
@@ -733,35 +271,19 @@ vmlinux.32: vmlinux
733vmlinux.64: vmlinux 271vmlinux.64: vmlinux
734 $(OBJCOPY) -O $(64bit-bfd) $(OBJCOPYFLAGS) $< $@ 272 $(OBJCOPY) -O $(64bit-bfd) $(OBJCOPYFLAGS) $< $@
735 273
736makeboot =$(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) $(1)
737makezboot =$(Q)$(MAKE) $(build)=arch/mips/boot/compressed \
738 VMLINUX_LOAD_ADDRESS=$(load-y) 32bit-bfd=$(32bit-bfd) $(1)
739
740all: $(all-y) 274all: $(all-y)
741 275
742vmlinuz: vmlinux FORCE 276# boot
743 +@$(call makezboot,$@) 277vmlinux.bin vmlinux.ecoff vmlinux.srec: $(vmlinux-32) FORCE
278 $(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) arch/mips/boot/$@
744 279
745vmlinuz.bin: vmlinux 280# boot/compressed
746 +@$(call makezboot,$@) 281vmlinuz vmlinuz.bin vmlinuz.ecoff vmlinuz.srec: $(vmlinux-32) FORCE
282 $(Q)$(MAKE) $(build)=arch/mips/boot/compressed \
283 VMLINUX_LOAD_ADDRESS=$(load-y) 32bit-bfd=$(32bit-bfd) $@
747 284
748vmlinuz.ecoff: vmlinux
749 +@$(call makezboot,$@)
750 285
751vmlinuz.srec: vmlinux 286CLEAN_FILES += vmlinux.32 vmlinux.64
752 +@$(call makezboot,$@)
753
754vmlinux.bin: $(vmlinux-32)
755 +@$(call makeboot,$@)
756
757vmlinux.ecoff: $(vmlinux-32)
758 +@$(call makeboot,$@)
759
760vmlinux.srec: $(vmlinux-32)
761 +@$(call makeboot,$@)
762
763CLEAN_FILES += vmlinux.ecoff \
764 vmlinux.srec
765 287
766archprepare: 288archprepare:
767ifdef CONFIG_MIPS32_N32 289ifdef CONFIG_MIPS32_N32
@@ -780,9 +302,9 @@ install:
780 $(Q)install -D -m 644 System.map $(INSTALL_PATH)/System.map-$(KERNELRELEASE) 302 $(Q)install -D -m 644 System.map $(INSTALL_PATH)/System.map-$(KERNELRELEASE)
781 303
782archclean: 304archclean:
783 @$(MAKE) $(clean)=arch/mips/boot 305 $(Q)$(MAKE) $(clean)=arch/mips/boot
784 @$(MAKE) $(clean)=arch/mips/boot/compressed 306 $(Q)$(MAKE) $(clean)=arch/mips/boot/compressed
785 @$(MAKE) $(clean)=arch/mips/lasat 307 $(Q)$(MAKE) $(clean)=arch/mips/lasat
786 308
787define archhelp 309define archhelp
788 echo ' install - install kernel into $(INSTALL_PATH)' 310 echo ' install - install kernel into $(INSTALL_PATH)'
@@ -796,11 +318,3 @@ define archhelp
796 echo 318 echo
797 echo ' These will be default as apropriate for a configured platform.' 319 echo ' These will be default as apropriate for a configured platform.'
798endef 320endef
799
800CLEAN_FILES += vmlinux.32 \
801 vmlinux.64 \
802 vmlinux.ecoff \
803 vmlinuz \
804 vmlinuz.ecoff \
805 vmlinuz.bin \
806 vmlinuz.srec
diff --git a/arch/mips/alchemy/Kconfig b/arch/mips/alchemy/Kconfig
index df3b1a7eb15d..2ccfd4a135bc 100644
--- a/arch/mips/alchemy/Kconfig
+++ b/arch/mips/alchemy/Kconfig
@@ -11,7 +11,7 @@ config ALCHEMY_GPIO_INDIRECT
11 11
12choice 12choice
13 prompt "Machine type" 13 prompt "Machine type"
14 depends on MACH_ALCHEMY 14 depends on MIPS_ALCHEMY
15 default MIPS_DB1000 15 default MIPS_DB1000
16 16
17config MIPS_MTX1 17config MIPS_MTX1
@@ -128,41 +128,33 @@ config MIPS_XXS1500
128 select SYS_SUPPORTS_LITTLE_ENDIAN 128 select SYS_SUPPORTS_LITTLE_ENDIAN
129 select SYS_HAS_EARLY_PRINTK 129 select SYS_HAS_EARLY_PRINTK
130 130
131config MIPS_GPR
132 bool "Trapeze ITS GPR board"
133 select SOC_AU1550
134 select HW_HAS_PCI
135 select DMA_NONCOHERENT
136 select MIPS_DISABLE_OBSOLETE_IDE
137 select SYS_SUPPORTS_LITTLE_ENDIAN
138 select SYS_HAS_EARLY_PRINTK
139
131endchoice 140endchoice
132 141
133config SOC_AU1000 142config SOC_AU1000
134 bool 143 bool
135 select SOC_AU1X00
136 select ALCHEMY_GPIOINT_AU1000 144 select ALCHEMY_GPIOINT_AU1000
137 145
138config SOC_AU1100 146config SOC_AU1100
139 bool 147 bool
140 select SOC_AU1X00
141 select ALCHEMY_GPIOINT_AU1000 148 select ALCHEMY_GPIOINT_AU1000
142 149
143config SOC_AU1500 150config SOC_AU1500
144 bool 151 bool
145 select SOC_AU1X00
146 select ALCHEMY_GPIOINT_AU1000 152 select ALCHEMY_GPIOINT_AU1000
147 153
148config SOC_AU1550 154config SOC_AU1550
149 bool 155 bool
150 select SOC_AU1X00
151 select ALCHEMY_GPIOINT_AU1000 156 select ALCHEMY_GPIOINT_AU1000
152 157
153config SOC_AU1200 158config SOC_AU1200
154 bool 159 bool
155 select SOC_AU1X00
156 select ALCHEMY_GPIOINT_AU1000 160 select ALCHEMY_GPIOINT_AU1000
157
158config SOC_AU1X00
159 bool
160 select 64BIT_PHYS_ADDR
161 select CEVT_R4K_LIB
162 select CSRC_R4K_LIB
163 select IRQ_CPU
164 select SYS_HAS_CPU_MIPS32_R1
165 select SYS_SUPPORTS_32BIT_KERNEL
166 select SYS_SUPPORTS_APM_EMULATION
167 select GENERIC_GPIO
168 select ARCH_WANT_OPTIONAL_GPIOLIB
diff --git a/arch/mips/alchemy/Platform b/arch/mips/alchemy/Platform
new file mode 100644
index 000000000000..96e9e41f1b2a
--- /dev/null
+++ b/arch/mips/alchemy/Platform
@@ -0,0 +1,114 @@
1#
2# Core Alchemy code
3#
4platform-$(CONFIG_MIPS_ALCHEMY) += alchemy/common/
5
6
7#
8# AMD Alchemy Pb1000 eval board
9#
10platform-$(CONFIG_MIPS_PB1000) += alchemy/devboards/
11cflags-$(CONFIG_MIPS_PB1000) += -I$(srctree)/arch/mips/include/asm/mach-pb1x00
12load-$(CONFIG_MIPS_PB1000) += 0xffffffff80100000
13
14#
15# AMD Alchemy Pb1100 eval board
16#
17platform-$(CONFIG_MIPS_PB1100) += alchemy/devboards/
18cflags-$(CONFIG_MIPS_PB1100) += -I$(srctree)/arch/mips/include/asm/mach-pb1x00
19load-$(CONFIG_MIPS_PB1100) += 0xffffffff80100000
20
21#
22# AMD Alchemy Pb1500 eval board
23#
24platform-$(CONFIG_MIPS_PB1500) += alchemy/devboards/
25cflags-$(CONFIG_MIPS_PB1500) += -I$(srctree)/arch/mips/include/asm/mach-pb1x00
26load-$(CONFIG_MIPS_PB1500) += 0xffffffff80100000
27
28#
29# AMD Alchemy Pb1550 eval board
30#
31platform-$(CONFIG_MIPS_PB1550) += alchemy/devboards/
32cflags-$(CONFIG_MIPS_PB1550) += -I$(srctree)/arch/mips/include/asm/mach-pb1x00
33load-$(CONFIG_MIPS_PB1550) += 0xffffffff80100000
34
35#
36# AMD Alchemy Pb1200 eval board
37#
38platform-$(CONFIG_MIPS_PB1200) += alchemy/devboards/
39cflags-$(CONFIG_MIPS_PB1200) += -I$(srctree)/arch/mips/include/asm/mach-pb1x00
40load-$(CONFIG_MIPS_PB1200) += 0xffffffff80100000
41
42#
43# AMD Alchemy Db1000 eval board
44#
45platform-$(CONFIG_MIPS_DB1000) += alchemy/devboards/
46cflags-$(CONFIG_MIPS_DB1000) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
47load-$(CONFIG_MIPS_DB1000) += 0xffffffff80100000
48
49#
50# AMD Alchemy Db1100 eval board
51#
52platform-$(CONFIG_MIPS_DB1100) += alchemy/devboards/
53cflags-$(CONFIG_MIPS_DB1100) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
54load-$(CONFIG_MIPS_DB1100) += 0xffffffff80100000
55
56#
57# AMD Alchemy Db1500 eval board
58#
59platform-$(CONFIG_MIPS_DB1500) += alchemy/devboards/
60cflags-$(CONFIG_MIPS_DB1500) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
61load-$(CONFIG_MIPS_DB1500) += 0xffffffff80100000
62
63#
64# AMD Alchemy Db1550 eval board
65#
66platform-$(CONFIG_MIPS_DB1550) += alchemy/devboards/
67cflags-$(CONFIG_MIPS_DB1550) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
68load-$(CONFIG_MIPS_DB1550) += 0xffffffff80100000
69
70#
71# AMD Alchemy Db1200 eval board
72#
73platform-$(CONFIG_MIPS_DB1200) += alchemy/devboards/
74cflags-$(CONFIG_MIPS_DB1200) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
75load-$(CONFIG_MIPS_DB1200) += 0xffffffff80100000
76
77#
78# AMD Alchemy Bosporus eval board
79#
80platform-$(CONFIG_MIPS_BOSPORUS) += alchemy/devboards/
81cflags-$(CONFIG_MIPS_BOSPORUS) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
82load-$(CONFIG_MIPS_BOSPORUS) += 0xffffffff80100000
83
84#
85# AMD Alchemy Mirage eval board
86#
87platform-$(CONFIG_MIPS_MIRAGE) += alchemy/devboards/
88cflags-$(CONFIG_MIPS_MIRAGE) += -I$(srctree)/arch/mips/include/asm/mach-db1x00
89load-$(CONFIG_MIPS_MIRAGE) += 0xffffffff80100000
90
91#
92# 4G-Systems eval board
93#
94platform-$(CONFIG_MIPS_MTX1) += alchemy/mtx-1/
95load-$(CONFIG_MIPS_MTX1) += 0xffffffff80100000
96
97#
98# MyCable eval board
99#
100platform-$(CONFIG_MIPS_XXS1500) += alchemy/xxs1500/
101load-$(CONFIG_MIPS_XXS1500) += 0xffffffff80100000
102
103#
104# Trapeze ITS GRP board
105#
106platform-$(CONFIG_MIPS_GPR) += alchemy/gpr/
107load-$(CONFIG_MIPS_GPR) += 0xffffffff80100000
108
109# boards can specify their own <gpio.h> in one of their include dirs.
110# If they do, placing this line here at the end will make sure the
111# compiler picks the board one. If they don't, it will make sure
112# the alchemy generic gpio header is picked up.
113
114cflags-$(CONFIG_MIPS_ALCHEMY) += -I$(srctree)/arch/mips/include/asm/mach-au1x00
diff --git a/arch/mips/alchemy/common/Makefile b/arch/mips/alchemy/common/Makefile
index 06c0e65a54b5..27811fe341d6 100644
--- a/arch/mips/alchemy/common/Makefile
+++ b/arch/mips/alchemy/common/Makefile
@@ -18,5 +18,3 @@ ifeq ($(CONFIG_ALCHEMY_GPIO_INDIRECT),)
18endif 18endif
19 19
20obj-$(CONFIG_PCI) += pci.o 20obj-$(CONFIG_PCI) += pci.o
21
22EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/alchemy/common/clocks.c b/arch/mips/alchemy/common/clocks.c
index 460c6285c1bb..af0fe41055af 100644
--- a/arch/mips/alchemy/common/clocks.c
+++ b/arch/mips/alchemy/common/clocks.c
@@ -89,11 +89,7 @@ unsigned long au1xxx_calc_clock(void)
89 * over backwards trying to determine the frequency. 89 * over backwards trying to determine the frequency.
90 */ 90 */
91 if (au1xxx_cpu_has_pll_wo()) 91 if (au1xxx_cpu_has_pll_wo())
92#ifdef CONFIG_SOC_AU1000_FREQUENCY
93 cpu_speed = CONFIG_SOC_AU1000_FREQUENCY;
94#else
95 cpu_speed = 396000000; 92 cpu_speed = 396000000;
96#endif
97 else 93 else
98 cpu_speed = (au_readl(SYS_CPUPLL) & 0x0000003f) * AU1000_SRC_CLK; 94 cpu_speed = (au_readl(SYS_CPUPLL) & 0x0000003f) * AU1000_SRC_CLK;
99 95
diff --git a/arch/mips/alchemy/common/platform.c b/arch/mips/alchemy/common/platform.c
index f9e5622ebc95..1dc55ee2681b 100644
--- a/arch/mips/alchemy/common/platform.c
+++ b/arch/mips/alchemy/common/platform.c
@@ -12,6 +12,7 @@
12 */ 12 */
13 13
14#include <linux/dma-mapping.h> 14#include <linux/dma-mapping.h>
15#include <linux/etherdevice.h>
15#include <linux/platform_device.h> 16#include <linux/platform_device.h>
16#include <linux/serial_8250.h> 17#include <linux/serial_8250.h>
17#include <linux/init.h> 18#include <linux/init.h>
@@ -21,6 +22,8 @@
21#include <asm/mach-au1x00/au1100_mmc.h> 22#include <asm/mach-au1x00/au1100_mmc.h>
22#include <asm/mach-au1x00/au1xxx_eth.h> 23#include <asm/mach-au1x00/au1xxx_eth.h>
23 24
25#include <prom.h>
26
24#define PORT(_base, _irq) \ 27#define PORT(_base, _irq) \
25 { \ 28 { \
26 .mapbase = _base, \ 29 .mapbase = _base, \
@@ -33,7 +36,6 @@
33 } 36 }
34 37
35static struct plat_serial8250_port au1x00_uart_data[] = { 38static struct plat_serial8250_port au1x00_uart_data[] = {
36#if defined(CONFIG_SERIAL_8250_AU1X00)
37#if defined(CONFIG_SOC_AU1000) 39#if defined(CONFIG_SOC_AU1000)
38 PORT(UART0_PHYS_ADDR, AU1000_UART0_INT), 40 PORT(UART0_PHYS_ADDR, AU1000_UART0_INT),
39 PORT(UART1_PHYS_ADDR, AU1000_UART1_INT), 41 PORT(UART1_PHYS_ADDR, AU1000_UART1_INT),
@@ -54,7 +56,6 @@ static struct plat_serial8250_port au1x00_uart_data[] = {
54 PORT(UART0_PHYS_ADDR, AU1200_UART0_INT), 56 PORT(UART0_PHYS_ADDR, AU1200_UART0_INT),
55 PORT(UART1_PHYS_ADDR, AU1200_UART1_INT), 57 PORT(UART1_PHYS_ADDR, AU1200_UART1_INT),
56#endif 58#endif
57#endif /* CONFIG_SERIAL_8250_AU1X00 */
58 { }, 59 { },
59}; 60};
60 61
@@ -436,17 +437,27 @@ static int __init au1xxx_platform_init(void)
436{ 437{
437 unsigned int uartclk = get_au1x00_uart_baud_base() * 16; 438 unsigned int uartclk = get_au1x00_uart_baud_base() * 16;
438 int err, i; 439 int err, i;
440 unsigned char ethaddr[6];
439 441
440 /* Fill up uartclk. */ 442 /* Fill up uartclk. */
441 for (i = 0; au1x00_uart_data[i].flags; i++) 443 for (i = 0; au1x00_uart_data[i].flags; i++)
442 au1x00_uart_data[i].uartclk = uartclk; 444 au1x00_uart_data[i].uartclk = uartclk;
443 445
446 /* use firmware-provided mac addr if available and necessary */
447 i = prom_get_ethernet_addr(ethaddr);
448 if (!i && !is_valid_ether_addr(au1xxx_eth0_platform_data.mac))
449 memcpy(au1xxx_eth0_platform_data.mac, ethaddr, 6);
450
444 err = platform_add_devices(au1xxx_platform_devices, 451 err = platform_add_devices(au1xxx_platform_devices,
445 ARRAY_SIZE(au1xxx_platform_devices)); 452 ARRAY_SIZE(au1xxx_platform_devices));
446#ifndef CONFIG_SOC_AU1100 453#ifndef CONFIG_SOC_AU1100
454 ethaddr[5] += 1; /* next addr for 2nd MAC */
455 if (!i && !is_valid_ether_addr(au1xxx_eth1_platform_data.mac))
456 memcpy(au1xxx_eth1_platform_data.mac, ethaddr, 6);
457
447 /* Register second MAC if enabled in pinfunc */ 458 /* Register second MAC if enabled in pinfunc */
448 if (!err && !(au_readl(SYS_PINFUNC) & (u32)SYS_PF_NI2)) 459 if (!err && !(au_readl(SYS_PINFUNC) & (u32)SYS_PF_NI2))
449 platform_device_register(&au1xxx_eth1_device); 460 err = platform_device_register(&au1xxx_eth1_device);
450#endif 461#endif
451 462
452 return err; 463 return err;
diff --git a/arch/mips/alchemy/devboards/Makefile b/arch/mips/alchemy/devboards/Makefile
index ecbd37f9ee87..826449c817c3 100644
--- a/arch/mips/alchemy/devboards/Makefile
+++ b/arch/mips/alchemy/devboards/Makefile
@@ -16,5 +16,3 @@ obj-$(CONFIG_MIPS_DB1500) += db1x00/
16obj-$(CONFIG_MIPS_DB1550) += db1x00/ 16obj-$(CONFIG_MIPS_DB1550) += db1x00/
17obj-$(CONFIG_MIPS_BOSPORUS) += db1x00/ 17obj-$(CONFIG_MIPS_BOSPORUS) += db1x00/
18obj-$(CONFIG_MIPS_MIRAGE) += db1x00/ 18obj-$(CONFIG_MIPS_MIRAGE) += db1x00/
19
20EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/alchemy/devboards/db1200/platform.c b/arch/mips/alchemy/devboards/db1200/platform.c
index 3cb95a98ab31..3fa34c3abc04 100644
--- a/arch/mips/alchemy/devboards/db1200/platform.c
+++ b/arch/mips/alchemy/devboards/db1200/platform.c
@@ -216,14 +216,14 @@ static struct resource db1200_ide_res[] = {
216 } 216 }
217}; 217};
218 218
219static u64 ide_dmamask = DMA_32BIT_MASK; 219static u64 ide_dmamask = DMA_BIT_MASK(32);
220 220
221static struct platform_device db1200_ide_dev = { 221static struct platform_device db1200_ide_dev = {
222 .name = "au1200-ide", 222 .name = "au1200-ide",
223 .id = 0, 223 .id = 0,
224 .dev = { 224 .dev = {
225 .dma_mask = &ide_dmamask, 225 .dma_mask = &ide_dmamask,
226 .coherent_dma_mask = DMA_32BIT_MASK, 226 .coherent_dma_mask = DMA_BIT_MASK(32),
227 }, 227 },
228 .num_resources = ARRAY_SIZE(db1200_ide_res), 228 .num_resources = ARRAY_SIZE(db1200_ide_res),
229 .resource = db1200_ide_res, 229 .resource = db1200_ide_res,
@@ -385,12 +385,12 @@ static struct au1550_spi_info db1200_spi_platdata = {
385 .activate_cs = db1200_spi_cs_en, 385 .activate_cs = db1200_spi_cs_en,
386}; 386};
387 387
388static u64 spi_dmamask = DMA_32BIT_MASK; 388static u64 spi_dmamask = DMA_BIT_MASK(32);
389 389
390static struct platform_device db1200_spi_dev = { 390static struct platform_device db1200_spi_dev = {
391 .dev = { 391 .dev = {
392 .dma_mask = &spi_dmamask, 392 .dma_mask = &spi_dmamask,
393 .coherent_dma_mask = DMA_32BIT_MASK, 393 .coherent_dma_mask = DMA_BIT_MASK(32),
394 .platform_data = &db1200_spi_platdata, 394 .platform_data = &db1200_spi_platdata,
395 }, 395 },
396 .name = "au1550-spi", 396 .name = "au1550-spi",
diff --git a/arch/mips/alchemy/devboards/db1x00/board_setup.c b/arch/mips/alchemy/devboards/db1x00/board_setup.c
index 50c9bef99daa..9e45971343ed 100644
--- a/arch/mips/alchemy/devboards/db1x00/board_setup.c
+++ b/arch/mips/alchemy/devboards/db1x00/board_setup.c
@@ -79,7 +79,6 @@ static struct au1000_eth_platform_data eth0_pdata = {
79 79
80static void bosporus_power_off(void) 80static void bosporus_power_off(void)
81{ 81{
82 printk(KERN_INFO "It's now safe to turn off power\n");
83 while (1) 82 while (1)
84 asm volatile (".set mips3 ; wait ; .set mips0"); 83 asm volatile (".set mips3 ; wait ; .set mips0");
85} 84}
diff --git a/arch/mips/alchemy/devboards/pb1000/board_setup.c b/arch/mips/alchemy/devboards/pb1000/board_setup.c
index 4ef50d86b181..f6540ec47a64 100644
--- a/arch/mips/alchemy/devboards/pb1000/board_setup.c
+++ b/arch/mips/alchemy/devboards/pb1000/board_setup.c
@@ -47,9 +47,11 @@ static void board_reset(char *c)
47 47
48static void board_power_off(void) 48static void board_power_off(void)
49{ 49{
50 printk(KERN_ALERT "It's now safe to remove power\n");
51 while (1) 50 while (1)
52 asm volatile (".set mips3 ; wait ; .set mips1"); 51 asm volatile (
52 " .set mips32 \n"
53 " wait \n"
54 " .set mips0 \n");
53} 55}
54 56
55void __init board_setup(void) 57void __init board_setup(void)
diff --git a/arch/mips/alchemy/devboards/pb1200/Makefile b/arch/mips/alchemy/devboards/pb1200/Makefile
index 2ea9b02ef09f..18c1bd53e4c0 100644
--- a/arch/mips/alchemy/devboards/pb1200/Makefile
+++ b/arch/mips/alchemy/devboards/pb1200/Makefile
@@ -3,5 +3,3 @@
3# 3#
4 4
5obj-y := board_setup.o platform.o 5obj-y := board_setup.o platform.o
6
7EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/alchemy/gpr/Makefile b/arch/mips/alchemy/gpr/Makefile
new file mode 100644
index 000000000000..cb73fe256dce
--- /dev/null
+++ b/arch/mips/alchemy/gpr/Makefile
@@ -0,0 +1,8 @@
1#
2# Copyright 2003 MontaVista Software Inc.
3# Author: MontaVista Software, Inc. <source@mvista.com>
4#
5# Makefile for Trapeze ITS GPR board.
6#
7
8obj-y += board_setup.o init.o platform.o
diff --git a/arch/mips/alchemy/gpr/board_setup.c b/arch/mips/alchemy/gpr/board_setup.c
new file mode 100644
index 000000000000..ad2e3f137933
--- /dev/null
+++ b/arch/mips/alchemy/gpr/board_setup.c
@@ -0,0 +1,93 @@
1/*
2 * Copyright 2010 Wolfgang Grandegger <wg@denx.de>
3 *
4 * Copyright 2000-2003, 2008 MontaVista Software Inc.
5 * Author: MontaVista Software, Inc. <source@mvista.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
13 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
15 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27
28#include <linux/gpio.h>
29#include <linux/init.h>
30#include <linux/interrupt.h>
31#include <linux/delay.h>
32#include <linux/pm.h>
33
34#include <asm/reboot.h>
35#include <asm/mach-au1x00/au1000.h>
36
37#include <prom.h>
38
39#define UART1_ADDR KSEG1ADDR(UART1_PHYS_ADDR)
40#define UART3_ADDR KSEG1ADDR(UART3_PHYS_ADDR)
41
42char irq_tab_alchemy[][5] __initdata = {
43 [0] = { -1, AU1500_PCI_INTA, AU1500_PCI_INTB, 0xff, 0xff },
44};
45
46static void gpr_reset(char *c)
47{
48 /* switch System-LED to orange (red# and green# on) */
49 alchemy_gpio_direction_output(4, 0);
50 alchemy_gpio_direction_output(5, 0);
51
52 /* trigger watchdog to reset board in 200ms */
53 printk(KERN_EMERG "Triggering watchdog soft reset...\n");
54 raw_local_irq_disable();
55 alchemy_gpio_direction_output(1, 0);
56 udelay(1);
57 alchemy_gpio_set_value(1, 1);
58 while (1)
59 cpu_wait();
60}
61
62static void gpr_power_off(void)
63{
64 while (1)
65 cpu_wait();
66}
67
68void __init board_setup(void)
69{
70 printk(KERN_INFO "Tarpeze ITS GPR board\n");
71
72 pm_power_off = gpr_power_off;
73 _machine_halt = gpr_power_off;
74 _machine_restart = gpr_reset;
75
76 /* Enable UART3 */
77 au_writel(0x1, UART3_ADDR + UART_MOD_CNTRL);/* clock enable (CE) */
78 au_writel(0x3, UART3_ADDR + UART_MOD_CNTRL); /* CE and "enable" */
79 /* Enable UART1 */
80 au_writel(0x1, UART1_ADDR + UART_MOD_CNTRL); /* clock enable (CE) */
81 au_writel(0x3, UART1_ADDR + UART_MOD_CNTRL); /* CE and "enable" */
82
83 /* Take away Reset of UMTS-card */
84 alchemy_gpio_direction_output(215, 1);
85
86#ifdef CONFIG_PCI
87#if defined(__MIPSEB__)
88 au_writel(0xf | (2 << 6) | (1 << 4), Au1500_PCI_CFG);
89#else
90 au_writel(0xf, Au1500_PCI_CFG);
91#endif
92#endif
93}
diff --git a/arch/mips/alchemy/gpr/init.c b/arch/mips/alchemy/gpr/init.c
new file mode 100644
index 000000000000..f044f4c541d7
--- /dev/null
+++ b/arch/mips/alchemy/gpr/init.c
@@ -0,0 +1,63 @@
1/*
2 * Copyright 2010 Wolfgang Grandegger <wg@denx.de>
3 *
4 * Copyright 2003, 2008 MontaVista Software Inc.
5 * Author: MontaVista Software, Inc. <source@mvista.com>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 *
12 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
13 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
14 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
15 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
16 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
17 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
18 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
19 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
20 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
21 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22 *
23 * You should have received a copy of the GNU General Public License along
24 * with this program; if not, write to the Free Software Foundation, Inc.,
25 * 675 Mass Ave, Cambridge, MA 02139, USA.
26 */
27
28#include <linux/init.h>
29#include <linux/kernel.h>
30
31#include <asm/bootinfo.h>
32#include <asm/mach-au1x00/au1000.h>
33
34#include <prom.h>
35
36const char *get_system_type(void)
37{
38 return "GPR";
39}
40
41void __init prom_init(void)
42{
43 unsigned char *memsize_str;
44 unsigned long memsize;
45
46 prom_argc = fw_arg0;
47 prom_argv = (char **)fw_arg1;
48 prom_envp = (char **)fw_arg2;
49
50 prom_init_cmdline();
51
52 memsize_str = prom_getenv("memsize");
53 if (!memsize_str)
54 memsize = 0x04000000;
55 else
56 strict_strtoul(memsize_str, 0, &memsize);
57 add_memory_region(0, memsize, BOOT_MEM_RAM);
58}
59
60void prom_putchar(unsigned char c)
61{
62 alchemy_uart_putchar(UART0_PHYS_ADDR, c);
63}
diff --git a/arch/mips/alchemy/gpr/platform.c b/arch/mips/alchemy/gpr/platform.c
new file mode 100644
index 000000000000..14b46629cfc8
--- /dev/null
+++ b/arch/mips/alchemy/gpr/platform.c
@@ -0,0 +1,183 @@
1/*
2 * GPR board platform device registration
3 *
4 * Copyright (C) 2010 Wolfgang Grandegger <wg@denx.de>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <linux/init.h>
22#include <linux/platform_device.h>
23#include <linux/mtd/partitions.h>
24#include <linux/mtd/physmap.h>
25#include <linux/leds.h>
26#include <linux/gpio.h>
27#include <linux/i2c.h>
28#include <linux/i2c-gpio.h>
29
30#include <asm/mach-au1x00/au1000.h>
31
32/*
33 * Watchdog
34 */
35static struct resource gpr_wdt_resource[] = {
36 [0] = {
37 .start = 1,
38 .end = 1,
39 .name = "gpr-adm6320-wdt",
40 .flags = IORESOURCE_IRQ,
41 }
42};
43
44static struct platform_device gpr_wdt_device = {
45 .name = "adm6320-wdt",
46 .id = 0,
47 .num_resources = ARRAY_SIZE(gpr_wdt_resource),
48 .resource = gpr_wdt_resource,
49};
50
51/*
52 * FLASH
53 *
54 * 0x00000000-0x00200000 : "kernel"
55 * 0x00200000-0x00a00000 : "rootfs"
56 * 0x01d00000-0x01f00000 : "config"
57 * 0x01c00000-0x01d00000 : "yamon"
58 * 0x01d00000-0x01d40000 : "yamon env vars"
59 * 0x00000000-0x00a00000 : "kernel+rootfs"
60 */
61static struct mtd_partition gpr_mtd_partitions[] = {
62 {
63 .name = "kernel",
64 .size = 0x00200000,
65 .offset = 0,
66 },
67 {
68 .name = "rootfs",
69 .size = 0x00800000,
70 .offset = MTDPART_OFS_APPEND,
71 .mask_flags = MTD_WRITEABLE,
72 },
73 {
74 .name = "config",
75 .size = 0x00200000,
76 .offset = 0x01d00000,
77 },
78 {
79 .name = "yamon",
80 .size = 0x00100000,
81 .offset = 0x01c00000,
82 },
83 {
84 .name = "yamon env vars",
85 .size = 0x00040000,
86 .offset = MTDPART_OFS_APPEND,
87 },
88 {
89 .name = "kernel+rootfs",
90 .size = 0x00a00000,
91 .offset = 0,
92 },
93};
94
95static struct physmap_flash_data gpr_flash_data = {
96 .width = 4,
97 .nr_parts = ARRAY_SIZE(gpr_mtd_partitions),
98 .parts = gpr_mtd_partitions,
99};
100
101static struct resource gpr_mtd_resource = {
102 .start = 0x1e000000,
103 .end = 0x1fffffff,
104 .flags = IORESOURCE_MEM,
105};
106
107static struct platform_device gpr_mtd_device = {
108 .name = "physmap-flash",
109 .dev = {
110 .platform_data = &gpr_flash_data,
111 },
112 .num_resources = 1,
113 .resource = &gpr_mtd_resource,
114};
115
116/*
117 * LEDs
118 */
119static struct gpio_led gpr_gpio_leds[] = {
120 { /* green */
121 .name = "gpr:green",
122 .gpio = 4,
123 .active_low = 1,
124 },
125 { /* red */
126 .name = "gpr:red",
127 .gpio = 5,
128 .active_low = 1,
129 }
130};
131
132static struct gpio_led_platform_data gpr_led_data = {
133 .num_leds = ARRAY_SIZE(gpr_gpio_leds),
134 .leds = gpr_gpio_leds,
135};
136
137static struct platform_device gpr_led_devices = {
138 .name = "leds-gpio",
139 .id = -1,
140 .dev = {
141 .platform_data = &gpr_led_data,
142 }
143};
144
145/*
146 * I2C
147 */
148static struct i2c_gpio_platform_data gpr_i2c_data = {
149 .sda_pin = 209,
150 .sda_is_open_drain = 1,
151 .scl_pin = 210,
152 .scl_is_open_drain = 1,
153 .udelay = 2, /* ~100 kHz */
154 .timeout = HZ,
155 };
156
157static struct platform_device gpr_i2c_device = {
158 .name = "i2c-gpio",
159 .id = -1,
160 .dev.platform_data = &gpr_i2c_data,
161};
162
163static struct i2c_board_info gpr_i2c_info[] __initdata = {
164 {
165 I2C_BOARD_INFO("lm83", 0x18),
166 .type = "lm83"
167 }
168};
169
170static struct platform_device *gpr_devices[] __initdata = {
171 &gpr_wdt_device,
172 &gpr_mtd_device,
173 &gpr_i2c_device,
174 &gpr_led_devices,
175};
176
177static int __init gpr_dev_init(void)
178{
179 i2c_register_board_info(0, gpr_i2c_info, ARRAY_SIZE(gpr_i2c_info));
180
181 return platform_add_devices(gpr_devices, ARRAY_SIZE(gpr_devices));
182}
183device_initcall(gpr_dev_init);
diff --git a/arch/mips/alchemy/mtx-1/Makefile b/arch/mips/alchemy/mtx-1/Makefile
index 4a53815b3c6c..81b540ceaf88 100644
--- a/arch/mips/alchemy/mtx-1/Makefile
+++ b/arch/mips/alchemy/mtx-1/Makefile
@@ -6,7 +6,4 @@
6# Makefile for 4G Systems MTX-1 board. 6# Makefile for 4G Systems MTX-1 board.
7# 7#
8 8
9lib-y := init.o board_setup.o 9obj-y += init.o board_setup.o platform.o
10obj-y := platform.o
11
12EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/alchemy/mtx-1/board_setup.c b/arch/mips/alchemy/mtx-1/board_setup.c
index 52d883d37dd7..6398fa95905c 100644
--- a/arch/mips/alchemy/mtx-1/board_setup.c
+++ b/arch/mips/alchemy/mtx-1/board_setup.c
@@ -60,9 +60,11 @@ static void mtx1_reset(char *c)
60 60
61static void mtx1_power_off(void) 61static void mtx1_power_off(void)
62{ 62{
63 printk(KERN_ALERT "It's now safe to remove power\n");
64 while (1) 63 while (1)
65 asm volatile (".set mips3 ; wait ; .set mips1"); 64 asm volatile (
65 " .set mips32 \n"
66 " wait \n"
67 " .set mips0 \n");
66} 68}
67 69
68void __init board_setup(void) 70void __init board_setup(void)
@@ -105,14 +107,10 @@ void __init board_setup(void)
105int 107int
106mtx1_pci_idsel(unsigned int devsel, int assert) 108mtx1_pci_idsel(unsigned int devsel, int assert)
107{ 109{
108#define MTX_IDSEL_ONLY_0_AND_3 0 110 /* This function is only necessary to support a proprietary Cardbus
109#if MTX_IDSEL_ONLY_0_AND_3 111 * adapter on the mtx-1 "singleboard" variant. It triggers a custom
110 if (devsel != 0 && devsel != 3) { 112 * logic chip connected to EXT_IO3 (GPIO1) to suppress IDSEL signals.
111 printk(KERN_ERR "*** not 0 or 3\n"); 113 */
112 return 0;
113 }
114#endif
115
116 if (assert && devsel != 0) 114 if (assert && devsel != 0)
117 /* Suppress signal to Cardbus */ 115 /* Suppress signal to Cardbus */
118 alchemy_gpio_set_value(1, 0); /* set EXT_IO3 OFF */ 116 alchemy_gpio_set_value(1, 0); /* set EXT_IO3 OFF */
diff --git a/arch/mips/alchemy/xxs1500/Makefile b/arch/mips/alchemy/xxs1500/Makefile
index 4dc81d794cb8..91defcf4f335 100644
--- a/arch/mips/alchemy/xxs1500/Makefile
+++ b/arch/mips/alchemy/xxs1500/Makefile
@@ -5,6 +5,4 @@
5# Makefile for MyCable XXS1500 board. 5# Makefile for MyCable XXS1500 board.
6# 6#
7 7
8lib-y := init.o board_setup.o platform.o 8obj-y += init.o board_setup.o platform.o
9
10EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/alchemy/xxs1500/board_setup.c b/arch/mips/alchemy/xxs1500/board_setup.c
index 47b42927607b..b43c918925d3 100644
--- a/arch/mips/alchemy/xxs1500/board_setup.c
+++ b/arch/mips/alchemy/xxs1500/board_setup.c
@@ -42,9 +42,11 @@ static void xxs1500_reset(char *c)
42 42
43static void xxs1500_power_off(void) 43static void xxs1500_power_off(void)
44{ 44{
45 printk(KERN_ALERT "It's now safe to remove power\n");
46 while (1) 45 while (1)
47 asm volatile (".set mips3 ; wait ; .set mips1"); 46 asm volatile (
47 " .set mips32 \n"
48 " wait \n"
49 " .set mips0 \n");
48} 50}
49 51
50void __init board_setup(void) 52void __init board_setup(void)
diff --git a/arch/mips/ar7/Makefile b/arch/mips/ar7/Makefile
index 26bc5da18997..7435e44b3964 100644
--- a/arch/mips/ar7/Makefile
+++ b/arch/mips/ar7/Makefile
@@ -8,4 +8,3 @@ obj-y := \
8 platform.o \ 8 platform.o \
9 gpio.o \ 9 gpio.o \
10 clock.o 10 clock.o
11EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/ar7/Platform b/arch/mips/ar7/Platform
new file mode 100644
index 000000000000..0bf85c416c6c
--- /dev/null
+++ b/arch/mips/ar7/Platform
@@ -0,0 +1,6 @@
1#
2# Texas Instruments AR7
3#
4platform-$(CONFIG_AR7) += ar7/
5cflags-$(CONFIG_AR7) += -I$(srctree)/arch/mips/include/asm/mach-ar7
6load-$(CONFIG_AR7) += 0xffffffff94100000
diff --git a/arch/mips/ar7/platform.c b/arch/mips/ar7/platform.c
index 8f31d1d59683..0da5b2b8dd88 100644
--- a/arch/mips/ar7/platform.c
+++ b/arch/mips/ar7/platform.c
@@ -292,40 +292,28 @@ static struct platform_device cpmac_high = {
292 .num_resources = ARRAY_SIZE(cpmac_high_res), 292 .num_resources = ARRAY_SIZE(cpmac_high_res),
293}; 293};
294 294
295static inline unsigned char char2hex(char h) 295static void __init cpmac_get_mac(int instance, unsigned char *dev_addr)
296{ 296{
297 switch (h) { 297 char name[5], *mac;
298 case '0': case '1': case '2': case '3': case '4':
299 case '5': case '6': case '7': case '8': case '9':
300 return h - '0';
301 case 'A': case 'B': case 'C': case 'D': case 'E': case 'F':
302 return h - 'A' + 10;
303 case 'a': case 'b': case 'c': case 'd': case 'e': case 'f':
304 return h - 'a' + 10;
305 default:
306 return 0;
307 }
308}
309
310static void cpmac_get_mac(int instance, unsigned char *dev_addr)
311{
312 int i;
313 char name[5], default_mac[ETH_ALEN], *mac;
314 298
315 mac = NULL;
316 sprintf(name, "mac%c", 'a' + instance); 299 sprintf(name, "mac%c", 'a' + instance);
317 mac = prom_getenv(name); 300 mac = prom_getenv(name);
318 if (!mac) { 301 if (!mac && instance) {
319 sprintf(name, "mac%c", 'a'); 302 sprintf(name, "mac%c", 'a');
320 mac = prom_getenv(name); 303 mac = prom_getenv(name);
321 } 304 }
322 if (!mac) { 305
323 random_ether_addr(default_mac); 306 if (mac) {
324 mac = default_mac; 307 if (sscanf(mac, "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
325 } 308 &dev_addr[0], &dev_addr[1],
326 for (i = 0; i < 6; i++) 309 &dev_addr[2], &dev_addr[3],
327 dev_addr[i] = (char2hex(mac[i * 3]) << 4) + 310 &dev_addr[4], &dev_addr[5]) != 6) {
328 char2hex(mac[i * 3 + 1]); 311 pr_warning("cannot parse mac address, "
312 "using random address\n");
313 random_ether_addr(dev_addr);
314 }
315 } else
316 random_ether_addr(dev_addr);
329} 317}
330 318
331/***************************************************************************** 319/*****************************************************************************
diff --git a/arch/mips/bcm47xx/Platform b/arch/mips/bcm47xx/Platform
new file mode 100644
index 000000000000..874b7ca4cd11
--- /dev/null
+++ b/arch/mips/bcm47xx/Platform
@@ -0,0 +1,7 @@
1#
2# Broadcom BCM47XX boards
3#
4platform-$(CONFIG_BCM47XX) += bcm47xx/
5cflags-$(CONFIG_BCM47XX) += \
6 -I$(srctree)/arch/mips/include/asm/mach-bcm47xx
7load-$(CONFIG_BCM47XX) := 0xffffffff80001000
diff --git a/arch/mips/bcm47xx/nvram.c b/arch/mips/bcm47xx/nvram.c
index 06e03b222f6d..e5b6615731e5 100644
--- a/arch/mips/bcm47xx/nvram.c
+++ b/arch/mips/bcm47xx/nvram.c
@@ -69,7 +69,7 @@ int nvram_getenv(char *name, char *val, size_t val_len)
69 char *var, *value, *end, *eq; 69 char *var, *value, *end, *eq;
70 70
71 if (!name) 71 if (!name)
72 return 1; 72 return NVRAM_ERR_INV_PARAM;
73 73
74 if (!nvram_buf[0]) 74 if (!nvram_buf[0])
75 early_nvram_init(); 75 early_nvram_init();
@@ -89,6 +89,6 @@ int nvram_getenv(char *name, char *val, size_t val_len)
89 return 0; 89 return 0;
90 } 90 }
91 } 91 }
92 return 1; 92 return NVRAM_ERR_ENVNOTFOUND;
93} 93}
94EXPORT_SYMBOL(nvram_getenv); 94EXPORT_SYMBOL(nvram_getenv);
diff --git a/arch/mips/bcm47xx/prom.c b/arch/mips/bcm47xx/prom.c
index 0fa646c5a844..f6e9063cc4c2 100644
--- a/arch/mips/bcm47xx/prom.c
+++ b/arch/mips/bcm47xx/prom.c
@@ -126,6 +126,7 @@ static __init void prom_init_cmdline(void)
126static __init void prom_init_mem(void) 126static __init void prom_init_mem(void)
127{ 127{
128 unsigned long mem; 128 unsigned long mem;
129 unsigned long max;
129 130
130 /* Figure out memory size by finding aliases. 131 /* Figure out memory size by finding aliases.
131 * 132 *
@@ -134,21 +135,26 @@ static __init void prom_init_mem(void)
134 * want to reuse the memory used by CFE (around 4MB). That means cfe_* 135 * want to reuse the memory used by CFE (around 4MB). That means cfe_*
135 * functions stop to work at some point during the boot, we should only 136 * functions stop to work at some point during the boot, we should only
136 * call them at the beginning of the boot. 137 * call them at the beginning of the boot.
138 *
139 * BCM47XX uses 128MB for addressing the ram, if the system contains
140 * less that that amount of ram it remaps the ram more often into the
141 * available space.
142 * Accessing memory after 128MB will cause an exception.
143 * max contains the biggest possible address supported by the platform.
144 * If the method wants to try something above we assume 128MB ram.
137 */ 145 */
146 max = ((unsigned long)(prom_init) | ((128 << 20) - 1));
138 for (mem = (1 << 20); mem < (128 << 20); mem += (1 << 20)) { 147 for (mem = (1 << 20); mem < (128 << 20); mem += (1 << 20)) {
148 if (((unsigned long)(prom_init) + mem) > max) {
149 mem = (128 << 20);
150 printk(KERN_DEBUG "assume 128MB RAM\n");
151 break;
152 }
139 if (*(unsigned long *)((unsigned long)(prom_init) + mem) == 153 if (*(unsigned long *)((unsigned long)(prom_init) + mem) ==
140 *(unsigned long *)(prom_init)) 154 *(unsigned long *)(prom_init))
141 break; 155 break;
142 } 156 }
143 157
144 /* Ignoring the last page when ddr size is 128M. Cached
145 * accesses to last page is causing the processor to prefetch
146 * using address above 128M stepping out of the ddr address
147 * space.
148 */
149 if (mem == 0x8000000)
150 mem -= 0x1000;
151
152 add_memory_region(0, mem, BOOT_MEM_RAM); 158 add_memory_region(0, mem, BOOT_MEM_RAM);
153} 159}
154 160
diff --git a/arch/mips/bcm63xx/Makefile b/arch/mips/bcm63xx/Makefile
index 00064b660809..6dfdc69928ac 100644
--- a/arch/mips/bcm63xx/Makefile
+++ b/arch/mips/bcm63xx/Makefile
@@ -3,5 +3,3 @@ obj-y += clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o \
3obj-$(CONFIG_EARLY_PRINTK) += early_printk.o 3obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
4 4
5obj-y += boards/ 5obj-y += boards/
6
7EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/bcm63xx/Platform b/arch/mips/bcm63xx/Platform
new file mode 100644
index 000000000000..5f86b2fff6de
--- /dev/null
+++ b/arch/mips/bcm63xx/Platform
@@ -0,0 +1,7 @@
1#
2# Broadcom BCM63XX boards
3#
4platform-$(CONFIG_BCM63XX) += bcm63xx/
5cflags-$(CONFIG_BCM63XX) += \
6 -I$(srctree)/arch/mips/include/asm/mach-bcm63xx/
7load-$(CONFIG_BCM63XX) := 0xffffffff80010000
diff --git a/arch/mips/boot/.gitignore b/arch/mips/boot/.gitignore
index 4667a5f9280b..f210b09ececc 100644
--- a/arch/mips/boot/.gitignore
+++ b/arch/mips/boot/.gitignore
@@ -3,3 +3,4 @@ elf2ecoff
3vmlinux.* 3vmlinux.*
4zImage 4zImage
5zImage.tmp 5zImage.tmp
6calc_vmlinuz_load_addr
diff --git a/arch/mips/boot/Makefile b/arch/mips/boot/Makefile
index e39a08edcaaa..85bcb5adc7cb 100644
--- a/arch/mips/boot/Makefile
+++ b/arch/mips/boot/Makefile
@@ -11,35 +11,32 @@
11# Some DECstations need all possible sections of an ECOFF executable 11# Some DECstations need all possible sections of an ECOFF executable
12# 12#
13ifdef CONFIG_MACH_DECSTATION 13ifdef CONFIG_MACH_DECSTATION
14 E2EFLAGS = -a 14 e2eflag := -a
15else
16 E2EFLAGS =
17endif 15endif
18 16
19# 17#
20# Drop some uninteresting sections in the kernel. 18# Drop some uninteresting sections in the kernel.
21# This is only relevant for ELF kernels but doesn't hurt a.out 19# This is only relevant for ELF kernels but doesn't hurt a.out
22# 20#
23drop-sections = .reginfo .mdebug .comment .note .pdr .options .MIPS.options 21drop-sections := .reginfo .mdebug .comment .note .pdr .options .MIPS.options
24strip-flags = $(addprefix --remove-section=,$(drop-sections)) 22strip-flags := $(addprefix --remove-section=,$(drop-sections))
25 23
26VMLINUX = vmlinux 24hostprogs-y := elf2ecoff
27 25
28all: vmlinux.ecoff vmlinux.srec 26targets := vmlinux.ecoff
29 27quiet_cmd_ecoff = ECOFF $@
30vmlinux.ecoff: $(obj)/elf2ecoff $(VMLINUX) 28 cmd_ecoff = $(obj)/elf2ecoff $(VMLINUX) $@ $(e2eflag)
31 $(obj)/elf2ecoff $(VMLINUX) $(obj)/vmlinux.ecoff $(E2EFLAGS) 29$(obj)/vmlinux.ecoff: $(obj)/elf2ecoff $(VMLINUX) FORCE
32 30 $(call if_changed,ecoff)
33$(obj)/elf2ecoff: $(obj)/elf2ecoff.c 31
34 $(HOSTCC) -o $@ $^ 32targets += vmlinux.bin
35 33quiet_cmd_bin = OBJCOPY $@
36vmlinux.bin: $(VMLINUX) 34 cmd_bin = $(OBJCOPY) -O binary $(strip-flags) $(VMLINUX) $@
37 $(OBJCOPY) -O binary $(strip-flags) $(VMLINUX) $(obj)/vmlinux.bin 35$(obj)/vmlinux.bin: $(VMLINUX) FORCE
38 36 $(call if_changed,bin)
39vmlinux.srec: $(VMLINUX) 37
40 $(OBJCOPY) -S -O srec $(strip-flags) $(VMLINUX) $(obj)/vmlinux.srec 38targets += vmlinux.srec
41 39quiet_cmd_srec = OBJCOPY $@
42clean-files += elf2ecoff \ 40 cmd_srec = $(OBJCOPY) -S -O srec $(strip-flags) $(VMLINUX) $@
43 vmlinux.bin \ 41$(obj)/vmlinux.srec: $(VMLINUX) FORCE
44 vmlinux.ecoff \ 42 $(call if_changed,srec)
45 vmlinux.srec
diff --git a/arch/mips/boot/compressed/Makefile b/arch/mips/boot/compressed/Makefile
index 790ddd397620..ed9bb709c9a3 100644
--- a/arch/mips/boot/compressed/Makefile
+++ b/arch/mips/boot/compressed/Makefile
@@ -12,14 +12,6 @@
12# Author: Wu Zhangjin <wuzhangjin@gmail.com> 12# Author: Wu Zhangjin <wuzhangjin@gmail.com>
13# 13#
14 14
15# compressed kernel load addr: VMLINUZ_LOAD_ADDRESS > VMLINUX_LOAD_ADDRESS + VMLINUX_SIZE
16VMLINUX_SIZE := $(shell wc -c $(objtree)/$(KBUILD_IMAGE) 2>/dev/null | cut -d' ' -f1)
17VMLINUX_SIZE := $(shell [ -n "$(VMLINUX_SIZE)" ] && echo -n $$(($(VMLINUX_SIZE) + (65536 - $(VMLINUX_SIZE) % 65536))))
18# VMLINUZ_LOAD_ADDRESS = concat "high32 of VMLINUX_LOAD_ADDRESS" and "(low32 of VMLINUX_LOAD_ADDRESS) + VMLINUX_SIZE"
19HIGH32 := $(shell A=$(VMLINUX_LOAD_ADDRESS); [ $${\#A} -gt 10 ] && expr substr "$(VMLINUX_LOAD_ADDRESS)" 3 $$(($${\#A} - 10)))
20LOW32 := $(shell [ -n "$(HIGH32)" ] && A=11 || A=3; expr substr "$(VMLINUX_LOAD_ADDRESS)" $${A} 8)
21VMLINUZ_LOAD_ADDRESS := 0x$(shell [ -n "$(VMLINUX_SIZE)" -a -n "$(LOW32)" ] && printf "$(HIGH32)%08x" $$(($(VMLINUX_SIZE) + 0x$(LOW32))))
22
23# set the default size of the mallocing area for decompressing 15# set the default size of the mallocing area for decompressing
24BOOT_HEAP_SIZE := 0x400000 16BOOT_HEAP_SIZE := 0x400000
25 17
@@ -33,49 +25,61 @@ KBUILD_AFLAGS := $(LINUXINCLUDE) $(KBUILD_AFLAGS) -D__ASSEMBLY__ \
33 -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \ 25 -DBOOT_HEAP_SIZE=$(BOOT_HEAP_SIZE) \
34 -DKERNEL_ENTRY=0x$(shell $(NM) $(objtree)/$(KBUILD_IMAGE) 2>/dev/null | grep " kernel_entry" | cut -f1 -d \ ) 26 -DKERNEL_ENTRY=0x$(shell $(NM) $(objtree)/$(KBUILD_IMAGE) 2>/dev/null | grep " kernel_entry" | cut -f1 -d \ )
35 27
36obj-y := $(obj)/head.o $(obj)/decompress.o $(obj)/dbg.o 28targets := head.o decompress.o dbg.o uart-16550.o uart-alchemy.o
29
30# decompressor objects (linked with vmlinuz)
31vmlinuzobjs-y := $(obj)/head.o $(obj)/decompress.o $(obj)/dbg.o
37 32
38ifdef CONFIG_DEBUG_ZBOOT 33ifdef CONFIG_DEBUG_ZBOOT
39obj-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o 34vmlinuzobjs-$(CONFIG_SYS_SUPPORTS_ZBOOT_UART16550) += $(obj)/uart-16550.o
40obj-$(CONFIG_MACH_ALCHEMY) += $(obj)/uart-alchemy.o 35vmlinuzobjs-$(CONFIG_MIPS_ALCHEMY) += $(obj)/uart-alchemy.o
41endif 36endif
42 37
38targets += vmlinux.bin
43OBJCOPYFLAGS_vmlinux.bin := $(OBJCOPYFLAGS) -O binary -R .comment -S 39OBJCOPYFLAGS_vmlinux.bin := $(OBJCOPYFLAGS) -O binary -R .comment -S
44$(obj)/vmlinux.bin: $(KBUILD_IMAGE) 40$(obj)/vmlinux.bin: $(KBUILD_IMAGE) FORCE
45 $(call if_changed,objcopy) 41 $(call if_changed,objcopy)
46 42
47suffix_$(CONFIG_KERNEL_GZIP) = gz
48suffix_$(CONFIG_KERNEL_BZIP2) = bz2
49suffix_$(CONFIG_KERNEL_LZMA) = lzma
50suffix_$(CONFIG_KERNEL_LZO) = lzo
51tool_$(CONFIG_KERNEL_GZIP) = gzip 43tool_$(CONFIG_KERNEL_GZIP) = gzip
52tool_$(CONFIG_KERNEL_BZIP2) = bzip2 44tool_$(CONFIG_KERNEL_BZIP2) = bzip2
53tool_$(CONFIG_KERNEL_LZMA) = lzma 45tool_$(CONFIG_KERNEL_LZMA) = lzma
54tool_$(CONFIG_KERNEL_LZO) = lzo 46tool_$(CONFIG_KERNEL_LZO) = lzo
55$(obj)/vmlinux.$(suffix_y): $(obj)/vmlinux.bin 47
48targets += vmlinux.bin.z
49$(obj)/vmlinux.bin.z: $(obj)/vmlinux.bin FORCE
56 $(call if_changed,$(tool_y)) 50 $(call if_changed,$(tool_y))
57 51
58$(obj)/piggy.o: $(obj)/vmlinux.$(suffix_y) $(obj)/dummy.o 52targets += piggy.o
59 $(Q)$(OBJCOPY) $(OBJCOPYFLAGS) \ 53OBJCOPYFLAGS_piggy.o := --add-section=.image=$(obj)/vmlinux.bin.z \
60 --add-section=.image=$< \ 54 --set-section-flags=.image=contents,alloc,load,readonly,data
61 --set-section-flags=.image=contents,alloc,load,readonly,data \ 55$(obj)/piggy.o: $(obj)/dummy.o $(obj)/vmlinux.bin.z FORCE
62 $(obj)/dummy.o $@ 56 $(call if_changed,objcopy)
57
58# Calculate the load address of the compressed kernel image
59hostprogs-y := calc_vmlinuz_load_addr
60
61VMLINUZ_LOAD_ADDRESS = $(shell $(obj)/calc_vmlinuz_load_addr \
62 $(objtree)/$(KBUILD_IMAGE) $(VMLINUX_LOAD_ADDRESS))
63 63
64LDFLAGS_vmlinuz := $(LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T 64vmlinuzobjs-y += $(obj)/piggy.o
65vmlinuz: $(src)/ld.script $(obj-y) $(obj)/piggy.o 65
66 $(call if_changed,ld) 66quiet_cmd_zld = LD $@
67 $(Q)$(OBJCOPY) $(OBJCOPYFLAGS) $@ 67 cmd_zld = $(LD) $(LDFLAGS) -Ttext $(VMLINUZ_LOAD_ADDRESS) -T $< $(vmlinuzobjs-y) -o $@
68quiet_cmd_strip = STRIP $@
69 cmd_strip = $(STRIP) -s $@
70vmlinuz: $(src)/ld.script $(vmlinuzobjs-y) $(obj)/calc_vmlinuz_load_addr
71 $(call cmd,zld)
72 $(call cmd,strip)
68 73
69# 74#
70# Some DECstations need all possible sections of an ECOFF executable 75# Some DECstations need all possible sections of an ECOFF executable
71# 76#
72ifdef CONFIG_MACH_DECSTATION 77ifdef CONFIG_MACH_DECSTATION
73 E2EFLAGS = -a 78 e2eflag := -a
74else
75 E2EFLAGS =
76endif 79endif
77 80
78# elf2ecoff can only handle 32bit image 81# elf2ecoff can only handle 32bit image
82hostprogs-y += ../elf2ecoff
79 83
80ifdef CONFIG_32BIT 84ifdef CONFIG_32BIT
81 VMLINUZ = vmlinuz 85 VMLINUZ = vmlinuz
@@ -83,23 +87,22 @@ else
83 VMLINUZ = vmlinuz.32 87 VMLINUZ = vmlinuz.32
84endif 88endif
85 89
90quiet_cmd_32 = OBJCOPY $@
91 cmd_32 = $(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@
86vmlinuz.32: vmlinuz 92vmlinuz.32: vmlinuz
87 $(Q)$(OBJCOPY) -O $(32bit-bfd) $(OBJCOPYFLAGS) $< $@ 93 $(call cmd,32)
88 94
95quiet_cmd_ecoff = ECOFF $@
96 cmd_ecoff = $< $(VMLINUZ) $@ $(e2eflag)
89vmlinuz.ecoff: $(obj)/../elf2ecoff $(VMLINUZ) 97vmlinuz.ecoff: $(obj)/../elf2ecoff $(VMLINUZ)
90 $(Q)$(obj)/../elf2ecoff $(VMLINUZ) vmlinuz.ecoff $(E2EFLAGS) 98 $(call cmd,ecoff)
91
92$(obj)/../elf2ecoff: $(src)/../elf2ecoff.c
93 $(Q)$(HOSTCC) -o $@ $^
94 99
95OBJCOPYFLAGS_vmlinuz.bin := $(OBJCOPYFLAGS) -O binary 100OBJCOPYFLAGS_vmlinuz.bin := $(OBJCOPYFLAGS) -O binary
96vmlinuz.bin: vmlinuz 101vmlinuz.bin: vmlinuz
97 $(call if_changed,objcopy) 102 $(call cmd,objcopy)
98 103
99OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFLAGS) -S -O srec 104OBJCOPYFLAGS_vmlinuz.srec := $(OBJCOPYFLAGS) -S -O srec
100vmlinuz.srec: vmlinuz 105vmlinuz.srec: vmlinuz
101 $(call if_changed,objcopy) 106 $(call cmd,objcopy)
102 107
103clean: 108clean-files := $(objtree)/vmlinuz.*
104clean-files += *.o \
105 vmlinu*
diff --git a/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c b/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c
new file mode 100644
index 000000000000..88c9d963be88
--- /dev/null
+++ b/arch/mips/boot/compressed/calc_vmlinuz_load_addr.c
@@ -0,0 +1,57 @@
1/*
2 * Copyright (C) 2010 "Wu Zhangjin" <wuzhangjin@gmail.com>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 */
9
10#include <sys/types.h>
11#include <sys/stat.h>
12#include <errno.h>
13#include <stdint.h>
14#include <stdio.h>
15#include <stdlib.h>
16
17int main(int argc, char *argv[])
18{
19 struct stat sb;
20 uint64_t vmlinux_size, vmlinux_load_addr, vmlinuz_load_addr;
21
22 if (argc != 3) {
23 fprintf(stderr, "Usage: %s <pathname> <vmlinux_load_addr>\n",
24 argv[0]);
25 return EXIT_FAILURE;
26 }
27
28 if (stat(argv[1], &sb) == -1) {
29 perror("stat");
30 return EXIT_FAILURE;
31 }
32
33 /* Convert hex characters to dec number */
34 errno = 0;
35 if (sscanf(argv[2], "%llx", &vmlinux_load_addr) != 1) {
36 if (errno != 0)
37 perror("sscanf");
38 else
39 fprintf(stderr, "No matching characters\n");
40
41 return EXIT_FAILURE;
42 }
43
44 vmlinux_size = (uint64_t)sb.st_size;
45 vmlinuz_load_addr = vmlinux_load_addr + vmlinux_size;
46
47 /*
48 * Align with 16 bytes: "greater than that used for any standard data
49 * types by a MIPS compiler." -- See MIPS Run Linux (Second Edition).
50 */
51
52 vmlinuz_load_addr += (16 - vmlinux_size % 16);
53
54 printf("0x%llx\n", vmlinuz_load_addr);
55
56 return EXIT_SUCCESS;
57}
diff --git a/arch/mips/boot/compressed/decompress.c b/arch/mips/boot/compressed/decompress.c
index 5db43c58b1bf..5cad0faefa17 100644
--- a/arch/mips/boot/compressed/decompress.c
+++ b/arch/mips/boot/compressed/decompress.c
@@ -1,9 +1,6 @@
1/* 1/*
2 * Misc. bootloader code for many machines.
3 *
4 * Copyright 2001 MontaVista Software Inc. 2 * Copyright 2001 MontaVista Software Inc.
5 * Author: Matt Porter <mporter@mvista.com> Derived from 3 * Author: Matt Porter <mporter@mvista.com>
6 * arch/ppc/boot/prep/misc.c
7 * 4 *
8 * Copyright (C) 2009 Lemote, Inc. 5 * Copyright (C) 2009 Lemote, Inc.
9 * Author: Wu Zhangjin <wuzhangjin@gmail.com> 6 * Author: Wu Zhangjin <wuzhangjin@gmail.com>
@@ -19,12 +16,12 @@
19 16
20#include <asm/addrspace.h> 17#include <asm/addrspace.h>
21 18
22/* These two variables specify the free mem region 19/*
20 * These two variables specify the free mem region
23 * that can be used for temporary malloc area 21 * that can be used for temporary malloc area
24 */ 22 */
25unsigned long free_mem_ptr; 23unsigned long free_mem_ptr;
26unsigned long free_mem_end_ptr; 24unsigned long free_mem_end_ptr;
27char *zimage_start;
28 25
29/* The linker tells us where the image is. */ 26/* The linker tells us where the image is. */
30extern unsigned char __image_begin, __image_end; 27extern unsigned char __image_begin, __image_end;
@@ -83,38 +80,31 @@ void *memset(void *s, int c, size_t n)
83 80
84void decompress_kernel(unsigned long boot_heap_start) 81void decompress_kernel(unsigned long boot_heap_start)
85{ 82{
86 int zimage_size; 83 unsigned long zimage_start, zimage_size;
87 84
88 /* 85 zimage_start = (unsigned long)(&__image_begin);
89 * We link ourself to an arbitrary low address. When we run, we
90 * relocate outself to that address. __image_beign points to
91 * the part of the image where the zImage is. -- Tom
92 */
93 zimage_start = (char *)(unsigned long)(&__image_begin);
94 zimage_size = (unsigned long)(&__image_end) - 86 zimage_size = (unsigned long)(&__image_end) -
95 (unsigned long)(&__image_begin); 87 (unsigned long)(&__image_begin);
96 88
97 /*
98 * The zImage and initrd will be between start and _end, so they've
99 * already been moved once. We're good to go now. -- Tom
100 */
101 puts("zimage at: "); 89 puts("zimage at: ");
102 puthex((unsigned long)zimage_start); 90 puthex(zimage_start);
103 puts(" "); 91 puts(" ");
104 puthex((unsigned long)(zimage_size + zimage_start)); 92 puthex(zimage_size + zimage_start);
105 puts("\n"); 93 puts("\n");
106 94
107 /* this area are prepared for mallocing when decompressing */ 95 /* This area are prepared for mallocing when decompressing */
108 free_mem_ptr = boot_heap_start; 96 free_mem_ptr = boot_heap_start;
109 free_mem_end_ptr = boot_heap_start + BOOT_HEAP_SIZE; 97 free_mem_end_ptr = boot_heap_start + BOOT_HEAP_SIZE;
110 98
111 /* Display standard Linux/MIPS boot prompt for kernel args */ 99 /* Display standard Linux/MIPS boot prompt */
112 puts("Uncompressing Linux at load address "); 100 puts("Uncompressing Linux at load address ");
113 puthex(VMLINUX_LOAD_ADDRESS_ULL); 101 puthex(VMLINUX_LOAD_ADDRESS_ULL);
114 puts("\n"); 102 puts("\n");
103
115 /* Decompress the kernel with according algorithm */ 104 /* Decompress the kernel with according algorithm */
116 decompress(zimage_start, zimage_size, 0, 0, 105 decompress((char *)zimage_start, zimage_size, 0, 0,
117 (void *)VMLINUX_LOAD_ADDRESS_ULL, 0, error); 106 (void *)VMLINUX_LOAD_ADDRESS_ULL, 0, error);
118 /* FIXME: is there a need to flush cache here? */ 107
108 /* FIXME: should we flush cache here? */
119 puts("Now, booting the kernel...\n"); 109 puts("Now, booting the kernel...\n");
120} 110}
diff --git a/arch/mips/boot/compressed/ld.script b/arch/mips/boot/compressed/ld.script
index 613a35b02f50..8e6b07ca2f5e 100644
--- a/arch/mips/boot/compressed/ld.script
+++ b/arch/mips/boot/compressed/ld.script
@@ -2,61 +2,44 @@
2 * ld.script for compressed kernel support of MIPS 2 * ld.script for compressed kernel support of MIPS
3 * 3 *
4 * Copyright (C) 2009 Lemote Inc. 4 * Copyright (C) 2009 Lemote Inc.
5 * Author: Wu Zhangjin <wuzj@lemote.com> 5 * Author: Wu Zhangjin <wuzhanjing@gmail.com>
6 * Copyright (C) 2010 "Wu Zhangjin" <wuzhanjing@gmail.com>
6 */ 7 */
7 8
8OUTPUT_ARCH(mips) 9OUTPUT_ARCH(mips)
9ENTRY(start) 10ENTRY(start)
10SECTIONS 11SECTIONS
11{ 12{
12 /* . = VMLINUZ_LOAD_ADDRESS */ 13 /* Text and read-only data */
13 /* read-only */ 14 /* . = VMLINUZ_LOAD_ADDRESS; */
14 _text = .; /* Text and read-only data */ 15 .text : {
15 .text : {
16 _ftext = . ;
17 *(.text) 16 *(.text)
18 *(.rodata) 17 *(.rodata)
19 } = 0 18 }
20 _etext = .; /* End of text section */ 19 /* End of text section */
21 20
22 /* writable */ 21 /* Writable data */
23 .data : { /* Data */ 22 .data : {
24 _fdata = . ;
25 *(.data) 23 *(.data)
26 /* Put the compressed image here, so bss is on the end. */ 24 /* Put the compressed image here */
27 __image_begin = .; 25 __image_begin = .;
28 *(.image) 26 *(.image)
29 __image_end = .; 27 __image_end = .;
30 CONSTRUCTORS 28 CONSTRUCTORS
31 } 29 }
32 .sdata : { *(.sdata) } 30 . = ALIGN(16);
33 . = ALIGN(4); 31 _edata = .;
34 _edata = .; /* End of data section */ 32 /* End of data section */
35 33
36 /* BSS */ 34 /* BSS */
37 __bss_start = .; 35 .bss : {
38 _fbss = .;
39 .sbss : { *(.sbss) *(.scommon) }
40 .bss : {
41 *(.dynbss)
42 *(.bss) 36 *(.bss)
43 *(COMMON)
44 } 37 }
45 . = ALIGN(4); 38 . = ALIGN(16);
46 _end = . ; 39 _end = .;
47
48 /* These are needed for ELF backends which have not yet been converted
49 * to the new style linker. */
50
51 .stab 0 : { *(.stab) }
52 .stabstr 0 : { *(.stabstr) }
53
54 /* These must appear regardless of . */
55 .gptab.sdata : { *(.gptab.data) *(.gptab.sdata) }
56 .gptab.sbss : { *(.gptab.bss) *(.gptab.sbss) }
57 40
58 /* Sections to be discarded */ 41 /* Sections to be discarded */
59 /DISCARD/ : { 42 /DISCARD/ : {
60 *(.MIPS.options) 43 *(.MIPS.options)
61 *(.options) 44 *(.options)
62 *(.pdr) 45 *(.pdr)
diff --git a/arch/mips/cavium-octeon/Makefile b/arch/mips/cavium-octeon/Makefile
index 3e9876317e61..19eb0434269f 100644
--- a/arch/mips/cavium-octeon/Makefile
+++ b/arch/mips/cavium-octeon/Makefile
@@ -12,7 +12,6 @@
12obj-y := cpu.o setup.o serial.o octeon-platform.o octeon-irq.o csrc-octeon.o 12obj-y := cpu.o setup.o serial.o octeon-platform.o octeon-irq.o csrc-octeon.o
13obj-y += dma-octeon.o flash_setup.o 13obj-y += dma-octeon.o flash_setup.o
14obj-y += octeon-memcpy.o 14obj-y += octeon-memcpy.o
15obj-y += executive/
15 16
16obj-$(CONFIG_SMP) += smp.o 17obj-$(CONFIG_SMP) += smp.o
17
18EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/cavium-octeon/Platform b/arch/mips/cavium-octeon/Platform
new file mode 100644
index 000000000000..1e43ccf1a792
--- /dev/null
+++ b/arch/mips/cavium-octeon/Platform
@@ -0,0 +1,11 @@
1#
2# Cavium Octeon
3#
4platform-$(CONFIG_CPU_CAVIUM_OCTEON) += cavium-octeon/
5cflags-$(CONFIG_CPU_CAVIUM_OCTEON) += \
6 -I$(srctree)/arch/mips/include/asm/mach-cavium-octeon
7ifdef CONFIG_CAVIUM_OCTEON_2ND_KERNEL
8load-$(CONFIG_CPU_CAVIUM_OCTEON) += 0xffffffff84100000
9else
10load-$(CONFIG_CPU_CAVIUM_OCTEON) += 0xffffffff81100000
11endif
diff --git a/arch/mips/cavium-octeon/cpu.c b/arch/mips/cavium-octeon/cpu.c
index b6df5387e855..c664c8cc2b42 100644
--- a/arch/mips/cavium-octeon/cpu.c
+++ b/arch/mips/cavium-octeon/cpu.c
@@ -41,12 +41,8 @@ static int cnmips_cu2_call(struct notifier_block *nfb, unsigned long action,
41 return NOTIFY_OK; /* Let default notifier send signals */ 41 return NOTIFY_OK; /* Let default notifier send signals */
42} 42}
43 43
44static struct notifier_block cnmips_cu2_notifier = {
45 .notifier_call = cnmips_cu2_call,
46};
47
48static int cnmips_cu2_setup(void) 44static int cnmips_cu2_setup(void)
49{ 45{
50 return register_cu2_notifier(&cnmips_cu2_notifier); 46 return cu2_notifier(cnmips_cu2_call, 0);
51} 47}
52early_initcall(cnmips_cu2_setup); 48early_initcall(cnmips_cu2_setup);
diff --git a/arch/mips/cavium-octeon/csrc-octeon.c b/arch/mips/cavium-octeon/csrc-octeon.c
index 0bf4bbe04ae2..b6847c8e0ddd 100644
--- a/arch/mips/cavium-octeon/csrc-octeon.c
+++ b/arch/mips/cavium-octeon/csrc-octeon.c
@@ -53,7 +53,6 @@ static struct clocksource clocksource_mips = {
53unsigned long long notrace sched_clock(void) 53unsigned long long notrace sched_clock(void)
54{ 54{
55 /* 64-bit arithmatic can overflow, so use 128-bit. */ 55 /* 64-bit arithmatic can overflow, so use 128-bit. */
56#if (__GNUC__ < 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ <= 3))
57 u64 t1, t2, t3; 56 u64 t1, t2, t3;
58 unsigned long long rv; 57 unsigned long long rv;
59 u64 mult = clocksource_mips.mult; 58 u64 mult = clocksource_mips.mult;
@@ -73,13 +72,6 @@ unsigned long long notrace sched_clock(void)
73 : [cnt] "r" (cnt), [mult] "r" (mult), [shift] "r" (shift) 72 : [cnt] "r" (cnt), [mult] "r" (mult), [shift] "r" (shift)
74 : "hi", "lo"); 73 : "hi", "lo");
75 return rv; 74 return rv;
76#else
77 /* GCC > 4.3 do it the easy way. */
78 unsigned int __attribute__((mode(TI))) t;
79 t = read_c0_cvmcount();
80 t = t * clocksource_mips.mult;
81 return (unsigned long long)(t >> clocksource_mips.shift);
82#endif
83} 75}
84 76
85void __init plat_time_init(void) 77void __init plat_time_init(void)
@@ -88,3 +80,58 @@ void __init plat_time_init(void)
88 clocksource_set_clock(&clocksource_mips, mips_hpt_frequency); 80 clocksource_set_clock(&clocksource_mips, mips_hpt_frequency);
89 clocksource_register(&clocksource_mips); 81 clocksource_register(&clocksource_mips);
90} 82}
83
84static u64 octeon_udelay_factor;
85static u64 octeon_ndelay_factor;
86
87void __init octeon_setup_delays(void)
88{
89 octeon_udelay_factor = octeon_get_clock_rate() / 1000000;
90 /*
91 * For __ndelay we divide by 2^16, so the factor is multiplied
92 * by the same amount.
93 */
94 octeon_ndelay_factor = (octeon_udelay_factor * 0x10000ull) / 1000ull;
95
96 preset_lpj = octeon_get_clock_rate() / HZ;
97}
98
99void __udelay(unsigned long us)
100{
101 u64 cur, end, inc;
102
103 cur = read_c0_cvmcount();
104
105 inc = us * octeon_udelay_factor;
106 end = cur + inc;
107
108 while (end > cur)
109 cur = read_c0_cvmcount();
110}
111EXPORT_SYMBOL(__udelay);
112
113void __ndelay(unsigned long ns)
114{
115 u64 cur, end, inc;
116
117 cur = read_c0_cvmcount();
118
119 inc = ((ns * octeon_ndelay_factor) >> 16);
120 end = cur + inc;
121
122 while (end > cur)
123 cur = read_c0_cvmcount();
124}
125EXPORT_SYMBOL(__ndelay);
126
127void __delay(unsigned long loops)
128{
129 u64 cur, end;
130
131 cur = read_c0_cvmcount();
132 end = cur + loops;
133
134 while (end > cur)
135 cur = read_c0_cvmcount();
136}
137EXPORT_SYMBOL(__delay);
diff --git a/arch/mips/cavium-octeon/dma-octeon.c b/arch/mips/cavium-octeon/dma-octeon.c
index be531ec1f206..d22b5a2d64f4 100644
--- a/arch/mips/cavium-octeon/dma-octeon.c
+++ b/arch/mips/cavium-octeon/dma-octeon.c
@@ -99,13 +99,16 @@ dma_addr_t octeon_map_dma_mem(struct device *dev, void *ptr, size_t size)
99 panic("dma_map_single: " 99 panic("dma_map_single: "
100 "Attempt to map illegal memory address 0x%llx\n", 100 "Attempt to map illegal memory address 0x%llx\n",
101 physical); 101 physical);
102 else if ((physical + size >= 102 else if (physical >= CVMX_PCIE_BAR1_PHYS_BASE &&
103 (4ull<<30) - (OCTEON_PCI_BAR1_HOLE_SIZE<<20)) 103 physical + size < (CVMX_PCIE_BAR1_PHYS_BASE + CVMX_PCIE_BAR1_PHYS_SIZE)) {
104 && physical < (4ull<<30)) 104 result = physical - CVMX_PCIE_BAR1_PHYS_BASE + CVMX_PCIE_BAR1_RC_BASE;
105 pr_warning("dma_map_single: Warning: " 105
106 "Mapping memory address that might " 106 if (((result+size-1) & dma_mask) != result+size-1)
107 "conflict with devices 0x%llx-0x%llx\n", 107 panic("dma_map_single: Attempt to map address 0x%llx-0x%llx, which can't be accessed according to the dma mask 0x%llx\n",
108 physical, physical+size-1); 108 physical, physical+size-1, dma_mask);
109 goto done;
110 }
111
109 /* The 2nd 256MB is mapped at 256<<20 instead of 0x410000000 */ 112 /* The 2nd 256MB is mapped at 256<<20 instead of 0x410000000 */
110 if ((physical >= 0x410000000ull) && physical < 0x420000000ull) 113 if ((physical >= 0x410000000ull) && physical < 0x420000000ull)
111 result = physical - 0x400000000ull; 114 result = physical - 0x400000000ull;
diff --git a/arch/mips/cavium-octeon/octeon-irq.c b/arch/mips/cavium-octeon/octeon-irq.c
index c424cd158dc6..ce7500cdf5b7 100644
--- a/arch/mips/cavium-octeon/octeon-irq.c
+++ b/arch/mips/cavium-octeon/octeon-irq.c
@@ -3,15 +3,13 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2004-2008 Cavium Networks 6 * Copyright (C) 2004-2008, 2009, 2010 Cavium Networks
7 */ 7 */
8#include <linux/irq.h> 8#include <linux/irq.h>
9#include <linux/interrupt.h> 9#include <linux/interrupt.h>
10#include <linux/smp.h> 10#include <linux/smp.h>
11 11
12#include <asm/octeon/octeon.h> 12#include <asm/octeon/octeon.h>
13#include <asm/octeon/cvmx-pexp-defs.h>
14#include <asm/octeon/cvmx-npi-defs.h>
15 13
16static DEFINE_RAW_SPINLOCK(octeon_irq_ciu0_lock); 14static DEFINE_RAW_SPINLOCK(octeon_irq_ciu0_lock);
17static DEFINE_RAW_SPINLOCK(octeon_irq_ciu1_lock); 15static DEFINE_RAW_SPINLOCK(octeon_irq_ciu1_lock);
@@ -41,14 +39,14 @@ static void octeon_irq_core_ack(unsigned int irq)
41 39
42static void octeon_irq_core_eoi(unsigned int irq) 40static void octeon_irq_core_eoi(unsigned int irq)
43{ 41{
44 struct irq_desc *desc = irq_desc + irq; 42 struct irq_desc *desc = irq_to_desc(irq);
45 unsigned int bit = irq - OCTEON_IRQ_SW0; 43 unsigned int bit = irq - OCTEON_IRQ_SW0;
46 /* 44 /*
47 * If an IRQ is being processed while we are disabling it the 45 * If an IRQ is being processed while we are disabling it the
48 * handler will attempt to unmask the interrupt after it has 46 * handler will attempt to unmask the interrupt after it has
49 * been disabled. 47 * been disabled.
50 */ 48 */
51 if (desc->status & IRQ_DISABLED) 49 if ((unlikely(desc->status & IRQ_DISABLED)))
52 return; 50 return;
53 /* 51 /*
54 * We don't need to disable IRQs to make these atomic since 52 * We don't need to disable IRQs to make these atomic since
@@ -106,6 +104,29 @@ static struct irq_chip octeon_irq_chip_core = {
106 104
107static void octeon_irq_ciu0_ack(unsigned int irq) 105static void octeon_irq_ciu0_ack(unsigned int irq)
108{ 106{
107 switch (irq) {
108 case OCTEON_IRQ_GMX_DRP0:
109 case OCTEON_IRQ_GMX_DRP1:
110 case OCTEON_IRQ_IPD_DRP:
111 case OCTEON_IRQ_KEY_ZERO:
112 case OCTEON_IRQ_TIMER0:
113 case OCTEON_IRQ_TIMER1:
114 case OCTEON_IRQ_TIMER2:
115 case OCTEON_IRQ_TIMER3:
116 {
117 int index = cvmx_get_core_num() * 2;
118 u64 mask = 1ull << (irq - OCTEON_IRQ_WORKQ0);
119 /*
120 * CIU timer type interrupts must be acknoleged by
121 * writing a '1' bit to their sum0 bit.
122 */
123 cvmx_write_csr(CVMX_CIU_INTX_SUM0(index), mask);
124 break;
125 }
126 default:
127 break;
128 }
129
109 /* 130 /*
110 * In order to avoid any locking accessing the CIU, we 131 * In order to avoid any locking accessing the CIU, we
111 * acknowledge CIU interrupts by disabling all of them. This 132 * acknowledge CIU interrupts by disabling all of them. This
@@ -130,8 +151,54 @@ static void octeon_irq_ciu0_eoi(unsigned int irq)
130 set_c0_status(0x100 << 2); 151 set_c0_status(0x100 << 2);
131} 152}
132 153
154static int next_coreid_for_irq(struct irq_desc *desc)
155{
156
157#ifdef CONFIG_SMP
158 int coreid;
159 int weight = cpumask_weight(desc->affinity);
160
161 if (weight > 1) {
162 int cpu = smp_processor_id();
163 for (;;) {
164 cpu = cpumask_next(cpu, desc->affinity);
165 if (cpu >= nr_cpu_ids) {
166 cpu = -1;
167 continue;
168 } else if (cpumask_test_cpu(cpu, cpu_online_mask)) {
169 break;
170 }
171 }
172 coreid = octeon_coreid_for_cpu(cpu);
173 } else if (weight == 1) {
174 coreid = octeon_coreid_for_cpu(cpumask_first(desc->affinity));
175 } else {
176 coreid = cvmx_get_core_num();
177 }
178 return coreid;
179#else
180 return cvmx_get_core_num();
181#endif
182}
183
133static void octeon_irq_ciu0_enable(unsigned int irq) 184static void octeon_irq_ciu0_enable(unsigned int irq)
134{ 185{
186 struct irq_desc *desc = irq_to_desc(irq);
187 int coreid = next_coreid_for_irq(desc);
188 unsigned long flags;
189 uint64_t en0;
190 int bit = irq - OCTEON_IRQ_WORKQ0; /* Bit 0-63 of EN0 */
191
192 raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags);
193 en0 = cvmx_read_csr(CVMX_CIU_INTX_EN0(coreid * 2));
194 en0 |= 1ull << bit;
195 cvmx_write_csr(CVMX_CIU_INTX_EN0(coreid * 2), en0);
196 cvmx_read_csr(CVMX_CIU_INTX_EN0(coreid * 2));
197 raw_spin_unlock_irqrestore(&octeon_irq_ciu0_lock, flags);
198}
199
200static void octeon_irq_ciu0_enable_mbox(unsigned int irq)
201{
135 int coreid = cvmx_get_core_num(); 202 int coreid = cvmx_get_core_num();
136 unsigned long flags; 203 unsigned long flags;
137 uint64_t en0; 204 uint64_t en0;
@@ -167,63 +234,76 @@ static void octeon_irq_ciu0_disable(unsigned int irq)
167} 234}
168 235
169/* 236/*
170 * Enable the irq on the current core for chips that have the EN*_W1{S,C} 237 * Enable the irq on the next core in the affinity set for chips that
171 * registers. 238 * have the EN*_W1{S,C} registers.
172 */ 239 */
173static void octeon_irq_ciu0_enable_v2(unsigned int irq) 240static void octeon_irq_ciu0_enable_v2(unsigned int irq)
174{ 241{
175 int index = cvmx_get_core_num() * 2; 242 int index;
176 u64 mask = 1ull << (irq - OCTEON_IRQ_WORKQ0); 243 u64 mask = 1ull << (irq - OCTEON_IRQ_WORKQ0);
244 struct irq_desc *desc = irq_to_desc(irq);
177 245
178 cvmx_write_csr(CVMX_CIU_INTX_EN0_W1S(index), mask); 246 if ((desc->status & IRQ_DISABLED) == 0) {
247 index = next_coreid_for_irq(desc) * 2;
248 cvmx_write_csr(CVMX_CIU_INTX_EN0_W1S(index), mask);
249 }
179} 250}
180 251
181/* 252/*
182 * Disable the irq on the current core for chips that have the EN*_W1{S,C} 253 * Enable the irq on the current CPU for chips that
183 * registers. 254 * have the EN*_W1{S,C} registers.
184 */ 255 */
185static void octeon_irq_ciu0_ack_v2(unsigned int irq) 256static void octeon_irq_ciu0_enable_mbox_v2(unsigned int irq)
186{ 257{
187 int index = cvmx_get_core_num() * 2; 258 int index;
188 u64 mask = 1ull << (irq - OCTEON_IRQ_WORKQ0); 259 u64 mask = 1ull << (irq - OCTEON_IRQ_WORKQ0);
189 260
190 cvmx_write_csr(CVMX_CIU_INTX_EN0_W1C(index), mask); 261 index = cvmx_get_core_num() * 2;
262 cvmx_write_csr(CVMX_CIU_INTX_EN0_W1S(index), mask);
191} 263}
192 264
193/* 265/*
194 * CIU timer type interrupts must be acknoleged by writing a '1' bit 266 * Disable the irq on the current core for chips that have the EN*_W1{S,C}
195 * to their sum0 bit. 267 * registers.
196 */ 268 */
197static void octeon_irq_ciu0_timer_ack(unsigned int irq) 269static void octeon_irq_ciu0_ack_v2(unsigned int irq)
198{ 270{
199 int index = cvmx_get_core_num() * 2; 271 int index = cvmx_get_core_num() * 2;
200 uint64_t mask = 1ull << (irq - OCTEON_IRQ_WORKQ0); 272 u64 mask = 1ull << (irq - OCTEON_IRQ_WORKQ0);
201 cvmx_write_csr(CVMX_CIU_INTX_SUM0(index), mask);
202}
203 273
204static void octeon_irq_ciu0_timer_ack_v1(unsigned int irq) 274 switch (irq) {
205{ 275 case OCTEON_IRQ_GMX_DRP0:
206 octeon_irq_ciu0_timer_ack(irq); 276 case OCTEON_IRQ_GMX_DRP1:
207 octeon_irq_ciu0_ack(irq); 277 case OCTEON_IRQ_IPD_DRP:
208} 278 case OCTEON_IRQ_KEY_ZERO:
279 case OCTEON_IRQ_TIMER0:
280 case OCTEON_IRQ_TIMER1:
281 case OCTEON_IRQ_TIMER2:
282 case OCTEON_IRQ_TIMER3:
283 /*
284 * CIU timer type interrupts must be acknoleged by
285 * writing a '1' bit to their sum0 bit.
286 */
287 cvmx_write_csr(CVMX_CIU_INTX_SUM0(index), mask);
288 break;
289 default:
290 break;
291 }
209 292
210static void octeon_irq_ciu0_timer_ack_v2(unsigned int irq) 293 cvmx_write_csr(CVMX_CIU_INTX_EN0_W1C(index), mask);
211{
212 octeon_irq_ciu0_timer_ack(irq);
213 octeon_irq_ciu0_ack_v2(irq);
214} 294}
215 295
216/* 296/*
217 * Enable the irq on the current core for chips that have the EN*_W1{S,C} 297 * Enable the irq on the current core for chips that have the EN*_W1{S,C}
218 * registers. 298 * registers.
219 */ 299 */
220static void octeon_irq_ciu0_eoi_v2(unsigned int irq) 300static void octeon_irq_ciu0_eoi_mbox_v2(unsigned int irq)
221{ 301{
222 struct irq_desc *desc = irq_desc + irq; 302 struct irq_desc *desc = irq_to_desc(irq);
223 int index = cvmx_get_core_num() * 2; 303 int index = cvmx_get_core_num() * 2;
224 u64 mask = 1ull << (irq - OCTEON_IRQ_WORKQ0); 304 u64 mask = 1ull << (irq - OCTEON_IRQ_WORKQ0);
225 305
226 if ((desc->status & IRQ_DISABLED) == 0) 306 if (likely((desc->status & IRQ_DISABLED) == 0))
227 cvmx_write_csr(CVMX_CIU_INTX_EN0_W1S(index), mask); 307 cvmx_write_csr(CVMX_CIU_INTX_EN0_W1S(index), mask);
228} 308}
229 309
@@ -246,18 +326,30 @@ static void octeon_irq_ciu0_disable_all_v2(unsigned int irq)
246static int octeon_irq_ciu0_set_affinity(unsigned int irq, const struct cpumask *dest) 326static int octeon_irq_ciu0_set_affinity(unsigned int irq, const struct cpumask *dest)
247{ 327{
248 int cpu; 328 int cpu;
329 struct irq_desc *desc = irq_to_desc(irq);
330 int enable_one = (desc->status & IRQ_DISABLED) == 0;
249 unsigned long flags; 331 unsigned long flags;
250 int bit = irq - OCTEON_IRQ_WORKQ0; /* Bit 0-63 of EN0 */ 332 int bit = irq - OCTEON_IRQ_WORKQ0; /* Bit 0-63 of EN0 */
251 333
334 /*
335 * For non-v2 CIU, we will allow only single CPU affinity.
336 * This removes the need to do locking in the .ack/.eoi
337 * functions.
338 */
339 if (cpumask_weight(dest) != 1)
340 return -EINVAL;
341
252 raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags); 342 raw_spin_lock_irqsave(&octeon_irq_ciu0_lock, flags);
253 for_each_online_cpu(cpu) { 343 for_each_online_cpu(cpu) {
254 int coreid = octeon_coreid_for_cpu(cpu); 344 int coreid = octeon_coreid_for_cpu(cpu);
255 uint64_t en0 = 345 uint64_t en0 =
256 cvmx_read_csr(CVMX_CIU_INTX_EN0(coreid * 2)); 346 cvmx_read_csr(CVMX_CIU_INTX_EN0(coreid * 2));
257 if (cpumask_test_cpu(cpu, dest)) 347 if (cpumask_test_cpu(cpu, dest) && enable_one) {
348 enable_one = 0;
258 en0 |= 1ull << bit; 349 en0 |= 1ull << bit;
259 else 350 } else {
260 en0 &= ~(1ull << bit); 351 en0 &= ~(1ull << bit);
352 }
261 cvmx_write_csr(CVMX_CIU_INTX_EN0(coreid * 2), en0); 353 cvmx_write_csr(CVMX_CIU_INTX_EN0(coreid * 2), en0);
262 } 354 }
263 /* 355 /*
@@ -279,13 +371,18 @@ static int octeon_irq_ciu0_set_affinity_v2(unsigned int irq,
279{ 371{
280 int cpu; 372 int cpu;
281 int index; 373 int index;
374 struct irq_desc *desc = irq_to_desc(irq);
375 int enable_one = (desc->status & IRQ_DISABLED) == 0;
282 u64 mask = 1ull << (irq - OCTEON_IRQ_WORKQ0); 376 u64 mask = 1ull << (irq - OCTEON_IRQ_WORKQ0);
377
283 for_each_online_cpu(cpu) { 378 for_each_online_cpu(cpu) {
284 index = octeon_coreid_for_cpu(cpu) * 2; 379 index = octeon_coreid_for_cpu(cpu) * 2;
285 if (cpumask_test_cpu(cpu, dest)) 380 if (cpumask_test_cpu(cpu, dest) && enable_one) {
381 enable_one = 0;
286 cvmx_write_csr(CVMX_CIU_INTX_EN0_W1S(index), mask); 382 cvmx_write_csr(CVMX_CIU_INTX_EN0_W1S(index), mask);
287 else 383 } else {
288 cvmx_write_csr(CVMX_CIU_INTX_EN0_W1C(index), mask); 384 cvmx_write_csr(CVMX_CIU_INTX_EN0_W1C(index), mask);
385 }
289 } 386 }
290 return 0; 387 return 0;
291} 388}
@@ -298,8 +395,7 @@ static struct irq_chip octeon_irq_chip_ciu0_v2 = {
298 .name = "CIU0", 395 .name = "CIU0",
299 .enable = octeon_irq_ciu0_enable_v2, 396 .enable = octeon_irq_ciu0_enable_v2,
300 .disable = octeon_irq_ciu0_disable_all_v2, 397 .disable = octeon_irq_ciu0_disable_all_v2,
301 .ack = octeon_irq_ciu0_ack_v2, 398 .eoi = octeon_irq_ciu0_enable_v2,
302 .eoi = octeon_irq_ciu0_eoi_v2,
303#ifdef CONFIG_SMP 399#ifdef CONFIG_SMP
304 .set_affinity = octeon_irq_ciu0_set_affinity_v2, 400 .set_affinity = octeon_irq_ciu0_set_affinity_v2,
305#endif 401#endif
@@ -309,36 +405,27 @@ static struct irq_chip octeon_irq_chip_ciu0 = {
309 .name = "CIU0", 405 .name = "CIU0",
310 .enable = octeon_irq_ciu0_enable, 406 .enable = octeon_irq_ciu0_enable,
311 .disable = octeon_irq_ciu0_disable, 407 .disable = octeon_irq_ciu0_disable,
312 .ack = octeon_irq_ciu0_ack,
313 .eoi = octeon_irq_ciu0_eoi, 408 .eoi = octeon_irq_ciu0_eoi,
314#ifdef CONFIG_SMP 409#ifdef CONFIG_SMP
315 .set_affinity = octeon_irq_ciu0_set_affinity, 410 .set_affinity = octeon_irq_ciu0_set_affinity,
316#endif 411#endif
317}; 412};
318 413
319static struct irq_chip octeon_irq_chip_ciu0_timer_v2 = { 414/* The mbox versions don't do any affinity or round-robin. */
320 .name = "CIU0-T", 415static struct irq_chip octeon_irq_chip_ciu0_mbox_v2 = {
321 .enable = octeon_irq_ciu0_enable_v2, 416 .name = "CIU0-M",
322 .disable = octeon_irq_ciu0_disable_all_v2, 417 .enable = octeon_irq_ciu0_enable_mbox_v2,
323 .ack = octeon_irq_ciu0_timer_ack_v2, 418 .disable = octeon_irq_ciu0_disable,
324 .eoi = octeon_irq_ciu0_eoi_v2, 419 .eoi = octeon_irq_ciu0_eoi_mbox_v2,
325#ifdef CONFIG_SMP
326 .set_affinity = octeon_irq_ciu0_set_affinity_v2,
327#endif
328}; 420};
329 421
330static struct irq_chip octeon_irq_chip_ciu0_timer = { 422static struct irq_chip octeon_irq_chip_ciu0_mbox = {
331 .name = "CIU0-T", 423 .name = "CIU0-M",
332 .enable = octeon_irq_ciu0_enable, 424 .enable = octeon_irq_ciu0_enable_mbox,
333 .disable = octeon_irq_ciu0_disable, 425 .disable = octeon_irq_ciu0_disable,
334 .ack = octeon_irq_ciu0_timer_ack_v1,
335 .eoi = octeon_irq_ciu0_eoi, 426 .eoi = octeon_irq_ciu0_eoi,
336#ifdef CONFIG_SMP
337 .set_affinity = octeon_irq_ciu0_set_affinity,
338#endif
339}; 427};
340 428
341
342static void octeon_irq_ciu1_ack(unsigned int irq) 429static void octeon_irq_ciu1_ack(unsigned int irq)
343{ 430{
344 /* 431 /*
@@ -365,10 +452,30 @@ static void octeon_irq_ciu1_eoi(unsigned int irq)
365 452
366static void octeon_irq_ciu1_enable(unsigned int irq) 453static void octeon_irq_ciu1_enable(unsigned int irq)
367{ 454{
368 int coreid = cvmx_get_core_num(); 455 struct irq_desc *desc = irq_to_desc(irq);
456 int coreid = next_coreid_for_irq(desc);
457 unsigned long flags;
458 uint64_t en1;
459 int bit = irq - OCTEON_IRQ_WDOG0; /* Bit 0-63 of EN1 */
460
461 raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags);
462 en1 = cvmx_read_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1));
463 en1 |= 1ull << bit;
464 cvmx_write_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1), en1);
465 cvmx_read_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1));
466 raw_spin_unlock_irqrestore(&octeon_irq_ciu1_lock, flags);
467}
468
469/*
470 * Watchdog interrupts are special. They are associated with a single
471 * core, so we hardwire the affinity to that core.
472 */
473static void octeon_irq_ciu1_wd_enable(unsigned int irq)
474{
369 unsigned long flags; 475 unsigned long flags;
370 uint64_t en1; 476 uint64_t en1;
371 int bit = irq - OCTEON_IRQ_WDOG0; /* Bit 0-63 of EN1 */ 477 int bit = irq - OCTEON_IRQ_WDOG0; /* Bit 0-63 of EN1 */
478 int coreid = bit;
372 479
373 raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags); 480 raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags);
374 en1 = cvmx_read_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1)); 481 en1 = cvmx_read_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1));
@@ -405,36 +512,43 @@ static void octeon_irq_ciu1_disable(unsigned int irq)
405 */ 512 */
406static void octeon_irq_ciu1_enable_v2(unsigned int irq) 513static void octeon_irq_ciu1_enable_v2(unsigned int irq)
407{ 514{
408 int index = cvmx_get_core_num() * 2 + 1; 515 int index;
409 u64 mask = 1ull << (irq - OCTEON_IRQ_WDOG0); 516 u64 mask = 1ull << (irq - OCTEON_IRQ_WDOG0);
517 struct irq_desc *desc = irq_to_desc(irq);
410 518
411 cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(index), mask); 519 if ((desc->status & IRQ_DISABLED) == 0) {
520 index = next_coreid_for_irq(desc) * 2 + 1;
521 cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(index), mask);
522 }
412} 523}
413 524
414/* 525/*
415 * Disable the irq on the current core for chips that have the EN*_W1{S,C} 526 * Watchdog interrupts are special. They are associated with a single
416 * registers. 527 * core, so we hardwire the affinity to that core.
417 */ 528 */
418static void octeon_irq_ciu1_ack_v2(unsigned int irq) 529static void octeon_irq_ciu1_wd_enable_v2(unsigned int irq)
419{ 530{
420 int index = cvmx_get_core_num() * 2 + 1; 531 int index;
532 int coreid = irq - OCTEON_IRQ_WDOG0;
421 u64 mask = 1ull << (irq - OCTEON_IRQ_WDOG0); 533 u64 mask = 1ull << (irq - OCTEON_IRQ_WDOG0);
534 struct irq_desc *desc = irq_to_desc(irq);
422 535
423 cvmx_write_csr(CVMX_CIU_INTX_EN1_W1C(index), mask); 536 if ((desc->status & IRQ_DISABLED) == 0) {
537 index = coreid * 2 + 1;
538 cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(index), mask);
539 }
424} 540}
425 541
426/* 542/*
427 * Enable the irq on the current core for chips that have the EN*_W1{S,C} 543 * Disable the irq on the current core for chips that have the EN*_W1{S,C}
428 * registers. 544 * registers.
429 */ 545 */
430static void octeon_irq_ciu1_eoi_v2(unsigned int irq) 546static void octeon_irq_ciu1_ack_v2(unsigned int irq)
431{ 547{
432 struct irq_desc *desc = irq_desc + irq;
433 int index = cvmx_get_core_num() * 2 + 1; 548 int index = cvmx_get_core_num() * 2 + 1;
434 u64 mask = 1ull << (irq - OCTEON_IRQ_WDOG0); 549 u64 mask = 1ull << (irq - OCTEON_IRQ_WDOG0);
435 550
436 if ((desc->status & IRQ_DISABLED) == 0) 551 cvmx_write_csr(CVMX_CIU_INTX_EN1_W1C(index), mask);
437 cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(index), mask);
438} 552}
439 553
440/* 554/*
@@ -457,19 +571,30 @@ static int octeon_irq_ciu1_set_affinity(unsigned int irq,
457 const struct cpumask *dest) 571 const struct cpumask *dest)
458{ 572{
459 int cpu; 573 int cpu;
574 struct irq_desc *desc = irq_to_desc(irq);
575 int enable_one = (desc->status & IRQ_DISABLED) == 0;
460 unsigned long flags; 576 unsigned long flags;
461 int bit = irq - OCTEON_IRQ_WDOG0; /* Bit 0-63 of EN1 */ 577 int bit = irq - OCTEON_IRQ_WDOG0; /* Bit 0-63 of EN1 */
462 578
579 /*
580 * For non-v2 CIU, we will allow only single CPU affinity.
581 * This removes the need to do locking in the .ack/.eoi
582 * functions.
583 */
584 if (cpumask_weight(dest) != 1)
585 return -EINVAL;
586
463 raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags); 587 raw_spin_lock_irqsave(&octeon_irq_ciu1_lock, flags);
464 for_each_online_cpu(cpu) { 588 for_each_online_cpu(cpu) {
465 int coreid = octeon_coreid_for_cpu(cpu); 589 int coreid = octeon_coreid_for_cpu(cpu);
466 uint64_t en1 = 590 uint64_t en1 =
467 cvmx_read_csr(CVMX_CIU_INTX_EN1 591 cvmx_read_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1));
468 (coreid * 2 + 1)); 592 if (cpumask_test_cpu(cpu, dest) && enable_one) {
469 if (cpumask_test_cpu(cpu, dest)) 593 enable_one = 0;
470 en1 |= 1ull << bit; 594 en1 |= 1ull << bit;
471 else 595 } else {
472 en1 &= ~(1ull << bit); 596 en1 &= ~(1ull << bit);
597 }
473 cvmx_write_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1), en1); 598 cvmx_write_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1), en1);
474 } 599 }
475 /* 600 /*
@@ -491,13 +616,17 @@ static int octeon_irq_ciu1_set_affinity_v2(unsigned int irq,
491{ 616{
492 int cpu; 617 int cpu;
493 int index; 618 int index;
619 struct irq_desc *desc = irq_to_desc(irq);
620 int enable_one = (desc->status & IRQ_DISABLED) == 0;
494 u64 mask = 1ull << (irq - OCTEON_IRQ_WDOG0); 621 u64 mask = 1ull << (irq - OCTEON_IRQ_WDOG0);
495 for_each_online_cpu(cpu) { 622 for_each_online_cpu(cpu) {
496 index = octeon_coreid_for_cpu(cpu) * 2 + 1; 623 index = octeon_coreid_for_cpu(cpu) * 2 + 1;
497 if (cpumask_test_cpu(cpu, dest)) 624 if (cpumask_test_cpu(cpu, dest) && enable_one) {
625 enable_one = 0;
498 cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(index), mask); 626 cvmx_write_csr(CVMX_CIU_INTX_EN1_W1S(index), mask);
499 else 627 } else {
500 cvmx_write_csr(CVMX_CIU_INTX_EN1_W1C(index), mask); 628 cvmx_write_csr(CVMX_CIU_INTX_EN1_W1C(index), mask);
629 }
501 } 630 }
502 return 0; 631 return 0;
503} 632}
@@ -507,11 +636,10 @@ static int octeon_irq_ciu1_set_affinity_v2(unsigned int irq,
507 * Newer octeon chips have support for lockless CIU operation. 636 * Newer octeon chips have support for lockless CIU operation.
508 */ 637 */
509static struct irq_chip octeon_irq_chip_ciu1_v2 = { 638static struct irq_chip octeon_irq_chip_ciu1_v2 = {
510 .name = "CIU0", 639 .name = "CIU1",
511 .enable = octeon_irq_ciu1_enable_v2, 640 .enable = octeon_irq_ciu1_enable_v2,
512 .disable = octeon_irq_ciu1_disable_all_v2, 641 .disable = octeon_irq_ciu1_disable_all_v2,
513 .ack = octeon_irq_ciu1_ack_v2, 642 .eoi = octeon_irq_ciu1_enable_v2,
514 .eoi = octeon_irq_ciu1_eoi_v2,
515#ifdef CONFIG_SMP 643#ifdef CONFIG_SMP
516 .set_affinity = octeon_irq_ciu1_set_affinity_v2, 644 .set_affinity = octeon_irq_ciu1_set_affinity_v2,
517#endif 645#endif
@@ -521,103 +649,36 @@ static struct irq_chip octeon_irq_chip_ciu1 = {
521 .name = "CIU1", 649 .name = "CIU1",
522 .enable = octeon_irq_ciu1_enable, 650 .enable = octeon_irq_ciu1_enable,
523 .disable = octeon_irq_ciu1_disable, 651 .disable = octeon_irq_ciu1_disable,
524 .ack = octeon_irq_ciu1_ack,
525 .eoi = octeon_irq_ciu1_eoi, 652 .eoi = octeon_irq_ciu1_eoi,
526#ifdef CONFIG_SMP 653#ifdef CONFIG_SMP
527 .set_affinity = octeon_irq_ciu1_set_affinity, 654 .set_affinity = octeon_irq_ciu1_set_affinity,
528#endif 655#endif
529}; 656};
530 657
531#ifdef CONFIG_PCI_MSI 658static struct irq_chip octeon_irq_chip_ciu1_wd_v2 = {
532 659 .name = "CIU1-W",
533static DEFINE_RAW_SPINLOCK(octeon_irq_msi_lock); 660 .enable = octeon_irq_ciu1_wd_enable_v2,
534 661 .disable = octeon_irq_ciu1_disable_all_v2,
535static void octeon_irq_msi_ack(unsigned int irq) 662 .eoi = octeon_irq_ciu1_wd_enable_v2,
536{ 663};
537 if (!octeon_has_feature(OCTEON_FEATURE_PCIE)) {
538 /* These chips have PCI */
539 cvmx_write_csr(CVMX_NPI_NPI_MSI_RCV,
540 1ull << (irq - OCTEON_IRQ_MSI_BIT0));
541 } else {
542 /*
543 * These chips have PCIe. Thankfully the ACK doesn't
544 * need any locking.
545 */
546 cvmx_write_csr(CVMX_PEXP_NPEI_MSI_RCV0,
547 1ull << (irq - OCTEON_IRQ_MSI_BIT0));
548 }
549}
550
551static void octeon_irq_msi_eoi(unsigned int irq)
552{
553 /* Nothing needed */
554}
555
556static void octeon_irq_msi_enable(unsigned int irq)
557{
558 if (!octeon_has_feature(OCTEON_FEATURE_PCIE)) {
559 /*
560 * Octeon PCI doesn't have the ability to mask/unmask
561 * MSI interrupts individually. Instead of
562 * masking/unmasking them in groups of 16, we simple
563 * assume MSI devices are well behaved. MSI
564 * interrupts are always enable and the ACK is assumed
565 * to be enough.
566 */
567 } else {
568 /* These chips have PCIe. Note that we only support
569 * the first 64 MSI interrupts. Unfortunately all the
570 * MSI enables are in the same register. We use
571 * MSI0's lock to control access to them all.
572 */
573 uint64_t en;
574 unsigned long flags;
575 raw_spin_lock_irqsave(&octeon_irq_msi_lock, flags);
576 en = cvmx_read_csr(CVMX_PEXP_NPEI_MSI_ENB0);
577 en |= 1ull << (irq - OCTEON_IRQ_MSI_BIT0);
578 cvmx_write_csr(CVMX_PEXP_NPEI_MSI_ENB0, en);
579 cvmx_read_csr(CVMX_PEXP_NPEI_MSI_ENB0);
580 raw_spin_unlock_irqrestore(&octeon_irq_msi_lock, flags);
581 }
582}
583
584static void octeon_irq_msi_disable(unsigned int irq)
585{
586 if (!octeon_has_feature(OCTEON_FEATURE_PCIE)) {
587 /* See comment in enable */
588 } else {
589 /*
590 * These chips have PCIe. Note that we only support
591 * the first 64 MSI interrupts. Unfortunately all the
592 * MSI enables are in the same register. We use
593 * MSI0's lock to control access to them all.
594 */
595 uint64_t en;
596 unsigned long flags;
597 raw_spin_lock_irqsave(&octeon_irq_msi_lock, flags);
598 en = cvmx_read_csr(CVMX_PEXP_NPEI_MSI_ENB0);
599 en &= ~(1ull << (irq - OCTEON_IRQ_MSI_BIT0));
600 cvmx_write_csr(CVMX_PEXP_NPEI_MSI_ENB0, en);
601 cvmx_read_csr(CVMX_PEXP_NPEI_MSI_ENB0);
602 raw_spin_unlock_irqrestore(&octeon_irq_msi_lock, flags);
603 }
604}
605 664
606static struct irq_chip octeon_irq_chip_msi = { 665static struct irq_chip octeon_irq_chip_ciu1_wd = {
607 .name = "MSI", 666 .name = "CIU1-W",
608 .enable = octeon_irq_msi_enable, 667 .enable = octeon_irq_ciu1_wd_enable,
609 .disable = octeon_irq_msi_disable, 668 .disable = octeon_irq_ciu1_disable,
610 .ack = octeon_irq_msi_ack, 669 .eoi = octeon_irq_ciu1_eoi,
611 .eoi = octeon_irq_msi_eoi,
612}; 670};
613#endif 671
672static void (*octeon_ciu0_ack)(unsigned int);
673static void (*octeon_ciu1_ack)(unsigned int);
614 674
615void __init arch_init_irq(void) 675void __init arch_init_irq(void)
616{ 676{
617 int irq; 677 unsigned int irq;
618 struct irq_chip *chip0; 678 struct irq_chip *chip0;
619 struct irq_chip *chip0_timer; 679 struct irq_chip *chip0_mbox;
620 struct irq_chip *chip1; 680 struct irq_chip *chip1;
681 struct irq_chip *chip1_wd;
621 682
622#ifdef CONFIG_SMP 683#ifdef CONFIG_SMP
623 /* Set the default affinity to the boot cpu. */ 684 /* Set the default affinity to the boot cpu. */
@@ -631,13 +692,19 @@ void __init arch_init_irq(void)
631 if (OCTEON_IS_MODEL(OCTEON_CN58XX_PASS2_X) || 692 if (OCTEON_IS_MODEL(OCTEON_CN58XX_PASS2_X) ||
632 OCTEON_IS_MODEL(OCTEON_CN56XX_PASS2_X) || 693 OCTEON_IS_MODEL(OCTEON_CN56XX_PASS2_X) ||
633 OCTEON_IS_MODEL(OCTEON_CN52XX_PASS2_X)) { 694 OCTEON_IS_MODEL(OCTEON_CN52XX_PASS2_X)) {
695 octeon_ciu0_ack = octeon_irq_ciu0_ack_v2;
696 octeon_ciu1_ack = octeon_irq_ciu1_ack_v2;
634 chip0 = &octeon_irq_chip_ciu0_v2; 697 chip0 = &octeon_irq_chip_ciu0_v2;
635 chip0_timer = &octeon_irq_chip_ciu0_timer_v2; 698 chip0_mbox = &octeon_irq_chip_ciu0_mbox_v2;
636 chip1 = &octeon_irq_chip_ciu1_v2; 699 chip1 = &octeon_irq_chip_ciu1_v2;
700 chip1_wd = &octeon_irq_chip_ciu1_wd_v2;
637 } else { 701 } else {
702 octeon_ciu0_ack = octeon_irq_ciu0_ack;
703 octeon_ciu1_ack = octeon_irq_ciu1_ack;
638 chip0 = &octeon_irq_chip_ciu0; 704 chip0 = &octeon_irq_chip_ciu0;
639 chip0_timer = &octeon_irq_chip_ciu0_timer; 705 chip0_mbox = &octeon_irq_chip_ciu0_mbox;
640 chip1 = &octeon_irq_chip_ciu1; 706 chip1 = &octeon_irq_chip_ciu1;
707 chip1_wd = &octeon_irq_chip_ciu1_wd;
641 } 708 }
642 709
643 /* 0 - 15 reserved for i8259 master and slave controller. */ 710 /* 0 - 15 reserved for i8259 master and slave controller. */
@@ -651,34 +718,23 @@ void __init arch_init_irq(void)
651 /* 24 - 87 CIU_INT_SUM0 */ 718 /* 24 - 87 CIU_INT_SUM0 */
652 for (irq = OCTEON_IRQ_WORKQ0; irq <= OCTEON_IRQ_BOOTDMA; irq++) { 719 for (irq = OCTEON_IRQ_WORKQ0; irq <= OCTEON_IRQ_BOOTDMA; irq++) {
653 switch (irq) { 720 switch (irq) {
654 case OCTEON_IRQ_GMX_DRP0: 721 case OCTEON_IRQ_MBOX0:
655 case OCTEON_IRQ_GMX_DRP1: 722 case OCTEON_IRQ_MBOX1:
656 case OCTEON_IRQ_IPD_DRP: 723 set_irq_chip_and_handler(irq, chip0_mbox, handle_percpu_irq);
657 case OCTEON_IRQ_KEY_ZERO:
658 case OCTEON_IRQ_TIMER0:
659 case OCTEON_IRQ_TIMER1:
660 case OCTEON_IRQ_TIMER2:
661 case OCTEON_IRQ_TIMER3:
662 set_irq_chip_and_handler(irq, chip0_timer, handle_percpu_irq);
663 break; 724 break;
664 default: 725 default:
665 set_irq_chip_and_handler(irq, chip0, handle_percpu_irq); 726 set_irq_chip_and_handler(irq, chip0, handle_fasteoi_irq);
666 break; 727 break;
667 } 728 }
668 } 729 }
669 730
670 /* 88 - 151 CIU_INT_SUM1 */ 731 /* 88 - 151 CIU_INT_SUM1 */
671 for (irq = OCTEON_IRQ_WDOG0; irq <= OCTEON_IRQ_RESERVED151; irq++) { 732 for (irq = OCTEON_IRQ_WDOG0; irq <= OCTEON_IRQ_WDOG15; irq++)
672 set_irq_chip_and_handler(irq, chip1, handle_percpu_irq); 733 set_irq_chip_and_handler(irq, chip1_wd, handle_fasteoi_irq);
673 } 734
735 for (irq = OCTEON_IRQ_UART2; irq <= OCTEON_IRQ_RESERVED151; irq++)
736 set_irq_chip_and_handler(irq, chip1, handle_fasteoi_irq);
674 737
675#ifdef CONFIG_PCI_MSI
676 /* 152 - 215 PCI/PCIe MSI interrupts */
677 for (irq = OCTEON_IRQ_MSI_BIT0; irq <= OCTEON_IRQ_MSI_BIT63; irq++) {
678 set_irq_chip_and_handler(irq, &octeon_irq_chip_msi,
679 handle_percpu_irq);
680 }
681#endif
682 set_c0_status(0x300 << 2); 738 set_c0_status(0x300 << 2);
683} 739}
684 740
@@ -693,6 +749,7 @@ asmlinkage void plat_irq_dispatch(void)
693 unsigned long cop0_status; 749 unsigned long cop0_status;
694 uint64_t ciu_en; 750 uint64_t ciu_en;
695 uint64_t ciu_sum; 751 uint64_t ciu_sum;
752 unsigned int irq;
696 753
697 while (1) { 754 while (1) {
698 cop0_cause = read_c0_cause(); 755 cop0_cause = read_c0_cause();
@@ -704,18 +761,24 @@ asmlinkage void plat_irq_dispatch(void)
704 ciu_sum = cvmx_read_csr(ciu_sum0_address); 761 ciu_sum = cvmx_read_csr(ciu_sum0_address);
705 ciu_en = cvmx_read_csr(ciu_en0_address); 762 ciu_en = cvmx_read_csr(ciu_en0_address);
706 ciu_sum &= ciu_en; 763 ciu_sum &= ciu_en;
707 if (likely(ciu_sum)) 764 if (likely(ciu_sum)) {
708 do_IRQ(fls64(ciu_sum) + OCTEON_IRQ_WORKQ0 - 1); 765 irq = fls64(ciu_sum) + OCTEON_IRQ_WORKQ0 - 1;
709 else 766 octeon_ciu0_ack(irq);
767 do_IRQ(irq);
768 } else {
710 spurious_interrupt(); 769 spurious_interrupt();
770 }
711 } else if (unlikely(cop0_cause & STATUSF_IP3)) { 771 } else if (unlikely(cop0_cause & STATUSF_IP3)) {
712 ciu_sum = cvmx_read_csr(ciu_sum1_address); 772 ciu_sum = cvmx_read_csr(ciu_sum1_address);
713 ciu_en = cvmx_read_csr(ciu_en1_address); 773 ciu_en = cvmx_read_csr(ciu_en1_address);
714 ciu_sum &= ciu_en; 774 ciu_sum &= ciu_en;
715 if (likely(ciu_sum)) 775 if (likely(ciu_sum)) {
716 do_IRQ(fls64(ciu_sum) + OCTEON_IRQ_WDOG0 - 1); 776 irq = fls64(ciu_sum) + OCTEON_IRQ_WDOG0 - 1;
717 else 777 octeon_ciu1_ack(irq);
778 do_IRQ(irq);
779 } else {
718 spurious_interrupt(); 780 spurious_interrupt();
781 }
719 } else if (likely(cop0_cause)) { 782 } else if (likely(cop0_cause)) {
720 do_IRQ(fls(cop0_cause) - 9 + MIPS_CPU_IRQ_BASE); 783 do_IRQ(fls(cop0_cause) - 9 + MIPS_CPU_IRQ_BASE);
721 } else { 784 } else {
@@ -725,54 +788,84 @@ asmlinkage void plat_irq_dispatch(void)
725} 788}
726 789
727#ifdef CONFIG_HOTPLUG_CPU 790#ifdef CONFIG_HOTPLUG_CPU
728static int is_irq_enabled_on_cpu(unsigned int irq, unsigned int cpu)
729{
730 unsigned int isset;
731 int coreid = octeon_coreid_for_cpu(cpu);
732 int bit = (irq < OCTEON_IRQ_WDOG0) ?
733 irq - OCTEON_IRQ_WORKQ0 : irq - OCTEON_IRQ_WDOG0;
734 if (irq < 64) {
735 isset = (cvmx_read_csr(CVMX_CIU_INTX_EN0(coreid * 2)) &
736 (1ull << bit)) >> bit;
737 } else {
738 isset = (cvmx_read_csr(CVMX_CIU_INTX_EN1(coreid * 2 + 1)) &
739 (1ull << bit)) >> bit;
740 }
741 return isset;
742}
743 791
744void fixup_irqs(void) 792void fixup_irqs(void)
745{ 793{
746 int irq; 794 int irq;
795 struct irq_desc *desc;
796 cpumask_t new_affinity;
797 unsigned long flags;
798 int do_set_affinity;
799 int cpu;
800
801 cpu = smp_processor_id();
747 802
748 for (irq = OCTEON_IRQ_SW0; irq <= OCTEON_IRQ_TIMER; irq++) 803 for (irq = OCTEON_IRQ_SW0; irq <= OCTEON_IRQ_TIMER; irq++)
749 octeon_irq_core_disable_local(irq); 804 octeon_irq_core_disable_local(irq);
750 805
751 for (irq = OCTEON_IRQ_WORKQ0; irq <= OCTEON_IRQ_GPIO15; irq++) { 806 for (irq = OCTEON_IRQ_WORKQ0; irq < OCTEON_IRQ_LAST; irq++) {
752 if (is_irq_enabled_on_cpu(irq, smp_processor_id())) { 807 desc = irq_to_desc(irq);
753 /* ciu irq migrates to next cpu */ 808 switch (irq) {
754 octeon_irq_chip_ciu0.disable(irq); 809 case OCTEON_IRQ_MBOX0:
755 octeon_irq_ciu0_set_affinity(irq, &cpu_online_map); 810 case OCTEON_IRQ_MBOX1:
756 } 811 /* The eoi function will disable them on this CPU. */
757 } 812 desc->chip->eoi(irq);
758 813 break;
759#if 0 814 case OCTEON_IRQ_WDOG0:
760 for (irq = OCTEON_IRQ_MBOX0; irq <= OCTEON_IRQ_MBOX1; irq++) 815 case OCTEON_IRQ_WDOG1:
761 octeon_irq_mailbox_mask(irq); 816 case OCTEON_IRQ_WDOG2:
762#endif 817 case OCTEON_IRQ_WDOG3:
763 for (irq = OCTEON_IRQ_UART0; irq <= OCTEON_IRQ_BOOTDMA; irq++) { 818 case OCTEON_IRQ_WDOG4:
764 if (is_irq_enabled_on_cpu(irq, smp_processor_id())) { 819 case OCTEON_IRQ_WDOG5:
765 /* ciu irq migrates to next cpu */ 820 case OCTEON_IRQ_WDOG6:
766 octeon_irq_chip_ciu0.disable(irq); 821 case OCTEON_IRQ_WDOG7:
767 octeon_irq_ciu0_set_affinity(irq, &cpu_online_map); 822 case OCTEON_IRQ_WDOG8:
768 } 823 case OCTEON_IRQ_WDOG9:
769 } 824 case OCTEON_IRQ_WDOG10:
825 case OCTEON_IRQ_WDOG11:
826 case OCTEON_IRQ_WDOG12:
827 case OCTEON_IRQ_WDOG13:
828 case OCTEON_IRQ_WDOG14:
829 case OCTEON_IRQ_WDOG15:
830 /*
831 * These have special per CPU semantics and
832 * are handled in the watchdog driver.
833 */
834 break;
835 default:
836 raw_spin_lock_irqsave(&desc->lock, flags);
837 /*
838 * If this irq has an action, it is in use and
839 * must be migrated if it has affinity to this
840 * cpu.
841 */
842 if (desc->action && cpumask_test_cpu(cpu, desc->affinity)) {
843 if (cpumask_weight(desc->affinity) > 1) {
844 /*
845 * It has multi CPU affinity,
846 * just remove this CPU from
847 * the affinity set.
848 */
849 cpumask_copy(&new_affinity, desc->affinity);
850 cpumask_clear_cpu(cpu, &new_affinity);
851 } else {
852 /*
853 * Otherwise, put it on lowest
854 * numbered online CPU.
855 */
856 cpumask_clear(&new_affinity);
857 cpumask_set_cpu(cpumask_first(cpu_online_mask), &new_affinity);
858 }
859 do_set_affinity = 1;
860 } else {
861 do_set_affinity = 0;
862 }
863 raw_spin_unlock_irqrestore(&desc->lock, flags);
864
865 if (do_set_affinity)
866 irq_set_affinity(irq, &new_affinity);
770 867
771 for (irq = OCTEON_IRQ_UART2; irq <= OCTEON_IRQ_RESERVED135; irq++) { 868 break;
772 if (is_irq_enabled_on_cpu(irq, smp_processor_id())) {
773 /* ciu irq migrates to next cpu */
774 octeon_irq_chip_ciu1.disable(irq);
775 octeon_irq_ciu1_set_affinity(irq, &cpu_online_map);
776 } 869 }
777 } 870 }
778} 871}
diff --git a/arch/mips/cavium-octeon/octeon_boot.h b/arch/mips/cavium-octeon/octeon_boot.h
index 0f7f84accf9a..428864b2ba41 100644
--- a/arch/mips/cavium-octeon/octeon_boot.h
+++ b/arch/mips/cavium-octeon/octeon_boot.h
@@ -23,14 +23,16 @@
23#include <linux/types.h> 23#include <linux/types.h>
24 24
25struct boot_init_vector { 25struct boot_init_vector {
26 uint32_t stack_addr; 26 /* First stage address - in ram instead of flash */
27 uint32_t code_addr; 27 uint64_t code_addr;
28 /* Setup code for application, NOT application entry point */
28 uint32_t app_start_func_addr; 29 uint32_t app_start_func_addr;
30 /* k0 is used for global data - needs to be passed to other cores */
29 uint32_t k0_val; 31 uint32_t k0_val;
30 uint32_t flags; 32 /* Address of boot info block structure */
31 uint32_t boot_info_addr; 33 uint64_t boot_info_addr;
34 uint32_t flags; /* flags */
32 uint32_t pad; 35 uint32_t pad;
33 uint32_t pad2;
34}; 36};
35 37
36/* similar to bootloader's linux_app_boot_info but without global data */ 38/* similar to bootloader's linux_app_boot_info but without global data */
@@ -40,7 +42,7 @@ struct linux_app_boot_info {
40 uint32_t avail_coremask; 42 uint32_t avail_coremask;
41 uint32_t pci_console_active; 43 uint32_t pci_console_active;
42 uint32_t icache_prefetch_disable; 44 uint32_t icache_prefetch_disable;
43 uint32_t InitTLBStart_addr; 45 uint64_t InitTLBStart_addr;
44 uint32_t start_app_addr; 46 uint32_t start_app_addr;
45 uint32_t cur_exception_base; 47 uint32_t cur_exception_base;
46 uint32_t no_mark_private_data; 48 uint32_t no_mark_private_data;
@@ -58,7 +60,7 @@ struct linux_app_boot_info {
58 60
59#define LINUX_APP_BOOT_BLOCK_NAME "linux-app-boot" 61#define LINUX_APP_BOOT_BLOCK_NAME "linux-app-boot"
60 62
61#define LABI_SIGNATURE 0xAABBCCDD 63#define LABI_SIGNATURE 0xAABBCC01
62 64
63/* from uboot-headers/octeon_mem_map.h */ 65/* from uboot-headers/octeon_mem_map.h */
64#define EXCEPTION_BASE_INCR (4 * 1024) 66#define EXCEPTION_BASE_INCR (4 * 1024)
diff --git a/arch/mips/cavium-octeon/serial.c b/arch/mips/cavium-octeon/serial.c
index 83eac37a1ff9..638adab02842 100644
--- a/arch/mips/cavium-octeon/serial.c
+++ b/arch/mips/cavium-octeon/serial.c
@@ -18,11 +18,7 @@
18 18
19#include <asm/octeon/octeon.h> 19#include <asm/octeon/octeon.h>
20 20
21#ifdef CONFIG_GDB_CONSOLE
22#define DEBUG_UART 0
23#else
24#define DEBUG_UART 1 21#define DEBUG_UART 1
25#endif
26 22
27unsigned int octeon_serial_in(struct uart_port *up, int offset) 23unsigned int octeon_serial_in(struct uart_port *up, int offset)
28{ 24{
diff --git a/arch/mips/cavium-octeon/setup.c b/arch/mips/cavium-octeon/setup.c
index d1b5ffaf0281..69197cb6c7ea 100644
--- a/arch/mips/cavium-octeon/setup.c
+++ b/arch/mips/cavium-octeon/setup.c
@@ -32,6 +32,7 @@
32#include <asm/time.h> 32#include <asm/time.h>
33 33
34#include <asm/octeon/octeon.h> 34#include <asm/octeon/octeon.h>
35#include <asm/octeon/pci-octeon.h>
35 36
36#ifdef CONFIG_CAVIUM_DECODE_RSL 37#ifdef CONFIG_CAVIUM_DECODE_RSL
37extern void cvmx_interrupt_rsl_decode(void); 38extern void cvmx_interrupt_rsl_decode(void);
@@ -578,9 +579,6 @@ void __init prom_init(void)
578 } 579 }
579 580
580 if (strstr(arcs_cmdline, "console=") == NULL) { 581 if (strstr(arcs_cmdline, "console=") == NULL) {
581#ifdef CONFIG_GDB_CONSOLE
582 strcat(arcs_cmdline, " console=gdb");
583#else
584#ifdef CONFIG_CAVIUM_OCTEON_2ND_KERNEL 582#ifdef CONFIG_CAVIUM_OCTEON_2ND_KERNEL
585 strcat(arcs_cmdline, " console=ttyS0,115200"); 583 strcat(arcs_cmdline, " console=ttyS0,115200");
586#else 584#else
@@ -589,7 +587,6 @@ void __init prom_init(void)
589 else 587 else
590 strcat(arcs_cmdline, " console=ttyS0,115200"); 588 strcat(arcs_cmdline, " console=ttyS0,115200");
591#endif 589#endif
592#endif
593 } 590 }
594 591
595 if (octeon_is_simulation()) { 592 if (octeon_is_simulation()) {
@@ -598,13 +595,13 @@ void __init prom_init(void)
598 * the filesystem. Also specify the calibration delay 595 * the filesystem. Also specify the calibration delay
599 * to avoid calculating it every time. 596 * to avoid calculating it every time.
600 */ 597 */
601 strcat(arcs_cmdline, " rw root=1f00" 598 strcat(arcs_cmdline, " rw root=1f00 slram=root,0x40000000,+1073741824");
602 " lpj=60176 slram=root,0x40000000,+1073741824");
603 } 599 }
604 600
605 mips_hpt_frequency = octeon_get_clock_rate(); 601 mips_hpt_frequency = octeon_get_clock_rate();
606 602
607 octeon_init_cvmcount(); 603 octeon_init_cvmcount();
604 octeon_setup_delays();
608 605
609 _machine_restart = octeon_restart; 606 _machine_restart = octeon_restart;
610 _machine_halt = octeon_halt; 607 _machine_halt = octeon_halt;
@@ -613,6 +610,22 @@ void __init prom_init(void)
613 register_smp_ops(&octeon_smp_ops); 610 register_smp_ops(&octeon_smp_ops);
614} 611}
615 612
613/* Exclude a single page from the regions obtained in plat_mem_setup. */
614static __init void memory_exclude_page(u64 addr, u64 *mem, u64 *size)
615{
616 if (addr > *mem && addr < *mem + *size) {
617 u64 inc = addr - *mem;
618 add_memory_region(*mem, inc, BOOT_MEM_RAM);
619 *mem += inc;
620 *size -= inc;
621 }
622
623 if (addr == *mem && *size > PAGE_SIZE) {
624 *mem += PAGE_SIZE;
625 *size -= PAGE_SIZE;
626 }
627}
628
616void __init plat_mem_setup(void) 629void __init plat_mem_setup(void)
617{ 630{
618 uint64_t mem_alloc_size; 631 uint64_t mem_alloc_size;
@@ -663,12 +676,27 @@ void __init plat_mem_setup(void)
663 CVMX_BOOTMEM_FLAG_NO_LOCKING); 676 CVMX_BOOTMEM_FLAG_NO_LOCKING);
664#endif 677#endif
665 if (memory >= 0) { 678 if (memory >= 0) {
679 u64 size = mem_alloc_size;
680
681 /*
682 * exclude a page at the beginning and end of
683 * the 256MB PCIe 'hole' so the kernel will not
684 * try to allocate multi-page buffers that
685 * span the discontinuity.
686 */
687 memory_exclude_page(CVMX_PCIE_BAR1_PHYS_BASE,
688 &memory, &size);
689 memory_exclude_page(CVMX_PCIE_BAR1_PHYS_BASE +
690 CVMX_PCIE_BAR1_PHYS_SIZE,
691 &memory, &size);
692
666 /* 693 /*
667 * This function automatically merges address 694 * This function automatically merges address
668 * regions next to each other if they are 695 * regions next to each other if they are
669 * received in incrementing order. 696 * received in incrementing order.
670 */ 697 */
671 add_memory_region(memory, mem_alloc_size, BOOT_MEM_RAM); 698 if (size)
699 add_memory_region(memory, size, BOOT_MEM_RAM);
672 total += mem_alloc_size; 700 total += mem_alloc_size;
673 } else { 701 } else {
674 break; 702 break;
@@ -691,7 +719,10 @@ void __init plat_mem_setup(void)
691 "cvmx_bootmem_phy_alloc\n"); 719 "cvmx_bootmem_phy_alloc\n");
692} 720}
693 721
694 722/*
723 * Emit one character to the boot UART. Exported for use by the
724 * watchdog timer.
725 */
695int prom_putchar(char c) 726int prom_putchar(char c)
696{ 727{
697 uint64_t lsrval; 728 uint64_t lsrval;
@@ -705,6 +736,7 @@ int prom_putchar(char c)
705 cvmx_write_csr(CVMX_MIO_UARTX_THR(octeon_uart), c & 0xffull); 736 cvmx_write_csr(CVMX_MIO_UARTX_THR(octeon_uart), c & 0xffull);
706 return 1; 737 return 1;
707} 738}
739EXPORT_SYMBOL(prom_putchar);
708 740
709void prom_free_prom_memory(void) 741void prom_free_prom_memory(void)
710{ 742{
diff --git a/arch/mips/cavium-octeon/smp.c b/arch/mips/cavium-octeon/smp.c
index 6d99b9d8887d..391cefe556b3 100644
--- a/arch/mips/cavium-octeon/smp.c
+++ b/arch/mips/cavium-octeon/smp.c
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2004-2008 Cavium Networks 6 * Copyright (C) 2004-2008, 2009, 2010 Cavium Networks
7 */ 7 */
8#include <linux/cpu.h> 8#include <linux/cpu.h>
9#include <linux/init.h> 9#include <linux/init.h>
@@ -27,7 +27,8 @@ volatile unsigned long octeon_processor_sp;
27volatile unsigned long octeon_processor_gp; 27volatile unsigned long octeon_processor_gp;
28 28
29#ifdef CONFIG_HOTPLUG_CPU 29#ifdef CONFIG_HOTPLUG_CPU
30static unsigned int InitTLBStart_addr; 30uint64_t octeon_bootloader_entry_addr;
31EXPORT_SYMBOL(octeon_bootloader_entry_addr);
31#endif 32#endif
32 33
33static irqreturn_t mailbox_interrupt(int irq, void *dev_id) 34static irqreturn_t mailbox_interrupt(int irq, void *dev_id)
@@ -80,20 +81,13 @@ static inline void octeon_send_ipi_mask(const struct cpumask *mask,
80static void octeon_smp_hotplug_setup(void) 81static void octeon_smp_hotplug_setup(void)
81{ 82{
82#ifdef CONFIG_HOTPLUG_CPU 83#ifdef CONFIG_HOTPLUG_CPU
83 uint32_t labi_signature; 84 struct linux_app_boot_info *labi;
84 85
85 labi_signature = 86 labi = (struct linux_app_boot_info *)PHYS_TO_XKSEG_CACHED(LABI_ADDR_IN_BOOTLOADER);
86 cvmx_read64_uint32(CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS, 87 if (labi->labi_signature != LABI_SIGNATURE)
87 LABI_ADDR_IN_BOOTLOADER + 88 panic("The bootloader version on this board is incorrect.");
88 offsetof(struct linux_app_boot_info, 89
89 labi_signature))); 90 octeon_bootloader_entry_addr = labi->InitTLBStart_addr;
90 if (labi_signature != LABI_SIGNATURE)
91 pr_err("The bootloader version on this board is incorrect\n");
92 InitTLBStart_addr =
93 cvmx_read64_uint32(CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS,
94 LABI_ADDR_IN_BOOTLOADER +
95 offsetof(struct linux_app_boot_info,
96 InitTLBStart_addr)));
97#endif 91#endif
98} 92}
99 93
@@ -102,24 +96,47 @@ static void octeon_smp_setup(void)
102 const int coreid = cvmx_get_core_num(); 96 const int coreid = cvmx_get_core_num();
103 int cpus; 97 int cpus;
104 int id; 98 int id;
105
106 int core_mask = octeon_get_boot_coremask(); 99 int core_mask = octeon_get_boot_coremask();
100#ifdef CONFIG_HOTPLUG_CPU
101 unsigned int num_cores = cvmx_octeon_num_cores();
102#endif
103
104 /* The present CPUs are initially just the boot cpu (CPU 0). */
105 for (id = 0; id < NR_CPUS; id++) {
106 set_cpu_possible(id, id == 0);
107 set_cpu_present(id, id == 0);
108 }
107 109
108 cpus_clear(cpu_possible_map);
109 __cpu_number_map[coreid] = 0; 110 __cpu_number_map[coreid] = 0;
110 __cpu_logical_map[0] = coreid; 111 __cpu_logical_map[0] = coreid;
111 cpu_set(0, cpu_possible_map);
112 112
113 /* The present CPUs get the lowest CPU numbers. */
113 cpus = 1; 114 cpus = 1;
114 for (id = 0; id < 16; id++) { 115 for (id = 0; id < NR_CPUS; id++) {
115 if ((id != coreid) && (core_mask & (1 << id))) { 116 if ((id != coreid) && (core_mask & (1 << id))) {
116 cpu_set(cpus, cpu_possible_map); 117 set_cpu_possible(cpus, true);
118 set_cpu_present(cpus, true);
117 __cpu_number_map[id] = cpus; 119 __cpu_number_map[id] = cpus;
118 __cpu_logical_map[cpus] = id; 120 __cpu_logical_map[cpus] = id;
119 cpus++; 121 cpus++;
120 } 122 }
121 } 123 }
122 cpu_present_map = cpu_possible_map; 124
125#ifdef CONFIG_HOTPLUG_CPU
126 /*
127 * The possible CPUs are all those present on the chip. We
128 * will assign CPU numbers for possible cores as well. Cores
129 * are always consecutively numberd from 0.
130 */
131 for (id = 0; id < num_cores && id < NR_CPUS; id++) {
132 if (!(core_mask & (1 << id))) {
133 set_cpu_possible(cpus, true);
134 __cpu_number_map[id] = cpus;
135 __cpu_logical_map[cpus] = id;
136 cpus++;
137 }
138 }
139#endif
123 140
124 octeon_smp_hotplug_setup(); 141 octeon_smp_hotplug_setup();
125} 142}
@@ -158,18 +175,21 @@ static void octeon_init_secondary(void)
158{ 175{
159 const int coreid = cvmx_get_core_num(); 176 const int coreid = cvmx_get_core_num();
160 union cvmx_ciu_intx_sum0 interrupt_enable; 177 union cvmx_ciu_intx_sum0 interrupt_enable;
178 unsigned int sr;
161 179
162#ifdef CONFIG_HOTPLUG_CPU 180#ifdef CONFIG_HOTPLUG_CPU
163 unsigned int cur_exception_base; 181 struct linux_app_boot_info *labi;
164 182
165 cur_exception_base = cvmx_read64_uint32( 183 labi = (struct linux_app_boot_info *)PHYS_TO_XKSEG_CACHED(LABI_ADDR_IN_BOOTLOADER);
166 CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS, 184
167 LABI_ADDR_IN_BOOTLOADER + 185 if (labi->labi_signature != LABI_SIGNATURE)
168 offsetof(struct linux_app_boot_info, 186 panic("The bootloader version on this board is incorrect.");
169 cur_exception_base)));
170 /* cur_exception_base is incremented in bootloader after setting */
171 write_c0_ebase((unsigned int)(cur_exception_base - EXCEPTION_BASE_INCR));
172#endif 187#endif
188
189 sr = set_c0_status(ST0_BEV);
190 write_c0_ebase((u32)ebase);
191 write_c0_status(sr);
192
173 octeon_check_cpu_bist(); 193 octeon_check_cpu_bist();
174 octeon_init_cvmcount(); 194 octeon_init_cvmcount();
175 /* 195 /*
@@ -276,8 +296,8 @@ static int octeon_cpu_disable(void)
276static void octeon_cpu_die(unsigned int cpu) 296static void octeon_cpu_die(unsigned int cpu)
277{ 297{
278 int coreid = cpu_logical_map(cpu); 298 int coreid = cpu_logical_map(cpu);
279 uint32_t avail_coremask; 299 uint32_t mask, new_mask;
280 struct cvmx_bootmem_named_block_desc *block_desc; 300 const struct cvmx_bootmem_named_block_desc *block_desc;
281 301
282 while (per_cpu(cpu_state, cpu) != CPU_DEAD) 302 while (per_cpu(cpu_state, cpu) != CPU_DEAD)
283 cpu_relax(); 303 cpu_relax();
@@ -286,52 +306,40 @@ static void octeon_cpu_die(unsigned int cpu)
286 * This is a bit complicated strategics of getting/settig available 306 * This is a bit complicated strategics of getting/settig available
287 * cores mask, copied from bootloader 307 * cores mask, copied from bootloader
288 */ 308 */
309
310 mask = 1 << coreid;
289 /* LINUX_APP_BOOT_BLOCK is initialized in bootoct binary */ 311 /* LINUX_APP_BOOT_BLOCK is initialized in bootoct binary */
290 block_desc = cvmx_bootmem_find_named_block(LINUX_APP_BOOT_BLOCK_NAME); 312 block_desc = cvmx_bootmem_find_named_block(LINUX_APP_BOOT_BLOCK_NAME);
291 313
292 if (!block_desc) { 314 if (!block_desc) {
293 avail_coremask = 315 struct linux_app_boot_info *labi;
294 cvmx_read64_uint32(CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS,
295 LABI_ADDR_IN_BOOTLOADER +
296 offsetof
297 (struct linux_app_boot_info,
298 avail_coremask)));
299 } else { /* alternative, already initialized */
300 avail_coremask =
301 cvmx_read64_uint32(CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS,
302 block_desc->base_addr +
303 AVAIL_COREMASK_OFFSET_IN_LINUX_APP_BOOT_BLOCK));
304 }
305 316
306 avail_coremask |= 1 << coreid; 317 labi = (struct linux_app_boot_info *)PHYS_TO_XKSEG_CACHED(LABI_ADDR_IN_BOOTLOADER);
307 318
308 /* Setting avail_coremask for bootoct binary */ 319 labi->avail_coremask |= mask;
309 if (!block_desc) { 320 new_mask = labi->avail_coremask;
310 cvmx_write64_uint32(CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS, 321 } else { /* alternative, already initialized */
311 LABI_ADDR_IN_BOOTLOADER + 322 uint32_t *p = (uint32_t *)PHYS_TO_XKSEG_CACHED(block_desc->base_addr +
312 offsetof(struct linux_app_boot_info, 323 AVAIL_COREMASK_OFFSET_IN_LINUX_APP_BOOT_BLOCK);
313 avail_coremask)), 324 *p |= mask;
314 avail_coremask); 325 new_mask = *p;
315 } else {
316 cvmx_write64_uint32(CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS,
317 block_desc->base_addr +
318 AVAIL_COREMASK_OFFSET_IN_LINUX_APP_BOOT_BLOCK),
319 avail_coremask);
320 } 326 }
321 327
322 pr_info("Reset core %d. Available Coremask = %x\n", coreid, 328 pr_info("Reset core %d. Available Coremask = 0x%x \n", coreid, new_mask);
323 avail_coremask); 329 mb();
324 cvmx_write_csr(CVMX_CIU_PP_RST, 1 << coreid); 330 cvmx_write_csr(CVMX_CIU_PP_RST, 1 << coreid);
325 cvmx_write_csr(CVMX_CIU_PP_RST, 0); 331 cvmx_write_csr(CVMX_CIU_PP_RST, 0);
326} 332}
327 333
328void play_dead(void) 334void play_dead(void)
329{ 335{
330 int coreid = cvmx_get_core_num(); 336 int cpu = cpu_number_map(cvmx_get_core_num());
331 337
332 idle_task_exit(); 338 idle_task_exit();
333 octeon_processor_boot = 0xff; 339 octeon_processor_boot = 0xff;
334 per_cpu(cpu_state, coreid) = CPU_DEAD; 340 per_cpu(cpu_state, cpu) = CPU_DEAD;
341
342 mb();
335 343
336 while (1) /* core will be reset here */ 344 while (1) /* core will be reset here */
337 ; 345 ;
@@ -344,29 +352,27 @@ static void start_after_reset(void)
344 kernel_entry(0, 0, 0); /* set a2 = 0 for secondary core */ 352 kernel_entry(0, 0, 0); /* set a2 = 0 for secondary core */
345} 353}
346 354
347int octeon_update_boot_vector(unsigned int cpu) 355static int octeon_update_boot_vector(unsigned int cpu)
348{ 356{
349 357
350 int coreid = cpu_logical_map(cpu); 358 int coreid = cpu_logical_map(cpu);
351 unsigned int avail_coremask; 359 uint32_t avail_coremask;
352 struct cvmx_bootmem_named_block_desc *block_desc; 360 const struct cvmx_bootmem_named_block_desc *block_desc;
353 struct boot_init_vector *boot_vect = 361 struct boot_init_vector *boot_vect =
354 (struct boot_init_vector *) cvmx_phys_to_ptr(0x0 + 362 (struct boot_init_vector *)PHYS_TO_XKSEG_CACHED(BOOTLOADER_BOOT_VECTOR);
355 BOOTLOADER_BOOT_VECTOR);
356 363
357 block_desc = cvmx_bootmem_find_named_block(LINUX_APP_BOOT_BLOCK_NAME); 364 block_desc = cvmx_bootmem_find_named_block(LINUX_APP_BOOT_BLOCK_NAME);
358 365
359 if (!block_desc) { 366 if (!block_desc) {
360 avail_coremask = 367 struct linux_app_boot_info *labi;
361 cvmx_read64_uint32(CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS, 368
362 LABI_ADDR_IN_BOOTLOADER + 369 labi = (struct linux_app_boot_info *)PHYS_TO_XKSEG_CACHED(LABI_ADDR_IN_BOOTLOADER);
363 offsetof(struct linux_app_boot_info, 370
364 avail_coremask))); 371 avail_coremask = labi->avail_coremask;
372 labi->avail_coremask &= ~(1 << coreid);
365 } else { /* alternative, already initialized */ 373 } else { /* alternative, already initialized */
366 avail_coremask = 374 avail_coremask = *(uint32_t *)PHYS_TO_XKSEG_CACHED(
367 cvmx_read64_uint32(CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS, 375 block_desc->base_addr + AVAIL_COREMASK_OFFSET_IN_LINUX_APP_BOOT_BLOCK);
368 block_desc->base_addr +
369 AVAIL_COREMASK_OFFSET_IN_LINUX_APP_BOOT_BLOCK));
370 } 376 }
371 377
372 if (!(avail_coremask & (1 << coreid))) { 378 if (!(avail_coremask & (1 << coreid))) {
@@ -377,9 +383,9 @@ int octeon_update_boot_vector(unsigned int cpu)
377 383
378 boot_vect[coreid].app_start_func_addr = 384 boot_vect[coreid].app_start_func_addr =
379 (uint32_t) (unsigned long) start_after_reset; 385 (uint32_t) (unsigned long) start_after_reset;
380 boot_vect[coreid].code_addr = InitTLBStart_addr; 386 boot_vect[coreid].code_addr = octeon_bootloader_entry_addr;
381 387
382 CVMX_SYNC; 388 mb();
383 389
384 cvmx_write_csr(CVMX_CIU_NMI, (1 << coreid) & avail_coremask); 390 cvmx_write_csr(CVMX_CIU_NMI, (1 << coreid) & avail_coremask);
385 391
@@ -405,17 +411,11 @@ static int __cpuinit octeon_cpu_callback(struct notifier_block *nfb,
405 return NOTIFY_OK; 411 return NOTIFY_OK;
406} 412}
407 413
408static struct notifier_block __cpuinitdata octeon_cpu_notifier = {
409 .notifier_call = octeon_cpu_callback,
410};
411
412static int __cpuinit register_cavium_notifier(void) 414static int __cpuinit register_cavium_notifier(void)
413{ 415{
414 register_hotcpu_notifier(&octeon_cpu_notifier); 416 hotcpu_notifier(octeon_cpu_callback, 0);
415
416 return 0; 417 return 0;
417} 418}
418
419late_initcall(register_cavium_notifier); 419late_initcall(register_cavium_notifier);
420 420
421#endif /* CONFIG_HOTPLUG_CPU */ 421#endif /* CONFIG_HOTPLUG_CPU */
diff --git a/arch/mips/cobalt/Makefile b/arch/mips/cobalt/Makefile
index 237926288d6d..61a334ac43ac 100644
--- a/arch/mips/cobalt/Makefile
+++ b/arch/mips/cobalt/Makefile
@@ -7,5 +7,3 @@ obj-y := buttons.o irq.o lcd.o led.o reset.o rtc.o serial.o setup.o time.o
7obj-$(CONFIG_PCI) += pci.o 7obj-$(CONFIG_PCI) += pci.o
8obj-$(CONFIG_EARLY_PRINTK) += console.o 8obj-$(CONFIG_EARLY_PRINTK) += console.o
9obj-$(CONFIG_MTD_PHYSMAP) += mtd.o 9obj-$(CONFIG_MTD_PHYSMAP) += mtd.o
10
11EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/cobalt/Platform b/arch/mips/cobalt/Platform
new file mode 100644
index 000000000000..34123efd6dfe
--- /dev/null
+++ b/arch/mips/cobalt/Platform
@@ -0,0 +1,6 @@
1#
2# Cobalt Server
3#
4platform-$(CONFIG_MIPS_COBALT) += cobalt/
5cflags-$(CONFIG_MIPS_COBALT) += -I$(srctree)/arch/mips/include/asm/mach-cobalt
6load-$(CONFIG_MIPS_COBALT) += 0xffffffff80080000
diff --git a/arch/mips/configs/db1000_defconfig b/arch/mips/configs/db1000_defconfig
index f66d406aadce..3a9ec6ccd40d 100644
--- a/arch/mips/configs/db1000_defconfig
+++ b/arch/mips/configs/db1000_defconfig
@@ -8,7 +8,7 @@ CONFIG_MIPS=y
8# 8#
9# Machine selection 9# Machine selection
10# 10#
11CONFIG_MACH_ALCHEMY=y 11CONFIG_MIPS_ALCHEMY=y
12# CONFIG_AR7 is not set 12# CONFIG_AR7 is not set
13# CONFIG_BCM47XX is not set 13# CONFIG_BCM47XX is not set
14# CONFIG_BCM63XX is not set 14# CONFIG_BCM63XX is not set
@@ -64,7 +64,6 @@ CONFIG_MIPS_DB1000=y
64# CONFIG_MIPS_PB1550 is not set 64# CONFIG_MIPS_PB1550 is not set
65# CONFIG_MIPS_XXS1500 is not set 65# CONFIG_MIPS_XXS1500 is not set
66CONFIG_SOC_AU1000=y 66CONFIG_SOC_AU1000=y
67CONFIG_SOC_AU1X00=y
68CONFIG_LOONGSON_UART_BASE=y 67CONFIG_LOONGSON_UART_BASE=y
69CONFIG_RWSEM_GENERIC_SPINLOCK=y 68CONFIG_RWSEM_GENERIC_SPINLOCK=y
70# CONFIG_ARCH_HAS_ILOG2_U32 is not set 69# CONFIG_ARCH_HAS_ILOG2_U32 is not set
diff --git a/arch/mips/configs/db1100_defconfig b/arch/mips/configs/db1100_defconfig
index abb9a5805adc..4589b84301f3 100644
--- a/arch/mips/configs/db1100_defconfig
+++ b/arch/mips/configs/db1100_defconfig
@@ -8,7 +8,7 @@ CONFIG_MIPS=y
8# 8#
9# Machine selection 9# Machine selection
10# 10#
11CONFIG_MACH_ALCHEMY=y 11CONFIG_MIPS_ALCHEMY=y
12# CONFIG_AR7 is not set 12# CONFIG_AR7 is not set
13# CONFIG_BCM47XX is not set 13# CONFIG_BCM47XX is not set
14# CONFIG_BCM63XX is not set 14# CONFIG_BCM63XX is not set
@@ -64,7 +64,6 @@ CONFIG_MIPS_DB1100=y
64# CONFIG_MIPS_PB1550 is not set 64# CONFIG_MIPS_PB1550 is not set
65# CONFIG_MIPS_XXS1500 is not set 65# CONFIG_MIPS_XXS1500 is not set
66CONFIG_SOC_AU1100=y 66CONFIG_SOC_AU1100=y
67CONFIG_SOC_AU1X00=y
68CONFIG_LOONGSON_UART_BASE=y 67CONFIG_LOONGSON_UART_BASE=y
69CONFIG_RWSEM_GENERIC_SPINLOCK=y 68CONFIG_RWSEM_GENERIC_SPINLOCK=y
70# CONFIG_ARCH_HAS_ILOG2_U32 is not set 69# CONFIG_ARCH_HAS_ILOG2_U32 is not set
diff --git a/arch/mips/configs/db1200_defconfig b/arch/mips/configs/db1200_defconfig
index 991c20adf471..9950f2aabd31 100644
--- a/arch/mips/configs/db1200_defconfig
+++ b/arch/mips/configs/db1200_defconfig
@@ -8,7 +8,7 @@ CONFIG_MIPS=y
8# 8#
9# Machine selection 9# Machine selection
10# 10#
11CONFIG_MACH_ALCHEMY=y 11CONFIG_MIPS_ALCHEMY=y
12# CONFIG_AR7 is not set 12# CONFIG_AR7 is not set
13# CONFIG_BCM47XX is not set 13# CONFIG_BCM47XX is not set
14# CONFIG_BCM63XX is not set 14# CONFIG_BCM63XX is not set
@@ -64,7 +64,6 @@ CONFIG_MIPS_DB1200=y
64# CONFIG_MIPS_PB1550 is not set 64# CONFIG_MIPS_PB1550 is not set
65# CONFIG_MIPS_XXS1500 is not set 65# CONFIG_MIPS_XXS1500 is not set
66CONFIG_SOC_AU1200=y 66CONFIG_SOC_AU1200=y
67CONFIG_SOC_AU1X00=y
68CONFIG_LOONGSON_UART_BASE=y 67CONFIG_LOONGSON_UART_BASE=y
69CONFIG_RWSEM_GENERIC_SPINLOCK=y 68CONFIG_RWSEM_GENERIC_SPINLOCK=y
70# CONFIG_ARCH_HAS_ILOG2_U32 is not set 69# CONFIG_ARCH_HAS_ILOG2_U32 is not set
diff --git a/arch/mips/configs/db1500_defconfig b/arch/mips/configs/db1500_defconfig
index 5424c9167bf2..346ae631d1ef 100644
--- a/arch/mips/configs/db1500_defconfig
+++ b/arch/mips/configs/db1500_defconfig
@@ -8,7 +8,7 @@ CONFIG_MIPS=y
8# 8#
9# Machine selection 9# Machine selection
10# 10#
11CONFIG_MACH_ALCHEMY=y 11CONFIG_MIPS_ALCHEMY=y
12# CONFIG_AR7 is not set 12# CONFIG_AR7 is not set
13# CONFIG_BCM47XX is not set 13# CONFIG_BCM47XX is not set
14# CONFIG_BCM63XX is not set 14# CONFIG_BCM63XX is not set
@@ -64,7 +64,6 @@ CONFIG_MIPS_DB1500=y
64# CONFIG_MIPS_PB1550 is not set 64# CONFIG_MIPS_PB1550 is not set
65# CONFIG_MIPS_XXS1500 is not set 65# CONFIG_MIPS_XXS1500 is not set
66CONFIG_SOC_AU1500=y 66CONFIG_SOC_AU1500=y
67CONFIG_SOC_AU1X00=y
68CONFIG_LOONGSON_UART_BASE=y 67CONFIG_LOONGSON_UART_BASE=y
69CONFIG_RWSEM_GENERIC_SPINLOCK=y 68CONFIG_RWSEM_GENERIC_SPINLOCK=y
70# CONFIG_ARCH_HAS_ILOG2_U32 is not set 69# CONFIG_ARCH_HAS_ILOG2_U32 is not set
diff --git a/arch/mips/configs/db1550_defconfig b/arch/mips/configs/db1550_defconfig
index 949b6dcf634b..10eafb942af3 100644
--- a/arch/mips/configs/db1550_defconfig
+++ b/arch/mips/configs/db1550_defconfig
@@ -8,7 +8,7 @@ CONFIG_MIPS=y
8# 8#
9# Machine selection 9# Machine selection
10# 10#
11CONFIG_MACH_ALCHEMY=y 11CONFIG_MIPS_ALCHEMY=y
12# CONFIG_AR7 is not set 12# CONFIG_AR7 is not set
13# CONFIG_BCM47XX is not set 13# CONFIG_BCM47XX is not set
14# CONFIG_BCM63XX is not set 14# CONFIG_BCM63XX is not set
@@ -64,7 +64,6 @@ CONFIG_MIPS_DB1550=y
64# CONFIG_MIPS_PB1550 is not set 64# CONFIG_MIPS_PB1550 is not set
65# CONFIG_MIPS_XXS1500 is not set 65# CONFIG_MIPS_XXS1500 is not set
66CONFIG_SOC_AU1550=y 66CONFIG_SOC_AU1550=y
67CONFIG_SOC_AU1X00=y
68CONFIG_LOONGSON_UART_BASE=y 67CONFIG_LOONGSON_UART_BASE=y
69CONFIG_RWSEM_GENERIC_SPINLOCK=y 68CONFIG_RWSEM_GENERIC_SPINLOCK=y
70# CONFIG_ARCH_HAS_ILOG2_U32 is not set 69# CONFIG_ARCH_HAS_ILOG2_U32 is not set
diff --git a/arch/mips/configs/gpr_defconfig b/arch/mips/configs/gpr_defconfig
new file mode 100644
index 000000000000..17e2e624d03f
--- /dev/null
+++ b/arch/mips/configs/gpr_defconfig
@@ -0,0 +1,2060 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.35-rc6
4# Fri Jul 23 19:28:52 2010
5#
6CONFIG_MIPS=y
7
8#
9# Machine selection
10#
11CONFIG_MIPS_ALCHEMY=y
12# CONFIG_AR7 is not set
13# CONFIG_BCM47XX is not set
14# CONFIG_BCM63XX is not set
15# CONFIG_MIPS_COBALT is not set
16# CONFIG_MACH_DECSTATION is not set
17# CONFIG_MACH_JAZZ is not set
18# CONFIG_LASAT is not set
19# CONFIG_MACH_LOONGSON is not set
20# CONFIG_MIPS_MALTA is not set
21# CONFIG_MIPS_SIM is not set
22# CONFIG_NEC_MARKEINS is not set
23# CONFIG_MACH_VR41XX is not set
24# CONFIG_NXP_STB220 is not set
25# CONFIG_NXP_STB225 is not set
26# CONFIG_PNX8550_JBS is not set
27# CONFIG_PNX8550_STB810 is not set
28# CONFIG_PMC_MSP is not set
29# CONFIG_PMC_YOSEMITE is not set
30# CONFIG_POWERTV is not set
31# CONFIG_SGI_IP22 is not set
32# CONFIG_SGI_IP27 is not set
33# CONFIG_SGI_IP28 is not set
34# CONFIG_SGI_IP32 is not set
35# CONFIG_SIBYTE_CRHINE is not set
36# CONFIG_SIBYTE_CARMEL is not set
37# CONFIG_SIBYTE_CRHONE is not set
38# CONFIG_SIBYTE_RHONE is not set
39# CONFIG_SIBYTE_SWARM is not set
40# CONFIG_SIBYTE_LITTLESUR is not set
41# CONFIG_SIBYTE_SENTOSA is not set
42# CONFIG_SIBYTE_BIGSUR is not set
43# CONFIG_SNI_RM is not set
44# CONFIG_MACH_TX39XX is not set
45# CONFIG_MACH_TX49XX is not set
46# CONFIG_MIKROTIK_RB532 is not set
47# CONFIG_WR_PPMC is not set
48# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set
49# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set
50CONFIG_ALCHEMY_GPIOINT_AU1000=y
51# CONFIG_ALCHEMY_GPIO_INDIRECT is not set
52# CONFIG_MIPS_MTX1 is not set
53# CONFIG_MIPS_BOSPORUS is not set
54# CONFIG_MIPS_DB1000 is not set
55# CONFIG_MIPS_DB1100 is not set
56# CONFIG_MIPS_DB1200 is not set
57# CONFIG_MIPS_DB1500 is not set
58# CONFIG_MIPS_DB1550 is not set
59# CONFIG_MIPS_MIRAGE is not set
60# CONFIG_MIPS_PB1000 is not set
61# CONFIG_MIPS_PB1100 is not set
62# CONFIG_MIPS_PB1200 is not set
63# CONFIG_MIPS_PB1500 is not set
64# CONFIG_MIPS_PB1550 is not set
65# CONFIG_MIPS_XXS1500 is not set
66CONFIG_MIPS_GPR=y
67CONFIG_SOC_AU1550=y
68CONFIG_LOONGSON_UART_BASE=y
69# CONFIG_LOONGSON_MC146818 is not set
70CONFIG_RWSEM_GENERIC_SPINLOCK=y
71# CONFIG_ARCH_HAS_ILOG2_U32 is not set
72# CONFIG_ARCH_HAS_ILOG2_U64 is not set
73CONFIG_ARCH_SUPPORTS_OPROFILE=y
74CONFIG_GENERIC_FIND_NEXT_BIT=y
75CONFIG_GENERIC_HWEIGHT=y
76CONFIG_GENERIC_CALIBRATE_DELAY=y
77CONFIG_GENERIC_CLOCKEVENTS=y
78CONFIG_GENERIC_TIME=y
79CONFIG_GENERIC_CMOS_UPDATE=y
80CONFIG_SCHED_OMIT_FRAME_POINTER=y
81CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
82CONFIG_CEVT_R4K_LIB=y
83CONFIG_CSRC_R4K_LIB=y
84CONFIG_DMA_NONCOHERENT=y
85CONFIG_NEED_DMA_MAP_STATE=y
86CONFIG_SYS_HAS_EARLY_PRINTK=y
87CONFIG_MIPS_DISABLE_OBSOLETE_IDE=y
88# CONFIG_NO_IOPORT is not set
89CONFIG_GENERIC_GPIO=y
90# CONFIG_CPU_BIG_ENDIAN is not set
91CONFIG_CPU_LITTLE_ENDIAN=y
92CONFIG_SYS_SUPPORTS_APM_EMULATION=y
93CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
94CONFIG_IRQ_CPU=y
95CONFIG_MIPS_L1_CACHE_SHIFT=5
96
97#
98# CPU selection
99#
100# CONFIG_CPU_LOONGSON2E is not set
101# CONFIG_CPU_LOONGSON2F is not set
102CONFIG_CPU_MIPS32_R1=y
103# CONFIG_CPU_MIPS32_R2 is not set
104# CONFIG_CPU_MIPS64_R1 is not set
105# CONFIG_CPU_MIPS64_R2 is not set
106# CONFIG_CPU_R3000 is not set
107# CONFIG_CPU_TX39XX is not set
108# CONFIG_CPU_VR41XX is not set
109# CONFIG_CPU_R4300 is not set
110# CONFIG_CPU_R4X00 is not set
111# CONFIG_CPU_TX49XX is not set
112# CONFIG_CPU_R5000 is not set
113# CONFIG_CPU_R5432 is not set
114# CONFIG_CPU_R5500 is not set
115# CONFIG_CPU_R6000 is not set
116# CONFIG_CPU_NEVADA is not set
117# CONFIG_CPU_R8000 is not set
118# CONFIG_CPU_R10000 is not set
119# CONFIG_CPU_RM7000 is not set
120# CONFIG_CPU_RM9000 is not set
121# CONFIG_CPU_SB1 is not set
122# CONFIG_CPU_CAVIUM_OCTEON is not set
123CONFIG_SYS_SUPPORTS_ZBOOT=y
124CONFIG_SYS_HAS_CPU_MIPS32_R1=y
125CONFIG_CPU_MIPS32=y
126CONFIG_CPU_MIPSR1=y
127CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
128CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
129CONFIG_HARDWARE_WATCHPOINTS=y
130
131#
132# Kernel type
133#
134CONFIG_32BIT=y
135# CONFIG_64BIT is not set
136CONFIG_PAGE_SIZE_4KB=y
137# CONFIG_PAGE_SIZE_8KB is not set
138# CONFIG_PAGE_SIZE_16KB is not set
139# CONFIG_PAGE_SIZE_32KB is not set
140# CONFIG_PAGE_SIZE_64KB is not set
141CONFIG_CPU_HAS_PREFETCH=y
142CONFIG_MIPS_MT_DISABLED=y
143# CONFIG_MIPS_MT_SMP is not set
144# CONFIG_MIPS_MT_SMTC is not set
145CONFIG_64BIT_PHYS_ADDR=y
146CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
147CONFIG_CPU_HAS_SYNC=y
148CONFIG_GENERIC_HARDIRQS=y
149CONFIG_GENERIC_IRQ_PROBE=y
150CONFIG_CPU_SUPPORTS_HIGHMEM=y
151CONFIG_ARCH_FLATMEM_ENABLE=y
152CONFIG_ARCH_POPULATES_NODE_MAP=y
153CONFIG_SELECT_MEMORY_MODEL=y
154CONFIG_FLATMEM_MANUAL=y
155# CONFIG_DISCONTIGMEM_MANUAL is not set
156# CONFIG_SPARSEMEM_MANUAL is not set
157CONFIG_FLATMEM=y
158CONFIG_FLAT_NODE_MEM_MAP=y
159CONFIG_PAGEFLAGS_EXTENDED=y
160CONFIG_SPLIT_PTLOCK_CPUS=4
161CONFIG_PHYS_ADDR_T_64BIT=y
162CONFIG_ZONE_DMA_FLAG=0
163CONFIG_VIRT_TO_BUS=y
164# CONFIG_KSM is not set
165CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
166CONFIG_TICK_ONESHOT=y
167# CONFIG_NO_HZ is not set
168CONFIG_HIGH_RES_TIMERS=y
169CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
170# CONFIG_HZ_48 is not set
171# CONFIG_HZ_100 is not set
172# CONFIG_HZ_128 is not set
173CONFIG_HZ_250=y
174# CONFIG_HZ_256 is not set
175# CONFIG_HZ_1000 is not set
176# CONFIG_HZ_1024 is not set
177CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
178CONFIG_HZ=250
179# CONFIG_PREEMPT_NONE is not set
180CONFIG_PREEMPT_VOLUNTARY=y
181# CONFIG_PREEMPT is not set
182# CONFIG_KEXEC is not set
183CONFIG_SECCOMP=y
184CONFIG_LOCKDEP_SUPPORT=y
185CONFIG_STACKTRACE_SUPPORT=y
186CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
187CONFIG_CONSTRUCTORS=y
188
189#
190# General setup
191#
192CONFIG_EXPERIMENTAL=y
193CONFIG_BROKEN_ON_SMP=y
194CONFIG_INIT_ENV_ARG_LIMIT=32
195CONFIG_CROSS_COMPILE=""
196CONFIG_LOCALVERSION=""
197# CONFIG_LOCALVERSION_AUTO is not set
198CONFIG_HAVE_KERNEL_GZIP=y
199CONFIG_HAVE_KERNEL_BZIP2=y
200CONFIG_HAVE_KERNEL_LZMA=y
201CONFIG_HAVE_KERNEL_LZO=y
202CONFIG_KERNEL_GZIP=y
203# CONFIG_KERNEL_BZIP2 is not set
204# CONFIG_KERNEL_LZMA is not set
205# CONFIG_KERNEL_LZO is not set
206CONFIG_SWAP=y
207CONFIG_SYSVIPC=y
208CONFIG_SYSVIPC_SYSCTL=y
209CONFIG_POSIX_MQUEUE=y
210CONFIG_POSIX_MQUEUE_SYSCTL=y
211CONFIG_BSD_PROCESS_ACCT=y
212CONFIG_BSD_PROCESS_ACCT_V3=y
213# CONFIG_TASKSTATS is not set
214# CONFIG_AUDIT is not set
215
216#
217# RCU Subsystem
218#
219CONFIG_TREE_RCU=y
220# CONFIG_TREE_PREEMPT_RCU is not set
221# CONFIG_TINY_RCU is not set
222# CONFIG_RCU_TRACE is not set
223CONFIG_RCU_FANOUT=32
224# CONFIG_RCU_FANOUT_EXACT is not set
225# CONFIG_TREE_RCU_TRACE is not set
226# CONFIG_IKCONFIG is not set
227CONFIG_LOG_BUF_SHIFT=17
228# CONFIG_CGROUPS is not set
229# CONFIG_SYSFS_DEPRECATED_V2 is not set
230CONFIG_RELAY=y
231# CONFIG_NAMESPACES is not set
232CONFIG_BLK_DEV_INITRD=y
233CONFIG_INITRAMFS_SOURCE=""
234CONFIG_RD_GZIP=y
235# CONFIG_RD_BZIP2 is not set
236# CONFIG_RD_LZMA is not set
237# CONFIG_RD_LZO is not set
238# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
239CONFIG_SYSCTL=y
240CONFIG_ANON_INODES=y
241CONFIG_EMBEDDED=y
242CONFIG_SYSCTL_SYSCALL=y
243CONFIG_KALLSYMS=y
244# CONFIG_KALLSYMS_EXTRA_PASS is not set
245CONFIG_HOTPLUG=y
246CONFIG_PRINTK=y
247CONFIG_BUG=y
248CONFIG_ELF_CORE=y
249CONFIG_PCSPKR_PLATFORM=y
250CONFIG_BASE_FULL=y
251CONFIG_FUTEX=y
252CONFIG_EPOLL=y
253CONFIG_SIGNALFD=y
254CONFIG_TIMERFD=y
255CONFIG_EVENTFD=y
256CONFIG_SHMEM=y
257CONFIG_AIO=y
258
259#
260# Kernel Performance Events And Counters
261#
262CONFIG_VM_EVENT_COUNTERS=y
263CONFIG_PCI_QUIRKS=y
264CONFIG_COMPAT_BRK=y
265CONFIG_SLAB=y
266# CONFIG_SLUB is not set
267# CONFIG_SLOB is not set
268CONFIG_PROFILING=y
269# CONFIG_OPROFILE is not set
270CONFIG_HAVE_OPROFILE=y
271
272#
273# GCOV-based kernel profiling
274#
275# CONFIG_GCOV_KERNEL is not set
276# CONFIG_SLOW_WORK is not set
277CONFIG_HAVE_GENERIC_DMA_COHERENT=y
278CONFIG_SLABINFO=y
279CONFIG_RT_MUTEXES=y
280CONFIG_BASE_SMALL=0
281CONFIG_MODULES=y
282# CONFIG_MODULE_FORCE_LOAD is not set
283CONFIG_MODULE_UNLOAD=y
284# CONFIG_MODULE_FORCE_UNLOAD is not set
285# CONFIG_MODVERSIONS is not set
286# CONFIG_MODULE_SRCVERSION_ALL is not set
287CONFIG_BLOCK=y
288CONFIG_LBDAF=y
289# CONFIG_BLK_DEV_BSG is not set
290# CONFIG_BLK_DEV_INTEGRITY is not set
291
292#
293# IO Schedulers
294#
295CONFIG_IOSCHED_NOOP=y
296CONFIG_IOSCHED_DEADLINE=y
297CONFIG_IOSCHED_CFQ=y
298# CONFIG_DEFAULT_DEADLINE is not set
299CONFIG_DEFAULT_CFQ=y
300# CONFIG_DEFAULT_NOOP is not set
301CONFIG_DEFAULT_IOSCHED="cfq"
302# CONFIG_INLINE_SPIN_TRYLOCK is not set
303# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
304# CONFIG_INLINE_SPIN_LOCK is not set
305# CONFIG_INLINE_SPIN_LOCK_BH is not set
306# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
307# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
308CONFIG_INLINE_SPIN_UNLOCK=y
309# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
310CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
311# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
312# CONFIG_INLINE_READ_TRYLOCK is not set
313# CONFIG_INLINE_READ_LOCK is not set
314# CONFIG_INLINE_READ_LOCK_BH is not set
315# CONFIG_INLINE_READ_LOCK_IRQ is not set
316# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
317CONFIG_INLINE_READ_UNLOCK=y
318# CONFIG_INLINE_READ_UNLOCK_BH is not set
319CONFIG_INLINE_READ_UNLOCK_IRQ=y
320# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
321# CONFIG_INLINE_WRITE_TRYLOCK is not set
322# CONFIG_INLINE_WRITE_LOCK is not set
323# CONFIG_INLINE_WRITE_LOCK_BH is not set
324# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
325# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
326CONFIG_INLINE_WRITE_UNLOCK=y
327# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
328CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
329# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
330# CONFIG_MUTEX_SPIN_ON_OWNER is not set
331# CONFIG_FREEZER is not set
332
333#
334# Bus options (PCI, PCMCIA, EISA, ISA, TC)
335#
336CONFIG_HW_HAS_PCI=y
337CONFIG_PCI=y
338CONFIG_PCI_DOMAINS=y
339# CONFIG_ARCH_SUPPORTS_MSI is not set
340# CONFIG_PCI_STUB is not set
341# CONFIG_PCI_IOV is not set
342CONFIG_MMU=y
343# CONFIG_PCCARD is not set
344# CONFIG_HOTPLUG_PCI is not set
345
346#
347# Executable file formats
348#
349CONFIG_BINFMT_ELF=y
350# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
351# CONFIG_HAVE_AOUT is not set
352CONFIG_BINFMT_MISC=m
353CONFIG_TRAD_SIGNALS=y
354
355#
356# Power management options
357#
358CONFIG_ARCH_HIBERNATION_POSSIBLE=y
359CONFIG_ARCH_SUSPEND_POSSIBLE=y
360# CONFIG_PM is not set
361CONFIG_NET=y
362
363#
364# Networking options
365#
366CONFIG_PACKET=y
367CONFIG_UNIX=y
368# CONFIG_NET_KEY is not set
369CONFIG_INET=y
370CONFIG_IP_MULTICAST=y
371CONFIG_IP_ADVANCED_ROUTER=y
372CONFIG_ASK_IP_FIB_HASH=y
373# CONFIG_IP_FIB_TRIE is not set
374CONFIG_IP_FIB_HASH=y
375CONFIG_IP_MULTIPLE_TABLES=y
376CONFIG_IP_ROUTE_MULTIPATH=y
377CONFIG_IP_ROUTE_VERBOSE=y
378CONFIG_IP_PNP=y
379# CONFIG_IP_PNP_DHCP is not set
380CONFIG_IP_PNP_BOOTP=y
381# CONFIG_IP_PNP_RARP is not set
382# CONFIG_NET_IPIP is not set
383# CONFIG_NET_IPGRE is not set
384# CONFIG_IP_MROUTE is not set
385# CONFIG_ARPD is not set
386CONFIG_SYN_COOKIES=y
387# CONFIG_INET_AH is not set
388# CONFIG_INET_ESP is not set
389# CONFIG_INET_IPCOMP is not set
390# CONFIG_INET_XFRM_TUNNEL is not set
391# CONFIG_INET_TUNNEL is not set
392# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
393# CONFIG_INET_XFRM_MODE_TUNNEL is not set
394# CONFIG_INET_XFRM_MODE_BEET is not set
395CONFIG_INET_LRO=y
396CONFIG_INET_DIAG=y
397CONFIG_INET_TCP_DIAG=y
398# CONFIG_TCP_CONG_ADVANCED is not set
399CONFIG_TCP_CONG_CUBIC=y
400CONFIG_DEFAULT_TCP_CONG="cubic"
401# CONFIG_TCP_MD5SIG is not set
402# CONFIG_IPV6 is not set
403CONFIG_NETWORK_SECMARK=y
404CONFIG_NETFILTER=y
405# CONFIG_NETFILTER_DEBUG is not set
406CONFIG_NETFILTER_ADVANCED=y
407CONFIG_BRIDGE_NETFILTER=y
408
409#
410# Core Netfilter Configuration
411#
412CONFIG_NETFILTER_NETLINK=m
413CONFIG_NETFILTER_NETLINK_QUEUE=m
414CONFIG_NETFILTER_NETLINK_LOG=m
415# CONFIG_NF_CONNTRACK is not set
416# CONFIG_NETFILTER_TPROXY is not set
417CONFIG_NETFILTER_XTABLES=m
418
419#
420# Xtables combined modules
421#
422CONFIG_NETFILTER_XT_MARK=m
423
424#
425# Xtables targets
426#
427CONFIG_NETFILTER_XT_TARGET_CLASSIFY=m
428CONFIG_NETFILTER_XT_TARGET_DSCP=m
429CONFIG_NETFILTER_XT_TARGET_HL=m
430# CONFIG_NETFILTER_XT_TARGET_LED is not set
431CONFIG_NETFILTER_XT_TARGET_MARK=m
432# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set
433CONFIG_NETFILTER_XT_TARGET_NFQUEUE=m
434# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set
435# CONFIG_NETFILTER_XT_TARGET_TEE is not set
436# CONFIG_NETFILTER_XT_TARGET_TRACE is not set
437CONFIG_NETFILTER_XT_TARGET_SECMARK=m
438# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set
439# CONFIG_NETFILTER_XT_TARGET_TCPOPTSTRIP is not set
440
441#
442# Xtables matches
443#
444CONFIG_NETFILTER_XT_MATCH_COMMENT=m
445CONFIG_NETFILTER_XT_MATCH_DCCP=m
446CONFIG_NETFILTER_XT_MATCH_DSCP=m
447CONFIG_NETFILTER_XT_MATCH_ESP=m
448# CONFIG_NETFILTER_XT_MATCH_HASHLIMIT is not set
449CONFIG_NETFILTER_XT_MATCH_HL=m
450# CONFIG_NETFILTER_XT_MATCH_IPRANGE is not set
451CONFIG_NETFILTER_XT_MATCH_LENGTH=m
452CONFIG_NETFILTER_XT_MATCH_LIMIT=m
453CONFIG_NETFILTER_XT_MATCH_MAC=m
454CONFIG_NETFILTER_XT_MATCH_MARK=m
455CONFIG_NETFILTER_XT_MATCH_MULTIPORT=m
456# CONFIG_NETFILTER_XT_MATCH_OSF is not set
457# CONFIG_NETFILTER_XT_MATCH_OWNER is not set
458CONFIG_NETFILTER_XT_MATCH_PHYSDEV=m
459CONFIG_NETFILTER_XT_MATCH_PKTTYPE=m
460CONFIG_NETFILTER_XT_MATCH_QUOTA=m
461# CONFIG_NETFILTER_XT_MATCH_RATEEST is not set
462CONFIG_NETFILTER_XT_MATCH_REALM=m
463# CONFIG_NETFILTER_XT_MATCH_RECENT is not set
464CONFIG_NETFILTER_XT_MATCH_SCTP=m
465CONFIG_NETFILTER_XT_MATCH_STATISTIC=m
466CONFIG_NETFILTER_XT_MATCH_STRING=m
467CONFIG_NETFILTER_XT_MATCH_TCPMSS=m
468# CONFIG_NETFILTER_XT_MATCH_TIME is not set
469# CONFIG_NETFILTER_XT_MATCH_U32 is not set
470CONFIG_IP_VS=m
471# CONFIG_IP_VS_DEBUG is not set
472CONFIG_IP_VS_TAB_BITS=12
473
474#
475# IPVS transport protocol load balancing support
476#
477CONFIG_IP_VS_PROTO_TCP=y
478CONFIG_IP_VS_PROTO_UDP=y
479CONFIG_IP_VS_PROTO_AH_ESP=y
480CONFIG_IP_VS_PROTO_ESP=y
481CONFIG_IP_VS_PROTO_AH=y
482# CONFIG_IP_VS_PROTO_SCTP is not set
483
484#
485# IPVS scheduler
486#
487CONFIG_IP_VS_RR=m
488CONFIG_IP_VS_WRR=m
489CONFIG_IP_VS_LC=m
490CONFIG_IP_VS_WLC=m
491CONFIG_IP_VS_LBLC=m
492CONFIG_IP_VS_LBLCR=m
493CONFIG_IP_VS_DH=m
494CONFIG_IP_VS_SH=m
495CONFIG_IP_VS_SED=m
496CONFIG_IP_VS_NQ=m
497
498#
499# IPVS application helper
500#
501CONFIG_IP_VS_FTP=m
502
503#
504# IP: Netfilter Configuration
505#
506# CONFIG_NF_DEFRAG_IPV4 is not set
507CONFIG_IP_NF_QUEUE=m
508CONFIG_IP_NF_IPTABLES=m
509CONFIG_IP_NF_MATCH_ADDRTYPE=m
510CONFIG_IP_NF_MATCH_AH=m
511CONFIG_IP_NF_MATCH_ECN=m
512CONFIG_IP_NF_MATCH_TTL=m
513CONFIG_IP_NF_FILTER=m
514CONFIG_IP_NF_TARGET_REJECT=m
515CONFIG_IP_NF_TARGET_LOG=m
516CONFIG_IP_NF_TARGET_ULOG=m
517CONFIG_IP_NF_MANGLE=m
518CONFIG_IP_NF_TARGET_ECN=m
519CONFIG_IP_NF_TARGET_TTL=m
520CONFIG_IP_NF_RAW=m
521CONFIG_IP_NF_ARPTABLES=m
522CONFIG_IP_NF_ARPFILTER=m
523CONFIG_IP_NF_ARP_MANGLE=m
524
525#
526# DECnet: Netfilter Configuration
527#
528CONFIG_DECNET_NF_GRABULATOR=m
529CONFIG_BRIDGE_NF_EBTABLES=m
530CONFIG_BRIDGE_EBT_BROUTE=m
531CONFIG_BRIDGE_EBT_T_FILTER=m
532CONFIG_BRIDGE_EBT_T_NAT=m
533CONFIG_BRIDGE_EBT_802_3=m
534CONFIG_BRIDGE_EBT_AMONG=m
535CONFIG_BRIDGE_EBT_ARP=m
536CONFIG_BRIDGE_EBT_IP=m
537CONFIG_BRIDGE_EBT_LIMIT=m
538CONFIG_BRIDGE_EBT_MARK=m
539CONFIG_BRIDGE_EBT_PKTTYPE=m
540CONFIG_BRIDGE_EBT_STP=m
541CONFIG_BRIDGE_EBT_VLAN=m
542CONFIG_BRIDGE_EBT_ARPREPLY=m
543CONFIG_BRIDGE_EBT_DNAT=m
544CONFIG_BRIDGE_EBT_MARK_T=m
545CONFIG_BRIDGE_EBT_REDIRECT=m
546CONFIG_BRIDGE_EBT_SNAT=m
547CONFIG_BRIDGE_EBT_LOG=m
548CONFIG_BRIDGE_EBT_ULOG=m
549# CONFIG_BRIDGE_EBT_NFLOG is not set
550CONFIG_IP_DCCP=m
551CONFIG_INET_DCCP_DIAG=m
552
553#
554# DCCP CCIDs Configuration (EXPERIMENTAL)
555#
556# CONFIG_IP_DCCP_CCID2_DEBUG is not set
557CONFIG_IP_DCCP_CCID3=y
558# CONFIG_IP_DCCP_CCID3_DEBUG is not set
559CONFIG_IP_DCCP_CCID3_RTO=100
560CONFIG_IP_DCCP_TFRC_LIB=y
561CONFIG_IP_SCTP=m
562# CONFIG_SCTP_DBG_MSG is not set
563# CONFIG_SCTP_DBG_OBJCNT is not set
564# CONFIG_SCTP_HMAC_NONE is not set
565# CONFIG_SCTP_HMAC_SHA1 is not set
566CONFIG_SCTP_HMAC_MD5=y
567# CONFIG_RDS is not set
568CONFIG_TIPC=m
569# CONFIG_TIPC_ADVANCED is not set
570# CONFIG_TIPC_DEBUG is not set
571CONFIG_ATM=y
572CONFIG_ATM_CLIP=y
573# CONFIG_ATM_CLIP_NO_ICMP is not set
574CONFIG_ATM_LANE=m
575CONFIG_ATM_MPOA=m
576CONFIG_ATM_BR2684=m
577# CONFIG_ATM_BR2684_IPFILTER is not set
578# CONFIG_L2TP is not set
579CONFIG_STP=m
580CONFIG_BRIDGE=m
581CONFIG_BRIDGE_IGMP_SNOOPING=y
582# CONFIG_NET_DSA is not set
583CONFIG_VLAN_8021Q=m
584# CONFIG_VLAN_8021Q_GVRP is not set
585CONFIG_DECNET=m
586# CONFIG_DECNET_ROUTER is not set
587CONFIG_LLC=m
588CONFIG_LLC2=m
589CONFIG_IPX=m
590# CONFIG_IPX_INTERN is not set
591CONFIG_ATALK=m
592CONFIG_DEV_APPLETALK=m
593CONFIG_IPDDP=m
594CONFIG_IPDDP_ENCAP=y
595CONFIG_IPDDP_DECAP=y
596CONFIG_X25=m
597CONFIG_LAPB=m
598CONFIG_ECONET=m
599CONFIG_ECONET_AUNUDP=y
600CONFIG_ECONET_NATIVE=y
601CONFIG_WAN_ROUTER=m
602# CONFIG_PHONET is not set
603# CONFIG_IEEE802154 is not set
604CONFIG_NET_SCHED=y
605
606#
607# Queueing/Scheduling
608#
609CONFIG_NET_SCH_CBQ=m
610CONFIG_NET_SCH_HTB=m
611CONFIG_NET_SCH_HFSC=m
612CONFIG_NET_SCH_ATM=m
613CONFIG_NET_SCH_PRIO=m
614# CONFIG_NET_SCH_MULTIQ is not set
615CONFIG_NET_SCH_RED=m
616CONFIG_NET_SCH_SFQ=m
617CONFIG_NET_SCH_TEQL=m
618CONFIG_NET_SCH_TBF=m
619CONFIG_NET_SCH_GRED=m
620CONFIG_NET_SCH_DSMARK=m
621CONFIG_NET_SCH_NETEM=m
622# CONFIG_NET_SCH_DRR is not set
623CONFIG_NET_SCH_INGRESS=m
624
625#
626# Classification
627#
628CONFIG_NET_CLS=y
629CONFIG_NET_CLS_BASIC=m
630CONFIG_NET_CLS_TCINDEX=m
631CONFIG_NET_CLS_ROUTE4=m
632CONFIG_NET_CLS_ROUTE=y
633CONFIG_NET_CLS_FW=m
634CONFIG_NET_CLS_U32=m
635# CONFIG_CLS_U32_PERF is not set
636CONFIG_CLS_U32_MARK=y
637CONFIG_NET_CLS_RSVP=m
638CONFIG_NET_CLS_RSVP6=m
639# CONFIG_NET_CLS_FLOW is not set
640CONFIG_NET_EMATCH=y
641CONFIG_NET_EMATCH_STACK=32
642CONFIG_NET_EMATCH_CMP=m
643CONFIG_NET_EMATCH_NBYTE=m
644CONFIG_NET_EMATCH_U32=m
645CONFIG_NET_EMATCH_META=m
646CONFIG_NET_EMATCH_TEXT=m
647CONFIG_NET_CLS_ACT=y
648CONFIG_NET_ACT_POLICE=y
649# CONFIG_NET_ACT_GACT is not set
650# CONFIG_NET_ACT_MIRRED is not set
651# CONFIG_NET_ACT_IPT is not set
652# CONFIG_NET_ACT_NAT is not set
653# CONFIG_NET_ACT_PEDIT is not set
654# CONFIG_NET_ACT_SIMP is not set
655# CONFIG_NET_ACT_SKBEDIT is not set
656# CONFIG_NET_CLS_IND is not set
657CONFIG_NET_SCH_FIFO=y
658# CONFIG_DCB is not set
659
660#
661# Network testing
662#
663CONFIG_NET_PKTGEN=m
664CONFIG_HAMRADIO=y
665
666#
667# Packet Radio protocols
668#
669CONFIG_AX25=m
670# CONFIG_AX25_DAMA_SLAVE is not set
671CONFIG_NETROM=m
672CONFIG_ROSE=m
673
674#
675# AX.25 network device drivers
676#
677CONFIG_MKISS=m
678CONFIG_6PACK=m
679CONFIG_BPQETHER=m
680CONFIG_BAYCOM_SER_FDX=m
681CONFIG_BAYCOM_SER_HDX=m
682CONFIG_YAM=m
683# CONFIG_CAN is not set
684# CONFIG_IRDA is not set
685# CONFIG_BT is not set
686# CONFIG_AF_RXRPC is not set
687CONFIG_FIB_RULES=y
688CONFIG_WIRELESS=y
689CONFIG_WEXT_CORE=y
690CONFIG_WEXT_PROC=y
691CONFIG_CFG80211=y
692# CONFIG_NL80211_TESTMODE is not set
693# CONFIG_CFG80211_DEVELOPER_WARNINGS is not set
694# CONFIG_CFG80211_REG_DEBUG is not set
695CONFIG_CFG80211_DEFAULT_PS=y
696# CONFIG_CFG80211_DEBUGFS is not set
697# CONFIG_CFG80211_INTERNAL_REGDB is not set
698CONFIG_CFG80211_WEXT=y
699CONFIG_WIRELESS_EXT_SYSFS=y
700# CONFIG_LIB80211 is not set
701CONFIG_MAC80211=y
702CONFIG_MAC80211_HAS_RC=y
703# CONFIG_MAC80211_RC_PID is not set
704CONFIG_MAC80211_RC_MINSTREL=y
705# CONFIG_MAC80211_RC_DEFAULT_PID is not set
706CONFIG_MAC80211_RC_DEFAULT_MINSTREL=y
707CONFIG_MAC80211_RC_DEFAULT="minstrel"
708# CONFIG_MAC80211_MESH is not set
709CONFIG_MAC80211_LEDS=y
710# CONFIG_MAC80211_DEBUGFS is not set
711# CONFIG_MAC80211_DEBUG_MENU is not set
712# CONFIG_WIMAX is not set
713# CONFIG_RFKILL is not set
714# CONFIG_NET_9P is not set
715# CONFIG_CAIF is not set
716
717#
718# Device Drivers
719#
720
721#
722# Generic Driver Options
723#
724CONFIG_UEVENT_HELPER_PATH=""
725# CONFIG_DEVTMPFS is not set
726CONFIG_STANDALONE=y
727CONFIG_PREVENT_FIRMWARE_BUILD=y
728CONFIG_FW_LOADER=y
729CONFIG_FIRMWARE_IN_KERNEL=y
730CONFIG_EXTRA_FIRMWARE=""
731# CONFIG_SYS_HYPERVISOR is not set
732# CONFIG_CONNECTOR is not set
733CONFIG_MTD=y
734# CONFIG_MTD_DEBUG is not set
735# CONFIG_MTD_TESTS is not set
736# CONFIG_MTD_CONCAT is not set
737CONFIG_MTD_PARTITIONS=y
738# CONFIG_MTD_REDBOOT_PARTS is not set
739# CONFIG_MTD_CMDLINE_PARTS is not set
740# CONFIG_MTD_AR7_PARTS is not set
741
742#
743# User Modules And Translation Layers
744#
745CONFIG_MTD_CHAR=y
746CONFIG_MTD_BLKDEVS=y
747CONFIG_MTD_BLOCK=y
748# CONFIG_FTL is not set
749# CONFIG_NFTL is not set
750# CONFIG_INFTL is not set
751# CONFIG_RFD_FTL is not set
752# CONFIG_SSFDC is not set
753# CONFIG_SM_FTL is not set
754# CONFIG_MTD_OOPS is not set
755
756#
757# RAM/ROM/Flash chip drivers
758#
759CONFIG_MTD_CFI=y
760# CONFIG_MTD_JEDECPROBE is not set
761CONFIG_MTD_GEN_PROBE=y
762# CONFIG_MTD_CFI_ADV_OPTIONS is not set
763CONFIG_MTD_MAP_BANK_WIDTH_1=y
764CONFIG_MTD_MAP_BANK_WIDTH_2=y
765CONFIG_MTD_MAP_BANK_WIDTH_4=y
766# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
767# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
768# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
769CONFIG_MTD_CFI_I1=y
770CONFIG_MTD_CFI_I2=y
771# CONFIG_MTD_CFI_I4 is not set
772# CONFIG_MTD_CFI_I8 is not set
773CONFIG_MTD_CFI_INTELEXT=y
774CONFIG_MTD_CFI_AMDSTD=y
775# CONFIG_MTD_CFI_STAA is not set
776CONFIG_MTD_CFI_UTIL=y
777CONFIG_MTD_RAM=m
778# CONFIG_MTD_ROM is not set
779# CONFIG_MTD_ABSENT is not set
780
781#
782# Mapping drivers for chip access
783#
784CONFIG_MTD_COMPLEX_MAPPINGS=y
785CONFIG_MTD_PHYSMAP=y
786# CONFIG_MTD_PHYSMAP_COMPAT is not set
787# CONFIG_MTD_PCI is not set
788# CONFIG_MTD_GPIO_ADDR is not set
789# CONFIG_MTD_INTEL_VR_NOR is not set
790# CONFIG_MTD_PLATRAM is not set
791
792#
793# Self-contained MTD device drivers
794#
795# CONFIG_MTD_PMC551 is not set
796# CONFIG_MTD_SLRAM is not set
797# CONFIG_MTD_PHRAM is not set
798# CONFIG_MTD_MTDRAM is not set
799# CONFIG_MTD_BLOCK2MTD is not set
800
801#
802# Disk-On-Chip Device Drivers
803#
804# CONFIG_MTD_DOC2000 is not set
805# CONFIG_MTD_DOC2001 is not set
806# CONFIG_MTD_DOC2001PLUS is not set
807# CONFIG_MTD_NAND is not set
808# CONFIG_MTD_ONENAND is not set
809
810#
811# LPDDR flash memory drivers
812#
813# CONFIG_MTD_LPDDR is not set
814
815#
816# UBI - Unsorted block images
817#
818# CONFIG_MTD_UBI is not set
819# CONFIG_PARPORT is not set
820CONFIG_BLK_DEV=y
821# CONFIG_BLK_CPQ_DA is not set
822# CONFIG_BLK_CPQ_CISS_DA is not set
823# CONFIG_BLK_DEV_DAC960 is not set
824# CONFIG_BLK_DEV_UMEM is not set
825# CONFIG_BLK_DEV_COW_COMMON is not set
826CONFIG_BLK_DEV_LOOP=y
827# CONFIG_BLK_DEV_CRYPTOLOOP is not set
828
829#
830# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
831#
832# CONFIG_BLK_DEV_NBD is not set
833# CONFIG_BLK_DEV_SX8 is not set
834# CONFIG_BLK_DEV_UB is not set
835CONFIG_BLK_DEV_RAM=y
836CONFIG_BLK_DEV_RAM_COUNT=16
837CONFIG_BLK_DEV_RAM_SIZE=65536
838# CONFIG_BLK_DEV_XIP is not set
839# CONFIG_CDROM_PKTCDVD is not set
840# CONFIG_ATA_OVER_ETH is not set
841# CONFIG_BLK_DEV_HD is not set
842CONFIG_MISC_DEVICES=y
843# CONFIG_AD525X_DPOT is not set
844# CONFIG_PHANTOM is not set
845# CONFIG_SGI_IOC4 is not set
846CONFIG_TIFM_CORE=m
847CONFIG_TIFM_7XX1=m
848# CONFIG_ICS932S401 is not set
849# CONFIG_ENCLOSURE_SERVICES is not set
850# CONFIG_HP_ILO is not set
851# CONFIG_ISL29003 is not set
852# CONFIG_SENSORS_TSL2550 is not set
853# CONFIG_DS1682 is not set
854# CONFIG_C2PORT is not set
855
856#
857# EEPROM support
858#
859# CONFIG_EEPROM_AT24 is not set
860# CONFIG_EEPROM_LEGACY is not set
861# CONFIG_EEPROM_MAX6875 is not set
862# CONFIG_EEPROM_93CX6 is not set
863# CONFIG_CB710_CORE is not set
864CONFIG_HAVE_IDE=y
865# CONFIG_IDE is not set
866
867#
868# SCSI device support
869#
870CONFIG_SCSI_MOD=m
871# CONFIG_RAID_ATTRS is not set
872CONFIG_SCSI=m
873CONFIG_SCSI_DMA=y
874# CONFIG_SCSI_TGT is not set
875CONFIG_SCSI_NETLINK=y
876CONFIG_SCSI_PROC_FS=y
877
878#
879# SCSI support type (disk, tape, CD-ROM)
880#
881CONFIG_BLK_DEV_SD=m
882# CONFIG_CHR_DEV_ST is not set
883# CONFIG_CHR_DEV_OSST is not set
884# CONFIG_BLK_DEV_SR is not set
885CONFIG_CHR_DEV_SG=m
886# CONFIG_CHR_DEV_SCH is not set
887CONFIG_SCSI_MULTI_LUN=y
888# CONFIG_SCSI_CONSTANTS is not set
889CONFIG_SCSI_LOGGING=y
890# CONFIG_SCSI_SCAN_ASYNC is not set
891CONFIG_SCSI_WAIT_SCAN=m
892
893#
894# SCSI Transports
895#
896CONFIG_SCSI_SPI_ATTRS=m
897CONFIG_SCSI_FC_ATTRS=m
898CONFIG_SCSI_ISCSI_ATTRS=m
899CONFIG_SCSI_SAS_ATTRS=m
900CONFIG_SCSI_SAS_LIBSAS=m
901CONFIG_SCSI_SAS_HOST_SMP=y
902# CONFIG_SCSI_SAS_LIBSAS_DEBUG is not set
903# CONFIG_SCSI_SRP_ATTRS is not set
904# CONFIG_SCSI_LOWLEVEL is not set
905# CONFIG_SCSI_DH is not set
906# CONFIG_SCSI_OSD_INITIATOR is not set
907# CONFIG_ATA is not set
908# CONFIG_MD is not set
909# CONFIG_FUSION is not set
910
911#
912# IEEE 1394 (FireWire) support
913#
914
915#
916# You can enable one or both FireWire driver stacks.
917#
918
919#
920# The newer stack is recommended.
921#
922# CONFIG_FIREWIRE is not set
923# CONFIG_IEEE1394 is not set
924# CONFIG_I2O is not set
925CONFIG_NETDEVICES=y
926# CONFIG_IFB is not set
927# CONFIG_DUMMY is not set
928# CONFIG_BONDING is not set
929# CONFIG_MACVLAN is not set
930# CONFIG_EQUALIZER is not set
931# CONFIG_TUN is not set
932# CONFIG_VETH is not set
933# CONFIG_ARCNET is not set
934CONFIG_PHYLIB=y
935
936#
937# MII PHY device drivers
938#
939CONFIG_MARVELL_PHY=m
940CONFIG_DAVICOM_PHY=m
941CONFIG_QSEMI_PHY=m
942CONFIG_LXT_PHY=m
943CONFIG_CICADA_PHY=m
944CONFIG_VITESSE_PHY=m
945CONFIG_SMSC_PHY=m
946# CONFIG_BROADCOM_PHY is not set
947# CONFIG_ICPLUS_PHY is not set
948# CONFIG_REALTEK_PHY is not set
949# CONFIG_NATIONAL_PHY is not set
950# CONFIG_STE10XP is not set
951# CONFIG_LSI_ET1011C_PHY is not set
952# CONFIG_MICREL_PHY is not set
953# CONFIG_FIXED_PHY is not set
954# CONFIG_MDIO_BITBANG is not set
955CONFIG_NET_ETHERNET=y
956CONFIG_MII=y
957# CONFIG_AX88796 is not set
958CONFIG_MIPS_AU1X00_ENET=y
959# CONFIG_HAPPYMEAL is not set
960# CONFIG_SUNGEM is not set
961# CONFIG_CASSINI is not set
962# CONFIG_NET_VENDOR_3COM is not set
963# CONFIG_SMC91X is not set
964# CONFIG_DM9000 is not set
965# CONFIG_ETHOC is not set
966# CONFIG_SMSC911X is not set
967# CONFIG_DNET is not set
968# CONFIG_NET_TULIP is not set
969# CONFIG_HP100 is not set
970# CONFIG_IBM_NEW_EMAC_ZMII is not set
971# CONFIG_IBM_NEW_EMAC_RGMII is not set
972# CONFIG_IBM_NEW_EMAC_TAH is not set
973# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
974# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
975# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
976# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
977# CONFIG_NET_PCI is not set
978# CONFIG_B44 is not set
979# CONFIG_KS8842 is not set
980# CONFIG_KS8851_MLL is not set
981# CONFIG_ATL2 is not set
982# CONFIG_NETDEV_1000 is not set
983# CONFIG_NETDEV_10000 is not set
984# CONFIG_TR is not set
985CONFIG_WLAN=y
986# CONFIG_LIBERTAS_THINFIRM is not set
987# CONFIG_ATMEL is not set
988# CONFIG_AT76C50X_USB is not set
989# CONFIG_PRISM54 is not set
990# CONFIG_USB_ZD1201 is not set
991# CONFIG_USB_NET_RNDIS_WLAN is not set
992# CONFIG_RTL8180 is not set
993# CONFIG_RTL8187 is not set
994# CONFIG_ADM8211 is not set
995# CONFIG_MAC80211_HWSIM is not set
996# CONFIG_MWL8K is not set
997CONFIG_ATH_COMMON=y
998CONFIG_ATH_DEBUG=y
999CONFIG_ATH5K=y
1000CONFIG_ATH5K_DEBUG=y
1001# CONFIG_ATH9K is not set
1002# CONFIG_ATH9K_HTC is not set
1003# CONFIG_AR9170_USB is not set
1004# CONFIG_B43 is not set
1005# CONFIG_B43LEGACY is not set
1006# CONFIG_HOSTAP is not set
1007# CONFIG_IPW2100 is not set
1008# CONFIG_IPW2200 is not set
1009# CONFIG_IWLWIFI is not set
1010# CONFIG_LIBERTAS is not set
1011# CONFIG_HERMES is not set
1012# CONFIG_P54_COMMON is not set
1013# CONFIG_RT2X00 is not set
1014# CONFIG_WL12XX is not set
1015# CONFIG_ZD1211RW is not set
1016
1017#
1018# Enable WiMAX (Networking options) to see the WiMAX drivers
1019#
1020
1021#
1022# USB Network Adapters
1023#
1024# CONFIG_USB_CATC is not set
1025# CONFIG_USB_KAWETH is not set
1026# CONFIG_USB_PEGASUS is not set
1027# CONFIG_USB_RTL8150 is not set
1028# CONFIG_USB_USBNET is not set
1029# CONFIG_USB_IPHETH is not set
1030CONFIG_WAN=y
1031CONFIG_LANMEDIA=m
1032CONFIG_HDLC=m
1033CONFIG_HDLC_RAW=m
1034CONFIG_HDLC_RAW_ETH=m
1035CONFIG_HDLC_CISCO=m
1036CONFIG_HDLC_FR=m
1037CONFIG_HDLC_PPP=m
1038CONFIG_HDLC_X25=m
1039CONFIG_PCI200SYN=m
1040CONFIG_WANXL=m
1041# CONFIG_PC300TOO is not set
1042CONFIG_FARSYNC=m
1043CONFIG_DSCC4=m
1044CONFIG_DSCC4_PCISYNC=y
1045CONFIG_DSCC4_PCI_RST=y
1046CONFIG_DLCI=m
1047CONFIG_DLCI_MAX=8
1048CONFIG_WAN_ROUTER_DRIVERS=m
1049CONFIG_CYCLADES_SYNC=m
1050CONFIG_CYCLOMX_X25=y
1051CONFIG_LAPBETHER=m
1052CONFIG_X25_ASY=m
1053CONFIG_ATM_DRIVERS=y
1054# CONFIG_ATM_DUMMY is not set
1055CONFIG_ATM_TCP=m
1056CONFIG_ATM_LANAI=m
1057CONFIG_ATM_ENI=m
1058# CONFIG_ATM_ENI_DEBUG is not set
1059# CONFIG_ATM_ENI_TUNE_BURST is not set
1060CONFIG_ATM_FIRESTREAM=m
1061CONFIG_ATM_ZATM=m
1062# CONFIG_ATM_ZATM_DEBUG is not set
1063CONFIG_ATM_NICSTAR=m
1064# CONFIG_ATM_NICSTAR_USE_SUNI is not set
1065# CONFIG_ATM_NICSTAR_USE_IDT77105 is not set
1066CONFIG_ATM_IDT77252=m
1067# CONFIG_ATM_IDT77252_DEBUG is not set
1068# CONFIG_ATM_IDT77252_RCV_ALL is not set
1069CONFIG_ATM_IDT77252_USE_SUNI=y
1070CONFIG_ATM_AMBASSADOR=m
1071# CONFIG_ATM_AMBASSADOR_DEBUG is not set
1072CONFIG_ATM_HORIZON=m
1073# CONFIG_ATM_HORIZON_DEBUG is not set
1074CONFIG_ATM_IA=m
1075# CONFIG_ATM_IA_DEBUG is not set
1076CONFIG_ATM_FORE200E=m
1077# CONFIG_ATM_FORE200E_USE_TASKLET is not set
1078CONFIG_ATM_FORE200E_TX_RETRY=16
1079CONFIG_ATM_FORE200E_DEBUG=0
1080CONFIG_ATM_HE=m
1081CONFIG_ATM_HE_USE_SUNI=y
1082# CONFIG_ATM_SOLOS is not set
1083# CONFIG_FDDI is not set
1084# CONFIG_HIPPI is not set
1085CONFIG_PPP=m
1086CONFIG_PPP_MULTILINK=y
1087CONFIG_PPP_FILTER=y
1088CONFIG_PPP_ASYNC=m
1089CONFIG_PPP_SYNC_TTY=m
1090CONFIG_PPP_DEFLATE=m
1091CONFIG_PPP_BSDCOMP=m
1092CONFIG_PPP_MPPE=m
1093CONFIG_PPPOE=m
1094CONFIG_PPPOATM=m
1095CONFIG_SLIP=m
1096CONFIG_SLIP_COMPRESSED=y
1097CONFIG_SLHC=m
1098CONFIG_SLIP_SMART=y
1099CONFIG_SLIP_MODE_SLIP6=y
1100CONFIG_NET_FC=y
1101CONFIG_NETCONSOLE=m
1102# CONFIG_NETCONSOLE_DYNAMIC is not set
1103CONFIG_NETPOLL=y
1104# CONFIG_NETPOLL_TRAP is not set
1105CONFIG_NET_POLL_CONTROLLER=y
1106# CONFIG_VMXNET3 is not set
1107# CONFIG_ISDN is not set
1108# CONFIG_PHONE is not set
1109
1110#
1111# Input device support
1112#
1113CONFIG_INPUT=y
1114# CONFIG_INPUT_FF_MEMLESS is not set
1115# CONFIG_INPUT_POLLDEV is not set
1116# CONFIG_INPUT_SPARSEKMAP is not set
1117
1118#
1119# Userland interfaces
1120#
1121# CONFIG_INPUT_MOUSEDEV is not set
1122# CONFIG_INPUT_JOYDEV is not set
1123# CONFIG_INPUT_EVDEV is not set
1124# CONFIG_INPUT_EVBUG is not set
1125
1126#
1127# Input Device Drivers
1128#
1129# CONFIG_INPUT_KEYBOARD is not set
1130# CONFIG_INPUT_MOUSE is not set
1131# CONFIG_INPUT_JOYSTICK is not set
1132# CONFIG_INPUT_TABLET is not set
1133# CONFIG_INPUT_TOUCHSCREEN is not set
1134# CONFIG_INPUT_MISC is not set
1135
1136#
1137# Hardware I/O ports
1138#
1139# CONFIG_SERIO is not set
1140# CONFIG_GAMEPORT is not set
1141
1142#
1143# Character devices
1144#
1145CONFIG_VT=y
1146CONFIG_CONSOLE_TRANSLATIONS=y
1147CONFIG_VT_CONSOLE=y
1148CONFIG_HW_CONSOLE=y
1149CONFIG_VT_HW_CONSOLE_BINDING=y
1150CONFIG_DEVKMEM=y
1151# CONFIG_SERIAL_NONSTANDARD is not set
1152# CONFIG_N_GSM is not set
1153# CONFIG_NOZOMI is not set
1154
1155#
1156# Serial drivers
1157#
1158CONFIG_SERIAL_8250=y
1159CONFIG_SERIAL_8250_CONSOLE=y
1160# CONFIG_SERIAL_8250_PCI is not set
1161CONFIG_SERIAL_8250_NR_UARTS=4
1162CONFIG_SERIAL_8250_RUNTIME_UARTS=4
1163# CONFIG_SERIAL_8250_EXTENDED is not set
1164
1165#
1166# Non-8250 serial port support
1167#
1168CONFIG_SERIAL_CORE=y
1169CONFIG_SERIAL_CORE_CONSOLE=y
1170# CONFIG_SERIAL_JSM is not set
1171# CONFIG_SERIAL_TIMBERDALE is not set
1172# CONFIG_SERIAL_ALTERA_JTAGUART is not set
1173# CONFIG_SERIAL_ALTERA_UART is not set
1174CONFIG_UNIX98_PTYS=y
1175# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
1176CONFIG_LEGACY_PTYS=y
1177CONFIG_LEGACY_PTY_COUNT=256
1178# CONFIG_IPMI_HANDLER is not set
1179CONFIG_HW_RANDOM=y
1180# CONFIG_HW_RANDOM_TIMERIOMEM is not set
1181# CONFIG_R3964 is not set
1182# CONFIG_APPLICOM is not set
1183# CONFIG_RAW_DRIVER is not set
1184# CONFIG_TCG_TPM is not set
1185CONFIG_DEVPORT=y
1186# CONFIG_RAMOOPS is not set
1187CONFIG_I2C=y
1188CONFIG_I2C_BOARDINFO=y
1189CONFIG_I2C_COMPAT=y
1190CONFIG_I2C_CHARDEV=y
1191CONFIG_I2C_HELPER_AUTO=y
1192CONFIG_I2C_ALGOBIT=y
1193
1194#
1195# I2C Hardware Bus support
1196#
1197
1198#
1199# PC SMBus host controller drivers
1200#
1201# CONFIG_I2C_ALI1535 is not set
1202# CONFIG_I2C_ALI1563 is not set
1203# CONFIG_I2C_ALI15X3 is not set
1204# CONFIG_I2C_AMD756 is not set
1205# CONFIG_I2C_AMD8111 is not set
1206# CONFIG_I2C_I801 is not set
1207# CONFIG_I2C_ISCH is not set
1208# CONFIG_I2C_PIIX4 is not set
1209# CONFIG_I2C_NFORCE2 is not set
1210# CONFIG_I2C_SIS5595 is not set
1211# CONFIG_I2C_SIS630 is not set
1212# CONFIG_I2C_SIS96X is not set
1213# CONFIG_I2C_VIA is not set
1214# CONFIG_I2C_VIAPRO is not set
1215
1216#
1217# I2C system bus drivers (mostly embedded / system-on-chip)
1218#
1219# CONFIG_I2C_AU1550 is not set
1220CONFIG_I2C_GPIO=y
1221# CONFIG_I2C_OCORES is not set
1222# CONFIG_I2C_PCA_PLATFORM is not set
1223# CONFIG_I2C_SIMTEC is not set
1224# CONFIG_I2C_XILINX is not set
1225
1226#
1227# External I2C/SMBus adapter drivers
1228#
1229# CONFIG_I2C_PARPORT_LIGHT is not set
1230# CONFIG_I2C_TAOS_EVM is not set
1231# CONFIG_I2C_TINY_USB is not set
1232
1233#
1234# Other I2C/SMBus bus drivers
1235#
1236# CONFIG_I2C_STUB is not set
1237# CONFIG_I2C_DEBUG_CORE is not set
1238# CONFIG_I2C_DEBUG_ALGO is not set
1239# CONFIG_I2C_DEBUG_BUS is not set
1240# CONFIG_SPI is not set
1241
1242#
1243# PPS support
1244#
1245# CONFIG_PPS is not set
1246CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
1247CONFIG_GPIOLIB=y
1248CONFIG_GPIO_SYSFS=y
1249
1250#
1251# Memory mapped GPIO expanders:
1252#
1253# CONFIG_GPIO_IT8761E is not set
1254# CONFIG_GPIO_SCH is not set
1255
1256#
1257# I2C GPIO expanders:
1258#
1259# CONFIG_GPIO_MAX7300 is not set
1260# CONFIG_GPIO_MAX732X is not set
1261# CONFIG_GPIO_PCA953X is not set
1262# CONFIG_GPIO_PCF857X is not set
1263# CONFIG_GPIO_ADP5588 is not set
1264
1265#
1266# PCI GPIO expanders:
1267#
1268# CONFIG_GPIO_CS5535 is not set
1269# CONFIG_GPIO_BT8XX is not set
1270# CONFIG_GPIO_LANGWELL is not set
1271# CONFIG_GPIO_RDC321X is not set
1272
1273#
1274# SPI GPIO expanders:
1275#
1276
1277#
1278# AC97 GPIO expanders:
1279#
1280
1281#
1282# MODULbus GPIO expanders:
1283#
1284# CONFIG_W1 is not set
1285# CONFIG_POWER_SUPPLY is not set
1286CONFIG_HWMON=y
1287# CONFIG_HWMON_VID is not set
1288# CONFIG_HWMON_DEBUG_CHIP is not set
1289
1290#
1291# Native drivers
1292#
1293# CONFIG_SENSORS_AD7414 is not set
1294# CONFIG_SENSORS_AD7418 is not set
1295# CONFIG_SENSORS_ADM1021 is not set
1296# CONFIG_SENSORS_ADM1025 is not set
1297# CONFIG_SENSORS_ADM1026 is not set
1298# CONFIG_SENSORS_ADM1029 is not set
1299# CONFIG_SENSORS_ADM1031 is not set
1300# CONFIG_SENSORS_ADM9240 is not set
1301# CONFIG_SENSORS_ADT7411 is not set
1302# CONFIG_SENSORS_ADT7462 is not set
1303# CONFIG_SENSORS_ADT7470 is not set
1304# CONFIG_SENSORS_ADT7475 is not set
1305# CONFIG_SENSORS_ASC7621 is not set
1306# CONFIG_SENSORS_ATXP1 is not set
1307# CONFIG_SENSORS_DS1621 is not set
1308# CONFIG_SENSORS_I5K_AMB is not set
1309# CONFIG_SENSORS_F71805F is not set
1310# CONFIG_SENSORS_F71882FG is not set
1311# CONFIG_SENSORS_F75375S is not set
1312# CONFIG_SENSORS_G760A is not set
1313# CONFIG_SENSORS_GL518SM is not set
1314# CONFIG_SENSORS_GL520SM is not set
1315# CONFIG_SENSORS_IT87 is not set
1316# CONFIG_SENSORS_LM63 is not set
1317# CONFIG_SENSORS_LM73 is not set
1318# CONFIG_SENSORS_LM75 is not set
1319# CONFIG_SENSORS_LM77 is not set
1320# CONFIG_SENSORS_LM78 is not set
1321# CONFIG_SENSORS_LM80 is not set
1322CONFIG_SENSORS_LM83=y
1323# CONFIG_SENSORS_LM85 is not set
1324# CONFIG_SENSORS_LM87 is not set
1325# CONFIG_SENSORS_LM90 is not set
1326# CONFIG_SENSORS_LM92 is not set
1327# CONFIG_SENSORS_LM93 is not set
1328# CONFIG_SENSORS_LTC4215 is not set
1329# CONFIG_SENSORS_LTC4245 is not set
1330# CONFIG_SENSORS_LM95241 is not set
1331# CONFIG_SENSORS_MAX1619 is not set
1332# CONFIG_SENSORS_MAX6650 is not set
1333# CONFIG_SENSORS_PC87360 is not set
1334# CONFIG_SENSORS_PC87427 is not set
1335# CONFIG_SENSORS_PCF8591 is not set
1336# CONFIG_SENSORS_SHT15 is not set
1337# CONFIG_SENSORS_SIS5595 is not set
1338# CONFIG_SENSORS_DME1737 is not set
1339# CONFIG_SENSORS_EMC1403 is not set
1340# CONFIG_SENSORS_SMSC47M1 is not set
1341# CONFIG_SENSORS_SMSC47M192 is not set
1342# CONFIG_SENSORS_SMSC47B397 is not set
1343# CONFIG_SENSORS_ADS7828 is not set
1344# CONFIG_SENSORS_AMC6821 is not set
1345# CONFIG_SENSORS_THMC50 is not set
1346# CONFIG_SENSORS_TMP102 is not set
1347# CONFIG_SENSORS_TMP401 is not set
1348# CONFIG_SENSORS_TMP421 is not set
1349# CONFIG_SENSORS_VIA686A is not set
1350# CONFIG_SENSORS_VT1211 is not set
1351# CONFIG_SENSORS_VT8231 is not set
1352# CONFIG_SENSORS_W83781D is not set
1353# CONFIG_SENSORS_W83791D is not set
1354# CONFIG_SENSORS_W83792D is not set
1355# CONFIG_SENSORS_W83793 is not set
1356# CONFIG_SENSORS_W83L785TS is not set
1357# CONFIG_SENSORS_W83L786NG is not set
1358# CONFIG_SENSORS_W83627HF is not set
1359# CONFIG_SENSORS_W83627EHF is not set
1360# CONFIG_SENSORS_LIS3_I2C is not set
1361# CONFIG_THERMAL is not set
1362CONFIG_WATCHDOG=y
1363CONFIG_WATCHDOG_NOWAYOUT=y
1364
1365#
1366# Watchdog Device Drivers
1367#
1368# CONFIG_SOFT_WATCHDOG is not set
1369# CONFIG_ALIM7101_WDT is not set
1370
1371#
1372# PCI-based Watchdog Cards
1373#
1374# CONFIG_PCIPCWATCHDOG is not set
1375# CONFIG_WDTPCI is not set
1376
1377#
1378# USB-based Watchdog Cards
1379#
1380# CONFIG_USBPCWATCHDOG is not set
1381CONFIG_SSB_POSSIBLE=y
1382
1383#
1384# Sonics Silicon Backplane
1385#
1386CONFIG_SSB=m
1387CONFIG_SSB_SPROM=y
1388CONFIG_SSB_PCIHOST_POSSIBLE=y
1389CONFIG_SSB_PCIHOST=y
1390# CONFIG_SSB_B43_PCI_BRIDGE is not set
1391# CONFIG_SSB_SILENT is not set
1392# CONFIG_SSB_DEBUG is not set
1393CONFIG_SSB_DRIVER_PCICORE_POSSIBLE=y
1394CONFIG_SSB_DRIVER_PCICORE=y
1395# CONFIG_SSB_DRIVER_MIPS is not set
1396CONFIG_MFD_SUPPORT=y
1397# CONFIG_MFD_CORE is not set
1398# CONFIG_MFD_88PM860X is not set
1399# CONFIG_MFD_SM501 is not set
1400# CONFIG_HTC_PASIC3 is not set
1401# CONFIG_HTC_I2CPLD is not set
1402# CONFIG_TPS65010 is not set
1403# CONFIG_TPS6507X is not set
1404# CONFIG_TWL4030_CORE is not set
1405# CONFIG_MFD_TC35892 is not set
1406# CONFIG_MFD_TMIO is not set
1407# CONFIG_PMIC_DA903X is not set
1408# CONFIG_PMIC_ADP5520 is not set
1409# CONFIG_MFD_MAX8925 is not set
1410# CONFIG_MFD_WM8400 is not set
1411# CONFIG_MFD_WM831X is not set
1412# CONFIG_MFD_WM8350_I2C is not set
1413# CONFIG_MFD_WM8994 is not set
1414# CONFIG_MFD_PCF50633 is not set
1415# CONFIG_ABX500_CORE is not set
1416# CONFIG_MFD_TIMBERDALE is not set
1417# CONFIG_LPC_SCH is not set
1418# CONFIG_MFD_RDC321X is not set
1419# CONFIG_MFD_JANZ_CMODIO is not set
1420# CONFIG_REGULATOR is not set
1421# CONFIG_MEDIA_SUPPORT is not set
1422
1423#
1424# Graphics support
1425#
1426# CONFIG_VGA_ARB is not set
1427# CONFIG_DRM is not set
1428# CONFIG_VGASTATE is not set
1429# CONFIG_VIDEO_OUTPUT_CONTROL is not set
1430# CONFIG_FB is not set
1431CONFIG_BACKLIGHT_LCD_SUPPORT=y
1432# CONFIG_LCD_CLASS_DEVICE is not set
1433CONFIG_BACKLIGHT_CLASS_DEVICE=y
1434# CONFIG_BACKLIGHT_GENERIC is not set
1435# CONFIG_BACKLIGHT_ADP8860 is not set
1436
1437#
1438# Display device support
1439#
1440# CONFIG_DISPLAY_SUPPORT is not set
1441
1442#
1443# Console display driver support
1444#
1445# CONFIG_VGA_CONSOLE is not set
1446CONFIG_DUMMY_CONSOLE=y
1447# CONFIG_SOUND is not set
1448CONFIG_HID_SUPPORT=y
1449CONFIG_HID=y
1450# CONFIG_HIDRAW is not set
1451
1452#
1453# USB Input Devices
1454#
1455CONFIG_USB_HID=m
1456# CONFIG_HID_PID is not set
1457CONFIG_USB_HIDDEV=y
1458
1459#
1460# USB HID Boot Protocol drivers
1461#
1462CONFIG_USB_KBD=m
1463CONFIG_USB_MOUSE=m
1464
1465#
1466# Special HID drivers
1467#
1468# CONFIG_HID_3M_PCT is not set
1469# CONFIG_HID_A4TECH is not set
1470# CONFIG_HID_APPLE is not set
1471# CONFIG_HID_BELKIN is not set
1472# CONFIG_HID_CANDO is not set
1473# CONFIG_HID_CHERRY is not set
1474# CONFIG_HID_CHICONY is not set
1475# CONFIG_HID_CYPRESS is not set
1476# CONFIG_HID_DRAGONRISE is not set
1477# CONFIG_HID_EGALAX is not set
1478# CONFIG_HID_EZKEY is not set
1479# CONFIG_HID_KYE is not set
1480# CONFIG_HID_GYRATION is not set
1481# CONFIG_HID_TWINHAN is not set
1482# CONFIG_HID_KENSINGTON is not set
1483# CONFIG_HID_LOGITECH is not set
1484# CONFIG_HID_MICROSOFT is not set
1485# CONFIG_HID_MOSART is not set
1486# CONFIG_HID_MONTEREY is not set
1487# CONFIG_HID_NTRIG is not set
1488# CONFIG_HID_ORTEK is not set
1489# CONFIG_HID_PANTHERLORD is not set
1490# CONFIG_HID_PETALYNX is not set
1491# CONFIG_HID_PICOLCD is not set
1492# CONFIG_HID_QUANTA is not set
1493# CONFIG_HID_ROCCAT is not set
1494# CONFIG_HID_ROCCAT_KONE is not set
1495# CONFIG_HID_SAMSUNG is not set
1496# CONFIG_HID_SONY is not set
1497# CONFIG_HID_STANTUM is not set
1498# CONFIG_HID_SUNPLUS is not set
1499# CONFIG_HID_GREENASIA is not set
1500# CONFIG_HID_SMARTJOYPLUS is not set
1501# CONFIG_HID_TOPSEED is not set
1502# CONFIG_HID_THRUSTMASTER is not set
1503# CONFIG_HID_ZEROPLUS is not set
1504# CONFIG_HID_ZYDACRON is not set
1505CONFIG_USB_SUPPORT=y
1506CONFIG_USB_ARCH_HAS_HCD=y
1507CONFIG_USB_ARCH_HAS_OHCI=y
1508CONFIG_USB_ARCH_HAS_EHCI=y
1509CONFIG_USB=y
1510# CONFIG_USB_DEBUG is not set
1511# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set
1512
1513#
1514# Miscellaneous USB options
1515#
1516# CONFIG_USB_DEVICEFS is not set
1517# CONFIG_USB_DEVICE_CLASS is not set
1518# CONFIG_USB_DYNAMIC_MINORS is not set
1519# CONFIG_USB_OTG_WHITELIST is not set
1520# CONFIG_USB_OTG_BLACKLIST_HUB is not set
1521CONFIG_USB_MON=y
1522# CONFIG_USB_WUSB is not set
1523# CONFIG_USB_WUSB_CBAF is not set
1524
1525#
1526# USB Host Controller Drivers
1527#
1528# CONFIG_USB_C67X00_HCD is not set
1529# CONFIG_USB_XHCI_HCD is not set
1530CONFIG_USB_EHCI_HCD=y
1531CONFIG_USB_EHCI_ROOT_HUB_TT=y
1532CONFIG_USB_EHCI_TT_NEWSCHED=y
1533# CONFIG_USB_OXU210HP_HCD is not set
1534# CONFIG_USB_ISP116X_HCD is not set
1535# CONFIG_USB_ISP1760_HCD is not set
1536# CONFIG_USB_ISP1362_HCD is not set
1537CONFIG_USB_OHCI_HCD=y
1538# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1539# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
1540CONFIG_USB_OHCI_LITTLE_ENDIAN=y
1541# CONFIG_USB_UHCI_HCD is not set
1542# CONFIG_USB_SL811_HCD is not set
1543# CONFIG_USB_R8A66597_HCD is not set
1544# CONFIG_USB_WHCI_HCD is not set
1545# CONFIG_USB_HWA_HCD is not set
1546
1547#
1548# USB Device Class drivers
1549#
1550# CONFIG_USB_ACM is not set
1551# CONFIG_USB_PRINTER is not set
1552# CONFIG_USB_WDM is not set
1553# CONFIG_USB_TMC is not set
1554
1555#
1556# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
1557#
1558
1559#
1560# also be needed; see USB_STORAGE Help for more info
1561#
1562CONFIG_USB_STORAGE=m
1563# CONFIG_USB_STORAGE_DEBUG is not set
1564# CONFIG_USB_STORAGE_DATAFAB is not set
1565# CONFIG_USB_STORAGE_FREECOM is not set
1566# CONFIG_USB_STORAGE_ISD200 is not set
1567# CONFIG_USB_STORAGE_USBAT is not set
1568# CONFIG_USB_STORAGE_SDDR09 is not set
1569# CONFIG_USB_STORAGE_SDDR55 is not set
1570# CONFIG_USB_STORAGE_JUMPSHOT is not set
1571# CONFIG_USB_STORAGE_ALAUDA is not set
1572# CONFIG_USB_STORAGE_ONETOUCH is not set
1573# CONFIG_USB_STORAGE_KARMA is not set
1574# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
1575CONFIG_USB_LIBUSUAL=y
1576
1577#
1578# USB Imaging devices
1579#
1580# CONFIG_USB_MDC800 is not set
1581# CONFIG_USB_MICROTEK is not set
1582
1583#
1584# USB port drivers
1585#
1586CONFIG_USB_SERIAL=y
1587# CONFIG_USB_SERIAL_CONSOLE is not set
1588CONFIG_USB_EZUSB=y
1589CONFIG_USB_SERIAL_GENERIC=y
1590# CONFIG_USB_SERIAL_AIRCABLE is not set
1591# CONFIG_USB_SERIAL_ARK3116 is not set
1592# CONFIG_USB_SERIAL_BELKIN is not set
1593# CONFIG_USB_SERIAL_CH341 is not set
1594# CONFIG_USB_SERIAL_WHITEHEAT is not set
1595# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
1596# CONFIG_USB_SERIAL_CP210X is not set
1597# CONFIG_USB_SERIAL_CYPRESS_M8 is not set
1598# CONFIG_USB_SERIAL_EMPEG is not set
1599# CONFIG_USB_SERIAL_FTDI_SIO is not set
1600# CONFIG_USB_SERIAL_FUNSOFT is not set
1601# CONFIG_USB_SERIAL_VISOR is not set
1602# CONFIG_USB_SERIAL_IPAQ is not set
1603# CONFIG_USB_SERIAL_IR is not set
1604# CONFIG_USB_SERIAL_EDGEPORT is not set
1605# CONFIG_USB_SERIAL_EDGEPORT_TI is not set
1606# CONFIG_USB_SERIAL_GARMIN is not set
1607# CONFIG_USB_SERIAL_IPW is not set
1608# CONFIG_USB_SERIAL_IUU is not set
1609# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set
1610# CONFIG_USB_SERIAL_KEYSPAN is not set
1611# CONFIG_USB_SERIAL_KLSI is not set
1612# CONFIG_USB_SERIAL_KOBIL_SCT is not set
1613# CONFIG_USB_SERIAL_MCT_U232 is not set
1614# CONFIG_USB_SERIAL_MOS7720 is not set
1615# CONFIG_USB_SERIAL_MOS7840 is not set
1616# CONFIG_USB_SERIAL_MOTOROLA is not set
1617# CONFIG_USB_SERIAL_NAVMAN is not set
1618# CONFIG_USB_SERIAL_PL2303 is not set
1619# CONFIG_USB_SERIAL_OTI6858 is not set
1620# CONFIG_USB_SERIAL_QCAUX is not set
1621# CONFIG_USB_SERIAL_QUALCOMM is not set
1622# CONFIG_USB_SERIAL_SPCP8X5 is not set
1623# CONFIG_USB_SERIAL_HP4X is not set
1624# CONFIG_USB_SERIAL_SAFE is not set
1625# CONFIG_USB_SERIAL_SIEMENS_MPI is not set
1626CONFIG_USB_SERIAL_SIERRAWIRELESS=y
1627# CONFIG_USB_SERIAL_SYMBOL is not set
1628# CONFIG_USB_SERIAL_TI is not set
1629# CONFIG_USB_SERIAL_CYBERJACK is not set
1630# CONFIG_USB_SERIAL_XIRCOM is not set
1631# CONFIG_USB_SERIAL_OPTION is not set
1632# CONFIG_USB_SERIAL_OMNINET is not set
1633# CONFIG_USB_SERIAL_OPTICON is not set
1634# CONFIG_USB_SERIAL_VIVOPAY_SERIAL is not set
1635# CONFIG_USB_SERIAL_ZIO is not set
1636# CONFIG_USB_SERIAL_DEBUG is not set
1637
1638#
1639# USB Miscellaneous drivers
1640#
1641# CONFIG_USB_EMI62 is not set
1642# CONFIG_USB_EMI26 is not set
1643# CONFIG_USB_ADUTUX is not set
1644# CONFIG_USB_SEVSEG is not set
1645# CONFIG_USB_RIO500 is not set
1646# CONFIG_USB_LEGOTOWER is not set
1647# CONFIG_USB_LCD is not set
1648# CONFIG_USB_LED is not set
1649# CONFIG_USB_CYPRESS_CY7C63 is not set
1650# CONFIG_USB_CYTHERM is not set
1651# CONFIG_USB_IDMOUSE is not set
1652# CONFIG_USB_FTDI_ELAN is not set
1653# CONFIG_USB_APPLEDISPLAY is not set
1654# CONFIG_USB_SISUSBVGA is not set
1655# CONFIG_USB_LD is not set
1656# CONFIG_USB_TRANCEVIBRATOR is not set
1657# CONFIG_USB_IOWARRIOR is not set
1658# CONFIG_USB_TEST is not set
1659# CONFIG_USB_ISIGHTFW is not set
1660# CONFIG_USB_ATM is not set
1661# CONFIG_USB_GADGET is not set
1662
1663#
1664# OTG and related infrastructure
1665#
1666# CONFIG_USB_GPIO_VBUS is not set
1667# CONFIG_NOP_USB_XCEIV is not set
1668# CONFIG_UWB is not set
1669# CONFIG_MMC is not set
1670# CONFIG_MEMSTICK is not set
1671CONFIG_NEW_LEDS=y
1672CONFIG_LEDS_CLASS=y
1673
1674#
1675# LED drivers
1676#
1677# CONFIG_LEDS_PCA9532 is not set
1678CONFIG_LEDS_GPIO=y
1679CONFIG_LEDS_GPIO_PLATFORM=y
1680# CONFIG_LEDS_LP3944 is not set
1681# CONFIG_LEDS_PCA955X is not set
1682# CONFIG_LEDS_BD2802 is not set
1683# CONFIG_LEDS_LT3593 is not set
1684CONFIG_LEDS_TRIGGERS=y
1685
1686#
1687# LED Triggers
1688#
1689CONFIG_LEDS_TRIGGER_TIMER=y
1690CONFIG_LEDS_TRIGGER_HEARTBEAT=y
1691# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
1692# CONFIG_LEDS_TRIGGER_GPIO is not set
1693CONFIG_LEDS_TRIGGER_DEFAULT_ON=y
1694
1695#
1696# iptables trigger is under Netfilter config (LED target)
1697#
1698# CONFIG_ACCESSIBILITY is not set
1699# CONFIG_INFINIBAND is not set
1700CONFIG_RTC_LIB=y
1701# CONFIG_RTC_CLASS is not set
1702# CONFIG_DMADEVICES is not set
1703# CONFIG_AUXDISPLAY is not set
1704# CONFIG_UIO is not set
1705# CONFIG_STAGING is not set
1706
1707#
1708# File systems
1709#
1710# CONFIG_EXT2_FS is not set
1711# CONFIG_EXT3_FS is not set
1712# CONFIG_EXT4_FS is not set
1713# CONFIG_REISERFS_FS is not set
1714# CONFIG_JFS_FS is not set
1715# CONFIG_FS_POSIX_ACL is not set
1716# CONFIG_XFS_FS is not set
1717# CONFIG_GFS2_FS is not set
1718# CONFIG_OCFS2_FS is not set
1719# CONFIG_BTRFS_FS is not set
1720# CONFIG_NILFS2_FS is not set
1721CONFIG_FILE_LOCKING=y
1722# CONFIG_FSNOTIFY is not set
1723# CONFIG_DNOTIFY is not set
1724# CONFIG_INOTIFY is not set
1725# CONFIG_INOTIFY_USER is not set
1726# CONFIG_QUOTA is not set
1727# CONFIG_AUTOFS_FS is not set
1728# CONFIG_AUTOFS4_FS is not set
1729# CONFIG_FUSE_FS is not set
1730
1731#
1732# Caches
1733#
1734# CONFIG_FSCACHE is not set
1735
1736#
1737# CD-ROM/DVD Filesystems
1738#
1739CONFIG_ISO9660_FS=m
1740CONFIG_JOLIET=y
1741CONFIG_ZISOFS=y
1742CONFIG_UDF_FS=m
1743CONFIG_UDF_NLS=y
1744
1745#
1746# DOS/FAT/NT Filesystems
1747#
1748CONFIG_FAT_FS=m
1749CONFIG_MSDOS_FS=m
1750CONFIG_VFAT_FS=m
1751CONFIG_FAT_DEFAULT_CODEPAGE=437
1752CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
1753# CONFIG_NTFS_FS is not set
1754
1755#
1756# Pseudo filesystems
1757#
1758CONFIG_PROC_FS=y
1759CONFIG_PROC_KCORE=y
1760CONFIG_PROC_SYSCTL=y
1761CONFIG_PROC_PAGE_MONITOR=y
1762CONFIG_SYSFS=y
1763CONFIG_TMPFS=y
1764# CONFIG_TMPFS_POSIX_ACL is not set
1765# CONFIG_HUGETLB_PAGE is not set
1766# CONFIG_CONFIGFS_FS is not set
1767CONFIG_MISC_FILESYSTEMS=y
1768# CONFIG_ADFS_FS is not set
1769# CONFIG_AFFS_FS is not set
1770# CONFIG_ECRYPT_FS is not set
1771# CONFIG_HFS_FS is not set
1772# CONFIG_HFSPLUS_FS is not set
1773# CONFIG_BEFS_FS is not set
1774# CONFIG_BFS_FS is not set
1775# CONFIG_EFS_FS is not set
1776CONFIG_JFFS2_FS=y
1777CONFIG_JFFS2_FS_DEBUG=0
1778CONFIG_JFFS2_FS_WRITEBUFFER=y
1779# CONFIG_JFFS2_FS_WBUF_VERIFY is not set
1780# CONFIG_JFFS2_SUMMARY is not set
1781# CONFIG_JFFS2_FS_XATTR is not set
1782CONFIG_JFFS2_COMPRESSION_OPTIONS=y
1783CONFIG_JFFS2_ZLIB=y
1784# CONFIG_JFFS2_LZO is not set
1785CONFIG_JFFS2_RTIME=y
1786CONFIG_JFFS2_RUBIN=y
1787# CONFIG_JFFS2_CMODE_NONE is not set
1788CONFIG_JFFS2_CMODE_PRIORITY=y
1789# CONFIG_JFFS2_CMODE_SIZE is not set
1790# CONFIG_JFFS2_CMODE_FAVOURLZO is not set
1791# CONFIG_LOGFS is not set
1792# CONFIG_CRAMFS is not set
1793# CONFIG_SQUASHFS is not set
1794# CONFIG_VXFS_FS is not set
1795# CONFIG_MINIX_FS is not set
1796# CONFIG_OMFS_FS is not set
1797# CONFIG_HPFS_FS is not set
1798# CONFIG_QNX4FS_FS is not set
1799# CONFIG_ROMFS_FS is not set
1800# CONFIG_SYSV_FS is not set
1801# CONFIG_UFS_FS is not set
1802CONFIG_NETWORK_FILESYSTEMS=y
1803CONFIG_NFS_FS=y
1804CONFIG_NFS_V3=y
1805# CONFIG_NFS_V3_ACL is not set
1806CONFIG_NFS_V4=y
1807# CONFIG_NFS_V4_1 is not set
1808CONFIG_ROOT_NFS=y
1809# CONFIG_NFSD is not set
1810CONFIG_LOCKD=y
1811CONFIG_LOCKD_V4=y
1812CONFIG_NFS_COMMON=y
1813CONFIG_SUNRPC=y
1814CONFIG_SUNRPC_GSS=y
1815CONFIG_RPCSEC_GSS_KRB5=y
1816# CONFIG_RPCSEC_GSS_SPKM3 is not set
1817# CONFIG_SMB_FS is not set
1818# CONFIG_CEPH_FS is not set
1819# CONFIG_CIFS is not set
1820# CONFIG_NCP_FS is not set
1821# CONFIG_CODA_FS is not set
1822# CONFIG_AFS_FS is not set
1823
1824#
1825# Partition Types
1826#
1827CONFIG_PARTITION_ADVANCED=y
1828# CONFIG_ACORN_PARTITION is not set
1829# CONFIG_OSF_PARTITION is not set
1830# CONFIG_AMIGA_PARTITION is not set
1831# CONFIG_ATARI_PARTITION is not set
1832# CONFIG_MAC_PARTITION is not set
1833CONFIG_MSDOS_PARTITION=y
1834# CONFIG_BSD_DISKLABEL is not set
1835# CONFIG_MINIX_SUBPARTITION is not set
1836# CONFIG_SOLARIS_X86_PARTITION is not set
1837# CONFIG_UNIXWARE_DISKLABEL is not set
1838# CONFIG_LDM_PARTITION is not set
1839# CONFIG_SGI_PARTITION is not set
1840# CONFIG_ULTRIX_PARTITION is not set
1841# CONFIG_SUN_PARTITION is not set
1842# CONFIG_KARMA_PARTITION is not set
1843# CONFIG_EFI_PARTITION is not set
1844# CONFIG_SYSV68_PARTITION is not set
1845CONFIG_NLS=y
1846CONFIG_NLS_DEFAULT="iso8859-1"
1847CONFIG_NLS_CODEPAGE_437=y
1848# CONFIG_NLS_CODEPAGE_737 is not set
1849# CONFIG_NLS_CODEPAGE_775 is not set
1850CONFIG_NLS_CODEPAGE_850=y
1851# CONFIG_NLS_CODEPAGE_852 is not set
1852# CONFIG_NLS_CODEPAGE_855 is not set
1853# CONFIG_NLS_CODEPAGE_857 is not set
1854# CONFIG_NLS_CODEPAGE_860 is not set
1855# CONFIG_NLS_CODEPAGE_861 is not set
1856# CONFIG_NLS_CODEPAGE_862 is not set
1857# CONFIG_NLS_CODEPAGE_863 is not set
1858# CONFIG_NLS_CODEPAGE_864 is not set
1859# CONFIG_NLS_CODEPAGE_865 is not set
1860# CONFIG_NLS_CODEPAGE_866 is not set
1861# CONFIG_NLS_CODEPAGE_869 is not set
1862# CONFIG_NLS_CODEPAGE_936 is not set
1863# CONFIG_NLS_CODEPAGE_950 is not set
1864# CONFIG_NLS_CODEPAGE_932 is not set
1865# CONFIG_NLS_CODEPAGE_949 is not set
1866# CONFIG_NLS_CODEPAGE_874 is not set
1867# CONFIG_NLS_ISO8859_8 is not set
1868# CONFIG_NLS_CODEPAGE_1250 is not set
1869# CONFIG_NLS_CODEPAGE_1251 is not set
1870# CONFIG_NLS_ASCII is not set
1871CONFIG_NLS_ISO8859_1=y
1872# CONFIG_NLS_ISO8859_2 is not set
1873# CONFIG_NLS_ISO8859_3 is not set
1874# CONFIG_NLS_ISO8859_4 is not set
1875# CONFIG_NLS_ISO8859_5 is not set
1876# CONFIG_NLS_ISO8859_6 is not set
1877# CONFIG_NLS_ISO8859_7 is not set
1878# CONFIG_NLS_ISO8859_9 is not set
1879# CONFIG_NLS_ISO8859_13 is not set
1880# CONFIG_NLS_ISO8859_14 is not set
1881# CONFIG_NLS_ISO8859_15 is not set
1882# CONFIG_NLS_KOI8_R is not set
1883# CONFIG_NLS_KOI8_U is not set
1884# CONFIG_NLS_UTF8 is not set
1885# CONFIG_DLM is not set
1886
1887#
1888# Kernel hacking
1889#
1890CONFIG_TRACE_IRQFLAGS_SUPPORT=y
1891# CONFIG_PRINTK_TIME is not set
1892CONFIG_ENABLE_WARN_DEPRECATED=y
1893# CONFIG_ENABLE_MUST_CHECK is not set
1894CONFIG_FRAME_WARN=1024
1895CONFIG_MAGIC_SYSRQ=y
1896# CONFIG_STRIP_ASM_SYMS is not set
1897# CONFIG_UNUSED_SYMBOLS is not set
1898CONFIG_DEBUG_FS=y
1899# CONFIG_HEADERS_CHECK is not set
1900# CONFIG_DEBUG_KERNEL is not set
1901# CONFIG_DEBUG_MEMORY_INIT is not set
1902CONFIG_RCU_CPU_STALL_DETECTOR=y
1903# CONFIG_LKDTM is not set
1904# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1905CONFIG_HAVE_FUNCTION_TRACER=y
1906CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
1907CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
1908CONFIG_HAVE_DYNAMIC_FTRACE=y
1909CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
1910CONFIG_TRACING_SUPPORT=y
1911# CONFIG_FTRACE is not set
1912# CONFIG_DYNAMIC_DEBUG is not set
1913# CONFIG_ATOMIC64_SELFTEST is not set
1914# CONFIG_SAMPLES is not set
1915CONFIG_HAVE_ARCH_KGDB=y
1916CONFIG_EARLY_PRINTK=y
1917CONFIG_CMDLINE_BOOL=y
1918CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs rw ip=auto"
1919# CONFIG_CMDLINE_OVERRIDE is not set
1920# CONFIG_SPINLOCK_TEST is not set
1921
1922#
1923# Security options
1924#
1925CONFIG_KEYS=y
1926# CONFIG_KEYS_DEBUG_PROC_KEYS is not set
1927# CONFIG_SECURITY is not set
1928# CONFIG_SECURITYFS is not set
1929# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1930# CONFIG_DEFAULT_SECURITY_SMACK is not set
1931# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1932CONFIG_DEFAULT_SECURITY_DAC=y
1933CONFIG_DEFAULT_SECURITY=""
1934CONFIG_CRYPTO=y
1935
1936#
1937# Crypto core or helper
1938#
1939# CONFIG_CRYPTO_FIPS is not set
1940CONFIG_CRYPTO_ALGAPI=y
1941CONFIG_CRYPTO_ALGAPI2=y
1942CONFIG_CRYPTO_AEAD=m
1943CONFIG_CRYPTO_AEAD2=y
1944CONFIG_CRYPTO_BLKCIPHER=y
1945CONFIG_CRYPTO_BLKCIPHER2=y
1946CONFIG_CRYPTO_HASH=y
1947CONFIG_CRYPTO_HASH2=y
1948CONFIG_CRYPTO_RNG=m
1949CONFIG_CRYPTO_RNG2=y
1950CONFIG_CRYPTO_PCOMP=y
1951CONFIG_CRYPTO_MANAGER=y
1952CONFIG_CRYPTO_MANAGER2=y
1953# CONFIG_CRYPTO_GF128MUL is not set
1954CONFIG_CRYPTO_NULL=m
1955CONFIG_CRYPTO_WORKQUEUE=y
1956# CONFIG_CRYPTO_CRYPTD is not set
1957CONFIG_CRYPTO_AUTHENC=m
1958CONFIG_CRYPTO_TEST=m
1959
1960#
1961# Authenticated Encryption with Associated Data
1962#
1963# CONFIG_CRYPTO_CCM is not set
1964# CONFIG_CRYPTO_GCM is not set
1965# CONFIG_CRYPTO_SEQIV is not set
1966
1967#
1968# Block modes
1969#
1970CONFIG_CRYPTO_CBC=y
1971# CONFIG_CRYPTO_CTR is not set
1972# CONFIG_CRYPTO_CTS is not set
1973CONFIG_CRYPTO_ECB=y
1974# CONFIG_CRYPTO_LRW is not set
1975CONFIG_CRYPTO_PCBC=m
1976# CONFIG_CRYPTO_XTS is not set
1977
1978#
1979# Hash modes
1980#
1981CONFIG_CRYPTO_HMAC=y
1982# CONFIG_CRYPTO_XCBC is not set
1983# CONFIG_CRYPTO_VMAC is not set
1984
1985#
1986# Digest
1987#
1988CONFIG_CRYPTO_CRC32C=m
1989# CONFIG_CRYPTO_GHASH is not set
1990CONFIG_CRYPTO_MD4=m
1991CONFIG_CRYPTO_MD5=y
1992CONFIG_CRYPTO_MICHAEL_MIC=m
1993# CONFIG_CRYPTO_RMD128 is not set
1994# CONFIG_CRYPTO_RMD160 is not set
1995# CONFIG_CRYPTO_RMD256 is not set
1996# CONFIG_CRYPTO_RMD320 is not set
1997CONFIG_CRYPTO_SHA1=m
1998CONFIG_CRYPTO_SHA256=m
1999CONFIG_CRYPTO_SHA512=m
2000CONFIG_CRYPTO_TGR192=m
2001CONFIG_CRYPTO_WP512=m
2002
2003#
2004# Ciphers
2005#
2006CONFIG_CRYPTO_AES=y
2007CONFIG_CRYPTO_ANUBIS=m
2008CONFIG_CRYPTO_ARC4=y
2009CONFIG_CRYPTO_BLOWFISH=m
2010# CONFIG_CRYPTO_CAMELLIA is not set
2011CONFIG_CRYPTO_CAST5=m
2012CONFIG_CRYPTO_CAST6=m
2013CONFIG_CRYPTO_DES=y
2014# CONFIG_CRYPTO_FCRYPT is not set
2015CONFIG_CRYPTO_KHAZAD=m
2016# CONFIG_CRYPTO_SALSA20 is not set
2017# CONFIG_CRYPTO_SEED is not set
2018CONFIG_CRYPTO_SERPENT=m
2019CONFIG_CRYPTO_TEA=m
2020CONFIG_CRYPTO_TWOFISH=m
2021CONFIG_CRYPTO_TWOFISH_COMMON=m
2022
2023#
2024# Compression
2025#
2026CONFIG_CRYPTO_DEFLATE=m
2027# CONFIG_CRYPTO_ZLIB is not set
2028# CONFIG_CRYPTO_LZO is not set
2029
2030#
2031# Random Number Generation
2032#
2033CONFIG_CRYPTO_ANSI_CPRNG=m
2034CONFIG_CRYPTO_HW=y
2035# CONFIG_CRYPTO_DEV_HIFN_795X is not set
2036# CONFIG_BINARY_PRINTF is not set
2037
2038#
2039# Library routines
2040#
2041CONFIG_BITREVERSE=y
2042CONFIG_GENERIC_FIND_LAST_BIT=y
2043CONFIG_CRC_CCITT=m
2044CONFIG_CRC16=m
2045# CONFIG_CRC_T10DIF is not set
2046CONFIG_CRC_ITU_T=m
2047CONFIG_CRC32=y
2048# CONFIG_CRC7 is not set
2049CONFIG_LIBCRC32C=m
2050CONFIG_ZLIB_INFLATE=y
2051CONFIG_ZLIB_DEFLATE=y
2052CONFIG_DECOMPRESS_GZIP=y
2053CONFIG_TEXTSEARCH=y
2054CONFIG_TEXTSEARCH_KMP=m
2055CONFIG_TEXTSEARCH_BM=m
2056CONFIG_TEXTSEARCH_FSM=m
2057CONFIG_HAS_IOMEM=y
2058CONFIG_HAS_IOPORT=y
2059CONFIG_HAS_DMA=y
2060CONFIG_NLATTR=y
diff --git a/arch/mips/configs/mtx1_defconfig b/arch/mips/configs/mtx1_defconfig
index cff8f4c0e57c..10d20aa731d3 100644
--- a/arch/mips/configs/mtx1_defconfig
+++ b/arch/mips/configs/mtx1_defconfig
@@ -8,7 +8,7 @@ CONFIG_MIPS=y
8# 8#
9# Machine selection 9# Machine selection
10# 10#
11CONFIG_MACH_ALCHEMY=y 11CONFIG_MIPS_ALCHEMY=y
12# CONFIG_AR7 is not set 12# CONFIG_AR7 is not set
13# CONFIG_BCM47XX is not set 13# CONFIG_BCM47XX is not set
14# CONFIG_BCM63XX is not set 14# CONFIG_BCM63XX is not set
@@ -64,7 +64,6 @@ CONFIG_MIPS_MTX1=y
64# CONFIG_MIPS_PB1550 is not set 64# CONFIG_MIPS_PB1550 is not set
65# CONFIG_MIPS_XXS1500 is not set 65# CONFIG_MIPS_XXS1500 is not set
66CONFIG_SOC_AU1500=y 66CONFIG_SOC_AU1500=y
67CONFIG_SOC_AU1X00=y
68CONFIG_LOONGSON_UART_BASE=y 67CONFIG_LOONGSON_UART_BASE=y
69CONFIG_RWSEM_GENERIC_SPINLOCK=y 68CONFIG_RWSEM_GENERIC_SPINLOCK=y
70# CONFIG_ARCH_HAS_ILOG2_U32 is not set 69# CONFIG_ARCH_HAS_ILOG2_U32 is not set
diff --git a/arch/mips/configs/pb1100_defconfig b/arch/mips/configs/pb1100_defconfig
index 97382b698b9b..778f726af8e0 100644
--- a/arch/mips/configs/pb1100_defconfig
+++ b/arch/mips/configs/pb1100_defconfig
@@ -8,7 +8,7 @@ CONFIG_MIPS=y
8# 8#
9# Machine selection 9# Machine selection
10# 10#
11CONFIG_MACH_ALCHEMY=y 11CONFIG_MIPS_ALCHEMY=y
12# CONFIG_AR7 is not set 12# CONFIG_AR7 is not set
13# CONFIG_BCM47XX is not set 13# CONFIG_BCM47XX is not set
14# CONFIG_BCM63XX is not set 14# CONFIG_BCM63XX is not set
@@ -64,7 +64,6 @@ CONFIG_MIPS_PB1100=y
64# CONFIG_MIPS_PB1550 is not set 64# CONFIG_MIPS_PB1550 is not set
65# CONFIG_MIPS_XXS1500 is not set 65# CONFIG_MIPS_XXS1500 is not set
66CONFIG_SOC_AU1100=y 66CONFIG_SOC_AU1100=y
67CONFIG_SOC_AU1X00=y
68CONFIG_LOONGSON_UART_BASE=y 67CONFIG_LOONGSON_UART_BASE=y
69CONFIG_RWSEM_GENERIC_SPINLOCK=y 68CONFIG_RWSEM_GENERIC_SPINLOCK=y
70# CONFIG_ARCH_HAS_ILOG2_U32 is not set 69# CONFIG_ARCH_HAS_ILOG2_U32 is not set
diff --git a/arch/mips/configs/pb1200_defconfig b/arch/mips/configs/pb1200_defconfig
index e9ad77320f16..0f908c692111 100644
--- a/arch/mips/configs/pb1200_defconfig
+++ b/arch/mips/configs/pb1200_defconfig
@@ -8,7 +8,7 @@ CONFIG_MIPS=y
8# 8#
9# Machine selection 9# Machine selection
10# 10#
11CONFIG_MACH_ALCHEMY=y 11CONFIG_MIPS_ALCHEMY=y
12# CONFIG_AR7 is not set 12# CONFIG_AR7 is not set
13# CONFIG_BCM47XX is not set 13# CONFIG_BCM47XX is not set
14# CONFIG_BCM63XX is not set 14# CONFIG_BCM63XX is not set
@@ -64,7 +64,6 @@ CONFIG_MIPS_PB1200=y
64# CONFIG_MIPS_PB1550 is not set 64# CONFIG_MIPS_PB1550 is not set
65# CONFIG_MIPS_XXS1500 is not set 65# CONFIG_MIPS_XXS1500 is not set
66CONFIG_SOC_AU1200=y 66CONFIG_SOC_AU1200=y
67CONFIG_SOC_AU1X00=y
68CONFIG_LOONGSON_UART_BASE=y 67CONFIG_LOONGSON_UART_BASE=y
69CONFIG_RWSEM_GENERIC_SPINLOCK=y 68CONFIG_RWSEM_GENERIC_SPINLOCK=y
70# CONFIG_ARCH_HAS_ILOG2_U32 is not set 69# CONFIG_ARCH_HAS_ILOG2_U32 is not set
diff --git a/arch/mips/configs/pb1500_defconfig b/arch/mips/configs/pb1500_defconfig
index 7497d3306b91..1c5fe6f06c0e 100644
--- a/arch/mips/configs/pb1500_defconfig
+++ b/arch/mips/configs/pb1500_defconfig
@@ -8,7 +8,7 @@ CONFIG_MIPS=y
8# 8#
9# Machine selection 9# Machine selection
10# 10#
11CONFIG_MACH_ALCHEMY=y 11CONFIG_MIPS_ALCHEMY=y
12# CONFIG_AR7 is not set 12# CONFIG_AR7 is not set
13# CONFIG_BCM47XX is not set 13# CONFIG_BCM47XX is not set
14# CONFIG_BCM63XX is not set 14# CONFIG_BCM63XX is not set
@@ -64,7 +64,6 @@ CONFIG_MIPS_PB1500=y
64# CONFIG_MIPS_PB1550 is not set 64# CONFIG_MIPS_PB1550 is not set
65# CONFIG_MIPS_XXS1500 is not set 65# CONFIG_MIPS_XXS1500 is not set
66CONFIG_SOC_AU1500=y 66CONFIG_SOC_AU1500=y
67CONFIG_SOC_AU1X00=y
68CONFIG_LOONGSON_UART_BASE=y 67CONFIG_LOONGSON_UART_BASE=y
69CONFIG_RWSEM_GENERIC_SPINLOCK=y 68CONFIG_RWSEM_GENERIC_SPINLOCK=y
70# CONFIG_ARCH_HAS_ILOG2_U32 is not set 69# CONFIG_ARCH_HAS_ILOG2_U32 is not set
diff --git a/arch/mips/configs/pb1550_defconfig b/arch/mips/configs/pb1550_defconfig
index aa526f53cb1b..49494b01138b 100644
--- a/arch/mips/configs/pb1550_defconfig
+++ b/arch/mips/configs/pb1550_defconfig
@@ -8,7 +8,7 @@ CONFIG_MIPS=y
8# 8#
9# Machine selection 9# Machine selection
10# 10#
11CONFIG_MACH_ALCHEMY=y 11CONFIG_MIPS_ALCHEMY=y
12# CONFIG_AR7 is not set 12# CONFIG_AR7 is not set
13# CONFIG_BCM47XX is not set 13# CONFIG_BCM47XX is not set
14# CONFIG_BCM63XX is not set 14# CONFIG_BCM63XX is not set
@@ -64,7 +64,6 @@ CONFIG_ALCHEMY_GPIOINT_AU1000=y
64CONFIG_MIPS_PB1550=y 64CONFIG_MIPS_PB1550=y
65# CONFIG_MIPS_XXS1500 is not set 65# CONFIG_MIPS_XXS1500 is not set
66CONFIG_SOC_AU1550=y 66CONFIG_SOC_AU1550=y
67CONFIG_SOC_AU1X00=y
68CONFIG_LOONGSON_UART_BASE=y 67CONFIG_LOONGSON_UART_BASE=y
69CONFIG_RWSEM_GENERIC_SPINLOCK=y 68CONFIG_RWSEM_GENERIC_SPINLOCK=y
70# CONFIG_ARCH_HAS_ILOG2_U32 is not set 69# CONFIG_ARCH_HAS_ILOG2_U32 is not set
diff --git a/arch/mips/configs/powertv_defconfig b/arch/mips/configs/powertv_defconfig
index 7291633d81cc..af0ab73bfce8 100644
--- a/arch/mips/configs/powertv_defconfig
+++ b/arch/mips/configs/powertv_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.31-rc5 3# Linux kernel version: 2.6.35-rc3
4# Fri Aug 28 14:49:33 2009 4# Thu Jul 1 11:03:28 2010
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -11,11 +11,12 @@ CONFIG_MIPS=y
11# CONFIG_MACH_ALCHEMY is not set 11# CONFIG_MACH_ALCHEMY is not set
12# CONFIG_AR7 is not set 12# CONFIG_AR7 is not set
13# CONFIG_BCM47XX is not set 13# CONFIG_BCM47XX is not set
14# CONFIG_BCM63XX is not set
14# CONFIG_MIPS_COBALT is not set 15# CONFIG_MIPS_COBALT is not set
15# CONFIG_MACH_DECSTATION is not set 16# CONFIG_MACH_DECSTATION is not set
16# CONFIG_MACH_JAZZ is not set 17# CONFIG_MACH_JAZZ is not set
17# CONFIG_LASAT is not set 18# CONFIG_LASAT is not set
18# CONFIG_LEMOTE_FULONG is not set 19# CONFIG_MACH_LOONGSON is not set
19# CONFIG_MIPS_MALTA is not set 20# CONFIG_MIPS_MALTA is not set
20# CONFIG_MIPS_SIM is not set 21# CONFIG_MIPS_SIM is not set
21# CONFIG_NEC_MARKEINS is not set 22# CONFIG_NEC_MARKEINS is not set
@@ -50,7 +51,6 @@ CONFIG_POWERTV=y
50# CONFIG_MIN_RUNTIME_RESOURCES is not set 51# CONFIG_MIN_RUNTIME_RESOURCES is not set
51# CONFIG_BOOTLOADER_DRIVER is not set 52# CONFIG_BOOTLOADER_DRIVER is not set
52CONFIG_BOOTLOADER_FAMILY="R2" 53CONFIG_BOOTLOADER_FAMILY="R2"
53CONFIG_CSRC_POWERTV=y
54CONFIG_RWSEM_GENERIC_SPINLOCK=y 54CONFIG_RWSEM_GENERIC_SPINLOCK=y
55# CONFIG_ARCH_HAS_ILOG2_U32 is not set 55# CONFIG_ARCH_HAS_ILOG2_U32 is not set
56# CONFIG_ARCH_HAS_ILOG2_U64 is not set 56# CONFIG_ARCH_HAS_ILOG2_U64 is not set
@@ -65,9 +65,9 @@ CONFIG_SCHED_OMIT_FRAME_POINTER=y
65CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y 65CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
66CONFIG_CEVT_R4K_LIB=y 66CONFIG_CEVT_R4K_LIB=y
67CONFIG_CEVT_R4K=y 67CONFIG_CEVT_R4K=y
68CONFIG_CSRC_POWERTV=y
68CONFIG_DMA_NONCOHERENT=y 69CONFIG_DMA_NONCOHERENT=y
69CONFIG_DMA_NEED_PCI_MAP_STATE=y 70CONFIG_NEED_DMA_MAP_STATE=y
70# CONFIG_EARLY_PRINTK is not set
71CONFIG_SYS_HAS_EARLY_PRINTK=y 71CONFIG_SYS_HAS_EARLY_PRINTK=y
72# CONFIG_NO_IOPORT is not set 72# CONFIG_NO_IOPORT is not set
73CONFIG_CPU_BIG_ENDIAN=y 73CONFIG_CPU_BIG_ENDIAN=y
@@ -79,7 +79,8 @@ CONFIG_MIPS_L1_CACHE_SHIFT=5
79# 79#
80# CPU selection 80# CPU selection
81# 81#
82# CONFIG_CPU_LOONGSON2 is not set 82# CONFIG_CPU_LOONGSON2E is not set
83# CONFIG_CPU_LOONGSON2F is not set
83# CONFIG_CPU_MIPS32_R1 is not set 84# CONFIG_CPU_MIPS32_R1 is not set
84CONFIG_CPU_MIPS32_R2=y 85CONFIG_CPU_MIPS32_R2=y
85# CONFIG_CPU_MIPS64_R1 is not set 86# CONFIG_CPU_MIPS64_R1 is not set
@@ -122,7 +123,7 @@ CONFIG_CPU_HAS_PREFETCH=y
122CONFIG_MIPS_MT_DISABLED=y 123CONFIG_MIPS_MT_DISABLED=y
123# CONFIG_MIPS_MT_SMP is not set 124# CONFIG_MIPS_MT_SMP is not set
124# CONFIG_MIPS_MT_SMTC is not set 125# CONFIG_MIPS_MT_SMTC is not set
125CONFIG_CPU_HAS_LLSC=y 126# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
126CONFIG_CPU_MIPSR2_IRQ_VI=y 127CONFIG_CPU_MIPSR2_IRQ_VI=y
127CONFIG_CPU_MIPSR2_IRQ_EI=y 128CONFIG_CPU_MIPSR2_IRQ_EI=y
128CONFIG_CPU_HAS_SYNC=y 129CONFIG_CPU_HAS_SYNC=y
@@ -144,8 +145,7 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
144# CONFIG_PHYS_ADDR_T_64BIT is not set 145# CONFIG_PHYS_ADDR_T_64BIT is not set
145CONFIG_ZONE_DMA_FLAG=0 146CONFIG_ZONE_DMA_FLAG=0
146CONFIG_VIRT_TO_BUS=y 147CONFIG_VIRT_TO_BUS=y
147CONFIG_HAVE_MLOCK=y 148# CONFIG_KSM is not set
148CONFIG_HAVE_MLOCKED_PAGE_BIT=y
149CONFIG_DEFAULT_MMAP_MIN_ADDR=4096 149CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
150CONFIG_TICK_ONESHOT=y 150CONFIG_TICK_ONESHOT=y
151CONFIG_NO_HZ=y 151CONFIG_NO_HZ=y
@@ -177,6 +177,7 @@ CONFIG_EXPERIMENTAL=y
177CONFIG_BROKEN_ON_SMP=y 177CONFIG_BROKEN_ON_SMP=y
178CONFIG_LOCK_KERNEL=y 178CONFIG_LOCK_KERNEL=y
179CONFIG_INIT_ENV_ARG_LIMIT=32 179CONFIG_INIT_ENV_ARG_LIMIT=32
180CONFIG_CROSS_COMPILE="mips-linux-"
180CONFIG_LOCALVERSION="" 181CONFIG_LOCALVERSION=""
181CONFIG_LOCALVERSION_AUTO=y 182CONFIG_LOCALVERSION_AUTO=y
182# CONFIG_SWAP is not set 183# CONFIG_SWAP is not set
@@ -190,19 +191,15 @@ CONFIG_SYSVIPC_SYSCTL=y
190# 191#
191# RCU Subsystem 192# RCU Subsystem
192# 193#
193CONFIG_CLASSIC_RCU=y 194CONFIG_TREE_RCU=y
194# CONFIG_TREE_RCU is not set 195# CONFIG_TREE_PREEMPT_RCU is not set
195# CONFIG_PREEMPT_RCU is not set 196# CONFIG_TINY_RCU is not set
197# CONFIG_RCU_TRACE is not set
198CONFIG_RCU_FANOUT=32
199# CONFIG_RCU_FANOUT_EXACT is not set
196# CONFIG_TREE_RCU_TRACE is not set 200# CONFIG_TREE_RCU_TRACE is not set
197# CONFIG_PREEMPT_RCU_TRACE is not set
198# CONFIG_IKCONFIG is not set 201# CONFIG_IKCONFIG is not set
199CONFIG_LOG_BUF_SHIFT=16 202CONFIG_LOG_BUF_SHIFT=16
200CONFIG_GROUP_SCHED=y
201CONFIG_FAIR_GROUP_SCHED=y
202# CONFIG_RT_GROUP_SCHED is not set
203CONFIG_USER_SCHED=y
204# CONFIG_CGROUP_SCHED is not set
205# CONFIG_CGROUPS is not set
206# CONFIG_SYSFS_DEPRECATED_V2 is not set 203# CONFIG_SYSFS_DEPRECATED_V2 is not set
207CONFIG_RELAY=y 204CONFIG_RELAY=y
208# CONFIG_NAMESPACES is not set 205# CONFIG_NAMESPACES is not set
@@ -211,6 +208,7 @@ CONFIG_INITRAMFS_SOURCE=""
211# CONFIG_RD_GZIP is not set 208# CONFIG_RD_GZIP is not set
212# CONFIG_RD_BZIP2 is not set 209# CONFIG_RD_BZIP2 is not set
213# CONFIG_RD_LZMA is not set 210# CONFIG_RD_LZMA is not set
211# CONFIG_RD_LZO is not set
214# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 212# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
215CONFIG_SYSCTL=y 213CONFIG_SYSCTL=y
216CONFIG_ANON_INODES=y 214CONFIG_ANON_INODES=y
@@ -234,18 +232,16 @@ CONFIG_SHMEM=y
234CONFIG_AIO=y 232CONFIG_AIO=y
235 233
236# 234#
237# Performance Counters 235# Kernel Performance Events And Counters
238# 236#
239# CONFIG_VM_EVENT_COUNTERS is not set 237# CONFIG_VM_EVENT_COUNTERS is not set
240CONFIG_PCI_QUIRKS=y 238CONFIG_PCI_QUIRKS=y
241# CONFIG_SLUB_DEBUG is not set 239# CONFIG_SLUB_DEBUG is not set
242# CONFIG_STRIP_ASM_SYMS is not set
243CONFIG_COMPAT_BRK=y 240CONFIG_COMPAT_BRK=y
244# CONFIG_SLAB is not set 241# CONFIG_SLAB is not set
245CONFIG_SLUB=y 242CONFIG_SLUB=y
246# CONFIG_SLOB is not set 243# CONFIG_SLOB is not set
247# CONFIG_PROFILING is not set 244# CONFIG_PROFILING is not set
248# CONFIG_MARKERS is not set
249CONFIG_HAVE_OPROFILE=y 245CONFIG_HAVE_OPROFILE=y
250 246
251# 247#
@@ -253,7 +249,7 @@ CONFIG_HAVE_OPROFILE=y
253# 249#
254# CONFIG_GCOV_KERNEL is not set 250# CONFIG_GCOV_KERNEL is not set
255# CONFIG_SLOW_WORK is not set 251# CONFIG_SLOW_WORK is not set
256# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set 252CONFIG_HAVE_GENERIC_DMA_COHERENT=y
257CONFIG_RT_MUTEXES=y 253CONFIG_RT_MUTEXES=y
258CONFIG_BASE_SMALL=0 254CONFIG_BASE_SMALL=0
259CONFIG_MODULES=y 255CONFIG_MODULES=y
@@ -271,15 +267,41 @@ CONFIG_LBDAF=y
271# IO Schedulers 267# IO Schedulers
272# 268#
273CONFIG_IOSCHED_NOOP=y 269CONFIG_IOSCHED_NOOP=y
274# CONFIG_IOSCHED_AS is not set
275# CONFIG_IOSCHED_DEADLINE is not set 270# CONFIG_IOSCHED_DEADLINE is not set
276# CONFIG_IOSCHED_CFQ is not set 271# CONFIG_IOSCHED_CFQ is not set
277# CONFIG_DEFAULT_AS is not set
278# CONFIG_DEFAULT_DEADLINE is not set 272# CONFIG_DEFAULT_DEADLINE is not set
279# CONFIG_DEFAULT_CFQ is not set 273# CONFIG_DEFAULT_CFQ is not set
280CONFIG_DEFAULT_NOOP=y 274CONFIG_DEFAULT_NOOP=y
281CONFIG_DEFAULT_IOSCHED="noop" 275CONFIG_DEFAULT_IOSCHED="noop"
282# CONFIG_PROBE_INITRD_HEADER is not set 276# CONFIG_INLINE_SPIN_TRYLOCK is not set
277# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
278# CONFIG_INLINE_SPIN_LOCK is not set
279# CONFIG_INLINE_SPIN_LOCK_BH is not set
280# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
281# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
282# CONFIG_INLINE_SPIN_UNLOCK is not set
283# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
284# CONFIG_INLINE_SPIN_UNLOCK_IRQ is not set
285# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
286# CONFIG_INLINE_READ_TRYLOCK is not set
287# CONFIG_INLINE_READ_LOCK is not set
288# CONFIG_INLINE_READ_LOCK_BH is not set
289# CONFIG_INLINE_READ_LOCK_IRQ is not set
290# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
291# CONFIG_INLINE_READ_UNLOCK is not set
292# CONFIG_INLINE_READ_UNLOCK_BH is not set
293# CONFIG_INLINE_READ_UNLOCK_IRQ is not set
294# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
295# CONFIG_INLINE_WRITE_TRYLOCK is not set
296# CONFIG_INLINE_WRITE_LOCK is not set
297# CONFIG_INLINE_WRITE_LOCK_BH is not set
298# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
299# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
300# CONFIG_INLINE_WRITE_UNLOCK is not set
301# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
302# CONFIG_INLINE_WRITE_UNLOCK_IRQ is not set
303# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
304# CONFIG_MUTEX_SPIN_ON_OWNER is not set
283# CONFIG_FREEZER is not set 305# CONFIG_FREEZER is not set
284 306
285# 307#
@@ -289,7 +311,6 @@ CONFIG_HW_HAS_PCI=y
289CONFIG_PCI=y 311CONFIG_PCI=y
290CONFIG_PCI_DOMAINS=y 312CONFIG_PCI_DOMAINS=y
291# CONFIG_ARCH_SUPPORTS_MSI is not set 313# CONFIG_ARCH_SUPPORTS_MSI is not set
292# CONFIG_PCI_LEGACY is not set
293# CONFIG_PCI_DEBUG is not set 314# CONFIG_PCI_DEBUG is not set
294# CONFIG_PCI_STUB is not set 315# CONFIG_PCI_STUB is not set
295# CONFIG_PCI_IOV is not set 316# CONFIG_PCI_IOV is not set
@@ -318,7 +339,6 @@ CONFIG_NET=y
318# Networking options 339# Networking options
319# 340#
320CONFIG_PACKET=y 341CONFIG_PACKET=y
321CONFIG_PACKET_MMAP=y
322CONFIG_UNIX=y 342CONFIG_UNIX=y
323CONFIG_XFRM=y 343CONFIG_XFRM=y
324# CONFIG_XFRM_USER is not set 344# CONFIG_XFRM_USER is not set
@@ -390,12 +410,26 @@ CONFIG_NETFILTER_ADVANCED=y
390# CONFIG_NETFILTER_NETLINK_LOG is not set 410# CONFIG_NETFILTER_NETLINK_LOG is not set
391# CONFIG_NF_CONNTRACK is not set 411# CONFIG_NF_CONNTRACK is not set
392CONFIG_NETFILTER_XTABLES=y 412CONFIG_NETFILTER_XTABLES=y
413
414#
415# Xtables combined modules
416#
417# CONFIG_NETFILTER_XT_MARK is not set
418
419#
420# Xtables targets
421#
393# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set 422# CONFIG_NETFILTER_XT_TARGET_CLASSIFY is not set
394# CONFIG_NETFILTER_XT_TARGET_MARK is not set 423# CONFIG_NETFILTER_XT_TARGET_MARK is not set
395# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set 424# CONFIG_NETFILTER_XT_TARGET_NFLOG is not set
396# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set 425# CONFIG_NETFILTER_XT_TARGET_NFQUEUE is not set
397# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set 426# CONFIG_NETFILTER_XT_TARGET_RATEEST is not set
427# CONFIG_NETFILTER_XT_TARGET_TEE is not set
398# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set 428# CONFIG_NETFILTER_XT_TARGET_TCPMSS is not set
429
430#
431# Xtables matches
432#
399# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set 433# CONFIG_NETFILTER_XT_MATCH_COMMENT is not set
400# CONFIG_NETFILTER_XT_MATCH_DCCP is not set 434# CONFIG_NETFILTER_XT_MATCH_DCCP is not set
401# CONFIG_NETFILTER_XT_MATCH_DSCP is not set 435# CONFIG_NETFILTER_XT_MATCH_DSCP is not set
@@ -465,10 +499,13 @@ CONFIG_IP6_NF_FILTER=y
465# CONFIG_IP6_NF_RAW is not set 499# CONFIG_IP6_NF_RAW is not set
466# CONFIG_IP_DCCP is not set 500# CONFIG_IP_DCCP is not set
467# CONFIG_IP_SCTP is not set 501# CONFIG_IP_SCTP is not set
502# CONFIG_RDS is not set
468# CONFIG_TIPC is not set 503# CONFIG_TIPC is not set
469# CONFIG_ATM is not set 504# CONFIG_ATM is not set
505# CONFIG_L2TP is not set
470CONFIG_STP=y 506CONFIG_STP=y
471CONFIG_BRIDGE=y 507CONFIG_BRIDGE=y
508CONFIG_BRIDGE_IGMP_SNOOPING=y
472# CONFIG_NET_DSA is not set 509# CONFIG_NET_DSA is not set
473# CONFIG_VLAN_8021Q is not set 510# CONFIG_VLAN_8021Q is not set
474# CONFIG_DECNET is not set 511# CONFIG_DECNET is not set
@@ -526,10 +563,21 @@ CONFIG_NET_SCH_FIFO=y
526# CONFIG_IRDA is not set 563# CONFIG_IRDA is not set
527# CONFIG_BT is not set 564# CONFIG_BT is not set
528# CONFIG_AF_RXRPC is not set 565# CONFIG_AF_RXRPC is not set
529# CONFIG_WIRELESS is not set 566CONFIG_WIRELESS=y
567# CONFIG_CFG80211 is not set
568# CONFIG_LIB80211 is not set
569
570#
571# CFG80211 needs to be enabled for MAC80211
572#
573
574#
575# Some wireless drivers require a rate control algorithm
576#
530# CONFIG_WIMAX is not set 577# CONFIG_WIMAX is not set
531# CONFIG_RFKILL is not set 578# CONFIG_RFKILL is not set
532# CONFIG_NET_9P is not set 579# CONFIG_NET_9P is not set
580# CONFIG_CAIF is not set
533 581
534# 582#
535# Device Drivers 583# Device Drivers
@@ -539,6 +587,7 @@ CONFIG_NET_SCH_FIFO=y
539# Generic Driver Options 587# Generic Driver Options
540# 588#
541CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug" 589CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
590# CONFIG_DEVTMPFS is not set
542CONFIG_STANDALONE=y 591CONFIG_STANDALONE=y
543CONFIG_PREVENT_FIRMWARE_BUILD=y 592CONFIG_PREVENT_FIRMWARE_BUILD=y
544CONFIG_FW_LOADER=y 593CONFIG_FW_LOADER=y
@@ -550,9 +599,9 @@ CONFIG_EXTRA_FIRMWARE=""
550# CONFIG_CONNECTOR is not set 599# CONFIG_CONNECTOR is not set
551CONFIG_MTD=y 600CONFIG_MTD=y
552# CONFIG_MTD_DEBUG is not set 601# CONFIG_MTD_DEBUG is not set
602# CONFIG_MTD_TESTS is not set
553# CONFIG_MTD_CONCAT is not set 603# CONFIG_MTD_CONCAT is not set
554CONFIG_MTD_PARTITIONS=y 604CONFIG_MTD_PARTITIONS=y
555# CONFIG_MTD_TESTS is not set
556# CONFIG_MTD_REDBOOT_PARTS is not set 605# CONFIG_MTD_REDBOOT_PARTS is not set
557CONFIG_MTD_CMDLINE_PARTS=y 606CONFIG_MTD_CMDLINE_PARTS=y
558# CONFIG_MTD_AR7_PARTS is not set 607# CONFIG_MTD_AR7_PARTS is not set
@@ -568,6 +617,7 @@ CONFIG_MTD_BLOCK=y
568# CONFIG_INFTL is not set 617# CONFIG_INFTL is not set
569# CONFIG_RFD_FTL is not set 618# CONFIG_RFD_FTL is not set
570# CONFIG_SSFDC is not set 619# CONFIG_SSFDC is not set
620# CONFIG_SM_FTL is not set
571# CONFIG_MTD_OOPS is not set 621# CONFIG_MTD_OOPS is not set
572 622
573# 623#
@@ -611,11 +661,16 @@ CONFIG_MTD_CFI_I2=y
611# CONFIG_MTD_DOC2000 is not set 661# CONFIG_MTD_DOC2000 is not set
612# CONFIG_MTD_DOC2001 is not set 662# CONFIG_MTD_DOC2001 is not set
613# CONFIG_MTD_DOC2001PLUS is not set 663# CONFIG_MTD_DOC2001PLUS is not set
664CONFIG_MTD_NAND_ECC=y
665# CONFIG_MTD_NAND_ECC_SMC is not set
614CONFIG_MTD_NAND=y 666CONFIG_MTD_NAND=y
615# CONFIG_MTD_NAND_VERIFY_WRITE is not set 667# CONFIG_MTD_NAND_VERIFY_WRITE is not set
616# CONFIG_MTD_NAND_ECC_SMC is not set 668# CONFIG_MTD_SM_COMMON is not set
617# CONFIG_MTD_NAND_MUSEUM_IDS is not set 669# CONFIG_MTD_NAND_MUSEUM_IDS is not set
670# CONFIG_MTD_NAND_DENALI is not set
671CONFIG_MTD_NAND_DENALI_SCRATCH_REG_ADDR=0xFF108018
618CONFIG_MTD_NAND_IDS=y 672CONFIG_MTD_NAND_IDS=y
673# CONFIG_MTD_NAND_RICOH is not set
619# CONFIG_MTD_NAND_DISKONCHIP is not set 674# CONFIG_MTD_NAND_DISKONCHIP is not set
620# CONFIG_MTD_NAND_CAFE is not set 675# CONFIG_MTD_NAND_CAFE is not set
621# CONFIG_MTD_NAND_NANDSIM is not set 676# CONFIG_MTD_NAND_NANDSIM is not set
@@ -641,6 +696,10 @@ CONFIG_BLK_DEV=y
641# CONFIG_BLK_DEV_COW_COMMON is not set 696# CONFIG_BLK_DEV_COW_COMMON is not set
642CONFIG_BLK_DEV_LOOP=y 697CONFIG_BLK_DEV_LOOP=y
643# CONFIG_BLK_DEV_CRYPTOLOOP is not set 698# CONFIG_BLK_DEV_CRYPTOLOOP is not set
699
700#
701# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
702#
644# CONFIG_BLK_DEV_NBD is not set 703# CONFIG_BLK_DEV_NBD is not set
645# CONFIG_BLK_DEV_SX8 is not set 704# CONFIG_BLK_DEV_SX8 is not set
646# CONFIG_BLK_DEV_UB is not set 705# CONFIG_BLK_DEV_UB is not set
@@ -658,6 +717,7 @@ CONFIG_HAVE_IDE=y
658# 717#
659# SCSI device support 718# SCSI device support
660# 719#
720CONFIG_SCSI_MOD=y
661# CONFIG_RAID_ATTRS is not set 721# CONFIG_RAID_ATTRS is not set
662CONFIG_SCSI=y 722CONFIG_SCSI=y
663CONFIG_SCSI_DMA=y 723CONFIG_SCSI_DMA=y
@@ -693,64 +753,95 @@ CONFIG_SCSI_WAIT_SCAN=m
693# CONFIG_SCSI_OSD_INITIATOR is not set 753# CONFIG_SCSI_OSD_INITIATOR is not set
694CONFIG_ATA=y 754CONFIG_ATA=y
695# CONFIG_ATA_NONSTANDARD is not set 755# CONFIG_ATA_NONSTANDARD is not set
756CONFIG_ATA_VERBOSE_ERROR=y
696CONFIG_SATA_PMP=y 757CONFIG_SATA_PMP=y
758
759#
760# Controllers with non-SFF native interface
761#
697# CONFIG_SATA_AHCI is not set 762# CONFIG_SATA_AHCI is not set
763# CONFIG_SATA_AHCI_PLATFORM is not set
764# CONFIG_SATA_INIC162X is not set
698# CONFIG_SATA_SIL24 is not set 765# CONFIG_SATA_SIL24 is not set
699CONFIG_ATA_SFF=y 766CONFIG_ATA_SFF=y
700# CONFIG_SATA_SVW is not set 767
768#
769# SFF controllers with custom DMA interface
770#
771# CONFIG_PDC_ADMA is not set
772# CONFIG_SATA_QSTOR is not set
773# CONFIG_SATA_SX4 is not set
774CONFIG_ATA_BMDMA=y
775
776#
777# SATA SFF controllers with BMDMA
778#
701# CONFIG_ATA_PIIX is not set 779# CONFIG_ATA_PIIX is not set
702# CONFIG_SATA_MV is not set 780# CONFIG_SATA_MV is not set
703# CONFIG_SATA_NV is not set 781# CONFIG_SATA_NV is not set
704# CONFIG_PDC_ADMA is not set
705# CONFIG_SATA_QSTOR is not set
706# CONFIG_SATA_PROMISE is not set 782# CONFIG_SATA_PROMISE is not set
707# CONFIG_SATA_SX4 is not set
708# CONFIG_SATA_SIL is not set 783# CONFIG_SATA_SIL is not set
709# CONFIG_SATA_SIS is not set 784# CONFIG_SATA_SIS is not set
785# CONFIG_SATA_SVW is not set
710# CONFIG_SATA_ULI is not set 786# CONFIG_SATA_ULI is not set
711# CONFIG_SATA_VIA is not set 787# CONFIG_SATA_VIA is not set
712# CONFIG_SATA_VITESSE is not set 788# CONFIG_SATA_VITESSE is not set
713# CONFIG_SATA_INIC162X is not set 789
790#
791# PATA SFF controllers with BMDMA
792#
714# CONFIG_PATA_ALI is not set 793# CONFIG_PATA_ALI is not set
715# CONFIG_PATA_AMD is not set 794# CONFIG_PATA_AMD is not set
716# CONFIG_PATA_ARTOP is not set 795# CONFIG_PATA_ARTOP is not set
717# CONFIG_PATA_ATIIXP is not set 796# CONFIG_PATA_ATIIXP is not set
718# CONFIG_PATA_CMD640_PCI is not set 797# CONFIG_PATA_ATP867X is not set
719# CONFIG_PATA_CMD64X is not set 798# CONFIG_PATA_CMD64X is not set
720# CONFIG_PATA_CS5520 is not set 799# CONFIG_PATA_CS5520 is not set
721# CONFIG_PATA_CS5530 is not set 800# CONFIG_PATA_CS5530 is not set
722# CONFIG_PATA_CYPRESS is not set 801# CONFIG_PATA_CYPRESS is not set
723# CONFIG_PATA_EFAR is not set 802# CONFIG_PATA_EFAR is not set
724# CONFIG_ATA_GENERIC is not set
725# CONFIG_PATA_HPT366 is not set 803# CONFIG_PATA_HPT366 is not set
726# CONFIG_PATA_HPT37X is not set 804# CONFIG_PATA_HPT37X is not set
727# CONFIG_PATA_HPT3X2N is not set 805# CONFIG_PATA_HPT3X2N is not set
728# CONFIG_PATA_HPT3X3 is not set 806# CONFIG_PATA_HPT3X3 is not set
729# CONFIG_PATA_IT821X is not set
730# CONFIG_PATA_IT8213 is not set 807# CONFIG_PATA_IT8213 is not set
808# CONFIG_PATA_IT821X is not set
731# CONFIG_PATA_JMICRON is not set 809# CONFIG_PATA_JMICRON is not set
732# CONFIG_PATA_TRIFLEX is not set
733# CONFIG_PATA_MARVELL is not set 810# CONFIG_PATA_MARVELL is not set
734# CONFIG_PATA_MPIIX is not set
735# CONFIG_PATA_OLDPIIX is not set
736# CONFIG_PATA_NETCELL is not set 811# CONFIG_PATA_NETCELL is not set
737# CONFIG_PATA_NINJA32 is not set 812# CONFIG_PATA_NINJA32 is not set
738# CONFIG_PATA_NS87410 is not set
739# CONFIG_PATA_NS87415 is not set 813# CONFIG_PATA_NS87415 is not set
740# CONFIG_PATA_OPTI is not set 814# CONFIG_PATA_OLDPIIX is not set
741# CONFIG_PATA_OPTIDMA is not set 815# CONFIG_PATA_OPTIDMA is not set
816# CONFIG_PATA_PDC2027X is not set
742# CONFIG_PATA_PDC_OLD is not set 817# CONFIG_PATA_PDC_OLD is not set
743# CONFIG_PATA_RADISYS is not set 818# CONFIG_PATA_RADISYS is not set
744# CONFIG_PATA_RZ1000 is not set 819# CONFIG_PATA_RDC is not set
745# CONFIG_PATA_SC1200 is not set 820# CONFIG_PATA_SC1200 is not set
821# CONFIG_PATA_SCH is not set
746# CONFIG_PATA_SERVERWORKS is not set 822# CONFIG_PATA_SERVERWORKS is not set
747# CONFIG_PATA_PDC2027X is not set
748# CONFIG_PATA_SIL680 is not set 823# CONFIG_PATA_SIL680 is not set
749# CONFIG_PATA_SIS is not set 824# CONFIG_PATA_SIS is not set
825# CONFIG_PATA_TOSHIBA is not set
826# CONFIG_PATA_TRIFLEX is not set
750# CONFIG_PATA_VIA is not set 827# CONFIG_PATA_VIA is not set
751# CONFIG_PATA_WINBOND is not set 828# CONFIG_PATA_WINBOND is not set
829
830#
831# PIO-only SFF controllers
832#
833# CONFIG_PATA_CMD640_PCI is not set
834# CONFIG_PATA_MPIIX is not set
835# CONFIG_PATA_NS87410 is not set
836# CONFIG_PATA_OPTI is not set
752# CONFIG_PATA_PLATFORM is not set 837# CONFIG_PATA_PLATFORM is not set
753# CONFIG_PATA_SCH is not set 838# CONFIG_PATA_RZ1000 is not set
839
840#
841# Generic fallback / legacy drivers
842#
843# CONFIG_ATA_GENERIC is not set
844# CONFIG_PATA_LEGACY is not set
754# CONFIG_MD is not set 845# CONFIG_MD is not set
755# CONFIG_FUSION is not set 846# CONFIG_FUSION is not set
756 847
@@ -763,7 +854,7 @@ CONFIG_ATA_SFF=y
763# 854#
764 855
765# 856#
766# See the help texts for more information. 857# The newer stack is recommended.
767# 858#
768# CONFIG_FIREWIRE is not set 859# CONFIG_FIREWIRE is not set
769# CONFIG_IEEE1394 is not set 860# CONFIG_IEEE1394 is not set
@@ -787,6 +878,7 @@ CONFIG_MII=y
787# CONFIG_SMC91X is not set 878# CONFIG_SMC91X is not set
788# CONFIG_DM9000 is not set 879# CONFIG_DM9000 is not set
789# CONFIG_ETHOC is not set 880# CONFIG_ETHOC is not set
881# CONFIG_SMSC911X is not set
790# CONFIG_DNET is not set 882# CONFIG_DNET is not set
791# CONFIG_NET_TULIP is not set 883# CONFIG_NET_TULIP is not set
792# CONFIG_HP100 is not set 884# CONFIG_HP100 is not set
@@ -800,6 +892,7 @@ CONFIG_MII=y
800# CONFIG_NET_PCI is not set 892# CONFIG_NET_PCI is not set
801# CONFIG_B44 is not set 893# CONFIG_B44 is not set
802# CONFIG_KS8842 is not set 894# CONFIG_KS8842 is not set
895# CONFIG_KS8851_MLL is not set
803# CONFIG_ATL2 is not set 896# CONFIG_ATL2 is not set
804CONFIG_NETDEV_1000=y 897CONFIG_NETDEV_1000=y
805# CONFIG_ACENIC is not set 898# CONFIG_ACENIC is not set
@@ -829,6 +922,8 @@ CONFIG_NETDEV_10000=y
829# CONFIG_CHELSIO_T1 is not set 922# CONFIG_CHELSIO_T1 is not set
830CONFIG_CHELSIO_T3_DEPENDS=y 923CONFIG_CHELSIO_T3_DEPENDS=y
831# CONFIG_CHELSIO_T3 is not set 924# CONFIG_CHELSIO_T3 is not set
925CONFIG_CHELSIO_T4_DEPENDS=y
926# CONFIG_CHELSIO_T4 is not set
832# CONFIG_ENIC is not set 927# CONFIG_ENIC is not set
833# CONFIG_IXGBE is not set 928# CONFIG_IXGBE is not set
834# CONFIG_IXGB is not set 929# CONFIG_IXGB is not set
@@ -841,16 +936,12 @@ CONFIG_CHELSIO_T3_DEPENDS=y
841# CONFIG_MLX4_CORE is not set 936# CONFIG_MLX4_CORE is not set
842# CONFIG_TEHUTI is not set 937# CONFIG_TEHUTI is not set
843# CONFIG_BNX2X is not set 938# CONFIG_BNX2X is not set
939# CONFIG_QLCNIC is not set
844# CONFIG_QLGE is not set 940# CONFIG_QLGE is not set
845# CONFIG_SFC is not set 941# CONFIG_SFC is not set
846# CONFIG_BE2NET is not set 942# CONFIG_BE2NET is not set
847# CONFIG_TR is not set 943# CONFIG_TR is not set
848 944# CONFIG_WLAN is not set
849#
850# Wireless LAN
851#
852# CONFIG_WLAN_PRE80211 is not set
853# CONFIG_WLAN_80211 is not set
854 945
855# 946#
856# Enable WiMAX (Networking options) to see the WiMAX drivers 947# Enable WiMAX (Networking options) to see the WiMAX drivers
@@ -864,6 +955,7 @@ CONFIG_CHELSIO_T3_DEPENDS=y
864# CONFIG_USB_PEGASUS is not set 955# CONFIG_USB_PEGASUS is not set
865CONFIG_USB_RTL8150=y 956CONFIG_USB_RTL8150=y
866# CONFIG_USB_USBNET is not set 957# CONFIG_USB_USBNET is not set
958# CONFIG_USB_IPHETH is not set
867# CONFIG_WAN is not set 959# CONFIG_WAN is not set
868# CONFIG_FDDI is not set 960# CONFIG_FDDI is not set
869# CONFIG_HIPPI is not set 961# CONFIG_HIPPI is not set
@@ -873,6 +965,7 @@ CONFIG_USB_RTL8150=y
873# CONFIG_NETCONSOLE is not set 965# CONFIG_NETCONSOLE is not set
874# CONFIG_NETPOLL is not set 966# CONFIG_NETPOLL is not set
875# CONFIG_NET_POLL_CONTROLLER is not set 967# CONFIG_NET_POLL_CONTROLLER is not set
968# CONFIG_VMXNET3 is not set
876# CONFIG_ISDN is not set 969# CONFIG_ISDN is not set
877# CONFIG_PHONE is not set 970# CONFIG_PHONE is not set
878 971
@@ -882,6 +975,7 @@ CONFIG_USB_RTL8150=y
882CONFIG_INPUT=y 975CONFIG_INPUT=y
883# CONFIG_INPUT_FF_MEMLESS is not set 976# CONFIG_INPUT_FF_MEMLESS is not set
884# CONFIG_INPUT_POLLDEV is not set 977# CONFIG_INPUT_POLLDEV is not set
978# CONFIG_INPUT_SPARSEKMAP is not set
885 979
886# 980#
887# Userland interfaces 981# Userland interfaces
@@ -913,6 +1007,7 @@ CONFIG_INPUT_EVDEV=y
913# CONFIG_VT is not set 1007# CONFIG_VT is not set
914# CONFIG_DEVKMEM is not set 1008# CONFIG_DEVKMEM is not set
915# CONFIG_SERIAL_NONSTANDARD is not set 1009# CONFIG_SERIAL_NONSTANDARD is not set
1010# CONFIG_N_GSM is not set
916# CONFIG_NOZOMI is not set 1011# CONFIG_NOZOMI is not set
917 1012
918# 1013#
@@ -924,6 +1019,9 @@ CONFIG_INPUT_EVDEV=y
924# Non-8250 serial port support 1019# Non-8250 serial port support
925# 1020#
926# CONFIG_SERIAL_JSM is not set 1021# CONFIG_SERIAL_JSM is not set
1022# CONFIG_SERIAL_TIMBERDALE is not set
1023# CONFIG_SERIAL_ALTERA_JTAGUART is not set
1024# CONFIG_SERIAL_ALTERA_UART is not set
927CONFIG_UNIX98_PTYS=y 1025CONFIG_UNIX98_PTYS=y
928# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set 1026# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
929# CONFIG_LEGACY_PTYS is not set 1027# CONFIG_LEGACY_PTYS is not set
@@ -934,6 +1032,7 @@ CONFIG_UNIX98_PTYS=y
934# CONFIG_RAW_DRIVER is not set 1032# CONFIG_RAW_DRIVER is not set
935# CONFIG_TCG_TPM is not set 1033# CONFIG_TCG_TPM is not set
936CONFIG_DEVPORT=y 1034CONFIG_DEVPORT=y
1035# CONFIG_RAMOOPS is not set
937# CONFIG_I2C is not set 1036# CONFIG_I2C is not set
938# CONFIG_SPI is not set 1037# CONFIG_SPI is not set
939 1038
@@ -945,7 +1044,6 @@ CONFIG_DEVPORT=y
945# CONFIG_POWER_SUPPLY is not set 1044# CONFIG_POWER_SUPPLY is not set
946# CONFIG_HWMON is not set 1045# CONFIG_HWMON is not set
947# CONFIG_THERMAL is not set 1046# CONFIG_THERMAL is not set
948# CONFIG_THERMAL_HWMON is not set
949# CONFIG_WATCHDOG is not set 1047# CONFIG_WATCHDOG is not set
950CONFIG_SSB_POSSIBLE=y 1048CONFIG_SSB_POSSIBLE=y
951 1049
@@ -953,20 +1051,14 @@ CONFIG_SSB_POSSIBLE=y
953# Sonics Silicon Backplane 1051# Sonics Silicon Backplane
954# 1052#
955# CONFIG_SSB is not set 1053# CONFIG_SSB is not set
956 1054# CONFIG_MFD_SUPPORT is not set
957#
958# Multifunction device drivers
959#
960# CONFIG_MFD_CORE is not set
961# CONFIG_MFD_SM501 is not set
962# CONFIG_HTC_PASIC3 is not set
963# CONFIG_MFD_TMIO is not set
964# CONFIG_REGULATOR is not set 1055# CONFIG_REGULATOR is not set
965# CONFIG_MEDIA_SUPPORT is not set 1056# CONFIG_MEDIA_SUPPORT is not set
966 1057
967# 1058#
968# Graphics support 1059# Graphics support
969# 1060#
1061# CONFIG_VGA_ARB is not set
970# CONFIG_DRM is not set 1062# CONFIG_DRM is not set
971# CONFIG_VGASTATE is not set 1063# CONFIG_VGASTATE is not set
972# CONFIG_VIDEO_OUTPUT_CONTROL is not set 1064# CONFIG_VIDEO_OUTPUT_CONTROL is not set
@@ -980,7 +1072,6 @@ CONFIG_SSB_POSSIBLE=y
980# CONFIG_SOUND is not set 1072# CONFIG_SOUND is not set
981CONFIG_HID_SUPPORT=y 1073CONFIG_HID_SUPPORT=y
982CONFIG_HID=y 1074CONFIG_HID=y
983# CONFIG_HID_DEBUG is not set
984# CONFIG_HIDRAW is not set 1075# CONFIG_HIDRAW is not set
985 1076
986# 1077#
@@ -993,31 +1084,43 @@ CONFIG_USB_HIDDEV=y
993# 1084#
994# Special HID drivers 1085# Special HID drivers
995# 1086#
1087# CONFIG_HID_3M_PCT is not set
996# CONFIG_HID_A4TECH is not set 1088# CONFIG_HID_A4TECH is not set
997# CONFIG_HID_APPLE is not set 1089# CONFIG_HID_APPLE is not set
998# CONFIG_HID_BELKIN is not set 1090# CONFIG_HID_BELKIN is not set
1091# CONFIG_HID_CANDO is not set
999# CONFIG_HID_CHERRY is not set 1092# CONFIG_HID_CHERRY is not set
1000# CONFIG_HID_CHICONY is not set 1093# CONFIG_HID_CHICONY is not set
1001# CONFIG_HID_CYPRESS is not set 1094# CONFIG_HID_CYPRESS is not set
1002# CONFIG_HID_DRAGONRISE is not set 1095# CONFIG_HID_DRAGONRISE is not set
1096# CONFIG_HID_EGALAX is not set
1003# CONFIG_HID_EZKEY is not set 1097# CONFIG_HID_EZKEY is not set
1004# CONFIG_HID_KYE is not set 1098# CONFIG_HID_KYE is not set
1005# CONFIG_HID_GYRATION is not set 1099# CONFIG_HID_GYRATION is not set
1100# CONFIG_HID_TWINHAN is not set
1006# CONFIG_HID_KENSINGTON is not set 1101# CONFIG_HID_KENSINGTON is not set
1007# CONFIG_HID_LOGITECH is not set 1102# CONFIG_HID_LOGITECH is not set
1008# CONFIG_HID_MICROSOFT is not set 1103# CONFIG_HID_MICROSOFT is not set
1104# CONFIG_HID_MOSART is not set
1009# CONFIG_HID_MONTEREY is not set 1105# CONFIG_HID_MONTEREY is not set
1010# CONFIG_HID_NTRIG is not set 1106# CONFIG_HID_NTRIG is not set
1107# CONFIG_HID_ORTEK is not set
1011# CONFIG_HID_PANTHERLORD is not set 1108# CONFIG_HID_PANTHERLORD is not set
1012# CONFIG_HID_PETALYNX is not set 1109# CONFIG_HID_PETALYNX is not set
1110# CONFIG_HID_PICOLCD is not set
1111# CONFIG_HID_QUANTA is not set
1112# CONFIG_HID_ROCCAT is not set
1113# CONFIG_HID_ROCCAT_KONE is not set
1013# CONFIG_HID_SAMSUNG is not set 1114# CONFIG_HID_SAMSUNG is not set
1014# CONFIG_HID_SONY is not set 1115# CONFIG_HID_SONY is not set
1116# CONFIG_HID_STANTUM is not set
1015# CONFIG_HID_SUNPLUS is not set 1117# CONFIG_HID_SUNPLUS is not set
1016# CONFIG_HID_GREENASIA is not set 1118# CONFIG_HID_GREENASIA is not set
1017# CONFIG_HID_SMARTJOYPLUS is not set 1119# CONFIG_HID_SMARTJOYPLUS is not set
1018# CONFIG_HID_TOPSEED is not set 1120# CONFIG_HID_TOPSEED is not set
1019# CONFIG_HID_THRUSTMASTER is not set 1121# CONFIG_HID_THRUSTMASTER is not set
1020# CONFIG_HID_ZEROPLUS is not set 1122# CONFIG_HID_ZEROPLUS is not set
1123# CONFIG_HID_ZYDACRON is not set
1021CONFIG_USB_SUPPORT=y 1124CONFIG_USB_SUPPORT=y
1022CONFIG_USB_ARCH_HAS_HCD=y 1125CONFIG_USB_ARCH_HAS_HCD=y
1023CONFIG_USB_ARCH_HAS_OHCI=y 1126CONFIG_USB_ARCH_HAS_OHCI=y
@@ -1032,7 +1135,6 @@ CONFIG_USB_ANNOUNCE_NEW_DEVICES=y
1032CONFIG_USB_DEVICEFS=y 1135CONFIG_USB_DEVICEFS=y
1033# CONFIG_USB_DEVICE_CLASS is not set 1136# CONFIG_USB_DEVICE_CLASS is not set
1034# CONFIG_USB_DYNAMIC_MINORS is not set 1137# CONFIG_USB_DYNAMIC_MINORS is not set
1035# CONFIG_USB_OTG is not set
1036# CONFIG_USB_OTG_WHITELIST is not set 1138# CONFIG_USB_OTG_WHITELIST is not set
1037# CONFIG_USB_OTG_BLACKLIST_HUB is not set 1139# CONFIG_USB_OTG_BLACKLIST_HUB is not set
1038# CONFIG_USB_MON is not set 1140# CONFIG_USB_MON is not set
@@ -1050,6 +1152,7 @@ CONFIG_USB_EHCI_HCD=y
1050# CONFIG_USB_OXU210HP_HCD is not set 1152# CONFIG_USB_OXU210HP_HCD is not set
1051# CONFIG_USB_ISP116X_HCD is not set 1153# CONFIG_USB_ISP116X_HCD is not set
1052# CONFIG_USB_ISP1760_HCD is not set 1154# CONFIG_USB_ISP1760_HCD is not set
1155# CONFIG_USB_ISP1362_HCD is not set
1053CONFIG_USB_OHCI_HCD=y 1156CONFIG_USB_OHCI_HCD=y
1054# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set 1157# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
1055# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set 1158# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
@@ -1133,6 +1236,7 @@ CONFIG_USB_SERIAL_CP210X=y
1133# CONFIG_USB_SERIAL_NAVMAN is not set 1236# CONFIG_USB_SERIAL_NAVMAN is not set
1134# CONFIG_USB_SERIAL_PL2303 is not set 1237# CONFIG_USB_SERIAL_PL2303 is not set
1135# CONFIG_USB_SERIAL_OTI6858 is not set 1238# CONFIG_USB_SERIAL_OTI6858 is not set
1239# CONFIG_USB_SERIAL_QCAUX is not set
1136# CONFIG_USB_SERIAL_QUALCOMM is not set 1240# CONFIG_USB_SERIAL_QUALCOMM is not set
1137# CONFIG_USB_SERIAL_SPCP8X5 is not set 1241# CONFIG_USB_SERIAL_SPCP8X5 is not set
1138# CONFIG_USB_SERIAL_HP4X is not set 1242# CONFIG_USB_SERIAL_HP4X is not set
@@ -1146,6 +1250,8 @@ CONFIG_USB_SERIAL_CP210X=y
1146# CONFIG_USB_SERIAL_OPTION is not set 1250# CONFIG_USB_SERIAL_OPTION is not set
1147# CONFIG_USB_SERIAL_OMNINET is not set 1251# CONFIG_USB_SERIAL_OMNINET is not set
1148# CONFIG_USB_SERIAL_OPTICON is not set 1252# CONFIG_USB_SERIAL_OPTICON is not set
1253# CONFIG_USB_SERIAL_VIVOPAY_SERIAL is not set
1254# CONFIG_USB_SERIAL_ZIO is not set
1149# CONFIG_USB_SERIAL_DEBUG is not set 1255# CONFIG_USB_SERIAL_DEBUG is not set
1150 1256
1151# 1257#
@@ -1158,7 +1264,6 @@ CONFIG_USB_SERIAL_CP210X=y
1158# CONFIG_USB_RIO500 is not set 1264# CONFIG_USB_RIO500 is not set
1159# CONFIG_USB_LEGOTOWER is not set 1265# CONFIG_USB_LEGOTOWER is not set
1160# CONFIG_USB_LCD is not set 1266# CONFIG_USB_LCD is not set
1161# CONFIG_USB_BERRY_CHARGE is not set
1162# CONFIG_USB_LED is not set 1267# CONFIG_USB_LED is not set
1163# CONFIG_USB_CYPRESS_CY7C63 is not set 1268# CONFIG_USB_CYPRESS_CY7C63 is not set
1164# CONFIG_USB_CYTHERM is not set 1269# CONFIG_USB_CYTHERM is not set
@@ -1171,7 +1276,6 @@ CONFIG_USB_SERIAL_CP210X=y
1171# CONFIG_USB_IOWARRIOR is not set 1276# CONFIG_USB_IOWARRIOR is not set
1172# CONFIG_USB_TEST is not set 1277# CONFIG_USB_TEST is not set
1173# CONFIG_USB_ISIGHTFW is not set 1278# CONFIG_USB_ISIGHTFW is not set
1174# CONFIG_USB_VST is not set
1175# CONFIG_USB_GADGET is not set 1279# CONFIG_USB_GADGET is not set
1176 1280
1177# 1281#
@@ -1189,10 +1293,6 @@ CONFIG_RTC_LIB=y
1189# CONFIG_DMADEVICES is not set 1293# CONFIG_DMADEVICES is not set
1190# CONFIG_AUXDISPLAY is not set 1294# CONFIG_AUXDISPLAY is not set
1191# CONFIG_UIO is not set 1295# CONFIG_UIO is not set
1192
1193#
1194# TI VLYNQ
1195#
1196# CONFIG_STAGING is not set 1296# CONFIG_STAGING is not set
1197 1297
1198# 1298#
@@ -1214,6 +1314,7 @@ CONFIG_JBD=y
1214# CONFIG_GFS2_FS is not set 1314# CONFIG_GFS2_FS is not set
1215# CONFIG_OCFS2_FS is not set 1315# CONFIG_OCFS2_FS is not set
1216# CONFIG_BTRFS_FS is not set 1316# CONFIG_BTRFS_FS is not set
1317# CONFIG_NILFS2_FS is not set
1217CONFIG_FILE_LOCKING=y 1318CONFIG_FILE_LOCKING=y
1218CONFIG_FSNOTIFY=y 1319CONFIG_FSNOTIFY=y
1219# CONFIG_DNOTIFY is not set 1320# CONFIG_DNOTIFY is not set
@@ -1274,6 +1375,7 @@ CONFIG_JFFS2_ZLIB=y
1274# CONFIG_JFFS2_LZO is not set 1375# CONFIG_JFFS2_LZO is not set
1275CONFIG_JFFS2_RTIME=y 1376CONFIG_JFFS2_RTIME=y
1276# CONFIG_JFFS2_RUBIN is not set 1377# CONFIG_JFFS2_RUBIN is not set
1378# CONFIG_LOGFS is not set
1277CONFIG_CRAMFS=y 1379CONFIG_CRAMFS=y
1278# CONFIG_SQUASHFS is not set 1380# CONFIG_SQUASHFS is not set
1279# CONFIG_VXFS_FS is not set 1381# CONFIG_VXFS_FS is not set
@@ -1284,7 +1386,6 @@ CONFIG_CRAMFS=y
1284# CONFIG_ROMFS_FS is not set 1386# CONFIG_ROMFS_FS is not set
1285# CONFIG_SYSV_FS is not set 1387# CONFIG_SYSV_FS is not set
1286# CONFIG_UFS_FS is not set 1388# CONFIG_UFS_FS is not set
1287# CONFIG_NILFS2_FS is not set
1288CONFIG_NETWORK_FILESYSTEMS=y 1389CONFIG_NETWORK_FILESYSTEMS=y
1289CONFIG_NFS_FS=y 1390CONFIG_NFS_FS=y
1290CONFIG_NFS_V3=y 1391CONFIG_NFS_V3=y
@@ -1299,6 +1400,7 @@ CONFIG_SUNRPC=y
1299# CONFIG_RPCSEC_GSS_KRB5 is not set 1400# CONFIG_RPCSEC_GSS_KRB5 is not set
1300# CONFIG_RPCSEC_GSS_SPKM3 is not set 1401# CONFIG_RPCSEC_GSS_SPKM3 is not set
1301# CONFIG_SMB_FS is not set 1402# CONFIG_SMB_FS is not set
1403# CONFIG_CEPH_FS is not set
1302# CONFIG_CIFS is not set 1404# CONFIG_CIFS is not set
1303# CONFIG_NCP_FS is not set 1405# CONFIG_NCP_FS is not set
1304# CONFIG_CODA_FS is not set 1406# CONFIG_CODA_FS is not set
@@ -1360,6 +1462,7 @@ CONFIG_ENABLE_WARN_DEPRECATED=y
1360CONFIG_ENABLE_MUST_CHECK=y 1462CONFIG_ENABLE_MUST_CHECK=y
1361CONFIG_FRAME_WARN=1024 1463CONFIG_FRAME_WARN=1024
1362# CONFIG_MAGIC_SYSRQ is not set 1464# CONFIG_MAGIC_SYSRQ is not set
1465# CONFIG_STRIP_ASM_SYMS is not set
1363# CONFIG_UNUSED_SYMBOLS is not set 1466# CONFIG_UNUSED_SYMBOLS is not set
1364CONFIG_DEBUG_FS=y 1467CONFIG_DEBUG_FS=y
1365# CONFIG_HEADERS_CHECK is not set 1468# CONFIG_HEADERS_CHECK is not set
@@ -1393,15 +1496,25 @@ CONFIG_DEBUG_INFO=y
1393# CONFIG_DEBUG_LIST is not set 1496# CONFIG_DEBUG_LIST is not set
1394# CONFIG_DEBUG_SG is not set 1497# CONFIG_DEBUG_SG is not set
1395# CONFIG_DEBUG_NOTIFIERS is not set 1498# CONFIG_DEBUG_NOTIFIERS is not set
1499# CONFIG_DEBUG_CREDENTIALS is not set
1396# CONFIG_BOOT_PRINTK_DELAY is not set 1500# CONFIG_BOOT_PRINTK_DELAY is not set
1397# CONFIG_RCU_TORTURE_TEST is not set 1501# CONFIG_RCU_TORTURE_TEST is not set
1398# CONFIG_RCU_CPU_STALL_DETECTOR is not set 1502# CONFIG_RCU_CPU_STALL_DETECTOR is not set
1399# CONFIG_BACKTRACE_SELF_TEST is not set 1503# CONFIG_BACKTRACE_SELF_TEST is not set
1400# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set 1504# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
1505# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
1506# CONFIG_LKDTM is not set
1401# CONFIG_FAULT_INJECTION is not set 1507# CONFIG_FAULT_INJECTION is not set
1508# CONFIG_SYSCTL_SYSCALL_CHECK is not set
1402# CONFIG_PAGE_POISONING is not set 1509# CONFIG_PAGE_POISONING is not set
1510CONFIG_HAVE_FUNCTION_TRACER=y
1511CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
1512CONFIG_HAVE_FUNCTION_TRACE_MCOUNT_TEST=y
1513CONFIG_HAVE_DYNAMIC_FTRACE=y
1514CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
1403CONFIG_TRACING_SUPPORT=y 1515CONFIG_TRACING_SUPPORT=y
1404CONFIG_FTRACE=y 1516CONFIG_FTRACE=y
1517# CONFIG_FUNCTION_TRACER is not set
1405# CONFIG_IRQSOFF_TRACER is not set 1518# CONFIG_IRQSOFF_TRACER is not set
1406# CONFIG_PREEMPT_TRACER is not set 1519# CONFIG_PREEMPT_TRACER is not set
1407# CONFIG_SCHED_TRACER is not set 1520# CONFIG_SCHED_TRACER is not set
@@ -1410,19 +1523,22 @@ CONFIG_FTRACE=y
1410CONFIG_BRANCH_PROFILE_NONE=y 1523CONFIG_BRANCH_PROFILE_NONE=y
1411# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set 1524# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
1412# CONFIG_PROFILE_ALL_BRANCHES is not set 1525# CONFIG_PROFILE_ALL_BRANCHES is not set
1526# CONFIG_STACK_TRACER is not set
1413# CONFIG_KMEMTRACE is not set 1527# CONFIG_KMEMTRACE is not set
1414# CONFIG_WORKQUEUE_TRACER is not set 1528# CONFIG_WORKQUEUE_TRACER is not set
1415# CONFIG_BLK_DEV_IO_TRACE is not set 1529# CONFIG_BLK_DEV_IO_TRACE is not set
1416# CONFIG_DYNAMIC_DEBUG is not set 1530# CONFIG_DYNAMIC_DEBUG is not set
1531# CONFIG_ATOMIC64_SELFTEST is not set
1417# CONFIG_SAMPLES is not set 1532# CONFIG_SAMPLES is not set
1418CONFIG_HAVE_ARCH_KGDB=y 1533CONFIG_HAVE_ARCH_KGDB=y
1419# CONFIG_KGDB is not set 1534# CONFIG_KGDB is not set
1420# CONFIG_KMEMCHECK is not set 1535# CONFIG_EARLY_PRINTK is not set
1421CONFIG_CMDLINE_BOOL=y 1536CONFIG_CMDLINE_BOOL=y
1422CONFIG_CMDLINE="rw dhash_entries=1024 ihash_entries=1024 ip=10.0.1.3:10.0.1.1:10.0.1.1:255.255.255.0:zeus:eth0: root=/dev/nfs nfsroot=/nfsroot/cramfs,wsize=512,rsize=512,tcp nokgdb console=ttyUSB0,115200 memsize=252M" 1537CONFIG_CMDLINE=""
1423# CONFIG_CMDLINE_OVERRIDE is not set 1538# CONFIG_CMDLINE_OVERRIDE is not set
1424# CONFIG_DEBUG_STACK_USAGE is not set 1539# CONFIG_DEBUG_STACK_USAGE is not set
1425# CONFIG_RUNTIME_DEBUG is not set 1540# CONFIG_RUNTIME_DEBUG is not set
1541# CONFIG_SPINLOCK_TEST is not set
1426 1542
1427# 1543#
1428# Security options 1544# Security options
@@ -1430,13 +1546,16 @@ CONFIG_CMDLINE="rw dhash_entries=1024 ihash_entries=1024 ip=10.0.1.3:10.0.1.1:10
1430# CONFIG_KEYS is not set 1546# CONFIG_KEYS is not set
1431# CONFIG_SECURITY is not set 1547# CONFIG_SECURITY is not set
1432# CONFIG_SECURITYFS is not set 1548# CONFIG_SECURITYFS is not set
1433# CONFIG_SECURITY_FILE_CAPABILITIES is not set 1549# CONFIG_DEFAULT_SECURITY_SELINUX is not set
1550# CONFIG_DEFAULT_SECURITY_SMACK is not set
1551# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
1552CONFIG_DEFAULT_SECURITY_DAC=y
1553CONFIG_DEFAULT_SECURITY=""
1434CONFIG_CRYPTO=y 1554CONFIG_CRYPTO=y
1435 1555
1436# 1556#
1437# Crypto core or helper 1557# Crypto core or helper
1438# 1558#
1439# CONFIG_CRYPTO_FIPS is not set
1440CONFIG_CRYPTO_ALGAPI=y 1559CONFIG_CRYPTO_ALGAPI=y
1441CONFIG_CRYPTO_ALGAPI2=y 1560CONFIG_CRYPTO_ALGAPI2=y
1442CONFIG_CRYPTO_AEAD=y 1561CONFIG_CRYPTO_AEAD=y
@@ -1479,11 +1598,13 @@ CONFIG_CRYPTO_CBC=y
1479# 1598#
1480CONFIG_CRYPTO_HMAC=y 1599CONFIG_CRYPTO_HMAC=y
1481# CONFIG_CRYPTO_XCBC is not set 1600# CONFIG_CRYPTO_XCBC is not set
1601# CONFIG_CRYPTO_VMAC is not set
1482 1602
1483# 1603#
1484# Digest 1604# Digest
1485# 1605#
1486# CONFIG_CRYPTO_CRC32C is not set 1606# CONFIG_CRYPTO_CRC32C is not set
1607# CONFIG_CRYPTO_GHASH is not set
1487# CONFIG_CRYPTO_MD4 is not set 1608# CONFIG_CRYPTO_MD4 is not set
1488CONFIG_CRYPTO_MD5=y 1609CONFIG_CRYPTO_MD5=y
1489# CONFIG_CRYPTO_MICHAEL_MIC is not set 1610# CONFIG_CRYPTO_MICHAEL_MIC is not set
diff --git a/arch/mips/dec/Makefile b/arch/mips/dec/Makefile
index c530208ee154..9eb2f9c036aa 100644
--- a/arch/mips/dec/Makefile
+++ b/arch/mips/dec/Makefile
@@ -8,5 +8,3 @@ obj-y := ecc-berr.o int-handler.o ioasic-irq.o kn01-berr.o \
8obj-$(CONFIG_PROM_CONSOLE) += promcon.o 8obj-$(CONFIG_PROM_CONSOLE) += promcon.o
9obj-$(CONFIG_TC) += tc.o 9obj-$(CONFIG_TC) += tc.o
10obj-$(CONFIG_CPU_HAS_WB) += wbflush.o 10obj-$(CONFIG_CPU_HAS_WB) += wbflush.o
11
12EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/dec/Platform b/arch/mips/dec/Platform
new file mode 100644
index 000000000000..3adbcbd95db1
--- /dev/null
+++ b/arch/mips/dec/Platform
@@ -0,0 +1,8 @@
1#
2# DECstation family
3#
4platform-$(CONFIG_MACH_DECSTATION) = dec/
5cflags-$(CONFIG_MACH_DECSTATION) += \
6 -I$(srctree)/arch/mips/include/asm/mach-dec
7libs-$(CONFIG_MACH_DECSTATION) += arch/mips/dec/prom/
8load-$(CONFIG_MACH_DECSTATION) += 0xffffffff80040000
diff --git a/arch/mips/dec/promcon.c b/arch/mips/dec/promcon.c
index 9f0972f5a702..c239c25b79ff 100644
--- a/arch/mips/dec/promcon.c
+++ b/arch/mips/dec/promcon.c
@@ -33,8 +33,7 @@ static int __init prom_console_setup(struct console *co, char *options)
33 return 0; 33 return 0;
34} 34}
35 35
36static struct console sercons = 36static struct console sercons = {
37{
38 .name = "ttyS", 37 .name = "ttyS",
39 .write = prom_console_write, 38 .write = prom_console_write,
40 .setup = prom_console_setup, 39 .setup = prom_console_setup,
diff --git a/arch/mips/emma/Makefile b/arch/mips/emma/Makefile
new file mode 100644
index 000000000000..4254a31edb09
--- /dev/null
+++ b/arch/mips/emma/Makefile
@@ -0,0 +1,6 @@
1obj-$(CONFIG_SOC_EMMA2RH) += common/
2
3#
4# NEC EMMA2RH Mark-eins
5#
6obj-$(CONFIG_NEC_MARKEINS) += markeins/
diff --git a/arch/mips/emma/Platform b/arch/mips/emma/Platform
new file mode 100644
index 000000000000..0282f7f99b88
--- /dev/null
+++ b/arch/mips/emma/Platform
@@ -0,0 +1,4 @@
1platform-$(CONFIG_SOC_EMMA2RH) += emma/
2cflags-$(CONFIG_SOC_EMMA2RH) += \
3 -I$(srctree)/arch/mips/include/asm/mach-emma2rh
4load-$(CONFIG_NEC_MARKEINS) += 0xffffffff88100000
diff --git a/arch/mips/emma/markeins/irq.c b/arch/mips/emma/markeins/irq.c
index 9504b7ee0b7c..3a96799eb65f 100644
--- a/arch/mips/emma/markeins/irq.c
+++ b/arch/mips/emma/markeins/irq.c
@@ -301,7 +301,7 @@ void __init arch_init_irq(void)
301 /* setup cascade interrupts */ 301 /* setup cascade interrupts */
302 setup_irq(EMMA2RH_IRQ_BASE + EMMA2RH_SW_CASCADE, &irq_cascade); 302 setup_irq(EMMA2RH_IRQ_BASE + EMMA2RH_SW_CASCADE, &irq_cascade);
303 setup_irq(EMMA2RH_IRQ_BASE + EMMA2RH_GPIO_CASCADE, &irq_cascade); 303 setup_irq(EMMA2RH_IRQ_BASE + EMMA2RH_GPIO_CASCADE, &irq_cascade);
304 setup_irq(CPU_IRQ_BASE + CPU_EMMA2RH_CASCADE, &irq_cascade); 304 setup_irq(MIPS_CPU_IRQ_BASE + 2, &irq_cascade);
305} 305}
306 306
307asmlinkage void plat_irq_dispatch(void) 307asmlinkage void plat_irq_dispatch(void)
@@ -309,13 +309,13 @@ asmlinkage void plat_irq_dispatch(void)
309 unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM; 309 unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
310 310
311 if (pending & STATUSF_IP7) 311 if (pending & STATUSF_IP7)
312 do_IRQ(CPU_IRQ_BASE + 7); 312 do_IRQ(MIPS_CPU_IRQ_BASE + 7);
313 else if (pending & STATUSF_IP2) 313 else if (pending & STATUSF_IP2)
314 emma2rh_irq_dispatch(); 314 emma2rh_irq_dispatch();
315 else if (pending & STATUSF_IP1) 315 else if (pending & STATUSF_IP1)
316 do_IRQ(CPU_IRQ_BASE + 1); 316 do_IRQ(MIPS_CPU_IRQ_BASE + 1);
317 else if (pending & STATUSF_IP0) 317 else if (pending & STATUSF_IP0)
318 do_IRQ(CPU_IRQ_BASE + 0); 318 do_IRQ(MIPS_CPU_IRQ_BASE + 0);
319 else 319 else
320 spurious_interrupt(); 320 spurious_interrupt();
321} 321}
diff --git a/arch/mips/emma/markeins/setup.c b/arch/mips/emma/markeins/setup.c
index 9b3f51e5f140..feceebcfff42 100644
--- a/arch/mips/emma/markeins/setup.c
+++ b/arch/mips/emma/markeins/setup.c
@@ -52,7 +52,6 @@ static void markeins_machine_halt(void)
52 52
53static void markeins_machine_power_off(void) 53static void markeins_machine_power_off(void)
54{ 54{
55 printk("EMMA2RH Mark-eins halted. Please turn off the power.\n");
56 markeins_led("poweroff."); 55 markeins_led("poweroff.");
57 while (1) ; 56 while (1) ;
58} 57}
diff --git a/arch/mips/include/asm/arch_hweight.h b/arch/mips/include/asm/arch_hweight.h
new file mode 100644
index 000000000000..712a7445ee93
--- /dev/null
+++ b/arch/mips/include/asm/arch_hweight.h
@@ -0,0 +1,38 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 */
7#ifndef _ASM_ARCH_HWEIGHT_H
8#define _ASM_ARCH_HWEIGHT_H
9
10#ifdef ARCH_HAS_USABLE_BUILTIN_POPCOUNT
11
12#include <asm/types.h>
13
14static inline unsigned int __arch_hweight32(unsigned int w)
15{
16 return __builtin_popcount(w);
17}
18
19static inline unsigned int __arch_hweight16(unsigned int w)
20{
21 return __builtin_popcount(w & 0xffff);
22}
23
24static inline unsigned int __arch_hweight8(unsigned int w)
25{
26 return __builtin_popcount(w & 0xff);
27}
28
29static inline unsigned long __arch_hweight64(__u64 w)
30{
31 return __builtin_popcountll(w);
32}
33
34#else
35#include <asm-generic/bitops/arch_hweight.h>
36#endif
37
38#endif /* _ASM_ARCH_HWEIGHT_H */
diff --git a/arch/mips/include/asm/bitops.h b/arch/mips/include/asm/bitops.h
index 9255cfbee459..b0ce7ca2851f 100644
--- a/arch/mips/include/asm/bitops.h
+++ b/arch/mips/include/asm/bitops.h
@@ -700,7 +700,10 @@ static inline int ffs(int word)
700#ifdef __KERNEL__ 700#ifdef __KERNEL__
701 701
702#include <asm-generic/bitops/sched.h> 702#include <asm-generic/bitops/sched.h>
703#include <asm-generic/bitops/hweight.h> 703
704#include <asm/arch_hweight.h>
705#include <asm-generic/bitops/const_hweight.h>
706
704#include <asm-generic/bitops/ext2-non-atomic.h> 707#include <asm-generic/bitops/ext2-non-atomic.h>
705#include <asm-generic/bitops/ext2-atomic.h> 708#include <asm-generic/bitops/ext2-atomic.h>
706#include <asm-generic/bitops/minix.h> 709#include <asm-generic/bitops/minix.h>
diff --git a/arch/mips/include/asm/bootinfo.h b/arch/mips/include/asm/bootinfo.h
index 09eee09780f2..15a8ef0707c6 100644
--- a/arch/mips/include/asm/bootinfo.h
+++ b/arch/mips/include/asm/bootinfo.h
@@ -71,6 +71,12 @@
71#define MACH_LEMOTE_LL2F 7 71#define MACH_LEMOTE_LL2F 7
72#define MACH_LOONGSON_END 8 72#define MACH_LOONGSON_END 8
73 73
74/*
75 * Valid machtype for group INGENIC
76 */
77#define MACH_INGENIC_JZ4730 0 /* JZ4730 SOC */
78#define MACH_INGENIC_JZ4740 1 /* JZ4740 SOC */
79
74extern char *system_type; 80extern char *system_type;
75const char *get_system_type(void); 81const char *get_system_type(void);
76 82
diff --git a/arch/mips/include/asm/break.h b/arch/mips/include/asm/break.h
index 44437ed765e8..9161e684cb4c 100644
--- a/arch/mips/include/asm/break.h
+++ b/arch/mips/include/asm/break.h
@@ -30,6 +30,8 @@
30#define BRK_BUG 512 /* Used by BUG() */ 30#define BRK_BUG 512 /* Used by BUG() */
31#define BRK_KDB 513 /* Used in KDB_ENTER() */ 31#define BRK_KDB 513 /* Used in KDB_ENTER() */
32#define BRK_MEMU 514 /* Used by FPU emulator */ 32#define BRK_MEMU 514 /* Used by FPU emulator */
33#define BRK_KPROBE_BP 515 /* Kprobe break */
34#define BRK_KPROBE_SSTEPBP 516 /* Kprobe single step software implementation */
33#define BRK_MULOVF 1023 /* Multiply overflow */ 35#define BRK_MULOVF 1023 /* Multiply overflow */
34 36
35#endif /* __ASM_BREAK_H */ 37#endif /* __ASM_BREAK_H */
diff --git a/arch/mips/include/asm/cacheops.h b/arch/mips/include/asm/cacheops.h
index 256ad2cc6eb8..8f99c11ab665 100644
--- a/arch/mips/include/asm/cacheops.h
+++ b/arch/mips/include/asm/cacheops.h
@@ -62,6 +62,8 @@
62 * RM7000-specific cacheops 62 * RM7000-specific cacheops
63 */ 63 */
64#define Page_Invalidate_T 0x16 64#define Page_Invalidate_T 0x16
65#define Index_Store_Tag_T 0x0a
66#define Index_Load_Tag_T 0x06
65 67
66/* 68/*
67 * R10000-specific cacheops 69 * R10000-specific cacheops
diff --git a/arch/mips/include/asm/cop2.h b/arch/mips/include/asm/cop2.h
index 6b04c98b7fad..2cb2f0c2c4f8 100644
--- a/arch/mips/include/asm/cop2.h
+++ b/arch/mips/include/asm/cop2.h
@@ -9,6 +9,8 @@
9#ifndef __ASM_COP2_H 9#ifndef __ASM_COP2_H
10#define __ASM_COP2_H 10#define __ASM_COP2_H
11 11
12#include <linux/notifier.h>
13
12enum cu2_ops { 14enum cu2_ops {
13 CU2_EXCEPTION, 15 CU2_EXCEPTION,
14 CU2_LWC2_OP, 16 CU2_LWC2_OP,
@@ -20,4 +22,14 @@ enum cu2_ops {
20extern int register_cu2_notifier(struct notifier_block *nb); 22extern int register_cu2_notifier(struct notifier_block *nb);
21extern int cu2_notifier_call_chain(unsigned long val, void *v); 23extern int cu2_notifier_call_chain(unsigned long val, void *v);
22 24
25#define cu2_notifier(fn, pri) \
26({ \
27 static struct notifier_block fn##_nb __cpuinitdata = { \
28 .notifier_call = fn, \
29 .priority = pri \
30 }; \
31 \
32 register_cu2_notifier(&fn##_nb); \
33})
34
23#endif /* __ASM_COP2_H */ 35#endif /* __ASM_COP2_H */
diff --git a/arch/mips/include/asm/cpu-features.h b/arch/mips/include/asm/cpu-features.h
index ac73cede3a0a..ca400f7c3f59 100644
--- a/arch/mips/include/asm/cpu-features.h
+++ b/arch/mips/include/asm/cpu-features.h
@@ -159,7 +159,8 @@
159 159
160/* 160/*
161 * MIPS32, MIPS64, VR5500, IDT32332, IDT32334 and maybe a few other 161 * MIPS32, MIPS64, VR5500, IDT32332, IDT32334 and maybe a few other
162 * pre-MIPS32/MIPS53 processors have CLO, CLZ. For 64-bit kernels 162 * pre-MIPS32/MIPS53 processors have CLO, CLZ. The IDT RC64574 is 64-bit and
163 * has CLO and CLZ but not DCLO nor DCLZ. For 64-bit kernels
163 * cpu_has_clo_clz also indicates the availability of DCLO and DCLZ. 164 * cpu_has_clo_clz also indicates the availability of DCLO and DCLZ.
164 */ 165 */
165# ifndef cpu_has_clo_clz 166# ifndef cpu_has_clo_clz
diff --git a/arch/mips/include/asm/cpu.h b/arch/mips/include/asm/cpu.h
index a5acda416946..b201a8f5b127 100644
--- a/arch/mips/include/asm/cpu.h
+++ b/arch/mips/include/asm/cpu.h
@@ -34,7 +34,7 @@
34#define PRID_COMP_LSI 0x080000 34#define PRID_COMP_LSI 0x080000
35#define PRID_COMP_LEXRA 0x0b0000 35#define PRID_COMP_LEXRA 0x0b0000
36#define PRID_COMP_CAVIUM 0x0d0000 36#define PRID_COMP_CAVIUM 0x0d0000
37 37#define PRID_COMP_INGENIC 0xd00000
38 38
39/* 39/*
40 * Assigned values for the product ID register. In order to detect a 40 * Assigned values for the product ID register. In order to detect a
@@ -133,6 +133,12 @@
133#define PRID_IMP_CAVIUM_CN52XX 0x0700 133#define PRID_IMP_CAVIUM_CN52XX 0x0700
134 134
135/* 135/*
136 * These are the PRID's for when 23:16 == PRID_COMP_INGENIC
137 */
138
139#define PRID_IMP_JZRISC 0x0200
140
141/*
136 * Definitions for 7:0 on legacy processors 142 * Definitions for 7:0 on legacy processors
137 */ 143 */
138 144
@@ -219,6 +225,7 @@ enum cpu_type_enum {
219 CPU_4KC, CPU_4KEC, CPU_4KSC, CPU_24K, CPU_34K, CPU_1004K, CPU_74K, 225 CPU_4KC, CPU_4KEC, CPU_4KSC, CPU_24K, CPU_34K, CPU_1004K, CPU_74K,
220 CPU_ALCHEMY, CPU_PR4450, CPU_BCM3302, CPU_BCM4710, 226 CPU_ALCHEMY, CPU_PR4450, CPU_BCM3302, CPU_BCM4710,
221 CPU_BCM6338, CPU_BCM6345, CPU_BCM6348, CPU_BCM6358, 227 CPU_BCM6338, CPU_BCM6345, CPU_BCM6348, CPU_BCM6358,
228 CPU_JZRISC,
222 229
223 /* 230 /*
224 * MIPS64 class processors 231 * MIPS64 class processors
diff --git a/arch/mips/include/asm/elf.h b/arch/mips/include/asm/elf.h
index ea77a42c5f8c..fd1d39eb7431 100644
--- a/arch/mips/include/asm/elf.h
+++ b/arch/mips/include/asm/elf.h
@@ -372,4 +372,9 @@ extern const char *__elf_platform;
372struct linux_binprm; 372struct linux_binprm;
373extern int arch_setup_additional_pages(struct linux_binprm *bprm, 373extern int arch_setup_additional_pages(struct linux_binprm *bprm,
374 int uses_interp); 374 int uses_interp);
375
376struct mm_struct;
377extern unsigned long arch_randomize_brk(struct mm_struct *mm);
378#define arch_randomize_brk arch_randomize_brk
379
375#endif /* _ASM_ELF_H */ 380#endif /* _ASM_ELF_H */
diff --git a/arch/mips/include/asm/emma/emma2rh.h b/arch/mips/include/asm/emma/emma2rh.h
index 2afb2fe11b30..c1449d20ef0e 100644
--- a/arch/mips/include/asm/emma/emma2rh.h
+++ b/arch/mips/include/asm/emma/emma2rh.h
@@ -99,88 +99,22 @@
99#define EMMA2RH_PCI_CONFIG_BASE EMMA2RH_PCI_IO_BASE 99#define EMMA2RH_PCI_CONFIG_BASE EMMA2RH_PCI_IO_BASE
100#define EMMA2RH_PCI_CONFIG_SIZE EMMA2RH_PCI_IO_SIZE 100#define EMMA2RH_PCI_CONFIG_SIZE EMMA2RH_PCI_IO_SIZE
101 101
102#define NUM_CPU_IRQ 8
103#define NUM_EMMA2RH_IRQ 96 102#define NUM_EMMA2RH_IRQ 96
104 103
105#define CPU_EMMA2RH_CASCADE 2 104#define EMMA2RH_IRQ_BASE (MIPS_CPU_IRQ_BASE + 8)
106#define CPU_IRQ_BASE MIPS_CPU_IRQ_BASE
107#define EMMA2RH_IRQ_BASE (CPU_IRQ_BASE + NUM_CPU_IRQ)
108 105
109/* 106/*
110 * emma2rh irq defs 107 * emma2rh irq defs
111 */ 108 */
112 109
113#define EMMA2RH_IRQ_INT0 (0 + EMMA2RH_IRQ_BASE) 110#define EMMA2RH_IRQ_INT(n) (EMMA2RH_IRQ_BASE + (n))
114#define EMMA2RH_IRQ_INT1 (1 + EMMA2RH_IRQ_BASE) 111
115#define EMMA2RH_IRQ_INT2 (2 + EMMA2RH_IRQ_BASE) 112#define EMMA2RH_IRQ_PFUR0 EMMA2RH_IRQ_INT(49)
116#define EMMA2RH_IRQ_INT3 (3 + EMMA2RH_IRQ_BASE) 113#define EMMA2RH_IRQ_PFUR1 EMMA2RH_IRQ_INT(50)
117#define EMMA2RH_IRQ_INT4 (4 + EMMA2RH_IRQ_BASE) 114#define EMMA2RH_IRQ_PFUR2 EMMA2RH_IRQ_INT(51)
118#define EMMA2RH_IRQ_INT5 (5 + EMMA2RH_IRQ_BASE) 115#define EMMA2RH_IRQ_PIIC0 EMMA2RH_IRQ_INT(56)
119#define EMMA2RH_IRQ_INT6 (6 + EMMA2RH_IRQ_BASE) 116#define EMMA2RH_IRQ_PIIC1 EMMA2RH_IRQ_INT(57)
120#define EMMA2RH_IRQ_INT7 (7 + EMMA2RH_IRQ_BASE) 117#define EMMA2RH_IRQ_PIIC2 EMMA2RH_IRQ_INT(58)
121#define EMMA2RH_IRQ_INT8 (8 + EMMA2RH_IRQ_BASE)
122#define EMMA2RH_IRQ_INT9 (9 + EMMA2RH_IRQ_BASE)
123#define EMMA2RH_IRQ_INT10 (10 + EMMA2RH_IRQ_BASE)
124#define EMMA2RH_IRQ_INT11 (11 + EMMA2RH_IRQ_BASE)
125#define EMMA2RH_IRQ_INT12 (12 + EMMA2RH_IRQ_BASE)
126#define EMMA2RH_IRQ_INT13 (13 + EMMA2RH_IRQ_BASE)
127#define EMMA2RH_IRQ_INT14 (14 + EMMA2RH_IRQ_BASE)
128#define EMMA2RH_IRQ_INT15 (15 + EMMA2RH_IRQ_BASE)
129#define EMMA2RH_IRQ_INT16 (16 + EMMA2RH_IRQ_BASE)
130#define EMMA2RH_IRQ_INT17 (17 + EMMA2RH_IRQ_BASE)
131#define EMMA2RH_IRQ_INT18 (18 + EMMA2RH_IRQ_BASE)
132#define EMMA2RH_IRQ_INT19 (19 + EMMA2RH_IRQ_BASE)
133#define EMMA2RH_IRQ_INT20 (20 + EMMA2RH_IRQ_BASE)
134#define EMMA2RH_IRQ_INT21 (21 + EMMA2RH_IRQ_BASE)
135#define EMMA2RH_IRQ_INT22 (22 + EMMA2RH_IRQ_BASE)
136#define EMMA2RH_IRQ_INT23 (23 + EMMA2RH_IRQ_BASE)
137#define EMMA2RH_IRQ_INT24 (24 + EMMA2RH_IRQ_BASE)
138#define EMMA2RH_IRQ_INT25 (25 + EMMA2RH_IRQ_BASE)
139#define EMMA2RH_IRQ_INT26 (26 + EMMA2RH_IRQ_BASE)
140#define EMMA2RH_IRQ_INT27 (27 + EMMA2RH_IRQ_BASE)
141#define EMMA2RH_IRQ_INT28 (28 + EMMA2RH_IRQ_BASE)
142#define EMMA2RH_IRQ_INT29 (29 + EMMA2RH_IRQ_BASE)
143#define EMMA2RH_IRQ_INT30 (30 + EMMA2RH_IRQ_BASE)
144#define EMMA2RH_IRQ_INT31 (31 + EMMA2RH_IRQ_BASE)
145#define EMMA2RH_IRQ_INT32 (32 + EMMA2RH_IRQ_BASE)
146#define EMMA2RH_IRQ_INT33 (33 + EMMA2RH_IRQ_BASE)
147#define EMMA2RH_IRQ_INT34 (34 + EMMA2RH_IRQ_BASE)
148#define EMMA2RH_IRQ_INT35 (35 + EMMA2RH_IRQ_BASE)
149#define EMMA2RH_IRQ_INT36 (36 + EMMA2RH_IRQ_BASE)
150#define EMMA2RH_IRQ_INT37 (37 + EMMA2RH_IRQ_BASE)
151#define EMMA2RH_IRQ_INT38 (38 + EMMA2RH_IRQ_BASE)
152#define EMMA2RH_IRQ_INT39 (39 + EMMA2RH_IRQ_BASE)
153#define EMMA2RH_IRQ_INT40 (40 + EMMA2RH_IRQ_BASE)
154#define EMMA2RH_IRQ_INT41 (41 + EMMA2RH_IRQ_BASE)
155#define EMMA2RH_IRQ_INT42 (42 + EMMA2RH_IRQ_BASE)
156#define EMMA2RH_IRQ_INT43 (43 + EMMA2RH_IRQ_BASE)
157#define EMMA2RH_IRQ_INT44 (44 + EMMA2RH_IRQ_BASE)
158#define EMMA2RH_IRQ_INT45 (45 + EMMA2RH_IRQ_BASE)
159#define EMMA2RH_IRQ_INT46 (46 + EMMA2RH_IRQ_BASE)
160#define EMMA2RH_IRQ_INT47 (47 + EMMA2RH_IRQ_BASE)
161#define EMMA2RH_IRQ_INT48 (48 + EMMA2RH_IRQ_BASE)
162#define EMMA2RH_IRQ_INT49 (49 + EMMA2RH_IRQ_BASE)
163#define EMMA2RH_IRQ_INT50 (50 + EMMA2RH_IRQ_BASE)
164#define EMMA2RH_IRQ_INT51 (51 + EMMA2RH_IRQ_BASE)
165#define EMMA2RH_IRQ_INT52 (52 + EMMA2RH_IRQ_BASE)
166#define EMMA2RH_IRQ_INT53 (53 + EMMA2RH_IRQ_BASE)
167#define EMMA2RH_IRQ_INT54 (54 + EMMA2RH_IRQ_BASE)
168#define EMMA2RH_IRQ_INT55 (55 + EMMA2RH_IRQ_BASE)
169#define EMMA2RH_IRQ_INT56 (56 + EMMA2RH_IRQ_BASE)
170#define EMMA2RH_IRQ_INT57 (57 + EMMA2RH_IRQ_BASE)
171#define EMMA2RH_IRQ_INT58 (58 + EMMA2RH_IRQ_BASE)
172#define EMMA2RH_IRQ_INT59 (59 + EMMA2RH_IRQ_BASE)
173#define EMMA2RH_IRQ_INT60 (60 + EMMA2RH_IRQ_BASE)
174#define EMMA2RH_IRQ_INT61 (61 + EMMA2RH_IRQ_BASE)
175#define EMMA2RH_IRQ_INT62 (62 + EMMA2RH_IRQ_BASE)
176#define EMMA2RH_IRQ_INT63 (63 + EMMA2RH_IRQ_BASE)
177
178#define EMMA2RH_IRQ_PFUR0 EMMA2RH_IRQ_INT49
179#define EMMA2RH_IRQ_PFUR1 EMMA2RH_IRQ_INT50
180#define EMMA2RH_IRQ_PFUR2 EMMA2RH_IRQ_INT51
181#define EMMA2RH_IRQ_PIIC0 EMMA2RH_IRQ_INT56
182#define EMMA2RH_IRQ_PIIC1 EMMA2RH_IRQ_INT57
183#define EMMA2RH_IRQ_PIIC2 EMMA2RH_IRQ_INT58
184 118
185/* 119/*
186 * EMMA2RH Register Access 120 * EMMA2RH Register Access
diff --git a/arch/mips/include/asm/emma/markeins.h b/arch/mips/include/asm/emma/markeins.h
index 2618bf230248..bf2d229c2dae 100644
--- a/arch/mips/include/asm/emma/markeins.h
+++ b/arch/mips/include/asm/emma/markeins.h
@@ -25,44 +25,13 @@
25#define NUM_EMMA2RH_IRQ_SW 32 25#define NUM_EMMA2RH_IRQ_SW 32
26#define NUM_EMMA2RH_IRQ_GPIO 32 26#define NUM_EMMA2RH_IRQ_GPIO 32
27 27
28#define EMMA2RH_SW_CASCADE (EMMA2RH_IRQ_INT7 - EMMA2RH_IRQ_INT0) 28#define EMMA2RH_SW_CASCADE (EMMA2RH_IRQ_INT(7) - EMMA2RH_IRQ_INT(0))
29#define EMMA2RH_GPIO_CASCADE (EMMA2RH_IRQ_INT46 - EMMA2RH_IRQ_INT0) 29#define EMMA2RH_GPIO_CASCADE (EMMA2RH_IRQ_INT(46) - EMMA2RH_IRQ_INT(0))
30 30
31#define EMMA2RH_SW_IRQ_BASE (EMMA2RH_IRQ_BASE + NUM_EMMA2RH_IRQ) 31#define EMMA2RH_SW_IRQ_BASE (EMMA2RH_IRQ_BASE + NUM_EMMA2RH_IRQ)
32#define EMMA2RH_GPIO_IRQ_BASE (EMMA2RH_SW_IRQ_BASE + NUM_EMMA2RH_IRQ_SW) 32#define EMMA2RH_GPIO_IRQ_BASE (EMMA2RH_SW_IRQ_BASE + NUM_EMMA2RH_IRQ_SW)
33 33
34#define EMMA2RH_SW_IRQ_INT0 (0+EMMA2RH_SW_IRQ_BASE) 34#define EMMA2RH_SW_IRQ_INT(n) (EMMA2RH_SW_IRQ_BASE + (n))
35#define EMMA2RH_SW_IRQ_INT1 (1+EMMA2RH_SW_IRQ_BASE)
36#define EMMA2RH_SW_IRQ_INT2 (2+EMMA2RH_SW_IRQ_BASE)
37#define EMMA2RH_SW_IRQ_INT3 (3+EMMA2RH_SW_IRQ_BASE)
38#define EMMA2RH_SW_IRQ_INT4 (4+EMMA2RH_SW_IRQ_BASE)
39#define EMMA2RH_SW_IRQ_INT5 (5+EMMA2RH_SW_IRQ_BASE)
40#define EMMA2RH_SW_IRQ_INT6 (6+EMMA2RH_SW_IRQ_BASE)
41#define EMMA2RH_SW_IRQ_INT7 (7+EMMA2RH_SW_IRQ_BASE)
42#define EMMA2RH_SW_IRQ_INT8 (8+EMMA2RH_SW_IRQ_BASE)
43#define EMMA2RH_SW_IRQ_INT9 (9+EMMA2RH_SW_IRQ_BASE)
44#define EMMA2RH_SW_IRQ_INT10 (10+EMMA2RH_SW_IRQ_BASE)
45#define EMMA2RH_SW_IRQ_INT11 (11+EMMA2RH_SW_IRQ_BASE)
46#define EMMA2RH_SW_IRQ_INT12 (12+EMMA2RH_SW_IRQ_BASE)
47#define EMMA2RH_SW_IRQ_INT13 (13+EMMA2RH_SW_IRQ_BASE)
48#define EMMA2RH_SW_IRQ_INT14 (14+EMMA2RH_SW_IRQ_BASE)
49#define EMMA2RH_SW_IRQ_INT15 (15+EMMA2RH_SW_IRQ_BASE)
50#define EMMA2RH_SW_IRQ_INT16 (16+EMMA2RH_SW_IRQ_BASE)
51#define EMMA2RH_SW_IRQ_INT17 (17+EMMA2RH_SW_IRQ_BASE)
52#define EMMA2RH_SW_IRQ_INT18 (18+EMMA2RH_SW_IRQ_BASE)
53#define EMMA2RH_SW_IRQ_INT19 (19+EMMA2RH_SW_IRQ_BASE)
54#define EMMA2RH_SW_IRQ_INT20 (20+EMMA2RH_SW_IRQ_BASE)
55#define EMMA2RH_SW_IRQ_INT21 (21+EMMA2RH_SW_IRQ_BASE)
56#define EMMA2RH_SW_IRQ_INT22 (22+EMMA2RH_SW_IRQ_BASE)
57#define EMMA2RH_SW_IRQ_INT23 (23+EMMA2RH_SW_IRQ_BASE)
58#define EMMA2RH_SW_IRQ_INT24 (24+EMMA2RH_SW_IRQ_BASE)
59#define EMMA2RH_SW_IRQ_INT25 (25+EMMA2RH_SW_IRQ_BASE)
60#define EMMA2RH_SW_IRQ_INT26 (26+EMMA2RH_SW_IRQ_BASE)
61#define EMMA2RH_SW_IRQ_INT27 (27+EMMA2RH_SW_IRQ_BASE)
62#define EMMA2RH_SW_IRQ_INT28 (28+EMMA2RH_SW_IRQ_BASE)
63#define EMMA2RH_SW_IRQ_INT29 (29+EMMA2RH_SW_IRQ_BASE)
64#define EMMA2RH_SW_IRQ_INT30 (30+EMMA2RH_SW_IRQ_BASE)
65#define EMMA2RH_SW_IRQ_INT31 (31+EMMA2RH_SW_IRQ_BASE)
66 35
67#define MARKEINS_PCI_IRQ_INTA EMMA2RH_GPIO_IRQ_BASE+15 36#define MARKEINS_PCI_IRQ_INTA EMMA2RH_GPIO_IRQ_BASE+15
68#define MARKEINS_PCI_IRQ_INTB EMMA2RH_GPIO_IRQ_BASE+16 37#define MARKEINS_PCI_IRQ_INTB EMMA2RH_GPIO_IRQ_BASE+16
diff --git a/arch/mips/include/asm/hazards.h b/arch/mips/include/asm/hazards.h
index 0eaf77ffbc4f..4e332165d7b7 100644
--- a/arch/mips/include/asm/hazards.h
+++ b/arch/mips/include/asm/hazards.h
@@ -87,7 +87,7 @@ do { \
87 : "=r" (tmp)); \ 87 : "=r" (tmp)); \
88} while (0) 88} while (0)
89 89
90#elif defined(CONFIG_CPU_MIPSR1) && !defined(CONFIG_MACH_ALCHEMY) 90#elif defined(CONFIG_CPU_MIPSR1) && !defined(CONFIG_MIPS_ALCHEMY)
91 91
92/* 92/*
93 * These are slightly complicated by the fact that we guarantee R1 kernels to 93 * These are slightly complicated by the fact that we guarantee R1 kernels to
@@ -138,7 +138,7 @@ do { \
138 __instruction_hazard(); \ 138 __instruction_hazard(); \
139} while (0) 139} while (0)
140 140
141#elif defined(CONFIG_MACH_ALCHEMY) || defined(CONFIG_CPU_CAVIUM_OCTEON) || \ 141#elif defined(CONFIG_MIPS_ALCHEMY) || defined(CONFIG_CPU_CAVIUM_OCTEON) || \
142 defined(CONFIG_CPU_LOONGSON2) || defined(CONFIG_CPU_R10000) || \ 142 defined(CONFIG_CPU_LOONGSON2) || defined(CONFIG_CPU_R10000) || \
143 defined(CONFIG_CPU_R5500) 143 defined(CONFIG_CPU_R5500)
144 144
diff --git a/arch/mips/include/asm/inst.h b/arch/mips/include/asm/inst.h
index 6489f00731ca..444ff71aa0e8 100644
--- a/arch/mips/include/asm/inst.h
+++ b/arch/mips/include/asm/inst.h
@@ -247,6 +247,12 @@ struct ma_format { /* FPU multipy and add format (MIPS IV) */
247 unsigned int fmt : 2; 247 unsigned int fmt : 2;
248}; 248};
249 249
250struct b_format { /* BREAK and SYSCALL */
251 unsigned int opcode:6;
252 unsigned int code:20;
253 unsigned int func:6;
254};
255
250#elif defined(__MIPSEL__) 256#elif defined(__MIPSEL__)
251 257
252struct j_format { /* Jump format */ 258struct j_format { /* Jump format */
@@ -314,6 +320,12 @@ struct ma_format { /* FPU multipy and add format (MIPS IV) */
314 unsigned int opcode : 6; 320 unsigned int opcode : 6;
315}; 321};
316 322
323struct b_format { /* BREAK and SYSCALL */
324 unsigned int func:6;
325 unsigned int code:20;
326 unsigned int opcode:6;
327};
328
317#else /* !defined (__MIPSEB__) && !defined (__MIPSEL__) */ 329#else /* !defined (__MIPSEB__) && !defined (__MIPSEL__) */
318#error "MIPS but neither __MIPSEL__ nor __MIPSEB__?" 330#error "MIPS but neither __MIPSEL__ nor __MIPSEB__?"
319#endif 331#endif
@@ -328,7 +340,8 @@ union mips_instruction {
328 struct c_format c_format; 340 struct c_format c_format;
329 struct r_format r_format; 341 struct r_format r_format;
330 struct f_format f_format; 342 struct f_format f_format;
331 struct ma_format ma_format; 343 struct ma_format ma_format;
344 struct b_format b_format;
332}; 345};
333 346
334/* HACHACHAHCAHC ... */ 347/* HACHACHAHCAHC ... */
diff --git a/arch/mips/include/asm/kdebug.h b/arch/mips/include/asm/kdebug.h
index 5bf62aafc890..6a9af5fcb5d7 100644
--- a/arch/mips/include/asm/kdebug.h
+++ b/arch/mips/include/asm/kdebug.h
@@ -8,6 +8,9 @@ enum die_val {
8 DIE_FP, 8 DIE_FP,
9 DIE_TRAP, 9 DIE_TRAP,
10 DIE_RI, 10 DIE_RI,
11 DIE_PAGE_FAULT,
12 DIE_BREAK,
13 DIE_SSTEPBP
11}; 14};
12 15
13#endif /* _ASM_MIPS_KDEBUG_H */ 16#endif /* _ASM_MIPS_KDEBUG_H */
diff --git a/arch/mips/include/asm/kgdb.h b/arch/mips/include/asm/kgdb.h
index 19002d605ac4..e6c0b0e14ccb 100644
--- a/arch/mips/include/asm/kgdb.h
+++ b/arch/mips/include/asm/kgdb.h
@@ -8,28 +8,27 @@
8#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2) || \ 8#if (_MIPS_ISA == _MIPS_ISA_MIPS1) || (_MIPS_ISA == _MIPS_ISA_MIPS2) || \
9 (_MIPS_ISA == _MIPS_ISA_MIPS32) 9 (_MIPS_ISA == _MIPS_ISA_MIPS32)
10 10
11#define KGDB_GDB_REG_SIZE 32 11#define KGDB_GDB_REG_SIZE 32
12#define GDB_SIZEOF_REG sizeof(u32)
12 13
13#elif (_MIPS_ISA == _MIPS_ISA_MIPS3) || (_MIPS_ISA == _MIPS_ISA_MIPS4) || \ 14#elif (_MIPS_ISA == _MIPS_ISA_MIPS3) || (_MIPS_ISA == _MIPS_ISA_MIPS4) || \
14 (_MIPS_ISA == _MIPS_ISA_MIPS64) 15 (_MIPS_ISA == _MIPS_ISA_MIPS64)
15 16
16#ifdef CONFIG_32BIT 17#ifdef CONFIG_32BIT
17#define KGDB_GDB_REG_SIZE 32 18#define KGDB_GDB_REG_SIZE 32
19#define GDB_SIZEOF_REG sizeof(u32)
18#else /* CONFIG_CPU_32BIT */ 20#else /* CONFIG_CPU_32BIT */
19#define KGDB_GDB_REG_SIZE 64 21#define KGDB_GDB_REG_SIZE 64
22#define GDB_SIZEOF_REG sizeof(u64)
20#endif 23#endif
21#else 24#else
22#error "Need to set KGDB_GDB_REG_SIZE for MIPS ISA" 25#error "Need to set KGDB_GDB_REG_SIZE for MIPS ISA"
23#endif /* _MIPS_ISA */ 26#endif /* _MIPS_ISA */
24 27
25#define BUFMAX 2048 28#define BUFMAX 2048
26#if (KGDB_GDB_REG_SIZE == 32) 29#define DBG_MAX_REG_NUM 72
27#define NUMREGBYTES (90*sizeof(u32)) 30#define NUMREGBYTES (DBG_MAX_REG_NUM * sizeof(GDB_SIZEOF_REG))
28#define NUMCRITREGBYTES (12*sizeof(u32)) 31#define NUMCRITREGBYTES (12 * sizeof(GDB_SIZEOF_REG))
29#else
30#define NUMREGBYTES (90*sizeof(u64))
31#define NUMCRITREGBYTES (12*sizeof(u64))
32#endif
33#define BREAK_INSTR_SIZE 4 32#define BREAK_INSTR_SIZE 4
34#define CACHE_FLUSH_IS_SAFE 0 33#define CACHE_FLUSH_IS_SAFE 0
35 34
diff --git a/arch/mips/include/asm/kprobes.h b/arch/mips/include/asm/kprobes.h
new file mode 100644
index 000000000000..e6ea4d4d7205
--- /dev/null
+++ b/arch/mips/include/asm/kprobes.h
@@ -0,0 +1,92 @@
1/*
2 * Kernel Probes (KProbes)
3 * include/asm-mips/kprobes.h
4 *
5 * Copyright 2006 Sony Corp.
6 * Copyright 2010 Cavium Networks
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; version 2 of the License.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 */
21
22#ifndef _ASM_KPROBES_H
23#define _ASM_KPROBES_H
24
25#include <linux/ptrace.h>
26#include <linux/types.h>
27
28#include <asm/cacheflush.h>
29#include <asm/kdebug.h>
30#include <asm/inst.h>
31
32#define __ARCH_WANT_KPROBES_INSN_SLOT
33
34struct kprobe;
35struct pt_regs;
36
37typedef union mips_instruction kprobe_opcode_t;
38
39#define MAX_INSN_SIZE 2
40
41#define flush_insn_slot(p) \
42do { \
43 flush_icache_range((unsigned long)p->addr, \
44 (unsigned long)p->addr + \
45 (MAX_INSN_SIZE * sizeof(kprobe_opcode_t))); \
46} while (0)
47
48
49#define kretprobe_blacklist_size 0
50
51void arch_remove_kprobe(struct kprobe *p);
52
53/* Architecture specific copy of original instruction*/
54struct arch_specific_insn {
55 /* copy of the original instruction */
56 kprobe_opcode_t *insn;
57};
58
59struct prev_kprobe {
60 struct kprobe *kp;
61 unsigned long status;
62 unsigned long old_SR;
63 unsigned long saved_SR;
64 unsigned long saved_epc;
65};
66
67#define MAX_JPROBES_STACK_SIZE 128
68#define MAX_JPROBES_STACK_ADDR \
69 (((unsigned long)current_thread_info()) + THREAD_SIZE - 32 - sizeof(struct pt_regs))
70
71#define MIN_JPROBES_STACK_SIZE(ADDR) \
72 ((((ADDR) + MAX_JPROBES_STACK_SIZE) > MAX_JPROBES_STACK_ADDR) \
73 ? MAX_JPROBES_STACK_ADDR - (ADDR) \
74 : MAX_JPROBES_STACK_SIZE)
75
76
77/* per-cpu kprobe control block */
78struct kprobe_ctlblk {
79 unsigned long kprobe_status;
80 unsigned long kprobe_old_SR;
81 unsigned long kprobe_saved_SR;
82 unsigned long kprobe_saved_epc;
83 unsigned long jprobe_saved_sp;
84 struct pt_regs jprobe_saved_regs;
85 u8 jprobes_stack[MAX_JPROBES_STACK_SIZE];
86 struct prev_kprobe prev_kprobe;
87};
88
89extern int kprobe_exceptions_notify(struct notifier_block *self,
90 unsigned long val, void *data);
91
92#endif /* _ASM_KPROBES_H */
diff --git a/arch/mips/include/asm/local64.h b/arch/mips/include/asm/local64.h
new file mode 100644
index 000000000000..36c93b5cc239
--- /dev/null
+++ b/arch/mips/include/asm/local64.h
@@ -0,0 +1 @@
#include <asm-generic/local64.h>
diff --git a/arch/mips/include/asm/mach-au1x00/au1xxx_eth.h b/arch/mips/include/asm/mach-au1x00/au1xxx_eth.h
index bae9b758fcde..49dc8d9db186 100644
--- a/arch/mips/include/asm/mach-au1x00/au1xxx_eth.h
+++ b/arch/mips/include/asm/mach-au1x00/au1xxx_eth.h
@@ -9,6 +9,7 @@ struct au1000_eth_platform_data {
9 int phy_addr; 9 int phy_addr;
10 int phy_busid; 10 int phy_busid;
11 int phy_irq; 11 int phy_irq;
12 char mac[6];
12}; 13};
13 14
14void __init au1xxx_override_eth_cfg(unsigned port, 15void __init au1xxx_override_eth_cfg(unsigned port,
diff --git a/arch/mips/include/asm/mach-bcm47xx/nvram.h b/arch/mips/include/asm/mach-bcm47xx/nvram.h
index 0d8cc146f7a4..c58ebd8bc155 100644
--- a/arch/mips/include/asm/mach-bcm47xx/nvram.h
+++ b/arch/mips/include/asm/mach-bcm47xx/nvram.h
@@ -31,6 +31,9 @@ struct nvram_header {
31#define NVRAM_MAX_VALUE_LEN 255 31#define NVRAM_MAX_VALUE_LEN 255
32#define NVRAM_MAX_PARAM_LEN 64 32#define NVRAM_MAX_PARAM_LEN 64
33 33
34#define NVRAM_ERR_INV_PARAM -8
35#define NVRAM_ERR_ENVNOTFOUND -9
36
34extern int nvram_getenv(char *name, char *val, size_t val_len); 37extern int nvram_getenv(char *name, char *val, size_t val_len);
35 38
36#endif 39#endif
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 bbf054042395..b952fc7215e2 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
@@ -61,21 +61,18 @@
61 61
62#define kernel_uses_smartmips_rixi (cpu_data[0].cputype == CPU_CAVIUM_OCTEON_PLUS) 62#define kernel_uses_smartmips_rixi (cpu_data[0].cputype == CPU_CAVIUM_OCTEON_PLUS)
63 63
64#define ARCH_HAS_READ_CURRENT_TIMER 1
65#define ARCH_HAS_IRQ_PER_CPU 1 64#define ARCH_HAS_IRQ_PER_CPU 1
66#define ARCH_HAS_SPINLOCK_PREFETCH 1 65#define ARCH_HAS_SPINLOCK_PREFETCH 1
67#define spin_lock_prefetch(x) prefetch(x) 66#define spin_lock_prefetch(x) prefetch(x)
68#define PREFETCH_STRIDE 128 67#define PREFETCH_STRIDE 128
69 68
70static inline int read_current_timer(unsigned long *result) 69#ifdef __OCTEON__
71{ 70/*
72 asm volatile ("rdhwr %0,$31\n" 71 * All gcc versions that have OCTEON support define __OCTEON__ and have the
73#ifndef CONFIG_64BIT 72 * __builtin_popcount support.
74 "\tsll %0, 0" 73 */
74#define ARCH_HAS_USABLE_BUILTIN_POPCOUNT 1
75#endif 75#endif
76 : "=r" (*result));
77 return 0;
78}
79 76
80static inline int octeon_has_saa(void) 77static inline int octeon_has_saa(void)
81{ 78{
diff --git a/arch/mips/include/asm/mach-cavium-octeon/irq.h b/arch/mips/include/asm/mach-cavium-octeon/irq.h
index d32220fbf4f1..6ddab8aef644 100644
--- a/arch/mips/include/asm/mach-cavium-octeon/irq.h
+++ b/arch/mips/include/asm/mach-cavium-octeon/irq.h
@@ -172,71 +172,9 @@
172#ifdef CONFIG_PCI_MSI 172#ifdef CONFIG_PCI_MSI
173/* 152 - 215 represent the MSI interrupts 0-63 */ 173/* 152 - 215 represent the MSI interrupts 0-63 */
174#define OCTEON_IRQ_MSI_BIT0 152 174#define OCTEON_IRQ_MSI_BIT0 152
175#define OCTEON_IRQ_MSI_BIT1 153 175#define OCTEON_IRQ_MSI_LAST (OCTEON_IRQ_MSI_BIT0 + 255)
176#define OCTEON_IRQ_MSI_BIT2 154
177#define OCTEON_IRQ_MSI_BIT3 155
178#define OCTEON_IRQ_MSI_BIT4 156
179#define OCTEON_IRQ_MSI_BIT5 157
180#define OCTEON_IRQ_MSI_BIT6 158
181#define OCTEON_IRQ_MSI_BIT7 159
182#define OCTEON_IRQ_MSI_BIT8 160
183#define OCTEON_IRQ_MSI_BIT9 161
184#define OCTEON_IRQ_MSI_BIT10 162
185#define OCTEON_IRQ_MSI_BIT11 163
186#define OCTEON_IRQ_MSI_BIT12 164
187#define OCTEON_IRQ_MSI_BIT13 165
188#define OCTEON_IRQ_MSI_BIT14 166
189#define OCTEON_IRQ_MSI_BIT15 167
190#define OCTEON_IRQ_MSI_BIT16 168
191#define OCTEON_IRQ_MSI_BIT17 169
192#define OCTEON_IRQ_MSI_BIT18 170
193#define OCTEON_IRQ_MSI_BIT19 171
194#define OCTEON_IRQ_MSI_BIT20 172
195#define OCTEON_IRQ_MSI_BIT21 173
196#define OCTEON_IRQ_MSI_BIT22 174
197#define OCTEON_IRQ_MSI_BIT23 175
198#define OCTEON_IRQ_MSI_BIT24 176
199#define OCTEON_IRQ_MSI_BIT25 177
200#define OCTEON_IRQ_MSI_BIT26 178
201#define OCTEON_IRQ_MSI_BIT27 179
202#define OCTEON_IRQ_MSI_BIT28 180
203#define OCTEON_IRQ_MSI_BIT29 181
204#define OCTEON_IRQ_MSI_BIT30 182
205#define OCTEON_IRQ_MSI_BIT31 183
206#define OCTEON_IRQ_MSI_BIT32 184
207#define OCTEON_IRQ_MSI_BIT33 185
208#define OCTEON_IRQ_MSI_BIT34 186
209#define OCTEON_IRQ_MSI_BIT35 187
210#define OCTEON_IRQ_MSI_BIT36 188
211#define OCTEON_IRQ_MSI_BIT37 189
212#define OCTEON_IRQ_MSI_BIT38 190
213#define OCTEON_IRQ_MSI_BIT39 191
214#define OCTEON_IRQ_MSI_BIT40 192
215#define OCTEON_IRQ_MSI_BIT41 193
216#define OCTEON_IRQ_MSI_BIT42 194
217#define OCTEON_IRQ_MSI_BIT43 195
218#define OCTEON_IRQ_MSI_BIT44 196
219#define OCTEON_IRQ_MSI_BIT45 197
220#define OCTEON_IRQ_MSI_BIT46 198
221#define OCTEON_IRQ_MSI_BIT47 199
222#define OCTEON_IRQ_MSI_BIT48 200
223#define OCTEON_IRQ_MSI_BIT49 201
224#define OCTEON_IRQ_MSI_BIT50 202
225#define OCTEON_IRQ_MSI_BIT51 203
226#define OCTEON_IRQ_MSI_BIT52 204
227#define OCTEON_IRQ_MSI_BIT53 205
228#define OCTEON_IRQ_MSI_BIT54 206
229#define OCTEON_IRQ_MSI_BIT55 207
230#define OCTEON_IRQ_MSI_BIT56 208
231#define OCTEON_IRQ_MSI_BIT57 209
232#define OCTEON_IRQ_MSI_BIT58 210
233#define OCTEON_IRQ_MSI_BIT59 211
234#define OCTEON_IRQ_MSI_BIT60 212
235#define OCTEON_IRQ_MSI_BIT61 213
236#define OCTEON_IRQ_MSI_BIT62 214
237#define OCTEON_IRQ_MSI_BIT63 215
238 176
239#define OCTEON_IRQ_LAST 216 177#define OCTEON_IRQ_LAST (OCTEON_IRQ_MSI_LAST + 1)
240#else 178#else
241#define OCTEON_IRQ_LAST 152 179#define OCTEON_IRQ_LAST 152
242#endif 180#endif
diff --git a/arch/mips/include/asm/mach-jz4740/base.h b/arch/mips/include/asm/mach-jz4740/base.h
new file mode 100644
index 000000000000..f37318605452
--- /dev/null
+++ b/arch/mips/include/asm/mach-jz4740/base.h
@@ -0,0 +1,26 @@
1#ifndef __ASM_MACH_JZ4740_BASE_H__
2#define __ASM_MACH_JZ4740_BASE_H__
3
4#define JZ4740_CPM_BASE_ADDR 0x10000000
5#define JZ4740_INTC_BASE_ADDR 0x10001000
6#define JZ4740_WDT_BASE_ADDR 0x10002000
7#define JZ4740_TCU_BASE_ADDR 0x10002010
8#define JZ4740_RTC_BASE_ADDR 0x10003000
9#define JZ4740_GPIO_BASE_ADDR 0x10010000
10#define JZ4740_AIC_BASE_ADDR 0x10020000
11#define JZ4740_MSC_BASE_ADDR 0x10021000
12#define JZ4740_UART0_BASE_ADDR 0x10030000
13#define JZ4740_UART1_BASE_ADDR 0x10031000
14#define JZ4740_I2C_BASE_ADDR 0x10042000
15#define JZ4740_SSI_BASE_ADDR 0x10043000
16#define JZ4740_SADC_BASE_ADDR 0x10070000
17#define JZ4740_EMC_BASE_ADDR 0x13010000
18#define JZ4740_DMAC_BASE_ADDR 0x13020000
19#define JZ4740_UHC_BASE_ADDR 0x13030000
20#define JZ4740_UDC_BASE_ADDR 0x13040000
21#define JZ4740_LCD_BASE_ADDR 0x13050000
22#define JZ4740_SLCD_BASE_ADDR 0x13050000
23#define JZ4740_CIM_BASE_ADDR 0x13060000
24#define JZ4740_IPU_BASE_ADDR 0x13080000
25
26#endif
diff --git a/arch/mips/include/asm/mach-jz4740/clock.h b/arch/mips/include/asm/mach-jz4740/clock.h
new file mode 100644
index 000000000000..1b7408dd0e23
--- /dev/null
+++ b/arch/mips/include/asm/mach-jz4740/clock.h
@@ -0,0 +1,28 @@
1/*
2 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * You should have received a copy of the GNU General Public License along
10 * with this program; if not, write to the Free Software Foundation, Inc.,
11 * 675 Mass Ave, Cambridge, MA 02139, USA.
12 *
13 */
14
15#ifndef __ASM_JZ4740_CLOCK_H__
16#define __ASM_JZ4740_CLOCK_H__
17
18enum jz4740_wait_mode {
19 JZ4740_WAIT_MODE_IDLE,
20 JZ4740_WAIT_MODE_SLEEP,
21};
22
23void jz4740_clock_set_wait_mode(enum jz4740_wait_mode mode);
24
25void jz4740_clock_udc_enable_auto_suspend(void);
26void jz4740_clock_udc_disable_auto_suspend(void);
27
28#endif
diff --git a/arch/mips/include/asm/mach-jz4740/cpu-feature-overrides.h b/arch/mips/include/asm/mach-jz4740/cpu-feature-overrides.h
new file mode 100644
index 000000000000..d12e5c6477b9
--- /dev/null
+++ b/arch/mips/include/asm/mach-jz4740/cpu-feature-overrides.h
@@ -0,0 +1,51 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 */
7#ifndef __ASM_MACH_JZ4740_CPU_FEATURE_OVERRIDES_H
8#define __ASM_MACH_JZ4740_CPU_FEATURE_OVERRIDES_H
9
10#define cpu_has_tlb 1
11#define cpu_has_4kex 1
12#define cpu_has_3k_cache 0
13#define cpu_has_4k_cache 1
14#define cpu_has_tx39_cache 0
15#define cpu_has_fpu 0
16#define cpu_has_32fpr 0
17#define cpu_has_counter 0
18#define cpu_has_watch 1
19#define cpu_has_divec 1
20#define cpu_has_vce 0
21#define cpu_has_cache_cdex_p 0
22#define cpu_has_cache_cdex_s 0
23#define cpu_has_prefetch 1
24#define cpu_has_mcheck 1
25#define cpu_has_ejtag 1
26#define cpu_has_llsc 1
27#define cpu_has_mips16 0
28#define cpu_has_mdmx 0
29#define cpu_has_mips3d 0
30#define cpu_has_smartmips 0
31#define kernel_uses_llsc 1
32#define cpu_has_vtag_icache 1
33#define cpu_has_dc_aliases 0
34#define cpu_has_ic_fills_f_dc 0
35#define cpu_has_pindexed_dcache 0
36#define cpu_has_mips32r1 1
37#define cpu_has_mips32r2 0
38#define cpu_has_mips64r1 0
39#define cpu_has_mips64r2 0
40#define cpu_has_dsp 0
41#define cpu_has_mipsmt 0
42#define cpu_has_userlocal 0
43#define cpu_has_nofpuex 0
44#define cpu_has_64bits 0
45#define cpu_has_64bit_zero_reg 0
46#define cpu_has_inclusive_pcaches 0
47
48#define cpu_dcache_line_size() 32
49#define cpu_icache_line_size() 32
50
51#endif
diff --git a/arch/mips/include/asm/mach-jz4740/dma.h b/arch/mips/include/asm/mach-jz4740/dma.h
new file mode 100644
index 000000000000..a3be12183599
--- /dev/null
+++ b/arch/mips/include/asm/mach-jz4740/dma.h
@@ -0,0 +1,90 @@
1/*
2 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ7420/JZ4740 DMA definitions
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#ifndef __ASM_MACH_JZ4740_DMA_H__
17#define __ASM_MACH_JZ4740_DMA_H__
18
19struct jz4740_dma_chan;
20
21enum jz4740_dma_request_type {
22 JZ4740_DMA_TYPE_AUTO_REQUEST = 8,
23 JZ4740_DMA_TYPE_UART_TRANSMIT = 20,
24 JZ4740_DMA_TYPE_UART_RECEIVE = 21,
25 JZ4740_DMA_TYPE_SPI_TRANSMIT = 22,
26 JZ4740_DMA_TYPE_SPI_RECEIVE = 23,
27 JZ4740_DMA_TYPE_AIC_TRANSMIT = 24,
28 JZ4740_DMA_TYPE_AIC_RECEIVE = 25,
29 JZ4740_DMA_TYPE_MMC_TRANSMIT = 26,
30 JZ4740_DMA_TYPE_MMC_RECEIVE = 27,
31 JZ4740_DMA_TYPE_TCU = 28,
32 JZ4740_DMA_TYPE_SADC = 29,
33 JZ4740_DMA_TYPE_SLCD = 30,
34};
35
36enum jz4740_dma_width {
37 JZ4740_DMA_WIDTH_32BIT = 0,
38 JZ4740_DMA_WIDTH_8BIT = 1,
39 JZ4740_DMA_WIDTH_16BIT = 2,
40};
41
42enum jz4740_dma_transfer_size {
43 JZ4740_DMA_TRANSFER_SIZE_4BYTE = 0,
44 JZ4740_DMA_TRANSFER_SIZE_1BYTE = 1,
45 JZ4740_DMA_TRANSFER_SIZE_2BYTE = 2,
46 JZ4740_DMA_TRANSFER_SIZE_16BYTE = 3,
47 JZ4740_DMA_TRANSFER_SIZE_32BYTE = 4,
48};
49
50enum jz4740_dma_flags {
51 JZ4740_DMA_SRC_AUTOINC = 0x2,
52 JZ4740_DMA_DST_AUTOINC = 0x1,
53};
54
55enum jz4740_dma_mode {
56 JZ4740_DMA_MODE_SINGLE = 0,
57 JZ4740_DMA_MODE_BLOCK = 1,
58};
59
60struct jz4740_dma_config {
61 enum jz4740_dma_width src_width;
62 enum jz4740_dma_width dst_width;
63 enum jz4740_dma_transfer_size transfer_size;
64 enum jz4740_dma_request_type request_type;
65 enum jz4740_dma_flags flags;
66 enum jz4740_dma_mode mode;
67};
68
69typedef void (*jz4740_dma_complete_callback_t)(struct jz4740_dma_chan *, int, void *);
70
71struct jz4740_dma_chan *jz4740_dma_request(void *dev, const char *name);
72void jz4740_dma_free(struct jz4740_dma_chan *dma);
73
74void jz4740_dma_configure(struct jz4740_dma_chan *dma,
75 const struct jz4740_dma_config *config);
76
77
78void jz4740_dma_enable(struct jz4740_dma_chan *dma);
79void jz4740_dma_disable(struct jz4740_dma_chan *dma);
80
81void jz4740_dma_set_src_addr(struct jz4740_dma_chan *dma, dma_addr_t src);
82void jz4740_dma_set_dst_addr(struct jz4740_dma_chan *dma, dma_addr_t dst);
83void jz4740_dma_set_transfer_count(struct jz4740_dma_chan *dma, uint32_t count);
84
85uint32_t jz4740_dma_get_residue(const struct jz4740_dma_chan *dma);
86
87void jz4740_dma_set_complete_cb(struct jz4740_dma_chan *dma,
88 jz4740_dma_complete_callback_t cb);
89
90#endif /* __ASM_JZ4740_DMA_H__ */
diff --git a/arch/mips/include/asm/mach-jz4740/gpio.h b/arch/mips/include/asm/mach-jz4740/gpio.h
new file mode 100644
index 000000000000..7b74703745bb
--- /dev/null
+++ b/arch/mips/include/asm/mach-jz4740/gpio.h
@@ -0,0 +1,398 @@
1/*
2 * Copyright (C) 2009, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 GPIO pin definitions
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#ifndef _JZ_GPIO_H
17#define _JZ_GPIO_H
18
19#include <linux/types.h>
20
21enum jz_gpio_function {
22 JZ_GPIO_FUNC_NONE,
23 JZ_GPIO_FUNC1,
24 JZ_GPIO_FUNC2,
25 JZ_GPIO_FUNC3,
26};
27
28
29/*
30 Usually a driver for a SoC component has to request several gpio pins and
31 configure them as funcion pins.
32 jz_gpio_bulk_request can be used to ease this process.
33 Usually one would do something like:
34
35 const static struct jz_gpio_bulk_request i2c_pins[] = {
36 JZ_GPIO_BULK_PIN(I2C_SDA),
37 JZ_GPIO_BULK_PIN(I2C_SCK),
38 };
39
40 inside the probe function:
41
42 ret = jz_gpio_bulk_request(i2c_pins, ARRAY_SIZE(i2c_pins));
43 if (ret) {
44 ...
45
46 inside the remove function:
47
48 jz_gpio_bulk_free(i2c_pins, ARRAY_SIZE(i2c_pins));
49
50
51*/
52struct jz_gpio_bulk_request {
53 int gpio;
54 const char *name;
55 enum jz_gpio_function function;
56};
57
58#define JZ_GPIO_BULK_PIN(pin) { \
59 .gpio = JZ_GPIO_ ## pin, \
60 .name = #pin, \
61 .function = JZ_GPIO_FUNC_ ## pin \
62}
63
64int jz_gpio_bulk_request(const struct jz_gpio_bulk_request *request, size_t num);
65void jz_gpio_bulk_free(const struct jz_gpio_bulk_request *request, size_t num);
66void jz_gpio_bulk_suspend(const struct jz_gpio_bulk_request *request, size_t num);
67void jz_gpio_bulk_resume(const struct jz_gpio_bulk_request *request, size_t num);
68void jz_gpio_enable_pullup(unsigned gpio);
69void jz_gpio_disable_pullup(unsigned gpio);
70int jz_gpio_set_function(int gpio, enum jz_gpio_function function);
71
72int jz_gpio_port_direction_input(int port, uint32_t mask);
73int jz_gpio_port_direction_output(int port, uint32_t mask);
74void jz_gpio_port_set_value(int port, uint32_t value, uint32_t mask);
75uint32_t jz_gpio_port_get_value(int port, uint32_t mask);
76
77#include <asm/mach-generic/gpio.h>
78
79#define JZ_GPIO_PORTA(x) ((x) + 32 * 0)
80#define JZ_GPIO_PORTB(x) ((x) + 32 * 1)
81#define JZ_GPIO_PORTC(x) ((x) + 32 * 2)
82#define JZ_GPIO_PORTD(x) ((x) + 32 * 3)
83
84/* Port A function pins */
85#define JZ_GPIO_MEM_DATA0 JZ_GPIO_PORTA(0)
86#define JZ_GPIO_MEM_DATA1 JZ_GPIO_PORTA(1)
87#define JZ_GPIO_MEM_DATA2 JZ_GPIO_PORTA(2)
88#define JZ_GPIO_MEM_DATA3 JZ_GPIO_PORTA(3)
89#define JZ_GPIO_MEM_DATA4 JZ_GPIO_PORTA(4)
90#define JZ_GPIO_MEM_DATA5 JZ_GPIO_PORTA(5)
91#define JZ_GPIO_MEM_DATA6 JZ_GPIO_PORTA(6)
92#define JZ_GPIO_MEM_DATA7 JZ_GPIO_PORTA(7)
93#define JZ_GPIO_MEM_DATA8 JZ_GPIO_PORTA(8)
94#define JZ_GPIO_MEM_DATA9 JZ_GPIO_PORTA(9)
95#define JZ_GPIO_MEM_DATA10 JZ_GPIO_PORTA(10)
96#define JZ_GPIO_MEM_DATA11 JZ_GPIO_PORTA(11)
97#define JZ_GPIO_MEM_DATA12 JZ_GPIO_PORTA(12)
98#define JZ_GPIO_MEM_DATA13 JZ_GPIO_PORTA(13)
99#define JZ_GPIO_MEM_DATA14 JZ_GPIO_PORTA(14)
100#define JZ_GPIO_MEM_DATA15 JZ_GPIO_PORTA(15)
101#define JZ_GPIO_MEM_DATA16 JZ_GPIO_PORTA(16)
102#define JZ_GPIO_MEM_DATA17 JZ_GPIO_PORTA(17)
103#define JZ_GPIO_MEM_DATA18 JZ_GPIO_PORTA(18)
104#define JZ_GPIO_MEM_DATA19 JZ_GPIO_PORTA(19)
105#define JZ_GPIO_MEM_DATA20 JZ_GPIO_PORTA(20)
106#define JZ_GPIO_MEM_DATA21 JZ_GPIO_PORTA(21)
107#define JZ_GPIO_MEM_DATA22 JZ_GPIO_PORTA(22)
108#define JZ_GPIO_MEM_DATA23 JZ_GPIO_PORTA(23)
109#define JZ_GPIO_MEM_DATA24 JZ_GPIO_PORTA(24)
110#define JZ_GPIO_MEM_DATA25 JZ_GPIO_PORTA(25)
111#define JZ_GPIO_MEM_DATA26 JZ_GPIO_PORTA(26)
112#define JZ_GPIO_MEM_DATA27 JZ_GPIO_PORTA(27)
113#define JZ_GPIO_MEM_DATA28 JZ_GPIO_PORTA(28)
114#define JZ_GPIO_MEM_DATA29 JZ_GPIO_PORTA(29)
115#define JZ_GPIO_MEM_DATA30 JZ_GPIO_PORTA(30)
116#define JZ_GPIO_MEM_DATA31 JZ_GPIO_PORTA(31)
117
118#define JZ_GPIO_FUNC_MEM_DATA0 JZ_GPIO_FUNC1
119#define JZ_GPIO_FUNC_MEM_DATA1 JZ_GPIO_FUNC1
120#define JZ_GPIO_FUNC_MEM_DATA2 JZ_GPIO_FUNC1
121#define JZ_GPIO_FUNC_MEM_DATA3 JZ_GPIO_FUNC1
122#define JZ_GPIO_FUNC_MEM_DATA4 JZ_GPIO_FUNC1
123#define JZ_GPIO_FUNC_MEM_DATA5 JZ_GPIO_FUNC1
124#define JZ_GPIO_FUNC_MEM_DATA6 JZ_GPIO_FUNC1
125#define JZ_GPIO_FUNC_MEM_DATA7 JZ_GPIO_FUNC1
126#define JZ_GPIO_FUNC_MEM_DATA8 JZ_GPIO_FUNC1
127#define JZ_GPIO_FUNC_MEM_DATA9 JZ_GPIO_FUNC1
128#define JZ_GPIO_FUNC_MEM_DATA10 JZ_GPIO_FUNC1
129#define JZ_GPIO_FUNC_MEM_DATA11 JZ_GPIO_FUNC1
130#define JZ_GPIO_FUNC_MEM_DATA12 JZ_GPIO_FUNC1
131#define JZ_GPIO_FUNC_MEM_DATA13 JZ_GPIO_FUNC1
132#define JZ_GPIO_FUNC_MEM_DATA14 JZ_GPIO_FUNC1
133#define JZ_GPIO_FUNC_MEM_DATA15 JZ_GPIO_FUNC1
134#define JZ_GPIO_FUNC_MEM_DATA16 JZ_GPIO_FUNC1
135#define JZ_GPIO_FUNC_MEM_DATA17 JZ_GPIO_FUNC1
136#define JZ_GPIO_FUNC_MEM_DATA18 JZ_GPIO_FUNC1
137#define JZ_GPIO_FUNC_MEM_DATA19 JZ_GPIO_FUNC1
138#define JZ_GPIO_FUNC_MEM_DATA20 JZ_GPIO_FUNC1
139#define JZ_GPIO_FUNC_MEM_DATA21 JZ_GPIO_FUNC1
140#define JZ_GPIO_FUNC_MEM_DATA22 JZ_GPIO_FUNC1
141#define JZ_GPIO_FUNC_MEM_DATA23 JZ_GPIO_FUNC1
142#define JZ_GPIO_FUNC_MEM_DATA24 JZ_GPIO_FUNC1
143#define JZ_GPIO_FUNC_MEM_DATA25 JZ_GPIO_FUNC1
144#define JZ_GPIO_FUNC_MEM_DATA26 JZ_GPIO_FUNC1
145#define JZ_GPIO_FUNC_MEM_DATA27 JZ_GPIO_FUNC1
146#define JZ_GPIO_FUNC_MEM_DATA28 JZ_GPIO_FUNC1
147#define JZ_GPIO_FUNC_MEM_DATA29 JZ_GPIO_FUNC1
148#define JZ_GPIO_FUNC_MEM_DATA30 JZ_GPIO_FUNC1
149#define JZ_GPIO_FUNC_MEM_DATA31 JZ_GPIO_FUNC1
150
151/* Port B function pins */
152#define JZ_GPIO_MEM_ADDR0 JZ_GPIO_PORTB(0)
153#define JZ_GPIO_MEM_ADDR1 JZ_GPIO_PORTB(1)
154#define JZ_GPIO_MEM_ADDR2 JZ_GPIO_PORTB(2)
155#define JZ_GPIO_MEM_ADDR3 JZ_GPIO_PORTB(3)
156#define JZ_GPIO_MEM_ADDR4 JZ_GPIO_PORTB(4)
157#define JZ_GPIO_MEM_ADDR5 JZ_GPIO_PORTB(5)
158#define JZ_GPIO_MEM_ADDR6 JZ_GPIO_PORTB(6)
159#define JZ_GPIO_MEM_ADDR7 JZ_GPIO_PORTB(7)
160#define JZ_GPIO_MEM_ADDR8 JZ_GPIO_PORTB(8)
161#define JZ_GPIO_MEM_ADDR9 JZ_GPIO_PORTB(9)
162#define JZ_GPIO_MEM_ADDR10 JZ_GPIO_PORTB(10)
163#define JZ_GPIO_MEM_ADDR11 JZ_GPIO_PORTB(11)
164#define JZ_GPIO_MEM_ADDR12 JZ_GPIO_PORTB(12)
165#define JZ_GPIO_MEM_ADDR13 JZ_GPIO_PORTB(13)
166#define JZ_GPIO_MEM_ADDR14 JZ_GPIO_PORTB(14)
167#define JZ_GPIO_MEM_ADDR15 JZ_GPIO_PORTB(15)
168#define JZ_GPIO_MEM_ADDR16 JZ_GPIO_PORTB(16)
169#define JZ_GPIO_LCD_CLS JZ_GPIO_PORTB(17)
170#define JZ_GPIO_LCD_SPL JZ_GPIO_PORTB(18)
171#define JZ_GPIO_MEM_DCS JZ_GPIO_PORTB(19)
172#define JZ_GPIO_MEM_RAS JZ_GPIO_PORTB(20)
173#define JZ_GPIO_MEM_CAS JZ_GPIO_PORTB(21)
174#define JZ_GPIO_MEM_SDWE JZ_GPIO_PORTB(22)
175#define JZ_GPIO_MEM_CKE JZ_GPIO_PORTB(23)
176#define JZ_GPIO_MEM_CKO JZ_GPIO_PORTB(24)
177#define JZ_GPIO_MEM_CS0 JZ_GPIO_PORTB(25)
178#define JZ_GPIO_MEM_CS1 JZ_GPIO_PORTB(26)
179#define JZ_GPIO_MEM_CS2 JZ_GPIO_PORTB(27)
180#define JZ_GPIO_MEM_CS3 JZ_GPIO_PORTB(28)
181#define JZ_GPIO_MEM_RD JZ_GPIO_PORTB(29)
182#define JZ_GPIO_MEM_WR JZ_GPIO_PORTB(30)
183#define JZ_GPIO_MEM_WE0 JZ_GPIO_PORTB(31)
184
185#define JZ_GPIO_FUNC_MEM_ADDR0 JZ_GPIO_FUNC1
186#define JZ_GPIO_FUNC_MEM_ADDR1 JZ_GPIO_FUNC1
187#define JZ_GPIO_FUNC_MEM_ADDR2 JZ_GPIO_FUNC1
188#define JZ_GPIO_FUNC_MEM_ADDR3 JZ_GPIO_FUNC1
189#define JZ_GPIO_FUNC_MEM_ADDR4 JZ_GPIO_FUNC1
190#define JZ_GPIO_FUNC_MEM_ADDR5 JZ_GPIO_FUNC1
191#define JZ_GPIO_FUNC_MEM_ADDR6 JZ_GPIO_FUNC1
192#define JZ_GPIO_FUNC_MEM_ADDR7 JZ_GPIO_FUNC1
193#define JZ_GPIO_FUNC_MEM_ADDR8 JZ_GPIO_FUNC1
194#define JZ_GPIO_FUNC_MEM_ADDR9 JZ_GPIO_FUNC1
195#define JZ_GPIO_FUNC_MEM_ADDR10 JZ_GPIO_FUNC1
196#define JZ_GPIO_FUNC_MEM_ADDR11 JZ_GPIO_FUNC1
197#define JZ_GPIO_FUNC_MEM_ADDR12 JZ_GPIO_FUNC1
198#define JZ_GPIO_FUNC_MEM_ADDR13 JZ_GPIO_FUNC1
199#define JZ_GPIO_FUNC_MEM_ADDR14 JZ_GPIO_FUNC1
200#define JZ_GPIO_FUNC_MEM_ADDR15 JZ_GPIO_FUNC1
201#define JZ_GPIO_FUNC_MEM_ADDR16 JZ_GPIO_FUNC1
202#define JZ_GPIO_FUNC_LCD_CLS JZ_GPIO_FUNC1
203#define JZ_GPIO_FUNC_LCD_SPL JZ_GPIO_FUNC1
204#define JZ_GPIO_FUNC_MEM_DCS JZ_GPIO_FUNC1
205#define JZ_GPIO_FUNC_MEM_RAS JZ_GPIO_FUNC1
206#define JZ_GPIO_FUNC_MEM_CAS JZ_GPIO_FUNC1
207#define JZ_GPIO_FUNC_MEM_SDWE JZ_GPIO_FUNC1
208#define JZ_GPIO_FUNC_MEM_CKE JZ_GPIO_FUNC1
209#define JZ_GPIO_FUNC_MEM_CKO JZ_GPIO_FUNC1
210#define JZ_GPIO_FUNC_MEM_CS0 JZ_GPIO_FUNC1
211#define JZ_GPIO_FUNC_MEM_CS1 JZ_GPIO_FUNC1
212#define JZ_GPIO_FUNC_MEM_CS2 JZ_GPIO_FUNC1
213#define JZ_GPIO_FUNC_MEM_CS3 JZ_GPIO_FUNC1
214#define JZ_GPIO_FUNC_MEM_RD JZ_GPIO_FUNC1
215#define JZ_GPIO_FUNC_MEM_WR JZ_GPIO_FUNC1
216#define JZ_GPIO_FUNC_MEM_WE0 JZ_GPIO_FUNC1
217
218
219#define JZ_GPIO_MEM_ADDR21 JZ_GPIO_PORTB(17)
220#define JZ_GPIO_MEM_ADDR22 JZ_GPIO_PORTB(18)
221
222#define JZ_GPIO_FUNC_MEM_ADDR21 JZ_GPIO_FUNC2
223#define JZ_GPIO_FUNC_MEM_ADDR22 JZ_GPIO_FUNC2
224
225/* Port C function pins */
226#define JZ_GPIO_LCD_DATA0 JZ_GPIO_PORTC(0)
227#define JZ_GPIO_LCD_DATA1 JZ_GPIO_PORTC(1)
228#define JZ_GPIO_LCD_DATA2 JZ_GPIO_PORTC(2)
229#define JZ_GPIO_LCD_DATA3 JZ_GPIO_PORTC(3)
230#define JZ_GPIO_LCD_DATA4 JZ_GPIO_PORTC(4)
231#define JZ_GPIO_LCD_DATA5 JZ_GPIO_PORTC(5)
232#define JZ_GPIO_LCD_DATA6 JZ_GPIO_PORTC(6)
233#define JZ_GPIO_LCD_DATA7 JZ_GPIO_PORTC(7)
234#define JZ_GPIO_LCD_DATA8 JZ_GPIO_PORTC(8)
235#define JZ_GPIO_LCD_DATA9 JZ_GPIO_PORTC(9)
236#define JZ_GPIO_LCD_DATA10 JZ_GPIO_PORTC(10)
237#define JZ_GPIO_LCD_DATA11 JZ_GPIO_PORTC(11)
238#define JZ_GPIO_LCD_DATA12 JZ_GPIO_PORTC(12)
239#define JZ_GPIO_LCD_DATA13 JZ_GPIO_PORTC(13)
240#define JZ_GPIO_LCD_DATA14 JZ_GPIO_PORTC(14)
241#define JZ_GPIO_LCD_DATA15 JZ_GPIO_PORTC(15)
242#define JZ_GPIO_LCD_DATA16 JZ_GPIO_PORTC(16)
243#define JZ_GPIO_LCD_DATA17 JZ_GPIO_PORTC(17)
244#define JZ_GPIO_LCD_PCLK JZ_GPIO_PORTC(18)
245#define JZ_GPIO_LCD_HSYNC JZ_GPIO_PORTC(19)
246#define JZ_GPIO_LCD_VSYNC JZ_GPIO_PORTC(20)
247#define JZ_GPIO_LCD_DE JZ_GPIO_PORTC(21)
248#define JZ_GPIO_LCD_PS JZ_GPIO_PORTC(22)
249#define JZ_GPIO_LCD_REV JZ_GPIO_PORTC(23)
250#define JZ_GPIO_MEM_WE1 JZ_GPIO_PORTC(24)
251#define JZ_GPIO_MEM_WE2 JZ_GPIO_PORTC(25)
252#define JZ_GPIO_MEM_WE3 JZ_GPIO_PORTC(26)
253#define JZ_GPIO_MEM_WAIT JZ_GPIO_PORTC(27)
254#define JZ_GPIO_MEM_FRE JZ_GPIO_PORTC(28)
255#define JZ_GPIO_MEM_FWE JZ_GPIO_PORTC(29)
256
257#define JZ_GPIO_FUNC_LCD_DATA0 JZ_GPIO_FUNC1
258#define JZ_GPIO_FUNC_LCD_DATA1 JZ_GPIO_FUNC1
259#define JZ_GPIO_FUNC_LCD_DATA2 JZ_GPIO_FUNC1
260#define JZ_GPIO_FUNC_LCD_DATA3 JZ_GPIO_FUNC1
261#define JZ_GPIO_FUNC_LCD_DATA4 JZ_GPIO_FUNC1
262#define JZ_GPIO_FUNC_LCD_DATA5 JZ_GPIO_FUNC1
263#define JZ_GPIO_FUNC_LCD_DATA6 JZ_GPIO_FUNC1
264#define JZ_GPIO_FUNC_LCD_DATA7 JZ_GPIO_FUNC1
265#define JZ_GPIO_FUNC_LCD_DATA8 JZ_GPIO_FUNC1
266#define JZ_GPIO_FUNC_LCD_DATA9 JZ_GPIO_FUNC1
267#define JZ_GPIO_FUNC_LCD_DATA10 JZ_GPIO_FUNC1
268#define JZ_GPIO_FUNC_LCD_DATA11 JZ_GPIO_FUNC1
269#define JZ_GPIO_FUNC_LCD_DATA12 JZ_GPIO_FUNC1
270#define JZ_GPIO_FUNC_LCD_DATA13 JZ_GPIO_FUNC1
271#define JZ_GPIO_FUNC_LCD_DATA14 JZ_GPIO_FUNC1
272#define JZ_GPIO_FUNC_LCD_DATA15 JZ_GPIO_FUNC1
273#define JZ_GPIO_FUNC_LCD_DATA16 JZ_GPIO_FUNC1
274#define JZ_GPIO_FUNC_LCD_DATA17 JZ_GPIO_FUNC1
275#define JZ_GPIO_FUNC_LCD_PCLK JZ_GPIO_FUNC1
276#define JZ_GPIO_FUNC_LCD_VSYNC JZ_GPIO_FUNC1
277#define JZ_GPIO_FUNC_LCD_HSYNC JZ_GPIO_FUNC1
278#define JZ_GPIO_FUNC_LCD_DE JZ_GPIO_FUNC1
279#define JZ_GPIO_FUNC_LCD_PS JZ_GPIO_FUNC1
280#define JZ_GPIO_FUNC_LCD_REV JZ_GPIO_FUNC1
281#define JZ_GPIO_FUNC_MEM_WE1 JZ_GPIO_FUNC1
282#define JZ_GPIO_FUNC_MEM_WE2 JZ_GPIO_FUNC1
283#define JZ_GPIO_FUNC_MEM_WE3 JZ_GPIO_FUNC1
284#define JZ_GPIO_FUNC_MEM_WAIT JZ_GPIO_FUNC1
285#define JZ_GPIO_FUNC_MEM_FRE JZ_GPIO_FUNC1
286#define JZ_GPIO_FUNC_MEM_FWE JZ_GPIO_FUNC1
287
288
289#define JZ_GPIO_MEM_ADDR19 JZ_GPIO_PORTB(22)
290#define JZ_GPIO_MEM_ADDR20 JZ_GPIO_PORTB(23)
291
292#define JZ_GPIO_FUNC_MEM_ADDR19 JZ_GPIO_FUNC2
293#define JZ_GPIO_FUNC_MEM_ADDR20 JZ_GPIO_FUNC2
294
295/* Port D function pins */
296#define JZ_GPIO_CIM_DATA0 JZ_GPIO_PORTD(0)
297#define JZ_GPIO_CIM_DATA1 JZ_GPIO_PORTD(1)
298#define JZ_GPIO_CIM_DATA2 JZ_GPIO_PORTD(2)
299#define JZ_GPIO_CIM_DATA3 JZ_GPIO_PORTD(3)
300#define JZ_GPIO_CIM_DATA4 JZ_GPIO_PORTD(4)
301#define JZ_GPIO_CIM_DATA5 JZ_GPIO_PORTD(5)
302#define JZ_GPIO_CIM_DATA6 JZ_GPIO_PORTD(6)
303#define JZ_GPIO_CIM_DATA7 JZ_GPIO_PORTD(7)
304#define JZ_GPIO_MSC_CMD JZ_GPIO_PORTD(8)
305#define JZ_GPIO_MSC_CLK JZ_GPIO_PORTD(9)
306#define JZ_GPIO_MSC_DATA0 JZ_GPIO_PORTD(10)
307#define JZ_GPIO_MSC_DATA1 JZ_GPIO_PORTD(11)
308#define JZ_GPIO_MSC_DATA2 JZ_GPIO_PORTD(12)
309#define JZ_GPIO_MSC_DATA3 JZ_GPIO_PORTD(13)
310#define JZ_GPIO_CIM_MCLK JZ_GPIO_PORTD(14)
311#define JZ_GPIO_CIM_PCLK JZ_GPIO_PORTD(15)
312#define JZ_GPIO_CIM_VSYNC JZ_GPIO_PORTD(16)
313#define JZ_GPIO_CIM_HSYNC JZ_GPIO_PORTD(17)
314#define JZ_GPIO_SPI_CLK JZ_GPIO_PORTD(18)
315#define JZ_GPIO_SPI_CE0 JZ_GPIO_PORTD(19)
316#define JZ_GPIO_SPI_DT JZ_GPIO_PORTD(20)
317#define JZ_GPIO_SPI_DR JZ_GPIO_PORTD(21)
318#define JZ_GPIO_SPI_CE1 JZ_GPIO_PORTD(22)
319#define JZ_GPIO_PWM0 JZ_GPIO_PORTD(23)
320#define JZ_GPIO_PWM1 JZ_GPIO_PORTD(24)
321#define JZ_GPIO_PWM2 JZ_GPIO_PORTD(25)
322#define JZ_GPIO_PWM3 JZ_GPIO_PORTD(26)
323#define JZ_GPIO_PWM4 JZ_GPIO_PORTD(27)
324#define JZ_GPIO_PWM5 JZ_GPIO_PORTD(28)
325#define JZ_GPIO_PWM6 JZ_GPIO_PORTD(30)
326#define JZ_GPIO_PWM7 JZ_GPIO_PORTD(31)
327
328#define JZ_GPIO_FUNC_CIM_DATA JZ_GPIO_FUNC1
329#define JZ_GPIO_FUNC_CIM_DATA0 JZ_GPIO_FUNC_CIM_DATA
330#define JZ_GPIO_FUNC_CIM_DATA1 JZ_GPIO_FUNC_CIM_DATA
331#define JZ_GPIO_FUNC_CIM_DATA2 JZ_GPIO_FUNC_CIM_DATA
332#define JZ_GPIO_FUNC_CIM_DATA3 JZ_GPIO_FUNC_CIM_DATA
333#define JZ_GPIO_FUNC_CIM_DATA4 JZ_GPIO_FUNC_CIM_DATA
334#define JZ_GPIO_FUNC_CIM_DATA5 JZ_GPIO_FUNC_CIM_DATA
335#define JZ_GPIO_FUNC_CIM_DATA6 JZ_GPIO_FUNC_CIM_DATA
336#define JZ_GPIO_FUNC_CIM_DATA7 JZ_GPIO_FUNC_CIM_DATA
337#define JZ_GPIO_FUNC_MSC_CMD JZ_GPIO_FUNC1
338#define JZ_GPIO_FUNC_MSC_CLK JZ_GPIO_FUNC1
339#define JZ_GPIO_FUNC_MSC_DATA JZ_GPIO_FUNC1
340#define JZ_GPIO_FUNC_MSC_DATA0 JZ_GPIO_FUNC_MSC_DATA
341#define JZ_GPIO_FUNC_MSC_DATA1 JZ_GPIO_FUNC_MSC_DATA
342#define JZ_GPIO_FUNC_MSC_DATA2 JZ_GPIO_FUNC_MSC_DATA
343#define JZ_GPIO_FUNC_MSC_DATA3 JZ_GPIO_FUNC_MSC_DATA
344#define JZ_GPIO_FUNC_CIM_MCLK JZ_GPIO_FUNC1
345#define JZ_GPIO_FUNC_CIM_PCLK JZ_GPIO_FUNC1
346#define JZ_GPIO_FUNC_CIM_VSYNC JZ_GPIO_FUNC1
347#define JZ_GPIO_FUNC_CIM_HSYNC JZ_GPIO_FUNC1
348#define JZ_GPIO_FUNC_SPI_CLK JZ_GPIO_FUNC1
349#define JZ_GPIO_FUNC_SPI_CE0 JZ_GPIO_FUNC1
350#define JZ_GPIO_FUNC_SPI_DT JZ_GPIO_FUNC1
351#define JZ_GPIO_FUNC_SPI_DR JZ_GPIO_FUNC1
352#define JZ_GPIO_FUNC_SPI_CE1 JZ_GPIO_FUNC1
353
354#define JZ_GPIO_FUNC_PWM JZ_GPIO_FUNC1
355#define JZ_GPIO_FUNC_PWM0 JZ_GPIO_FUNC_PWM
356#define JZ_GPIO_FUNC_PWM1 JZ_GPIO_FUNC_PWM
357#define JZ_GPIO_FUNC_PWM2 JZ_GPIO_FUNC_PWM
358#define JZ_GPIO_FUNC_PWM3 JZ_GPIO_FUNC_PWM
359#define JZ_GPIO_FUNC_PWM4 JZ_GPIO_FUNC_PWM
360#define JZ_GPIO_FUNC_PWM5 JZ_GPIO_FUNC_PWM
361#define JZ_GPIO_FUNC_PWM6 JZ_GPIO_FUNC_PWM
362#define JZ_GPIO_FUNC_PWM7 JZ_GPIO_FUNC_PWM
363
364#define JZ_GPIO_MEM_SCLK_RSTN JZ_GPIO_PORTD(18)
365#define JZ_GPIO_MEM_BCLK JZ_GPIO_PORTD(19)
366#define JZ_GPIO_MEM_SDATO JZ_GPIO_PORTD(20)
367#define JZ_GPIO_MEM_SDATI JZ_GPIO_PORTD(21)
368#define JZ_GPIO_MEM_SYNC JZ_GPIO_PORTD(22)
369#define JZ_GPIO_I2C_SDA JZ_GPIO_PORTD(23)
370#define JZ_GPIO_I2C_SCK JZ_GPIO_PORTD(24)
371#define JZ_GPIO_UART0_TXD JZ_GPIO_PORTD(25)
372#define JZ_GPIO_UART0_RXD JZ_GPIO_PORTD(26)
373#define JZ_GPIO_MEM_ADDR17 JZ_GPIO_PORTD(27)
374#define JZ_GPIO_MEM_ADDR18 JZ_GPIO_PORTD(28)
375#define JZ_GPIO_UART0_CTS JZ_GPIO_PORTD(30)
376#define JZ_GPIO_UART0_RTS JZ_GPIO_PORTD(31)
377
378#define JZ_GPIO_FUNC_MEM_SCLK_RSTN JZ_GPIO_FUNC2
379#define JZ_GPIO_FUNC_MEM_BCLK JZ_GPIO_FUNC2
380#define JZ_GPIO_FUNC_MEM_SDATO JZ_GPIO_FUNC2
381#define JZ_GPIO_FUNC_MEM_SDATI JZ_GPIO_FUNC2
382#define JZ_GPIO_FUNC_MEM_SYNC JZ_GPIO_FUNC2
383#define JZ_GPIO_FUNC_I2C_SDA JZ_GPIO_FUNC2
384#define JZ_GPIO_FUNC_I2C_SCK JZ_GPIO_FUNC2
385#define JZ_GPIO_FUNC_UART0_TXD JZ_GPIO_FUNC2
386#define JZ_GPIO_FUNC_UART0_RXD JZ_GPIO_FUNC2
387#define JZ_GPIO_FUNC_MEM_ADDR17 JZ_GPIO_FUNC2
388#define JZ_GPIO_FUNC_MEM_ADDR18 JZ_GPIO_FUNC2
389#define JZ_GPIO_FUNC_UART0_CTS JZ_GPIO_FUNC2
390#define JZ_GPIO_FUNC_UART0_RTS JZ_GPIO_FUNC2
391
392#define JZ_GPIO_UART1_RXD JZ_GPIO_PORTD(30)
393#define JZ_GPIO_UART1_TXD JZ_GPIO_PORTD(31)
394
395#define JZ_GPIO_FUNC_UART1_RXD JZ_GPIO_FUNC3
396#define JZ_GPIO_FUNC_UART1_TXD JZ_GPIO_FUNC3
397
398#endif
diff --git a/arch/mips/include/asm/mach-jz4740/irq.h b/arch/mips/include/asm/mach-jz4740/irq.h
new file mode 100644
index 000000000000..a865c983c70a
--- /dev/null
+++ b/arch/mips/include/asm/mach-jz4740/irq.h
@@ -0,0 +1,57 @@
1/*
2 * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 IRQ definitions
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#ifndef __ASM_MACH_JZ4740_IRQ_H__
17#define __ASM_MACH_JZ4740_IRQ_H__
18
19#define MIPS_CPU_IRQ_BASE 0
20#define JZ4740_IRQ_BASE 8
21
22/* 1st-level interrupts */
23#define JZ4740_IRQ(x) (JZ4740_IRQ_BASE + (x))
24#define JZ4740_IRQ_I2C JZ4740_IRQ(1)
25#define JZ4740_IRQ_UHC JZ4740_IRQ(3)
26#define JZ4740_IRQ_UART1 JZ4740_IRQ(8)
27#define JZ4740_IRQ_UART0 JZ4740_IRQ(9)
28#define JZ4740_IRQ_SADC JZ4740_IRQ(12)
29#define JZ4740_IRQ_MSC JZ4740_IRQ(14)
30#define JZ4740_IRQ_RTC JZ4740_IRQ(15)
31#define JZ4740_IRQ_SSI JZ4740_IRQ(16)
32#define JZ4740_IRQ_CIM JZ4740_IRQ(17)
33#define JZ4740_IRQ_AIC JZ4740_IRQ(18)
34#define JZ4740_IRQ_ETH JZ4740_IRQ(19)
35#define JZ4740_IRQ_DMAC JZ4740_IRQ(20)
36#define JZ4740_IRQ_TCU2 JZ4740_IRQ(21)
37#define JZ4740_IRQ_TCU1 JZ4740_IRQ(22)
38#define JZ4740_IRQ_TCU0 JZ4740_IRQ(23)
39#define JZ4740_IRQ_UDC JZ4740_IRQ(24)
40#define JZ4740_IRQ_GPIO3 JZ4740_IRQ(25)
41#define JZ4740_IRQ_GPIO2 JZ4740_IRQ(26)
42#define JZ4740_IRQ_GPIO1 JZ4740_IRQ(27)
43#define JZ4740_IRQ_GPIO0 JZ4740_IRQ(28)
44#define JZ4740_IRQ_IPU JZ4740_IRQ(29)
45#define JZ4740_IRQ_LCD JZ4740_IRQ(30)
46
47/* 2nd-level interrupts */
48#define JZ4740_IRQ_DMA(x) (JZ4740_IRQ(32) + (X))
49
50#define JZ4740_IRQ_INTC_GPIO(x) (JZ4740_IRQ_GPIO0 - (x))
51#define JZ4740_IRQ_GPIO(x) (JZ4740_IRQ(48) + (x))
52
53#define JZ4740_IRQ_ADC_BASE JZ4740_IRQ(176)
54
55#define NR_IRQS (JZ4740_IRQ_ADC_BASE + 6)
56
57#endif
diff --git a/arch/mips/include/asm/mach-jz4740/jz4740_fb.h b/arch/mips/include/asm/mach-jz4740/jz4740_fb.h
new file mode 100644
index 000000000000..6a50e6f7a21a
--- /dev/null
+++ b/arch/mips/include/asm/mach-jz4740/jz4740_fb.h
@@ -0,0 +1,67 @@
1/*
2 * Copyright (C) 2009, Lars-Peter Clausen <lars@metafoo.de>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * You should have received a copy of the GNU General Public License along
10 * with this program; if not, write to the Free Software Foundation, Inc.,
11 * 675 Mass Ave, Cambridge, MA 02139, USA.
12 *
13 */
14
15#ifndef __ASM_MACH_JZ4740_JZ4740_FB_H__
16#define __ASM_MACH_JZ4740_JZ4740_FB_H__
17
18#include <linux/fb.h>
19
20enum jz4740_fb_lcd_type {
21 JZ_LCD_TYPE_GENERIC_16_BIT = 0,
22 JZ_LCD_TYPE_GENERIC_18_BIT = 0 | (1 << 4),
23 JZ_LCD_TYPE_SPECIAL_TFT_1 = 1,
24 JZ_LCD_TYPE_SPECIAL_TFT_2 = 2,
25 JZ_LCD_TYPE_SPECIAL_TFT_3 = 3,
26 JZ_LCD_TYPE_NON_INTERLACED_CCIR656 = 5,
27 JZ_LCD_TYPE_INTERLACED_CCIR656 = 7,
28 JZ_LCD_TYPE_SINGLE_COLOR_STN = 8,
29 JZ_LCD_TYPE_SINGLE_MONOCHROME_STN = 9,
30 JZ_LCD_TYPE_DUAL_COLOR_STN = 10,
31 JZ_LCD_TYPE_DUAL_MONOCHROME_STN = 11,
32 JZ_LCD_TYPE_8BIT_SERIAL = 12,
33};
34
35#define JZ4740_FB_SPECIAL_TFT_CONFIG(start, stop) (((start) << 16) | (stop))
36
37/*
38* width: width of the lcd display in mm
39* height: height of the lcd display in mm
40* num_modes: size of modes
41* modes: list of valid video modes
42* bpp: bits per pixel for the lcd
43* lcd_type: lcd type
44*/
45
46struct jz4740_fb_platform_data {
47 unsigned int width;
48 unsigned int height;
49
50 size_t num_modes;
51 struct fb_videomode *modes;
52
53 unsigned int bpp;
54 enum jz4740_fb_lcd_type lcd_type;
55
56 struct {
57 uint32_t spl;
58 uint32_t cls;
59 uint32_t ps;
60 uint32_t rev;
61 } special_tft_config;
62
63 unsigned pixclk_falling_edge:1;
64 unsigned date_enable_active_low:1;
65};
66
67#endif
diff --git a/arch/mips/include/asm/mach-jz4740/jz4740_mmc.h b/arch/mips/include/asm/mach-jz4740/jz4740_mmc.h
new file mode 100644
index 000000000000..8543f432b4b3
--- /dev/null
+++ b/arch/mips/include/asm/mach-jz4740/jz4740_mmc.h
@@ -0,0 +1,15 @@
1#ifndef __LINUX_MMC_JZ4740_MMC
2#define __LINUX_MMC_JZ4740_MMC
3
4struct jz4740_mmc_platform_data {
5 int gpio_power;
6 int gpio_card_detect;
7 int gpio_read_only;
8 unsigned card_detect_active_low:1;
9 unsigned read_only_active_low:1;
10 unsigned power_active_low:1;
11
12 unsigned data_1bit:1;
13};
14
15#endif
diff --git a/arch/mips/include/asm/mach-jz4740/jz4740_nand.h b/arch/mips/include/asm/mach-jz4740/jz4740_nand.h
new file mode 100644
index 000000000000..bb5b9a4e29c8
--- /dev/null
+++ b/arch/mips/include/asm/mach-jz4740/jz4740_nand.h
@@ -0,0 +1,34 @@
1/*
2 * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 SoC NAND controller driver
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#ifndef __ASM_MACH_JZ4740_JZ4740_NAND_H__
17#define __ASM_MACH_JZ4740_JZ4740_NAND_H__
18
19#include <linux/mtd/nand.h>
20#include <linux/mtd/partitions.h>
21
22struct jz_nand_platform_data {
23 int num_partitions;
24 struct mtd_partition *partitions;
25
26 struct nand_ecclayout *ecc_layout;
27
28 unsigned int busy_gpio;
29
30 void (*ident_callback)(struct platform_device *, struct nand_chip *,
31 struct mtd_partition **, int *num_partitions);
32};
33
34#endif
diff --git a/arch/mips/include/asm/mach-jz4740/platform.h b/arch/mips/include/asm/mach-jz4740/platform.h
new file mode 100644
index 000000000000..8987a76e9676
--- /dev/null
+++ b/arch/mips/include/asm/mach-jz4740/platform.h
@@ -0,0 +1,36 @@
1/*
2 * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 platform device definitions
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16
17#ifndef __JZ4740_PLATFORM_H
18#define __JZ4740_PLATFORM_H
19
20#include <linux/platform_device.h>
21
22extern struct platform_device jz4740_usb_ohci_device;
23extern struct platform_device jz4740_udc_device;
24extern struct platform_device jz4740_mmc_device;
25extern struct platform_device jz4740_rtc_device;
26extern struct platform_device jz4740_i2c_device;
27extern struct platform_device jz4740_nand_device;
28extern struct platform_device jz4740_framebuffer_device;
29extern struct platform_device jz4740_i2s_device;
30extern struct platform_device jz4740_pcm_device;
31extern struct platform_device jz4740_codec_device;
32extern struct platform_device jz4740_adc_device;
33
34void jz4740_serial_device_register(void);
35
36#endif
diff --git a/arch/mips/include/asm/mach-jz4740/timer.h b/arch/mips/include/asm/mach-jz4740/timer.h
new file mode 100644
index 000000000000..9baa03ce748c
--- /dev/null
+++ b/arch/mips/include/asm/mach-jz4740/timer.h
@@ -0,0 +1,22 @@
1/*
2 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 platform timer support
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#ifndef __ASM_MACH_JZ4740_TIMER
17#define __ASM_MACH_JZ4740_TIMER
18
19void jz4740_timer_enable_watchdog(void);
20void jz4740_timer_disable_watchdog(void);
21
22#endif
diff --git a/arch/mips/include/asm/mach-jz4740/war.h b/arch/mips/include/asm/mach-jz4740/war.h
new file mode 100644
index 000000000000..3a5bc17e28fe
--- /dev/null
+++ b/arch/mips/include/asm/mach-jz4740/war.h
@@ -0,0 +1,25 @@
1/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2002, 2004, 2007 by Ralf Baechle <ralf@linux-mips.org>
7 */
8#ifndef __ASM_MIPS_MACH_JZ4740_WAR_H
9#define __ASM_MIPS_MACH_JZ4740_WAR_H
10
11#define R4600_V1_INDEX_ICACHEOP_WAR 0
12#define R4600_V1_HIT_CACHEOP_WAR 0
13#define R4600_V2_HIT_CACHEOP_WAR 0
14#define R5432_CP0_INTERRUPT_WAR 0
15#define BCM1250_M3_WAR 0
16#define SIBYTE_1956_WAR 0
17#define MIPS4K_ICACHE_REFILL_WAR 0
18#define MIPS_CACHE_SYNC_WAR 0
19#define TX49XX_ICACHE_INDEX_INV_WAR 0
20#define RM9000_CDEX_SMP_WAR 0
21#define ICACHE_REFILLS_WORKAROUND_WAR 0
22#define R10000_LLSC_WAR 0
23#define MIPS34K_MISSED_ITLB_WAR 0
24
25#endif /* __ASM_MIPS_MACH_JZ4740_WAR_H */
diff --git a/arch/mips/include/asm/mach-loongson/loongson.h b/arch/mips/include/asm/mach-loongson/loongson.h
index fcdbe3a4ce1f..cb6985f24303 100644
--- a/arch/mips/include/asm/mach-loongson/loongson.h
+++ b/arch/mips/include/asm/mach-loongson/loongson.h
@@ -45,7 +45,6 @@ static inline void prom_init_uart_base(void)
45/* irq operation functions */ 45/* irq operation functions */
46extern void bonito_irqdispatch(void); 46extern void bonito_irqdispatch(void);
47extern void __init bonito_irq_init(void); 47extern void __init bonito_irq_init(void);
48extern void __init set_irq_trigger_mode(void);
49extern void __init mach_init_irq(void); 48extern void __init mach_init_irq(void);
50extern void mach_irq_dispatch(unsigned int pending); 49extern void mach_irq_dispatch(unsigned int pending);
51extern int mach_i8259_irq(void); 50extern int mach_i8259_irq(void);
@@ -63,6 +62,14 @@ extern int mach_i8259_irq(void);
63#define LOONGSON_IRQ_BASE 32 62#define LOONGSON_IRQ_BASE 32
64#define LOONGSON2_PERFCNT_IRQ (MIPS_CPU_IRQ_BASE + 6) /* cpu perf counter */ 63#define LOONGSON2_PERFCNT_IRQ (MIPS_CPU_IRQ_BASE + 6) /* cpu perf counter */
65 64
65#include <linux/interrupt.h>
66static inline void do_perfcnt_IRQ(void)
67{
68#if defined(CONFIG_OPROFILE) || defined(CONFIG_OPROFILE_MODULE)
69 do_IRQ(LOONGSON2_PERFCNT_IRQ);
70#endif
71}
72
66#define LOONGSON_FLASH_BASE 0x1c000000 73#define LOONGSON_FLASH_BASE 0x1c000000
67#define LOONGSON_FLASH_SIZE 0x02000000 /* 32M */ 74#define LOONGSON_FLASH_SIZE 0x02000000 /* 32M */
68#define LOONGSON_FLASH_TOP (LOONGSON_FLASH_BASE+LOONGSON_FLASH_SIZE-1) 75#define LOONGSON_FLASH_TOP (LOONGSON_FLASH_BASE+LOONGSON_FLASH_SIZE-1)
diff --git a/arch/mips/include/asm/mach-pb1x00/pb1550.h b/arch/mips/include/asm/mach-pb1x00/pb1550.h
index 58796410bd6e..fc4d766641ce 100644
--- a/arch/mips/include/asm/mach-pb1x00/pb1550.h
+++ b/arch/mips/include/asm/mach-pb1x00/pb1550.h
@@ -40,14 +40,6 @@
40#define SMBUS_PSC_BASE PSC2_BASE_ADDR 40#define SMBUS_PSC_BASE PSC2_BASE_ADDR
41#define I2S_PSC_BASE PSC3_BASE_ADDR 41#define I2S_PSC_BASE PSC3_BASE_ADDR
42 42
43#if defined(CONFIG_MTD_PB1550_BOOT) && defined(CONFIG_MTD_PB1550_USER)
44#define PB1550_BOTH_BANKS
45#elif defined(CONFIG_MTD_PB1550_BOOT) && !defined(CONFIG_MTD_PB1550_USER)
46#define PB1550_BOOT_ONLY
47#elif !defined(CONFIG_MTD_PB1550_BOOT) && defined(CONFIG_MTD_PB1550_USER)
48#define PB1550_USER_ONLY
49#endif
50
51/* 43/*
52 * Timing values as described in databook, * ns value stripped of 44 * Timing values as described in databook, * ns value stripped of
53 * lower 2 bits. 45 * lower 2 bits.
diff --git a/arch/mips/include/asm/mach-powertv/asic.h b/arch/mips/include/asm/mach-powertv/asic.h
index bcad43a93ebf..c7077a64b9a7 100644
--- a/arch/mips/include/asm/mach-powertv/asic.h
+++ b/arch/mips/include/asm/mach-powertv/asic.h
@@ -20,6 +20,7 @@
20#define _ASM_MACH_POWERTV_ASIC_H 20#define _ASM_MACH_POWERTV_ASIC_H
21 21
22#include <linux/ioport.h> 22#include <linux/ioport.h>
23#include <linux/platform_device.h>
23#include <asm/mach-powertv/asic_regs.h> 24#include <asm/mach-powertv/asic_regs.h>
24 25
25#define DVR_CAPABLE (1<<0) 26#define DVR_CAPABLE (1<<0)
@@ -40,19 +41,23 @@ enum family_type {
40 FAMILY_8600VZB, 41 FAMILY_8600VZB,
41 FAMILY_1500VZE, 42 FAMILY_1500VZE,
42 FAMILY_1500VZF, 43 FAMILY_1500VZF,
44 FAMILY_8700,
43 FAMILIES 45 FAMILIES
44}; 46};
45 47
46/* Register maps for each ASIC */ 48/* Register maps for each ASIC */
47extern const struct register_map calliope_register_map; 49extern const struct register_map calliope_register_map;
48extern const struct register_map cronus_register_map; 50extern const struct register_map cronus_register_map;
51extern const struct register_map gaia_register_map;
49extern const struct register_map zeus_register_map; 52extern const struct register_map zeus_register_map;
50 53
51extern struct resource dvr_cronus_resources[]; 54extern struct resource dvr_cronus_resources[];
55extern struct resource dvr_gaia_resources[];
52extern struct resource dvr_zeus_resources[]; 56extern struct resource dvr_zeus_resources[];
53extern struct resource non_dvr_calliope_resources[]; 57extern struct resource non_dvr_calliope_resources[];
54extern struct resource non_dvr_cronus_resources[]; 58extern struct resource non_dvr_cronus_resources[];
55extern struct resource non_dvr_cronuslite_resources[]; 59extern struct resource non_dvr_cronuslite_resources[];
60extern struct resource non_dvr_gaia_resources[];
56extern struct resource non_dvr_vz_calliope_resources[]; 61extern struct resource non_dvr_vz_calliope_resources[];
57extern struct resource non_dvr_vze_calliope_resources[]; 62extern struct resource non_dvr_vze_calliope_resources[];
58extern struct resource non_dvr_vzf_calliope_resources[]; 63extern struct resource non_dvr_vzf_calliope_resources[];
@@ -67,16 +72,24 @@ extern int platform_supports_ffs(void);
67extern int platform_supports_pcie(void); 72extern int platform_supports_pcie(void);
68extern int platform_supports_display(void); 73extern int platform_supports_display(void);
69extern void configure_platform(void); 74extern void configure_platform(void);
70extern void platform_configure_usb_ehci(void);
71extern void platform_unconfigure_usb_ehci(void);
72extern void platform_configure_usb_ohci(void);
73extern void platform_unconfigure_usb_ohci(void);
74 75
75/* Platform Resources */ 76/* Platform Resources */
76#define ASIC_RESOURCE_GET_EXISTS 1 77#define ASIC_RESOURCE_GET_EXISTS 1
77extern struct resource *asic_resource_get(const char *name); 78extern struct resource *asic_resource_get(const char *name);
78extern void platform_release_memory(void *baddr, int size); 79extern void platform_release_memory(void *baddr, int size);
79 80
81/* USB configuration */
82struct usb_hcd; /* Forward reference */
83extern void platform_configure_usb_ehci(void);
84extern void platform_unconfigure_usb_ehci(void);
85extern void platform_configure_usb_ohci(void);
86extern void platform_unconfigure_usb_ohci(void);
87
88/* Resource for ASIC registers */
89extern struct resource asic_resource;
90extern int platform_usb_devices_init(struct platform_device **echi_dev,
91 struct platform_device **ohci_dev);
92
80/* Reboot Cause */ 93/* Reboot Cause */
81extern void set_reboot_cause(char code, unsigned int data, unsigned int data2); 94extern void set_reboot_cause(char code, unsigned int data, unsigned int data2);
82extern void set_locked_reboot_cause(char code, unsigned int data, 95extern void set_locked_reboot_cause(char code, unsigned int data,
diff --git a/arch/mips/include/asm/mach-powertv/asic_reg_map.h b/arch/mips/include/asm/mach-powertv/asic_reg_map.h
index 6f26cb09828e..20348e817b09 100644
--- a/arch/mips/include/asm/mach-powertv/asic_reg_map.h
+++ b/arch/mips/include/asm/mach-powertv/asic_reg_map.h
@@ -64,7 +64,7 @@ REGISTER_MAP_ELEMENT(int_level_0_1)
64REGISTER_MAP_ELEMENT(int_level_0_0) 64REGISTER_MAP_ELEMENT(int_level_0_0)
65REGISTER_MAP_ELEMENT(int_docsis_en) 65REGISTER_MAP_ELEMENT(int_docsis_en)
66REGISTER_MAP_ELEMENT(mips_pll_setup) 66REGISTER_MAP_ELEMENT(mips_pll_setup)
67REGISTER_MAP_ELEMENT(usb_fs) 67REGISTER_MAP_ELEMENT(fs432x4b4_usb_ctl)
68REGISTER_MAP_ELEMENT(test_bus) 68REGISTER_MAP_ELEMENT(test_bus)
69REGISTER_MAP_ELEMENT(crt_spare) 69REGISTER_MAP_ELEMENT(crt_spare)
70REGISTER_MAP_ELEMENT(usb2_ohci_int_mask) 70REGISTER_MAP_ELEMENT(usb2_ohci_int_mask)
diff --git a/arch/mips/include/asm/mach-powertv/asic_regs.h b/arch/mips/include/asm/mach-powertv/asic_regs.h
index 1e11236c6dbc..deecb26a077e 100644
--- a/arch/mips/include/asm/mach-powertv/asic_regs.h
+++ b/arch/mips/include/asm/mach-powertv/asic_regs.h
@@ -27,7 +27,8 @@ enum asic_type {
27 ASIC_CALLIOPE, 27 ASIC_CALLIOPE,
28 ASIC_CRONUS, 28 ASIC_CRONUS,
29 ASIC_CRONUSLITE, 29 ASIC_CRONUSLITE,
30 ASICS 30 ASIC_GAIA,
31 ASICS /* Number of supported ASICs */
31}; 32};
32 33
33/* hardcoded values read from Chip Version registers */ 34/* hardcoded values read from Chip Version registers */
@@ -37,6 +38,7 @@ enum asic_type {
37 38
38#define NAND_FLASH_BASE 0x03000000 39#define NAND_FLASH_BASE 0x03000000
39#define CALLIOPE_IO_BASE 0x08000000 40#define CALLIOPE_IO_BASE 0x08000000
41#define GAIA_IO_BASE 0x09000000
40#define CRONUS_IO_BASE 0x09000000 42#define CRONUS_IO_BASE 0x09000000
41#define ZEUS_IO_BASE 0x09000000 43#define ZEUS_IO_BASE 0x09000000
42 44
@@ -99,6 +101,7 @@ static inline void register_map_virtualize(struct register_map *map)
99} 101}
100 102
101extern struct register_map _asic_register_map; 103extern struct register_map _asic_register_map;
104extern unsigned long asic_phy_base;
102 105
103/* 106/*
104 * Macros to interface to registers through their ioremapped address 107 * Macros to interface to registers through their ioremapped address
diff --git a/arch/mips/include/asm/mach-powertv/dma-coherence.h b/arch/mips/include/asm/mach-powertv/dma-coherence.h
index 5b8d5ebeb838..f76029c2406e 100644
--- a/arch/mips/include/asm/mach-powertv/dma-coherence.h
+++ b/arch/mips/include/asm/mach-powertv/dma-coherence.h
@@ -65,21 +65,21 @@ static inline dma_addr_t plat_map_dma_mem(struct device *dev, void *addr,
65 size_t size) 65 size_t size)
66{ 66{
67 if (is_kseg2(addr)) 67 if (is_kseg2(addr))
68 return phys_to_bus(virt_to_phys_from_pte(addr)); 68 return phys_to_dma(virt_to_phys_from_pte(addr));
69 else 69 else
70 return phys_to_bus(virt_to_phys(addr)); 70 return phys_to_dma(virt_to_phys(addr));
71} 71}
72 72
73static inline dma_addr_t plat_map_dma_mem_page(struct device *dev, 73static inline dma_addr_t plat_map_dma_mem_page(struct device *dev,
74 struct page *page) 74 struct page *page)
75{ 75{
76 return phys_to_bus(page_to_phys(page)); 76 return phys_to_dma(page_to_phys(page));
77} 77}
78 78
79static inline unsigned long plat_dma_addr_to_phys(struct device *dev, 79static inline unsigned long plat_dma_addr_to_phys(struct device *dev,
80 dma_addr_t dma_addr) 80 dma_addr_t dma_addr)
81{ 81{
82 return bus_to_phys(dma_addr); 82 return dma_to_phys(dma_addr);
83} 83}
84 84
85static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr, 85static inline void plat_unmap_dma_mem(struct device *dev, dma_addr_t dma_addr,
diff --git a/arch/mips/include/asm/mach-powertv/ioremap.h b/arch/mips/include/asm/mach-powertv/ioremap.h
index e6276d5146e8..076f2eeaa575 100644
--- a/arch/mips/include/asm/mach-powertv/ioremap.h
+++ b/arch/mips/include/asm/mach-powertv/ioremap.h
@@ -10,64 +10,101 @@
10#define __ASM_MACH_POWERTV_IOREMAP_H 10#define __ASM_MACH_POWERTV_IOREMAP_H
11 11
12#include <linux/types.h> 12#include <linux/types.h>
13#include <linux/log2.h>
14#include <linux/compiler.h>
13 15
14#define LOW_MEM_BOUNDARY_PHYS 0x20000000 16#include <asm/pgtable-bits.h>
15#define LOW_MEM_BOUNDARY_MASK (~(LOW_MEM_BOUNDARY_PHYS - 1)) 17#include <asm/addrspace.h>
18
19/* We're going to mess with bits, so get sizes */
20#define IOR_BPC 8 /* Bits per char */
21#define IOR_PHYS_BITS (IOR_BPC * sizeof(phys_addr_t))
22#define IOR_DMA_BITS (IOR_BPC * sizeof(dma_addr_t))
16 23
17/* 24/*
18 * The bus addresses are different than the physical addresses that 25 * Define the granularity of physical/DMA mapping in terms of the number
19 * the processor sees by an offset. This offset varies by ASIC 26 * of bits that defines the offset within a grain. These will be the
20 * version. Define a variable to hold the offset and some macros to 27 * least significant bits of the address. The rest of a physical or DMA
21 * make the conversion simpler. */ 28 * address will be used to index into an appropriate table to find the
22extern unsigned long phys_to_bus_offset; 29 * offset to add to the address to yield the corresponding DMA or physical
23 30 * address, respectively.
24#ifdef CONFIG_HIGHMEM 31 */
25#define MEM_GAP_PHYS 0x60000000 32#define IOR_LSBITS 22 /* Bits in a grain */
33
26/* 34/*
27 * TODO: We will use the hard code for conversion between physical and 35 * Compute the number of most significant address bits after removing those
28 * bus until the bootloader releases their device tree to us. 36 * used for the offset within a grain and then compute the number of table
37 * entries for the conversion.
29 */ 38 */
30#define phys_to_bus(x) (((x) < LOW_MEM_BOUNDARY_PHYS) ? \ 39#define IOR_PHYS_MSBITS (IOR_PHYS_BITS - IOR_LSBITS)
31 ((x) + phys_to_bus_offset) : (x)) 40#define IOR_NUM_PHYS_TO_DMA ((phys_addr_t) 1 << IOR_PHYS_MSBITS)
32#define bus_to_phys(x) (((x) < MEM_GAP_PHYS_ADDR) ? \ 41
33 ((x) - phys_to_bus_offset) : (x)) 42#define IOR_DMA_MSBITS (IOR_DMA_BITS - IOR_LSBITS)
34#else 43#define IOR_NUM_DMA_TO_PHYS ((dma_addr_t) 1 << IOR_DMA_MSBITS)
35#define phys_to_bus(x) ((x) + phys_to_bus_offset)
36#define bus_to_phys(x) ((x) - phys_to_bus_offset)
37#endif
38 44
39/* 45/*
40 * Determine whether the address we are given is for an ASIC device 46 * Define data structures used as elements in the arrays for the conversion
41 * Params: addr Address to check 47 * between physical and DMA addresses. We do some slightly fancy math to
42 * Returns: Zero if the address is not for ASIC devices, non-zero 48 * compute the width of the offset element of the conversion tables so
43 * if it is. 49 * that we can have the smallest conversion tables. Next, round up the
50 * sizes to the next higher power of two, i.e. the offset element will have
51 * 8, 16, 32, 64, etc. bits. This eliminates the need to mask off any
52 * bits. Finally, we compute a shift value that puts the most significant
53 * bits of the offset into the most significant bits of the offset element.
54 * This makes it more efficient on processors without barrel shifters and
55 * easier to see the values if the conversion table is dumped in binary.
44 */ 56 */
45static inline int asic_is_device_addr(phys_t addr) 57#define _IOR_OFFSET_WIDTH(n) (1 << order_base_2(n))
58#define IOR_OFFSET_WIDTH(n) \
59 (_IOR_OFFSET_WIDTH(n) < 8 ? 8 : _IOR_OFFSET_WIDTH(n))
60
61#define IOR_PHYS_OFFSET_BITS IOR_OFFSET_WIDTH(IOR_PHYS_MSBITS)
62#define IOR_PHYS_SHIFT (IOR_PHYS_BITS - IOR_PHYS_OFFSET_BITS)
63
64#define IOR_DMA_OFFSET_BITS IOR_OFFSET_WIDTH(IOR_DMA_MSBITS)
65#define IOR_DMA_SHIFT (IOR_DMA_BITS - IOR_DMA_OFFSET_BITS)
66
67struct ior_phys_to_dma {
68 dma_addr_t offset:IOR_DMA_OFFSET_BITS __packed
69 __aligned((IOR_DMA_OFFSET_BITS / IOR_BPC));
70};
71
72struct ior_dma_to_phys {
73 dma_addr_t offset:IOR_PHYS_OFFSET_BITS __packed
74 __aligned((IOR_PHYS_OFFSET_BITS / IOR_BPC));
75};
76
77extern struct ior_phys_to_dma _ior_phys_to_dma[IOR_NUM_PHYS_TO_DMA];
78extern struct ior_dma_to_phys _ior_dma_to_phys[IOR_NUM_DMA_TO_PHYS];
79
80static inline dma_addr_t _phys_to_dma_offset_raw(phys_addr_t phys)
46{ 81{
47 return !((phys_t)addr & (phys_t) LOW_MEM_BOUNDARY_MASK); 82 return (dma_addr_t)_ior_phys_to_dma[phys >> IOR_LSBITS].offset;
48} 83}
49 84
50/* 85static inline dma_addr_t _dma_to_phys_offset_raw(dma_addr_t dma)
51 * Determine whether the address we are given is external RAM mappable
52 * into KSEG1.
53 * Params: addr Address to check
54 * Returns: Zero if the address is not for external RAM and
55 */
56static inline int asic_is_lowmem_ram_addr(phys_t addr)
57{ 86{
58 /* 87 return (dma_addr_t)_ior_dma_to_phys[dma >> IOR_LSBITS].offset;
59 * The RAM always starts at the following address in the processor's 88}
60 * physical address space
61 */
62 static const phys_t phys_ram_base = 0x10000000;
63 phys_t bus_ram_base;
64 89
65 bus_ram_base = phys_to_bus_offset + phys_ram_base; 90/* These are not portable and should not be used in drivers. Drivers should
91 * be using ioremap() and friends to map physical addreses to virtual
92 * addresses and dma_map*() and friends to map virtual addresses into DMA
93 * addresses and back.
94 */
95static inline dma_addr_t phys_to_dma(phys_addr_t phys)
96{
97 return phys + (_phys_to_dma_offset_raw(phys) << IOR_PHYS_SHIFT);
98}
66 99
67 return addr >= bus_ram_base && 100static inline phys_addr_t dma_to_phys(dma_addr_t dma)
68 addr < (bus_ram_base + (LOW_MEM_BOUNDARY_PHYS - phys_ram_base)); 101{
102 return dma + (_dma_to_phys_offset_raw(dma) << IOR_DMA_SHIFT);
69} 103}
70 104
105extern void ioremap_add_map(dma_addr_t phys, phys_addr_t alias,
106 dma_addr_t size);
107
71/* 108/*
72 * Allow physical addresses to be fixed up to help peripherals located 109 * Allow physical addresses to be fixed up to help peripherals located
73 * outside the low 32-bit range -- generic pass-through version. 110 * outside the low 32-bit range -- generic pass-through version.
@@ -77,10 +114,50 @@ static inline phys_t fixup_bigphys_addr(phys_t phys_addr, phys_t size)
77 return phys_addr; 114 return phys_addr;
78} 115}
79 116
80static inline void __iomem *plat_ioremap(phys_t offset, unsigned long size, 117/*
118 * Handle the special case of addresses the area aliased into the first
119 * 512 MiB of the processor's physical address space. These turn into either
120 * kseg0 or kseg1 addresses, depending on flags.
121 */
122static inline void __iomem *plat_ioremap(phys_t start, unsigned long size,
81 unsigned long flags) 123 unsigned long flags)
82{ 124{
83 return NULL; 125 phys_addr_t start_offset;
126 void __iomem *result = NULL;
127
128 /* Start by checking to see whether this is an aliased address */
129 start_offset = _dma_to_phys_offset_raw(start);
130
131 /*
132 * If:
133 * o the memory is aliased into the first 512 MiB, and
134 * o the start and end are in the same RAM bank, and
135 * o we don't have a zero size or wrap around, and
136 * o we are supposed to create an uncached mapping,
137 * handle this is a kseg0 or kseg1 address
138 */
139 if (start_offset != 0) {
140 phys_addr_t last;
141 dma_addr_t dma_to_phys_offset;
142
143 last = start + size - 1;
144 dma_to_phys_offset =
145 _dma_to_phys_offset_raw(last) << IOR_DMA_SHIFT;
146
147 if (dma_to_phys_offset == start_offset &&
148 size != 0 && start <= last) {
149 phys_t adjusted_start;
150 adjusted_start = start + start_offset;
151 if (flags == _CACHE_UNCACHED)
152 result = (void __iomem *) (unsigned long)
153 CKSEG1ADDR(adjusted_start);
154 else
155 result = (void __iomem *) (unsigned long)
156 CKSEG0ADDR(adjusted_start);
157 }
158 }
159
160 return result;
84} 161}
85 162
86static inline int plat_iounmap(const volatile void __iomem *addr) 163static inline int plat_iounmap(const volatile void __iomem *addr)
diff --git a/arch/mips/include/asm/mach-tx49xx/kmalloc.h b/arch/mips/include/asm/mach-tx49xx/kmalloc.h
index 913ff196259d..b74caf65482b 100644
--- a/arch/mips/include/asm/mach-tx49xx/kmalloc.h
+++ b/arch/mips/include/asm/mach-tx49xx/kmalloc.h
@@ -1,8 +1,6 @@
1#ifndef __ASM_MACH_TX49XX_KMALLOC_H 1#ifndef __ASM_MACH_TX49XX_KMALLOC_H
2#define __ASM_MACH_TX49XX_KMALLOC_H 2#define __ASM_MACH_TX49XX_KMALLOC_H
3 3
4/* 4#define ARCH_KMALLOC_MINALIGN L1_CACHE_BYTES
5 * All happy, no need to define ARCH_KMALLOC_MINALIGN
6 */
7 5
8#endif /* __ASM_MACH_TX49XX_KMALLOC_H */ 6#endif /* __ASM_MACH_TX49XX_KMALLOC_H */
diff --git a/arch/mips/include/asm/mipsregs.h b/arch/mips/include/asm/mipsregs.h
index c6e3c93ce7c7..335474c155f6 100644
--- a/arch/mips/include/asm/mipsregs.h
+++ b/arch/mips/include/asm/mipsregs.h
@@ -408,6 +408,7 @@
408#define STATUSB_IP15 7 408#define STATUSB_IP15 7
409#define STATUSF_IP15 (_ULCAST_(1) << 7) 409#define STATUSF_IP15 (_ULCAST_(1) << 7)
410#define ST0_CH 0x00040000 410#define ST0_CH 0x00040000
411#define ST0_NMI 0x00080000
411#define ST0_SR 0x00100000 412#define ST0_SR 0x00100000
412#define ST0_TS 0x00200000 413#define ST0_TS 0x00200000
413#define ST0_BEV 0x00400000 414#define ST0_BEV 0x00400000
diff --git a/arch/mips/include/asm/octeon/octeon.h b/arch/mips/include/asm/octeon/octeon.h
index ca6214b5ccb9..917a6c413b1a 100644
--- a/arch/mips/include/asm/octeon/octeon.h
+++ b/arch/mips/include/asm/octeon/octeon.h
@@ -50,6 +50,7 @@ extern void octeon_crypto_disable(struct octeon_cop2_state *state,
50extern asmlinkage void octeon_cop2_restore(struct octeon_cop2_state *task); 50extern asmlinkage void octeon_cop2_restore(struct octeon_cop2_state *task);
51 51
52extern void octeon_init_cvmcount(void); 52extern void octeon_init_cvmcount(void);
53extern void octeon_setup_delays(void);
53 54
54#define OCTEON_ARGV_MAX_ARGS 64 55#define OCTEON_ARGV_MAX_ARGS 64
55#define OCTOEN_SERIAL_LEN 20 56#define OCTOEN_SERIAL_LEN 20
@@ -253,4 +254,6 @@ static inline uint32_t octeon_npi_read32(uint64_t address)
253 254
254extern struct cvmx_bootinfo *octeon_bootinfo; 255extern struct cvmx_bootinfo *octeon_bootinfo;
255 256
257extern uint64_t octeon_bootloader_entry_addr;
258
256#endif /* __ASM_OCTEON_OCTEON_H */ 259#endif /* __ASM_OCTEON_OCTEON_H */
diff --git a/arch/mips/include/asm/octeon/pci-octeon.h b/arch/mips/include/asm/octeon/pci-octeon.h
index 6ac5d3e3398e..ece78043acf6 100644
--- a/arch/mips/include/asm/octeon/pci-octeon.h
+++ b/arch/mips/include/asm/octeon/pci-octeon.h
@@ -15,6 +15,19 @@
15#define PCI_CONFIG_SPACE_DELAY 10000 15#define PCI_CONFIG_SPACE_DELAY 10000
16 16
17/* 17/*
18 * The physical memory base mapped by BAR1. 256MB at the end of the
19 * first 4GB.
20 */
21#define CVMX_PCIE_BAR1_PHYS_BASE ((1ull << 32) - (1ull << 28))
22#define CVMX_PCIE_BAR1_PHYS_SIZE (1ull << 28)
23
24/*
25 * The RC base of BAR1. gen1 has a 39-bit BAR2, gen2 has 41-bit BAR2,
26 * place BAR1 so it is the same for both.
27 */
28#define CVMX_PCIE_BAR1_RC_BASE (1ull << 41)
29
30/*
18 * pcibios_map_irq() is defined inside pci-octeon.c. All it does is 31 * pcibios_map_irq() is defined inside pci-octeon.c. All it does is
19 * call the Octeon specific version pointed to by this variable. This 32 * call the Octeon specific version pointed to by this variable. This
20 * function needs to change for PCI or PCIe based hosts. 33 * function needs to change for PCI or PCIe based hosts.
diff --git a/arch/mips/include/asm/pci.h b/arch/mips/include/asm/pci.h
index 3beea1479b43..576397c69920 100644
--- a/arch/mips/include/asm/pci.h
+++ b/arch/mips/include/asm/pci.h
@@ -140,6 +140,11 @@ static inline int pci_get_legacy_ide_irq(struct pci_dev *dev, int channel)
140 return channel ? 15 : 14; 140 return channel ? 15 : 14;
141} 141}
142 142
143#ifdef CONFIG_CPU_CAVIUM_OCTEON
144/* MSI arch hook for OCTEON */
145#define arch_setup_msi_irqs arch_setup_msi_irqs
146#endif
147
143extern int pci_probe_only; 148extern int pci_probe_only;
144 149
145extern char * (*pcibios_plat_setup)(char *str); 150extern char * (*pcibios_plat_setup)(char *str);
diff --git a/arch/mips/include/asm/pmc-sierra/msp71xx/msp_prom.h b/arch/mips/include/asm/pmc-sierra/msp71xx/msp_prom.h
index 54ef1a96d7ce..786d82daf8d6 100644
--- a/arch/mips/include/asm/pmc-sierra/msp71xx/msp_prom.h
+++ b/arch/mips/include/asm/pmc-sierra/msp71xx/msp_prom.h
@@ -124,10 +124,6 @@ extern void prom_meminit(void);
124extern void prom_fixup_mem_map(unsigned long start_mem, 124extern void prom_fixup_mem_map(unsigned long start_mem,
125 unsigned long end_mem); 125 unsigned long end_mem);
126 126
127#ifdef CONFIG_MTD_PMC_MSP_RAMROOT
128extern bool get_ramroot(void **start, unsigned long *size);
129#endif
130
131extern int get_ethernet_addr(char *ethaddr_name, char *ethernet_addr); 127extern int get_ethernet_addr(char *ethaddr_name, char *ethernet_addr);
132extern unsigned long get_deviceid(void); 128extern unsigned long get_deviceid(void);
133extern char identify_enet(unsigned long interface_num); 129extern char identify_enet(unsigned long interface_num);
diff --git a/arch/mips/include/asm/processor.h b/arch/mips/include/asm/processor.h
index 5d33b727acf5..0d629bb93cbe 100644
--- a/arch/mips/include/asm/processor.h
+++ b/arch/mips/include/asm/processor.h
@@ -34,6 +34,11 @@ extern void (*cpu_wait)(void);
34extern unsigned int vced_count, vcei_count; 34extern unsigned int vced_count, vcei_count;
35 35
36/* 36/*
37 * MIPS does have an arch_pick_mmap_layout()
38 */
39#define HAVE_ARCH_PICK_MMAP_LAYOUT 1
40
41/*
37 * A special page (the vdso) is mapped into all processes at the very 42 * A special page (the vdso) is mapped into all processes at the very
38 * top of the virtual memory space. 43 * top of the virtual memory space.
39 */ 44 */
@@ -52,6 +57,9 @@ extern unsigned int vced_count, vcei_count;
52 * space during mmap's. 57 * space during mmap's.
53 */ 58 */
54#define TASK_UNMAPPED_BASE ((TASK_SIZE / 3) & ~(PAGE_SIZE)) 59#define TASK_UNMAPPED_BASE ((TASK_SIZE / 3) & ~(PAGE_SIZE))
60
61#define TASK_IS_32BIT_ADDR 1
62
55#endif 63#endif
56 64
57#ifdef CONFIG_64BIT 65#ifdef CONFIG_64BIT
@@ -77,6 +85,9 @@ extern unsigned int vced_count, vcei_count;
77 PAGE_ALIGN(TASK_SIZE32 / 3) : PAGE_ALIGN(TASK_SIZE / 3)) 85 PAGE_ALIGN(TASK_SIZE32 / 3) : PAGE_ALIGN(TASK_SIZE / 3))
78#define TASK_SIZE_OF(tsk) \ 86#define TASK_SIZE_OF(tsk) \
79 (test_tsk_thread_flag(tsk, TIF_32BIT_ADDR) ? TASK_SIZE32 : TASK_SIZE) 87 (test_tsk_thread_flag(tsk, TIF_32BIT_ADDR) ? TASK_SIZE32 : TASK_SIZE)
88
89#define TASK_IS_32BIT_ADDR test_thread_flag(TIF_32BIT_ADDR)
90
80#endif 91#endif
81 92
82#ifdef __KERNEL__ 93#ifdef __KERNEL__
@@ -218,7 +229,6 @@ struct thread_struct {
218 unsigned long cp0_badvaddr; /* Last user fault */ 229 unsigned long cp0_badvaddr; /* Last user fault */
219 unsigned long cp0_baduaddr; /* Last kernel fault accessing USEG */ 230 unsigned long cp0_baduaddr; /* Last kernel fault accessing USEG */
220 unsigned long error_code; 231 unsigned long error_code;
221 unsigned long trap_no;
222 unsigned long irix_trampoline; /* Wheee... */ 232 unsigned long irix_trampoline; /* Wheee... */
223 unsigned long irix_oldctx; 233 unsigned long irix_oldctx;
224#ifdef CONFIG_CPU_CAVIUM_OCTEON 234#ifdef CONFIG_CPU_CAVIUM_OCTEON
@@ -290,7 +300,6 @@ struct thread_struct {
290 .cp0_badvaddr = 0, \ 300 .cp0_badvaddr = 0, \
291 .cp0_baduaddr = 0, \ 301 .cp0_baduaddr = 0, \
292 .error_code = 0, \ 302 .error_code = 0, \
293 .trap_no = 0, \
294 .irix_trampoline = 0, \ 303 .irix_trampoline = 0, \
295 .irix_oldctx = 0, \ 304 .irix_oldctx = 0, \
296 /* \ 305 /* \
diff --git a/arch/mips/include/asm/ptrace.h b/arch/mips/include/asm/ptrace.h
index cdc6a46efd98..9f1b8dba2c81 100644
--- a/arch/mips/include/asm/ptrace.h
+++ b/arch/mips/include/asm/ptrace.h
@@ -137,6 +137,7 @@ extern int ptrace_set_watch_regs(struct task_struct *child,
137 */ 137 */
138#define user_mode(regs) (((regs)->cp0_status & KU_MASK) == KU_USER) 138#define user_mode(regs) (((regs)->cp0_status & KU_MASK) == KU_USER)
139 139
140#define regs_return_value(_regs) ((_regs)->regs[2])
140#define instruction_pointer(regs) ((regs)->cp0_epc) 141#define instruction_pointer(regs) ((regs)->cp0_epc)
141#define profile_pc(regs) instruction_pointer(regs) 142#define profile_pc(regs) instruction_pointer(regs)
142 143
diff --git a/arch/mips/include/asm/sn/agent.h b/arch/mips/include/asm/sn/agent.h
index ac4ea85c3a5c..dc81114d4742 100644
--- a/arch/mips/include/asm/sn/agent.h
+++ b/arch/mips/include/asm/sn/agent.h
@@ -11,7 +11,6 @@
11#ifndef _ASM_SGI_SN_AGENT_H 11#ifndef _ASM_SGI_SN_AGENT_H
12#define _ASM_SGI_SN_AGENT_H 12#define _ASM_SGI_SN_AGENT_H
13 13
14#include <linux/topology.h>
15#include <asm/sn/addrs.h> 14#include <asm/sn/addrs.h>
16#include <asm/sn/arch.h> 15#include <asm/sn/arch.h>
17 16
diff --git a/arch/mips/include/asm/uasm.h b/arch/mips/include/asm/uasm.h
index 697e40c06497..892062d6d748 100644
--- a/arch/mips/include/asm/uasm.h
+++ b/arch/mips/include/asm/uasm.h
@@ -10,44 +10,55 @@
10 10
11#include <linux/types.h> 11#include <linux/types.h>
12 12
13#ifdef CONFIG_EXPORT_UASM
14#include <linux/module.h>
15#define __uasminit
16#define __uasminitdata
17#define UASM_EXPORT_SYMBOL(sym) EXPORT_SYMBOL(sym)
18#else
19#define __uasminit __cpuinit
20#define __uasminitdata __cpuinitdata
21#define UASM_EXPORT_SYMBOL(sym)
22#endif
23
13#define Ip_u1u2u3(op) \ 24#define Ip_u1u2u3(op) \
14void __cpuinit \ 25void __uasminit \
15uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c) 26uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c)
16 27
17#define Ip_u2u1u3(op) \ 28#define Ip_u2u1u3(op) \
18void __cpuinit \ 29void __uasminit \
19uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c) 30uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c)
20 31
21#define Ip_u3u1u2(op) \ 32#define Ip_u3u1u2(op) \
22void __cpuinit \ 33void __uasminit \
23uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c) 34uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c)
24 35
25#define Ip_u1u2s3(op) \ 36#define Ip_u1u2s3(op) \
26void __cpuinit \ 37void __uasminit \
27uasm_i##op(u32 **buf, unsigned int a, unsigned int b, signed int c) 38uasm_i##op(u32 **buf, unsigned int a, unsigned int b, signed int c)
28 39
29#define Ip_u2s3u1(op) \ 40#define Ip_u2s3u1(op) \
30void __cpuinit \ 41void __uasminit \
31uasm_i##op(u32 **buf, unsigned int a, signed int b, unsigned int c) 42uasm_i##op(u32 **buf, unsigned int a, signed int b, unsigned int c)
32 43
33#define Ip_u2u1s3(op) \ 44#define Ip_u2u1s3(op) \
34void __cpuinit \ 45void __uasminit \
35uasm_i##op(u32 **buf, unsigned int a, unsigned int b, signed int c) 46uasm_i##op(u32 **buf, unsigned int a, unsigned int b, signed int c)
36 47
37#define Ip_u2u1msbu3(op) \ 48#define Ip_u2u1msbu3(op) \
38void __cpuinit \ 49void __uasminit \
39uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c, \ 50uasm_i##op(u32 **buf, unsigned int a, unsigned int b, unsigned int c, \
40 unsigned int d) 51 unsigned int d)
41 52
42#define Ip_u1u2(op) \ 53#define Ip_u1u2(op) \
43void __cpuinit uasm_i##op(u32 **buf, unsigned int a, unsigned int b) 54void __uasminit uasm_i##op(u32 **buf, unsigned int a, unsigned int b)
44 55
45#define Ip_u1s2(op) \ 56#define Ip_u1s2(op) \
46void __cpuinit uasm_i##op(u32 **buf, unsigned int a, signed int b) 57void __uasminit uasm_i##op(u32 **buf, unsigned int a, signed int b)
47 58
48#define Ip_u1(op) void __cpuinit uasm_i##op(u32 **buf, unsigned int a) 59#define Ip_u1(op) void __uasminit uasm_i##op(u32 **buf, unsigned int a)
49 60
50#define Ip_0(op) void __cpuinit uasm_i##op(u32 **buf) 61#define Ip_0(op) void __uasminit uasm_i##op(u32 **buf)
51 62
52Ip_u2u1s3(_addiu); 63Ip_u2u1s3(_addiu);
53Ip_u3u1u2(_addu); 64Ip_u3u1u2(_addu);
@@ -71,6 +82,7 @@ Ip_u2u1u3(_dsra);
71Ip_u2u1u3(_dsrl); 82Ip_u2u1u3(_dsrl);
72Ip_u2u1u3(_dsrl32); 83Ip_u2u1u3(_dsrl32);
73Ip_u2u1u3(_drotr); 84Ip_u2u1u3(_drotr);
85Ip_u2u1u3(_drotr32);
74Ip_u3u1u2(_dsubu); 86Ip_u3u1u2(_dsubu);
75Ip_0(_eret); 87Ip_0(_eret);
76Ip_u1(_j); 88Ip_u1(_j);
@@ -111,7 +123,7 @@ struct uasm_label {
111 int lab; 123 int lab;
112}; 124};
113 125
114void __cpuinit uasm_build_label(struct uasm_label **lab, u32 *addr, int lid); 126void __uasminit uasm_build_label(struct uasm_label **lab, u32 *addr, int lid);
115#ifdef CONFIG_64BIT 127#ifdef CONFIG_64BIT
116int uasm_in_compat_space_p(long addr); 128int uasm_in_compat_space_p(long addr);
117#endif 129#endif
@@ -121,7 +133,7 @@ void UASM_i_LA_mostly(u32 **buf, unsigned int rs, long addr);
121void UASM_i_LA(u32 **buf, unsigned int rs, long addr); 133void UASM_i_LA(u32 **buf, unsigned int rs, long addr);
122 134
123#define UASM_L_LA(lb) \ 135#define UASM_L_LA(lb) \
124static inline void __cpuinit uasm_l##lb(struct uasm_label **lab, u32 *addr) \ 136static inline void __uasminit uasm_l##lb(struct uasm_label **lab, u32 *addr) \
125{ \ 137{ \
126 uasm_build_label(lab, addr, label##lb); \ 138 uasm_build_label(lab, addr, label##lb); \
127} 139}
@@ -176,6 +188,15 @@ static inline void uasm_i_dsrl_safe(u32 **p, unsigned int a1,
176 uasm_i_dsrl32(p, a1, a2, a3 - 32); 188 uasm_i_dsrl32(p, a1, a2, a3 - 32);
177} 189}
178 190
191static inline void uasm_i_drotr_safe(u32 **p, unsigned int a1,
192 unsigned int a2, unsigned int a3)
193{
194 if (a3 < 32)
195 uasm_i_drotr(p, a1, a2, a3);
196 else
197 uasm_i_drotr32(p, a1, a2, a3 - 32);
198}
199
179static inline void uasm_i_dsll_safe(u32 **p, unsigned int a1, 200static inline void uasm_i_dsll_safe(u32 **p, unsigned int a1,
180 unsigned int a2, unsigned int a3) 201 unsigned int a2, unsigned int a3)
181{ 202{
@@ -213,3 +234,7 @@ void uasm_il_bne(u32 **p, struct uasm_reloc **r, unsigned int reg1,
213void uasm_il_bnez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); 234void uasm_il_bnez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid);
214void uasm_il_bgezl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); 235void uasm_il_bgezl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid);
215void uasm_il_bgez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid); 236void uasm_il_bgez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid);
237void uasm_il_bbit0(u32 **p, struct uasm_reloc **r, unsigned int reg,
238 unsigned int bit, int lid);
239void uasm_il_bbit1(u32 **p, struct uasm_reloc **r, unsigned int reg,
240 unsigned int bit, int lid);
diff --git a/arch/mips/jazz/Makefile b/arch/mips/jazz/Makefile
index 5aee0c266d18..dd9d99bfcf7a 100644
--- a/arch/mips/jazz/Makefile
+++ b/arch/mips/jazz/Makefile
@@ -3,5 +3,3 @@
3# 3#
4 4
5obj-y := irq.o jazzdma.o reset.o setup.o 5obj-y := irq.o jazzdma.o reset.o setup.o
6
7EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/jazz/Platform b/arch/mips/jazz/Platform
new file mode 100644
index 000000000000..3373788acca1
--- /dev/null
+++ b/arch/mips/jazz/Platform
@@ -0,0 +1,6 @@
1#
2# Acer PICA 61, Mips Magnum 4000 and Olivetti M700.
3#
4platform-$(CONFIG_MACH_JAZZ) += jazz/
5cflags-$(CONFIG_MACH_JAZZ) += -I$(srctree)/arch/mips/include/asm/mach-jazz
6load-$(CONFIG_MACH_JAZZ) += 0xffffffff80080000
diff --git a/arch/mips/jz4740/Kconfig b/arch/mips/jz4740/Kconfig
new file mode 100644
index 000000000000..3e7141f0746c
--- /dev/null
+++ b/arch/mips/jz4740/Kconfig
@@ -0,0 +1,12 @@
1choice
2 prompt "Machine type"
3 depends on MACH_JZ4740
4 default JZ4740_QI_LB60
5
6config JZ4740_QI_LB60
7 bool "Qi Hardware Ben NanoNote"
8
9endchoice
10
11config HAVE_PWM
12 bool
diff --git a/arch/mips/jz4740/Makefile b/arch/mips/jz4740/Makefile
new file mode 100644
index 000000000000..a604eaeb6c08
--- /dev/null
+++ b/arch/mips/jz4740/Makefile
@@ -0,0 +1,20 @@
1#
2# Makefile for the Ingenic JZ4740.
3#
4
5# Object file lists.
6
7obj-y += prom.o irq.o time.o reset.o setup.o dma.o \
8 gpio.o clock.o platform.o timer.o pwm.o serial.o
9
10obj-$(CONFIG_DEBUG_FS) += clock-debugfs.o
11
12# board specific support
13
14obj-$(CONFIG_JZ4740_QI_LB60) += board-qi_lb60.o
15
16# PM support
17
18obj-$(CONFIG_PM) += pm.o
19
20EXTRA_CFLAGS += -Werror -Wall
diff --git a/arch/mips/jz4740/Platform b/arch/mips/jz4740/Platform
new file mode 100644
index 000000000000..6a97230e3d05
--- /dev/null
+++ b/arch/mips/jz4740/Platform
@@ -0,0 +1,3 @@
1core-$(CONFIG_MACH_JZ4740) += arch/mips/jz4740/
2cflags-$(CONFIG_MACH_JZ4740) += -I$(srctree)/arch/mips/include/asm/mach-jz4740
3load-$(CONFIG_MACH_JZ4740) += 0xffffffff80010000
diff --git a/arch/mips/jz4740/board-qi_lb60.c b/arch/mips/jz4740/board-qi_lb60.c
new file mode 100644
index 000000000000..5742bb4d78f4
--- /dev/null
+++ b/arch/mips/jz4740/board-qi_lb60.c
@@ -0,0 +1,471 @@
1/*
2 * linux/arch/mips/jz4740/board-qi_lb60.c
3 *
4 * QI_LB60 board support
5 *
6 * Copyright (c) 2009 Qi Hardware inc.,
7 * Author: Xiangfu Liu <xiangfu@qi-hardware.com>
8 * Copyright 2010, Lars-Petrer Clausen <lars@metafoo.de>
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 or later
12 * as published by the Free Software Foundation.
13 */
14
15#include <linux/kernel.h>
16#include <linux/init.h>
17#include <linux/gpio.h>
18
19#include <linux/input.h>
20#include <linux/gpio_keys.h>
21#include <linux/input/matrix_keypad.h>
22#include <linux/spi/spi.h>
23#include <linux/spi/spi_gpio.h>
24#include <linux/power_supply.h>
25#include <linux/power/jz4740-battery.h>
26
27#include <asm/mach-jz4740/jz4740_fb.h>
28#include <asm/mach-jz4740/jz4740_mmc.h>
29#include <asm/mach-jz4740/jz4740_nand.h>
30
31#include <linux/regulator/fixed.h>
32#include <linux/regulator/machine.h>
33
34#include <linux/leds_pwm.h>
35
36#include <asm/mach-jz4740/platform.h>
37
38#include "clock.h"
39
40static bool is_avt2;
41
42/* GPIOs */
43#define QI_LB60_GPIO_SD_CD JZ_GPIO_PORTD(0)
44#define QI_LB60_GPIO_SD_VCC_EN_N JZ_GPIO_PORTD(2)
45
46#define QI_LB60_GPIO_KEYOUT(x) (JZ_GPIO_PORTC(10) + (x))
47#define QI_LB60_GPIO_KEYIN(x) (JZ_GPIO_PORTD(18) + (x))
48#define QI_LB60_GPIO_KEYIN8 JZ_GPIO_PORTD(26)
49
50/* NAND */
51static struct nand_ecclayout qi_lb60_ecclayout_1gb = {
52/* .eccbytes = 36,
53 .eccpos = {
54 6, 7, 8, 9, 10, 11, 12, 13,
55 14, 15, 16, 17, 18, 19, 20, 21,
56 22, 23, 24, 25, 26, 27, 28, 29,
57 30, 31, 32, 33, 34, 35, 36, 37,
58 38, 39, 40, 41
59 },*/
60 .oobfree = {
61 { .offset = 2, .length = 4 },
62 { .offset = 42, .length = 22 }
63 },
64};
65
66/* Early prototypes of the QI LB60 had only 1GB of NAND.
67 * In order to support these devices aswell the partition and ecc layout is
68 * initalized depending on the NAND size */
69static struct mtd_partition qi_lb60_partitions_1gb[] = {
70 {
71 .name = "NAND BOOT partition",
72 .offset = 0 * 0x100000,
73 .size = 4 * 0x100000,
74 },
75 {
76 .name = "NAND KERNEL partition",
77 .offset = 4 * 0x100000,
78 .size = 4 * 0x100000,
79 },
80 {
81 .name = "NAND ROOTFS partition",
82 .offset = 8 * 0x100000,
83 .size = (504 + 512) * 0x100000,
84 },
85};
86
87static struct nand_ecclayout qi_lb60_ecclayout_2gb = {
88/* .eccbytes = 72,
89 .eccpos = {
90 12, 13, 14, 15, 16, 17, 18, 19,
91 20, 21, 22, 23, 24, 25, 26, 27,
92 28, 29, 30, 31, 32, 33, 34, 35,
93 36, 37, 38, 39, 40, 41, 42, 43,
94 44, 45, 46, 47, 48, 49, 50, 51,
95 52, 53, 54, 55, 56, 57, 58, 59,
96 60, 61, 62, 63, 64, 65, 66, 67,
97 68, 69, 70, 71, 72, 73, 74, 75,
98 76, 77, 78, 79, 80, 81, 82, 83
99 },*/
100 .oobfree = {
101 { .offset = 2, .length = 10 },
102 { .offset = 84, .length = 44 },
103 },
104};
105
106static struct mtd_partition qi_lb60_partitions_2gb[] = {
107 {
108 .name = "NAND BOOT partition",
109 .offset = 0 * 0x100000,
110 .size = 4 * 0x100000,
111 },
112 {
113 .name = "NAND KERNEL partition",
114 .offset = 4 * 0x100000,
115 .size = 4 * 0x100000,
116 },
117 {
118 .name = "NAND ROOTFS partition",
119 .offset = 8 * 0x100000,
120 .size = (504 + 512 + 1024) * 0x100000,
121 },
122};
123
124static void qi_lb60_nand_ident(struct platform_device *pdev,
125 struct nand_chip *chip, struct mtd_partition **partitions,
126 int *num_partitions)
127{
128 if (chip->page_shift == 12) {
129 chip->ecc.layout = &qi_lb60_ecclayout_2gb;
130 *partitions = qi_lb60_partitions_2gb;
131 *num_partitions = ARRAY_SIZE(qi_lb60_partitions_2gb);
132 } else {
133 chip->ecc.layout = &qi_lb60_ecclayout_1gb;
134 *partitions = qi_lb60_partitions_1gb;
135 *num_partitions = ARRAY_SIZE(qi_lb60_partitions_1gb);
136 }
137}
138
139static struct jz_nand_platform_data qi_lb60_nand_pdata = {
140 .ident_callback = qi_lb60_nand_ident,
141 .busy_gpio = 94,
142};
143
144/* Keyboard*/
145
146#define KEY_QI_QI KEY_F13
147#define KEY_QI_UPRED KEY_RIGHTALT
148#define KEY_QI_VOLUP KEY_VOLUMEUP
149#define KEY_QI_VOLDOWN KEY_VOLUMEDOWN
150#define KEY_QI_FN KEY_LEFTCTRL
151
152static const uint32_t qi_lb60_keymap[] = {
153 KEY(0, 0, KEY_F1), /* S2 */
154 KEY(0, 1, KEY_F2), /* S3 */
155 KEY(0, 2, KEY_F3), /* S4 */
156 KEY(0, 3, KEY_F4), /* S5 */
157 KEY(0, 4, KEY_F5), /* S6 */
158 KEY(0, 5, KEY_F6), /* S7 */
159 KEY(0, 6, KEY_F7), /* S8 */
160
161 KEY(1, 0, KEY_Q), /* S10 */
162 KEY(1, 1, KEY_W), /* S11 */
163 KEY(1, 2, KEY_E), /* S12 */
164 KEY(1, 3, KEY_R), /* S13 */
165 KEY(1, 4, KEY_T), /* S14 */
166 KEY(1, 5, KEY_Y), /* S15 */
167 KEY(1, 6, KEY_U), /* S16 */
168 KEY(1, 7, KEY_I), /* S17 */
169 KEY(2, 0, KEY_A), /* S18 */
170 KEY(2, 1, KEY_S), /* S19 */
171 KEY(2, 2, KEY_D), /* S20 */
172 KEY(2, 3, KEY_F), /* S21 */
173 KEY(2, 4, KEY_G), /* S22 */
174 KEY(2, 5, KEY_H), /* S23 */
175 KEY(2, 6, KEY_J), /* S24 */
176 KEY(2, 7, KEY_K), /* S25 */
177 KEY(3, 0, KEY_ESC), /* S26 */
178 KEY(3, 1, KEY_Z), /* S27 */
179 KEY(3, 2, KEY_X), /* S28 */
180 KEY(3, 3, KEY_C), /* S29 */
181 KEY(3, 4, KEY_V), /* S30 */
182 KEY(3, 5, KEY_B), /* S31 */
183 KEY(3, 6, KEY_N), /* S32 */
184 KEY(3, 7, KEY_M), /* S33 */
185 KEY(4, 0, KEY_TAB), /* S34 */
186 KEY(4, 1, KEY_CAPSLOCK), /* S35 */
187 KEY(4, 2, KEY_BACKSLASH), /* S36 */
188 KEY(4, 3, KEY_APOSTROPHE), /* S37 */
189 KEY(4, 4, KEY_COMMA), /* S38 */
190 KEY(4, 5, KEY_DOT), /* S39 */
191 KEY(4, 6, KEY_SLASH), /* S40 */
192 KEY(4, 7, KEY_UP), /* S41 */
193 KEY(5, 0, KEY_O), /* S42 */
194 KEY(5, 1, KEY_L), /* S43 */
195 KEY(5, 2, KEY_EQUAL), /* S44 */
196 KEY(5, 3, KEY_QI_UPRED), /* S45 */
197 KEY(5, 4, KEY_SPACE), /* S46 */
198 KEY(5, 5, KEY_QI_QI), /* S47 */
199 KEY(5, 6, KEY_RIGHTCTRL), /* S48 */
200 KEY(5, 7, KEY_LEFT), /* S49 */
201 KEY(6, 0, KEY_F8), /* S50 */
202 KEY(6, 1, KEY_P), /* S51 */
203 KEY(6, 2, KEY_BACKSPACE),/* S52 */
204 KEY(6, 3, KEY_ENTER), /* S53 */
205 KEY(6, 4, KEY_QI_VOLUP), /* S54 */
206 KEY(6, 5, KEY_QI_VOLDOWN), /* S55 */
207 KEY(6, 6, KEY_DOWN), /* S56 */
208 KEY(6, 7, KEY_RIGHT), /* S57 */
209
210 KEY(7, 0, KEY_LEFTSHIFT), /* S58 */
211 KEY(7, 1, KEY_LEFTALT), /* S59 */
212 KEY(7, 2, KEY_QI_FN), /* S60 */
213};
214
215static const struct matrix_keymap_data qi_lb60_keymap_data = {
216 .keymap = qi_lb60_keymap,
217 .keymap_size = ARRAY_SIZE(qi_lb60_keymap),
218};
219
220static const unsigned int qi_lb60_keypad_cols[] = {
221 QI_LB60_GPIO_KEYOUT(0),
222 QI_LB60_GPIO_KEYOUT(1),
223 QI_LB60_GPIO_KEYOUT(2),
224 QI_LB60_GPIO_KEYOUT(3),
225 QI_LB60_GPIO_KEYOUT(4),
226 QI_LB60_GPIO_KEYOUT(5),
227 QI_LB60_GPIO_KEYOUT(6),
228 QI_LB60_GPIO_KEYOUT(7),
229};
230
231static const unsigned int qi_lb60_keypad_rows[] = {
232 QI_LB60_GPIO_KEYIN(0),
233 QI_LB60_GPIO_KEYIN(1),
234 QI_LB60_GPIO_KEYIN(2),
235 QI_LB60_GPIO_KEYIN(3),
236 QI_LB60_GPIO_KEYIN(4),
237 QI_LB60_GPIO_KEYIN(5),
238 QI_LB60_GPIO_KEYIN(7),
239 QI_LB60_GPIO_KEYIN8,
240};
241
242static struct matrix_keypad_platform_data qi_lb60_pdata = {
243 .keymap_data = &qi_lb60_keymap_data,
244 .col_gpios = qi_lb60_keypad_cols,
245 .row_gpios = qi_lb60_keypad_rows,
246 .num_col_gpios = ARRAY_SIZE(qi_lb60_keypad_cols),
247 .num_row_gpios = ARRAY_SIZE(qi_lb60_keypad_rows),
248 .col_scan_delay_us = 10,
249 .debounce_ms = 10,
250 .wakeup = 1,
251 .active_low = 1,
252};
253
254static struct platform_device qi_lb60_keypad = {
255 .name = "matrix-keypad",
256 .id = -1,
257 .dev = {
258 .platform_data = &qi_lb60_pdata,
259 },
260};
261
262/* Display */
263static struct fb_videomode qi_lb60_video_modes[] = {
264 {
265 .name = "320x240",
266 .xres = 320,
267 .yres = 240,
268 .refresh = 30,
269 .left_margin = 140,
270 .right_margin = 273,
271 .upper_margin = 20,
272 .lower_margin = 2,
273 .hsync_len = 1,
274 .vsync_len = 1,
275 .sync = 0,
276 .vmode = FB_VMODE_NONINTERLACED,
277 },
278};
279
280static struct jz4740_fb_platform_data qi_lb60_fb_pdata = {
281 .width = 60,
282 .height = 45,
283 .num_modes = ARRAY_SIZE(qi_lb60_video_modes),
284 .modes = qi_lb60_video_modes,
285 .bpp = 24,
286 .lcd_type = JZ_LCD_TYPE_8BIT_SERIAL,
287 .pixclk_falling_edge = 1,
288};
289
290struct spi_gpio_platform_data spigpio_platform_data = {
291 .sck = JZ_GPIO_PORTC(23),
292 .mosi = JZ_GPIO_PORTC(22),
293 .miso = -1,
294 .num_chipselect = 1,
295};
296
297static struct platform_device spigpio_device = {
298 .name = "spi_gpio",
299 .id = 1,
300 .dev = {
301 .platform_data = &spigpio_platform_data,
302 },
303};
304
305static struct spi_board_info qi_lb60_spi_board_info[] = {
306 {
307 .modalias = "ili8960",
308 .controller_data = (void *)JZ_GPIO_PORTC(21),
309 .chip_select = 0,
310 .bus_num = 1,
311 .max_speed_hz = 30 * 1000,
312 .mode = SPI_3WIRE,
313 },
314};
315
316/* Battery */
317static struct jz_battery_platform_data qi_lb60_battery_pdata = {
318 .gpio_charge = JZ_GPIO_PORTC(27),
319 .gpio_charge_active_low = 1,
320 .info = {
321 .name = "battery",
322 .technology = POWER_SUPPLY_TECHNOLOGY_LIPO,
323 .voltage_max_design = 4200000,
324 .voltage_min_design = 3600000,
325 },
326};
327
328/* GPIO Key: power */
329static struct gpio_keys_button qi_lb60_gpio_keys_buttons[] = {
330 [0] = {
331 .code = KEY_POWER,
332 .gpio = JZ_GPIO_PORTD(29),
333 .active_low = 1,
334 .desc = "Power",
335 .wakeup = 1,
336 },
337};
338
339static struct gpio_keys_platform_data qi_lb60_gpio_keys_data = {
340 .nbuttons = ARRAY_SIZE(qi_lb60_gpio_keys_buttons),
341 .buttons = qi_lb60_gpio_keys_buttons,
342};
343
344static struct platform_device qi_lb60_gpio_keys = {
345 .name = "gpio-keys",
346 .id = -1,
347 .dev = {
348 .platform_data = &qi_lb60_gpio_keys_data,
349 }
350};
351
352static struct jz4740_mmc_platform_data qi_lb60_mmc_pdata = {
353 .gpio_card_detect = QI_LB60_GPIO_SD_CD,
354 .gpio_read_only = -1,
355 .gpio_power = QI_LB60_GPIO_SD_VCC_EN_N,
356 .power_active_low = 1,
357};
358
359/* OHCI */
360static struct regulator_consumer_supply avt2_usb_regulator_consumer =
361 REGULATOR_SUPPLY("vbus", "jz4740-ohci");
362
363static struct regulator_init_data avt2_usb_regulator_init_data = {
364 .num_consumer_supplies = 1,
365 .consumer_supplies = &avt2_usb_regulator_consumer,
366 .constraints = {
367 .name = "USB power",
368 .min_uV = 5000000,
369 .max_uV = 5000000,
370 .valid_modes_mask = REGULATOR_MODE_NORMAL,
371 .valid_ops_mask = REGULATOR_CHANGE_STATUS,
372 },
373};
374
375static struct fixed_voltage_config avt2_usb_regulator_data = {
376 .supply_name = "USB power",
377 .microvolts = 5000000,
378 .gpio = JZ_GPIO_PORTB(17),
379 .init_data = &avt2_usb_regulator_init_data,
380};
381
382static struct platform_device avt2_usb_regulator_device = {
383 .name = "reg-fixed-voltage",
384 .id = -1,
385 .dev = {
386 .platform_data = &avt2_usb_regulator_data,
387 }
388};
389
390/* beeper */
391static struct platform_device qi_lb60_pwm_beeper = {
392 .name = "pwm-beeper",
393 .id = -1,
394 .dev = {
395 .platform_data = (void *)4,
396 },
397};
398
399static struct platform_device *jz_platform_devices[] __initdata = {
400 &jz4740_udc_device,
401 &jz4740_mmc_device,
402 &jz4740_nand_device,
403 &qi_lb60_keypad,
404 &spigpio_device,
405 &jz4740_framebuffer_device,
406 &jz4740_pcm_device,
407 &jz4740_i2s_device,
408 &jz4740_codec_device,
409 &jz4740_rtc_device,
410 &jz4740_adc_device,
411 &qi_lb60_gpio_keys,
412 &qi_lb60_pwm_beeper,
413};
414
415static void __init board_gpio_setup(void)
416{
417 /* We only need to enable/disable pullup here for pins used in generic
418 * drivers. Everything else is done by the drivers themselfs. */
419 jz_gpio_disable_pullup(QI_LB60_GPIO_SD_VCC_EN_N);
420 jz_gpio_disable_pullup(QI_LB60_GPIO_SD_CD);
421}
422
423static int __init qi_lb60_init_platform_devices(void)
424{
425 jz4740_framebuffer_device.dev.platform_data = &qi_lb60_fb_pdata;
426 jz4740_nand_device.dev.platform_data = &qi_lb60_nand_pdata;
427 jz4740_adc_device.dev.platform_data = &qi_lb60_battery_pdata;
428 jz4740_mmc_device.dev.platform_data = &qi_lb60_mmc_pdata;
429
430 jz4740_serial_device_register();
431
432 spi_register_board_info(qi_lb60_spi_board_info,
433 ARRAY_SIZE(qi_lb60_spi_board_info));
434
435 if (is_avt2) {
436 platform_device_register(&avt2_usb_regulator_device);
437 platform_device_register(&jz4740_usb_ohci_device);
438 }
439
440 return platform_add_devices(jz_platform_devices,
441 ARRAY_SIZE(jz_platform_devices));
442
443}
444
445struct jz4740_clock_board_data jz4740_clock_bdata = {
446 .ext_rate = 12000000,
447 .rtc_rate = 32768,
448};
449
450static __init int board_avt2(char *str)
451{
452 qi_lb60_mmc_pdata.card_detect_active_low = 1;
453 is_avt2 = true;
454
455 return 1;
456}
457__setup("avt2", board_avt2);
458
459static int __init qi_lb60_board_setup(void)
460{
461 printk(KERN_INFO "Qi Hardware JZ4740 QI %s setup\n",
462 is_avt2 ? "AVT2" : "LB60");
463
464 board_gpio_setup();
465
466 if (qi_lb60_init_platform_devices())
467 panic("Failed to initalize platform devices\n");
468
469 return 0;
470}
471arch_initcall(qi_lb60_board_setup);
diff --git a/arch/mips/jz4740/clock-debugfs.c b/arch/mips/jz4740/clock-debugfs.c
new file mode 100644
index 000000000000..330a0f2bf17b
--- /dev/null
+++ b/arch/mips/jz4740/clock-debugfs.c
@@ -0,0 +1,109 @@
1/*
2 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 SoC clock support debugfs entries
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#include <linux/kernel.h>
17#include <linux/module.h>
18#include <linux/clk.h>
19#include <linux/err.h>
20
21#include <linux/debugfs.h>
22#include <linux/uaccess.h>
23
24#include <asm/mach-jz4740/clock.h>
25#include "clock.h"
26
27static struct dentry *jz4740_clock_debugfs;
28
29static int jz4740_clock_debugfs_show_enabled(void *data, uint64_t *value)
30{
31 struct clk *clk = data;
32 *value = clk_is_enabled(clk);
33
34 return 0;
35}
36
37static int jz4740_clock_debugfs_set_enabled(void *data, uint64_t value)
38{
39 struct clk *clk = data;
40
41 if (value)
42 return clk_enable(clk);
43 else
44 clk_disable(clk);
45
46 return 0;
47}
48
49DEFINE_SIMPLE_ATTRIBUTE(jz4740_clock_debugfs_ops_enabled,
50 jz4740_clock_debugfs_show_enabled,
51 jz4740_clock_debugfs_set_enabled,
52 "%llu\n");
53
54static int jz4740_clock_debugfs_show_rate(void *data, uint64_t *value)
55{
56 struct clk *clk = data;
57 *value = clk_get_rate(clk);
58
59 return 0;
60}
61
62DEFINE_SIMPLE_ATTRIBUTE(jz4740_clock_debugfs_ops_rate,
63 jz4740_clock_debugfs_show_rate,
64 NULL,
65 "%llu\n");
66
67void jz4740_clock_debugfs_add_clk(struct clk *clk)
68{
69 if (!jz4740_clock_debugfs)
70 return;
71
72 clk->debugfs_entry = debugfs_create_dir(clk->name, jz4740_clock_debugfs);
73 debugfs_create_file("rate", S_IWUGO | S_IRUGO, clk->debugfs_entry, clk,
74 &jz4740_clock_debugfs_ops_rate);
75 debugfs_create_file("enabled", S_IRUGO, clk->debugfs_entry, clk,
76 &jz4740_clock_debugfs_ops_enabled);
77
78 if (clk->parent) {
79 char parent_path[100];
80 snprintf(parent_path, 100, "../%s", clk->parent->name);
81 clk->debugfs_parent_entry = debugfs_create_symlink("parent",
82 clk->debugfs_entry,
83 parent_path);
84 }
85}
86
87/* TODO: Locking */
88void jz4740_clock_debugfs_update_parent(struct clk *clk)
89{
90 if (clk->debugfs_parent_entry)
91 debugfs_remove(clk->debugfs_parent_entry);
92
93 if (clk->parent) {
94 char parent_path[100];
95 snprintf(parent_path, 100, "../%s", clk->parent->name);
96 clk->debugfs_parent_entry = debugfs_create_symlink("parent",
97 clk->debugfs_entry,
98 parent_path);
99 } else {
100 clk->debugfs_parent_entry = NULL;
101 }
102}
103
104void jz4740_clock_debugfs_init(void)
105{
106 jz4740_clock_debugfs = debugfs_create_dir("jz4740-clock", NULL);
107 if (IS_ERR(jz4740_clock_debugfs))
108 jz4740_clock_debugfs = NULL;
109}
diff --git a/arch/mips/jz4740/clock.c b/arch/mips/jz4740/clock.c
new file mode 100644
index 000000000000..118a8a5562dd
--- /dev/null
+++ b/arch/mips/jz4740/clock.c
@@ -0,0 +1,924 @@
1/*
2 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 SoC clock support
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#include <linux/kernel.h>
17#include <linux/errno.h>
18#include <linux/clk.h>
19#include <linux/spinlock.h>
20#include <linux/io.h>
21#include <linux/module.h>
22#include <linux/list.h>
23#include <linux/err.h>
24
25#include <asm/mach-jz4740/clock.h>
26#include <asm/mach-jz4740/base.h>
27
28#include "clock.h"
29
30#define JZ_REG_CLOCK_CTRL 0x00
31#define JZ_REG_CLOCK_LOW_POWER 0x04
32#define JZ_REG_CLOCK_PLL 0x10
33#define JZ_REG_CLOCK_GATE 0x20
34#define JZ_REG_CLOCK_SLEEP_CTRL 0x24
35#define JZ_REG_CLOCK_I2S 0x60
36#define JZ_REG_CLOCK_LCD 0x64
37#define JZ_REG_CLOCK_MMC 0x68
38#define JZ_REG_CLOCK_UHC 0x6C
39#define JZ_REG_CLOCK_SPI 0x74
40
41#define JZ_CLOCK_CTRL_I2S_SRC_PLL BIT(31)
42#define JZ_CLOCK_CTRL_KO_ENABLE BIT(30)
43#define JZ_CLOCK_CTRL_UDC_SRC_PLL BIT(29)
44#define JZ_CLOCK_CTRL_UDIV_MASK 0x1f800000
45#define JZ_CLOCK_CTRL_CHANGE_ENABLE BIT(22)
46#define JZ_CLOCK_CTRL_PLL_HALF BIT(21)
47#define JZ_CLOCK_CTRL_LDIV_MASK 0x001f0000
48#define JZ_CLOCK_CTRL_UDIV_OFFSET 23
49#define JZ_CLOCK_CTRL_LDIV_OFFSET 16
50#define JZ_CLOCK_CTRL_MDIV_OFFSET 12
51#define JZ_CLOCK_CTRL_PDIV_OFFSET 8
52#define JZ_CLOCK_CTRL_HDIV_OFFSET 4
53#define JZ_CLOCK_CTRL_CDIV_OFFSET 0
54
55#define JZ_CLOCK_GATE_UART0 BIT(0)
56#define JZ_CLOCK_GATE_TCU BIT(1)
57#define JZ_CLOCK_GATE_RTC BIT(2)
58#define JZ_CLOCK_GATE_I2C BIT(3)
59#define JZ_CLOCK_GATE_SPI BIT(4)
60#define JZ_CLOCK_GATE_AIC BIT(5)
61#define JZ_CLOCK_GATE_I2S BIT(6)
62#define JZ_CLOCK_GATE_MMC BIT(7)
63#define JZ_CLOCK_GATE_ADC BIT(8)
64#define JZ_CLOCK_GATE_CIM BIT(9)
65#define JZ_CLOCK_GATE_LCD BIT(10)
66#define JZ_CLOCK_GATE_UDC BIT(11)
67#define JZ_CLOCK_GATE_DMAC BIT(12)
68#define JZ_CLOCK_GATE_IPU BIT(13)
69#define JZ_CLOCK_GATE_UHC BIT(14)
70#define JZ_CLOCK_GATE_UART1 BIT(15)
71
72#define JZ_CLOCK_I2S_DIV_MASK 0x01ff
73
74#define JZ_CLOCK_LCD_DIV_MASK 0x01ff
75
76#define JZ_CLOCK_MMC_DIV_MASK 0x001f
77
78#define JZ_CLOCK_UHC_DIV_MASK 0x000f
79
80#define JZ_CLOCK_SPI_SRC_PLL BIT(31)
81#define JZ_CLOCK_SPI_DIV_MASK 0x000f
82
83#define JZ_CLOCK_PLL_M_MASK 0x01ff
84#define JZ_CLOCK_PLL_N_MASK 0x001f
85#define JZ_CLOCK_PLL_OD_MASK 0x0003
86#define JZ_CLOCK_PLL_STABLE BIT(10)
87#define JZ_CLOCK_PLL_BYPASS BIT(9)
88#define JZ_CLOCK_PLL_ENABLED BIT(8)
89#define JZ_CLOCK_PLL_STABLIZE_MASK 0x000f
90#define JZ_CLOCK_PLL_M_OFFSET 23
91#define JZ_CLOCK_PLL_N_OFFSET 18
92#define JZ_CLOCK_PLL_OD_OFFSET 16
93
94#define JZ_CLOCK_LOW_POWER_MODE_DOZE BIT(2)
95#define JZ_CLOCK_LOW_POWER_MODE_SLEEP BIT(0)
96
97#define JZ_CLOCK_SLEEP_CTRL_SUSPEND_UHC BIT(7)
98#define JZ_CLOCK_SLEEP_CTRL_ENABLE_UDC BIT(6)
99
100static void __iomem *jz_clock_base;
101static spinlock_t jz_clock_lock;
102static LIST_HEAD(jz_clocks);
103
104struct main_clk {
105 struct clk clk;
106 uint32_t div_offset;
107};
108
109struct divided_clk {
110 struct clk clk;
111 uint32_t reg;
112 uint32_t mask;
113};
114
115struct static_clk {
116 struct clk clk;
117 unsigned long rate;
118};
119
120static uint32_t jz_clk_reg_read(int reg)
121{
122 return readl(jz_clock_base + reg);
123}
124
125static void jz_clk_reg_write_mask(int reg, uint32_t val, uint32_t mask)
126{
127 uint32_t val2;
128
129 spin_lock(&jz_clock_lock);
130 val2 = readl(jz_clock_base + reg);
131 val2 &= ~mask;
132 val2 |= val;
133 writel(val2, jz_clock_base + reg);
134 spin_unlock(&jz_clock_lock);
135}
136
137static void jz_clk_reg_set_bits(int reg, uint32_t mask)
138{
139 uint32_t val;
140
141 spin_lock(&jz_clock_lock);
142 val = readl(jz_clock_base + reg);
143 val |= mask;
144 writel(val, jz_clock_base + reg);
145 spin_unlock(&jz_clock_lock);
146}
147
148static void jz_clk_reg_clear_bits(int reg, uint32_t mask)
149{
150 uint32_t val;
151
152 spin_lock(&jz_clock_lock);
153 val = readl(jz_clock_base + reg);
154 val &= ~mask;
155 writel(val, jz_clock_base + reg);
156 spin_unlock(&jz_clock_lock);
157}
158
159static int jz_clk_enable_gating(struct clk *clk)
160{
161 if (clk->gate_bit == JZ4740_CLK_NOT_GATED)
162 return -EINVAL;
163
164 jz_clk_reg_clear_bits(JZ_REG_CLOCK_GATE, clk->gate_bit);
165 return 0;
166}
167
168static int jz_clk_disable_gating(struct clk *clk)
169{
170 if (clk->gate_bit == JZ4740_CLK_NOT_GATED)
171 return -EINVAL;
172
173 jz_clk_reg_set_bits(JZ_REG_CLOCK_GATE, clk->gate_bit);
174 return 0;
175}
176
177static int jz_clk_is_enabled_gating(struct clk *clk)
178{
179 if (clk->gate_bit == JZ4740_CLK_NOT_GATED)
180 return 1;
181
182 return !(jz_clk_reg_read(JZ_REG_CLOCK_GATE) & clk->gate_bit);
183}
184
185static unsigned long jz_clk_static_get_rate(struct clk *clk)
186{
187 return ((struct static_clk *)clk)->rate;
188}
189
190static int jz_clk_ko_enable(struct clk *clk)
191{
192 jz_clk_reg_set_bits(JZ_REG_CLOCK_CTRL, JZ_CLOCK_CTRL_KO_ENABLE);
193 return 0;
194}
195
196static int jz_clk_ko_disable(struct clk *clk)
197{
198 jz_clk_reg_clear_bits(JZ_REG_CLOCK_CTRL, JZ_CLOCK_CTRL_KO_ENABLE);
199 return 0;
200}
201
202static int jz_clk_ko_is_enabled(struct clk *clk)
203{
204 return !!(jz_clk_reg_read(JZ_REG_CLOCK_CTRL) & JZ_CLOCK_CTRL_KO_ENABLE);
205}
206
207static const int pllno[] = {1, 2, 2, 4};
208
209static unsigned long jz_clk_pll_get_rate(struct clk *clk)
210{
211 uint32_t val;
212 int m;
213 int n;
214 int od;
215
216 val = jz_clk_reg_read(JZ_REG_CLOCK_PLL);
217
218 if (val & JZ_CLOCK_PLL_BYPASS)
219 return clk_get_rate(clk->parent);
220
221 m = ((val >> 23) & 0x1ff) + 2;
222 n = ((val >> 18) & 0x1f) + 2;
223 od = (val >> 16) & 0x3;
224
225 return ((clk_get_rate(clk->parent) / n) * m) / pllno[od];
226}
227
228static unsigned long jz_clk_pll_half_get_rate(struct clk *clk)
229{
230 uint32_t reg;
231
232 reg = jz_clk_reg_read(JZ_REG_CLOCK_CTRL);
233 if (reg & JZ_CLOCK_CTRL_PLL_HALF)
234 return jz_clk_pll_get_rate(clk->parent);
235 return jz_clk_pll_get_rate(clk->parent) >> 1;
236}
237
238static const int jz_clk_main_divs[] = {1, 2, 3, 4, 6, 8, 12, 16, 24, 32};
239
240static unsigned long jz_clk_main_round_rate(struct clk *clk, unsigned long rate)
241{
242 unsigned long parent_rate = jz_clk_pll_get_rate(clk->parent);
243 int div;
244
245 div = parent_rate / rate;
246 if (div > 32)
247 return parent_rate / 32;
248 else if (div < 1)
249 return parent_rate;
250
251 div &= (0x3 << (ffs(div) - 1));
252
253 return parent_rate / div;
254}
255
256static unsigned long jz_clk_main_get_rate(struct clk *clk)
257{
258 struct main_clk *mclk = (struct main_clk *)clk;
259 uint32_t div;
260
261 div = jz_clk_reg_read(JZ_REG_CLOCK_CTRL);
262
263 div >>= mclk->div_offset;
264 div &= 0xf;
265
266 if (div >= ARRAY_SIZE(jz_clk_main_divs))
267 div = ARRAY_SIZE(jz_clk_main_divs) - 1;
268
269 return jz_clk_pll_get_rate(clk->parent) / jz_clk_main_divs[div];
270}
271
272static int jz_clk_main_set_rate(struct clk *clk, unsigned long rate)
273{
274 struct main_clk *mclk = (struct main_clk *)clk;
275 int i;
276 int div;
277 unsigned long parent_rate = jz_clk_pll_get_rate(clk->parent);
278
279 rate = jz_clk_main_round_rate(clk, rate);
280
281 div = parent_rate / rate;
282
283 i = (ffs(div) - 1) << 1;
284 if (i > 0 && !(div & BIT(i-1)))
285 i -= 1;
286
287 jz_clk_reg_write_mask(JZ_REG_CLOCK_CTRL, i << mclk->div_offset,
288 0xf << mclk->div_offset);
289
290 return 0;
291}
292
293static struct clk_ops jz_clk_static_ops = {
294 .get_rate = jz_clk_static_get_rate,
295 .enable = jz_clk_enable_gating,
296 .disable = jz_clk_disable_gating,
297 .is_enabled = jz_clk_is_enabled_gating,
298};
299
300static struct static_clk jz_clk_ext = {
301 .clk = {
302 .name = "ext",
303 .gate_bit = JZ4740_CLK_NOT_GATED,
304 .ops = &jz_clk_static_ops,
305 },
306};
307
308static struct clk_ops jz_clk_pll_ops = {
309 .get_rate = jz_clk_pll_get_rate,
310};
311
312static struct clk jz_clk_pll = {
313 .name = "pll",
314 .parent = &jz_clk_ext.clk,
315 .ops = &jz_clk_pll_ops,
316};
317
318static struct clk_ops jz_clk_pll_half_ops = {
319 .get_rate = jz_clk_pll_half_get_rate,
320};
321
322static struct clk jz_clk_pll_half = {
323 .name = "pll half",
324 .parent = &jz_clk_pll,
325 .ops = &jz_clk_pll_half_ops,
326};
327
328static const struct clk_ops jz_clk_main_ops = {
329 .get_rate = jz_clk_main_get_rate,
330 .set_rate = jz_clk_main_set_rate,
331 .round_rate = jz_clk_main_round_rate,
332};
333
334static struct main_clk jz_clk_cpu = {
335 .clk = {
336 .name = "cclk",
337 .parent = &jz_clk_pll,
338 .ops = &jz_clk_main_ops,
339 },
340 .div_offset = JZ_CLOCK_CTRL_CDIV_OFFSET,
341};
342
343static struct main_clk jz_clk_memory = {
344 .clk = {
345 .name = "mclk",
346 .parent = &jz_clk_pll,
347 .ops = &jz_clk_main_ops,
348 },
349 .div_offset = JZ_CLOCK_CTRL_MDIV_OFFSET,
350};
351
352static struct main_clk jz_clk_high_speed_peripheral = {
353 .clk = {
354 .name = "hclk",
355 .parent = &jz_clk_pll,
356 .ops = &jz_clk_main_ops,
357 },
358 .div_offset = JZ_CLOCK_CTRL_HDIV_OFFSET,
359};
360
361
362static struct main_clk jz_clk_low_speed_peripheral = {
363 .clk = {
364 .name = "pclk",
365 .parent = &jz_clk_pll,
366 .ops = &jz_clk_main_ops,
367 },
368 .div_offset = JZ_CLOCK_CTRL_PDIV_OFFSET,
369};
370
371static const struct clk_ops jz_clk_ko_ops = {
372 .enable = jz_clk_ko_enable,
373 .disable = jz_clk_ko_disable,
374 .is_enabled = jz_clk_ko_is_enabled,
375};
376
377static struct clk jz_clk_ko = {
378 .name = "cko",
379 .parent = &jz_clk_memory.clk,
380 .ops = &jz_clk_ko_ops,
381};
382
383static int jz_clk_spi_set_parent(struct clk *clk, struct clk *parent)
384{
385 if (parent == &jz_clk_pll)
386 jz_clk_reg_set_bits(JZ_CLOCK_SPI_SRC_PLL, JZ_REG_CLOCK_SPI);
387 else if (parent == &jz_clk_ext.clk)
388 jz_clk_reg_clear_bits(JZ_CLOCK_SPI_SRC_PLL, JZ_REG_CLOCK_SPI);
389 else
390 return -EINVAL;
391
392 clk->parent = parent;
393
394 return 0;
395}
396
397static int jz_clk_i2s_set_parent(struct clk *clk, struct clk *parent)
398{
399 if (parent == &jz_clk_pll_half)
400 jz_clk_reg_set_bits(JZ_REG_CLOCK_CTRL, JZ_CLOCK_CTRL_I2S_SRC_PLL);
401 else if (parent == &jz_clk_ext.clk)
402 jz_clk_reg_clear_bits(JZ_REG_CLOCK_CTRL, JZ_CLOCK_CTRL_I2S_SRC_PLL);
403 else
404 return -EINVAL;
405
406 clk->parent = parent;
407
408 return 0;
409}
410
411static int jz_clk_udc_enable(struct clk *clk)
412{
413 jz_clk_reg_set_bits(JZ_REG_CLOCK_SLEEP_CTRL,
414 JZ_CLOCK_SLEEP_CTRL_ENABLE_UDC);
415
416 return 0;
417}
418
419static int jz_clk_udc_disable(struct clk *clk)
420{
421 jz_clk_reg_clear_bits(JZ_REG_CLOCK_SLEEP_CTRL,
422 JZ_CLOCK_SLEEP_CTRL_ENABLE_UDC);
423
424 return 0;
425}
426
427static int jz_clk_udc_is_enabled(struct clk *clk)
428{
429 return !!(jz_clk_reg_read(JZ_REG_CLOCK_SLEEP_CTRL) &
430 JZ_CLOCK_SLEEP_CTRL_ENABLE_UDC);
431}
432
433static int jz_clk_udc_set_parent(struct clk *clk, struct clk *parent)
434{
435 if (parent == &jz_clk_pll_half)
436 jz_clk_reg_set_bits(JZ_REG_CLOCK_CTRL, JZ_CLOCK_CTRL_UDC_SRC_PLL);
437 else if (parent == &jz_clk_ext.clk)
438 jz_clk_reg_clear_bits(JZ_REG_CLOCK_CTRL, JZ_CLOCK_CTRL_UDC_SRC_PLL);
439 else
440 return -EINVAL;
441
442 clk->parent = parent;
443
444 return 0;
445}
446
447static int jz_clk_udc_set_rate(struct clk *clk, unsigned long rate)
448{
449 int div;
450
451 if (clk->parent == &jz_clk_ext.clk)
452 return -EINVAL;
453
454 div = clk_get_rate(clk->parent) / rate - 1;
455
456 if (div < 0)
457 div = 0;
458 else if (div > 63)
459 div = 63;
460
461 jz_clk_reg_write_mask(JZ_REG_CLOCK_CTRL, div << JZ_CLOCK_CTRL_UDIV_OFFSET,
462 JZ_CLOCK_CTRL_UDIV_MASK);
463 return 0;
464}
465
466static unsigned long jz_clk_udc_get_rate(struct clk *clk)
467{
468 int div;
469
470 if (clk->parent == &jz_clk_ext.clk)
471 return clk_get_rate(clk->parent);
472
473 div = (jz_clk_reg_read(JZ_REG_CLOCK_CTRL) & JZ_CLOCK_CTRL_UDIV_MASK);
474 div >>= JZ_CLOCK_CTRL_UDIV_OFFSET;
475 div += 1;
476
477 return clk_get_rate(clk->parent) / div;
478}
479
480static unsigned long jz_clk_divided_get_rate(struct clk *clk)
481{
482 struct divided_clk *dclk = (struct divided_clk *)clk;
483 int div;
484
485 if (clk->parent == &jz_clk_ext.clk)
486 return clk_get_rate(clk->parent);
487
488 div = (jz_clk_reg_read(dclk->reg) & dclk->mask) + 1;
489
490 return clk_get_rate(clk->parent) / div;
491}
492
493static int jz_clk_divided_set_rate(struct clk *clk, unsigned long rate)
494{
495 struct divided_clk *dclk = (struct divided_clk *)clk;
496 int div;
497
498 if (clk->parent == &jz_clk_ext.clk)
499 return -EINVAL;
500
501 div = clk_get_rate(clk->parent) / rate - 1;
502
503 if (div < 0)
504 div = 0;
505 else if (div > dclk->mask)
506 div = dclk->mask;
507
508 jz_clk_reg_write_mask(dclk->reg, div, dclk->mask);
509
510 return 0;
511}
512
513static unsigned long jz_clk_ldclk_round_rate(struct clk *clk, unsigned long rate)
514{
515 int div;
516 unsigned long parent_rate = jz_clk_pll_half_get_rate(clk->parent);
517
518 if (rate > 150000000)
519 return 150000000;
520
521 div = parent_rate / rate;
522 if (div < 1)
523 div = 1;
524 else if (div > 32)
525 div = 32;
526
527 return parent_rate / div;
528}
529
530static int jz_clk_ldclk_set_rate(struct clk *clk, unsigned long rate)
531{
532 int div;
533
534 if (rate > 150000000)
535 return -EINVAL;
536
537 div = jz_clk_pll_half_get_rate(clk->parent) / rate - 1;
538 if (div < 0)
539 div = 0;
540 else if (div > 31)
541 div = 31;
542
543 jz_clk_reg_write_mask(JZ_REG_CLOCK_CTRL, div << JZ_CLOCK_CTRL_LDIV_OFFSET,
544 JZ_CLOCK_CTRL_LDIV_MASK);
545
546 return 0;
547}
548
549static unsigned long jz_clk_ldclk_get_rate(struct clk *clk)
550{
551 int div;
552
553 div = jz_clk_reg_read(JZ_REG_CLOCK_CTRL) & JZ_CLOCK_CTRL_LDIV_MASK;
554 div >>= JZ_CLOCK_CTRL_LDIV_OFFSET;
555
556 return jz_clk_pll_half_get_rate(clk->parent) / (div + 1);
557}
558
559static const struct clk_ops jz_clk_ops_ld = {
560 .set_rate = jz_clk_ldclk_set_rate,
561 .get_rate = jz_clk_ldclk_get_rate,
562 .round_rate = jz_clk_ldclk_round_rate,
563 .enable = jz_clk_enable_gating,
564 .disable = jz_clk_disable_gating,
565 .is_enabled = jz_clk_is_enabled_gating,
566};
567
568static struct clk jz_clk_ld = {
569 .name = "lcd",
570 .gate_bit = JZ_CLOCK_GATE_LCD,
571 .parent = &jz_clk_pll_half,
572 .ops = &jz_clk_ops_ld,
573};
574
575static const struct clk_ops jz_clk_i2s_ops = {
576 .set_rate = jz_clk_divided_set_rate,
577 .get_rate = jz_clk_divided_get_rate,
578 .enable = jz_clk_enable_gating,
579 .disable = jz_clk_disable_gating,
580 .is_enabled = jz_clk_is_enabled_gating,
581 .set_parent = jz_clk_i2s_set_parent,
582};
583
584static const struct clk_ops jz_clk_spi_ops = {
585 .set_rate = jz_clk_divided_set_rate,
586 .get_rate = jz_clk_divided_get_rate,
587 .enable = jz_clk_enable_gating,
588 .disable = jz_clk_disable_gating,
589 .is_enabled = jz_clk_is_enabled_gating,
590 .set_parent = jz_clk_spi_set_parent,
591};
592
593static const struct clk_ops jz_clk_divided_ops = {
594 .set_rate = jz_clk_divided_set_rate,
595 .get_rate = jz_clk_divided_get_rate,
596 .enable = jz_clk_enable_gating,
597 .disable = jz_clk_disable_gating,
598 .is_enabled = jz_clk_is_enabled_gating,
599};
600
601static struct divided_clk jz4740_clock_divided_clks[] = {
602 [0] = {
603 .clk = {
604 .name = "i2s",
605 .parent = &jz_clk_ext.clk,
606 .gate_bit = JZ_CLOCK_GATE_I2S,
607 .ops = &jz_clk_i2s_ops,
608 },
609 .reg = JZ_REG_CLOCK_I2S,
610 .mask = JZ_CLOCK_I2S_DIV_MASK,
611 },
612 [1] = {
613 .clk = {
614 .name = "spi",
615 .parent = &jz_clk_ext.clk,
616 .gate_bit = JZ_CLOCK_GATE_SPI,
617 .ops = &jz_clk_spi_ops,
618 },
619 .reg = JZ_REG_CLOCK_SPI,
620 .mask = JZ_CLOCK_SPI_DIV_MASK,
621 },
622 [2] = {
623 .clk = {
624 .name = "lcd_pclk",
625 .parent = &jz_clk_pll_half,
626 .gate_bit = JZ4740_CLK_NOT_GATED,
627 .ops = &jz_clk_divided_ops,
628 },
629 .reg = JZ_REG_CLOCK_LCD,
630 .mask = JZ_CLOCK_LCD_DIV_MASK,
631 },
632 [3] = {
633 .clk = {
634 .name = "mmc",
635 .parent = &jz_clk_pll_half,
636 .gate_bit = JZ_CLOCK_GATE_MMC,
637 .ops = &jz_clk_divided_ops,
638 },
639 .reg = JZ_REG_CLOCK_MMC,
640 .mask = JZ_CLOCK_MMC_DIV_MASK,
641 },
642 [4] = {
643 .clk = {
644 .name = "uhc",
645 .parent = &jz_clk_pll_half,
646 .gate_bit = JZ_CLOCK_GATE_UHC,
647 .ops = &jz_clk_divided_ops,
648 },
649 .reg = JZ_REG_CLOCK_UHC,
650 .mask = JZ_CLOCK_UHC_DIV_MASK,
651 },
652};
653
654static const struct clk_ops jz_clk_udc_ops = {
655 .set_parent = jz_clk_udc_set_parent,
656 .set_rate = jz_clk_udc_set_rate,
657 .get_rate = jz_clk_udc_get_rate,
658 .enable = jz_clk_udc_enable,
659 .disable = jz_clk_udc_disable,
660 .is_enabled = jz_clk_udc_is_enabled,
661};
662
663static const struct clk_ops jz_clk_simple_ops = {
664 .enable = jz_clk_enable_gating,
665 .disable = jz_clk_disable_gating,
666 .is_enabled = jz_clk_is_enabled_gating,
667};
668
669static struct clk jz4740_clock_simple_clks[] = {
670 [0] = {
671 .name = "udc",
672 .parent = &jz_clk_ext.clk,
673 .ops = &jz_clk_udc_ops,
674 },
675 [1] = {
676 .name = "uart0",
677 .parent = &jz_clk_ext.clk,
678 .gate_bit = JZ_CLOCK_GATE_UART0,
679 .ops = &jz_clk_simple_ops,
680 },
681 [2] = {
682 .name = "uart1",
683 .parent = &jz_clk_ext.clk,
684 .gate_bit = JZ_CLOCK_GATE_UART1,
685 .ops = &jz_clk_simple_ops,
686 },
687 [3] = {
688 .name = "dma",
689 .parent = &jz_clk_high_speed_peripheral.clk,
690 .gate_bit = JZ_CLOCK_GATE_UART0,
691 .ops = &jz_clk_simple_ops,
692 },
693 [4] = {
694 .name = "ipu",
695 .parent = &jz_clk_high_speed_peripheral.clk,
696 .gate_bit = JZ_CLOCK_GATE_IPU,
697 .ops = &jz_clk_simple_ops,
698 },
699 [5] = {
700 .name = "adc",
701 .parent = &jz_clk_ext.clk,
702 .gate_bit = JZ_CLOCK_GATE_ADC,
703 .ops = &jz_clk_simple_ops,
704 },
705 [6] = {
706 .name = "i2c",
707 .parent = &jz_clk_ext.clk,
708 .gate_bit = JZ_CLOCK_GATE_I2C,
709 .ops = &jz_clk_simple_ops,
710 },
711 [7] = {
712 .name = "aic",
713 .parent = &jz_clk_ext.clk,
714 .gate_bit = JZ_CLOCK_GATE_AIC,
715 .ops = &jz_clk_simple_ops,
716 },
717};
718
719static struct static_clk jz_clk_rtc = {
720 .clk = {
721 .name = "rtc",
722 .gate_bit = JZ_CLOCK_GATE_RTC,
723 .ops = &jz_clk_static_ops,
724 },
725 .rate = 32768,
726};
727
728int clk_enable(struct clk *clk)
729{
730 if (!clk->ops->enable)
731 return -EINVAL;
732
733 return clk->ops->enable(clk);
734}
735EXPORT_SYMBOL_GPL(clk_enable);
736
737void clk_disable(struct clk *clk)
738{
739 if (clk->ops->disable)
740 clk->ops->disable(clk);
741}
742EXPORT_SYMBOL_GPL(clk_disable);
743
744int clk_is_enabled(struct clk *clk)
745{
746 if (clk->ops->is_enabled)
747 return clk->ops->is_enabled(clk);
748
749 return 1;
750}
751
752unsigned long clk_get_rate(struct clk *clk)
753{
754 if (clk->ops->get_rate)
755 return clk->ops->get_rate(clk);
756 if (clk->parent)
757 return clk_get_rate(clk->parent);
758
759 return -EINVAL;
760}
761EXPORT_SYMBOL_GPL(clk_get_rate);
762
763int clk_set_rate(struct clk *clk, unsigned long rate)
764{
765 if (!clk->ops->set_rate)
766 return -EINVAL;
767 return clk->ops->set_rate(clk, rate);
768}
769EXPORT_SYMBOL_GPL(clk_set_rate);
770
771long clk_round_rate(struct clk *clk, unsigned long rate)
772{
773 if (clk->ops->round_rate)
774 return clk->ops->round_rate(clk, rate);
775
776 return -EINVAL;
777}
778EXPORT_SYMBOL_GPL(clk_round_rate);
779
780int clk_set_parent(struct clk *clk, struct clk *parent)
781{
782 int ret;
783 int enabled;
784
785 if (!clk->ops->set_parent)
786 return -EINVAL;
787
788 enabled = clk_is_enabled(clk);
789 if (enabled)
790 clk_disable(clk);
791 ret = clk->ops->set_parent(clk, parent);
792 if (enabled)
793 clk_enable(clk);
794
795 jz4740_clock_debugfs_update_parent(clk);
796
797 return ret;
798}
799EXPORT_SYMBOL_GPL(clk_set_parent);
800
801struct clk *clk_get(struct device *dev, const char *name)
802{
803 struct clk *clk;
804
805 list_for_each_entry(clk, &jz_clocks, list) {
806 if (strcmp(clk->name, name) == 0)
807 return clk;
808 }
809 return ERR_PTR(-ENXIO);
810}
811EXPORT_SYMBOL_GPL(clk_get);
812
813void clk_put(struct clk *clk)
814{
815}
816EXPORT_SYMBOL_GPL(clk_put);
817
818static inline void clk_add(struct clk *clk)
819{
820 list_add_tail(&clk->list, &jz_clocks);
821
822 jz4740_clock_debugfs_add_clk(clk);
823}
824
825static void clk_register_clks(void)
826{
827 size_t i;
828
829 clk_add(&jz_clk_ext.clk);
830 clk_add(&jz_clk_pll);
831 clk_add(&jz_clk_pll_half);
832 clk_add(&jz_clk_cpu.clk);
833 clk_add(&jz_clk_high_speed_peripheral.clk);
834 clk_add(&jz_clk_low_speed_peripheral.clk);
835 clk_add(&jz_clk_ko);
836 clk_add(&jz_clk_ld);
837 clk_add(&jz_clk_rtc.clk);
838
839 for (i = 0; i < ARRAY_SIZE(jz4740_clock_divided_clks); ++i)
840 clk_add(&jz4740_clock_divided_clks[i].clk);
841
842 for (i = 0; i < ARRAY_SIZE(jz4740_clock_simple_clks); ++i)
843 clk_add(&jz4740_clock_simple_clks[i]);
844}
845
846void jz4740_clock_set_wait_mode(enum jz4740_wait_mode mode)
847{
848 switch (mode) {
849 case JZ4740_WAIT_MODE_IDLE:
850 jz_clk_reg_clear_bits(JZ_REG_CLOCK_LOW_POWER, JZ_CLOCK_LOW_POWER_MODE_SLEEP);
851 break;
852 case JZ4740_WAIT_MODE_SLEEP:
853 jz_clk_reg_set_bits(JZ_REG_CLOCK_LOW_POWER, JZ_CLOCK_LOW_POWER_MODE_SLEEP);
854 break;
855 }
856}
857
858void jz4740_clock_udc_disable_auto_suspend(void)
859{
860 jz_clk_reg_clear_bits(JZ_REG_CLOCK_GATE, JZ_CLOCK_GATE_UDC);
861}
862EXPORT_SYMBOL_GPL(jz4740_clock_udc_disable_auto_suspend);
863
864void jz4740_clock_udc_enable_auto_suspend(void)
865{
866 jz_clk_reg_set_bits(JZ_REG_CLOCK_GATE, JZ_CLOCK_GATE_UDC);
867}
868EXPORT_SYMBOL_GPL(jz4740_clock_udc_enable_auto_suspend);
869
870void jz4740_clock_suspend(void)
871{
872 jz_clk_reg_set_bits(JZ_REG_CLOCK_GATE,
873 JZ_CLOCK_GATE_TCU | JZ_CLOCK_GATE_DMAC | JZ_CLOCK_GATE_UART0);
874
875 jz_clk_reg_clear_bits(JZ_REG_CLOCK_PLL, JZ_CLOCK_PLL_ENABLED);
876}
877
878void jz4740_clock_resume(void)
879{
880 uint32_t pll;
881
882 jz_clk_reg_set_bits(JZ_REG_CLOCK_PLL, JZ_CLOCK_PLL_ENABLED);
883
884 do {
885 pll = jz_clk_reg_read(JZ_REG_CLOCK_PLL);
886 } while (!(pll & JZ_CLOCK_PLL_STABLE));
887
888 jz_clk_reg_clear_bits(JZ_REG_CLOCK_GATE,
889 JZ_CLOCK_GATE_TCU | JZ_CLOCK_GATE_DMAC | JZ_CLOCK_GATE_UART0);
890}
891
892static int jz4740_clock_init(void)
893{
894 uint32_t val;
895
896 jz_clock_base = ioremap(JZ4740_CPM_BASE_ADDR, 0x100);
897 if (!jz_clock_base)
898 return -EBUSY;
899
900 spin_lock_init(&jz_clock_lock);
901
902 jz_clk_ext.rate = jz4740_clock_bdata.ext_rate;
903 jz_clk_rtc.rate = jz4740_clock_bdata.rtc_rate;
904
905 val = jz_clk_reg_read(JZ_REG_CLOCK_SPI);
906
907 if (val & JZ_CLOCK_SPI_SRC_PLL)
908 jz4740_clock_divided_clks[1].clk.parent = &jz_clk_pll_half;
909
910 val = jz_clk_reg_read(JZ_REG_CLOCK_CTRL);
911
912 if (val & JZ_CLOCK_CTRL_I2S_SRC_PLL)
913 jz4740_clock_divided_clks[0].clk.parent = &jz_clk_pll_half;
914
915 if (val & JZ_CLOCK_CTRL_UDC_SRC_PLL)
916 jz4740_clock_simple_clks[0].parent = &jz_clk_pll_half;
917
918 jz4740_clock_debugfs_init();
919
920 clk_register_clks();
921
922 return 0;
923}
924arch_initcall(jz4740_clock_init);
diff --git a/arch/mips/jz4740/clock.h b/arch/mips/jz4740/clock.h
new file mode 100644
index 000000000000..5d07499d7461
--- /dev/null
+++ b/arch/mips/jz4740/clock.h
@@ -0,0 +1,76 @@
1/*
2 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 SoC clock support
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#ifndef __MIPS_JZ4740_CLOCK_H__
17#define __MIPS_JZ4740_CLOCK_H__
18
19#include <linux/list.h>
20
21struct jz4740_clock_board_data {
22 unsigned long ext_rate;
23 unsigned long rtc_rate;
24};
25
26extern struct jz4740_clock_board_data jz4740_clock_bdata;
27
28void jz4740_clock_suspend(void);
29void jz4740_clock_resume(void);
30
31struct clk;
32
33struct clk_ops {
34 unsigned long (*get_rate)(struct clk *clk);
35 unsigned long (*round_rate)(struct clk *clk, unsigned long rate);
36 int (*set_rate)(struct clk *clk, unsigned long rate);
37 int (*enable)(struct clk *clk);
38 int (*disable)(struct clk *clk);
39 int (*is_enabled)(struct clk *clk);
40
41 int (*set_parent)(struct clk *clk, struct clk *parent);
42
43};
44
45struct clk {
46 const char *name;
47 struct clk *parent;
48
49 uint32_t gate_bit;
50
51 const struct clk_ops *ops;
52
53 struct list_head list;
54
55#ifdef CONFIG_DEBUG_FS
56 struct dentry *debugfs_entry;
57 struct dentry *debugfs_parent_entry;
58#endif
59
60};
61
62#define JZ4740_CLK_NOT_GATED ((uint32_t)-1)
63
64int clk_is_enabled(struct clk *clk);
65
66#ifdef CONFIG_DEBUG_FS
67void jz4740_clock_debugfs_init(void);
68void jz4740_clock_debugfs_add_clk(struct clk *clk);
69void jz4740_clock_debugfs_update_parent(struct clk *clk);
70#else
71static inline void jz4740_clock_debugfs_init(void) {};
72static inline void jz4740_clock_debugfs_add_clk(struct clk *clk) {};
73static inline void jz4740_clock_debugfs_update_parent(struct clk *clk) {};
74#endif
75
76#endif
diff --git a/arch/mips/jz4740/dma.c b/arch/mips/jz4740/dma.c
new file mode 100644
index 000000000000..5ebe75a68350
--- /dev/null
+++ b/arch/mips/jz4740/dma.c
@@ -0,0 +1,289 @@
1/*
2 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 SoC DMA support
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#include <linux/kernel.h>
17#include <linux/module.h>
18#include <linux/spinlock.h>
19#include <linux/interrupt.h>
20
21#include <linux/dma-mapping.h>
22#include <asm/mach-jz4740/dma.h>
23#include <asm/mach-jz4740/base.h>
24
25#define JZ_REG_DMA_SRC_ADDR(x) (0x00 + (x) * 0x20)
26#define JZ_REG_DMA_DST_ADDR(x) (0x04 + (x) * 0x20)
27#define JZ_REG_DMA_TRANSFER_COUNT(x) (0x08 + (x) * 0x20)
28#define JZ_REG_DMA_REQ_TYPE(x) (0x0C + (x) * 0x20)
29#define JZ_REG_DMA_STATUS_CTRL(x) (0x10 + (x) * 0x20)
30#define JZ_REG_DMA_CMD(x) (0x14 + (x) * 0x20)
31#define JZ_REG_DMA_DESC_ADDR(x) (0x18 + (x) * 0x20)
32
33#define JZ_REG_DMA_CTRL 0x300
34#define JZ_REG_DMA_IRQ 0x304
35#define JZ_REG_DMA_DOORBELL 0x308
36#define JZ_REG_DMA_DOORBELL_SET 0x30C
37
38#define JZ_DMA_STATUS_CTRL_NO_DESC BIT(31)
39#define JZ_DMA_STATUS_CTRL_DESC_INV BIT(6)
40#define JZ_DMA_STATUS_CTRL_ADDR_ERR BIT(4)
41#define JZ_DMA_STATUS_CTRL_TRANSFER_DONE BIT(3)
42#define JZ_DMA_STATUS_CTRL_HALT BIT(2)
43#define JZ_DMA_STATUS_CTRL_COUNT_TERMINATE BIT(1)
44#define JZ_DMA_STATUS_CTRL_ENABLE BIT(0)
45
46#define JZ_DMA_CMD_SRC_INC BIT(23)
47#define JZ_DMA_CMD_DST_INC BIT(22)
48#define JZ_DMA_CMD_RDIL_MASK (0xf << 16)
49#define JZ_DMA_CMD_SRC_WIDTH_MASK (0x3 << 14)
50#define JZ_DMA_CMD_DST_WIDTH_MASK (0x3 << 12)
51#define JZ_DMA_CMD_INTERVAL_LENGTH_MASK (0x7 << 8)
52#define JZ_DMA_CMD_BLOCK_MODE BIT(7)
53#define JZ_DMA_CMD_DESC_VALID BIT(4)
54#define JZ_DMA_CMD_DESC_VALID_MODE BIT(3)
55#define JZ_DMA_CMD_VALID_IRQ_ENABLE BIT(2)
56#define JZ_DMA_CMD_TRANSFER_IRQ_ENABLE BIT(1)
57#define JZ_DMA_CMD_LINK_ENABLE BIT(0)
58
59#define JZ_DMA_CMD_FLAGS_OFFSET 22
60#define JZ_DMA_CMD_RDIL_OFFSET 16
61#define JZ_DMA_CMD_SRC_WIDTH_OFFSET 14
62#define JZ_DMA_CMD_DST_WIDTH_OFFSET 12
63#define JZ_DMA_CMD_TRANSFER_SIZE_OFFSET 8
64#define JZ_DMA_CMD_MODE_OFFSET 7
65
66#define JZ_DMA_CTRL_PRIORITY_MASK (0x3 << 8)
67#define JZ_DMA_CTRL_HALT BIT(3)
68#define JZ_DMA_CTRL_ADDRESS_ERROR BIT(2)
69#define JZ_DMA_CTRL_ENABLE BIT(0)
70
71
72static void __iomem *jz4740_dma_base;
73static spinlock_t jz4740_dma_lock;
74
75static inline uint32_t jz4740_dma_read(size_t reg)
76{
77 return readl(jz4740_dma_base + reg);
78}
79
80static inline void jz4740_dma_write(size_t reg, uint32_t val)
81{
82 writel(val, jz4740_dma_base + reg);
83}
84
85static inline void jz4740_dma_write_mask(size_t reg, uint32_t val, uint32_t mask)
86{
87 uint32_t val2;
88 val2 = jz4740_dma_read(reg);
89 val2 &= ~mask;
90 val2 |= val;
91 jz4740_dma_write(reg, val2);
92}
93
94struct jz4740_dma_chan {
95 unsigned int id;
96 void *dev;
97 const char *name;
98
99 enum jz4740_dma_flags flags;
100 uint32_t transfer_shift;
101
102 jz4740_dma_complete_callback_t complete_cb;
103
104 unsigned used:1;
105};
106
107#define JZ4740_DMA_CHANNEL(_id) { .id = _id }
108
109struct jz4740_dma_chan jz4740_dma_channels[] = {
110 JZ4740_DMA_CHANNEL(0),
111 JZ4740_DMA_CHANNEL(1),
112 JZ4740_DMA_CHANNEL(2),
113 JZ4740_DMA_CHANNEL(3),
114 JZ4740_DMA_CHANNEL(4),
115 JZ4740_DMA_CHANNEL(5),
116};
117
118struct jz4740_dma_chan *jz4740_dma_request(void *dev, const char *name)
119{
120 unsigned int i;
121 struct jz4740_dma_chan *dma = NULL;
122
123 spin_lock(&jz4740_dma_lock);
124
125 for (i = 0; i < ARRAY_SIZE(jz4740_dma_channels); ++i) {
126 if (!jz4740_dma_channels[i].used) {
127 dma = &jz4740_dma_channels[i];
128 dma->used = 1;
129 break;
130 }
131 }
132
133 spin_unlock(&jz4740_dma_lock);
134
135 if (!dma)
136 return NULL;
137
138 dma->dev = dev;
139 dma->name = name;
140
141 return dma;
142}
143EXPORT_SYMBOL_GPL(jz4740_dma_request);
144
145void jz4740_dma_configure(struct jz4740_dma_chan *dma,
146 const struct jz4740_dma_config *config)
147{
148 uint32_t cmd;
149
150 switch (config->transfer_size) {
151 case JZ4740_DMA_TRANSFER_SIZE_2BYTE:
152 dma->transfer_shift = 1;
153 break;
154 case JZ4740_DMA_TRANSFER_SIZE_4BYTE:
155 dma->transfer_shift = 2;
156 break;
157 case JZ4740_DMA_TRANSFER_SIZE_16BYTE:
158 dma->transfer_shift = 4;
159 break;
160 case JZ4740_DMA_TRANSFER_SIZE_32BYTE:
161 dma->transfer_shift = 5;
162 break;
163 default:
164 dma->transfer_shift = 0;
165 break;
166 }
167
168 cmd = config->flags << JZ_DMA_CMD_FLAGS_OFFSET;
169 cmd |= config->src_width << JZ_DMA_CMD_SRC_WIDTH_OFFSET;
170 cmd |= config->dst_width << JZ_DMA_CMD_DST_WIDTH_OFFSET;
171 cmd |= config->transfer_size << JZ_DMA_CMD_TRANSFER_SIZE_OFFSET;
172 cmd |= config->mode << JZ_DMA_CMD_MODE_OFFSET;
173 cmd |= JZ_DMA_CMD_TRANSFER_IRQ_ENABLE;
174
175 jz4740_dma_write(JZ_REG_DMA_CMD(dma->id), cmd);
176 jz4740_dma_write(JZ_REG_DMA_STATUS_CTRL(dma->id), 0);
177 jz4740_dma_write(JZ_REG_DMA_REQ_TYPE(dma->id), config->request_type);
178}
179EXPORT_SYMBOL_GPL(jz4740_dma_configure);
180
181void jz4740_dma_set_src_addr(struct jz4740_dma_chan *dma, dma_addr_t src)
182{
183 jz4740_dma_write(JZ_REG_DMA_SRC_ADDR(dma->id), src);
184}
185EXPORT_SYMBOL_GPL(jz4740_dma_set_src_addr);
186
187void jz4740_dma_set_dst_addr(struct jz4740_dma_chan *dma, dma_addr_t dst)
188{
189 jz4740_dma_write(JZ_REG_DMA_DST_ADDR(dma->id), dst);
190}
191EXPORT_SYMBOL_GPL(jz4740_dma_set_dst_addr);
192
193void jz4740_dma_set_transfer_count(struct jz4740_dma_chan *dma, uint32_t count)
194{
195 count >>= dma->transfer_shift;
196 jz4740_dma_write(JZ_REG_DMA_TRANSFER_COUNT(dma->id), count);
197}
198EXPORT_SYMBOL_GPL(jz4740_dma_set_transfer_count);
199
200void jz4740_dma_set_complete_cb(struct jz4740_dma_chan *dma,
201 jz4740_dma_complete_callback_t cb)
202{
203 dma->complete_cb = cb;
204}
205EXPORT_SYMBOL_GPL(jz4740_dma_set_complete_cb);
206
207void jz4740_dma_free(struct jz4740_dma_chan *dma)
208{
209 dma->dev = NULL;
210 dma->complete_cb = NULL;
211 dma->used = 0;
212}
213EXPORT_SYMBOL_GPL(jz4740_dma_free);
214
215void jz4740_dma_enable(struct jz4740_dma_chan *dma)
216{
217 jz4740_dma_write_mask(JZ_REG_DMA_STATUS_CTRL(dma->id),
218 JZ_DMA_STATUS_CTRL_NO_DESC | JZ_DMA_STATUS_CTRL_ENABLE,
219 JZ_DMA_STATUS_CTRL_HALT | JZ_DMA_STATUS_CTRL_NO_DESC |
220 JZ_DMA_STATUS_CTRL_ENABLE);
221
222 jz4740_dma_write_mask(JZ_REG_DMA_CTRL,
223 JZ_DMA_CTRL_ENABLE,
224 JZ_DMA_CTRL_HALT | JZ_DMA_CTRL_ENABLE);
225}
226EXPORT_SYMBOL_GPL(jz4740_dma_enable);
227
228void jz4740_dma_disable(struct jz4740_dma_chan *dma)
229{
230 jz4740_dma_write_mask(JZ_REG_DMA_STATUS_CTRL(dma->id), 0,
231 JZ_DMA_STATUS_CTRL_ENABLE);
232}
233EXPORT_SYMBOL_GPL(jz4740_dma_disable);
234
235uint32_t jz4740_dma_get_residue(const struct jz4740_dma_chan *dma)
236{
237 uint32_t residue;
238 residue = jz4740_dma_read(JZ_REG_DMA_TRANSFER_COUNT(dma->id));
239 return residue << dma->transfer_shift;
240}
241EXPORT_SYMBOL_GPL(jz4740_dma_get_residue);
242
243static void jz4740_dma_chan_irq(struct jz4740_dma_chan *dma)
244{
245 uint32_t status;
246
247 status = jz4740_dma_read(JZ_REG_DMA_STATUS_CTRL(dma->id));
248
249 jz4740_dma_write_mask(JZ_REG_DMA_STATUS_CTRL(dma->id), 0,
250 JZ_DMA_STATUS_CTRL_ENABLE | JZ_DMA_STATUS_CTRL_TRANSFER_DONE);
251
252 if (dma->complete_cb)
253 dma->complete_cb(dma, 0, dma->dev);
254}
255
256static irqreturn_t jz4740_dma_irq(int irq, void *dev_id)
257{
258 uint32_t irq_status;
259 unsigned int i;
260
261 irq_status = readl(jz4740_dma_base + JZ_REG_DMA_IRQ);
262
263 for (i = 0; i < 6; ++i) {
264 if (irq_status & (1 << i))
265 jz4740_dma_chan_irq(&jz4740_dma_channels[i]);
266 }
267
268 return IRQ_HANDLED;
269}
270
271static int jz4740_dma_init(void)
272{
273 unsigned int ret;
274
275 jz4740_dma_base = ioremap(JZ4740_DMAC_BASE_ADDR, 0x400);
276
277 if (!jz4740_dma_base)
278 return -EBUSY;
279
280 spin_lock_init(&jz4740_dma_lock);
281
282 ret = request_irq(JZ4740_IRQ_DMAC, jz4740_dma_irq, 0, "DMA", NULL);
283
284 if (ret)
285 printk(KERN_ERR "JZ4740 DMA: Failed to request irq: %d\n", ret);
286
287 return ret;
288}
289arch_initcall(jz4740_dma_init);
diff --git a/arch/mips/jz4740/gpio.c b/arch/mips/jz4740/gpio.c
new file mode 100644
index 000000000000..38f60f35156c
--- /dev/null
+++ b/arch/mips/jz4740/gpio.c
@@ -0,0 +1,604 @@
1/*
2 * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 platform GPIO support
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#include <linux/kernel.h>
17#include <linux/module.h>
18#include <linux/init.h>
19
20#include <linux/spinlock.h>
21#include <linux/sysdev.h>
22#include <linux/io.h>
23#include <linux/gpio.h>
24#include <linux/delay.h>
25#include <linux/interrupt.h>
26#include <linux/bitops.h>
27
28#include <linux/debugfs.h>
29#include <linux/seq_file.h>
30
31#include <asm/mach-jz4740/base.h>
32
33#define JZ4740_GPIO_BASE_A (32*0)
34#define JZ4740_GPIO_BASE_B (32*1)
35#define JZ4740_GPIO_BASE_C (32*2)
36#define JZ4740_GPIO_BASE_D (32*3)
37
38#define JZ4740_GPIO_NUM_A 32
39#define JZ4740_GPIO_NUM_B 32
40#define JZ4740_GPIO_NUM_C 31
41#define JZ4740_GPIO_NUM_D 32
42
43#define JZ4740_IRQ_GPIO_BASE_A (JZ4740_IRQ_GPIO(0) + JZ4740_GPIO_BASE_A)
44#define JZ4740_IRQ_GPIO_BASE_B (JZ4740_IRQ_GPIO(0) + JZ4740_GPIO_BASE_B)
45#define JZ4740_IRQ_GPIO_BASE_C (JZ4740_IRQ_GPIO(0) + JZ4740_GPIO_BASE_C)
46#define JZ4740_IRQ_GPIO_BASE_D (JZ4740_IRQ_GPIO(0) + JZ4740_GPIO_BASE_D)
47
48#define JZ_REG_GPIO_PIN 0x00
49#define JZ_REG_GPIO_DATA 0x10
50#define JZ_REG_GPIO_DATA_SET 0x14
51#define JZ_REG_GPIO_DATA_CLEAR 0x18
52#define JZ_REG_GPIO_MASK 0x20
53#define JZ_REG_GPIO_MASK_SET 0x24
54#define JZ_REG_GPIO_MASK_CLEAR 0x28
55#define JZ_REG_GPIO_PULL 0x30
56#define JZ_REG_GPIO_PULL_SET 0x34
57#define JZ_REG_GPIO_PULL_CLEAR 0x38
58#define JZ_REG_GPIO_FUNC 0x40
59#define JZ_REG_GPIO_FUNC_SET 0x44
60#define JZ_REG_GPIO_FUNC_CLEAR 0x48
61#define JZ_REG_GPIO_SELECT 0x50
62#define JZ_REG_GPIO_SELECT_SET 0x54
63#define JZ_REG_GPIO_SELECT_CLEAR 0x58
64#define JZ_REG_GPIO_DIRECTION 0x60
65#define JZ_REG_GPIO_DIRECTION_SET 0x64
66#define JZ_REG_GPIO_DIRECTION_CLEAR 0x68
67#define JZ_REG_GPIO_TRIGGER 0x70
68#define JZ_REG_GPIO_TRIGGER_SET 0x74
69#define JZ_REG_GPIO_TRIGGER_CLEAR 0x78
70#define JZ_REG_GPIO_FLAG 0x80
71#define JZ_REG_GPIO_FLAG_CLEAR 0x14
72
73#define GPIO_TO_BIT(gpio) BIT(gpio & 0x1f)
74#define GPIO_TO_REG(gpio, reg) (gpio_to_jz_gpio_chip(gpio)->base + (reg))
75#define CHIP_TO_REG(chip, reg) (gpio_chip_to_jz_gpio_chip(chip)->base + (reg))
76
77struct jz_gpio_chip {
78 unsigned int irq;
79 unsigned int irq_base;
80 uint32_t wakeup;
81 uint32_t suspend_mask;
82 uint32_t edge_trigger_both;
83
84 void __iomem *base;
85
86 spinlock_t lock;
87
88 struct gpio_chip gpio_chip;
89 struct irq_chip irq_chip;
90 struct sys_device sysdev;
91};
92
93static struct jz_gpio_chip jz4740_gpio_chips[];
94
95static inline struct jz_gpio_chip *gpio_to_jz_gpio_chip(unsigned int gpio)
96{
97 return &jz4740_gpio_chips[gpio >> 5];
98}
99
100static inline struct jz_gpio_chip *gpio_chip_to_jz_gpio_chip(struct gpio_chip *gpio_chip)
101{
102 return container_of(gpio_chip, struct jz_gpio_chip, gpio_chip);
103}
104
105static inline struct jz_gpio_chip *irq_to_jz_gpio_chip(unsigned int irq)
106{
107 return get_irq_chip_data(irq);
108}
109
110static inline void jz_gpio_write_bit(unsigned int gpio, unsigned int reg)
111{
112 writel(GPIO_TO_BIT(gpio), GPIO_TO_REG(gpio, reg));
113}
114
115int jz_gpio_set_function(int gpio, enum jz_gpio_function function)
116{
117 if (function == JZ_GPIO_FUNC_NONE) {
118 jz_gpio_write_bit(gpio, JZ_REG_GPIO_FUNC_CLEAR);
119 jz_gpio_write_bit(gpio, JZ_REG_GPIO_SELECT_CLEAR);
120 jz_gpio_write_bit(gpio, JZ_REG_GPIO_TRIGGER_CLEAR);
121 } else {
122 jz_gpio_write_bit(gpio, JZ_REG_GPIO_FUNC_SET);
123 jz_gpio_write_bit(gpio, JZ_REG_GPIO_TRIGGER_CLEAR);
124 switch (function) {
125 case JZ_GPIO_FUNC1:
126 jz_gpio_write_bit(gpio, JZ_REG_GPIO_SELECT_CLEAR);
127 break;
128 case JZ_GPIO_FUNC3:
129 jz_gpio_write_bit(gpio, JZ_REG_GPIO_TRIGGER_SET);
130 case JZ_GPIO_FUNC2: /* Falltrough */
131 jz_gpio_write_bit(gpio, JZ_REG_GPIO_SELECT_SET);
132 break;
133 default:
134 BUG();
135 break;
136 }
137 }
138
139 return 0;
140}
141EXPORT_SYMBOL_GPL(jz_gpio_set_function);
142
143int jz_gpio_bulk_request(const struct jz_gpio_bulk_request *request, size_t num)
144{
145 size_t i;
146 int ret;
147
148 for (i = 0; i < num; ++i, ++request) {
149 ret = gpio_request(request->gpio, request->name);
150 if (ret)
151 goto err;
152 jz_gpio_set_function(request->gpio, request->function);
153 }
154
155 return 0;
156
157err:
158 for (--request; i > 0; --i, --request) {
159 gpio_free(request->gpio);
160 jz_gpio_set_function(request->gpio, JZ_GPIO_FUNC_NONE);
161 }
162
163 return ret;
164}
165EXPORT_SYMBOL_GPL(jz_gpio_bulk_request);
166
167void jz_gpio_bulk_free(const struct jz_gpio_bulk_request *request, size_t num)
168{
169 size_t i;
170
171 for (i = 0; i < num; ++i, ++request) {
172 gpio_free(request->gpio);
173 jz_gpio_set_function(request->gpio, JZ_GPIO_FUNC_NONE);
174 }
175
176}
177EXPORT_SYMBOL_GPL(jz_gpio_bulk_free);
178
179void jz_gpio_bulk_suspend(const struct jz_gpio_bulk_request *request, size_t num)
180{
181 size_t i;
182
183 for (i = 0; i < num; ++i, ++request) {
184 jz_gpio_set_function(request->gpio, JZ_GPIO_FUNC_NONE);
185 jz_gpio_write_bit(request->gpio, JZ_REG_GPIO_DIRECTION_CLEAR);
186 jz_gpio_write_bit(request->gpio, JZ_REG_GPIO_PULL_SET);
187 }
188}
189EXPORT_SYMBOL_GPL(jz_gpio_bulk_suspend);
190
191void jz_gpio_bulk_resume(const struct jz_gpio_bulk_request *request, size_t num)
192{
193 size_t i;
194
195 for (i = 0; i < num; ++i, ++request)
196 jz_gpio_set_function(request->gpio, request->function);
197}
198EXPORT_SYMBOL_GPL(jz_gpio_bulk_resume);
199
200void jz_gpio_enable_pullup(unsigned gpio)
201{
202 jz_gpio_write_bit(gpio, JZ_REG_GPIO_PULL_CLEAR);
203}
204EXPORT_SYMBOL_GPL(jz_gpio_enable_pullup);
205
206void jz_gpio_disable_pullup(unsigned gpio)
207{
208 jz_gpio_write_bit(gpio, JZ_REG_GPIO_PULL_SET);
209}
210EXPORT_SYMBOL_GPL(jz_gpio_disable_pullup);
211
212static int jz_gpio_get_value(struct gpio_chip *chip, unsigned gpio)
213{
214 return !!(readl(CHIP_TO_REG(chip, JZ_REG_GPIO_PIN)) & BIT(gpio));
215}
216
217static void jz_gpio_set_value(struct gpio_chip *chip, unsigned gpio, int value)
218{
219 uint32_t __iomem *reg = CHIP_TO_REG(chip, JZ_REG_GPIO_DATA_SET);
220 reg += !value;
221 writel(BIT(gpio), reg);
222}
223
224static int jz_gpio_direction_output(struct gpio_chip *chip, unsigned gpio,
225 int value)
226{
227 writel(BIT(gpio), CHIP_TO_REG(chip, JZ_REG_GPIO_DIRECTION_SET));
228 jz_gpio_set_value(chip, gpio, value);
229
230 return 0;
231}
232
233static int jz_gpio_direction_input(struct gpio_chip *chip, unsigned gpio)
234{
235 writel(BIT(gpio), CHIP_TO_REG(chip, JZ_REG_GPIO_DIRECTION_CLEAR));
236
237 return 0;
238}
239
240int jz_gpio_port_direction_input(int port, uint32_t mask)
241{
242 writel(mask, GPIO_TO_REG(port, JZ_REG_GPIO_DIRECTION_CLEAR));
243
244 return 0;
245}
246EXPORT_SYMBOL(jz_gpio_port_direction_input);
247
248int jz_gpio_port_direction_output(int port, uint32_t mask)
249{
250 writel(mask, GPIO_TO_REG(port, JZ_REG_GPIO_DIRECTION_SET));
251
252 return 0;
253}
254EXPORT_SYMBOL(jz_gpio_port_direction_output);
255
256void jz_gpio_port_set_value(int port, uint32_t value, uint32_t mask)
257{
258 writel(~value & mask, GPIO_TO_REG(port, JZ_REG_GPIO_DATA_CLEAR));
259 writel(value & mask, GPIO_TO_REG(port, JZ_REG_GPIO_DATA_SET));
260}
261EXPORT_SYMBOL(jz_gpio_port_set_value);
262
263uint32_t jz_gpio_port_get_value(int port, uint32_t mask)
264{
265 uint32_t value = readl(GPIO_TO_REG(port, JZ_REG_GPIO_PIN));
266
267 return value & mask;
268}
269EXPORT_SYMBOL(jz_gpio_port_get_value);
270
271int gpio_to_irq(unsigned gpio)
272{
273 return JZ4740_IRQ_GPIO(0) + gpio;
274}
275EXPORT_SYMBOL_GPL(gpio_to_irq);
276
277int irq_to_gpio(unsigned irq)
278{
279 return irq - JZ4740_IRQ_GPIO(0);
280}
281EXPORT_SYMBOL_GPL(irq_to_gpio);
282
283#define IRQ_TO_BIT(irq) BIT(irq_to_gpio(irq) & 0x1f)
284
285static void jz_gpio_check_trigger_both(struct jz_gpio_chip *chip, unsigned int irq)
286{
287 uint32_t value;
288 void __iomem *reg;
289 uint32_t mask = IRQ_TO_BIT(irq);
290
291 if (!(chip->edge_trigger_both & mask))
292 return;
293
294 reg = chip->base;
295
296 value = readl(chip->base + JZ_REG_GPIO_PIN);
297 if (value & mask)
298 reg += JZ_REG_GPIO_DIRECTION_CLEAR;
299 else
300 reg += JZ_REG_GPIO_DIRECTION_SET;
301
302 writel(mask, reg);
303}
304
305static void jz_gpio_irq_demux_handler(unsigned int irq, struct irq_desc *desc)
306{
307 uint32_t flag;
308 unsigned int gpio_irq;
309 unsigned int gpio_bank;
310 struct jz_gpio_chip *chip = get_irq_desc_data(desc);
311
312 gpio_bank = JZ4740_IRQ_GPIO0 - irq;
313
314 flag = readl(chip->base + JZ_REG_GPIO_FLAG);
315
316 if (!flag)
317 return;
318
319 gpio_irq = __fls(flag);
320
321 jz_gpio_check_trigger_both(chip, irq);
322
323 gpio_irq += (gpio_bank << 5) + JZ4740_IRQ_GPIO(0);
324
325 generic_handle_irq(gpio_irq);
326};
327
328static inline void jz_gpio_set_irq_bit(unsigned int irq, unsigned int reg)
329{
330 struct jz_gpio_chip *chip = irq_to_jz_gpio_chip(irq);
331 writel(IRQ_TO_BIT(irq), chip->base + reg);
332}
333
334static void jz_gpio_irq_mask(unsigned int irq)
335{
336 jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_MASK_SET);
337};
338
339static void jz_gpio_irq_unmask(unsigned int irq)
340{
341 struct jz_gpio_chip *chip = irq_to_jz_gpio_chip(irq);
342
343 jz_gpio_check_trigger_both(chip, irq);
344
345 jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_MASK_CLEAR);
346};
347
348/* TODO: Check if function is gpio */
349static unsigned int jz_gpio_irq_startup(unsigned int irq)
350{
351 struct irq_desc *desc = irq_to_desc(irq);
352
353 jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_SELECT_SET);
354
355 desc->status &= ~IRQ_MASKED;
356 jz_gpio_irq_unmask(irq);
357
358 return 0;
359}
360
361static void jz_gpio_irq_shutdown(unsigned int irq)
362{
363 struct irq_desc *desc = irq_to_desc(irq);
364
365 jz_gpio_irq_mask(irq);
366 desc->status |= IRQ_MASKED;
367
368 /* Set direction to input */
369 jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_DIRECTION_CLEAR);
370 jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_SELECT_CLEAR);
371}
372
373static void jz_gpio_irq_ack(unsigned int irq)
374{
375 jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_FLAG_CLEAR);
376};
377
378static int jz_gpio_irq_set_type(unsigned int irq, unsigned int flow_type)
379{
380 struct jz_gpio_chip *chip = irq_to_jz_gpio_chip(irq);
381 struct irq_desc *desc = irq_to_desc(irq);
382
383 jz_gpio_irq_mask(irq);
384
385 if (flow_type == IRQ_TYPE_EDGE_BOTH) {
386 uint32_t value = readl(chip->base + JZ_REG_GPIO_PIN);
387 if (value & IRQ_TO_BIT(irq))
388 flow_type = IRQ_TYPE_EDGE_FALLING;
389 else
390 flow_type = IRQ_TYPE_EDGE_RISING;
391 chip->edge_trigger_both |= IRQ_TO_BIT(irq);
392 } else {
393 chip->edge_trigger_both &= ~IRQ_TO_BIT(irq);
394 }
395
396 switch (flow_type) {
397 case IRQ_TYPE_EDGE_RISING:
398 jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_DIRECTION_SET);
399 jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_TRIGGER_SET);
400 break;
401 case IRQ_TYPE_EDGE_FALLING:
402 jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_DIRECTION_CLEAR);
403 jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_TRIGGER_SET);
404 break;
405 case IRQ_TYPE_LEVEL_HIGH:
406 jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_DIRECTION_SET);
407 jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_TRIGGER_CLEAR);
408 break;
409 case IRQ_TYPE_LEVEL_LOW:
410 jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_DIRECTION_CLEAR);
411 jz_gpio_set_irq_bit(irq, JZ_REG_GPIO_TRIGGER_CLEAR);
412 break;
413 default:
414 return -EINVAL;
415 }
416
417 if (!(desc->status & IRQ_MASKED))
418 jz_gpio_irq_unmask(irq);
419
420 return 0;
421}
422
423static int jz_gpio_irq_set_wake(unsigned int irq, unsigned int on)
424{
425 struct jz_gpio_chip *chip = irq_to_jz_gpio_chip(irq);
426 spin_lock(&chip->lock);
427 if (on)
428 chip->wakeup |= IRQ_TO_BIT(irq);
429 else
430 chip->wakeup &= ~IRQ_TO_BIT(irq);
431 spin_unlock(&chip->lock);
432
433 set_irq_wake(chip->irq, on);
434 return 0;
435}
436
437/*
438 * This lock class tells lockdep that GPIO irqs are in a different
439 * category than their parents, so it won't report false recursion.
440 */
441static struct lock_class_key gpio_lock_class;
442
443#define JZ4740_GPIO_CHIP(_bank) { \
444 .irq_base = JZ4740_IRQ_GPIO_BASE_ ## _bank, \
445 .gpio_chip = { \
446 .label = "Bank " # _bank, \
447 .owner = THIS_MODULE, \
448 .set = jz_gpio_set_value, \
449 .get = jz_gpio_get_value, \
450 .direction_output = jz_gpio_direction_output, \
451 .direction_input = jz_gpio_direction_input, \
452 .base = JZ4740_GPIO_BASE_ ## _bank, \
453 .ngpio = JZ4740_GPIO_NUM_ ## _bank, \
454 }, \
455 .irq_chip = { \
456 .name = "GPIO Bank " # _bank, \
457 .mask = jz_gpio_irq_mask, \
458 .unmask = jz_gpio_irq_unmask, \
459 .ack = jz_gpio_irq_ack, \
460 .startup = jz_gpio_irq_startup, \
461 .shutdown = jz_gpio_irq_shutdown, \
462 .set_type = jz_gpio_irq_set_type, \
463 .set_wake = jz_gpio_irq_set_wake, \
464 }, \
465}
466
467static struct jz_gpio_chip jz4740_gpio_chips[] = {
468 JZ4740_GPIO_CHIP(A),
469 JZ4740_GPIO_CHIP(B),
470 JZ4740_GPIO_CHIP(C),
471 JZ4740_GPIO_CHIP(D),
472};
473
474static inline struct jz_gpio_chip *sysdev_to_chip(struct sys_device *dev)
475{
476 return container_of(dev, struct jz_gpio_chip, sysdev);
477}
478
479static int jz4740_gpio_suspend(struct sys_device *dev, pm_message_t state)
480{
481 struct jz_gpio_chip *chip = sysdev_to_chip(dev);
482
483 chip->suspend_mask = readl(chip->base + JZ_REG_GPIO_MASK);
484 writel(~(chip->wakeup), chip->base + JZ_REG_GPIO_MASK_SET);
485 writel(chip->wakeup, chip->base + JZ_REG_GPIO_MASK_CLEAR);
486
487 return 0;
488}
489
490static int jz4740_gpio_resume(struct sys_device *dev)
491{
492 struct jz_gpio_chip *chip = sysdev_to_chip(dev);
493 uint32_t mask = chip->suspend_mask;
494
495 writel(~mask, chip->base + JZ_REG_GPIO_MASK_CLEAR);
496 writel(mask, chip->base + JZ_REG_GPIO_MASK_SET);
497
498 return 0;
499}
500
501static struct sysdev_class jz4740_gpio_sysdev_class = {
502 .name = "gpio",
503 .suspend = jz4740_gpio_suspend,
504 .resume = jz4740_gpio_resume,
505};
506
507static int jz4740_gpio_chip_init(struct jz_gpio_chip *chip, unsigned int id)
508{
509 int ret, irq;
510
511 chip->sysdev.id = id;
512 chip->sysdev.cls = &jz4740_gpio_sysdev_class;
513 ret = sysdev_register(&chip->sysdev);
514
515 if (ret)
516 return ret;
517
518 spin_lock_init(&chip->lock);
519
520 chip->base = ioremap(JZ4740_GPIO_BASE_ADDR + (id * 0x100), 0x100);
521
522 gpiochip_add(&chip->gpio_chip);
523
524 chip->irq = JZ4740_IRQ_INTC_GPIO(id);
525 set_irq_data(chip->irq, chip);
526 set_irq_chained_handler(chip->irq, jz_gpio_irq_demux_handler);
527
528 for (irq = chip->irq_base; irq < chip->irq_base + chip->gpio_chip.ngpio; ++irq) {
529 lockdep_set_class(&irq_desc[irq].lock, &gpio_lock_class);
530 set_irq_chip_data(irq, chip);
531 set_irq_chip_and_handler(irq, &chip->irq_chip, handle_level_irq);
532 }
533
534 return 0;
535}
536
537static int __init jz4740_gpio_init(void)
538{
539 unsigned int i;
540 int ret;
541
542 ret = sysdev_class_register(&jz4740_gpio_sysdev_class);
543 if (ret)
544 return ret;
545
546 for (i = 0; i < ARRAY_SIZE(jz4740_gpio_chips); ++i)
547 jz4740_gpio_chip_init(&jz4740_gpio_chips[i], i);
548
549 printk(KERN_INFO "JZ4740 GPIO initalized\n");
550
551 return 0;
552}
553arch_initcall(jz4740_gpio_init);
554
555#ifdef CONFIG_DEBUG_FS
556
557static inline void gpio_seq_reg(struct seq_file *s, struct jz_gpio_chip *chip,
558 const char *name, unsigned int reg)
559{
560 seq_printf(s, "\t%s: %08x\n", name, readl(chip->base + reg));
561}
562
563static int gpio_regs_show(struct seq_file *s, void *unused)
564{
565 struct jz_gpio_chip *chip = jz4740_gpio_chips;
566 int i;
567
568 for (i = 0; i < ARRAY_SIZE(jz4740_gpio_chips); ++i, ++chip) {
569 seq_printf(s, "==GPIO %d==\n", i);
570 gpio_seq_reg(s, chip, "Pin", JZ_REG_GPIO_PIN);
571 gpio_seq_reg(s, chip, "Data", JZ_REG_GPIO_DATA);
572 gpio_seq_reg(s, chip, "Mask", JZ_REG_GPIO_MASK);
573 gpio_seq_reg(s, chip, "Pull", JZ_REG_GPIO_PULL);
574 gpio_seq_reg(s, chip, "Func", JZ_REG_GPIO_FUNC);
575 gpio_seq_reg(s, chip, "Select", JZ_REG_GPIO_SELECT);
576 gpio_seq_reg(s, chip, "Direction", JZ_REG_GPIO_DIRECTION);
577 gpio_seq_reg(s, chip, "Trigger", JZ_REG_GPIO_TRIGGER);
578 gpio_seq_reg(s, chip, "Flag", JZ_REG_GPIO_FLAG);
579 }
580
581 return 0;
582}
583
584static int gpio_regs_open(struct inode *inode, struct file *file)
585{
586 return single_open(file, gpio_regs_show, NULL);
587}
588
589static const struct file_operations gpio_regs_operations = {
590 .open = gpio_regs_open,
591 .read = seq_read,
592 .llseek = seq_lseek,
593 .release = single_release,
594};
595
596static int __init gpio_debugfs_init(void)
597{
598 (void) debugfs_create_file("jz_regs_gpio", S_IFREG | S_IRUGO,
599 NULL, NULL, &gpio_regs_operations);
600 return 0;
601}
602subsys_initcall(gpio_debugfs_init);
603
604#endif
diff --git a/arch/mips/jz4740/irq.c b/arch/mips/jz4740/irq.c
new file mode 100644
index 000000000000..7d33ff83580f
--- /dev/null
+++ b/arch/mips/jz4740/irq.c
@@ -0,0 +1,167 @@
1/*
2 * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 platform IRQ support
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#include <linux/errno.h>
17#include <linux/init.h>
18#include <linux/types.h>
19#include <linux/interrupt.h>
20#include <linux/ioport.h>
21#include <linux/timex.h>
22#include <linux/slab.h>
23#include <linux/delay.h>
24
25#include <linux/debugfs.h>
26#include <linux/seq_file.h>
27
28#include <asm/io.h>
29#include <asm/mipsregs.h>
30#include <asm/irq_cpu.h>
31
32#include <asm/mach-jz4740/base.h>
33
34static void __iomem *jz_intc_base;
35static uint32_t jz_intc_wakeup;
36static uint32_t jz_intc_saved;
37
38#define JZ_REG_INTC_STATUS 0x00
39#define JZ_REG_INTC_MASK 0x04
40#define JZ_REG_INTC_SET_MASK 0x08
41#define JZ_REG_INTC_CLEAR_MASK 0x0c
42#define JZ_REG_INTC_PENDING 0x10
43
44#define IRQ_BIT(x) BIT((x) - JZ4740_IRQ_BASE)
45
46static void intc_irq_unmask(unsigned int irq)
47{
48 writel(IRQ_BIT(irq), jz_intc_base + JZ_REG_INTC_CLEAR_MASK);
49}
50
51static void intc_irq_mask(unsigned int irq)
52{
53 writel(IRQ_BIT(irq), jz_intc_base + JZ_REG_INTC_SET_MASK);
54}
55
56static int intc_irq_set_wake(unsigned int irq, unsigned int on)
57{
58 if (on)
59 jz_intc_wakeup |= IRQ_BIT(irq);
60 else
61 jz_intc_wakeup &= ~IRQ_BIT(irq);
62
63 return 0;
64}
65
66static struct irq_chip intc_irq_type = {
67 .name = "INTC",
68 .mask = intc_irq_mask,
69 .mask_ack = intc_irq_mask,
70 .unmask = intc_irq_unmask,
71 .set_wake = intc_irq_set_wake,
72};
73
74static irqreturn_t jz4740_cascade(int irq, void *data)
75{
76 uint32_t irq_reg;
77
78 irq_reg = readl(jz_intc_base + JZ_REG_INTC_PENDING);
79
80 if (irq_reg)
81 generic_handle_irq(__fls(irq_reg) + JZ4740_IRQ_BASE);
82
83 return IRQ_HANDLED;
84}
85
86static struct irqaction jz4740_cascade_action = {
87 .handler = jz4740_cascade,
88 .name = "JZ4740 cascade interrupt",
89};
90
91void __init arch_init_irq(void)
92{
93 int i;
94 mips_cpu_irq_init();
95
96 jz_intc_base = ioremap(JZ4740_INTC_BASE_ADDR, 0x14);
97
98 for (i = JZ4740_IRQ_BASE; i < JZ4740_IRQ_BASE + 32; i++) {
99 intc_irq_mask(i);
100 set_irq_chip_and_handler(i, &intc_irq_type, handle_level_irq);
101 }
102
103 setup_irq(2, &jz4740_cascade_action);
104}
105
106asmlinkage void plat_irq_dispatch(void)
107{
108 unsigned int pending = read_c0_status() & read_c0_cause() & ST0_IM;
109 if (pending & STATUSF_IP2)
110 do_IRQ(2);
111 else if (pending & STATUSF_IP3)
112 do_IRQ(3);
113 else
114 spurious_interrupt();
115}
116
117void jz4740_intc_suspend(void)
118{
119 jz_intc_saved = readl(jz_intc_base + JZ_REG_INTC_MASK);
120 writel(~jz_intc_wakeup, jz_intc_base + JZ_REG_INTC_SET_MASK);
121 writel(jz_intc_wakeup, jz_intc_base + JZ_REG_INTC_CLEAR_MASK);
122}
123
124void jz4740_intc_resume(void)
125{
126 writel(~jz_intc_saved, jz_intc_base + JZ_REG_INTC_CLEAR_MASK);
127 writel(jz_intc_saved, jz_intc_base + JZ_REG_INTC_SET_MASK);
128}
129
130#ifdef CONFIG_DEBUG_FS
131
132static inline void intc_seq_reg(struct seq_file *s, const char *name,
133 unsigned int reg)
134{
135 seq_printf(s, "%s:\t\t%08x\n", name, readl(jz_intc_base + reg));
136}
137
138static int intc_regs_show(struct seq_file *s, void *unused)
139{
140 intc_seq_reg(s, "Status", JZ_REG_INTC_STATUS);
141 intc_seq_reg(s, "Mask", JZ_REG_INTC_MASK);
142 intc_seq_reg(s, "Pending", JZ_REG_INTC_PENDING);
143
144 return 0;
145}
146
147static int intc_regs_open(struct inode *inode, struct file *file)
148{
149 return single_open(file, intc_regs_show, NULL);
150}
151
152static const struct file_operations intc_regs_operations = {
153 .open = intc_regs_open,
154 .read = seq_read,
155 .llseek = seq_lseek,
156 .release = single_release,
157};
158
159static int __init intc_debugfs_init(void)
160{
161 (void) debugfs_create_file("jz_regs_intc", S_IFREG | S_IRUGO,
162 NULL, NULL, &intc_regs_operations);
163 return 0;
164}
165subsys_initcall(intc_debugfs_init);
166
167#endif
diff --git a/arch/mips/jz4740/irq.h b/arch/mips/jz4740/irq.h
new file mode 100644
index 000000000000..56b5eadd1fa2
--- /dev/null
+++ b/arch/mips/jz4740/irq.h
@@ -0,0 +1,21 @@
1/*
2 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * You should have received a copy of the GNU General Public License along
10 * with this program; if not, write to the Free Software Foundation, Inc.,
11 * 675 Mass Ave, Cambridge, MA 02139, USA.
12 *
13 */
14
15#ifndef __MIPS_JZ4740_IRQ_H__
16#define __MIPS_JZ4740_IRQ_H__
17
18extern void jz4740_intc_suspend(void);
19extern void jz4740_intc_resume(void);
20
21#endif
diff --git a/arch/mips/jz4740/platform.c b/arch/mips/jz4740/platform.c
new file mode 100644
index 000000000000..95bc2b5b14f1
--- /dev/null
+++ b/arch/mips/jz4740/platform.c
@@ -0,0 +1,291 @@
1/*
2 * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 platform devices
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#include <linux/device.h>
17#include <linux/init.h>
18#include <linux/kernel.h>
19#include <linux/platform_device.h>
20#include <linux/resource.h>
21
22#include <linux/dma-mapping.h>
23
24#include <asm/mach-jz4740/platform.h>
25#include <asm/mach-jz4740/base.h>
26#include <asm/mach-jz4740/irq.h>
27
28#include <linux/serial_core.h>
29#include <linux/serial_8250.h>
30
31#include "serial.h"
32#include "clock.h"
33
34/* OHCI controller */
35static struct resource jz4740_usb_ohci_resources[] = {
36 {
37 .start = JZ4740_UHC_BASE_ADDR,
38 .end = JZ4740_UHC_BASE_ADDR + 0x1000 - 1,
39 .flags = IORESOURCE_MEM,
40 },
41 {
42 .start = JZ4740_IRQ_UHC,
43 .end = JZ4740_IRQ_UHC,
44 .flags = IORESOURCE_IRQ,
45 },
46};
47
48struct platform_device jz4740_usb_ohci_device = {
49 .name = "jz4740-ohci",
50 .id = -1,
51 .dev = {
52 .dma_mask = &jz4740_usb_ohci_device.dev.coherent_dma_mask,
53 .coherent_dma_mask = DMA_BIT_MASK(32),
54 },
55 .num_resources = ARRAY_SIZE(jz4740_usb_ohci_resources),
56 .resource = jz4740_usb_ohci_resources,
57};
58
59/* UDC (USB gadget controller) */
60static struct resource jz4740_usb_gdt_resources[] = {
61 {
62 .start = JZ4740_UDC_BASE_ADDR,
63 .end = JZ4740_UDC_BASE_ADDR + 0x1000 - 1,
64 .flags = IORESOURCE_MEM,
65 },
66 {
67 .start = JZ4740_IRQ_UDC,
68 .end = JZ4740_IRQ_UDC,
69 .flags = IORESOURCE_IRQ,
70 },
71};
72
73struct platform_device jz4740_udc_device = {
74 .name = "jz-udc",
75 .id = -1,
76 .dev = {
77 .dma_mask = &jz4740_udc_device.dev.coherent_dma_mask,
78 .coherent_dma_mask = DMA_BIT_MASK(32),
79 },
80 .num_resources = ARRAY_SIZE(jz4740_usb_gdt_resources),
81 .resource = jz4740_usb_gdt_resources,
82};
83
84/* MMC/SD controller */
85static struct resource jz4740_mmc_resources[] = {
86 {
87 .start = JZ4740_MSC_BASE_ADDR,
88 .end = JZ4740_MSC_BASE_ADDR + 0x1000 - 1,
89 .flags = IORESOURCE_MEM,
90 },
91 {
92 .start = JZ4740_IRQ_MSC,
93 .end = JZ4740_IRQ_MSC,
94 .flags = IORESOURCE_IRQ,
95 }
96};
97
98struct platform_device jz4740_mmc_device = {
99 .name = "jz4740-mmc",
100 .id = 0,
101 .dev = {
102 .dma_mask = &jz4740_mmc_device.dev.coherent_dma_mask,
103 .coherent_dma_mask = DMA_BIT_MASK(32),
104 },
105 .num_resources = ARRAY_SIZE(jz4740_mmc_resources),
106 .resource = jz4740_mmc_resources,
107};
108
109/* RTC controller */
110static struct resource jz4740_rtc_resources[] = {
111 {
112 .start = JZ4740_RTC_BASE_ADDR,
113 .end = JZ4740_RTC_BASE_ADDR + 0x38 - 1,
114 .flags = IORESOURCE_MEM,
115 },
116 {
117 .start = JZ4740_IRQ_RTC,
118 .end = JZ4740_IRQ_RTC,
119 .flags = IORESOURCE_IRQ,
120 },
121};
122
123struct platform_device jz4740_rtc_device = {
124 .name = "jz4740-rtc",
125 .id = -1,
126 .num_resources = ARRAY_SIZE(jz4740_rtc_resources),
127 .resource = jz4740_rtc_resources,
128};
129
130/* I2C controller */
131static struct resource jz4740_i2c_resources[] = {
132 {
133 .start = JZ4740_I2C_BASE_ADDR,
134 .end = JZ4740_I2C_BASE_ADDR + 0x1000 - 1,
135 .flags = IORESOURCE_MEM,
136 },
137 {
138 .start = JZ4740_IRQ_I2C,
139 .end = JZ4740_IRQ_I2C,
140 .flags = IORESOURCE_IRQ,
141 }
142};
143
144struct platform_device jz4740_i2c_device = {
145 .name = "jz4740-i2c",
146 .id = 0,
147 .num_resources = ARRAY_SIZE(jz4740_i2c_resources),
148 .resource = jz4740_i2c_resources,
149};
150
151/* NAND controller */
152static struct resource jz4740_nand_resources[] = {
153 {
154 .name = "mmio",
155 .start = JZ4740_EMC_BASE_ADDR,
156 .end = JZ4740_EMC_BASE_ADDR + 0x1000 - 1,
157 .flags = IORESOURCE_MEM,
158 },
159 {
160 .name = "bank",
161 .start = 0x18000000,
162 .end = 0x180C0000 - 1,
163 .flags = IORESOURCE_MEM,
164 },
165};
166
167struct platform_device jz4740_nand_device = {
168 .name = "jz4740-nand",
169 .num_resources = ARRAY_SIZE(jz4740_nand_resources),
170 .resource = jz4740_nand_resources,
171};
172
173/* LCD controller */
174static struct resource jz4740_framebuffer_resources[] = {
175 {
176 .start = JZ4740_LCD_BASE_ADDR,
177 .end = JZ4740_LCD_BASE_ADDR + 0x1000 - 1,
178 .flags = IORESOURCE_MEM,
179 },
180};
181
182struct platform_device jz4740_framebuffer_device = {
183 .name = "jz4740-fb",
184 .id = -1,
185 .num_resources = ARRAY_SIZE(jz4740_framebuffer_resources),
186 .resource = jz4740_framebuffer_resources,
187 .dev = {
188 .dma_mask = &jz4740_framebuffer_device.dev.coherent_dma_mask,
189 .coherent_dma_mask = DMA_BIT_MASK(32),
190 },
191};
192
193/* I2S controller */
194static struct resource jz4740_i2s_resources[] = {
195 {
196 .start = JZ4740_AIC_BASE_ADDR,
197 .end = JZ4740_AIC_BASE_ADDR + 0x38 - 1,
198 .flags = IORESOURCE_MEM,
199 },
200};
201
202struct platform_device jz4740_i2s_device = {
203 .name = "jz4740-i2s",
204 .id = -1,
205 .num_resources = ARRAY_SIZE(jz4740_i2s_resources),
206 .resource = jz4740_i2s_resources,
207};
208
209/* PCM */
210struct platform_device jz4740_pcm_device = {
211 .name = "jz4740-pcm",
212 .id = -1,
213};
214
215/* Codec */
216static struct resource jz4740_codec_resources[] = {
217 {
218 .start = JZ4740_AIC_BASE_ADDR + 0x80,
219 .end = JZ4740_AIC_BASE_ADDR + 0x88 - 1,
220 .flags = IORESOURCE_MEM,
221 },
222};
223
224struct platform_device jz4740_codec_device = {
225 .name = "jz4740-codec",
226 .id = -1,
227 .num_resources = ARRAY_SIZE(jz4740_codec_resources),
228 .resource = jz4740_codec_resources,
229};
230
231/* ADC controller */
232static struct resource jz4740_adc_resources[] = {
233 {
234 .start = JZ4740_SADC_BASE_ADDR,
235 .end = JZ4740_SADC_BASE_ADDR + 0x30,
236 .flags = IORESOURCE_MEM,
237 },
238 {
239 .start = JZ4740_IRQ_SADC,
240 .end = JZ4740_IRQ_SADC,
241 .flags = IORESOURCE_IRQ,
242 },
243 {
244 .start = JZ4740_IRQ_ADC_BASE,
245 .end = JZ4740_IRQ_ADC_BASE,
246 .flags = IORESOURCE_IRQ,
247 },
248};
249
250struct platform_device jz4740_adc_device = {
251 .name = "jz4740-adc",
252 .id = -1,
253 .num_resources = ARRAY_SIZE(jz4740_adc_resources),
254 .resource = jz4740_adc_resources,
255};
256
257/* Serial */
258#define JZ4740_UART_DATA(_id) \
259 { \
260 .flags = UPF_SKIP_TEST | UPF_IOREMAP | UPF_FIXED_TYPE, \
261 .iotype = UPIO_MEM, \
262 .regshift = 2, \
263 .serial_out = jz4740_serial_out, \
264 .type = PORT_16550, \
265 .mapbase = JZ4740_UART ## _id ## _BASE_ADDR, \
266 .irq = JZ4740_IRQ_UART ## _id, \
267 }
268
269static struct plat_serial8250_port jz4740_uart_data[] = {
270 JZ4740_UART_DATA(0),
271 JZ4740_UART_DATA(1),
272 {},
273};
274
275static struct platform_device jz4740_uart_device = {
276 .name = "serial8250",
277 .id = 0,
278 .dev = {
279 .platform_data = jz4740_uart_data,
280 },
281};
282
283void jz4740_serial_device_register(void)
284{
285 struct plat_serial8250_port *p;
286
287 for (p = jz4740_uart_data; p->flags != 0; ++p)
288 p->uartclk = jz4740_clock_bdata.ext_rate;
289
290 platform_device_register(&jz4740_uart_device);
291}
diff --git a/arch/mips/jz4740/pm.c b/arch/mips/jz4740/pm.c
new file mode 100644
index 000000000000..a9994585424d
--- /dev/null
+++ b/arch/mips/jz4740/pm.c
@@ -0,0 +1,56 @@
1/*
2 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 SoC power management support
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#include <linux/init.h>
17#include <linux/pm.h>
18#include <linux/delay.h>
19#include <linux/suspend.h>
20
21#include <asm/mach-jz4740/clock.h>
22
23#include "clock.h"
24#include "irq.h"
25
26static int jz4740_pm_enter(suspend_state_t state)
27{
28 jz4740_intc_suspend();
29 jz4740_clock_suspend();
30
31 jz4740_clock_set_wait_mode(JZ4740_WAIT_MODE_SLEEP);
32
33 __asm__(".set\tmips3\n\t"
34 "wait\n\t"
35 ".set\tmips0");
36
37 jz4740_clock_set_wait_mode(JZ4740_WAIT_MODE_IDLE);
38
39 jz4740_clock_resume();
40 jz4740_intc_resume();
41
42 return 0;
43}
44
45static struct platform_suspend_ops jz4740_pm_ops = {
46 .valid = suspend_valid_only_mem,
47 .enter = jz4740_pm_enter,
48};
49
50static int __init jz4740_pm_init(void)
51{
52 suspend_set_ops(&jz4740_pm_ops);
53 return 0;
54
55}
56late_initcall(jz4740_pm_init);
diff --git a/arch/mips/jz4740/prom.c b/arch/mips/jz4740/prom.c
new file mode 100644
index 000000000000..cfeac15eb2e4
--- /dev/null
+++ b/arch/mips/jz4740/prom.c
@@ -0,0 +1,68 @@
1/*
2 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 SoC prom code
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#include <linux/module.h>
17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/string.h>
20
21#include <linux/serial_reg.h>
22
23#include <asm/bootinfo.h>
24#include <asm/mach-jz4740/base.h>
25
26void jz4740_init_cmdline(int argc, char *argv[])
27{
28 unsigned int count = COMMAND_LINE_SIZE - 1;
29 int i;
30 char *dst = &(arcs_cmdline[0]);
31 char *src;
32
33 for (i = 1; i < argc && count; ++i) {
34 src = argv[i];
35 while (*src && count) {
36 *dst++ = *src++;
37 --count;
38 }
39 *dst++ = ' ';
40 }
41 if (i > 1)
42 --dst;
43
44 *dst = 0;
45}
46
47void __init prom_init(void)
48{
49 jz4740_init_cmdline((int)fw_arg0, (char **)fw_arg1);
50 mips_machtype = MACH_INGENIC_JZ4740;
51}
52
53void __init prom_free_prom_memory(void)
54{
55}
56
57#define UART_REG(_reg) ((void __iomem *)CKSEG1ADDR(JZ4740_UART0_BASE_ADDR + (_reg << 2)))
58
59void prom_putchar(char c)
60{
61 uint8_t lsr;
62
63 do {
64 lsr = readb(UART_REG(UART_LSR));
65 } while ((lsr & UART_LSR_TEMT) == 0);
66
67 writeb(c, UART_REG(UART_TX));
68}
diff --git a/arch/mips/jz4740/pwm.c b/arch/mips/jz4740/pwm.c
new file mode 100644
index 000000000000..a26a6faec9a6
--- /dev/null
+++ b/arch/mips/jz4740/pwm.c
@@ -0,0 +1,177 @@
1/*
2 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 platform PWM support
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#include <linux/kernel.h>
17
18#include <linux/clk.h>
19#include <linux/err.h>
20#include <linux/pwm.h>
21#include <linux/gpio.h>
22
23#include <asm/mach-jz4740/gpio.h>
24#include "timer.h"
25
26static struct clk *jz4740_pwm_clk;
27
28DEFINE_MUTEX(jz4740_pwm_mutex);
29
30struct pwm_device {
31 unsigned int id;
32 unsigned int gpio;
33 bool used;
34};
35
36static struct pwm_device jz4740_pwm_list[] = {
37 { 2, JZ_GPIO_PWM2, false },
38 { 3, JZ_GPIO_PWM3, false },
39 { 4, JZ_GPIO_PWM4, false },
40 { 5, JZ_GPIO_PWM5, false },
41 { 6, JZ_GPIO_PWM6, false },
42 { 7, JZ_GPIO_PWM7, false },
43};
44
45struct pwm_device *pwm_request(int id, const char *label)
46{
47 int ret = 0;
48 struct pwm_device *pwm;
49
50 if (id < 2 || id > 7 || !jz4740_pwm_clk)
51 return ERR_PTR(-ENODEV);
52
53 mutex_lock(&jz4740_pwm_mutex);
54
55 pwm = &jz4740_pwm_list[id - 2];
56 if (pwm->used)
57 ret = -EBUSY;
58 else
59 pwm->used = true;
60
61 mutex_unlock(&jz4740_pwm_mutex);
62
63 if (ret)
64 return ERR_PTR(ret);
65
66 ret = gpio_request(pwm->gpio, label);
67
68 if (ret) {
69 printk(KERN_ERR "Failed to request pwm gpio: %d\n", ret);
70 pwm->used = false;
71 return ERR_PTR(ret);
72 }
73
74 jz_gpio_set_function(pwm->gpio, JZ_GPIO_FUNC_PWM);
75
76 jz4740_timer_start(id);
77
78 return pwm;
79}
80
81void pwm_free(struct pwm_device *pwm)
82{
83 pwm_disable(pwm);
84 jz4740_timer_set_ctrl(pwm->id, 0);
85
86 jz_gpio_set_function(pwm->gpio, JZ_GPIO_FUNC_NONE);
87 gpio_free(pwm->gpio);
88
89 jz4740_timer_stop(pwm->id);
90
91 pwm->used = false;
92}
93
94int pwm_config(struct pwm_device *pwm, int duty_ns, int period_ns)
95{
96 unsigned long long tmp;
97 unsigned long period, duty;
98 unsigned int prescaler = 0;
99 unsigned int id = pwm->id;
100 uint16_t ctrl;
101 bool is_enabled;
102
103 if (duty_ns < 0 || duty_ns > period_ns)
104 return -EINVAL;
105
106 tmp = (unsigned long long)clk_get_rate(jz4740_pwm_clk) * period_ns;
107 do_div(tmp, 1000000000);
108 period = tmp;
109
110 while (period > 0xffff && prescaler < 6) {
111 period >>= 2;
112 ++prescaler;
113 }
114
115 if (prescaler == 6)
116 return -EINVAL;
117
118 tmp = (unsigned long long)period * duty_ns;
119 do_div(tmp, period_ns);
120 duty = period - tmp;
121
122 if (duty >= period)
123 duty = period - 1;
124
125 is_enabled = jz4740_timer_is_enabled(id);
126 if (is_enabled)
127 pwm_disable(pwm);
128
129 jz4740_timer_set_count(id, 0);
130 jz4740_timer_set_duty(id, duty);
131 jz4740_timer_set_period(id, period);
132
133 ctrl = JZ_TIMER_CTRL_PRESCALER(prescaler) | JZ_TIMER_CTRL_SRC_EXT |
134 JZ_TIMER_CTRL_PWM_ABBRUPT_SHUTDOWN;
135
136 jz4740_timer_set_ctrl(id, ctrl);
137
138 if (is_enabled)
139 pwm_enable(pwm);
140
141 return 0;
142}
143
144int pwm_enable(struct pwm_device *pwm)
145{
146 uint32_t ctrl = jz4740_timer_get_ctrl(pwm->id);
147
148 ctrl |= JZ_TIMER_CTRL_PWM_ENABLE;
149 jz4740_timer_set_ctrl(pwm->id, ctrl);
150 jz4740_timer_enable(pwm->id);
151
152 return 0;
153}
154
155void pwm_disable(struct pwm_device *pwm)
156{
157 uint32_t ctrl = jz4740_timer_get_ctrl(pwm->id);
158
159 ctrl &= ~JZ_TIMER_CTRL_PWM_ENABLE;
160 jz4740_timer_disable(pwm->id);
161 jz4740_timer_set_ctrl(pwm->id, ctrl);
162}
163
164static int __init jz4740_pwm_init(void)
165{
166 int ret = 0;
167
168 jz4740_pwm_clk = clk_get(NULL, "ext");
169
170 if (IS_ERR(jz4740_pwm_clk)) {
171 ret = PTR_ERR(jz4740_pwm_clk);
172 jz4740_pwm_clk = NULL;
173 }
174
175 return ret;
176}
177subsys_initcall(jz4740_pwm_init);
diff --git a/arch/mips/jz4740/reset.c b/arch/mips/jz4740/reset.c
new file mode 100644
index 000000000000..5f1fb95c0d0d
--- /dev/null
+++ b/arch/mips/jz4740/reset.c
@@ -0,0 +1,79 @@
1/*
2 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * You should have received a copy of the GNU General Public License along
10 * with this program; if not, write to the Free Software Foundation, Inc.,
11 * 675 Mass Ave, Cambridge, MA 02139, USA.
12 *
13 */
14
15#include <linux/io.h>
16#include <linux/kernel.h>
17#include <linux/pm.h>
18
19#include <asm/reboot.h>
20
21#include <asm/mach-jz4740/base.h>
22#include <asm/mach-jz4740/timer.h>
23
24static void jz4740_halt(void)
25{
26 while (1) {
27 __asm__(".set push;\n"
28 ".set mips3;\n"
29 "wait;\n"
30 ".set pop;\n"
31 );
32 }
33}
34
35#define JZ_REG_WDT_DATA 0x00
36#define JZ_REG_WDT_COUNTER_ENABLE 0x04
37#define JZ_REG_WDT_COUNTER 0x08
38#define JZ_REG_WDT_CTRL 0x0c
39
40static void jz4740_restart(char *command)
41{
42 void __iomem *wdt_base = ioremap(JZ4740_WDT_BASE_ADDR, 0x0f);
43
44 jz4740_timer_enable_watchdog();
45
46 writeb(0, wdt_base + JZ_REG_WDT_COUNTER_ENABLE);
47
48 writew(0, wdt_base + JZ_REG_WDT_COUNTER);
49 writew(0, wdt_base + JZ_REG_WDT_DATA);
50 writew(BIT(2), wdt_base + JZ_REG_WDT_CTRL);
51
52 writeb(1, wdt_base + JZ_REG_WDT_COUNTER_ENABLE);
53 jz4740_halt();
54}
55
56#define JZ_REG_RTC_CTRL 0x00
57#define JZ_REG_RTC_HIBERNATE 0x20
58
59#define JZ_RTC_CTRL_WRDY BIT(7)
60
61static void jz4740_power_off(void)
62{
63 void __iomem *rtc_base = ioremap(JZ4740_RTC_BASE_ADDR, 0x24);
64 uint32_t ctrl;
65
66 do {
67 ctrl = readl(rtc_base + JZ_REG_RTC_CTRL);
68 } while (!(ctrl & JZ_RTC_CTRL_WRDY));
69
70 writel(1, rtc_base + JZ_REG_RTC_HIBERNATE);
71 jz4740_halt();
72}
73
74void jz4740_reset_init(void)
75{
76 _machine_restart = jz4740_restart;
77 _machine_halt = jz4740_halt;
78 pm_power_off = jz4740_power_off;
79}
diff --git a/arch/mips/jz4740/reset.h b/arch/mips/jz4740/reset.h
new file mode 100644
index 000000000000..5202ab4ad9db
--- /dev/null
+++ b/arch/mips/jz4740/reset.h
@@ -0,0 +1,6 @@
1#ifndef __MIPS_JZ4740_RESET_H__
2#define __MIPS_JZ4740_RESET_H__
3
4extern void jz4740_reset_init(void);
5
6#endif
diff --git a/arch/mips/jz4740/serial.c b/arch/mips/jz4740/serial.c
new file mode 100644
index 000000000000..d23de45826d1
--- /dev/null
+++ b/arch/mips/jz4740/serial.c
@@ -0,0 +1,33 @@
1/*
2 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 serial support
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#include <linux/io.h>
17#include <linux/serial_core.h>
18#include <linux/serial_reg.h>
19
20void jz4740_serial_out(struct uart_port *p, int offset, int value)
21{
22 switch (offset) {
23 case UART_FCR:
24 value |= 0x10; /* Enable uart module */
25 break;
26 case UART_IER:
27 value |= (value & 0x4) << 2;
28 break;
29 default:
30 break;
31 }
32 writeb(value, p->membase + (offset << p->regshift));
33}
diff --git a/arch/mips/jz4740/serial.h b/arch/mips/jz4740/serial.h
new file mode 100644
index 000000000000..b9fe3ade0289
--- /dev/null
+++ b/arch/mips/jz4740/serial.h
@@ -0,0 +1,20 @@
1/*
2 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 serial support
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#ifndef __MIPS_JZ4740_SERIAL_H__
17
18void jz4740_serial_out(struct uart_port *p, int offset, int value);
19
20#endif
diff --git a/arch/mips/jz4740/setup.c b/arch/mips/jz4740/setup.c
new file mode 100644
index 000000000000..6a9e14dab91e
--- /dev/null
+++ b/arch/mips/jz4740/setup.c
@@ -0,0 +1,29 @@
1/*
2 * Copyright (C) 2009-2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 setup code
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#include <linux/init.h>
17#include <linux/kernel.h>
18
19#include "reset.h"
20
21void __init plat_mem_setup(void)
22{
23 jz4740_reset_init();
24}
25
26const char *get_system_type(void)
27{
28 return "JZ4740";
29}
diff --git a/arch/mips/jz4740/time.c b/arch/mips/jz4740/time.c
new file mode 100644
index 000000000000..fe01678d94fd
--- /dev/null
+++ b/arch/mips/jz4740/time.c
@@ -0,0 +1,144 @@
1/*
2 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 platform time support
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#include <linux/interrupt.h>
17#include <linux/kernel.h>
18#include <linux/time.h>
19
20#include <linux/clockchips.h>
21
22#include <asm/mach-jz4740/irq.h>
23#include <asm/time.h>
24
25#include "clock.h"
26#include "timer.h"
27
28#define TIMER_CLOCKEVENT 0
29#define TIMER_CLOCKSOURCE 1
30
31static uint16_t jz4740_jiffies_per_tick;
32
33static cycle_t jz4740_clocksource_read(struct clocksource *cs)
34{
35 return jz4740_timer_get_count(TIMER_CLOCKSOURCE);
36}
37
38static struct clocksource jz4740_clocksource = {
39 .name = "jz4740-timer",
40 .rating = 200,
41 .read = jz4740_clocksource_read,
42 .mask = CLOCKSOURCE_MASK(16),
43 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
44};
45
46static irqreturn_t jz4740_clockevent_irq(int irq, void *devid)
47{
48 struct clock_event_device *cd = devid;
49
50 jz4740_timer_ack_full(TIMER_CLOCKEVENT);
51
52 if (cd->mode != CLOCK_EVT_MODE_PERIODIC)
53 jz4740_timer_disable(TIMER_CLOCKEVENT);
54
55 cd->event_handler(cd);
56
57 return IRQ_HANDLED;
58}
59
60static void jz4740_clockevent_set_mode(enum clock_event_mode mode,
61 struct clock_event_device *cd)
62{
63 switch (mode) {
64 case CLOCK_EVT_MODE_PERIODIC:
65 jz4740_timer_set_count(TIMER_CLOCKEVENT, 0);
66 jz4740_timer_set_period(TIMER_CLOCKEVENT, jz4740_jiffies_per_tick);
67 case CLOCK_EVT_MODE_RESUME:
68 jz4740_timer_irq_full_enable(TIMER_CLOCKEVENT);
69 jz4740_timer_enable(TIMER_CLOCKEVENT);
70 break;
71 case CLOCK_EVT_MODE_ONESHOT:
72 case CLOCK_EVT_MODE_SHUTDOWN:
73 jz4740_timer_disable(TIMER_CLOCKEVENT);
74 break;
75 default:
76 break;
77 }
78}
79
80static int jz4740_clockevent_set_next(unsigned long evt,
81 struct clock_event_device *cd)
82{
83 jz4740_timer_set_count(TIMER_CLOCKEVENT, 0);
84 jz4740_timer_set_period(TIMER_CLOCKEVENT, evt);
85 jz4740_timer_enable(TIMER_CLOCKEVENT);
86
87 return 0;
88}
89
90static struct clock_event_device jz4740_clockevent = {
91 .name = "jz4740-timer",
92 .features = CLOCK_EVT_FEAT_PERIODIC,
93 .set_next_event = jz4740_clockevent_set_next,
94 .set_mode = jz4740_clockevent_set_mode,
95 .rating = 200,
96 .irq = JZ4740_IRQ_TCU0,
97};
98
99static struct irqaction timer_irqaction = {
100 .handler = jz4740_clockevent_irq,
101 .flags = IRQF_PERCPU | IRQF_TIMER,
102 .name = "jz4740-timerirq",
103 .dev_id = &jz4740_clockevent,
104};
105
106void __init plat_time_init(void)
107{
108 int ret;
109 uint32_t clk_rate;
110 uint16_t ctrl;
111
112 jz4740_timer_init();
113
114 clk_rate = jz4740_clock_bdata.ext_rate >> 4;
115 jz4740_jiffies_per_tick = DIV_ROUND_CLOSEST(clk_rate, HZ);
116
117 clockevent_set_clock(&jz4740_clockevent, clk_rate);
118 jz4740_clockevent.min_delta_ns = clockevent_delta2ns(100, &jz4740_clockevent);
119 jz4740_clockevent.max_delta_ns = clockevent_delta2ns(0xffff, &jz4740_clockevent);
120 jz4740_clockevent.cpumask = cpumask_of(0);
121
122 clockevents_register_device(&jz4740_clockevent);
123
124 clocksource_set_clock(&jz4740_clocksource, clk_rate);
125 ret = clocksource_register(&jz4740_clocksource);
126
127 if (ret)
128 printk(KERN_ERR "Failed to register clocksource: %d\n", ret);
129
130 setup_irq(JZ4740_IRQ_TCU0, &timer_irqaction);
131
132 ctrl = JZ_TIMER_CTRL_PRESCALE_16 | JZ_TIMER_CTRL_SRC_EXT;
133
134 jz4740_timer_set_ctrl(TIMER_CLOCKEVENT, ctrl);
135 jz4740_timer_set_ctrl(TIMER_CLOCKSOURCE, ctrl);
136
137 jz4740_timer_set_period(TIMER_CLOCKEVENT, jz4740_jiffies_per_tick);
138 jz4740_timer_irq_full_enable(TIMER_CLOCKEVENT);
139
140 jz4740_timer_set_period(TIMER_CLOCKSOURCE, 0xffff);
141
142 jz4740_timer_enable(TIMER_CLOCKEVENT);
143 jz4740_timer_enable(TIMER_CLOCKSOURCE);
144}
diff --git a/arch/mips/jz4740/timer.c b/arch/mips/jz4740/timer.c
new file mode 100644
index 000000000000..b2c015129055
--- /dev/null
+++ b/arch/mips/jz4740/timer.c
@@ -0,0 +1,48 @@
1/*
2 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 platform timer support
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#include <linux/io.h>
17#include <linux/kernel.h>
18#include <linux/module.h>
19
20#include "timer.h"
21
22#include <asm/mach-jz4740/base.h>
23
24void __iomem *jz4740_timer_base;
25
26void jz4740_timer_enable_watchdog(void)
27{
28 writel(BIT(16), jz4740_timer_base + JZ_REG_TIMER_STOP_CLEAR);
29}
30
31void jz4740_timer_disable_watchdog(void)
32{
33 writel(BIT(16), jz4740_timer_base + JZ_REG_TIMER_STOP_SET);
34}
35
36void __init jz4740_timer_init(void)
37{
38 jz4740_timer_base = ioremap(JZ4740_TCU_BASE_ADDR, 0x100);
39
40 if (!jz4740_timer_base)
41 panic("Failed to ioremap timer registers");
42
43 /* Disable all timer clocks except for those used as system timers */
44 writel(0x000100fc, jz4740_timer_base + JZ_REG_TIMER_STOP_SET);
45
46 /* Timer irqs are unmasked by default, mask them */
47 writel(0x00ff00ff, jz4740_timer_base + JZ_REG_TIMER_MASK_SET);
48}
diff --git a/arch/mips/jz4740/timer.h b/arch/mips/jz4740/timer.h
new file mode 100644
index 000000000000..fca3994f2e6d
--- /dev/null
+++ b/arch/mips/jz4740/timer.h
@@ -0,0 +1,136 @@
1/*
2 * Copyright (C) 2010, Lars-Peter Clausen <lars@metafoo.de>
3 * JZ4740 platform timer support
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version.
9 *
10 * You should have received a copy of the GNU General Public License along
11 * with this program; if not, write to the Free Software Foundation, Inc.,
12 * 675 Mass Ave, Cambridge, MA 02139, USA.
13 *
14 */
15
16#ifndef __MIPS_JZ4740_TIMER_H__
17#define __MIPS_JZ4740_TIMER_H__
18
19#include <linux/module.h>
20#include <linux/io.h>
21
22#define JZ_REG_TIMER_STOP 0x0C
23#define JZ_REG_TIMER_STOP_SET 0x1C
24#define JZ_REG_TIMER_STOP_CLEAR 0x2C
25#define JZ_REG_TIMER_ENABLE 0x00
26#define JZ_REG_TIMER_ENABLE_SET 0x04
27#define JZ_REG_TIMER_ENABLE_CLEAR 0x08
28#define JZ_REG_TIMER_FLAG 0x10
29#define JZ_REG_TIMER_FLAG_SET 0x14
30#define JZ_REG_TIMER_FLAG_CLEAR 0x18
31#define JZ_REG_TIMER_MASK 0x20
32#define JZ_REG_TIMER_MASK_SET 0x24
33#define JZ_REG_TIMER_MASK_CLEAR 0x28
34
35#define JZ_REG_TIMER_DFR(x) (((x) * 0x10) + 0x30)
36#define JZ_REG_TIMER_DHR(x) (((x) * 0x10) + 0x34)
37#define JZ_REG_TIMER_CNT(x) (((x) * 0x10) + 0x38)
38#define JZ_REG_TIMER_CTRL(x) (((x) * 0x10) + 0x3C)
39
40#define JZ_TIMER_IRQ_HALF(x) BIT((x) + 0x10)
41#define JZ_TIMER_IRQ_FULL(x) BIT(x)
42
43#define JZ_TIMER_CTRL_PWM_ABBRUPT_SHUTDOWN BIT(9)
44#define JZ_TIMER_CTRL_PWM_ACTIVE_LOW BIT(8)
45#define JZ_TIMER_CTRL_PWM_ENABLE BIT(7)
46#define JZ_TIMER_CTRL_PRESCALE_MASK 0x1c
47#define JZ_TIMER_CTRL_PRESCALE_OFFSET 0x3
48#define JZ_TIMER_CTRL_PRESCALE_1 (0 << 3)
49#define JZ_TIMER_CTRL_PRESCALE_4 (1 << 3)
50#define JZ_TIMER_CTRL_PRESCALE_16 (2 << 3)
51#define JZ_TIMER_CTRL_PRESCALE_64 (3 << 3)
52#define JZ_TIMER_CTRL_PRESCALE_256 (4 << 3)
53#define JZ_TIMER_CTRL_PRESCALE_1024 (5 << 3)
54
55#define JZ_TIMER_CTRL_PRESCALER(x) ((x) << JZ_TIMER_CTRL_PRESCALE_OFFSET)
56
57#define JZ_TIMER_CTRL_SRC_EXT BIT(2)
58#define JZ_TIMER_CTRL_SRC_RTC BIT(1)
59#define JZ_TIMER_CTRL_SRC_PCLK BIT(0)
60
61extern void __iomem *jz4740_timer_base;
62void __init jz4740_timer_init(void);
63
64static inline void jz4740_timer_stop(unsigned int timer)
65{
66 writel(BIT(timer), jz4740_timer_base + JZ_REG_TIMER_STOP_SET);
67}
68
69static inline void jz4740_timer_start(unsigned int timer)
70{
71 writel(BIT(timer), jz4740_timer_base + JZ_REG_TIMER_STOP_CLEAR);
72}
73
74static inline bool jz4740_timer_is_enabled(unsigned int timer)
75{
76 return readb(jz4740_timer_base + JZ_REG_TIMER_ENABLE) & BIT(timer);
77}
78
79static inline void jz4740_timer_enable(unsigned int timer)
80{
81 writeb(BIT(timer), jz4740_timer_base + JZ_REG_TIMER_ENABLE_SET);
82}
83
84static inline void jz4740_timer_disable(unsigned int timer)
85{
86 writeb(BIT(timer), jz4740_timer_base + JZ_REG_TIMER_ENABLE_CLEAR);
87}
88
89
90static inline void jz4740_timer_set_period(unsigned int timer, uint16_t period)
91{
92 writew(period, jz4740_timer_base + JZ_REG_TIMER_DFR(timer));
93}
94
95static inline void jz4740_timer_set_duty(unsigned int timer, uint16_t duty)
96{
97 writew(duty, jz4740_timer_base + JZ_REG_TIMER_DHR(timer));
98}
99
100static inline void jz4740_timer_set_count(unsigned int timer, uint16_t count)
101{
102 writew(count, jz4740_timer_base + JZ_REG_TIMER_CNT(timer));
103}
104
105static inline uint16_t jz4740_timer_get_count(unsigned int timer)
106{
107 return readw(jz4740_timer_base + JZ_REG_TIMER_CNT(timer));
108}
109
110static inline void jz4740_timer_ack_full(unsigned int timer)
111{
112 writel(JZ_TIMER_IRQ_FULL(timer), jz4740_timer_base + JZ_REG_TIMER_FLAG_CLEAR);
113}
114
115static inline void jz4740_timer_irq_full_enable(unsigned int timer)
116{
117 writel(JZ_TIMER_IRQ_FULL(timer), jz4740_timer_base + JZ_REG_TIMER_FLAG_CLEAR);
118 writel(JZ_TIMER_IRQ_FULL(timer), jz4740_timer_base + JZ_REG_TIMER_MASK_CLEAR);
119}
120
121static inline void jz4740_timer_irq_full_disable(unsigned int timer)
122{
123 writel(JZ_TIMER_IRQ_FULL(timer), jz4740_timer_base + JZ_REG_TIMER_MASK_SET);
124}
125
126static inline void jz4740_timer_set_ctrl(unsigned int timer, uint16_t ctrl)
127{
128 writew(ctrl, jz4740_timer_base + JZ_REG_TIMER_CTRL(timer));
129}
130
131static inline uint16_t jz4740_timer_get_ctrl(unsigned int timer)
132{
133 return readw(jz4740_timer_base + JZ_REG_TIMER_CTRL(timer));
134}
135
136#endif
diff --git a/arch/mips/kernel/Makefile b/arch/mips/kernel/Makefile
index 7a6ac501cbb5..06f848299785 100644
--- a/arch/mips/kernel/Makefile
+++ b/arch/mips/kernel/Makefile
@@ -76,6 +76,7 @@ obj-$(CONFIG_IRQ_TXX9) += irq_txx9.o
76obj-$(CONFIG_IRQ_GT641XX) += irq-gt641xx.o 76obj-$(CONFIG_IRQ_GT641XX) += irq-gt641xx.o
77obj-$(CONFIG_IRQ_GIC) += irq-gic.o 77obj-$(CONFIG_IRQ_GIC) += irq-gic.o
78 78
79obj-$(CONFIG_KPROBES) += kprobes.o
79obj-$(CONFIG_32BIT) += scall32-o32.o 80obj-$(CONFIG_32BIT) += scall32-o32.o
80obj-$(CONFIG_64BIT) += scall64-64.o 81obj-$(CONFIG_64BIT) += scall64-64.o
81obj-$(CONFIG_MIPS32_COMPAT) += linux32.o ptrace32.o signal32.o 82obj-$(CONFIG_MIPS32_COMPAT) += linux32.o ptrace32.o signal32.o
@@ -101,6 +102,4 @@ obj-$(CONFIG_HAVE_STD_PC_SERIAL_PORT) += 8250-platform.o
101 102
102obj-$(CONFIG_MIPS_CPUFREQ) += cpufreq/ 103obj-$(CONFIG_MIPS_CPUFREQ) += cpufreq/
103 104
104EXTRA_CFLAGS += -Werror
105
106CPPFLAGS_vmlinux.lds := $(KBUILD_CFLAGS) 105CPPFLAGS_vmlinux.lds := $(KBUILD_CFLAGS)
diff --git a/arch/mips/kernel/asm-offsets.c b/arch/mips/kernel/asm-offsets.c
index ca6c83218caa..6b30fb2caa67 100644
--- a/arch/mips/kernel/asm-offsets.c
+++ b/arch/mips/kernel/asm-offsets.c
@@ -126,7 +126,6 @@ void output_thread_defines(void)
126 thread.cp0_baduaddr); 126 thread.cp0_baduaddr);
127 OFFSET(THREAD_ECODE, task_struct, \ 127 OFFSET(THREAD_ECODE, task_struct, \
128 thread.error_code); 128 thread.error_code);
129 OFFSET(THREAD_TRAPNO, task_struct, thread.trap_no);
130 OFFSET(THREAD_TRAMP, task_struct, \ 129 OFFSET(THREAD_TRAMP, task_struct, \
131 thread.irix_trampoline); 130 thread.irix_trampoline);
132 OFFSET(THREAD_OLDCTX, task_struct, \ 131 OFFSET(THREAD_OLDCTX, task_struct, \
diff --git a/arch/mips/kernel/cevt-r4k.c b/arch/mips/kernel/cevt-r4k.c
index 0b2450ceb13f..2a4d50ff5e2c 100644
--- a/arch/mips/kernel/cevt-r4k.c
+++ b/arch/mips/kernel/cevt-r4k.c
@@ -163,7 +163,6 @@ int c0_compare_int_usable(void)
163 163
164int __cpuinit r4k_clockevent_init(void) 164int __cpuinit r4k_clockevent_init(void)
165{ 165{
166 uint64_t mips_freq = mips_hpt_frequency;
167 unsigned int cpu = smp_processor_id(); 166 unsigned int cpu = smp_processor_id();
168 struct clock_event_device *cd; 167 struct clock_event_device *cd;
169 unsigned int irq; 168 unsigned int irq;
@@ -188,9 +187,9 @@ int __cpuinit r4k_clockevent_init(void)
188 cd->name = "MIPS"; 187 cd->name = "MIPS";
189 cd->features = CLOCK_EVT_FEAT_ONESHOT; 188 cd->features = CLOCK_EVT_FEAT_ONESHOT;
190 189
190 clockevent_set_clock(cd, mips_hpt_frequency);
191
191 /* Calculate the min / max delta */ 192 /* Calculate the min / max delta */
192 cd->mult = div_sc((unsigned long) mips_freq, NSEC_PER_SEC, 32);
193 cd->shift = 32;
194 cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd); 193 cd->max_delta_ns = clockevent_delta2ns(0x7fffffff, cd);
195 cd->min_delta_ns = clockevent_delta2ns(0x300, cd); 194 cd->min_delta_ns = clockevent_delta2ns(0x300, cd);
196 195
diff --git a/arch/mips/kernel/cpu-bugs64.c b/arch/mips/kernel/cpu-bugs64.c
index 408d0a07b3a3..b8bb8ba60869 100644
--- a/arch/mips/kernel/cpu-bugs64.c
+++ b/arch/mips/kernel/cpu-bugs64.c
@@ -239,7 +239,7 @@ static inline void check_daddi(void)
239 panic(bug64hit, !DADDI_WAR ? daddiwar : nowar); 239 panic(bug64hit, !DADDI_WAR ? daddiwar : nowar);
240} 240}
241 241
242int daddiu_bug __cpuinitdata = -1; 242int daddiu_bug = -1;
243 243
244static inline void check_daddiu(void) 244static inline void check_daddiu(void)
245{ 245{
diff --git a/arch/mips/kernel/cpu-probe.c b/arch/mips/kernel/cpu-probe.c
index 3562b854f2cd..b1b304ea2128 100644
--- a/arch/mips/kernel/cpu-probe.c
+++ b/arch/mips/kernel/cpu-probe.c
@@ -187,6 +187,7 @@ void __init check_wait(void)
187 case CPU_BCM6358: 187 case CPU_BCM6358:
188 case CPU_CAVIUM_OCTEON: 188 case CPU_CAVIUM_OCTEON:
189 case CPU_CAVIUM_OCTEON_PLUS: 189 case CPU_CAVIUM_OCTEON_PLUS:
190 case CPU_JZRISC:
190 cpu_wait = r4k_wait; 191 cpu_wait = r4k_wait;
191 break; 192 break;
192 193
@@ -760,6 +761,9 @@ static void __cpuinit decode_configs(struct cpuinfo_mips *c)
760 ok = decode_config4(c); 761 ok = decode_config4(c);
761 762
762 mips_probe_watch_registers(c); 763 mips_probe_watch_registers(c);
764
765 if (cpu_has_mips_r2)
766 c->core = read_c0_ebase() & 0x3ff;
763} 767}
764 768
765static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu) 769static inline void cpu_probe_mips(struct cpuinfo_mips *c, unsigned int cpu)
@@ -956,6 +960,22 @@ platform:
956 } 960 }
957} 961}
958 962
963static inline void cpu_probe_ingenic(struct cpuinfo_mips *c, unsigned int cpu)
964{
965 decode_configs(c);
966 /* JZRISC does not implement the CP0 counter. */
967 c->options &= ~MIPS_CPU_COUNTER;
968 switch (c->processor_id & 0xff00) {
969 case PRID_IMP_JZRISC:
970 c->cputype = CPU_JZRISC;
971 __cpu_name[cpu] = "Ingenic JZRISC";
972 break;
973 default:
974 panic("Unknown Ingenic Processor ID!");
975 break;
976 }
977}
978
959const char *__cpu_name[NR_CPUS]; 979const char *__cpu_name[NR_CPUS];
960const char *__elf_platform; 980const char *__elf_platform;
961 981
@@ -994,6 +1014,9 @@ __cpuinit void cpu_probe(void)
994 case PRID_COMP_CAVIUM: 1014 case PRID_COMP_CAVIUM:
995 cpu_probe_cavium(c, cpu); 1015 cpu_probe_cavium(c, cpu);
996 break; 1016 break;
1017 case PRID_COMP_INGENIC:
1018 cpu_probe_ingenic(c, cpu);
1019 break;
997 } 1020 }
998 1021
999 BUG_ON(!__cpu_name[cpu]); 1022 BUG_ON(!__cpu_name[cpu]);
diff --git a/arch/mips/kernel/kgdb.c b/arch/mips/kernel/kgdb.c
index 9b78ff6e9b84..1f4e2fa64140 100644
--- a/arch/mips/kernel/kgdb.c
+++ b/arch/mips/kernel/kgdb.c
@@ -50,6 +50,151 @@ static struct hard_trap_info {
50 { 0, 0} /* Must be last */ 50 { 0, 0} /* Must be last */
51}; 51};
52 52
53struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] =
54{
55 { "zero", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[0]) },
56 { "at", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[1]) },
57 { "v0", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[2]) },
58 { "v1", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[3]) },
59 { "a0", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[4]) },
60 { "a1", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[5]) },
61 { "a2", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[6]) },
62 { "a3", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[7]) },
63 { "t0", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[8]) },
64 { "t1", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[9]) },
65 { "t2", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[10]) },
66 { "t3", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[11]) },
67 { "t4", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[12]) },
68 { "t5", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[13]) },
69 { "t6", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[14]) },
70 { "t7", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[15]) },
71 { "s0", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[16]) },
72 { "s1", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[17]) },
73 { "s2", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[18]) },
74 { "s3", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[19]) },
75 { "s4", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[20]) },
76 { "s5", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[21]) },
77 { "s6", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[22]) },
78 { "s7", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[23]) },
79 { "t8", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[24]) },
80 { "t9", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[25]) },
81 { "k0", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[26]) },
82 { "k1", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[27]) },
83 { "gp", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[28]) },
84 { "sp", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[29]) },
85 { "s8", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[30]) },
86 { "ra", GDB_SIZEOF_REG, offsetof(struct pt_regs, regs[31]) },
87 { "sr", GDB_SIZEOF_REG, offsetof(struct pt_regs, cp0_status) },
88 { "lo", GDB_SIZEOF_REG, offsetof(struct pt_regs, lo) },
89 { "hi", GDB_SIZEOF_REG, offsetof(struct pt_regs, hi) },
90 { "bad", GDB_SIZEOF_REG, offsetof(struct pt_regs, cp0_badvaddr) },
91 { "cause", GDB_SIZEOF_REG, offsetof(struct pt_regs, cp0_cause) },
92 { "pc", GDB_SIZEOF_REG, offsetof(struct pt_regs, cp0_epc) },
93 { "f0", GDB_SIZEOF_REG, 0 },
94 { "f1", GDB_SIZEOF_REG, 1 },
95 { "f2", GDB_SIZEOF_REG, 2 },
96 { "f3", GDB_SIZEOF_REG, 3 },
97 { "f4", GDB_SIZEOF_REG, 4 },
98 { "f5", GDB_SIZEOF_REG, 5 },
99 { "f6", GDB_SIZEOF_REG, 6 },
100 { "f7", GDB_SIZEOF_REG, 7 },
101 { "f8", GDB_SIZEOF_REG, 8 },
102 { "f9", GDB_SIZEOF_REG, 9 },
103 { "f10", GDB_SIZEOF_REG, 10 },
104 { "f11", GDB_SIZEOF_REG, 11 },
105 { "f12", GDB_SIZEOF_REG, 12 },
106 { "f13", GDB_SIZEOF_REG, 13 },
107 { "f14", GDB_SIZEOF_REG, 14 },
108 { "f15", GDB_SIZEOF_REG, 15 },
109 { "f16", GDB_SIZEOF_REG, 16 },
110 { "f17", GDB_SIZEOF_REG, 17 },
111 { "f18", GDB_SIZEOF_REG, 18 },
112 { "f19", GDB_SIZEOF_REG, 19 },
113 { "f20", GDB_SIZEOF_REG, 20 },
114 { "f21", GDB_SIZEOF_REG, 21 },
115 { "f22", GDB_SIZEOF_REG, 22 },
116 { "f23", GDB_SIZEOF_REG, 23 },
117 { "f24", GDB_SIZEOF_REG, 24 },
118 { "f25", GDB_SIZEOF_REG, 25 },
119 { "f26", GDB_SIZEOF_REG, 26 },
120 { "f27", GDB_SIZEOF_REG, 27 },
121 { "f28", GDB_SIZEOF_REG, 28 },
122 { "f29", GDB_SIZEOF_REG, 29 },
123 { "f30", GDB_SIZEOF_REG, 30 },
124 { "f31", GDB_SIZEOF_REG, 31 },
125 { "fsr", GDB_SIZEOF_REG, 0 },
126 { "fir", GDB_SIZEOF_REG, 0 },
127};
128
129int dbg_set_reg(int regno, void *mem, struct pt_regs *regs)
130{
131 int fp_reg;
132
133 if (regno < 0 || regno >= DBG_MAX_REG_NUM)
134 return -EINVAL;
135
136 if (dbg_reg_def[regno].offset != -1 && regno < 38) {
137 memcpy((void *)regs + dbg_reg_def[regno].offset, mem,
138 dbg_reg_def[regno].size);
139 } else if (current && dbg_reg_def[regno].offset != -1 && regno < 72) {
140 /* FP registers 38 -> 69 */
141 if (!(regs->cp0_status & ST0_CU1))
142 return 0;
143 if (regno == 70) {
144 /* Process the fcr31/fsr (register 70) */
145 memcpy((void *)&current->thread.fpu.fcr31, mem,
146 dbg_reg_def[regno].size);
147 goto out_save;
148 } else if (regno == 71) {
149 /* Ignore the fir (register 71) */
150 goto out_save;
151 }
152 fp_reg = dbg_reg_def[regno].offset;
153 memcpy((void *)&current->thread.fpu.fpr[fp_reg], mem,
154 dbg_reg_def[regno].size);
155out_save:
156 restore_fp(current);
157 }
158
159 return 0;
160}
161
162char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs)
163{
164 int fp_reg;
165
166 if (regno >= DBG_MAX_REG_NUM || regno < 0)
167 return NULL;
168
169 if (dbg_reg_def[regno].offset != -1 && regno < 38) {
170 /* First 38 registers */
171 memcpy(mem, (void *)regs + dbg_reg_def[regno].offset,
172 dbg_reg_def[regno].size);
173 } else if (current && dbg_reg_def[regno].offset != -1 && regno < 72) {
174 /* FP registers 38 -> 69 */
175 if (!(regs->cp0_status & ST0_CU1))
176 goto out;
177 save_fp(current);
178 if (regno == 70) {
179 /* Process the fcr31/fsr (register 70) */
180 memcpy(mem, (void *)&current->thread.fpu.fcr31,
181 dbg_reg_def[regno].size);
182 goto out;
183 } else if (regno == 71) {
184 /* Ignore the fir (register 71) */
185 memset(mem, 0, dbg_reg_def[regno].size);
186 goto out;
187 }
188 fp_reg = dbg_reg_def[regno].offset;
189 memcpy(mem, (void *)&current->thread.fpu.fpr[fp_reg],
190 dbg_reg_def[regno].size);
191 }
192
193out:
194 return dbg_reg_def[regno].name;
195
196}
197
53void arch_kgdb_breakpoint(void) 198void arch_kgdb_breakpoint(void)
54{ 199{
55 __asm__ __volatile__( 200 __asm__ __volatile__(
@@ -84,64 +229,6 @@ static int compute_signal(int tt)
84 return SIGHUP; /* default for things we don't know about */ 229 return SIGHUP; /* default for things we don't know about */
85} 230}
86 231
87void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
88{
89 int reg;
90
91#if (KGDB_GDB_REG_SIZE == 32)
92 u32 *ptr = (u32 *)gdb_regs;
93#else
94 u64 *ptr = (u64 *)gdb_regs;
95#endif
96
97 for (reg = 0; reg < 32; reg++)
98 *(ptr++) = regs->regs[reg];
99
100 *(ptr++) = regs->cp0_status;
101 *(ptr++) = regs->lo;
102 *(ptr++) = regs->hi;
103 *(ptr++) = regs->cp0_badvaddr;
104 *(ptr++) = regs->cp0_cause;
105 *(ptr++) = regs->cp0_epc;
106
107 /* FP REGS */
108 if (!(current && (regs->cp0_status & ST0_CU1)))
109 return;
110
111 save_fp(current);
112 for (reg = 0; reg < 32; reg++)
113 *(ptr++) = current->thread.fpu.fpr[reg];
114}
115
116void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
117{
118 int reg;
119
120#if (KGDB_GDB_REG_SIZE == 32)
121 const u32 *ptr = (u32 *)gdb_regs;
122#else
123 const u64 *ptr = (u64 *)gdb_regs;
124#endif
125
126 for (reg = 0; reg < 32; reg++)
127 regs->regs[reg] = *(ptr++);
128
129 regs->cp0_status = *(ptr++);
130 regs->lo = *(ptr++);
131 regs->hi = *(ptr++);
132 regs->cp0_badvaddr = *(ptr++);
133 regs->cp0_cause = *(ptr++);
134 regs->cp0_epc = *(ptr++);
135
136 /* FP REGS from current */
137 if (!(current && (regs->cp0_status & ST0_CU1)))
138 return;
139
140 for (reg = 0; reg < 32; reg++)
141 current->thread.fpu.fpr[reg] = *(ptr++);
142 restore_fp(current);
143}
144
145/* 232/*
146 * Similar to regs_to_gdb_regs() except that process is sleeping and so 233 * Similar to regs_to_gdb_regs() except that process is sleeping and so
147 * we may not be able to get all the info. 234 * we may not be able to get all the info.
@@ -242,7 +329,7 @@ static struct notifier_block kgdb_notifier = {
242}; 329};
243 330
244/* 331/*
245 * Handle the 's' and 'c' commands 332 * Handle the 'c' command
246 */ 333 */
247int kgdb_arch_handle_exception(int vector, int signo, int err_code, 334int kgdb_arch_handle_exception(int vector, int signo, int err_code,
248 char *remcom_in_buffer, char *remcom_out_buffer, 335 char *remcom_in_buffer, char *remcom_out_buffer,
@@ -250,20 +337,14 @@ int kgdb_arch_handle_exception(int vector, int signo, int err_code,
250{ 337{
251 char *ptr; 338 char *ptr;
252 unsigned long address; 339 unsigned long address;
253 int cpu = smp_processor_id();
254 340
255 switch (remcom_in_buffer[0]) { 341 switch (remcom_in_buffer[0]) {
256 case 's':
257 case 'c': 342 case 'c':
258 /* handle the optional parameter */ 343 /* handle the optional parameter */
259 ptr = &remcom_in_buffer[1]; 344 ptr = &remcom_in_buffer[1];
260 if (kgdb_hex2long(&ptr, &address)) 345 if (kgdb_hex2long(&ptr, &address))
261 regs->cp0_epc = address; 346 regs->cp0_epc = address;
262 347
263 atomic_set(&kgdb_cpu_doing_single_step, -1);
264 if (remcom_in_buffer[0] == 's')
265 atomic_set(&kgdb_cpu_doing_single_step, cpu);
266
267 return 0; 348 return 0;
268 } 349 }
269 350
diff --git a/arch/mips/kernel/kprobes.c b/arch/mips/kernel/kprobes.c
new file mode 100644
index 000000000000..ee28683fc2ac
--- /dev/null
+++ b/arch/mips/kernel/kprobes.c
@@ -0,0 +1,557 @@
1/*
2 * Kernel Probes (KProbes)
3 * arch/mips/kernel/kprobes.c
4 *
5 * Copyright 2006 Sony Corp.
6 * Copyright 2010 Cavium Networks
7 *
8 * Some portions copied from the powerpc version.
9 *
10 * Copyright (C) IBM Corporation, 2002, 2004
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; version 2 of the License.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 */
25
26#include <linux/kprobes.h>
27#include <linux/preempt.h>
28#include <linux/kdebug.h>
29#include <linux/slab.h>
30
31#include <asm/ptrace.h>
32#include <asm/break.h>
33#include <asm/inst.h>
34
35static const union mips_instruction breakpoint_insn = {
36 .b_format = {
37 .opcode = spec_op,
38 .code = BRK_KPROBE_BP,
39 .func = break_op
40 }
41};
42
43static const union mips_instruction breakpoint2_insn = {
44 .b_format = {
45 .opcode = spec_op,
46 .code = BRK_KPROBE_SSTEPBP,
47 .func = break_op
48 }
49};
50
51DEFINE_PER_CPU(struct kprobe *, current_kprobe);
52DEFINE_PER_CPU(struct kprobe_ctlblk, kprobe_ctlblk);
53
54static int __kprobes insn_has_delayslot(union mips_instruction insn)
55{
56 switch (insn.i_format.opcode) {
57
58 /*
59 * This group contains:
60 * jr and jalr are in r_format format.
61 */
62 case spec_op:
63 switch (insn.r_format.func) {
64 case jr_op:
65 case jalr_op:
66 break;
67 default:
68 goto insn_ok;
69 }
70
71 /*
72 * This group contains:
73 * bltz_op, bgez_op, bltzl_op, bgezl_op,
74 * bltzal_op, bgezal_op, bltzall_op, bgezall_op.
75 */
76 case bcond_op:
77
78 /*
79 * These are unconditional and in j_format.
80 */
81 case jal_op:
82 case j_op:
83
84 /*
85 * These are conditional and in i_format.
86 */
87 case beq_op:
88 case beql_op:
89 case bne_op:
90 case bnel_op:
91 case blez_op:
92 case blezl_op:
93 case bgtz_op:
94 case bgtzl_op:
95
96 /*
97 * These are the FPA/cp1 branch instructions.
98 */
99 case cop1_op:
100
101#ifdef CONFIG_CPU_CAVIUM_OCTEON
102 case lwc2_op: /* This is bbit0 on Octeon */
103 case ldc2_op: /* This is bbit032 on Octeon */
104 case swc2_op: /* This is bbit1 on Octeon */
105 case sdc2_op: /* This is bbit132 on Octeon */
106#endif
107 return 1;
108 default:
109 break;
110 }
111insn_ok:
112 return 0;
113}
114
115int __kprobes arch_prepare_kprobe(struct kprobe *p)
116{
117 union mips_instruction insn;
118 union mips_instruction prev_insn;
119 int ret = 0;
120
121 prev_insn = p->addr[-1];
122 insn = p->addr[0];
123
124 if (insn_has_delayslot(insn) || insn_has_delayslot(prev_insn)) {
125 pr_notice("Kprobes for branch and jump instructions are not supported\n");
126 ret = -EINVAL;
127 goto out;
128 }
129
130 /* insn: must be on special executable page on mips. */
131 p->ainsn.insn = get_insn_slot();
132 if (!p->ainsn.insn) {
133 ret = -ENOMEM;
134 goto out;
135 }
136
137 /*
138 * In the kprobe->ainsn.insn[] array we store the original
139 * instruction at index zero and a break trap instruction at
140 * index one.
141 */
142
143 memcpy(&p->ainsn.insn[0], p->addr, sizeof(kprobe_opcode_t));
144 p->ainsn.insn[1] = breakpoint2_insn;
145 p->opcode = *p->addr;
146
147out:
148 return ret;
149}
150
151void __kprobes arch_arm_kprobe(struct kprobe *p)
152{
153 *p->addr = breakpoint_insn;
154 flush_insn_slot(p);
155}
156
157void __kprobes arch_disarm_kprobe(struct kprobe *p)
158{
159 *p->addr = p->opcode;
160 flush_insn_slot(p);
161}
162
163void __kprobes arch_remove_kprobe(struct kprobe *p)
164{
165 free_insn_slot(p->ainsn.insn, 0);
166}
167
168static void save_previous_kprobe(struct kprobe_ctlblk *kcb)
169{
170 kcb->prev_kprobe.kp = kprobe_running();
171 kcb->prev_kprobe.status = kcb->kprobe_status;
172 kcb->prev_kprobe.old_SR = kcb->kprobe_old_SR;
173 kcb->prev_kprobe.saved_SR = kcb->kprobe_saved_SR;
174 kcb->prev_kprobe.saved_epc = kcb->kprobe_saved_epc;
175}
176
177static void restore_previous_kprobe(struct kprobe_ctlblk *kcb)
178{
179 __get_cpu_var(current_kprobe) = kcb->prev_kprobe.kp;
180 kcb->kprobe_status = kcb->prev_kprobe.status;
181 kcb->kprobe_old_SR = kcb->prev_kprobe.old_SR;
182 kcb->kprobe_saved_SR = kcb->prev_kprobe.saved_SR;
183 kcb->kprobe_saved_epc = kcb->prev_kprobe.saved_epc;
184}
185
186static void set_current_kprobe(struct kprobe *p, struct pt_regs *regs,
187 struct kprobe_ctlblk *kcb)
188{
189 __get_cpu_var(current_kprobe) = p;
190 kcb->kprobe_saved_SR = kcb->kprobe_old_SR = (regs->cp0_status & ST0_IE);
191 kcb->kprobe_saved_epc = regs->cp0_epc;
192}
193
194static void prepare_singlestep(struct kprobe *p, struct pt_regs *regs)
195{
196 regs->cp0_status &= ~ST0_IE;
197
198 /* single step inline if the instruction is a break */
199 if (p->opcode.word == breakpoint_insn.word ||
200 p->opcode.word == breakpoint2_insn.word)
201 regs->cp0_epc = (unsigned long)p->addr;
202 else
203 regs->cp0_epc = (unsigned long)&p->ainsn.insn[0];
204}
205
206static int __kprobes kprobe_handler(struct pt_regs *regs)
207{
208 struct kprobe *p;
209 int ret = 0;
210 kprobe_opcode_t *addr;
211 struct kprobe_ctlblk *kcb;
212
213 addr = (kprobe_opcode_t *) regs->cp0_epc;
214
215 /*
216 * We don't want to be preempted for the entire
217 * duration of kprobe processing
218 */
219 preempt_disable();
220 kcb = get_kprobe_ctlblk();
221
222 /* Check we're not actually recursing */
223 if (kprobe_running()) {
224 p = get_kprobe(addr);
225 if (p) {
226 if (kcb->kprobe_status == KPROBE_HIT_SS &&
227 p->ainsn.insn->word == breakpoint_insn.word) {
228 regs->cp0_status &= ~ST0_IE;
229 regs->cp0_status |= kcb->kprobe_saved_SR;
230 goto no_kprobe;
231 }
232 /*
233 * We have reentered the kprobe_handler(), since
234 * another probe was hit while within the handler.
235 * We here save the original kprobes variables and
236 * just single step on the instruction of the new probe
237 * without calling any user handlers.
238 */
239 save_previous_kprobe(kcb);
240 set_current_kprobe(p, regs, kcb);
241 kprobes_inc_nmissed_count(p);
242 prepare_singlestep(p, regs);
243 kcb->kprobe_status = KPROBE_REENTER;
244 return 1;
245 } else {
246 if (addr->word != breakpoint_insn.word) {
247 /*
248 * The breakpoint instruction was removed by
249 * another cpu right after we hit, no further
250 * handling of this interrupt is appropriate
251 */
252 ret = 1;
253 goto no_kprobe;
254 }
255 p = __get_cpu_var(current_kprobe);
256 if (p->break_handler && p->break_handler(p, regs))
257 goto ss_probe;
258 }
259 goto no_kprobe;
260 }
261
262 p = get_kprobe(addr);
263 if (!p) {
264 if (addr->word != breakpoint_insn.word) {
265 /*
266 * The breakpoint instruction was removed right
267 * after we hit it. Another cpu has removed
268 * either a probepoint or a debugger breakpoint
269 * at this address. In either case, no further
270 * handling of this interrupt is appropriate.
271 */
272 ret = 1;
273 }
274 /* Not one of ours: let kernel handle it */
275 goto no_kprobe;
276 }
277
278 set_current_kprobe(p, regs, kcb);
279 kcb->kprobe_status = KPROBE_HIT_ACTIVE;
280
281 if (p->pre_handler && p->pre_handler(p, regs)) {
282 /* handler has already set things up, so skip ss setup */
283 return 1;
284 }
285
286ss_probe:
287 prepare_singlestep(p, regs);
288 kcb->kprobe_status = KPROBE_HIT_SS;
289 return 1;
290
291no_kprobe:
292 preempt_enable_no_resched();
293 return ret;
294
295}
296
297/*
298 * Called after single-stepping. p->addr is the address of the
299 * instruction whose first byte has been replaced by the "break 0"
300 * instruction. To avoid the SMP problems that can occur when we
301 * temporarily put back the original opcode to single-step, we
302 * single-stepped a copy of the instruction. The address of this
303 * copy is p->ainsn.insn.
304 *
305 * This function prepares to return from the post-single-step
306 * breakpoint trap.
307 */
308static void __kprobes resume_execution(struct kprobe *p,
309 struct pt_regs *regs,
310 struct kprobe_ctlblk *kcb)
311{
312 unsigned long orig_epc = kcb->kprobe_saved_epc;
313 regs->cp0_epc = orig_epc + 4;
314}
315
316static inline int post_kprobe_handler(struct pt_regs *regs)
317{
318 struct kprobe *cur = kprobe_running();
319 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
320
321 if (!cur)
322 return 0;
323
324 if ((kcb->kprobe_status != KPROBE_REENTER) && cur->post_handler) {
325 kcb->kprobe_status = KPROBE_HIT_SSDONE;
326 cur->post_handler(cur, regs, 0);
327 }
328
329 resume_execution(cur, regs, kcb);
330
331 regs->cp0_status |= kcb->kprobe_saved_SR;
332
333 /* Restore back the original saved kprobes variables and continue. */
334 if (kcb->kprobe_status == KPROBE_REENTER) {
335 restore_previous_kprobe(kcb);
336 goto out;
337 }
338 reset_current_kprobe();
339out:
340 preempt_enable_no_resched();
341
342 return 1;
343}
344
345static inline int kprobe_fault_handler(struct pt_regs *regs, int trapnr)
346{
347 struct kprobe *cur = kprobe_running();
348 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
349
350 if (cur->fault_handler && cur->fault_handler(cur, regs, trapnr))
351 return 1;
352
353 if (kcb->kprobe_status & KPROBE_HIT_SS) {
354 resume_execution(cur, regs, kcb);
355 regs->cp0_status |= kcb->kprobe_old_SR;
356
357 reset_current_kprobe();
358 preempt_enable_no_resched();
359 }
360 return 0;
361}
362
363/*
364 * Wrapper routine for handling exceptions.
365 */
366int __kprobes kprobe_exceptions_notify(struct notifier_block *self,
367 unsigned long val, void *data)
368{
369
370 struct die_args *args = (struct die_args *)data;
371 int ret = NOTIFY_DONE;
372
373 switch (val) {
374 case DIE_BREAK:
375 if (kprobe_handler(args->regs))
376 ret = NOTIFY_STOP;
377 break;
378 case DIE_SSTEPBP:
379 if (post_kprobe_handler(args->regs))
380 ret = NOTIFY_STOP;
381 break;
382
383 case DIE_PAGE_FAULT:
384 /* kprobe_running() needs smp_processor_id() */
385 preempt_disable();
386
387 if (kprobe_running()
388 && kprobe_fault_handler(args->regs, args->trapnr))
389 ret = NOTIFY_STOP;
390 preempt_enable();
391 break;
392 default:
393 break;
394 }
395 return ret;
396}
397
398int __kprobes setjmp_pre_handler(struct kprobe *p, struct pt_regs *regs)
399{
400 struct jprobe *jp = container_of(p, struct jprobe, kp);
401 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
402
403 kcb->jprobe_saved_regs = *regs;
404 kcb->jprobe_saved_sp = regs->regs[29];
405
406 memcpy(kcb->jprobes_stack, (void *)kcb->jprobe_saved_sp,
407 MIN_JPROBES_STACK_SIZE(kcb->jprobe_saved_sp));
408
409 regs->cp0_epc = (unsigned long)(jp->entry);
410
411 return 1;
412}
413
414/* Defined in the inline asm below. */
415void jprobe_return_end(void);
416
417void __kprobes jprobe_return(void)
418{
419 /* Assembler quirk necessitates this '0,code' business. */
420 asm volatile(
421 "break 0,%0\n\t"
422 ".globl jprobe_return_end\n"
423 "jprobe_return_end:\n"
424 : : "n" (BRK_KPROBE_BP) : "memory");
425}
426
427int __kprobes longjmp_break_handler(struct kprobe *p, struct pt_regs *regs)
428{
429 struct kprobe_ctlblk *kcb = get_kprobe_ctlblk();
430
431 if (regs->cp0_epc >= (unsigned long)jprobe_return &&
432 regs->cp0_epc <= (unsigned long)jprobe_return_end) {
433 *regs = kcb->jprobe_saved_regs;
434 memcpy((void *)kcb->jprobe_saved_sp, kcb->jprobes_stack,
435 MIN_JPROBES_STACK_SIZE(kcb->jprobe_saved_sp));
436 preempt_enable_no_resched();
437
438 return 1;
439 }
440 return 0;
441}
442
443/*
444 * Function return probe trampoline:
445 * - init_kprobes() establishes a probepoint here
446 * - When the probed function returns, this probe causes the
447 * handlers to fire
448 */
449static void __used kretprobe_trampoline_holder(void)
450{
451 asm volatile(
452 ".set push\n\t"
453 /* Keep the assembler from reordering and placing JR here. */
454 ".set noreorder\n\t"
455 "nop\n\t"
456 ".global kretprobe_trampoline\n"
457 "kretprobe_trampoline:\n\t"
458 "nop\n\t"
459 ".set pop"
460 : : : "memory");
461}
462
463void kretprobe_trampoline(void);
464
465void __kprobes arch_prepare_kretprobe(struct kretprobe_instance *ri,
466 struct pt_regs *regs)
467{
468 ri->ret_addr = (kprobe_opcode_t *) regs->regs[31];
469
470 /* Replace the return addr with trampoline addr */
471 regs->regs[31] = (unsigned long)kretprobe_trampoline;
472}
473
474/*
475 * Called when the probe at kretprobe trampoline is hit
476 */
477static int __kprobes trampoline_probe_handler(struct kprobe *p,
478 struct pt_regs *regs)
479{
480 struct kretprobe_instance *ri = NULL;
481 struct hlist_head *head, empty_rp;
482 struct hlist_node *node, *tmp;
483 unsigned long flags, orig_ret_address = 0;
484 unsigned long trampoline_address = (unsigned long)kretprobe_trampoline;
485
486 INIT_HLIST_HEAD(&empty_rp);
487 kretprobe_hash_lock(current, &head, &flags);
488
489 /*
490 * It is possible to have multiple instances associated with a given
491 * task either because an multiple functions in the call path
492 * have a return probe installed on them, and/or more than one return
493 * return probe was registered for a target function.
494 *
495 * We can handle this because:
496 * - instances are always inserted at the head of the list
497 * - when multiple return probes are registered for the same
498 * function, the first instance's ret_addr will point to the
499 * real return address, and all the rest will point to
500 * kretprobe_trampoline
501 */
502 hlist_for_each_entry_safe(ri, node, tmp, head, hlist) {
503 if (ri->task != current)
504 /* another task is sharing our hash bucket */
505 continue;
506
507 if (ri->rp && ri->rp->handler)
508 ri->rp->handler(ri, regs);
509
510 orig_ret_address = (unsigned long)ri->ret_addr;
511 recycle_rp_inst(ri, &empty_rp);
512
513 if (orig_ret_address != trampoline_address)
514 /*
515 * This is the real return address. Any other
516 * instances associated with this task are for
517 * other calls deeper on the call stack
518 */
519 break;
520 }
521
522 kretprobe_assert(ri, orig_ret_address, trampoline_address);
523 instruction_pointer(regs) = orig_ret_address;
524
525 reset_current_kprobe();
526 kretprobe_hash_unlock(current, &flags);
527 preempt_enable_no_resched();
528
529 hlist_for_each_entry_safe(ri, node, tmp, &empty_rp, hlist) {
530 hlist_del(&ri->hlist);
531 kfree(ri);
532 }
533 /*
534 * By returning a non-zero value, we are telling
535 * kprobe_handler() that we don't want the post_handler
536 * to run (and have re-enabled preemption)
537 */
538 return 1;
539}
540
541int __kprobes arch_trampoline_kprobe(struct kprobe *p)
542{
543 if (p->addr == (kprobe_opcode_t *)kretprobe_trampoline)
544 return 1;
545
546 return 0;
547}
548
549static struct kprobe trampoline_p = {
550 .addr = (kprobe_opcode_t *)kretprobe_trampoline,
551 .pre_handler = trampoline_probe_handler
552};
553
554int __init arch_init_kprobes(void)
555{
556 return register_kprobe(&trampoline_p);
557}
diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S
index 6bfcb7a00ec6..4c968e7efb74 100644
--- a/arch/mips/kernel/mcount.S
+++ b/arch/mips/kernel/mcount.S
@@ -165,12 +165,12 @@ NESTED(ftrace_graph_caller, PT_SIZE, ra)
165 165
166 /* arg3: Get frame pointer of current stack */ 166 /* arg3: Get frame pointer of current stack */
167#ifdef CONFIG_FRAME_POINTER 167#ifdef CONFIG_FRAME_POINTER
168 move a2, fp 168 move a2, fp
169#else /* ! CONFIG_FRAME_POINTER */ 169#else /* ! CONFIG_FRAME_POINTER */
170#ifdef CONFIG_64BIT 170#ifdef CONFIG_64BIT
171 PTR_LA a2, PT_SIZE(sp) 171 PTR_LA a2, PT_SIZE(sp)
172#else 172#else
173 PTR_LA a2, (PT_SIZE+8)(sp) 173 PTR_LA a2, (PT_SIZE+8)(sp)
174#endif 174#endif
175#endif 175#endif
176 176
diff --git a/arch/mips/kernel/scall64-n32.S b/arch/mips/kernel/scall64-n32.S
index a4faceea9d88..a3d66137731a 100644
--- a/arch/mips/kernel/scall64-n32.S
+++ b/arch/mips/kernel/scall64-n32.S
@@ -400,22 +400,22 @@ EXPORT(sysn32_call_table)
400 PTR sys_ioprio_set 400 PTR sys_ioprio_set
401 PTR sys_ioprio_get 401 PTR sys_ioprio_get
402 PTR compat_sys_utimensat 402 PTR compat_sys_utimensat
403 PTR compat_sys_signalfd /* 5280 */ 403 PTR compat_sys_signalfd /* 6280 */
404 PTR sys_ni_syscall 404 PTR sys_ni_syscall
405 PTR sys_eventfd 405 PTR sys_eventfd
406 PTR sys_fallocate 406 PTR sys_fallocate
407 PTR sys_timerfd_create 407 PTR sys_timerfd_create
408 PTR compat_sys_timerfd_gettime /* 5285 */ 408 PTR compat_sys_timerfd_gettime /* 6285 */
409 PTR compat_sys_timerfd_settime 409 PTR compat_sys_timerfd_settime
410 PTR sys_signalfd4 410 PTR sys_signalfd4
411 PTR sys_eventfd2 411 PTR sys_eventfd2
412 PTR sys_epoll_create1 412 PTR sys_epoll_create1
413 PTR sys_dup3 /* 5290 */ 413 PTR sys_dup3 /* 6290 */
414 PTR sys_pipe2 414 PTR sys_pipe2
415 PTR sys_inotify_init1 415 PTR sys_inotify_init1
416 PTR sys_preadv 416 PTR sys_preadv
417 PTR sys_pwritev 417 PTR sys_pwritev
418 PTR compat_sys_rt_tgsigqueueinfo /* 5295 */ 418 PTR compat_sys_rt_tgsigqueueinfo /* 6295 */
419 PTR sys_perf_event_open 419 PTR sys_perf_event_open
420 PTR sys_accept4 420 PTR sys_accept4
421 PTR compat_sys_recvmmsg 421 PTR compat_sys_recvmmsg
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c
index 6cdca1956b77..383aeb95cb49 100644
--- a/arch/mips/kernel/smp.c
+++ b/arch/mips/kernel/smp.c
@@ -47,8 +47,12 @@
47#endif /* CONFIG_MIPS_MT_SMTC */ 47#endif /* CONFIG_MIPS_MT_SMTC */
48 48
49volatile cpumask_t cpu_callin_map; /* Bitmask of started secondaries */ 49volatile cpumask_t cpu_callin_map; /* Bitmask of started secondaries */
50
50int __cpu_number_map[NR_CPUS]; /* Map physical to logical */ 51int __cpu_number_map[NR_CPUS]; /* Map physical to logical */
52EXPORT_SYMBOL(__cpu_number_map);
53
51int __cpu_logical_map[NR_CPUS]; /* Map logical to physical */ 54int __cpu_logical_map[NR_CPUS]; /* Map logical to physical */
55EXPORT_SYMBOL(__cpu_logical_map);
52 56
53/* Number of TCs (or siblings in Intel speak) per CPU core */ 57/* Number of TCs (or siblings in Intel speak) per CPU core */
54int smp_num_siblings = 1; 58int smp_num_siblings = 1;
diff --git a/arch/mips/kernel/smtc.c b/arch/mips/kernel/smtc.c
index a95dea5459c4..cfeb2c155896 100644
--- a/arch/mips/kernel/smtc.c
+++ b/arch/mips/kernel/smtc.c
@@ -975,8 +975,7 @@ void ipi_decode(struct smtc_ipi *pipi)
975 ipi_call_interrupt(); 975 ipi_call_interrupt();
976 break; 976 break;
977 default: 977 default:
978 printk("Impossible SMTC IPI Argument 0x%x\n", 978 printk("Impossible SMTC IPI Argument %p\n", arg_copy);
979 (int)arg_copy);
980 break; 979 break;
981 } 980 }
982 break; 981 break;
diff --git a/arch/mips/kernel/syscall.c b/arch/mips/kernel/syscall.c
index dd81b0f87518..58bab2ef257f 100644
--- a/arch/mips/kernel/syscall.c
+++ b/arch/mips/kernel/syscall.c
@@ -29,6 +29,8 @@
29#include <linux/ipc.h> 29#include <linux/ipc.h>
30#include <linux/uaccess.h> 30#include <linux/uaccess.h>
31#include <linux/slab.h> 31#include <linux/slab.h>
32#include <linux/random.h>
33#include <linux/elf.h>
32 34
33#include <asm/asm.h> 35#include <asm/asm.h>
34#include <asm/branch.h> 36#include <asm/branch.h>
@@ -116,7 +118,7 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
116 (!vmm || addr + len <= vmm->vm_start)) 118 (!vmm || addr + len <= vmm->vm_start))
117 return addr; 119 return addr;
118 } 120 }
119 addr = TASK_UNMAPPED_BASE; 121 addr = current->mm->mmap_base;
120 if (do_color_align) 122 if (do_color_align)
121 addr = COLOUR_ALIGN(addr, pgoff); 123 addr = COLOUR_ALIGN(addr, pgoff);
122 else 124 else
@@ -134,6 +136,51 @@ unsigned long arch_get_unmapped_area(struct file *filp, unsigned long addr,
134 } 136 }
135} 137}
136 138
139void arch_pick_mmap_layout(struct mm_struct *mm)
140{
141 unsigned long random_factor = 0UL;
142
143 if (current->flags & PF_RANDOMIZE) {
144 random_factor = get_random_int();
145 random_factor = random_factor << PAGE_SHIFT;
146 if (TASK_IS_32BIT_ADDR)
147 random_factor &= 0xfffffful;
148 else
149 random_factor &= 0xffffffful;
150 }
151
152 mm->mmap_base = TASK_UNMAPPED_BASE + random_factor;
153 mm->get_unmapped_area = arch_get_unmapped_area;
154 mm->unmap_area = arch_unmap_area;
155}
156
157static inline unsigned long brk_rnd(void)
158{
159 unsigned long rnd = get_random_int();
160
161 rnd = rnd << PAGE_SHIFT;
162 /* 8MB for 32bit, 256MB for 64bit */
163 if (TASK_IS_32BIT_ADDR)
164 rnd = rnd & 0x7ffffful;
165 else
166 rnd = rnd & 0xffffffful;
167
168 return rnd;
169}
170
171unsigned long arch_randomize_brk(struct mm_struct *mm)
172{
173 unsigned long base = mm->brk;
174 unsigned long ret;
175
176 ret = PAGE_ALIGN(base + brk_rnd());
177
178 if (ret < mm->brk)
179 return mm->brk;
180
181 return ret;
182}
183
137SYSCALL_DEFINE6(mips_mmap, unsigned long, addr, unsigned long, len, 184SYSCALL_DEFINE6(mips_mmap, unsigned long, addr, unsigned long, len,
138 unsigned long, prot, unsigned long, flags, unsigned long, 185 unsigned long, prot, unsigned long, flags, unsigned long,
139 fd, off_t, offset) 186 fd, off_t, offset)
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index 852780868fb4..03ec0019032b 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -25,6 +25,7 @@
25#include <linux/ptrace.h> 25#include <linux/ptrace.h>
26#include <linux/kgdb.h> 26#include <linux/kgdb.h>
27#include <linux/kdebug.h> 27#include <linux/kdebug.h>
28#include <linux/kprobes.h>
28#include <linux/notifier.h> 29#include <linux/notifier.h>
29#include <linux/kdb.h> 30#include <linux/kdb.h>
30 31
@@ -334,7 +335,7 @@ void show_regs(struct pt_regs *regs)
334 __show_regs((struct pt_regs *)regs); 335 __show_regs((struct pt_regs *)regs);
335} 336}
336 337
337void show_registers(const struct pt_regs *regs) 338void show_registers(struct pt_regs *regs)
338{ 339{
339 const int field = 2 * sizeof(unsigned long); 340 const int field = 2 * sizeof(unsigned long);
340 341
@@ -356,9 +357,14 @@ void show_registers(const struct pt_regs *regs)
356 printk("\n"); 357 printk("\n");
357} 358}
358 359
360static int regs_to_trapnr(struct pt_regs *regs)
361{
362 return (regs->cp0_cause >> 2) & 0x1f;
363}
364
359static DEFINE_SPINLOCK(die_lock); 365static DEFINE_SPINLOCK(die_lock);
360 366
361void __noreturn die(const char * str, struct pt_regs * regs) 367void __noreturn die(const char *str, struct pt_regs *regs)
362{ 368{
363 static int die_counter; 369 static int die_counter;
364 int sig = SIGSEGV; 370 int sig = SIGSEGV;
@@ -366,7 +372,7 @@ void __noreturn die(const char * str, struct pt_regs * regs)
366 unsigned long dvpret = dvpe(); 372 unsigned long dvpret = dvpe();
367#endif /* CONFIG_MIPS_MT_SMTC */ 373#endif /* CONFIG_MIPS_MT_SMTC */
368 374
369 notify_die(DIE_OOPS, str, (struct pt_regs *)regs, SIGSEGV, 0, 0); 375 notify_die(DIE_OOPS, str, regs, 0, regs_to_trapnr(regs), SIGSEGV);
370 376
371 console_verbose(); 377 console_verbose();
372 spin_lock_irq(&die_lock); 378 spin_lock_irq(&die_lock);
@@ -375,7 +381,7 @@ void __noreturn die(const char * str, struct pt_regs * regs)
375 mips_mt_regdump(dvpret); 381 mips_mt_regdump(dvpret);
376#endif /* CONFIG_MIPS_MT_SMTC */ 382#endif /* CONFIG_MIPS_MT_SMTC */
377 383
378 if (notify_die(DIE_OOPS, str, regs, 0, current->thread.trap_no, SIGSEGV) == NOTIFY_STOP) 384 if (notify_die(DIE_OOPS, str, regs, 0, regs_to_trapnr(regs), SIGSEGV) == NOTIFY_STOP)
379 sig = 0; 385 sig = 0;
380 386
381 printk("%s[#%d]:\n", str, ++die_counter); 387 printk("%s[#%d]:\n", str, ++die_counter);
@@ -449,7 +455,7 @@ asmlinkage void do_be(struct pt_regs *regs)
449 printk(KERN_ALERT "%s bus error, epc == %0*lx, ra == %0*lx\n", 455 printk(KERN_ALERT "%s bus error, epc == %0*lx, ra == %0*lx\n",
450 data ? "Data" : "Instruction", 456 data ? "Data" : "Instruction",
451 field, regs->cp0_epc, field, regs->regs[31]); 457 field, regs->cp0_epc, field, regs->regs[31]);
452 if (notify_die(DIE_OOPS, "bus error", regs, SIGBUS, 0, 0) 458 if (notify_die(DIE_OOPS, "bus error", regs, 0, regs_to_trapnr(regs), SIGBUS)
453 == NOTIFY_STOP) 459 == NOTIFY_STOP)
454 return; 460 return;
455 461
@@ -650,7 +656,7 @@ asmlinkage void do_fpe(struct pt_regs *regs, unsigned long fcr31)
650{ 656{
651 siginfo_t info; 657 siginfo_t info;
652 658
653 if (notify_die(DIE_FP, "FP exception", regs, SIGFPE, 0, 0) 659 if (notify_die(DIE_FP, "FP exception", regs, 0, regs_to_trapnr(regs), SIGFPE)
654 == NOTIFY_STOP) 660 == NOTIFY_STOP)
655 return; 661 return;
656 die_if_kernel("FP exception in kernel code", regs); 662 die_if_kernel("FP exception in kernel code", regs);
@@ -713,11 +719,11 @@ static void do_trap_or_bp(struct pt_regs *regs, unsigned int code,
713 char b[40]; 719 char b[40];
714 720
715#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP 721#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
716 if (kgdb_ll_trap(DIE_TRAP, str, regs, code, 0, 0) == NOTIFY_STOP) 722 if (kgdb_ll_trap(DIE_TRAP, str, regs, code, regs_to_trapnr(regs), SIGTRAP) == NOTIFY_STOP)
717 return; 723 return;
718#endif /* CONFIG_KGDB_LOW_LEVEL_TRAP */ 724#endif /* CONFIG_KGDB_LOW_LEVEL_TRAP */
719 725
720 if (notify_die(DIE_TRAP, str, regs, code, 0, 0) == NOTIFY_STOP) 726 if (notify_die(DIE_TRAP, str, regs, code, regs_to_trapnr(regs), SIGTRAP) == NOTIFY_STOP)
721 return; 727 return;
722 728
723 /* 729 /*
@@ -783,6 +789,25 @@ asmlinkage void do_bp(struct pt_regs *regs)
783 if (bcode >= (1 << 10)) 789 if (bcode >= (1 << 10))
784 bcode >>= 10; 790 bcode >>= 10;
785 791
792 /*
793 * notify the kprobe handlers, if instruction is likely to
794 * pertain to them.
795 */
796 switch (bcode) {
797 case BRK_KPROBE_BP:
798 if (notify_die(DIE_BREAK, "debug", regs, bcode, regs_to_trapnr(regs), SIGTRAP) == NOTIFY_STOP)
799 return;
800 else
801 break;
802 case BRK_KPROBE_SSTEPBP:
803 if (notify_die(DIE_SSTEPBP, "single_step", regs, bcode, regs_to_trapnr(regs), SIGTRAP) == NOTIFY_STOP)
804 return;
805 else
806 break;
807 default:
808 break;
809 }
810
786 do_trap_or_bp(regs, bcode, "Break"); 811 do_trap_or_bp(regs, bcode, "Break");
787 return; 812 return;
788 813
@@ -815,7 +840,7 @@ asmlinkage void do_ri(struct pt_regs *regs)
815 unsigned int opcode = 0; 840 unsigned int opcode = 0;
816 int status = -1; 841 int status = -1;
817 842
818 if (notify_die(DIE_RI, "RI Fault", regs, SIGSEGV, 0, 0) 843 if (notify_die(DIE_RI, "RI Fault", regs, 0, regs_to_trapnr(regs), SIGILL)
819 == NOTIFY_STOP) 844 == NOTIFY_STOP)
820 return; 845 return;
821 846
@@ -907,11 +932,6 @@ static int default_cu2_call(struct notifier_block *nfb, unsigned long action,
907 return NOTIFY_OK; 932 return NOTIFY_OK;
908} 933}
909 934
910static struct notifier_block default_cu2_notifier = {
911 .notifier_call = default_cu2_call,
912 .priority = 0x80000000, /* Run last */
913};
914
915asmlinkage void do_cpu(struct pt_regs *regs) 935asmlinkage void do_cpu(struct pt_regs *regs)
916{ 936{
917 unsigned int __user *epc; 937 unsigned int __user *epc;
@@ -1734,5 +1754,5 @@ void __init trap_init(void)
1734 1754
1735 sort_extable(__start___dbe_table, __stop___dbe_table); 1755 sort_extable(__start___dbe_table, __stop___dbe_table);
1736 1756
1737 register_cu2_notifier(&default_cu2_notifier); 1757 cu2_notifier(default_cu2_call, 0x80000000); /* Run last */
1738} 1758}
diff --git a/arch/mips/lasat/Makefile b/arch/mips/lasat/Makefile
index 33791609fe99..9cc4e4db8b99 100644
--- a/arch/mips/lasat/Makefile
+++ b/arch/mips/lasat/Makefile
@@ -12,5 +12,3 @@ obj-$(CONFIG_PICVUE_PROC) += picvue_proc.o
12 12
13clean: 13clean:
14 make -C image clean 14 make -C image clean
15
16EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/lasat/Platform b/arch/mips/lasat/Platform
new file mode 100644
index 000000000000..760252828bf1
--- /dev/null
+++ b/arch/mips/lasat/Platform
@@ -0,0 +1,7 @@
1#
2# LASAT platforms
3#
4platform-$(CONFIG_LASAT) += lasat/
5cflags-$(CONFIG_LASAT) += \
6 -I$(srctree)/arch/mips/include/asm/mach-lasat
7load-$(CONFIG_LASAT) += 0xffffffff80000000
diff --git a/arch/mips/loongson/Platform b/arch/mips/loongson/Platform
new file mode 100644
index 000000000000..29692e5433b1
--- /dev/null
+++ b/arch/mips/loongson/Platform
@@ -0,0 +1,32 @@
1#
2# Loongson Processors' Support
3#
4
5# Only gcc >= 4.4 have Loongson specific support
6cflags-$(CONFIG_CPU_LOONGSON2) += -Wa,--trap
7cflags-$(CONFIG_CPU_LOONGSON2E) += \
8 $(call cc-option,-march=loongson2e,-march=r4600)
9cflags-$(CONFIG_CPU_LOONGSON2F) += \
10 $(call cc-option,-march=loongson2f,-march=r4600)
11# Enable the workarounds for Loongson2f
12ifdef CONFIG_CPU_LOONGSON2F_WORKAROUNDS
13 ifeq ($(call as-option,-Wa$(comma)-mfix-loongson2f-nop,),)
14 $(error only binutils >= 2.20.2 have needed option -mfix-loongson2f-nop)
15 else
16 cflags-$(CONFIG_CPU_NOP_WORKAROUNDS) += -Wa$(comma)-mfix-loongson2f-nop
17 endif
18 ifeq ($(call as-option,-Wa$(comma)-mfix-loongson2f-jump,),)
19 $(error only binutils >= 2.20.2 have needed option -mfix-loongson2f-jump)
20 else
21 cflags-$(CONFIG_CPU_JUMP_WORKAROUNDS) += -Wa$(comma)-mfix-loongson2f-jump
22 endif
23endif
24
25#
26# Loongson Machines' Support
27#
28
29platform-$(CONFIG_MACH_LOONGSON) += loongson/
30cflags-$(CONFIG_MACH_LOONGSON) += -I$(srctree)/arch/mips/include/asm/mach-loongson -mno-branch-likely
31load-$(CONFIG_LEMOTE_FULOONG2E) += 0xffffffff80100000
32load-$(CONFIG_LEMOTE_MACH2F) += 0xffffffff80200000
diff --git a/arch/mips/loongson/common/cs5536/Makefile b/arch/mips/loongson/common/cs5536/Makefile
index 510d4cdc2378..f12e64007347 100644
--- a/arch/mips/loongson/common/cs5536/Makefile
+++ b/arch/mips/loongson/common/cs5536/Makefile
@@ -9,5 +9,3 @@ obj-$(CONFIG_CS5536) += cs5536_pci.o cs5536_ide.o cs5536_acc.o cs5536_ohci.o \
9# Enable cs5536 mfgpt Timer 9# Enable cs5536 mfgpt Timer
10# 10#
11obj-$(CONFIG_CS5536_MFGPT) += cs5536_mfgpt.o 11obj-$(CONFIG_CS5536_MFGPT) += cs5536_mfgpt.o
12
13EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/loongson/common/irq.c b/arch/mips/loongson/common/irq.c
index 20e732831978..5897471dedca 100644
--- a/arch/mips/loongson/common/irq.c
+++ b/arch/mips/loongson/common/irq.c
@@ -21,19 +21,16 @@ void bonito_irqdispatch(void)
21 21
22 /* workaround the IO dma problem: let cpu looping to allow DMA finish */ 22 /* workaround the IO dma problem: let cpu looping to allow DMA finish */
23 int_status = LOONGSON_INTISR; 23 int_status = LOONGSON_INTISR;
24 if (int_status & (1 << 10)) { 24 while (int_status & (1 << 10)) {
25 while (int_status & (1 << 10)) { 25 udelay(1);
26 udelay(1); 26 int_status = LOONGSON_INTISR;
27 int_status = LOONGSON_INTISR;
28 }
29 } 27 }
30 28
31 /* Get pending sources, masked by current enables */ 29 /* Get pending sources, masked by current enables */
32 int_status = LOONGSON_INTISR & LOONGSON_INTEN; 30 int_status = LOONGSON_INTISR & LOONGSON_INTEN;
33 31
34 if (int_status != 0) { 32 if (int_status) {
35 i = __ffs(int_status); 33 i = __ffs(int_status);
36 int_status &= ~(1 << i);
37 do_IRQ(LOONGSON_IRQ_BASE + i); 34 do_IRQ(LOONGSON_IRQ_BASE + i);
38 } 35 }
39} 36}
@@ -56,9 +53,6 @@ void __init arch_init_irq(void)
56 */ 53 */
57 clear_c0_status(ST0_IM | ST0_BEV); 54 clear_c0_status(ST0_IM | ST0_BEV);
58 55
59 /* setting irq trigger mode */
60 set_irq_trigger_mode();
61
62 /* no steer */ 56 /* no steer */
63 LOONGSON_INTSTEER = 0; 57 LOONGSON_INTSTEER = 0;
64 58
diff --git a/arch/mips/loongson/fuloong-2e/Makefile b/arch/mips/loongson/fuloong-2e/Makefile
index 3aba5fcc09dc..b7622720c1ad 100644
--- a/arch/mips/loongson/fuloong-2e/Makefile
+++ b/arch/mips/loongson/fuloong-2e/Makefile
@@ -3,5 +3,3 @@
3# 3#
4 4
5obj-y += irq.o reset.o 5obj-y += irq.o reset.o
6
7EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/loongson/fuloong-2e/irq.c b/arch/mips/loongson/fuloong-2e/irq.c
index 320e9379bdd7..d61a04222b87 100644
--- a/arch/mips/loongson/fuloong-2e/irq.c
+++ b/arch/mips/loongson/fuloong-2e/irq.c
@@ -30,7 +30,7 @@ asmlinkage void mach_irq_dispatch(unsigned int pending)
30 if (pending & CAUSEF_IP7) 30 if (pending & CAUSEF_IP7)
31 do_IRQ(MIPS_CPU_IRQ_BASE + 7); 31 do_IRQ(MIPS_CPU_IRQ_BASE + 7);
32 else if (pending & CAUSEF_IP6) /* perf counter loverflow */ 32 else if (pending & CAUSEF_IP6) /* perf counter loverflow */
33 do_IRQ(LOONGSON2_PERFCNT_IRQ); 33 do_perfcnt_IRQ();
34 else if (pending & CAUSEF_IP5) 34 else if (pending & CAUSEF_IP5)
35 i8259_irqdispatch(); 35 i8259_irqdispatch();
36 else if (pending & CAUSEF_IP2) 36 else if (pending & CAUSEF_IP2)
@@ -44,13 +44,6 @@ static struct irqaction cascade_irqaction = {
44 .name = "cascade", 44 .name = "cascade",
45}; 45};
46 46
47void __init set_irq_trigger_mode(void)
48{
49 /* most bonito irq should be level triggered */
50 LOONGSON_INTEDGE = LOONGSON_ICU_SYSTEMERR | LOONGSON_ICU_MASTERERR |
51 LOONGSON_ICU_RETRYERR | LOONGSON_ICU_MBOXES;
52}
53
54void __init mach_init_irq(void) 47void __init mach_init_irq(void)
55{ 48{
56 /* init all controller 49 /* init all controller
@@ -59,6 +52,10 @@ void __init mach_init_irq(void)
59 * 32-63 ------> bonito irq 52 * 32-63 ------> bonito irq
60 */ 53 */
61 54
55 /* most bonito irq should be level triggered */
56 LOONGSON_INTEDGE = LOONGSON_ICU_SYSTEMERR | LOONGSON_ICU_MASTERERR |
57 LOONGSON_ICU_RETRYERR | LOONGSON_ICU_MBOXES;
58
62 /* Sets the first-level interrupt dispatcher. */ 59 /* Sets the first-level interrupt dispatcher. */
63 mips_cpu_irq_init(); 60 mips_cpu_irq_init();
64 init_i8259_irqs(); 61 init_i8259_irqs();
diff --git a/arch/mips/loongson/lemote-2f/irq.c b/arch/mips/loongson/lemote-2f/irq.c
index 1d8b4d28a058..081db102bb98 100644
--- a/arch/mips/loongson/lemote-2f/irq.c
+++ b/arch/mips/loongson/lemote-2f/irq.c
@@ -19,7 +19,6 @@
19#include <machine.h> 19#include <machine.h>
20 20
21#define LOONGSON_TIMER_IRQ (MIPS_CPU_IRQ_BASE + 7) /* cpu timer */ 21#define LOONGSON_TIMER_IRQ (MIPS_CPU_IRQ_BASE + 7) /* cpu timer */
22#define LOONGSON_PERFCNT_IRQ (MIPS_CPU_IRQ_BASE + 6) /* cpu perf counter */
23#define LOONGSON_NORTH_BRIDGE_IRQ (MIPS_CPU_IRQ_BASE + 6) /* bonito */ 22#define LOONGSON_NORTH_BRIDGE_IRQ (MIPS_CPU_IRQ_BASE + 6) /* bonito */
24#define LOONGSON_UART_IRQ (MIPS_CPU_IRQ_BASE + 3) /* cpu serial port */ 23#define LOONGSON_UART_IRQ (MIPS_CPU_IRQ_BASE + 3) /* cpu serial port */
25#define LOONGSON_SOUTH_BRIDGE_IRQ (MIPS_CPU_IRQ_BASE + 2) /* i8259 */ 24#define LOONGSON_SOUTH_BRIDGE_IRQ (MIPS_CPU_IRQ_BASE + 2) /* i8259 */
@@ -79,9 +78,7 @@ void mach_irq_dispatch(unsigned int pending)
79 if (pending & CAUSEF_IP7) 78 if (pending & CAUSEF_IP7)
80 do_IRQ(LOONGSON_TIMER_IRQ); 79 do_IRQ(LOONGSON_TIMER_IRQ);
81 else if (pending & CAUSEF_IP6) { /* North Bridge, Perf counter */ 80 else if (pending & CAUSEF_IP6) { /* North Bridge, Perf counter */
82#if defined(CONFIG_OPROFILE) || defined(CONFIG_OPROFILE_MODULE) 81 do_perfcnt_IRQ();
83 do_IRQ(LOONGSON2_PERFCNT_IRQ);
84#endif
85 bonito_irqdispatch(); 82 bonito_irqdispatch();
86 } else if (pending & CAUSEF_IP3) /* CPU UART */ 83 } else if (pending & CAUSEF_IP3) /* CPU UART */
87 do_IRQ(LOONGSON_UART_IRQ); 84 do_IRQ(LOONGSON_UART_IRQ);
@@ -91,13 +88,6 @@ void mach_irq_dispatch(unsigned int pending)
91 spurious_interrupt(); 88 spurious_interrupt();
92} 89}
93 90
94void __init set_irq_trigger_mode(void)
95{
96 /* setup cs5536 as high level trigger */
97 LOONGSON_INTPOL = LOONGSON_INT_BIT_INT0 | LOONGSON_INT_BIT_INT1;
98 LOONGSON_INTEDGE &= ~(LOONGSON_INT_BIT_INT0 | LOONGSON_INT_BIT_INT1);
99}
100
101static irqreturn_t ip6_action(int cpl, void *dev_id) 91static irqreturn_t ip6_action(int cpl, void *dev_id)
102{ 92{
103 return IRQ_HANDLED; 93 return IRQ_HANDLED;
@@ -122,6 +112,10 @@ void __init mach_init_irq(void)
122 * 32-63 ------> bonito irq 112 * 32-63 ------> bonito irq
123 */ 113 */
124 114
115 /* setup cs5536 as high level trigger */
116 LOONGSON_INTPOL = LOONGSON_INT_BIT_INT0 | LOONGSON_INT_BIT_INT1;
117 LOONGSON_INTEDGE &= ~(LOONGSON_INT_BIT_INT0 | LOONGSON_INT_BIT_INT1);
118
125 /* Sets the first-level interrupt dispatcher. */ 119 /* Sets the first-level interrupt dispatcher. */
126 mips_cpu_irq_init(); 120 mips_cpu_irq_init();
127 init_i8259_irqs(); 121 init_i8259_irqs();
diff --git a/arch/mips/math-emu/Makefile b/arch/mips/math-emu/Makefile
index d547efdeedc2..96607230d9ea 100644
--- a/arch/mips/math-emu/Makefile
+++ b/arch/mips/math-emu/Makefile
@@ -10,4 +10,3 @@ obj-y := cp1emu.o ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \
10 sp_scalb.o sp_simple.o sp_tint.o sp_fint.o sp_tlong.o sp_flong.o \ 10 sp_scalb.o sp_simple.o sp_tint.o sp_fint.o sp_tlong.o sp_flong.o \
11 dp_sqrt.o sp_sqrt.o kernel_linkage.o dsemul.o 11 dp_sqrt.o sp_sqrt.o kernel_linkage.o dsemul.o
12 12
13EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/math-emu/dp_modf.c b/arch/mips/math-emu/dp_modf.c
index 25861a42c36f..a8570e5c3efc 100644
--- a/arch/mips/math-emu/dp_modf.c
+++ b/arch/mips/math-emu/dp_modf.c
@@ -29,7 +29,7 @@
29 29
30/* modf function is always exact for a finite number 30/* modf function is always exact for a finite number
31*/ 31*/
32ieee754dp ieee754dp_modf(ieee754dp x, ieee754dp * ip) 32ieee754dp ieee754dp_modf(ieee754dp x, ieee754dp *ip)
33{ 33{
34 COMPXDP; 34 COMPXDP;
35 35
diff --git a/arch/mips/math-emu/dp_tint.c b/arch/mips/math-emu/dp_tint.c
index 77b2b7ccf28a..24478623c117 100644
--- a/arch/mips/math-emu/dp_tint.c
+++ b/arch/mips/math-emu/dp_tint.c
@@ -69,8 +69,7 @@ int ieee754dp_tint(ieee754dp x)
69 round = 0; 69 round = 0;
70 sticky = residue != 0; 70 sticky = residue != 0;
71 xm = 0; 71 xm = 0;
72 } 72 } else {
73 else {
74 residue = xm << (64 - DP_MBITS + xe); 73 residue = xm << (64 - DP_MBITS + xe);
75 round = (residue >> 63) != 0; 74 round = (residue >> 63) != 0;
76 sticky = (residue << 1) != 0; 75 sticky = (residue << 1) != 0;
diff --git a/arch/mips/math-emu/dp_tlong.c b/arch/mips/math-emu/dp_tlong.c
index d71113e07164..0f07ec2be3f9 100644
--- a/arch/mips/math-emu/dp_tlong.c
+++ b/arch/mips/math-emu/dp_tlong.c
@@ -71,8 +71,7 @@ s64 ieee754dp_tlong(ieee754dp x)
71 round = 0; 71 round = 0;
72 sticky = residue != 0; 72 sticky = residue != 0;
73 xm = 0; 73 xm = 0;
74 } 74 } else {
75 else {
76 /* Shifting a u64 64 times does not work, 75 /* Shifting a u64 64 times does not work,
77 * so we do it in two steps. Be aware that xe 76 * so we do it in two steps. Be aware that xe
78 * may be -1 */ 77 * may be -1 */
diff --git a/arch/mips/math-emu/sp_modf.c b/arch/mips/math-emu/sp_modf.c
index 4b1dbac796f8..76568946b4c0 100644
--- a/arch/mips/math-emu/sp_modf.c
+++ b/arch/mips/math-emu/sp_modf.c
@@ -29,7 +29,7 @@
29 29
30/* modf function is always exact for a finite number 30/* modf function is always exact for a finite number
31*/ 31*/
32ieee754sp ieee754sp_modf(ieee754sp x, ieee754sp * ip) 32ieee754sp ieee754sp_modf(ieee754sp x, ieee754sp *ip)
33{ 33{
34 COMPXSP; 34 COMPXSP;
35 35
diff --git a/arch/mips/math-emu/sp_tint.c b/arch/mips/math-emu/sp_tint.c
index 1d73d2abe0b5..352dc3a5f1af 100644
--- a/arch/mips/math-emu/sp_tint.c
+++ b/arch/mips/math-emu/sp_tint.c
@@ -72,8 +72,7 @@ int ieee754sp_tint(ieee754sp x)
72 round = 0; 72 round = 0;
73 sticky = residue != 0; 73 sticky = residue != 0;
74 xm = 0; 74 xm = 0;
75 } 75 } else {
76 else {
77 /* Shifting a u32 32 times does not work, 76 /* Shifting a u32 32 times does not work,
78 * so we do it in two steps. Be aware that xe 77 * so we do it in two steps. Be aware that xe
79 * may be -1 */ 78 * may be -1 */
diff --git a/arch/mips/math-emu/sp_tlong.c b/arch/mips/math-emu/sp_tlong.c
index 4be21aa81fbf..92cd9c511a10 100644
--- a/arch/mips/math-emu/sp_tlong.c
+++ b/arch/mips/math-emu/sp_tlong.c
@@ -71,8 +71,7 @@ s64 ieee754sp_tlong(ieee754sp x)
71 round = 0; 71 round = 0;
72 sticky = residue != 0; 72 sticky = residue != 0;
73 xm = 0; 73 xm = 0;
74 } 74 } else {
75 else {
76 residue = xm << (32 - SP_MBITS + xe); 75 residue = xm << (32 - SP_MBITS + xe);
77 round = (residue >> 31) != 0; 76 round = (residue >> 31) != 0;
78 sticky = (residue << 1) != 0; 77 sticky = (residue << 1) != 0;
diff --git a/arch/mips/mipssim/Makefile b/arch/mips/mipssim/Makefile
index 41b96571315e..01410a3f1729 100644
--- a/arch/mips/mipssim/Makefile
+++ b/arch/mips/mipssim/Makefile
@@ -21,5 +21,3 @@ obj-y := sim_platform.o sim_setup.o sim_mem.o sim_time.o sim_int.o
21 21
22obj-$(CONFIG_EARLY_PRINTK) += sim_console.o 22obj-$(CONFIG_EARLY_PRINTK) += sim_console.o
23obj-$(CONFIG_MIPS_MT_SMTC) += sim_smtc.o 23obj-$(CONFIG_MIPS_MT_SMTC) += sim_smtc.o
24
25EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/mipssim/Platform b/arch/mips/mipssim/Platform
new file mode 100644
index 000000000000..3df60b8a12ef
--- /dev/null
+++ b/arch/mips/mipssim/Platform
@@ -0,0 +1,6 @@
1#
2# MIPS SIM
3#
4platform-$(CONFIG_MIPS_SIM) += mipssim/
5cflags-$(CONFIG_MIPS_SIM) += -I$(srctree)/arch/mips/include/asm/mach-mipssim
6load-$(CONFIG_MIPS_SIM) += 0x80100000
diff --git a/arch/mips/mm/Makefile b/arch/mips/mm/Makefile
index f0e435599707..d679c772d082 100644
--- a/arch/mips/mm/Makefile
+++ b/arch/mips/mm/Makefile
@@ -34,5 +34,3 @@ obj-$(CONFIG_IP22_CPU_SCACHE) += sc-ip22.o
34obj-$(CONFIG_R5000_CPU_SCACHE) += sc-r5k.o 34obj-$(CONFIG_R5000_CPU_SCACHE) += sc-r5k.o
35obj-$(CONFIG_RM7000_CPU_SCACHE) += sc-rm7k.o 35obj-$(CONFIG_RM7000_CPU_SCACHE) += sc-rm7k.o
36obj-$(CONFIG_MIPS_CPU_SCACHE) += sc-mips.o 36obj-$(CONFIG_MIPS_CPU_SCACHE) += sc-mips.o
37
38EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/mm/fault.c b/arch/mips/mm/fault.c
index b78f7d913ca4..783ad0065fdf 100644
--- a/arch/mips/mm/fault.c
+++ b/arch/mips/mm/fault.c
@@ -16,8 +16,8 @@
16#include <linux/mman.h> 16#include <linux/mman.h>
17#include <linux/mm.h> 17#include <linux/mm.h>
18#include <linux/smp.h> 18#include <linux/smp.h>
19#include <linux/vt_kern.h> /* For unblank_screen() */
20#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/kprobes.h>
21 21
22#include <asm/branch.h> 22#include <asm/branch.h>
23#include <asm/mmu_context.h> 23#include <asm/mmu_context.h>
@@ -25,13 +25,14 @@
25#include <asm/uaccess.h> 25#include <asm/uaccess.h>
26#include <asm/ptrace.h> 26#include <asm/ptrace.h>
27#include <asm/highmem.h> /* For VMALLOC_END */ 27#include <asm/highmem.h> /* For VMALLOC_END */
28#include <linux/kdebug.h>
28 29
29/* 30/*
30 * This routine handles page faults. It determines the address, 31 * This routine handles page faults. It determines the address,
31 * and the problem, and then passes it off to one of the appropriate 32 * and the problem, and then passes it off to one of the appropriate
32 * routines. 33 * routines.
33 */ 34 */
34asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write, 35asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, unsigned long write,
35 unsigned long address) 36 unsigned long address)
36{ 37{
37 struct vm_area_struct * vma = NULL; 38 struct vm_area_struct * vma = NULL;
@@ -47,6 +48,17 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long write,
47 field, regs->cp0_epc); 48 field, regs->cp0_epc);
48#endif 49#endif
49 50
51#ifdef CONFIG_KPROBES
52 /*
53 * This is to notify the fault handler of the kprobes. The
54 * exception code is redundant as it is also carried in REGS,
55 * but we pass it anyhow.
56 */
57 if (notify_die(DIE_PAGE_FAULT, "page fault", regs, -1,
58 (regs->cp0_cause >> 2) & 0x1f, SIGSEGV) == NOTIFY_STOP)
59 return;
60#endif
61
50 info.si_code = SEGV_MAPERR; 62 info.si_code = SEGV_MAPERR;
51 63
52 /* 64 /*
diff --git a/arch/mips/mm/sc-rm7k.c b/arch/mips/mm/sc-rm7k.c
index de69bfbf506e..1ef75cd80a0d 100644
--- a/arch/mips/mm/sc-rm7k.c
+++ b/arch/mips/mm/sc-rm7k.c
@@ -16,6 +16,7 @@
16#include <asm/cacheops.h> 16#include <asm/cacheops.h>
17#include <asm/mipsregs.h> 17#include <asm/mipsregs.h>
18#include <asm/processor.h> 18#include <asm/processor.h>
19#include <asm/sections.h>
19#include <asm/cacheflush.h> /* for run_uncached() */ 20#include <asm/cacheflush.h> /* for run_uncached() */
20 21
21/* Primary cache parameters. */ 22/* Primary cache parameters. */
@@ -25,11 +26,15 @@
25/* Secondary cache parameters. */ 26/* Secondary cache parameters. */
26#define scache_size (256*1024) /* Fixed to 256KiB on RM7000 */ 27#define scache_size (256*1024) /* Fixed to 256KiB on RM7000 */
27 28
29/* Tertiary cache parameters */
30#define tc_lsize 32
31
28extern unsigned long icache_way_size, dcache_way_size; 32extern unsigned long icache_way_size, dcache_way_size;
33unsigned long tcache_size;
29 34
30#include <asm/r4kcache.h> 35#include <asm/r4kcache.h>
31 36
32static int rm7k_tcache_enabled; 37static int rm7k_tcache_init;
33 38
34/* 39/*
35 * Writeback and invalidate the primary cache dcache before DMA. 40 * Writeback and invalidate the primary cache dcache before DMA.
@@ -46,7 +51,7 @@ static void rm7k_sc_wback_inv(unsigned long addr, unsigned long size)
46 51
47 blast_scache_range(addr, addr + size); 52 blast_scache_range(addr, addr + size);
48 53
49 if (!rm7k_tcache_enabled) 54 if (!rm7k_tcache_init)
50 return; 55 return;
51 56
52 a = addr & ~(tc_pagesize - 1); 57 a = addr & ~(tc_pagesize - 1);
@@ -70,7 +75,7 @@ static void rm7k_sc_inv(unsigned long addr, unsigned long size)
70 75
71 blast_inv_scache_range(addr, addr + size); 76 blast_inv_scache_range(addr, addr + size);
72 77
73 if (!rm7k_tcache_enabled) 78 if (!rm7k_tcache_init)
74 return; 79 return;
75 80
76 a = addr & ~(tc_pagesize - 1); 81 a = addr & ~(tc_pagesize - 1);
@@ -83,6 +88,45 @@ static void rm7k_sc_inv(unsigned long addr, unsigned long size)
83 } 88 }
84} 89}
85 90
91static void blast_rm7k_tcache(void)
92{
93 unsigned long start = CKSEG0ADDR(0);
94 unsigned long end = start + tcache_size;
95
96 write_c0_taglo(0);
97
98 while (start < end) {
99 cache_op(Page_Invalidate_T, start);
100 start += tc_pagesize;
101 }
102}
103
104/*
105 * This function is executed in uncached address space.
106 */
107static __cpuinit void __rm7k_tc_enable(void)
108{
109 int i;
110
111 set_c0_config(RM7K_CONF_TE);
112
113 write_c0_taglo(0);
114 write_c0_taghi(0);
115
116 for (i = 0; i < tcache_size; i += tc_lsize)
117 cache_op(Index_Store_Tag_T, CKSEG0ADDR(i));
118}
119
120static __cpuinit void rm7k_tc_enable(void)
121{
122 if (read_c0_config() & RM7K_CONF_TE)
123 return;
124
125 BUG_ON(tcache_size == 0);
126
127 run_uncached(__rm7k_tc_enable);
128}
129
86/* 130/*
87 * This function is executed in uncached address space. 131 * This function is executed in uncached address space.
88 */ 132 */
@@ -95,16 +139,8 @@ static __cpuinit void __rm7k_sc_enable(void)
95 write_c0_taglo(0); 139 write_c0_taglo(0);
96 write_c0_taghi(0); 140 write_c0_taghi(0);
97 141
98 for (i = 0; i < scache_size; i += sc_lsize) { 142 for (i = 0; i < scache_size; i += sc_lsize)
99 __asm__ __volatile__ ( 143 cache_op(Index_Store_Tag_SD, CKSEG0ADDR(i));
100 ".set noreorder\n\t"
101 ".set mips3\n\t"
102 "cache %1, (%0)\n\t"
103 ".set mips0\n\t"
104 ".set reorder"
105 :
106 : "r" (CKSEG0ADDR(i)), "i" (Index_Store_Tag_SD));
107 }
108} 144}
109 145
110static __cpuinit void rm7k_sc_enable(void) 146static __cpuinit void rm7k_sc_enable(void)
@@ -112,13 +148,29 @@ static __cpuinit void rm7k_sc_enable(void)
112 if (read_c0_config() & RM7K_CONF_SE) 148 if (read_c0_config() & RM7K_CONF_SE)
113 return; 149 return;
114 150
115 printk(KERN_INFO "Enabling secondary cache...\n"); 151 pr_info("Enabling secondary cache...\n");
116 run_uncached(__rm7k_sc_enable); 152 run_uncached(__rm7k_sc_enable);
153
154 if (rm7k_tcache_init)
155 rm7k_tc_enable();
156}
157
158static void rm7k_tc_disable(void)
159{
160 unsigned long flags;
161
162 local_irq_save(flags);
163 blast_rm7k_tcache();
164 clear_c0_config(RM7K_CONF_TE);
165 local_irq_save(flags);
117} 166}
118 167
119static void rm7k_sc_disable(void) 168static void rm7k_sc_disable(void)
120{ 169{
121 clear_c0_config(RM7K_CONF_SE); 170 clear_c0_config(RM7K_CONF_SE);
171
172 if (rm7k_tcache_init)
173 rm7k_tc_disable();
122} 174}
123 175
124static struct bcache_ops rm7k_sc_ops = { 176static struct bcache_ops rm7k_sc_ops = {
@@ -128,6 +180,52 @@ static struct bcache_ops rm7k_sc_ops = {
128 .bc_inv = rm7k_sc_inv 180 .bc_inv = rm7k_sc_inv
129}; 181};
130 182
183/*
184 * This is a probing function like the one found in c-r4k.c, we look for the
185 * wrap around point with different addresses.
186 */
187static __cpuinit void __probe_tcache(void)
188{
189 unsigned long flags, addr, begin, end, pow2;
190
191 begin = (unsigned long) &_stext;
192 begin &= ~((8 * 1024 * 1024) - 1);
193 end = begin + (8 * 1024 * 1024);
194
195 local_irq_save(flags);
196
197 set_c0_config(RM7K_CONF_TE);
198
199 /* Fill size-multiple lines with a valid tag */
200 pow2 = (256 * 1024);
201 for (addr = begin; addr <= end; addr = (begin + pow2)) {
202 unsigned long *p = (unsigned long *) addr;
203 __asm__ __volatile__("nop" : : "r" (*p));
204 pow2 <<= 1;
205 }
206
207 /* Load first line with a 0 tag, to check after */
208 write_c0_taglo(0);
209 write_c0_taghi(0);
210 cache_op(Index_Store_Tag_T, begin);
211
212 /* Look for the wrap-around */
213 pow2 = (512 * 1024);
214 for (addr = begin + (512 * 1024); addr <= end; addr = begin + pow2) {
215 cache_op(Index_Load_Tag_T, addr);
216 if (!read_c0_taglo())
217 break;
218 pow2 <<= 1;
219 }
220
221 addr -= begin;
222 tcache_size = addr;
223
224 clear_c0_config(RM7K_CONF_TE);
225
226 local_irq_restore(flags);
227}
228
131void __cpuinit rm7k_sc_init(void) 229void __cpuinit rm7k_sc_init(void)
132{ 230{
133 struct cpuinfo_mips *c = &current_cpu_data; 231 struct cpuinfo_mips *c = &current_cpu_data;
@@ -147,27 +245,26 @@ void __cpuinit rm7k_sc_init(void)
147 if (!(config & RM7K_CONF_SE)) 245 if (!(config & RM7K_CONF_SE))
148 rm7k_sc_enable(); 246 rm7k_sc_enable();
149 247
248 bcops = &rm7k_sc_ops;
249
150 /* 250 /*
151 * While we're at it let's deal with the tertiary cache. 251 * While we're at it let's deal with the tertiary cache.
152 */ 252 */
153 if (!(config & RM7K_CONF_TC)) {
154
155 /*
156 * We can't enable the L3 cache yet. There may be board-specific
157 * magic necessary to turn it on, and blindly asking the CPU to
158 * start using it would may give cache errors.
159 *
160 * Also, board-specific knowledge may allow us to use the
161 * CACHE Flash_Invalidate_T instruction if the tag RAM supports
162 * it, and may specify the size of the L3 cache so we don't have
163 * to probe it.
164 */
165 printk(KERN_INFO "Tertiary cache present, %s enabled\n",
166 (config & RM7K_CONF_TE) ? "already" : "not (yet)");
167
168 if ((config & RM7K_CONF_TE))
169 rm7k_tcache_enabled = 1;
170 }
171 253
172 bcops = &rm7k_sc_ops; 254 rm7k_tcache_init = 0;
255 tcache_size = 0;
256
257 if (config & RM7K_CONF_TC)
258 return;
259
260 /*
261 * No efficient way to ask the hardware for the size of the tcache,
262 * so must probe for it.
263 */
264 run_uncached(__probe_tcache);
265 rm7k_tc_enable();
266 rm7k_tcache_init = 1;
267 c->tcache.linesz = tc_lsize;
268 c->tcache.ways = 1;
269 pr_info("Tertiary cache size %ldK.\n", (tcache_size >> 10));
173} 270}
diff --git a/arch/mips/mm/tlbex.c b/arch/mips/mm/tlbex.c
index 86f004dc8355..4510e61883eb 100644
--- a/arch/mips/mm/tlbex.c
+++ b/arch/mips/mm/tlbex.c
@@ -409,6 +409,11 @@ static void __cpuinit build_tlb_write_entry(u32 **p, struct uasm_label **l,
409 tlbw(p); 409 tlbw(p);
410 break; 410 break;
411 411
412 case CPU_JZRISC:
413 tlbw(p);
414 uasm_i_nop(p);
415 break;
416
412 default: 417 default:
413 panic("No TLB refill handler yet (CPU type: %d)", 418 panic("No TLB refill handler yet (CPU type: %d)",
414 current_cpu_data.cputype); 419 current_cpu_data.cputype);
diff --git a/arch/mips/mm/uasm.c b/arch/mips/mm/uasm.c
index 611d564fdcf1..d2647a4e012b 100644
--- a/arch/mips/mm/uasm.c
+++ b/arch/mips/mm/uasm.c
@@ -62,12 +62,13 @@ enum opcode {
62 insn_beql, insn_bgez, insn_bgezl, insn_bltz, insn_bltzl, 62 insn_beql, insn_bgez, insn_bgezl, insn_bltz, insn_bltzl,
63 insn_bne, insn_cache, insn_daddu, insn_daddiu, insn_dmfc0, 63 insn_bne, insn_cache, insn_daddu, insn_daddiu, insn_dmfc0,
64 insn_dmtc0, insn_dsll, insn_dsll32, insn_dsra, insn_dsrl, 64 insn_dmtc0, insn_dsll, insn_dsll32, insn_dsra, insn_dsrl,
65 insn_dsrl32, insn_drotr, insn_dsubu, insn_eret, insn_j, insn_jal, 65 insn_dsrl32, insn_drotr, insn_drotr32, insn_dsubu, insn_eret,
66 insn_jr, insn_ld, insn_ll, insn_lld, insn_lui, insn_lw, insn_mfc0, 66 insn_j, insn_jal, insn_jr, insn_ld, insn_ll, insn_lld,
67 insn_mtc0, insn_or, insn_ori, insn_pref, insn_rfe, insn_sc, insn_scd, 67 insn_lui, insn_lw, insn_mfc0, insn_mtc0, insn_or, insn_ori,
68 insn_sd, insn_sll, insn_sra, insn_srl, insn_rotr, insn_subu, insn_sw, 68 insn_pref, insn_rfe, insn_sc, insn_scd, insn_sd, insn_sll,
69 insn_tlbp, insn_tlbr, insn_tlbwi, insn_tlbwr, insn_xor, insn_xori, 69 insn_sra, insn_srl, insn_rotr, insn_subu, insn_sw, insn_tlbp,
70 insn_dins, insn_syscall 70 insn_tlbr, insn_tlbwi, insn_tlbwr, insn_xor, insn_xori,
71 insn_dins, insn_syscall, insn_bbit0, insn_bbit1
71}; 72};
72 73
73struct insn { 74struct insn {
@@ -85,7 +86,7 @@ struct insn {
85 | (e) << RE_SH \ 86 | (e) << RE_SH \
86 | (f) << FUNC_SH) 87 | (f) << FUNC_SH)
87 88
88static struct insn insn_table[] __cpuinitdata = { 89static struct insn insn_table[] __uasminitdata = {
89 { insn_addiu, M(addiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM }, 90 { insn_addiu, M(addiu_op, 0, 0, 0, 0, 0), RS | RT | SIMM },
90 { insn_addu, M(spec_op, 0, 0, 0, 0, addu_op), RS | RT | RD }, 91 { insn_addu, M(spec_op, 0, 0, 0, 0, addu_op), RS | RT | RD },
91 { insn_and, M(spec_op, 0, 0, 0, 0, and_op), RS | RT | RD }, 92 { insn_and, M(spec_op, 0, 0, 0, 0, and_op), RS | RT | RD },
@@ -108,6 +109,7 @@ static struct insn insn_table[] __cpuinitdata = {
108 { insn_dsrl, M(spec_op, 0, 0, 0, 0, dsrl_op), RT | RD | RE }, 109 { insn_dsrl, M(spec_op, 0, 0, 0, 0, dsrl_op), RT | RD | RE },
109 { insn_dsrl32, M(spec_op, 0, 0, 0, 0, dsrl32_op), RT | RD | RE }, 110 { insn_dsrl32, M(spec_op, 0, 0, 0, 0, dsrl32_op), RT | RD | RE },
110 { insn_drotr, M(spec_op, 1, 0, 0, 0, dsrl_op), RT | RD | RE }, 111 { insn_drotr, M(spec_op, 1, 0, 0, 0, dsrl_op), RT | RD | RE },
112 { insn_drotr32, M(spec_op, 1, 0, 0, 0, dsrl32_op), RT | RD | RE },
111 { insn_dsubu, M(spec_op, 0, 0, 0, 0, dsubu_op), RS | RT | RD }, 113 { insn_dsubu, M(spec_op, 0, 0, 0, 0, dsubu_op), RS | RT | RD },
112 { insn_eret, M(cop0_op, cop_op, 0, 0, 0, eret_op), 0 }, 114 { insn_eret, M(cop0_op, cop_op, 0, 0, 0, eret_op), 0 },
113 { insn_j, M(j_op, 0, 0, 0, 0, 0), JIMM }, 115 { insn_j, M(j_op, 0, 0, 0, 0, 0), JIMM },
@@ -141,12 +143,14 @@ static struct insn insn_table[] __cpuinitdata = {
141 { insn_xori, M(xori_op, 0, 0, 0, 0, 0), RS | RT | UIMM }, 143 { insn_xori, M(xori_op, 0, 0, 0, 0, 0), RS | RT | UIMM },
142 { insn_dins, M(spec3_op, 0, 0, 0, 0, dins_op), RS | RT | RD | RE }, 144 { insn_dins, M(spec3_op, 0, 0, 0, 0, dins_op), RS | RT | RD | RE },
143 { insn_syscall, M(spec_op, 0, 0, 0, 0, syscall_op), SCIMM}, 145 { insn_syscall, M(spec_op, 0, 0, 0, 0, syscall_op), SCIMM},
146 { insn_bbit0, M(lwc2_op, 0, 0, 0, 0, 0), RS | RT | BIMM },
147 { insn_bbit1, M(swc2_op, 0, 0, 0, 0, 0), RS | RT | BIMM },
144 { insn_invalid, 0, 0 } 148 { insn_invalid, 0, 0 }
145}; 149};
146 150
147#undef M 151#undef M
148 152
149static inline __cpuinit u32 build_rs(u32 arg) 153static inline __uasminit u32 build_rs(u32 arg)
150{ 154{
151 if (arg & ~RS_MASK) 155 if (arg & ~RS_MASK)
152 printk(KERN_WARNING "Micro-assembler field overflow\n"); 156 printk(KERN_WARNING "Micro-assembler field overflow\n");
@@ -154,7 +158,7 @@ static inline __cpuinit u32 build_rs(u32 arg)
154 return (arg & RS_MASK) << RS_SH; 158 return (arg & RS_MASK) << RS_SH;
155} 159}
156 160
157static inline __cpuinit u32 build_rt(u32 arg) 161static inline __uasminit u32 build_rt(u32 arg)
158{ 162{
159 if (arg & ~RT_MASK) 163 if (arg & ~RT_MASK)
160 printk(KERN_WARNING "Micro-assembler field overflow\n"); 164 printk(KERN_WARNING "Micro-assembler field overflow\n");
@@ -162,7 +166,7 @@ static inline __cpuinit u32 build_rt(u32 arg)
162 return (arg & RT_MASK) << RT_SH; 166 return (arg & RT_MASK) << RT_SH;
163} 167}
164 168
165static inline __cpuinit u32 build_rd(u32 arg) 169static inline __uasminit u32 build_rd(u32 arg)
166{ 170{
167 if (arg & ~RD_MASK) 171 if (arg & ~RD_MASK)
168 printk(KERN_WARNING "Micro-assembler field overflow\n"); 172 printk(KERN_WARNING "Micro-assembler field overflow\n");
@@ -170,7 +174,7 @@ static inline __cpuinit u32 build_rd(u32 arg)
170 return (arg & RD_MASK) << RD_SH; 174 return (arg & RD_MASK) << RD_SH;
171} 175}
172 176
173static inline __cpuinit u32 build_re(u32 arg) 177static inline __uasminit u32 build_re(u32 arg)
174{ 178{
175 if (arg & ~RE_MASK) 179 if (arg & ~RE_MASK)
176 printk(KERN_WARNING "Micro-assembler field overflow\n"); 180 printk(KERN_WARNING "Micro-assembler field overflow\n");
@@ -178,7 +182,7 @@ static inline __cpuinit u32 build_re(u32 arg)
178 return (arg & RE_MASK) << RE_SH; 182 return (arg & RE_MASK) << RE_SH;
179} 183}
180 184
181static inline __cpuinit u32 build_simm(s32 arg) 185static inline __uasminit u32 build_simm(s32 arg)
182{ 186{
183 if (arg > 0x7fff || arg < -0x8000) 187 if (arg > 0x7fff || arg < -0x8000)
184 printk(KERN_WARNING "Micro-assembler field overflow\n"); 188 printk(KERN_WARNING "Micro-assembler field overflow\n");
@@ -186,7 +190,7 @@ static inline __cpuinit u32 build_simm(s32 arg)
186 return arg & 0xffff; 190 return arg & 0xffff;
187} 191}
188 192
189static inline __cpuinit u32 build_uimm(u32 arg) 193static inline __uasminit u32 build_uimm(u32 arg)
190{ 194{
191 if (arg & ~IMM_MASK) 195 if (arg & ~IMM_MASK)
192 printk(KERN_WARNING "Micro-assembler field overflow\n"); 196 printk(KERN_WARNING "Micro-assembler field overflow\n");
@@ -194,7 +198,7 @@ static inline __cpuinit u32 build_uimm(u32 arg)
194 return arg & IMM_MASK; 198 return arg & IMM_MASK;
195} 199}
196 200
197static inline __cpuinit u32 build_bimm(s32 arg) 201static inline __uasminit u32 build_bimm(s32 arg)
198{ 202{
199 if (arg > 0x1ffff || arg < -0x20000) 203 if (arg > 0x1ffff || arg < -0x20000)
200 printk(KERN_WARNING "Micro-assembler field overflow\n"); 204 printk(KERN_WARNING "Micro-assembler field overflow\n");
@@ -205,7 +209,7 @@ static inline __cpuinit u32 build_bimm(s32 arg)
205 return ((arg < 0) ? (1 << 15) : 0) | ((arg >> 2) & 0x7fff); 209 return ((arg < 0) ? (1 << 15) : 0) | ((arg >> 2) & 0x7fff);
206} 210}
207 211
208static inline __cpuinit u32 build_jimm(u32 arg) 212static inline __uasminit u32 build_jimm(u32 arg)
209{ 213{
210 if (arg & ~((JIMM_MASK) << 2)) 214 if (arg & ~((JIMM_MASK) << 2))
211 printk(KERN_WARNING "Micro-assembler field overflow\n"); 215 printk(KERN_WARNING "Micro-assembler field overflow\n");
@@ -213,7 +217,7 @@ static inline __cpuinit u32 build_jimm(u32 arg)
213 return (arg >> 2) & JIMM_MASK; 217 return (arg >> 2) & JIMM_MASK;
214} 218}
215 219
216static inline __cpuinit u32 build_scimm(u32 arg) 220static inline __uasminit u32 build_scimm(u32 arg)
217{ 221{
218 if (arg & ~SCIMM_MASK) 222 if (arg & ~SCIMM_MASK)
219 printk(KERN_WARNING "Micro-assembler field overflow\n"); 223 printk(KERN_WARNING "Micro-assembler field overflow\n");
@@ -221,7 +225,7 @@ static inline __cpuinit u32 build_scimm(u32 arg)
221 return (arg & SCIMM_MASK) << SCIMM_SH; 225 return (arg & SCIMM_MASK) << SCIMM_SH;
222} 226}
223 227
224static inline __cpuinit u32 build_func(u32 arg) 228static inline __uasminit u32 build_func(u32 arg)
225{ 229{
226 if (arg & ~FUNC_MASK) 230 if (arg & ~FUNC_MASK)
227 printk(KERN_WARNING "Micro-assembler field overflow\n"); 231 printk(KERN_WARNING "Micro-assembler field overflow\n");
@@ -229,7 +233,7 @@ static inline __cpuinit u32 build_func(u32 arg)
229 return arg & FUNC_MASK; 233 return arg & FUNC_MASK;
230} 234}
231 235
232static inline __cpuinit u32 build_set(u32 arg) 236static inline __uasminit u32 build_set(u32 arg)
233{ 237{
234 if (arg & ~SET_MASK) 238 if (arg & ~SET_MASK)
235 printk(KERN_WARNING "Micro-assembler field overflow\n"); 239 printk(KERN_WARNING "Micro-assembler field overflow\n");
@@ -241,7 +245,7 @@ static inline __cpuinit u32 build_set(u32 arg)
241 * The order of opcode arguments is implicitly left to right, 245 * The order of opcode arguments is implicitly left to right,
242 * starting with RS and ending with FUNC or IMM. 246 * starting with RS and ending with FUNC or IMM.
243 */ 247 */
244static void __cpuinit build_insn(u32 **buf, enum opcode opc, ...) 248static void __uasminit build_insn(u32 **buf, enum opcode opc, ...)
245{ 249{
246 struct insn *ip = NULL; 250 struct insn *ip = NULL;
247 unsigned int i; 251 unsigned int i;
@@ -291,67 +295,78 @@ static void __cpuinit build_insn(u32 **buf, enum opcode opc, ...)
291Ip_u1u2u3(op) \ 295Ip_u1u2u3(op) \
292{ \ 296{ \
293 build_insn(buf, insn##op, a, b, c); \ 297 build_insn(buf, insn##op, a, b, c); \
294} 298} \
299UASM_EXPORT_SYMBOL(uasm_i##op);
295 300
296#define I_u2u1u3(op) \ 301#define I_u2u1u3(op) \
297Ip_u2u1u3(op) \ 302Ip_u2u1u3(op) \
298{ \ 303{ \
299 build_insn(buf, insn##op, b, a, c); \ 304 build_insn(buf, insn##op, b, a, c); \
300} 305} \
306UASM_EXPORT_SYMBOL(uasm_i##op);
301 307
302#define I_u3u1u2(op) \ 308#define I_u3u1u2(op) \
303Ip_u3u1u2(op) \ 309Ip_u3u1u2(op) \
304{ \ 310{ \
305 build_insn(buf, insn##op, b, c, a); \ 311 build_insn(buf, insn##op, b, c, a); \
306} 312} \
313UASM_EXPORT_SYMBOL(uasm_i##op);
307 314
308#define I_u1u2s3(op) \ 315#define I_u1u2s3(op) \
309Ip_u1u2s3(op) \ 316Ip_u1u2s3(op) \
310{ \ 317{ \
311 build_insn(buf, insn##op, a, b, c); \ 318 build_insn(buf, insn##op, a, b, c); \
312} 319} \
320UASM_EXPORT_SYMBOL(uasm_i##op);
313 321
314#define I_u2s3u1(op) \ 322#define I_u2s3u1(op) \
315Ip_u2s3u1(op) \ 323Ip_u2s3u1(op) \
316{ \ 324{ \
317 build_insn(buf, insn##op, c, a, b); \ 325 build_insn(buf, insn##op, c, a, b); \
318} 326} \
327UASM_EXPORT_SYMBOL(uasm_i##op);
319 328
320#define I_u2u1s3(op) \ 329#define I_u2u1s3(op) \
321Ip_u2u1s3(op) \ 330Ip_u2u1s3(op) \
322{ \ 331{ \
323 build_insn(buf, insn##op, b, a, c); \ 332 build_insn(buf, insn##op, b, a, c); \
324} 333} \
334UASM_EXPORT_SYMBOL(uasm_i##op);
325 335
326#define I_u2u1msbu3(op) \ 336#define I_u2u1msbu3(op) \
327Ip_u2u1msbu3(op) \ 337Ip_u2u1msbu3(op) \
328{ \ 338{ \
329 build_insn(buf, insn##op, b, a, c+d-1, c); \ 339 build_insn(buf, insn##op, b, a, c+d-1, c); \
330} 340} \
341UASM_EXPORT_SYMBOL(uasm_i##op);
331 342
332#define I_u1u2(op) \ 343#define I_u1u2(op) \
333Ip_u1u2(op) \ 344Ip_u1u2(op) \
334{ \ 345{ \
335 build_insn(buf, insn##op, a, b); \ 346 build_insn(buf, insn##op, a, b); \
336} 347} \
348UASM_EXPORT_SYMBOL(uasm_i##op);
337 349
338#define I_u1s2(op) \ 350#define I_u1s2(op) \
339Ip_u1s2(op) \ 351Ip_u1s2(op) \
340{ \ 352{ \
341 build_insn(buf, insn##op, a, b); \ 353 build_insn(buf, insn##op, a, b); \
342} 354} \
355UASM_EXPORT_SYMBOL(uasm_i##op);
343 356
344#define I_u1(op) \ 357#define I_u1(op) \
345Ip_u1(op) \ 358Ip_u1(op) \
346{ \ 359{ \
347 build_insn(buf, insn##op, a); \ 360 build_insn(buf, insn##op, a); \
348} 361} \
362UASM_EXPORT_SYMBOL(uasm_i##op);
349 363
350#define I_0(op) \ 364#define I_0(op) \
351Ip_0(op) \ 365Ip_0(op) \
352{ \ 366{ \
353 build_insn(buf, insn##op); \ 367 build_insn(buf, insn##op); \
354} 368} \
369UASM_EXPORT_SYMBOL(uasm_i##op);
355 370
356I_u2u1s3(_addiu) 371I_u2u1s3(_addiu)
357I_u3u1u2(_addu) 372I_u3u1u2(_addu)
@@ -375,6 +390,7 @@ I_u2u1u3(_dsra)
375I_u2u1u3(_dsrl) 390I_u2u1u3(_dsrl)
376I_u2u1u3(_dsrl32) 391I_u2u1u3(_dsrl32)
377I_u2u1u3(_drotr) 392I_u2u1u3(_drotr)
393I_u2u1u3(_drotr32)
378I_u3u1u2(_dsubu) 394I_u3u1u2(_dsubu)
379I_0(_eret) 395I_0(_eret)
380I_u1(_j) 396I_u1(_j)
@@ -408,16 +424,19 @@ I_u3u1u2(_xor)
408I_u2u1u3(_xori) 424I_u2u1u3(_xori)
409I_u2u1msbu3(_dins); 425I_u2u1msbu3(_dins);
410I_u1(_syscall); 426I_u1(_syscall);
427I_u1u2s3(_bbit0);
428I_u1u2s3(_bbit1);
411 429
412/* Handle labels. */ 430/* Handle labels. */
413void __cpuinit uasm_build_label(struct uasm_label **lab, u32 *addr, int lid) 431void __uasminit uasm_build_label(struct uasm_label **lab, u32 *addr, int lid)
414{ 432{
415 (*lab)->addr = addr; 433 (*lab)->addr = addr;
416 (*lab)->lab = lid; 434 (*lab)->lab = lid;
417 (*lab)++; 435 (*lab)++;
418} 436}
437UASM_EXPORT_SYMBOL(uasm_build_label);
419 438
420int __cpuinit uasm_in_compat_space_p(long addr) 439int __uasminit uasm_in_compat_space_p(long addr)
421{ 440{
422 /* Is this address in 32bit compat space? */ 441 /* Is this address in 32bit compat space? */
423#ifdef CONFIG_64BIT 442#ifdef CONFIG_64BIT
@@ -426,8 +445,9 @@ int __cpuinit uasm_in_compat_space_p(long addr)
426 return 1; 445 return 1;
427#endif 446#endif
428} 447}
448UASM_EXPORT_SYMBOL(uasm_in_compat_space_p);
429 449
430static int __cpuinit uasm_rel_highest(long val) 450static int __uasminit uasm_rel_highest(long val)
431{ 451{
432#ifdef CONFIG_64BIT 452#ifdef CONFIG_64BIT
433 return ((((val + 0x800080008000L) >> 48) & 0xffff) ^ 0x8000) - 0x8000; 453 return ((((val + 0x800080008000L) >> 48) & 0xffff) ^ 0x8000) - 0x8000;
@@ -436,7 +456,7 @@ static int __cpuinit uasm_rel_highest(long val)
436#endif 456#endif
437} 457}
438 458
439static int __cpuinit uasm_rel_higher(long val) 459static int __uasminit uasm_rel_higher(long val)
440{ 460{
441#ifdef CONFIG_64BIT 461#ifdef CONFIG_64BIT
442 return ((((val + 0x80008000L) >> 32) & 0xffff) ^ 0x8000) - 0x8000; 462 return ((((val + 0x80008000L) >> 32) & 0xffff) ^ 0x8000) - 0x8000;
@@ -445,17 +465,19 @@ static int __cpuinit uasm_rel_higher(long val)
445#endif 465#endif
446} 466}
447 467
448int __cpuinit uasm_rel_hi(long val) 468int __uasminit uasm_rel_hi(long val)
449{ 469{
450 return ((((val + 0x8000L) >> 16) & 0xffff) ^ 0x8000) - 0x8000; 470 return ((((val + 0x8000L) >> 16) & 0xffff) ^ 0x8000) - 0x8000;
451} 471}
472UASM_EXPORT_SYMBOL(uasm_rel_hi);
452 473
453int __cpuinit uasm_rel_lo(long val) 474int __uasminit uasm_rel_lo(long val)
454{ 475{
455 return ((val & 0xffff) ^ 0x8000) - 0x8000; 476 return ((val & 0xffff) ^ 0x8000) - 0x8000;
456} 477}
478UASM_EXPORT_SYMBOL(uasm_rel_lo);
457 479
458void __cpuinit UASM_i_LA_mostly(u32 **buf, unsigned int rs, long addr) 480void __uasminit UASM_i_LA_mostly(u32 **buf, unsigned int rs, long addr)
459{ 481{
460 if (!uasm_in_compat_space_p(addr)) { 482 if (!uasm_in_compat_space_p(addr)) {
461 uasm_i_lui(buf, rs, uasm_rel_highest(addr)); 483 uasm_i_lui(buf, rs, uasm_rel_highest(addr));
@@ -470,8 +492,9 @@ void __cpuinit UASM_i_LA_mostly(u32 **buf, unsigned int rs, long addr)
470 } else 492 } else
471 uasm_i_lui(buf, rs, uasm_rel_hi(addr)); 493 uasm_i_lui(buf, rs, uasm_rel_hi(addr));
472} 494}
495UASM_EXPORT_SYMBOL(UASM_i_LA_mostly);
473 496
474void __cpuinit UASM_i_LA(u32 **buf, unsigned int rs, long addr) 497void __uasminit UASM_i_LA(u32 **buf, unsigned int rs, long addr)
475{ 498{
476 UASM_i_LA_mostly(buf, rs, addr); 499 UASM_i_LA_mostly(buf, rs, addr);
477 if (uasm_rel_lo(addr)) { 500 if (uasm_rel_lo(addr)) {
@@ -481,9 +504,10 @@ void __cpuinit UASM_i_LA(u32 **buf, unsigned int rs, long addr)
481 uasm_i_addiu(buf, rs, rs, uasm_rel_lo(addr)); 504 uasm_i_addiu(buf, rs, rs, uasm_rel_lo(addr));
482 } 505 }
483} 506}
507UASM_EXPORT_SYMBOL(UASM_i_LA);
484 508
485/* Handle relocations. */ 509/* Handle relocations. */
486void __cpuinit 510void __uasminit
487uasm_r_mips_pc16(struct uasm_reloc **rel, u32 *addr, int lid) 511uasm_r_mips_pc16(struct uasm_reloc **rel, u32 *addr, int lid)
488{ 512{
489 (*rel)->addr = addr; 513 (*rel)->addr = addr;
@@ -491,8 +515,9 @@ uasm_r_mips_pc16(struct uasm_reloc **rel, u32 *addr, int lid)
491 (*rel)->lab = lid; 515 (*rel)->lab = lid;
492 (*rel)++; 516 (*rel)++;
493} 517}
518UASM_EXPORT_SYMBOL(uasm_r_mips_pc16);
494 519
495static inline void __cpuinit 520static inline void __uasminit
496__resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab) 521__resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab)
497{ 522{
498 long laddr = (long)lab->addr; 523 long laddr = (long)lab->addr;
@@ -509,7 +534,7 @@ __resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab)
509 } 534 }
510} 535}
511 536
512void __cpuinit 537void __uasminit
513uasm_resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab) 538uasm_resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab)
514{ 539{
515 struct uasm_label *l; 540 struct uasm_label *l;
@@ -519,24 +544,27 @@ uasm_resolve_relocs(struct uasm_reloc *rel, struct uasm_label *lab)
519 if (rel->lab == l->lab) 544 if (rel->lab == l->lab)
520 __resolve_relocs(rel, l); 545 __resolve_relocs(rel, l);
521} 546}
547UASM_EXPORT_SYMBOL(uasm_resolve_relocs);
522 548
523void __cpuinit 549void __uasminit
524uasm_move_relocs(struct uasm_reloc *rel, u32 *first, u32 *end, long off) 550uasm_move_relocs(struct uasm_reloc *rel, u32 *first, u32 *end, long off)
525{ 551{
526 for (; rel->lab != UASM_LABEL_INVALID; rel++) 552 for (; rel->lab != UASM_LABEL_INVALID; rel++)
527 if (rel->addr >= first && rel->addr < end) 553 if (rel->addr >= first && rel->addr < end)
528 rel->addr += off; 554 rel->addr += off;
529} 555}
556UASM_EXPORT_SYMBOL(uasm_move_relocs);
530 557
531void __cpuinit 558void __uasminit
532uasm_move_labels(struct uasm_label *lab, u32 *first, u32 *end, long off) 559uasm_move_labels(struct uasm_label *lab, u32 *first, u32 *end, long off)
533{ 560{
534 for (; lab->lab != UASM_LABEL_INVALID; lab++) 561 for (; lab->lab != UASM_LABEL_INVALID; lab++)
535 if (lab->addr >= first && lab->addr < end) 562 if (lab->addr >= first && lab->addr < end)
536 lab->addr += off; 563 lab->addr += off;
537} 564}
565UASM_EXPORT_SYMBOL(uasm_move_labels);
538 566
539void __cpuinit 567void __uasminit
540uasm_copy_handler(struct uasm_reloc *rel, struct uasm_label *lab, u32 *first, 568uasm_copy_handler(struct uasm_reloc *rel, struct uasm_label *lab, u32 *first,
541 u32 *end, u32 *target) 569 u32 *end, u32 *target)
542{ 570{
@@ -547,8 +575,9 @@ uasm_copy_handler(struct uasm_reloc *rel, struct uasm_label *lab, u32 *first,
547 uasm_move_relocs(rel, first, end, off); 575 uasm_move_relocs(rel, first, end, off);
548 uasm_move_labels(lab, first, end, off); 576 uasm_move_labels(lab, first, end, off);
549} 577}
578UASM_EXPORT_SYMBOL(uasm_copy_handler);
550 579
551int __cpuinit uasm_insn_has_bdelay(struct uasm_reloc *rel, u32 *addr) 580int __uasminit uasm_insn_has_bdelay(struct uasm_reloc *rel, u32 *addr)
552{ 581{
553 for (; rel->lab != UASM_LABEL_INVALID; rel++) { 582 for (; rel->lab != UASM_LABEL_INVALID; rel++) {
554 if (rel->addr == addr 583 if (rel->addr == addr
@@ -559,61 +588,88 @@ int __cpuinit uasm_insn_has_bdelay(struct uasm_reloc *rel, u32 *addr)
559 588
560 return 0; 589 return 0;
561} 590}
591UASM_EXPORT_SYMBOL(uasm_insn_has_bdelay);
562 592
563/* Convenience functions for labeled branches. */ 593/* Convenience functions for labeled branches. */
564void __cpuinit 594void __uasminit
565uasm_il_bltz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) 595uasm_il_bltz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid)
566{ 596{
567 uasm_r_mips_pc16(r, *p, lid); 597 uasm_r_mips_pc16(r, *p, lid);
568 uasm_i_bltz(p, reg, 0); 598 uasm_i_bltz(p, reg, 0);
569} 599}
600UASM_EXPORT_SYMBOL(uasm_il_bltz);
570 601
571void __cpuinit 602void __uasminit
572uasm_il_b(u32 **p, struct uasm_reloc **r, int lid) 603uasm_il_b(u32 **p, struct uasm_reloc **r, int lid)
573{ 604{
574 uasm_r_mips_pc16(r, *p, lid); 605 uasm_r_mips_pc16(r, *p, lid);
575 uasm_i_b(p, 0); 606 uasm_i_b(p, 0);
576} 607}
608UASM_EXPORT_SYMBOL(uasm_il_b);
577 609
578void __cpuinit 610void __uasminit
579uasm_il_beqz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) 611uasm_il_beqz(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid)
580{ 612{
581 uasm_r_mips_pc16(r, *p, lid); 613 uasm_r_mips_pc16(r, *p, lid);
582 uasm_i_beqz(p, reg, 0); 614 uasm_i_beqz(p, reg, 0);
583} 615}
616UASM_EXPORT_SYMBOL(uasm_il_beqz);
584 617
585void __cpuinit 618void __uasminit
586uasm_il_beqzl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) 619uasm_il_beqzl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid)
587{ 620{
588 uasm_r_mips_pc16(r, *p, lid); 621 uasm_r_mips_pc16(r, *p, lid);
589 uasm_i_beqzl(p, reg, 0); 622 uasm_i_beqzl(p, reg, 0);
590} 623}
624UASM_EXPORT_SYMBOL(uasm_il_beqzl);
591 625
592void __cpuinit 626void __uasminit
593uasm_il_bne(u32 **p, struct uasm_reloc **r, unsigned int reg1, 627uasm_il_bne(u32 **p, struct uasm_reloc **r, unsigned int reg1,
594 unsigned int reg2, int lid) 628 unsigned int reg2, int lid)
595{ 629{
596 uasm_r_mips_pc16(r, *p, lid); 630 uasm_r_mips_pc16(r, *p, lid);
597 uasm_i_bne(p, reg1, reg2, 0); 631 uasm_i_bne(p, reg1, reg2, 0);
598} 632}
633UASM_EXPORT_SYMBOL(uasm_il_bne);
599 634
600void __cpuinit 635void __uasminit
601uasm_il_bnez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) 636uasm_il_bnez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid)
602{ 637{
603 uasm_r_mips_pc16(r, *p, lid); 638 uasm_r_mips_pc16(r, *p, lid);
604 uasm_i_bnez(p, reg, 0); 639 uasm_i_bnez(p, reg, 0);
605} 640}
641UASM_EXPORT_SYMBOL(uasm_il_bnez);
606 642
607void __cpuinit 643void __uasminit
608uasm_il_bgezl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) 644uasm_il_bgezl(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid)
609{ 645{
610 uasm_r_mips_pc16(r, *p, lid); 646 uasm_r_mips_pc16(r, *p, lid);
611 uasm_i_bgezl(p, reg, 0); 647 uasm_i_bgezl(p, reg, 0);
612} 648}
649UASM_EXPORT_SYMBOL(uasm_il_bgezl);
613 650
614void __cpuinit 651void __uasminit
615uasm_il_bgez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid) 652uasm_il_bgez(u32 **p, struct uasm_reloc **r, unsigned int reg, int lid)
616{ 653{
617 uasm_r_mips_pc16(r, *p, lid); 654 uasm_r_mips_pc16(r, *p, lid);
618 uasm_i_bgez(p, reg, 0); 655 uasm_i_bgez(p, reg, 0);
619} 656}
657UASM_EXPORT_SYMBOL(uasm_il_bgez);
658
659void __uasminit
660uasm_il_bbit0(u32 **p, struct uasm_reloc **r, unsigned int reg,
661 unsigned int bit, int lid)
662{
663 uasm_r_mips_pc16(r, *p, lid);
664 uasm_i_bbit0(p, reg, bit, 0);
665}
666UASM_EXPORT_SYMBOL(uasm_il_bbit0);
667
668void __uasminit
669uasm_il_bbit1(u32 **p, struct uasm_reloc **r, unsigned int reg,
670 unsigned int bit, int lid)
671{
672 uasm_r_mips_pc16(r, *p, lid);
673 uasm_i_bbit1(p, reg, bit, 0);
674}
675UASM_EXPORT_SYMBOL(uasm_il_bbit1);
diff --git a/arch/mips/mti-malta/Makefile b/arch/mips/mti-malta/Makefile
index 32e847808df1..6079ef33b5f0 100644
--- a/arch/mips/mti-malta/Makefile
+++ b/arch/mips/mti-malta/Makefile
@@ -15,5 +15,3 @@ obj-$(CONFIG_PCI) += malta-pci.o
15 15
16# FIXME FIXME FIXME 16# FIXME FIXME FIXME
17obj-$(CONFIG_MIPS_MT_SMTC) += malta-smtc.o 17obj-$(CONFIG_MIPS_MT_SMTC) += malta-smtc.o
18
19EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/mti-malta/Platform b/arch/mips/mti-malta/Platform
new file mode 100644
index 000000000000..5b548b5a4fcf
--- /dev/null
+++ b/arch/mips/mti-malta/Platform
@@ -0,0 +1,7 @@
1#
2# MIPS Malta board
3#
4platform-$(CONFIG_MIPS_MALTA) += mti-malta/
5cflags-$(CONFIG_MIPS_MALTA) += -I$(srctree)/arch/mips/include/asm/mach-malta
6load-$(CONFIG_MIPS_MALTA) += 0xffffffff80100000
7all-$(CONFIG_MIPS_MALTA) := $(COMPRESSION_FNAME).bin
diff --git a/arch/mips/nxp/pnx833x/stb22x/Makefile b/arch/mips/nxp/pnx833x/stb22x/Makefile
deleted file mode 100644
index f81c5801f455..000000000000
--- a/arch/mips/nxp/pnx833x/stb22x/Makefile
+++ /dev/null
@@ -1,3 +0,0 @@
1lib-y := board.o
2
3EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/nxp/pnx8550/jbs/Makefile b/arch/mips/nxp/pnx8550/jbs/Makefile
deleted file mode 100644
index ad6a8ca7d8ce..000000000000
--- a/arch/mips/nxp/pnx8550/jbs/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
1
2# Makefile for the NXP JBS Board.
3
4lib-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/nxp/pnx8550/stb810/Makefile b/arch/mips/nxp/pnx8550/stb810/Makefile
deleted file mode 100644
index ab91d72c5664..000000000000
--- a/arch/mips/nxp/pnx8550/stb810/Makefile
+++ /dev/null
@@ -1,4 +0,0 @@
1
2# Makefile for the NXP STB810 Board.
3
4lib-y := prom_init.o board_setup.o irqmap.o
diff --git a/arch/mips/pci/msi-octeon.c b/arch/mips/pci/msi-octeon.c
index 03742e647657..d8080499872a 100644
--- a/arch/mips/pci/msi-octeon.c
+++ b/arch/mips/pci/msi-octeon.c
@@ -3,7 +3,7 @@
3 * License. See the file "COPYING" in the main directory of this archive 3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details. 4 * for more details.
5 * 5 *
6 * Copyright (C) 2005-2009 Cavium Networks 6 * Copyright (C) 2005-2009, 2010 Cavium Networks
7 */ 7 */
8#include <linux/kernel.h> 8#include <linux/kernel.h>
9#include <linux/init.h> 9#include <linux/init.h>
@@ -22,7 +22,7 @@
22 * Each bit in msi_free_irq_bitmask represents a MSI interrupt that is 22 * Each bit in msi_free_irq_bitmask represents a MSI interrupt that is
23 * in use. 23 * in use.
24 */ 24 */
25static uint64_t msi_free_irq_bitmask; 25static u64 msi_free_irq_bitmask[4];
26 26
27/* 27/*
28 * Each bit in msi_multiple_irq_bitmask tells that the device using 28 * Each bit in msi_multiple_irq_bitmask tells that the device using
@@ -30,7 +30,7 @@ static uint64_t msi_free_irq_bitmask;
30 * is used so we can disable all of the MSI interrupts when a device 30 * is used so we can disable all of the MSI interrupts when a device
31 * uses multiple. 31 * uses multiple.
32 */ 32 */
33static uint64_t msi_multiple_irq_bitmask; 33static u64 msi_multiple_irq_bitmask[4];
34 34
35/* 35/*
36 * This lock controls updates to msi_free_irq_bitmask and 36 * This lock controls updates to msi_free_irq_bitmask and
@@ -38,6 +38,11 @@ static uint64_t msi_multiple_irq_bitmask;
38 */ 38 */
39static DEFINE_SPINLOCK(msi_free_irq_bitmask_lock); 39static DEFINE_SPINLOCK(msi_free_irq_bitmask_lock);
40 40
41/*
42 * Number of MSI IRQs used. This variable is set up in
43 * the module init time.
44 */
45static int msi_irq_size;
41 46
42/** 47/**
43 * Called when a driver request MSI interrupts instead of the 48 * Called when a driver request MSI interrupts instead of the
@@ -54,12 +59,13 @@ static DEFINE_SPINLOCK(msi_free_irq_bitmask_lock);
54int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc) 59int arch_setup_msi_irq(struct pci_dev *dev, struct msi_desc *desc)
55{ 60{
56 struct msi_msg msg; 61 struct msi_msg msg;
57 uint16_t control; 62 u16 control;
58 int configured_private_bits; 63 int configured_private_bits;
59 int request_private_bits; 64 int request_private_bits;
60 int irq; 65 int irq = 0;
61 int irq_step; 66 int irq_step;
62 uint64_t search_mask; 67 u64 search_mask;
68 int index;
63 69
64 /* 70 /*
65 * Read the MSI config to figure out how many IRQs this device 71 * Read the MSI config to figure out how many IRQs this device
@@ -111,29 +117,31 @@ try_only_one:
111 * use. 117 * use.
112 */ 118 */
113 spin_lock(&msi_free_irq_bitmask_lock); 119 spin_lock(&msi_free_irq_bitmask_lock);
114 for (irq = 0; irq < 64; irq += irq_step) { 120 for (index = 0; index < msi_irq_size/64; index++) {
115 if ((msi_free_irq_bitmask & (search_mask << irq)) == 0) { 121 for (irq = 0; irq < 64; irq += irq_step) {
116 msi_free_irq_bitmask |= search_mask << irq; 122 if ((msi_free_irq_bitmask[index] & (search_mask << irq)) == 0) {
117 msi_multiple_irq_bitmask |= (search_mask >> 1) << irq; 123 msi_free_irq_bitmask[index] |= search_mask << irq;
118 break; 124 msi_multiple_irq_bitmask[index] |= (search_mask >> 1) << irq;
125 goto msi_irq_allocated;
126 }
119 } 127 }
120 } 128 }
129msi_irq_allocated:
121 spin_unlock(&msi_free_irq_bitmask_lock); 130 spin_unlock(&msi_free_irq_bitmask_lock);
122 131
123 /* Make sure the search for available interrupts didn't fail */ 132 /* Make sure the search for available interrupts didn't fail */
124 if (irq >= 64) { 133 if (irq >= 64) {
125 if (request_private_bits) { 134 if (request_private_bits) {
126 pr_err("arch_setup_msi_irq: Unable to find %d free " 135 pr_err("arch_setup_msi_irq: Unable to find %d free interrupts, trying just one",
127 "interrupts, trying just one",
128 1 << request_private_bits); 136 1 << request_private_bits);
129 request_private_bits = 0; 137 request_private_bits = 0;
130 goto try_only_one; 138 goto try_only_one;
131 } else 139 } else
132 panic("arch_setup_msi_irq: Unable to find a free MSI " 140 panic("arch_setup_msi_irq: Unable to find a free MSI interrupt");
133 "interrupt");
134 } 141 }
135 142
136 /* MSI interrupts start at logical IRQ OCTEON_IRQ_MSI_BIT0 */ 143 /* MSI interrupts start at logical IRQ OCTEON_IRQ_MSI_BIT0 */
144 irq += index*64;
137 irq += OCTEON_IRQ_MSI_BIT0; 145 irq += OCTEON_IRQ_MSI_BIT0;
138 146
139 switch (octeon_dma_bar_type) { 147 switch (octeon_dma_bar_type) {
@@ -169,6 +177,34 @@ try_only_one:
169 return 0; 177 return 0;
170} 178}
171 179
180int arch_setup_msi_irqs(struct pci_dev *dev, int nvec, int type)
181{
182 struct msi_desc *entry;
183 int ret;
184
185 /*
186 * MSI-X is not supported.
187 */
188 if (type == PCI_CAP_ID_MSIX)
189 return -EINVAL;
190
191 /*
192 * If an architecture wants to support multiple MSI, it needs to
193 * override arch_setup_msi_irqs()
194 */
195 if (type == PCI_CAP_ID_MSI && nvec > 1)
196 return 1;
197
198 list_for_each_entry(entry, &dev->msi_list, list) {
199 ret = arch_setup_msi_irq(dev, entry);
200 if (ret < 0)
201 return ret;
202 if (ret > 0)
203 return -ENOSPC;
204 }
205
206 return 0;
207}
172 208
173/** 209/**
174 * Called when a device no longer needs its MSI interrupts. All 210 * Called when a device no longer needs its MSI interrupts. All
@@ -179,12 +215,18 @@ try_only_one:
179void arch_teardown_msi_irq(unsigned int irq) 215void arch_teardown_msi_irq(unsigned int irq)
180{ 216{
181 int number_irqs; 217 int number_irqs;
182 uint64_t bitmask; 218 u64 bitmask;
219 int index = 0;
220 int irq0;
183 221
184 if ((irq < OCTEON_IRQ_MSI_BIT0) || (irq > OCTEON_IRQ_MSI_BIT63)) 222 if ((irq < OCTEON_IRQ_MSI_BIT0)
223 || (irq > msi_irq_size + OCTEON_IRQ_MSI_BIT0))
185 panic("arch_teardown_msi_irq: Attempted to teardown illegal " 224 panic("arch_teardown_msi_irq: Attempted to teardown illegal "
186 "MSI interrupt (%d)", irq); 225 "MSI interrupt (%d)", irq);
226
187 irq -= OCTEON_IRQ_MSI_BIT0; 227 irq -= OCTEON_IRQ_MSI_BIT0;
228 index = irq / 64;
229 irq0 = irq % 64;
188 230
189 /* 231 /*
190 * Count the number of IRQs we need to free by looking at the 232 * Count the number of IRQs we need to free by looking at the
@@ -192,97 +234,198 @@ void arch_teardown_msi_irq(unsigned int irq)
192 * IRQ is also owned by this device. 234 * IRQ is also owned by this device.
193 */ 235 */
194 number_irqs = 0; 236 number_irqs = 0;
195 while ((irq+number_irqs < 64) && 237 while ((irq0 + number_irqs < 64) &&
196 (msi_multiple_irq_bitmask & (1ull << (irq + number_irqs)))) 238 (msi_multiple_irq_bitmask[index]
239 & (1ull << (irq0 + number_irqs))))
197 number_irqs++; 240 number_irqs++;
198 number_irqs++; 241 number_irqs++;
199 /* Mask with one bit for each IRQ */ 242 /* Mask with one bit for each IRQ */
200 bitmask = (1 << number_irqs) - 1; 243 bitmask = (1 << number_irqs) - 1;
201 /* Shift the mask to the correct bit location */ 244 /* Shift the mask to the correct bit location */
202 bitmask <<= irq; 245 bitmask <<= irq0;
203 if ((msi_free_irq_bitmask & bitmask) != bitmask) 246 if ((msi_free_irq_bitmask[index] & bitmask) != bitmask)
204 panic("arch_teardown_msi_irq: Attempted to teardown MSI " 247 panic("arch_teardown_msi_irq: Attempted to teardown MSI "
205 "interrupt (%d) not in use", irq); 248 "interrupt (%d) not in use", irq);
206 249
207 /* Checks are done, update the in use bitmask */ 250 /* Checks are done, update the in use bitmask */
208 spin_lock(&msi_free_irq_bitmask_lock); 251 spin_lock(&msi_free_irq_bitmask_lock);
209 msi_free_irq_bitmask &= ~bitmask; 252 msi_free_irq_bitmask[index] &= ~bitmask;
210 msi_multiple_irq_bitmask &= ~bitmask; 253 msi_multiple_irq_bitmask[index] &= ~bitmask;
211 spin_unlock(&msi_free_irq_bitmask_lock); 254 spin_unlock(&msi_free_irq_bitmask_lock);
212} 255}
213 256
257static DEFINE_RAW_SPINLOCK(octeon_irq_msi_lock);
258
259static u64 msi_rcv_reg[4];
260static u64 mis_ena_reg[4];
261
262static void octeon_irq_msi_enable_pcie(unsigned int irq)
263{
264 u64 en;
265 unsigned long flags;
266 int msi_number = irq - OCTEON_IRQ_MSI_BIT0;
267 int irq_index = msi_number >> 6;
268 int irq_bit = msi_number & 0x3f;
269
270 raw_spin_lock_irqsave(&octeon_irq_msi_lock, flags);
271 en = cvmx_read_csr(mis_ena_reg[irq_index]);
272 en |= 1ull << irq_bit;
273 cvmx_write_csr(mis_ena_reg[irq_index], en);
274 cvmx_read_csr(mis_ena_reg[irq_index]);
275 raw_spin_unlock_irqrestore(&octeon_irq_msi_lock, flags);
276}
277
278static void octeon_irq_msi_disable_pcie(unsigned int irq)
279{
280 u64 en;
281 unsigned long flags;
282 int msi_number = irq - OCTEON_IRQ_MSI_BIT0;
283 int irq_index = msi_number >> 6;
284 int irq_bit = msi_number & 0x3f;
285
286 raw_spin_lock_irqsave(&octeon_irq_msi_lock, flags);
287 en = cvmx_read_csr(mis_ena_reg[irq_index]);
288 en &= ~(1ull << irq_bit);
289 cvmx_write_csr(mis_ena_reg[irq_index], en);
290 cvmx_read_csr(mis_ena_reg[irq_index]);
291 raw_spin_unlock_irqrestore(&octeon_irq_msi_lock, flags);
292}
293
294static struct irq_chip octeon_irq_chip_msi_pcie = {
295 .name = "MSI",
296 .enable = octeon_irq_msi_enable_pcie,
297 .disable = octeon_irq_msi_disable_pcie,
298};
299
300static void octeon_irq_msi_enable_pci(unsigned int irq)
301{
302 /*
303 * Octeon PCI doesn't have the ability to mask/unmask MSI
304 * interrupts individually. Instead of masking/unmasking them
305 * in groups of 16, we simple assume MSI devices are well
306 * behaved. MSI interrupts are always enable and the ACK is
307 * assumed to be enough
308 */
309}
310
311static void octeon_irq_msi_disable_pci(unsigned int irq)
312{
313 /* See comment in enable */
314}
315
316static struct irq_chip octeon_irq_chip_msi_pci = {
317 .name = "MSI",
318 .enable = octeon_irq_msi_enable_pci,
319 .disable = octeon_irq_msi_disable_pci,
320};
214 321
215/* 322/*
216 * Called by the interrupt handling code when an MSI interrupt 323 * Called by the interrupt handling code when an MSI interrupt
217 * occurs. 324 * occurs.
218 */ 325 */
219static irqreturn_t octeon_msi_interrupt(int cpl, void *dev_id) 326static irqreturn_t __octeon_msi_do_interrupt(int index, u64 msi_bits)
220{ 327{
221 uint64_t msi_bits;
222 int irq; 328 int irq;
329 int bit;
223 330
224 if (octeon_dma_bar_type == OCTEON_DMA_BAR_TYPE_PCIE) 331 bit = fls64(msi_bits);
225 msi_bits = cvmx_read_csr(CVMX_PEXP_NPEI_MSI_RCV0); 332 if (bit) {
226 else 333 bit--;
227 msi_bits = cvmx_read_csr(CVMX_NPI_NPI_MSI_RCV); 334 /* Acknowledge it first. */
228 irq = fls64(msi_bits); 335 cvmx_write_csr(msi_rcv_reg[index], 1ull << bit);
229 if (irq) { 336
230 irq += OCTEON_IRQ_MSI_BIT0 - 1; 337 irq = bit + OCTEON_IRQ_MSI_BIT0 + 64 * index;
231 if (irq_desc[irq].action) { 338 do_IRQ(irq);
232 do_IRQ(irq); 339 return IRQ_HANDLED;
233 return IRQ_HANDLED;
234 } else {
235 pr_err("Spurious MSI interrupt %d\n", irq);
236 if (octeon_has_feature(OCTEON_FEATURE_PCIE)) {
237 /* These chips have PCIe */
238 cvmx_write_csr(CVMX_PEXP_NPEI_MSI_RCV0,
239 1ull << (irq -
240 OCTEON_IRQ_MSI_BIT0));
241 } else {
242 /* These chips have PCI */
243 cvmx_write_csr(CVMX_NPI_NPI_MSI_RCV,
244 1ull << (irq -
245 OCTEON_IRQ_MSI_BIT0));
246 }
247 }
248 } 340 }
249 return IRQ_NONE; 341 return IRQ_NONE;
250} 342}
251 343
344#define OCTEON_MSI_INT_HANDLER_X(x) \
345static irqreturn_t octeon_msi_interrupt##x(int cpl, void *dev_id) \
346{ \
347 u64 msi_bits = cvmx_read_csr(msi_rcv_reg[(x)]); \
348 return __octeon_msi_do_interrupt((x), msi_bits); \
349}
350
351/*
352 * Create octeon_msi_interrupt{0-3} function body
353 */
354OCTEON_MSI_INT_HANDLER_X(0);
355OCTEON_MSI_INT_HANDLER_X(1);
356OCTEON_MSI_INT_HANDLER_X(2);
357OCTEON_MSI_INT_HANDLER_X(3);
252 358
253/* 359/*
254 * Initializes the MSI interrupt handling code 360 * Initializes the MSI interrupt handling code
255 */ 361 */
256int octeon_msi_initialize(void) 362int __init octeon_msi_initialize(void)
257{ 363{
364 int irq;
365 struct irq_chip *msi;
366
367 if (octeon_dma_bar_type == OCTEON_DMA_BAR_TYPE_PCIE) {
368 msi_rcv_reg[0] = CVMX_PEXP_NPEI_MSI_RCV0;
369 msi_rcv_reg[1] = CVMX_PEXP_NPEI_MSI_RCV1;
370 msi_rcv_reg[2] = CVMX_PEXP_NPEI_MSI_RCV2;
371 msi_rcv_reg[3] = CVMX_PEXP_NPEI_MSI_RCV3;
372 mis_ena_reg[0] = CVMX_PEXP_NPEI_MSI_ENB0;
373 mis_ena_reg[1] = CVMX_PEXP_NPEI_MSI_ENB1;
374 mis_ena_reg[2] = CVMX_PEXP_NPEI_MSI_ENB2;
375 mis_ena_reg[3] = CVMX_PEXP_NPEI_MSI_ENB3;
376 msi = &octeon_irq_chip_msi_pcie;
377 } else {
378 msi_rcv_reg[0] = CVMX_NPI_NPI_MSI_RCV;
379#define INVALID_GENERATE_ADE 0x8700000000000000ULL;
380 msi_rcv_reg[1] = INVALID_GENERATE_ADE;
381 msi_rcv_reg[2] = INVALID_GENERATE_ADE;
382 msi_rcv_reg[3] = INVALID_GENERATE_ADE;
383 mis_ena_reg[0] = INVALID_GENERATE_ADE;
384 mis_ena_reg[1] = INVALID_GENERATE_ADE;
385 mis_ena_reg[2] = INVALID_GENERATE_ADE;
386 mis_ena_reg[3] = INVALID_GENERATE_ADE;
387 msi = &octeon_irq_chip_msi_pci;
388 }
389
390 for (irq = OCTEON_IRQ_MSI_BIT0; irq <= OCTEON_IRQ_MSI_LAST; irq++)
391 set_irq_chip_and_handler(irq, msi, handle_simple_irq);
392
258 if (octeon_has_feature(OCTEON_FEATURE_PCIE)) { 393 if (octeon_has_feature(OCTEON_FEATURE_PCIE)) {
259 if (request_irq(OCTEON_IRQ_PCI_MSI0, octeon_msi_interrupt, 394 if (request_irq(OCTEON_IRQ_PCI_MSI0, octeon_msi_interrupt0,
260 IRQF_SHARED, 395 0, "MSI[0:63]", octeon_msi_interrupt0))
261 "MSI[0:63]", octeon_msi_interrupt))
262 panic("request_irq(OCTEON_IRQ_PCI_MSI0) failed"); 396 panic("request_irq(OCTEON_IRQ_PCI_MSI0) failed");
397
398 if (request_irq(OCTEON_IRQ_PCI_MSI1, octeon_msi_interrupt1,
399 0, "MSI[64:127]", octeon_msi_interrupt1))
400 panic("request_irq(OCTEON_IRQ_PCI_MSI1) failed");
401
402 if (request_irq(OCTEON_IRQ_PCI_MSI2, octeon_msi_interrupt2,
403 0, "MSI[127:191]", octeon_msi_interrupt2))
404 panic("request_irq(OCTEON_IRQ_PCI_MSI2) failed");
405
406 if (request_irq(OCTEON_IRQ_PCI_MSI3, octeon_msi_interrupt3,
407 0, "MSI[192:255]", octeon_msi_interrupt3))
408 panic("request_irq(OCTEON_IRQ_PCI_MSI3) failed");
409
410 msi_irq_size = 256;
263 } else if (octeon_is_pci_host()) { 411 } else if (octeon_is_pci_host()) {
264 if (request_irq(OCTEON_IRQ_PCI_MSI0, octeon_msi_interrupt, 412 if (request_irq(OCTEON_IRQ_PCI_MSI0, octeon_msi_interrupt0,
265 IRQF_SHARED, 413 0, "MSI[0:15]", octeon_msi_interrupt0))
266 "MSI[0:15]", octeon_msi_interrupt))
267 panic("request_irq(OCTEON_IRQ_PCI_MSI0) failed"); 414 panic("request_irq(OCTEON_IRQ_PCI_MSI0) failed");
268 415
269 if (request_irq(OCTEON_IRQ_PCI_MSI1, octeon_msi_interrupt, 416 if (request_irq(OCTEON_IRQ_PCI_MSI1, octeon_msi_interrupt0,
270 IRQF_SHARED, 417 0, "MSI[16:31]", octeon_msi_interrupt0))
271 "MSI[16:31]", octeon_msi_interrupt))
272 panic("request_irq(OCTEON_IRQ_PCI_MSI1) failed"); 418 panic("request_irq(OCTEON_IRQ_PCI_MSI1) failed");
273 419
274 if (request_irq(OCTEON_IRQ_PCI_MSI2, octeon_msi_interrupt, 420 if (request_irq(OCTEON_IRQ_PCI_MSI2, octeon_msi_interrupt0,
275 IRQF_SHARED, 421 0, "MSI[32:47]", octeon_msi_interrupt0))
276 "MSI[32:47]", octeon_msi_interrupt))
277 panic("request_irq(OCTEON_IRQ_PCI_MSI2) failed"); 422 panic("request_irq(OCTEON_IRQ_PCI_MSI2) failed");
278 423
279 if (request_irq(OCTEON_IRQ_PCI_MSI3, octeon_msi_interrupt, 424 if (request_irq(OCTEON_IRQ_PCI_MSI3, octeon_msi_interrupt0,
280 IRQF_SHARED, 425 0, "MSI[48:63]", octeon_msi_interrupt0))
281 "MSI[48:63]", octeon_msi_interrupt))
282 panic("request_irq(OCTEON_IRQ_PCI_MSI3) failed"); 426 panic("request_irq(OCTEON_IRQ_PCI_MSI3) failed");
283 427 msi_irq_size = 64;
284 } 428 }
285 return 0; 429 return 0;
286} 430}
287
288subsys_initcall(octeon_msi_initialize); 431subsys_initcall(octeon_msi_initialize);
diff --git a/arch/mips/pci/ops-titan-ht.c b/arch/mips/pci/ops-titan-ht.c
index 749c1922d420..57d54adc9e20 100644
--- a/arch/mips/pci/ops-titan-ht.c
+++ b/arch/mips/pci/ops-titan-ht.c
@@ -32,7 +32,7 @@
32#include <asm/titan_dep.h> 32#include <asm/titan_dep.h>
33 33
34static int titan_ht_config_read_dword(struct pci_bus *bus, unsigned int devfn, 34static int titan_ht_config_read_dword(struct pci_bus *bus, unsigned int devfn,
35 int offset, u32 * val) 35 int offset, u32 *val)
36{ 36{
37 volatile uint32_t address; 37 volatile uint32_t address;
38 int busno; 38 int busno;
@@ -64,7 +64,7 @@ static int titan_ht_config_read_dword(struct pci_bus *bus, unsigned int devfn,
64} 64}
65 65
66static int titan_ht_config_read(struct pci_bus *bus, unsigned int devfn, 66static int titan_ht_config_read(struct pci_bus *bus, unsigned int devfn,
67 int offset, int size, u32 * val) 67 int offset, int size, u32 *val)
68{ 68{
69 uint32_t dword; 69 uint32_t dword;
70 70
diff --git a/arch/mips/pci/pcie-octeon.c b/arch/mips/pci/pcie-octeon.c
index 6aa5c542d52d..861361e0c9af 100644
--- a/arch/mips/pci/pcie-octeon.c
+++ b/arch/mips/pci/pcie-octeon.c
@@ -402,6 +402,10 @@ static void __cvmx_pcie_rc_initialize_config_space(int pcie_port)
402 npei_ctl_status2.s.mps = 0; 402 npei_ctl_status2.s.mps = 0;
403 /* Max read request size = 128 bytes for best Octeon DMA performance */ 403 /* Max read request size = 128 bytes for best Octeon DMA performance */
404 npei_ctl_status2.s.mrrs = 0; 404 npei_ctl_status2.s.mrrs = 0;
405 if (pcie_port)
406 npei_ctl_status2.s.c1_b1_s = 3; /* Port1 BAR1 Size 256MB */
407 else
408 npei_ctl_status2.s.c0_b1_s = 3; /* Port0 BAR1 Size 256MB */
405 cvmx_write_csr(CVMX_PEXP_NPEI_CTL_STATUS2, npei_ctl_status2.u64); 409 cvmx_write_csr(CVMX_PEXP_NPEI_CTL_STATUS2, npei_ctl_status2.u64);
406 410
407 /* ECRC Generation (PCIE*_CFG070[GE,CE]) */ 411 /* ECRC Generation (PCIE*_CFG070[GE,CE]) */
@@ -666,6 +670,8 @@ static int __cvmx_pcie_rc_initialize_link(int pcie_port)
666static int cvmx_pcie_rc_initialize(int pcie_port) 670static int cvmx_pcie_rc_initialize(int pcie_port)
667{ 671{
668 int i; 672 int i;
673 int base;
674 u64 addr_swizzle;
669 union cvmx_ciu_soft_prst ciu_soft_prst; 675 union cvmx_ciu_soft_prst ciu_soft_prst;
670 union cvmx_pescx_bist_status pescx_bist_status; 676 union cvmx_pescx_bist_status pescx_bist_status;
671 union cvmx_pescx_bist_status2 pescx_bist_status2; 677 union cvmx_pescx_bist_status2 pescx_bist_status2;
@@ -674,6 +680,7 @@ static int cvmx_pcie_rc_initialize(int pcie_port)
674 union cvmx_npei_mem_access_subidx mem_access_subid; 680 union cvmx_npei_mem_access_subidx mem_access_subid;
675 union cvmx_npei_dbg_data npei_dbg_data; 681 union cvmx_npei_dbg_data npei_dbg_data;
676 union cvmx_pescx_ctl_status2 pescx_ctl_status2; 682 union cvmx_pescx_ctl_status2 pescx_ctl_status2;
683 union cvmx_npei_bar1_indexx bar1_index;
677 684
678 /* 685 /*
679 * Make sure we aren't trying to setup a target mode interface 686 * Make sure we aren't trying to setup a target mode interface
@@ -918,12 +925,30 @@ static int cvmx_pcie_rc_initialize(int pcie_port)
918 /* Set Octeon's BAR0 to decode 0-16KB. It overlaps with Bar2 */ 925 /* Set Octeon's BAR0 to decode 0-16KB. It overlaps with Bar2 */
919 cvmx_write_csr(CVMX_PESCX_P2N_BAR0_START(pcie_port), 0); 926 cvmx_write_csr(CVMX_PESCX_P2N_BAR0_START(pcie_port), 0);
920 927
921 /* 928 /* BAR1 follows BAR2 with a gap. */
922 * Disable Octeon's BAR1. It isn't needed in RC mode since 929 cvmx_write_csr(CVMX_PESCX_P2N_BAR1_START(pcie_port), CVMX_PCIE_BAR1_RC_BASE);
923 * BAR2 maps all of memory. BAR2 also maps 256MB-512MB into 930
924 * the 2nd 256MB of memory. 931 bar1_index.u32 = 0;
925 */ 932 bar1_index.s.addr_idx = (CVMX_PCIE_BAR1_PHYS_BASE >> 22);
926 cvmx_write_csr(CVMX_PESCX_P2N_BAR1_START(pcie_port), -1); 933 bar1_index.s.ca = 1; /* Not Cached */
934 bar1_index.s.end_swp = 1; /* Endian Swap mode */
935 bar1_index.s.addr_v = 1; /* Valid entry */
936
937 base = pcie_port ? 16 : 0;
938
939 /* Big endian swizzle for 32-bit PEXP_NCB register. */
940#ifdef __MIPSEB__
941 addr_swizzle = 4;
942#else
943 addr_swizzle = 0;
944#endif
945 for (i = 0; i < 16; i++) {
946 cvmx_write64_uint32((CVMX_PEXP_NPEI_BAR1_INDEXX(base) ^ addr_swizzle),
947 bar1_index.u32);
948 base++;
949 /* 256MB / 16 >> 22 == 4 */
950 bar1_index.s.addr_idx += (((1ull << 28) / 16ull) >> 22);
951 }
927 952
928 /* 953 /*
929 * Set Octeon's BAR2 to decode 0-2^39. Bar0 and Bar1 take 954 * Set Octeon's BAR2 to decode 0-2^39. Bar0 and Bar1 take
diff --git a/arch/mips/pmc-sierra/Platform b/arch/mips/pmc-sierra/Platform
new file mode 100644
index 000000000000..f092f2524c5f
--- /dev/null
+++ b/arch/mips/pmc-sierra/Platform
@@ -0,0 +1,14 @@
1#
2# PMC-Sierra MSP SOCs
3#
4platform-$(CONFIG_PMC_MSP) += pmc-sierra/msp71xx/
5cflags-$(CONFIG_PMC_MSP) += -I$(srctree)/arch/mips/include/asm/pmc-sierra/msp71xx \
6 -mno-branch-likely
7load-$(CONFIG_PMC_MSP) += 0xffffffff80100000
8
9#
10# PMC-Sierra Yosemite
11#
12platform-$(CONFIG_PMC_YOSEMITE) += pmc-sierra/yosemite/
13cflags-$(CONFIG_PMC_YOSEMITE) += -I$(srctree)/arch/mips/include/asm/mach-yosemite
14load-$(CONFIG_PMC_YOSEMITE) += 0xffffffff80100000
diff --git a/arch/mips/pmc-sierra/msp71xx/msp_hwbutton.c b/arch/mips/pmc-sierra/msp71xx/msp_hwbutton.c
index 11769b55438c..c841f083a7f5 100644
--- a/arch/mips/pmc-sierra/msp71xx/msp_hwbutton.c
+++ b/arch/mips/pmc-sierra/msp71xx/msp_hwbutton.c
@@ -32,9 +32,6 @@
32#include <msp_int.h> 32#include <msp_int.h>
33#include <msp_regs.h> 33#include <msp_regs.h>
34#include <msp_regops.h> 34#include <msp_regops.h>
35#ifdef CONFIG_PMCTWILED
36#include <msp_led_macros.h>
37#endif
38 35
39/* For hwbutton_interrupt->initial_state */ 36/* For hwbutton_interrupt->initial_state */
40#define HWBUTTON_HI 0x1 37#define HWBUTTON_HI 0x1
@@ -82,10 +79,6 @@ static void standby_on(void *data)
82 printk(KERN_WARNING "STANDBY switch was set to ON (not implemented)\n"); 79 printk(KERN_WARNING "STANDBY switch was set to ON (not implemented)\n");
83 80
84 /* TODO: Put board in standby mode */ 81 /* TODO: Put board in standby mode */
85#ifdef CONFIG_PMCTWILED
86 msp_led_turn_off(MSP_LED_PWRSTANDBY_GREEN);
87 msp_led_turn_on(MSP_LED_PWRSTANDBY_RED);
88#endif
89} 82}
90 83
91static void standby_off(void *data) 84static void standby_off(void *data)
@@ -94,10 +87,6 @@ static void standby_off(void *data)
94 "STANDBY switch was set to OFF (not implemented)\n"); 87 "STANDBY switch was set to OFF (not implemented)\n");
95 88
96 /* TODO: Take out of standby mode */ 89 /* TODO: Take out of standby mode */
97#ifdef CONFIG_PMCTWILED
98 msp_led_turn_on(MSP_LED_PWRSTANDBY_GREEN);
99 msp_led_turn_off(MSP_LED_PWRSTANDBY_RED);
100#endif
101} 90}
102 91
103static struct hwbutton_interrupt softreset_sw = { 92static struct hwbutton_interrupt softreset_sw = {
diff --git a/arch/mips/pmc-sierra/yosemite/ht-irq.c b/arch/mips/pmc-sierra/yosemite/ht-irq.c
index 5aec4057314e..86b98e98fb4f 100644
--- a/arch/mips/pmc-sierra/yosemite/ht-irq.c
+++ b/arch/mips/pmc-sierra/yosemite/ht-irq.c
@@ -35,18 +35,17 @@
35 */ 35 */
36void __init titan_ht_pcibios_fixup_bus(struct pci_bus *bus) 36void __init titan_ht_pcibios_fixup_bus(struct pci_bus *bus)
37{ 37{
38 struct pci_bus *current_bus = bus; 38 struct pci_bus *current_bus = bus;
39 struct pci_dev *devices; 39 struct pci_dev *devices;
40 struct list_head *devices_link; 40 struct list_head *devices_link;
41 41
42 list_for_each(devices_link, &(current_bus->devices)) { 42 list_for_each(devices_link, &(current_bus->devices)) {
43 devices = pci_dev_b(devices_link); 43 devices = pci_dev_b(devices_link);
44 if (devices == NULL) 44 if (devices == NULL)
45 continue; 45 continue;
46 } 46 }
47 47
48 /* 48 /*
49 * PLX and SPKT related changes go here 49 * PLX and SPKT related changes go here
50 */ 50 */
51
52} 51}
diff --git a/arch/mips/pmc-sierra/yosemite/irq.c b/arch/mips/pmc-sierra/yosemite/irq.c
index 51021cfd04bc..25bbbf428be9 100644
--- a/arch/mips/pmc-sierra/yosemite/irq.c
+++ b/arch/mips/pmc-sierra/yosemite/irq.c
@@ -150,8 +150,4 @@ void __init arch_init_irq(void)
150 mips_cpu_irq_init(); 150 mips_cpu_irq_init();
151 rm7k_cpu_irq_init(); 151 rm7k_cpu_irq_init();
152 rm9k_cpu_irq_init(); 152 rm9k_cpu_irq_init();
153
154#ifdef CONFIG_GDB_CONSOLE
155 register_gdb_console();
156#endif
157} 153}
diff --git a/arch/mips/pnx833x/Makefile b/arch/mips/pnx833x/Makefile
new file mode 100644
index 000000000000..02c4698cab05
--- /dev/null
+++ b/arch/mips/pnx833x/Makefile
@@ -0,0 +1,3 @@
1obj-$(CONFIG_SOC_PNX833X) += common/
2obj-$(CONFIG_NXP_STB220) += stb22x/
3obj-$(CONFIG_NXP_STB225) += stb22x/
diff --git a/arch/mips/pnx833x/Platform b/arch/mips/pnx833x/Platform
new file mode 100644
index 000000000000..7e6ec4dbc8dd
--- /dev/null
+++ b/arch/mips/pnx833x/Platform
@@ -0,0 +1,5 @@
1# NXP STB225
2platform-$(CONFIG_SOC_PNX833X) += pnx833x/
3cflags-$(CONFIG_SOC_PNX833X) += -Iarch/mips/include/asm/mach-pnx833x
4load-$(CONFIG_NXP_STB220) += 0xffffffff80001000
5load-$(CONFIG_NXP_STB225) += 0xffffffff80001000
diff --git a/arch/mips/nxp/pnx833x/common/Makefile b/arch/mips/pnx833x/common/Makefile
index 4a16f3b503b5..1a46dd291b16 100644
--- a/arch/mips/nxp/pnx833x/common/Makefile
+++ b/arch/mips/pnx833x/common/Makefile
@@ -1,3 +1 @@
1obj-y := interrupts.o platform.o prom.o setup.o reset.o obj-y := interrupts.o platform.o prom.o setup.o reset.o
2
3EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/nxp/pnx833x/common/interrupts.c b/arch/mips/pnx833x/common/interrupts.c
index 941916f8aaff..941916f8aaff 100644
--- a/arch/mips/nxp/pnx833x/common/interrupts.c
+++ b/arch/mips/pnx833x/common/interrupts.c
diff --git a/arch/mips/nxp/pnx833x/common/platform.c b/arch/mips/pnx833x/common/platform.c
index 01f8345a2069..01f8345a2069 100644
--- a/arch/mips/nxp/pnx833x/common/platform.c
+++ b/arch/mips/pnx833x/common/platform.c
diff --git a/arch/mips/nxp/pnx833x/common/prom.c b/arch/mips/pnx833x/common/prom.c
index 29969f90a6b0..29969f90a6b0 100644
--- a/arch/mips/nxp/pnx833x/common/prom.c
+++ b/arch/mips/pnx833x/common/prom.c
diff --git a/arch/mips/nxp/pnx833x/common/reset.c b/arch/mips/pnx833x/common/reset.c
index e0ea96d29fde..e0ea96d29fde 100644
--- a/arch/mips/nxp/pnx833x/common/reset.c
+++ b/arch/mips/pnx833x/common/reset.c
diff --git a/arch/mips/nxp/pnx833x/common/setup.c b/arch/mips/pnx833x/common/setup.c
index e51fbc4b644d..e51fbc4b644d 100644
--- a/arch/mips/nxp/pnx833x/common/setup.c
+++ b/arch/mips/pnx833x/common/setup.c
diff --git a/arch/mips/pnx833x/stb22x/Makefile b/arch/mips/pnx833x/stb22x/Makefile
new file mode 100644
index 000000000000..7b580060de50
--- /dev/null
+++ b/arch/mips/pnx833x/stb22x/Makefile
@@ -0,0 +1 @@
obj-y := board.o
diff --git a/arch/mips/nxp/pnx833x/stb22x/board.c b/arch/mips/pnx833x/stb22x/board.c
index 644eb7c3210f..644eb7c3210f 100644
--- a/arch/mips/nxp/pnx833x/stb22x/board.c
+++ b/arch/mips/pnx833x/stb22x/board.c
diff --git a/arch/mips/pnx8550/Makefile b/arch/mips/pnx8550/Makefile
new file mode 100644
index 000000000000..3f7e8561437b
--- /dev/null
+++ b/arch/mips/pnx8550/Makefile
@@ -0,0 +1,3 @@
1obj-$(CONFIG_SOC_PNX8550) += common/
2obj-$(CONFIG_PNX8550_JBS) += jbs/
3obj-$(CONFIG_PNX8550_STB810) += stb810/
diff --git a/arch/mips/pnx8550/Platform b/arch/mips/pnx8550/Platform
new file mode 100644
index 000000000000..0e7fbde768d5
--- /dev/null
+++ b/arch/mips/pnx8550/Platform
@@ -0,0 +1,7 @@
1platform-$(CONFIG_SOC_PNX8550) += pnx8550/
2
3cflags-$(CONFIG_SOC_PNX8550) += \
4 -I$(srctree)/arch/mips/include/asm/mach-pnx8550
5
6load-$(CONFIG_PNX8550_JBS) += 0xffffffff80060000
7load-$(CONFIG_PNX8550_STB810) += 0xffffffff80060000
diff --git a/arch/mips/nxp/pnx8550/common/Makefile b/arch/mips/pnx8550/common/Makefile
index dd9e7b1f7fd3..f8ce695dc54f 100644
--- a/arch/mips/nxp/pnx8550/common/Makefile
+++ b/arch/mips/pnx8550/common/Makefile
@@ -24,5 +24,3 @@
24 24
25obj-y := setup.o prom.o int.o reset.o time.o proc.o platform.o 25obj-y := setup.o prom.o int.o reset.o time.o proc.o platform.o
26obj-$(CONFIG_PCI) += pci.o 26obj-$(CONFIG_PCI) += pci.o
27
28EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/nxp/pnx8550/common/int.c b/arch/mips/pnx8550/common/int.c
index cfed5051dc6d..cfed5051dc6d 100644
--- a/arch/mips/nxp/pnx8550/common/int.c
+++ b/arch/mips/pnx8550/common/int.c
diff --git a/arch/mips/pnx8550/common/pci.c b/arch/mips/pnx8550/common/pci.c
new file mode 100644
index 000000000000..98e86ddb86cc
--- /dev/null
+++ b/arch/mips/pnx8550/common/pci.c
@@ -0,0 +1,134 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 *
5 * Author: source@mvista.com
6 *
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 */
20#include <linux/types.h>
21#include <linux/pci.h>
22#include <linux/kernel.h>
23#include <linux/init.h>
24
25#include <pci.h>
26#include <glb.h>
27#include <nand.h>
28
29static struct resource pci_io_resource = {
30 .start = PNX8550_PCIIO + 0x1000, /* reserve regacy I/O space */
31 .end = PNX8550_PCIIO + PNX8550_PCIIO_SIZE,
32 .name = "pci IO space",
33 .flags = IORESOURCE_IO
34};
35
36static struct resource pci_mem_resource = {
37 .start = PNX8550_PCIMEM,
38 .end = PNX8550_PCIMEM + PNX8550_PCIMEM_SIZE - 1,
39 .name = "pci memory space",
40 .flags = IORESOURCE_MEM
41};
42
43extern struct pci_ops pnx8550_pci_ops;
44
45static struct pci_controller pnx8550_controller = {
46 .pci_ops = &pnx8550_pci_ops,
47 .io_map_base = PNX8550_PORT_BASE,
48 .io_resource = &pci_io_resource,
49 .mem_resource = &pci_mem_resource,
50};
51
52/* Return the total size of DRAM-memory, (RANK0 + RANK1) */
53static inline unsigned long get_system_mem_size(void)
54{
55 /* Read IP2031_RANK0_ADDR_LO */
56 unsigned long dram_r0_lo = inl(PCI_BASE | 0x65010);
57 /* Read IP2031_RANK1_ADDR_HI */
58 unsigned long dram_r1_hi = inl(PCI_BASE | 0x65018);
59
60 return dram_r1_hi - dram_r0_lo + 1;
61}
62
63static int __init pnx8550_pci_setup(void)
64{
65 int pci_mem_code;
66 int mem_size = get_system_mem_size() >> 20;
67
68 /* Clear the Global 2 Register, PCI Inta Output Enable Registers
69 Bit 1:Enable DAC Powerdown
70 -> 0:DACs are enabled and are working normally
71 1:DACs are powerdown
72 Bit 0:Enable of PCI inta output
73 -> 0 = Disable PCI inta output
74 1 = Enable PCI inta output
75 */
76 PNX8550_GLB2_ENAB_INTA_O = 0;
77
78 /* Calc the PCI mem size code */
79 if (mem_size >= 128)
80 pci_mem_code = SIZE_128M;
81 else if (mem_size >= 64)
82 pci_mem_code = SIZE_64M;
83 else if (mem_size >= 32)
84 pci_mem_code = SIZE_32M;
85 else
86 pci_mem_code = SIZE_16M;
87
88 /* Set PCI_XIO registers */
89 outl(pci_mem_resource.start, PCI_BASE | PCI_BASE1_LO);
90 outl(pci_mem_resource.end + 1, PCI_BASE | PCI_BASE1_HI);
91 outl(pci_io_resource.start, PCI_BASE | PCI_BASE2_LO);
92 outl(pci_io_resource.end, PCI_BASE | PCI_BASE2_HI);
93
94 /* Send memory transaction via PCI_BASE2 */
95 outl(0x00000001, PCI_BASE | PCI_IO);
96
97 /* Unlock the setup register */
98 outl(0xca, PCI_BASE | PCI_UNLOCKREG);
99
100 /*
101 * BAR0 of PNX8550 (pci base 10) must be zero in order for ide
102 * to work, and in order for bus_to_baddr to work without any
103 * hacks.
104 */
105 outl(0x00000000, PCI_BASE | PCI_BASE10);
106
107 /*
108 *These two bars are set by default or the boot code.
109 * However, it's safer to set them here so we're not boot
110 * code dependent.
111 */
112 outl(0x1be00000, PCI_BASE | PCI_BASE14); /* PNX MMIO */
113 outl(PNX8550_NAND_BASE_ADDR, PCI_BASE | PCI_BASE18); /* XIO */
114
115 outl(PCI_EN_TA |
116 PCI_EN_PCI2MMI |
117 PCI_EN_XIO |
118 PCI_SETUP_BASE18_SIZE(SIZE_32M) |
119 PCI_SETUP_BASE18_EN |
120 PCI_SETUP_BASE14_EN |
121 PCI_SETUP_BASE10_PREF |
122 PCI_SETUP_BASE10_SIZE(pci_mem_code) |
123 PCI_SETUP_CFGMANAGE_EN |
124 PCI_SETUP_PCIARB_EN,
125 PCI_BASE |
126 PCI_SETUP); /* PCI_SETUP */
127 outl(0x00000000, PCI_BASE | PCI_CTRL); /* PCI_CONTROL */
128
129 register_pci_controller(&pnx8550_controller);
130
131 return 0;
132}
133
134arch_initcall(pnx8550_pci_setup);
diff --git a/arch/mips/nxp/pnx8550/common/platform.c b/arch/mips/pnx8550/common/platform.c
index 5264cc09a27b..5264cc09a27b 100644
--- a/arch/mips/nxp/pnx8550/common/platform.c
+++ b/arch/mips/pnx8550/common/platform.c
diff --git a/arch/mips/nxp/pnx8550/common/proc.c b/arch/mips/pnx8550/common/proc.c
index 3bba5ec828e8..3bba5ec828e8 100644
--- a/arch/mips/nxp/pnx8550/common/proc.c
+++ b/arch/mips/pnx8550/common/proc.c
diff --git a/arch/mips/nxp/pnx8550/common/prom.c b/arch/mips/pnx8550/common/prom.c
index 32f70097c3c7..32f70097c3c7 100644
--- a/arch/mips/nxp/pnx8550/common/prom.c
+++ b/arch/mips/pnx8550/common/prom.c
diff --git a/arch/mips/nxp/pnx8550/common/reset.c b/arch/mips/pnx8550/common/reset.c
index fadd8744a6bc..fadd8744a6bc 100644
--- a/arch/mips/nxp/pnx8550/common/reset.c
+++ b/arch/mips/pnx8550/common/reset.c
diff --git a/arch/mips/pnx8550/common/setup.c b/arch/mips/pnx8550/common/setup.c
new file mode 100644
index 000000000000..64246c9c875c
--- /dev/null
+++ b/arch/mips/pnx8550/common/setup.c
@@ -0,0 +1,145 @@
1/*
2 *
3 * 2.6 port, Embedded Alley Solutions, Inc
4 *
5 * Based on Per Hallsmark, per.hallsmark@mvista.com
6 *
7 * This program is free software; you can distribute it and/or modify it
8 * under the terms of the GNU General Public License (Version 2) as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
19 */
20#include <linux/init.h>
21#include <linux/sched.h>
22#include <linux/ioport.h>
23#include <linux/irq.h>
24#include <linux/mm.h>
25#include <linux/delay.h>
26#include <linux/interrupt.h>
27#include <linux/serial_pnx8xxx.h>
28#include <linux/pm.h>
29
30#include <asm/cpu.h>
31#include <asm/bootinfo.h>
32#include <asm/irq.h>
33#include <asm/mipsregs.h>
34#include <asm/reboot.h>
35#include <asm/pgtable.h>
36#include <asm/time.h>
37
38#include <glb.h>
39#include <int.h>
40#include <pci.h>
41#include <uart.h>
42#include <nand.h>
43
44extern void __init board_setup(void);
45extern void pnx8550_machine_restart(char *);
46extern void pnx8550_machine_halt(void);
47extern void pnx8550_machine_power_off(void);
48extern struct resource ioport_resource;
49extern struct resource iomem_resource;
50extern char *prom_getcmdline(void);
51
52struct resource standard_io_resources[] = {
53 {
54 .start = 0x00,
55 .end = 0x1f,
56 .name = "dma1",
57 .flags = IORESOURCE_BUSY
58 }, {
59 .start = 0x40,
60 .end = 0x5f,
61 .name = "timer",
62 .flags = IORESOURCE_BUSY
63 }, {
64 .start = 0x80,
65 .end = 0x8f,
66 .name = "dma page reg",
67 .flags = IORESOURCE_BUSY
68 }, {
69 .start = 0xc0,
70 .end = 0xdf,
71 .name = "dma2",
72 .flags = IORESOURCE_BUSY
73 },
74};
75
76#define STANDARD_IO_RESOURCES ARRAY_SIZE(standard_io_resources)
77
78extern struct resource pci_io_resource;
79extern struct resource pci_mem_resource;
80
81/* Return the total size of DRAM-memory, (RANK0 + RANK1) */
82unsigned long get_system_mem_size(void)
83{
84 /* Read IP2031_RANK0_ADDR_LO */
85 unsigned long dram_r0_lo = inl(PCI_BASE | 0x65010);
86 /* Read IP2031_RANK1_ADDR_HI */
87 unsigned long dram_r1_hi = inl(PCI_BASE | 0x65018);
88
89 return dram_r1_hi - dram_r0_lo + 1;
90}
91
92int pnx8550_console_port = -1;
93
94void __init plat_mem_setup(void)
95{
96 int i;
97 char* argptr;
98
99 board_setup(); /* board specific setup */
100
101 _machine_restart = pnx8550_machine_restart;
102 _machine_halt = pnx8550_machine_halt;
103 pm_power_off = pnx8550_machine_power_off;
104
105 /* Clear the Global 2 Register, PCI Inta Output Enable Registers
106 Bit 1:Enable DAC Powerdown
107 -> 0:DACs are enabled and are working normally
108 1:DACs are powerdown
109 Bit 0:Enable of PCI inta output
110 -> 0 = Disable PCI inta output
111 1 = Enable PCI inta output
112 */
113 PNX8550_GLB2_ENAB_INTA_O = 0;
114
115 /* IO/MEM resources. */
116 set_io_port_base(PNX8550_PORT_BASE);
117 ioport_resource.start = 0;
118 ioport_resource.end = ~0;
119 iomem_resource.start = 0;
120 iomem_resource.end = ~0;
121
122 /* Request I/O space for devices on this board */
123 for (i = 0; i < STANDARD_IO_RESOURCES; i++)
124 request_resource(&ioport_resource, standard_io_resources + i);
125
126 /* Place the Mode Control bit for GPIO pin 16 in primary function */
127 /* Pin 16 is used by UART1, UA1_TX */
128 outl((PNX8550_GPIO_MODE_PRIMOP << PNX8550_GPIO_MC_16_BIT) |
129 (PNX8550_GPIO_MODE_PRIMOP << PNX8550_GPIO_MC_17_BIT),
130 PNX8550_GPIO_MC1);
131
132 argptr = prom_getcmdline();
133 if ((argptr = strstr(argptr, "console=ttyS")) != NULL) {
134 argptr += strlen("console=ttyS");
135 pnx8550_console_port = *argptr == '0' ? 0 : 1;
136
137 /* We must initialize the UART (console) before early printk */
138 /* Set LCR to 8-bit and BAUD to 38400 (no 5) */
139 ip3106_lcr(UART_BASE, pnx8550_console_port) =
140 PNX8XXX_UART_LCR_8BIT;
141 ip3106_baud(UART_BASE, pnx8550_console_port) = 5;
142 }
143
144 return;
145}
diff --git a/arch/mips/nxp/pnx8550/common/time.c b/arch/mips/pnx8550/common/time.c
index 8836c6203df0..8836c6203df0 100644
--- a/arch/mips/nxp/pnx8550/common/time.c
+++ b/arch/mips/pnx8550/common/time.c
diff --git a/arch/mips/pnx8550/jbs/Makefile b/arch/mips/pnx8550/jbs/Makefile
new file mode 100644
index 000000000000..c4dc3d53eb5c
--- /dev/null
+++ b/arch/mips/pnx8550/jbs/Makefile
@@ -0,0 +1,4 @@
1
2# Makefile for the NXP JBS Board.
3
4obj-y := init.o board_setup.o irqmap.o
diff --git a/arch/mips/nxp/pnx8550/jbs/board_setup.c b/arch/mips/pnx8550/jbs/board_setup.c
index 57dd903ca408..57dd903ca408 100644
--- a/arch/mips/nxp/pnx8550/jbs/board_setup.c
+++ b/arch/mips/pnx8550/jbs/board_setup.c
diff --git a/arch/mips/nxp/pnx8550/jbs/init.c b/arch/mips/pnx8550/jbs/init.c
index d59b4a4e5e8b..d59b4a4e5e8b 100644
--- a/arch/mips/nxp/pnx8550/jbs/init.c
+++ b/arch/mips/pnx8550/jbs/init.c
diff --git a/arch/mips/nxp/pnx8550/jbs/irqmap.c b/arch/mips/pnx8550/jbs/irqmap.c
index 7fc89842002c..7fc89842002c 100644
--- a/arch/mips/nxp/pnx8550/jbs/irqmap.c
+++ b/arch/mips/pnx8550/jbs/irqmap.c
diff --git a/arch/mips/pnx8550/stb810/Makefile b/arch/mips/pnx8550/stb810/Makefile
new file mode 100644
index 000000000000..cb4ff022f1fb
--- /dev/null
+++ b/arch/mips/pnx8550/stb810/Makefile
@@ -0,0 +1,4 @@
1
2# Makefile for the NXP STB810 Board.
3
4obj-y := prom_init.o board_setup.o irqmap.o
diff --git a/arch/mips/nxp/pnx8550/stb810/board_setup.c b/arch/mips/pnx8550/stb810/board_setup.c
index af2a55e0b4e9..af2a55e0b4e9 100644
--- a/arch/mips/nxp/pnx8550/stb810/board_setup.c
+++ b/arch/mips/pnx8550/stb810/board_setup.c
diff --git a/arch/mips/nxp/pnx8550/stb810/irqmap.c b/arch/mips/pnx8550/stb810/irqmap.c
index 8c034963ddcd..8c034963ddcd 100644
--- a/arch/mips/nxp/pnx8550/stb810/irqmap.c
+++ b/arch/mips/pnx8550/stb810/irqmap.c
diff --git a/arch/mips/nxp/pnx8550/stb810/prom_init.c b/arch/mips/pnx8550/stb810/prom_init.c
index ca7f4ada0640..ca7f4ada0640 100644
--- a/arch/mips/nxp/pnx8550/stb810/prom_init.c
+++ b/arch/mips/pnx8550/stb810/prom_init.c
diff --git a/arch/mips/powertv/Makefile b/arch/mips/powertv/Makefile
index 0a0d73c0564f..baf6e9092a9f 100644
--- a/arch/mips/powertv/Makefile
+++ b/arch/mips/powertv/Makefile
@@ -23,6 +23,9 @@
23# under Linux. 23# under Linux.
24# 24#
25 25
26obj-y += init.o memory.o reset.o time.o powertv_setup.o asic/ pci/ 26obj-y += init.o ioremap.o memory.o powertv_setup.o reset.o time.o \
27 asic/ pci/
27 28
28EXTRA_CFLAGS += -Wall -Werror 29obj-$(CONFIG_USB) += powertv-usb.o
30
31EXTRA_CFLAGS += -Wall
diff --git a/arch/mips/powertv/Platform b/arch/mips/powertv/Platform
new file mode 100644
index 000000000000..4eb5af1d8eea
--- /dev/null
+++ b/arch/mips/powertv/Platform
@@ -0,0 +1,7 @@
1#
2# Cisco PowerTV Platform
3#
4platform-$(CONFIG_POWERTV) += powertv/
5cflags-$(CONFIG_POWERTV) += \
6 -I$(srctree)/arch/mips/include/asm/mach-powertv
7load-$(CONFIG_POWERTV) += 0xffffffff90800000
diff --git a/arch/mips/powertv/asic/Makefile b/arch/mips/powertv/asic/Makefile
index bebfdcff0443..f0e95dc0ac97 100644
--- a/arch/mips/powertv/asic/Makefile
+++ b/arch/mips/powertv/asic/Makefile
@@ -16,8 +16,8 @@
16# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 16# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17# 17#
18 18
19obj-y += asic-calliope.o asic-cronus.o asic-zeus.o asic_devices.o asic_int.o \ 19obj-y += asic-calliope.o asic-cronus.o asic-gaia.o asic-zeus.o \
20 irq_asic.o prealloc-calliope.o prealloc-cronus.o \ 20 asic_devices.o asic_int.o irq_asic.o prealloc-calliope.o \
21 prealloc-cronuslite.o prealloc-zeus.o 21 prealloc-cronus.o prealloc-cronuslite.o prealloc-gaia.o prealloc-zeus.o
22 22
23EXTRA_CFLAGS += -Wall -Werror 23EXTRA_CFLAGS += -Wall -Werror
diff --git a/arch/mips/powertv/asic/asic-calliope.c b/arch/mips/powertv/asic/asic-calliope.c
index 1ae6623444b2..0a170e0ffeaa 100644
--- a/arch/mips/powertv/asic/asic-calliope.c
+++ b/arch/mips/powertv/asic/asic-calliope.c
@@ -77,7 +77,7 @@ const struct register_map calliope_register_map __initdata = {
77 .int_docsis_en = {.phys = CALLIOPE_ADDR(0xA028F4)}, 77 .int_docsis_en = {.phys = CALLIOPE_ADDR(0xA028F4)},
78 78
79 .mips_pll_setup = {.phys = CALLIOPE_ADDR(0x980000)}, 79 .mips_pll_setup = {.phys = CALLIOPE_ADDR(0x980000)},
80 .usb_fs = {.phys = CALLIOPE_ADDR(0x980030)}, 80 .fs432x4b4_usb_ctl = {.phys = CALLIOPE_ADDR(0x980030)},
81 .test_bus = {.phys = CALLIOPE_ADDR(0x9800CC)}, 81 .test_bus = {.phys = CALLIOPE_ADDR(0x9800CC)},
82 .crt_spare = {.phys = CALLIOPE_ADDR(0x9800d4)}, 82 .crt_spare = {.phys = CALLIOPE_ADDR(0x9800d4)},
83 .usb2_ohci_int_mask = {.phys = CALLIOPE_ADDR(0x9A000c)}, 83 .usb2_ohci_int_mask = {.phys = CALLIOPE_ADDR(0x9A000c)},
diff --git a/arch/mips/powertv/asic/asic-cronus.c b/arch/mips/powertv/asic/asic-cronus.c
index 5bb64bfb508b..bbc0c122be5e 100644
--- a/arch/mips/powertv/asic/asic-cronus.c
+++ b/arch/mips/powertv/asic/asic-cronus.c
@@ -77,13 +77,13 @@ const struct register_map cronus_register_map __initdata = {
77 .int_docsis_en = {.phys = CRONUS_ADDR(0x2A28F4)}, 77 .int_docsis_en = {.phys = CRONUS_ADDR(0x2A28F4)},
78 78
79 .mips_pll_setup = {.phys = CRONUS_ADDR(0x1C0000)}, 79 .mips_pll_setup = {.phys = CRONUS_ADDR(0x1C0000)},
80 .usb_fs = {.phys = CRONUS_ADDR(0x1C0018)}, 80 .fs432x4b4_usb_ctl = {.phys = CRONUS_ADDR(0x1C0028)},
81 .test_bus = {.phys = CRONUS_ADDR(0x1C00CC)}, 81 .test_bus = {.phys = CRONUS_ADDR(0x1C00CC)},
82 .crt_spare = {.phys = CRONUS_ADDR(0x1c00d4)}, 82 .crt_spare = {.phys = CRONUS_ADDR(0x1c00d4)},
83 .usb2_ohci_int_mask = {.phys = CRONUS_ADDR(0x20000C)}, 83 .usb2_ohci_int_mask = {.phys = CRONUS_ADDR(0x20000C)},
84 .usb2_strap = {.phys = CRONUS_ADDR(0x200014)}, 84 .usb2_strap = {.phys = CRONUS_ADDR(0x200014)},
85 .ehci_hcapbase = {.phys = CRONUS_ADDR(0x21FE00)}, 85 .ehci_hcapbase = {.phys = CRONUS_ADDR(0x21FE00)},
86 .ohci_hc_revision = {.phys = CRONUS_ADDR(0x1E0000)}, 86 .ohci_hc_revision = {.phys = CRONUS_ADDR(0x21fc00)},
87 .bcm1_bs_lmi_steer = {.phys = CRONUS_ADDR(0x2E0008)}, 87 .bcm1_bs_lmi_steer = {.phys = CRONUS_ADDR(0x2E0008)},
88 .usb2_control = {.phys = CRONUS_ADDR(0x2E004C)}, 88 .usb2_control = {.phys = CRONUS_ADDR(0x2E004C)},
89 .usb2_stbus_obc = {.phys = CRONUS_ADDR(0x21FF00)}, 89 .usb2_stbus_obc = {.phys = CRONUS_ADDR(0x21FF00)},
diff --git a/arch/mips/powertv/asic/asic-gaia.c b/arch/mips/powertv/asic/asic-gaia.c
new file mode 100644
index 000000000000..91dda682752c
--- /dev/null
+++ b/arch/mips/powertv/asic/asic-gaia.c
@@ -0,0 +1,96 @@
1/*
2 * Locations of devices in the Gaia ASIC
3 *
4 * Copyright (C) 2005-2009 Scientific-Atlanta, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Author: David VomLehn
21 */
22
23#include <linux/init.h>
24#include <asm/mach-powertv/asic.h>
25
26const struct register_map gaia_register_map __initdata = {
27 .eic_slow0_strt_add = {.phys = GAIA_IO_BASE + 0x000000},
28 .eic_cfg_bits = {.phys = GAIA_IO_BASE + 0x000038},
29 .eic_ready_status = {.phys = GAIA_IO_BASE + 0x00004C},
30
31 .chipver3 = {.phys = GAIA_IO_BASE + 0x2A0800},
32 .chipver2 = {.phys = GAIA_IO_BASE + 0x2A0804},
33 .chipver1 = {.phys = GAIA_IO_BASE + 0x2A0808},
34 .chipver0 = {.phys = GAIA_IO_BASE + 0x2A080C},
35
36 /* The registers of IRBlaster */
37 .uart1_intstat = {.phys = GAIA_IO_BASE + 0x2A1800},
38 .uart1_inten = {.phys = GAIA_IO_BASE + 0x2A1804},
39 .uart1_config1 = {.phys = GAIA_IO_BASE + 0x2A1808},
40 .uart1_config2 = {.phys = GAIA_IO_BASE + 0x2A180C},
41 .uart1_divisorhi = {.phys = GAIA_IO_BASE + 0x2A1810},
42 .uart1_divisorlo = {.phys = GAIA_IO_BASE + 0x2A1814},
43 .uart1_data = {.phys = GAIA_IO_BASE + 0x2A1818},
44 .uart1_status = {.phys = GAIA_IO_BASE + 0x2A181C},
45
46 .int_stat_3 = {.phys = GAIA_IO_BASE + 0x2A2800},
47 .int_stat_2 = {.phys = GAIA_IO_BASE + 0x2A2804},
48 .int_stat_1 = {.phys = GAIA_IO_BASE + 0x2A2808},
49 .int_stat_0 = {.phys = GAIA_IO_BASE + 0x2A280C},
50 .int_config = {.phys = GAIA_IO_BASE + 0x2A2810},
51 .int_int_scan = {.phys = GAIA_IO_BASE + 0x2A2818},
52 .ien_int_3 = {.phys = GAIA_IO_BASE + 0x2A2830},
53 .ien_int_2 = {.phys = GAIA_IO_BASE + 0x2A2834},
54 .ien_int_1 = {.phys = GAIA_IO_BASE + 0x2A2838},
55 .ien_int_0 = {.phys = GAIA_IO_BASE + 0x2A283C},
56 .int_level_3_3 = {.phys = GAIA_IO_BASE + 0x2A2880},
57 .int_level_3_2 = {.phys = GAIA_IO_BASE + 0x2A2884},
58 .int_level_3_1 = {.phys = GAIA_IO_BASE + 0x2A2888},
59 .int_level_3_0 = {.phys = GAIA_IO_BASE + 0x2A288C},
60 .int_level_2_3 = {.phys = GAIA_IO_BASE + 0x2A2890},
61 .int_level_2_2 = {.phys = GAIA_IO_BASE + 0x2A2894},
62 .int_level_2_1 = {.phys = GAIA_IO_BASE + 0x2A2898},
63 .int_level_2_0 = {.phys = GAIA_IO_BASE + 0x2A289C},
64 .int_level_1_3 = {.phys = GAIA_IO_BASE + 0x2A28A0},
65 .int_level_1_2 = {.phys = GAIA_IO_BASE + 0x2A28A4},
66 .int_level_1_1 = {.phys = GAIA_IO_BASE + 0x2A28A8},
67 .int_level_1_0 = {.phys = GAIA_IO_BASE + 0x2A28AC},
68 .int_level_0_3 = {.phys = GAIA_IO_BASE + 0x2A28B0},
69 .int_level_0_2 = {.phys = GAIA_IO_BASE + 0x2A28B4},
70 .int_level_0_1 = {.phys = GAIA_IO_BASE + 0x2A28B8},
71 .int_level_0_0 = {.phys = GAIA_IO_BASE + 0x2A28BC},
72 .int_docsis_en = {.phys = GAIA_IO_BASE + 0x2A28F4},
73
74 .mips_pll_setup = {.phys = GAIA_IO_BASE + 0x1C0000},
75 .fs432x4b4_usb_ctl = {.phys = GAIA_IO_BASE + 0x1C0024},
76 .test_bus = {.phys = GAIA_IO_BASE + 0x1C00CC},
77 .crt_spare = {.phys = GAIA_IO_BASE + 0x1c0108},
78 .usb2_ohci_int_mask = {.phys = GAIA_IO_BASE + 0x20000C},
79 .usb2_strap = {.phys = GAIA_IO_BASE + 0x200014},
80 .ehci_hcapbase = {.phys = GAIA_IO_BASE + 0x21FE00},
81 .ohci_hc_revision = {.phys = GAIA_IO_BASE + 0x21fc00},
82 .bcm1_bs_lmi_steer = {.phys = GAIA_IO_BASE + 0x2E0004},
83 .usb2_control = {.phys = GAIA_IO_BASE + 0x2E004C},
84 .usb2_stbus_obc = {.phys = GAIA_IO_BASE + 0x21FF00},
85 .usb2_stbus_mess_size = {.phys = GAIA_IO_BASE + 0x21FF04},
86 .usb2_stbus_chunk_size = {.phys = GAIA_IO_BASE + 0x21FF08},
87
88 .pcie_regs = {.phys = GAIA_IO_BASE + 0x220000},
89 .tim_ch = {.phys = GAIA_IO_BASE + 0x2A2C10},
90 .tim_cl = {.phys = GAIA_IO_BASE + 0x2A2C14},
91 .gpio_dout = {.phys = GAIA_IO_BASE + 0x2A2C20},
92 .gpio_din = {.phys = GAIA_IO_BASE + 0x2A2C24},
93 .gpio_dir = {.phys = GAIA_IO_BASE + 0x2A2C2C},
94 .watchdog = {.phys = GAIA_IO_BASE + 0x2A2C30},
95 .front_panel = {.phys = GAIA_IO_BASE + 0x2A3800},
96};
diff --git a/arch/mips/powertv/asic/asic-zeus.c b/arch/mips/powertv/asic/asic-zeus.c
index 095cbe10ebb9..4a05bb096476 100644
--- a/arch/mips/powertv/asic/asic-zeus.c
+++ b/arch/mips/powertv/asic/asic-zeus.c
@@ -77,7 +77,7 @@ const struct register_map zeus_register_map __initdata = {
77 .int_docsis_en = {.phys = ZEUS_ADDR(0x2828F4)}, 77 .int_docsis_en = {.phys = ZEUS_ADDR(0x2828F4)},
78 78
79 .mips_pll_setup = {.phys = ZEUS_ADDR(0x1a0000)}, 79 .mips_pll_setup = {.phys = ZEUS_ADDR(0x1a0000)},
80 .usb_fs = {.phys = ZEUS_ADDR(0x1a0018)}, 80 .fs432x4b4_usb_ctl = {.phys = ZEUS_ADDR(0x1a0018)},
81 .test_bus = {.phys = ZEUS_ADDR(0x1a0238)}, 81 .test_bus = {.phys = ZEUS_ADDR(0x1a0238)},
82 .crt_spare = {.phys = ZEUS_ADDR(0x1a0090)}, 82 .crt_spare = {.phys = ZEUS_ADDR(0x1a0090)},
83 .usb2_ohci_int_mask = {.phys = ZEUS_ADDR(0x1e000c)}, 83 .usb2_ohci_int_mask = {.phys = ZEUS_ADDR(0x1e000c)},
diff --git a/arch/mips/powertv/asic/asic_devices.c b/arch/mips/powertv/asic/asic_devices.c
index 9ec523e4dd06..e56fa61b3991 100644
--- a/arch/mips/powertv/asic/asic_devices.c
+++ b/arch/mips/powertv/asic/asic_devices.c
@@ -1,7 +1,6 @@
1/* 1/*
2 * ASIC Device List Intialization
3 * 2 *
4 * Description: Defines the platform resources for the SA settop. 3 * Description: Defines the platform resources for Gaia-based settops.
5 * 4 *
6 * Copyright (C) 2005-2009 Scientific-Atlanta, Inc. 5 * Copyright (C) 2005-2009 Scientific-Atlanta, Inc.
7 * 6 *
@@ -19,11 +18,6 @@
19 * along with this program; if not, write to the Free Software 18 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 * 20 *
22 * Author: Ken Eppinett
23 * David Schleef <ds@schleef.org>
24 *
25 * Description: Defines the platform resources for the SA settop.
26 *
27 * NOTE: The bootloader allocates persistent memory at an address which is 21 * NOTE: The bootloader allocates persistent memory at an address which is
28 * 16 MiB below the end of the highest address in KSEG0. All fixed 22 * 16 MiB below the end of the highest address in KSEG0. All fixed
29 * address memory reservations must avoid this region. 23 * address memory reservations must avoid this region.
@@ -39,7 +33,6 @@
39#include <linux/mm.h> 33#include <linux/mm.h>
40#include <linux/platform_device.h> 34#include <linux/platform_device.h>
41#include <linux/module.h> 35#include <linux/module.h>
42#include <linux/gfp.h>
43#include <asm/page.h> 36#include <asm/page.h>
44#include <linux/swap.h> 37#include <linux/swap.h>
45#include <linux/highmem.h> 38#include <linux/highmem.h>
@@ -74,14 +67,13 @@ unsigned long asic_phy_base;
74unsigned long asic_base; 67unsigned long asic_base;
75EXPORT_SYMBOL(asic_base); /* Exported for testing */ 68EXPORT_SYMBOL(asic_base); /* Exported for testing */
76struct resource *gp_resources; 69struct resource *gp_resources;
77static bool usb_configured;
78 70
79/* 71/*
80 * Don't recommend to use it directly, it is usually used by kernel internally. 72 * Don't recommend to use it directly, it is usually used by kernel internally.
81 * Portable code should be using interfaces such as ioremp, dma_map_single, etc. 73 * Portable code should be using interfaces such as ioremp, dma_map_single, etc.
82 */ 74 */
83unsigned long phys_to_bus_offset; 75unsigned long phys_to_dma_offset;
84EXPORT_SYMBOL(phys_to_bus_offset); 76EXPORT_SYMBOL(phys_to_dma_offset);
85 77
86/* 78/*
87 * 79 *
@@ -97,101 +89,19 @@ struct resource asic_resource = {
97}; 89};
98 90
99/* 91/*
100 *
101 * USB Host Resource Definition
102 *
103 */
104
105static struct resource ehci_resources[] = {
106 {
107 .parent = &asic_resource,
108 .start = 0,
109 .end = 0xff,
110 .flags = IORESOURCE_MEM,
111 },
112 {
113 .start = irq_usbehci,
114 .end = irq_usbehci,
115 .flags = IORESOURCE_IRQ,
116 },
117};
118
119static u64 ehci_dmamask = DMA_BIT_MASK(32);
120
121static struct platform_device ehci_device = {
122 .name = "powertv-ehci",
123 .id = 0,
124 .num_resources = 2,
125 .resource = ehci_resources,
126 .dev = {
127 .dma_mask = &ehci_dmamask,
128 .coherent_dma_mask = DMA_BIT_MASK(32),
129 },
130};
131
132static struct resource ohci_resources[] = {
133 {
134 .parent = &asic_resource,
135 .start = 0,
136 .end = 0xff,
137 .flags = IORESOURCE_MEM,
138 },
139 {
140 .start = irq_usbohci,
141 .end = irq_usbohci,
142 .flags = IORESOURCE_IRQ,
143 },
144};
145
146static u64 ohci_dmamask = DMA_BIT_MASK(32);
147
148static struct platform_device ohci_device = {
149 .name = "powertv-ohci",
150 .id = 0,
151 .num_resources = 2,
152 .resource = ohci_resources,
153 .dev = {
154 .dma_mask = &ohci_dmamask,
155 .coherent_dma_mask = DMA_BIT_MASK(32),
156 },
157};
158
159static struct platform_device *platform_devices[] = {
160 &ehci_device,
161 &ohci_device,
162};
163
164/*
165 *
166 * Platform Configuration and Device Initialization
167 *
168 */
169static void __init fs_update(int pe, int md, int sdiv, int disable_div_by_3)
170{
171 int en_prg, byp, pwr, nsb, val;
172 int sout;
173
174 sout = 1;
175 en_prg = 1;
176 byp = 0;
177 nsb = 1;
178 pwr = 1;
179
180 val = ((sdiv << 29) | (md << 24) | (pe<<8) | (sout<<3) | (byp<<2) |
181 (nsb<<1) | (disable_div_by_3<<5));
182
183 asic_write(val, usb_fs);
184 asic_write(val | (en_prg<<4), usb_fs);
185 asic_write(val | (en_prg<<4) | pwr, usb_fs);
186}
187
188/*
189 * Allow override of bootloader-specified model 92 * Allow override of bootloader-specified model
93 * Returns zero on success, a negative errno value on failure. This parameter
94 * allows overriding of the bootloader-specified model.
190 */ 95 */
191static char __initdata cmdline[COMMAND_LINE_SIZE]; 96static char __initdata cmdline[COMMAND_LINE_SIZE];
192 97
193#define FORCEFAMILY_PARAM "forcefamily" 98#define FORCEFAMILY_PARAM "forcefamily"
194 99
100/*
101 * check_forcefamily - check for, and parse, forcefamily command line parameter
102 * @forced_family: Pointer to two-character array in which to store the
103 * value of the forcedfamily parameter, if any.
104 */
195static __init int check_forcefamily(unsigned char forced_family[2]) 105static __init int check_forcefamily(unsigned char forced_family[2])
196{ 106{
197 const char *p; 107 const char *p;
@@ -231,14 +141,10 @@ static __init int check_forcefamily(unsigned char forced_family[2])
231 */ 141 */
232static __init noinline void platform_set_family(void) 142static __init noinline void platform_set_family(void)
233{ 143{
234#define BOOTLDRFAMILY(byte1, byte0) (((byte1) << 8) | (byte0))
235
236 unsigned char forced_family[2]; 144 unsigned char forced_family[2];
237 unsigned short bootldr_family; 145 unsigned short bootldr_family;
238 146
239 check_forcefamily(forced_family); 147 if (check_forcefamily(forced_family) == 0)
240
241 if (forced_family[0] != '\0' && forced_family[1] != '\0')
242 bootldr_family = BOOTLDRFAMILY(forced_family[0], 148 bootldr_family = BOOTLDRFAMILY(forced_family[0],
243 forced_family[1]); 149 forced_family[1]);
244 else { 150 else {
@@ -289,6 +195,9 @@ static __init noinline void platform_set_family(void)
289 case BOOTLDRFAMILY('F', '1'): 195 case BOOTLDRFAMILY('F', '1'):
290 platform_family = FAMILY_1500VZF; 196 platform_family = FAMILY_1500VZF;
291 break; 197 break;
198 case BOOTLDRFAMILY('8', '7'):
199 platform_family = FAMILY_8700;
200 break;
292 default: 201 default:
293 platform_family = -1; 202 platform_family = -1;
294 } 203 }
@@ -301,24 +210,9 @@ unsigned int platform_get_family(void)
301EXPORT_SYMBOL(platform_get_family); 210EXPORT_SYMBOL(platform_get_family);
302 211
303/* 212/*
304 * \brief usb_eye_configure() for optimizing the USB eye on Calliope.
305 *
306 * \param unsigned int value saved to the register.
307 *
308 * \return none
309 *
310 */
311static void __init usb_eye_configure(unsigned int value)
312{
313 asic_write(asic_read(crt_spare) | value, crt_spare);
314}
315
316/*
317 * platform_get_asic - determine the ASIC type. 213 * platform_get_asic - determine the ASIC type.
318 * 214 *
319 * \param none 215 * Returns the ASIC type, or ASIC_UNKNOWN if unknown
320 *
321 * \return ASIC type; ASIC_UNKNOWN if none
322 * 216 *
323 */ 217 */
324enum asic_type platform_get_asic(void) 218enum asic_type platform_get_asic(void)
@@ -328,93 +222,10 @@ enum asic_type platform_get_asic(void)
328EXPORT_SYMBOL(platform_get_asic); 222EXPORT_SYMBOL(platform_get_asic);
329 223
330/* 224/*
331 * platform_configure_usb - usb configuration based on platform type. 225 * set_register_map - set ASIC register configuration
332 * @bcm1_usb2_ctl: value for the BCM1_USB2_CTL register, which is 226 * @phys_base: Physical address of the base of the ASIC registers
333 * quirky 227 * @map: Description of key ASIC registers
334 */
335static void __init platform_configure_usb(void)
336{
337 u32 bcm1_usb2_ctl;
338
339 if (usb_configured)
340 return;
341
342 switch (asic) {
343 case ASIC_ZEUS:
344 case ASIC_CRONUS:
345 case ASIC_CRONUSLITE:
346 fs_update(0x0000, 0x11, 0x02, 0);
347 bcm1_usb2_ctl = 0x803;
348 break;
349
350 case ASIC_CALLIOPE:
351 fs_update(0x0000, 0x11, 0x02, 1);
352
353 switch (platform_family) {
354 case FAMILY_1500VZE:
355 break;
356
357 case FAMILY_1500VZF:
358 usb_eye_configure(0x003c0000);
359 break;
360
361 default:
362 usb_eye_configure(0x00300000);
363 break;
364 }
365
366 bcm1_usb2_ctl = 0x803;
367 break;
368
369 default:
370 pr_err("Unknown ASIC type: %d\n", asic);
371 break;
372 }
373
374 /* turn on USB power */
375 asic_write(0, usb2_strap);
376 /* Enable all OHCI interrupts */
377 asic_write(bcm1_usb2_ctl, usb2_control);
378 /* USB2_STBUS_OBC store32/load32 */
379 asic_write(3, usb2_stbus_obc);
380 /* USB2_STBUS_MESS_SIZE 2 packets */
381 asic_write(1, usb2_stbus_mess_size);
382 /* USB2_STBUS_CHUNK_SIZE 2 packets */
383 asic_write(1, usb2_stbus_chunk_size);
384
385 usb_configured = true;
386}
387
388/*
389 * Set up the USB EHCI interface
390 */ 228 */
391void platform_configure_usb_ehci()
392{
393 platform_configure_usb();
394}
395
396/*
397 * Set up the USB OHCI interface
398 */
399void platform_configure_usb_ohci()
400{
401 platform_configure_usb();
402}
403
404/*
405 * Shut the USB EHCI interface down--currently a NOP
406 */
407void platform_unconfigure_usb_ehci()
408{
409}
410
411/*
412 * Shut the USB OHCI interface down--currently a NOP
413 */
414void platform_unconfigure_usb_ohci()
415{
416}
417
418static void __init set_register_map(unsigned long phys_base, 229static void __init set_register_map(unsigned long phys_base,
419 const struct register_map *map) 230 const struct register_map *map)
420{ 231{
@@ -526,6 +337,15 @@ void __init configure_platform(void)
526 "DVR_CAPABLE\n"); 337 "DVR_CAPABLE\n");
527 break; 338 break;
528 339
340 case FAMILY_8700:
341 platform_features = FFS_CAPABLE | PCIE_CAPABLE;
342 asic = ASIC_GAIA;
343 set_register_map(GAIA_IO_BASE, &gaia_register_map);
344 gp_resources = dvr_gaia_resources;
345
346 pr_info("Platform: 8700 - GAIA, DVR_CAPABLE\n");
347 break;
348
529 default: 349 default:
530 pr_crit("Platform: UNKNOWN PLATFORM\n"); 350 pr_crit("Platform: UNKNOWN PLATFORM\n");
531 break; 351 break;
@@ -533,10 +353,10 @@ void __init configure_platform(void)
533 353
534 switch (asic) { 354 switch (asic) {
535 case ASIC_ZEUS: 355 case ASIC_ZEUS:
536 phys_to_bus_offset = 0x30000000; 356 phys_to_dma_offset = 0x30000000;
537 break; 357 break;
538 case ASIC_CALLIOPE: 358 case ASIC_CALLIOPE:
539 phys_to_bus_offset = 0x10000000; 359 phys_to_dma_offset = 0x10000000;
540 break; 360 break;
541 case ASIC_CRONUSLITE: 361 case ASIC_CRONUSLITE:
542 /* Fall through */ 362 /* Fall through */
@@ -546,42 +366,16 @@ void __init configure_platform(void)
546 * 0x2XXXXXXX. If 0x10000000 aliases into 0x60000000- 366 * 0x2XXXXXXX. If 0x10000000 aliases into 0x60000000-
547 * 0x6XXXXXXX, the offset should be 0x50000000, not 0x10000000. 367 * 0x6XXXXXXX, the offset should be 0x50000000, not 0x10000000.
548 */ 368 */
549 phys_to_bus_offset = 0x10000000; 369 phys_to_dma_offset = 0x10000000;
550 break; 370 break;
551 default: 371 default:
552 phys_to_bus_offset = 0x00000000; 372 phys_to_dma_offset = 0x00000000;
553 break; 373 break;
554 } 374 }
555} 375}
556 376
557/**
558 * platform_devices_init - sets up USB device resourse.
559 */
560static int __init platform_devices_init(void)
561{
562 pr_notice("%s: ----- Initializing USB resources -----\n", __func__);
563
564 asic_resource.start = asic_phy_base;
565 asic_resource.end += asic_resource.start;
566
567 ehci_resources[0].start = asic_reg_phys_addr(ehci_hcapbase);
568 ehci_resources[0].end += ehci_resources[0].start;
569
570 ohci_resources[0].start = asic_reg_phys_addr(ohci_hc_revision);
571 ohci_resources[0].end += ohci_resources[0].start;
572
573 set_io_port_base(0);
574
575 platform_add_devices(platform_devices, ARRAY_SIZE(platform_devices));
576
577 return 0;
578}
579
580arch_initcall(platform_devices_init);
581
582/* 377/*
583 * 378 * RESOURCE ALLOCATION
584 * BOOTMEM ALLOCATION
585 * 379 *
586 */ 380 */
587/* 381/*
@@ -603,7 +397,7 @@ void __init platform_alloc_bootmem(void)
603 int size = gp_resources[i].end - gp_resources[i].start + 1; 397 int size = gp_resources[i].end - gp_resources[i].start + 1;
604 if ((gp_resources[i].start != 0) && 398 if ((gp_resources[i].start != 0) &&
605 ((gp_resources[i].flags & IORESOURCE_MEM) != 0)) { 399 ((gp_resources[i].flags & IORESOURCE_MEM) != 0)) {
606 reserve_bootmem(bus_to_phys(gp_resources[i].start), 400 reserve_bootmem(dma_to_phys(gp_resources[i].start),
607 size, 0); 401 size, 0);
608 total += gp_resources[i].end - 402 total += gp_resources[i].end -
609 gp_resources[i].start + 1; 403 gp_resources[i].start + 1;
@@ -627,7 +421,7 @@ void __init platform_alloc_bootmem(void)
627 421
628 else { 422 else {
629 gp_resources[i].start = 423 gp_resources[i].start =
630 phys_to_bus(virt_to_phys(mem)); 424 phys_to_dma(virt_to_phys(mem));
631 gp_resources[i].end = 425 gp_resources[i].end =
632 gp_resources[i].start + size - 1; 426 gp_resources[i].start + size - 1;
633 total += size; 427 total += size;
@@ -691,7 +485,7 @@ static void __init pmem_setup_resource(void)
691 if (resource && pmemaddr && pmemlen) { 485 if (resource && pmemaddr && pmemlen) {
692 /* The address provided by bootloader is in kseg0. Convert to 486 /* The address provided by bootloader is in kseg0. Convert to
693 * a bus address. */ 487 * a bus address. */
694 resource->start = phys_to_bus(pmemaddr - 0x80000000); 488 resource->start = phys_to_dma(pmemaddr - 0x80000000);
695 resource->end = resource->start + pmemlen - 1; 489 resource->end = resource->start + pmemlen - 1;
696 490
697 pr_info("persistent memory: start=0x%x end=0x%x\n", 491 pr_info("persistent memory: start=0x%x end=0x%x\n",
diff --git a/arch/mips/powertv/asic/prealloc-gaia.c b/arch/mips/powertv/asic/prealloc-gaia.c
new file mode 100644
index 000000000000..8ac8c7aeb986
--- /dev/null
+++ b/arch/mips/powertv/asic/prealloc-gaia.c
@@ -0,0 +1,589 @@
1/*
2 * Memory pre-allocations for Gaia boxes.
3 *
4 * Copyright (C) 2005-2009 Scientific-Atlanta, Inc.
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 * Author: David VomLehn
21 */
22
23#include <linux/init.h>
24#include <asm/mach-powertv/asic.h>
25
26/*
27 * DVR_CAPABLE GAIA RESOURCES
28 */
29struct resource dvr_gaia_resources[] __initdata = {
30 /*
31 *
32 * VIDEO1 / LX1
33 *
34 */
35 {
36 .name = "ST231aImage", /* Delta-Mu 1 image and ram */
37 .start = 0x24000000,
38 .end = 0x241FFFFF, /* 2MiB */
39 .flags = IORESOURCE_MEM,
40 },
41 {
42 .name = "ST231aMonitor", /* 8KiB block ST231a monitor */
43 .start = 0x24200000,
44 .end = 0x24201FFF,
45 .flags = IORESOURCE_MEM,
46 },
47 {
48 .name = "MediaMemory1",
49 .start = 0x24202000,
50 .end = 0x25FFFFFF, /*~29.9MiB (32MiB - (2MiB + 8KiB)) */
51 .flags = IORESOURCE_MEM,
52 },
53 /*
54 *
55 * VIDEO2 / LX2
56 *
57 */
58 {
59 .name = "ST231bImage", /* Delta-Mu 2 image and ram */
60 .start = 0x60000000,
61 .end = 0x601FFFFF, /* 2MiB */
62 .flags = IORESOURCE_IO,
63 },
64 {
65 .name = "ST231bMonitor", /* 8KiB block ST231b monitor */
66 .start = 0x60200000,
67 .end = 0x60201FFF,
68 .flags = IORESOURCE_IO,
69 },
70 {
71 .name = "MediaMemory2",
72 .start = 0x60202000,
73 .end = 0x61FFFFFF, /*~29.9MiB (32MiB - (2MiB + 8KiB)) */
74 .flags = IORESOURCE_IO,
75 },
76 /*
77 *
78 * Sysaudio Driver
79 *
80 * This driver requires:
81 *
82 * Arbitrary Based Buffers:
83 * DSP_Image_Buff - DSP code and data images (1MB)
84 * ADSC_CPU_PCM_Buff - ADSC CPU PCM buffer (40KB)
85 * ADSC_AUX_Buff - ADSC AUX buffer (16KB)
86 * ADSC_Main_Buff - ADSC Main buffer (16KB)
87 *
88 */
89 {
90 .name = "DSP_Image_Buff",
91 .start = 0x00000000,
92 .end = 0x000FFFFF,
93 .flags = IORESOURCE_MEM,
94 },
95 {
96 .name = "ADSC_CPU_PCM_Buff",
97 .start = 0x00000000,
98 .end = 0x00009FFF,
99 .flags = IORESOURCE_MEM,
100 },
101 {
102 .name = "ADSC_AUX_Buff",
103 .start = 0x00000000,
104 .end = 0x00003FFF,
105 .flags = IORESOURCE_MEM,
106 },
107 {
108 .name = "ADSC_Main_Buff",
109 .start = 0x00000000,
110 .end = 0x00003FFF,
111 .flags = IORESOURCE_MEM,
112 },
113 /*
114 *
115 * STAVEM driver/STAPI
116 *
117 * This driver requires:
118 *
119 * Arbitrary Based Buffers:
120 * This memory area is used for allocating buffers for Video decoding
121 * purposes. Allocation/De-allocation within this buffer is managed
122 * by the STAVMEM driver of the STAPI. They could be Decimated
123 * Picture Buffers, Intermediate Buffers, as deemed necessary for
124 * video decoding purposes, for any video decoders on Zeus.
125 *
126 */
127 {
128 .name = "AVMEMPartition0",
129 .start = 0x63580000,
130 .end = 0x64180000 - 1, /* 12 MB total */
131 .flags = IORESOURCE_IO,
132 },
133 /*
134 *
135 * DOCSIS Subsystem
136 *
137 * This driver requires:
138 *
139 * Arbitrary Based Buffers:
140 * Docsis -
141 *
142 */
143 {
144 .name = "Docsis",
145 .start = 0x62000000,
146 .end = 0x62700000 - 1, /* 7 MB total */
147 .flags = IORESOURCE_IO,
148 },
149 /*
150 *
151 * GHW HAL Driver
152 *
153 * This driver requires:
154 *
155 * Arbitrary Based Buffers:
156 * GraphicsHeap - PowerTV Graphics Heap
157 *
158 */
159 {
160 .name = "GraphicsHeap",
161 .start = 0x62700000,
162 .end = 0x63500000 - 1, /* 14 MB total */
163 .flags = IORESOURCE_IO,
164 },
165 /*
166 *
167 * multi com buffer area
168 *
169 * This driver requires:
170 *
171 * Arbitrary Based Buffers:
172 * Docsis -
173 *
174 */
175 {
176 .name = "MulticomSHM",
177 .start = 0x26000000,
178 .end = 0x26020000 - 1,
179 .flags = IORESOURCE_MEM,
180 },
181 /*
182 *
183 * DMA Ring buffer
184 *
185 * This driver requires:
186 *
187 * Arbitrary Based Buffers:
188 * Docsis -
189 *
190 */
191 {
192 .name = "BMM_Buffer",
193 .start = 0x00000000,
194 .end = 0x00280000 - 1,
195 .flags = IORESOURCE_MEM,
196 },
197 /*
198 *
199 * Display bins buffer for unit0
200 *
201 * This driver requires:
202 *
203 * Arbitrary Based Buffers:
204 * Display Bins for unit0
205 *
206 */
207 {
208 .name = "DisplayBins0",
209 .start = 0x00000000,
210 .end = 0x00000FFF, /* 4 KB total */
211 .flags = IORESOURCE_MEM,
212 },
213 /*
214 *
215 * Display bins buffer
216 *
217 * This driver requires:
218 *
219 * Arbitrary Based Buffers:
220 * Display Bins for unit1
221 *
222 */
223 {
224 .name = "DisplayBins1",
225 .start = 0x64AD4000,
226 .end = 0x64AD5000 - 1, /* 4 KB total */
227 .flags = IORESOURCE_IO,
228 },
229 /*
230 *
231 * ITFS
232 *
233 * This driver requires:
234 *
235 * Arbitrary Based Buffers:
236 * Docsis -
237 *
238 */
239 {
240 .name = "ITFS",
241 .start = 0x64180000,
242 /* 815,104 bytes each for 2 ITFS partitions. */
243 .end = 0x6430DFFF,
244 .flags = IORESOURCE_IO,
245 },
246 /*
247 *
248 * AVFS
249 *
250 * This driver requires:
251 *
252 * Arbitrary Based Buffers:
253 * Docsis -
254 *
255 */
256 {
257 .name = "AvfsDmaMem",
258 .start = 0x6430E000,
259 /* (945K * 8) = (128K *3) 5 playbacks / 3 server */
260 .end = 0x64AD0000 - 1,
261 .flags = IORESOURCE_IO,
262 },
263 {
264 .name = "AvfsFileSys",
265 .start = 0x64AD0000,
266 .end = 0x64AD1000 - 1, /* 4K */
267 .flags = IORESOURCE_IO,
268 },
269 /*
270 *
271 * Smartcard
272 *
273 * This driver requires:
274 *
275 * Arbitrary Based Buffers:
276 * Read and write buffers for Internal/External cards
277 *
278 */
279 {
280 .name = "SmartCardInfo",
281 .start = 0x64AD1000,
282 .end = 0x64AD3800 - 1,
283 .flags = IORESOURCE_IO,
284 },
285 /*
286 *
287 * KAVNET
288 * NP Reset Vector - must be of the form xxCxxxxx
289 * NP Image - must be video bank 1
290 * NP IPC - must be video bank 2
291 */
292 {
293 .name = "NP_Reset_Vector",
294 .start = 0x27c00000,
295 .end = 0x27c01000 - 1,
296 .flags = IORESOURCE_MEM,
297 },
298 {
299 .name = "NP_Image",
300 .start = 0x27020000,
301 .end = 0x27060000 - 1,
302 .flags = IORESOURCE_MEM,
303 },
304 {
305 .name = "NP_IPC",
306 .start = 0x63500000,
307 .end = 0x63580000 - 1,
308 .flags = IORESOURCE_IO,
309 },
310 /*
311 * Add other resources here
312 */
313 { },
314};
315
316/*
317 * NON_DVR_CAPABLE GAIA RESOURCES
318 */
319struct resource non_dvr_gaia_resources[] __initdata = {
320 /*
321 *
322 * VIDEO1 / LX1
323 *
324 */
325 {
326 .name = "ST231aImage", /* Delta-Mu 1 image and ram */
327 .start = 0x24000000,
328 .end = 0x241FFFFF, /* 2MiB */
329 .flags = IORESOURCE_MEM,
330 },
331 {
332 .name = "ST231aMonitor", /* 8KiB block ST231a monitor */
333 .start = 0x24200000,
334 .end = 0x24201FFF,
335 .flags = IORESOURCE_MEM,
336 },
337 {
338 .name = "MediaMemory1",
339 .start = 0x24202000,
340 .end = 0x25FFFFFF, /*~29.9MiB (32MiB - (2MiB + 8KiB)) */
341 .flags = IORESOURCE_MEM,
342 },
343 /*
344 *
345 * VIDEO2 / LX2
346 *
347 */
348 {
349 .name = "ST231bImage", /* Delta-Mu 2 image and ram */
350 .start = 0x60000000,
351 .end = 0x601FFFFF, /* 2MiB */
352 .flags = IORESOURCE_IO,
353 },
354 {
355 .name = "ST231bMonitor", /* 8KiB block ST231b monitor */
356 .start = 0x60200000,
357 .end = 0x60201FFF,
358 .flags = IORESOURCE_IO,
359 },
360 {
361 .name = "MediaMemory2",
362 .start = 0x60202000,
363 .end = 0x61FFFFFF, /*~29.9MiB (32MiB - (2MiB + 8KiB)) */
364 .flags = IORESOURCE_IO,
365 },
366 /*
367 *
368 * Sysaudio Driver
369 *
370 * This driver requires:
371 *
372 * Arbitrary Based Buffers:
373 * DSP_Image_Buff - DSP code and data images (1MB)
374 * ADSC_CPU_PCM_Buff - ADSC CPU PCM buffer (40KB)
375 * ADSC_AUX_Buff - ADSC AUX buffer (16KB)
376 * ADSC_Main_Buff - ADSC Main buffer (16KB)
377 *
378 */
379 {
380 .name = "DSP_Image_Buff",
381 .start = 0x00000000,
382 .end = 0x000FFFFF,
383 .flags = IORESOURCE_MEM,
384 },
385 {
386 .name = "ADSC_CPU_PCM_Buff",
387 .start = 0x00000000,
388 .end = 0x00009FFF,
389 .flags = IORESOURCE_MEM,
390 },
391 {
392 .name = "ADSC_AUX_Buff",
393 .start = 0x00000000,
394 .end = 0x00003FFF,
395 .flags = IORESOURCE_MEM,
396 },
397 {
398 .name = "ADSC_Main_Buff",
399 .start = 0x00000000,
400 .end = 0x00003FFF,
401 .flags = IORESOURCE_MEM,
402 },
403 /*
404 *
405 * STAVEM driver/STAPI
406 *
407 * This driver requires:
408 *
409 * Arbitrary Based Buffers:
410 * This memory area is used for allocating buffers for Video decoding
411 * purposes. Allocation/De-allocation within this buffer is managed
412 * by the STAVMEM driver of the STAPI. They could be Decimated
413 * Picture Buffers, Intermediate Buffers, as deemed necessary for
414 * video decoding purposes, for any video decoders on Zeus.
415 *
416 */
417 {
418 .name = "AVMEMPartition0",
419 .start = 0x63580000,
420 .end = 0x64180000 - 1, /* 12 MB total */
421 .flags = IORESOURCE_IO,
422 },
423 /*
424 *
425 * DOCSIS Subsystem
426 *
427 * This driver requires:
428 *
429 * Arbitrary Based Buffers:
430 * Docsis -
431 *
432 */
433 {
434 .name = "Docsis",
435 .start = 0x62000000,
436 .end = 0x62700000 - 1, /* 7 MB total */
437 .flags = IORESOURCE_IO,
438 },
439 /*
440 *
441 * GHW HAL Driver
442 *
443 * This driver requires:
444 *
445 * Arbitrary Based Buffers:
446 * GraphicsHeap - PowerTV Graphics Heap
447 *
448 */
449 {
450 .name = "GraphicsHeap",
451 .start = 0x62700000,
452 .end = 0x63500000 - 1, /* 14 MB total */
453 .flags = IORESOURCE_IO,
454 },
455 /*
456 *
457 * multi com buffer area
458 *
459 * This driver requires:
460 *
461 * Arbitrary Based Buffers:
462 * Docsis -
463 *
464 */
465 {
466 .name = "MulticomSHM",
467 .start = 0x26000000,
468 .end = 0x26020000 - 1,
469 .flags = IORESOURCE_MEM,
470 },
471 /*
472 *
473 * DMA Ring buffer
474 *
475 * This driver requires:
476 *
477 * Arbitrary Based Buffers:
478 * Docsis -
479 *
480 */
481 {
482 .name = "BMM_Buffer",
483 .start = 0x00000000,
484 .end = 0x000AA000 - 1,
485 .flags = IORESOURCE_MEM,
486 },
487 /*
488 *
489 * Display bins buffer for unit0
490 *
491 * This driver requires:
492 *
493 * Arbitrary Based Buffers:
494 * Display Bins for unit0
495 *
496 */
497 {
498 .name = "DisplayBins0",
499 .start = 0x00000000,
500 .end = 0x00000FFF, /* 4 KB total */
501 .flags = IORESOURCE_MEM,
502 },
503 /*
504 *
505 * Display bins buffer
506 *
507 * This driver requires:
508 *
509 * Arbitrary Based Buffers:
510 * Display Bins for unit1
511 *
512 */
513 {
514 .name = "DisplayBins1",
515 .start = 0x64AD4000,
516 .end = 0x64AD5000 - 1, /* 4 KB total */
517 .flags = IORESOURCE_IO,
518 },
519 /*
520 *
521 * AVFS: player HAL memory
522 *
523 *
524 */
525 {
526 .name = "AvfsDmaMem",
527 .start = 0x6430E000,
528 .end = 0x645D2C00 - 1, /* 945K * 3 for playback */
529 .flags = IORESOURCE_IO,
530 },
531 /*
532 *
533 * PMEM
534 *
535 * This driver requires:
536 *
537 * Arbitrary Based Buffers:
538 * Persistent memory for diagnostics.
539 *
540 */
541 {
542 .name = "DiagPersistentMemory",
543 .start = 0x00000000,
544 .end = 0x10000 - 1,
545 .flags = IORESOURCE_MEM,
546 },
547 /*
548 *
549 * Smartcard
550 *
551 * This driver requires:
552 *
553 * Arbitrary Based Buffers:
554 * Read and write buffers for Internal/External cards
555 *
556 */
557 {
558 .name = "SmartCardInfo",
559 .start = 0x64AD1000,
560 .end = 0x64AD3800 - 1,
561 .flags = IORESOURCE_IO,
562 },
563 /*
564 *
565 * KAVNET
566 * NP Reset Vector - must be of the form xxCxxxxx
567 * NP Image - must be video bank 1
568 * NP IPC - must be video bank 2
569 */
570 {
571 .name = "NP_Reset_Vector",
572 .start = 0x27c00000,
573 .end = 0x27c01000 - 1,
574 .flags = IORESOURCE_MEM,
575 },
576 {
577 .name = "NP_Image",
578 .start = 0x27020000,
579 .end = 0x27060000 - 1,
580 .flags = IORESOURCE_MEM,
581 },
582 {
583 .name = "NP_IPC",
584 .start = 0x63500000,
585 .end = 0x63580000 - 1,
586 .flags = IORESOURCE_IO,
587 },
588 { },
589};
diff --git a/arch/mips/powertv/init.c b/arch/mips/powertv/init.c
index 0afe227f1d0a..83552288e802 100644
--- a/arch/mips/powertv/init.c
+++ b/arch/mips/powertv/init.c
@@ -117,8 +117,10 @@ void __init prom_init(void)
117 board_nmi_handler_setup = mips_nmi_setup; 117 board_nmi_handler_setup = mips_nmi_setup;
118 board_ejtag_handler_setup = mips_ejtag_setup; 118 board_ejtag_handler_setup = mips_ejtag_setup;
119 119
120 if (prom_argc == 1) 120 if (prom_argc == 1) {
121 strlcat(arcs_cmdline, " ", COMMAND_LINE_SIZE);
121 strlcat(arcs_cmdline, prom_argv, COMMAND_LINE_SIZE); 122 strlcat(arcs_cmdline, prom_argv, COMMAND_LINE_SIZE);
123 }
122 124
123 configure_platform(); 125 configure_platform();
124 prom_meminit(); 126 prom_meminit();
diff --git a/arch/mips/powertv/ioremap.c b/arch/mips/powertv/ioremap.c
new file mode 100644
index 000000000000..a77c6f62fe23
--- /dev/null
+++ b/arch/mips/powertv/ioremap.c
@@ -0,0 +1,136 @@
1/*
2 * ioremap.c
3 *
4 * Support for mapping between dma_addr_t values a phys_addr_t values.
5 *
6 * Copyright (C) 2005-2009 Scientific-Atlanta, Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21 *
22 * Author: David VomLehn <dvomlehn@cisco.com>
23 *
24 * Description: Defines the platform resources for the SA settop.
25 *
26 * NOTE: The bootloader allocates persistent memory at an address which is
27 * 16 MiB below the end of the highest address in KSEG0. All fixed
28 * address memory reservations must avoid this region.
29 */
30
31#include <linux/kernel.h>
32#include <linux/module.h>
33
34#include <asm/mach-powertv/ioremap.h>
35
36/*
37 * Define the sizes of and masks for grains in physical and DMA space. The
38 * values are the same but the types are not.
39 */
40#define IOR_PHYS_GRAIN ((phys_addr_t) 1 << IOR_LSBITS)
41#define IOR_PHYS_GRAIN_MASK (IOR_PHYS_GRAIN - 1)
42
43#define IOR_DMA_GRAIN ((dma_addr_t) 1 << IOR_LSBITS)
44#define IOR_DMA_GRAIN_MASK (IOR_DMA_GRAIN - 1)
45
46/*
47 * Values that, when accessed by an index derived from a phys_addr_t and
48 * added to phys_addr_t value, yield a DMA address
49 */
50struct ior_phys_to_dma _ior_phys_to_dma[IOR_NUM_PHYS_TO_DMA];
51EXPORT_SYMBOL(_ior_phys_to_dma);
52
53/*
54 * Values that, when accessed by an index derived from a dma_addr_t and
55 * added to that dma_addr_t value, yield a physical address
56 */
57struct ior_dma_to_phys _ior_dma_to_phys[IOR_NUM_DMA_TO_PHYS];
58EXPORT_SYMBOL(_ior_dma_to_phys);
59
60/**
61 * setup_dma_to_phys - set up conversion from DMA to physical addresses
62 * @dma_idx: Top IOR_LSBITS bits of the DMA address, i.e. an index
63 * into the array _dma_to_phys.
64 * @delta: Value that, when added to the DMA address, will yield the
65 * physical address
66 * @s: Number of bytes in the section of memory with the given delta
67 * between DMA and physical addresses.
68 */
69static void setup_dma_to_phys(dma_addr_t dma, phys_addr_t delta, dma_addr_t s)
70{
71 int dma_idx, first_idx, last_idx;
72 phys_addr_t first, last;
73
74 /*
75 * Calculate the first and last indices, rounding the first up and
76 * the second down.
77 */
78 first = dma & ~IOR_DMA_GRAIN_MASK;
79 last = (dma + s - 1) & ~IOR_DMA_GRAIN_MASK;
80 first_idx = first >> IOR_LSBITS; /* Convert to indices */
81 last_idx = last >> IOR_LSBITS;
82
83 for (dma_idx = first_idx; dma_idx <= last_idx; dma_idx++)
84 _ior_dma_to_phys[dma_idx].offset = delta >> IOR_DMA_SHIFT;
85}
86
87/**
88 * setup_phys_to_dma - set up conversion from DMA to physical addresses
89 * @phys_idx: Top IOR_LSBITS bits of the DMA address, i.e. an index
90 * into the array _phys_to_dma.
91 * @delta: Value that, when added to the DMA address, will yield the
92 * physical address
93 * @s: Number of bytes in the section of memory with the given delta
94 * between DMA and physical addresses.
95 */
96static void setup_phys_to_dma(phys_addr_t phys, dma_addr_t delta, phys_addr_t s)
97{
98 int phys_idx, first_idx, last_idx;
99 phys_addr_t first, last;
100
101 /*
102 * Calculate the first and last indices, rounding the first up and
103 * the second down.
104 */
105 first = phys & ~IOR_PHYS_GRAIN_MASK;
106 last = (phys + s - 1) & ~IOR_PHYS_GRAIN_MASK;
107 first_idx = first >> IOR_LSBITS; /* Convert to indices */
108 last_idx = last >> IOR_LSBITS;
109
110 for (phys_idx = first_idx; phys_idx <= last_idx; phys_idx++)
111 _ior_phys_to_dma[phys_idx].offset = delta >> IOR_PHYS_SHIFT;
112}
113
114/**
115 * ioremap_add_map - add to the physical and DMA address conversion arrays
116 * @phys: Process's view of the address of the start of the memory chunk
117 * @dma: DMA address of the start of the memory chunk
118 * @size: Size, in bytes, of the chunk of memory
119 *
120 * NOTE: It might be obvious, but the assumption is that all @size bytes have
121 * the same offset between the physical address and the DMA address.
122 */
123void ioremap_add_map(phys_addr_t phys, phys_addr_t dma, phys_addr_t size)
124{
125 if (size == 0)
126 return;
127
128 if ((dma & IOR_DMA_GRAIN_MASK) != 0 ||
129 (phys & IOR_PHYS_GRAIN_MASK) != 0 ||
130 (size & IOR_PHYS_GRAIN_MASK) != 0)
131 pr_crit("Memory allocation must be in chunks of 0x%x bytes\n",
132 IOR_PHYS_GRAIN);
133
134 setup_dma_to_phys(dma, phys - dma, size);
135 setup_phys_to_dma(phys, dma - phys, size);
136}
diff --git a/arch/mips/powertv/memory.c b/arch/mips/powertv/memory.c
index f49eb3d0358b..73880ad29bc2 100644
--- a/arch/mips/powertv/memory.c
+++ b/arch/mips/powertv/memory.c
@@ -30,28 +30,141 @@
30#include <asm/sections.h> 30#include <asm/sections.h>
31 31
32#include <asm/mips-boards/prom.h> 32#include <asm/mips-boards/prom.h>
33#include <asm/mach-powertv/asic.h>
34#include <asm/mach-powertv/ioremap.h>
33 35
34#include "init.h" 36#include "init.h"
35 37
36/* Memory constants */ 38/* Memory constants */
37#define KIBIBYTE(n) ((n) * 1024) /* Number of kibibytes */ 39#define KIBIBYTE(n) ((n) * 1024) /* Number of kibibytes */
38#define MEBIBYTE(n) ((n) * KIBIBYTE(1024)) /* Number of mebibytes */ 40#define MEBIBYTE(n) ((n) * KIBIBYTE(1024)) /* Number of mebibytes */
39#define DEFAULT_MEMSIZE MEBIBYTE(256) /* If no memsize provided */ 41#define DEFAULT_MEMSIZE MEBIBYTE(128) /* If no memsize provided */
40#define LOW_MEM_MAX MEBIBYTE(252) /* Max usable low mem */
41#define RES_BOOTLDR_MEMSIZE MEBIBYTE(1) /* Memory reserved for bldr */
42#define BOOT_MEM_SIZE KIBIBYTE(256) /* Memory reserved for bldr */
43#define PHYS_MEM_START 0x10000000 /* Start of physical memory */
44 42
45char __initdata cmdline[COMMAND_LINE_SIZE]; 43#define BLDR_SIZE KIBIBYTE(256) /* Memory reserved for bldr */
44#define RV_SIZE MEBIBYTE(4) /* Size of reset vector */
46 45
47void __init prom_meminit(void) 46#define LOW_MEM_END 0x20000000 /* Highest low memory address */
47#define BLDR_ALIAS 0x10000000 /* Bootloader address */
48#define RV_PHYS 0x1fc00000 /* Reset vector address */
49#define LOW_RAM_END RV_PHYS /* End of real RAM in low mem */
50
51/*
52 * Very low-level conversion from processor physical address to device
53 * DMA address for the first bank of memory.
54 */
55#define PHYS_TO_DMA(paddr) ((paddr) + (CONFIG_LOW_RAM_DMA - LOW_RAM_ALIAS))
56
57unsigned long ptv_memsize;
58
59/*
60 * struct low_mem_reserved - Items in low memmory that are reserved
61 * @start: Physical address of item
62 * @size: Size, in bytes, of this item
63 * @is_aliased: True if this is RAM aliased from another location. If false,
64 * it is something other than aliased RAM and the RAM in the
65 * unaliased address is still visible outside of low memory.
66 */
67struct low_mem_reserved {
68 phys_addr_t start;
69 phys_addr_t size;
70 bool is_aliased;
71};
72
73/*
74 * Must be in ascending address order
75 */
76struct low_mem_reserved low_mem_reserved[] = {
77 {BLDR_ALIAS, BLDR_SIZE, true}, /* Bootloader RAM */
78 {RV_PHYS, RV_SIZE, false}, /* Reset vector */
79};
80
81/*
82 * struct mem_layout - layout of a piece of the system RAM
83 * @phys: Physical address of the start of this piece of RAM. This is the
84 * address at which both the processor and I/O devices see the
85 * RAM.
86 * @alias: Alias of this piece of memory in order to make it appear in
87 * the low memory part of the processor's address space. I/O
88 * devices don't see anything here.
89 * @size: Size, in bytes, of this piece of RAM
90 */
91struct mem_layout {
92 phys_addr_t phys;
93 phys_addr_t alias;
94 phys_addr_t size;
95};
96
97/*
98 * struct mem_layout_list - list descriptor for layouts of system RAM pieces
99 * @family: Specifies the family being described
100 * @n: Number of &struct mem_layout elements
101 * @layout: Pointer to the list of &mem_layout structures
102 */
103struct mem_layout_list {
104 enum family_type family;
105 size_t n;
106 struct mem_layout *layout;
107};
108
109static struct mem_layout f1500_layout[] = {
110 {0x20000000, 0x10000000, MEBIBYTE(256)},
111};
112
113static struct mem_layout f4500_layout[] = {
114 {0x40000000, 0x10000000, MEBIBYTE(256)},
115 {0x20000000, 0x20000000, MEBIBYTE(32)},
116};
117
118static struct mem_layout f8500_layout[] = {
119 {0x40000000, 0x10000000, MEBIBYTE(256)},
120 {0x20000000, 0x20000000, MEBIBYTE(32)},
121 {0x30000000, 0x30000000, MEBIBYTE(32)},
122};
123
124static struct mem_layout fx600_layout[] = {
125 {0x20000000, 0x10000000, MEBIBYTE(256)},
126 {0x60000000, 0x60000000, MEBIBYTE(128)},
127};
128
129static struct mem_layout_list layout_list[] = {
130 {FAMILY_1500, ARRAY_SIZE(f1500_layout), f1500_layout},
131 {FAMILY_1500VZE, ARRAY_SIZE(f1500_layout), f1500_layout},
132 {FAMILY_1500VZF, ARRAY_SIZE(f1500_layout), f1500_layout},
133 {FAMILY_4500, ARRAY_SIZE(f4500_layout), f4500_layout},
134 {FAMILY_8500, ARRAY_SIZE(f8500_layout), f8500_layout},
135 {FAMILY_8500RNG, ARRAY_SIZE(f8500_layout), f8500_layout},
136 {FAMILY_4600, ARRAY_SIZE(fx600_layout), fx600_layout},
137 {FAMILY_4600VZA, ARRAY_SIZE(fx600_layout), fx600_layout},
138 {FAMILY_8600, ARRAY_SIZE(fx600_layout), fx600_layout},
139 {FAMILY_8600VZB, ARRAY_SIZE(fx600_layout), fx600_layout},
140};
141
142/* If we can't determine the layout, use this */
143static struct mem_layout default_layout[] = {
144 {0x20000000, 0x10000000, MEBIBYTE(128)},
145};
146
147/**
148 * register_non_ram - register low memory not available for RAM usage
149 */
150static __init void register_non_ram(void)
151{
152 int i;
153
154 for (i = 0; i < ARRAY_SIZE(low_mem_reserved); i++)
155 add_memory_region(low_mem_reserved[i].start,
156 low_mem_reserved[i].size, BOOT_MEM_RESERVED);
157}
158
159/**
160 * get_memsize - get the size of memory as a single bank
161 */
162static phys_addr_t get_memsize(void)
48{ 163{
164 static char cmdline[COMMAND_LINE_SIZE] __initdata;
165 phys_addr_t memsize = 0;
49 char *memsize_str; 166 char *memsize_str;
50 unsigned long memsize = 0;
51 unsigned int physend;
52 char *ptr; 167 char *ptr;
53 int low_mem;
54 int high_mem;
55 168
56 /* Check the command line first for a memsize directive */ 169 /* Check the command line first for a memsize directive */
57 strcpy(cmdline, arcs_cmdline); 170 strcpy(cmdline, arcs_cmdline);
@@ -73,96 +186,156 @@ void __init prom_meminit(void)
73 if (memsize == 0) { 186 if (memsize == 0) {
74 if (_prom_memsize != 0) { 187 if (_prom_memsize != 0) {
75 memsize = _prom_memsize; 188 memsize = _prom_memsize;
76 pr_info("_prom_memsize = 0x%lx\n", memsize); 189 pr_info("_prom_memsize = 0x%x\n", memsize);
77 /* add in memory that the bootloader doesn't 190 /* add in memory that the bootloader doesn't
78 * report */ 191 * report */
79 memsize += BOOT_MEM_SIZE; 192 memsize += BLDR_SIZE;
80 } else { 193 } else {
81 memsize = DEFAULT_MEMSIZE; 194 memsize = DEFAULT_MEMSIZE;
82 pr_info("Memsize not passed by bootloader, " 195 pr_info("Memsize not passed by bootloader, "
83 "defaulting to 0x%lx\n", memsize); 196 "defaulting to 0x%x\n", memsize);
84 } 197 }
85 } 198 }
86 } 199 }
87 200
88 physend = PFN_ALIGN(&_end) - 0x80000000; 201 return memsize;
89 if (memsize > LOW_MEM_MAX) { 202}
90 low_mem = LOW_MEM_MAX; 203
91 high_mem = memsize - low_mem; 204/**
92 } else { 205 * register_low_ram - register an aliased section of RAM
93 low_mem = memsize; 206 * @p: Alias address of memory
94 high_mem = 0; 207 * @n: Number of bytes in this section of memory
208 *
209 * Returns the number of bytes registered
210 *
211 */
212static __init phys_addr_t register_low_ram(phys_addr_t p, phys_addr_t n)
213{
214 phys_addr_t s;
215 int i;
216 phys_addr_t orig_n;
217
218 orig_n = n;
219
220 BUG_ON(p + n > RV_PHYS);
221
222 for (i = 0; n != 0 && i < ARRAY_SIZE(low_mem_reserved); i++) {
223 phys_addr_t start;
224 phys_addr_t size;
225
226 start = low_mem_reserved[i].start;
227 size = low_mem_reserved[i].size;
228
229 /* Handle memory before this low memory section */
230 if (p < start) {
231 phys_addr_t s;
232 s = min(n, start - p);
233 add_memory_region(p, s, BOOT_MEM_RAM);
234 p += s;
235 n -= s;
236 }
237
238 /* Handle the low memory section itself. If it's aliased,
239 * we reduce the number of byes left, but if not, the RAM
240 * is available elsewhere and we don't reduce the number of
241 * bytes remaining. */
242 if (p == start) {
243 if (low_mem_reserved[i].is_aliased) {
244 s = min(n, size);
245 n -= s;
246 p += s;
247 } else
248 p += n;
249 }
95 } 250 }
96 251
252 return orig_n - n;
253}
254
97/* 255/*
98 * TODO: We will use the hard code for memory configuration until 256 * register_ram - register real RAM
99 * the bootloader releases their device tree to us. 257 * @p: Address of memory as seen by devices
258 * @alias: If the memory is seen at an additional address by the processor,
259 * this will be the address, otherwise it is the same as @p.
260 * @n: Number of bytes in this section of memory
100 */ 261 */
262static __init void register_ram(phys_addr_t p, phys_addr_t alias,
263 phys_addr_t n)
264{
101 /* 265 /*
102 * Add the memory reserved for use by the bootloader to the 266 * If some or all of this memory has an alias, break it into the
103 * memory map. 267 * aliased and non-aliased portion.
104 */
105 add_memory_region(PHYS_MEM_START, RES_BOOTLDR_MEMSIZE,
106 BOOT_MEM_RESERVED);
107#ifdef CONFIG_HIGHMEM_256_128
108 /*
109 * Add memory in low for general use by the kernel and its friends
110 * (like drivers, applications, etc).
111 */
112 add_memory_region(PHYS_MEM_START + RES_BOOTLDR_MEMSIZE,
113 LOW_MEM_MAX - RES_BOOTLDR_MEMSIZE, BOOT_MEM_RAM);
114 /*
115 * Add the memory reserved for reset vector.
116 */
117 add_memory_region(0x1fc00000, MEBIBYTE(4), BOOT_MEM_RESERVED);
118 /*
119 * Add the memory reserved.
120 */
121 add_memory_region(0x20000000, MEBIBYTE(1024 + 75), BOOT_MEM_RESERVED);
122 /*
123 * Add memory in high for general use by the kernel and its friends
124 * (like drivers, applications, etc).
125 *
126 * 75MB is reserved for devices which are using the memory in high.
127 */
128 add_memory_region(0x60000000 + MEBIBYTE(75), MEBIBYTE(128 - 75),
129 BOOT_MEM_RAM);
130#elif defined CONFIG_HIGHMEM_128_128
131 /*
132 * Add memory in low for general use by the kernel and its friends
133 * (like drivers, applications, etc).
134 */
135 add_memory_region(PHYS_MEM_START + RES_BOOTLDR_MEMSIZE,
136 MEBIBYTE(128) - RES_BOOTLDR_MEMSIZE, BOOT_MEM_RAM);
137 /*
138 * Add the memory reserved.
139 */
140 add_memory_region(PHYS_MEM_START + MEBIBYTE(128),
141 MEBIBYTE(128 + 1024 + 75), BOOT_MEM_RESERVED);
142 /*
143 * Add memory in high for general use by the kernel and its friends
144 * (like drivers, applications, etc).
145 *
146 * 75MB is reserved for devices which are using the memory in high.
147 */
148 add_memory_region(0x60000000 + MEBIBYTE(75), MEBIBYTE(128 - 75),
149 BOOT_MEM_RAM);
150#else
151 /* Add low memory regions for either:
152 * - no-highmemory configuration case -OR-
153 * - highmemory "HIGHMEM_LOWBANK_ONLY" case
154 */
155 /*
156 * Add memory for general use by the kernel and its friends
157 * (like drivers, applications, etc).
158 */ 268 */
159 add_memory_region(PHYS_MEM_START + RES_BOOTLDR_MEMSIZE, 269 if (p != alias) {
160 low_mem - RES_BOOTLDR_MEMSIZE, BOOT_MEM_RAM); 270 phys_addr_t alias_size;
271 phys_addr_t registered;
272
273 alias_size = min(n, LOW_RAM_END - alias);
274 registered = register_low_ram(alias, alias_size);
275 ioremap_add_map(alias, p, n);
276 n -= registered;
277 p += registered;
278 }
279
280#ifdef CONFIG_HIGHMEM
281 if (n != 0) {
282 add_memory_region(p, n, BOOT_MEM_RAM);
283 ioremap_add_map(p, p, n);
284 }
285#endif
286}
287
288/**
289 * register_address_space - register things in the address space
290 * @memsize: Number of bytes of RAM installed
291 *
292 * Takes the given number of bytes of RAM and registers as many of the regions,
293 * or partial regions, as it can. So, the default configuration might have
294 * two regions with 256 MiB each. If the memsize passed in on the command line
295 * is 384 MiB, it will register the first region with 256 MiB and the second
296 * with 128 MiB.
297 */
298static __init void register_address_space(phys_addr_t memsize)
299{
300 int i;
301 phys_addr_t size;
302 size_t n;
303 struct mem_layout *layout;
304 enum family_type family;
305
161 /* 306 /*
162 * Add the memory reserved for reset vector. 307 * Register all of the things that aren't available to the kernel as
308 * memory.
163 */ 309 */
164 add_memory_region(0x1fc00000, MEBIBYTE(4), BOOT_MEM_RESERVED); 310 register_non_ram();
165#endif 311
312 /* Find the appropriate memory description */
313 family = platform_get_family();
314
315 for (i = 0; i < ARRAY_SIZE(layout_list); i++) {
316 if (layout_list[i].family == family)
317 break;
318 }
319
320 if (i == ARRAY_SIZE(layout_list)) {
321 n = ARRAY_SIZE(default_layout);
322 layout = default_layout;
323 } else {
324 n = layout_list[i].n;
325 layout = layout_list[i].layout;
326 }
327
328 for (i = 0; memsize != 0 && i < n; i++) {
329 size = min(memsize, layout[i].size);
330 register_ram(layout[i].phys, layout[i].alias, size);
331 memsize -= size;
332 }
333}
334
335void __init prom_meminit(void)
336{
337 ptv_memsize = get_memsize();
338 register_address_space(ptv_memsize);
166} 339}
167 340
168void __init prom_free_prom_memory(void) 341void __init prom_free_prom_memory(void)
diff --git a/arch/mips/powertv/powertv-usb.c b/arch/mips/powertv/powertv-usb.c
new file mode 100644
index 000000000000..6ac85cf7aa20
--- /dev/null
+++ b/arch/mips/powertv/powertv-usb.c
@@ -0,0 +1,403 @@
1/*
2 * powertv-usb.c
3 *
4 * Description: ASIC-specific USB device setup and shutdown
5 *
6 * Copyright (C) 2005-2009 Scientific-Atlanta, Inc.
7 * Copyright (C) 2009 Cisco Systems, Inc.
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
22 *
23 * Author: Ken Eppinett
24 * David Schleef <ds@schleef.org>
25 *
26 * NOTE: The bootloader allocates persistent memory at an address which is
27 * 16 MiB below the end of the highest address in KSEG0. All fixed
28 * address memory reservations must avoid this region.
29 */
30
31#include <linux/kernel.h>
32#include <linux/ioport.h>
33#include <linux/platform_device.h>
34#include <asm/mach-powertv/asic.h>
35#include <asm/mach-powertv/interrupts.h>
36
37/* misc_clk_ctl1 values */
38#define MCC1_30MHZ_POWERUP_SELECT (1 << 14)
39#define MCC1_DIV9 (1 << 13)
40#define MCC1_ETHMIPS_POWERUP_SELECT (1 << 11)
41#define MCC1_USB_POWERUP_SELECT (1 << 1)
42#define MCC1_CLOCK108_POWERUP_SELECT (1 << 0)
43
44/* Possible values for clock select */
45#define MCC1_USB_CLOCK_HIGH_Z (0 << 4)
46#define MCC1_USB_CLOCK_48MHZ (1 << 4)
47#define MCC1_USB_CLOCK_24MHZ (2 << 4)
48#define MCC1_USB_CLOCK_6MHZ (3 << 4)
49
50#define MCC1_CONFIG (MCC1_30MHZ_POWERUP_SELECT | \
51 MCC1_DIV9 | \
52 MCC1_ETHMIPS_POWERUP_SELECT | \
53 MCC1_USB_POWERUP_SELECT | \
54 MCC1_CLOCK108_POWERUP_SELECT)
55
56/* misc_clk_ctl2 values */
57#define MCC2_GMII_GCLK_TO_PAD (1 << 31)
58#define MCC2_ETHER125_0_CLOCK_SELECT (1 << 29)
59#define MCC2_RMII_0_CLOCK_SELECT (1 << 28)
60#define MCC2_GMII_TX0_CLOCK_SELECT (1 << 27)
61#define MCC2_GMII_RX0_CLOCK_SELECT (1 << 26)
62#define MCC2_ETHER125_1_CLOCK_SELECT (1 << 24)
63#define MCC2_RMII_1_CLOCK_SELECT (1 << 23)
64#define MCC2_GMII_TX1_CLOCK_SELECT (1 << 22)
65#define MCC2_GMII_RX1_CLOCK_SELECT (1 << 21)
66#define MCC2_ETHER125_2_CLOCK_SELECT (1 << 19)
67#define MCC2_RMII_2_CLOCK_SELECT (1 << 18)
68#define MCC2_GMII_TX2_CLOCK_SELECT (1 << 17)
69#define MCC2_GMII_RX2_CLOCK_SELECT (1 << 16)
70
71#define ETHER_CLK_CONFIG (MCC2_GMII_GCLK_TO_PAD | \
72 MCC2_ETHER125_0_CLOCK_SELECT | \
73 MCC2_RMII_0_CLOCK_SELECT | \
74 MCC2_GMII_TX0_CLOCK_SELECT | \
75 MCC2_GMII_RX0_CLOCK_SELECT | \
76 MCC2_ETHER125_1_CLOCK_SELECT | \
77 MCC2_RMII_1_CLOCK_SELECT | \
78 MCC2_GMII_TX1_CLOCK_SELECT | \
79 MCC2_GMII_RX1_CLOCK_SELECT | \
80 MCC2_ETHER125_2_CLOCK_SELECT | \
81 MCC2_RMII_2_CLOCK_SELECT | \
82 MCC2_GMII_TX2_CLOCK_SELECT | \
83 MCC2_GMII_RX2_CLOCK_SELECT)
84
85/* misc_clk_ctl2 definitions for Gaia */
86#define FSX4A_REF_SELECT (1 << 16)
87#define FSX4B_REF_SELECT (1 << 17)
88#define FSX4C_REF_SELECT (1 << 18)
89#define DDR_PLL_REF_SELECT (1 << 19)
90#define MIPS_PLL_REF_SELECT (1 << 20)
91
92/* Definitions for the QAM frequency select register FS432X4A4_QAM_CTL */
93#define QAM_FS_SDIV_SHIFT 29
94#define QAM_FS_MD_SHIFT 24
95#define QAM_FS_MD_MASK 0x1f /* Cut down to 5 bits */
96#define QAM_FS_PE_SHIFT 8
97
98#define QAM_FS_DISABLE_DIVIDE_BY_3 (1 << 5)
99#define QAM_FS_ENABLE_PROGRAM (1 << 4)
100#define QAM_FS_ENABLE_OUTPUT (1 << 3)
101#define QAM_FS_SELECT_TEST_BYPASS (1 << 2)
102#define QAM_FS_DISABLE_DIGITAL_STANDBY (1 << 1)
103#define QAM_FS_CHOOSE_FS (1 << 0)
104
105/* Definitions for fs432x4a_ctl register */
106#define QAM_FS_NSDIV_54MHZ (1 << 2)
107
108/* Definitions for bcm1_usb2_ctl register */
109#define BCM1_USB2_CTL_BISTOK (1 << 11)
110#define BCM1_USB2_CTL_PORT2_SHIFT_JK (1 << 7)
111#define BCM1_USB2_CTL_PORT1_SHIFT_JK (1 << 6)
112#define BCM1_USB2_CTL_PORT2_FAST_EDGE (1 << 5)
113#define BCM1_USB2_CTL_PORT1_FAST_EDGE (1 << 4)
114#define BCM1_USB2_CTL_EHCI_PRT_PWR_ACTIVE_HIGH (1 << 1)
115#define BCM1_USB2_CTL_APP_PRT_OVRCUR_IN_ACTIVE_HIGH (1 << 0)
116
117/* Definitions for crt_spare register */
118#define CRT_SPARE_PORT2_SHIFT_JK (1 << 21)
119#define CRT_SPARE_PORT1_SHIFT_JK (1 << 20)
120#define CRT_SPARE_PORT2_FAST_EDGE (1 << 19)
121#define CRT_SPARE_PORT1_FAST_EDGE (1 << 18)
122#define CRT_SPARE_DIVIDE_BY_9_FROM_432 (1 << 17)
123#define CRT_SPARE_USB_DIVIDE_BY_9 (1 << 16)
124
125/* Definitions for usb2_stbus_obc register */
126#define USB_STBUS_OBC_STORE32_LOAD32 0x3
127
128/* Definitions for usb2_stbus_mess_size register */
129#define USB2_STBUS_MESS_SIZE_2 0x1 /* 2 packets */
130
131/* Definitions for usb2_stbus_chunk_size register */
132#define USB2_STBUS_CHUNK_SIZE_2 0x1 /* 2 packets */
133
134/* Definitions for usb2_strap register */
135#define USB2_STRAP_HFREQ_SELECT 0x1
136
137/*
138 * USB Host Resource Definition
139 */
140
141static struct resource ehci_resources[] = {
142 {
143 .parent = &asic_resource,
144 .start = 0,
145 .end = 0xff,
146 .flags = IORESOURCE_MEM,
147 },
148 {
149 .start = irq_usbehci,
150 .end = irq_usbehci,
151 .flags = IORESOURCE_IRQ,
152 },
153};
154
155static u64 ehci_dmamask = 0xffffffffULL;
156
157static struct platform_device ehci_device = {
158 .name = "powertv-ehci",
159 .id = 0,
160 .num_resources = 2,
161 .resource = ehci_resources,
162 .dev = {
163 .dma_mask = &ehci_dmamask,
164 .coherent_dma_mask = 0xffffffff,
165 },
166};
167
168static struct resource ohci_resources[] = {
169 {
170 .parent = &asic_resource,
171 .start = 0,
172 .end = 0xff,
173 .flags = IORESOURCE_MEM,
174 },
175 {
176 .start = irq_usbohci,
177 .end = irq_usbohci,
178 .flags = IORESOURCE_IRQ,
179 },
180};
181
182static u64 ohci_dmamask = 0xffffffffULL;
183
184static struct platform_device ohci_device = {
185 .name = "powertv-ohci",
186 .id = 0,
187 .num_resources = 2,
188 .resource = ohci_resources,
189 .dev = {
190 .dma_mask = &ohci_dmamask,
191 .coherent_dma_mask = 0xffffffff,
192 },
193};
194
195static unsigned usb_users;
196static DEFINE_SPINLOCK(usb_regs_lock);
197
198/*
199 *
200 * fs_update - set frequency synthesizer for USB
201 * @pe_bits Phase tap setting
202 * @md_bits Coarse selector bus for algorithm of phase tap
203 * @sdiv_bits Output divider setting
204 * @disable_div_by_3 Either QAM_FS_DISABLE_DIVIDE_BY_3 or zero
205 * @standby Either QAM_FS_DISABLE_DIGITAL_STANDBY or zero
206 *
207 * QAM frequency selection code, which affects the frequency at which USB
208 * runs. The frequency is calculated as:
209 * 2^15 * ndiv * Fin
210 * Fout = ------------------------------------------------------------
211 * (sdiv * (ipe * (1 + md/32) - (ipe - 2^15)*(1 + (md + 1)/32)))
212 * where:
213 * Fin 54 MHz
214 * ndiv QAM_FS_NSDIV_54MHZ ? 8 : 16
215 * sdiv 1 << (sdiv_bits + 1)
216 * ipe Same as pe_bits
217 * md A five-bit, two's-complement integer (range [-16, 15]), which
218 * is the lower 5 bits of md_bits.
219 */
220static void fs_update(u32 pe_bits, int md_bits, u32 sdiv_bits,
221 u32 disable_div_by_3, u32 standby)
222{
223 u32 val;
224
225 val = ((sdiv_bits << QAM_FS_SDIV_SHIFT) |
226 ((md_bits & QAM_FS_MD_MASK) << QAM_FS_MD_SHIFT) |
227 (pe_bits << QAM_FS_PE_SHIFT) |
228 QAM_FS_ENABLE_OUTPUT |
229 standby |
230 disable_div_by_3);
231 asic_write(val, fs432x4b4_usb_ctl);
232 asic_write(val | QAM_FS_ENABLE_PROGRAM, fs432x4b4_usb_ctl);
233 asic_write(val | QAM_FS_ENABLE_PROGRAM | QAM_FS_CHOOSE_FS,
234 fs432x4b4_usb_ctl);
235}
236
237/*
238 * usb_eye_configure - for optimizing the shape USB eye waveform
239 * @set: Bits to set in the register
240 * @clear: Bits to clear in the register; each bit with a one will
241 * be set in the register, zero bits will not be modified
242 */
243static void usb_eye_configure(u32 set, u32 clear)
244{
245 u32 old;
246
247 old = asic_read(crt_spare);
248 old |= set;
249 old &= ~clear;
250 asic_write(old, crt_spare);
251}
252
253/*
254 * platform_configure_usb - usb configuration based on platform type.
255 */
256static void platform_configure_usb(void)
257{
258 u32 bcm1_usb2_ctl_value;
259 enum asic_type asic_type;
260 unsigned long flags;
261
262 spin_lock_irqsave(&usb_regs_lock, flags);
263 usb_users++;
264
265 if (usb_users != 1) {
266 spin_unlock_irqrestore(&usb_regs_lock, flags);
267 return;
268 }
269
270 asic_type = platform_get_asic();
271
272 switch (asic_type) {
273 case ASIC_ZEUS:
274 fs_update(0x0000, -15, 0x02, 0, 0);
275 bcm1_usb2_ctl_value = BCM1_USB2_CTL_EHCI_PRT_PWR_ACTIVE_HIGH |
276 BCM1_USB2_CTL_APP_PRT_OVRCUR_IN_ACTIVE_HIGH;
277 break;
278
279 case ASIC_CRONUS:
280 case ASIC_CRONUSLITE:
281 usb_eye_configure(0, CRT_SPARE_USB_DIVIDE_BY_9);
282 fs_update(0x8000, -14, 0x03, QAM_FS_DISABLE_DIVIDE_BY_3,
283 QAM_FS_DISABLE_DIGITAL_STANDBY);
284 bcm1_usb2_ctl_value = BCM1_USB2_CTL_EHCI_PRT_PWR_ACTIVE_HIGH |
285 BCM1_USB2_CTL_APP_PRT_OVRCUR_IN_ACTIVE_HIGH;
286 break;
287
288 case ASIC_CALLIOPE:
289 fs_update(0x0000, -15, 0x02, QAM_FS_DISABLE_DIVIDE_BY_3,
290 QAM_FS_DISABLE_DIGITAL_STANDBY);
291
292 switch (platform_get_family()) {
293 case FAMILY_1500VZE:
294 break;
295
296 case FAMILY_1500VZF:
297 usb_eye_configure(CRT_SPARE_PORT2_SHIFT_JK |
298 CRT_SPARE_PORT1_SHIFT_JK |
299 CRT_SPARE_PORT2_FAST_EDGE |
300 CRT_SPARE_PORT1_FAST_EDGE, 0);
301 break;
302
303 default:
304 usb_eye_configure(CRT_SPARE_PORT2_SHIFT_JK |
305 CRT_SPARE_PORT1_SHIFT_JK, 0);
306 break;
307 }
308
309 bcm1_usb2_ctl_value = BCM1_USB2_CTL_BISTOK |
310 BCM1_USB2_CTL_EHCI_PRT_PWR_ACTIVE_HIGH |
311 BCM1_USB2_CTL_APP_PRT_OVRCUR_IN_ACTIVE_HIGH;
312 break;
313
314 case ASIC_GAIA:
315 fs_update(0x8000, -14, 0x03, QAM_FS_DISABLE_DIVIDE_BY_3,
316 QAM_FS_DISABLE_DIGITAL_STANDBY);
317 bcm1_usb2_ctl_value = BCM1_USB2_CTL_BISTOK |
318 BCM1_USB2_CTL_EHCI_PRT_PWR_ACTIVE_HIGH |
319 BCM1_USB2_CTL_APP_PRT_OVRCUR_IN_ACTIVE_HIGH;
320 break;
321
322 default:
323 pr_err("Unknown ASIC type: %d\n", asic_type);
324 bcm1_usb2_ctl_value = 0;
325 break;
326 }
327
328 /* turn on USB power */
329 asic_write(0, usb2_strap);
330 /* Enable all OHCI interrupts */
331 asic_write(bcm1_usb2_ctl_value, usb2_control);
332 /* usb2_stbus_obc store32/load32 */
333 asic_write(USB_STBUS_OBC_STORE32_LOAD32, usb2_stbus_obc);
334 /* usb2_stbus_mess_size 2 packets */
335 asic_write(USB2_STBUS_MESS_SIZE_2, usb2_stbus_mess_size);
336 /* usb2_stbus_chunk_size 2 packets */
337 asic_write(USB2_STBUS_CHUNK_SIZE_2, usb2_stbus_chunk_size);
338 spin_unlock_irqrestore(&usb_regs_lock, flags);
339}
340
341static void platform_unconfigure_usb(void)
342{
343 unsigned long flags;
344
345 spin_lock_irqsave(&usb_regs_lock, flags);
346 usb_users--;
347 if (usb_users == 0)
348 asic_write(USB2_STRAP_HFREQ_SELECT, usb2_strap);
349 spin_unlock_irqrestore(&usb_regs_lock, flags);
350}
351
352/*
353 * Set up the USB EHCI interface
354 */
355void platform_configure_usb_ehci()
356{
357 platform_configure_usb();
358}
359EXPORT_SYMBOL(platform_configure_usb_ehci);
360
361/*
362 * Set up the USB OHCI interface
363 */
364void platform_configure_usb_ohci()
365{
366 platform_configure_usb();
367}
368EXPORT_SYMBOL(platform_configure_usb_ohci);
369
370/*
371 * Shut the USB EHCI interface down
372 */
373void platform_unconfigure_usb_ehci()
374{
375 platform_unconfigure_usb();
376}
377EXPORT_SYMBOL(platform_unconfigure_usb_ehci);
378
379/*
380 * Shut the USB OHCI interface down
381 */
382void platform_unconfigure_usb_ohci()
383{
384 platform_unconfigure_usb();
385}
386EXPORT_SYMBOL(platform_unconfigure_usb_ohci);
387
388/**
389 * platform_devices_init - sets up USB device resourse.
390 */
391int __init platform_usb_devices_init(struct platform_device **ehci_dev,
392 struct platform_device **ohci_dev)
393{
394 *ehci_dev = &ehci_device;
395 ehci_resources[0].start = asic_reg_phys_addr(ehci_hcapbase);
396 ehci_resources[0].end += ehci_resources[0].start;
397
398 *ohci_dev = &ohci_device;
399 ohci_resources[0].start = asic_reg_phys_addr(ohci_hc_revision);
400 ohci_resources[0].end += ohci_resources[0].start;
401
402 return 0;
403}
diff --git a/arch/mips/powertv/powertv_setup.c b/arch/mips/powertv/powertv_setup.c
index af2cae0a5ab3..3933c373a438 100644
--- a/arch/mips/powertv/powertv_setup.c
+++ b/arch/mips/powertv/powertv_setup.c
@@ -199,14 +199,8 @@ static int panic_handler(struct notifier_block *notifier_block,
199 my_regs.cp0_status = read_c0_status(); 199 my_regs.cp0_status = read_c0_status();
200 } 200 }
201 201
202#ifdef CONFIG_DIAGNOSTICS
203 failure_report((char *) cause_string,
204 have_die_regs ? &die_regs : &my_regs);
205 have_die_regs = false;
206#else
207 pr_crit("I'm feeling a bit sleepy. hmmmmm... perhaps a nap would... " 202 pr_crit("I'm feeling a bit sleepy. hmmmmm... perhaps a nap would... "
208 "zzzz... \n"); 203 "zzzz... \n");
209#endif
210 204
211 return NOTIFY_DONE; 205 return NOTIFY_DONE;
212} 206}
diff --git a/arch/mips/rb532/Makefile b/arch/mips/rb532/Makefile
index 8f0b6b6a1625..efdecdb6e3ea 100644
--- a/arch/mips/rb532/Makefile
+++ b/arch/mips/rb532/Makefile
@@ -3,5 +3,3 @@
3# 3#
4 4
5obj-y += irq.o time.o setup.o serial.o prom.o gpio.o devices.o 5obj-y += irq.o time.o setup.o serial.o prom.o gpio.o devices.o
6
7EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/rb532/Platform b/arch/mips/rb532/Platform
new file mode 100644
index 000000000000..aeec45a7cbb3
--- /dev/null
+++ b/arch/mips/rb532/Platform
@@ -0,0 +1,7 @@
1#
2# Routerboard 532
3#
4platform-$(CONFIG_MIKROTIK_RB532) += rb532/
5cflags-$(CONFIG_MIKROTIK_RB532) += \
6 -I$(srctree)/arch/mips/include/asm/mach-rc32434
7load-$(CONFIG_MIKROTIK_RB532) += 0xffffffff80101000
diff --git a/arch/mips/sgi-ip22/Makefile b/arch/mips/sgi-ip22/Makefile
index 416b18f9fa72..cc538493cae1 100644
--- a/arch/mips/sgi-ip22/Makefile
+++ b/arch/mips/sgi-ip22/Makefile
@@ -9,5 +9,3 @@ obj-y += ip22-mc.o ip22-hpc.o ip22-int.o ip22-time.o ip22-nvram.o \
9obj-$(CONFIG_SGI_IP22) += ip22-berr.o 9obj-$(CONFIG_SGI_IP22) += ip22-berr.o
10obj-$(CONFIG_SGI_IP28) += ip28-berr.o 10obj-$(CONFIG_SGI_IP28) += ip28-berr.o
11obj-$(CONFIG_EISA) += ip22-eisa.o 11obj-$(CONFIG_EISA) += ip22-eisa.o
12
13EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/sgi-ip22/Platform b/arch/mips/sgi-ip22/Platform
new file mode 100644
index 000000000000..b7a4b7e04c38
--- /dev/null
+++ b/arch/mips/sgi-ip22/Platform
@@ -0,0 +1,34 @@
1#
2# SGI IP22 (Indy/Indigo2)
3#
4# Set the load address to >= 0xffffffff88069000 if you want to leave space for
5# symmon, 0xffffffff80002000 for production kernels. Note that the value must
6# be aligned to a multiple of the kernel stack size or the handling of the
7# current variable will break so for 64-bit kernels we have to raise the start
8# address by 8kb.
9#
10platform-$(CONFIG_SGI_IP22) += sgi-ip22/
11cflags-$(CONFIG_SGI_IP22) += -I$(srctree)/arch/mips/include/asm/mach-ip22
12ifdef CONFIG_32BIT
13load-$(CONFIG_SGI_IP22) += 0xffffffff88002000
14endif
15ifdef CONFIG_64BIT
16load-$(CONFIG_SGI_IP22) += 0xffffffff88004000
17endif
18
19#
20# SGI IP28 (Indigo2 R10k)
21#
22# Set the load address to >= 0xa800000020080000 if you want to leave space for
23# symmon, 0xa800000020004000 for production kernels ? Note that the value must
24# be 16kb aligned or the handling of the current variable will break.
25# Simplified: what IP22 does at 128MB+ in ksegN, IP28 does at 512MB+ in xkphys
26#
27ifdef CONFIG_SGI_IP28
28 ifeq ($(call cc-option-yn,-mr10k-cache-barrier=store), n)
29 $(error gcc doesn't support needed option -mr10k-cache-barrier=store)
30 endif
31endif
32platform-$(CONFIG_SGI_IP28) += sgi-ip22/
33cflags-$(CONFIG_SGI_IP28) += -mr10k-cache-barrier=store -I$(srctree)/arch/mips/include/asm/mach-ip28
34load-$(CONFIG_SGI_IP28) += 0xa800000020004000
diff --git a/arch/mips/sgi-ip27/Makefile b/arch/mips/sgi-ip27/Makefile
index 31f4931b8484..1f29e761d691 100644
--- a/arch/mips/sgi-ip27/Makefile
+++ b/arch/mips/sgi-ip27/Makefile
@@ -8,5 +8,3 @@ obj-y := ip27-berr.o ip27-irq.o ip27-init.o ip27-klconfig.o ip27-klnuma.o \
8 8
9obj-$(CONFIG_EARLY_PRINTK) += ip27-console.o 9obj-$(CONFIG_EARLY_PRINTK) += ip27-console.o
10obj-$(CONFIG_SMP) += ip27-smp.o 10obj-$(CONFIG_SMP) += ip27-smp.o
11
12EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/sgi-ip27/Platform b/arch/mips/sgi-ip27/Platform
new file mode 100644
index 000000000000..1fb9c2ea7c8f
--- /dev/null
+++ b/arch/mips/sgi-ip27/Platform
@@ -0,0 +1,19 @@
1#
2# SGI-IP27 (Origin200/2000)
3#
4# Set the load address to >= 0xc000000000300000 if you want to leave space for
5# symmon, 0xc00000000001c000 for production kernels. Note that the value must
6# be 16kb aligned or the handling of the current variable will break.
7#
8ifdef CONFIG_SGI_IP27
9platform-$(CONFIG_SGI_IP27) += sgi-ip27/
10cflags-$(CONFIG_SGI_IP27) += -I$(srctree)/arch/mips/include/asm/mach-ip27
11ifdef CONFIG_MAPPED_KERNEL
12load-$(CONFIG_SGI_IP27) += 0xc00000004001c000
13OBJCOPYFLAGS := --change-addresses=0x3fffffff80000000
14dataoffset-$(CONFIG_SGI_IP27) += 0x01000000
15else
16load-$(CONFIG_SGI_IP27) += 0xa80000000001c000
17OBJCOPYFLAGS := --change-addresses=0x57ffffff80000000
18endif
19endif
diff --git a/arch/mips/sgi-ip27/ip27-klconfig.c b/arch/mips/sgi-ip27/ip27-klconfig.c
index dd830b3670d1..7afe14688003 100644
--- a/arch/mips/sgi-ip27/ip27-klconfig.c
+++ b/arch/mips/sgi-ip27/ip27-klconfig.c
@@ -48,7 +48,7 @@ klinfo_t *find_first_component(lboard_t *brd, unsigned char struct_type)
48 return find_component(brd, (klinfo_t *)NULL, struct_type); 48 return find_component(brd, (klinfo_t *)NULL, struct_type);
49} 49}
50 50
51lboard_t * find_lboard(lboard_t *start, unsigned char brd_type) 51lboard_t *find_lboard(lboard_t *start, unsigned char brd_type)
52{ 52{
53 /* Search all boards stored on this node. */ 53 /* Search all boards stored on this node. */
54 while (start) { 54 while (start) {
@@ -60,7 +60,7 @@ lboard_t * find_lboard(lboard_t *start, unsigned char brd_type)
60 return (lboard_t *)NULL; 60 return (lboard_t *)NULL;
61} 61}
62 62
63lboard_t * find_lboard_class(lboard_t *start, unsigned char brd_type) 63lboard_t *find_lboard_class(lboard_t *start, unsigned char brd_type)
64{ 64{
65 /* Search all boards stored on this node. */ 65 /* Search all boards stored on this node. */
66 while (start) { 66 while (start) {
@@ -78,7 +78,7 @@ cnodeid_t get_cpu_cnode(cpuid_t cpu)
78 return CPUID_TO_COMPACT_NODEID(cpu); 78 return CPUID_TO_COMPACT_NODEID(cpu);
79} 79}
80 80
81klcpu_t * nasid_slice_to_cpuinfo(nasid_t nasid, int slice) 81klcpu_t *nasid_slice_to_cpuinfo(nasid_t nasid, int slice)
82{ 82{
83 lboard_t *brd; 83 lboard_t *brd;
84 klcpu_t *acpu; 84 klcpu_t *acpu;
@@ -97,7 +97,7 @@ klcpu_t * nasid_slice_to_cpuinfo(nasid_t nasid, int slice)
97 return (klcpu_t *)NULL; 97 return (klcpu_t *)NULL;
98} 98}
99 99
100klcpu_t * sn_get_cpuinfo(cpuid_t cpu) 100klcpu_t *sn_get_cpuinfo(cpuid_t cpu)
101{ 101{
102 nasid_t nasid; 102 nasid_t nasid;
103 int slice; 103 int slice;
diff --git a/arch/mips/sgi-ip32/Makefile b/arch/mips/sgi-ip32/Makefile
index 31c9aa1bcb40..60f0227425e7 100644
--- a/arch/mips/sgi-ip32/Makefile
+++ b/arch/mips/sgi-ip32/Makefile
@@ -5,5 +5,3 @@
5 5
6obj-y += ip32-berr.o ip32-irq.o ip32-platform.o ip32-setup.o ip32-reset.o \ 6obj-y += ip32-berr.o ip32-irq.o ip32-platform.o ip32-setup.o ip32-reset.o \
7 crime.o ip32-memory.o 7 crime.o ip32-memory.o
8
9EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/sgi-ip32/Platform b/arch/mips/sgi-ip32/Platform
new file mode 100644
index 000000000000..0fea556f3641
--- /dev/null
+++ b/arch/mips/sgi-ip32/Platform
@@ -0,0 +1,11 @@
1#
2# SGI-IP32 (O2)
3#
4# Set the load address to >= 80069000 if you want to leave space for symmon,
5# 0xffffffff80004000 for production kernels. Note that the value must be aligned to
6# a multiple of the kernel stack size or the handling of the current variable
7# will break.
8#
9platform-$(CONFIG_SGI_IP32) += sgi-ip32/
10cflags-$(CONFIG_SGI_IP32) += -I$(srctree)/arch/mips/include/asm/mach-ip32
11load-$(CONFIG_SGI_IP32) += 0xffffffff80004000
diff --git a/arch/mips/sibyte/Makefile b/arch/mips/sibyte/Makefile
new file mode 100644
index 000000000000..c8ed2c807e69
--- /dev/null
+++ b/arch/mips/sibyte/Makefile
@@ -0,0 +1,27 @@
1#
2# Sibyte SB1250 / BCM1480 family of SOCs
3#
4obj-$(CONFIG_SIBYTE_BCM112X) += sb1250/
5obj-$(CONFIG_SIBYTE_BCM112X) += common/
6obj-$(CONFIG_SIBYTE_SB1250) += sb1250/
7obj-$(CONFIG_SIBYTE_SB1250) += common/
8obj-$(CONFIG_SIBYTE_BCM1x55) += bcm1480/
9obj-$(CONFIG_SIBYTE_BCM1x55) += common/
10obj-$(CONFIG_SIBYTE_BCM1x80) += bcm1480/
11obj-$(CONFIG_SIBYTE_BCM1x80) += common/
12
13#
14# Sibyte BCM91120x (Carmel) board
15# Sibyte BCM91120C (CRhine) board
16# Sibyte BCM91125C (CRhone) board
17# Sibyte BCM91125E (Rhone) board
18# Sibyte SWARM board
19# Sibyte BCM91x80 (BigSur) board
20#
21obj-$(CONFIG_SIBYTE_CARMEL) += swarm/
22obj-$(CONFIG_SIBYTE_CRHINE) += swarm/
23obj-$(CONFIG_SIBYTE_CRHONE) += swarm/
24obj-$(CONFIG_SIBYTE_RHONE) += swarm/
25obj-$(CONFIG_SIBYTE_SENTOSA) += swarm/
26obj-$(CONFIG_SIBYTE_SWARM) += swarm/
27obj-$(CONFIG_SIBYTE_BIGSUR) += swarm/
diff --git a/arch/mips/sibyte/Platform b/arch/mips/sibyte/Platform
new file mode 100644
index 000000000000..911dfe39c631
--- /dev/null
+++ b/arch/mips/sibyte/Platform
@@ -0,0 +1,43 @@
1#
2# These are all rather similar so we consider them a single platform
3#
4platform-$(CONFIG_SIBYTE_BCM112X) += sibyte/
5platform-$(CONFIG_SIBYTE_SB1250) += sibyte/
6platform-$(CONFIG_SIBYTE_BCM1x55) += sibyte/
7platform-$(CONFIG_SIBYTE_BCM1x80) += sibyte/
8
9#
10# Sibyte SB1250 / BCM1480 family of SOCs
11#
12cflags-$(CONFIG_SIBYTE_BCM112X) += \
13 -I$(srctree)/arch/mips/include/asm/mach-sibyte \
14 -DSIBYTE_HDR_FEATURES=SIBYTE_HDR_FMASK_1250_112x_ALL
15
16platform-$(CONFIG_SIBYTE_SB1250) += sibyte/
17cflags-$(CONFIG_SIBYTE_SB1250) += \
18 -I$(srctree)/arch/mips/include/asm/mach-sibyte \
19 -DSIBYTE_HDR_FEATURES=SIBYTE_HDR_FMASK_1250_112x_ALL
20
21cflags-$(CONFIG_SIBYTE_BCM1x55) += \
22 -I$(srctree)/arch/mips/include/asm/mach-sibyte \
23 -DSIBYTE_HDR_FEATURES=SIBYTE_HDR_FMASK_1480_ALL
24
25cflags-$(CONFIG_SIBYTE_BCM1x80) += \
26 -I$(srctree)/arch/mips/include/asm/mach-sibyte \
27 -DSIBYTE_HDR_FEATURES=SIBYTE_HDR_FMASK_1480_ALL
28
29#
30# Sibyte BCM91120x (Carmel) board
31# Sibyte BCM91120C (CRhine) board
32# Sibyte BCM91125C (CRhone) board
33# Sibyte BCM91125E (Rhone) board
34# Sibyte SWARM board
35# Sibyte BCM91x80 (BigSur) board
36#
37load-$(CONFIG_SIBYTE_CARMEL) := 0xffffffff80100000
38load-$(CONFIG_SIBYTE_CRHINE) := 0xffffffff80100000
39load-$(CONFIG_SIBYTE_CRHONE) := 0xffffffff80100000
40load-$(CONFIG_SIBYTE_RHONE) := 0xffffffff80100000
41load-$(CONFIG_SIBYTE_SENTOSA) := 0xffffffff80100000
42load-$(CONFIG_SIBYTE_SWARM) := 0xffffffff80100000
43load-$(CONFIG_SIBYTE_BIGSUR) := 0xffffffff80100000
diff --git a/arch/mips/sibyte/bcm1480/Makefile b/arch/mips/sibyte/bcm1480/Makefile
index f292f7df0cfb..cdc4c56c3e29 100644
--- a/arch/mips/sibyte/bcm1480/Makefile
+++ b/arch/mips/sibyte/bcm1480/Makefile
@@ -1,5 +1,3 @@
1obj-y := setup.o irq.o time.o 1obj-y := setup.o irq.o time.o
2 2
3obj-$(CONFIG_SMP) += smp.o 3obj-$(CONFIG_SMP) += smp.o
4
5EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/sibyte/common/Makefile b/arch/mips/sibyte/common/Makefile
index 4f659837c7c6..36aa700cc40c 100644
--- a/arch/mips/sibyte/common/Makefile
+++ b/arch/mips/sibyte/common/Makefile
@@ -1,5 +1,3 @@
1obj-y := cfe.o 1obj-y := cfe.o
2obj-$(CONFIG_SIBYTE_CFE_CONSOLE) += cfe_console.o 2obj-$(CONFIG_SIBYTE_CFE_CONSOLE) += cfe_console.o
3obj-$(CONFIG_SIBYTE_TBPROF) += sb_tbprof.o 3obj-$(CONFIG_SIBYTE_TBPROF) += sb_tbprof.o
4
5EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/sibyte/sb1250/Makefile b/arch/mips/sibyte/sb1250/Makefile
index 1896f4e77a30..d3d969de407b 100644
--- a/arch/mips/sibyte/sb1250/Makefile
+++ b/arch/mips/sibyte/sb1250/Makefile
@@ -2,5 +2,3 @@ obj-y := setup.o irq.o time.o
2 2
3obj-$(CONFIG_SMP) += smp.o 3obj-$(CONFIG_SMP) += smp.o
4obj-$(CONFIG_SIBYTE_BUS_WATCHER) += bus_watcher.o 4obj-$(CONFIG_SIBYTE_BUS_WATCHER) += bus_watcher.o
5
6EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/sni/Makefile b/arch/mips/sni/Makefile
index a7dbeebe7fe6..9d3bad3200ce 100644
--- a/arch/mips/sni/Makefile
+++ b/arch/mips/sni/Makefile
@@ -4,5 +4,3 @@
4 4
5obj-y += irq.o reset.o setup.o a20r.o rm200.o pcimt.o pcit.o time.o 5obj-y += irq.o reset.o setup.o a20r.o rm200.o pcimt.o pcit.o time.o
6obj-$(CONFIG_EISA) += eisa.o 6obj-$(CONFIG_EISA) += eisa.o
7
8EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/sni/Platform b/arch/mips/sni/Platform
new file mode 100644
index 000000000000..2644a9d63c0f
--- /dev/null
+++ b/arch/mips/sni/Platform
@@ -0,0 +1,11 @@
1#
2# SNI RM
3#
4platform-$(CONFIG_SNI_RM) += sni/
5cflags-$(CONFIG_SNI_RM) += -I$(srctree)/arch/mips/include/asm/mach-rm
6ifdef CONFIG_CPU_LITTLE_ENDIAN
7load-$(CONFIG_SNI_RM) += 0xffffffff80600000
8else
9load-$(CONFIG_SNI_RM) += 0xffffffff80030000
10endif
11all-$(CONFIG_SNI_RM) := $(COMPRESSION_FNAME).ecoff
diff --git a/arch/mips/txx9/Makefile b/arch/mips/txx9/Makefile
new file mode 100644
index 000000000000..34787dabff06
--- /dev/null
+++ b/arch/mips/txx9/Makefile
@@ -0,0 +1,17 @@
1#
2# Common TXx9
3#
4obj-$(CONFIG_MACH_TX39XX) += generic/
5obj-$(CONFIG_MACH_TX49XX) += generic/
6
7#
8# Toshiba JMR-TX3927 board
9#
10obj-$(CONFIG_TOSHIBA_JMR3927) += jmr3927/
11
12#
13# Toshiba RBTX49XX boards
14#
15obj-$(CONFIG_TOSHIBA_RBTX4927) += rbtx4927/
16obj-$(CONFIG_TOSHIBA_RBTX4938) += rbtx4938/
17obj-$(CONFIG_TOSHIBA_RBTX4939) += rbtx4939/
diff --git a/arch/mips/txx9/Platform b/arch/mips/txx9/Platform
new file mode 100644
index 000000000000..a801abbe138b
--- /dev/null
+++ b/arch/mips/txx9/Platform
@@ -0,0 +1,10 @@
1platform-$(CONFIG_MACH_TX39XX) += txx9/
2platform-$(CONFIG_MACH_TX49XX) += txx9/
3
4cflags-$(CONFIG_MACH_TX39XX) += \
5 -I$(srctree)/arch/mips/include/asm/mach-tx39xx
6cflags-$(CONFIG_MACH_TX49XX) += \
7 -I$(srctree)/arch/mips/include/asm/mach-tx49xx
8
9load-$(CONFIG_MACH_TX39XX) += 0xffffffff80050000
10load-$(CONFIG_MACH_TX49XX) += 0xffffffff80100000
diff --git a/arch/mips/txx9/generic/Makefile b/arch/mips/txx9/generic/Makefile
index f2579ce054a1..1863c167e66e 100644
--- a/arch/mips/txx9/generic/Makefile
+++ b/arch/mips/txx9/generic/Makefile
@@ -11,5 +11,3 @@ obj-$(CONFIG_SOC_TX4939) += setup_tx4939.o irq_tx4939.o
11obj-$(CONFIG_TOSHIBA_FPCIB0) += smsc_fdc37m81x.o 11obj-$(CONFIG_TOSHIBA_FPCIB0) += smsc_fdc37m81x.o
12obj-$(CONFIG_SPI) += spi_eeprom.o 12obj-$(CONFIG_SPI) += spi_eeprom.o
13obj-$(CONFIG_TXX9_7SEGLED) += 7segled.o 13obj-$(CONFIG_TXX9_7SEGLED) += 7segled.o
14
15EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/txx9/jmr3927/Makefile b/arch/mips/txx9/jmr3927/Makefile
index 20d61ac543e5..9f5d5b623839 100644
--- a/arch/mips/txx9/jmr3927/Makefile
+++ b/arch/mips/txx9/jmr3927/Makefile
@@ -3,5 +3,3 @@
3# 3#
4 4
5obj-y += prom.o irq.o setup.o 5obj-y += prom.o irq.o setup.o
6
7EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/txx9/rbtx4927/Makefile b/arch/mips/txx9/rbtx4927/Makefile
index f3e1f597b4f1..60b24c8f7e63 100644
--- a/arch/mips/txx9/rbtx4927/Makefile
+++ b/arch/mips/txx9/rbtx4927/Makefile
@@ -1,3 +1 @@
1obj-y += prom.o setup.o irq.o obj-y += prom.o setup.o irq.o
2
3EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/txx9/rbtx4938/Makefile b/arch/mips/txx9/rbtx4938/Makefile
index f3e1f597b4f1..60b24c8f7e63 100644
--- a/arch/mips/txx9/rbtx4938/Makefile
+++ b/arch/mips/txx9/rbtx4938/Makefile
@@ -1,3 +1 @@
1obj-y += prom.o setup.o irq.o obj-y += prom.o setup.o irq.o
2
3EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/txx9/rbtx4939/Makefile b/arch/mips/txx9/rbtx4939/Makefile
index 3232cd03a7d6..5c84625a3f1c 100644
--- a/arch/mips/txx9/rbtx4939/Makefile
+++ b/arch/mips/txx9/rbtx4939/Makefile
@@ -1,3 +1 @@
1obj-y += irq.o setup.o prom.o obj-y += irq.o setup.o prom.o
2
3EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/vr41xx/Platform b/arch/mips/vr41xx/Platform
new file mode 100644
index 000000000000..b6c8d5c08ddb
--- /dev/null
+++ b/arch/mips/vr41xx/Platform
@@ -0,0 +1,32 @@
1#
2# NEC VR4100 series based machines
3#
4platform-$(CONFIG_MACH_VR41XX) += vr41xx/common/
5cflags-$(CONFIG_MACH_VR41XX) += -I$(srctree)/arch/mips/include/asm/mach-vr41xx
6
7#
8# CASIO CASSIPEIA E-55/65 (VR4111)
9#
10platform-$(CONFIG_CASIO_E55) += vr41xx/casio-e55/
11load-$(CONFIG_CASIO_E55) += 0xffffffff80004000
12
13#
14# IBM WorkPad z50 (VR4121)
15#
16platform-$(CONFIG_IBM_WORKPAD) += vr41xx/ibm-workpad/
17load-$(CONFIG_IBM_WORKPAD) += 0xffffffff80004000
18
19#
20# TANBAC VR4131 multichip module(TB0225) and TANBAC VR4131DIMM(TB0229) (VR4131)
21#
22load-$(CONFIG_TANBAC_TB022X) += 0xffffffff80000000
23
24#
25# Victor MP-C303/304 (VR4122)
26#
27load-$(CONFIG_VICTOR_MPC30X) += 0xffffffff80001000
28
29#
30# ZAO Networks Capcella (VR4131)
31#
32load-$(CONFIG_ZAO_CAPCELLA) += 0xffffffff80000000
diff --git a/arch/mips/vr41xx/common/Makefile b/arch/mips/vr41xx/common/Makefile
index 7d5d83b8c582..d0d84ec8d63d 100644
--- a/arch/mips/vr41xx/common/Makefile
+++ b/arch/mips/vr41xx/common/Makefile
@@ -3,5 +3,3 @@
3# 3#
4 4
5obj-y += bcu.o cmu.o giu.o icu.o init.o irq.o pmu.o rtc.o siu.o type.o 5obj-y += bcu.o cmu.o giu.o icu.o init.o irq.o pmu.o rtc.o siu.o type.o
6
7EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/gt64120/wrppmc/Makefile b/arch/mips/wrppmc/Makefile
index b49d282bee8a..307cc6920ce6 100644
--- a/arch/mips/gt64120/wrppmc/Makefile
+++ b/arch/mips/wrppmc/Makefile
@@ -6,9 +6,7 @@
6# Copyright 2006 Wind River System, Inc. 6# Copyright 2006 Wind River System, Inc.
7# Author: Rongkai.Zhan <rongkai.zhan@windriver.com> 7# Author: Rongkai.Zhan <rongkai.zhan@windriver.com>
8# 8#
9# Makefile for the Wind River MIPS 4KC PPMC Eval Board 9# Makefile for the Wind River MIPS 4Kc PPMC Eval Board
10# 10#
11 11
12obj-y += irq.o pci.o reset.o serial.o setup.o time.o 12obj-y += irq.o pci.o reset.o serial.o setup.o time.o
13
14EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/wrppmc/Platform b/arch/mips/wrppmc/Platform
new file mode 100644
index 000000000000..e758645e9681
--- /dev/null
+++ b/arch/mips/wrppmc/Platform
@@ -0,0 +1,7 @@
1#
2# Wind River PPMC Board (4KC + GT64120)
3#
4platform-$(CONFIG_WR_PPMC) += wrppmc/
5cflags-$(CONFIG_WR_PPMC) += \
6 -I$(srctree)/arch/mips/include/asm/mach-wrppmc
7load-$(CONFIG_WR_PPMC) += 0xffffffff80100000
diff --git a/arch/mips/gt64120/wrppmc/irq.c b/arch/mips/wrppmc/irq.c
index c6e706274db4..c6e706274db4 100644
--- a/arch/mips/gt64120/wrppmc/irq.c
+++ b/arch/mips/wrppmc/irq.c
diff --git a/arch/mips/gt64120/wrppmc/pci.c b/arch/mips/wrppmc/pci.c
index d06192faeb7c..d06192faeb7c 100644
--- a/arch/mips/gt64120/wrppmc/pci.c
+++ b/arch/mips/wrppmc/pci.c
diff --git a/arch/mips/gt64120/wrppmc/reset.c b/arch/mips/wrppmc/reset.c
index cc5474b24f06..cc5474b24f06 100644
--- a/arch/mips/gt64120/wrppmc/reset.c
+++ b/arch/mips/wrppmc/reset.c
diff --git a/arch/mips/gt64120/wrppmc/serial.c b/arch/mips/wrppmc/serial.c
index 6f9d0858f596..6f9d0858f596 100644
--- a/arch/mips/gt64120/wrppmc/serial.c
+++ b/arch/mips/wrppmc/serial.c
diff --git a/arch/mips/gt64120/wrppmc/setup.c b/arch/mips/wrppmc/setup.c
index ca65c84031a7..ca65c84031a7 100644
--- a/arch/mips/gt64120/wrppmc/setup.c
+++ b/arch/mips/wrppmc/setup.c
diff --git a/arch/mips/gt64120/wrppmc/time.c b/arch/mips/wrppmc/time.c
index 668dbd5f12c5..668dbd5f12c5 100644
--- a/arch/mips/gt64120/wrppmc/time.c
+++ b/arch/mips/wrppmc/time.c
diff --git a/arch/mn10300/Kconfig b/arch/mn10300/Kconfig
index 1c4565a9102b..444b9f918fdf 100644
--- a/arch/mn10300/Kconfig
+++ b/arch/mn10300/Kconfig
@@ -46,9 +46,6 @@ config GENERIC_FIND_NEXT_BIT
46config GENERIC_HWEIGHT 46config GENERIC_HWEIGHT
47 def_bool y 47 def_bool y
48 48
49config GENERIC_TIME
50 def_bool y
51
52config GENERIC_BUG 49config GENERIC_BUG
53 def_bool y 50 def_bool y
54 51
diff --git a/arch/mn10300/include/asm/local64.h b/arch/mn10300/include/asm/local64.h
new file mode 100644
index 000000000000..36c93b5cc239
--- /dev/null
+++ b/arch/mn10300/include/asm/local64.h
@@ -0,0 +1 @@
#include <asm-generic/local64.h>
diff --git a/arch/parisc/Kconfig b/arch/parisc/Kconfig
index 05a366a5c4d5..907417d187e1 100644
--- a/arch/parisc/Kconfig
+++ b/arch/parisc/Kconfig
@@ -66,10 +66,6 @@ config GENERIC_CALIBRATE_DELAY
66 bool 66 bool
67 default y 67 default y
68 68
69config GENERIC_TIME
70 bool
71 default y
72
73config TIME_LOW_RES 69config TIME_LOW_RES
74 bool 70 bool
75 depends on SMP 71 depends on SMP
diff --git a/arch/parisc/include/asm/local64.h b/arch/parisc/include/asm/local64.h
new file mode 100644
index 000000000000..36c93b5cc239
--- /dev/null
+++ b/arch/parisc/include/asm/local64.h
@@ -0,0 +1 @@
#include <asm-generic/local64.h>
diff --git a/arch/parisc/kernel/firmware.c b/arch/parisc/kernel/firmware.c
index 4c247e02d9b1..df971fa0c32f 100644
--- a/arch/parisc/kernel/firmware.c
+++ b/arch/parisc/kernel/firmware.c
@@ -1123,7 +1123,6 @@ static char __attribute__((aligned(64))) iodc_dbuf[4096];
1123 */ 1123 */
1124int pdc_iodc_print(const unsigned char *str, unsigned count) 1124int pdc_iodc_print(const unsigned char *str, unsigned count)
1125{ 1125{
1126 static int posx; /* for simple TAB-Simulation... */
1127 unsigned int i; 1126 unsigned int i;
1128 unsigned long flags; 1127 unsigned long flags;
1129 1128
@@ -1133,19 +1132,12 @@ int pdc_iodc_print(const unsigned char *str, unsigned count)
1133 iodc_dbuf[i+0] = '\r'; 1132 iodc_dbuf[i+0] = '\r';
1134 iodc_dbuf[i+1] = '\n'; 1133 iodc_dbuf[i+1] = '\n';
1135 i += 2; 1134 i += 2;
1136 posx = 0;
1137 goto print; 1135 goto print;
1138 case '\t':
1139 while (posx & 7) {
1140 iodc_dbuf[i] = ' ';
1141 i++, posx++;
1142 }
1143 break;
1144 case '\b': /* BS */ 1136 case '\b': /* BS */
1145 posx -= 2; 1137 i--; /* overwrite last */
1146 default: 1138 default:
1147 iodc_dbuf[i] = str[i]; 1139 iodc_dbuf[i] = str[i];
1148 i++, posx++; 1140 i++;
1149 break; 1141 break;
1150 } 1142 }
1151 } 1143 }
diff --git a/arch/parisc/kernel/ftrace.c b/arch/parisc/kernel/ftrace.c
index 9877372ffdba..5beb97bafbb1 100644
--- a/arch/parisc/kernel/ftrace.c
+++ b/arch/parisc/kernel/ftrace.c
@@ -82,7 +82,7 @@ unsigned long ftrace_return_to_handler(unsigned long retval0,
82 unsigned long ret; 82 unsigned long ret;
83 83
84 pop_return_trace(&trace, &ret); 84 pop_return_trace(&trace, &ret);
85 trace.rettime = cpu_clock(raw_smp_processor_id()); 85 trace.rettime = local_clock();
86 ftrace_graph_return(&trace); 86 ftrace_graph_return(&trace);
87 87
88 if (unlikely(!ret)) { 88 if (unlikely(!ret)) {
@@ -126,7 +126,7 @@ void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr)
126 return; 126 return;
127 } 127 }
128 128
129 calltime = cpu_clock(raw_smp_processor_id()); 129 calltime = local_clock();
130 130
131 if (push_return_trace(old, calltime, 131 if (push_return_trace(old, calltime,
132 self_addr, &trace.depth) == -EBUSY) { 132 self_addr, &trace.depth) == -EBUSY) {
diff --git a/arch/powerpc/Kconfig b/arch/powerpc/Kconfig
index 2031a2846865..631e5a0fb6ab 100644
--- a/arch/powerpc/Kconfig
+++ b/arch/powerpc/Kconfig
@@ -29,9 +29,6 @@ config MMU
29config GENERIC_CMOS_UPDATE 29config GENERIC_CMOS_UPDATE
30 def_bool y 30 def_bool y
31 31
32config GENERIC_TIME
33 def_bool y
34
35config GENERIC_TIME_VSYSCALL 32config GENERIC_TIME_VSYSCALL
36 def_bool y 33 def_bool y
37 34
@@ -120,6 +117,8 @@ config ARCH_NO_VIRT_TO_BUS
120config PPC 117config PPC
121 bool 118 bool
122 default y 119 default y
120 select OF
121 select OF_FLATTREE
123 select HAVE_FTRACE_MCOUNT_RECORD 122 select HAVE_FTRACE_MCOUNT_RECORD
124 select HAVE_DYNAMIC_FTRACE 123 select HAVE_DYNAMIC_FTRACE
125 select HAVE_FUNCTION_TRACER 124 select HAVE_FUNCTION_TRACER
@@ -141,6 +140,7 @@ config PPC
141 select GENERIC_ATOMIC64 if PPC32 140 select GENERIC_ATOMIC64 if PPC32
142 select HAVE_PERF_EVENTS 141 select HAVE_PERF_EVENTS
143 select HAVE_REGS_AND_STACK_ACCESS_API 142 select HAVE_REGS_AND_STACK_ACCESS_API
143 select HAVE_HW_BREAKPOINT if PERF_EVENTS && PPC_BOOK3S_64
144 144
145config EARLY_PRINTK 145config EARLY_PRINTK
146 bool 146 bool
@@ -172,10 +172,6 @@ config ARCH_MAY_HAVE_PC_FDC
172config PPC_OF 172config PPC_OF
173 def_bool y 173 def_bool y
174 174
175config OF
176 def_bool y
177 select OF_FLATTREE
178
179config PPC_UDBG_16550 175config PPC_UDBG_16550
180 bool 176 bool
181 default n 177 default n
@@ -198,10 +194,6 @@ config SYS_SUPPORTS_APM_EMULATION
198 default y if PMAC_APM_EMU 194 default y if PMAC_APM_EMU
199 bool 195 bool
200 196
201config DTC
202 bool
203 default y
204
205config DEFAULT_UIMAGE 197config DEFAULT_UIMAGE
206 bool 198 bool
207 help 199 help
@@ -218,7 +210,7 @@ config ARCH_HIBERNATION_POSSIBLE
218config ARCH_SUSPEND_POSSIBLE 210config ARCH_SUSPEND_POSSIBLE
219 def_bool y 211 def_bool y
220 depends on ADB_PMU || PPC_EFIKA || PPC_LITE5200 || PPC_83xx || \ 212 depends on ADB_PMU || PPC_EFIKA || PPC_LITE5200 || PPC_83xx || \
221 PPC_85xx || PPC_86xx 213 PPC_85xx || PPC_86xx || PPC_PSERIES
222 214
223config PPC_DCR_NATIVE 215config PPC_DCR_NATIVE
224 bool 216 bool
@@ -351,7 +343,7 @@ config ARCH_ENABLE_MEMORY_HOTREMOVE
351 343
352config KEXEC 344config KEXEC
353 bool "kexec system call (EXPERIMENTAL)" 345 bool "kexec system call (EXPERIMENTAL)"
354 depends on (PPC_BOOK3S || (FSL_BOOKE && !SMP)) && EXPERIMENTAL 346 depends on (PPC_BOOK3S || FSL_BOOKE) && EXPERIMENTAL
355 help 347 help
356 kexec is a system call that implements the ability to shutdown your 348 kexec is a system call that implements the ability to shutdown your
357 current kernel, and to start another kernel. It is like a reboot 349 current kernel, and to start another kernel. It is like a reboot
@@ -368,8 +360,8 @@ config KEXEC
368 360
369config CRASH_DUMP 361config CRASH_DUMP
370 bool "Build a kdump crash kernel" 362 bool "Build a kdump crash kernel"
371 depends on PPC64 || 6xx 363 depends on PPC64 || 6xx || FSL_BOOKE
372 select RELOCATABLE if PPC64 364 select RELOCATABLE if PPC64 || FSL_BOOKE
373 help 365 help
374 Build a kernel suitable for use as a kdump capture kernel. 366 Build a kernel suitable for use as a kdump capture kernel.
375 The same kernel binary can be used as production kernel and dump 367 The same kernel binary can be used as production kernel and dump
@@ -578,14 +570,6 @@ config SCHED_SMT
578 when dealing with POWER5 cpus at a cost of slightly increased 570 when dealing with POWER5 cpus at a cost of slightly increased
579 overhead in some places. If unsure say N here. 571 overhead in some places. If unsure say N here.
580 572
581config PROC_DEVICETREE
582 bool "Support for device tree in /proc"
583 depends on PROC_FS
584 help
585 This option adds a device-tree directory under /proc which contains
586 an image of the device tree that the kernel copies from Open
587 Firmware or other boot firmware. If unsure, say Y here.
588
589config CMDLINE_BOOL 573config CMDLINE_BOOL
590 bool "Default bootloader kernel arguments" 574 bool "Default bootloader kernel arguments"
591 575
@@ -668,7 +652,7 @@ config NEED_SG_DMA_LENGTH
668 652
669config GENERIC_ISA_DMA 653config GENERIC_ISA_DMA
670 bool 654 bool
671 depends on PPC64 || POWER4 || 6xx && !CPM2 655 depends on ISA_DMA_API
672 default y 656 default y
673 657
674config PPC_INDIRECT_PCI 658config PPC_INDIRECT_PCI
@@ -897,7 +881,7 @@ config KERNEL_START_BOOL
897config KERNEL_START 881config KERNEL_START
898 hex "Virtual address of kernel base" if KERNEL_START_BOOL 882 hex "Virtual address of kernel base" if KERNEL_START_BOOL
899 default PAGE_OFFSET if PAGE_OFFSET_BOOL 883 default PAGE_OFFSET if PAGE_OFFSET_BOOL
900 default "0xc2000000" if CRASH_DUMP 884 default "0xc2000000" if CRASH_DUMP && !RELOCATABLE
901 default "0xc0000000" 885 default "0xc0000000"
902 886
903config PHYSICAL_START_BOOL 887config PHYSICAL_START_BOOL
@@ -910,7 +894,7 @@ config PHYSICAL_START_BOOL
910 894
911config PHYSICAL_START 895config PHYSICAL_START
912 hex "Physical address where the kernel is loaded" if PHYSICAL_START_BOOL 896 hex "Physical address where the kernel is loaded" if PHYSICAL_START_BOOL
913 default "0x02000000" if PPC_STD_MMU && CRASH_DUMP 897 default "0x02000000" if PPC_STD_MMU && CRASH_DUMP && !RELOCATABLE
914 default "0x00000000" 898 default "0x00000000"
915 899
916config PHYSICAL_ALIGN 900config PHYSICAL_ALIGN
diff --git a/arch/powerpc/Makefile b/arch/powerpc/Makefile
index 77cfe7a29e25..5d42f5eae70f 100644
--- a/arch/powerpc/Makefile
+++ b/arch/powerpc/Makefile
@@ -94,7 +94,7 @@ else
94endif 94endif
95endif 95endif
96 96
97LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o 97KBUILD_LDFLAGS_MODULE += arch/powerpc/lib/crtsavres.o
98 98
99ifeq ($(CONFIG_TUNE_CELL),y) 99ifeq ($(CONFIG_TUNE_CELL),y)
100 KBUILD_CFLAGS += $(call cc-option,-mtune=cell) 100 KBUILD_CFLAGS += $(call cc-option,-mtune=cell)
diff --git a/arch/powerpc/boot/dts/canyonlands.dts b/arch/powerpc/boot/dts/canyonlands.dts
index cd56bb5b347b..5806ef0b860b 100644
--- a/arch/powerpc/boot/dts/canyonlands.dts
+++ b/arch/powerpc/boot/dts/canyonlands.dts
@@ -270,7 +270,7 @@
270 clock-frequency = <0>; /* Filled in by U-Boot */ 270 clock-frequency = <0>; /* Filled in by U-Boot */
271 current-speed = <0>; /* Filled in by U-Boot */ 271 current-speed = <0>; /* Filled in by U-Boot */
272 interrupt-parent = <&UIC1>; 272 interrupt-parent = <&UIC1>;
273 interrupts = <0x1d 0x4>; 273 interrupts = <28 0x4>;
274 }; 274 };
275 275
276 UART3: serial@ef600600 { 276 UART3: serial@ef600600 {
@@ -281,7 +281,7 @@
281 clock-frequency = <0>; /* Filled in by U-Boot */ 281 clock-frequency = <0>; /* Filled in by U-Boot */
282 current-speed = <0>; /* Filled in by U-Boot */ 282 current-speed = <0>; /* Filled in by U-Boot */
283 interrupt-parent = <&UIC1>; 283 interrupt-parent = <&UIC1>;
284 interrupts = <0x1e 0x4>; 284 interrupts = <29 0x4>;
285 }; 285 };
286 286
287 IIC0: i2c@ef600700 { 287 IIC0: i2c@ef600700 {
diff --git a/arch/powerpc/boot/dts/glacier.dts b/arch/powerpc/boot/dts/glacier.dts
index d62a4fb6f93c..e618fc4cbc9e 100644
--- a/arch/powerpc/boot/dts/glacier.dts
+++ b/arch/powerpc/boot/dts/glacier.dts
@@ -259,7 +259,7 @@
259 clock-frequency = <0>; /* Filled in by U-Boot */ 259 clock-frequency = <0>; /* Filled in by U-Boot */
260 current-speed = <0>; /* Filled in by U-Boot */ 260 current-speed = <0>; /* Filled in by U-Boot */
261 interrupt-parent = <&UIC1>; 261 interrupt-parent = <&UIC1>;
262 interrupts = <0x1d 0x4>; 262 interrupts = <28 0x4>;
263 }; 263 };
264 264
265 UART3: serial@ef600600 { 265 UART3: serial@ef600600 {
@@ -270,7 +270,7 @@
270 clock-frequency = <0>; /* Filled in by U-Boot */ 270 clock-frequency = <0>; /* Filled in by U-Boot */
271 current-speed = <0>; /* Filled in by U-Boot */ 271 current-speed = <0>; /* Filled in by U-Boot */
272 interrupt-parent = <&UIC1>; 272 interrupt-parent = <&UIC1>;
273 interrupts = <0x1e 0x4>; 273 interrupts = <29 0x4>;
274 }; 274 };
275 275
276 IIC0: i2c@ef600700 { 276 IIC0: i2c@ef600700 {
diff --git a/arch/powerpc/boot/dts/mpc8308rdb.dts b/arch/powerpc/boot/dts/mpc8308rdb.dts
new file mode 100644
index 000000000000..a97eb2db5a18
--- /dev/null
+++ b/arch/powerpc/boot/dts/mpc8308rdb.dts
@@ -0,0 +1,303 @@
1/*
2 * MPC8308RDB Device Tree Source
3 *
4 * Copyright 2009 Freescale Semiconductor Inc.
5 * Copyright 2010 Ilya Yanok, Emcraft Systems, yanok@emcraft.com
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13/dts-v1/;
14
15/ {
16 compatible = "fsl,mpc8308rdb";
17 #address-cells = <1>;
18 #size-cells = <1>;
19
20 aliases {
21 ethernet0 = &enet0;
22 ethernet1 = &enet1;
23 serial0 = &serial0;
24 serial1 = &serial1;
25 pci0 = &pci0;
26 };
27
28 cpus {
29 #address-cells = <1>;
30 #size-cells = <0>;
31
32 PowerPC,8308@0 {
33 device_type = "cpu";
34 reg = <0x0>;
35 d-cache-line-size = <32>;
36 i-cache-line-size = <32>;
37 d-cache-size = <16384>;
38 i-cache-size = <16384>;
39 timebase-frequency = <0>; // from bootloader
40 bus-frequency = <0>; // from bootloader
41 clock-frequency = <0>; // from bootloader
42 };
43 };
44
45 memory {
46 device_type = "memory";
47 reg = <0x00000000 0x08000000>; // 128MB at 0
48 };
49
50 localbus@e0005000 {
51 #address-cells = <2>;
52 #size-cells = <1>;
53 compatible = "fsl,mpc8315-elbc", "fsl,elbc", "simple-bus";
54 reg = <0xe0005000 0x1000>;
55 interrupts = <77 0x8>;
56 interrupt-parent = <&ipic>;
57
58 // CS0 and CS1 are swapped when
59 // booting from nand, but the
60 // addresses are the same.
61 ranges = <0x0 0x0 0xfe000000 0x00800000
62 0x1 0x0 0xe0600000 0x00002000
63 0x2 0x0 0xf0000000 0x00020000
64 0x3 0x0 0xfa000000 0x00008000>;
65
66 flash@0,0 {
67 #address-cells = <1>;
68 #size-cells = <1>;
69 compatible = "cfi-flash";
70 reg = <0x0 0x0 0x800000>;
71 bank-width = <2>;
72 device-width = <1>;
73
74 u-boot@0 {
75 reg = <0x0 0x60000>;
76 read-only;
77 };
78 env@60000 {
79 reg = <0x60000 0x10000>;
80 };
81 env1@70000 {
82 reg = <0x70000 0x10000>;
83 };
84 kernel@80000 {
85 reg = <0x80000 0x200000>;
86 };
87 dtb@280000 {
88 reg = <0x280000 0x10000>;
89 };
90 ramdisk@290000 {
91 reg = <0x290000 0x570000>;
92 };
93 };
94
95 nand@1,0 {
96 #address-cells = <1>;
97 #size-cells = <1>;
98 compatible = "fsl,mpc8315-fcm-nand",
99 "fsl,elbc-fcm-nand";
100 reg = <0x1 0x0 0x2000>;
101
102 jffs2@0 {
103 reg = <0x0 0x2000000>;
104 };
105 };
106 };
107
108 immr@e0000000 {
109 #address-cells = <1>;
110 #size-cells = <1>;
111 device_type = "soc";
112 compatible = "fsl,mpc8315-immr", "simple-bus";
113 ranges = <0 0xe0000000 0x00100000>;
114 reg = <0xe0000000 0x00000200>;
115 bus-frequency = <0>;
116
117 i2c@3000 {
118 #address-cells = <1>;
119 #size-cells = <0>;
120 cell-index = <0>;
121 compatible = "fsl-i2c";
122 reg = <0x3000 0x100>;
123 interrupts = <14 0x8>;
124 interrupt-parent = <&ipic>;
125 dfsrr;
126 rtc@68 {
127 compatible = "dallas,ds1339";
128 reg = <0x68>;
129 };
130 };
131
132 usb@23000 {
133 compatible = "fsl-usb2-dr";
134 reg = <0x23000 0x1000>;
135 #address-cells = <1>;
136 #size-cells = <0>;
137 interrupt-parent = <&ipic>;
138 interrupts = <38 0x8>;
139 dr_mode = "peripheral";
140 phy_type = "ulpi";
141 };
142
143 enet0: ethernet@24000 {
144 #address-cells = <1>;
145 #size-cells = <1>;
146 ranges = <0x0 0x24000 0x1000>;
147
148 cell-index = <0>;
149 device_type = "network";
150 model = "eTSEC";
151 compatible = "gianfar";
152 reg = <0x24000 0x1000>;
153 local-mac-address = [ 00 00 00 00 00 00 ];
154 interrupts = <32 0x8 33 0x8 34 0x8>;
155 interrupt-parent = <&ipic>;
156 tbi-handle = < &tbi0 >;
157 phy-handle = < &phy2 >;
158 fsl,magic-packet;
159
160 mdio@520 {
161 #address-cells = <1>;
162 #size-cells = <0>;
163 compatible = "fsl,gianfar-mdio";
164 reg = <0x520 0x20>;
165 phy2: ethernet-phy@2 {
166 interrupt-parent = <&ipic>;
167 interrupts = <17 0x8>;
168 reg = <0x2>;
169 device_type = "ethernet-phy";
170 };
171 tbi0: tbi-phy@11 {
172 reg = <0x11>;
173 device_type = "tbi-phy";
174 };
175 };
176 };
177
178 enet1: ethernet@25000 {
179 #address-cells = <1>;
180 #size-cells = <1>;
181 cell-index = <1>;
182 device_type = "network";
183 model = "eTSEC";
184 compatible = "gianfar";
185 reg = <0x25000 0x1000>;
186 ranges = <0x0 0x25000 0x1000>;
187 local-mac-address = [ 00 00 00 00 00 00 ];
188 interrupts = <35 0x8 36 0x8 37 0x8>;
189 interrupt-parent = <&ipic>;
190 tbi-handle = < &tbi1 >;
191 /* Vitesse 7385 isn't on the MDIO bus */
192 fixed-link = <1 1 1000 0 0>;
193 fsl,magic-packet;
194
195 mdio@520 {
196 #address-cells = <1>;
197 #size-cells = <0>;
198 compatible = "fsl,gianfar-tbi";
199 reg = <0x520 0x20>;
200
201 tbi1: tbi-phy@11 {
202 reg = <0x11>;
203 device_type = "tbi-phy";
204 };
205 };
206 };
207
208 serial0: serial@4500 {
209 cell-index = <0>;
210 device_type = "serial";
211 compatible = "ns16550";
212 reg = <0x4500 0x100>;
213 clock-frequency = <133333333>;
214 interrupts = <9 0x8>;
215 interrupt-parent = <&ipic>;
216 };
217
218 serial1: serial@4600 {
219 cell-index = <1>;
220 device_type = "serial";
221 compatible = "ns16550";
222 reg = <0x4600 0x100>;
223 clock-frequency = <133333333>;
224 interrupts = <10 0x8>;
225 interrupt-parent = <&ipic>;
226 };
227
228 gpio@c00 {
229 #gpio-cells = <2>;
230 device_type = "gpio";
231 compatible = "fsl,mpc8308-gpio", "fsl,mpc8349-gpio";
232 reg = <0xc00 0x18>;
233 interrupts = <74 0x8>;
234 interrupt-parent = <&ipic>;
235 gpio-controller;
236 };
237
238 /* IPIC
239 * interrupts cell = <intr #, sense>
240 * sense values match linux IORESOURCE_IRQ_* defines:
241 * sense == 8: Level, low assertion
242 * sense == 2: Edge, high-to-low change
243 */
244 ipic: interrupt-controller@700 {
245 compatible = "fsl,ipic";
246 interrupt-controller;
247 #address-cells = <0>;
248 #interrupt-cells = <2>;
249 reg = <0x700 0x100>;
250 device_type = "ipic";
251 };
252
253 ipic-msi@7c0 {
254 compatible = "fsl,ipic-msi";
255 reg = <0x7c0 0x40>;
256 msi-available-ranges = <0x0 0x100>;
257 interrupts = < 0x43 0x8
258 0x4 0x8
259 0x51 0x8
260 0x52 0x8
261 0x56 0x8
262 0x57 0x8
263 0x58 0x8
264 0x59 0x8 >;
265 interrupt-parent = < &ipic >;
266 };
267
268 };
269
270 pci0: pcie@e0009000 {
271 #address-cells = <3>;
272 #size-cells = <2>;
273 #interrupt-cells = <1>;
274 device_type = "pci";
275 compatible = "fsl,mpc8308-pcie", "fsl,mpc8314-pcie";
276 reg = <0xe0009000 0x00001000
277 0xb0000000 0x01000000>;
278 ranges = <0x02000000 0 0xa0000000 0xa0000000 0 0x10000000
279 0x01000000 0 0x00000000 0xb1000000 0 0x00800000>;
280 bus-range = <0 0>;
281 interrupt-map-mask = <0xf800 0 0 7>;
282 interrupt-map = <0 0 0 1 &ipic 1 8
283 0 0 0 2 &ipic 1 8
284 0 0 0 3 &ipic 1 8
285 0 0 0 4 &ipic 1 8>;
286 interrupts = <0x1 0x8>;
287 interrupt-parent = <&ipic>;
288 clock-frequency = <0>;
289
290 pcie@0 {
291 #address-cells = <3>;
292 #size-cells = <2>;
293 device_type = "pci";
294 reg = <0 0 0 0 0>;
295 ranges = <0x02000000 0 0xa0000000
296 0x02000000 0 0xa0000000
297 0 0x10000000
298 0x01000000 0 0x00000000
299 0x01000000 0 0x00000000
300 0 0x00800000>;
301 };
302 };
303};
diff --git a/arch/powerpc/boot/dts/mpc8540ads.dts b/arch/powerpc/boot/dts/mpc8540ads.dts
index 9dc292962a9a..8d1bf0fd9268 100644
--- a/arch/powerpc/boot/dts/mpc8540ads.dts
+++ b/arch/powerpc/boot/dts/mpc8540ads.dts
@@ -71,14 +71,14 @@
71 }; 71 };
72 72
73 memory-controller@2000 { 73 memory-controller@2000 {
74 compatible = "fsl,8540-memory-controller"; 74 compatible = "fsl,mpc8540-memory-controller";
75 reg = <0x2000 0x1000>; 75 reg = <0x2000 0x1000>;
76 interrupt-parent = <&mpic>; 76 interrupt-parent = <&mpic>;
77 interrupts = <18 2>; 77 interrupts = <18 2>;
78 }; 78 };
79 79
80 L2: l2-cache-controller@20000 { 80 L2: l2-cache-controller@20000 {
81 compatible = "fsl,8540-l2-cache-controller"; 81 compatible = "fsl,mpc8540-l2-cache-controller";
82 reg = <0x20000 0x1000>; 82 reg = <0x20000 0x1000>;
83 cache-line-size = <32>; // 32 bytes 83 cache-line-size = <32>; // 32 bytes
84 cache-size = <0x40000>; // L2, 256K 84 cache-size = <0x40000>; // L2, 256K
diff --git a/arch/powerpc/boot/dts/mpc8541cds.dts b/arch/powerpc/boot/dts/mpc8541cds.dts
index 9a3ad311aedf..87ff96549fac 100644
--- a/arch/powerpc/boot/dts/mpc8541cds.dts
+++ b/arch/powerpc/boot/dts/mpc8541cds.dts
@@ -71,14 +71,14 @@
71 }; 71 };
72 72
73 memory-controller@2000 { 73 memory-controller@2000 {
74 compatible = "fsl,8541-memory-controller"; 74 compatible = "fsl,mpc8541-memory-controller";
75 reg = <0x2000 0x1000>; 75 reg = <0x2000 0x1000>;
76 interrupt-parent = <&mpic>; 76 interrupt-parent = <&mpic>;
77 interrupts = <18 2>; 77 interrupts = <18 2>;
78 }; 78 };
79 79
80 L2: l2-cache-controller@20000 { 80 L2: l2-cache-controller@20000 {
81 compatible = "fsl,8541-l2-cache-controller"; 81 compatible = "fsl,mpc8541-l2-cache-controller";
82 reg = <0x20000 0x1000>; 82 reg = <0x20000 0x1000>;
83 cache-line-size = <32>; // 32 bytes 83 cache-line-size = <32>; // 32 bytes
84 cache-size = <0x40000>; // L2, 256K 84 cache-size = <0x40000>; // L2, 256K
diff --git a/arch/powerpc/boot/dts/mpc8544ds.dts b/arch/powerpc/boot/dts/mpc8544ds.dts
index 98e94b465662..d793968743c9 100644
--- a/arch/powerpc/boot/dts/mpc8544ds.dts
+++ b/arch/powerpc/boot/dts/mpc8544ds.dts
@@ -73,14 +73,14 @@
73 }; 73 };
74 74
75 memory-controller@2000 { 75 memory-controller@2000 {
76 compatible = "fsl,8544-memory-controller"; 76 compatible = "fsl,mpc8544-memory-controller";
77 reg = <0x2000 0x1000>; 77 reg = <0x2000 0x1000>;
78 interrupt-parent = <&mpic>; 78 interrupt-parent = <&mpic>;
79 interrupts = <18 2>; 79 interrupts = <18 2>;
80 }; 80 };
81 81
82 L2: l2-cache-controller@20000 { 82 L2: l2-cache-controller@20000 {
83 compatible = "fsl,8544-l2-cache-controller"; 83 compatible = "fsl,mpc8544-l2-cache-controller";
84 reg = <0x20000 0x1000>; 84 reg = <0x20000 0x1000>;
85 cache-line-size = <32>; // 32 bytes 85 cache-line-size = <32>; // 32 bytes
86 cache-size = <0x40000>; // L2, 256K 86 cache-size = <0x40000>; // L2, 256K
diff --git a/arch/powerpc/boot/dts/mpc8548cds.dts b/arch/powerpc/boot/dts/mpc8548cds.dts
index 0f5262452682..a17a5572fb73 100644
--- a/arch/powerpc/boot/dts/mpc8548cds.dts
+++ b/arch/powerpc/boot/dts/mpc8548cds.dts
@@ -74,14 +74,14 @@
74 }; 74 };
75 75
76 memory-controller@2000 { 76 memory-controller@2000 {
77 compatible = "fsl,8548-memory-controller"; 77 compatible = "fsl,mpc8548-memory-controller";
78 reg = <0x2000 0x1000>; 78 reg = <0x2000 0x1000>;
79 interrupt-parent = <&mpic>; 79 interrupt-parent = <&mpic>;
80 interrupts = <18 2>; 80 interrupts = <18 2>;
81 }; 81 };
82 82
83 L2: l2-cache-controller@20000 { 83 L2: l2-cache-controller@20000 {
84 compatible = "fsl,8548-l2-cache-controller"; 84 compatible = "fsl,mpc8548-l2-cache-controller";
85 reg = <0x20000 0x1000>; 85 reg = <0x20000 0x1000>;
86 cache-line-size = <32>; // 32 bytes 86 cache-line-size = <32>; // 32 bytes
87 cache-size = <0x80000>; // L2, 512K 87 cache-size = <0x80000>; // L2, 512K
diff --git a/arch/powerpc/boot/dts/mpc8555cds.dts b/arch/powerpc/boot/dts/mpc8555cds.dts
index 065b2f093de2..5c5614f9eb17 100644
--- a/arch/powerpc/boot/dts/mpc8555cds.dts
+++ b/arch/powerpc/boot/dts/mpc8555cds.dts
@@ -71,14 +71,14 @@
71 }; 71 };
72 72
73 memory-controller@2000 { 73 memory-controller@2000 {
74 compatible = "fsl,8555-memory-controller"; 74 compatible = "fsl,mpc8555-memory-controller";
75 reg = <0x2000 0x1000>; 75 reg = <0x2000 0x1000>;
76 interrupt-parent = <&mpic>; 76 interrupt-parent = <&mpic>;
77 interrupts = <18 2>; 77 interrupts = <18 2>;
78 }; 78 };
79 79
80 L2: l2-cache-controller@20000 { 80 L2: l2-cache-controller@20000 {
81 compatible = "fsl,8555-l2-cache-controller"; 81 compatible = "fsl,mpc8555-l2-cache-controller";
82 reg = <0x20000 0x1000>; 82 reg = <0x20000 0x1000>;
83 cache-line-size = <32>; // 32 bytes 83 cache-line-size = <32>; // 32 bytes
84 cache-size = <0x40000>; // L2, 256K 84 cache-size = <0x40000>; // L2, 256K
diff --git a/arch/powerpc/boot/dts/mpc8560ads.dts b/arch/powerpc/boot/dts/mpc8560ads.dts
index a5bb1ec70a5a..6e85e1ba0851 100644
--- a/arch/powerpc/boot/dts/mpc8560ads.dts
+++ b/arch/powerpc/boot/dts/mpc8560ads.dts
@@ -71,14 +71,14 @@
71 }; 71 };
72 72
73 memory-controller@2000 { 73 memory-controller@2000 {
74 compatible = "fsl,8540-memory-controller"; 74 compatible = "fsl,mpc8540-memory-controller";
75 reg = <0x2000 0x1000>; 75 reg = <0x2000 0x1000>;
76 interrupt-parent = <&mpic>; 76 interrupt-parent = <&mpic>;
77 interrupts = <18 2>; 77 interrupts = <18 2>;
78 }; 78 };
79 79
80 L2: l2-cache-controller@20000 { 80 L2: l2-cache-controller@20000 {
81 compatible = "fsl,8540-l2-cache-controller"; 81 compatible = "fsl,mpc8540-l2-cache-controller";
82 reg = <0x20000 0x1000>; 82 reg = <0x20000 0x1000>;
83 cache-line-size = <32>; // 32 bytes 83 cache-line-size = <32>; // 32 bytes
84 cache-size = <0x40000>; // L2, 256K 84 cache-size = <0x40000>; // L2, 256K
diff --git a/arch/powerpc/boot/dts/mpc8568mds.dts b/arch/powerpc/boot/dts/mpc8568mds.dts
index 92fb17876e7d..30cf0e098bb9 100644
--- a/arch/powerpc/boot/dts/mpc8568mds.dts
+++ b/arch/powerpc/boot/dts/mpc8568mds.dts
@@ -124,14 +124,14 @@
124 }; 124 };
125 125
126 memory-controller@2000 { 126 memory-controller@2000 {
127 compatible = "fsl,8568-memory-controller"; 127 compatible = "fsl,mpc8568-memory-controller";
128 reg = <0x2000 0x1000>; 128 reg = <0x2000 0x1000>;
129 interrupt-parent = <&mpic>; 129 interrupt-parent = <&mpic>;
130 interrupts = <18 2>; 130 interrupts = <18 2>;
131 }; 131 };
132 132
133 L2: l2-cache-controller@20000 { 133 L2: l2-cache-controller@20000 {
134 compatible = "fsl,8568-l2-cache-controller"; 134 compatible = "fsl,mpc8568-l2-cache-controller";
135 reg = <0x20000 0x1000>; 135 reg = <0x20000 0x1000>;
136 cache-line-size = <32>; // 32 bytes 136 cache-line-size = <32>; // 32 bytes
137 cache-size = <0x80000>; // L2, 512K 137 cache-size = <0x80000>; // L2, 512K
diff --git a/arch/powerpc/boot/dts/p1021mds.dts b/arch/powerpc/boot/dts/p1021mds.dts
index 7fad2df25981..ad5b85269004 100644
--- a/arch/powerpc/boot/dts/p1021mds.dts
+++ b/arch/powerpc/boot/dts/p1021mds.dts
@@ -617,6 +617,7 @@
617 bus-frequency = <0>; 617 bus-frequency = <0>;
618 fsl,qe-num-riscs = <1>; 618 fsl,qe-num-riscs = <1>;
619 fsl,qe-num-snums = <28>; 619 fsl,qe-num-snums = <28>;
620 status = "disabled"; /* no firmware loaded */
620 621
621 qeic: interrupt-controller@80 { 622 qeic: interrupt-controller@80 {
622 interrupt-controller; 623 interrupt-controller;
diff --git a/arch/powerpc/boot/dts/p1022ds.dts b/arch/powerpc/boot/dts/p1022ds.dts
new file mode 100644
index 000000000000..8bcb10b92677
--- /dev/null
+++ b/arch/powerpc/boot/dts/p1022ds.dts
@@ -0,0 +1,633 @@
1/*
2 * P1022 DS 36Bit Physical Address Map Device Tree Source
3 *
4 * Copyright 2010 Freescale Semiconductor, Inc.
5 *
6 * This file is licensed under the terms of the GNU General Public License
7 * version 2. This program is licensed "as is" without any warranty of any
8 * kind, whether express or implied.
9 */
10
11/dts-v1/;
12/ {
13 model = "fsl,P1022";
14 compatible = "fsl,P1022DS";
15 #address-cells = <2>;
16 #size-cells = <2>;
17 interrupt-parent = <&mpic>;
18
19 aliases {
20 ethernet0 = &enet0;
21 ethernet1 = &enet1;
22 serial0 = &serial0;
23 serial1 = &serial1;
24 pci0 = &pci0;
25 pci1 = &pci1;
26 pci2 = &pci2;
27 };
28
29 cpus {
30 #address-cells = <1>;
31 #size-cells = <0>;
32
33 PowerPC,P1022@0 {
34 device_type = "cpu";
35 reg = <0x0>;
36 next-level-cache = <&L2>;
37 };
38
39 PowerPC,P1022@1 {
40 device_type = "cpu";
41 reg = <0x1>;
42 next-level-cache = <&L2>;
43 };
44 };
45
46 memory {
47 device_type = "memory";
48 };
49
50 localbus@fffe05000 {
51 #address-cells = <2>;
52 #size-cells = <1>;
53 compatible = "fsl,p1022-elbc", "fsl,elbc", "simple-bus";
54 reg = <0 0xffe05000 0 0x1000>;
55 interrupts = <19 2>;
56
57 ranges = <0x0 0x0 0xf 0xe8000000 0x08000000
58 0x1 0x0 0xf 0xe0000000 0x08000000
59 0x2 0x0 0x0 0xffa00000 0x00040000
60 0x3 0x0 0xf 0xffdf0000 0x00008000>;
61
62 nor@0,0 {
63 #address-cells = <1>;
64 #size-cells = <1>;
65 compatible = "cfi-flash";
66 reg = <0x0 0x0 0x8000000>;
67 bank-width = <2>;
68 device-width = <1>;
69
70 partition@0 {
71 reg = <0x0 0x03000000>;
72 label = "ramdisk-nor";
73 read-only;
74 };
75
76 partition@3000000 {
77 reg = <0x03000000 0x00e00000>;
78 label = "diagnostic-nor";
79 read-only;
80 };
81
82 partition@3e00000 {
83 reg = <0x03e00000 0x00200000>;
84 label = "dink-nor";
85 read-only;
86 };
87
88 partition@4000000 {
89 reg = <0x04000000 0x00400000>;
90 label = "kernel-nor";
91 read-only;
92 };
93
94 partition@4400000 {
95 reg = <0x04400000 0x03b00000>;
96 label = "jffs2-nor";
97 };
98
99 partition@7f00000 {
100 reg = <0x07f00000 0x00080000>;
101 label = "dtb-nor";
102 read-only;
103 };
104
105 partition@7f80000 {
106 reg = <0x07f80000 0x00080000>;
107 label = "u-boot-nor";
108 read-only;
109 };
110 };
111
112 nand@2,0 {
113 #address-cells = <1>;
114 #size-cells = <1>;
115 compatible = "fsl,elbc-fcm-nand";
116 reg = <0x2 0x0 0x40000>;
117
118 partition@0 {
119 reg = <0x0 0x02000000>;
120 label = "u-boot-nand";
121 read-only;
122 };
123
124 partition@2000000 {
125 reg = <0x02000000 0x10000000>;
126 label = "jffs2-nand";
127 };
128
129 partition@12000000 {
130 reg = <0x12000000 0x10000000>;
131 label = "ramdisk-nand";
132 read-only;
133 };
134
135 partition@22000000 {
136 reg = <0x22000000 0x04000000>;
137 label = "kernel-nand";
138 };
139
140 partition@26000000 {
141 reg = <0x26000000 0x01000000>;
142 label = "dtb-nand";
143 read-only;
144 };
145
146 partition@27000000 {
147 reg = <0x27000000 0x19000000>;
148 label = "reserved-nand";
149 };
150 };
151 };
152
153 soc@fffe00000 {
154 #address-cells = <1>;
155 #size-cells = <1>;
156 device_type = "soc";
157 compatible = "fsl,p1022-immr", "simple-bus";
158 ranges = <0x0 0xf 0xffe00000 0x100000>;
159 bus-frequency = <0>; // Filled out by uboot.
160
161 ecm-law@0 {
162 compatible = "fsl,ecm-law";
163 reg = <0x0 0x1000>;
164 fsl,num-laws = <12>;
165 };
166
167 ecm@1000 {
168 compatible = "fsl,p1022-ecm", "fsl,ecm";
169 reg = <0x1000 0x1000>;
170 interrupts = <16 2>;
171 };
172
173 memory-controller@2000 {
174 compatible = "fsl,p1022-memory-controller";
175 reg = <0x2000 0x1000>;
176 interrupts = <16 2>;
177 };
178
179 i2c@3000 {
180 #address-cells = <1>;
181 #size-cells = <0>;
182 cell-index = <0>;
183 compatible = "fsl-i2c";
184 reg = <0x3000 0x100>;
185 interrupts = <43 2>;
186 dfsrr;
187 };
188
189 i2c@3100 {
190 #address-cells = <1>;
191 #size-cells = <0>;
192 cell-index = <1>;
193 compatible = "fsl-i2c";
194 reg = <0x3100 0x100>;
195 interrupts = <43 2>;
196 dfsrr;
197
198 wm8776:codec@1a {
199 compatible = "wlf,wm8776";
200 reg = <0x1a>;
201 /* MCLK source is a stand-alone oscillator */
202 clock-frequency = <12288000>;
203 };
204 };
205
206 serial0: serial@4500 {
207 cell-index = <0>;
208 device_type = "serial";
209 compatible = "ns16550";
210 reg = <0x4500 0x100>;
211 clock-frequency = <0>;
212 interrupts = <42 2>;
213 };
214
215 serial1: serial@4600 {
216 cell-index = <1>;
217 device_type = "serial";
218 compatible = "ns16550";
219 reg = <0x4600 0x100>;
220 clock-frequency = <0>;
221 interrupts = <42 2>;
222 };
223
224 spi@7000 {
225 cell-index = <0>;
226 #address-cells = <1>;
227 #size-cells = <0>;
228 compatible = "fsl,espi";
229 reg = <0x7000 0x1000>;
230 interrupts = <59 0x2>;
231 espi,num-ss-bits = <4>;
232 mode = "cpu";
233
234 fsl_m25p80@0 {
235 #address-cells = <1>;
236 #size-cells = <1>;
237 compatible = "fsl,espi-flash";
238 reg = <0>;
239 linux,modalias = "fsl_m25p80";
240 spi-max-frequency = <40000000>; /* input clock */
241 partition@0 {
242 label = "u-boot-spi";
243 reg = <0x00000000 0x00100000>;
244 read-only;
245 };
246 partition@100000 {
247 label = "kernel-spi";
248 reg = <0x00100000 0x00500000>;
249 read-only;
250 };
251 partition@600000 {
252 label = "dtb-spi";
253 reg = <0x00600000 0x00100000>;
254 read-only;
255 };
256 partition@700000 {
257 label = "file system-spi";
258 reg = <0x00700000 0x00900000>;
259 };
260 };
261 };
262
263 ssi@15000 {
264 compatible = "fsl,mpc8610-ssi";
265 cell-index = <0>;
266 reg = <0x15000 0x100>;
267 interrupts = <75 2>;
268 fsl,mode = "i2s-slave";
269 codec-handle = <&wm8776>;
270 fsl,playback-dma = <&dma00>;
271 fsl,capture-dma = <&dma01>;
272 fsl,fifo-depth = <16>;
273 };
274
275 dma@c300 {
276 #address-cells = <1>;
277 #size-cells = <1>;
278 compatible = "fsl,eloplus-dma";
279 reg = <0xc300 0x4>;
280 ranges = <0x0 0xc100 0x200>;
281 cell-index = <1>;
282 dma00: dma-channel@0 {
283 compatible = "fsl,eloplus-dma-channel";
284 reg = <0x0 0x80>;
285 cell-index = <0>;
286 interrupts = <76 2>;
287 };
288 dma01: dma-channel@80 {
289 compatible = "fsl,eloplus-dma-channel";
290 reg = <0x80 0x80>;
291 cell-index = <1>;
292 interrupts = <77 2>;
293 };
294 dma-channel@100 {
295 compatible = "fsl,eloplus-dma-channel";
296 reg = <0x100 0x80>;
297 cell-index = <2>;
298 interrupts = <78 2>;
299 };
300 dma-channel@180 {
301 compatible = "fsl,eloplus-dma-channel";
302 reg = <0x180 0x80>;
303 cell-index = <3>;
304 interrupts = <79 2>;
305 };
306 };
307
308 gpio: gpio-controller@f000 {
309 #gpio-cells = <2>;
310 compatible = "fsl,mpc8572-gpio";
311 reg = <0xf000 0x100>;
312 interrupts = <47 0x2>;
313 gpio-controller;
314 };
315
316 L2: l2-cache-controller@20000 {
317 compatible = "fsl,p1022-l2-cache-controller";
318 reg = <0x20000 0x1000>;
319 cache-line-size = <32>; // 32 bytes
320 cache-size = <0x40000>; // L2, 256K
321 interrupts = <16 2>;
322 };
323
324 dma@21300 {
325 #address-cells = <1>;
326 #size-cells = <1>;
327 compatible = "fsl,eloplus-dma";
328 reg = <0x21300 0x4>;
329 ranges = <0x0 0x21100 0x200>;
330 cell-index = <0>;
331 dma-channel@0 {
332 compatible = "fsl,eloplus-dma-channel";
333 reg = <0x0 0x80>;
334 cell-index = <0>;
335 interrupts = <20 2>;
336 };
337 dma-channel@80 {
338 compatible = "fsl,eloplus-dma-channel";
339 reg = <0x80 0x80>;
340 cell-index = <1>;
341 interrupts = <21 2>;
342 };
343 dma-channel@100 {
344 compatible = "fsl,eloplus-dma-channel";
345 reg = <0x100 0x80>;
346 cell-index = <2>;
347 interrupts = <22 2>;
348 };
349 dma-channel@180 {
350 compatible = "fsl,eloplus-dma-channel";
351 reg = <0x180 0x80>;
352 cell-index = <3>;
353 interrupts = <23 2>;
354 };
355 };
356
357 usb@22000 {
358 #address-cells = <1>;
359 #size-cells = <0>;
360 compatible = "fsl-usb2-dr";
361 reg = <0x22000 0x1000>;
362 interrupts = <28 0x2>;
363 phy_type = "ulpi";
364 };
365
366 mdio@24000 {
367 #address-cells = <1>;
368 #size-cells = <0>;
369 compatible = "fsl,etsec2-mdio";
370 reg = <0x24000 0x1000 0xb0030 0x4>;
371
372 phy0: ethernet-phy@0 {
373 interrupts = <3 1>;
374 reg = <0x1>;
375 };
376 phy1: ethernet-phy@1 {
377 interrupts = <9 1>;
378 reg = <0x2>;
379 };
380 };
381
382 mdio@25000 {
383 #address-cells = <1>;
384 #size-cells = <0>;
385 compatible = "fsl,etsec2-mdio";
386 reg = <0x25000 0x1000 0xb1030 0x4>;
387 };
388
389 enet0: ethernet@B0000 {
390 #address-cells = <1>;
391 #size-cells = <1>;
392 cell-index = <0>;
393 device_type = "network";
394 model = "eTSEC";
395 compatible = "fsl,etsec2";
396 fsl,num_rx_queues = <0x8>;
397 fsl,num_tx_queues = <0x8>;
398 fsl,magic-packet;
399 fsl,wake-on-filer;
400 local-mac-address = [ 00 00 00 00 00 00 ];
401 fixed-link = <1 1 1000 0 0>;
402 phy-handle = <&phy0>;
403 phy-connection-type = "rgmii-id";
404 queue-group@0{
405 #address-cells = <1>;
406 #size-cells = <1>;
407 reg = <0xB0000 0x1000>;
408 interrupts = <29 2 30 2 34 2>;
409 };
410 queue-group@1{
411 #address-cells = <1>;
412 #size-cells = <1>;
413 reg = <0xB4000 0x1000>;
414 interrupts = <17 2 18 2 24 2>;
415 };
416 };
417
418 enet1: ethernet@B1000 {
419 #address-cells = <1>;
420 #size-cells = <1>;
421 cell-index = <0>;
422 device_type = "network";
423 model = "eTSEC";
424 compatible = "fsl,etsec2";
425 fsl,num_rx_queues = <0x8>;
426 fsl,num_tx_queues = <0x8>;
427 local-mac-address = [ 00 00 00 00 00 00 ];
428 fixed-link = <1 1 1000 0 0>;
429 phy-handle = <&phy1>;
430 phy-connection-type = "rgmii-id";
431 queue-group@0{
432 #address-cells = <1>;
433 #size-cells = <1>;
434 reg = <0xB1000 0x1000>;
435 interrupts = <35 2 36 2 40 2>;
436 };
437 queue-group@1{
438 #address-cells = <1>;
439 #size-cells = <1>;
440 reg = <0xB5000 0x1000>;
441 interrupts = <51 2 52 2 67 2>;
442 };
443 };
444
445 sdhci@2e000 {
446 compatible = "fsl,p1022-esdhc", "fsl,esdhc";
447 reg = <0x2e000 0x1000>;
448 interrupts = <72 0x2>;
449 fsl,sdhci-auto-cmd12;
450 /* Filled in by U-Boot */
451 clock-frequency = <0>;
452 };
453
454 crypto@30000 {
455 compatible = "fsl,sec3.3", "fsl,sec3.1", "fsl,sec3.0",
456 "fsl,sec2.4", "fsl,sec2.2", "fsl,sec2.1",
457 "fsl,sec2.0";
458 reg = <0x30000 0x10000>;
459 interrupts = <45 2 58 2>;
460 fsl,num-channels = <4>;
461 fsl,channel-fifo-len = <24>;
462 fsl,exec-units-mask = <0x97c>;
463 fsl,descriptor-types-mask = <0x3a30abf>;
464 };
465
466 sata@18000 {
467 compatible = "fsl,mpc8536-sata", "fsl,pq-sata";
468 reg = <0x18000 0x1000>;
469 cell-index = <1>;
470 interrupts = <74 0x2>;
471 };
472
473 sata@19000 {
474 compatible = "fsl,mpc8536-sata", "fsl,pq-sata";
475 reg = <0x19000 0x1000>;
476 cell-index = <2>;
477 interrupts = <41 0x2>;
478 };
479
480 power@e0070{
481 compatible = "fsl,mpc8536-pmc", "fsl,mpc8548-pmc";
482 reg = <0xe0070 0x20>;
483 };
484
485 display@10000 {
486 compatible = "fsl,diu", "fsl,p1022-diu";
487 reg = <0x10000 1000>;
488 interrupts = <64 2>;
489 };
490
491 timer@41100 {
492 compatible = "fsl,mpic-global-timer";
493 reg = <0x41100 0x204>;
494 interrupts = <0xf7 0x2>;
495 };
496
497 mpic: pic@40000 {
498 interrupt-controller;
499 #address-cells = <0>;
500 #interrupt-cells = <2>;
501 reg = <0x40000 0x40000>;
502 compatible = "chrp,open-pic";
503 device_type = "open-pic";
504 };
505
506 msi@41600 {
507 compatible = "fsl,p1022-msi", "fsl,mpic-msi";
508 reg = <0x41600 0x80>;
509 msi-available-ranges = <0 0x100>;
510 interrupts = <
511 0xe0 0
512 0xe1 0
513 0xe2 0
514 0xe3 0
515 0xe4 0
516 0xe5 0
517 0xe6 0
518 0xe7 0>;
519 };
520
521 global-utilities@e0000 { //global utilities block
522 compatible = "fsl,p1022-guts";
523 reg = <0xe0000 0x1000>;
524 fsl,has-rstcr;
525 };
526 };
527
528 pci0: pcie@fffe09000 {
529 compatible = "fsl,p1022-pcie";
530 device_type = "pci";
531 #interrupt-cells = <1>;
532 #size-cells = <2>;
533 #address-cells = <3>;
534 reg = <0xf 0xffe09000 0 0x1000>;
535 bus-range = <0 255>;
536 ranges = <0x2000000 0x0 0xa0000000 0xc 0x20000000 0x0 0x20000000
537 0x1000000 0x0 0x00000000 0xf 0xffc10000 0x0 0x10000>;
538 clock-frequency = <33333333>;
539 interrupts = <16 2>;
540 interrupt-map-mask = <0xf800 0 0 7>;
541 interrupt-map = <
542 /* IDSEL 0x0 */
543 0000 0 0 1 &mpic 4 1
544 0000 0 0 2 &mpic 5 1
545 0000 0 0 3 &mpic 6 1
546 0000 0 0 4 &mpic 7 1
547 >;
548 pcie@0 {
549 reg = <0x0 0x0 0x0 0x0 0x0>;
550 #size-cells = <2>;
551 #address-cells = <3>;
552 device_type = "pci";
553 ranges = <0x2000000 0x0 0xe0000000
554 0x2000000 0x0 0xe0000000
555 0x0 0x20000000
556
557 0x1000000 0x0 0x0
558 0x1000000 0x0 0x0
559 0x0 0x100000>;
560 };
561 };
562
563 pci1: pcie@fffe0a000 {
564 compatible = "fsl,p1022-pcie";
565 device_type = "pci";
566 #interrupt-cells = <1>;
567 #size-cells = <2>;
568 #address-cells = <3>;
569 reg = <0xf 0xffe0a000 0 0x1000>;
570 bus-range = <0 255>;
571 ranges = <0x2000000 0x0 0xc0000000 0xc 0x40000000 0x0 0x20000000
572 0x1000000 0x0 0x00000000 0xf 0xffc20000 0x0 0x10000>;
573 clock-frequency = <33333333>;
574 interrupts = <16 2>;
575 interrupt-map-mask = <0xf800 0 0 7>;
576 interrupt-map = <
577 /* IDSEL 0x0 */
578 0000 0 0 1 &mpic 0 1
579 0000 0 0 2 &mpic 1 1
580 0000 0 0 3 &mpic 2 1
581 0000 0 0 4 &mpic 3 1
582 >;
583 pcie@0 {
584 reg = <0x0 0x0 0x0 0x0 0x0>;
585 #size-cells = <2>;
586 #address-cells = <3>;
587 device_type = "pci";
588 ranges = <0x2000000 0x0 0xe0000000
589 0x2000000 0x0 0xe0000000
590 0x0 0x20000000
591
592 0x1000000 0x0 0x0
593 0x1000000 0x0 0x0
594 0x0 0x100000>;
595 };
596 };
597
598
599 pci2: pcie@fffe0b000 {
600 compatible = "fsl,p1022-pcie";
601 device_type = "pci";
602 #interrupt-cells = <1>;
603 #size-cells = <2>;
604 #address-cells = <3>;
605 reg = <0xf 0xffe0b000 0 0x1000>;
606 bus-range = <0 255>;
607 ranges = <0x2000000 0x0 0x80000000 0xc 0x00000000 0x0 0x20000000
608 0x1000000 0x0 0x00000000 0xf 0xffc00000 0x0 0x10000>;
609 clock-frequency = <33333333>;
610 interrupts = <16 2>;
611 interrupt-map-mask = <0xf800 0 0 7>;
612 interrupt-map = <
613 /* IDSEL 0x0 */
614 0000 0 0 1 &mpic 8 1
615 0000 0 0 2 &mpic 9 1
616 0000 0 0 3 &mpic 10 1
617 0000 0 0 4 &mpic 11 1
618 >;
619 pcie@0 {
620 reg = <0x0 0x0 0x0 0x0 0x0>;
621 #size-cells = <2>;
622 #address-cells = <3>;
623 device_type = "pci";
624 ranges = <0x2000000 0x0 0xe0000000
625 0x2000000 0x0 0xe0000000
626 0x0 0x20000000
627
628 0x1000000 0x0 0x0
629 0x1000000 0x0 0x0
630 0x0 0x100000>;
631 };
632 };
633};
diff --git a/arch/powerpc/boot/dts/pdm360ng.dts b/arch/powerpc/boot/dts/pdm360ng.dts
new file mode 100644
index 000000000000..94dfa5c9a7f9
--- /dev/null
+++ b/arch/powerpc/boot/dts/pdm360ng.dts
@@ -0,0 +1,410 @@
1/*
2 * Device Tree Source for IFM PDM360NG.
3 *
4 * Copyright 2009 - 2010 DENX Software Engineering.
5 * Anatolij Gustschin <agust@denx.de>
6 *
7 * Based on MPC5121E ADS dts.
8 * Copyright 2008 Freescale Semiconductor Inc.
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16/dts-v1/;
17
18/ {
19 model = "pdm360ng";
20 compatible = "ifm,pdm360ng";
21 #address-cells = <1>;
22 #size-cells = <1>;
23 interrupt-parent = <&ipic>;
24
25 aliases {
26 ethernet0 = &eth0;
27 };
28
29 cpus {
30 #address-cells = <1>;
31 #size-cells = <0>;
32
33 PowerPC,5121@0 {
34 device_type = "cpu";
35 reg = <0>;
36 d-cache-line-size = <0x20>; // 32 bytes
37 i-cache-line-size = <0x20>; // 32 bytes
38 d-cache-size = <0x8000>; // L1, 32K
39 i-cache-size = <0x8000>; // L1, 32K
40 timebase-frequency = <49500000>;// 49.5 MHz (csb/4)
41 bus-frequency = <198000000>; // 198 MHz csb bus
42 clock-frequency = <396000000>; // 396 MHz ppc core
43 };
44 };
45
46 memory {
47 device_type = "memory";
48 reg = <0x00000000 0x20000000>; // 512MB at 0
49 };
50
51 nfc@40000000 {
52 compatible = "fsl,mpc5121-nfc";
53 reg = <0x40000000 0x100000>;
54 interrupts = <0x6 0x8>;
55 #address-cells = <0x1>;
56 #size-cells = <0x1>;
57 bank-width = <0x1>;
58 chips = <0x1>;
59
60 partition@0 {
61 label = "nand0";
62 reg = <0x0 0x40000000>;
63 };
64 };
65
66 sram@50000000 {
67 compatible = "fsl,mpc5121-sram";
68 reg = <0x50000000 0x20000>; // 128K at 0x50000000
69 };
70
71 localbus@80000020 {
72 compatible = "fsl,mpc5121-localbus";
73 #address-cells = <2>;
74 #size-cells = <1>;
75 reg = <0x80000020 0x40>;
76
77 ranges = <0x0 0x0 0xf0000000 0x10000000 /* Flash */
78 0x2 0x0 0x50040000 0x00020000>; /* CS2: MRAM */
79
80 flash@0,0 {
81 compatible = "amd,s29gl01gp", "cfi-flash";
82 reg = <0 0x00000000 0x08000000
83 0 0x08000000 0x08000000>;
84 #address-cells = <1>;
85 #size-cells = <1>;
86 bank-width = <4>;
87 device-width = <2>;
88
89 partition@0 {
90 label = "u-boot";
91 reg = <0x00000000 0x00080000>;
92 read-only;
93 };
94 partition@80000 {
95 label = "environment";
96 reg = <0x00080000 0x00080000>;
97 read-only;
98 };
99 partition@100000 {
100 label = "splash-image";
101 reg = <0x00100000 0x00080000>;
102 read-only;
103 };
104 partition@180000 {
105 label = "device-tree";
106 reg = <0x00180000 0x00040000>;
107 };
108 partition@1c0000 {
109 label = "kernel";
110 reg = <0x001c0000 0x00500000>;
111 };
112 partition@6c0000 {
113 label = "filesystem";
114 reg = <0x006c0000 0x07940000>;
115 };
116 };
117
118 mram0@2,0 {
119 compatible = "mtd-ram";
120 reg = <2 0x00000 0x10000>;
121 bank-width = <2>;
122 };
123
124 mram1@2,10000 {
125 compatible = "mtd-ram";
126 reg = <2 0x010000 0x10000>;
127 bank-width = <2>;
128 };
129 };
130
131 soc@80000000 {
132 compatible = "fsl,mpc5121-immr";
133 #address-cells = <1>;
134 #size-cells = <1>;
135 #interrupt-cells = <2>;
136 ranges = <0x0 0x80000000 0x400000>;
137 reg = <0x80000000 0x400000>;
138 bus-frequency = <66000000>; // 66 MHz ips bus
139
140 // IPIC
141 // interrupts cell = <intr #, sense>
142 // sense values match linux IORESOURCE_IRQ_* defines:
143 // sense == 8: Level, low assertion
144 // sense == 2: Edge, high-to-low change
145 //
146 ipic: interrupt-controller@c00 {
147 compatible = "fsl,mpc5121-ipic", "fsl,ipic";
148 interrupt-controller;
149 #address-cells = <0>;
150 #interrupt-cells = <2>;
151 reg = <0xc00 0x100>;
152 };
153
154 rtc@a00 { // Real time clock
155 compatible = "fsl,mpc5121-rtc";
156 reg = <0xa00 0x100>;
157 interrupts = <79 0x8 80 0x8>;
158 };
159
160 reset@e00 { // Reset module
161 compatible = "fsl,mpc5121-reset";
162 reg = <0xe00 0x100>;
163 };
164
165 clock@f00 { // Clock control
166 compatible = "fsl,mpc5121-clock";
167 reg = <0xf00 0x100>;
168 };
169
170 pmc@1000{ //Power Management Controller
171 compatible = "fsl,mpc5121-pmc";
172 reg = <0x1000 0x100>;
173 interrupts = <83 0x2>;
174 };
175
176 gpio@1100 {
177 compatible = "fsl,mpc5121-gpio";
178 reg = <0x1100 0x100>;
179 interrupts = <78 0x8>;
180 };
181
182 can@1300 {
183 compatible = "fsl,mpc5121-mscan";
184 interrupts = <12 0x8>;
185 reg = <0x1300 0x80>;
186 };
187
188 can@1380 {
189 compatible = "fsl,mpc5121-mscan";
190 interrupts = <13 0x8>;
191 reg = <0x1380 0x80>;
192 };
193
194 i2c@1700 {
195 #address-cells = <1>;
196 #size-cells = <0>;
197 compatible = "fsl,mpc5121-i2c";
198 reg = <0x1700 0x20>;
199 interrupts = <0x9 0x8>;
200 fsl,preserve-clocking;
201
202 eeprom@50 {
203 compatible = "at,24c01";
204 reg = <0x50>;
205 };
206
207 rtc@68 {
208 compatible = "stm,m41t00";
209 reg = <0x68>;
210 };
211 };
212
213 i2c@1740 {
214 #address-cells = <1>;
215 #size-cells = <0>;
216 compatible = "fsl,mpc5121-i2c";
217 reg = <0x1740 0x20>;
218 interrupts = <0xb 0x8>;
219 fsl,preserve-clocking;
220 };
221
222 i2ccontrol@1760 {
223 compatible = "fsl,mpc5121-i2c-ctrl";
224 reg = <0x1760 0x8>;
225 };
226
227 axe@2000 {
228 compatible = "fsl,mpc5121-axe";
229 reg = <0x2000 0x100>;
230 interrupts = <42 0x8>;
231 };
232
233 display@2100 {
234 compatible = "fsl,mpc5121-diu";
235 reg = <0x2100 0x100>;
236 interrupts = <64 0x8>;
237 };
238
239 can@2300 {
240 compatible = "fsl,mpc5121-mscan";
241 interrupts = <90 0x8>;
242 reg = <0x2300 0x80>;
243 };
244
245 can@2380 {
246 compatible = "fsl,mpc5121-mscan";
247 interrupts = <91 0x8>;
248 reg = <0x2380 0x80>;
249 };
250
251 viu@2400 {
252 compatible = "fsl,mpc5121-viu";
253 reg = <0x2400 0x400>;
254 interrupts = <67 0x8>;
255 };
256
257 mdio@2800 {
258 compatible = "fsl,mpc5121-fec-mdio";
259 reg = <0x2800 0x200>;
260 #address-cells = <1>;
261 #size-cells = <0>;
262 phy: ethernet-phy@0 {
263 compatible = "smsc,lan8700";
264 reg = <0x1f>;
265 };
266 };
267
268 eth0: ethernet@2800 {
269 compatible = "fsl,mpc5121-fec";
270 reg = <0x2800 0x200>;
271 local-mac-address = [ 00 00 00 00 00 00 ];
272 interrupts = <4 0x8>;
273 phy-handle = < &phy >;
274 };
275
276 // USB1 using external ULPI PHY
277 usb@3000 {
278 compatible = "fsl,mpc5121-usb2-dr";
279 reg = <0x3000 0x600>;
280 #address-cells = <1>;
281 #size-cells = <0>;
282 interrupts = <43 0x8>;
283 dr_mode = "host";
284 phy_type = "ulpi";
285 };
286
287 // USB0 using internal UTMI PHY
288 usb@4000 {
289 compatible = "fsl,mpc5121-usb2-dr";
290 reg = <0x4000 0x600>;
291 #address-cells = <1>;
292 #size-cells = <0>;
293 interrupts = <44 0x8>;
294 dr_mode = "otg";
295 phy_type = "utmi_wide";
296 fsl,invert-pwr-fault;
297 };
298
299 // IO control
300 ioctl@a000 {
301 compatible = "fsl,mpc5121-ioctl";
302 reg = <0xA000 0x1000>;
303 };
304
305 // 512x PSCs are not 52xx PSCs compatible
306 serial@11000 {
307 compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
308 cell-index = <0>;
309 reg = <0x11000 0x100>;
310 interrupts = <40 0x8>;
311 fsl,rx-fifo-size = <16>;
312 fsl,tx-fifo-size = <16>;
313 };
314
315 serial@11100 {
316 compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
317 cell-index = <1>;
318 reg = <0x11100 0x100>;
319 interrupts = <40 0x8>;
320 fsl,rx-fifo-size = <16>;
321 fsl,tx-fifo-size = <16>;
322 };
323
324 serial@11200 {
325 compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
326 cell-index = <2>;
327 reg = <0x11200 0x100>;
328 interrupts = <40 0x8>;
329 fsl,rx-fifo-size = <16>;
330 fsl,tx-fifo-size = <16>;
331 };
332
333 serial@11300 {
334 compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
335 cell-index = <3>;
336 reg = <0x11300 0x100>;
337 interrupts = <40 0x8>;
338 fsl,rx-fifo-size = <16>;
339 fsl,tx-fifo-size = <16>;
340 };
341
342 serial@11400 {
343 compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
344 cell-index = <4>;
345 reg = <0x11400 0x100>;
346 interrupts = <40 0x8>;
347 fsl,rx-fifo-size = <16>;
348 fsl,tx-fifo-size = <16>;
349 };
350
351 serial@11600 {
352 compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
353 cell-index = <6>;
354 reg = <0x11600 0x100>;
355 interrupts = <40 0x8>;
356 fsl,rx-fifo-size = <16>;
357 fsl,tx-fifo-size = <16>;
358 };
359
360 serial@11800 {
361 compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
362 cell-index = <8>;
363 reg = <0x11800 0x100>;
364 interrupts = <40 0x8>;
365 fsl,rx-fifo-size = <16>;
366 fsl,tx-fifo-size = <16>;
367 };
368
369 serial@11B00 {
370 compatible = "fsl,mpc5121-psc-uart", "fsl,mpc5121-psc";
371 cell-index = <11>;
372 reg = <0x11B00 0x100>;
373 interrupts = <40 0x8>;
374 fsl,rx-fifo-size = <16>;
375 fsl,tx-fifo-size = <16>;
376 };
377
378 pscfifo@11f00 {
379 compatible = "fsl,mpc5121-psc-fifo";
380 reg = <0x11f00 0x100>;
381 interrupts = <40 0x8>;
382 };
383
384 spi@11900 {
385 compatible = "fsl,mpc5121-psc-spi", "fsl,mpc5121-psc";
386 cell-index = <9>;
387 #address-cells = <1>;
388 #size-cells = <0>;
389 reg = <0x11900 0x100>;
390 interrupts = <40 0x8>;
391 fsl,rx-fifo-size = <16>;
392 fsl,tx-fifo-size = <16>;
393
394 // 7845 touch screen controller
395 ts@0 {
396 compatible = "ti,ads7846";
397 reg = <0x0>;
398 spi-max-frequency = <3000000>;
399 // pen irq is GPIO25
400 interrupts = <78 0x8>;
401 };
402 };
403
404 dma@14000 {
405 compatible = "fsl,mpc5121-dma";
406 reg = <0x14000 0x1800>;
407 interrupts = <65 0x8>;
408 };
409 };
410};
diff --git a/arch/powerpc/boot/dts/stxssa8555.dts b/arch/powerpc/boot/dts/stxssa8555.dts
new file mode 100644
index 000000000000..49efd44057d7
--- /dev/null
+++ b/arch/powerpc/boot/dts/stxssa8555.dts
@@ -0,0 +1,380 @@
1/*
2 * MPC8555-based STx GP3 Device Tree Source
3 *
4 * Copyright 2006, 2008 Freescale Semiconductor Inc.
5 *
6 * Copyright 2010 Silicon Turnkey Express LLC.
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 */
13
14/dts-v1/;
15
16/ {
17 model = "stx,gp3";
18 compatible = "stx,gp3-8560", "stx,gp3";
19 #address-cells = <1>;
20 #size-cells = <1>;
21
22 aliases {
23 ethernet0 = &enet0;
24 ethernet1 = &enet1;
25 serial0 = &serial0;
26 serial1 = &serial1;
27 pci0 = &pci0;
28 };
29
30 cpus {
31 #address-cells = <1>;
32 #size-cells = <0>;
33
34 PowerPC,8555@0 {
35 device_type = "cpu";
36 reg = <0x0>;
37 d-cache-line-size = <32>; // 32 bytes
38 i-cache-line-size = <32>; // 32 bytes
39 d-cache-size = <0x8000>; // L1, 32K
40 i-cache-size = <0x8000>; // L1, 32K
41 timebase-frequency = <0>; // 33 MHz, from uboot
42 bus-frequency = <0>; // 166 MHz
43 clock-frequency = <0>; // 825 MHz, from uboot
44 next-level-cache = <&L2>;
45 };
46 };
47
48 memory {
49 device_type = "memory";
50 reg = <0x00000000 0x10000000>;
51 };
52
53 soc8555@e0000000 {
54 #address-cells = <1>;
55 #size-cells = <1>;
56 device_type = "soc";
57 compatible = "simple-bus";
58 ranges = <0x0 0xe0000000 0x100000>;
59 bus-frequency = <0>;
60
61 ecm-law@0 {
62 compatible = "fsl,ecm-law";
63 reg = <0x0 0x1000>;
64 fsl,num-laws = <8>;
65 };
66
67 ecm@1000 {
68 compatible = "fsl,mpc8555-ecm", "fsl,ecm";
69 reg = <0x1000 0x1000>;
70 interrupts = <17 2>;
71 interrupt-parent = <&mpic>;
72 };
73
74 memory-controller@2000 {
75 compatible = "fsl,mpc8555-memory-controller";
76 reg = <0x2000 0x1000>;
77 interrupt-parent = <&mpic>;
78 interrupts = <18 2>;
79 };
80
81 L2: l2-cache-controller@20000 {
82 compatible = "fsl,mpc8555-l2-cache-controller";
83 reg = <0x20000 0x1000>;
84 cache-line-size = <32>; // 32 bytes
85 cache-size = <0x40000>; // L2, 256K
86 interrupt-parent = <&mpic>;
87 interrupts = <16 2>;
88 };
89
90 i2c@3000 {
91 #address-cells = <1>;
92 #size-cells = <0>;
93 cell-index = <0>;
94 compatible = "fsl-i2c";
95 reg = <0x3000 0x100>;
96 interrupts = <43 2>;
97 interrupt-parent = <&mpic>;
98 dfsrr;
99 };
100
101 dma@21300 {
102 #address-cells = <1>;
103 #size-cells = <1>;
104 compatible = "fsl,mpc8555-dma", "fsl,eloplus-dma";
105 reg = <0x21300 0x4>;
106 ranges = <0x0 0x21100 0x200>;
107 cell-index = <0>;
108 dma-channel@0 {
109 compatible = "fsl,mpc8555-dma-channel",
110 "fsl,eloplus-dma-channel";
111 reg = <0x0 0x80>;
112 cell-index = <0>;
113 interrupt-parent = <&mpic>;
114 interrupts = <20 2>;
115 };
116 dma-channel@80 {
117 compatible = "fsl,mpc8555-dma-channel",
118 "fsl,eloplus-dma-channel";
119 reg = <0x80 0x80>;
120 cell-index = <1>;
121 interrupt-parent = <&mpic>;
122 interrupts = <21 2>;
123 };
124 dma-channel@100 {
125 compatible = "fsl,mpc8555-dma-channel",
126 "fsl,eloplus-dma-channel";
127 reg = <0x100 0x80>;
128 cell-index = <2>;
129 interrupt-parent = <&mpic>;
130 interrupts = <22 2>;
131 };
132 dma-channel@180 {
133 compatible = "fsl,mpc8555-dma-channel",
134 "fsl,eloplus-dma-channel";
135 reg = <0x180 0x80>;
136 cell-index = <3>;
137 interrupt-parent = <&mpic>;
138 interrupts = <23 2>;
139 };
140 };
141
142 enet0: ethernet@24000 {
143 #address-cells = <1>;
144 #size-cells = <1>;
145 cell-index = <0>;
146 device_type = "network";
147 model = "TSEC";
148 compatible = "gianfar";
149 reg = <0x24000 0x1000>;
150 ranges = <0x0 0x24000 0x1000>;
151 local-mac-address = [ 00 00 00 00 00 00 ];
152 interrupts = <29 2 30 2 34 2>;
153 interrupt-parent = <&mpic>;
154 tbi-handle = <&tbi0>;
155 phy-handle = <&phy0>;
156
157 mdio@520 {
158 #address-cells = <1>;
159 #size-cells = <0>;
160 compatible = "fsl,gianfar-mdio";
161 reg = <0x520 0x20>;
162
163 phy0: ethernet-phy@2 {
164 interrupt-parent = <&mpic>;
165 interrupts = <5 1>;
166 reg = <0x2>;
167 device_type = "ethernet-phy";
168 };
169 phy1: ethernet-phy@4 {
170 interrupt-parent = <&mpic>;
171 interrupts = <5 1>;
172 reg = <0x4>;
173 device_type = "ethernet-phy";
174 };
175 tbi0: tbi-phy@11 {
176 reg = <0x11>;
177 device_type = "tbi-phy";
178 };
179 };
180 };
181
182 enet1: ethernet@25000 {
183 #address-cells = <1>;
184 #size-cells = <1>;
185 cell-index = <1>;
186 device_type = "network";
187 model = "TSEC";
188 compatible = "gianfar";
189 reg = <0x25000 0x1000>;
190 ranges = <0x0 0x25000 0x1000>;
191 local-mac-address = [ 00 00 00 00 00 00 ];
192 interrupts = <35 2 36 2 40 2>;
193 interrupt-parent = <&mpic>;
194 tbi-handle = <&tbi1>;
195 phy-handle = <&phy1>;
196
197 mdio@520 {
198 #address-cells = <1>;
199 #size-cells = <0>;
200 compatible = "fsl,gianfar-tbi";
201 reg = <0x520 0x20>;
202
203 tbi1: tbi-phy@11 {
204 reg = <0x11>;
205 device_type = "tbi-phy";
206 };
207 };
208 };
209
210 serial0: serial@4500 {
211 cell-index = <0>;
212 device_type = "serial";
213 compatible = "ns16550";
214 reg = <0x4500 0x100>; // reg base, size
215 clock-frequency = <0>; // should we fill in in uboot?
216 interrupts = <42 2>;
217 interrupt-parent = <&mpic>;
218 };
219
220 serial1: serial@4600 {
221 cell-index = <1>;
222 device_type = "serial";
223 compatible = "ns16550";
224 reg = <0x4600 0x100>; // reg base, size
225 clock-frequency = <0>; // should we fill in in uboot?
226 interrupts = <42 2>;
227 interrupt-parent = <&mpic>;
228 };
229
230 crypto@30000 {
231 compatible = "fsl,sec2.0";
232 reg = <0x30000 0x10000>;
233 interrupts = <45 2>;
234 interrupt-parent = <&mpic>;
235 fsl,num-channels = <4>;
236 fsl,channel-fifo-len = <24>;
237 fsl,exec-units-mask = <0x7e>;
238 fsl,descriptor-types-mask = <0x01010ebf>;
239 };
240
241 mpic: pic@40000 {
242 interrupt-controller;
243 #address-cells = <0>;
244 #interrupt-cells = <2>;
245 reg = <0x40000 0x40000>;
246 compatible = "chrp,open-pic";
247 device_type = "open-pic";
248 };
249
250 cpm@919c0 {
251 #address-cells = <1>;
252 #size-cells = <1>;
253 compatible = "fsl,mpc8555-cpm", "fsl,cpm2";
254 reg = <0x919c0 0x30>;
255 ranges;
256
257 muram@80000 {
258 #address-cells = <1>;
259 #size-cells = <1>;
260 ranges = <0x0 0x80000 0x10000>;
261
262 data@0 {
263 compatible = "fsl,cpm-muram-data";
264 reg = <0x0 0x2000 0x9000 0x1000>;
265 };
266 };
267
268 brg@919f0 {
269 compatible = "fsl,mpc8555-brg",
270 "fsl,cpm2-brg",
271 "fsl,cpm-brg";
272 reg = <0x919f0 0x10 0x915f0 0x10>;
273 };
274
275 cpmpic: pic@90c00 {
276 interrupt-controller;
277 #address-cells = <0>;
278 #interrupt-cells = <2>;
279 interrupts = <46 2>;
280 interrupt-parent = <&mpic>;
281 reg = <0x90c00 0x80>;
282 compatible = "fsl,mpc8555-cpm-pic", "fsl,cpm2-pic";
283 };
284 };
285 };
286
287 pci0: pci@e0008000 {
288 interrupt-map-mask = <0x1f800 0x0 0x0 0x7>;
289 interrupt-map = <
290
291 /* IDSEL 0x10 */
292 0x8000 0x0 0x0 0x1 &mpic 0x0 0x1
293 0x8000 0x0 0x0 0x2 &mpic 0x1 0x1
294 0x8000 0x0 0x0 0x3 &mpic 0x2 0x1
295 0x8000 0x0 0x0 0x4 &mpic 0x3 0x1
296
297 /* IDSEL 0x11 */
298 0x8800 0x0 0x0 0x1 &mpic 0x0 0x1
299 0x8800 0x0 0x0 0x2 &mpic 0x1 0x1
300 0x8800 0x0 0x0 0x3 &mpic 0x2 0x1
301 0x8800 0x0 0x0 0x4 &mpic 0x3 0x1
302
303 /* IDSEL 0x12 (Slot 1) */
304 0x9000 0x0 0x0 0x1 &mpic 0x0 0x1
305 0x9000 0x0 0x0 0x2 &mpic 0x1 0x1
306 0x9000 0x0 0x0 0x3 &mpic 0x2 0x1
307 0x9000 0x0 0x0 0x4 &mpic 0x3 0x1
308
309 /* IDSEL 0x13 (Slot 2) */
310 0x9800 0x0 0x0 0x1 &mpic 0x1 0x1
311 0x9800 0x0 0x0 0x2 &mpic 0x2 0x1
312 0x9800 0x0 0x0 0x3 &mpic 0x3 0x1
313 0x9800 0x0 0x0 0x4 &mpic 0x0 0x1
314
315 /* IDSEL 0x14 (Slot 3) */
316 0xa000 0x0 0x0 0x1 &mpic 0x2 0x1
317 0xa000 0x0 0x0 0x2 &mpic 0x3 0x1
318 0xa000 0x0 0x0 0x3 &mpic 0x0 0x1
319 0xa000 0x0 0x0 0x4 &mpic 0x1 0x1
320
321 /* IDSEL 0x15 (Slot 4) */
322 0xa800 0x0 0x0 0x1 &mpic 0x3 0x1
323 0xa800 0x0 0x0 0x2 &mpic 0x0 0x1
324 0xa800 0x0 0x0 0x3 &mpic 0x1 0x1
325 0xa800 0x0 0x0 0x4 &mpic 0x2 0x1
326
327 /* Bus 1 (Tundra Bridge) */
328 /* IDSEL 0x12 (ISA bridge) */
329 0x19000 0x0 0x0 0x1 &mpic 0x0 0x1
330 0x19000 0x0 0x0 0x2 &mpic 0x1 0x1
331 0x19000 0x0 0x0 0x3 &mpic 0x2 0x1
332 0x19000 0x0 0x0 0x4 &mpic 0x3 0x1>;
333 interrupt-parent = <&mpic>;
334 interrupts = <24 2>;
335 bus-range = <0 0>;
336 ranges = <0x2000000 0x0 0x80000000 0x80000000 0x0 0x20000000
337 0x1000000 0x0 0x0 0xe2000000 0x0 0x100000>;
338 clock-frequency = <66666666>;
339 #interrupt-cells = <1>;
340 #size-cells = <2>;
341 #address-cells = <3>;
342 reg = <0xe0008000 0x1000>;
343 compatible = "fsl,mpc8540-pci";
344 device_type = "pci";
345
346 i8259@19000 {
347 interrupt-controller;
348 device_type = "interrupt-controller";
349 reg = <0x19000 0x0 0x0 0x0 0x1>;
350 #address-cells = <0>;
351 #interrupt-cells = <2>;
352 compatible = "chrp,iic";
353 interrupts = <1>;
354 interrupt-parent = <&pci0>;
355 };
356 };
357
358 pci1: pci@e0009000 {
359 interrupt-map-mask = <0xf800 0x0 0x0 0x7>;
360 interrupt-map = <
361
362 /* IDSEL 0x15 */
363 0xa800 0x0 0x0 0x1 &mpic 0xb 0x1
364 0xa800 0x0 0x0 0x2 &mpic 0xb 0x1
365 0xa800 0x0 0x0 0x3 &mpic 0xb 0x1
366 0xa800 0x0 0x0 0x4 &mpic 0xb 0x1>;
367 interrupt-parent = <&mpic>;
368 interrupts = <25 2>;
369 bus-range = <0 0>;
370 ranges = <0x2000000 0x0 0xa0000000 0xa0000000 0x0 0x20000000
371 0x1000000 0x0 0x0 0xe3000000 0x0 0x100000>;
372 clock-frequency = <66666666>;
373 #interrupt-cells = <1>;
374 #size-cells = <2>;
375 #address-cells = <3>;
376 reg = <0xe0009000 0x1000>;
377 compatible = "fsl,mpc8540-pci";
378 device_type = "pci";
379 };
380};
diff --git a/arch/powerpc/boot/dts/tqm8540.dts b/arch/powerpc/boot/dts/tqm8540.dts
index 71347537b83e..15ca731bc24e 100644
--- a/arch/powerpc/boot/dts/tqm8540.dts
+++ b/arch/powerpc/boot/dts/tqm8540.dts
@@ -289,7 +289,14 @@
289 interrupt-map = < 289 interrupt-map = <
290 /* IDSEL 28 */ 290 /* IDSEL 28 */
291 0xe000 0 0 1 &mpic 2 1 291 0xe000 0 0 1 &mpic 2 1
292 0xe000 0 0 2 &mpic 3 1>; 292 0xe000 0 0 2 &mpic 3 1
293 0xe000 0 0 3 &mpic 6 1
294 0xe000 0 0 4 &mpic 5 1
295
296 /* IDSEL 11 */
297 0x5800 0 0 1 &mpic 6 1
298 0x5800 0 0 2 &mpic 5 1
299 >;
293 300
294 interrupt-parent = <&mpic>; 301 interrupt-parent = <&mpic>;
295 interrupts = <24 2>; 302 interrupts = <24 2>;
diff --git a/arch/powerpc/boot/dts/tqm8541.dts b/arch/powerpc/boot/dts/tqm8541.dts
index b30f63753d41..f49d09181312 100644
--- a/arch/powerpc/boot/dts/tqm8541.dts
+++ b/arch/powerpc/boot/dts/tqm8541.dts
@@ -311,7 +311,14 @@
311 interrupt-map = < 311 interrupt-map = <
312 /* IDSEL 28 */ 312 /* IDSEL 28 */
313 0xe000 0 0 1 &mpic 2 1 313 0xe000 0 0 1 &mpic 2 1
314 0xe000 0 0 2 &mpic 3 1>; 314 0xe000 0 0 2 &mpic 3 1
315 0xe000 0 0 3 &mpic 6 1
316 0xe000 0 0 4 &mpic 5 1
317
318 /* IDSEL 11 */
319 0x5800 0 0 1 &mpic 6 1
320 0x5800 0 0 2 &mpic 5 1
321 >;
315 322
316 interrupt-parent = <&mpic>; 323 interrupt-parent = <&mpic>;
317 interrupts = <24 2>; 324 interrupts = <24 2>;
diff --git a/arch/powerpc/boot/dts/tqm8548-bigflash.dts b/arch/powerpc/boot/dts/tqm8548-bigflash.dts
index 61f25e15fd66..5dbb36edb038 100644
--- a/arch/powerpc/boot/dts/tqm8548-bigflash.dts
+++ b/arch/powerpc/boot/dts/tqm8548-bigflash.dts
@@ -442,7 +442,14 @@
442 interrupt-map = < 442 interrupt-map = <
443 /* IDSEL 28 */ 443 /* IDSEL 28 */
444 0xe000 0 0 1 &mpic 2 1 444 0xe000 0 0 1 &mpic 2 1
445 0xe000 0 0 2 &mpic 3 1>; 445 0xe000 0 0 2 &mpic 3 1
446 0xe000 0 0 3 &mpic 6 1
447 0xe000 0 0 4 &mpic 5 1
448
449 /* IDSEL 11 */
450 0x5800 0 0 1 &mpic 6 1
451 0x5800 0 0 2 &mpic 5 1
452 >;
446 453
447 interrupt-parent = <&mpic>; 454 interrupt-parent = <&mpic>;
448 interrupts = <24 2>; 455 interrupts = <24 2>;
diff --git a/arch/powerpc/boot/dts/tqm8548.dts b/arch/powerpc/boot/dts/tqm8548.dts
index 025759c7c955..a050ae427108 100644
--- a/arch/powerpc/boot/dts/tqm8548.dts
+++ b/arch/powerpc/boot/dts/tqm8548.dts
@@ -442,7 +442,14 @@
442 interrupt-map = < 442 interrupt-map = <
443 /* IDSEL 28 */ 443 /* IDSEL 28 */
444 0xe000 0 0 1 &mpic 2 1 444 0xe000 0 0 1 &mpic 2 1
445 0xe000 0 0 2 &mpic 3 1>; 445 0xe000 0 0 2 &mpic 3 1
446 0xe000 0 0 3 &mpic 6 1
447 0xe000 0 0 4 &mpic 5 1
448
449 /* IDSEL 11 */
450 0x5800 0 0 1 &mpic 6 1
451 0x5800 0 0 2 &mpic 5 1
452 >;
446 453
447 interrupt-parent = <&mpic>; 454 interrupt-parent = <&mpic>;
448 interrupts = <24 2>; 455 interrupts = <24 2>;
diff --git a/arch/powerpc/boot/dts/tqm8555.dts b/arch/powerpc/boot/dts/tqm8555.dts
index 95e287381836..81bad8cd3756 100644
--- a/arch/powerpc/boot/dts/tqm8555.dts
+++ b/arch/powerpc/boot/dts/tqm8555.dts
@@ -311,7 +311,14 @@
311 interrupt-map = < 311 interrupt-map = <
312 /* IDSEL 28 */ 312 /* IDSEL 28 */
313 0xe000 0 0 1 &mpic 2 1 313 0xe000 0 0 1 &mpic 2 1
314 0xe000 0 0 2 &mpic 3 1>; 314 0xe000 0 0 2 &mpic 3 1
315 0xe000 0 0 3 &mpic 6 1
316 0xe000 0 0 4 &mpic 5 1
317
318 /* IDSEL 11 */
319 0x5800 0 0 1 &mpic 6 1
320 0x5800 0 0 2 &mpic 5 1
321 >;
315 322
316 interrupt-parent = <&mpic>; 323 interrupt-parent = <&mpic>;
317 interrupts = <24 2>; 324 interrupts = <24 2>;
diff --git a/arch/powerpc/boot/dts/tqm8560.dts b/arch/powerpc/boot/dts/tqm8560.dts
index ff70580a8f4c..22ec39b5beeb 100644
--- a/arch/powerpc/boot/dts/tqm8560.dts
+++ b/arch/powerpc/boot/dts/tqm8560.dts
@@ -382,7 +382,14 @@
382 interrupt-map = < 382 interrupt-map = <
383 /* IDSEL 28 */ 383 /* IDSEL 28 */
384 0xe000 0 0 1 &mpic 2 1 384 0xe000 0 0 1 &mpic 2 1
385 0xe000 0 0 2 &mpic 3 1>; 385 0xe000 0 0 2 &mpic 3 1
386 0xe000 0 0 3 &mpic 6 1
387 0xe000 0 0 4 &mpic 5 1
388
389 /* IDSEL 11 */
390 0x5800 0 0 1 &mpic 6 1
391 0x5800 0 0 2 &mpic 5 1
392 >;
386 393
387 interrupt-parent = <&mpic>; 394 interrupt-parent = <&mpic>;
388 interrupts = <24 2>; 395 interrupts = <24 2>;
diff --git a/arch/powerpc/boot/dts/tqm8xx.dts b/arch/powerpc/boot/dts/tqm8xx.dts
new file mode 100644
index 000000000000..f6da7ec49a8e
--- /dev/null
+++ b/arch/powerpc/boot/dts/tqm8xx.dts
@@ -0,0 +1,172 @@
1/*
2 * TQM8XX Device Tree Source
3 *
4 * Heiko Schocher <hs@denx.de>
5 * 2010 DENX Software Engineering GmbH
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version.
11 */
12
13/dts-v1/;
14
15/ {
16 model = "TQM8xx";
17 compatible = "tqc,tqm8xx";
18 #address-cells = <1>;
19 #size-cells = <1>;
20
21 aliases {
22 ethernet0 = &eth0;
23 ethernet1 = &eth1;
24 mdio1 = &phy1;
25 serial0 = &smc1;
26 };
27
28 cpus {
29 #address-cells = <1>;
30 #size-cells = <0>;
31
32 PowerPC,860@0 {
33 device_type = "cpu";
34 reg = <0x0>;
35 d-cache-line-size = <16>; // 16 bytes
36 i-cache-line-size = <16>; // 16 bytes
37 d-cache-size = <0x1000>; // L1, 4K
38 i-cache-size = <0x1000>; // L1, 4K
39 timebase-frequency = <0>;
40 bus-frequency = <0>;
41 clock-frequency = <0>;
42 interrupts = <15 2>; // decrementer interrupt
43 interrupt-parent = <&PIC>;
44 };
45 };
46
47 memory {
48 device_type = "memory";
49 reg = <0x0 0x2000000>;
50 };
51
52 localbus@fff00100 {
53 compatible = "fsl,mpc860-localbus", "fsl,pq1-localbus";
54 #address-cells = <2>;
55 #size-cells = <1>;
56 reg = <0xfff00100 0x40>;
57
58 ranges = <
59 0x0 0x0 0x40000000 0x800000
60 >;
61
62 flash@0,0 {
63 compatible = "cfi-flash";
64 reg = <0 0 0x800000>;
65 #address-cells = <1>;
66 #size-cells = <1>;
67 bank-width = <4>;
68 device-width = <2>;
69 };
70 };
71
72 soc@fff00000 {
73 #address-cells = <1>;
74 #size-cells = <1>;
75 device_type = "soc";
76 ranges = <0x0 0xfff00000 0x00004000>;
77
78 phy1: mdio@e00 {
79 compatible = "fsl,mpc866-fec-mdio", "fsl,pq1-fec-mdio";
80 reg = <0xe00 0x188>;
81 #address-cells = <1>;
82 #size-cells = <0>;
83 PHY: ethernet-phy@f {
84 reg = <0xf>;
85 device_type = "ethernet-phy";
86 };
87 };
88
89 eth1: ethernet@e00 {
90 device_type = "network";
91 compatible = "fsl,mpc866-fec-enet",
92 "fsl,pq1-fec-enet";
93 reg = <0xe00 0x188>;
94 interrupts = <3 1>;
95 interrupt-parent = <&PIC>;
96 phy-handle = <&PHY>;
97 linux,network-index = <1>;
98 };
99
100 PIC: pic@0 {
101 interrupt-controller;
102 #interrupt-cells = <2>;
103 reg = <0x0 0x24>;
104 compatible = "fsl,mpc860-pic", "fsl,pq1-pic";
105 };
106
107 cpm@9c0 {
108 #address-cells = <1>;
109 #size-cells = <1>;
110 compatible = "fsl,mpc860-cpm", "fsl,cpm1";
111 ranges;
112 reg = <0x9c0 0x40>;
113 brg-frequency = <0>;
114 interrupts = <0 2>; // cpm error interrupt
115 interrupt-parent = <&CPM_PIC>;
116
117 muram@2000 {
118 #address-cells = <1>;
119 #size-cells = <1>;
120 ranges = <0x0 0x2000 0x2000>;
121
122 data@0 {
123 compatible = "fsl,cpm-muram-data";
124 reg = <0x0 0x2000>;
125 };
126 };
127
128 brg@9f0 {
129 compatible = "fsl,mpc860-brg",
130 "fsl,cpm1-brg",
131 "fsl,cpm-brg";
132 reg = <0x9f0 0x10>;
133 clock-frequency = <0>;
134 };
135
136 CPM_PIC: pic@930 {
137 interrupt-controller;
138 #address-cells = <0>;
139 #interrupt-cells = <1>;
140 interrupts = <5 2 0 2>;
141 interrupt-parent = <&PIC>;
142 reg = <0x930 0x20>;
143 compatible = "fsl,mpc860-cpm-pic",
144 "fsl,cpm1-pic";
145 };
146
147
148 smc1: serial@a80 {
149 device_type = "serial";
150 compatible = "fsl,mpc860-smc-uart",
151 "fsl,cpm1-smc-uart";
152 reg = <0xa80 0x10 0x3e80 0x40>;
153 interrupts = <4>;
154 interrupt-parent = <&CPM_PIC>;
155 fsl,cpm-brg = <1>;
156 fsl,cpm-command = <0x90>;
157 };
158
159 eth0: ethernet@a00 {
160 device_type = "network";
161 compatible = "fsl,mpc860-scc-enet",
162 "fsl,cpm1-scc-enet";
163 reg = <0xa00 0x18 0x3c00 0x100>;
164 interrupts = <30>;
165 interrupt-parent = <&CPM_PIC>;
166 fsl,cpm-command = <0000>;
167 linux,network-index = <0>;
168 fixed-link = <0 0 10 0 0>;
169 };
170 };
171 };
172};
diff --git a/arch/powerpc/configs/mpc85xx_defconfig b/arch/powerpc/configs/mpc85xx_defconfig
index cfebef9f9123..d32f31a03f58 100644
--- a/arch/powerpc/configs/mpc85xx_defconfig
+++ b/arch/powerpc/configs/mpc85xx_defconfig
@@ -19,7 +19,8 @@ CONFIG_E500=y
19CONFIG_FSL_EMB_PERFMON=y 19CONFIG_FSL_EMB_PERFMON=y
20CONFIG_BOOKE=y 20CONFIG_BOOKE=y
21CONFIG_FSL_BOOKE=y 21CONFIG_FSL_BOOKE=y
22# CONFIG_PHYS_64BIT is not set 22CONFIG_PTE_64BIT=y
23CONFIG_PHYS_64BIT=y
23CONFIG_SPE=y 24CONFIG_SPE=y
24CONFIG_PPC_MMU_NOHASH=y 25CONFIG_PPC_MMU_NOHASH=y
25CONFIG_PPC_MMU_NOHASH_32=y 26CONFIG_PPC_MMU_NOHASH_32=y
@@ -28,7 +29,7 @@ CONFIG_PPC_BOOK3E_MMU=y
28# CONFIG_SMP is not set 29# CONFIG_SMP is not set
29CONFIG_PPC32=y 30CONFIG_PPC32=y
30CONFIG_WORD_SIZE=32 31CONFIG_WORD_SIZE=32
31# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set 32CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
32CONFIG_MMU=y 33CONFIG_MMU=y
33CONFIG_GENERIC_CMOS_UPDATE=y 34CONFIG_GENERIC_CMOS_UPDATE=y
34CONFIG_GENERIC_TIME=y 35CONFIG_GENERIC_TIME=y
@@ -239,6 +240,7 @@ CONFIG_MPC85xx_MDS=y
239CONFIG_MPC8536_DS=y 240CONFIG_MPC8536_DS=y
240CONFIG_MPC85xx_DS=y 241CONFIG_MPC85xx_DS=y
241CONFIG_MPC85xx_RDB=y 242CONFIG_MPC85xx_RDB=y
243CONFIG_P1022_DS=y
242CONFIG_SOCRATES=y 244CONFIG_SOCRATES=y
243CONFIG_KSI8560=y 245CONFIG_KSI8560=y
244CONFIG_XES_MPC85xx=y 246CONFIG_XES_MPC85xx=y
@@ -311,7 +313,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
311CONFIG_PAGEFLAGS_EXTENDED=y 313CONFIG_PAGEFLAGS_EXTENDED=y
312CONFIG_SPLIT_PTLOCK_CPUS=4 314CONFIG_SPLIT_PTLOCK_CPUS=4
313CONFIG_MIGRATION=y 315CONFIG_MIGRATION=y
314# CONFIG_PHYS_ADDR_T_64BIT is not set 316CONFIG_PHYS_ADDR_T_64BIT=y
315CONFIG_ZONE_DMA_FLAG=1 317CONFIG_ZONE_DMA_FLAG=1
316CONFIG_BOUNCE=y 318CONFIG_BOUNCE=y
317CONFIG_VIRT_TO_BUS=y 319CONFIG_VIRT_TO_BUS=y
@@ -321,7 +323,7 @@ CONFIG_PPC_4K_PAGES=y
321# CONFIG_PPC_16K_PAGES is not set 323# CONFIG_PPC_16K_PAGES is not set
322# CONFIG_PPC_64K_PAGES is not set 324# CONFIG_PPC_64K_PAGES is not set
323# CONFIG_PPC_256K_PAGES is not set 325# CONFIG_PPC_256K_PAGES is not set
324CONFIG_FORCE_MAX_ZONEORDER=11 326CONFIG_FORCE_MAX_ZONEORDER=12
325CONFIG_PROC_DEVICETREE=y 327CONFIG_PROC_DEVICETREE=y
326# CONFIG_CMDLINE_BOOL is not set 328# CONFIG_CMDLINE_BOOL is not set
327CONFIG_EXTRA_TARGETS="" 329CONFIG_EXTRA_TARGETS=""
@@ -1122,16 +1124,13 @@ CONFIG_VGA_CONSOLE=y
1122# CONFIG_VGACON_SOFT_SCROLLBACK is not set 1124# CONFIG_VGACON_SOFT_SCROLLBACK is not set
1123CONFIG_DUMMY_CONSOLE=y 1125CONFIG_DUMMY_CONSOLE=y
1124CONFIG_SOUND=y 1126CONFIG_SOUND=y
1125CONFIG_SOUND_OSS_CORE=y 1127# CONFIG_SOUND_OSS_CORE is not set
1126CONFIG_SOUND_OSS_CORE_PRECLAIM=y
1127CONFIG_SND=y 1128CONFIG_SND=y
1128CONFIG_SND_TIMER=y 1129CONFIG_SND_TIMER=y
1129CONFIG_SND_PCM=y 1130CONFIG_SND_PCM=y
1130# CONFIG_SND_SEQUENCER is not set 1131# CONFIG_SND_SEQUENCER is not set
1131CONFIG_SND_OSSEMUL=y 1132# CONFIG_SND_MIXER_OSS is not set
1132CONFIG_SND_MIXER_OSS=y 1133# CONFIG_SND_PCM_OSS is not set
1133CONFIG_SND_PCM_OSS=y
1134CONFIG_SND_PCM_OSS_PLUGINS=y
1135# CONFIG_SND_HRTIMER is not set 1134# CONFIG_SND_HRTIMER is not set
1136# CONFIG_SND_DYNAMIC_MINORS is not set 1135# CONFIG_SND_DYNAMIC_MINORS is not set
1137# CONFIG_SND_SUPPORT_OLD_API is not set 1136# CONFIG_SND_SUPPORT_OLD_API is not set
@@ -1145,12 +1144,7 @@ CONFIG_SND_VMASTER=y
1145# CONFIG_SND_SBAWE_SEQ is not set 1144# CONFIG_SND_SBAWE_SEQ is not set
1146# CONFIG_SND_EMU10K1_SEQ is not set 1145# CONFIG_SND_EMU10K1_SEQ is not set
1147CONFIG_SND_AC97_CODEC=y 1146CONFIG_SND_AC97_CODEC=y
1148CONFIG_SND_DRIVERS=y 1147# CONFIG_SND_DRIVERS is not set
1149# CONFIG_SND_DUMMY is not set
1150# CONFIG_SND_MTPAV is not set
1151# CONFIG_SND_SERIAL_U16550 is not set
1152# CONFIG_SND_MPU401 is not set
1153# CONFIG_SND_AC97_POWER_SAVE is not set
1154CONFIG_SND_PCI=y 1148CONFIG_SND_PCI=y
1155# CONFIG_SND_AD1889 is not set 1149# CONFIG_SND_AD1889 is not set
1156# CONFIG_SND_ALS300 is not set 1150# CONFIG_SND_ALS300 is not set
@@ -1218,12 +1212,8 @@ CONFIG_SND_INTEL8X0=y
1218# CONFIG_SND_VIRTUOSO is not set 1212# CONFIG_SND_VIRTUOSO is not set
1219# CONFIG_SND_VX222 is not set 1213# CONFIG_SND_VX222 is not set
1220# CONFIG_SND_YMFPCI is not set 1214# CONFIG_SND_YMFPCI is not set
1221CONFIG_SND_PPC=y 1215# CONFIG_SND_PPC is not set
1222CONFIG_SND_USB=y 1216# CONFIG_SND_USB is not set
1223# CONFIG_SND_USB_AUDIO is not set
1224# CONFIG_SND_USB_UA101 is not set
1225# CONFIG_SND_USB_USX2Y is not set
1226# CONFIG_SND_USB_CAIAQ is not set
1227# CONFIG_SND_SOC is not set 1217# CONFIG_SND_SOC is not set
1228# CONFIG_SOUND_PRIME is not set 1218# CONFIG_SOUND_PRIME is not set
1229CONFIG_AC97_BUS=y 1219CONFIG_AC97_BUS=y
diff --git a/arch/powerpc/configs/mpc85xx_smp_defconfig b/arch/powerpc/configs/mpc85xx_smp_defconfig
index f5451d80f19b..f93de10adcda 100644
--- a/arch/powerpc/configs/mpc85xx_smp_defconfig
+++ b/arch/powerpc/configs/mpc85xx_smp_defconfig
@@ -19,7 +19,8 @@ CONFIG_E500=y
19CONFIG_FSL_EMB_PERFMON=y 19CONFIG_FSL_EMB_PERFMON=y
20CONFIG_BOOKE=y 20CONFIG_BOOKE=y
21CONFIG_FSL_BOOKE=y 21CONFIG_FSL_BOOKE=y
22# CONFIG_PHYS_64BIT is not set 22CONFIG_PTE_64BIT=y
23CONFIG_PHYS_64BIT=y
23CONFIG_SPE=y 24CONFIG_SPE=y
24CONFIG_PPC_MMU_NOHASH=y 25CONFIG_PPC_MMU_NOHASH=y
25CONFIG_PPC_MMU_NOHASH_32=y 26CONFIG_PPC_MMU_NOHASH_32=y
@@ -29,7 +30,7 @@ CONFIG_SMP=y
29CONFIG_NR_CPUS=8 30CONFIG_NR_CPUS=8
30CONFIG_PPC32=y 31CONFIG_PPC32=y
31CONFIG_WORD_SIZE=32 32CONFIG_WORD_SIZE=32
32# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set 33CONFIG_ARCH_PHYS_ADDR_T_64BIT=y
33CONFIG_MMU=y 34CONFIG_MMU=y
34CONFIG_GENERIC_CMOS_UPDATE=y 35CONFIG_GENERIC_CMOS_UPDATE=y
35CONFIG_GENERIC_TIME=y 36CONFIG_GENERIC_TIME=y
@@ -243,6 +244,7 @@ CONFIG_MPC85xx_MDS=y
243CONFIG_MPC8536_DS=y 244CONFIG_MPC8536_DS=y
244CONFIG_MPC85xx_DS=y 245CONFIG_MPC85xx_DS=y
245CONFIG_MPC85xx_RDB=y 246CONFIG_MPC85xx_RDB=y
247CONFIG_P1022_DS=y
246CONFIG_SOCRATES=y 248CONFIG_SOCRATES=y
247CONFIG_KSI8560=y 249CONFIG_KSI8560=y
248CONFIG_XES_MPC85xx=y 250CONFIG_XES_MPC85xx=y
@@ -316,7 +318,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
316CONFIG_PAGEFLAGS_EXTENDED=y 318CONFIG_PAGEFLAGS_EXTENDED=y
317CONFIG_SPLIT_PTLOCK_CPUS=4 319CONFIG_SPLIT_PTLOCK_CPUS=4
318CONFIG_MIGRATION=y 320CONFIG_MIGRATION=y
319# CONFIG_PHYS_ADDR_T_64BIT is not set 321CONFIG_PHYS_ADDR_T_64BIT=y
320CONFIG_ZONE_DMA_FLAG=1 322CONFIG_ZONE_DMA_FLAG=1
321CONFIG_BOUNCE=y 323CONFIG_BOUNCE=y
322CONFIG_VIRT_TO_BUS=y 324CONFIG_VIRT_TO_BUS=y
@@ -326,7 +328,7 @@ CONFIG_PPC_4K_PAGES=y
326# CONFIG_PPC_16K_PAGES is not set 328# CONFIG_PPC_16K_PAGES is not set
327# CONFIG_PPC_64K_PAGES is not set 329# CONFIG_PPC_64K_PAGES is not set
328# CONFIG_PPC_256K_PAGES is not set 330# CONFIG_PPC_256K_PAGES is not set
329CONFIG_FORCE_MAX_ZONEORDER=11 331CONFIG_FORCE_MAX_ZONEORDER=12
330CONFIG_PROC_DEVICETREE=y 332CONFIG_PROC_DEVICETREE=y
331# CONFIG_CMDLINE_BOOL is not set 333# CONFIG_CMDLINE_BOOL is not set
332CONFIG_EXTRA_TARGETS="" 334CONFIG_EXTRA_TARGETS=""
@@ -1127,16 +1129,13 @@ CONFIG_VGA_CONSOLE=y
1127# CONFIG_VGACON_SOFT_SCROLLBACK is not set 1129# CONFIG_VGACON_SOFT_SCROLLBACK is not set
1128CONFIG_DUMMY_CONSOLE=y 1130CONFIG_DUMMY_CONSOLE=y
1129CONFIG_SOUND=y 1131CONFIG_SOUND=y
1130CONFIG_SOUND_OSS_CORE=y 1132# CONFIG_SOUND_OSS_CORE is not set
1131CONFIG_SOUND_OSS_CORE_PRECLAIM=y
1132CONFIG_SND=y 1133CONFIG_SND=y
1133CONFIG_SND_TIMER=y 1134CONFIG_SND_TIMER=y
1134CONFIG_SND_PCM=y 1135CONFIG_SND_PCM=y
1135# CONFIG_SND_SEQUENCER is not set 1136# CONFIG_SND_SEQUENCER is not set
1136CONFIG_SND_OSSEMUL=y 1137# CONFIG_SND_MIXER_OSS is not set
1137CONFIG_SND_MIXER_OSS=y 1138# CONFIG_SND_PCM_OSS is not set
1138CONFIG_SND_PCM_OSS=y
1139CONFIG_SND_PCM_OSS_PLUGINS=y
1140# CONFIG_SND_HRTIMER is not set 1139# CONFIG_SND_HRTIMER is not set
1141# CONFIG_SND_DYNAMIC_MINORS is not set 1140# CONFIG_SND_DYNAMIC_MINORS is not set
1142# CONFIG_SND_SUPPORT_OLD_API is not set 1141# CONFIG_SND_SUPPORT_OLD_API is not set
@@ -1150,12 +1149,7 @@ CONFIG_SND_VMASTER=y
1150# CONFIG_SND_SBAWE_SEQ is not set 1149# CONFIG_SND_SBAWE_SEQ is not set
1151# CONFIG_SND_EMU10K1_SEQ is not set 1150# CONFIG_SND_EMU10K1_SEQ is not set
1152CONFIG_SND_AC97_CODEC=y 1151CONFIG_SND_AC97_CODEC=y
1153CONFIG_SND_DRIVERS=y 1152# CONFIG_SND_DRIVERS is not set
1154# CONFIG_SND_DUMMY is not set
1155# CONFIG_SND_MTPAV is not set
1156# CONFIG_SND_SERIAL_U16550 is not set
1157# CONFIG_SND_MPU401 is not set
1158# CONFIG_SND_AC97_POWER_SAVE is not set
1159CONFIG_SND_PCI=y 1153CONFIG_SND_PCI=y
1160# CONFIG_SND_AD1889 is not set 1154# CONFIG_SND_AD1889 is not set
1161# CONFIG_SND_ALS300 is not set 1155# CONFIG_SND_ALS300 is not set
@@ -1223,12 +1217,8 @@ CONFIG_SND_INTEL8X0=y
1223# CONFIG_SND_VIRTUOSO is not set 1217# CONFIG_SND_VIRTUOSO is not set
1224# CONFIG_SND_VX222 is not set 1218# CONFIG_SND_VX222 is not set
1225# CONFIG_SND_YMFPCI is not set 1219# CONFIG_SND_YMFPCI is not set
1226CONFIG_SND_PPC=y 1220# CONFIG_SND_PPC is not set
1227CONFIG_SND_USB=y 1221# CONFIG_SND_USB is not set
1228# CONFIG_SND_USB_AUDIO is not set
1229# CONFIG_SND_USB_UA101 is not set
1230# CONFIG_SND_USB_USX2Y is not set
1231# CONFIG_SND_USB_CAIAQ is not set
1232# CONFIG_SND_SOC is not set 1222# CONFIG_SND_SOC is not set
1233# CONFIG_SOUND_PRIME is not set 1223# CONFIG_SOUND_PRIME is not set
1234CONFIG_AC97_BUS=y 1224CONFIG_AC97_BUS=y
diff --git a/arch/powerpc/configs/tqm8xx_defconfig b/arch/powerpc/configs/tqm8xx_defconfig
new file mode 100644
index 000000000000..85e654b64874
--- /dev/null
+++ b/arch/powerpc/configs/tqm8xx_defconfig
@@ -0,0 +1,934 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.34-rc1
4# Tue Mar 23 08:22:15 2010
5#
6# CONFIG_PPC64 is not set
7
8#
9# Processor support
10#
11# CONFIG_PPC_BOOK3S_32 is not set
12# CONFIG_PPC_85xx is not set
13CONFIG_PPC_8xx=y
14# CONFIG_40x is not set
15# CONFIG_44x is not set
16# CONFIG_E200 is not set
17CONFIG_8xx=y
18CONFIG_PPC_MMU_NOHASH=y
19CONFIG_PPC_MMU_NOHASH_32=y
20# CONFIG_PPC_MM_SLICES is not set
21CONFIG_NOT_COHERENT_CACHE=y
22CONFIG_PPC32=y
23CONFIG_WORD_SIZE=32
24# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
25CONFIG_MMU=y
26CONFIG_GENERIC_CMOS_UPDATE=y
27CONFIG_GENERIC_TIME=y
28CONFIG_GENERIC_TIME_VSYSCALL=y
29CONFIG_GENERIC_CLOCKEVENTS=y
30CONFIG_GENERIC_HARDIRQS=y
31CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
32# CONFIG_HAVE_SETUP_PER_CPU_AREA is not set
33# CONFIG_NEED_PER_CPU_EMBED_FIRST_CHUNK is not set
34CONFIG_IRQ_PER_CPU=y
35CONFIG_NR_IRQS=512
36CONFIG_STACKTRACE_SUPPORT=y
37CONFIG_HAVE_LATENCYTOP_SUPPORT=y
38CONFIG_TRACE_IRQFLAGS_SUPPORT=y
39CONFIG_LOCKDEP_SUPPORT=y
40CONFIG_RWSEM_XCHGADD_ALGORITHM=y
41CONFIG_ARCH_HAS_ILOG2_U32=y
42CONFIG_GENERIC_HWEIGHT=y
43CONFIG_GENERIC_FIND_NEXT_BIT=y
44# CONFIG_ARCH_NO_VIRT_TO_BUS is not set
45CONFIG_PPC=y
46CONFIG_EARLY_PRINTK=y
47CONFIG_GENERIC_NVRAM=y
48CONFIG_SCHED_OMIT_FRAME_POINTER=y
49CONFIG_ARCH_MAY_HAVE_PC_FDC=y
50CONFIG_PPC_OF=y
51CONFIG_OF=y
52# CONFIG_PPC_UDBG_16550 is not set
53# CONFIG_GENERIC_TBSYNC is not set
54CONFIG_AUDIT_ARCH=y
55CONFIG_GENERIC_BUG=y
56CONFIG_DTC=y
57# CONFIG_DEFAULT_UIMAGE is not set
58CONFIG_ARCH_HIBERNATION_POSSIBLE=y
59# CONFIG_PPC_DCR_NATIVE is not set
60# CONFIG_PPC_DCR_MMIO is not set
61CONFIG_ARCH_SUPPORTS_DEBUG_PAGEALLOC=y
62CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
63CONFIG_CONSTRUCTORS=y
64
65#
66# General setup
67#
68CONFIG_EXPERIMENTAL=y
69CONFIG_BROKEN_ON_SMP=y
70CONFIG_INIT_ENV_ARG_LIMIT=32
71CONFIG_LOCALVERSION=""
72CONFIG_LOCALVERSION_AUTO=y
73# CONFIG_SWAP is not set
74CONFIG_SYSVIPC=y
75CONFIG_SYSVIPC_SYSCTL=y
76# CONFIG_POSIX_MQUEUE is not set
77# CONFIG_BSD_PROCESS_ACCT is not set
78# CONFIG_TASKSTATS is not set
79# CONFIG_AUDIT is not set
80
81#
82# RCU Subsystem
83#
84CONFIG_TREE_RCU=y
85# CONFIG_TREE_PREEMPT_RCU is not set
86# CONFIG_TINY_RCU is not set
87# CONFIG_RCU_TRACE is not set
88CONFIG_RCU_FANOUT=32
89# CONFIG_RCU_FANOUT_EXACT is not set
90# CONFIG_TREE_RCU_TRACE is not set
91# CONFIG_IKCONFIG is not set
92CONFIG_LOG_BUF_SHIFT=14
93# CONFIG_CGROUPS is not set
94CONFIG_SYSFS_DEPRECATED=y
95CONFIG_SYSFS_DEPRECATED_V2=y
96# CONFIG_RELAY is not set
97# CONFIG_NAMESPACES is not set
98# CONFIG_BLK_DEV_INITRD is not set
99# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
100CONFIG_SYSCTL=y
101CONFIG_ANON_INODES=y
102CONFIG_EMBEDDED=y
103# CONFIG_SYSCTL_SYSCALL is not set
104CONFIG_KALLSYMS=y
105# CONFIG_KALLSYMS_ALL is not set
106# CONFIG_KALLSYMS_EXTRA_PASS is not set
107CONFIG_HOTPLUG=y
108CONFIG_PRINTK=y
109CONFIG_BUG=y
110# CONFIG_ELF_CORE is not set
111# CONFIG_BASE_FULL is not set
112# CONFIG_FUTEX is not set
113CONFIG_EPOLL=y
114CONFIG_SIGNALFD=y
115CONFIG_TIMERFD=y
116CONFIG_EVENTFD=y
117CONFIG_SHMEM=y
118CONFIG_AIO=y
119CONFIG_HAVE_PERF_EVENTS=y
120
121#
122# Kernel Performance Events And Counters
123#
124# CONFIG_PERF_EVENTS is not set
125# CONFIG_PERF_COUNTERS is not set
126# CONFIG_VM_EVENT_COUNTERS is not set
127CONFIG_SLUB_DEBUG=y
128CONFIG_COMPAT_BRK=y
129# CONFIG_SLAB is not set
130CONFIG_SLUB=y
131# CONFIG_SLOB is not set
132# CONFIG_PROFILING is not set
133CONFIG_HAVE_OPROFILE=y
134# CONFIG_KPROBES is not set
135CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
136CONFIG_HAVE_IOREMAP_PROT=y
137CONFIG_HAVE_KPROBES=y
138CONFIG_HAVE_KRETPROBES=y
139CONFIG_HAVE_ARCH_TRACEHOOK=y
140CONFIG_HAVE_DMA_ATTRS=y
141CONFIG_HAVE_CLK=y
142CONFIG_HAVE_DMA_API_DEBUG=y
143
144#
145# GCOV-based kernel profiling
146#
147# CONFIG_SLOW_WORK is not set
148# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
149CONFIG_SLABINFO=y
150CONFIG_BASE_SMALL=1
151CONFIG_MODULES=y
152# CONFIG_MODULE_FORCE_LOAD is not set
153CONFIG_MODULE_UNLOAD=y
154# CONFIG_MODULE_FORCE_UNLOAD is not set
155# CONFIG_MODVERSIONS is not set
156CONFIG_MODULE_SRCVERSION_ALL=y
157CONFIG_BLOCK=y
158CONFIG_LBDAF=y
159# CONFIG_BLK_DEV_BSG is not set
160# CONFIG_BLK_DEV_INTEGRITY is not set
161
162#
163# IO Schedulers
164#
165CONFIG_IOSCHED_NOOP=y
166CONFIG_IOSCHED_DEADLINE=y
167# CONFIG_IOSCHED_CFQ is not set
168CONFIG_DEFAULT_DEADLINE=y
169# CONFIG_DEFAULT_CFQ is not set
170# CONFIG_DEFAULT_NOOP is not set
171CONFIG_DEFAULT_IOSCHED="deadline"
172# CONFIG_INLINE_SPIN_TRYLOCK is not set
173# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
174# CONFIG_INLINE_SPIN_LOCK is not set
175# CONFIG_INLINE_SPIN_LOCK_BH is not set
176# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
177# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
178CONFIG_INLINE_SPIN_UNLOCK=y
179# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
180CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
181# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
182# CONFIG_INLINE_READ_TRYLOCK is not set
183# CONFIG_INLINE_READ_LOCK is not set
184# CONFIG_INLINE_READ_LOCK_BH is not set
185# CONFIG_INLINE_READ_LOCK_IRQ is not set
186# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
187CONFIG_INLINE_READ_UNLOCK=y
188# CONFIG_INLINE_READ_UNLOCK_BH is not set
189CONFIG_INLINE_READ_UNLOCK_IRQ=y
190# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
191# CONFIG_INLINE_WRITE_TRYLOCK is not set
192# CONFIG_INLINE_WRITE_LOCK is not set
193# CONFIG_INLINE_WRITE_LOCK_BH is not set
194# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
195# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
196CONFIG_INLINE_WRITE_UNLOCK=y
197# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
198CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
199# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
200# CONFIG_MUTEX_SPIN_ON_OWNER is not set
201# CONFIG_FREEZER is not set
202
203#
204# Platform support
205#
206# CONFIG_PPC_CELL is not set
207# CONFIG_PPC_CELL_NATIVE is not set
208CONFIG_CPM1=y
209# CONFIG_MPC8XXFADS is not set
210# CONFIG_MPC86XADS is not set
211# CONFIG_MPC885ADS is not set
212# CONFIG_PPC_EP88XC is not set
213# CONFIG_PPC_ADDER875 is not set
214# CONFIG_PPC_MGSUVD is not set
215CONFIG_TQM8XX=y
216
217#
218# MPC8xx CPM Options
219#
220
221#
222# Generic MPC8xx Options
223#
224CONFIG_8xx_COPYBACK=y
225# CONFIG_8xx_GPIO is not set
226# CONFIG_8xx_CPU6 is not set
227# CONFIG_8xx_CPU15 is not set
228CONFIG_NO_UCODE_PATCH=y
229# CONFIG_USB_SOF_UCODE_PATCH is not set
230# CONFIG_I2C_SPI_UCODE_PATCH is not set
231# CONFIG_I2C_SPI_SMC1_UCODE_PATCH is not set
232# CONFIG_PQ2ADS is not set
233# CONFIG_IPIC is not set
234# CONFIG_MPIC is not set
235# CONFIG_MPIC_WEIRD is not set
236# CONFIG_PPC_I8259 is not set
237# CONFIG_PPC_RTAS is not set
238# CONFIG_MMIO_NVRAM is not set
239# CONFIG_PPC_MPC106 is not set
240# CONFIG_PPC_970_NAP is not set
241# CONFIG_PPC_INDIRECT_IO is not set
242# CONFIG_GENERIC_IOMAP is not set
243# CONFIG_CPU_FREQ is not set
244# CONFIG_QUICC_ENGINE is not set
245# CONFIG_FSL_ULI1575 is not set
246CONFIG_CPM=y
247# CONFIG_SIMPLE_GPIO is not set
248
249#
250# Kernel options
251#
252# CONFIG_HIGHMEM is not set
253CONFIG_TICK_ONESHOT=y
254CONFIG_NO_HZ=y
255CONFIG_HIGH_RES_TIMERS=y
256CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
257CONFIG_HZ_100=y
258# CONFIG_HZ_250 is not set
259# CONFIG_HZ_300 is not set
260# CONFIG_HZ_1000 is not set
261CONFIG_HZ=100
262CONFIG_SCHED_HRTICK=y
263CONFIG_PREEMPT_NONE=y
264# CONFIG_PREEMPT_VOLUNTARY is not set
265# CONFIG_PREEMPT is not set
266CONFIG_BINFMT_ELF=y
267# CONFIG_HAVE_AOUT is not set
268# CONFIG_BINFMT_MISC is not set
269# CONFIG_MATH_EMULATION is not set
270CONFIG_8XX_MINIMAL_FPEMU=y
271# CONFIG_IOMMU_HELPER is not set
272# CONFIG_SWIOTLB is not set
273CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
274CONFIG_ARCH_HAS_WALK_MEMORY=y
275CONFIG_ARCH_ENABLE_MEMORY_HOTREMOVE=y
276CONFIG_SPARSE_IRQ=y
277CONFIG_MAX_ACTIVE_REGIONS=32
278CONFIG_ARCH_FLATMEM_ENABLE=y
279CONFIG_ARCH_POPULATES_NODE_MAP=y
280CONFIG_SELECT_MEMORY_MODEL=y
281CONFIG_FLATMEM_MANUAL=y
282# CONFIG_DISCONTIGMEM_MANUAL is not set
283# CONFIG_SPARSEMEM_MANUAL is not set
284CONFIG_FLATMEM=y
285CONFIG_FLAT_NODE_MEM_MAP=y
286CONFIG_PAGEFLAGS_EXTENDED=y
287CONFIG_SPLIT_PTLOCK_CPUS=4
288CONFIG_MIGRATION=y
289# CONFIG_PHYS_ADDR_T_64BIT is not set
290CONFIG_ZONE_DMA_FLAG=1
291CONFIG_BOUNCE=y
292CONFIG_VIRT_TO_BUS=y
293# CONFIG_KSM is not set
294CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
295CONFIG_PPC_4K_PAGES=y
296# CONFIG_PPC_16K_PAGES is not set
297# CONFIG_PPC_64K_PAGES is not set
298# CONFIG_PPC_256K_PAGES is not set
299CONFIG_FORCE_MAX_ZONEORDER=11
300CONFIG_PROC_DEVICETREE=y
301# CONFIG_CMDLINE_BOOL is not set
302CONFIG_EXTRA_TARGETS=""
303# CONFIG_PM is not set
304# CONFIG_SECCOMP is not set
305CONFIG_ISA_DMA_API=y
306
307#
308# Bus options
309#
310CONFIG_ZONE_DMA=y
311CONFIG_NEED_DMA_MAP_STATE=y
312CONFIG_FSL_SOC=y
313# CONFIG_PCI is not set
314# CONFIG_PCI_DOMAINS is not set
315# CONFIG_PCI_SYSCALL is not set
316# CONFIG_PCI_QSPAN is not set
317# CONFIG_ARCH_SUPPORTS_MSI is not set
318# CONFIG_PCCARD is not set
319# CONFIG_HAS_RAPIDIO is not set
320
321#
322# Advanced setup
323#
324# CONFIG_ADVANCED_OPTIONS is not set
325
326#
327# Default settings for advanced configuration options are used
328#
329CONFIG_LOWMEM_SIZE=0x30000000
330CONFIG_PAGE_OFFSET=0xc0000000
331CONFIG_KERNEL_START=0xc0000000
332CONFIG_PHYSICAL_START=0x00000000
333CONFIG_TASK_SIZE=0x80000000
334CONFIG_CONSISTENT_SIZE=0x00200000
335CONFIG_NET=y
336
337#
338# Networking options
339#
340CONFIG_PACKET=y
341CONFIG_UNIX=y
342# CONFIG_NET_KEY is not set
343CONFIG_INET=y
344# CONFIG_IP_MULTICAST is not set
345# CONFIG_IP_ADVANCED_ROUTER is not set
346CONFIG_IP_FIB_HASH=y
347CONFIG_IP_PNP=y
348# CONFIG_IP_PNP_DHCP is not set
349# CONFIG_IP_PNP_BOOTP is not set
350# CONFIG_IP_PNP_RARP is not set
351# CONFIG_NET_IPIP is not set
352# CONFIG_NET_IPGRE is not set
353# CONFIG_ARPD is not set
354CONFIG_SYN_COOKIES=y
355# CONFIG_INET_AH is not set
356# CONFIG_INET_ESP is not set
357# CONFIG_INET_IPCOMP is not set
358# CONFIG_INET_XFRM_TUNNEL is not set
359# CONFIG_INET_TUNNEL is not set
360# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
361# CONFIG_INET_XFRM_MODE_TUNNEL is not set
362# CONFIG_INET_XFRM_MODE_BEET is not set
363# CONFIG_INET_LRO is not set
364CONFIG_INET_DIAG=y
365CONFIG_INET_TCP_DIAG=y
366# CONFIG_TCP_CONG_ADVANCED is not set
367CONFIG_TCP_CONG_CUBIC=y
368CONFIG_DEFAULT_TCP_CONG="cubic"
369# CONFIG_TCP_MD5SIG is not set
370# CONFIG_IPV6 is not set
371# CONFIG_NETWORK_SECMARK is not set
372# CONFIG_NETFILTER is not set
373# CONFIG_IP_DCCP is not set
374# CONFIG_IP_SCTP is not set
375# CONFIG_RDS is not set
376# CONFIG_TIPC is not set
377# CONFIG_ATM is not set
378# CONFIG_BRIDGE is not set
379# CONFIG_NET_DSA is not set
380# CONFIG_VLAN_8021Q is not set
381# CONFIG_DECNET is not set
382# CONFIG_LLC2 is not set
383# CONFIG_IPX is not set
384# CONFIG_ATALK is not set
385# CONFIG_X25 is not set
386# CONFIG_LAPB is not set
387# CONFIG_ECONET is not set
388# CONFIG_WAN_ROUTER is not set
389# CONFIG_PHONET is not set
390# CONFIG_IEEE802154 is not set
391# CONFIG_NET_SCHED is not set
392# CONFIG_DCB is not set
393
394#
395# Network testing
396#
397# CONFIG_NET_PKTGEN is not set
398# CONFIG_HAMRADIO is not set
399# CONFIG_CAN is not set
400# CONFIG_IRDA is not set
401# CONFIG_BT is not set
402# CONFIG_AF_RXRPC is not set
403# CONFIG_WIRELESS is not set
404# CONFIG_WIMAX is not set
405# CONFIG_RFKILL is not set
406# CONFIG_NET_9P is not set
407
408#
409# Device Drivers
410#
411
412#
413# Generic Driver Options
414#
415CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
416# CONFIG_DEVTMPFS is not set
417CONFIG_STANDALONE=y
418CONFIG_PREVENT_FIRMWARE_BUILD=y
419# CONFIG_FW_LOADER is not set
420# CONFIG_DEBUG_DRIVER is not set
421# CONFIG_DEBUG_DEVRES is not set
422# CONFIG_SYS_HYPERVISOR is not set
423# CONFIG_CONNECTOR is not set
424CONFIG_MTD=y
425# CONFIG_MTD_DEBUG is not set
426# CONFIG_MTD_TESTS is not set
427CONFIG_MTD_CONCAT=y
428CONFIG_MTD_PARTITIONS=y
429# CONFIG_MTD_REDBOOT_PARTS is not set
430CONFIG_MTD_CMDLINE_PARTS=y
431CONFIG_MTD_OF_PARTS=y
432# CONFIG_MTD_AR7_PARTS is not set
433
434#
435# User Modules And Translation Layers
436#
437CONFIG_MTD_CHAR=y
438CONFIG_MTD_BLKDEVS=y
439CONFIG_MTD_BLOCK=y
440# CONFIG_FTL is not set
441# CONFIG_NFTL is not set
442# CONFIG_INFTL is not set
443# CONFIG_RFD_FTL is not set
444# CONFIG_SSFDC is not set
445# CONFIG_MTD_OOPS is not set
446
447#
448# RAM/ROM/Flash chip drivers
449#
450CONFIG_MTD_CFI=y
451# CONFIG_MTD_JEDECPROBE is not set
452CONFIG_MTD_GEN_PROBE=y
453# CONFIG_MTD_CFI_ADV_OPTIONS is not set
454CONFIG_MTD_MAP_BANK_WIDTH_1=y
455CONFIG_MTD_MAP_BANK_WIDTH_2=y
456CONFIG_MTD_MAP_BANK_WIDTH_4=y
457# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
458# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
459# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
460CONFIG_MTD_CFI_I1=y
461CONFIG_MTD_CFI_I2=y
462# CONFIG_MTD_CFI_I4 is not set
463# CONFIG_MTD_CFI_I8 is not set
464CONFIG_MTD_CFI_INTELEXT=y
465CONFIG_MTD_CFI_AMDSTD=y
466# CONFIG_MTD_CFI_STAA is not set
467CONFIG_MTD_CFI_UTIL=y
468# CONFIG_MTD_RAM is not set
469# CONFIG_MTD_ROM is not set
470# CONFIG_MTD_ABSENT is not set
471
472#
473# Mapping drivers for chip access
474#
475# CONFIG_MTD_COMPLEX_MAPPINGS is not set
476# CONFIG_MTD_PHYSMAP is not set
477CONFIG_MTD_PHYSMAP_OF=y
478# CONFIG_MTD_CFI_FLAGADM is not set
479# CONFIG_MTD_PLATRAM is not set
480
481#
482# Self-contained MTD device drivers
483#
484# CONFIG_MTD_SLRAM is not set
485# CONFIG_MTD_PHRAM is not set
486# CONFIG_MTD_MTDRAM is not set
487# CONFIG_MTD_BLOCK2MTD is not set
488
489#
490# Disk-On-Chip Device Drivers
491#
492# CONFIG_MTD_DOC2000 is not set
493# CONFIG_MTD_DOC2001 is not set
494# CONFIG_MTD_DOC2001PLUS is not set
495# CONFIG_MTD_NAND is not set
496# CONFIG_MTD_ONENAND is not set
497
498#
499# LPDDR flash memory drivers
500#
501# CONFIG_MTD_LPDDR is not set
502
503#
504# UBI - Unsorted block images
505#
506# CONFIG_MTD_UBI is not set
507CONFIG_OF_FLATTREE=y
508CONFIG_OF_DYNAMIC=y
509CONFIG_OF_DEVICE=y
510CONFIG_OF_MDIO=y
511# CONFIG_PARPORT is not set
512# CONFIG_BLK_DEV is not set
513# CONFIG_MISC_DEVICES is not set
514CONFIG_HAVE_IDE=y
515# CONFIG_IDE is not set
516
517#
518# SCSI device support
519#
520# CONFIG_RAID_ATTRS is not set
521# CONFIG_SCSI is not set
522# CONFIG_SCSI_DMA is not set
523# CONFIG_SCSI_NETLINK is not set
524# CONFIG_ATA is not set
525# CONFIG_MD is not set
526# CONFIG_MACINTOSH_DRIVERS is not set
527CONFIG_NETDEVICES=y
528# CONFIG_DUMMY is not set
529# CONFIG_BONDING is not set
530# CONFIG_MACVLAN is not set
531# CONFIG_EQUALIZER is not set
532# CONFIG_TUN is not set
533# CONFIG_VETH is not set
534CONFIG_PHYLIB=y
535
536#
537# MII PHY device drivers
538#
539# CONFIG_MARVELL_PHY is not set
540CONFIG_DAVICOM_PHY=y
541# CONFIG_QSEMI_PHY is not set
542# CONFIG_LXT_PHY is not set
543# CONFIG_CICADA_PHY is not set
544# CONFIG_VITESSE_PHY is not set
545# CONFIG_SMSC_PHY is not set
546# CONFIG_BROADCOM_PHY is not set
547# CONFIG_ICPLUS_PHY is not set
548# CONFIG_REALTEK_PHY is not set
549# CONFIG_NATIONAL_PHY is not set
550# CONFIG_STE10XP is not set
551# CONFIG_LSI_ET1011C_PHY is not set
552CONFIG_FIXED_PHY=y
553# CONFIG_MDIO_BITBANG is not set
554CONFIG_NET_ETHERNET=y
555CONFIG_MII=y
556# CONFIG_ETHOC is not set
557# CONFIG_DNET is not set
558# CONFIG_IBM_NEW_EMAC_ZMII is not set
559# CONFIG_IBM_NEW_EMAC_RGMII is not set
560# CONFIG_IBM_NEW_EMAC_TAH is not set
561# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
562# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
563# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
564# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
565# CONFIG_B44 is not set
566# CONFIG_KS8842 is not set
567# CONFIG_KS8851_MLL is not set
568# CONFIG_XILINX_EMACLITE is not set
569CONFIG_FS_ENET=y
570CONFIG_FS_ENET_HAS_SCC=y
571CONFIG_FS_ENET_HAS_FEC=y
572CONFIG_FS_ENET_MDIO_FEC=y
573# CONFIG_NETDEV_1000 is not set
574# CONFIG_NETDEV_10000 is not set
575# CONFIG_WLAN is not set
576
577#
578# Enable WiMAX (Networking options) to see the WiMAX drivers
579#
580# CONFIG_WAN is not set
581# CONFIG_PPP is not set
582# CONFIG_SLIP is not set
583# CONFIG_NETCONSOLE is not set
584# CONFIG_NETPOLL is not set
585# CONFIG_NET_POLL_CONTROLLER is not set
586# CONFIG_ISDN is not set
587# CONFIG_PHONE is not set
588
589#
590# Input device support
591#
592# CONFIG_INPUT is not set
593
594#
595# Hardware I/O ports
596#
597# CONFIG_SERIO is not set
598# CONFIG_GAMEPORT is not set
599
600#
601# Character devices
602#
603# CONFIG_VT is not set
604CONFIG_DEVKMEM=y
605# CONFIG_SERIAL_NONSTANDARD is not set
606
607#
608# Serial drivers
609#
610# CONFIG_SERIAL_8250 is not set
611
612#
613# Non-8250 serial port support
614#
615# CONFIG_SERIAL_UARTLITE is not set
616CONFIG_SERIAL_CORE=y
617CONFIG_SERIAL_CORE_CONSOLE=y
618CONFIG_SERIAL_CPM=y
619CONFIG_SERIAL_CPM_CONSOLE=y
620# CONFIG_SERIAL_TIMBERDALE is not set
621# CONFIG_SERIAL_GRLIB_GAISLER_APBUART is not set
622CONFIG_UNIX98_PTYS=y
623# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
624# CONFIG_LEGACY_PTYS is not set
625# CONFIG_HVC_UDBG is not set
626# CONFIG_IPMI_HANDLER is not set
627CONFIG_HW_RANDOM=y
628# CONFIG_HW_RANDOM_TIMERIOMEM is not set
629# CONFIG_NVRAM is not set
630CONFIG_GEN_RTC=y
631# CONFIG_GEN_RTC_X is not set
632# CONFIG_R3964 is not set
633# CONFIG_RAW_DRIVER is not set
634# CONFIG_TCG_TPM is not set
635# CONFIG_I2C is not set
636# CONFIG_SPI is not set
637
638#
639# PPS support
640#
641# CONFIG_PPS is not set
642CONFIG_ARCH_WANT_OPTIONAL_GPIOLIB=y
643# CONFIG_GPIOLIB is not set
644# CONFIG_W1 is not set
645# CONFIG_POWER_SUPPLY is not set
646# CONFIG_HWMON is not set
647# CONFIG_THERMAL is not set
648# CONFIG_WATCHDOG is not set
649CONFIG_SSB_POSSIBLE=y
650
651#
652# Sonics Silicon Backplane
653#
654# CONFIG_SSB is not set
655
656#
657# Multifunction device drivers
658#
659# CONFIG_MFD_CORE is not set
660# CONFIG_MFD_SM501 is not set
661# CONFIG_HTC_PASIC3 is not set
662# CONFIG_MFD_TMIO is not set
663# CONFIG_REGULATOR is not set
664# CONFIG_MEDIA_SUPPORT is not set
665
666#
667# Graphics support
668#
669# CONFIG_VGASTATE is not set
670# CONFIG_VIDEO_OUTPUT_CONTROL is not set
671# CONFIG_FB is not set
672# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
673
674#
675# Display device support
676#
677# CONFIG_DISPLAY_SUPPORT is not set
678# CONFIG_SOUND is not set
679# CONFIG_USB_SUPPORT is not set
680# CONFIG_MMC is not set
681# CONFIG_MEMSTICK is not set
682# CONFIG_NEW_LEDS is not set
683# CONFIG_ACCESSIBILITY is not set
684# CONFIG_EDAC is not set
685# CONFIG_RTC_CLASS is not set
686# CONFIG_DMADEVICES is not set
687# CONFIG_AUXDISPLAY is not set
688# CONFIG_UIO is not set
689
690#
691# TI VLYNQ
692#
693# CONFIG_STAGING is not set
694
695#
696# File systems
697#
698# CONFIG_EXT2_FS is not set
699# CONFIG_EXT3_FS is not set
700# CONFIG_EXT4_FS is not set
701# CONFIG_REISERFS_FS is not set
702# CONFIG_JFS_FS is not set
703# CONFIG_FS_POSIX_ACL is not set
704# CONFIG_XFS_FS is not set
705# CONFIG_GFS2_FS is not set
706# CONFIG_OCFS2_FS is not set
707# CONFIG_BTRFS_FS is not set
708# CONFIG_NILFS2_FS is not set
709CONFIG_FILE_LOCKING=y
710CONFIG_FSNOTIFY=y
711# CONFIG_DNOTIFY is not set
712# CONFIG_INOTIFY is not set
713CONFIG_INOTIFY_USER=y
714# CONFIG_QUOTA is not set
715# CONFIG_AUTOFS_FS is not set
716# CONFIG_AUTOFS4_FS is not set
717# CONFIG_FUSE_FS is not set
718
719#
720# Caches
721#
722# CONFIG_FSCACHE is not set
723
724#
725# CD-ROM/DVD Filesystems
726#
727# CONFIG_ISO9660_FS is not set
728# CONFIG_UDF_FS is not set
729
730#
731# DOS/FAT/NT Filesystems
732#
733# CONFIG_MSDOS_FS is not set
734# CONFIG_VFAT_FS is not set
735# CONFIG_NTFS_FS is not set
736
737#
738# Pseudo filesystems
739#
740CONFIG_PROC_FS=y
741# CONFIG_PROC_KCORE is not set
742CONFIG_PROC_SYSCTL=y
743CONFIG_PROC_PAGE_MONITOR=y
744CONFIG_SYSFS=y
745CONFIG_TMPFS=y
746# CONFIG_TMPFS_POSIX_ACL is not set
747# CONFIG_HUGETLB_PAGE is not set
748# CONFIG_CONFIGFS_FS is not set
749CONFIG_MISC_FILESYSTEMS=y
750# CONFIG_ADFS_FS is not set
751# CONFIG_AFFS_FS is not set
752# CONFIG_HFS_FS is not set
753# CONFIG_HFSPLUS_FS is not set
754# CONFIG_BEFS_FS is not set
755# CONFIG_BFS_FS is not set
756# CONFIG_EFS_FS is not set
757# CONFIG_JFFS2_FS is not set
758# CONFIG_LOGFS is not set
759CONFIG_CRAMFS=y
760# CONFIG_SQUASHFS is not set
761# CONFIG_VXFS_FS is not set
762# CONFIG_MINIX_FS is not set
763# CONFIG_OMFS_FS is not set
764# CONFIG_HPFS_FS is not set
765# CONFIG_QNX4FS_FS is not set
766# CONFIG_ROMFS_FS is not set
767# CONFIG_SYSV_FS is not set
768# CONFIG_UFS_FS is not set
769CONFIG_NETWORK_FILESYSTEMS=y
770CONFIG_NFS_FS=y
771CONFIG_NFS_V3=y
772# CONFIG_NFS_V3_ACL is not set
773# CONFIG_NFS_V4 is not set
774CONFIG_ROOT_NFS=y
775# CONFIG_NFSD is not set
776CONFIG_LOCKD=y
777CONFIG_LOCKD_V4=y
778CONFIG_NFS_COMMON=y
779CONFIG_SUNRPC=y
780# CONFIG_RPCSEC_GSS_KRB5 is not set
781# CONFIG_RPCSEC_GSS_SPKM3 is not set
782# CONFIG_SMB_FS is not set
783# CONFIG_CIFS is not set
784# CONFIG_NCP_FS is not set
785# CONFIG_CODA_FS is not set
786# CONFIG_AFS_FS is not set
787
788#
789# Partition Types
790#
791CONFIG_PARTITION_ADVANCED=y
792# CONFIG_ACORN_PARTITION is not set
793# CONFIG_OSF_PARTITION is not set
794# CONFIG_AMIGA_PARTITION is not set
795# CONFIG_ATARI_PARTITION is not set
796# CONFIG_MAC_PARTITION is not set
797CONFIG_MSDOS_PARTITION=y
798# CONFIG_BSD_DISKLABEL is not set
799# CONFIG_MINIX_SUBPARTITION is not set
800# CONFIG_SOLARIS_X86_PARTITION is not set
801# CONFIG_UNIXWARE_DISKLABEL is not set
802# CONFIG_LDM_PARTITION is not set
803# CONFIG_SGI_PARTITION is not set
804# CONFIG_ULTRIX_PARTITION is not set
805# CONFIG_SUN_PARTITION is not set
806# CONFIG_KARMA_PARTITION is not set
807# CONFIG_EFI_PARTITION is not set
808# CONFIG_SYSV68_PARTITION is not set
809# CONFIG_NLS is not set
810# CONFIG_DLM is not set
811# CONFIG_BINARY_PRINTF is not set
812
813#
814# Library routines
815#
816CONFIG_GENERIC_FIND_LAST_BIT=y
817# CONFIG_CRC_CCITT is not set
818# CONFIG_CRC16 is not set
819# CONFIG_CRC_T10DIF is not set
820# CONFIG_CRC_ITU_T is not set
821# CONFIG_CRC32 is not set
822# CONFIG_CRC7 is not set
823# CONFIG_LIBCRC32C is not set
824CONFIG_ZLIB_INFLATE=y
825CONFIG_HAS_IOMEM=y
826CONFIG_HAS_IOPORT=y
827CONFIG_HAS_DMA=y
828CONFIG_HAVE_LMB=y
829CONFIG_NLATTR=y
830CONFIG_GENERIC_ATOMIC64=y
831
832#
833# Kernel hacking
834#
835# CONFIG_PRINTK_TIME is not set
836CONFIG_ENABLE_WARN_DEPRECATED=y
837CONFIG_ENABLE_MUST_CHECK=y
838CONFIG_FRAME_WARN=1024
839CONFIG_MAGIC_SYSRQ=y
840# CONFIG_STRIP_ASM_SYMS is not set
841# CONFIG_UNUSED_SYMBOLS is not set
842# CONFIG_DEBUG_FS is not set
843# CONFIG_HEADERS_CHECK is not set
844CONFIG_DEBUG_KERNEL=y
845# CONFIG_DEBUG_SHIRQ is not set
846CONFIG_DETECT_SOFTLOCKUP=y
847# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
848CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
849CONFIG_DETECT_HUNG_TASK=y
850# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
851CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
852CONFIG_SCHED_DEBUG=y
853# CONFIG_SCHEDSTATS is not set
854# CONFIG_TIMER_STATS is not set
855# CONFIG_DEBUG_OBJECTS is not set
856# CONFIG_SLUB_DEBUG_ON is not set
857# CONFIG_SLUB_STATS is not set
858# CONFIG_DEBUG_KMEMLEAK is not set
859# CONFIG_DEBUG_SPINLOCK is not set
860# CONFIG_DEBUG_MUTEXES is not set
861# CONFIG_DEBUG_LOCK_ALLOC is not set
862# CONFIG_PROVE_LOCKING is not set
863# CONFIG_LOCK_STAT is not set
864# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
865# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
866# CONFIG_DEBUG_KOBJECT is not set
867CONFIG_DEBUG_BUGVERBOSE=y
868CONFIG_DEBUG_INFO=y
869# CONFIG_DEBUG_VM is not set
870# CONFIG_DEBUG_WRITECOUNT is not set
871# CONFIG_DEBUG_MEMORY_INIT is not set
872# CONFIG_DEBUG_LIST is not set
873# CONFIG_DEBUG_SG is not set
874# CONFIG_DEBUG_NOTIFIERS is not set
875# CONFIG_DEBUG_CREDENTIALS is not set
876# CONFIG_RCU_TORTURE_TEST is not set
877# CONFIG_RCU_CPU_STALL_DETECTOR is not set
878# CONFIG_BACKTRACE_SELF_TEST is not set
879# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
880# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
881# CONFIG_FAULT_INJECTION is not set
882# CONFIG_LATENCYTOP is not set
883# CONFIG_SYSCTL_SYSCALL_CHECK is not set
884# CONFIG_DEBUG_PAGEALLOC is not set
885CONFIG_HAVE_FUNCTION_TRACER=y
886CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
887CONFIG_HAVE_DYNAMIC_FTRACE=y
888CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
889CONFIG_TRACING_SUPPORT=y
890CONFIG_FTRACE=y
891# CONFIG_FUNCTION_TRACER is not set
892# CONFIG_IRQSOFF_TRACER is not set
893# CONFIG_SCHED_TRACER is not set
894# CONFIG_ENABLE_DEFAULT_TRACERS is not set
895# CONFIG_BOOT_TRACER is not set
896CONFIG_BRANCH_PROFILE_NONE=y
897# CONFIG_PROFILE_ANNOTATED_BRANCHES is not set
898# CONFIG_PROFILE_ALL_BRANCHES is not set
899# CONFIG_STACK_TRACER is not set
900# CONFIG_KMEMTRACE is not set
901# CONFIG_WORKQUEUE_TRACER is not set
902# CONFIG_BLK_DEV_IO_TRACE is not set
903# CONFIG_DMA_API_DEBUG is not set
904# CONFIG_SAMPLES is not set
905CONFIG_HAVE_ARCH_KGDB=y
906# CONFIG_KGDB is not set
907# CONFIG_PPC_DISABLE_WERROR is not set
908CONFIG_PPC_WERROR=y
909CONFIG_PRINT_STACK_DEPTH=64
910# CONFIG_DEBUG_STACKOVERFLOW is not set
911# CONFIG_DEBUG_STACK_USAGE is not set
912# CONFIG_CODE_PATCHING_SELFTEST is not set
913# CONFIG_FTR_FIXUP_SELFTEST is not set
914# CONFIG_MSI_BITMAP_SELFTEST is not set
915# CONFIG_XMON is not set
916# CONFIG_IRQSTACKS is not set
917# CONFIG_BDI_SWITCH is not set
918# CONFIG_PPC_EARLY_DEBUG is not set
919
920#
921# Security options
922#
923# CONFIG_KEYS is not set
924# CONFIG_SECURITY is not set
925# CONFIG_SECURITYFS is not set
926# CONFIG_DEFAULT_SECURITY_SELINUX is not set
927# CONFIG_DEFAULT_SECURITY_SMACK is not set
928# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
929CONFIG_DEFAULT_SECURITY_DAC=y
930CONFIG_DEFAULT_SECURITY=""
931# CONFIG_CRYPTO is not set
932CONFIG_PPC_CLOCK=y
933CONFIG_PPC_LIB_RHEAP=y
934# CONFIG_VIRTUALIZATION is not set
diff --git a/arch/powerpc/include/asm/abs_addr.h b/arch/powerpc/include/asm/abs_addr.h
index 9a846efe6382..5ab0b71531be 100644
--- a/arch/powerpc/include/asm/abs_addr.h
+++ b/arch/powerpc/include/asm/abs_addr.h
@@ -69,7 +69,7 @@ static inline unsigned long phys_to_abs(unsigned long pa)
69 * Legacy iSeries Hypervisor calls 69 * Legacy iSeries Hypervisor calls
70 */ 70 */
71#define iseries_hv_addr(virtaddr) \ 71#define iseries_hv_addr(virtaddr) \
72 (0x8000000000000000 | virt_to_abs(virtaddr)) 72 (0x8000000000000000UL | virt_to_abs(virtaddr))
73 73
74#endif /* __KERNEL__ */ 74#endif /* __KERNEL__ */
75#endif /* _ASM_POWERPC_ABS_ADDR_H */ 75#endif /* _ASM_POWERPC_ABS_ADDR_H */
diff --git a/arch/powerpc/include/asm/asm-compat.h b/arch/powerpc/include/asm/asm-compat.h
index 2048a6aeea91..decad950f11a 100644
--- a/arch/powerpc/include/asm/asm-compat.h
+++ b/arch/powerpc/include/asm/asm-compat.h
@@ -30,6 +30,7 @@
30#define PPC_STLCX stringify_in_c(stdcx.) 30#define PPC_STLCX stringify_in_c(stdcx.)
31#define PPC_CNTLZL stringify_in_c(cntlzd) 31#define PPC_CNTLZL stringify_in_c(cntlzd)
32#define PPC_LR_STKOFF 16 32#define PPC_LR_STKOFF 16
33#define PPC_MIN_STKFRM 112
33 34
34/* Move to CR, single-entry optimized version. Only available 35/* Move to CR, single-entry optimized version. Only available
35 * on POWER4 and later. 36 * on POWER4 and later.
@@ -55,6 +56,7 @@
55#define PPC_CNTLZL stringify_in_c(cntlzw) 56#define PPC_CNTLZL stringify_in_c(cntlzw)
56#define PPC_MTOCRF stringify_in_c(mtcrf) 57#define PPC_MTOCRF stringify_in_c(mtcrf)
57#define PPC_LR_STKOFF 4 58#define PPC_LR_STKOFF 4
59#define PPC_MIN_STKFRM 16
58 60
59#endif 61#endif
60 62
diff --git a/arch/powerpc/include/asm/cputable.h b/arch/powerpc/include/asm/cputable.h
index b0b21134f61a..3a40a992e594 100644
--- a/arch/powerpc/include/asm/cputable.h
+++ b/arch/powerpc/include/asm/cputable.h
@@ -197,6 +197,7 @@ extern const char *powerpc_base_platform;
197#define CPU_FTR_SAO LONG_ASM_CONST(0x0020000000000000) 197#define CPU_FTR_SAO LONG_ASM_CONST(0x0020000000000000)
198#define CPU_FTR_CP_USE_DCBTZ LONG_ASM_CONST(0x0040000000000000) 198#define CPU_FTR_CP_USE_DCBTZ LONG_ASM_CONST(0x0040000000000000)
199#define CPU_FTR_UNALIGNED_LD_STD LONG_ASM_CONST(0x0080000000000000) 199#define CPU_FTR_UNALIGNED_LD_STD LONG_ASM_CONST(0x0080000000000000)
200#define CPU_FTR_ASYM_SMT LONG_ASM_CONST(0x0100000000000000)
200 201
201#ifndef __ASSEMBLY__ 202#ifndef __ASSEMBLY__
202 203
@@ -412,7 +413,7 @@ extern const char *powerpc_base_platform;
412 CPU_FTR_MMCRA | CPU_FTR_SMT | \ 413 CPU_FTR_MMCRA | CPU_FTR_SMT | \
413 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \ 414 CPU_FTR_COHERENT_ICACHE | CPU_FTR_LOCKLESS_TLBIE | \
414 CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \ 415 CPU_FTR_PURR | CPU_FTR_SPURR | CPU_FTR_REAL_LE | \
415 CPU_FTR_DSCR | CPU_FTR_SAO) 416 CPU_FTR_DSCR | CPU_FTR_SAO | CPU_FTR_ASYM_SMT)
416#define CPU_FTRS_CELL (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \ 417#define CPU_FTRS_CELL (CPU_FTR_USE_TB | CPU_FTR_LWSYNC | \
417 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \ 418 CPU_FTR_PPCAS_ARCH_V2 | CPU_FTR_CTRL | \
418 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \ 419 CPU_FTR_ALTIVEC_COMP | CPU_FTR_MMCRA | CPU_FTR_SMT | \
@@ -517,6 +518,10 @@ static inline int cpu_has_feature(unsigned long feature)
517 & feature); 518 & feature);
518} 519}
519 520
521#ifdef CONFIG_HAVE_HW_BREAKPOINT
522#define HBP_NUM 1
523#endif /* CONFIG_HAVE_HW_BREAKPOINT */
524
520#endif /* !__ASSEMBLY__ */ 525#endif /* !__ASSEMBLY__ */
521 526
522#endif /* __KERNEL__ */ 527#endif /* __KERNEL__ */
diff --git a/arch/powerpc/include/asm/dbell.h b/arch/powerpc/include/asm/dbell.h
index 501189a543d1..0893ab9343a6 100644
--- a/arch/powerpc/include/asm/dbell.h
+++ b/arch/powerpc/include/asm/dbell.h
@@ -27,10 +27,10 @@ enum ppc_dbell {
27 PPC_G_DBELL_MC = 4, /* guest mcheck doorbell */ 27 PPC_G_DBELL_MC = 4, /* guest mcheck doorbell */
28}; 28};
29 29
30#ifdef CONFIG_SMP 30extern void doorbell_message_pass(int target, int msg);
31extern unsigned long dbell_smp_message[NR_CPUS]; 31extern void doorbell_exception(struct pt_regs *regs);
32extern void smp_dbell_message_pass(int target, int msg); 32extern void doorbell_check_self(void);
33#endif 33extern void doorbell_setup_this_cpu(void);
34 34
35static inline void ppc_msgsnd(enum ppc_dbell type, u32 flags, u32 tag) 35static inline void ppc_msgsnd(enum ppc_dbell type, u32 flags, u32 tag)
36{ 36{
diff --git a/arch/powerpc/include/asm/hvcall.h b/arch/powerpc/include/asm/hvcall.h
index 5119b7db3142..de03ca58db5d 100644
--- a/arch/powerpc/include/asm/hvcall.h
+++ b/arch/powerpc/include/asm/hvcall.h
@@ -74,6 +74,7 @@
74#define H_NOT_ENOUGH_RESOURCES -44 74#define H_NOT_ENOUGH_RESOURCES -44
75#define H_R_STATE -45 75#define H_R_STATE -45
76#define H_RESCINDEND -46 76#define H_RESCINDEND -46
77#define H_MULTI_THREADS_ACTIVE -9005
77 78
78 79
79/* Long Busy is a condition that can be returned by the firmware 80/* Long Busy is a condition that can be returned by the firmware
diff --git a/arch/powerpc/include/asm/hw_breakpoint.h b/arch/powerpc/include/asm/hw_breakpoint.h
new file mode 100644
index 000000000000..1c33ec17ca36
--- /dev/null
+++ b/arch/powerpc/include/asm/hw_breakpoint.h
@@ -0,0 +1,74 @@
1/*
2 * PowerPC BookIII S hardware breakpoint definitions
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17 *
18 * Copyright 2010, IBM Corporation.
19 * Author: K.Prasad <prasad@linux.vnet.ibm.com>
20 *
21 */
22
23#ifndef _PPC_BOOK3S_64_HW_BREAKPOINT_H
24#define _PPC_BOOK3S_64_HW_BREAKPOINT_H
25
26#ifdef __KERNEL__
27#ifdef CONFIG_HAVE_HW_BREAKPOINT
28
29struct arch_hw_breakpoint {
30 bool extraneous_interrupt;
31 u8 len; /* length of the target data symbol */
32 int type;
33 unsigned long address;
34};
35
36#include <linux/kdebug.h>
37#include <asm/reg.h>
38#include <asm/system.h>
39
40struct perf_event;
41struct pmu;
42struct perf_sample_data;
43
44#define HW_BREAKPOINT_ALIGN 0x7
45/* Maximum permissible length of any HW Breakpoint */
46#define HW_BREAKPOINT_LEN 0x8
47
48extern int hw_breakpoint_slots(int type);
49extern int arch_bp_generic_fields(int type, int *gen_bp_type);
50extern int arch_check_bp_in_kernelspace(struct perf_event *bp);
51extern int arch_validate_hwbkpt_settings(struct perf_event *bp);
52extern int hw_breakpoint_exceptions_notify(struct notifier_block *unused,
53 unsigned long val, void *data);
54int arch_install_hw_breakpoint(struct perf_event *bp);
55void arch_uninstall_hw_breakpoint(struct perf_event *bp);
56void hw_breakpoint_pmu_read(struct perf_event *bp);
57extern void flush_ptrace_hw_breakpoint(struct task_struct *tsk);
58
59extern struct pmu perf_ops_bp;
60extern void ptrace_triggered(struct perf_event *bp, int nmi,
61 struct perf_sample_data *data, struct pt_regs *regs);
62static inline void hw_breakpoint_disable(void)
63{
64 set_dabr(0);
65}
66extern void thread_change_pc(struct task_struct *tsk, struct pt_regs *regs);
67
68#else /* CONFIG_HAVE_HW_BREAKPOINT */
69static inline void hw_breakpoint_disable(void) { }
70static inline void thread_change_pc(struct task_struct *tsk,
71 struct pt_regs *regs) { }
72#endif /* CONFIG_HAVE_HW_BREAKPOINT */
73#endif /* __KERNEL__ */
74#endif /* _PPC_BOOK3S_64_HW_BREAKPOINT_H */
diff --git a/arch/powerpc/include/asm/irq.h b/arch/powerpc/include/asm/irq.h
index ecba37a91749..67ab5fb7d153 100644
--- a/arch/powerpc/include/asm/irq.h
+++ b/arch/powerpc/include/asm/irq.h
@@ -300,34 +300,6 @@ extern unsigned int irq_alloc_virt(struct irq_host *host,
300 */ 300 */
301extern void irq_free_virt(unsigned int virq, unsigned int count); 301extern void irq_free_virt(unsigned int virq, unsigned int count);
302 302
303
304/* -- OF helpers -- */
305
306/**
307 * irq_create_of_mapping - Map a hardware interrupt into linux virq space
308 * @controller: Device node of the interrupt controller
309 * @inspec: Interrupt specifier from the device-tree
310 * @intsize: Size of the interrupt specifier from the device-tree
311 *
312 * This function is identical to irq_create_mapping except that it takes
313 * as input informations straight from the device-tree (typically the results
314 * of the of_irq_map_*() functions.
315 */
316extern unsigned int irq_create_of_mapping(struct device_node *controller,
317 const u32 *intspec, unsigned int intsize);
318
319/**
320 * irq_of_parse_and_map - Parse and Map an interrupt into linux virq space
321 * @device: Device node of the device whose interrupt is to be mapped
322 * @index: Index of the interrupt to map
323 *
324 * This function is a wrapper that chains of_irq_map_one() and
325 * irq_create_of_mapping() to make things easier to callers
326 */
327extern unsigned int irq_of_parse_and_map(struct device_node *dev, int index);
328
329/* -- End OF helpers -- */
330
331/** 303/**
332 * irq_early_init - Init irq remapping subsystem 304 * irq_early_init - Init irq remapping subsystem
333 */ 305 */
diff --git a/arch/powerpc/include/asm/kvm_book3s.h b/arch/powerpc/include/asm/kvm_book3s.h
index 6f74d93725a0..8274a2d43925 100644
--- a/arch/powerpc/include/asm/kvm_book3s.h
+++ b/arch/powerpc/include/asm/kvm_book3s.h
@@ -115,7 +115,15 @@ extern void kvmppc_mmu_book3s_32_init(struct kvm_vcpu *vcpu);
115extern int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *pte); 115extern int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *pte);
116extern int kvmppc_mmu_map_segment(struct kvm_vcpu *vcpu, ulong eaddr); 116extern int kvmppc_mmu_map_segment(struct kvm_vcpu *vcpu, ulong eaddr);
117extern void kvmppc_mmu_flush_segments(struct kvm_vcpu *vcpu); 117extern void kvmppc_mmu_flush_segments(struct kvm_vcpu *vcpu);
118extern struct kvmppc_pte *kvmppc_mmu_find_pte(struct kvm_vcpu *vcpu, u64 ea, bool data); 118
119extern void kvmppc_mmu_hpte_cache_map(struct kvm_vcpu *vcpu, struct hpte_cache *pte);
120extern struct hpte_cache *kvmppc_mmu_hpte_cache_next(struct kvm_vcpu *vcpu);
121extern void kvmppc_mmu_hpte_destroy(struct kvm_vcpu *vcpu);
122extern int kvmppc_mmu_hpte_init(struct kvm_vcpu *vcpu);
123extern void kvmppc_mmu_invalidate_pte(struct kvm_vcpu *vcpu, struct hpte_cache *pte);
124extern int kvmppc_mmu_hpte_sysinit(void);
125extern void kvmppc_mmu_hpte_sysexit(void);
126
119extern int kvmppc_ld(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr, bool data); 127extern int kvmppc_ld(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr, bool data);
120extern int kvmppc_st(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr, bool data); 128extern int kvmppc_st(struct kvm_vcpu *vcpu, ulong *eaddr, int size, void *ptr, bool data);
121extern void kvmppc_book3s_queue_irqprio(struct kvm_vcpu *vcpu, unsigned int vec); 129extern void kvmppc_book3s_queue_irqprio(struct kvm_vcpu *vcpu, unsigned int vec);
diff --git a/arch/powerpc/include/asm/kvm_fpu.h b/arch/powerpc/include/asm/kvm_fpu.h
index 94f05de9ad04..c3d4f0518a67 100644
--- a/arch/powerpc/include/asm/kvm_fpu.h
+++ b/arch/powerpc/include/asm/kvm_fpu.h
@@ -22,24 +22,24 @@
22 22
23#include <linux/types.h> 23#include <linux/types.h>
24 24
25extern void fps_fres(struct thread_struct *t, u32 *dst, u32 *src1); 25extern void fps_fres(u64 *fpscr, u32 *dst, u32 *src1);
26extern void fps_frsqrte(struct thread_struct *t, u32 *dst, u32 *src1); 26extern void fps_frsqrte(u64 *fpscr, u32 *dst, u32 *src1);
27extern void fps_fsqrts(struct thread_struct *t, u32 *dst, u32 *src1); 27extern void fps_fsqrts(u64 *fpscr, u32 *dst, u32 *src1);
28 28
29extern void fps_fadds(struct thread_struct *t, u32 *dst, u32 *src1, u32 *src2); 29extern void fps_fadds(u64 *fpscr, u32 *dst, u32 *src1, u32 *src2);
30extern void fps_fdivs(struct thread_struct *t, u32 *dst, u32 *src1, u32 *src2); 30extern void fps_fdivs(u64 *fpscr, u32 *dst, u32 *src1, u32 *src2);
31extern void fps_fmuls(struct thread_struct *t, u32 *dst, u32 *src1, u32 *src2); 31extern void fps_fmuls(u64 *fpscr, u32 *dst, u32 *src1, u32 *src2);
32extern void fps_fsubs(struct thread_struct *t, u32 *dst, u32 *src1, u32 *src2); 32extern void fps_fsubs(u64 *fpscr, u32 *dst, u32 *src1, u32 *src2);
33 33
34extern void fps_fmadds(struct thread_struct *t, u32 *dst, u32 *src1, u32 *src2, 34extern void fps_fmadds(u64 *fpscr, u32 *dst, u32 *src1, u32 *src2,
35 u32 *src3); 35 u32 *src3);
36extern void fps_fmsubs(struct thread_struct *t, u32 *dst, u32 *src1, u32 *src2, 36extern void fps_fmsubs(u64 *fpscr, u32 *dst, u32 *src1, u32 *src2,
37 u32 *src3); 37 u32 *src3);
38extern void fps_fnmadds(struct thread_struct *t, u32 *dst, u32 *src1, u32 *src2, 38extern void fps_fnmadds(u64 *fpscr, u32 *dst, u32 *src1, u32 *src2,
39 u32 *src3); 39 u32 *src3);
40extern void fps_fnmsubs(struct thread_struct *t, u32 *dst, u32 *src1, u32 *src2, 40extern void fps_fnmsubs(u64 *fpscr, u32 *dst, u32 *src1, u32 *src2,
41 u32 *src3); 41 u32 *src3);
42extern void fps_fsel(struct thread_struct *t, u32 *dst, u32 *src1, u32 *src2, 42extern void fps_fsel(u64 *fpscr, u32 *dst, u32 *src1, u32 *src2,
43 u32 *src3); 43 u32 *src3);
44 44
45#define FPD_ONE_IN(name) extern void fpd_ ## name(u64 *fpscr, u32 *cr, \ 45#define FPD_ONE_IN(name) extern void fpd_ ## name(u64 *fpscr, u32 *cr, \
@@ -82,4 +82,7 @@ FPD_THREE_IN(fmadd)
82FPD_THREE_IN(fnmsub) 82FPD_THREE_IN(fnmsub)
83FPD_THREE_IN(fnmadd) 83FPD_THREE_IN(fnmadd)
84 84
85extern void kvm_cvt_fd(u32 *from, u64 *to, u64 *fpscr);
86extern void kvm_cvt_df(u64 *from, u32 *to, u64 *fpscr);
87
85#endif 88#endif
diff --git a/arch/powerpc/include/asm/kvm_host.h b/arch/powerpc/include/asm/kvm_host.h
index 0c9ad869decd..b0b23c007d6e 100644
--- a/arch/powerpc/include/asm/kvm_host.h
+++ b/arch/powerpc/include/asm/kvm_host.h
@@ -35,10 +35,17 @@
35#define KVM_COALESCED_MMIO_PAGE_OFFSET 1 35#define KVM_COALESCED_MMIO_PAGE_OFFSET 1
36 36
37/* We don't currently support large pages. */ 37/* We don't currently support large pages. */
38#define KVM_HPAGE_GFN_SHIFT(x) 0
38#define KVM_NR_PAGE_SIZES 1 39#define KVM_NR_PAGE_SIZES 1
39#define KVM_PAGES_PER_HPAGE(x) (1UL<<31) 40#define KVM_PAGES_PER_HPAGE(x) (1UL<<31)
40 41
41#define HPTEG_CACHE_NUM 1024 42#define HPTEG_CACHE_NUM (1 << 15)
43#define HPTEG_HASH_BITS_PTE 13
44#define HPTEG_HASH_BITS_VPTE 13
45#define HPTEG_HASH_BITS_VPTE_LONG 5
46#define HPTEG_HASH_NUM_PTE (1 << HPTEG_HASH_BITS_PTE)
47#define HPTEG_HASH_NUM_VPTE (1 << HPTEG_HASH_BITS_VPTE)
48#define HPTEG_HASH_NUM_VPTE_LONG (1 << HPTEG_HASH_BITS_VPTE_LONG)
42 49
43struct kvm; 50struct kvm;
44struct kvm_run; 51struct kvm_run;
@@ -151,6 +158,9 @@ struct kvmppc_mmu {
151}; 158};
152 159
153struct hpte_cache { 160struct hpte_cache {
161 struct hlist_node list_pte;
162 struct hlist_node list_vpte;
163 struct hlist_node list_vpte_long;
154 u64 host_va; 164 u64 host_va;
155 u64 pfn; 165 u64 pfn;
156 ulong slot; 166 ulong slot;
@@ -282,8 +292,10 @@ struct kvm_vcpu_arch {
282 unsigned long pending_exceptions; 292 unsigned long pending_exceptions;
283 293
284#ifdef CONFIG_PPC_BOOK3S 294#ifdef CONFIG_PPC_BOOK3S
285 struct hpte_cache hpte_cache[HPTEG_CACHE_NUM]; 295 struct hlist_head hpte_hash_pte[HPTEG_HASH_NUM_PTE];
286 int hpte_cache_offset; 296 struct hlist_head hpte_hash_vpte[HPTEG_HASH_NUM_VPTE];
297 struct hlist_head hpte_hash_vpte_long[HPTEG_HASH_NUM_VPTE_LONG];
298 int hpte_cache_count;
287#endif 299#endif
288}; 300};
289 301
diff --git a/arch/powerpc/include/asm/local64.h b/arch/powerpc/include/asm/local64.h
new file mode 100644
index 000000000000..36c93b5cc239
--- /dev/null
+++ b/arch/powerpc/include/asm/local64.h
@@ -0,0 +1 @@
#include <asm-generic/local64.h>
diff --git a/arch/powerpc/include/asm/machdep.h b/arch/powerpc/include/asm/machdep.h
index 9f0fc9e6ce0d..adc8e6cdf339 100644
--- a/arch/powerpc/include/asm/machdep.h
+++ b/arch/powerpc/include/asm/machdep.h
@@ -266,6 +266,7 @@ struct machdep_calls {
266 void (*suspend_disable_irqs)(void); 266 void (*suspend_disable_irqs)(void);
267 void (*suspend_enable_irqs)(void); 267 void (*suspend_enable_irqs)(void);
268#endif 268#endif
269 int (*suspend_disable_cpu)(void);
269 270
270#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE 271#ifdef CONFIG_ARCH_CPU_PROBE_RELEASE
271 ssize_t (*cpu_probe)(const char *, size_t); 272 ssize_t (*cpu_probe)(const char *, size_t);
@@ -277,6 +278,7 @@ extern void e500_idle(void);
277extern void power4_idle(void); 278extern void power4_idle(void);
278extern void power4_cpu_offline_powersave(void); 279extern void power4_cpu_offline_powersave(void);
279extern void ppc6xx_idle(void); 280extern void ppc6xx_idle(void);
281extern void book3e_idle(void);
280 282
281/* 283/*
282 * ppc_md contains a copy of the machine description structure for the 284 * ppc_md contains a copy of the machine description structure for the
@@ -366,8 +368,5 @@ static inline void log_error(char *buf, unsigned int err_type, int fatal)
366#define machine_late_initcall(mach,fn) __define_machine_initcall(mach,"7",fn,7) 368#define machine_late_initcall(mach,fn) __define_machine_initcall(mach,"7",fn,7)
367#define machine_late_initcall_sync(mach,fn) __define_machine_initcall(mach,"7s",fn,7s) 369#define machine_late_initcall_sync(mach,fn) __define_machine_initcall(mach,"7s",fn,7s)
368 370
369void generic_suspend_disable_irqs(void);
370void generic_suspend_enable_irqs(void);
371
372#endif /* __KERNEL__ */ 371#endif /* __KERNEL__ */
373#endif /* _ASM_POWERPC_MACHDEP_H */ 372#endif /* _ASM_POWERPC_MACHDEP_H */
diff --git a/arch/powerpc/include/asm/macio.h b/arch/powerpc/include/asm/macio.h
index 675e159b5ef4..7ab82c825a03 100644
--- a/arch/powerpc/include/asm/macio.h
+++ b/arch/powerpc/include/asm/macio.h
@@ -38,7 +38,7 @@ struct macio_dev
38{ 38{
39 struct macio_bus *bus; /* macio bus this device is on */ 39 struct macio_bus *bus; /* macio bus this device is on */
40 struct macio_dev *media_bay; /* Device is part of a media bay */ 40 struct macio_dev *media_bay; /* Device is part of a media bay */
41 struct of_device ofdev; 41 struct platform_device ofdev;
42 struct device_dma_parameters dma_parms; /* ide needs that */ 42 struct device_dma_parameters dma_parms; /* ide needs that */
43 int n_resources; 43 int n_resources;
44 struct resource resource[MACIO_DEV_COUNT_RESOURCES]; 44 struct resource resource[MACIO_DEV_COUNT_RESOURCES];
diff --git a/arch/powerpc/include/asm/mmu-book3e.h b/arch/powerpc/include/asm/mmu-book3e.h
index 74695816205c..87a1d787c5b6 100644
--- a/arch/powerpc/include/asm/mmu-book3e.h
+++ b/arch/powerpc/include/asm/mmu-book3e.h
@@ -193,6 +193,10 @@ struct mmu_psize_def
193{ 193{
194 unsigned int shift; /* number of bits */ 194 unsigned int shift; /* number of bits */
195 unsigned int enc; /* PTE encoding */ 195 unsigned int enc; /* PTE encoding */
196 unsigned int ind; /* Corresponding indirect page size shift */
197 unsigned int flags;
198#define MMU_PAGE_SIZE_DIRECT 0x1 /* Supported as a direct size */
199#define MMU_PAGE_SIZE_INDIRECT 0x2 /* Supported as an indirect size */
196}; 200};
197extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT]; 201extern struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT];
198 202
diff --git a/arch/powerpc/include/asm/mpc5121.h b/arch/powerpc/include/asm/mpc5121.h
index e6a30bb1d16a..8c0ab2ca689c 100644
--- a/arch/powerpc/include/asm/mpc5121.h
+++ b/arch/powerpc/include/asm/mpc5121.h
@@ -21,4 +21,36 @@ struct mpc512x_reset_module {
21 u32 rcer; /* Reset Control Enable Register */ 21 u32 rcer; /* Reset Control Enable Register */
22}; 22};
23 23
24/*
25 * Clock Control Module
26 */
27struct mpc512x_ccm {
28 u32 spmr; /* System PLL Mode Register */
29 u32 sccr1; /* System Clock Control Register 1 */
30 u32 sccr2; /* System Clock Control Register 2 */
31 u32 scfr1; /* System Clock Frequency Register 1 */
32 u32 scfr2; /* System Clock Frequency Register 2 */
33 u32 scfr2s; /* System Clock Frequency Shadow Register 2 */
34 u32 bcr; /* Bread Crumb Register */
35 u32 p0ccr; /* PSC0 Clock Control Register */
36 u32 p1ccr; /* PSC1 CCR */
37 u32 p2ccr; /* PSC2 CCR */
38 u32 p3ccr; /* PSC3 CCR */
39 u32 p4ccr; /* PSC4 CCR */
40 u32 p5ccr; /* PSC5 CCR */
41 u32 p6ccr; /* PSC6 CCR */
42 u32 p7ccr; /* PSC7 CCR */
43 u32 p8ccr; /* PSC8 CCR */
44 u32 p9ccr; /* PSC9 CCR */
45 u32 p10ccr; /* PSC10 CCR */
46 u32 p11ccr; /* PSC11 CCR */
47 u32 spccr; /* SPDIF Clock Control Register */
48 u32 cccr; /* CFM Clock Control Register */
49 u32 dccr; /* DIU Clock Control Register */
50 u32 m1ccr; /* MSCAN1 CCR */
51 u32 m2ccr; /* MSCAN2 CCR */
52 u32 m3ccr; /* MSCAN3 CCR */
53 u32 m4ccr; /* MSCAN4 CCR */
54 u8 res[0x98]; /* Reserved */
55};
24#endif /* __ASM_POWERPC_MPC5121_H__ */ 56#endif /* __ASM_POWERPC_MPC5121_H__ */
diff --git a/arch/powerpc/include/asm/of_device.h b/arch/powerpc/include/asm/of_device.h
deleted file mode 100644
index 444e97e2982e..000000000000
--- a/arch/powerpc/include/asm/of_device.h
+++ /dev/null
@@ -1,27 +0,0 @@
1#ifndef _ASM_POWERPC_OF_DEVICE_H
2#define _ASM_POWERPC_OF_DEVICE_H
3#ifdef __KERNEL__
4
5#include <linux/device.h>
6#include <linux/of.h>
7
8/*
9 * The of_device is a kind of "base class" that is a superset of
10 * struct device for use by devices attached to an OF node and
11 * probed using OF properties.
12 */
13struct of_device
14{
15 struct device dev; /* Generic device interface */
16 struct pdev_archdata archdata;
17};
18
19extern struct of_device *of_device_alloc(struct device_node *np,
20 const char *bus_id,
21 struct device *parent);
22
23extern int of_device_uevent(struct device *dev,
24 struct kobj_uevent_env *env);
25
26#endif /* __KERNEL__ */
27#endif /* _ASM_POWERPC_OF_DEVICE_H */
diff --git a/arch/powerpc/include/asm/of_platform.h b/arch/powerpc/include/asm/of_platform.h
deleted file mode 100644
index d4aaa3489440..000000000000
--- a/arch/powerpc/include/asm/of_platform.h
+++ /dev/null
@@ -1,29 +0,0 @@
1#ifndef _ASM_POWERPC_OF_PLATFORM_H
2#define _ASM_POWERPC_OF_PLATFORM_H
3/*
4 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
5 * <benh@kernel.crashing.org>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 *
12 */
13
14/* Platform devices and busses creation */
15extern struct of_device *of_platform_device_create(struct device_node *np,
16 const char *bus_id,
17 struct device *parent);
18/* pseudo "matches" value to not do deep probe */
19#define OF_NO_DEEP_PROBE ((struct of_device_id *)-1)
20
21extern int of_platform_bus_probe(struct device_node *root,
22 const struct of_device_id *matches,
23 struct device *parent);
24
25extern struct of_device *of_find_device_by_phandle(phandle ph);
26
27extern void of_instantiate_rtc(void);
28
29#endif /* _ASM_POWERPC_OF_PLATFORM_H */
diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.h
index 8ce7963ad41d..1ff6662f7faf 100644
--- a/arch/powerpc/include/asm/paca.h
+++ b/arch/powerpc/include/asm/paca.h
@@ -146,7 +146,7 @@ struct paca_struct {
146extern struct paca_struct *paca; 146extern struct paca_struct *paca;
147extern __initdata struct paca_struct boot_paca; 147extern __initdata struct paca_struct boot_paca;
148extern void initialise_paca(struct paca_struct *new_paca, int cpu); 148extern void initialise_paca(struct paca_struct *new_paca, int cpu);
149 149extern void setup_paca(struct paca_struct *new_paca);
150extern void allocate_pacas(void); 150extern void allocate_pacas(void);
151extern void free_unused_pacas(void); 151extern void free_unused_pacas(void);
152 152
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index 76e1f313a58e..51e9e6f90d12 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -303,13 +303,8 @@ extern void pcibios_free_controller(struct pci_controller *phb);
303extern void pcibios_setup_phb_resources(struct pci_controller *hose); 303extern void pcibios_setup_phb_resources(struct pci_controller *hose);
304 304
305#ifdef CONFIG_PCI 305#ifdef CONFIG_PCI
306extern unsigned long pci_address_to_pio(phys_addr_t address);
307extern int pcibios_vaddr_is_ioport(void __iomem *address); 306extern int pcibios_vaddr_is_ioport(void __iomem *address);
308#else 307#else
309static inline unsigned long pci_address_to_pio(phys_addr_t address)
310{
311 return (unsigned long)-1;
312}
313static inline int pcibios_vaddr_is_ioport(void __iomem *address) 308static inline int pcibios_vaddr_is_ioport(void __iomem *address)
314{ 309{
315 return 0; 310 return 0;
diff --git a/arch/powerpc/include/asm/percpu.h b/arch/powerpc/include/asm/percpu.h
index f879252b7ea6..2cedefddba37 100644
--- a/arch/powerpc/include/asm/percpu.h
+++ b/arch/powerpc/include/asm/percpu.h
@@ -1,7 +1,6 @@
1#ifndef _ASM_POWERPC_PERCPU_H_ 1#ifndef _ASM_POWERPC_PERCPU_H_
2#define _ASM_POWERPC_PERCPU_H_ 2#define _ASM_POWERPC_PERCPU_H_
3#ifdef __powerpc64__ 3#ifdef __powerpc64__
4#include <linux/compiler.h>
5 4
6/* 5/*
7 * Same as asm-generic/percpu.h, except that we store the per cpu offset 6 * Same as asm-generic/percpu.h, except that we store the per cpu offset
@@ -12,9 +11,7 @@
12 11
13#include <asm/paca.h> 12#include <asm/paca.h>
14 13
15#define __per_cpu_offset(cpu) (paca[cpu].data_offset)
16#define __my_cpu_offset local_paca->data_offset 14#define __my_cpu_offset local_paca->data_offset
17#define per_cpu_offset(x) (__per_cpu_offset(x))
18 15
19#endif /* CONFIG_SMP */ 16#endif /* CONFIG_SMP */
20#endif /* __powerpc64__ */ 17#endif /* __powerpc64__ */
diff --git a/arch/powerpc/include/asm/perf_event.h b/arch/powerpc/include/asm/perf_event.h
index e6d4ce69b126..5c16b891d501 100644
--- a/arch/powerpc/include/asm/perf_event.h
+++ b/arch/powerpc/include/asm/perf_event.h
@@ -21,3 +21,15 @@
21#ifdef CONFIG_FSL_EMB_PERF_EVENT 21#ifdef CONFIG_FSL_EMB_PERF_EVENT
22#include <asm/perf_event_fsl_emb.h> 22#include <asm/perf_event_fsl_emb.h>
23#endif 23#endif
24
25#ifdef CONFIG_PERF_EVENTS
26#include <asm/ptrace.h>
27#include <asm/reg.h>
28
29#define perf_arch_fetch_caller_regs(regs, __ip) \
30 do { \
31 (regs)->nip = __ip; \
32 (regs)->gpr[1] = *(unsigned long *)__get_SP(); \
33 asm volatile("mfmsr %0" : "=r" ((regs)->msr)); \
34 } while (0)
35#endif
diff --git a/arch/powerpc/include/asm/ppc-opcode.h b/arch/powerpc/include/asm/ppc-opcode.h
index d553bbeb726c..43adc8b819ed 100644
--- a/arch/powerpc/include/asm/ppc-opcode.h
+++ b/arch/powerpc/include/asm/ppc-opcode.h
@@ -52,13 +52,17 @@
52#define PPC_INST_WAIT 0x7c00007c 52#define PPC_INST_WAIT 0x7c00007c
53#define PPC_INST_TLBIVAX 0x7c000624 53#define PPC_INST_TLBIVAX 0x7c000624
54#define PPC_INST_TLBSRX_DOT 0x7c0006a5 54#define PPC_INST_TLBSRX_DOT 0x7c0006a5
55#define PPC_INST_XXLOR 0xf0000510
55 56
56/* macros to insert fields into opcodes */ 57/* macros to insert fields into opcodes */
57#define __PPC_RA(a) (((a) & 0x1f) << 16) 58#define __PPC_RA(a) (((a) & 0x1f) << 16)
58#define __PPC_RB(b) (((b) & 0x1f) << 11) 59#define __PPC_RB(b) (((b) & 0x1f) << 11)
59#define __PPC_RS(s) (((s) & 0x1f) << 21) 60#define __PPC_RS(s) (((s) & 0x1f) << 21)
60#define __PPC_RT(s) __PPC_RS(s) 61#define __PPC_RT(s) __PPC_RS(s)
62#define __PPC_XA(a) ((((a) & 0x1f) << 16) | (((a) & 0x20) >> 3))
63#define __PPC_XB(b) ((((b) & 0x1f) << 11) | (((b) & 0x20) >> 4))
61#define __PPC_XS(s) ((((s) & 0x1f) << 21) | (((s) & 0x20) >> 5)) 64#define __PPC_XS(s) ((((s) & 0x1f) << 21) | (((s) & 0x20) >> 5))
65#define __PPC_XT(s) __PPC_XS(s)
62#define __PPC_T_TLB(t) (((t) & 0x3) << 21) 66#define __PPC_T_TLB(t) (((t) & 0x3) << 21)
63#define __PPC_WC(w) (((w) & 0x3) << 21) 67#define __PPC_WC(w) (((w) & 0x3) << 21)
64/* 68/*
@@ -106,9 +110,12 @@
106 * the 128 bit load store instructions based on that. 110 * the 128 bit load store instructions based on that.
107 */ 111 */
108#define VSX_XX1(s, a, b) (__PPC_XS(s) | __PPC_RA(a) | __PPC_RB(b)) 112#define VSX_XX1(s, a, b) (__PPC_XS(s) | __PPC_RA(a) | __PPC_RB(b))
113#define VSX_XX3(t, a, b) (__PPC_XT(t) | __PPC_XA(a) | __PPC_XB(b))
109#define STXVD2X(s, a, b) stringify_in_c(.long PPC_INST_STXVD2X | \ 114#define STXVD2X(s, a, b) stringify_in_c(.long PPC_INST_STXVD2X | \
110 VSX_XX1((s), (a), (b))) 115 VSX_XX1((s), (a), (b)))
111#define LXVD2X(s, a, b) stringify_in_c(.long PPC_INST_LXVD2X | \ 116#define LXVD2X(s, a, b) stringify_in_c(.long PPC_INST_LXVD2X | \
112 VSX_XX1((s), (a), (b))) 117 VSX_XX1((s), (a), (b)))
118#define XXLOR(t, a, b) stringify_in_c(.long PPC_INST_XXLOR | \
119 VSX_XX3((t), (a), (b)))
113 120
114#endif /* _ASM_POWERPC_PPC_OPCODE_H */ 121#endif /* _ASM_POWERPC_PPC_OPCODE_H */
diff --git a/arch/powerpc/include/asm/processor.h b/arch/powerpc/include/asm/processor.h
index 7492fe8ad6e4..19c05b0f74be 100644
--- a/arch/powerpc/include/asm/processor.h
+++ b/arch/powerpc/include/asm/processor.h
@@ -209,6 +209,14 @@ struct thread_struct {
209#ifdef CONFIG_PPC64 209#ifdef CONFIG_PPC64
210 unsigned long start_tb; /* Start purr when proc switched in */ 210 unsigned long start_tb; /* Start purr when proc switched in */
211 unsigned long accum_tb; /* Total accumilated purr for process */ 211 unsigned long accum_tb; /* Total accumilated purr for process */
212#ifdef CONFIG_HAVE_HW_BREAKPOINT
213 struct perf_event *ptrace_bps[HBP_NUM];
214 /*
215 * Helps identify source of single-step exception and subsequent
216 * hw-breakpoint enablement
217 */
218 struct perf_event *last_hit_ubp;
219#endif /* CONFIG_HAVE_HW_BREAKPOINT */
212#endif 220#endif
213 unsigned long dabr; /* Data address breakpoint register */ 221 unsigned long dabr; /* Data address breakpoint register */
214#ifdef CONFIG_ALTIVEC 222#ifdef CONFIG_ALTIVEC
diff --git a/arch/powerpc/include/asm/prom.h b/arch/powerpc/include/asm/prom.h
index ddd408a93b5a..ae26f2efd089 100644
--- a/arch/powerpc/include/asm/prom.h
+++ b/arch/powerpc/include/asm/prom.h
@@ -17,9 +17,6 @@
17 * 2 of the License, or (at your option) any later version. 17 * 2 of the License, or (at your option) any later version.
18 */ 18 */
19#include <linux/types.h> 19#include <linux/types.h>
20#include <linux/of_fdt.h>
21#include <linux/proc_fs.h>
22#include <linux/platform_device.h>
23#include <asm/irq.h> 20#include <asm/irq.h>
24#include <asm/atomic.h> 21#include <asm/atomic.h>
25 22
@@ -43,49 +40,14 @@ extern void pci_create_OF_bus_map(void);
43 * OF address retreival & translation 40 * OF address retreival & translation
44 */ 41 */
45 42
46/* Translate an OF address block into a CPU physical address
47 */
48extern u64 of_translate_address(struct device_node *np, const u32 *addr);
49
50/* Translate a DMA address from device space to CPU space */ 43/* Translate a DMA address from device space to CPU space */
51extern u64 of_translate_dma_address(struct device_node *dev, 44extern u64 of_translate_dma_address(struct device_node *dev,
52 const u32 *in_addr); 45 const u32 *in_addr);
53 46
54/* Extract an address from a device, returns the region size and
55 * the address space flags too. The PCI version uses a BAR number
56 * instead of an absolute index
57 */
58extern const u32 *of_get_address(struct device_node *dev, int index,
59 u64 *size, unsigned int *flags);
60#ifdef CONFIG_PCI 47#ifdef CONFIG_PCI
61extern const u32 *of_get_pci_address(struct device_node *dev, int bar_no, 48extern unsigned long pci_address_to_pio(phys_addr_t address);
62 u64 *size, unsigned int *flags); 49#define pci_address_to_pio pci_address_to_pio
63#else 50#endif /* CONFIG_PCI */
64static inline const u32 *of_get_pci_address(struct device_node *dev,
65 int bar_no, u64 *size, unsigned int *flags)
66{
67 return NULL;
68}
69#endif /* CONFIG_PCI */
70
71/* Get an address as a resource. Note that if your address is
72 * a PIO address, the conversion will fail if the physical address
73 * can't be internally converted to an IO token with
74 * pci_address_to_pio(), that is because it's either called to early
75 * or it can't be matched to any host bridge IO space
76 */
77extern int of_address_to_resource(struct device_node *dev, int index,
78 struct resource *r);
79#ifdef CONFIG_PCI
80extern int of_pci_address_to_resource(struct device_node *dev, int bar,
81 struct resource *r);
82#else
83static inline int of_pci_address_to_resource(struct device_node *dev, int bar,
84 struct resource *r)
85{
86 return -ENOSYS;
87}
88#endif /* CONFIG_PCI */
89 51
90/* Parse the ibm,dma-window property of an OF node into the busno, phys and 52/* Parse the ibm,dma-window property of an OF node into the busno, phys and
91 * size parameters. 53 * size parameters.
@@ -104,69 +66,12 @@ struct device_node *of_find_next_cache_node(struct device_node *np);
104/* Get the MAC address */ 66/* Get the MAC address */
105extern const void *of_get_mac_address(struct device_node *np); 67extern const void *of_get_mac_address(struct device_node *np);
106 68
107/* 69#ifdef CONFIG_NUMA
108 * OF interrupt mapping 70extern int of_node_to_nid(struct device_node *device);
109 */ 71#else
110 72static inline int of_node_to_nid(struct device_node *device) { return 0; }
111/* This structure is returned when an interrupt is mapped. The controller 73#endif
112 * field needs to be put() after use 74#define of_node_to_nid of_node_to_nid
113 */
114
115#define OF_MAX_IRQ_SPEC 4 /* We handle specifiers of at most 4 cells */
116
117struct of_irq {
118 struct device_node *controller; /* Interrupt controller node */
119 u32 size; /* Specifier size */
120 u32 specifier[OF_MAX_IRQ_SPEC]; /* Specifier copy */
121};
122
123/**
124 * of_irq_map_init - Initialize the irq remapper
125 * @flags: flags defining workarounds to enable
126 *
127 * Some machines have bugs in the device-tree which require certain workarounds
128 * to be applied. Call this before any interrupt mapping attempts to enable
129 * those workarounds.
130 */
131#define OF_IMAP_OLDWORLD_MAC 0x00000001
132#define OF_IMAP_NO_PHANDLE 0x00000002
133
134extern void of_irq_map_init(unsigned int flags);
135
136/**
137 * of_irq_map_raw - Low level interrupt tree parsing
138 * @parent: the device interrupt parent
139 * @intspec: interrupt specifier ("interrupts" property of the device)
140 * @ointsize: size of the passed in interrupt specifier
141 * @addr: address specifier (start of "reg" property of the device)
142 * @out_irq: structure of_irq filled by this function
143 *
144 * Returns 0 on success and a negative number on error
145 *
146 * This function is a low-level interrupt tree walking function. It
147 * can be used to do a partial walk with synthetized reg and interrupts
148 * properties, for example when resolving PCI interrupts when no device
149 * node exist for the parent.
150 *
151 */
152
153extern int of_irq_map_raw(struct device_node *parent, const u32 *intspec,
154 u32 ointsize, const u32 *addr,
155 struct of_irq *out_irq);
156
157
158/**
159 * of_irq_map_one - Resolve an interrupt for a device
160 * @device: the device whose interrupt is to be resolved
161 * @index: index of the interrupt to resolve
162 * @out_irq: structure of_irq filled by this function
163 *
164 * This function resolves an interrupt, walking the tree, for a given
165 * device-tree node. It's the high level pendant to of_irq_map_raw().
166 * It also implements the workarounds for OldWolrd Macs.
167 */
168extern int of_irq_map_one(struct device_node *device, int index,
169 struct of_irq *out_irq);
170 75
171/** 76/**
172 * of_irq_map_pci - Resolve the interrupt for a PCI device 77 * of_irq_map_pci - Resolve the interrupt for a PCI device
@@ -180,19 +85,19 @@ extern int of_irq_map_one(struct device_node *device, int index,
180 * resolving using the OF tree walking. 85 * resolving using the OF tree walking.
181 */ 86 */
182struct pci_dev; 87struct pci_dev;
88struct of_irq;
183extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq); 89extern int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq);
184 90
185extern int of_irq_to_resource(struct device_node *dev, int index, 91extern void of_instantiate_rtc(void);
186 struct resource *r);
187 92
188/** 93/* These includes are put at the bottom because they may contain things
189 * of_iomap - Maps the memory mapped IO for a given device_node 94 * that are overridden by this file. Ideally they shouldn't be included
190 * @device: the device whose io range will be mapped 95 * by this file, but there are a bunch of .c files that currently depend
191 * @index: index of the io range 96 * on it. Eventually they will be cleaned up. */
192 * 97#include <linux/of_fdt.h>
193 * Returns a pointer to the mapped memory 98#include <linux/of_address.h>
194 */ 99#include <linux/of_irq.h>
195extern void __iomem *of_iomap(struct device_node *device, int index); 100#include <linux/platform_device.h>
196 101
197#endif /* __KERNEL__ */ 102#endif /* __KERNEL__ */
198#endif /* _POWERPC_PROM_H */ 103#endif /* _POWERPC_PROM_H */
diff --git a/arch/powerpc/include/asm/reg.h b/arch/powerpc/include/asm/reg.h
index d62fdf4e504b..d8be016d2ede 100644
--- a/arch/powerpc/include/asm/reg.h
+++ b/arch/powerpc/include/asm/reg.h
@@ -890,7 +890,7 @@
890#ifndef __ASSEMBLY__ 890#ifndef __ASSEMBLY__
891#define mfmsr() ({unsigned long rval; \ 891#define mfmsr() ({unsigned long rval; \
892 asm volatile("mfmsr %0" : "=r" (rval)); rval;}) 892 asm volatile("mfmsr %0" : "=r" (rval)); rval;})
893#ifdef CONFIG_PPC64 893#ifdef CONFIG_PPC_BOOK3S_64
894#define __mtmsrd(v, l) asm volatile("mtmsrd %0," __stringify(l) \ 894#define __mtmsrd(v, l) asm volatile("mtmsrd %0," __stringify(l) \
895 : : "r" (v) : "memory") 895 : : "r" (v) : "memory")
896#define mtmsrd(v) __mtmsrd((v), 0) 896#define mtmsrd(v) __mtmsrd((v), 0)
diff --git a/arch/powerpc/include/asm/reg_booke.h b/arch/powerpc/include/asm/reg_booke.h
index 2360317179a9..667a498eaee1 100644
--- a/arch/powerpc/include/asm/reg_booke.h
+++ b/arch/powerpc/include/asm/reg_booke.h
@@ -29,8 +29,8 @@
29#if defined(CONFIG_PPC_BOOK3E_64) 29#if defined(CONFIG_PPC_BOOK3E_64)
30#define MSR_ MSR_ME | MSR_CE 30#define MSR_ MSR_ME | MSR_CE
31#define MSR_KERNEL MSR_ | MSR_CM 31#define MSR_KERNEL MSR_ | MSR_CM
32#define MSR_USER32 MSR_ | MSR_PR | MSR_EE 32#define MSR_USER32 MSR_ | MSR_PR | MSR_EE | MSR_DE
33#define MSR_USER64 MSR_USER32 | MSR_CM 33#define MSR_USER64 MSR_USER32 | MSR_CM | MSR_DE
34#elif defined (CONFIG_40x) 34#elif defined (CONFIG_40x)
35#define MSR_KERNEL (MSR_ME|MSR_RI|MSR_IR|MSR_DR|MSR_CE) 35#define MSR_KERNEL (MSR_ME|MSR_RI|MSR_IR|MSR_DR|MSR_CE)
36#define MSR_USER (MSR_KERNEL|MSR_PR|MSR_EE) 36#define MSR_USER (MSR_KERNEL|MSR_PR|MSR_EE)
@@ -62,6 +62,7 @@
62#define SPRN_TLB0PS 0x158 /* TLB 0 Page Size Register */ 62#define SPRN_TLB0PS 0x158 /* TLB 0 Page Size Register */
63#define SPRN_MAS5_MAS6 0x15c /* MMU Assist Register 5 || 6 */ 63#define SPRN_MAS5_MAS6 0x15c /* MMU Assist Register 5 || 6 */
64#define SPRN_MAS8_MAS1 0x15d /* MMU Assist Register 8 || 1 */ 64#define SPRN_MAS8_MAS1 0x15d /* MMU Assist Register 8 || 1 */
65#define SPRN_EPTCFG 0x15e /* Embedded Page Table Config */
65#define SPRN_MAS7_MAS3 0x174 /* MMU Assist Register 7 || 3 */ 66#define SPRN_MAS7_MAS3 0x174 /* MMU Assist Register 7 || 3 */
66#define SPRN_MAS0_MAS1 0x175 /* MMU Assist Register 0 || 1 */ 67#define SPRN_MAS0_MAS1 0x175 /* MMU Assist Register 0 || 1 */
67#define SPRN_IVOR0 0x190 /* Interrupt Vector Offset Register 0 */ 68#define SPRN_IVOR0 0x190 /* Interrupt Vector Offset Register 0 */
diff --git a/arch/powerpc/include/asm/rtas.h b/arch/powerpc/include/asm/rtas.h
index 20de73c36682..3d35f8ae377e 100644
--- a/arch/powerpc/include/asm/rtas.h
+++ b/arch/powerpc/include/asm/rtas.h
@@ -63,6 +63,14 @@ struct rtas_t {
63 struct device_node *dev; /* virtual address pointer */ 63 struct device_node *dev; /* virtual address pointer */
64}; 64};
65 65
66struct rtas_suspend_me_data {
67 atomic_t working; /* number of cpus accessing this struct */
68 atomic_t done;
69 int token; /* ibm,suspend-me */
70 atomic_t error;
71 struct completion *complete; /* wait on this until working == 0 */
72};
73
66/* RTAS event classes */ 74/* RTAS event classes */
67#define RTAS_INTERNAL_ERROR 0x80000000 /* set bit 0 */ 75#define RTAS_INTERNAL_ERROR 0x80000000 /* set bit 0 */
68#define RTAS_EPOW_WARNING 0x40000000 /* set bit 1 */ 76#define RTAS_EPOW_WARNING 0x40000000 /* set bit 1 */
@@ -137,6 +145,9 @@ struct rtas_t {
137#define RTAS_TYPE_PMGM_CONFIG_CHANGE 0x70 145#define RTAS_TYPE_PMGM_CONFIG_CHANGE 0x70
138#define RTAS_TYPE_PMGM_SERVICE_PROC 0x71 146#define RTAS_TYPE_PMGM_SERVICE_PROC 0x71
139 147
148/* RTAS check-exception vector offset */
149#define RTAS_VECTOR_EXTERNAL_INTERRUPT 0x500
150
140struct rtas_error_log { 151struct rtas_error_log {
141 unsigned long version:8; /* Architectural version */ 152 unsigned long version:8; /* Architectural version */
142 unsigned long severity:3; /* Severity level of error */ 153 unsigned long severity:3; /* Severity level of error */
@@ -174,6 +185,8 @@ extern int rtas_set_indicator(int indicator, int index, int new_value);
174extern int rtas_set_indicator_fast(int indicator, int index, int new_value); 185extern int rtas_set_indicator_fast(int indicator, int index, int new_value);
175extern void rtas_progress(char *s, unsigned short hex); 186extern void rtas_progress(char *s, unsigned short hex);
176extern void rtas_initialize(void); 187extern void rtas_initialize(void);
188extern int rtas_suspend_cpu(struct rtas_suspend_me_data *data);
189extern int rtas_suspend_last_cpu(struct rtas_suspend_me_data *data);
177 190
178struct rtc_time; 191struct rtc_time;
179extern unsigned long rtas_get_boot_time(void); 192extern unsigned long rtas_get_boot_time(void);
diff --git a/arch/powerpc/include/asm/smu.h b/arch/powerpc/include/asm/smu.h
index 7ae2753da565..e3bdada8c542 100644
--- a/arch/powerpc/include/asm/smu.h
+++ b/arch/powerpc/include/asm/smu.h
@@ -457,8 +457,8 @@ extern void smu_poll(void);
457 */ 457 */
458extern int smu_init(void); 458extern int smu_init(void);
459extern int smu_present(void); 459extern int smu_present(void);
460struct of_device; 460struct platform_device;
461extern struct of_device *smu_get_ofdev(void); 461extern struct platform_device *smu_get_ofdev(void);
462 462
463 463
464/* 464/*
diff --git a/arch/powerpc/include/asm/system.h b/arch/powerpc/include/asm/system.h
index a6297c67c3d6..6c294acac848 100644
--- a/arch/powerpc/include/asm/system.h
+++ b/arch/powerpc/include/asm/system.h
@@ -515,11 +515,8 @@ __cmpxchg_local(volatile void *ptr, unsigned long old, unsigned long new,
515 * powers of 2 writes until it reaches sufficient alignment). 515 * powers of 2 writes until it reaches sufficient alignment).
516 * 516 *
517 * Based on this we disable the IP header alignment in network drivers. 517 * Based on this we disable the IP header alignment in network drivers.
518 * We also modify NET_SKB_PAD to be a cacheline in size, thus maintaining
519 * cacheline alignment of buffers.
520 */ 518 */
521#define NET_IP_ALIGN 0 519#define NET_IP_ALIGN 0
522#define NET_SKB_PAD L1_CACHE_BYTES
523 520
524#define cmpxchg64(ptr, o, n) \ 521#define cmpxchg64(ptr, o, n) \
525 ({ \ 522 ({ \
diff --git a/arch/powerpc/include/asm/time.h b/arch/powerpc/include/asm/time.h
index 27ccb764fdab..dc779dfcf258 100644
--- a/arch/powerpc/include/asm/time.h
+++ b/arch/powerpc/include/asm/time.h
@@ -28,16 +28,12 @@
28extern unsigned long tb_ticks_per_jiffy; 28extern unsigned long tb_ticks_per_jiffy;
29extern unsigned long tb_ticks_per_usec; 29extern unsigned long tb_ticks_per_usec;
30extern unsigned long tb_ticks_per_sec; 30extern unsigned long tb_ticks_per_sec;
31extern u64 tb_to_xs;
32extern unsigned tb_to_us;
33 31
34struct rtc_time; 32struct rtc_time;
35extern void to_tm(int tim, struct rtc_time * tm); 33extern void to_tm(int tim, struct rtc_time * tm);
36extern void GregorianDay(struct rtc_time *tm); 34extern void GregorianDay(struct rtc_time *tm);
37extern time_t last_rtc_update;
38 35
39extern void generic_calibrate_decr(void); 36extern void generic_calibrate_decr(void);
40extern void wakeup_decrementer(void);
41extern void snapshot_timebase(void); 37extern void snapshot_timebase(void);
42 38
43extern void set_dec_cpu6(unsigned int val); 39extern void set_dec_cpu6(unsigned int val);
@@ -204,9 +200,6 @@ static inline unsigned long tb_ticks_since(unsigned long tstamp)
204extern u64 mulhdu(u64, u64); 200extern u64 mulhdu(u64, u64);
205#endif 201#endif
206 202
207extern void smp_space_timers(unsigned int);
208
209extern unsigned mulhwu_scale_factor(unsigned, unsigned);
210extern void div128_by_32(u64 dividend_high, u64 dividend_low, 203extern void div128_by_32(u64 dividend_high, u64 dividend_low,
211 unsigned divisor, struct div_result *dr); 204 unsigned divisor, struct div_result *dr);
212 205
diff --git a/arch/powerpc/include/asm/topology.h b/arch/powerpc/include/asm/topology.h
index 32adf7280720..afe4aaa65c3b 100644
--- a/arch/powerpc/include/asm/topology.h
+++ b/arch/powerpc/include/asm/topology.h
@@ -41,8 +41,6 @@ static inline int cpu_to_node(int cpu)
41 cpu_all_mask : \ 41 cpu_all_mask : \
42 node_to_cpumask_map[node]) 42 node_to_cpumask_map[node])
43 43
44int of_node_to_nid(struct device_node *device);
45
46struct pci_bus; 44struct pci_bus;
47#ifdef CONFIG_PCI 45#ifdef CONFIG_PCI
48extern int pcibus_to_node(struct pci_bus *bus); 46extern int pcibus_to_node(struct pci_bus *bus);
@@ -87,6 +85,9 @@ static inline int pcibus_to_node(struct pci_bus *bus)
87 .balance_interval = 1, \ 85 .balance_interval = 1, \
88} 86}
89 87
88extern int __node_distance(int, int);
89#define node_distance(a, b) __node_distance(a, b)
90
90extern void __init dump_numa_cpu_topology(void); 91extern void __init dump_numa_cpu_topology(void);
91 92
92extern int sysfs_add_device_to_node(struct sys_device *dev, int nid); 93extern int sysfs_add_device_to_node(struct sys_device *dev, int nid);
@@ -94,11 +95,6 @@ extern void sysfs_remove_device_from_node(struct sys_device *dev, int nid);
94 95
95#else 96#else
96 97
97static inline int of_node_to_nid(struct device_node *device)
98{
99 return 0;
100}
101
102static inline void dump_numa_cpu_topology(void) {} 98static inline void dump_numa_cpu_topology(void) {}
103 99
104static inline int sysfs_add_device_to_node(struct sys_device *dev, int nid) 100static inline int sysfs_add_device_to_node(struct sys_device *dev, int nid)
diff --git a/arch/powerpc/include/asm/vdso_datapage.h b/arch/powerpc/include/asm/vdso_datapage.h
index 13c2c283e178..08679c5319b8 100644
--- a/arch/powerpc/include/asm/vdso_datapage.h
+++ b/arch/powerpc/include/asm/vdso_datapage.h
@@ -85,6 +85,7 @@ struct vdso_data {
85 __s32 wtom_clock_sec; /* Wall to monotonic clock */ 85 __s32 wtom_clock_sec; /* Wall to monotonic clock */
86 __s32 wtom_clock_nsec; 86 __s32 wtom_clock_nsec;
87 struct timespec stamp_xtime; /* xtime as at tb_orig_stamp */ 87 struct timespec stamp_xtime; /* xtime as at tb_orig_stamp */
88 __u32 stamp_sec_fraction; /* fractional seconds of stamp_xtime */
88 __u32 syscall_map_64[SYSCALL_MAP_SIZE]; /* map of syscalls */ 89 __u32 syscall_map_64[SYSCALL_MAP_SIZE]; /* map of syscalls */
89 __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */ 90 __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */
90}; 91};
@@ -105,6 +106,7 @@ struct vdso_data {
105 __s32 wtom_clock_sec; /* Wall to monotonic clock */ 106 __s32 wtom_clock_sec; /* Wall to monotonic clock */
106 __s32 wtom_clock_nsec; 107 __s32 wtom_clock_nsec;
107 struct timespec stamp_xtime; /* xtime as at tb_orig_stamp */ 108 struct timespec stamp_xtime; /* xtime as at tb_orig_stamp */
109 __u32 stamp_sec_fraction; /* fractional seconds of stamp_xtime */
108 __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */ 110 __u32 syscall_map_32[SYSCALL_MAP_SIZE]; /* map of syscalls */
109 __u32 dcache_block_size; /* L1 d-cache block size */ 111 __u32 dcache_block_size; /* L1 d-cache block size */
110 __u32 icache_block_size; /* L1 i-cache block size */ 112 __u32 icache_block_size; /* L1 i-cache block size */
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 58d0572de6f9..1dda70129141 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -34,13 +34,14 @@ obj-y += vdso32/
34obj-$(CONFIG_PPC64) += setup_64.o sys_ppc32.o \ 34obj-$(CONFIG_PPC64) += setup_64.o sys_ppc32.o \
35 signal_64.o ptrace32.o \ 35 signal_64.o ptrace32.o \
36 paca.o nvram_64.o firmware.o 36 paca.o nvram_64.o firmware.o
37obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
37obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_ppc970.o cpu_setup_pa6t.o 38obj-$(CONFIG_PPC_BOOK3S_64) += cpu_setup_ppc970.o cpu_setup_pa6t.o
38obj64-$(CONFIG_RELOCATABLE) += reloc_64.o 39obj64-$(CONFIG_RELOCATABLE) += reloc_64.o
39obj-$(CONFIG_PPC_BOOK3E_64) += exceptions-64e.o 40obj-$(CONFIG_PPC_BOOK3E_64) += exceptions-64e.o idle_book3e.o
40obj-$(CONFIG_PPC64) += vdso64/ 41obj-$(CONFIG_PPC64) += vdso64/
41obj-$(CONFIG_ALTIVEC) += vecemu.o 42obj-$(CONFIG_ALTIVEC) += vecemu.o
42obj-$(CONFIG_PPC_970_NAP) += idle_power4.o 43obj-$(CONFIG_PPC_970_NAP) += idle_power4.o
43obj-$(CONFIG_PPC_OF) += of_device.o of_platform.o prom_parse.o 44obj-$(CONFIG_PPC_OF) += of_platform.o prom_parse.o
44obj-$(CONFIG_PPC_CLOCK) += clock.o 45obj-$(CONFIG_PPC_CLOCK) += clock.o
45procfs-y := proc_powerpc.o 46procfs-y := proc_powerpc.o
46obj-$(CONFIG_PROC_FS) += $(procfs-y) 47obj-$(CONFIG_PROC_FS) += $(procfs-y)
@@ -67,6 +68,7 @@ obj64-$(CONFIG_HIBERNATION) += swsusp_asm64.o
67obj-$(CONFIG_MODULES) += module.o module_$(CONFIG_WORD_SIZE).o 68obj-$(CONFIG_MODULES) += module.o module_$(CONFIG_WORD_SIZE).o
68obj-$(CONFIG_44x) += cpu_setup_44x.o 69obj-$(CONFIG_44x) += cpu_setup_44x.o
69obj-$(CONFIG_FSL_BOOKE) += cpu_setup_fsl_booke.o dbell.o 70obj-$(CONFIG_FSL_BOOKE) += cpu_setup_fsl_booke.o dbell.o
71obj-$(CONFIG_PPC_BOOK3E_64) += dbell.o
70 72
71extra-y := head_$(CONFIG_WORD_SIZE).o 73extra-y := head_$(CONFIG_WORD_SIZE).o
72extra-$(CONFIG_PPC_BOOK3E_32) := head_new_booke.o 74extra-$(CONFIG_PPC_BOOK3E_32) := head_new_booke.o
diff --git a/arch/powerpc/kernel/asm-offsets.c b/arch/powerpc/kernel/asm-offsets.c
index 496cc5b3984f..1c0607ddccc0 100644
--- a/arch/powerpc/kernel/asm-offsets.c
+++ b/arch/powerpc/kernel/asm-offsets.c
@@ -194,7 +194,6 @@ int main(void)
194 DEFINE(PACA_STARTSPURR, offsetof(struct paca_struct, startspurr)); 194 DEFINE(PACA_STARTSPURR, offsetof(struct paca_struct, startspurr));
195 DEFINE(PACA_USER_TIME, offsetof(struct paca_struct, user_time)); 195 DEFINE(PACA_USER_TIME, offsetof(struct paca_struct, user_time));
196 DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time)); 196 DEFINE(PACA_SYSTEM_TIME, offsetof(struct paca_struct, system_time));
197 DEFINE(PACA_DATA_OFFSET, offsetof(struct paca_struct, data_offset));
198 DEFINE(PACA_TRAP_SAVE, offsetof(struct paca_struct, trap_save)); 197 DEFINE(PACA_TRAP_SAVE, offsetof(struct paca_struct, trap_save));
199#ifdef CONFIG_KVM_BOOK3S_64_HANDLER 198#ifdef CONFIG_KVM_BOOK3S_64_HANDLER
200 DEFINE(PACA_KVM_SVCPU, offsetof(struct paca_struct, shadow_vcpu)); 199 DEFINE(PACA_KVM_SVCPU, offsetof(struct paca_struct, shadow_vcpu));
@@ -342,6 +341,7 @@ int main(void)
342 DEFINE(WTOM_CLOCK_SEC, offsetof(struct vdso_data, wtom_clock_sec)); 341 DEFINE(WTOM_CLOCK_SEC, offsetof(struct vdso_data, wtom_clock_sec));
343 DEFINE(WTOM_CLOCK_NSEC, offsetof(struct vdso_data, wtom_clock_nsec)); 342 DEFINE(WTOM_CLOCK_NSEC, offsetof(struct vdso_data, wtom_clock_nsec));
344 DEFINE(STAMP_XTIME, offsetof(struct vdso_data, stamp_xtime)); 343 DEFINE(STAMP_XTIME, offsetof(struct vdso_data, stamp_xtime));
344 DEFINE(STAMP_SEC_FRAC, offsetof(struct vdso_data, stamp_sec_fraction));
345 DEFINE(CFG_ICACHE_BLOCKSZ, offsetof(struct vdso_data, icache_block_size)); 345 DEFINE(CFG_ICACHE_BLOCKSZ, offsetof(struct vdso_data, icache_block_size));
346 DEFINE(CFG_DCACHE_BLOCKSZ, offsetof(struct vdso_data, dcache_block_size)); 346 DEFINE(CFG_DCACHE_BLOCKSZ, offsetof(struct vdso_data, dcache_block_size));
347 DEFINE(CFG_ICACHE_LOGBLOCKSZ, offsetof(struct vdso_data, icache_log_block_size)); 347 DEFINE(CFG_ICACHE_LOGBLOCKSZ, offsetof(struct vdso_data, icache_log_block_size));
diff --git a/arch/powerpc/kernel/cputable.c b/arch/powerpc/kernel/cputable.c
index 87aa0f3c6047..65e2b4e10f97 100644
--- a/arch/powerpc/kernel/cputable.c
+++ b/arch/powerpc/kernel/cputable.c
@@ -1364,10 +1364,10 @@ static struct cpu_spec __initdata cpu_specs[] = {
1364 .machine_check = machine_check_4xx, 1364 .machine_check = machine_check_4xx,
1365 .platform = "ppc405", 1365 .platform = "ppc405",
1366 }, 1366 },
1367 { /* 405EX */ 1367 { /* 405EX Rev. A/B with Security */
1368 .pvr_mask = 0xffff0004, 1368 .pvr_mask = 0xffff000f,
1369 .pvr_value = 0x12910004, 1369 .pvr_value = 0x12910007,
1370 .cpu_name = "405EX", 1370 .cpu_name = "405EX Rev. A/B",
1371 .cpu_features = CPU_FTRS_40X, 1371 .cpu_features = CPU_FTRS_40X,
1372 .cpu_user_features = PPC_FEATURE_32 | 1372 .cpu_user_features = PPC_FEATURE_32 |
1373 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 1373 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
@@ -1377,10 +1377,114 @@ static struct cpu_spec __initdata cpu_specs[] = {
1377 .machine_check = machine_check_4xx, 1377 .machine_check = machine_check_4xx,
1378 .platform = "ppc405", 1378 .platform = "ppc405",
1379 }, 1379 },
1380 { /* 405EXr */ 1380 { /* 405EX Rev. C without Security */
1381 .pvr_mask = 0xffff0004, 1381 .pvr_mask = 0xffff000f,
1382 .pvr_value = 0x1291000d,
1383 .cpu_name = "405EX Rev. C",
1384 .cpu_features = CPU_FTRS_40X,
1385 .cpu_user_features = PPC_FEATURE_32 |
1386 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1387 .mmu_features = MMU_FTR_TYPE_40x,
1388 .icache_bsize = 32,
1389 .dcache_bsize = 32,
1390 .machine_check = machine_check_4xx,
1391 .platform = "ppc405",
1392 },
1393 { /* 405EX Rev. C with Security */
1394 .pvr_mask = 0xffff000f,
1395 .pvr_value = 0x1291000f,
1396 .cpu_name = "405EX Rev. C",
1397 .cpu_features = CPU_FTRS_40X,
1398 .cpu_user_features = PPC_FEATURE_32 |
1399 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1400 .mmu_features = MMU_FTR_TYPE_40x,
1401 .icache_bsize = 32,
1402 .dcache_bsize = 32,
1403 .machine_check = machine_check_4xx,
1404 .platform = "ppc405",
1405 },
1406 { /* 405EX Rev. D without Security */
1407 .pvr_mask = 0xffff000f,
1408 .pvr_value = 0x12910003,
1409 .cpu_name = "405EX Rev. D",
1410 .cpu_features = CPU_FTRS_40X,
1411 .cpu_user_features = PPC_FEATURE_32 |
1412 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1413 .mmu_features = MMU_FTR_TYPE_40x,
1414 .icache_bsize = 32,
1415 .dcache_bsize = 32,
1416 .machine_check = machine_check_4xx,
1417 .platform = "ppc405",
1418 },
1419 { /* 405EX Rev. D with Security */
1420 .pvr_mask = 0xffff000f,
1421 .pvr_value = 0x12910005,
1422 .cpu_name = "405EX Rev. D",
1423 .cpu_features = CPU_FTRS_40X,
1424 .cpu_user_features = PPC_FEATURE_32 |
1425 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1426 .mmu_features = MMU_FTR_TYPE_40x,
1427 .icache_bsize = 32,
1428 .dcache_bsize = 32,
1429 .machine_check = machine_check_4xx,
1430 .platform = "ppc405",
1431 },
1432 { /* 405EXr Rev. A/B without Security */
1433 .pvr_mask = 0xffff000f,
1434 .pvr_value = 0x12910001,
1435 .cpu_name = "405EXr Rev. A/B",
1436 .cpu_features = CPU_FTRS_40X,
1437 .cpu_user_features = PPC_FEATURE_32 |
1438 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1439 .mmu_features = MMU_FTR_TYPE_40x,
1440 .icache_bsize = 32,
1441 .dcache_bsize = 32,
1442 .machine_check = machine_check_4xx,
1443 .platform = "ppc405",
1444 },
1445 { /* 405EXr Rev. C without Security */
1446 .pvr_mask = 0xffff000f,
1447 .pvr_value = 0x12910009,
1448 .cpu_name = "405EXr Rev. C",
1449 .cpu_features = CPU_FTRS_40X,
1450 .cpu_user_features = PPC_FEATURE_32 |
1451 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1452 .mmu_features = MMU_FTR_TYPE_40x,
1453 .icache_bsize = 32,
1454 .dcache_bsize = 32,
1455 .machine_check = machine_check_4xx,
1456 .platform = "ppc405",
1457 },
1458 { /* 405EXr Rev. C with Security */
1459 .pvr_mask = 0xffff000f,
1460 .pvr_value = 0x1291000b,
1461 .cpu_name = "405EXr Rev. C",
1462 .cpu_features = CPU_FTRS_40X,
1463 .cpu_user_features = PPC_FEATURE_32 |
1464 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1465 .mmu_features = MMU_FTR_TYPE_40x,
1466 .icache_bsize = 32,
1467 .dcache_bsize = 32,
1468 .machine_check = machine_check_4xx,
1469 .platform = "ppc405",
1470 },
1471 { /* 405EXr Rev. D without Security */
1472 .pvr_mask = 0xffff000f,
1382 .pvr_value = 0x12910000, 1473 .pvr_value = 0x12910000,
1383 .cpu_name = "405EXr", 1474 .cpu_name = "405EXr Rev. D",
1475 .cpu_features = CPU_FTRS_40X,
1476 .cpu_user_features = PPC_FEATURE_32 |
1477 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
1478 .mmu_features = MMU_FTR_TYPE_40x,
1479 .icache_bsize = 32,
1480 .dcache_bsize = 32,
1481 .machine_check = machine_check_4xx,
1482 .platform = "ppc405",
1483 },
1484 { /* 405EXr Rev. D with Security */
1485 .pvr_mask = 0xffff000f,
1486 .pvr_value = 0x12910002,
1487 .cpu_name = "405EXr Rev. D",
1384 .cpu_features = CPU_FTRS_40X, 1488 .cpu_features = CPU_FTRS_40X,
1385 .cpu_user_features = PPC_FEATURE_32 | 1489 .cpu_user_features = PPC_FEATURE_32 |
1386 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC, 1490 PPC_FEATURE_HAS_MMU | PPC_FEATURE_HAS_4xxMAC,
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
index 40f524643ba6..8e05c16344e4 100644
--- a/arch/powerpc/kernel/crash_dump.c
+++ b/arch/powerpc/kernel/crash_dump.c
@@ -128,9 +128,9 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
128 if (!csize) 128 if (!csize)
129 return 0; 129 return 0;
130 130
131 csize = min(csize, PAGE_SIZE); 131 csize = min_t(size_t, csize, PAGE_SIZE);
132 132
133 if (pfn < max_pfn) { 133 if ((min_low_pfn < pfn) && (pfn < max_pfn)) {
134 vaddr = __va(pfn << PAGE_SHIFT); 134 vaddr = __va(pfn << PAGE_SHIFT);
135 csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf); 135 csize = copy_oldmem_vaddr(vaddr, buf, csize, offset, userbuf);
136 } else { 136 } else {
diff --git a/arch/powerpc/kernel/dbell.c b/arch/powerpc/kernel/dbell.c
index 1493734cd871..3307a52d797f 100644
--- a/arch/powerpc/kernel/dbell.c
+++ b/arch/powerpc/kernel/dbell.c
@@ -13,32 +13,88 @@
13#include <linux/kernel.h> 13#include <linux/kernel.h>
14#include <linux/smp.h> 14#include <linux/smp.h>
15#include <linux/threads.h> 15#include <linux/threads.h>
16#include <linux/percpu.h>
16 17
17#include <asm/dbell.h> 18#include <asm/dbell.h>
19#include <asm/irq_regs.h>
18 20
19#ifdef CONFIG_SMP 21#ifdef CONFIG_SMP
20unsigned long dbell_smp_message[NR_CPUS]; 22struct doorbell_cpu_info {
23 unsigned long messages; /* current messages bits */
24 unsigned int tag; /* tag value */
25};
21 26
22void smp_dbell_message_pass(int target, int msg) 27static DEFINE_PER_CPU(struct doorbell_cpu_info, doorbell_cpu_info);
28
29void doorbell_setup_this_cpu(void)
30{
31 struct doorbell_cpu_info *info = &__get_cpu_var(doorbell_cpu_info);
32
33 info->messages = 0;
34 info->tag = mfspr(SPRN_PIR) & 0x3fff;
35}
36
37void doorbell_message_pass(int target, int msg)
23{ 38{
39 struct doorbell_cpu_info *info;
24 int i; 40 int i;
25 41
26 if(target < NR_CPUS) { 42 if (target < NR_CPUS) {
27 set_bit(msg, &dbell_smp_message[target]); 43 info = &per_cpu(doorbell_cpu_info, target);
28 ppc_msgsnd(PPC_DBELL, 0, target); 44 set_bit(msg, &info->messages);
45 ppc_msgsnd(PPC_DBELL, 0, info->tag);
29 } 46 }
30 else if(target == MSG_ALL_BUT_SELF) { 47 else if (target == MSG_ALL_BUT_SELF) {
31 for_each_online_cpu(i) { 48 for_each_online_cpu(i) {
32 if (i == smp_processor_id()) 49 if (i == smp_processor_id())
33 continue; 50 continue;
34 set_bit(msg, &dbell_smp_message[i]); 51 info = &per_cpu(doorbell_cpu_info, i);
35 ppc_msgsnd(PPC_DBELL, 0, i); 52 set_bit(msg, &info->messages);
53 ppc_msgsnd(PPC_DBELL, 0, info->tag);
36 } 54 }
37 } 55 }
38 else { /* target == MSG_ALL */ 56 else { /* target == MSG_ALL */
39 for_each_online_cpu(i) 57 for_each_online_cpu(i) {
40 set_bit(msg, &dbell_smp_message[i]); 58 info = &per_cpu(doorbell_cpu_info, i);
59 set_bit(msg, &info->messages);
60 }
41 ppc_msgsnd(PPC_DBELL, PPC_DBELL_MSG_BRDCAST, 0); 61 ppc_msgsnd(PPC_DBELL, PPC_DBELL_MSG_BRDCAST, 0);
42 } 62 }
43} 63}
44#endif 64
65void doorbell_exception(struct pt_regs *regs)
66{
67 struct pt_regs *old_regs = set_irq_regs(regs);
68 struct doorbell_cpu_info *info = &__get_cpu_var(doorbell_cpu_info);
69 int msg;
70
71 /* Warning: regs can be NULL when called from irq enable */
72
73 if (!info->messages || (num_online_cpus() < 2))
74 goto out;
75
76 for (msg = 0; msg < 4; msg++)
77 if (test_and_clear_bit(msg, &info->messages))
78 smp_message_recv(msg);
79
80out:
81 set_irq_regs(old_regs);
82}
83
84void doorbell_check_self(void)
85{
86 struct doorbell_cpu_info *info = &__get_cpu_var(doorbell_cpu_info);
87
88 if (!info->messages)
89 return;
90
91 ppc_msgsnd(PPC_DBELL, 0, info->tag);
92}
93
94#else /* CONFIG_SMP */
95void doorbell_exception(struct pt_regs *regs)
96{
97 printk(KERN_WARNING "Received doorbell on non-smp system\n");
98}
99#endif /* CONFIG_SMP */
100
diff --git a/arch/powerpc/kernel/dma-swiotlb.c b/arch/powerpc/kernel/dma-swiotlb.c
index 02f724f36753..4295e0b94b2d 100644
--- a/arch/powerpc/kernel/dma-swiotlb.c
+++ b/arch/powerpc/kernel/dma-swiotlb.c
@@ -82,17 +82,9 @@ static struct notifier_block ppc_swiotlb_plat_bus_notifier = {
82 .priority = 0, 82 .priority = 0,
83}; 83};
84 84
85static struct notifier_block ppc_swiotlb_of_bus_notifier = {
86 .notifier_call = ppc_swiotlb_bus_notify,
87 .priority = 0,
88};
89
90int __init swiotlb_setup_bus_notifier(void) 85int __init swiotlb_setup_bus_notifier(void)
91{ 86{
92 bus_register_notifier(&platform_bus_type, 87 bus_register_notifier(&platform_bus_type,
93 &ppc_swiotlb_plat_bus_notifier); 88 &ppc_swiotlb_plat_bus_notifier);
94 bus_register_notifier(&of_platform_bus_type,
95 &ppc_swiotlb_of_bus_notifier);
96
97 return 0; 89 return 0;
98} 90}
diff --git a/arch/powerpc/kernel/exceptions-64e.S b/arch/powerpc/kernel/exceptions-64e.S
index 24dcc0ecf246..5c43063d2506 100644
--- a/arch/powerpc/kernel/exceptions-64e.S
+++ b/arch/powerpc/kernel/exceptions-64e.S
@@ -191,6 +191,12 @@ exc_##n##_bad_stack: \
191 sth r1,PACA_TRAP_SAVE(r13); /* store trap */ \ 191 sth r1,PACA_TRAP_SAVE(r13); /* store trap */ \
192 b bad_stack_book3e; /* bad stack error */ 192 b bad_stack_book3e; /* bad stack error */
193 193
194/* WARNING: If you change the layout of this stub, make sure you chcek
195 * the debug exception handler which handles single stepping
196 * into exceptions from userspace, and the MM code in
197 * arch/powerpc/mm/tlb_nohash.c which patches the branch here
198 * and would need to be updated if that branch is moved
199 */
194#define EXCEPTION_STUB(loc, label) \ 200#define EXCEPTION_STUB(loc, label) \
195 . = interrupt_base_book3e + loc; \ 201 . = interrupt_base_book3e + loc; \
196 nop; /* To make debug interrupts happy */ \ 202 nop; /* To make debug interrupts happy */ \
@@ -204,11 +210,30 @@ exc_##n##_bad_stack: \
204 lis r,TSR_FIS@h; \ 210 lis r,TSR_FIS@h; \
205 mtspr SPRN_TSR,r 211 mtspr SPRN_TSR,r
206 212
213/* Used by asynchronous interrupt that may happen in the idle loop.
214 *
215 * This check if the thread was in the idle loop, and if yes, returns
216 * to the caller rather than the PC. This is to avoid a race if
217 * interrupts happen before the wait instruction.
218 */
219#define CHECK_NAPPING() \
220 clrrdi r11,r1,THREAD_SHIFT; \
221 ld r10,TI_LOCAL_FLAGS(r11); \
222 andi. r9,r10,_TLF_NAPPING; \
223 beq+ 1f; \
224 ld r8,_LINK(r1); \
225 rlwinm r7,r10,0,~_TLF_NAPPING; \
226 std r8,_NIP(r1); \
227 std r7,TI_LOCAL_FLAGS(r11); \
2281:
229
230
207#define MASKABLE_EXCEPTION(trapnum, label, hdlr, ack) \ 231#define MASKABLE_EXCEPTION(trapnum, label, hdlr, ack) \
208 START_EXCEPTION(label); \ 232 START_EXCEPTION(label); \
209 NORMAL_EXCEPTION_PROLOG(trapnum, PROLOG_ADDITION_MASKABLE) \ 233 NORMAL_EXCEPTION_PROLOG(trapnum, PROLOG_ADDITION_MASKABLE) \
210 EXCEPTION_COMMON(trapnum, PACA_EXGEN, INTS_DISABLE_ALL) \ 234 EXCEPTION_COMMON(trapnum, PACA_EXGEN, INTS_DISABLE_ALL) \
211 ack(r8); \ 235 ack(r8); \
236 CHECK_NAPPING(); \
212 addi r3,r1,STACK_FRAME_OVERHEAD; \ 237 addi r3,r1,STACK_FRAME_OVERHEAD; \
213 bl hdlr; \ 238 bl hdlr; \
214 b .ret_from_except_lite; 239 b .ret_from_except_lite;
@@ -246,11 +271,9 @@ interrupt_base_book3e: /* fake trap */
246 EXCEPTION_STUB(0x1a0, watchdog) /* 0x09f0 */ 271 EXCEPTION_STUB(0x1a0, watchdog) /* 0x09f0 */
247 EXCEPTION_STUB(0x1c0, data_tlb_miss) 272 EXCEPTION_STUB(0x1c0, data_tlb_miss)
248 EXCEPTION_STUB(0x1e0, instruction_tlb_miss) 273 EXCEPTION_STUB(0x1e0, instruction_tlb_miss)
274 EXCEPTION_STUB(0x280, doorbell)
275 EXCEPTION_STUB(0x2a0, doorbell_crit)
249 276
250#if 0
251 EXCEPTION_STUB(0x280, processor_doorbell)
252 EXCEPTION_STUB(0x220, processor_doorbell_crit)
253#endif
254 .globl interrupt_end_book3e 277 .globl interrupt_end_book3e
255interrupt_end_book3e: 278interrupt_end_book3e:
256 279
@@ -259,6 +282,7 @@ interrupt_end_book3e:
259 CRIT_EXCEPTION_PROLOG(0x100, PROLOG_ADDITION_NONE) 282 CRIT_EXCEPTION_PROLOG(0x100, PROLOG_ADDITION_NONE)
260// EXCEPTION_COMMON(0x100, PACA_EXCRIT, INTS_DISABLE_ALL) 283// EXCEPTION_COMMON(0x100, PACA_EXCRIT, INTS_DISABLE_ALL)
261// bl special_reg_save_crit 284// bl special_reg_save_crit
285// CHECK_NAPPING();
262// addi r3,r1,STACK_FRAME_OVERHEAD 286// addi r3,r1,STACK_FRAME_OVERHEAD
263// bl .critical_exception 287// bl .critical_exception
264// b ret_from_crit_except 288// b ret_from_crit_except
@@ -270,6 +294,7 @@ interrupt_end_book3e:
270// EXCEPTION_COMMON(0x200, PACA_EXMC, INTS_DISABLE_ALL) 294// EXCEPTION_COMMON(0x200, PACA_EXMC, INTS_DISABLE_ALL)
271// bl special_reg_save_mc 295// bl special_reg_save_mc
272// addi r3,r1,STACK_FRAME_OVERHEAD 296// addi r3,r1,STACK_FRAME_OVERHEAD
297// CHECK_NAPPING();
273// bl .machine_check_exception 298// bl .machine_check_exception
274// b ret_from_mc_except 299// b ret_from_mc_except
275 b . 300 b .
@@ -340,6 +365,7 @@ interrupt_end_book3e:
340 CRIT_EXCEPTION_PROLOG(0x9f0, PROLOG_ADDITION_NONE) 365 CRIT_EXCEPTION_PROLOG(0x9f0, PROLOG_ADDITION_NONE)
341// EXCEPTION_COMMON(0x9f0, PACA_EXCRIT, INTS_DISABLE_ALL) 366// EXCEPTION_COMMON(0x9f0, PACA_EXCRIT, INTS_DISABLE_ALL)
342// bl special_reg_save_crit 367// bl special_reg_save_crit
368// CHECK_NAPPING();
343// addi r3,r1,STACK_FRAME_OVERHEAD 369// addi r3,r1,STACK_FRAME_OVERHEAD
344// bl .unknown_exception 370// bl .unknown_exception
345// b ret_from_crit_except 371// b ret_from_crit_except
@@ -428,6 +454,20 @@ interrupt_end_book3e:
428kernel_dbg_exc: 454kernel_dbg_exc:
429 b . /* NYI */ 455 b . /* NYI */
430 456
457/* Doorbell interrupt */
458 MASKABLE_EXCEPTION(0x2070, doorbell, .doorbell_exception, ACK_NONE)
459
460/* Doorbell critical Interrupt */
461 START_EXCEPTION(doorbell_crit);
462 CRIT_EXCEPTION_PROLOG(0x2080, PROLOG_ADDITION_NONE)
463// EXCEPTION_COMMON(0x2080, PACA_EXCRIT, INTS_DISABLE_ALL)
464// bl special_reg_save_crit
465// CHECK_NAPPING();
466// addi r3,r1,STACK_FRAME_OVERHEAD
467// bl .doorbell_critical_exception
468// b ret_from_crit_except
469 b .
470
431 471
432/* 472/*
433 * An interrupt came in while soft-disabled; clear EE in SRR1, 473 * An interrupt came in while soft-disabled; clear EE in SRR1,
@@ -563,6 +603,8 @@ BAD_STACK_TRAMPOLINE(0xd00)
563BAD_STACK_TRAMPOLINE(0xe00) 603BAD_STACK_TRAMPOLINE(0xe00)
564BAD_STACK_TRAMPOLINE(0xf00) 604BAD_STACK_TRAMPOLINE(0xf00)
565BAD_STACK_TRAMPOLINE(0xf20) 605BAD_STACK_TRAMPOLINE(0xf20)
606BAD_STACK_TRAMPOLINE(0x2070)
607BAD_STACK_TRAMPOLINE(0x2080)
566 608
567 .globl bad_stack_book3e 609 .globl bad_stack_book3e
568bad_stack_book3e: 610bad_stack_book3e:
diff --git a/arch/powerpc/kernel/exceptions-64s.S b/arch/powerpc/kernel/exceptions-64s.S
index 3e423fbad6bc..f53029a01554 100644
--- a/arch/powerpc/kernel/exceptions-64s.S
+++ b/arch/powerpc/kernel/exceptions-64s.S
@@ -828,6 +828,7 @@ END_FW_FTR_SECTION_IFCLR(FW_FEATURE_ISERIES)
828 828
829/* We have a data breakpoint exception - handle it */ 829/* We have a data breakpoint exception - handle it */
830handle_dabr_fault: 830handle_dabr_fault:
831 bl .save_nvgprs
831 ld r4,_DAR(r1) 832 ld r4,_DAR(r1)
832 ld r5,_DSISR(r1) 833 ld r5,_DSISR(r1)
833 addi r3,r1,STACK_FRAME_OVERHEAD 834 addi r3,r1,STACK_FRAME_OVERHEAD
diff --git a/arch/powerpc/kernel/hw_breakpoint.c b/arch/powerpc/kernel/hw_breakpoint.c
new file mode 100644
index 000000000000..5ecd0401cdb1
--- /dev/null
+++ b/arch/powerpc/kernel/hw_breakpoint.c
@@ -0,0 +1,364 @@
1/*
2 * HW_breakpoint: a unified kernel/user-space hardware breakpoint facility,
3 * using the CPU's debug registers. Derived from
4 * "arch/x86/kernel/hw_breakpoint.c"
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 *
20 * Copyright 2010 IBM Corporation
21 * Author: K.Prasad <prasad@linux.vnet.ibm.com>
22 *
23 */
24
25#include <linux/hw_breakpoint.h>
26#include <linux/notifier.h>
27#include <linux/kprobes.h>
28#include <linux/percpu.h>
29#include <linux/kernel.h>
30#include <linux/module.h>
31#include <linux/sched.h>
32#include <linux/init.h>
33#include <linux/smp.h>
34
35#include <asm/hw_breakpoint.h>
36#include <asm/processor.h>
37#include <asm/sstep.h>
38#include <asm/uaccess.h>
39
40/*
41 * Stores the breakpoints currently in use on each breakpoint address
42 * register for every cpu
43 */
44static DEFINE_PER_CPU(struct perf_event *, bp_per_reg);
45
46/*
47 * Returns total number of data or instruction breakpoints available.
48 */
49int hw_breakpoint_slots(int type)
50{
51 if (type == TYPE_DATA)
52 return HBP_NUM;
53 return 0; /* no instruction breakpoints available */
54}
55
56/*
57 * Install a perf counter breakpoint.
58 *
59 * We seek a free debug address register and use it for this
60 * breakpoint.
61 *
62 * Atomic: we hold the counter->ctx->lock and we only handle variables
63 * and registers local to this cpu.
64 */
65int arch_install_hw_breakpoint(struct perf_event *bp)
66{
67 struct arch_hw_breakpoint *info = counter_arch_bp(bp);
68 struct perf_event **slot = &__get_cpu_var(bp_per_reg);
69
70 *slot = bp;
71
72 /*
73 * Do not install DABR values if the instruction must be single-stepped.
74 * If so, DABR will be populated in single_step_dabr_instruction().
75 */
76 if (current->thread.last_hit_ubp != bp)
77 set_dabr(info->address | info->type | DABR_TRANSLATION);
78
79 return 0;
80}
81
82/*
83 * Uninstall the breakpoint contained in the given counter.
84 *
85 * First we search the debug address register it uses and then we disable
86 * it.
87 *
88 * Atomic: we hold the counter->ctx->lock and we only handle variables
89 * and registers local to this cpu.
90 */
91void arch_uninstall_hw_breakpoint(struct perf_event *bp)
92{
93 struct perf_event **slot = &__get_cpu_var(bp_per_reg);
94
95 if (*slot != bp) {
96 WARN_ONCE(1, "Can't find the breakpoint");
97 return;
98 }
99
100 *slot = NULL;
101 set_dabr(0);
102}
103
104/*
105 * Perform cleanup of arch-specific counters during unregistration
106 * of the perf-event
107 */
108void arch_unregister_hw_breakpoint(struct perf_event *bp)
109{
110 /*
111 * If the breakpoint is unregistered between a hw_breakpoint_handler()
112 * and the single_step_dabr_instruction(), then cleanup the breakpoint
113 * restoration variables to prevent dangling pointers.
114 */
115 if (bp->ctx->task)
116 bp->ctx->task->thread.last_hit_ubp = NULL;
117}
118
119/*
120 * Check for virtual address in kernel space.
121 */
122int arch_check_bp_in_kernelspace(struct perf_event *bp)
123{
124 struct arch_hw_breakpoint *info = counter_arch_bp(bp);
125
126 return is_kernel_addr(info->address);
127}
128
129int arch_bp_generic_fields(int type, int *gen_bp_type)
130{
131 switch (type) {
132 case DABR_DATA_READ:
133 *gen_bp_type = HW_BREAKPOINT_R;
134 break;
135 case DABR_DATA_WRITE:
136 *gen_bp_type = HW_BREAKPOINT_W;
137 break;
138 case (DABR_DATA_WRITE | DABR_DATA_READ):
139 *gen_bp_type = (HW_BREAKPOINT_W | HW_BREAKPOINT_R);
140 break;
141 default:
142 return -EINVAL;
143 }
144 return 0;
145}
146
147/*
148 * Validate the arch-specific HW Breakpoint register settings
149 */
150int arch_validate_hwbkpt_settings(struct perf_event *bp)
151{
152 int ret = -EINVAL;
153 struct arch_hw_breakpoint *info = counter_arch_bp(bp);
154
155 if (!bp)
156 return ret;
157
158 switch (bp->attr.bp_type) {
159 case HW_BREAKPOINT_R:
160 info->type = DABR_DATA_READ;
161 break;
162 case HW_BREAKPOINT_W:
163 info->type = DABR_DATA_WRITE;
164 break;
165 case HW_BREAKPOINT_R | HW_BREAKPOINT_W:
166 info->type = (DABR_DATA_READ | DABR_DATA_WRITE);
167 break;
168 default:
169 return ret;
170 }
171
172 info->address = bp->attr.bp_addr;
173 info->len = bp->attr.bp_len;
174
175 /*
176 * Since breakpoint length can be a maximum of HW_BREAKPOINT_LEN(8)
177 * and breakpoint addresses are aligned to nearest double-word
178 * HW_BREAKPOINT_ALIGN by rounding off to the lower address, the
179 * 'symbolsize' should satisfy the check below.
180 */
181 if (info->len >
182 (HW_BREAKPOINT_LEN - (info->address & HW_BREAKPOINT_ALIGN)))
183 return -EINVAL;
184 return 0;
185}
186
187/*
188 * Restores the breakpoint on the debug registers.
189 * Invoke this function if it is known that the execution context is
190 * about to change to cause loss of MSR_SE settings.
191 */
192void thread_change_pc(struct task_struct *tsk, struct pt_regs *regs)
193{
194 struct arch_hw_breakpoint *info;
195
196 if (likely(!tsk->thread.last_hit_ubp))
197 return;
198
199 info = counter_arch_bp(tsk->thread.last_hit_ubp);
200 regs->msr &= ~MSR_SE;
201 set_dabr(info->address | info->type | DABR_TRANSLATION);
202 tsk->thread.last_hit_ubp = NULL;
203}
204
205/*
206 * Handle debug exception notifications.
207 */
208int __kprobes hw_breakpoint_handler(struct die_args *args)
209{
210 int rc = NOTIFY_STOP;
211 struct perf_event *bp;
212 struct pt_regs *regs = args->regs;
213 int stepped = 1;
214 struct arch_hw_breakpoint *info;
215 unsigned int instr;
216 unsigned long dar = regs->dar;
217
218 /* Disable breakpoints during exception handling */
219 set_dabr(0);
220
221 /*
222 * The counter may be concurrently released but that can only
223 * occur from a call_rcu() path. We can then safely fetch
224 * the breakpoint, use its callback, touch its counter
225 * while we are in an rcu_read_lock() path.
226 */
227 rcu_read_lock();
228
229 bp = __get_cpu_var(bp_per_reg);
230 if (!bp)
231 goto out;
232 info = counter_arch_bp(bp);
233
234 /*
235 * Return early after invoking user-callback function without restoring
236 * DABR if the breakpoint is from ptrace which always operates in
237 * one-shot mode. The ptrace-ed process will receive the SIGTRAP signal
238 * generated in do_dabr().
239 */
240 if (bp->overflow_handler == ptrace_triggered) {
241 perf_bp_event(bp, regs);
242 rc = NOTIFY_DONE;
243 goto out;
244 }
245
246 /*
247 * Verify if dar lies within the address range occupied by the symbol
248 * being watched to filter extraneous exceptions. If it doesn't,
249 * we still need to single-step the instruction, but we don't
250 * generate an event.
251 */
252 info->extraneous_interrupt = !((bp->attr.bp_addr <= dar) &&
253 (dar - bp->attr.bp_addr < bp->attr.bp_len));
254
255 /* Do not emulate user-space instructions, instead single-step them */
256 if (user_mode(regs)) {
257 bp->ctx->task->thread.last_hit_ubp = bp;
258 regs->msr |= MSR_SE;
259 goto out;
260 }
261
262 stepped = 0;
263 instr = 0;
264 if (!__get_user_inatomic(instr, (unsigned int *) regs->nip))
265 stepped = emulate_step(regs, instr);
266
267 /*
268 * emulate_step() could not execute it. We've failed in reliably
269 * handling the hw-breakpoint. Unregister it and throw a warning
270 * message to let the user know about it.
271 */
272 if (!stepped) {
273 WARN(1, "Unable to handle hardware breakpoint. Breakpoint at "
274 "0x%lx will be disabled.", info->address);
275 perf_event_disable(bp);
276 goto out;
277 }
278 /*
279 * As a policy, the callback is invoked in a 'trigger-after-execute'
280 * fashion
281 */
282 if (!info->extraneous_interrupt)
283 perf_bp_event(bp, regs);
284
285 set_dabr(info->address | info->type | DABR_TRANSLATION);
286out:
287 rcu_read_unlock();
288 return rc;
289}
290
291/*
292 * Handle single-step exceptions following a DABR hit.
293 */
294int __kprobes single_step_dabr_instruction(struct die_args *args)
295{
296 struct pt_regs *regs = args->regs;
297 struct perf_event *bp = NULL;
298 struct arch_hw_breakpoint *bp_info;
299
300 bp = current->thread.last_hit_ubp;
301 /*
302 * Check if we are single-stepping as a result of a
303 * previous HW Breakpoint exception
304 */
305 if (!bp)
306 return NOTIFY_DONE;
307
308 bp_info = counter_arch_bp(bp);
309
310 /*
311 * We shall invoke the user-defined callback function in the single
312 * stepping handler to confirm to 'trigger-after-execute' semantics
313 */
314 if (!bp_info->extraneous_interrupt)
315 perf_bp_event(bp, regs);
316
317 set_dabr(bp_info->address | bp_info->type | DABR_TRANSLATION);
318 current->thread.last_hit_ubp = NULL;
319
320 /*
321 * If the process was being single-stepped by ptrace, let the
322 * other single-step actions occur (e.g. generate SIGTRAP).
323 */
324 if (test_thread_flag(TIF_SINGLESTEP))
325 return NOTIFY_DONE;
326
327 return NOTIFY_STOP;
328}
329
330/*
331 * Handle debug exception notifications.
332 */
333int __kprobes hw_breakpoint_exceptions_notify(
334 struct notifier_block *unused, unsigned long val, void *data)
335{
336 int ret = NOTIFY_DONE;
337
338 switch (val) {
339 case DIE_DABR_MATCH:
340 ret = hw_breakpoint_handler(data);
341 break;
342 case DIE_SSTEP:
343 ret = single_step_dabr_instruction(data);
344 break;
345 }
346
347 return ret;
348}
349
350/*
351 * Release the user breakpoints used by ptrace
352 */
353void flush_ptrace_hw_breakpoint(struct task_struct *tsk)
354{
355 struct thread_struct *t = &tsk->thread;
356
357 unregister_hw_breakpoint(t->ptrace_bps[0]);
358 t->ptrace_bps[0] = NULL;
359}
360
361void hw_breakpoint_pmu_read(struct perf_event *bp)
362{
363 /* TODO */
364}
diff --git a/arch/powerpc/kernel/ibmebus.c b/arch/powerpc/kernel/ibmebus.c
index 21266abfbda6..9b626cfffce1 100644
--- a/arch/powerpc/kernel/ibmebus.c
+++ b/arch/powerpc/kernel/ibmebus.c
@@ -140,19 +140,19 @@ static struct dma_map_ops ibmebus_dma_ops = {
140 140
141static int ibmebus_match_path(struct device *dev, void *data) 141static int ibmebus_match_path(struct device *dev, void *data)
142{ 142{
143 struct device_node *dn = to_of_device(dev)->dev.of_node; 143 struct device_node *dn = to_platform_device(dev)->dev.of_node;
144 return (dn->full_name && 144 return (dn->full_name &&
145 (strcasecmp((char *)data, dn->full_name) == 0)); 145 (strcasecmp((char *)data, dn->full_name) == 0));
146} 146}
147 147
148static int ibmebus_match_node(struct device *dev, void *data) 148static int ibmebus_match_node(struct device *dev, void *data)
149{ 149{
150 return to_of_device(dev)->dev.of_node == data; 150 return to_platform_device(dev)->dev.of_node == data;
151} 151}
152 152
153static int ibmebus_create_device(struct device_node *dn) 153static int ibmebus_create_device(struct device_node *dn)
154{ 154{
155 struct of_device *dev; 155 struct platform_device *dev;
156 int ret; 156 int ret;
157 157
158 dev = of_device_alloc(dn, NULL, &ibmebus_bus_device); 158 dev = of_device_alloc(dn, NULL, &ibmebus_bus_device);
@@ -298,7 +298,7 @@ static ssize_t ibmebus_store_remove(struct bus_type *bus,
298 298
299 if ((dev = bus_find_device(&ibmebus_bus_type, NULL, path, 299 if ((dev = bus_find_device(&ibmebus_bus_type, NULL, path,
300 ibmebus_match_path))) { 300 ibmebus_match_path))) {
301 of_device_unregister(to_of_device(dev)); 301 of_device_unregister(to_platform_device(dev));
302 302
303 kfree(path); 303 kfree(path);
304 return count; 304 return count;
diff --git a/arch/powerpc/kernel/idle_book3e.S b/arch/powerpc/kernel/idle_book3e.S
new file mode 100644
index 000000000000..16c002d6bdf1
--- /dev/null
+++ b/arch/powerpc/kernel/idle_book3e.S
@@ -0,0 +1,86 @@
1/*
2 * Copyright 2010 IBM Corp, Benjamin Herrenschmidt <benh@kernel.crashing.org>
3 *
4 * Generic idle routine for Book3E processors
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 */
11
12#include <linux/threads.h>
13#include <asm/reg.h>
14#include <asm/ppc_asm.h>
15#include <asm/asm-offsets.h>
16#include <asm/ppc-opcode.h>
17#include <asm/processor.h>
18#include <asm/thread_info.h>
19
20/* 64-bit version only for now */
21#ifdef CONFIG_PPC64
22
23_GLOBAL(book3e_idle)
24 /* Save LR for later */
25 mflr r0
26 std r0,16(r1)
27
28 /* Hard disable interrupts */
29 wrteei 0
30
31 /* Now check if an interrupt came in while we were soft disabled
32 * since we may otherwise lose it (doorbells etc...). We know
33 * that since PACAHARDIRQEN will have been cleared in that case.
34 */
35 lbz r3,PACAHARDIRQEN(r13)
36 cmpwi cr0,r3,0
37 beqlr
38
39 /* Now we are going to mark ourselves as soft and hard enables in
40 * order to be able to take interrupts while asleep. We inform lockdep
41 * of that. We don't actually turn interrupts on just yet tho.
42 */
43#ifdef CONFIG_TRACE_IRQFLAGS
44 stdu r1,-128(r1)
45 bl .trace_hardirqs_on
46#endif
47 li r0,1
48 stb r0,PACASOFTIRQEN(r13)
49 stb r0,PACAHARDIRQEN(r13)
50
51 /* Interrupts will make use return to LR, so get something we want
52 * in there
53 */
54 bl 1f
55
56 /* Hard disable interrupts again */
57 wrteei 0
58
59 /* Mark them off again in the PACA as well */
60 li r0,0
61 stb r0,PACASOFTIRQEN(r13)
62 stb r0,PACAHARDIRQEN(r13)
63
64 /* Tell lockdep about it */
65#ifdef CONFIG_TRACE_IRQFLAGS
66 bl .trace_hardirqs_off
67 addi r1,r1,128
68#endif
69 ld r0,16(r1)
70 mtlr r0
71 blr
72
731: /* Let's set the _TLF_NAPPING flag so interrupts make us return
74 * to the right spot
75 */
76 clrrdi r11,r1,THREAD_SHIFT
77 ld r10,TI_LOCAL_FLAGS(r11)
78 ori r10,r10,_TLF_NAPPING
79 std r10,TI_LOCAL_FLAGS(r11)
80
81 /* We can now re-enable hard interrupts and go to sleep */
82 wrteei 1
831: PPC_WAIT(0)
84 b 1b
85
86#endif /* CONFIG_PPC64 */
diff --git a/arch/powerpc/kernel/irq.c b/arch/powerpc/kernel/irq.c
index 77be3d058a65..d3ce67cf03be 100644
--- a/arch/powerpc/kernel/irq.c
+++ b/arch/powerpc/kernel/irq.c
@@ -53,6 +53,8 @@
53#include <linux/bootmem.h> 53#include <linux/bootmem.h>
54#include <linux/pci.h> 54#include <linux/pci.h>
55#include <linux/debugfs.h> 55#include <linux/debugfs.h>
56#include <linux/of.h>
57#include <linux/of_irq.h>
56 58
57#include <asm/uaccess.h> 59#include <asm/uaccess.h>
58#include <asm/system.h> 60#include <asm/system.h>
@@ -64,6 +66,8 @@
64#include <asm/ptrace.h> 66#include <asm/ptrace.h>
65#include <asm/machdep.h> 67#include <asm/machdep.h>
66#include <asm/udbg.h> 68#include <asm/udbg.h>
69#include <asm/dbell.h>
70
67#ifdef CONFIG_PPC64 71#ifdef CONFIG_PPC64
68#include <asm/paca.h> 72#include <asm/paca.h>
69#include <asm/firmware.h> 73#include <asm/firmware.h>
@@ -153,14 +157,28 @@ notrace void raw_local_irq_restore(unsigned long en)
153 if (get_hard_enabled()) 157 if (get_hard_enabled())
154 return; 158 return;
155 159
160#if defined(CONFIG_BOOKE) && defined(CONFIG_SMP)
161 /* Check for pending doorbell interrupts and resend to ourself */
162 doorbell_check_self();
163#endif
164
156 /* 165 /*
157 * Need to hard-enable interrupts here. Since currently disabled, 166 * Need to hard-enable interrupts here. Since currently disabled,
158 * no need to take further asm precautions against preemption; but 167 * no need to take further asm precautions against preemption; but
159 * use local_paca instead of get_paca() to avoid preemption checking. 168 * use local_paca instead of get_paca() to avoid preemption checking.
160 */ 169 */
161 local_paca->hard_enabled = en; 170 local_paca->hard_enabled = en;
171
172#ifndef CONFIG_BOOKE
173 /* On server, re-trigger the decrementer if it went negative since
174 * some processors only trigger on edge transitions of the sign bit.
175 *
176 * BookE has a level sensitive decrementer (latches in TSR) so we
177 * don't need that
178 */
162 if ((int)mfspr(SPRN_DEC) < 0) 179 if ((int)mfspr(SPRN_DEC) < 0)
163 mtspr(SPRN_DEC, 1); 180 mtspr(SPRN_DEC, 1);
181#endif /* CONFIG_BOOKE */
164 182
165 /* 183 /*
166 * Force the delivery of pending soft-disabled interrupts on PS3. 184 * Force the delivery of pending soft-disabled interrupts on PS3.
@@ -804,18 +822,6 @@ unsigned int irq_create_of_mapping(struct device_node *controller,
804} 822}
805EXPORT_SYMBOL_GPL(irq_create_of_mapping); 823EXPORT_SYMBOL_GPL(irq_create_of_mapping);
806 824
807unsigned int irq_of_parse_and_map(struct device_node *dev, int index)
808{
809 struct of_irq oirq;
810
811 if (of_irq_map_one(dev, index, &oirq))
812 return NO_IRQ;
813
814 return irq_create_of_mapping(oirq.controller, oirq.specifier,
815 oirq.size);
816}
817EXPORT_SYMBOL_GPL(irq_of_parse_and_map);
818
819void irq_dispose_mapping(unsigned int virq) 825void irq_dispose_mapping(unsigned int virq)
820{ 826{
821 struct irq_host *host; 827 struct irq_host *host;
diff --git a/arch/powerpc/kernel/kgdb.c b/arch/powerpc/kernel/kgdb.c
index 82a7b228c81a..7f61a3ac787c 100644
--- a/arch/powerpc/kernel/kgdb.c
+++ b/arch/powerpc/kernel/kgdb.c
@@ -129,7 +129,7 @@ static int kgdb_handle_breakpoint(struct pt_regs *regs)
129 return 0; 129 return 0;
130 130
131 if (*(u32 *) (regs->nip) == *(u32 *) (&arch_kgdb_ops.gdb_bpt_instr)) 131 if (*(u32 *) (regs->nip) == *(u32 *) (&arch_kgdb_ops.gdb_bpt_instr))
132 regs->nip += 4; 132 regs->nip += BREAK_INSTR_SIZE;
133 133
134 return 1; 134 return 1;
135} 135}
diff --git a/arch/powerpc/kernel/legacy_serial.c b/arch/powerpc/kernel/legacy_serial.c
index 035ada5443ee..c1fd0f9658fd 100644
--- a/arch/powerpc/kernel/legacy_serial.c
+++ b/arch/powerpc/kernel/legacy_serial.c
@@ -4,6 +4,7 @@
4#include <linux/serial_core.h> 4#include <linux/serial_core.h>
5#include <linux/console.h> 5#include <linux/console.h>
6#include <linux/pci.h> 6#include <linux/pci.h>
7#include <linux/of_address.h>
7#include <linux/of_device.h> 8#include <linux/of_device.h>
8#include <asm/io.h> 9#include <asm/io.h>
9#include <asm/mmu.h> 10#include <asm/mmu.h>
diff --git a/arch/powerpc/kernel/machine_kexec.c b/arch/powerpc/kernel/machine_kexec.c
index 89f005116aac..dd6c141f1662 100644
--- a/arch/powerpc/kernel/machine_kexec.c
+++ b/arch/powerpc/kernel/machine_kexec.c
@@ -45,6 +45,18 @@ void machine_kexec_cleanup(struct kimage *image)
45 ppc_md.machine_kexec_cleanup(image); 45 ppc_md.machine_kexec_cleanup(image);
46} 46}
47 47
48void arch_crash_save_vmcoreinfo(void)
49{
50
51#ifdef CONFIG_NEED_MULTIPLE_NODES
52 VMCOREINFO_SYMBOL(node_data);
53 VMCOREINFO_LENGTH(node_data, MAX_NUMNODES);
54#endif
55#ifndef CONFIG_NEED_MULTIPLE_NODES
56 VMCOREINFO_SYMBOL(contig_page_data);
57#endif
58}
59
48/* 60/*
49 * Do not allocate memory (or fail in any way) in machine_kexec(). 61 * Do not allocate memory (or fail in any way) in machine_kexec().
50 * We are past the point of no return, committed to rebooting now. 62 * We are past the point of no return, committed to rebooting now.
@@ -144,24 +156,24 @@ int overlaps_crashkernel(unsigned long start, unsigned long size)
144} 156}
145 157
146/* Values we need to export to the second kernel via the device tree. */ 158/* Values we need to export to the second kernel via the device tree. */
147static unsigned long kernel_end; 159static phys_addr_t kernel_end;
148static unsigned long crashk_size; 160static phys_addr_t crashk_size;
149 161
150static struct property kernel_end_prop = { 162static struct property kernel_end_prop = {
151 .name = "linux,kernel-end", 163 .name = "linux,kernel-end",
152 .length = sizeof(unsigned long), 164 .length = sizeof(phys_addr_t),
153 .value = &kernel_end, 165 .value = &kernel_end,
154}; 166};
155 167
156static struct property crashk_base_prop = { 168static struct property crashk_base_prop = {
157 .name = "linux,crashkernel-base", 169 .name = "linux,crashkernel-base",
158 .length = sizeof(unsigned long), 170 .length = sizeof(phys_addr_t),
159 .value = &crashk_res.start, 171 .value = &crashk_res.start,
160}; 172};
161 173
162static struct property crashk_size_prop = { 174static struct property crashk_size_prop = {
163 .name = "linux,crashkernel-size", 175 .name = "linux,crashkernel-size",
164 .length = sizeof(unsigned long), 176 .length = sizeof(phys_addr_t),
165 .value = &crashk_size, 177 .value = &crashk_size,
166}; 178};
167 179
diff --git a/arch/powerpc/kernel/machine_kexec_64.c b/arch/powerpc/kernel/machine_kexec_64.c
index ed31a29c4ff7..583af70c4b14 100644
--- a/arch/powerpc/kernel/machine_kexec_64.c
+++ b/arch/powerpc/kernel/machine_kexec_64.c
@@ -15,6 +15,8 @@
15#include <linux/thread_info.h> 15#include <linux/thread_info.h>
16#include <linux/init_task.h> 16#include <linux/init_task.h>
17#include <linux/errno.h> 17#include <linux/errno.h>
18#include <linux/kernel.h>
19#include <linux/cpu.h>
18 20
19#include <asm/page.h> 21#include <asm/page.h>
20#include <asm/current.h> 22#include <asm/current.h>
@@ -25,6 +27,7 @@
25#include <asm/sections.h> /* _end */ 27#include <asm/sections.h> /* _end */
26#include <asm/prom.h> 28#include <asm/prom.h>
27#include <asm/smp.h> 29#include <asm/smp.h>
30#include <asm/hw_breakpoint.h>
28 31
29int default_machine_kexec_prepare(struct kimage *image) 32int default_machine_kexec_prepare(struct kimage *image)
30{ 33{
@@ -165,6 +168,7 @@ static void kexec_smp_down(void *arg)
165 while(kexec_all_irq_disabled == 0) 168 while(kexec_all_irq_disabled == 0)
166 cpu_relax(); 169 cpu_relax();
167 mb(); /* make sure all irqs are disabled before this */ 170 mb(); /* make sure all irqs are disabled before this */
171 hw_breakpoint_disable();
168 /* 172 /*
169 * Now every CPU has IRQs off, we can clear out any pending 173 * Now every CPU has IRQs off, we can clear out any pending
170 * IPIs and be sure that no more will come in after this. 174 * IPIs and be sure that no more will come in after this.
@@ -180,8 +184,22 @@ static void kexec_prepare_cpus_wait(int wait_state)
180{ 184{
181 int my_cpu, i, notified=-1; 185 int my_cpu, i, notified=-1;
182 186
187 hw_breakpoint_disable();
183 my_cpu = get_cpu(); 188 my_cpu = get_cpu();
184 /* Make sure each CPU has atleast made it to the state we need */ 189 /* Make sure each CPU has at least made it to the state we need.
190 *
191 * FIXME: There is a (slim) chance of a problem if not all of the CPUs
192 * are correctly onlined. If somehow we start a CPU on boot with RTAS
193 * start-cpu, but somehow that CPU doesn't write callin_cpu_map[] in
194 * time, the boot CPU will timeout. If it does eventually execute
195 * stuff, the secondary will start up (paca[].cpu_start was written) and
196 * get into a peculiar state. If the platform supports
197 * smp_ops->take_timebase(), the secondary CPU will probably be spinning
198 * in there. If not (i.e. pseries), the secondary will continue on and
199 * try to online itself/idle/etc. If it survives that, we need to find
200 * these possible-but-not-online-but-should-be CPUs and chaperone them
201 * into kexec_smp_wait().
202 */
185 for_each_online_cpu(i) { 203 for_each_online_cpu(i) {
186 if (i == my_cpu) 204 if (i == my_cpu)
187 continue; 205 continue;
@@ -189,9 +207,9 @@ static void kexec_prepare_cpus_wait(int wait_state)
189 while (paca[i].kexec_state < wait_state) { 207 while (paca[i].kexec_state < wait_state) {
190 barrier(); 208 barrier();
191 if (i != notified) { 209 if (i != notified) {
192 printk( "kexec: waiting for cpu %d (physical" 210 printk(KERN_INFO "kexec: waiting for cpu %d "
193 " %d) to enter %i state\n", 211 "(physical %d) to enter %i state\n",
194 i, paca[i].hw_cpu_id, wait_state); 212 i, paca[i].hw_cpu_id, wait_state);
195 notified = i; 213 notified = i;
196 } 214 }
197 } 215 }
@@ -199,9 +217,32 @@ static void kexec_prepare_cpus_wait(int wait_state)
199 mb(); 217 mb();
200} 218}
201 219
202static void kexec_prepare_cpus(void) 220/*
221 * We need to make sure each present CPU is online. The next kernel will scan
222 * the device tree and assume primary threads are online and query secondary
223 * threads via RTAS to online them if required. If we don't online primary
224 * threads, they will be stuck. However, we also online secondary threads as we
225 * may be using 'cede offline'. In this case RTAS doesn't see the secondary
226 * threads as offline -- and again, these CPUs will be stuck.
227 *
228 * So, we online all CPUs that should be running, including secondary threads.
229 */
230static void wake_offline_cpus(void)
203{ 231{
232 int cpu = 0;
204 233
234 for_each_present_cpu(cpu) {
235 if (!cpu_online(cpu)) {
236 printk(KERN_INFO "kexec: Waking offline cpu %d.\n",
237 cpu);
238 cpu_up(cpu);
239 }
240 }
241}
242
243static void kexec_prepare_cpus(void)
244{
245 wake_offline_cpus();
205 smp_call_function(kexec_smp_down, NULL, /* wait */0); 246 smp_call_function(kexec_smp_down, NULL, /* wait */0);
206 local_irq_disable(); 247 local_irq_disable();
207 mb(); /* make sure IRQs are disabled before we say they are */ 248 mb(); /* make sure IRQs are disabled before we say they are */
@@ -215,7 +256,10 @@ static void kexec_prepare_cpus(void)
215 if (ppc_md.kexec_cpu_down) 256 if (ppc_md.kexec_cpu_down)
216 ppc_md.kexec_cpu_down(0, 0); 257 ppc_md.kexec_cpu_down(0, 0);
217 258
218 /* Before removing MMU mapings make sure all CPUs have entered real mode */ 259 /*
260 * Before removing MMU mappings make sure all CPUs have entered real
261 * mode:
262 */
219 kexec_prepare_cpus_wait(KEXEC_STATE_REAL_MODE); 263 kexec_prepare_cpus_wait(KEXEC_STATE_REAL_MODE);
220 264
221 put_cpu(); 265 put_cpu();
@@ -257,6 +301,12 @@ static void kexec_prepare_cpus(void)
257static union thread_union kexec_stack __init_task_data = 301static union thread_union kexec_stack __init_task_data =
258 { }; 302 { };
259 303
304/*
305 * For similar reasons to the stack above, the kexecing CPU needs to be on a
306 * static PACA; we switch to kexec_paca.
307 */
308struct paca_struct kexec_paca;
309
260/* Our assembly helper, in kexec_stub.S */ 310/* Our assembly helper, in kexec_stub.S */
261extern NORET_TYPE void kexec_sequence(void *newstack, unsigned long start, 311extern NORET_TYPE void kexec_sequence(void *newstack, unsigned long start,
262 void *image, void *control, 312 void *image, void *control,
@@ -278,12 +328,28 @@ void default_machine_kexec(struct kimage *image)
278 if (crashing_cpu == -1) 328 if (crashing_cpu == -1)
279 kexec_prepare_cpus(); 329 kexec_prepare_cpus();
280 330
331 pr_debug("kexec: Starting switchover sequence.\n");
332
281 /* switch to a staticly allocated stack. Based on irq stack code. 333 /* switch to a staticly allocated stack. Based on irq stack code.
282 * XXX: the task struct will likely be invalid once we do the copy! 334 * XXX: the task struct will likely be invalid once we do the copy!
283 */ 335 */
284 kexec_stack.thread_info.task = current_thread_info()->task; 336 kexec_stack.thread_info.task = current_thread_info()->task;
285 kexec_stack.thread_info.flags = 0; 337 kexec_stack.thread_info.flags = 0;
286 338
339 /* We need a static PACA, too; copy this CPU's PACA over and switch to
340 * it. Also poison per_cpu_offset to catch anyone using non-static
341 * data.
342 */
343 memcpy(&kexec_paca, get_paca(), sizeof(struct paca_struct));
344 kexec_paca.data_offset = 0xedeaddeadeeeeeeeUL;
345 paca = (struct paca_struct *)RELOC_HIDE(&kexec_paca, 0) -
346 kexec_paca.paca_index;
347 setup_paca(&kexec_paca);
348
349 /* XXX: If anyone does 'dynamic lppacas' this will also need to be
350 * switched to a static version!
351 */
352
287 /* Some things are best done in assembly. Finding globals with 353 /* Some things are best done in assembly. Finding globals with
288 * a toc is easier in C, so pass in what we can. 354 * a toc is easier in C, so pass in what we can.
289 */ 355 */
diff --git a/arch/powerpc/kernel/misc.S b/arch/powerpc/kernel/misc.S
index 22e507c8a556..2d29752cbe16 100644
--- a/arch/powerpc/kernel/misc.S
+++ b/arch/powerpc/kernel/misc.S
@@ -127,29 +127,3 @@ _GLOBAL(__setup_cpu_power7)
127_GLOBAL(__restore_cpu_power7) 127_GLOBAL(__restore_cpu_power7)
128 /* place holder */ 128 /* place holder */
129 blr 129 blr
130
131/*
132 * Get a minimal set of registers for our caller's nth caller.
133 * r3 = regs pointer, r5 = n.
134 *
135 * We only get R1 (stack pointer), NIP (next instruction pointer)
136 * and LR (link register). These are all we can get in the
137 * general case without doing complicated stack unwinding, but
138 * fortunately they are enough to do a stack backtrace, which
139 * is all we need them for.
140 */
141_GLOBAL(perf_arch_fetch_caller_regs)
142 mr r6,r1
143 cmpwi r5,0
144 mflr r4
145 ble 2f
146 mtctr r5
1471: PPC_LL r6,0(r6)
148 bdnz 1b
149 PPC_LL r4,PPC_LR_STKOFF(r6)
1502: PPC_LL r7,0(r6)
151 PPC_LL r7,PPC_LR_STKOFF(r7)
152 PPC_STL r6,GPR1-STACK_FRAME_OVERHEAD(r3)
153 PPC_STL r4,_NIP-STACK_FRAME_OVERHEAD(r3)
154 PPC_STL r7,_LINK-STACK_FRAME_OVERHEAD(r3)
155 blr
diff --git a/arch/powerpc/kernel/of_device.c b/arch/powerpc/kernel/of_device.c
deleted file mode 100644
index df78e0236a02..000000000000
--- a/arch/powerpc/kernel/of_device.c
+++ /dev/null
@@ -1,133 +0,0 @@
1#include <linux/string.h>
2#include <linux/kernel.h>
3#include <linux/of.h>
4#include <linux/init.h>
5#include <linux/module.h>
6#include <linux/mod_devicetable.h>
7#include <linux/slab.h>
8#include <linux/of_device.h>
9
10#include <asm/errno.h>
11#include <asm/dcr.h>
12
13static void of_device_make_bus_id(struct of_device *dev)
14{
15 static atomic_t bus_no_reg_magic;
16 struct device_node *node = dev->dev.of_node;
17 const u32 *reg;
18 u64 addr;
19 int magic;
20
21 /*
22 * If it's a DCR based device, use 'd' for native DCRs
23 * and 'D' for MMIO DCRs.
24 */
25#ifdef CONFIG_PPC_DCR
26 reg = of_get_property(node, "dcr-reg", NULL);
27 if (reg) {
28#ifdef CONFIG_PPC_DCR_NATIVE
29 dev_set_name(&dev->dev, "d%x.%s", *reg, node->name);
30#else /* CONFIG_PPC_DCR_NATIVE */
31 addr = of_translate_dcr_address(node, *reg, NULL);
32 if (addr != OF_BAD_ADDR) {
33 dev_set_name(&dev->dev, "D%llx.%s",
34 (unsigned long long)addr, node->name);
35 return;
36 }
37#endif /* !CONFIG_PPC_DCR_NATIVE */
38 }
39#endif /* CONFIG_PPC_DCR */
40
41 /*
42 * For MMIO, get the physical address
43 */
44 reg = of_get_property(node, "reg", NULL);
45 if (reg) {
46 addr = of_translate_address(node, reg);
47 if (addr != OF_BAD_ADDR) {
48 dev_set_name(&dev->dev, "%llx.%s",
49 (unsigned long long)addr, node->name);
50 return;
51 }
52 }
53
54 /*
55 * No BusID, use the node name and add a globally incremented
56 * counter (and pray...)
57 */
58 magic = atomic_add_return(1, &bus_no_reg_magic);
59 dev_set_name(&dev->dev, "%s.%d", node->name, magic - 1);
60}
61
62struct of_device *of_device_alloc(struct device_node *np,
63 const char *bus_id,
64 struct device *parent)
65{
66 struct of_device *dev;
67
68 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
69 if (!dev)
70 return NULL;
71
72 dev->dev.of_node = of_node_get(np);
73 dev->dev.dma_mask = &dev->archdata.dma_mask;
74 dev->dev.parent = parent;
75 dev->dev.release = of_release_dev;
76
77 if (bus_id)
78 dev_set_name(&dev->dev, "%s", bus_id);
79 else
80 of_device_make_bus_id(dev);
81
82 return dev;
83}
84EXPORT_SYMBOL(of_device_alloc);
85
86int of_device_uevent(struct device *dev, struct kobj_uevent_env *env)
87{
88 struct of_device *ofdev;
89 const char *compat;
90 int seen = 0, cplen, sl;
91
92 if (!dev)
93 return -ENODEV;
94
95 ofdev = to_of_device(dev);
96
97 if (add_uevent_var(env, "OF_NAME=%s", ofdev->dev.of_node->name))
98 return -ENOMEM;
99
100 if (add_uevent_var(env, "OF_TYPE=%s", ofdev->dev.of_node->type))
101 return -ENOMEM;
102
103 /* Since the compatible field can contain pretty much anything
104 * it's not really legal to split it out with commas. We split it
105 * up using a number of environment variables instead. */
106
107 compat = of_get_property(ofdev->dev.of_node, "compatible", &cplen);
108 while (compat && *compat && cplen > 0) {
109 if (add_uevent_var(env, "OF_COMPATIBLE_%d=%s", seen, compat))
110 return -ENOMEM;
111
112 sl = strlen (compat) + 1;
113 compat += sl;
114 cplen -= sl;
115 seen++;
116 }
117
118 if (add_uevent_var(env, "OF_COMPATIBLE_N=%d", seen))
119 return -ENOMEM;
120
121 /* modalias is trickier, we add it in 2 steps */
122 if (add_uevent_var(env, "MODALIAS="))
123 return -ENOMEM;
124 sl = of_device_get_modalias(ofdev, &env->buf[env->buflen-1],
125 sizeof(env->buf) - env->buflen);
126 if (sl >= (sizeof(env->buf) - env->buflen))
127 return -ENOMEM;
128 env->buflen += sl;
129
130 return 0;
131}
132EXPORT_SYMBOL(of_device_uevent);
133EXPORT_SYMBOL(of_device_get_modalias);
diff --git a/arch/powerpc/kernel/of_platform.c b/arch/powerpc/kernel/of_platform.c
index 487a98851ba6..b2c363ef38ad 100644
--- a/arch/powerpc/kernel/of_platform.c
+++ b/arch/powerpc/kernel/of_platform.c
@@ -28,207 +28,6 @@
28#include <asm/ppc-pci.h> 28#include <asm/ppc-pci.h>
29#include <asm/atomic.h> 29#include <asm/atomic.h>
30 30
31/*
32 * The list of OF IDs below is used for matching bus types in the
33 * system whose devices are to be exposed as of_platform_devices.
34 *
35 * This is the default list valid for most platforms. This file provides
36 * functions who can take an explicit list if necessary though
37 *
38 * The search is always performed recursively looking for children of
39 * the provided device_node and recursively if such a children matches
40 * a bus type in the list
41 */
42
43static const struct of_device_id of_default_bus_ids[] = {
44 { .type = "soc", },
45 { .compatible = "soc", },
46 { .type = "spider", },
47 { .type = "axon", },
48 { .type = "plb5", },
49 { .type = "plb4", },
50 { .type = "opb", },
51 { .type = "ebc", },
52 {},
53};
54
55struct bus_type of_platform_bus_type = {
56 .uevent = of_device_uevent,
57};
58EXPORT_SYMBOL(of_platform_bus_type);
59
60static int __init of_bus_driver_init(void)
61{
62 return of_bus_type_init(&of_platform_bus_type, "of_platform");
63}
64
65postcore_initcall(of_bus_driver_init);
66
67struct of_device* of_platform_device_create(struct device_node *np,
68 const char *bus_id,
69 struct device *parent)
70{
71 struct of_device *dev;
72
73 dev = of_device_alloc(np, bus_id, parent);
74 if (!dev)
75 return NULL;
76
77 dev->archdata.dma_mask = 0xffffffffUL;
78 dev->dev.coherent_dma_mask = DMA_BIT_MASK(32);
79
80 dev->dev.bus = &of_platform_bus_type;
81
82 /* We do not fill the DMA ops for platform devices by default.
83 * This is currently the responsibility of the platform code
84 * to do such, possibly using a device notifier
85 */
86
87 if (of_device_register(dev) != 0) {
88 of_device_free(dev);
89 return NULL;
90 }
91
92 return dev;
93}
94EXPORT_SYMBOL(of_platform_device_create);
95
96
97
98/**
99 * of_platform_bus_create - Create an OF device for a bus node and all its
100 * children. Optionally recursively instanciate matching busses.
101 * @bus: device node of the bus to instanciate
102 * @matches: match table, NULL to use the default, OF_NO_DEEP_PROBE to
103 * disallow recursive creation of child busses
104 */
105static int of_platform_bus_create(const struct device_node *bus,
106 const struct of_device_id *matches,
107 struct device *parent)
108{
109 struct device_node *child;
110 struct of_device *dev;
111 int rc = 0;
112
113 for_each_child_of_node(bus, child) {
114 pr_debug(" create child: %s\n", child->full_name);
115 dev = of_platform_device_create(child, NULL, parent);
116 if (dev == NULL)
117 rc = -ENOMEM;
118 else if (!of_match_node(matches, child))
119 continue;
120 if (rc == 0) {
121 pr_debug(" and sub busses\n");
122 rc = of_platform_bus_create(child, matches, &dev->dev);
123 } if (rc) {
124 of_node_put(child);
125 break;
126 }
127 }
128 return rc;
129}
130
131/**
132 * of_platform_bus_probe - Probe the device-tree for platform busses
133 * @root: parent of the first level to probe or NULL for the root of the tree
134 * @matches: match table, NULL to use the default
135 * @parent: parent to hook devices from, NULL for toplevel
136 *
137 * Note that children of the provided root are not instanciated as devices
138 * unless the specified root itself matches the bus list and is not NULL.
139 */
140
141int of_platform_bus_probe(struct device_node *root,
142 const struct of_device_id *matches,
143 struct device *parent)
144{
145 struct device_node *child;
146 struct of_device *dev;
147 int rc = 0;
148
149 if (matches == NULL)
150 matches = of_default_bus_ids;
151 if (matches == OF_NO_DEEP_PROBE)
152 return -EINVAL;
153 if (root == NULL)
154 root = of_find_node_by_path("/");
155 else
156 of_node_get(root);
157
158 pr_debug("of_platform_bus_probe()\n");
159 pr_debug(" starting at: %s\n", root->full_name);
160
161 /* Do a self check of bus type, if there's a match, create
162 * children
163 */
164 if (of_match_node(matches, root)) {
165 pr_debug(" root match, create all sub devices\n");
166 dev = of_platform_device_create(root, NULL, parent);
167 if (dev == NULL) {
168 rc = -ENOMEM;
169 goto bail;
170 }
171 pr_debug(" create all sub busses\n");
172 rc = of_platform_bus_create(root, matches, &dev->dev);
173 goto bail;
174 }
175 for_each_child_of_node(root, child) {
176 if (!of_match_node(matches, child))
177 continue;
178
179 pr_debug(" match: %s\n", child->full_name);
180 dev = of_platform_device_create(child, NULL, parent);
181 if (dev == NULL)
182 rc = -ENOMEM;
183 else
184 rc = of_platform_bus_create(child, matches, &dev->dev);
185 if (rc) {
186 of_node_put(child);
187 break;
188 }
189 }
190 bail:
191 of_node_put(root);
192 return rc;
193}
194EXPORT_SYMBOL(of_platform_bus_probe);
195
196static int of_dev_node_match(struct device *dev, void *data)
197{
198 return to_of_device(dev)->dev.of_node == data;
199}
200
201struct of_device *of_find_device_by_node(struct device_node *np)
202{
203 struct device *dev;
204
205 dev = bus_find_device(&of_platform_bus_type,
206 NULL, np, of_dev_node_match);
207 if (dev)
208 return to_of_device(dev);
209 return NULL;
210}
211EXPORT_SYMBOL(of_find_device_by_node);
212
213static int of_dev_phandle_match(struct device *dev, void *data)
214{
215 phandle *ph = data;
216 return to_of_device(dev)->dev.of_node->phandle == *ph;
217}
218
219struct of_device *of_find_device_by_phandle(phandle ph)
220{
221 struct device *dev;
222
223 dev = bus_find_device(&of_platform_bus_type,
224 NULL, &ph, of_dev_phandle_match);
225 if (dev)
226 return to_of_device(dev);
227 return NULL;
228}
229EXPORT_SYMBOL(of_find_device_by_phandle);
230
231
232#ifdef CONFIG_PPC_OF_PLATFORM_PCI 31#ifdef CONFIG_PPC_OF_PLATFORM_PCI
233 32
234/* The probing of PCI controllers from of_platform is currently 33/* The probing of PCI controllers from of_platform is currently
@@ -237,7 +36,7 @@ EXPORT_SYMBOL(of_find_device_by_phandle);
237 * lacking some bits needed here. 36 * lacking some bits needed here.
238 */ 37 */
239 38
240static int __devinit of_pci_phb_probe(struct of_device *dev, 39static int __devinit of_pci_phb_probe(struct platform_device *dev,
241 const struct of_device_id *match) 40 const struct of_device_id *match)
242{ 41{
243 struct pci_controller *phb; 42 struct pci_controller *phb;
diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c
index 139a773853f4..d0a26f1770fe 100644
--- a/arch/powerpc/kernel/paca.c
+++ b/arch/powerpc/kernel/paca.c
@@ -105,6 +105,16 @@ void __init initialise_paca(struct paca_struct *new_paca, int cpu)
105#endif /* CONFIG_PPC_STD_MMU_64 */ 105#endif /* CONFIG_PPC_STD_MMU_64 */
106} 106}
107 107
108/* Put the paca pointer into r13 and SPRG_PACA */
109void setup_paca(struct paca_struct *new_paca)
110{
111 local_paca = new_paca;
112 mtspr(SPRN_SPRG_PACA, local_paca);
113#ifdef CONFIG_PPC_BOOK3E
114 mtspr(SPRN_SPRG_TLB_EXFRAME, local_paca->extlb);
115#endif
116}
117
108static int __initdata paca_size; 118static int __initdata paca_size;
109 119
110void __init allocate_pacas(void) 120void __init allocate_pacas(void)
diff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c
index 5b38f6ae2b29..9021c4ad4bbd 100644
--- a/arch/powerpc/kernel/pci-common.c
+++ b/arch/powerpc/kernel/pci-common.c
@@ -21,6 +21,7 @@
21#include <linux/string.h> 21#include <linux/string.h>
22#include <linux/init.h> 22#include <linux/init.h>
23#include <linux/bootmem.h> 23#include <linux/bootmem.h>
24#include <linux/of_address.h>
24#include <linux/mm.h> 25#include <linux/mm.h>
25#include <linux/list.h> 26#include <linux/list.h>
26#include <linux/syscalls.h> 27#include <linux/syscalls.h>
diff --git a/arch/powerpc/kernel/perf_event.c b/arch/powerpc/kernel/perf_event.c
index 5c14ffe51258..d301a30445e0 100644
--- a/arch/powerpc/kernel/perf_event.c
+++ b/arch/powerpc/kernel/perf_event.c
@@ -410,15 +410,15 @@ static void power_pmu_read(struct perf_event *event)
410 * Therefore we treat them like NMIs. 410 * Therefore we treat them like NMIs.
411 */ 411 */
412 do { 412 do {
413 prev = atomic64_read(&event->hw.prev_count); 413 prev = local64_read(&event->hw.prev_count);
414 barrier(); 414 barrier();
415 val = read_pmc(event->hw.idx); 415 val = read_pmc(event->hw.idx);
416 } while (atomic64_cmpxchg(&event->hw.prev_count, prev, val) != prev); 416 } while (local64_cmpxchg(&event->hw.prev_count, prev, val) != prev);
417 417
418 /* The counters are only 32 bits wide */ 418 /* The counters are only 32 bits wide */
419 delta = (val - prev) & 0xfffffffful; 419 delta = (val - prev) & 0xfffffffful;
420 atomic64_add(delta, &event->count); 420 local64_add(delta, &event->count);
421 atomic64_sub(delta, &event->hw.period_left); 421 local64_sub(delta, &event->hw.period_left);
422} 422}
423 423
424/* 424/*
@@ -444,10 +444,10 @@ static void freeze_limited_counters(struct cpu_hw_events *cpuhw,
444 if (!event->hw.idx) 444 if (!event->hw.idx)
445 continue; 445 continue;
446 val = (event->hw.idx == 5) ? pmc5 : pmc6; 446 val = (event->hw.idx == 5) ? pmc5 : pmc6;
447 prev = atomic64_read(&event->hw.prev_count); 447 prev = local64_read(&event->hw.prev_count);
448 event->hw.idx = 0; 448 event->hw.idx = 0;
449 delta = (val - prev) & 0xfffffffful; 449 delta = (val - prev) & 0xfffffffful;
450 atomic64_add(delta, &event->count); 450 local64_add(delta, &event->count);
451 } 451 }
452} 452}
453 453
@@ -462,7 +462,7 @@ static void thaw_limited_counters(struct cpu_hw_events *cpuhw,
462 event = cpuhw->limited_counter[i]; 462 event = cpuhw->limited_counter[i];
463 event->hw.idx = cpuhw->limited_hwidx[i]; 463 event->hw.idx = cpuhw->limited_hwidx[i];
464 val = (event->hw.idx == 5) ? pmc5 : pmc6; 464 val = (event->hw.idx == 5) ? pmc5 : pmc6;
465 atomic64_set(&event->hw.prev_count, val); 465 local64_set(&event->hw.prev_count, val);
466 perf_event_update_userpage(event); 466 perf_event_update_userpage(event);
467 } 467 }
468} 468}
@@ -666,11 +666,11 @@ void hw_perf_enable(void)
666 } 666 }
667 val = 0; 667 val = 0;
668 if (event->hw.sample_period) { 668 if (event->hw.sample_period) {
669 left = atomic64_read(&event->hw.period_left); 669 left = local64_read(&event->hw.period_left);
670 if (left < 0x80000000L) 670 if (left < 0x80000000L)
671 val = 0x80000000L - left; 671 val = 0x80000000L - left;
672 } 672 }
673 atomic64_set(&event->hw.prev_count, val); 673 local64_set(&event->hw.prev_count, val);
674 event->hw.idx = idx; 674 event->hw.idx = idx;
675 write_pmc(idx, val); 675 write_pmc(idx, val);
676 perf_event_update_userpage(event); 676 perf_event_update_userpage(event);
@@ -754,7 +754,7 @@ static int power_pmu_enable(struct perf_event *event)
754 * skip the schedulability test here, it will be peformed 754 * skip the schedulability test here, it will be peformed
755 * at commit time(->commit_txn) as a whole 755 * at commit time(->commit_txn) as a whole
756 */ 756 */
757 if (cpuhw->group_flag & PERF_EVENT_TXN_STARTED) 757 if (cpuhw->group_flag & PERF_EVENT_TXN)
758 goto nocheck; 758 goto nocheck;
759 759
760 if (check_excludes(cpuhw->event, cpuhw->flags, n0, 1)) 760 if (check_excludes(cpuhw->event, cpuhw->flags, n0, 1))
@@ -845,8 +845,8 @@ static void power_pmu_unthrottle(struct perf_event *event)
845 if (left < 0x80000000L) 845 if (left < 0x80000000L)
846 val = 0x80000000L - left; 846 val = 0x80000000L - left;
847 write_pmc(event->hw.idx, val); 847 write_pmc(event->hw.idx, val);
848 atomic64_set(&event->hw.prev_count, val); 848 local64_set(&event->hw.prev_count, val);
849 atomic64_set(&event->hw.period_left, left); 849 local64_set(&event->hw.period_left, left);
850 perf_event_update_userpage(event); 850 perf_event_update_userpage(event);
851 perf_enable(); 851 perf_enable();
852 local_irq_restore(flags); 852 local_irq_restore(flags);
@@ -861,7 +861,7 @@ void power_pmu_start_txn(const struct pmu *pmu)
861{ 861{
862 struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events); 862 struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
863 863
864 cpuhw->group_flag |= PERF_EVENT_TXN_STARTED; 864 cpuhw->group_flag |= PERF_EVENT_TXN;
865 cpuhw->n_txn_start = cpuhw->n_events; 865 cpuhw->n_txn_start = cpuhw->n_events;
866} 866}
867 867
@@ -874,7 +874,7 @@ void power_pmu_cancel_txn(const struct pmu *pmu)
874{ 874{
875 struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events); 875 struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
876 876
877 cpuhw->group_flag &= ~PERF_EVENT_TXN_STARTED; 877 cpuhw->group_flag &= ~PERF_EVENT_TXN;
878} 878}
879 879
880/* 880/*
@@ -900,6 +900,7 @@ int power_pmu_commit_txn(const struct pmu *pmu)
900 for (i = cpuhw->n_txn_start; i < n; ++i) 900 for (i = cpuhw->n_txn_start; i < n; ++i)
901 cpuhw->event[i]->hw.config = cpuhw->events[i]; 901 cpuhw->event[i]->hw.config = cpuhw->events[i];
902 902
903 cpuhw->group_flag &= ~PERF_EVENT_TXN;
903 return 0; 904 return 0;
904} 905}
905 906
@@ -1111,7 +1112,7 @@ const struct pmu *hw_perf_event_init(struct perf_event *event)
1111 event->hw.config = events[n]; 1112 event->hw.config = events[n];
1112 event->hw.event_base = cflags[n]; 1113 event->hw.event_base = cflags[n];
1113 event->hw.last_period = event->hw.sample_period; 1114 event->hw.last_period = event->hw.sample_period;
1114 atomic64_set(&event->hw.period_left, event->hw.last_period); 1115 local64_set(&event->hw.period_left, event->hw.last_period);
1115 1116
1116 /* 1117 /*
1117 * See if we need to reserve the PMU. 1118 * See if we need to reserve the PMU.
@@ -1149,16 +1150,16 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
1149 int record = 0; 1150 int record = 0;
1150 1151
1151 /* we don't have to worry about interrupts here */ 1152 /* we don't have to worry about interrupts here */
1152 prev = atomic64_read(&event->hw.prev_count); 1153 prev = local64_read(&event->hw.prev_count);
1153 delta = (val - prev) & 0xfffffffful; 1154 delta = (val - prev) & 0xfffffffful;
1154 atomic64_add(delta, &event->count); 1155 local64_add(delta, &event->count);
1155 1156
1156 /* 1157 /*
1157 * See if the total period for this event has expired, 1158 * See if the total period for this event has expired,
1158 * and update for the next period. 1159 * and update for the next period.
1159 */ 1160 */
1160 val = 0; 1161 val = 0;
1161 left = atomic64_read(&event->hw.period_left) - delta; 1162 left = local64_read(&event->hw.period_left) - delta;
1162 if (period) { 1163 if (period) {
1163 if (left <= 0) { 1164 if (left <= 0) {
1164 left += period; 1165 left += period;
@@ -1196,8 +1197,8 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
1196 } 1197 }
1197 1198
1198 write_pmc(event->hw.idx, val); 1199 write_pmc(event->hw.idx, val);
1199 atomic64_set(&event->hw.prev_count, val); 1200 local64_set(&event->hw.prev_count, val);
1200 atomic64_set(&event->hw.period_left, left); 1201 local64_set(&event->hw.period_left, left);
1201 perf_event_update_userpage(event); 1202 perf_event_update_userpage(event);
1202} 1203}
1203 1204
diff --git a/arch/powerpc/kernel/perf_event_fsl_emb.c b/arch/powerpc/kernel/perf_event_fsl_emb.c
index 369872f6cf78..1ba45471ae43 100644
--- a/arch/powerpc/kernel/perf_event_fsl_emb.c
+++ b/arch/powerpc/kernel/perf_event_fsl_emb.c
@@ -162,15 +162,15 @@ static void fsl_emb_pmu_read(struct perf_event *event)
162 * Therefore we treat them like NMIs. 162 * Therefore we treat them like NMIs.
163 */ 163 */
164 do { 164 do {
165 prev = atomic64_read(&event->hw.prev_count); 165 prev = local64_read(&event->hw.prev_count);
166 barrier(); 166 barrier();
167 val = read_pmc(event->hw.idx); 167 val = read_pmc(event->hw.idx);
168 } while (atomic64_cmpxchg(&event->hw.prev_count, prev, val) != prev); 168 } while (local64_cmpxchg(&event->hw.prev_count, prev, val) != prev);
169 169
170 /* The counters are only 32 bits wide */ 170 /* The counters are only 32 bits wide */
171 delta = (val - prev) & 0xfffffffful; 171 delta = (val - prev) & 0xfffffffful;
172 atomic64_add(delta, &event->count); 172 local64_add(delta, &event->count);
173 atomic64_sub(delta, &event->hw.period_left); 173 local64_sub(delta, &event->hw.period_left);
174} 174}
175 175
176/* 176/*
@@ -296,11 +296,11 @@ static int fsl_emb_pmu_enable(struct perf_event *event)
296 296
297 val = 0; 297 val = 0;
298 if (event->hw.sample_period) { 298 if (event->hw.sample_period) {
299 s64 left = atomic64_read(&event->hw.period_left); 299 s64 left = local64_read(&event->hw.period_left);
300 if (left < 0x80000000L) 300 if (left < 0x80000000L)
301 val = 0x80000000L - left; 301 val = 0x80000000L - left;
302 } 302 }
303 atomic64_set(&event->hw.prev_count, val); 303 local64_set(&event->hw.prev_count, val);
304 write_pmc(i, val); 304 write_pmc(i, val);
305 perf_event_update_userpage(event); 305 perf_event_update_userpage(event);
306 306
@@ -371,8 +371,8 @@ static void fsl_emb_pmu_unthrottle(struct perf_event *event)
371 if (left < 0x80000000L) 371 if (left < 0x80000000L)
372 val = 0x80000000L - left; 372 val = 0x80000000L - left;
373 write_pmc(event->hw.idx, val); 373 write_pmc(event->hw.idx, val);
374 atomic64_set(&event->hw.prev_count, val); 374 local64_set(&event->hw.prev_count, val);
375 atomic64_set(&event->hw.period_left, left); 375 local64_set(&event->hw.period_left, left);
376 perf_event_update_userpage(event); 376 perf_event_update_userpage(event);
377 perf_enable(); 377 perf_enable();
378 local_irq_restore(flags); 378 local_irq_restore(flags);
@@ -500,7 +500,7 @@ const struct pmu *hw_perf_event_init(struct perf_event *event)
500 return ERR_PTR(-ENOTSUPP); 500 return ERR_PTR(-ENOTSUPP);
501 501
502 event->hw.last_period = event->hw.sample_period; 502 event->hw.last_period = event->hw.sample_period;
503 atomic64_set(&event->hw.period_left, event->hw.last_period); 503 local64_set(&event->hw.period_left, event->hw.last_period);
504 504
505 /* 505 /*
506 * See if we need to reserve the PMU. 506 * See if we need to reserve the PMU.
@@ -541,16 +541,16 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
541 int record = 0; 541 int record = 0;
542 542
543 /* we don't have to worry about interrupts here */ 543 /* we don't have to worry about interrupts here */
544 prev = atomic64_read(&event->hw.prev_count); 544 prev = local64_read(&event->hw.prev_count);
545 delta = (val - prev) & 0xfffffffful; 545 delta = (val - prev) & 0xfffffffful;
546 atomic64_add(delta, &event->count); 546 local64_add(delta, &event->count);
547 547
548 /* 548 /*
549 * See if the total period for this event has expired, 549 * See if the total period for this event has expired,
550 * and update for the next period. 550 * and update for the next period.
551 */ 551 */
552 val = 0; 552 val = 0;
553 left = atomic64_read(&event->hw.period_left) - delta; 553 left = local64_read(&event->hw.period_left) - delta;
554 if (period) { 554 if (period) {
555 if (left <= 0) { 555 if (left <= 0) {
556 left += period; 556 left += period;
@@ -566,9 +566,10 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
566 * Finally record data if requested. 566 * Finally record data if requested.
567 */ 567 */
568 if (record) { 568 if (record) {
569 struct perf_sample_data data = { 569 struct perf_sample_data data;
570 .period = event->hw.last_period, 570
571 }; 571 perf_sample_data_init(&data, 0);
572 data.period = event->hw.last_period;
572 573
573 if (perf_event_overflow(event, nmi, &data, regs)) { 574 if (perf_event_overflow(event, nmi, &data, regs)) {
574 /* 575 /*
@@ -584,8 +585,8 @@ static void record_and_restart(struct perf_event *event, unsigned long val,
584 } 585 }
585 586
586 write_pmc(event->hw.idx, val); 587 write_pmc(event->hw.idx, val);
587 atomic64_set(&event->hw.prev_count, val); 588 local64_set(&event->hw.prev_count, val);
588 atomic64_set(&event->hw.period_left, left); 589 local64_set(&event->hw.period_left, left);
589 perf_event_update_userpage(event); 590 perf_event_update_userpage(event);
590} 591}
591 592
diff --git a/arch/powerpc/kernel/ppc_ksyms.c b/arch/powerpc/kernel/ppc_ksyms.c
index 3b4dcc82a4c1..ab3e392ac63c 100644
--- a/arch/powerpc/kernel/ppc_ksyms.c
+++ b/arch/powerpc/kernel/ppc_ksyms.c
@@ -101,10 +101,6 @@ EXPORT_SYMBOL(pci_dram_offset);
101EXPORT_SYMBOL(start_thread); 101EXPORT_SYMBOL(start_thread);
102EXPORT_SYMBOL(kernel_thread); 102EXPORT_SYMBOL(kernel_thread);
103 103
104#ifdef CONFIG_PPC_FPU
105EXPORT_SYMBOL_GPL(cvt_df);
106EXPORT_SYMBOL_GPL(cvt_fd);
107#endif
108EXPORT_SYMBOL(giveup_fpu); 104EXPORT_SYMBOL(giveup_fpu);
109#ifdef CONFIG_ALTIVEC 105#ifdef CONFIG_ALTIVEC
110EXPORT_SYMBOL(giveup_altivec); 106EXPORT_SYMBOL(giveup_altivec);
diff --git a/arch/powerpc/kernel/process.c b/arch/powerpc/kernel/process.c
index 773424df828a..e78a5add7f15 100644
--- a/arch/powerpc/kernel/process.c
+++ b/arch/powerpc/kernel/process.c
@@ -37,6 +37,7 @@
37#include <linux/kernel_stat.h> 37#include <linux/kernel_stat.h>
38#include <linux/personality.h> 38#include <linux/personality.h>
39#include <linux/random.h> 39#include <linux/random.h>
40#include <linux/hw_breakpoint.h>
40 41
41#include <asm/pgtable.h> 42#include <asm/pgtable.h>
42#include <asm/uaccess.h> 43#include <asm/uaccess.h>
@@ -462,14 +463,42 @@ struct task_struct *__switch_to(struct task_struct *prev,
462#ifdef CONFIG_PPC_ADV_DEBUG_REGS 463#ifdef CONFIG_PPC_ADV_DEBUG_REGS
463 switch_booke_debug_regs(&new->thread); 464 switch_booke_debug_regs(&new->thread);
464#else 465#else
466/*
467 * For PPC_BOOK3S_64, we use the hw-breakpoint interfaces that would
468 * schedule DABR
469 */
470#ifndef CONFIG_HAVE_HW_BREAKPOINT
465 if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr)) 471 if (unlikely(__get_cpu_var(current_dabr) != new->thread.dabr))
466 set_dabr(new->thread.dabr); 472 set_dabr(new->thread.dabr);
473#endif /* CONFIG_HAVE_HW_BREAKPOINT */
467#endif 474#endif
468 475
469 476
470 new_thread = &new->thread; 477 new_thread = &new->thread;
471 old_thread = &current->thread; 478 old_thread = &current->thread;
472 479
480#if defined(CONFIG_PPC_BOOK3E_64)
481 /* XXX Current Book3E code doesn't deal with kernel side DBCR0,
482 * we always hold the user values, so we set it now.
483 *
484 * However, we ensure the kernel MSR:DE is appropriately cleared too
485 * to avoid spurrious single step exceptions in the kernel.
486 *
487 * This will have to change to merge with the ppc32 code at some point,
488 * but I don't like much what ppc32 is doing today so there's some
489 * thinking needed there
490 */
491 if ((new_thread->dbcr0 | old_thread->dbcr0) & DBCR0_IDM) {
492 u32 dbcr0;
493
494 mtmsr(mfmsr() & ~MSR_DE);
495 isync();
496 dbcr0 = mfspr(SPRN_DBCR0);
497 dbcr0 = (dbcr0 & DBCR0_EDM) | new_thread->dbcr0;
498 mtspr(SPRN_DBCR0, dbcr0);
499 }
500#endif /* CONFIG_PPC64_BOOK3E */
501
473#ifdef CONFIG_PPC64 502#ifdef CONFIG_PPC64
474 /* 503 /*
475 * Collect processor utilization data per process 504 * Collect processor utilization data per process
@@ -642,7 +671,11 @@ void flush_thread(void)
642{ 671{
643 discard_lazy_cpu_state(); 672 discard_lazy_cpu_state();
644 673
674#ifdef CONFIG_HAVE_HW_BREAKPOINTS
675 flush_ptrace_hw_breakpoint(current);
676#else /* CONFIG_HAVE_HW_BREAKPOINTS */
645 set_debug_reg_defaults(&current->thread); 677 set_debug_reg_defaults(&current->thread);
678#endif /* CONFIG_HAVE_HW_BREAKPOINTS */
646} 679}
647 680
648void 681void
@@ -660,6 +693,9 @@ void prepare_to_copy(struct task_struct *tsk)
660 flush_altivec_to_thread(current); 693 flush_altivec_to_thread(current);
661 flush_vsx_to_thread(current); 694 flush_vsx_to_thread(current);
662 flush_spe_to_thread(current); 695 flush_spe_to_thread(current);
696#ifdef CONFIG_HAVE_HW_BREAKPOINT
697 flush_ptrace_hw_breakpoint(tsk);
698#endif /* CONFIG_HAVE_HW_BREAKPOINT */
663} 699}
664 700
665/* 701/*
@@ -1263,3 +1299,14 @@ unsigned long randomize_et_dyn(unsigned long base)
1263 1299
1264 return ret; 1300 return ret;
1265} 1301}
1302
1303#ifdef CONFIG_SMP
1304int arch_sd_sibling_asym_packing(void)
1305{
1306 if (cpu_has_feature(CPU_FTR_ASYM_SMT)) {
1307 printk_once(KERN_INFO "Enabling Asymmetric SMT scheduling\n");
1308 return SD_ASYM_PACKING;
1309 }
1310 return 0;
1311}
1312#endif
diff --git a/arch/powerpc/kernel/prom_init.c b/arch/powerpc/kernel/prom_init.c
index 3b6f8ae9b8cc..941ff4dbc567 100644
--- a/arch/powerpc/kernel/prom_init.c
+++ b/arch/powerpc/kernel/prom_init.c
@@ -311,6 +311,24 @@ static void __init prom_print_hex(unsigned long val)
311 call_prom("write", 3, 1, _prom->stdout, buf, nibbles); 311 call_prom("write", 3, 1, _prom->stdout, buf, nibbles);
312} 312}
313 313
314/* max number of decimal digits in an unsigned long */
315#define UL_DIGITS 21
316static void __init prom_print_dec(unsigned long val)
317{
318 int i, size;
319 char buf[UL_DIGITS+1];
320 struct prom_t *_prom = &RELOC(prom);
321
322 for (i = UL_DIGITS-1; i >= 0; i--) {
323 buf[i] = (val % 10) + '0';
324 val = val/10;
325 if (val == 0)
326 break;
327 }
328 /* shift stuff down */
329 size = UL_DIGITS - i;
330 call_prom("write", 3, 1, _prom->stdout, buf+i, size);
331}
314 332
315static void __init prom_printf(const char *format, ...) 333static void __init prom_printf(const char *format, ...)
316{ 334{
@@ -350,6 +368,14 @@ static void __init prom_printf(const char *format, ...)
350 v = va_arg(args, unsigned long); 368 v = va_arg(args, unsigned long);
351 prom_print_hex(v); 369 prom_print_hex(v);
352 break; 370 break;
371 case 'l':
372 ++q;
373 if (*q == 'u') { /* '%lu' */
374 ++q;
375 v = va_arg(args, unsigned long);
376 prom_print_dec(v);
377 }
378 break;
353 } 379 }
354 } 380 }
355} 381}
@@ -835,11 +861,11 @@ static int __init prom_count_smt_threads(void)
835 if (plen == PROM_ERROR) 861 if (plen == PROM_ERROR)
836 break; 862 break;
837 plen >>= 2; 863 plen >>= 2;
838 prom_debug("Found 0x%x smt threads per core\n", (unsigned long)plen); 864 prom_debug("Found %lu smt threads per core\n", (unsigned long)plen);
839 865
840 /* Sanity check */ 866 /* Sanity check */
841 if (plen < 1 || plen > 64) { 867 if (plen < 1 || plen > 64) {
842 prom_printf("Threads per core 0x%x out of bounds, assuming 1\n", 868 prom_printf("Threads per core %lu out of bounds, assuming 1\n",
843 (unsigned long)plen); 869 (unsigned long)plen);
844 return 1; 870 return 1;
845 } 871 }
@@ -869,12 +895,12 @@ static void __init prom_send_capabilities(void)
869 cores = (u32 *)PTRRELOC(&ibm_architecture_vec[IBM_ARCH_VEC_NRCORES_OFFSET]); 895 cores = (u32 *)PTRRELOC(&ibm_architecture_vec[IBM_ARCH_VEC_NRCORES_OFFSET]);
870 if (*cores != NR_CPUS) { 896 if (*cores != NR_CPUS) {
871 prom_printf("WARNING ! " 897 prom_printf("WARNING ! "
872 "ibm_architecture_vec structure inconsistent: 0x%x !\n", 898 "ibm_architecture_vec structure inconsistent: %lu!\n",
873 *cores); 899 *cores);
874 } else { 900 } else {
875 *cores = DIV_ROUND_UP(NR_CPUS, prom_count_smt_threads()); 901 *cores = DIV_ROUND_UP(NR_CPUS, prom_count_smt_threads());
876 prom_printf("Max number of cores passed to firmware: 0x%x\n", 902 prom_printf("Max number of cores passed to firmware: %lu (NR_CPUS = %lu)\n",
877 (unsigned long)*cores); 903 *cores, NR_CPUS);
878 } 904 }
879 905
880 /* try calling the ibm,client-architecture-support method */ 906 /* try calling the ibm,client-architecture-support method */
@@ -1482,7 +1508,7 @@ static void __init prom_hold_cpus(void)
1482 reg = -1; 1508 reg = -1;
1483 prom_getprop(node, "reg", &reg, sizeof(reg)); 1509 prom_getprop(node, "reg", &reg, sizeof(reg));
1484 1510
1485 prom_debug("cpu hw idx = 0x%x\n", reg); 1511 prom_debug("cpu hw idx = %lu\n", reg);
1486 1512
1487 /* Init the acknowledge var which will be reset by 1513 /* Init the acknowledge var which will be reset by
1488 * the secondary cpu when it awakens from its OF 1514 * the secondary cpu when it awakens from its OF
@@ -1492,7 +1518,7 @@ static void __init prom_hold_cpus(void)
1492 1518
1493 if (reg != _prom->cpu) { 1519 if (reg != _prom->cpu) {
1494 /* Primary Thread of non-boot cpu */ 1520 /* Primary Thread of non-boot cpu */
1495 prom_printf("starting cpu hw idx %x... ", reg); 1521 prom_printf("starting cpu hw idx %lu... ", reg);
1496 call_prom("start-cpu", 3, 0, node, 1522 call_prom("start-cpu", 3, 0, node,
1497 secondary_hold, reg); 1523 secondary_hold, reg);
1498 1524
@@ -1507,7 +1533,7 @@ static void __init prom_hold_cpus(void)
1507 } 1533 }
1508#ifdef CONFIG_SMP 1534#ifdef CONFIG_SMP
1509 else 1535 else
1510 prom_printf("boot cpu hw idx %x\n", reg); 1536 prom_printf("boot cpu hw idx %lu\n", reg);
1511#endif /* CONFIG_SMP */ 1537#endif /* CONFIG_SMP */
1512 } 1538 }
1513 1539
@@ -2420,7 +2446,7 @@ static void __init prom_find_boot_cpu(void)
2420 prom_getprop(cpu_pkg, "reg", &getprop_rval, sizeof(getprop_rval)); 2446 prom_getprop(cpu_pkg, "reg", &getprop_rval, sizeof(getprop_rval));
2421 _prom->cpu = getprop_rval; 2447 _prom->cpu = getprop_rval;
2422 2448
2423 prom_debug("Booting CPU hw index = 0x%x\n", _prom->cpu); 2449 prom_debug("Booting CPU hw index = %lu\n", _prom->cpu);
2424} 2450}
2425 2451
2426static void __init prom_check_initrd(unsigned long r3, unsigned long r4) 2452static void __init prom_check_initrd(unsigned long r3, unsigned long r4)
diff --git a/arch/powerpc/kernel/prom_parse.c b/arch/powerpc/kernel/prom_parse.c
index 8362620c9e6f..88334af038e5 100644
--- a/arch/powerpc/kernel/prom_parse.c
+++ b/arch/powerpc/kernel/prom_parse.c
@@ -6,232 +6,11 @@
6#include <linux/module.h> 6#include <linux/module.h>
7#include <linux/ioport.h> 7#include <linux/ioport.h>
8#include <linux/etherdevice.h> 8#include <linux/etherdevice.h>
9#include <linux/of_address.h>
9#include <asm/prom.h> 10#include <asm/prom.h>
10#include <asm/pci-bridge.h> 11#include <asm/pci-bridge.h>
11 12
12#ifdef DEBUG
13#define DBG(fmt...) do { printk(fmt); } while(0)
14#else
15#define DBG(fmt...) do { } while(0)
16#endif
17
18#ifdef CONFIG_PPC64
19#define PRu64 "%lx"
20#else
21#define PRu64 "%llx"
22#endif
23
24/* Max address size we deal with */
25#define OF_MAX_ADDR_CELLS 4
26#define OF_CHECK_COUNTS(na, ns) ((na) > 0 && (na) <= OF_MAX_ADDR_CELLS && \
27 (ns) > 0)
28
29static struct of_bus *of_match_bus(struct device_node *np);
30static int __of_address_to_resource(struct device_node *dev,
31 const u32 *addrp, u64 size, unsigned int flags,
32 struct resource *r);
33
34
35/* Debug utility */
36#ifdef DEBUG
37static void of_dump_addr(const char *s, const u32 *addr, int na)
38{
39 printk("%s", s);
40 while(na--)
41 printk(" %08x", *(addr++));
42 printk("\n");
43}
44#else
45static void of_dump_addr(const char *s, const u32 *addr, int na) { }
46#endif
47
48
49/* Callbacks for bus specific translators */
50struct of_bus {
51 const char *name;
52 const char *addresses;
53 int (*match)(struct device_node *parent);
54 void (*count_cells)(struct device_node *child,
55 int *addrc, int *sizec);
56 u64 (*map)(u32 *addr, const u32 *range,
57 int na, int ns, int pna);
58 int (*translate)(u32 *addr, u64 offset, int na);
59 unsigned int (*get_flags)(const u32 *addr);
60};
61
62
63/*
64 * Default translator (generic bus)
65 */
66
67static void of_bus_default_count_cells(struct device_node *dev,
68 int *addrc, int *sizec)
69{
70 if (addrc)
71 *addrc = of_n_addr_cells(dev);
72 if (sizec)
73 *sizec = of_n_size_cells(dev);
74}
75
76static u64 of_bus_default_map(u32 *addr, const u32 *range,
77 int na, int ns, int pna)
78{
79 u64 cp, s, da;
80
81 cp = of_read_number(range, na);
82 s = of_read_number(range + na + pna, ns);
83 da = of_read_number(addr, na);
84
85 DBG("OF: default map, cp="PRu64", s="PRu64", da="PRu64"\n",
86 cp, s, da);
87
88 if (da < cp || da >= (cp + s))
89 return OF_BAD_ADDR;
90 return da - cp;
91}
92
93static int of_bus_default_translate(u32 *addr, u64 offset, int na)
94{
95 u64 a = of_read_number(addr, na);
96 memset(addr, 0, na * 4);
97 a += offset;
98 if (na > 1)
99 addr[na - 2] = a >> 32;
100 addr[na - 1] = a & 0xffffffffu;
101
102 return 0;
103}
104
105static unsigned int of_bus_default_get_flags(const u32 *addr)
106{
107 return IORESOURCE_MEM;
108}
109
110
111#ifdef CONFIG_PCI 13#ifdef CONFIG_PCI
112/*
113 * PCI bus specific translator
114 */
115
116static int of_bus_pci_match(struct device_node *np)
117{
118 /* "vci" is for the /chaos bridge on 1st-gen PCI powermacs */
119 return !strcmp(np->type, "pci") || !strcmp(np->type, "vci");
120}
121
122static void of_bus_pci_count_cells(struct device_node *np,
123 int *addrc, int *sizec)
124{
125 if (addrc)
126 *addrc = 3;
127 if (sizec)
128 *sizec = 2;
129}
130
131static unsigned int of_bus_pci_get_flags(const u32 *addr)
132{
133 unsigned int flags = 0;
134 u32 w = addr[0];
135
136 switch((w >> 24) & 0x03) {
137 case 0x01:
138 flags |= IORESOURCE_IO;
139 break;
140 case 0x02: /* 32 bits */
141 case 0x03: /* 64 bits */
142 flags |= IORESOURCE_MEM;
143 break;
144 }
145 if (w & 0x40000000)
146 flags |= IORESOURCE_PREFETCH;
147 return flags;
148}
149
150static u64 of_bus_pci_map(u32 *addr, const u32 *range, int na, int ns, int pna)
151{
152 u64 cp, s, da;
153 unsigned int af, rf;
154
155 af = of_bus_pci_get_flags(addr);
156 rf = of_bus_pci_get_flags(range);
157
158 /* Check address type match */
159 if ((af ^ rf) & (IORESOURCE_MEM | IORESOURCE_IO))
160 return OF_BAD_ADDR;
161
162 /* Read address values, skipping high cell */
163 cp = of_read_number(range + 1, na - 1);
164 s = of_read_number(range + na + pna, ns);
165 da = of_read_number(addr + 1, na - 1);
166
167 DBG("OF: PCI map, cp="PRu64", s="PRu64", da="PRu64"\n", cp, s, da);
168
169 if (da < cp || da >= (cp + s))
170 return OF_BAD_ADDR;
171 return da - cp;
172}
173
174static int of_bus_pci_translate(u32 *addr, u64 offset, int na)
175{
176 return of_bus_default_translate(addr + 1, offset, na - 1);
177}
178
179const u32 *of_get_pci_address(struct device_node *dev, int bar_no, u64 *size,
180 unsigned int *flags)
181{
182 const u32 *prop;
183 unsigned int psize;
184 struct device_node *parent;
185 struct of_bus *bus;
186 int onesize, i, na, ns;
187
188 /* Get parent & match bus type */
189 parent = of_get_parent(dev);
190 if (parent == NULL)
191 return NULL;
192 bus = of_match_bus(parent);
193 if (strcmp(bus->name, "pci")) {
194 of_node_put(parent);
195 return NULL;
196 }
197 bus->count_cells(dev, &na, &ns);
198 of_node_put(parent);
199 if (!OF_CHECK_COUNTS(na, ns))
200 return NULL;
201
202 /* Get "reg" or "assigned-addresses" property */
203 prop = of_get_property(dev, bus->addresses, &psize);
204 if (prop == NULL)
205 return NULL;
206 psize /= 4;
207
208 onesize = na + ns;
209 for (i = 0; psize >= onesize; psize -= onesize, prop += onesize, i++)
210 if ((prop[0] & 0xff) == ((bar_no * 4) + PCI_BASE_ADDRESS_0)) {
211 if (size)
212 *size = of_read_number(prop + na, ns);
213 if (flags)
214 *flags = bus->get_flags(prop);
215 return prop;
216 }
217 return NULL;
218}
219EXPORT_SYMBOL(of_get_pci_address);
220
221int of_pci_address_to_resource(struct device_node *dev, int bar,
222 struct resource *r)
223{
224 const u32 *addrp;
225 u64 size;
226 unsigned int flags;
227
228 addrp = of_get_pci_address(dev, bar, &size, &flags);
229 if (addrp == NULL)
230 return -EINVAL;
231 return __of_address_to_resource(dev, addrp, size, flags, r);
232}
233EXPORT_SYMBOL_GPL(of_pci_address_to_resource);
234
235int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq) 14int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq)
236{ 15{
237 struct device_node *dn, *ppnode; 16 struct device_node *dn, *ppnode;
@@ -313,345 +92,6 @@ int of_irq_map_pci(struct pci_dev *pdev, struct of_irq *out_irq)
313EXPORT_SYMBOL_GPL(of_irq_map_pci); 92EXPORT_SYMBOL_GPL(of_irq_map_pci);
314#endif /* CONFIG_PCI */ 93#endif /* CONFIG_PCI */
315 94
316/*
317 * ISA bus specific translator
318 */
319
320static int of_bus_isa_match(struct device_node *np)
321{
322 return !strcmp(np->name, "isa");
323}
324
325static void of_bus_isa_count_cells(struct device_node *child,
326 int *addrc, int *sizec)
327{
328 if (addrc)
329 *addrc = 2;
330 if (sizec)
331 *sizec = 1;
332}
333
334static u64 of_bus_isa_map(u32 *addr, const u32 *range, int na, int ns, int pna)
335{
336 u64 cp, s, da;
337
338 /* Check address type match */
339 if ((addr[0] ^ range[0]) & 0x00000001)
340 return OF_BAD_ADDR;
341
342 /* Read address values, skipping high cell */
343 cp = of_read_number(range + 1, na - 1);
344 s = of_read_number(range + na + pna, ns);
345 da = of_read_number(addr + 1, na - 1);
346
347 DBG("OF: ISA map, cp="PRu64", s="PRu64", da="PRu64"\n", cp, s, da);
348
349 if (da < cp || da >= (cp + s))
350 return OF_BAD_ADDR;
351 return da - cp;
352}
353
354static int of_bus_isa_translate(u32 *addr, u64 offset, int na)
355{
356 return of_bus_default_translate(addr + 1, offset, na - 1);
357}
358
359static unsigned int of_bus_isa_get_flags(const u32 *addr)
360{
361 unsigned int flags = 0;
362 u32 w = addr[0];
363
364 if (w & 1)
365 flags |= IORESOURCE_IO;
366 else
367 flags |= IORESOURCE_MEM;
368 return flags;
369}
370
371
372/*
373 * Array of bus specific translators
374 */
375
376static struct of_bus of_busses[] = {
377#ifdef CONFIG_PCI
378 /* PCI */
379 {
380 .name = "pci",
381 .addresses = "assigned-addresses",
382 .match = of_bus_pci_match,
383 .count_cells = of_bus_pci_count_cells,
384 .map = of_bus_pci_map,
385 .translate = of_bus_pci_translate,
386 .get_flags = of_bus_pci_get_flags,
387 },
388#endif /* CONFIG_PCI */
389 /* ISA */
390 {
391 .name = "isa",
392 .addresses = "reg",
393 .match = of_bus_isa_match,
394 .count_cells = of_bus_isa_count_cells,
395 .map = of_bus_isa_map,
396 .translate = of_bus_isa_translate,
397 .get_flags = of_bus_isa_get_flags,
398 },
399 /* Default */
400 {
401 .name = "default",
402 .addresses = "reg",
403 .match = NULL,
404 .count_cells = of_bus_default_count_cells,
405 .map = of_bus_default_map,
406 .translate = of_bus_default_translate,
407 .get_flags = of_bus_default_get_flags,
408 },
409};
410
411static struct of_bus *of_match_bus(struct device_node *np)
412{
413 int i;
414
415 for (i = 0; i < ARRAY_SIZE(of_busses); i ++)
416 if (!of_busses[i].match || of_busses[i].match(np))
417 return &of_busses[i];
418 BUG();
419 return NULL;
420}
421
422static int of_translate_one(struct device_node *parent, struct of_bus *bus,
423 struct of_bus *pbus, u32 *addr,
424 int na, int ns, int pna, const char *rprop)
425{
426 const u32 *ranges;
427 unsigned int rlen;
428 int rone;
429 u64 offset = OF_BAD_ADDR;
430
431 /* Normally, an absence of a "ranges" property means we are
432 * crossing a non-translatable boundary, and thus the addresses
433 * below the current not cannot be converted to CPU physical ones.
434 * Unfortunately, while this is very clear in the spec, it's not
435 * what Apple understood, and they do have things like /uni-n or
436 * /ht nodes with no "ranges" property and a lot of perfectly
437 * useable mapped devices below them. Thus we treat the absence of
438 * "ranges" as equivalent to an empty "ranges" property which means
439 * a 1:1 translation at that level. It's up to the caller not to try
440 * to translate addresses that aren't supposed to be translated in
441 * the first place. --BenH.
442 */
443 ranges = of_get_property(parent, rprop, &rlen);
444 if (ranges == NULL || rlen == 0) {
445 offset = of_read_number(addr, na);
446 memset(addr, 0, pna * 4);
447 DBG("OF: no ranges, 1:1 translation\n");
448 goto finish;
449 }
450
451 DBG("OF: walking ranges...\n");
452
453 /* Now walk through the ranges */
454 rlen /= 4;
455 rone = na + pna + ns;
456 for (; rlen >= rone; rlen -= rone, ranges += rone) {
457 offset = bus->map(addr, ranges, na, ns, pna);
458 if (offset != OF_BAD_ADDR)
459 break;
460 }
461 if (offset == OF_BAD_ADDR) {
462 DBG("OF: not found !\n");
463 return 1;
464 }
465 memcpy(addr, ranges + na, 4 * pna);
466
467 finish:
468 of_dump_addr("OF: parent translation for:", addr, pna);
469 DBG("OF: with offset: "PRu64"\n", offset);
470
471 /* Translate it into parent bus space */
472 return pbus->translate(addr, offset, pna);
473}
474
475
476/*
477 * Translate an address from the device-tree into a CPU physical address,
478 * this walks up the tree and applies the various bus mappings on the
479 * way.
480 *
481 * Note: We consider that crossing any level with #size-cells == 0 to mean
482 * that translation is impossible (that is we are not dealing with a value
483 * that can be mapped to a cpu physical address). This is not really specified
484 * that way, but this is traditionally the way IBM at least do things
485 */
486u64 __of_translate_address(struct device_node *dev, const u32 *in_addr,
487 const char *rprop)
488{
489 struct device_node *parent = NULL;
490 struct of_bus *bus, *pbus;
491 u32 addr[OF_MAX_ADDR_CELLS];
492 int na, ns, pna, pns;
493 u64 result = OF_BAD_ADDR;
494
495 DBG("OF: ** translation for device %s **\n", dev->full_name);
496
497 /* Increase refcount at current level */
498 of_node_get(dev);
499
500 /* Get parent & match bus type */
501 parent = of_get_parent(dev);
502 if (parent == NULL)
503 goto bail;
504 bus = of_match_bus(parent);
505
506 /* Cound address cells & copy address locally */
507 bus->count_cells(dev, &na, &ns);
508 if (!OF_CHECK_COUNTS(na, ns)) {
509 printk(KERN_ERR "prom_parse: Bad cell count for %s\n",
510 dev->full_name);
511 goto bail;
512 }
513 memcpy(addr, in_addr, na * 4);
514
515 DBG("OF: bus is %s (na=%d, ns=%d) on %s\n",
516 bus->name, na, ns, parent->full_name);
517 of_dump_addr("OF: translating address:", addr, na);
518
519 /* Translate */
520 for (;;) {
521 /* Switch to parent bus */
522 of_node_put(dev);
523 dev = parent;
524 parent = of_get_parent(dev);
525
526 /* If root, we have finished */
527 if (parent == NULL) {
528 DBG("OF: reached root node\n");
529 result = of_read_number(addr, na);
530 break;
531 }
532
533 /* Get new parent bus and counts */
534 pbus = of_match_bus(parent);
535 pbus->count_cells(dev, &pna, &pns);
536 if (!OF_CHECK_COUNTS(pna, pns)) {
537 printk(KERN_ERR "prom_parse: Bad cell count for %s\n",
538 dev->full_name);
539 break;
540 }
541
542 DBG("OF: parent bus is %s (na=%d, ns=%d) on %s\n",
543 pbus->name, pna, pns, parent->full_name);
544
545 /* Apply bus translation */
546 if (of_translate_one(dev, bus, pbus, addr, na, ns, pna, rprop))
547 break;
548
549 /* Complete the move up one level */
550 na = pna;
551 ns = pns;
552 bus = pbus;
553
554 of_dump_addr("OF: one level translation:", addr, na);
555 }
556 bail:
557 of_node_put(parent);
558 of_node_put(dev);
559
560 return result;
561}
562
563u64 of_translate_address(struct device_node *dev, const u32 *in_addr)
564{
565 return __of_translate_address(dev, in_addr, "ranges");
566}
567EXPORT_SYMBOL(of_translate_address);
568
569u64 of_translate_dma_address(struct device_node *dev, const u32 *in_addr)
570{
571 return __of_translate_address(dev, in_addr, "dma-ranges");
572}
573EXPORT_SYMBOL(of_translate_dma_address);
574
575const u32 *of_get_address(struct device_node *dev, int index, u64 *size,
576 unsigned int *flags)
577{
578 const u32 *prop;
579 unsigned int psize;
580 struct device_node *parent;
581 struct of_bus *bus;
582 int onesize, i, na, ns;
583
584 /* Get parent & match bus type */
585 parent = of_get_parent(dev);
586 if (parent == NULL)
587 return NULL;
588 bus = of_match_bus(parent);
589 bus->count_cells(dev, &na, &ns);
590 of_node_put(parent);
591 if (!OF_CHECK_COUNTS(na, ns))
592 return NULL;
593
594 /* Get "reg" or "assigned-addresses" property */
595 prop = of_get_property(dev, bus->addresses, &psize);
596 if (prop == NULL)
597 return NULL;
598 psize /= 4;
599
600 onesize = na + ns;
601 for (i = 0; psize >= onesize; psize -= onesize, prop += onesize, i++)
602 if (i == index) {
603 if (size)
604 *size = of_read_number(prop + na, ns);
605 if (flags)
606 *flags = bus->get_flags(prop);
607 return prop;
608 }
609 return NULL;
610}
611EXPORT_SYMBOL(of_get_address);
612
613static int __of_address_to_resource(struct device_node *dev, const u32 *addrp,
614 u64 size, unsigned int flags,
615 struct resource *r)
616{
617 u64 taddr;
618
619 if ((flags & (IORESOURCE_IO | IORESOURCE_MEM)) == 0)
620 return -EINVAL;
621 taddr = of_translate_address(dev, addrp);
622 if (taddr == OF_BAD_ADDR)
623 return -EINVAL;
624 memset(r, 0, sizeof(struct resource));
625 if (flags & IORESOURCE_IO) {
626 unsigned long port;
627 port = pci_address_to_pio(taddr);
628 if (port == (unsigned long)-1)
629 return -EINVAL;
630 r->start = port;
631 r->end = port + size - 1;
632 } else {
633 r->start = taddr;
634 r->end = taddr + size - 1;
635 }
636 r->flags = flags;
637 r->name = dev->name;
638 return 0;
639}
640
641int of_address_to_resource(struct device_node *dev, int index,
642 struct resource *r)
643{
644 const u32 *addrp;
645 u64 size;
646 unsigned int flags;
647
648 addrp = of_get_address(dev, index, &size, &flags);
649 if (addrp == NULL)
650 return -EINVAL;
651 return __of_address_to_resource(dev, addrp, size, flags, r);
652}
653EXPORT_SYMBOL_GPL(of_address_to_resource);
654
655void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop, 95void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
656 unsigned long *busno, unsigned long *phys, unsigned long *size) 96 unsigned long *busno, unsigned long *phys, unsigned long *size)
657{ 97{
@@ -678,342 +118,6 @@ void of_parse_dma_window(struct device_node *dn, const void *dma_window_prop,
678 *size = of_read_number(dma_window, cells); 118 *size = of_read_number(dma_window, cells);
679} 119}
680 120
681/*
682 * Interrupt remapper
683 */
684
685static unsigned int of_irq_workarounds;
686static struct device_node *of_irq_dflt_pic;
687
688static struct device_node *of_irq_find_parent(struct device_node *child)
689{
690 struct device_node *p;
691 const phandle *parp;
692
693 if (!of_node_get(child))
694 return NULL;
695
696 do {
697 parp = of_get_property(child, "interrupt-parent", NULL);
698 if (parp == NULL)
699 p = of_get_parent(child);
700 else {
701 if (of_irq_workarounds & OF_IMAP_NO_PHANDLE)
702 p = of_node_get(of_irq_dflt_pic);
703 else
704 p = of_find_node_by_phandle(*parp);
705 }
706 of_node_put(child);
707 child = p;
708 } while (p && of_get_property(p, "#interrupt-cells", NULL) == NULL);
709
710 return p;
711}
712
713/* This doesn't need to be called if you don't have any special workaround
714 * flags to pass
715 */
716void of_irq_map_init(unsigned int flags)
717{
718 of_irq_workarounds = flags;
719
720 /* OldWorld, don't bother looking at other things */
721 if (flags & OF_IMAP_OLDWORLD_MAC)
722 return;
723
724 /* If we don't have phandles, let's try to locate a default interrupt
725 * controller (happens when booting with BootX). We do a first match
726 * here, hopefully, that only ever happens on machines with one
727 * controller.
728 */
729 if (flags & OF_IMAP_NO_PHANDLE) {
730 struct device_node *np;
731
732 for_each_node_with_property(np, "interrupt-controller") {
733 /* Skip /chosen/interrupt-controller */
734 if (strcmp(np->name, "chosen") == 0)
735 continue;
736 /* It seems like at least one person on this planet wants
737 * to use BootX on a machine with an AppleKiwi controller
738 * which happens to pretend to be an interrupt
739 * controller too.
740 */
741 if (strcmp(np->name, "AppleKiwi") == 0)
742 continue;
743 /* I think we found one ! */
744 of_irq_dflt_pic = np;
745 break;
746 }
747 }
748
749}
750
751int of_irq_map_raw(struct device_node *parent, const u32 *intspec, u32 ointsize,
752 const u32 *addr, struct of_irq *out_irq)
753{
754 struct device_node *ipar, *tnode, *old = NULL, *newpar = NULL;
755 const u32 *tmp, *imap, *imask;
756 u32 intsize = 1, addrsize, newintsize = 0, newaddrsize = 0;
757 int imaplen, match, i;
758
759 DBG("of_irq_map_raw: par=%s,intspec=[0x%08x 0x%08x...],ointsize=%d\n",
760 parent->full_name, intspec[0], intspec[1], ointsize);
761
762 ipar = of_node_get(parent);
763
764 /* First get the #interrupt-cells property of the current cursor
765 * that tells us how to interpret the passed-in intspec. If there
766 * is none, we are nice and just walk up the tree
767 */
768 do {
769 tmp = of_get_property(ipar, "#interrupt-cells", NULL);
770 if (tmp != NULL) {
771 intsize = *tmp;
772 break;
773 }
774 tnode = ipar;
775 ipar = of_irq_find_parent(ipar);
776 of_node_put(tnode);
777 } while (ipar);
778 if (ipar == NULL) {
779 DBG(" -> no parent found !\n");
780 goto fail;
781 }
782
783 DBG("of_irq_map_raw: ipar=%s, size=%d\n", ipar->full_name, intsize);
784
785 if (ointsize != intsize)
786 return -EINVAL;
787
788 /* Look for this #address-cells. We have to implement the old linux
789 * trick of looking for the parent here as some device-trees rely on it
790 */
791 old = of_node_get(ipar);
792 do {
793 tmp = of_get_property(old, "#address-cells", NULL);
794 tnode = of_get_parent(old);
795 of_node_put(old);
796 old = tnode;
797 } while(old && tmp == NULL);
798 of_node_put(old);
799 old = NULL;
800 addrsize = (tmp == NULL) ? 2 : *tmp;
801
802 DBG(" -> addrsize=%d\n", addrsize);
803
804 /* Now start the actual "proper" walk of the interrupt tree */
805 while (ipar != NULL) {
806 /* Now check if cursor is an interrupt-controller and if it is
807 * then we are done
808 */
809 if (of_get_property(ipar, "interrupt-controller", NULL) !=
810 NULL) {
811 DBG(" -> got it !\n");
812 memcpy(out_irq->specifier, intspec,
813 intsize * sizeof(u32));
814 out_irq->size = intsize;
815 out_irq->controller = ipar;
816 of_node_put(old);
817 return 0;
818 }
819
820 /* Now look for an interrupt-map */
821 imap = of_get_property(ipar, "interrupt-map", &imaplen);
822 /* No interrupt map, check for an interrupt parent */
823 if (imap == NULL) {
824 DBG(" -> no map, getting parent\n");
825 newpar = of_irq_find_parent(ipar);
826 goto skiplevel;
827 }
828 imaplen /= sizeof(u32);
829
830 /* Look for a mask */
831 imask = of_get_property(ipar, "interrupt-map-mask", NULL);
832
833 /* If we were passed no "reg" property and we attempt to parse
834 * an interrupt-map, then #address-cells must be 0.
835 * Fail if it's not.
836 */
837 if (addr == NULL && addrsize != 0) {
838 DBG(" -> no reg passed in when needed !\n");
839 goto fail;
840 }
841
842 /* Parse interrupt-map */
843 match = 0;
844 while (imaplen > (addrsize + intsize + 1) && !match) {
845 /* Compare specifiers */
846 match = 1;
847 for (i = 0; i < addrsize && match; ++i) {
848 u32 mask = imask ? imask[i] : 0xffffffffu;
849 match = ((addr[i] ^ imap[i]) & mask) == 0;
850 }
851 for (; i < (addrsize + intsize) && match; ++i) {
852 u32 mask = imask ? imask[i] : 0xffffffffu;
853 match =
854 ((intspec[i-addrsize] ^ imap[i]) & mask) == 0;
855 }
856 imap += addrsize + intsize;
857 imaplen -= addrsize + intsize;
858
859 DBG(" -> match=%d (imaplen=%d)\n", match, imaplen);
860
861 /* Get the interrupt parent */
862 if (of_irq_workarounds & OF_IMAP_NO_PHANDLE)
863 newpar = of_node_get(of_irq_dflt_pic);
864 else
865 newpar = of_find_node_by_phandle((phandle)*imap);
866 imap++;
867 --imaplen;
868
869 /* Check if not found */
870 if (newpar == NULL) {
871 DBG(" -> imap parent not found !\n");
872 goto fail;
873 }
874
875 /* Get #interrupt-cells and #address-cells of new
876 * parent
877 */
878 tmp = of_get_property(newpar, "#interrupt-cells", NULL);
879 if (tmp == NULL) {
880 DBG(" -> parent lacks #interrupt-cells !\n");
881 goto fail;
882 }
883 newintsize = *tmp;
884 tmp = of_get_property(newpar, "#address-cells", NULL);
885 newaddrsize = (tmp == NULL) ? 0 : *tmp;
886
887 DBG(" -> newintsize=%d, newaddrsize=%d\n",
888 newintsize, newaddrsize);
889
890 /* Check for malformed properties */
891 if (imaplen < (newaddrsize + newintsize))
892 goto fail;
893
894 imap += newaddrsize + newintsize;
895 imaplen -= newaddrsize + newintsize;
896
897 DBG(" -> imaplen=%d\n", imaplen);
898 }
899 if (!match)
900 goto fail;
901
902 of_node_put(old);
903 old = of_node_get(newpar);
904 addrsize = newaddrsize;
905 intsize = newintsize;
906 intspec = imap - intsize;
907 addr = intspec - addrsize;
908
909 skiplevel:
910 /* Iterate again with new parent */
911 DBG(" -> new parent: %s\n", newpar ? newpar->full_name : "<>");
912 of_node_put(ipar);
913 ipar = newpar;
914 newpar = NULL;
915 }
916 fail:
917 of_node_put(ipar);
918 of_node_put(old);
919 of_node_put(newpar);
920
921 return -EINVAL;
922}
923EXPORT_SYMBOL_GPL(of_irq_map_raw);
924
925#if defined(CONFIG_PPC_PMAC) && defined(CONFIG_PPC32)
926static int of_irq_map_oldworld(struct device_node *device, int index,
927 struct of_irq *out_irq)
928{
929 const u32 *ints = NULL;
930 int intlen;
931
932 /*
933 * Old machines just have a list of interrupt numbers
934 * and no interrupt-controller nodes. We also have dodgy
935 * cases where the APPL,interrupts property is completely
936 * missing behind pci-pci bridges and we have to get it
937 * from the parent (the bridge itself, as apple just wired
938 * everything together on these)
939 */
940 while (device) {
941 ints = of_get_property(device, "AAPL,interrupts", &intlen);
942 if (ints != NULL)
943 break;
944 device = device->parent;
945 if (device && strcmp(device->type, "pci") != 0)
946 break;
947 }
948 if (ints == NULL)
949 return -EINVAL;
950 intlen /= sizeof(u32);
951
952 if (index >= intlen)
953 return -EINVAL;
954
955 out_irq->controller = NULL;
956 out_irq->specifier[0] = ints[index];
957 out_irq->size = 1;
958
959 return 0;
960}
961#else /* defined(CONFIG_PPC_PMAC) && defined(CONFIG_PPC32) */
962static int of_irq_map_oldworld(struct device_node *device, int index,
963 struct of_irq *out_irq)
964{
965 return -EINVAL;
966}
967#endif /* !(defined(CONFIG_PPC_PMAC) && defined(CONFIG_PPC32)) */
968
969int of_irq_map_one(struct device_node *device, int index, struct of_irq *out_irq)
970{
971 struct device_node *p;
972 const u32 *intspec, *tmp, *addr;
973 u32 intsize, intlen;
974 int res = -EINVAL;
975
976 DBG("of_irq_map_one: dev=%s, index=%d\n", device->full_name, index);
977
978 /* OldWorld mac stuff is "special", handle out of line */
979 if (of_irq_workarounds & OF_IMAP_OLDWORLD_MAC)
980 return of_irq_map_oldworld(device, index, out_irq);
981
982 /* Get the interrupts property */
983 intspec = of_get_property(device, "interrupts", &intlen);
984 if (intspec == NULL)
985 return -EINVAL;
986 intlen /= sizeof(u32);
987
988 /* Get the reg property (if any) */
989 addr = of_get_property(device, "reg", NULL);
990
991 /* Look for the interrupt parent. */
992 p = of_irq_find_parent(device);
993 if (p == NULL)
994 return -EINVAL;
995
996 /* Get size of interrupt specifier */
997 tmp = of_get_property(p, "#interrupt-cells", NULL);
998 if (tmp == NULL)
999 goto out;
1000 intsize = *tmp;
1001
1002 DBG(" intsize=%d intlen=%d\n", intsize, intlen);
1003
1004 /* Check index */
1005 if ((index + 1) * intsize > intlen)
1006 goto out;
1007
1008 /* Get new specifier and map it */
1009 res = of_irq_map_raw(p, intspec + index * intsize, intsize,
1010 addr, out_irq);
1011out:
1012 of_node_put(p);
1013 return res;
1014}
1015EXPORT_SYMBOL_GPL(of_irq_map_one);
1016
1017/** 121/**
1018 * Search the device tree for the best MAC address to use. 'mac-address' is 122 * Search the device tree for the best MAC address to use. 'mac-address' is
1019 * checked first, because that is supposed to contain to "most recent" MAC 123 * checked first, because that is supposed to contain to "most recent" MAC
@@ -1051,29 +155,3 @@ const void *of_get_mac_address(struct device_node *np)
1051 return NULL; 155 return NULL;
1052} 156}
1053EXPORT_SYMBOL(of_get_mac_address); 157EXPORT_SYMBOL(of_get_mac_address);
1054
1055int of_irq_to_resource(struct device_node *dev, int index, struct resource *r)
1056{
1057 int irq = irq_of_parse_and_map(dev, index);
1058
1059 /* Only dereference the resource if both the
1060 * resource and the irq are valid. */
1061 if (r && irq != NO_IRQ) {
1062 r->start = r->end = irq;
1063 r->flags = IORESOURCE_IRQ;
1064 }
1065
1066 return irq;
1067}
1068EXPORT_SYMBOL_GPL(of_irq_to_resource);
1069
1070void __iomem *of_iomap(struct device_node *np, int index)
1071{
1072 struct resource res;
1073
1074 if (of_address_to_resource(np, index, &res))
1075 return NULL;
1076
1077 return ioremap(res.start, 1 + res.end - res.start);
1078}
1079EXPORT_SYMBOL(of_iomap);
diff --git a/arch/powerpc/kernel/ptrace.c b/arch/powerpc/kernel/ptrace.c
index 7a0c0199ea28..11f3cd9c832f 100644
--- a/arch/powerpc/kernel/ptrace.c
+++ b/arch/powerpc/kernel/ptrace.c
@@ -32,6 +32,8 @@
32#ifdef CONFIG_PPC32 32#ifdef CONFIG_PPC32
33#include <linux/module.h> 33#include <linux/module.h>
34#endif 34#endif
35#include <linux/hw_breakpoint.h>
36#include <linux/perf_event.h>
35 37
36#include <asm/uaccess.h> 38#include <asm/uaccess.h>
37#include <asm/page.h> 39#include <asm/page.h>
@@ -866,9 +868,34 @@ void user_disable_single_step(struct task_struct *task)
866 clear_tsk_thread_flag(task, TIF_SINGLESTEP); 868 clear_tsk_thread_flag(task, TIF_SINGLESTEP);
867} 869}
868 870
871#ifdef CONFIG_HAVE_HW_BREAKPOINT
872void ptrace_triggered(struct perf_event *bp, int nmi,
873 struct perf_sample_data *data, struct pt_regs *regs)
874{
875 struct perf_event_attr attr;
876
877 /*
878 * Disable the breakpoint request here since ptrace has defined a
879 * one-shot behaviour for breakpoint exceptions in PPC64.
880 * The SIGTRAP signal is generated automatically for us in do_dabr().
881 * We don't have to do anything about that here
882 */
883 attr = bp->attr;
884 attr.disabled = true;
885 modify_user_hw_breakpoint(bp, &attr);
886}
887#endif /* CONFIG_HAVE_HW_BREAKPOINT */
888
869int ptrace_set_debugreg(struct task_struct *task, unsigned long addr, 889int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
870 unsigned long data) 890 unsigned long data)
871{ 891{
892#ifdef CONFIG_HAVE_HW_BREAKPOINT
893 int ret;
894 struct thread_struct *thread = &(task->thread);
895 struct perf_event *bp;
896 struct perf_event_attr attr;
897#endif /* CONFIG_HAVE_HW_BREAKPOINT */
898
872 /* For ppc64 we support one DABR and no IABR's at the moment (ppc64). 899 /* For ppc64 we support one DABR and no IABR's at the moment (ppc64).
873 * For embedded processors we support one DAC and no IAC's at the 900 * For embedded processors we support one DAC and no IAC's at the
874 * moment. 901 * moment.
@@ -896,6 +923,43 @@ int ptrace_set_debugreg(struct task_struct *task, unsigned long addr,
896 /* Ensure breakpoint translation bit is set */ 923 /* Ensure breakpoint translation bit is set */
897 if (data && !(data & DABR_TRANSLATION)) 924 if (data && !(data & DABR_TRANSLATION))
898 return -EIO; 925 return -EIO;
926#ifdef CONFIG_HAVE_HW_BREAKPOINT
927 bp = thread->ptrace_bps[0];
928 if ((!data) || !(data & (DABR_DATA_WRITE | DABR_DATA_READ))) {
929 if (bp) {
930 unregister_hw_breakpoint(bp);
931 thread->ptrace_bps[0] = NULL;
932 }
933 return 0;
934 }
935 if (bp) {
936 attr = bp->attr;
937 attr.bp_addr = data & ~HW_BREAKPOINT_ALIGN;
938 arch_bp_generic_fields(data &
939 (DABR_DATA_WRITE | DABR_DATA_READ),
940 &attr.bp_type);
941 ret = modify_user_hw_breakpoint(bp, &attr);
942 if (ret)
943 return ret;
944 thread->ptrace_bps[0] = bp;
945 thread->dabr = data;
946 return 0;
947 }
948
949 /* Create a new breakpoint request if one doesn't exist already */
950 hw_breakpoint_init(&attr);
951 attr.bp_addr = data & ~HW_BREAKPOINT_ALIGN;
952 arch_bp_generic_fields(data & (DABR_DATA_WRITE | DABR_DATA_READ),
953 &attr.bp_type);
954
955 thread->ptrace_bps[0] = bp = register_user_hw_breakpoint(&attr,
956 ptrace_triggered, task);
957 if (IS_ERR(bp)) {
958 thread->ptrace_bps[0] = NULL;
959 return PTR_ERR(bp);
960 }
961
962#endif /* CONFIG_HAVE_HW_BREAKPOINT */
899 963
900 /* Move contents to the DABR register */ 964 /* Move contents to the DABR register */
901 task->thread.dabr = data; 965 task->thread.dabr = data;
diff --git a/arch/powerpc/kernel/rtas.c b/arch/powerpc/kernel/rtas.c
index d0516dbee762..41048de3c6c3 100644
--- a/arch/powerpc/kernel/rtas.c
+++ b/arch/powerpc/kernel/rtas.c
@@ -47,14 +47,6 @@ struct rtas_t rtas = {
47}; 47};
48EXPORT_SYMBOL(rtas); 48EXPORT_SYMBOL(rtas);
49 49
50struct rtas_suspend_me_data {
51 atomic_t working; /* number of cpus accessing this struct */
52 atomic_t done;
53 int token; /* ibm,suspend-me */
54 int error;
55 struct completion *complete; /* wait on this until working == 0 */
56};
57
58DEFINE_SPINLOCK(rtas_data_buf_lock); 50DEFINE_SPINLOCK(rtas_data_buf_lock);
59EXPORT_SYMBOL(rtas_data_buf_lock); 51EXPORT_SYMBOL(rtas_data_buf_lock);
60 52
@@ -714,14 +706,53 @@ void rtas_os_term(char *str)
714 706
715static int ibm_suspend_me_token = RTAS_UNKNOWN_SERVICE; 707static int ibm_suspend_me_token = RTAS_UNKNOWN_SERVICE;
716#ifdef CONFIG_PPC_PSERIES 708#ifdef CONFIG_PPC_PSERIES
717static void rtas_percpu_suspend_me(void *info) 709static int __rtas_suspend_last_cpu(struct rtas_suspend_me_data *data, int wake_when_done)
710{
711 u16 slb_size = mmu_slb_size;
712 int rc = H_MULTI_THREADS_ACTIVE;
713 int cpu;
714
715 slb_set_size(SLB_MIN_SIZE);
716 printk(KERN_DEBUG "calling ibm,suspend-me on cpu %i\n", smp_processor_id());
717
718 while (rc == H_MULTI_THREADS_ACTIVE && !atomic_read(&data->done) &&
719 !atomic_read(&data->error))
720 rc = rtas_call(data->token, 0, 1, NULL);
721
722 if (rc || atomic_read(&data->error)) {
723 printk(KERN_DEBUG "ibm,suspend-me returned %d\n", rc);
724 slb_set_size(slb_size);
725 }
726
727 if (atomic_read(&data->error))
728 rc = atomic_read(&data->error);
729
730 atomic_set(&data->error, rc);
731
732 if (wake_when_done) {
733 atomic_set(&data->done, 1);
734
735 for_each_online_cpu(cpu)
736 plpar_hcall_norets(H_PROD, get_hard_smp_processor_id(cpu));
737 }
738
739 if (atomic_dec_return(&data->working) == 0)
740 complete(data->complete);
741
742 return rc;
743}
744
745int rtas_suspend_last_cpu(struct rtas_suspend_me_data *data)
746{
747 atomic_inc(&data->working);
748 return __rtas_suspend_last_cpu(data, 0);
749}
750
751static int __rtas_suspend_cpu(struct rtas_suspend_me_data *data, int wake_when_done)
718{ 752{
719 long rc = H_SUCCESS; 753 long rc = H_SUCCESS;
720 unsigned long msr_save; 754 unsigned long msr_save;
721 u16 slb_size = mmu_slb_size;
722 int cpu; 755 int cpu;
723 struct rtas_suspend_me_data *data =
724 (struct rtas_suspend_me_data *)info;
725 756
726 atomic_inc(&data->working); 757 atomic_inc(&data->working);
727 758
@@ -729,7 +760,7 @@ static void rtas_percpu_suspend_me(void *info)
729 msr_save = mfmsr(); 760 msr_save = mfmsr();
730 mtmsr(msr_save & ~(MSR_EE)); 761 mtmsr(msr_save & ~(MSR_EE));
731 762
732 while (rc == H_SUCCESS && !atomic_read(&data->done)) 763 while (rc == H_SUCCESS && !atomic_read(&data->done) && !atomic_read(&data->error))
733 rc = plpar_hcall_norets(H_JOIN); 764 rc = plpar_hcall_norets(H_JOIN);
734 765
735 mtmsr(msr_save); 766 mtmsr(msr_save);
@@ -741,33 +772,37 @@ static void rtas_percpu_suspend_me(void *info)
741 /* All other cpus are in H_JOIN, this cpu does 772 /* All other cpus are in H_JOIN, this cpu does
742 * the suspend. 773 * the suspend.
743 */ 774 */
744 slb_set_size(SLB_MIN_SIZE); 775 return __rtas_suspend_last_cpu(data, wake_when_done);
745 printk(KERN_DEBUG "calling ibm,suspend-me on cpu %i\n",
746 smp_processor_id());
747 data->error = rtas_call(data->token, 0, 1, NULL);
748
749 if (data->error) {
750 printk(KERN_DEBUG "ibm,suspend-me returned %d\n",
751 data->error);
752 slb_set_size(slb_size);
753 }
754 } else { 776 } else {
755 printk(KERN_ERR "H_JOIN on cpu %i failed with rc = %ld\n", 777 printk(KERN_ERR "H_JOIN on cpu %i failed with rc = %ld\n",
756 smp_processor_id(), rc); 778 smp_processor_id(), rc);
757 data->error = rc; 779 atomic_set(&data->error, rc);
758 } 780 }
759 781
760 atomic_set(&data->done, 1); 782 if (wake_when_done) {
783 atomic_set(&data->done, 1);
761 784
762 /* This cpu did the suspend or got an error; in either case, 785 /* This cpu did the suspend or got an error; in either case,
763 * we need to prod all other other cpus out of join state. 786 * we need to prod all other other cpus out of join state.
764 * Extra prods are harmless. 787 * Extra prods are harmless.
765 */ 788 */
766 for_each_online_cpu(cpu) 789 for_each_online_cpu(cpu)
767 plpar_hcall_norets(H_PROD, get_hard_smp_processor_id(cpu)); 790 plpar_hcall_norets(H_PROD, get_hard_smp_processor_id(cpu));
791 }
768out: 792out:
769 if (atomic_dec_return(&data->working) == 0) 793 if (atomic_dec_return(&data->working) == 0)
770 complete(data->complete); 794 complete(data->complete);
795 return rc;
796}
797
798int rtas_suspend_cpu(struct rtas_suspend_me_data *data)
799{
800 return __rtas_suspend_cpu(data, 0);
801}
802
803static void rtas_percpu_suspend_me(void *info)
804{
805 __rtas_suspend_cpu((struct rtas_suspend_me_data *)info, 1);
771} 806}
772 807
773static int rtas_ibm_suspend_me(struct rtas_args *args) 808static int rtas_ibm_suspend_me(struct rtas_args *args)
@@ -802,22 +837,22 @@ static int rtas_ibm_suspend_me(struct rtas_args *args)
802 837
803 atomic_set(&data.working, 0); 838 atomic_set(&data.working, 0);
804 atomic_set(&data.done, 0); 839 atomic_set(&data.done, 0);
840 atomic_set(&data.error, 0);
805 data.token = rtas_token("ibm,suspend-me"); 841 data.token = rtas_token("ibm,suspend-me");
806 data.error = 0;
807 data.complete = &done; 842 data.complete = &done;
808 843
809 /* Call function on all CPUs. One of us will make the 844 /* Call function on all CPUs. One of us will make the
810 * rtas call 845 * rtas call
811 */ 846 */
812 if (on_each_cpu(rtas_percpu_suspend_me, &data, 0)) 847 if (on_each_cpu(rtas_percpu_suspend_me, &data, 0))
813 data.error = -EINVAL; 848 atomic_set(&data.error, -EINVAL);
814 849
815 wait_for_completion(&done); 850 wait_for_completion(&done);
816 851
817 if (data.error != 0) 852 if (atomic_read(&data.error) != 0)
818 printk(KERN_ERR "Error doing global join\n"); 853 printk(KERN_ERR "Error doing global join\n");
819 854
820 return data.error; 855 return atomic_read(&data.error);
821} 856}
822#else /* CONFIG_PPC_PSERIES */ 857#else /* CONFIG_PPC_PSERIES */
823static int rtas_ibm_suspend_me(struct rtas_args *args) 858static int rtas_ibm_suspend_me(struct rtas_args *args)
diff --git a/arch/powerpc/kernel/setup-common.c b/arch/powerpc/kernel/setup-common.c
index b7e6c7e193ae..15ade0d7bbb2 100644
--- a/arch/powerpc/kernel/setup-common.c
+++ b/arch/powerpc/kernel/setup-common.c
@@ -94,6 +94,10 @@ struct screen_info screen_info = {
94 .orig_video_points = 16 94 .orig_video_points = 16
95}; 95};
96 96
97/* Variables required to store legacy IO irq routing */
98int of_i8042_kbd_irq;
99int of_i8042_aux_irq;
100
97#ifdef __DO_IRQ_CANON 101#ifdef __DO_IRQ_CANON
98/* XXX should go elsewhere eventually */ 102/* XXX should go elsewhere eventually */
99int ppc_do_canonicalize_irqs; 103int ppc_do_canonicalize_irqs;
@@ -575,6 +579,15 @@ int check_legacy_ioport(unsigned long base_port)
575 np = of_find_compatible_node(NULL, NULL, "pnpPNP,f03"); 579 np = of_find_compatible_node(NULL, NULL, "pnpPNP,f03");
576 if (np) { 580 if (np) {
577 parent = of_get_parent(np); 581 parent = of_get_parent(np);
582
583 of_i8042_kbd_irq = irq_of_parse_and_map(parent, 0);
584 if (!of_i8042_kbd_irq)
585 of_i8042_kbd_irq = 1;
586
587 of_i8042_aux_irq = irq_of_parse_and_map(parent, 1);
588 if (!of_i8042_aux_irq)
589 of_i8042_aux_irq = 12;
590
578 of_node_put(np); 591 of_node_put(np);
579 np = parent; 592 np = parent;
580 break; 593 break;
@@ -701,16 +714,9 @@ static struct notifier_block ppc_dflt_plat_bus_notifier = {
701 .priority = INT_MAX, 714 .priority = INT_MAX,
702}; 715};
703 716
704static struct notifier_block ppc_dflt_of_bus_notifier = {
705 .notifier_call = ppc_dflt_bus_notify,
706 .priority = INT_MAX,
707};
708
709static int __init setup_bus_notifier(void) 717static int __init setup_bus_notifier(void)
710{ 718{
711 bus_register_notifier(&platform_bus_type, &ppc_dflt_plat_bus_notifier); 719 bus_register_notifier(&platform_bus_type, &ppc_dflt_plat_bus_notifier);
712 bus_register_notifier(&of_platform_bus_type, &ppc_dflt_of_bus_notifier);
713
714 return 0; 720 return 0;
715} 721}
716 722
diff --git a/arch/powerpc/kernel/setup_64.c b/arch/powerpc/kernel/setup_64.c
index d135f93cb0f6..1bee4b68fa45 100644
--- a/arch/powerpc/kernel/setup_64.c
+++ b/arch/powerpc/kernel/setup_64.c
@@ -142,16 +142,6 @@ early_param("smt-enabled", early_smt_enabled);
142#define check_smt_enabled() 142#define check_smt_enabled()
143#endif /* CONFIG_SMP */ 143#endif /* CONFIG_SMP */
144 144
145/* Put the paca pointer into r13 and SPRG_PACA */
146static void __init setup_paca(struct paca_struct *new_paca)
147{
148 local_paca = new_paca;
149 mtspr(SPRN_SPRG_PACA, local_paca);
150#ifdef CONFIG_PPC_BOOK3E
151 mtspr(SPRN_SPRG_TLB_EXFRAME, local_paca->extlb);
152#endif
153}
154
155/* 145/*
156 * Early initialization entry point. This is called by head.S 146 * Early initialization entry point. This is called by head.S
157 * with MMU translation disabled. We rely on the "feature" of 147 * with MMU translation disabled. We rely on the "feature" of
@@ -600,6 +590,9 @@ static int pcpu_cpu_distance(unsigned int from, unsigned int to)
600 return REMOTE_DISTANCE; 590 return REMOTE_DISTANCE;
601} 591}
602 592
593unsigned long __per_cpu_offset[NR_CPUS] __read_mostly;
594EXPORT_SYMBOL(__per_cpu_offset);
595
603void __init setup_per_cpu_areas(void) 596void __init setup_per_cpu_areas(void)
604{ 597{
605 const size_t dyn_size = PERCPU_MODULE_RESERVE + PERCPU_DYNAMIC_RESERVE; 598 const size_t dyn_size = PERCPU_MODULE_RESERVE + PERCPU_DYNAMIC_RESERVE;
@@ -624,8 +617,10 @@ void __init setup_per_cpu_areas(void)
624 panic("cannot initialize percpu area (err=%d)", rc); 617 panic("cannot initialize percpu area (err=%d)", rc);
625 618
626 delta = (unsigned long)pcpu_base_addr - (unsigned long)__per_cpu_start; 619 delta = (unsigned long)pcpu_base_addr - (unsigned long)__per_cpu_start;
627 for_each_possible_cpu(cpu) 620 for_each_possible_cpu(cpu) {
628 paca[cpu].data_offset = delta + pcpu_unit_offsets[cpu]; 621 __per_cpu_offset[cpu] = delta + pcpu_unit_offsets[cpu];
622 paca[cpu].data_offset = __per_cpu_offset[cpu];
623 }
629} 624}
630#endif 625#endif
631 626
diff --git a/arch/powerpc/kernel/signal.c b/arch/powerpc/kernel/signal.c
index a0afb555a7c9..7109f5b1baa8 100644
--- a/arch/powerpc/kernel/signal.c
+++ b/arch/powerpc/kernel/signal.c
@@ -11,6 +11,7 @@
11 11
12#include <linux/tracehook.h> 12#include <linux/tracehook.h>
13#include <linux/signal.h> 13#include <linux/signal.h>
14#include <asm/hw_breakpoint.h>
14#include <asm/uaccess.h> 15#include <asm/uaccess.h>
15#include <asm/unistd.h> 16#include <asm/unistd.h>
16 17
@@ -149,6 +150,8 @@ static int do_signal_pending(sigset_t *oldset, struct pt_regs *regs)
149 if (current->thread.dabr) 150 if (current->thread.dabr)
150 set_dabr(current->thread.dabr); 151 set_dabr(current->thread.dabr);
151#endif 152#endif
153 /* Re-enable the breakpoints for the signal stack */
154 thread_change_pc(current, regs);
152 155
153 if (is32) { 156 if (is32) {
154 if (ka.sa.sa_flags & SA_SIGINFO) 157 if (ka.sa.sa_flags & SA_SIGINFO)
diff --git a/arch/powerpc/kernel/smp.c b/arch/powerpc/kernel/smp.c
index 5c196d1086d9..a61b3ddd7bb3 100644
--- a/arch/powerpc/kernel/smp.c
+++ b/arch/powerpc/kernel/smp.c
@@ -288,8 +288,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
288 max_cpus = NR_CPUS; 288 max_cpus = NR_CPUS;
289 else 289 else
290 max_cpus = 1; 290 max_cpus = 1;
291
292 smp_space_timers(max_cpus);
293 291
294 for_each_possible_cpu(cpu) 292 for_each_possible_cpu(cpu)
295 if (cpu != boot_cpuid) 293 if (cpu != boot_cpuid)
@@ -501,14 +499,6 @@ int __devinit start_secondary(void *unused)
501 current->active_mm = &init_mm; 499 current->active_mm = &init_mm;
502 500
503 smp_store_cpu_info(cpu); 501 smp_store_cpu_info(cpu);
504
505#if defined(CONFIG_BOOKE) || defined(CONFIG_40x)
506 /* Clear any pending timer interrupts */
507 mtspr(SPRN_TSR, TSR_ENW | TSR_WIS | TSR_DIS | TSR_FIS);
508
509 /* Enable decrementer interrupt */
510 mtspr(SPRN_TCR, TCR_DIE);
511#endif
512 set_dec(tb_ticks_per_jiffy); 502 set_dec(tb_ticks_per_jiffy);
513 preempt_disable(); 503 preempt_disable();
514 cpu_callin_map[cpu] = 1; 504 cpu_callin_map[cpu] = 1;
diff --git a/arch/powerpc/kernel/suspend.c b/arch/powerpc/kernel/suspend.c
index 6fc6328dc626..0167d53da30c 100644
--- a/arch/powerpc/kernel/suspend.c
+++ b/arch/powerpc/kernel/suspend.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * Distribute under GPLv2 4 * Distribute under GPLv2
5 * 5 *
6 * Copyright (c) 2002 Pavel Machek <pavel@suse.cz> 6 * Copyright (c) 2002 Pavel Machek <pavel@ucw.cz>
7 * Copyright (c) 2001 Patrick Mochel <mochel@osdl.org> 7 * Copyright (c) 2001 Patrick Mochel <mochel@osdl.org>
8 */ 8 */
9 9
diff --git a/arch/powerpc/kernel/time.c b/arch/powerpc/kernel/time.c
index 0441bbdadbd1..ce53dfa7130d 100644
--- a/arch/powerpc/kernel/time.c
+++ b/arch/powerpc/kernel/time.c
@@ -149,16 +149,6 @@ unsigned long tb_ticks_per_usec = 100; /* sane default */
149EXPORT_SYMBOL(tb_ticks_per_usec); 149EXPORT_SYMBOL(tb_ticks_per_usec);
150unsigned long tb_ticks_per_sec; 150unsigned long tb_ticks_per_sec;
151EXPORT_SYMBOL(tb_ticks_per_sec); /* for cputime_t conversions */ 151EXPORT_SYMBOL(tb_ticks_per_sec); /* for cputime_t conversions */
152u64 tb_to_xs;
153unsigned tb_to_us;
154
155#define TICKLEN_SCALE NTP_SCALE_SHIFT
156static u64 last_tick_len; /* units are ns / 2^TICKLEN_SCALE */
157static u64 ticklen_to_xs; /* 0.64 fraction */
158
159/* If last_tick_len corresponds to about 1/HZ seconds, then
160 last_tick_len << TICKLEN_SHIFT will be about 2^63. */
161#define TICKLEN_SHIFT (63 - 30 - TICKLEN_SCALE + SHIFT_HZ)
162 152
163DEFINE_SPINLOCK(rtc_lock); 153DEFINE_SPINLOCK(rtc_lock);
164EXPORT_SYMBOL_GPL(rtc_lock); 154EXPORT_SYMBOL_GPL(rtc_lock);
@@ -174,7 +164,6 @@ unsigned long ppc_proc_freq;
174EXPORT_SYMBOL(ppc_proc_freq); 164EXPORT_SYMBOL(ppc_proc_freq);
175unsigned long ppc_tb_freq; 165unsigned long ppc_tb_freq;
176 166
177static u64 tb_last_jiffy __cacheline_aligned_in_smp;
178static DEFINE_PER_CPU(u64, last_jiffy); 167static DEFINE_PER_CPU(u64, last_jiffy);
179 168
180#ifdef CONFIG_VIRT_CPU_ACCOUNTING 169#ifdef CONFIG_VIRT_CPU_ACCOUNTING
@@ -423,30 +412,6 @@ void udelay(unsigned long usecs)
423} 412}
424EXPORT_SYMBOL(udelay); 413EXPORT_SYMBOL(udelay);
425 414
426static inline void update_gtod(u64 new_tb_stamp, u64 new_stamp_xsec,
427 u64 new_tb_to_xs)
428{
429 /*
430 * tb_update_count is used to allow the userspace gettimeofday code
431 * to assure itself that it sees a consistent view of the tb_to_xs and
432 * stamp_xsec variables. It reads the tb_update_count, then reads
433 * tb_to_xs and stamp_xsec and then reads tb_update_count again. If
434 * the two values of tb_update_count match and are even then the
435 * tb_to_xs and stamp_xsec values are consistent. If not, then it
436 * loops back and reads them again until this criteria is met.
437 * We expect the caller to have done the first increment of
438 * vdso_data->tb_update_count already.
439 */
440 vdso_data->tb_orig_stamp = new_tb_stamp;
441 vdso_data->stamp_xsec = new_stamp_xsec;
442 vdso_data->tb_to_xs = new_tb_to_xs;
443 vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec;
444 vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec;
445 vdso_data->stamp_xtime = xtime;
446 smp_wmb();
447 ++(vdso_data->tb_update_count);
448}
449
450#ifdef CONFIG_SMP 415#ifdef CONFIG_SMP
451unsigned long profile_pc(struct pt_regs *regs) 416unsigned long profile_pc(struct pt_regs *regs)
452{ 417{
@@ -470,7 +435,6 @@ EXPORT_SYMBOL(profile_pc);
470 435
471static int __init iSeries_tb_recal(void) 436static int __init iSeries_tb_recal(void)
472{ 437{
473 struct div_result divres;
474 unsigned long titan, tb; 438 unsigned long titan, tb;
475 439
476 /* Make sure we only run on iSeries */ 440 /* Make sure we only run on iSeries */
@@ -501,10 +465,7 @@ static int __init iSeries_tb_recal(void)
501 tb_ticks_per_jiffy = new_tb_ticks_per_jiffy; 465 tb_ticks_per_jiffy = new_tb_ticks_per_jiffy;
502 tb_ticks_per_sec = new_tb_ticks_per_sec; 466 tb_ticks_per_sec = new_tb_ticks_per_sec;
503 calc_cputime_factors(); 467 calc_cputime_factors();
504 div128_by_32( XSEC_PER_SEC, 0, tb_ticks_per_sec, &divres );
505 tb_to_xs = divres.result_low;
506 vdso_data->tb_ticks_per_sec = tb_ticks_per_sec; 468 vdso_data->tb_ticks_per_sec = tb_ticks_per_sec;
507 vdso_data->tb_to_xs = tb_to_xs;
508 setup_cputime_one_jiffy(); 469 setup_cputime_one_jiffy();
509 } 470 }
510 else { 471 else {
@@ -667,27 +628,9 @@ void timer_interrupt(struct pt_regs * regs)
667 trace_timer_interrupt_exit(regs); 628 trace_timer_interrupt_exit(regs);
668} 629}
669 630
670void wakeup_decrementer(void)
671{
672 unsigned long ticks;
673
674 /*
675 * The timebase gets saved on sleep and restored on wakeup,
676 * so all we need to do is to reset the decrementer.
677 */
678 ticks = tb_ticks_since(__get_cpu_var(last_jiffy));
679 if (ticks < tb_ticks_per_jiffy)
680 ticks = tb_ticks_per_jiffy - ticks;
681 else
682 ticks = 1;
683 set_dec(ticks);
684}
685
686#ifdef CONFIG_SUSPEND 631#ifdef CONFIG_SUSPEND
687void generic_suspend_disable_irqs(void) 632static void generic_suspend_disable_irqs(void)
688{ 633{
689 preempt_disable();
690
691 /* Disable the decrementer, so that it doesn't interfere 634 /* Disable the decrementer, so that it doesn't interfere
692 * with suspending. 635 * with suspending.
693 */ 636 */
@@ -697,12 +640,9 @@ void generic_suspend_disable_irqs(void)
697 set_dec(0x7fffffff); 640 set_dec(0x7fffffff);
698} 641}
699 642
700void generic_suspend_enable_irqs(void) 643static void generic_suspend_enable_irqs(void)
701{ 644{
702 wakeup_decrementer();
703
704 local_irq_enable(); 645 local_irq_enable();
705 preempt_enable();
706} 646}
707 647
708/* Overrides the weak version in kernel/power/main.c */ 648/* Overrides the weak version in kernel/power/main.c */
@@ -722,23 +662,6 @@ void arch_suspend_enable_irqs(void)
722} 662}
723#endif 663#endif
724 664
725#ifdef CONFIG_SMP
726void __init smp_space_timers(unsigned int max_cpus)
727{
728 int i;
729 u64 previous_tb = per_cpu(last_jiffy, boot_cpuid);
730
731 /* make sure tb > per_cpu(last_jiffy, cpu) for all cpus always */
732 previous_tb -= tb_ticks_per_jiffy;
733
734 for_each_possible_cpu(i) {
735 if (i == boot_cpuid)
736 continue;
737 per_cpu(last_jiffy, i) = previous_tb;
738 }
739}
740#endif
741
742/* 665/*
743 * Scheduler clock - returns current time in nanosec units. 666 * Scheduler clock - returns current time in nanosec units.
744 * 667 *
@@ -873,10 +796,11 @@ static cycle_t timebase_read(struct clocksource *cs)
873 return (cycle_t)get_tb(); 796 return (cycle_t)get_tb();
874} 797}
875 798
876void update_vsyscall(struct timespec *wall_time, struct clocksource *clock, 799void update_vsyscall(struct timespec *wall_time, struct timespec *wtm,
877 u32 mult) 800 struct clocksource *clock, u32 mult)
878{ 801{
879 u64 t2x, stamp_xsec; 802 u64 new_tb_to_xs, new_stamp_xsec;
803 u32 frac_sec;
880 804
881 if (clock != &clocksource_timebase) 805 if (clock != &clocksource_timebase)
882 return; 806 return;
@@ -887,11 +811,35 @@ void update_vsyscall(struct timespec *wall_time, struct clocksource *clock,
887 811
888 /* XXX this assumes clock->shift == 22 */ 812 /* XXX this assumes clock->shift == 22 */
889 /* 4611686018 ~= 2^(20+64-22) / 1e9 */ 813 /* 4611686018 ~= 2^(20+64-22) / 1e9 */
890 t2x = (u64) mult * 4611686018ULL; 814 new_tb_to_xs = (u64) mult * 4611686018ULL;
891 stamp_xsec = (u64) xtime.tv_nsec * XSEC_PER_SEC; 815 new_stamp_xsec = (u64) wall_time->tv_nsec * XSEC_PER_SEC;
892 do_div(stamp_xsec, 1000000000); 816 do_div(new_stamp_xsec, 1000000000);
893 stamp_xsec += (u64) xtime.tv_sec * XSEC_PER_SEC; 817 new_stamp_xsec += (u64) wall_time->tv_sec * XSEC_PER_SEC;
894 update_gtod(clock->cycle_last, stamp_xsec, t2x); 818
819 BUG_ON(wall_time->tv_nsec >= NSEC_PER_SEC);
820 /* this is tv_nsec / 1e9 as a 0.32 fraction */
821 frac_sec = ((u64) wall_time->tv_nsec * 18446744073ULL) >> 32;
822
823 /*
824 * tb_update_count is used to allow the userspace gettimeofday code
825 * to assure itself that it sees a consistent view of the tb_to_xs and
826 * stamp_xsec variables. It reads the tb_update_count, then reads
827 * tb_to_xs and stamp_xsec and then reads tb_update_count again. If
828 * the two values of tb_update_count match and are even then the
829 * tb_to_xs and stamp_xsec values are consistent. If not, then it
830 * loops back and reads them again until this criteria is met.
831 * We expect the caller to have done the first increment of
832 * vdso_data->tb_update_count already.
833 */
834 vdso_data->tb_orig_stamp = clock->cycle_last;
835 vdso_data->stamp_xsec = new_stamp_xsec;
836 vdso_data->tb_to_xs = new_tb_to_xs;
837 vdso_data->wtom_clock_sec = wtm->tv_sec;
838 vdso_data->wtom_clock_nsec = wtm->tv_nsec;
839 vdso_data->stamp_xtime = *wall_time;
840 vdso_data->stamp_sec_fraction = frac_sec;
841 smp_wmb();
842 ++(vdso_data->tb_update_count);
895} 843}
896 844
897void update_vsyscall_tz(void) 845void update_vsyscall_tz(void)
@@ -1007,15 +955,13 @@ void secondary_cpu_time_init(void)
1007/* This function is only called on the boot processor */ 955/* This function is only called on the boot processor */
1008void __init time_init(void) 956void __init time_init(void)
1009{ 957{
1010 unsigned long flags;
1011 struct div_result res; 958 struct div_result res;
1012 u64 scale, x; 959 u64 scale;
1013 unsigned shift; 960 unsigned shift;
1014 961
1015 if (__USE_RTC()) { 962 if (__USE_RTC()) {
1016 /* 601 processor: dec counts down by 128 every 128ns */ 963 /* 601 processor: dec counts down by 128 every 128ns */
1017 ppc_tb_freq = 1000000000; 964 ppc_tb_freq = 1000000000;
1018 tb_last_jiffy = get_rtcl();
1019 } else { 965 } else {
1020 /* Normal PowerPC with timebase register */ 966 /* Normal PowerPC with timebase register */
1021 ppc_md.calibrate_decr(); 967 ppc_md.calibrate_decr();
@@ -1023,50 +969,15 @@ void __init time_init(void)
1023 ppc_tb_freq / 1000000, ppc_tb_freq % 1000000); 969 ppc_tb_freq / 1000000, ppc_tb_freq % 1000000);
1024 printk(KERN_DEBUG "time_init: processor frequency = %lu.%.6lu MHz\n", 970 printk(KERN_DEBUG "time_init: processor frequency = %lu.%.6lu MHz\n",
1025 ppc_proc_freq / 1000000, ppc_proc_freq % 1000000); 971 ppc_proc_freq / 1000000, ppc_proc_freq % 1000000);
1026 tb_last_jiffy = get_tb();
1027 } 972 }
1028 973
1029 tb_ticks_per_jiffy = ppc_tb_freq / HZ; 974 tb_ticks_per_jiffy = ppc_tb_freq / HZ;
1030 tb_ticks_per_sec = ppc_tb_freq; 975 tb_ticks_per_sec = ppc_tb_freq;
1031 tb_ticks_per_usec = ppc_tb_freq / 1000000; 976 tb_ticks_per_usec = ppc_tb_freq / 1000000;
1032 tb_to_us = mulhwu_scale_factor(ppc_tb_freq, 1000000);
1033 calc_cputime_factors(); 977 calc_cputime_factors();
1034 setup_cputime_one_jiffy(); 978 setup_cputime_one_jiffy();
1035 979
1036 /* 980 /*
1037 * Calculate the length of each tick in ns. It will not be
1038 * exactly 1e9/HZ unless ppc_tb_freq is divisible by HZ.
1039 * We compute 1e9 * tb_ticks_per_jiffy / ppc_tb_freq,
1040 * rounded up.
1041 */
1042 x = (u64) NSEC_PER_SEC * tb_ticks_per_jiffy + ppc_tb_freq - 1;
1043 do_div(x, ppc_tb_freq);
1044 tick_nsec = x;
1045 last_tick_len = x << TICKLEN_SCALE;
1046
1047 /*
1048 * Compute ticklen_to_xs, which is a factor which gets multiplied
1049 * by (last_tick_len << TICKLEN_SHIFT) to get a tb_to_xs value.
1050 * It is computed as:
1051 * ticklen_to_xs = 2^N / (tb_ticks_per_jiffy * 1e9)
1052 * where N = 64 + 20 - TICKLEN_SCALE - TICKLEN_SHIFT
1053 * which turns out to be N = 51 - SHIFT_HZ.
1054 * This gives the result as a 0.64 fixed-point fraction.
1055 * That value is reduced by an offset amounting to 1 xsec per
1056 * 2^31 timebase ticks to avoid problems with time going backwards
1057 * by 1 xsec when we do timer_recalc_offset due to losing the
1058 * fractional xsec. That offset is equal to ppc_tb_freq/2^51
1059 * since there are 2^20 xsec in a second.
1060 */
1061 div128_by_32((1ULL << 51) - ppc_tb_freq, 0,
1062 tb_ticks_per_jiffy << SHIFT_HZ, &res);
1063 div128_by_32(res.result_high, res.result_low, NSEC_PER_SEC, &res);
1064 ticklen_to_xs = res.result_low;
1065
1066 /* Compute tb_to_xs from tick_nsec */
1067 tb_to_xs = mulhdu(last_tick_len << TICKLEN_SHIFT, ticklen_to_xs);
1068
1069 /*
1070 * Compute scale factor for sched_clock. 981 * Compute scale factor for sched_clock.
1071 * The calibrate_decr() function has set tb_ticks_per_sec, 982 * The calibrate_decr() function has set tb_ticks_per_sec,
1072 * which is the timebase frequency. 983 * which is the timebase frequency.
@@ -1087,21 +998,14 @@ void __init time_init(void)
1087 /* Save the current timebase to pretty up CONFIG_PRINTK_TIME */ 998 /* Save the current timebase to pretty up CONFIG_PRINTK_TIME */
1088 boot_tb = get_tb_or_rtc(); 999 boot_tb = get_tb_or_rtc();
1089 1000
1090 write_seqlock_irqsave(&xtime_lock, flags);
1091
1092 /* If platform provided a timezone (pmac), we correct the time */ 1001 /* If platform provided a timezone (pmac), we correct the time */
1093 if (timezone_offset) { 1002 if (timezone_offset) {
1094 sys_tz.tz_minuteswest = -timezone_offset / 60; 1003 sys_tz.tz_minuteswest = -timezone_offset / 60;
1095 sys_tz.tz_dsttime = 0; 1004 sys_tz.tz_dsttime = 0;
1096 } 1005 }
1097 1006
1098 vdso_data->tb_orig_stamp = tb_last_jiffy;
1099 vdso_data->tb_update_count = 0; 1007 vdso_data->tb_update_count = 0;
1100 vdso_data->tb_ticks_per_sec = tb_ticks_per_sec; 1008 vdso_data->tb_ticks_per_sec = tb_ticks_per_sec;
1101 vdso_data->stamp_xsec = (u64) xtime.tv_sec * XSEC_PER_SEC;
1102 vdso_data->tb_to_xs = tb_to_xs;
1103
1104 write_sequnlock_irqrestore(&xtime_lock, flags);
1105 1009
1106 /* Start the decrementer on CPUs that have manual control 1010 /* Start the decrementer on CPUs that have manual control
1107 * such as BookE 1011 * such as BookE
@@ -1195,39 +1099,6 @@ void to_tm(int tim, struct rtc_time * tm)
1195 GregorianDay(tm); 1099 GregorianDay(tm);
1196} 1100}
1197 1101
1198/* Auxiliary function to compute scaling factors */
1199/* Actually the choice of a timebase running at 1/4 the of the bus
1200 * frequency giving resolution of a few tens of nanoseconds is quite nice.
1201 * It makes this computation very precise (27-28 bits typically) which
1202 * is optimistic considering the stability of most processor clock
1203 * oscillators and the precision with which the timebase frequency
1204 * is measured but does not harm.
1205 */
1206unsigned mulhwu_scale_factor(unsigned inscale, unsigned outscale)
1207{
1208 unsigned mlt=0, tmp, err;
1209 /* No concern for performance, it's done once: use a stupid
1210 * but safe and compact method to find the multiplier.
1211 */
1212
1213 for (tmp = 1U<<31; tmp != 0; tmp >>= 1) {
1214 if (mulhwu(inscale, mlt|tmp) < outscale)
1215 mlt |= tmp;
1216 }
1217
1218 /* We might still be off by 1 for the best approximation.
1219 * A side effect of this is that if outscale is too large
1220 * the returned value will be zero.
1221 * Many corner cases have been checked and seem to work,
1222 * some might have been forgotten in the test however.
1223 */
1224
1225 err = inscale * (mlt+1);
1226 if (err <= inscale/2)
1227 mlt++;
1228 return mlt;
1229}
1230
1231/* 1102/*
1232 * Divide a 128-bit dividend by a 32-bit divisor, leaving a 128 bit 1103 * Divide a 128-bit dividend by a 32-bit divisor, leaving a 128 bit
1233 * result. 1104 * result.
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 25fc33984c2b..a45a63c3a0c7 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -55,9 +55,6 @@
55#endif 55#endif
56#include <asm/kexec.h> 56#include <asm/kexec.h>
57#include <asm/ppc-opcode.h> 57#include <asm/ppc-opcode.h>
58#ifdef CONFIG_FSL_BOOKE
59#include <asm/dbell.h>
60#endif
61 58
62#if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC) 59#if defined(CONFIG_DEBUGGER) || defined(CONFIG_KEXEC)
63int (*__debugger)(struct pt_regs *regs) __read_mostly; 60int (*__debugger)(struct pt_regs *regs) __read_mostly;
@@ -688,7 +685,7 @@ void RunModeException(struct pt_regs *regs)
688 685
689void __kprobes single_step_exception(struct pt_regs *regs) 686void __kprobes single_step_exception(struct pt_regs *regs)
690{ 687{
691 regs->msr &= ~(MSR_SE | MSR_BE); /* Turn off 'trace' bits */ 688 clear_single_step(regs);
692 689
693 if (notify_die(DIE_SSTEP, "single_step", regs, 5, 690 if (notify_die(DIE_SSTEP, "single_step", regs, 5,
694 5, SIGTRAP) == NOTIFY_STOP) 691 5, SIGTRAP) == NOTIFY_STOP)
@@ -707,10 +704,8 @@ void __kprobes single_step_exception(struct pt_regs *regs)
707 */ 704 */
708static void emulate_single_step(struct pt_regs *regs) 705static void emulate_single_step(struct pt_regs *regs)
709{ 706{
710 if (single_stepping(regs)) { 707 if (single_stepping(regs))
711 clear_single_step(regs); 708 single_step_exception(regs);
712 _exception(SIGTRAP, regs, TRAP_TRACE, 0);
713 }
714} 709}
715 710
716static inline int __parse_fpscr(unsigned long fpscr) 711static inline int __parse_fpscr(unsigned long fpscr)
@@ -1344,24 +1339,6 @@ void vsx_assist_exception(struct pt_regs *regs)
1344#endif /* CONFIG_VSX */ 1339#endif /* CONFIG_VSX */
1345 1340
1346#ifdef CONFIG_FSL_BOOKE 1341#ifdef CONFIG_FSL_BOOKE
1347
1348void doorbell_exception(struct pt_regs *regs)
1349{
1350#ifdef CONFIG_SMP
1351 int cpu = smp_processor_id();
1352 int msg;
1353
1354 if (num_online_cpus() < 2)
1355 return;
1356
1357 for (msg = 0; msg < 4; msg++)
1358 if (test_and_clear_bit(msg, &dbell_smp_message[cpu]))
1359 smp_message_recv(msg);
1360#else
1361 printk(KERN_WARNING "Received doorbell on non-smp system\n");
1362#endif
1363}
1364
1365void CacheLockingException(struct pt_regs *regs, unsigned long address, 1342void CacheLockingException(struct pt_regs *regs, unsigned long address,
1366 unsigned long error_code) 1343 unsigned long error_code)
1367{ 1344{
diff --git a/arch/powerpc/kernel/vdso32/gettimeofday.S b/arch/powerpc/kernel/vdso32/gettimeofday.S
index ee038d4bf252..4ee09ee2e836 100644
--- a/arch/powerpc/kernel/vdso32/gettimeofday.S
+++ b/arch/powerpc/kernel/vdso32/gettimeofday.S
@@ -19,8 +19,10 @@
19/* Offset for the low 32-bit part of a field of long type */ 19/* Offset for the low 32-bit part of a field of long type */
20#ifdef CONFIG_PPC64 20#ifdef CONFIG_PPC64
21#define LOPART 4 21#define LOPART 4
22#define TSPEC_TV_SEC TSPC64_TV_SEC+LOPART
22#else 23#else
23#define LOPART 0 24#define LOPART 0
25#define TSPEC_TV_SEC TSPC32_TV_SEC
24#endif 26#endif
25 27
26 .text 28 .text
@@ -41,23 +43,11 @@ V_FUNCTION_BEGIN(__kernel_gettimeofday)
41 mr r9, r3 /* datapage ptr in r9 */ 43 mr r9, r3 /* datapage ptr in r9 */
42 cmplwi r10,0 /* check if tv is NULL */ 44 cmplwi r10,0 /* check if tv is NULL */
43 beq 3f 45 beq 3f
44 bl __do_get_xsec@local /* get xsec from tb & kernel */ 46 lis r7,1000000@ha /* load up USEC_PER_SEC */
45 bne- 2f /* out of line -> do syscall */ 47 addi r7,r7,1000000@l /* so we get microseconds in r4 */
46 48 bl __do_get_tspec@local /* get sec/usec from tb & kernel */
47 /* seconds are xsec >> 20 */ 49 stw r3,TVAL32_TV_SEC(r10)
48 rlwinm r5,r4,12,20,31 50 stw r4,TVAL32_TV_USEC(r10)
49 rlwimi r5,r3,12,0,19
50 stw r5,TVAL32_TV_SEC(r10)
51
52 /* get remaining xsec and convert to usec. we scale
53 * up remaining xsec by 12 bits and get the top 32 bits
54 * of the multiplication
55 */
56 rlwinm r5,r4,12,0,19
57 lis r6,1000000@h
58 ori r6,r6,1000000@l
59 mulhwu r5,r5,r6
60 stw r5,TVAL32_TV_USEC(r10)
61 51
623: cmplwi r11,0 /* check if tz is NULL */ 523: cmplwi r11,0 /* check if tz is NULL */
63 beq 1f 53 beq 1f
@@ -70,14 +60,6 @@ V_FUNCTION_BEGIN(__kernel_gettimeofday)
70 crclr cr0*4+so 60 crclr cr0*4+so
71 li r3,0 61 li r3,0
72 blr 62 blr
73
742:
75 mtlr r12
76 mr r3,r10
77 mr r4,r11
78 li r0,__NR_gettimeofday
79 sc
80 blr
81 .cfi_endproc 63 .cfi_endproc
82V_FUNCTION_END(__kernel_gettimeofday) 64V_FUNCTION_END(__kernel_gettimeofday)
83 65
@@ -100,7 +82,8 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
100 mr r11,r4 /* r11 saves tp */ 82 mr r11,r4 /* r11 saves tp */
101 bl __get_datapage@local /* get data page */ 83 bl __get_datapage@local /* get data page */
102 mr r9,r3 /* datapage ptr in r9 */ 84 mr r9,r3 /* datapage ptr in r9 */
103 85 lis r7,NSEC_PER_SEC@h /* want nanoseconds */
86 ori r7,r7,NSEC_PER_SEC@l
10450: bl __do_get_tspec@local /* get sec/nsec from tb & kernel */ 8750: bl __do_get_tspec@local /* get sec/nsec from tb & kernel */
105 bne cr1,80f /* not monotonic -> all done */ 88 bne cr1,80f /* not monotonic -> all done */
106 89
@@ -198,83 +181,12 @@ V_FUNCTION_END(__kernel_clock_getres)
198 181
199 182
200/* 183/*
201 * This is the core of gettimeofday() & friends, it returns the xsec 184 * This is the core of clock_gettime() and gettimeofday(),
202 * value in r3 & r4 and expects the datapage ptr (non clobbered) 185 * it returns the current time in r3 (seconds) and r4.
203 * in r9. clobbers r0,r4,r5,r6,r7,r8. 186 * On entry, r7 gives the resolution of r4, either USEC_PER_SEC
204 * When returning, r8 contains the counter value that can be reused 187 * or NSEC_PER_SEC, giving r4 in microseconds or nanoseconds.
205 * by the monotonic clock implementation
206 */
207__do_get_xsec:
208 .cfi_startproc
209 /* Check for update count & load values. We use the low
210 * order 32 bits of the update count
211 */
2121: lwz r8,(CFG_TB_UPDATE_COUNT+LOPART)(r9)
213 andi. r0,r8,1 /* pending update ? loop */
214 bne- 1b
215 xor r0,r8,r8 /* create dependency */
216 add r9,r9,r0
217
218 /* Load orig stamp (offset to TB) */
219 lwz r5,CFG_TB_ORIG_STAMP(r9)
220 lwz r6,(CFG_TB_ORIG_STAMP+4)(r9)
221
222 /* Get a stable TB value */
2232: mftbu r3
224 mftbl r4
225 mftbu r0
226 cmpl cr0,r3,r0
227 bne- 2b
228
229 /* Substract tb orig stamp. If the high part is non-zero, we jump to
230 * the slow path which call the syscall.
231 * If it's ok, then we have our 32 bits tb_ticks value in r7
232 */
233 subfc r7,r6,r4
234 subfe. r0,r5,r3
235 bne- 3f
236
237 /* Load scale factor & do multiplication */
238 lwz r5,CFG_TB_TO_XS(r9) /* load values */
239 lwz r6,(CFG_TB_TO_XS+4)(r9)
240 mulhwu r4,r7,r5
241 mulhwu r6,r7,r6
242 mullw r0,r7,r5
243 addc r6,r6,r0
244
245 /* At this point, we have the scaled xsec value in r4 + XER:CA
246 * we load & add the stamp since epoch
247 */
248 lwz r5,CFG_STAMP_XSEC(r9)
249 lwz r6,(CFG_STAMP_XSEC+4)(r9)
250 adde r4,r4,r6
251 addze r3,r5
252
253 /* We now have our result in r3,r4. We create a fake dependency
254 * on that result and re-check the counter
255 */
256 or r6,r4,r3
257 xor r0,r6,r6
258 add r9,r9,r0
259 lwz r0,(CFG_TB_UPDATE_COUNT+LOPART)(r9)
260 cmpl cr0,r8,r0 /* check if updated */
261 bne- 1b
262
263 /* Warning ! The caller expects CR:EQ to be set to indicate a
264 * successful calculation (so it won't fallback to the syscall
265 * method). We have overriden that CR bit in the counter check,
266 * but fortunately, the loop exit condition _is_ CR:EQ set, so
267 * we can exit safely here. If you change this code, be careful
268 * of that side effect.
269 */
2703: blr
271 .cfi_endproc
272
273/*
274 * This is the core of clock_gettime(), it returns the current
275 * time in seconds and nanoseconds in r3 and r4.
276 * It expects the datapage ptr in r9 and doesn't clobber it. 188 * It expects the datapage ptr in r9 and doesn't clobber it.
277 * It clobbers r0, r5, r6, r10 and returns NSEC_PER_SEC in r7. 189 * It clobbers r0, r5 and r6.
278 * On return, r8 contains the counter value that can be reused. 190 * On return, r8 contains the counter value that can be reused.
279 * This clobbers cr0 but not any other cr field. 191 * This clobbers cr0 but not any other cr field.
280 */ 192 */
@@ -297,70 +209,58 @@ __do_get_tspec:
2972: mftbu r3 2092: mftbu r3
298 mftbl r4 210 mftbl r4
299 mftbu r0 211 mftbu r0
300 cmpl cr0,r3,r0 212 cmplw cr0,r3,r0
301 bne- 2b 213 bne- 2b
302 214
303 /* Subtract tb orig stamp and shift left 12 bits. 215 /* Subtract tb orig stamp and shift left 12 bits.
304 */ 216 */
305 subfc r7,r6,r4 217 subfc r4,r6,r4
306 subfe r0,r5,r3 218 subfe r0,r5,r3
307 slwi r0,r0,12 219 slwi r0,r0,12
308 rlwimi. r0,r7,12,20,31 220 rlwimi. r0,r4,12,20,31
309 slwi r7,r7,12 221 slwi r4,r4,12
310 222
311 /* Load scale factor & do multiplication */ 223 /*
224 * Load scale factor & do multiplication.
225 * We only use the high 32 bits of the tb_to_xs value.
226 * Even with a 1GHz timebase clock, the high 32 bits of
227 * tb_to_xs will be at least 4 million, so the error from
228 * ignoring the low 32 bits will be no more than 0.25ppm.
229 * The error will just make the clock run very very slightly
230 * slow until the next time the kernel updates the VDSO data,
231 * at which point the clock will catch up to the kernel's value,
232 * so there is no long-term error accumulation.
233 */
312 lwz r5,CFG_TB_TO_XS(r9) /* load values */ 234 lwz r5,CFG_TB_TO_XS(r9) /* load values */
313 lwz r6,(CFG_TB_TO_XS+4)(r9) 235 mulhwu r4,r4,r5
314 mulhwu r3,r7,r6
315 mullw r10,r7,r5
316 mulhwu r4,r7,r5
317 addc r10,r3,r10
318 li r3,0 236 li r3,0
319 237
320 beq+ 4f /* skip high part computation if 0 */ 238 beq+ 4f /* skip high part computation if 0 */
321 mulhwu r3,r0,r5 239 mulhwu r3,r0,r5
322 mullw r7,r0,r5 240 mullw r5,r0,r5
323 mulhwu r5,r0,r6
324 mullw r6,r0,r6
325 adde r4,r4,r7
326 addze r3,r3
327 addc r4,r4,r5 241 addc r4,r4,r5
328 addze r3,r3 242 addze r3,r3
329 addc r10,r10,r6 2434:
330 244 /* At this point, we have seconds since the xtime stamp
3314: addze r4,r4 /* add in carry */ 245 * as a 32.32 fixed-point number in r3 and r4.
332 lis r7,NSEC_PER_SEC@h 246 * Load & add the xtime stamp.
333 ori r7,r7,NSEC_PER_SEC@l
334 mulhwu r4,r4,r7 /* convert to nanoseconds */
335
336 /* At this point, we have seconds & nanoseconds since the xtime
337 * stamp in r3+CA and r4. Load & add the xtime stamp.
338 */ 247 */
339#ifdef CONFIG_PPC64 248 lwz r5,STAMP_XTIME+TSPEC_TV_SEC(r9)
340 lwz r5,STAMP_XTIME+TSPC64_TV_SEC+LOPART(r9) 249 lwz r6,STAMP_SEC_FRAC(r9)
341 lwz r6,STAMP_XTIME+TSPC64_TV_NSEC+LOPART(r9) 250 addc r4,r4,r6
342#else
343 lwz r5,STAMP_XTIME+TSPC32_TV_SEC(r9)
344 lwz r6,STAMP_XTIME+TSPC32_TV_NSEC(r9)
345#endif
346 add r4,r4,r6
347 adde r3,r3,r5 251 adde r3,r3,r5
348 252
349 /* We now have our result in r3,r4. We create a fake dependency 253 /* We create a fake dependency on the result in r3/r4
350 * on that result and re-check the counter 254 * and re-check the counter
351 */ 255 */
352 or r6,r4,r3 256 or r6,r4,r3
353 xor r0,r6,r6 257 xor r0,r6,r6
354 add r9,r9,r0 258 add r9,r9,r0
355 lwz r0,(CFG_TB_UPDATE_COUNT+LOPART)(r9) 259 lwz r0,(CFG_TB_UPDATE_COUNT+LOPART)(r9)
356 cmpl cr0,r8,r0 /* check if updated */ 260 cmplw cr0,r8,r0 /* check if updated */
357 bne- 1b 261 bne- 1b
358 262
359 /* check for nanosecond overflow and adjust if necessary */ 263 mulhwu r4,r4,r7 /* convert to micro or nanoseconds */
360 cmpw r4,r7
361 bltlr /* all done if no overflow */
362 subf r4,r7,r4 /* adjust if overflow */
363 addi r3,r3,1
364 264
365 blr 265 blr
366 .cfi_endproc 266 .cfi_endproc
diff --git a/arch/powerpc/kernel/vdso64/gettimeofday.S b/arch/powerpc/kernel/vdso64/gettimeofday.S
index 262cd5857a56..e97a9a0dc4ac 100644
--- a/arch/powerpc/kernel/vdso64/gettimeofday.S
+++ b/arch/powerpc/kernel/vdso64/gettimeofday.S
@@ -33,18 +33,11 @@ V_FUNCTION_BEGIN(__kernel_gettimeofday)
33 bl V_LOCAL_FUNC(__get_datapage) /* get data page */ 33 bl V_LOCAL_FUNC(__get_datapage) /* get data page */
34 cmpldi r11,0 /* check if tv is NULL */ 34 cmpldi r11,0 /* check if tv is NULL */
35 beq 2f 35 beq 2f
36 bl V_LOCAL_FUNC(__do_get_xsec) /* get xsec from tb & kernel */ 36 lis r7,1000000@ha /* load up USEC_PER_SEC */
37 lis r7,15 /* r7 = 1000000 = USEC_PER_SEC */ 37 addi r7,r7,1000000@l
38 ori r7,r7,16960 38 bl V_LOCAL_FUNC(__do_get_tspec) /* get sec/us from tb & kernel */
39 rldicl r5,r4,44,20 /* r5 = sec = xsec / XSEC_PER_SEC */ 39 std r4,TVAL64_TV_SEC(r11) /* store sec in tv */
40 rldicr r6,r5,20,43 /* r6 = sec * XSEC_PER_SEC */ 40 std r5,TVAL64_TV_USEC(r11) /* store usec in tv */
41 std r5,TVAL64_TV_SEC(r11) /* store sec in tv */
42 subf r0,r6,r4 /* r0 = xsec = (xsec - r6) */
43 mulld r0,r0,r7 /* usec = (xsec * USEC_PER_SEC) /
44 * XSEC_PER_SEC
45 */
46 rldicl r0,r0,44,20
47 std r0,TVAL64_TV_USEC(r11) /* store usec in tv */
482: cmpldi r10,0 /* check if tz is NULL */ 412: cmpldi r10,0 /* check if tz is NULL */
49 beq 1f 42 beq 1f
50 lwz r4,CFG_TZ_MINUTEWEST(r3)/* fill tz */ 43 lwz r4,CFG_TZ_MINUTEWEST(r3)/* fill tz */
@@ -77,6 +70,8 @@ V_FUNCTION_BEGIN(__kernel_clock_gettime)
77 .cfi_register lr,r12 70 .cfi_register lr,r12
78 mr r11,r4 /* r11 saves tp */ 71 mr r11,r4 /* r11 saves tp */
79 bl V_LOCAL_FUNC(__get_datapage) /* get data page */ 72 bl V_LOCAL_FUNC(__get_datapage) /* get data page */
73 lis r7,NSEC_PER_SEC@h /* want nanoseconds */
74 ori r7,r7,NSEC_PER_SEC@l
8050: bl V_LOCAL_FUNC(__do_get_tspec) /* get time from tb & kernel */ 7550: bl V_LOCAL_FUNC(__do_get_tspec) /* get time from tb & kernel */
81 bne cr1,80f /* if not monotonic, all done */ 76 bne cr1,80f /* if not monotonic, all done */
82 77
@@ -171,49 +166,12 @@ V_FUNCTION_END(__kernel_clock_getres)
171 166
172 167
173/* 168/*
174 * This is the core of gettimeofday(), it returns the xsec 169 * This is the core of clock_gettime() and gettimeofday(),
175 * value in r4 and expects the datapage ptr (non clobbered) 170 * it returns the current time in r4 (seconds) and r5.
176 * in r3. clobbers r0,r4,r5,r6,r7,r8 171 * On entry, r7 gives the resolution of r5, either USEC_PER_SEC
177 * When returning, r8 contains the counter value that can be reused 172 * or NSEC_PER_SEC, giving r5 in microseconds or nanoseconds.
178 */
179V_FUNCTION_BEGIN(__do_get_xsec)
180 .cfi_startproc
181 /* check for update count & load values */
1821: ld r8,CFG_TB_UPDATE_COUNT(r3)
183 andi. r0,r8,1 /* pending update ? loop */
184 bne- 1b
185 xor r0,r8,r8 /* create dependency */
186 add r3,r3,r0
187
188 /* Get TB & offset it. We use the MFTB macro which will generate
189 * workaround code for Cell.
190 */
191 MFTB(r7)
192 ld r9,CFG_TB_ORIG_STAMP(r3)
193 subf r7,r9,r7
194
195 /* Scale result */
196 ld r5,CFG_TB_TO_XS(r3)
197 mulhdu r7,r7,r5
198
199 /* Add stamp since epoch */
200 ld r6,CFG_STAMP_XSEC(r3)
201 add r4,r6,r7
202
203 xor r0,r4,r4
204 add r3,r3,r0
205 ld r0,CFG_TB_UPDATE_COUNT(r3)
206 cmpld cr0,r0,r8 /* check if updated */
207 bne- 1b
208 blr
209 .cfi_endproc
210V_FUNCTION_END(__do_get_xsec)
211
212/*
213 * This is the core of clock_gettime(), it returns the current
214 * time in seconds and nanoseconds in r4 and r5.
215 * It expects the datapage ptr in r3 and doesn't clobber it. 173 * It expects the datapage ptr in r3 and doesn't clobber it.
216 * It clobbers r0 and r6 and returns NSEC_PER_SEC in r7. 174 * It clobbers r0, r6 and r9.
217 * On return, r8 contains the counter value that can be reused. 175 * On return, r8 contains the counter value that can be reused.
218 * This clobbers cr0 but not any other cr field. 176 * This clobbers cr0 but not any other cr field.
219 */ 177 */
@@ -229,18 +187,18 @@ V_FUNCTION_BEGIN(__do_get_tspec)
229 /* Get TB & offset it. We use the MFTB macro which will generate 187 /* Get TB & offset it. We use the MFTB macro which will generate
230 * workaround code for Cell. 188 * workaround code for Cell.
231 */ 189 */
232 MFTB(r7) 190 MFTB(r6)
233 ld r9,CFG_TB_ORIG_STAMP(r3) 191 ld r9,CFG_TB_ORIG_STAMP(r3)
234 subf r7,r9,r7 192 subf r6,r9,r6
235 193
236 /* Scale result */ 194 /* Scale result */
237 ld r5,CFG_TB_TO_XS(r3) 195 ld r5,CFG_TB_TO_XS(r3)
238 sldi r7,r7,12 /* compute time since stamp_xtime */ 196 sldi r6,r6,12 /* compute time since stamp_xtime */
239 mulhdu r6,r7,r5 /* in units of 2^-32 seconds */ 197 mulhdu r6,r6,r5 /* in units of 2^-32 seconds */
240 198
241 /* Add stamp since epoch */ 199 /* Add stamp since epoch */
242 ld r4,STAMP_XTIME+TSPC64_TV_SEC(r3) 200 ld r4,STAMP_XTIME+TSPC64_TV_SEC(r3)
243 ld r5,STAMP_XTIME+TSPC64_TV_NSEC(r3) 201 lwz r5,STAMP_SEC_FRAC(r3)
244 or r0,r4,r5 202 or r0,r4,r5
245 or r0,r0,r6 203 or r0,r0,r6
246 xor r0,r0,r0 204 xor r0,r0,r0
@@ -250,17 +208,11 @@ V_FUNCTION_BEGIN(__do_get_tspec)
250 bne- 1b /* reload if so */ 208 bne- 1b /* reload if so */
251 209
252 /* convert to seconds & nanoseconds and add to stamp */ 210 /* convert to seconds & nanoseconds and add to stamp */
253 lis r7,NSEC_PER_SEC@h 211 add r6,r6,r5 /* add on fractional seconds of xtime */
254 ori r7,r7,NSEC_PER_SEC@l 212 mulhwu r5,r6,r7 /* compute micro or nanoseconds and */
255 mulhwu r0,r6,r7 /* compute nanoseconds and */
256 srdi r6,r6,32 /* seconds since stamp_xtime */ 213 srdi r6,r6,32 /* seconds since stamp_xtime */
257 clrldi r0,r0,32 214 clrldi r5,r5,32
258 add r5,r5,r0 /* add nanoseconds together */
259 cmpd r5,r7 /* overflow? */
260 add r4,r4,r6 215 add r4,r4,r6
261 bltlr /* all done if no overflow */
262 subf r5,r7,r5 /* if overflow, adjust */
263 addi r4,r4,1
264 blr 216 blr
265 .cfi_endproc 217 .cfi_endproc
266V_FUNCTION_END(__do_get_tspec) 218V_FUNCTION_END(__do_get_tspec)
diff --git a/arch/powerpc/kvm/44x_tlb.c b/arch/powerpc/kvm/44x_tlb.c
index 812312542e50..9b9b5cdea840 100644
--- a/arch/powerpc/kvm/44x_tlb.c
+++ b/arch/powerpc/kvm/44x_tlb.c
@@ -316,7 +316,8 @@ void kvmppc_mmu_map(struct kvm_vcpu *vcpu, u64 gvaddr, gpa_t gpaddr,
316 gfn = gpaddr >> PAGE_SHIFT; 316 gfn = gpaddr >> PAGE_SHIFT;
317 new_page = gfn_to_page(vcpu->kvm, gfn); 317 new_page = gfn_to_page(vcpu->kvm, gfn);
318 if (is_error_page(new_page)) { 318 if (is_error_page(new_page)) {
319 printk(KERN_ERR "Couldn't get guest page for gfn %lx!\n", gfn); 319 printk(KERN_ERR "Couldn't get guest page for gfn %llx!\n",
320 (unsigned long long)gfn);
320 kvm_release_page_clean(new_page); 321 kvm_release_page_clean(new_page);
321 return; 322 return;
322 } 323 }
diff --git a/arch/powerpc/kvm/Makefile b/arch/powerpc/kvm/Makefile
index ff436066bf77..d45c818a384c 100644
--- a/arch/powerpc/kvm/Makefile
+++ b/arch/powerpc/kvm/Makefile
@@ -45,6 +45,7 @@ kvm-book3s_64-objs := \
45 book3s.o \ 45 book3s.o \
46 book3s_emulate.o \ 46 book3s_emulate.o \
47 book3s_interrupts.o \ 47 book3s_interrupts.o \
48 book3s_mmu_hpte.o \
48 book3s_64_mmu_host.o \ 49 book3s_64_mmu_host.o \
49 book3s_64_mmu.o \ 50 book3s_64_mmu.o \
50 book3s_32_mmu.o 51 book3s_32_mmu.o
@@ -57,6 +58,7 @@ kvm-book3s_32-objs := \
57 book3s.o \ 58 book3s.o \
58 book3s_emulate.o \ 59 book3s_emulate.o \
59 book3s_interrupts.o \ 60 book3s_interrupts.o \
61 book3s_mmu_hpte.o \
60 book3s_32_mmu_host.o \ 62 book3s_32_mmu_host.o \
61 book3s_32_mmu.o 63 book3s_32_mmu.o
62kvm-objs-$(CONFIG_KVM_BOOK3S_32) := $(kvm-book3s_32-objs) 64kvm-objs-$(CONFIG_KVM_BOOK3S_32) := $(kvm-book3s_32-objs)
diff --git a/arch/powerpc/kvm/book3s.c b/arch/powerpc/kvm/book3s.c
index b998abf1a63d..a3cef30d1d42 100644
--- a/arch/powerpc/kvm/book3s.c
+++ b/arch/powerpc/kvm/book3s.c
@@ -1047,8 +1047,6 @@ int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
1047{ 1047{
1048 int i; 1048 int i;
1049 1049
1050 vcpu_load(vcpu);
1051
1052 regs->pc = kvmppc_get_pc(vcpu); 1050 regs->pc = kvmppc_get_pc(vcpu);
1053 regs->cr = kvmppc_get_cr(vcpu); 1051 regs->cr = kvmppc_get_cr(vcpu);
1054 regs->ctr = kvmppc_get_ctr(vcpu); 1052 regs->ctr = kvmppc_get_ctr(vcpu);
@@ -1069,8 +1067,6 @@ int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
1069 for (i = 0; i < ARRAY_SIZE(regs->gpr); i++) 1067 for (i = 0; i < ARRAY_SIZE(regs->gpr); i++)
1070 regs->gpr[i] = kvmppc_get_gpr(vcpu, i); 1068 regs->gpr[i] = kvmppc_get_gpr(vcpu, i);
1071 1069
1072 vcpu_put(vcpu);
1073
1074 return 0; 1070 return 0;
1075} 1071}
1076 1072
@@ -1078,8 +1074,6 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
1078{ 1074{
1079 int i; 1075 int i;
1080 1076
1081 vcpu_load(vcpu);
1082
1083 kvmppc_set_pc(vcpu, regs->pc); 1077 kvmppc_set_pc(vcpu, regs->pc);
1084 kvmppc_set_cr(vcpu, regs->cr); 1078 kvmppc_set_cr(vcpu, regs->cr);
1085 kvmppc_set_ctr(vcpu, regs->ctr); 1079 kvmppc_set_ctr(vcpu, regs->ctr);
@@ -1099,8 +1093,6 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
1099 for (i = 0; i < ARRAY_SIZE(regs->gpr); i++) 1093 for (i = 0; i < ARRAY_SIZE(regs->gpr); i++)
1100 kvmppc_set_gpr(vcpu, i, regs->gpr[i]); 1094 kvmppc_set_gpr(vcpu, i, regs->gpr[i]);
1101 1095
1102 vcpu_put(vcpu);
1103
1104 return 0; 1096 return 0;
1105} 1097}
1106 1098
@@ -1110,8 +1102,6 @@ int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
1110 struct kvmppc_vcpu_book3s *vcpu3s = to_book3s(vcpu); 1102 struct kvmppc_vcpu_book3s *vcpu3s = to_book3s(vcpu);
1111 int i; 1103 int i;
1112 1104
1113 vcpu_load(vcpu);
1114
1115 sregs->pvr = vcpu->arch.pvr; 1105 sregs->pvr = vcpu->arch.pvr;
1116 1106
1117 sregs->u.s.sdr1 = to_book3s(vcpu)->sdr1; 1107 sregs->u.s.sdr1 = to_book3s(vcpu)->sdr1;
@@ -1131,8 +1121,6 @@ int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
1131 } 1121 }
1132 } 1122 }
1133 1123
1134 vcpu_put(vcpu);
1135
1136 return 0; 1124 return 0;
1137} 1125}
1138 1126
@@ -1142,8 +1130,6 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
1142 struct kvmppc_vcpu_book3s *vcpu3s = to_book3s(vcpu); 1130 struct kvmppc_vcpu_book3s *vcpu3s = to_book3s(vcpu);
1143 int i; 1131 int i;
1144 1132
1145 vcpu_load(vcpu);
1146
1147 kvmppc_set_pvr(vcpu, sregs->pvr); 1133 kvmppc_set_pvr(vcpu, sregs->pvr);
1148 1134
1149 vcpu3s->sdr1 = sregs->u.s.sdr1; 1135 vcpu3s->sdr1 = sregs->u.s.sdr1;
@@ -1171,8 +1157,6 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
1171 /* Flush the MMU after messing with the segments */ 1157 /* Flush the MMU after messing with the segments */
1172 kvmppc_mmu_pte_flush(vcpu, 0, 0); 1158 kvmppc_mmu_pte_flush(vcpu, 0, 0);
1173 1159
1174 vcpu_put(vcpu);
1175
1176 return 0; 1160 return 0;
1177} 1161}
1178 1162
@@ -1309,12 +1293,17 @@ extern int __kvmppc_vcpu_entry(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu);
1309int __kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) 1293int __kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
1310{ 1294{
1311 int ret; 1295 int ret;
1312 struct thread_struct ext_bkp; 1296 double fpr[32][TS_FPRWIDTH];
1297 unsigned int fpscr;
1298 int fpexc_mode;
1313#ifdef CONFIG_ALTIVEC 1299#ifdef CONFIG_ALTIVEC
1314 bool save_vec = current->thread.used_vr; 1300 vector128 vr[32];
1301 vector128 vscr;
1302 unsigned long uninitialized_var(vrsave);
1303 int used_vr;
1315#endif 1304#endif
1316#ifdef CONFIG_VSX 1305#ifdef CONFIG_VSX
1317 bool save_vsx = current->thread.used_vsr; 1306 int used_vsr;
1318#endif 1307#endif
1319 ulong ext_msr; 1308 ulong ext_msr;
1320 1309
@@ -1327,27 +1316,27 @@ int __kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
1327 /* Save FPU state in stack */ 1316 /* Save FPU state in stack */
1328 if (current->thread.regs->msr & MSR_FP) 1317 if (current->thread.regs->msr & MSR_FP)
1329 giveup_fpu(current); 1318 giveup_fpu(current);
1330 memcpy(ext_bkp.fpr, current->thread.fpr, sizeof(current->thread.fpr)); 1319 memcpy(fpr, current->thread.fpr, sizeof(current->thread.fpr));
1331 ext_bkp.fpscr = current->thread.fpscr; 1320 fpscr = current->thread.fpscr.val;
1332 ext_bkp.fpexc_mode = current->thread.fpexc_mode; 1321 fpexc_mode = current->thread.fpexc_mode;
1333 1322
1334#ifdef CONFIG_ALTIVEC 1323#ifdef CONFIG_ALTIVEC
1335 /* Save Altivec state in stack */ 1324 /* Save Altivec state in stack */
1336 if (save_vec) { 1325 used_vr = current->thread.used_vr;
1326 if (used_vr) {
1337 if (current->thread.regs->msr & MSR_VEC) 1327 if (current->thread.regs->msr & MSR_VEC)
1338 giveup_altivec(current); 1328 giveup_altivec(current);
1339 memcpy(ext_bkp.vr, current->thread.vr, sizeof(ext_bkp.vr)); 1329 memcpy(vr, current->thread.vr, sizeof(current->thread.vr));
1340 ext_bkp.vscr = current->thread.vscr; 1330 vscr = current->thread.vscr;
1341 ext_bkp.vrsave = current->thread.vrsave; 1331 vrsave = current->thread.vrsave;
1342 } 1332 }
1343 ext_bkp.used_vr = current->thread.used_vr;
1344#endif 1333#endif
1345 1334
1346#ifdef CONFIG_VSX 1335#ifdef CONFIG_VSX
1347 /* Save VSX state in stack */ 1336 /* Save VSX state in stack */
1348 if (save_vsx && (current->thread.regs->msr & MSR_VSX)) 1337 used_vsr = current->thread.used_vsr;
1338 if (used_vsr && (current->thread.regs->msr & MSR_VSX))
1349 __giveup_vsx(current); 1339 __giveup_vsx(current);
1350 ext_bkp.used_vsr = current->thread.used_vsr;
1351#endif 1340#endif
1352 1341
1353 /* Remember the MSR with disabled extensions */ 1342 /* Remember the MSR with disabled extensions */
@@ -1372,22 +1361,22 @@ int __kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
1372 kvmppc_giveup_ext(vcpu, MSR_VSX); 1361 kvmppc_giveup_ext(vcpu, MSR_VSX);
1373 1362
1374 /* Restore FPU state from stack */ 1363 /* Restore FPU state from stack */
1375 memcpy(current->thread.fpr, ext_bkp.fpr, sizeof(ext_bkp.fpr)); 1364 memcpy(current->thread.fpr, fpr, sizeof(current->thread.fpr));
1376 current->thread.fpscr = ext_bkp.fpscr; 1365 current->thread.fpscr.val = fpscr;
1377 current->thread.fpexc_mode = ext_bkp.fpexc_mode; 1366 current->thread.fpexc_mode = fpexc_mode;
1378 1367
1379#ifdef CONFIG_ALTIVEC 1368#ifdef CONFIG_ALTIVEC
1380 /* Restore Altivec state from stack */ 1369 /* Restore Altivec state from stack */
1381 if (save_vec && current->thread.used_vr) { 1370 if (used_vr && current->thread.used_vr) {
1382 memcpy(current->thread.vr, ext_bkp.vr, sizeof(ext_bkp.vr)); 1371 memcpy(current->thread.vr, vr, sizeof(current->thread.vr));
1383 current->thread.vscr = ext_bkp.vscr; 1372 current->thread.vscr = vscr;
1384 current->thread.vrsave= ext_bkp.vrsave; 1373 current->thread.vrsave = vrsave;
1385 } 1374 }
1386 current->thread.used_vr = ext_bkp.used_vr; 1375 current->thread.used_vr = used_vr;
1387#endif 1376#endif
1388 1377
1389#ifdef CONFIG_VSX 1378#ifdef CONFIG_VSX
1390 current->thread.used_vsr = ext_bkp.used_vsr; 1379 current->thread.used_vsr = used_vsr;
1391#endif 1380#endif
1392 1381
1393 return ret; 1382 return ret;
@@ -1395,12 +1384,22 @@ int __kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu)
1395 1384
1396static int kvmppc_book3s_init(void) 1385static int kvmppc_book3s_init(void)
1397{ 1386{
1398 return kvm_init(NULL, sizeof(struct kvmppc_vcpu_book3s), 0, 1387 int r;
1399 THIS_MODULE); 1388
1389 r = kvm_init(NULL, sizeof(struct kvmppc_vcpu_book3s), 0,
1390 THIS_MODULE);
1391
1392 if (r)
1393 return r;
1394
1395 r = kvmppc_mmu_hpte_sysinit();
1396
1397 return r;
1400} 1398}
1401 1399
1402static void kvmppc_book3s_exit(void) 1400static void kvmppc_book3s_exit(void)
1403{ 1401{
1402 kvmppc_mmu_hpte_sysexit();
1404 kvm_exit(); 1403 kvm_exit();
1405} 1404}
1406 1405
diff --git a/arch/powerpc/kvm/book3s_32_mmu.c b/arch/powerpc/kvm/book3s_32_mmu.c
index 0b10503c8a4a..3292d76101d2 100644
--- a/arch/powerpc/kvm/book3s_32_mmu.c
+++ b/arch/powerpc/kvm/book3s_32_mmu.c
@@ -354,10 +354,10 @@ static int kvmppc_mmu_book3s_32_esid_to_vsid(struct kvm_vcpu *vcpu, ulong esid,
354 *vsid = VSID_REAL_DR | gvsid; 354 *vsid = VSID_REAL_DR | gvsid;
355 break; 355 break;
356 case MSR_DR|MSR_IR: 356 case MSR_DR|MSR_IR:
357 if (!sr->valid) 357 if (sr->valid)
358 return -1; 358 *vsid = sr->vsid;
359 359 else
360 *vsid = sr->vsid; 360 *vsid = VSID_BAT | gvsid;
361 break; 361 break;
362 default: 362 default:
363 BUG(); 363 BUG();
diff --git a/arch/powerpc/kvm/book3s_32_mmu_host.c b/arch/powerpc/kvm/book3s_32_mmu_host.c
index 0bb66005338f..0b51ef872c1e 100644
--- a/arch/powerpc/kvm/book3s_32_mmu_host.c
+++ b/arch/powerpc/kvm/book3s_32_mmu_host.c
@@ -19,6 +19,7 @@
19 */ 19 */
20 20
21#include <linux/kvm_host.h> 21#include <linux/kvm_host.h>
22#include <linux/hash.h>
22 23
23#include <asm/kvm_ppc.h> 24#include <asm/kvm_ppc.h>
24#include <asm/kvm_book3s.h> 25#include <asm/kvm_book3s.h>
@@ -57,139 +58,26 @@
57static ulong htab; 58static ulong htab;
58static u32 htabmask; 59static u32 htabmask;
59 60
60static void invalidate_pte(struct kvm_vcpu *vcpu, struct hpte_cache *pte) 61void kvmppc_mmu_invalidate_pte(struct kvm_vcpu *vcpu, struct hpte_cache *pte)
61{ 62{
62 volatile u32 *pteg; 63 volatile u32 *pteg;
63 64
64 dprintk_mmu("KVM: Flushing SPTE: 0x%llx (0x%llx) -> 0x%llx\n", 65 /* Remove from host HTAB */
65 pte->pte.eaddr, pte->pte.vpage, pte->host_va);
66
67 pteg = (u32*)pte->slot; 66 pteg = (u32*)pte->slot;
68
69 pteg[0] = 0; 67 pteg[0] = 0;
68
69 /* And make sure it's gone from the TLB too */
70 asm volatile ("sync"); 70 asm volatile ("sync");
71 asm volatile ("tlbie %0" : : "r" (pte->pte.eaddr) : "memory"); 71 asm volatile ("tlbie %0" : : "r" (pte->pte.eaddr) : "memory");
72 asm volatile ("sync"); 72 asm volatile ("sync");
73 asm volatile ("tlbsync"); 73 asm volatile ("tlbsync");
74
75 pte->host_va = 0;
76
77 if (pte->pte.may_write)
78 kvm_release_pfn_dirty(pte->pfn);
79 else
80 kvm_release_pfn_clean(pte->pfn);
81}
82
83void kvmppc_mmu_pte_flush(struct kvm_vcpu *vcpu, ulong guest_ea, ulong ea_mask)
84{
85 int i;
86
87 dprintk_mmu("KVM: Flushing %d Shadow PTEs: 0x%x & 0x%x\n",
88 vcpu->arch.hpte_cache_offset, guest_ea, ea_mask);
89 BUG_ON(vcpu->arch.hpte_cache_offset > HPTEG_CACHE_NUM);
90
91 guest_ea &= ea_mask;
92 for (i = 0; i < vcpu->arch.hpte_cache_offset; i++) {
93 struct hpte_cache *pte;
94
95 pte = &vcpu->arch.hpte_cache[i];
96 if (!pte->host_va)
97 continue;
98
99 if ((pte->pte.eaddr & ea_mask) == guest_ea) {
100 invalidate_pte(vcpu, pte);
101 }
102 }
103
104 /* Doing a complete flush -> start from scratch */
105 if (!ea_mask)
106 vcpu->arch.hpte_cache_offset = 0;
107}
108
109void kvmppc_mmu_pte_vflush(struct kvm_vcpu *vcpu, u64 guest_vp, u64 vp_mask)
110{
111 int i;
112
113 dprintk_mmu("KVM: Flushing %d Shadow vPTEs: 0x%llx & 0x%llx\n",
114 vcpu->arch.hpte_cache_offset, guest_vp, vp_mask);
115 BUG_ON(vcpu->arch.hpte_cache_offset > HPTEG_CACHE_NUM);
116
117 guest_vp &= vp_mask;
118 for (i = 0; i < vcpu->arch.hpte_cache_offset; i++) {
119 struct hpte_cache *pte;
120
121 pte = &vcpu->arch.hpte_cache[i];
122 if (!pte->host_va)
123 continue;
124
125 if ((pte->pte.vpage & vp_mask) == guest_vp) {
126 invalidate_pte(vcpu, pte);
127 }
128 }
129}
130
131void kvmppc_mmu_pte_pflush(struct kvm_vcpu *vcpu, ulong pa_start, ulong pa_end)
132{
133 int i;
134
135 dprintk_mmu("KVM: Flushing %d Shadow pPTEs: 0x%llx & 0x%llx\n",
136 vcpu->arch.hpte_cache_offset, pa_start, pa_end);
137 BUG_ON(vcpu->arch.hpte_cache_offset > HPTEG_CACHE_NUM);
138
139 for (i = 0; i < vcpu->arch.hpte_cache_offset; i++) {
140 struct hpte_cache *pte;
141
142 pte = &vcpu->arch.hpte_cache[i];
143 if (!pte->host_va)
144 continue;
145
146 if ((pte->pte.raddr >= pa_start) &&
147 (pte->pte.raddr < pa_end)) {
148 invalidate_pte(vcpu, pte);
149 }
150 }
151}
152
153struct kvmppc_pte *kvmppc_mmu_find_pte(struct kvm_vcpu *vcpu, u64 ea, bool data)
154{
155 int i;
156 u64 guest_vp;
157
158 guest_vp = vcpu->arch.mmu.ea_to_vp(vcpu, ea, false);
159 for (i=0; i<vcpu->arch.hpte_cache_offset; i++) {
160 struct hpte_cache *pte;
161
162 pte = &vcpu->arch.hpte_cache[i];
163 if (!pte->host_va)
164 continue;
165
166 if (pte->pte.vpage == guest_vp)
167 return &pte->pte;
168 }
169
170 return NULL;
171}
172
173static int kvmppc_mmu_hpte_cache_next(struct kvm_vcpu *vcpu)
174{
175 if (vcpu->arch.hpte_cache_offset == HPTEG_CACHE_NUM)
176 kvmppc_mmu_pte_flush(vcpu, 0, 0);
177
178 return vcpu->arch.hpte_cache_offset++;
179} 74}
180 75
181/* We keep 512 gvsid->hvsid entries, mapping the guest ones to the array using 76/* We keep 512 gvsid->hvsid entries, mapping the guest ones to the array using
182 * a hash, so we don't waste cycles on looping */ 77 * a hash, so we don't waste cycles on looping */
183static u16 kvmppc_sid_hash(struct kvm_vcpu *vcpu, u64 gvsid) 78static u16 kvmppc_sid_hash(struct kvm_vcpu *vcpu, u64 gvsid)
184{ 79{
185 return (u16)(((gvsid >> (SID_MAP_BITS * 7)) & SID_MAP_MASK) ^ 80 return hash_64(gvsid, SID_MAP_BITS);
186 ((gvsid >> (SID_MAP_BITS * 6)) & SID_MAP_MASK) ^
187 ((gvsid >> (SID_MAP_BITS * 5)) & SID_MAP_MASK) ^
188 ((gvsid >> (SID_MAP_BITS * 4)) & SID_MAP_MASK) ^
189 ((gvsid >> (SID_MAP_BITS * 3)) & SID_MAP_MASK) ^
190 ((gvsid >> (SID_MAP_BITS * 2)) & SID_MAP_MASK) ^
191 ((gvsid >> (SID_MAP_BITS * 1)) & SID_MAP_MASK) ^
192 ((gvsid >> (SID_MAP_BITS * 0)) & SID_MAP_MASK));
193} 81}
194 82
195 83
@@ -256,7 +144,6 @@ int kvmppc_mmu_map_page(struct kvm_vcpu *vcpu, struct kvmppc_pte *orig_pte)
256 register int rr = 0; 144 register int rr = 0;
257 bool primary = false; 145 bool primary = false;
258 bool evict = false; 146 bool evict = false;
259 int hpte_id;
260 struct hpte_cache *pte; 147 struct hpte_cache *pte;
261 148
262 /* Get host physical address for gpa */ 149 /* Get host physical address for gpa */
@@ -341,8 +228,7 @@ next_pteg:
341 228
342 /* Now tell our Shadow PTE code about the new page */ 229 /* Now tell our Shadow PTE code about the new page */
343 230
344 hpte_id = kvmppc_mmu_hpte_cache_next(vcpu); 231 pte = kvmppc_mmu_hpte_cache_next(vcpu);
345 pte = &vcpu->arch.hpte_cache[hpte_id];
346 232
347 dprintk_mmu("KVM: %c%c Map 0x%llx: [%lx] 0x%llx (0x%llx) -> %lx\n", 233 dprintk_mmu("KVM: %c%c Map 0x%llx: [%lx] 0x%llx (0x%llx) -> %lx\n",
348 orig_pte->may_write ? 'w' : '-', 234 orig_pte->may_write ? 'w' : '-',
@@ -355,6 +241,8 @@ next_pteg:
355 pte->pte = *orig_pte; 241 pte->pte = *orig_pte;
356 pte->pfn = hpaddr >> PAGE_SHIFT; 242 pte->pfn = hpaddr >> PAGE_SHIFT;
357 243
244 kvmppc_mmu_hpte_cache_map(vcpu, pte);
245
358 return 0; 246 return 0;
359} 247}
360 248
@@ -439,7 +327,7 @@ void kvmppc_mmu_flush_segments(struct kvm_vcpu *vcpu)
439 327
440void kvmppc_mmu_destroy(struct kvm_vcpu *vcpu) 328void kvmppc_mmu_destroy(struct kvm_vcpu *vcpu)
441{ 329{
442 kvmppc_mmu_pte_flush(vcpu, 0, 0); 330 kvmppc_mmu_hpte_destroy(vcpu);
443 preempt_disable(); 331 preempt_disable();
444 __destroy_context(to_book3s(vcpu)->context_id); 332 __destroy_context(to_book3s(vcpu)->context_id);
445 preempt_enable(); 333 preempt_enable();
@@ -479,5 +367,7 @@ int kvmppc_mmu_init(struct kvm_vcpu *vcpu)
479 htabmask = ((sdr1 & 0x1FF) << 16) | 0xFFC0; 367 htabmask = ((sdr1 & 0x1FF) << 16) | 0xFFC0;
480 htab = (ulong)__va(sdr1 & 0xffff0000); 368 htab = (ulong)__va(sdr1 & 0xffff0000);
481 369
370 kvmppc_mmu_hpte_init(vcpu);
371
482 return 0; 372 return 0;
483} 373}
diff --git a/arch/powerpc/kvm/book3s_64_mmu_host.c b/arch/powerpc/kvm/book3s_64_mmu_host.c
index e4b5744977f6..384179a5002b 100644
--- a/arch/powerpc/kvm/book3s_64_mmu_host.c
+++ b/arch/powerpc/kvm/book3s_64_mmu_host.c
@@ -20,6 +20,7 @@
20 */ 20 */
21 21
22#include <linux/kvm_host.h> 22#include <linux/kvm_host.h>
23#include <linux/hash.h>
23 24
24#include <asm/kvm_ppc.h> 25#include <asm/kvm_ppc.h>
25#include <asm/kvm_book3s.h> 26#include <asm/kvm_book3s.h>
@@ -46,135 +47,20 @@
46#define dprintk_slb(a, ...) do { } while(0) 47#define dprintk_slb(a, ...) do { } while(0)
47#endif 48#endif
48 49
49static void invalidate_pte(struct hpte_cache *pte) 50void kvmppc_mmu_invalidate_pte(struct kvm_vcpu *vcpu, struct hpte_cache *pte)
50{ 51{
51 dprintk_mmu("KVM: Flushing SPT: 0x%lx (0x%llx) -> 0x%llx\n",
52 pte->pte.eaddr, pte->pte.vpage, pte->host_va);
53
54 ppc_md.hpte_invalidate(pte->slot, pte->host_va, 52 ppc_md.hpte_invalidate(pte->slot, pte->host_va,
55 MMU_PAGE_4K, MMU_SEGSIZE_256M, 53 MMU_PAGE_4K, MMU_SEGSIZE_256M,
56 false); 54 false);
57 pte->host_va = 0;
58
59 if (pte->pte.may_write)
60 kvm_release_pfn_dirty(pte->pfn);
61 else
62 kvm_release_pfn_clean(pte->pfn);
63}
64
65void kvmppc_mmu_pte_flush(struct kvm_vcpu *vcpu, ulong guest_ea, ulong ea_mask)
66{
67 int i;
68
69 dprintk_mmu("KVM: Flushing %d Shadow PTEs: 0x%lx & 0x%lx\n",
70 vcpu->arch.hpte_cache_offset, guest_ea, ea_mask);
71 BUG_ON(vcpu->arch.hpte_cache_offset > HPTEG_CACHE_NUM);
72
73 guest_ea &= ea_mask;
74 for (i = 0; i < vcpu->arch.hpte_cache_offset; i++) {
75 struct hpte_cache *pte;
76
77 pte = &vcpu->arch.hpte_cache[i];
78 if (!pte->host_va)
79 continue;
80
81 if ((pte->pte.eaddr & ea_mask) == guest_ea) {
82 invalidate_pte(pte);
83 }
84 }
85
86 /* Doing a complete flush -> start from scratch */
87 if (!ea_mask)
88 vcpu->arch.hpte_cache_offset = 0;
89}
90
91void kvmppc_mmu_pte_vflush(struct kvm_vcpu *vcpu, u64 guest_vp, u64 vp_mask)
92{
93 int i;
94
95 dprintk_mmu("KVM: Flushing %d Shadow vPTEs: 0x%llx & 0x%llx\n",
96 vcpu->arch.hpte_cache_offset, guest_vp, vp_mask);
97 BUG_ON(vcpu->arch.hpte_cache_offset > HPTEG_CACHE_NUM);
98
99 guest_vp &= vp_mask;
100 for (i = 0; i < vcpu->arch.hpte_cache_offset; i++) {
101 struct hpte_cache *pte;
102
103 pte = &vcpu->arch.hpte_cache[i];
104 if (!pte->host_va)
105 continue;
106
107 if ((pte->pte.vpage & vp_mask) == guest_vp) {
108 invalidate_pte(pte);
109 }
110 }
111}
112
113void kvmppc_mmu_pte_pflush(struct kvm_vcpu *vcpu, ulong pa_start, ulong pa_end)
114{
115 int i;
116
117 dprintk_mmu("KVM: Flushing %d Shadow pPTEs: 0x%lx & 0x%lx\n",
118 vcpu->arch.hpte_cache_offset, pa_start, pa_end);
119 BUG_ON(vcpu->arch.hpte_cache_offset > HPTEG_CACHE_NUM);
120
121 for (i = 0; i < vcpu->arch.hpte_cache_offset; i++) {
122 struct hpte_cache *pte;
123
124 pte = &vcpu->arch.hpte_cache[i];
125 if (!pte->host_va)
126 continue;
127
128 if ((pte->pte.raddr >= pa_start) &&
129 (pte->pte.raddr < pa_end)) {
130 invalidate_pte(pte);
131 }
132 }
133}
134
135struct kvmppc_pte *kvmppc_mmu_find_pte(struct kvm_vcpu *vcpu, u64 ea, bool data)
136{
137 int i;
138 u64 guest_vp;
139
140 guest_vp = vcpu->arch.mmu.ea_to_vp(vcpu, ea, false);
141 for (i=0; i<vcpu->arch.hpte_cache_offset; i++) {
142 struct hpte_cache *pte;
143
144 pte = &vcpu->arch.hpte_cache[i];
145 if (!pte->host_va)
146 continue;
147
148 if (pte->pte.vpage == guest_vp)
149 return &pte->pte;
150 }
151
152 return NULL;
153}
154
155static int kvmppc_mmu_hpte_cache_next(struct kvm_vcpu *vcpu)
156{
157 if (vcpu->arch.hpte_cache_offset == HPTEG_CACHE_NUM)
158 kvmppc_mmu_pte_flush(vcpu, 0, 0);
159
160 return vcpu->arch.hpte_cache_offset++;
161} 55}
162 56
163/* We keep 512 gvsid->hvsid entries, mapping the guest ones to the array using 57/* We keep 512 gvsid->hvsid entries, mapping the guest ones to the array using
164 * a hash, so we don't waste cycles on looping */ 58 * a hash, so we don't waste cycles on looping */
165static u16 kvmppc_sid_hash(struct kvm_vcpu *vcpu, u64 gvsid) 59static u16 kvmppc_sid_hash(struct kvm_vcpu *vcpu, u64 gvsid)
166{ 60{
167 return (u16)(((gvsid >> (SID_MAP_BITS * 7)) & SID_MAP_MASK) ^ 61 return hash_64(gvsid, SID_MAP_BITS);
168 ((gvsid >> (SID_MAP_BITS * 6)) & SID_MAP_MASK) ^
169 ((gvsid >> (SID_MAP_BITS * 5)) & SID_MAP_MASK) ^
170 ((gvsid >> (SID_MAP_BITS * 4)) & SID_MAP_MASK) ^
171 ((gvsid >> (SID_MAP_BITS * 3)) & SID_MAP_MASK) ^
172 ((gvsid >> (SID_MAP_BITS * 2)) & SID_MAP_MASK) ^
173 ((gvsid >> (SID_MAP_BITS * 1)) & SID_MAP_MASK) ^
174 ((gvsid >> (SID_MAP_BITS * 0)) & SID_MAP_MASK));
175} 62}
176 63
177
178static struct kvmppc_sid_map *find_sid_vsid(struct kvm_vcpu *vcpu, u64 gvsid) 64static struct kvmppc_sid_map *find_sid_vsid(struct kvm_vcpu *vcpu, u64 gvsid)
179{ 65{
180 struct kvmppc_sid_map *map; 66 struct kvmppc_sid_map *map;
@@ -273,8 +159,7 @@ map_again:
273 attempt++; 159 attempt++;
274 goto map_again; 160 goto map_again;
275 } else { 161 } else {
276 int hpte_id = kvmppc_mmu_hpte_cache_next(vcpu); 162 struct hpte_cache *pte = kvmppc_mmu_hpte_cache_next(vcpu);
277 struct hpte_cache *pte = &vcpu->arch.hpte_cache[hpte_id];
278 163
279 dprintk_mmu("KVM: %c%c Map 0x%lx: [%lx] 0x%lx (0x%llx) -> %lx\n", 164 dprintk_mmu("KVM: %c%c Map 0x%lx: [%lx] 0x%lx (0x%llx) -> %lx\n",
280 ((rflags & HPTE_R_PP) == 3) ? '-' : 'w', 165 ((rflags & HPTE_R_PP) == 3) ? '-' : 'w',
@@ -292,6 +177,8 @@ map_again:
292 pte->host_va = va; 177 pte->host_va = va;
293 pte->pte = *orig_pte; 178 pte->pte = *orig_pte;
294 pte->pfn = hpaddr >> PAGE_SHIFT; 179 pte->pfn = hpaddr >> PAGE_SHIFT;
180
181 kvmppc_mmu_hpte_cache_map(vcpu, pte);
295 } 182 }
296 183
297 return 0; 184 return 0;
@@ -418,7 +305,7 @@ void kvmppc_mmu_flush_segments(struct kvm_vcpu *vcpu)
418 305
419void kvmppc_mmu_destroy(struct kvm_vcpu *vcpu) 306void kvmppc_mmu_destroy(struct kvm_vcpu *vcpu)
420{ 307{
421 kvmppc_mmu_pte_flush(vcpu, 0, 0); 308 kvmppc_mmu_hpte_destroy(vcpu);
422 __destroy_context(to_book3s(vcpu)->context_id); 309 __destroy_context(to_book3s(vcpu)->context_id);
423} 310}
424 311
@@ -436,5 +323,7 @@ int kvmppc_mmu_init(struct kvm_vcpu *vcpu)
436 vcpu3s->vsid_first = vcpu3s->context_id << USER_ESID_BITS; 323 vcpu3s->vsid_first = vcpu3s->context_id << USER_ESID_BITS;
437 vcpu3s->vsid_next = vcpu3s->vsid_first; 324 vcpu3s->vsid_next = vcpu3s->vsid_first;
438 325
326 kvmppc_mmu_hpte_init(vcpu);
327
439 return 0; 328 return 0;
440} 329}
diff --git a/arch/powerpc/kvm/book3s_mmu_hpte.c b/arch/powerpc/kvm/book3s_mmu_hpte.c
new file mode 100644
index 000000000000..4868d4a7ebc5
--- /dev/null
+++ b/arch/powerpc/kvm/book3s_mmu_hpte.c
@@ -0,0 +1,277 @@
1/*
2 * Copyright (C) 2010 SUSE Linux Products GmbH. All rights reserved.
3 *
4 * Authors:
5 * Alexander Graf <agraf@suse.de>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License, version 2, as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20
21#include <linux/kvm_host.h>
22#include <linux/hash.h>
23#include <linux/slab.h>
24
25#include <asm/kvm_ppc.h>
26#include <asm/kvm_book3s.h>
27#include <asm/machdep.h>
28#include <asm/mmu_context.h>
29#include <asm/hw_irq.h>
30
31#define PTE_SIZE 12
32
33/* #define DEBUG_MMU */
34
35#ifdef DEBUG_MMU
36#define dprintk_mmu(a, ...) printk(KERN_INFO a, __VA_ARGS__)
37#else
38#define dprintk_mmu(a, ...) do { } while(0)
39#endif
40
41static struct kmem_cache *hpte_cache;
42
43static inline u64 kvmppc_mmu_hash_pte(u64 eaddr)
44{
45 return hash_64(eaddr >> PTE_SIZE, HPTEG_HASH_BITS_PTE);
46}
47
48static inline u64 kvmppc_mmu_hash_vpte(u64 vpage)
49{
50 return hash_64(vpage & 0xfffffffffULL, HPTEG_HASH_BITS_VPTE);
51}
52
53static inline u64 kvmppc_mmu_hash_vpte_long(u64 vpage)
54{
55 return hash_64((vpage & 0xffffff000ULL) >> 12,
56 HPTEG_HASH_BITS_VPTE_LONG);
57}
58
59void kvmppc_mmu_hpte_cache_map(struct kvm_vcpu *vcpu, struct hpte_cache *pte)
60{
61 u64 index;
62
63 /* Add to ePTE list */
64 index = kvmppc_mmu_hash_pte(pte->pte.eaddr);
65 hlist_add_head(&pte->list_pte, &vcpu->arch.hpte_hash_pte[index]);
66
67 /* Add to vPTE list */
68 index = kvmppc_mmu_hash_vpte(pte->pte.vpage);
69 hlist_add_head(&pte->list_vpte, &vcpu->arch.hpte_hash_vpte[index]);
70
71 /* Add to vPTE_long list */
72 index = kvmppc_mmu_hash_vpte_long(pte->pte.vpage);
73 hlist_add_head(&pte->list_vpte_long,
74 &vcpu->arch.hpte_hash_vpte_long[index]);
75}
76
77static void invalidate_pte(struct kvm_vcpu *vcpu, struct hpte_cache *pte)
78{
79 dprintk_mmu("KVM: Flushing SPT: 0x%lx (0x%llx) -> 0x%llx\n",
80 pte->pte.eaddr, pte->pte.vpage, pte->host_va);
81
82 /* Different for 32 and 64 bit */
83 kvmppc_mmu_invalidate_pte(vcpu, pte);
84
85 if (pte->pte.may_write)
86 kvm_release_pfn_dirty(pte->pfn);
87 else
88 kvm_release_pfn_clean(pte->pfn);
89
90 hlist_del(&pte->list_pte);
91 hlist_del(&pte->list_vpte);
92 hlist_del(&pte->list_vpte_long);
93
94 vcpu->arch.hpte_cache_count--;
95 kmem_cache_free(hpte_cache, pte);
96}
97
98static void kvmppc_mmu_pte_flush_all(struct kvm_vcpu *vcpu)
99{
100 struct hpte_cache *pte;
101 struct hlist_node *node, *tmp;
102 int i;
103
104 for (i = 0; i < HPTEG_HASH_NUM_VPTE_LONG; i++) {
105 struct hlist_head *list = &vcpu->arch.hpte_hash_vpte_long[i];
106
107 hlist_for_each_entry_safe(pte, node, tmp, list, list_vpte_long)
108 invalidate_pte(vcpu, pte);
109 }
110}
111
112static void kvmppc_mmu_pte_flush_page(struct kvm_vcpu *vcpu, ulong guest_ea)
113{
114 struct hlist_head *list;
115 struct hlist_node *node, *tmp;
116 struct hpte_cache *pte;
117
118 /* Find the list of entries in the map */
119 list = &vcpu->arch.hpte_hash_pte[kvmppc_mmu_hash_pte(guest_ea)];
120
121 /* Check the list for matching entries and invalidate */
122 hlist_for_each_entry_safe(pte, node, tmp, list, list_pte)
123 if ((pte->pte.eaddr & ~0xfffUL) == guest_ea)
124 invalidate_pte(vcpu, pte);
125}
126
127void kvmppc_mmu_pte_flush(struct kvm_vcpu *vcpu, ulong guest_ea, ulong ea_mask)
128{
129 u64 i;
130
131 dprintk_mmu("KVM: Flushing %d Shadow PTEs: 0x%lx & 0x%lx\n",
132 vcpu->arch.hpte_cache_count, guest_ea, ea_mask);
133
134 guest_ea &= ea_mask;
135
136 switch (ea_mask) {
137 case ~0xfffUL:
138 kvmppc_mmu_pte_flush_page(vcpu, guest_ea);
139 break;
140 case 0x0ffff000:
141 /* 32-bit flush w/o segment, go through all possible segments */
142 for (i = 0; i < 0x100000000ULL; i += 0x10000000ULL)
143 kvmppc_mmu_pte_flush(vcpu, guest_ea | i, ~0xfffUL);
144 break;
145 case 0:
146 /* Doing a complete flush -> start from scratch */
147 kvmppc_mmu_pte_flush_all(vcpu);
148 break;
149 default:
150 WARN_ON(1);
151 break;
152 }
153}
154
155/* Flush with mask 0xfffffffff */
156static void kvmppc_mmu_pte_vflush_short(struct kvm_vcpu *vcpu, u64 guest_vp)
157{
158 struct hlist_head *list;
159 struct hlist_node *node, *tmp;
160 struct hpte_cache *pte;
161 u64 vp_mask = 0xfffffffffULL;
162
163 list = &vcpu->arch.hpte_hash_vpte[kvmppc_mmu_hash_vpte(guest_vp)];
164
165 /* Check the list for matching entries and invalidate */
166 hlist_for_each_entry_safe(pte, node, tmp, list, list_vpte)
167 if ((pte->pte.vpage & vp_mask) == guest_vp)
168 invalidate_pte(vcpu, pte);
169}
170
171/* Flush with mask 0xffffff000 */
172static void kvmppc_mmu_pte_vflush_long(struct kvm_vcpu *vcpu, u64 guest_vp)
173{
174 struct hlist_head *list;
175 struct hlist_node *node, *tmp;
176 struct hpte_cache *pte;
177 u64 vp_mask = 0xffffff000ULL;
178
179 list = &vcpu->arch.hpte_hash_vpte_long[
180 kvmppc_mmu_hash_vpte_long(guest_vp)];
181
182 /* Check the list for matching entries and invalidate */
183 hlist_for_each_entry_safe(pte, node, tmp, list, list_vpte_long)
184 if ((pte->pte.vpage & vp_mask) == guest_vp)
185 invalidate_pte(vcpu, pte);
186}
187
188void kvmppc_mmu_pte_vflush(struct kvm_vcpu *vcpu, u64 guest_vp, u64 vp_mask)
189{
190 dprintk_mmu("KVM: Flushing %d Shadow vPTEs: 0x%llx & 0x%llx\n",
191 vcpu->arch.hpte_cache_count, guest_vp, vp_mask);
192 guest_vp &= vp_mask;
193
194 switch(vp_mask) {
195 case 0xfffffffffULL:
196 kvmppc_mmu_pte_vflush_short(vcpu, guest_vp);
197 break;
198 case 0xffffff000ULL:
199 kvmppc_mmu_pte_vflush_long(vcpu, guest_vp);
200 break;
201 default:
202 WARN_ON(1);
203 return;
204 }
205}
206
207void kvmppc_mmu_pte_pflush(struct kvm_vcpu *vcpu, ulong pa_start, ulong pa_end)
208{
209 struct hlist_node *node, *tmp;
210 struct hpte_cache *pte;
211 int i;
212
213 dprintk_mmu("KVM: Flushing %d Shadow pPTEs: 0x%lx - 0x%lx\n",
214 vcpu->arch.hpte_cache_count, pa_start, pa_end);
215
216 for (i = 0; i < HPTEG_HASH_NUM_VPTE_LONG; i++) {
217 struct hlist_head *list = &vcpu->arch.hpte_hash_vpte_long[i];
218
219 hlist_for_each_entry_safe(pte, node, tmp, list, list_vpte_long)
220 if ((pte->pte.raddr >= pa_start) &&
221 (pte->pte.raddr < pa_end))
222 invalidate_pte(vcpu, pte);
223 }
224}
225
226struct hpte_cache *kvmppc_mmu_hpte_cache_next(struct kvm_vcpu *vcpu)
227{
228 struct hpte_cache *pte;
229
230 pte = kmem_cache_zalloc(hpte_cache, GFP_KERNEL);
231 vcpu->arch.hpte_cache_count++;
232
233 if (vcpu->arch.hpte_cache_count == HPTEG_CACHE_NUM)
234 kvmppc_mmu_pte_flush_all(vcpu);
235
236 return pte;
237}
238
239void kvmppc_mmu_hpte_destroy(struct kvm_vcpu *vcpu)
240{
241 kvmppc_mmu_pte_flush(vcpu, 0, 0);
242}
243
244static void kvmppc_mmu_hpte_init_hash(struct hlist_head *hash_list, int len)
245{
246 int i;
247
248 for (i = 0; i < len; i++)
249 INIT_HLIST_HEAD(&hash_list[i]);
250}
251
252int kvmppc_mmu_hpte_init(struct kvm_vcpu *vcpu)
253{
254 /* init hpte lookup hashes */
255 kvmppc_mmu_hpte_init_hash(vcpu->arch.hpte_hash_pte,
256 ARRAY_SIZE(vcpu->arch.hpte_hash_pte));
257 kvmppc_mmu_hpte_init_hash(vcpu->arch.hpte_hash_vpte,
258 ARRAY_SIZE(vcpu->arch.hpte_hash_vpte));
259 kvmppc_mmu_hpte_init_hash(vcpu->arch.hpte_hash_vpte_long,
260 ARRAY_SIZE(vcpu->arch.hpte_hash_vpte_long));
261
262 return 0;
263}
264
265int kvmppc_mmu_hpte_sysinit(void)
266{
267 /* init hpte slab cache */
268 hpte_cache = kmem_cache_create("kvm-spt", sizeof(struct hpte_cache),
269 sizeof(struct hpte_cache), 0, NULL);
270
271 return 0;
272}
273
274void kvmppc_mmu_hpte_sysexit(void)
275{
276 kmem_cache_destroy(hpte_cache);
277}
diff --git a/arch/powerpc/kvm/book3s_paired_singles.c b/arch/powerpc/kvm/book3s_paired_singles.c
index a9f66abafcb3..474f2e24050a 100644
--- a/arch/powerpc/kvm/book3s_paired_singles.c
+++ b/arch/powerpc/kvm/book3s_paired_singles.c
@@ -159,10 +159,7 @@
159 159
160static inline void kvmppc_sync_qpr(struct kvm_vcpu *vcpu, int rt) 160static inline void kvmppc_sync_qpr(struct kvm_vcpu *vcpu, int rt)
161{ 161{
162 struct thread_struct t; 162 kvm_cvt_df(&vcpu->arch.fpr[rt], &vcpu->arch.qpr[rt], &vcpu->arch.fpscr);
163
164 t.fpscr.val = vcpu->arch.fpscr;
165 cvt_df((double*)&vcpu->arch.fpr[rt], (float*)&vcpu->arch.qpr[rt], &t);
166} 163}
167 164
168static void kvmppc_inject_pf(struct kvm_vcpu *vcpu, ulong eaddr, bool is_store) 165static void kvmppc_inject_pf(struct kvm_vcpu *vcpu, ulong eaddr, bool is_store)
@@ -183,7 +180,6 @@ static int kvmppc_emulate_fpr_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
183 int rs, ulong addr, int ls_type) 180 int rs, ulong addr, int ls_type)
184{ 181{
185 int emulated = EMULATE_FAIL; 182 int emulated = EMULATE_FAIL;
186 struct thread_struct t;
187 int r; 183 int r;
188 char tmp[8]; 184 char tmp[8];
189 int len = sizeof(u32); 185 int len = sizeof(u32);
@@ -191,8 +187,6 @@ static int kvmppc_emulate_fpr_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
191 if (ls_type == FPU_LS_DOUBLE) 187 if (ls_type == FPU_LS_DOUBLE)
192 len = sizeof(u64); 188 len = sizeof(u64);
193 189
194 t.fpscr.val = vcpu->arch.fpscr;
195
196 /* read from memory */ 190 /* read from memory */
197 r = kvmppc_ld(vcpu, &addr, len, tmp, true); 191 r = kvmppc_ld(vcpu, &addr, len, tmp, true);
198 vcpu->arch.paddr_accessed = addr; 192 vcpu->arch.paddr_accessed = addr;
@@ -210,7 +204,7 @@ static int kvmppc_emulate_fpr_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
210 /* put in registers */ 204 /* put in registers */
211 switch (ls_type) { 205 switch (ls_type) {
212 case FPU_LS_SINGLE: 206 case FPU_LS_SINGLE:
213 cvt_fd((float*)tmp, (double*)&vcpu->arch.fpr[rs], &t); 207 kvm_cvt_fd((u32*)tmp, &vcpu->arch.fpr[rs], &vcpu->arch.fpscr);
214 vcpu->arch.qpr[rs] = *((u32*)tmp); 208 vcpu->arch.qpr[rs] = *((u32*)tmp);
215 break; 209 break;
216 case FPU_LS_DOUBLE: 210 case FPU_LS_DOUBLE:
@@ -229,17 +223,14 @@ static int kvmppc_emulate_fpr_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
229 int rs, ulong addr, int ls_type) 223 int rs, ulong addr, int ls_type)
230{ 224{
231 int emulated = EMULATE_FAIL; 225 int emulated = EMULATE_FAIL;
232 struct thread_struct t;
233 int r; 226 int r;
234 char tmp[8]; 227 char tmp[8];
235 u64 val; 228 u64 val;
236 int len; 229 int len;
237 230
238 t.fpscr.val = vcpu->arch.fpscr;
239
240 switch (ls_type) { 231 switch (ls_type) {
241 case FPU_LS_SINGLE: 232 case FPU_LS_SINGLE:
242 cvt_df((double*)&vcpu->arch.fpr[rs], (float*)tmp, &t); 233 kvm_cvt_df(&vcpu->arch.fpr[rs], (u32*)tmp, &vcpu->arch.fpscr);
243 val = *((u32*)tmp); 234 val = *((u32*)tmp);
244 len = sizeof(u32); 235 len = sizeof(u32);
245 break; 236 break;
@@ -278,13 +269,10 @@ static int kvmppc_emulate_psq_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
278 int rs, ulong addr, bool w, int i) 269 int rs, ulong addr, bool w, int i)
279{ 270{
280 int emulated = EMULATE_FAIL; 271 int emulated = EMULATE_FAIL;
281 struct thread_struct t;
282 int r; 272 int r;
283 float one = 1.0; 273 float one = 1.0;
284 u32 tmp[2]; 274 u32 tmp[2];
285 275
286 t.fpscr.val = vcpu->arch.fpscr;
287
288 /* read from memory */ 276 /* read from memory */
289 if (w) { 277 if (w) {
290 r = kvmppc_ld(vcpu, &addr, sizeof(u32), tmp, true); 278 r = kvmppc_ld(vcpu, &addr, sizeof(u32), tmp, true);
@@ -308,7 +296,7 @@ static int kvmppc_emulate_psq_load(struct kvm_run *run, struct kvm_vcpu *vcpu,
308 emulated = EMULATE_DONE; 296 emulated = EMULATE_DONE;
309 297
310 /* put in registers */ 298 /* put in registers */
311 cvt_fd((float*)&tmp[0], (double*)&vcpu->arch.fpr[rs], &t); 299 kvm_cvt_fd(&tmp[0], &vcpu->arch.fpr[rs], &vcpu->arch.fpscr);
312 vcpu->arch.qpr[rs] = tmp[1]; 300 vcpu->arch.qpr[rs] = tmp[1];
313 301
314 dprintk(KERN_INFO "KVM: PSQ_LD [0x%x, 0x%x] at 0x%lx (%d)\n", tmp[0], 302 dprintk(KERN_INFO "KVM: PSQ_LD [0x%x, 0x%x] at 0x%lx (%d)\n", tmp[0],
@@ -322,14 +310,11 @@ static int kvmppc_emulate_psq_store(struct kvm_run *run, struct kvm_vcpu *vcpu,
322 int rs, ulong addr, bool w, int i) 310 int rs, ulong addr, bool w, int i)
323{ 311{
324 int emulated = EMULATE_FAIL; 312 int emulated = EMULATE_FAIL;
325 struct thread_struct t;
326 int r; 313 int r;
327 u32 tmp[2]; 314 u32 tmp[2];
328 int len = w ? sizeof(u32) : sizeof(u64); 315 int len = w ? sizeof(u32) : sizeof(u64);
329 316
330 t.fpscr.val = vcpu->arch.fpscr; 317 kvm_cvt_df(&vcpu->arch.fpr[rs], &tmp[0], &vcpu->arch.fpscr);
331
332 cvt_df((double*)&vcpu->arch.fpr[rs], (float*)&tmp[0], &t);
333 tmp[1] = vcpu->arch.qpr[rs]; 318 tmp[1] = vcpu->arch.qpr[rs];
334 319
335 r = kvmppc_st(vcpu, &addr, len, tmp, true); 320 r = kvmppc_st(vcpu, &addr, len, tmp, true);
@@ -517,7 +502,7 @@ static int get_d_signext(u32 inst)
517static int kvmppc_ps_three_in(struct kvm_vcpu *vcpu, bool rc, 502static int kvmppc_ps_three_in(struct kvm_vcpu *vcpu, bool rc,
518 int reg_out, int reg_in1, int reg_in2, 503 int reg_out, int reg_in1, int reg_in2,
519 int reg_in3, int scalar, 504 int reg_in3, int scalar,
520 void (*func)(struct thread_struct *t, 505 void (*func)(u64 *fpscr,
521 u32 *dst, u32 *src1, 506 u32 *dst, u32 *src1,
522 u32 *src2, u32 *src3)) 507 u32 *src2, u32 *src3))
523{ 508{
@@ -526,27 +511,25 @@ static int kvmppc_ps_three_in(struct kvm_vcpu *vcpu, bool rc,
526 u32 ps0_out; 511 u32 ps0_out;
527 u32 ps0_in1, ps0_in2, ps0_in3; 512 u32 ps0_in1, ps0_in2, ps0_in3;
528 u32 ps1_in1, ps1_in2, ps1_in3; 513 u32 ps1_in1, ps1_in2, ps1_in3;
529 struct thread_struct t;
530 t.fpscr.val = vcpu->arch.fpscr;
531 514
532 /* RC */ 515 /* RC */
533 WARN_ON(rc); 516 WARN_ON(rc);
534 517
535 /* PS0 */ 518 /* PS0 */
536 cvt_df((double*)&fpr[reg_in1], (float*)&ps0_in1, &t); 519 kvm_cvt_df(&fpr[reg_in1], &ps0_in1, &vcpu->arch.fpscr);
537 cvt_df((double*)&fpr[reg_in2], (float*)&ps0_in2, &t); 520 kvm_cvt_df(&fpr[reg_in2], &ps0_in2, &vcpu->arch.fpscr);
538 cvt_df((double*)&fpr[reg_in3], (float*)&ps0_in3, &t); 521 kvm_cvt_df(&fpr[reg_in3], &ps0_in3, &vcpu->arch.fpscr);
539 522
540 if (scalar & SCALAR_LOW) 523 if (scalar & SCALAR_LOW)
541 ps0_in2 = qpr[reg_in2]; 524 ps0_in2 = qpr[reg_in2];
542 525
543 func(&t, &ps0_out, &ps0_in1, &ps0_in2, &ps0_in3); 526 func(&vcpu->arch.fpscr, &ps0_out, &ps0_in1, &ps0_in2, &ps0_in3);
544 527
545 dprintk(KERN_INFO "PS3 ps0 -> f(0x%x, 0x%x, 0x%x) = 0x%x\n", 528 dprintk(KERN_INFO "PS3 ps0 -> f(0x%x, 0x%x, 0x%x) = 0x%x\n",
546 ps0_in1, ps0_in2, ps0_in3, ps0_out); 529 ps0_in1, ps0_in2, ps0_in3, ps0_out);
547 530
548 if (!(scalar & SCALAR_NO_PS0)) 531 if (!(scalar & SCALAR_NO_PS0))
549 cvt_fd((float*)&ps0_out, (double*)&fpr[reg_out], &t); 532 kvm_cvt_fd(&ps0_out, &fpr[reg_out], &vcpu->arch.fpscr);
550 533
551 /* PS1 */ 534 /* PS1 */
552 ps1_in1 = qpr[reg_in1]; 535 ps1_in1 = qpr[reg_in1];
@@ -557,7 +540,7 @@ static int kvmppc_ps_three_in(struct kvm_vcpu *vcpu, bool rc,
557 ps1_in2 = ps0_in2; 540 ps1_in2 = ps0_in2;
558 541
559 if (!(scalar & SCALAR_NO_PS1)) 542 if (!(scalar & SCALAR_NO_PS1))
560 func(&t, &qpr[reg_out], &ps1_in1, &ps1_in2, &ps1_in3); 543 func(&vcpu->arch.fpscr, &qpr[reg_out], &ps1_in1, &ps1_in2, &ps1_in3);
561 544
562 dprintk(KERN_INFO "PS3 ps1 -> f(0x%x, 0x%x, 0x%x) = 0x%x\n", 545 dprintk(KERN_INFO "PS3 ps1 -> f(0x%x, 0x%x, 0x%x) = 0x%x\n",
563 ps1_in1, ps1_in2, ps1_in3, qpr[reg_out]); 546 ps1_in1, ps1_in2, ps1_in3, qpr[reg_out]);
@@ -568,7 +551,7 @@ static int kvmppc_ps_three_in(struct kvm_vcpu *vcpu, bool rc,
568static int kvmppc_ps_two_in(struct kvm_vcpu *vcpu, bool rc, 551static int kvmppc_ps_two_in(struct kvm_vcpu *vcpu, bool rc,
569 int reg_out, int reg_in1, int reg_in2, 552 int reg_out, int reg_in1, int reg_in2,
570 int scalar, 553 int scalar,
571 void (*func)(struct thread_struct *t, 554 void (*func)(u64 *fpscr,
572 u32 *dst, u32 *src1, 555 u32 *dst, u32 *src1,
573 u32 *src2)) 556 u32 *src2))
574{ 557{
@@ -578,27 +561,25 @@ static int kvmppc_ps_two_in(struct kvm_vcpu *vcpu, bool rc,
578 u32 ps0_in1, ps0_in2; 561 u32 ps0_in1, ps0_in2;
579 u32 ps1_out; 562 u32 ps1_out;
580 u32 ps1_in1, ps1_in2; 563 u32 ps1_in1, ps1_in2;
581 struct thread_struct t;
582 t.fpscr.val = vcpu->arch.fpscr;
583 564
584 /* RC */ 565 /* RC */
585 WARN_ON(rc); 566 WARN_ON(rc);
586 567
587 /* PS0 */ 568 /* PS0 */
588 cvt_df((double*)&fpr[reg_in1], (float*)&ps0_in1, &t); 569 kvm_cvt_df(&fpr[reg_in1], &ps0_in1, &vcpu->arch.fpscr);
589 570
590 if (scalar & SCALAR_LOW) 571 if (scalar & SCALAR_LOW)
591 ps0_in2 = qpr[reg_in2]; 572 ps0_in2 = qpr[reg_in2];
592 else 573 else
593 cvt_df((double*)&fpr[reg_in2], (float*)&ps0_in2, &t); 574 kvm_cvt_df(&fpr[reg_in2], &ps0_in2, &vcpu->arch.fpscr);
594 575
595 func(&t, &ps0_out, &ps0_in1, &ps0_in2); 576 func(&vcpu->arch.fpscr, &ps0_out, &ps0_in1, &ps0_in2);
596 577
597 if (!(scalar & SCALAR_NO_PS0)) { 578 if (!(scalar & SCALAR_NO_PS0)) {
598 dprintk(KERN_INFO "PS2 ps0 -> f(0x%x, 0x%x) = 0x%x\n", 579 dprintk(KERN_INFO "PS2 ps0 -> f(0x%x, 0x%x) = 0x%x\n",
599 ps0_in1, ps0_in2, ps0_out); 580 ps0_in1, ps0_in2, ps0_out);
600 581
601 cvt_fd((float*)&ps0_out, (double*)&fpr[reg_out], &t); 582 kvm_cvt_fd(&ps0_out, &fpr[reg_out], &vcpu->arch.fpscr);
602 } 583 }
603 584
604 /* PS1 */ 585 /* PS1 */
@@ -608,7 +589,7 @@ static int kvmppc_ps_two_in(struct kvm_vcpu *vcpu, bool rc,
608 if (scalar & SCALAR_HIGH) 589 if (scalar & SCALAR_HIGH)
609 ps1_in2 = ps0_in2; 590 ps1_in2 = ps0_in2;
610 591
611 func(&t, &ps1_out, &ps1_in1, &ps1_in2); 592 func(&vcpu->arch.fpscr, &ps1_out, &ps1_in1, &ps1_in2);
612 593
613 if (!(scalar & SCALAR_NO_PS1)) { 594 if (!(scalar & SCALAR_NO_PS1)) {
614 qpr[reg_out] = ps1_out; 595 qpr[reg_out] = ps1_out;
@@ -622,31 +603,29 @@ static int kvmppc_ps_two_in(struct kvm_vcpu *vcpu, bool rc,
622 603
623static int kvmppc_ps_one_in(struct kvm_vcpu *vcpu, bool rc, 604static int kvmppc_ps_one_in(struct kvm_vcpu *vcpu, bool rc,
624 int reg_out, int reg_in, 605 int reg_out, int reg_in,
625 void (*func)(struct thread_struct *t, 606 void (*func)(u64 *t,
626 u32 *dst, u32 *src1)) 607 u32 *dst, u32 *src1))
627{ 608{
628 u32 *qpr = vcpu->arch.qpr; 609 u32 *qpr = vcpu->arch.qpr;
629 u64 *fpr = vcpu->arch.fpr; 610 u64 *fpr = vcpu->arch.fpr;
630 u32 ps0_out, ps0_in; 611 u32 ps0_out, ps0_in;
631 u32 ps1_in; 612 u32 ps1_in;
632 struct thread_struct t;
633 t.fpscr.val = vcpu->arch.fpscr;
634 613
635 /* RC */ 614 /* RC */
636 WARN_ON(rc); 615 WARN_ON(rc);
637 616
638 /* PS0 */ 617 /* PS0 */
639 cvt_df((double*)&fpr[reg_in], (float*)&ps0_in, &t); 618 kvm_cvt_df(&fpr[reg_in], &ps0_in, &vcpu->arch.fpscr);
640 func(&t, &ps0_out, &ps0_in); 619 func(&vcpu->arch.fpscr, &ps0_out, &ps0_in);
641 620
642 dprintk(KERN_INFO "PS1 ps0 -> f(0x%x) = 0x%x\n", 621 dprintk(KERN_INFO "PS1 ps0 -> f(0x%x) = 0x%x\n",
643 ps0_in, ps0_out); 622 ps0_in, ps0_out);
644 623
645 cvt_fd((float*)&ps0_out, (double*)&fpr[reg_out], &t); 624 kvm_cvt_fd(&ps0_out, &fpr[reg_out], &vcpu->arch.fpscr);
646 625
647 /* PS1 */ 626 /* PS1 */
648 ps1_in = qpr[reg_in]; 627 ps1_in = qpr[reg_in];
649 func(&t, &qpr[reg_out], &ps1_in); 628 func(&vcpu->arch.fpscr, &qpr[reg_out], &ps1_in);
650 629
651 dprintk(KERN_INFO "PS1 ps1 -> f(0x%x) = 0x%x\n", 630 dprintk(KERN_INFO "PS1 ps1 -> f(0x%x) = 0x%x\n",
652 ps1_in, qpr[reg_out]); 631 ps1_in, qpr[reg_out]);
@@ -672,13 +651,10 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
672 651
673 bool rcomp = (inst & 1) ? true : false; 652 bool rcomp = (inst & 1) ? true : false;
674 u32 cr = kvmppc_get_cr(vcpu); 653 u32 cr = kvmppc_get_cr(vcpu);
675 struct thread_struct t;
676#ifdef DEBUG 654#ifdef DEBUG
677 int i; 655 int i;
678#endif 656#endif
679 657
680 t.fpscr.val = vcpu->arch.fpscr;
681
682 if (!kvmppc_inst_is_paired_single(vcpu, inst)) 658 if (!kvmppc_inst_is_paired_single(vcpu, inst))
683 return EMULATE_FAIL; 659 return EMULATE_FAIL;
684 660
@@ -695,7 +671,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
695#ifdef DEBUG 671#ifdef DEBUG
696 for (i = 0; i < ARRAY_SIZE(vcpu->arch.fpr); i++) { 672 for (i = 0; i < ARRAY_SIZE(vcpu->arch.fpr); i++) {
697 u32 f; 673 u32 f;
698 cvt_df((double*)&vcpu->arch.fpr[i], (float*)&f, &t); 674 kvm_cvt_df(&vcpu->arch.fpr[i], &f, &vcpu->arch.fpscr);
699 dprintk(KERN_INFO "FPR[%d] = 0x%x / 0x%llx QPR[%d] = 0x%x\n", 675 dprintk(KERN_INFO "FPR[%d] = 0x%x / 0x%llx QPR[%d] = 0x%x\n",
700 i, f, vcpu->arch.fpr[i], i, vcpu->arch.qpr[i]); 676 i, f, vcpu->arch.fpr[i], i, vcpu->arch.qpr[i]);
701 } 677 }
@@ -819,8 +795,9 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
819 WARN_ON(rcomp); 795 WARN_ON(rcomp);
820 vcpu->arch.fpr[ax_rd] = vcpu->arch.fpr[ax_ra]; 796 vcpu->arch.fpr[ax_rd] = vcpu->arch.fpr[ax_ra];
821 /* vcpu->arch.qpr[ax_rd] = vcpu->arch.fpr[ax_rb]; */ 797 /* vcpu->arch.qpr[ax_rd] = vcpu->arch.fpr[ax_rb]; */
822 cvt_df((double*)&vcpu->arch.fpr[ax_rb], 798 kvm_cvt_df(&vcpu->arch.fpr[ax_rb],
823 (float*)&vcpu->arch.qpr[ax_rd], &t); 799 &vcpu->arch.qpr[ax_rd],
800 &vcpu->arch.fpscr);
824 break; 801 break;
825 case OP_4X_PS_MERGE01: 802 case OP_4X_PS_MERGE01:
826 WARN_ON(rcomp); 803 WARN_ON(rcomp);
@@ -830,17 +807,20 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
830 case OP_4X_PS_MERGE10: 807 case OP_4X_PS_MERGE10:
831 WARN_ON(rcomp); 808 WARN_ON(rcomp);
832 /* vcpu->arch.fpr[ax_rd] = vcpu->arch.qpr[ax_ra]; */ 809 /* vcpu->arch.fpr[ax_rd] = vcpu->arch.qpr[ax_ra]; */
833 cvt_fd((float*)&vcpu->arch.qpr[ax_ra], 810 kvm_cvt_fd(&vcpu->arch.qpr[ax_ra],
834 (double*)&vcpu->arch.fpr[ax_rd], &t); 811 &vcpu->arch.fpr[ax_rd],
812 &vcpu->arch.fpscr);
835 /* vcpu->arch.qpr[ax_rd] = vcpu->arch.fpr[ax_rb]; */ 813 /* vcpu->arch.qpr[ax_rd] = vcpu->arch.fpr[ax_rb]; */
836 cvt_df((double*)&vcpu->arch.fpr[ax_rb], 814 kvm_cvt_df(&vcpu->arch.fpr[ax_rb],
837 (float*)&vcpu->arch.qpr[ax_rd], &t); 815 &vcpu->arch.qpr[ax_rd],
816 &vcpu->arch.fpscr);
838 break; 817 break;
839 case OP_4X_PS_MERGE11: 818 case OP_4X_PS_MERGE11:
840 WARN_ON(rcomp); 819 WARN_ON(rcomp);
841 /* vcpu->arch.fpr[ax_rd] = vcpu->arch.qpr[ax_ra]; */ 820 /* vcpu->arch.fpr[ax_rd] = vcpu->arch.qpr[ax_ra]; */
842 cvt_fd((float*)&vcpu->arch.qpr[ax_ra], 821 kvm_cvt_fd(&vcpu->arch.qpr[ax_ra],
843 (double*)&vcpu->arch.fpr[ax_rd], &t); 822 &vcpu->arch.fpr[ax_rd],
823 &vcpu->arch.fpscr);
844 vcpu->arch.qpr[ax_rd] = vcpu->arch.qpr[ax_rb]; 824 vcpu->arch.qpr[ax_rd] = vcpu->arch.qpr[ax_rb];
845 break; 825 break;
846 } 826 }
@@ -1275,7 +1255,7 @@ int kvmppc_emulate_paired_single(struct kvm_run *run, struct kvm_vcpu *vcpu)
1275#ifdef DEBUG 1255#ifdef DEBUG
1276 for (i = 0; i < ARRAY_SIZE(vcpu->arch.fpr); i++) { 1256 for (i = 0; i < ARRAY_SIZE(vcpu->arch.fpr); i++) {
1277 u32 f; 1257 u32 f;
1278 cvt_df((double*)&vcpu->arch.fpr[i], (float*)&f, &t); 1258 kvm_cvt_df(&vcpu->arch.fpr[i], &f, &vcpu->arch.fpscr);
1279 dprintk(KERN_INFO "FPR[%d] = 0x%x\n", i, f); 1259 dprintk(KERN_INFO "FPR[%d] = 0x%x\n", i, f);
1280 } 1260 }
1281#endif 1261#endif
diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c
index a33ab8cc2ccc..8d4e35f5372c 100644
--- a/arch/powerpc/kvm/booke.c
+++ b/arch/powerpc/kvm/booke.c
@@ -144,7 +144,7 @@ static int kvmppc_booke_irqprio_deliver(struct kvm_vcpu *vcpu,
144 unsigned int priority) 144 unsigned int priority)
145{ 145{
146 int allowed = 0; 146 int allowed = 0;
147 ulong msr_mask; 147 ulong uninitialized_var(msr_mask);
148 bool update_esr = false, update_dear = false; 148 bool update_esr = false, update_dear = false;
149 149
150 switch (priority) { 150 switch (priority) {
@@ -485,8 +485,6 @@ int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
485{ 485{
486 int i; 486 int i;
487 487
488 vcpu_load(vcpu);
489
490 regs->pc = vcpu->arch.pc; 488 regs->pc = vcpu->arch.pc;
491 regs->cr = kvmppc_get_cr(vcpu); 489 regs->cr = kvmppc_get_cr(vcpu);
492 regs->ctr = vcpu->arch.ctr; 490 regs->ctr = vcpu->arch.ctr;
@@ -507,8 +505,6 @@ int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
507 for (i = 0; i < ARRAY_SIZE(regs->gpr); i++) 505 for (i = 0; i < ARRAY_SIZE(regs->gpr); i++)
508 regs->gpr[i] = kvmppc_get_gpr(vcpu, i); 506 regs->gpr[i] = kvmppc_get_gpr(vcpu, i);
509 507
510 vcpu_put(vcpu);
511
512 return 0; 508 return 0;
513} 509}
514 510
@@ -516,8 +512,6 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
516{ 512{
517 int i; 513 int i;
518 514
519 vcpu_load(vcpu);
520
521 vcpu->arch.pc = regs->pc; 515 vcpu->arch.pc = regs->pc;
522 kvmppc_set_cr(vcpu, regs->cr); 516 kvmppc_set_cr(vcpu, regs->cr);
523 vcpu->arch.ctr = regs->ctr; 517 vcpu->arch.ctr = regs->ctr;
@@ -537,8 +531,6 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
537 for (i = 0; i < ARRAY_SIZE(regs->gpr); i++) 531 for (i = 0; i < ARRAY_SIZE(regs->gpr); i++)
538 kvmppc_set_gpr(vcpu, i, regs->gpr[i]); 532 kvmppc_set_gpr(vcpu, i, regs->gpr[i]);
539 533
540 vcpu_put(vcpu);
541
542 return 0; 534 return 0;
543} 535}
544 536
@@ -569,9 +561,7 @@ int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
569{ 561{
570 int r; 562 int r;
571 563
572 vcpu_load(vcpu);
573 r = kvmppc_core_vcpu_translate(vcpu, tr); 564 r = kvmppc_core_vcpu_translate(vcpu, tr);
574 vcpu_put(vcpu);
575 return r; 565 return r;
576} 566}
577 567
diff --git a/arch/powerpc/kvm/fpu.S b/arch/powerpc/kvm/fpu.S
index 2b340a3eee90..cb34bbe16113 100644
--- a/arch/powerpc/kvm/fpu.S
+++ b/arch/powerpc/kvm/fpu.S
@@ -271,3 +271,21 @@ FPD_THREE_IN(fmsub)
271FPD_THREE_IN(fmadd) 271FPD_THREE_IN(fmadd)
272FPD_THREE_IN(fnmsub) 272FPD_THREE_IN(fnmsub)
273FPD_THREE_IN(fnmadd) 273FPD_THREE_IN(fnmadd)
274
275_GLOBAL(kvm_cvt_fd)
276 lfd 0,0(r5) /* load up fpscr value */
277 MTFSF_L(0)
278 lfs 0,0(r3)
279 stfd 0,0(r4)
280 mffs 0
281 stfd 0,0(r5) /* save new fpscr value */
282 blr
283
284_GLOBAL(kvm_cvt_df)
285 lfd 0,0(r5) /* load up fpscr value */
286 MTFSF_L(0)
287 lfd 0,0(r3)
288 stfs 0,0(r4)
289 mffs 0
290 stfd 0,0(r5) /* save new fpscr value */
291 blr
diff --git a/arch/powerpc/kvm/powerpc.c b/arch/powerpc/kvm/powerpc.c
index 9b8683f39e05..72a4ad86ee91 100644
--- a/arch/powerpc/kvm/powerpc.c
+++ b/arch/powerpc/kvm/powerpc.c
@@ -36,11 +36,6 @@
36#define CREATE_TRACE_POINTS 36#define CREATE_TRACE_POINTS
37#include "trace.h" 37#include "trace.h"
38 38
39gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn)
40{
41 return gfn;
42}
43
44int kvm_arch_vcpu_runnable(struct kvm_vcpu *v) 39int kvm_arch_vcpu_runnable(struct kvm_vcpu *v)
45{ 40{
46 return !(v->arch.msr & MSR_WE) || !!(v->arch.pending_exceptions); 41 return !(v->arch.msr & MSR_WE) || !!(v->arch.pending_exceptions);
@@ -287,7 +282,7 @@ static void kvmppc_complete_dcr_load(struct kvm_vcpu *vcpu,
287static void kvmppc_complete_mmio_load(struct kvm_vcpu *vcpu, 282static void kvmppc_complete_mmio_load(struct kvm_vcpu *vcpu,
288 struct kvm_run *run) 283 struct kvm_run *run)
289{ 284{
290 u64 gpr; 285 u64 uninitialized_var(gpr);
291 286
292 if (run->mmio.len > sizeof(gpr)) { 287 if (run->mmio.len > sizeof(gpr)) {
293 printk(KERN_ERR "bad MMIO length: %d\n", run->mmio.len); 288 printk(KERN_ERR "bad MMIO length: %d\n", run->mmio.len);
@@ -423,8 +418,6 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
423 int r; 418 int r;
424 sigset_t sigsaved; 419 sigset_t sigsaved;
425 420
426 vcpu_load(vcpu);
427
428 if (vcpu->sigset_active) 421 if (vcpu->sigset_active)
429 sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved); 422 sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved);
430 423
@@ -456,8 +449,6 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *run)
456 if (vcpu->sigset_active) 449 if (vcpu->sigset_active)
457 sigprocmask(SIG_SETMASK, &sigsaved, NULL); 450 sigprocmask(SIG_SETMASK, &sigsaved, NULL);
458 451
459 vcpu_put(vcpu);
460
461 return r; 452 return r;
462} 453}
463 454
@@ -523,8 +514,9 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
523 if (copy_from_user(&irq, argp, sizeof(irq))) 514 if (copy_from_user(&irq, argp, sizeof(irq)))
524 goto out; 515 goto out;
525 r = kvm_vcpu_ioctl_interrupt(vcpu, &irq); 516 r = kvm_vcpu_ioctl_interrupt(vcpu, &irq);
526 break; 517 goto out;
527 } 518 }
519
528 case KVM_ENABLE_CAP: 520 case KVM_ENABLE_CAP:
529 { 521 {
530 struct kvm_enable_cap cap; 522 struct kvm_enable_cap cap;
diff --git a/arch/powerpc/kvm/timing.c b/arch/powerpc/kvm/timing.c
index 70378551c0cc..46fa04f12a9b 100644
--- a/arch/powerpc/kvm/timing.c
+++ b/arch/powerpc/kvm/timing.c
@@ -182,7 +182,7 @@ static ssize_t kvmppc_exit_timing_write(struct file *file,
182 } 182 }
183 183
184 if (c == 'c') { 184 if (c == 'c') {
185 struct seq_file *seqf = (struct seq_file *)file->private_data; 185 struct seq_file *seqf = file->private_data;
186 struct kvm_vcpu *vcpu = seqf->private; 186 struct kvm_vcpu *vcpu = seqf->private;
187 /* Write does not affect our buffers previously generated with 187 /* Write does not affect our buffers previously generated with
188 * show. seq_file is locked here to prevent races of init with 188 * show. seq_file is locked here to prevent races of init with
diff --git a/arch/powerpc/lib/Makefile b/arch/powerpc/lib/Makefile
index 111da1c03a11..5bb89c828070 100644
--- a/arch/powerpc/lib/Makefile
+++ b/arch/powerpc/lib/Makefile
@@ -18,8 +18,9 @@ obj-$(CONFIG_HAS_IOMEM) += devres.o
18 18
19obj-$(CONFIG_PPC64) += copypage_64.o copyuser_64.o \ 19obj-$(CONFIG_PPC64) += copypage_64.o copyuser_64.o \
20 memcpy_64.o usercopy_64.o mem_64.o string.o 20 memcpy_64.o usercopy_64.o mem_64.o string.o
21obj-$(CONFIG_XMON) += sstep.o 21obj-$(CONFIG_XMON) += sstep.o ldstfp.o
22obj-$(CONFIG_KPROBES) += sstep.o 22obj-$(CONFIG_KPROBES) += sstep.o ldstfp.o
23obj-$(CONFIG_HAVE_HW_BREAKPOINT) += sstep.o ldstfp.o
23 24
24ifeq ($(CONFIG_PPC64),y) 25ifeq ($(CONFIG_PPC64),y)
25obj-$(CONFIG_SMP) += locks.o 26obj-$(CONFIG_SMP) += locks.o
diff --git a/arch/powerpc/lib/ldstfp.S b/arch/powerpc/lib/ldstfp.S
new file mode 100644
index 000000000000..f6448636baf5
--- /dev/null
+++ b/arch/powerpc/lib/ldstfp.S
@@ -0,0 +1,375 @@
1/*
2 * Floating-point, VMX/Altivec and VSX loads and stores
3 * for use in instruction emulation.
4 *
5 * Copyright 2010 Paul Mackerras, IBM Corp. <paulus@au1.ibm.com>
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version
10 * 2 of the License, or (at your option) any later version.
11 */
12
13#include <asm/processor.h>
14#include <asm/ppc_asm.h>
15#include <asm/ppc-opcode.h>
16#include <asm/reg.h>
17#include <asm/asm-offsets.h>
18#include <linux/errno.h>
19
20#define STKFRM (PPC_MIN_STKFRM + 16)
21
22 .macro extab instr,handler
23 .section __ex_table,"a"
24 PPC_LONG \instr,\handler
25 .previous
26 .endm
27
28 .macro inst32 op
29reg = 0
30 .rept 32
3120: \op reg,0,r4
32 b 3f
33 extab 20b,99f
34reg = reg + 1
35 .endr
36 .endm
37
38/* Get the contents of frN into fr0; N is in r3. */
39_GLOBAL(get_fpr)
40 mflr r0
41 rlwinm r3,r3,3,0xf8
42 bcl 20,31,1f
43 blr /* fr0 is already in fr0 */
44 nop
45reg = 1
46 .rept 31
47 fmr fr0,reg
48 blr
49reg = reg + 1
50 .endr
511: mflr r5
52 add r5,r3,r5
53 mtctr r5
54 mtlr r0
55 bctr
56
57/* Put the contents of fr0 into frN; N is in r3. */
58_GLOBAL(put_fpr)
59 mflr r0
60 rlwinm r3,r3,3,0xf8
61 bcl 20,31,1f
62 blr /* fr0 is already in fr0 */
63 nop
64reg = 1
65 .rept 31
66 fmr reg,fr0
67 blr
68reg = reg + 1
69 .endr
701: mflr r5
71 add r5,r3,r5
72 mtctr r5
73 mtlr r0
74 bctr
75
76/* Load FP reg N from float at *p. N is in r3, p in r4. */
77_GLOBAL(do_lfs)
78 PPC_STLU r1,-STKFRM(r1)
79 mflr r0
80 PPC_STL r0,STKFRM+PPC_LR_STKOFF(r1)
81 mfmsr r6
82 ori r7,r6,MSR_FP
83 cmpwi cr7,r3,0
84 mtmsrd r7
85 isync
86 beq cr7,1f
87 stfd fr0,STKFRM-16(r1)
881: li r9,-EFAULT
892: lfs fr0,0(r4)
90 li r9,0
913: bl put_fpr
92 beq cr7,4f
93 lfd fr0,STKFRM-16(r1)
944: PPC_LL r0,STKFRM+PPC_LR_STKOFF(r1)
95 mtlr r0
96 mtmsrd r6
97 isync
98 mr r3,r9
99 addi r1,r1,STKFRM
100 blr
101 extab 2b,3b
102
103/* Load FP reg N from double at *p. N is in r3, p in r4. */
104_GLOBAL(do_lfd)
105 PPC_STLU r1,-STKFRM(r1)
106 mflr r0
107 PPC_STL r0,STKFRM+PPC_LR_STKOFF(r1)
108 mfmsr r6
109 ori r7,r6,MSR_FP
110 cmpwi cr7,r3,0
111 mtmsrd r7
112 isync
113 beq cr7,1f
114 stfd fr0,STKFRM-16(r1)
1151: li r9,-EFAULT
1162: lfd fr0,0(r4)
117 li r9,0
1183: beq cr7,4f
119 bl put_fpr
120 lfd fr0,STKFRM-16(r1)
1214: PPC_LL r0,STKFRM+PPC_LR_STKOFF(r1)
122 mtlr r0
123 mtmsrd r6
124 isync
125 mr r3,r9
126 addi r1,r1,STKFRM
127 blr
128 extab 2b,3b
129
130/* Store FP reg N to float at *p. N is in r3, p in r4. */
131_GLOBAL(do_stfs)
132 PPC_STLU r1,-STKFRM(r1)
133 mflr r0
134 PPC_STL r0,STKFRM+PPC_LR_STKOFF(r1)
135 mfmsr r6
136 ori r7,r6,MSR_FP
137 cmpwi cr7,r3,0
138 mtmsrd r7
139 isync
140 beq cr7,1f
141 stfd fr0,STKFRM-16(r1)
142 bl get_fpr
1431: li r9,-EFAULT
1442: stfs fr0,0(r4)
145 li r9,0
1463: beq cr7,4f
147 lfd fr0,STKFRM-16(r1)
1484: PPC_LL r0,STKFRM+PPC_LR_STKOFF(r1)
149 mtlr r0
150 mtmsrd r6
151 isync
152 mr r3,r9
153 addi r1,r1,STKFRM
154 blr
155 extab 2b,3b
156
157/* Store FP reg N to double at *p. N is in r3, p in r4. */
158_GLOBAL(do_stfd)
159 PPC_STLU r1,-STKFRM(r1)
160 mflr r0
161 PPC_STL r0,STKFRM+PPC_LR_STKOFF(r1)
162 mfmsr r6
163 ori r7,r6,MSR_FP
164 cmpwi cr7,r3,0
165 mtmsrd r7
166 isync
167 beq cr7,1f
168 stfd fr0,STKFRM-16(r1)
169 bl get_fpr
1701: li r9,-EFAULT
1712: stfd fr0,0(r4)
172 li r9,0
1733: beq cr7,4f
174 lfd fr0,STKFRM-16(r1)
1754: PPC_LL r0,STKFRM+PPC_LR_STKOFF(r1)
176 mtlr r0
177 mtmsrd r6
178 isync
179 mr r3,r9
180 addi r1,r1,STKFRM
181 blr
182 extab 2b,3b
183
184#ifdef CONFIG_ALTIVEC
185/* Get the contents of vrN into vr0; N is in r3. */
186_GLOBAL(get_vr)
187 mflr r0
188 rlwinm r3,r3,3,0xf8
189 bcl 20,31,1f
190 blr /* vr0 is already in vr0 */
191 nop
192reg = 1
193 .rept 31
194 vor vr0,reg,reg /* assembler doesn't know vmr? */
195 blr
196reg = reg + 1
197 .endr
1981: mflr r5
199 add r5,r3,r5
200 mtctr r5
201 mtlr r0
202 bctr
203
204/* Put the contents of vr0 into vrN; N is in r3. */
205_GLOBAL(put_vr)
206 mflr r0
207 rlwinm r3,r3,3,0xf8
208 bcl 20,31,1f
209 blr /* vr0 is already in vr0 */
210 nop
211reg = 1
212 .rept 31
213 vor reg,vr0,vr0
214 blr
215reg = reg + 1
216 .endr
2171: mflr r5
218 add r5,r3,r5
219 mtctr r5
220 mtlr r0
221 bctr
222
223/* Load vector reg N from *p. N is in r3, p in r4. */
224_GLOBAL(do_lvx)
225 PPC_STLU r1,-STKFRM(r1)
226 mflr r0
227 PPC_STL r0,STKFRM+PPC_LR_STKOFF(r1)
228 mfmsr r6
229 oris r7,r6,MSR_VEC@h
230 cmpwi cr7,r3,0
231 li r8,STKFRM-16
232 mtmsrd r7
233 isync
234 beq cr7,1f
235 stvx vr0,r1,r8
2361: li r9,-EFAULT
2372: lvx vr0,0,r4
238 li r9,0
2393: beq cr7,4f
240 bl put_vr
241 lvx vr0,r1,r8
2424: PPC_LL r0,STKFRM+PPC_LR_STKOFF(r1)
243 mtlr r0
244 mtmsrd r6
245 isync
246 mr r3,r9
247 addi r1,r1,STKFRM
248 blr
249 extab 2b,3b
250
251/* Store vector reg N to *p. N is in r3, p in r4. */
252_GLOBAL(do_stvx)
253 PPC_STLU r1,-STKFRM(r1)
254 mflr r0
255 PPC_STL r0,STKFRM+PPC_LR_STKOFF(r1)
256 mfmsr r6
257 oris r7,r6,MSR_VEC@h
258 cmpwi cr7,r3,0
259 li r8,STKFRM-16
260 mtmsrd r7
261 isync
262 beq cr7,1f
263 stvx vr0,r1,r8
264 bl get_vr
2651: li r9,-EFAULT
2662: stvx vr0,0,r4
267 li r9,0
2683: beq cr7,4f
269 lvx vr0,r1,r8
2704: PPC_LL r0,STKFRM+PPC_LR_STKOFF(r1)
271 mtlr r0
272 mtmsrd r6
273 isync
274 mr r3,r9
275 addi r1,r1,STKFRM
276 blr
277 extab 2b,3b
278#endif /* CONFIG_ALTIVEC */
279
280#ifdef CONFIG_VSX
281/* Get the contents of vsrN into vsr0; N is in r3. */
282_GLOBAL(get_vsr)
283 mflr r0
284 rlwinm r3,r3,3,0x1f8
285 bcl 20,31,1f
286 blr /* vsr0 is already in vsr0 */
287 nop
288reg = 1
289 .rept 63
290 XXLOR(0,reg,reg)
291 blr
292reg = reg + 1
293 .endr
2941: mflr r5
295 add r5,r3,r5
296 mtctr r5
297 mtlr r0
298 bctr
299
300/* Put the contents of vsr0 into vsrN; N is in r3. */
301_GLOBAL(put_vsr)
302 mflr r0
303 rlwinm r3,r3,3,0x1f8
304 bcl 20,31,1f
305 blr /* vr0 is already in vr0 */
306 nop
307reg = 1
308 .rept 63
309 XXLOR(reg,0,0)
310 blr
311reg = reg + 1
312 .endr
3131: mflr r5
314 add r5,r3,r5
315 mtctr r5
316 mtlr r0
317 bctr
318
319/* Load VSX reg N from vector doubleword *p. N is in r3, p in r4. */
320_GLOBAL(do_lxvd2x)
321 PPC_STLU r1,-STKFRM(r1)
322 mflr r0
323 PPC_STL r0,STKFRM+PPC_LR_STKOFF(r1)
324 mfmsr r6
325 oris r7,r6,MSR_VSX@h
326 cmpwi cr7,r3,0
327 li r8,STKFRM-16
328 mtmsrd r7
329 isync
330 beq cr7,1f
331 STXVD2X(0,r1,r8)
3321: li r9,-EFAULT
3332: LXVD2X(0,0,r4)
334 li r9,0
3353: beq cr7,4f
336 bl put_vsr
337 LXVD2X(0,r1,r8)
3384: PPC_LL r0,STKFRM+PPC_LR_STKOFF(r1)
339 mtlr r0
340 mtmsrd r6
341 isync
342 mr r3,r9
343 addi r1,r1,STKFRM
344 blr
345 extab 2b,3b
346
347/* Store VSX reg N to vector doubleword *p. N is in r3, p in r4. */
348_GLOBAL(do_stxvd2x)
349 PPC_STLU r1,-STKFRM(r1)
350 mflr r0
351 PPC_STL r0,STKFRM+PPC_LR_STKOFF(r1)
352 mfmsr r6
353 oris r7,r6,MSR_VSX@h
354 cmpwi cr7,r3,0
355 li r8,STKFRM-16
356 mtmsrd r7
357 isync
358 beq cr7,1f
359 STXVD2X(0,r1,r8)
360 bl get_vsr
3611: li r9,-EFAULT
3622: STXVD2X(0,0,r4)
363 li r9,0
3643: beq cr7,4f
365 LXVD2X(0,r1,r8)
3664: PPC_LL r0,STKFRM+PPC_LR_STKOFF(r1)
367 mtlr r0
368 mtmsrd r6
369 isync
370 mr r3,r9
371 addi r1,r1,STKFRM
372 blr
373 extab 2b,3b
374
375#endif /* CONFIG_VSX */
diff --git a/arch/powerpc/lib/sstep.c b/arch/powerpc/lib/sstep.c
index 13b7d54f185b..e0a9858d537e 100644
--- a/arch/powerpc/lib/sstep.c
+++ b/arch/powerpc/lib/sstep.c
@@ -13,6 +13,8 @@
13#include <linux/ptrace.h> 13#include <linux/ptrace.h>
14#include <asm/sstep.h> 14#include <asm/sstep.h>
15#include <asm/processor.h> 15#include <asm/processor.h>
16#include <asm/uaccess.h>
17#include <asm/cputable.h>
16 18
17extern char system_call_common[]; 19extern char system_call_common[];
18 20
@@ -23,6 +25,23 @@ extern char system_call_common[];
23#define MSR_MASK 0x87c0ffff 25#define MSR_MASK 0x87c0ffff
24#endif 26#endif
25 27
28/* Bits in XER */
29#define XER_SO 0x80000000U
30#define XER_OV 0x40000000U
31#define XER_CA 0x20000000U
32
33/*
34 * Functions in ldstfp.S
35 */
36extern int do_lfs(int rn, unsigned long ea);
37extern int do_lfd(int rn, unsigned long ea);
38extern int do_stfs(int rn, unsigned long ea);
39extern int do_stfd(int rn, unsigned long ea);
40extern int do_lvx(int rn, unsigned long ea);
41extern int do_stvx(int rn, unsigned long ea);
42extern int do_lxvd2x(int rn, unsigned long ea);
43extern int do_stxvd2x(int rn, unsigned long ea);
44
26/* 45/*
27 * Determine whether a conditional branch instruction would branch. 46 * Determine whether a conditional branch instruction would branch.
28 */ 47 */
@@ -46,16 +65,499 @@ static int __kprobes branch_taken(unsigned int instr, struct pt_regs *regs)
46 return 1; 65 return 1;
47} 66}
48 67
68
69static long __kprobes address_ok(struct pt_regs *regs, unsigned long ea, int nb)
70{
71 if (!user_mode(regs))
72 return 1;
73 return __access_ok(ea, nb, USER_DS);
74}
75
76/*
77 * Calculate effective address for a D-form instruction
78 */
79static unsigned long __kprobes dform_ea(unsigned int instr, struct pt_regs *regs)
80{
81 int ra;
82 unsigned long ea;
83
84 ra = (instr >> 16) & 0x1f;
85 ea = (signed short) instr; /* sign-extend */
86 if (ra) {
87 ea += regs->gpr[ra];
88 if (instr & 0x04000000) /* update forms */
89 regs->gpr[ra] = ea;
90 }
91#ifdef __powerpc64__
92 if (!(regs->msr & MSR_SF))
93 ea &= 0xffffffffUL;
94#endif
95 return ea;
96}
97
98#ifdef __powerpc64__
99/*
100 * Calculate effective address for a DS-form instruction
101 */
102static unsigned long __kprobes dsform_ea(unsigned int instr, struct pt_regs *regs)
103{
104 int ra;
105 unsigned long ea;
106
107 ra = (instr >> 16) & 0x1f;
108 ea = (signed short) (instr & ~3); /* sign-extend */
109 if (ra) {
110 ea += regs->gpr[ra];
111 if ((instr & 3) == 1) /* update forms */
112 regs->gpr[ra] = ea;
113 }
114 if (!(regs->msr & MSR_SF))
115 ea &= 0xffffffffUL;
116 return ea;
117}
118#endif /* __powerpc64 */
119
120/*
121 * Calculate effective address for an X-form instruction
122 */
123static unsigned long __kprobes xform_ea(unsigned int instr, struct pt_regs *regs,
124 int do_update)
125{
126 int ra, rb;
127 unsigned long ea;
128
129 ra = (instr >> 16) & 0x1f;
130 rb = (instr >> 11) & 0x1f;
131 ea = regs->gpr[rb];
132 if (ra) {
133 ea += regs->gpr[ra];
134 if (do_update) /* update forms */
135 regs->gpr[ra] = ea;
136 }
137#ifdef __powerpc64__
138 if (!(regs->msr & MSR_SF))
139 ea &= 0xffffffffUL;
140#endif
141 return ea;
142}
143
144/*
145 * Return the largest power of 2, not greater than sizeof(unsigned long),
146 * such that x is a multiple of it.
147 */
148static inline unsigned long max_align(unsigned long x)
149{
150 x |= sizeof(unsigned long);
151 return x & -x; /* isolates rightmost bit */
152}
153
154
155static inline unsigned long byterev_2(unsigned long x)
156{
157 return ((x >> 8) & 0xff) | ((x & 0xff) << 8);
158}
159
160static inline unsigned long byterev_4(unsigned long x)
161{
162 return ((x >> 24) & 0xff) | ((x >> 8) & 0xff00) |
163 ((x & 0xff00) << 8) | ((x & 0xff) << 24);
164}
165
166#ifdef __powerpc64__
167static inline unsigned long byterev_8(unsigned long x)
168{
169 return (byterev_4(x) << 32) | byterev_4(x >> 32);
170}
171#endif
172
173static int __kprobes read_mem_aligned(unsigned long *dest, unsigned long ea,
174 int nb)
175{
176 int err = 0;
177 unsigned long x = 0;
178
179 switch (nb) {
180 case 1:
181 err = __get_user(x, (unsigned char __user *) ea);
182 break;
183 case 2:
184 err = __get_user(x, (unsigned short __user *) ea);
185 break;
186 case 4:
187 err = __get_user(x, (unsigned int __user *) ea);
188 break;
189#ifdef __powerpc64__
190 case 8:
191 err = __get_user(x, (unsigned long __user *) ea);
192 break;
193#endif
194 }
195 if (!err)
196 *dest = x;
197 return err;
198}
199
200static int __kprobes read_mem_unaligned(unsigned long *dest, unsigned long ea,
201 int nb, struct pt_regs *regs)
202{
203 int err;
204 unsigned long x, b, c;
205
206 /* unaligned, do this in pieces */
207 x = 0;
208 for (; nb > 0; nb -= c) {
209 c = max_align(ea);
210 if (c > nb)
211 c = max_align(nb);
212 err = read_mem_aligned(&b, ea, c);
213 if (err)
214 return err;
215 x = (x << (8 * c)) + b;
216 ea += c;
217 }
218 *dest = x;
219 return 0;
220}
221
222/*
223 * Read memory at address ea for nb bytes, return 0 for success
224 * or -EFAULT if an error occurred.
225 */
226static int __kprobes read_mem(unsigned long *dest, unsigned long ea, int nb,
227 struct pt_regs *regs)
228{
229 if (!address_ok(regs, ea, nb))
230 return -EFAULT;
231 if ((ea & (nb - 1)) == 0)
232 return read_mem_aligned(dest, ea, nb);
233 return read_mem_unaligned(dest, ea, nb, regs);
234}
235
236static int __kprobes write_mem_aligned(unsigned long val, unsigned long ea,
237 int nb)
238{
239 int err = 0;
240
241 switch (nb) {
242 case 1:
243 err = __put_user(val, (unsigned char __user *) ea);
244 break;
245 case 2:
246 err = __put_user(val, (unsigned short __user *) ea);
247 break;
248 case 4:
249 err = __put_user(val, (unsigned int __user *) ea);
250 break;
251#ifdef __powerpc64__
252 case 8:
253 err = __put_user(val, (unsigned long __user *) ea);
254 break;
255#endif
256 }
257 return err;
258}
259
260static int __kprobes write_mem_unaligned(unsigned long val, unsigned long ea,
261 int nb, struct pt_regs *regs)
262{
263 int err;
264 unsigned long c;
265
266 /* unaligned or little-endian, do this in pieces */
267 for (; nb > 0; nb -= c) {
268 c = max_align(ea);
269 if (c > nb)
270 c = max_align(nb);
271 err = write_mem_aligned(val >> (nb - c) * 8, ea, c);
272 if (err)
273 return err;
274 ++ea;
275 }
276 return 0;
277}
278
279/*
280 * Write memory at address ea for nb bytes, return 0 for success
281 * or -EFAULT if an error occurred.
282 */
283static int __kprobes write_mem(unsigned long val, unsigned long ea, int nb,
284 struct pt_regs *regs)
285{
286 if (!address_ok(regs, ea, nb))
287 return -EFAULT;
288 if ((ea & (nb - 1)) == 0)
289 return write_mem_aligned(val, ea, nb);
290 return write_mem_unaligned(val, ea, nb, regs);
291}
292
49/* 293/*
50 * Emulate instructions that cause a transfer of control. 294 * Check the address and alignment, and call func to do the actual
295 * load or store.
296 */
297static int __kprobes do_fp_load(int rn, int (*func)(int, unsigned long),
298 unsigned long ea, int nb,
299 struct pt_regs *regs)
300{
301 int err;
302 unsigned long val[sizeof(double) / sizeof(long)];
303 unsigned long ptr;
304
305 if (!address_ok(regs, ea, nb))
306 return -EFAULT;
307 if ((ea & 3) == 0)
308 return (*func)(rn, ea);
309 ptr = (unsigned long) &val[0];
310 if (sizeof(unsigned long) == 8 || nb == 4) {
311 err = read_mem_unaligned(&val[0], ea, nb, regs);
312 ptr += sizeof(unsigned long) - nb;
313 } else {
314 /* reading a double on 32-bit */
315 err = read_mem_unaligned(&val[0], ea, 4, regs);
316 if (!err)
317 err = read_mem_unaligned(&val[1], ea + 4, 4, regs);
318 }
319 if (err)
320 return err;
321 return (*func)(rn, ptr);
322}
323
324static int __kprobes do_fp_store(int rn, int (*func)(int, unsigned long),
325 unsigned long ea, int nb,
326 struct pt_regs *regs)
327{
328 int err;
329 unsigned long val[sizeof(double) / sizeof(long)];
330 unsigned long ptr;
331
332 if (!address_ok(regs, ea, nb))
333 return -EFAULT;
334 if ((ea & 3) == 0)
335 return (*func)(rn, ea);
336 ptr = (unsigned long) &val[0];
337 if (sizeof(unsigned long) == 8 || nb == 4) {
338 ptr += sizeof(unsigned long) - nb;
339 err = (*func)(rn, ptr);
340 if (err)
341 return err;
342 err = write_mem_unaligned(val[0], ea, nb, regs);
343 } else {
344 /* writing a double on 32-bit */
345 err = (*func)(rn, ptr);
346 if (err)
347 return err;
348 err = write_mem_unaligned(val[0], ea, 4, regs);
349 if (!err)
350 err = write_mem_unaligned(val[1], ea + 4, 4, regs);
351 }
352 return err;
353}
354
355#ifdef CONFIG_ALTIVEC
356/* For Altivec/VMX, no need to worry about alignment */
357static int __kprobes do_vec_load(int rn, int (*func)(int, unsigned long),
358 unsigned long ea, struct pt_regs *regs)
359{
360 if (!address_ok(regs, ea & ~0xfUL, 16))
361 return -EFAULT;
362 return (*func)(rn, ea);
363}
364
365static int __kprobes do_vec_store(int rn, int (*func)(int, unsigned long),
366 unsigned long ea, struct pt_regs *regs)
367{
368 if (!address_ok(regs, ea & ~0xfUL, 16))
369 return -EFAULT;
370 return (*func)(rn, ea);
371}
372#endif /* CONFIG_ALTIVEC */
373
374#ifdef CONFIG_VSX
375static int __kprobes do_vsx_load(int rn, int (*func)(int, unsigned long),
376 unsigned long ea, struct pt_regs *regs)
377{
378 int err;
379 unsigned long val[2];
380
381 if (!address_ok(regs, ea, 16))
382 return -EFAULT;
383 if ((ea & 3) == 0)
384 return (*func)(rn, ea);
385 err = read_mem_unaligned(&val[0], ea, 8, regs);
386 if (!err)
387 err = read_mem_unaligned(&val[1], ea + 8, 8, regs);
388 if (!err)
389 err = (*func)(rn, (unsigned long) &val[0]);
390 return err;
391}
392
393static int __kprobes do_vsx_store(int rn, int (*func)(int, unsigned long),
394 unsigned long ea, struct pt_regs *regs)
395{
396 int err;
397 unsigned long val[2];
398
399 if (!address_ok(regs, ea, 16))
400 return -EFAULT;
401 if ((ea & 3) == 0)
402 return (*func)(rn, ea);
403 err = (*func)(rn, (unsigned long) &val[0]);
404 if (err)
405 return err;
406 err = write_mem_unaligned(val[0], ea, 8, regs);
407 if (!err)
408 err = write_mem_unaligned(val[1], ea + 8, 8, regs);
409 return err;
410}
411#endif /* CONFIG_VSX */
412
413#define __put_user_asmx(x, addr, err, op, cr) \
414 __asm__ __volatile__( \
415 "1: " op " %2,0,%3\n" \
416 " mfcr %1\n" \
417 "2:\n" \
418 ".section .fixup,\"ax\"\n" \
419 "3: li %0,%4\n" \
420 " b 2b\n" \
421 ".previous\n" \
422 ".section __ex_table,\"a\"\n" \
423 PPC_LONG_ALIGN "\n" \
424 PPC_LONG "1b,3b\n" \
425 ".previous" \
426 : "=r" (err), "=r" (cr) \
427 : "r" (x), "r" (addr), "i" (-EFAULT), "0" (err))
428
429#define __get_user_asmx(x, addr, err, op) \
430 __asm__ __volatile__( \
431 "1: "op" %1,0,%2\n" \
432 "2:\n" \
433 ".section .fixup,\"ax\"\n" \
434 "3: li %0,%3\n" \
435 " b 2b\n" \
436 ".previous\n" \
437 ".section __ex_table,\"a\"\n" \
438 PPC_LONG_ALIGN "\n" \
439 PPC_LONG "1b,3b\n" \
440 ".previous" \
441 : "=r" (err), "=r" (x) \
442 : "r" (addr), "i" (-EFAULT), "0" (err))
443
444#define __cacheop_user_asmx(addr, err, op) \
445 __asm__ __volatile__( \
446 "1: "op" 0,%1\n" \
447 "2:\n" \
448 ".section .fixup,\"ax\"\n" \
449 "3: li %0,%3\n" \
450 " b 2b\n" \
451 ".previous\n" \
452 ".section __ex_table,\"a\"\n" \
453 PPC_LONG_ALIGN "\n" \
454 PPC_LONG "1b,3b\n" \
455 ".previous" \
456 : "=r" (err) \
457 : "r" (addr), "i" (-EFAULT), "0" (err))
458
459static void __kprobes set_cr0(struct pt_regs *regs, int rd)
460{
461 long val = regs->gpr[rd];
462
463 regs->ccr = (regs->ccr & 0x0fffffff) | ((regs->xer >> 3) & 0x10000000);
464#ifdef __powerpc64__
465 if (!(regs->msr & MSR_SF))
466 val = (int) val;
467#endif
468 if (val < 0)
469 regs->ccr |= 0x80000000;
470 else if (val > 0)
471 regs->ccr |= 0x40000000;
472 else
473 regs->ccr |= 0x20000000;
474}
475
476static void __kprobes add_with_carry(struct pt_regs *regs, int rd,
477 unsigned long val1, unsigned long val2,
478 unsigned long carry_in)
479{
480 unsigned long val = val1 + val2;
481
482 if (carry_in)
483 ++val;
484 regs->gpr[rd] = val;
485#ifdef __powerpc64__
486 if (!(regs->msr & MSR_SF)) {
487 val = (unsigned int) val;
488 val1 = (unsigned int) val1;
489 }
490#endif
491 if (val < val1 || (carry_in && val == val1))
492 regs->xer |= XER_CA;
493 else
494 regs->xer &= ~XER_CA;
495}
496
497static void __kprobes do_cmp_signed(struct pt_regs *regs, long v1, long v2,
498 int crfld)
499{
500 unsigned int crval, shift;
501
502 crval = (regs->xer >> 31) & 1; /* get SO bit */
503 if (v1 < v2)
504 crval |= 8;
505 else if (v1 > v2)
506 crval |= 4;
507 else
508 crval |= 2;
509 shift = (7 - crfld) * 4;
510 regs->ccr = (regs->ccr & ~(0xf << shift)) | (crval << shift);
511}
512
513static void __kprobes do_cmp_unsigned(struct pt_regs *regs, unsigned long v1,
514 unsigned long v2, int crfld)
515{
516 unsigned int crval, shift;
517
518 crval = (regs->xer >> 31) & 1; /* get SO bit */
519 if (v1 < v2)
520 crval |= 8;
521 else if (v1 > v2)
522 crval |= 4;
523 else
524 crval |= 2;
525 shift = (7 - crfld) * 4;
526 regs->ccr = (regs->ccr & ~(0xf << shift)) | (crval << shift);
527}
528
529/*
530 * Elements of 32-bit rotate and mask instructions.
531 */
532#define MASK32(mb, me) ((0xffffffffUL >> (mb)) + \
533 ((signed long)-0x80000000L >> (me)) + ((me) >= (mb)))
534#ifdef __powerpc64__
535#define MASK64_L(mb) (~0UL >> (mb))
536#define MASK64_R(me) ((signed long)-0x8000000000000000L >> (me))
537#define MASK64(mb, me) (MASK64_L(mb) + MASK64_R(me) + ((me) >= (mb)))
538#define DATA32(x) (((x) & 0xffffffffUL) | (((x) & 0xffffffffUL) << 32))
539#else
540#define DATA32(x) (x)
541#endif
542#define ROTATE(x, n) ((n) ? (((x) << (n)) | ((x) >> (8 * sizeof(long) - (n)))) : (x))
543
544/*
545 * Emulate instructions that cause a transfer of control,
546 * loads and stores, and a few other instructions.
51 * Returns 1 if the step was emulated, 0 if not, 547 * Returns 1 if the step was emulated, 0 if not,
52 * or -1 if the instruction is one that should not be stepped, 548 * or -1 if the instruction is one that should not be stepped,
53 * such as an rfid, or a mtmsrd that would clear MSR_RI. 549 * such as an rfid, or a mtmsrd that would clear MSR_RI.
54 */ 550 */
55int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr) 551int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
56{ 552{
57 unsigned int opcode, rs, rb, rd, spr; 553 unsigned int opcode, ra, rb, rd, spr, u;
58 unsigned long int imm; 554 unsigned long int imm;
555 unsigned long int val, val2;
556 unsigned long int ea;
557 unsigned int cr, mb, me, sh;
558 int err;
559 unsigned long old_ra;
560 long ival;
59 561
60 opcode = instr >> 26; 562 opcode = instr >> 26;
61 switch (opcode) { 563 switch (opcode) {
@@ -78,7 +580,13 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
78 * entry code works. If that is changed, this will 580 * entry code works. If that is changed, this will
79 * need to be changed also. 581 * need to be changed also.
80 */ 582 */
583 if (regs->gpr[0] == 0x1ebe &&
584 cpu_has_feature(CPU_FTR_REAL_LE)) {
585 regs->msr ^= MSR_LE;
586 goto instr_done;
587 }
81 regs->gpr[9] = regs->gpr[13]; 588 regs->gpr[9] = regs->gpr[13];
589 regs->gpr[10] = MSR_KERNEL;
82 regs->gpr[11] = regs->nip + 4; 590 regs->gpr[11] = regs->nip + 4;
83 regs->gpr[12] = regs->msr & MSR_MASK; 591 regs->gpr[12] = regs->msr & MSR_MASK;
84 regs->gpr[13] = (unsigned long) get_paca(); 592 regs->gpr[13] = (unsigned long) get_paca();
@@ -102,9 +610,9 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
102 regs->nip = imm; 610 regs->nip = imm;
103 return 1; 611 return 1;
104 case 19: 612 case 19:
105 switch (instr & 0x7fe) { 613 switch ((instr >> 1) & 0x3ff) {
106 case 0x20: /* bclr */ 614 case 16: /* bclr */
107 case 0x420: /* bcctr */ 615 case 528: /* bcctr */
108 imm = (instr & 0x400)? regs->ctr: regs->link; 616 imm = (instr & 0x400)? regs->ctr: regs->link;
109 regs->nip += 4; 617 regs->nip += 4;
110 if ((regs->msr & MSR_SF) == 0) { 618 if ((regs->msr & MSR_SF) == 0) {
@@ -116,30 +624,233 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
116 if (branch_taken(instr, regs)) 624 if (branch_taken(instr, regs))
117 regs->nip = imm; 625 regs->nip = imm;
118 return 1; 626 return 1;
119 case 0x24: /* rfid, scary */ 627
628 case 18: /* rfid, scary */
120 return -1; 629 return -1;
630
631 case 150: /* isync */
632 isync();
633 goto instr_done;
634
635 case 33: /* crnor */
636 case 129: /* crandc */
637 case 193: /* crxor */
638 case 225: /* crnand */
639 case 257: /* crand */
640 case 289: /* creqv */
641 case 417: /* crorc */
642 case 449: /* cror */
643 ra = (instr >> 16) & 0x1f;
644 rb = (instr >> 11) & 0x1f;
645 rd = (instr >> 21) & 0x1f;
646 ra = (regs->ccr >> (31 - ra)) & 1;
647 rb = (regs->ccr >> (31 - rb)) & 1;
648 val = (instr >> (6 + ra * 2 + rb)) & 1;
649 regs->ccr = (regs->ccr & ~(1UL << (31 - rd))) |
650 (val << (31 - rd));
651 goto instr_done;
652 }
653 break;
654 case 31:
655 switch ((instr >> 1) & 0x3ff) {
656 case 598: /* sync */
657#ifdef __powerpc64__
658 switch ((instr >> 21) & 3) {
659 case 1: /* lwsync */
660 asm volatile("lwsync" : : : "memory");
661 goto instr_done;
662 case 2: /* ptesync */
663 asm volatile("ptesync" : : : "memory");
664 goto instr_done;
665 }
666#endif
667 mb();
668 goto instr_done;
669
670 case 854: /* eieio */
671 eieio();
672 goto instr_done;
673 }
674 break;
675 }
676
677 /* Following cases refer to regs->gpr[], so we need all regs */
678 if (!FULL_REGS(regs))
679 return 0;
680
681 rd = (instr >> 21) & 0x1f;
682 ra = (instr >> 16) & 0x1f;
683 rb = (instr >> 11) & 0x1f;
684
685 switch (opcode) {
686 case 7: /* mulli */
687 regs->gpr[rd] = regs->gpr[ra] * (short) instr;
688 goto instr_done;
689
690 case 8: /* subfic */
691 imm = (short) instr;
692 add_with_carry(regs, rd, ~regs->gpr[ra], imm, 1);
693 goto instr_done;
694
695 case 10: /* cmpli */
696 imm = (unsigned short) instr;
697 val = regs->gpr[ra];
698#ifdef __powerpc64__
699 if ((rd & 1) == 0)
700 val = (unsigned int) val;
701#endif
702 do_cmp_unsigned(regs, val, imm, rd >> 2);
703 goto instr_done;
704
705 case 11: /* cmpi */
706 imm = (short) instr;
707 val = regs->gpr[ra];
708#ifdef __powerpc64__
709 if ((rd & 1) == 0)
710 val = (int) val;
711#endif
712 do_cmp_signed(regs, val, imm, rd >> 2);
713 goto instr_done;
714
715 case 12: /* addic */
716 imm = (short) instr;
717 add_with_carry(regs, rd, regs->gpr[ra], imm, 0);
718 goto instr_done;
719
720 case 13: /* addic. */
721 imm = (short) instr;
722 add_with_carry(regs, rd, regs->gpr[ra], imm, 0);
723 set_cr0(regs, rd);
724 goto instr_done;
725
726 case 14: /* addi */
727 imm = (short) instr;
728 if (ra)
729 imm += regs->gpr[ra];
730 regs->gpr[rd] = imm;
731 goto instr_done;
732
733 case 15: /* addis */
734 imm = ((short) instr) << 16;
735 if (ra)
736 imm += regs->gpr[ra];
737 regs->gpr[rd] = imm;
738 goto instr_done;
739
740 case 20: /* rlwimi */
741 mb = (instr >> 6) & 0x1f;
742 me = (instr >> 1) & 0x1f;
743 val = DATA32(regs->gpr[rd]);
744 imm = MASK32(mb, me);
745 regs->gpr[ra] = (regs->gpr[ra] & ~imm) | (ROTATE(val, rb) & imm);
746 goto logical_done;
747
748 case 21: /* rlwinm */
749 mb = (instr >> 6) & 0x1f;
750 me = (instr >> 1) & 0x1f;
751 val = DATA32(regs->gpr[rd]);
752 regs->gpr[ra] = ROTATE(val, rb) & MASK32(mb, me);
753 goto logical_done;
754
755 case 23: /* rlwnm */
756 mb = (instr >> 6) & 0x1f;
757 me = (instr >> 1) & 0x1f;
758 rb = regs->gpr[rb] & 0x1f;
759 val = DATA32(regs->gpr[rd]);
760 regs->gpr[ra] = ROTATE(val, rb) & MASK32(mb, me);
761 goto logical_done;
762
763 case 24: /* ori */
764 imm = (unsigned short) instr;
765 regs->gpr[ra] = regs->gpr[rd] | imm;
766 goto instr_done;
767
768 case 25: /* oris */
769 imm = (unsigned short) instr;
770 regs->gpr[ra] = regs->gpr[rd] | (imm << 16);
771 goto instr_done;
772
773 case 26: /* xori */
774 imm = (unsigned short) instr;
775 regs->gpr[ra] = regs->gpr[rd] ^ imm;
776 goto instr_done;
777
778 case 27: /* xoris */
779 imm = (unsigned short) instr;
780 regs->gpr[ra] = regs->gpr[rd] ^ (imm << 16);
781 goto instr_done;
782
783 case 28: /* andi. */
784 imm = (unsigned short) instr;
785 regs->gpr[ra] = regs->gpr[rd] & imm;
786 set_cr0(regs, ra);
787 goto instr_done;
788
789 case 29: /* andis. */
790 imm = (unsigned short) instr;
791 regs->gpr[ra] = regs->gpr[rd] & (imm << 16);
792 set_cr0(regs, ra);
793 goto instr_done;
794
795#ifdef __powerpc64__
796 case 30: /* rld* */
797 mb = ((instr >> 6) & 0x1f) | (instr & 0x20);
798 val = regs->gpr[rd];
799 if ((instr & 0x10) == 0) {
800 sh = rb | ((instr & 2) << 4);
801 val = ROTATE(val, sh);
802 switch ((instr >> 2) & 3) {
803 case 0: /* rldicl */
804 regs->gpr[ra] = val & MASK64_L(mb);
805 goto logical_done;
806 case 1: /* rldicr */
807 regs->gpr[ra] = val & MASK64_R(mb);
808 goto logical_done;
809 case 2: /* rldic */
810 regs->gpr[ra] = val & MASK64(mb, 63 - sh);
811 goto logical_done;
812 case 3: /* rldimi */
813 imm = MASK64(mb, 63 - sh);
814 regs->gpr[ra] = (regs->gpr[ra] & ~imm) |
815 (val & imm);
816 goto logical_done;
817 }
818 } else {
819 sh = regs->gpr[rb] & 0x3f;
820 val = ROTATE(val, sh);
821 switch ((instr >> 1) & 7) {
822 case 0: /* rldcl */
823 regs->gpr[ra] = val & MASK64_L(mb);
824 goto logical_done;
825 case 1: /* rldcr */
826 regs->gpr[ra] = val & MASK64_R(mb);
827 goto logical_done;
828 }
121 } 829 }
830#endif
831
122 case 31: 832 case 31:
123 rd = (instr >> 21) & 0x1f; 833 switch ((instr >> 1) & 0x3ff) {
124 switch (instr & 0x7fe) { 834 case 83: /* mfmsr */
125 case 0xa6: /* mfmsr */ 835 if (regs->msr & MSR_PR)
836 break;
126 regs->gpr[rd] = regs->msr & MSR_MASK; 837 regs->gpr[rd] = regs->msr & MSR_MASK;
127 regs->nip += 4; 838 goto instr_done;
128 if ((regs->msr & MSR_SF) == 0) 839 case 146: /* mtmsr */
129 regs->nip &= 0xffffffffUL; 840 if (regs->msr & MSR_PR)
130 return 1; 841 break;
131 case 0x124: /* mtmsr */
132 imm = regs->gpr[rd]; 842 imm = regs->gpr[rd];
133 if ((imm & MSR_RI) == 0) 843 if ((imm & MSR_RI) == 0)
134 /* can't step mtmsr that would clear MSR_RI */ 844 /* can't step mtmsr that would clear MSR_RI */
135 return -1; 845 return -1;
136 regs->msr = imm; 846 regs->msr = imm;
137 regs->nip += 4; 847 goto instr_done;
138 return 1;
139#ifdef CONFIG_PPC64 848#ifdef CONFIG_PPC64
140 case 0x164: /* mtmsrd */ 849 case 178: /* mtmsrd */
141 /* only MSR_EE and MSR_RI get changed if bit 15 set */ 850 /* only MSR_EE and MSR_RI get changed if bit 15 set */
142 /* mtmsrd doesn't change MSR_HV and MSR_ME */ 851 /* mtmsrd doesn't change MSR_HV and MSR_ME */
852 if (regs->msr & MSR_PR)
853 break;
143 imm = (instr & 0x10000)? 0x8002: 0xefffffffffffefffUL; 854 imm = (instr & 0x10000)? 0x8002: 0xefffffffffffefffUL;
144 imm = (regs->msr & MSR_MASK & ~imm) 855 imm = (regs->msr & MSR_MASK & ~imm)
145 | (regs->gpr[rd] & imm); 856 | (regs->gpr[rd] & imm);
@@ -147,57 +858,770 @@ int __kprobes emulate_step(struct pt_regs *regs, unsigned int instr)
147 /* can't step mtmsrd that would clear MSR_RI */ 858 /* can't step mtmsrd that would clear MSR_RI */
148 return -1; 859 return -1;
149 regs->msr = imm; 860 regs->msr = imm;
150 regs->nip += 4; 861 goto instr_done;
151 if ((imm & MSR_SF) == 0)
152 regs->nip &= 0xffffffffUL;
153 return 1;
154#endif 862#endif
155 case 0x26: /* mfcr */ 863 case 19: /* mfcr */
156 regs->gpr[rd] = regs->ccr; 864 regs->gpr[rd] = regs->ccr;
157 regs->gpr[rd] &= 0xffffffffUL; 865 regs->gpr[rd] &= 0xffffffffUL;
158 goto mtspr_out; 866 goto instr_done;
159 case 0x2a6: /* mfspr */ 867
868 case 144: /* mtcrf */
869 imm = 0xf0000000UL;
870 val = regs->gpr[rd];
871 for (sh = 0; sh < 8; ++sh) {
872 if (instr & (0x80000 >> sh))
873 regs->ccr = (regs->ccr & ~imm) |
874 (val & imm);
875 imm >>= 4;
876 }
877 goto instr_done;
878
879 case 339: /* mfspr */
160 spr = (instr >> 11) & 0x3ff; 880 spr = (instr >> 11) & 0x3ff;
161 switch (spr) { 881 switch (spr) {
162 case 0x20: /* mfxer */ 882 case 0x20: /* mfxer */
163 regs->gpr[rd] = regs->xer; 883 regs->gpr[rd] = regs->xer;
164 regs->gpr[rd] &= 0xffffffffUL; 884 regs->gpr[rd] &= 0xffffffffUL;
165 goto mtspr_out; 885 goto instr_done;
166 case 0x100: /* mflr */ 886 case 0x100: /* mflr */
167 regs->gpr[rd] = regs->link; 887 regs->gpr[rd] = regs->link;
168 goto mtspr_out; 888 goto instr_done;
169 case 0x120: /* mfctr */ 889 case 0x120: /* mfctr */
170 regs->gpr[rd] = regs->ctr; 890 regs->gpr[rd] = regs->ctr;
171 goto mtspr_out; 891 goto instr_done;
172 }
173 break;
174 case 0x378: /* orx */
175 if (instr & 1)
176 break;
177 rs = (instr >> 21) & 0x1f;
178 rb = (instr >> 11) & 0x1f;
179 if (rs == rb) { /* mr */
180 rd = (instr >> 16) & 0x1f;
181 regs->gpr[rd] = regs->gpr[rs];
182 goto mtspr_out;
183 } 892 }
184 break; 893 break;
185 case 0x3a6: /* mtspr */ 894
895 case 467: /* mtspr */
186 spr = (instr >> 11) & 0x3ff; 896 spr = (instr >> 11) & 0x3ff;
187 switch (spr) { 897 switch (spr) {
188 case 0x20: /* mtxer */ 898 case 0x20: /* mtxer */
189 regs->xer = (regs->gpr[rd] & 0xffffffffUL); 899 regs->xer = (regs->gpr[rd] & 0xffffffffUL);
190 goto mtspr_out; 900 goto instr_done;
191 case 0x100: /* mtlr */ 901 case 0x100: /* mtlr */
192 regs->link = regs->gpr[rd]; 902 regs->link = regs->gpr[rd];
193 goto mtspr_out; 903 goto instr_done;
194 case 0x120: /* mtctr */ 904 case 0x120: /* mtctr */
195 regs->ctr = regs->gpr[rd]; 905 regs->ctr = regs->gpr[rd];
196mtspr_out: 906 goto instr_done;
197 regs->nip += 4;
198 return 1;
199 } 907 }
908 break;
909
910/*
911 * Compare instructions
912 */
913 case 0: /* cmp */
914 val = regs->gpr[ra];
915 val2 = regs->gpr[rb];
916#ifdef __powerpc64__
917 if ((rd & 1) == 0) {
918 /* word (32-bit) compare */
919 val = (int) val;
920 val2 = (int) val2;
921 }
922#endif
923 do_cmp_signed(regs, val, val2, rd >> 2);
924 goto instr_done;
925
926 case 32: /* cmpl */
927 val = regs->gpr[ra];
928 val2 = regs->gpr[rb];
929#ifdef __powerpc64__
930 if ((rd & 1) == 0) {
931 /* word (32-bit) compare */
932 val = (unsigned int) val;
933 val2 = (unsigned int) val2;
934 }
935#endif
936 do_cmp_unsigned(regs, val, val2, rd >> 2);
937 goto instr_done;
938
939/*
940 * Arithmetic instructions
941 */
942 case 8: /* subfc */
943 add_with_carry(regs, rd, ~regs->gpr[ra],
944 regs->gpr[rb], 1);
945 goto arith_done;
946#ifdef __powerpc64__
947 case 9: /* mulhdu */
948 asm("mulhdu %0,%1,%2" : "=r" (regs->gpr[rd]) :
949 "r" (regs->gpr[ra]), "r" (regs->gpr[rb]));
950 goto arith_done;
951#endif
952 case 10: /* addc */
953 add_with_carry(regs, rd, regs->gpr[ra],
954 regs->gpr[rb], 0);
955 goto arith_done;
956
957 case 11: /* mulhwu */
958 asm("mulhwu %0,%1,%2" : "=r" (regs->gpr[rd]) :
959 "r" (regs->gpr[ra]), "r" (regs->gpr[rb]));
960 goto arith_done;
961
962 case 40: /* subf */
963 regs->gpr[rd] = regs->gpr[rb] - regs->gpr[ra];
964 goto arith_done;
965#ifdef __powerpc64__
966 case 73: /* mulhd */
967 asm("mulhd %0,%1,%2" : "=r" (regs->gpr[rd]) :
968 "r" (regs->gpr[ra]), "r" (regs->gpr[rb]));
969 goto arith_done;
970#endif
971 case 75: /* mulhw */
972 asm("mulhw %0,%1,%2" : "=r" (regs->gpr[rd]) :
973 "r" (regs->gpr[ra]), "r" (regs->gpr[rb]));
974 goto arith_done;
975
976 case 104: /* neg */
977 regs->gpr[rd] = -regs->gpr[ra];
978 goto arith_done;
979
980 case 136: /* subfe */
981 add_with_carry(regs, rd, ~regs->gpr[ra], regs->gpr[rb],
982 regs->xer & XER_CA);
983 goto arith_done;
984
985 case 138: /* adde */
986 add_with_carry(regs, rd, regs->gpr[ra], regs->gpr[rb],
987 regs->xer & XER_CA);
988 goto arith_done;
989
990 case 200: /* subfze */
991 add_with_carry(regs, rd, ~regs->gpr[ra], 0L,
992 regs->xer & XER_CA);
993 goto arith_done;
994
995 case 202: /* addze */
996 add_with_carry(regs, rd, regs->gpr[ra], 0L,
997 regs->xer & XER_CA);
998 goto arith_done;
999
1000 case 232: /* subfme */
1001 add_with_carry(regs, rd, ~regs->gpr[ra], -1L,
1002 regs->xer & XER_CA);
1003 goto arith_done;
1004#ifdef __powerpc64__
1005 case 233: /* mulld */
1006 regs->gpr[rd] = regs->gpr[ra] * regs->gpr[rb];
1007 goto arith_done;
1008#endif
1009 case 234: /* addme */
1010 add_with_carry(regs, rd, regs->gpr[ra], -1L,
1011 regs->xer & XER_CA);
1012 goto arith_done;
1013
1014 case 235: /* mullw */
1015 regs->gpr[rd] = (unsigned int) regs->gpr[ra] *
1016 (unsigned int) regs->gpr[rb];
1017 goto arith_done;
1018
1019 case 266: /* add */
1020 regs->gpr[rd] = regs->gpr[ra] + regs->gpr[rb];
1021 goto arith_done;
1022#ifdef __powerpc64__
1023 case 457: /* divdu */
1024 regs->gpr[rd] = regs->gpr[ra] / regs->gpr[rb];
1025 goto arith_done;
1026#endif
1027 case 459: /* divwu */
1028 regs->gpr[rd] = (unsigned int) regs->gpr[ra] /
1029 (unsigned int) regs->gpr[rb];
1030 goto arith_done;
1031#ifdef __powerpc64__
1032 case 489: /* divd */
1033 regs->gpr[rd] = (long int) regs->gpr[ra] /
1034 (long int) regs->gpr[rb];
1035 goto arith_done;
1036#endif
1037 case 491: /* divw */
1038 regs->gpr[rd] = (int) regs->gpr[ra] /
1039 (int) regs->gpr[rb];
1040 goto arith_done;
1041
1042
1043/*
1044 * Logical instructions
1045 */
1046 case 26: /* cntlzw */
1047 asm("cntlzw %0,%1" : "=r" (regs->gpr[ra]) :
1048 "r" (regs->gpr[rd]));
1049 goto logical_done;
1050#ifdef __powerpc64__
1051 case 58: /* cntlzd */
1052 asm("cntlzd %0,%1" : "=r" (regs->gpr[ra]) :
1053 "r" (regs->gpr[rd]));
1054 goto logical_done;
1055#endif
1056 case 28: /* and */
1057 regs->gpr[ra] = regs->gpr[rd] & regs->gpr[rb];
1058 goto logical_done;
1059
1060 case 60: /* andc */
1061 regs->gpr[ra] = regs->gpr[rd] & ~regs->gpr[rb];
1062 goto logical_done;
1063
1064 case 124: /* nor */
1065 regs->gpr[ra] = ~(regs->gpr[rd] | regs->gpr[rb]);
1066 goto logical_done;
1067
1068 case 284: /* xor */
1069 regs->gpr[ra] = ~(regs->gpr[rd] ^ regs->gpr[rb]);
1070 goto logical_done;
1071
1072 case 316: /* xor */
1073 regs->gpr[ra] = regs->gpr[rd] ^ regs->gpr[rb];
1074 goto logical_done;
1075
1076 case 412: /* orc */
1077 regs->gpr[ra] = regs->gpr[rd] | ~regs->gpr[rb];
1078 goto logical_done;
1079
1080 case 444: /* or */
1081 regs->gpr[ra] = regs->gpr[rd] | regs->gpr[rb];
1082 goto logical_done;
1083
1084 case 476: /* nand */
1085 regs->gpr[ra] = ~(regs->gpr[rd] & regs->gpr[rb]);
1086 goto logical_done;
1087
1088 case 922: /* extsh */
1089 regs->gpr[ra] = (signed short) regs->gpr[rd];
1090 goto logical_done;
1091
1092 case 954: /* extsb */
1093 regs->gpr[ra] = (signed char) regs->gpr[rd];
1094 goto logical_done;
1095#ifdef __powerpc64__
1096 case 986: /* extsw */
1097 regs->gpr[ra] = (signed int) regs->gpr[rd];
1098 goto logical_done;
1099#endif
1100
1101/*
1102 * Shift instructions
1103 */
1104 case 24: /* slw */
1105 sh = regs->gpr[rb] & 0x3f;
1106 if (sh < 32)
1107 regs->gpr[ra] = (regs->gpr[rd] << sh) & 0xffffffffUL;
1108 else
1109 regs->gpr[ra] = 0;
1110 goto logical_done;
1111
1112 case 536: /* srw */
1113 sh = regs->gpr[rb] & 0x3f;
1114 if (sh < 32)
1115 regs->gpr[ra] = (regs->gpr[rd] & 0xffffffffUL) >> sh;
1116 else
1117 regs->gpr[ra] = 0;
1118 goto logical_done;
1119
1120 case 792: /* sraw */
1121 sh = regs->gpr[rb] & 0x3f;
1122 ival = (signed int) regs->gpr[rd];
1123 regs->gpr[ra] = ival >> (sh < 32 ? sh : 31);
1124 if (ival < 0 && (sh >= 32 || (ival & ((1 << sh) - 1)) != 0))
1125 regs->xer |= XER_CA;
1126 else
1127 regs->xer &= ~XER_CA;
1128 goto logical_done;
1129
1130 case 824: /* srawi */
1131 sh = rb;
1132 ival = (signed int) regs->gpr[rd];
1133 regs->gpr[ra] = ival >> sh;
1134 if (ival < 0 && (ival & ((1 << sh) - 1)) != 0)
1135 regs->xer |= XER_CA;
1136 else
1137 regs->xer &= ~XER_CA;
1138 goto logical_done;
1139
1140#ifdef __powerpc64__
1141 case 27: /* sld */
1142 sh = regs->gpr[rd] & 0x7f;
1143 if (sh < 64)
1144 regs->gpr[ra] = regs->gpr[rd] << sh;
1145 else
1146 regs->gpr[ra] = 0;
1147 goto logical_done;
1148
1149 case 539: /* srd */
1150 sh = regs->gpr[rb] & 0x7f;
1151 if (sh < 64)
1152 regs->gpr[ra] = regs->gpr[rd] >> sh;
1153 else
1154 regs->gpr[ra] = 0;
1155 goto logical_done;
1156
1157 case 794: /* srad */
1158 sh = regs->gpr[rb] & 0x7f;
1159 ival = (signed long int) regs->gpr[rd];
1160 regs->gpr[ra] = ival >> (sh < 64 ? sh : 63);
1161 if (ival < 0 && (sh >= 64 || (ival & ((1 << sh) - 1)) != 0))
1162 regs->xer |= XER_CA;
1163 else
1164 regs->xer &= ~XER_CA;
1165 goto logical_done;
1166
1167 case 826: /* sradi with sh_5 = 0 */
1168 case 827: /* sradi with sh_5 = 1 */
1169 sh = rb | ((instr & 2) << 4);
1170 ival = (signed long int) regs->gpr[rd];
1171 regs->gpr[ra] = ival >> sh;
1172 if (ival < 0 && (ival & ((1 << sh) - 1)) != 0)
1173 regs->xer |= XER_CA;
1174 else
1175 regs->xer &= ~XER_CA;
1176 goto logical_done;
1177#endif /* __powerpc64__ */
1178
1179/*
1180 * Cache instructions
1181 */
1182 case 54: /* dcbst */
1183 ea = xform_ea(instr, regs, 0);
1184 if (!address_ok(regs, ea, 8))
1185 return 0;
1186 err = 0;
1187 __cacheop_user_asmx(ea, err, "dcbst");
1188 if (err)
1189 return 0;
1190 goto instr_done;
1191
1192 case 86: /* dcbf */
1193 ea = xform_ea(instr, regs, 0);
1194 if (!address_ok(regs, ea, 8))
1195 return 0;
1196 err = 0;
1197 __cacheop_user_asmx(ea, err, "dcbf");
1198 if (err)
1199 return 0;
1200 goto instr_done;
1201
1202 case 246: /* dcbtst */
1203 if (rd == 0) {
1204 ea = xform_ea(instr, regs, 0);
1205 prefetchw((void *) ea);
1206 }
1207 goto instr_done;
1208
1209 case 278: /* dcbt */
1210 if (rd == 0) {
1211 ea = xform_ea(instr, regs, 0);
1212 prefetch((void *) ea);
1213 }
1214 goto instr_done;
1215
200 } 1216 }
1217 break;
201 } 1218 }
202 return 0; 1219
1220 /*
1221 * Following cases are for loads and stores, so bail out
1222 * if we're in little-endian mode.
1223 */
1224 if (regs->msr & MSR_LE)
1225 return 0;
1226
1227 /*
1228 * Save register RA in case it's an update form load or store
1229 * and the access faults.
1230 */
1231 old_ra = regs->gpr[ra];
1232
1233 switch (opcode) {
1234 case 31:
1235 u = instr & 0x40;
1236 switch ((instr >> 1) & 0x3ff) {
1237 case 20: /* lwarx */
1238 ea = xform_ea(instr, regs, 0);
1239 if (ea & 3)
1240 break; /* can't handle misaligned */
1241 err = -EFAULT;
1242 if (!address_ok(regs, ea, 4))
1243 goto ldst_done;
1244 err = 0;
1245 __get_user_asmx(val, ea, err, "lwarx");
1246 if (!err)
1247 regs->gpr[rd] = val;
1248 goto ldst_done;
1249
1250 case 150: /* stwcx. */
1251 ea = xform_ea(instr, regs, 0);
1252 if (ea & 3)
1253 break; /* can't handle misaligned */
1254 err = -EFAULT;
1255 if (!address_ok(regs, ea, 4))
1256 goto ldst_done;
1257 err = 0;
1258 __put_user_asmx(regs->gpr[rd], ea, err, "stwcx.", cr);
1259 if (!err)
1260 regs->ccr = (regs->ccr & 0x0fffffff) |
1261 (cr & 0xe0000000) |
1262 ((regs->xer >> 3) & 0x10000000);
1263 goto ldst_done;
1264
1265#ifdef __powerpc64__
1266 case 84: /* ldarx */
1267 ea = xform_ea(instr, regs, 0);
1268 if (ea & 7)
1269 break; /* can't handle misaligned */
1270 err = -EFAULT;
1271 if (!address_ok(regs, ea, 8))
1272 goto ldst_done;
1273 err = 0;
1274 __get_user_asmx(val, ea, err, "ldarx");
1275 if (!err)
1276 regs->gpr[rd] = val;
1277 goto ldst_done;
1278
1279 case 214: /* stdcx. */
1280 ea = xform_ea(instr, regs, 0);
1281 if (ea & 7)
1282 break; /* can't handle misaligned */
1283 err = -EFAULT;
1284 if (!address_ok(regs, ea, 8))
1285 goto ldst_done;
1286 err = 0;
1287 __put_user_asmx(regs->gpr[rd], ea, err, "stdcx.", cr);
1288 if (!err)
1289 regs->ccr = (regs->ccr & 0x0fffffff) |
1290 (cr & 0xe0000000) |
1291 ((regs->xer >> 3) & 0x10000000);
1292 goto ldst_done;
1293
1294 case 21: /* ldx */
1295 case 53: /* ldux */
1296 err = read_mem(&regs->gpr[rd], xform_ea(instr, regs, u),
1297 8, regs);
1298 goto ldst_done;
1299#endif
1300
1301 case 23: /* lwzx */
1302 case 55: /* lwzux */
1303 err = read_mem(&regs->gpr[rd], xform_ea(instr, regs, u),
1304 4, regs);
1305 goto ldst_done;
1306
1307 case 87: /* lbzx */
1308 case 119: /* lbzux */
1309 err = read_mem(&regs->gpr[rd], xform_ea(instr, regs, u),
1310 1, regs);
1311 goto ldst_done;
1312
1313#ifdef CONFIG_ALTIVEC
1314 case 103: /* lvx */
1315 case 359: /* lvxl */
1316 if (!(regs->msr & MSR_VEC))
1317 break;
1318 ea = xform_ea(instr, regs, 0);
1319 err = do_vec_load(rd, do_lvx, ea, regs);
1320 goto ldst_done;
1321
1322 case 231: /* stvx */
1323 case 487: /* stvxl */
1324 if (!(regs->msr & MSR_VEC))
1325 break;
1326 ea = xform_ea(instr, regs, 0);
1327 err = do_vec_store(rd, do_stvx, ea, regs);
1328 goto ldst_done;
1329#endif /* CONFIG_ALTIVEC */
1330
1331#ifdef __powerpc64__
1332 case 149: /* stdx */
1333 case 181: /* stdux */
1334 val = regs->gpr[rd];
1335 err = write_mem(val, xform_ea(instr, regs, u), 8, regs);
1336 goto ldst_done;
1337#endif
1338
1339 case 151: /* stwx */
1340 case 183: /* stwux */
1341 val = regs->gpr[rd];
1342 err = write_mem(val, xform_ea(instr, regs, u), 4, regs);
1343 goto ldst_done;
1344
1345 case 215: /* stbx */
1346 case 247: /* stbux */
1347 val = regs->gpr[rd];
1348 err = write_mem(val, xform_ea(instr, regs, u), 1, regs);
1349 goto ldst_done;
1350
1351 case 279: /* lhzx */
1352 case 311: /* lhzux */
1353 err = read_mem(&regs->gpr[rd], xform_ea(instr, regs, u),
1354 2, regs);
1355 goto ldst_done;
1356
1357#ifdef __powerpc64__
1358 case 341: /* lwax */
1359 case 373: /* lwaux */
1360 err = read_mem(&regs->gpr[rd], xform_ea(instr, regs, u),
1361 4, regs);
1362 if (!err)
1363 regs->gpr[rd] = (signed int) regs->gpr[rd];
1364 goto ldst_done;
1365#endif
1366
1367 case 343: /* lhax */
1368 case 375: /* lhaux */
1369 err = read_mem(&regs->gpr[rd], xform_ea(instr, regs, u),
1370 2, regs);
1371 if (!err)
1372 regs->gpr[rd] = (signed short) regs->gpr[rd];
1373 goto ldst_done;
1374
1375 case 407: /* sthx */
1376 case 439: /* sthux */
1377 val = regs->gpr[rd];
1378 err = write_mem(val, xform_ea(instr, regs, u), 2, regs);
1379 goto ldst_done;
1380
1381#ifdef __powerpc64__
1382 case 532: /* ldbrx */
1383 err = read_mem(&val, xform_ea(instr, regs, 0), 8, regs);
1384 if (!err)
1385 regs->gpr[rd] = byterev_8(val);
1386 goto ldst_done;
1387
1388#endif
1389
1390 case 534: /* lwbrx */
1391 err = read_mem(&val, xform_ea(instr, regs, 0), 4, regs);
1392 if (!err)
1393 regs->gpr[rd] = byterev_4(val);
1394 goto ldst_done;
1395
1396 case 535: /* lfsx */
1397 case 567: /* lfsux */
1398 if (!(regs->msr & MSR_FP))
1399 break;
1400 ea = xform_ea(instr, regs, u);
1401 err = do_fp_load(rd, do_lfs, ea, 4, regs);
1402 goto ldst_done;
1403
1404 case 599: /* lfdx */
1405 case 631: /* lfdux */
1406 if (!(regs->msr & MSR_FP))
1407 break;
1408 ea = xform_ea(instr, regs, u);
1409 err = do_fp_load(rd, do_lfd, ea, 8, regs);
1410 goto ldst_done;
1411
1412 case 663: /* stfsx */
1413 case 695: /* stfsux */
1414 if (!(regs->msr & MSR_FP))
1415 break;
1416 ea = xform_ea(instr, regs, u);
1417 err = do_fp_store(rd, do_stfs, ea, 4, regs);
1418 goto ldst_done;
1419
1420 case 727: /* stfdx */
1421 case 759: /* stfdux */
1422 if (!(regs->msr & MSR_FP))
1423 break;
1424 ea = xform_ea(instr, regs, u);
1425 err = do_fp_store(rd, do_stfd, ea, 8, regs);
1426 goto ldst_done;
1427
1428#ifdef __powerpc64__
1429 case 660: /* stdbrx */
1430 val = byterev_8(regs->gpr[rd]);
1431 err = write_mem(val, xform_ea(instr, regs, 0), 8, regs);
1432 goto ldst_done;
1433
1434#endif
1435 case 662: /* stwbrx */
1436 val = byterev_4(regs->gpr[rd]);
1437 err = write_mem(val, xform_ea(instr, regs, 0), 4, regs);
1438 goto ldst_done;
1439
1440 case 790: /* lhbrx */
1441 err = read_mem(&val, xform_ea(instr, regs, 0), 2, regs);
1442 if (!err)
1443 regs->gpr[rd] = byterev_2(val);
1444 goto ldst_done;
1445
1446 case 918: /* sthbrx */
1447 val = byterev_2(regs->gpr[rd]);
1448 err = write_mem(val, xform_ea(instr, regs, 0), 2, regs);
1449 goto ldst_done;
1450
1451#ifdef CONFIG_VSX
1452 case 844: /* lxvd2x */
1453 case 876: /* lxvd2ux */
1454 if (!(regs->msr & MSR_VSX))
1455 break;
1456 rd |= (instr & 1) << 5;
1457 ea = xform_ea(instr, regs, u);
1458 err = do_vsx_load(rd, do_lxvd2x, ea, regs);
1459 goto ldst_done;
1460
1461 case 972: /* stxvd2x */
1462 case 1004: /* stxvd2ux */
1463 if (!(regs->msr & MSR_VSX))
1464 break;
1465 rd |= (instr & 1) << 5;
1466 ea = xform_ea(instr, regs, u);
1467 err = do_vsx_store(rd, do_stxvd2x, ea, regs);
1468 goto ldst_done;
1469
1470#endif /* CONFIG_VSX */
1471 }
1472 break;
1473
1474 case 32: /* lwz */
1475 case 33: /* lwzu */
1476 err = read_mem(&regs->gpr[rd], dform_ea(instr, regs), 4, regs);
1477 goto ldst_done;
1478
1479 case 34: /* lbz */
1480 case 35: /* lbzu */
1481 err = read_mem(&regs->gpr[rd], dform_ea(instr, regs), 1, regs);
1482 goto ldst_done;
1483
1484 case 36: /* stw */
1485 case 37: /* stwu */
1486 val = regs->gpr[rd];
1487 err = write_mem(val, dform_ea(instr, regs), 4, regs);
1488 goto ldst_done;
1489
1490 case 38: /* stb */
1491 case 39: /* stbu */
1492 val = regs->gpr[rd];
1493 err = write_mem(val, dform_ea(instr, regs), 1, regs);
1494 goto ldst_done;
1495
1496 case 40: /* lhz */
1497 case 41: /* lhzu */
1498 err = read_mem(&regs->gpr[rd], dform_ea(instr, regs), 2, regs);
1499 goto ldst_done;
1500
1501 case 42: /* lha */
1502 case 43: /* lhau */
1503 err = read_mem(&regs->gpr[rd], dform_ea(instr, regs), 2, regs);
1504 if (!err)
1505 regs->gpr[rd] = (signed short) regs->gpr[rd];
1506 goto ldst_done;
1507
1508 case 44: /* sth */
1509 case 45: /* sthu */
1510 val = regs->gpr[rd];
1511 err = write_mem(val, dform_ea(instr, regs), 2, regs);
1512 goto ldst_done;
1513
1514 case 46: /* lmw */
1515 ra = (instr >> 16) & 0x1f;
1516 if (ra >= rd)
1517 break; /* invalid form, ra in range to load */
1518 ea = dform_ea(instr, regs);
1519 do {
1520 err = read_mem(&regs->gpr[rd], ea, 4, regs);
1521 if (err)
1522 return 0;
1523 ea += 4;
1524 } while (++rd < 32);
1525 goto instr_done;
1526
1527 case 47: /* stmw */
1528 ea = dform_ea(instr, regs);
1529 do {
1530 err = write_mem(regs->gpr[rd], ea, 4, regs);
1531 if (err)
1532 return 0;
1533 ea += 4;
1534 } while (++rd < 32);
1535 goto instr_done;
1536
1537 case 48: /* lfs */
1538 case 49: /* lfsu */
1539 if (!(regs->msr & MSR_FP))
1540 break;
1541 ea = dform_ea(instr, regs);
1542 err = do_fp_load(rd, do_lfs, ea, 4, regs);
1543 goto ldst_done;
1544
1545 case 50: /* lfd */
1546 case 51: /* lfdu */
1547 if (!(regs->msr & MSR_FP))
1548 break;
1549 ea = dform_ea(instr, regs);
1550 err = do_fp_load(rd, do_lfd, ea, 8, regs);
1551 goto ldst_done;
1552
1553 case 52: /* stfs */
1554 case 53: /* stfsu */
1555 if (!(regs->msr & MSR_FP))
1556 break;
1557 ea = dform_ea(instr, regs);
1558 err = do_fp_store(rd, do_stfs, ea, 4, regs);
1559 goto ldst_done;
1560
1561 case 54: /* stfd */
1562 case 55: /* stfdu */
1563 if (!(regs->msr & MSR_FP))
1564 break;
1565 ea = dform_ea(instr, regs);
1566 err = do_fp_store(rd, do_stfd, ea, 8, regs);
1567 goto ldst_done;
1568
1569#ifdef __powerpc64__
1570 case 58: /* ld[u], lwa */
1571 switch (instr & 3) {
1572 case 0: /* ld */
1573 err = read_mem(&regs->gpr[rd], dsform_ea(instr, regs),
1574 8, regs);
1575 goto ldst_done;
1576 case 1: /* ldu */
1577 err = read_mem(&regs->gpr[rd], dsform_ea(instr, regs),
1578 8, regs);
1579 goto ldst_done;
1580 case 2: /* lwa */
1581 err = read_mem(&regs->gpr[rd], dsform_ea(instr, regs),
1582 4, regs);
1583 if (!err)
1584 regs->gpr[rd] = (signed int) regs->gpr[rd];
1585 goto ldst_done;
1586 }
1587 break;
1588
1589 case 62: /* std[u] */
1590 val = regs->gpr[rd];
1591 switch (instr & 3) {
1592 case 0: /* std */
1593 err = write_mem(val, dsform_ea(instr, regs), 8, regs);
1594 goto ldst_done;
1595 case 1: /* stdu */
1596 err = write_mem(val, dsform_ea(instr, regs), 8, regs);
1597 goto ldst_done;
1598 }
1599 break;
1600#endif /* __powerpc64__ */
1601
1602 }
1603 err = -EINVAL;
1604
1605 ldst_done:
1606 if (err) {
1607 regs->gpr[ra] = old_ra;
1608 return 0; /* invoke DSI if -EFAULT? */
1609 }
1610 instr_done:
1611 regs->nip += 4;
1612#ifdef __powerpc64__
1613 if ((regs->msr & MSR_SF) == 0)
1614 regs->nip &= 0xffffffffUL;
1615#endif
1616 return 1;
1617
1618 logical_done:
1619 if (instr & 1)
1620 set_cr0(regs, ra);
1621 goto instr_done;
1622
1623 arith_done:
1624 if (instr & 1)
1625 set_cr0(regs, rd);
1626 goto instr_done;
203} 1627}
diff --git a/arch/powerpc/mm/fsl_booke_mmu.c b/arch/powerpc/mm/fsl_booke_mmu.c
index cdc7526e9c93..4b66a1ece6d8 100644
--- a/arch/powerpc/mm/fsl_booke_mmu.c
+++ b/arch/powerpc/mm/fsl_booke_mmu.c
@@ -104,9 +104,10 @@ unsigned long p_mapped_by_tlbcam(phys_addr_t pa)
104} 104}
105 105
106/* 106/*
107 * Set up one of the I/D BAT (block address translation) register pairs. 107 * Set up a variable-size TLB entry (tlbcam). The parameters are not checked;
108 * The parameters are not checked; in particular size must be a power 108 * in particular size must be a power of 4 between 4k and 256M (or 1G, for cpus
109 * of 4 between 4k and 256M. 109 * that support extended page sizes). Note that while some cpus support a
110 * page size of 4G, we don't allow its use here.
110 */ 111 */
111static void settlbcam(int index, unsigned long virt, phys_addr_t phys, 112static void settlbcam(int index, unsigned long virt, phys_addr_t phys,
112 unsigned long size, unsigned long flags, unsigned int pid) 113 unsigned long size, unsigned long flags, unsigned int pid)
diff --git a/arch/powerpc/mm/numa.c b/arch/powerpc/mm/numa.c
index aa731af720c0..002878ccf90b 100644
--- a/arch/powerpc/mm/numa.c
+++ b/arch/powerpc/mm/numa.c
@@ -42,6 +42,12 @@ EXPORT_SYMBOL(node_data);
42 42
43static int min_common_depth; 43static int min_common_depth;
44static int n_mem_addr_cells, n_mem_size_cells; 44static int n_mem_addr_cells, n_mem_size_cells;
45static int form1_affinity;
46
47#define MAX_DISTANCE_REF_POINTS 4
48static int distance_ref_points_depth;
49static const unsigned int *distance_ref_points;
50static int distance_lookup_table[MAX_NUMNODES][MAX_DISTANCE_REF_POINTS];
45 51
46/* 52/*
47 * Allocate node_to_cpumask_map based on number of available nodes 53 * Allocate node_to_cpumask_map based on number of available nodes
@@ -204,6 +210,39 @@ static const u32 *of_get_usable_memory(struct device_node *memory)
204 return prop; 210 return prop;
205} 211}
206 212
213int __node_distance(int a, int b)
214{
215 int i;
216 int distance = LOCAL_DISTANCE;
217
218 if (!form1_affinity)
219 return distance;
220
221 for (i = 0; i < distance_ref_points_depth; i++) {
222 if (distance_lookup_table[a][i] == distance_lookup_table[b][i])
223 break;
224
225 /* Double the distance for each NUMA level */
226 distance *= 2;
227 }
228
229 return distance;
230}
231
232static void initialize_distance_lookup_table(int nid,
233 const unsigned int *associativity)
234{
235 int i;
236
237 if (!form1_affinity)
238 return;
239
240 for (i = 0; i < distance_ref_points_depth; i++) {
241 distance_lookup_table[nid][i] =
242 associativity[distance_ref_points[i]];
243 }
244}
245
207/* Returns nid in the range [0..MAX_NUMNODES-1], or -1 if no useful numa 246/* Returns nid in the range [0..MAX_NUMNODES-1], or -1 if no useful numa
208 * info is found. 247 * info is found.
209 */ 248 */
@@ -225,6 +264,10 @@ static int of_node_to_nid_single(struct device_node *device)
225 /* POWER4 LPAR uses 0xffff as invalid node */ 264 /* POWER4 LPAR uses 0xffff as invalid node */
226 if (nid == 0xffff || nid >= MAX_NUMNODES) 265 if (nid == 0xffff || nid >= MAX_NUMNODES)
227 nid = -1; 266 nid = -1;
267
268 if (nid > 0 && tmp[0] >= distance_ref_points_depth)
269 initialize_distance_lookup_table(nid, tmp);
270
228out: 271out:
229 return nid; 272 return nid;
230} 273}
@@ -251,26 +294,10 @@ int of_node_to_nid(struct device_node *device)
251} 294}
252EXPORT_SYMBOL_GPL(of_node_to_nid); 295EXPORT_SYMBOL_GPL(of_node_to_nid);
253 296
254/*
255 * In theory, the "ibm,associativity" property may contain multiple
256 * associativity lists because a resource may be multiply connected
257 * into the machine. This resource then has different associativity
258 * characteristics relative to its multiple connections. We ignore
259 * this for now. We also assume that all cpu and memory sets have
260 * their distances represented at a common level. This won't be
261 * true for hierarchical NUMA.
262 *
263 * In any case the ibm,associativity-reference-points should give
264 * the correct depth for a normal NUMA system.
265 *
266 * - Dave Hansen <haveblue@us.ibm.com>
267 */
268static int __init find_min_common_depth(void) 297static int __init find_min_common_depth(void)
269{ 298{
270 int depth, index; 299 int depth;
271 const unsigned int *ref_points;
272 struct device_node *rtas_root; 300 struct device_node *rtas_root;
273 unsigned int len;
274 struct device_node *chosen; 301 struct device_node *chosen;
275 const char *vec5; 302 const char *vec5;
276 303
@@ -280,18 +307,28 @@ static int __init find_min_common_depth(void)
280 return -1; 307 return -1;
281 308
282 /* 309 /*
283 * this property is 2 32-bit integers, each representing a level of 310 * This property is a set of 32-bit integers, each representing
284 * depth in the associativity nodes. The first is for an SMP 311 * an index into the ibm,associativity nodes.
285 * configuration (should be all 0's) and the second is for a normal 312 *
286 * NUMA configuration. 313 * With form 0 affinity the first integer is for an SMP configuration
314 * (should be all 0's) and the second is for a normal NUMA
315 * configuration. We have only one level of NUMA.
316 *
317 * With form 1 affinity the first integer is the most significant
318 * NUMA boundary and the following are progressively less significant
319 * boundaries. There can be more than one level of NUMA.
287 */ 320 */
288 index = 1; 321 distance_ref_points = of_get_property(rtas_root,
289 ref_points = of_get_property(rtas_root, 322 "ibm,associativity-reference-points",
290 "ibm,associativity-reference-points", &len); 323 &distance_ref_points_depth);
324
325 if (!distance_ref_points) {
326 dbg("NUMA: ibm,associativity-reference-points not found.\n");
327 goto err;
328 }
329
330 distance_ref_points_depth /= sizeof(int);
291 331
292 /*
293 * For form 1 affinity information we want the first field
294 */
295#define VEC5_AFFINITY_BYTE 5 332#define VEC5_AFFINITY_BYTE 5
296#define VEC5_AFFINITY 0x80 333#define VEC5_AFFINITY 0x80
297 chosen = of_find_node_by_path("/chosen"); 334 chosen = of_find_node_by_path("/chosen");
@@ -299,19 +336,38 @@ static int __init find_min_common_depth(void)
299 vec5 = of_get_property(chosen, "ibm,architecture-vec-5", NULL); 336 vec5 = of_get_property(chosen, "ibm,architecture-vec-5", NULL);
300 if (vec5 && (vec5[VEC5_AFFINITY_BYTE] & VEC5_AFFINITY)) { 337 if (vec5 && (vec5[VEC5_AFFINITY_BYTE] & VEC5_AFFINITY)) {
301 dbg("Using form 1 affinity\n"); 338 dbg("Using form 1 affinity\n");
302 index = 0; 339 form1_affinity = 1;
303 } 340 }
304 } 341 }
305 342
306 if ((len >= 2 * sizeof(unsigned int)) && ref_points) { 343 if (form1_affinity) {
307 depth = ref_points[index]; 344 depth = distance_ref_points[0];
308 } else { 345 } else {
309 dbg("NUMA: ibm,associativity-reference-points not found.\n"); 346 if (distance_ref_points_depth < 2) {
310 depth = -1; 347 printk(KERN_WARNING "NUMA: "
348 "short ibm,associativity-reference-points\n");
349 goto err;
350 }
351
352 depth = distance_ref_points[1];
311 } 353 }
312 of_node_put(rtas_root);
313 354
355 /*
356 * Warn and cap if the hardware supports more than
357 * MAX_DISTANCE_REF_POINTS domains.
358 */
359 if (distance_ref_points_depth > MAX_DISTANCE_REF_POINTS) {
360 printk(KERN_WARNING "NUMA: distance array capped at "
361 "%d entries\n", MAX_DISTANCE_REF_POINTS);
362 distance_ref_points_depth = MAX_DISTANCE_REF_POINTS;
363 }
364
365 of_node_put(rtas_root);
314 return depth; 366 return depth;
367
368err:
369 of_node_put(rtas_root);
370 return -1;
315} 371}
316 372
317static void __init get_n_mem_cells(int *n_addr_cells, int *n_size_cells) 373static void __init get_n_mem_cells(int *n_addr_cells, int *n_size_cells)
diff --git a/arch/powerpc/mm/pgtable.c b/arch/powerpc/mm/pgtable.c
index ebc2f38eb381..2c7e801ab20b 100644
--- a/arch/powerpc/mm/pgtable.c
+++ b/arch/powerpc/mm/pgtable.c
@@ -92,7 +92,6 @@ static void pte_free_rcu_callback(struct rcu_head *head)
92 92
93static void pte_free_submit(struct pte_freelist_batch *batch) 93static void pte_free_submit(struct pte_freelist_batch *batch)
94{ 94{
95 INIT_RCU_HEAD(&batch->rcu);
96 call_rcu(&batch->rcu, pte_free_rcu_callback); 95 call_rcu(&batch->rcu, pte_free_rcu_callback);
97} 96}
98 97
diff --git a/arch/powerpc/mm/tlb_hash32.c b/arch/powerpc/mm/tlb_hash32.c
index 8aaa8b7eb324..690566b66e8e 100644
--- a/arch/powerpc/mm/tlb_hash32.c
+++ b/arch/powerpc/mm/tlb_hash32.c
@@ -89,17 +89,6 @@ void tlb_flush(struct mmu_gather *tlb)
89 * -- Cort 89 * -- Cort
90 */ 90 */
91 91
92/*
93 * 750 SMP is a Bad Idea because the 750 doesn't broadcast all
94 * the cache operations on the bus. Hence we need to use an IPI
95 * to get the other CPU(s) to invalidate their TLBs.
96 */
97#ifdef CONFIG_SMP_750
98#define FINISH_FLUSH smp_send_tlb_invalidate(0)
99#else
100#define FINISH_FLUSH do { } while (0)
101#endif
102
103static void flush_range(struct mm_struct *mm, unsigned long start, 92static void flush_range(struct mm_struct *mm, unsigned long start,
104 unsigned long end) 93 unsigned long end)
105{ 94{
@@ -138,7 +127,6 @@ static void flush_range(struct mm_struct *mm, unsigned long start,
138void flush_tlb_kernel_range(unsigned long start, unsigned long end) 127void flush_tlb_kernel_range(unsigned long start, unsigned long end)
139{ 128{
140 flush_range(&init_mm, start, end); 129 flush_range(&init_mm, start, end);
141 FINISH_FLUSH;
142} 130}
143EXPORT_SYMBOL(flush_tlb_kernel_range); 131EXPORT_SYMBOL(flush_tlb_kernel_range);
144 132
@@ -162,7 +150,6 @@ void flush_tlb_mm(struct mm_struct *mm)
162 */ 150 */
163 for (mp = mm->mmap; mp != NULL; mp = mp->vm_next) 151 for (mp = mm->mmap; mp != NULL; mp = mp->vm_next)
164 flush_range(mp->vm_mm, mp->vm_start, mp->vm_end); 152 flush_range(mp->vm_mm, mp->vm_start, mp->vm_end);
165 FINISH_FLUSH;
166} 153}
167EXPORT_SYMBOL(flush_tlb_mm); 154EXPORT_SYMBOL(flush_tlb_mm);
168 155
@@ -179,7 +166,6 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long vmaddr)
179 pmd = pmd_offset(pud_offset(pgd_offset(mm, vmaddr), vmaddr), vmaddr); 166 pmd = pmd_offset(pud_offset(pgd_offset(mm, vmaddr), vmaddr), vmaddr);
180 if (!pmd_none(*pmd)) 167 if (!pmd_none(*pmd))
181 flush_hash_pages(mm->context.id, vmaddr, pmd_val(*pmd), 1); 168 flush_hash_pages(mm->context.id, vmaddr, pmd_val(*pmd), 1);
182 FINISH_FLUSH;
183} 169}
184EXPORT_SYMBOL(flush_tlb_page); 170EXPORT_SYMBOL(flush_tlb_page);
185 171
@@ -192,6 +178,5 @@ void flush_tlb_range(struct vm_area_struct *vma, unsigned long start,
192 unsigned long end) 178 unsigned long end)
193{ 179{
194 flush_range(vma->vm_mm, start, end); 180 flush_range(vma->vm_mm, start, end);
195 FINISH_FLUSH;
196} 181}
197EXPORT_SYMBOL(flush_tlb_range); 182EXPORT_SYMBOL(flush_tlb_range);
diff --git a/arch/powerpc/mm/tlb_nohash.c b/arch/powerpc/mm/tlb_nohash.c
index d8695b02a968..fe391e942521 100644
--- a/arch/powerpc/mm/tlb_nohash.c
+++ b/arch/powerpc/mm/tlb_nohash.c
@@ -46,6 +46,7 @@
46struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT] = { 46struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT] = {
47 [MMU_PAGE_4K] = { 47 [MMU_PAGE_4K] = {
48 .shift = 12, 48 .shift = 12,
49 .ind = 20,
49 .enc = BOOK3E_PAGESZ_4K, 50 .enc = BOOK3E_PAGESZ_4K,
50 }, 51 },
51 [MMU_PAGE_16K] = { 52 [MMU_PAGE_16K] = {
@@ -54,6 +55,7 @@ struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT] = {
54 }, 55 },
55 [MMU_PAGE_64K] = { 56 [MMU_PAGE_64K] = {
56 .shift = 16, 57 .shift = 16,
58 .ind = 28,
57 .enc = BOOK3E_PAGESZ_64K, 59 .enc = BOOK3E_PAGESZ_64K,
58 }, 60 },
59 [MMU_PAGE_1M] = { 61 [MMU_PAGE_1M] = {
@@ -62,6 +64,7 @@ struct mmu_psize_def mmu_psize_defs[MMU_PAGE_COUNT] = {
62 }, 64 },
63 [MMU_PAGE_16M] = { 65 [MMU_PAGE_16M] = {
64 .shift = 24, 66 .shift = 24,
67 .ind = 36,
65 .enc = BOOK3E_PAGESZ_16M, 68 .enc = BOOK3E_PAGESZ_16M,
66 }, 69 },
67 [MMU_PAGE_256M] = { 70 [MMU_PAGE_256M] = {
@@ -344,16 +347,108 @@ void tlb_flush_pgtable(struct mmu_gather *tlb, unsigned long address)
344 } 347 }
345} 348}
346 349
347/* 350static void setup_page_sizes(void)
348 * Early initialization of the MMU TLB code 351{
349 */ 352 unsigned int tlb0cfg = mfspr(SPRN_TLB0CFG);
350static void __early_init_mmu(int boot_cpu) 353 unsigned int tlb0ps = mfspr(SPRN_TLB0PS);
354 unsigned int eptcfg = mfspr(SPRN_EPTCFG);
355 int i, psize;
356
357 /* Look for supported direct sizes */
358 for (psize = 0; psize < MMU_PAGE_COUNT; ++psize) {
359 struct mmu_psize_def *def = &mmu_psize_defs[psize];
360
361 if (tlb0ps & (1U << (def->shift - 10)))
362 def->flags |= MMU_PAGE_SIZE_DIRECT;
363 }
364
365 /* Indirect page sizes supported ? */
366 if ((tlb0cfg & TLBnCFG_IND) == 0)
367 goto no_indirect;
368
369 /* Now, we only deal with one IND page size for each
370 * direct size. Hopefully all implementations today are
371 * unambiguous, but we might want to be careful in the
372 * future.
373 */
374 for (i = 0; i < 3; i++) {
375 unsigned int ps, sps;
376
377 sps = eptcfg & 0x1f;
378 eptcfg >>= 5;
379 ps = eptcfg & 0x1f;
380 eptcfg >>= 5;
381 if (!ps || !sps)
382 continue;
383 for (psize = 0; psize < MMU_PAGE_COUNT; psize++) {
384 struct mmu_psize_def *def = &mmu_psize_defs[psize];
385
386 if (ps == (def->shift - 10))
387 def->flags |= MMU_PAGE_SIZE_INDIRECT;
388 if (sps == (def->shift - 10))
389 def->ind = ps + 10;
390 }
391 }
392 no_indirect:
393
394 /* Cleanup array and print summary */
395 pr_info("MMU: Supported page sizes\n");
396 for (psize = 0; psize < MMU_PAGE_COUNT; ++psize) {
397 struct mmu_psize_def *def = &mmu_psize_defs[psize];
398 const char *__page_type_names[] = {
399 "unsupported",
400 "direct",
401 "indirect",
402 "direct & indirect"
403 };
404 if (def->flags == 0) {
405 def->shift = 0;
406 continue;
407 }
408 pr_info(" %8ld KB as %s\n", 1ul << (def->shift - 10),
409 __page_type_names[def->flags & 0x3]);
410 }
411}
412
413static void setup_mmu_htw(void)
351{ 414{
352 extern unsigned int interrupt_base_book3e; 415 extern unsigned int interrupt_base_book3e;
353 extern unsigned int exc_data_tlb_miss_htw_book3e; 416 extern unsigned int exc_data_tlb_miss_htw_book3e;
354 extern unsigned int exc_instruction_tlb_miss_htw_book3e; 417 extern unsigned int exc_instruction_tlb_miss_htw_book3e;
355 418
356 unsigned int *ibase = &interrupt_base_book3e; 419 unsigned int *ibase = &interrupt_base_book3e;
420
421 /* Check if HW tablewalk is present, and if yes, enable it by:
422 *
423 * - patching the TLB miss handlers to branch to the
424 * one dedicates to it
425 *
426 * - setting the global book3e_htw_enabled
427 */
428 unsigned int tlb0cfg = mfspr(SPRN_TLB0CFG);
429
430 if ((tlb0cfg & TLBnCFG_IND) &&
431 (tlb0cfg & TLBnCFG_PT)) {
432 /* Our exceptions vectors start with a NOP and -then- a branch
433 * to deal with single stepping from userspace which stops on
434 * the second instruction. Thus we need to patch the second
435 * instruction of the exception, not the first one
436 */
437 patch_branch(ibase + (0x1c0 / 4) + 1,
438 (unsigned long)&exc_data_tlb_miss_htw_book3e, 0);
439 patch_branch(ibase + (0x1e0 / 4) + 1,
440 (unsigned long)&exc_instruction_tlb_miss_htw_book3e, 0);
441 book3e_htw_enabled = 1;
442 }
443 pr_info("MMU: Book3E Page Tables %s\n",
444 book3e_htw_enabled ? "Enabled" : "Disabled");
445}
446
447/*
448 * Early initialization of the MMU TLB code
449 */
450static void __early_init_mmu(int boot_cpu)
451{
357 unsigned int mas4; 452 unsigned int mas4;
358 453
359 /* XXX This will have to be decided at runtime, but right 454 /* XXX This will have to be decided at runtime, but right
@@ -370,35 +465,17 @@ static void __early_init_mmu(int boot_cpu)
370 */ 465 */
371 mmu_vmemmap_psize = MMU_PAGE_16M; 466 mmu_vmemmap_psize = MMU_PAGE_16M;
372 467
373 /* Check if HW tablewalk is present, and if yes, enable it by:
374 *
375 * - patching the TLB miss handlers to branch to the
376 * one dedicates to it
377 *
378 * - setting the global book3e_htw_enabled
379 *
380 * - Set MAS4:INDD and default page size
381 */
382
383 /* XXX This code only checks for TLB 0 capabilities and doesn't 468 /* XXX This code only checks for TLB 0 capabilities and doesn't
384 * check what page size combos are supported by the HW. It 469 * check what page size combos are supported by the HW. It
385 * also doesn't handle the case where a separate array holds 470 * also doesn't handle the case where a separate array holds
386 * the IND entries from the array loaded by the PT. 471 * the IND entries from the array loaded by the PT.
387 */ 472 */
388 if (boot_cpu) { 473 if (boot_cpu) {
389 unsigned int tlb0cfg = mfspr(SPRN_TLB0CFG); 474 /* Look for supported page sizes */
475 setup_page_sizes();
390 476
391 /* Check if HW loader is supported */ 477 /* Look for HW tablewalk support */
392 if ((tlb0cfg & TLBnCFG_IND) && 478 setup_mmu_htw();
393 (tlb0cfg & TLBnCFG_PT)) {
394 patch_branch(ibase + (0x1c0 / 4),
395 (unsigned long)&exc_data_tlb_miss_htw_book3e, 0);
396 patch_branch(ibase + (0x1e0 / 4),
397 (unsigned long)&exc_instruction_tlb_miss_htw_book3e, 0);
398 book3e_htw_enabled = 1;
399 }
400 pr_info("MMU: Book3E Page Tables %s\n",
401 book3e_htw_enabled ? "Enabled" : "Disabled");
402 } 479 }
403 480
404 /* Set MAS4 based on page table setting */ 481 /* Set MAS4 based on page table setting */
diff --git a/arch/powerpc/oprofile/Makefile b/arch/powerpc/oprofile/Makefile
index 73e1c2ca0552..e219ca43962d 100644
--- a/arch/powerpc/oprofile/Makefile
+++ b/arch/powerpc/oprofile/Makefile
@@ -16,6 +16,6 @@ oprofile-y := $(DRIVER_OBJS) common.o backtrace.o
16oprofile-$(CONFIG_OPROFILE_CELL) += op_model_cell.o \ 16oprofile-$(CONFIG_OPROFILE_CELL) += op_model_cell.o \
17 cell/spu_profiler.o cell/vma_map.o \ 17 cell/spu_profiler.o cell/vma_map.o \
18 cell/spu_task_sync.o 18 cell/spu_task_sync.o
19oprofile-$(CONFIG_PPC64) += op_model_rs64.o op_model_power4.o op_model_pa6t.o 19oprofile-$(CONFIG_PPC_BOOK3S_64) += op_model_rs64.o op_model_power4.o op_model_pa6t.o
20oprofile-$(CONFIG_FSL_EMB_PERFMON) += op_model_fsl_emb.o 20oprofile-$(CONFIG_FSL_EMB_PERFMON) += op_model_fsl_emb.o
21oprofile-$(CONFIG_6xx) += op_model_7450.o 21oprofile-$(CONFIG_6xx) += op_model_7450.o
diff --git a/arch/powerpc/oprofile/common.c b/arch/powerpc/oprofile/common.c
index 21f16edf6c8d..d65e68f3cb25 100644
--- a/arch/powerpc/oprofile/common.c
+++ b/arch/powerpc/oprofile/common.c
@@ -199,7 +199,7 @@ int __init oprofile_arch_init(struct oprofile_operations *ops)
199 return -ENODEV; 199 return -ENODEV;
200 200
201 switch (cur_cpu_spec->oprofile_type) { 201 switch (cur_cpu_spec->oprofile_type) {
202#ifdef CONFIG_PPC64 202#ifdef CONFIG_PPC_BOOK3S_64
203#ifdef CONFIG_OPROFILE_CELL 203#ifdef CONFIG_OPROFILE_CELL
204 case PPC_OPROFILE_CELL: 204 case PPC_OPROFILE_CELL:
205 if (firmware_has_feature(FW_FEATURE_LPAR)) 205 if (firmware_has_feature(FW_FEATURE_LPAR))
diff --git a/arch/powerpc/platforms/40x/Kconfig b/arch/powerpc/platforms/40x/Kconfig
index ec64264f7a50..b72176434ebe 100644
--- a/arch/powerpc/platforms/40x/Kconfig
+++ b/arch/powerpc/platforms/40x/Kconfig
@@ -71,22 +71,6 @@ config MAKALU
71 help 71 help
72 This option enables support for the AMCC PPC405EX board. 72 This option enables support for the AMCC PPC405EX board.
73 73
74#config REDWOOD_5
75# bool "Redwood-5"
76# depends on 40x
77# default n
78# select STB03xxx
79# help
80# This option enables support for the IBM STB04 evaluation board.
81
82#config REDWOOD_6
83# bool "Redwood-6"
84# depends on 40x
85# default n
86# select STB03xxx
87# help
88# This option enables support for the IBM STBx25xx evaluation board.
89
90#config SYCAMORE 74#config SYCAMORE
91# bool "Sycamore" 75# bool "Sycamore"
92# depends on 40x 76# depends on 40x
diff --git a/arch/powerpc/platforms/512x/Kconfig b/arch/powerpc/platforms/512x/Kconfig
index 4dac9b0525a4..27b0651221d1 100644
--- a/arch/powerpc/platforms/512x/Kconfig
+++ b/arch/powerpc/platforms/512x/Kconfig
@@ -1,32 +1,34 @@
1config PPC_MPC512x 1config PPC_MPC512x
2 bool 2 bool "512x-based boards"
3 depends on 6xx
3 select FSL_SOC 4 select FSL_SOC
4 select IPIC 5 select IPIC
5 select PPC_CLOCK 6 select PPC_CLOCK
6 select PPC_PCI_CHOICE 7 select PPC_PCI_CHOICE
7 select FSL_PCI if PCI 8 select FSL_PCI if PCI
8 9
9config PPC_MPC5121
10 bool
11 select PPC_MPC512x
12
13config MPC5121_ADS 10config MPC5121_ADS
14 bool "Freescale MPC5121E ADS" 11 bool "Freescale MPC5121E ADS"
15 depends on 6xx 12 depends on PPC_MPC512x
16 select DEFAULT_UIMAGE 13 select DEFAULT_UIMAGE
17 select PPC_MPC5121
18 select MPC5121_ADS_CPLD 14 select MPC5121_ADS_CPLD
19 help 15 help
20 This option enables support for the MPC5121E ADS board. 16 This option enables support for the MPC5121E ADS board.
21 17
22config MPC5121_GENERIC 18config MPC5121_GENERIC
23 bool "Generic support for simple MPC5121 based boards" 19 bool "Generic support for simple MPC5121 based boards"
24 depends on 6xx 20 depends on PPC_MPC512x
25 select DEFAULT_UIMAGE 21 select DEFAULT_UIMAGE
26 select PPC_MPC5121
27 help 22 help
28 This option enables support for simple MPC5121 based boards 23 This option enables support for simple MPC5121 based boards
29 which do not need custom platform specific setup. 24 which do not need custom platform specific setup.
30 25
31 Compatible boards include: Protonic LVT base boards (ZANMCU 26 Compatible boards include: Protonic LVT base boards (ZANMCU
32 and VICVT2). 27 and VICVT2).
28
29config PDM360NG
30 bool "ifm PDM360NG board"
31 depends on PPC_MPC512x
32 select DEFAULT_UIMAGE
33 help
34 This option enables support for the PDM360NG board.
diff --git a/arch/powerpc/platforms/512x/Makefile b/arch/powerpc/platforms/512x/Makefile
index 90be2f5717e6..4efc1c4b6fb5 100644
--- a/arch/powerpc/platforms/512x/Makefile
+++ b/arch/powerpc/platforms/512x/Makefile
@@ -4,3 +4,4 @@
4obj-y += clock.o mpc512x_shared.o 4obj-y += clock.o mpc512x_shared.o
5obj-$(CONFIG_MPC5121_ADS) += mpc5121_ads.o mpc5121_ads_cpld.o 5obj-$(CONFIG_MPC5121_ADS) += mpc5121_ads.o mpc5121_ads_cpld.o
6obj-$(CONFIG_MPC5121_GENERIC) += mpc5121_generic.o 6obj-$(CONFIG_MPC5121_GENERIC) += mpc5121_generic.o
7obj-$(CONFIG_PDM360NG) += pdm360ng.o
diff --git a/arch/powerpc/platforms/512x/clock.c b/arch/powerpc/platforms/512x/clock.c
index 4c42246b86a7..5b243bd3eb3b 100644
--- a/arch/powerpc/platforms/512x/clock.c
+++ b/arch/powerpc/platforms/512x/clock.c
@@ -292,6 +292,15 @@ static void diu_clk_calc(struct clk *clk)
292 clk->rate = rate; 292 clk->rate = rate;
293} 293}
294 294
295static void viu_clk_calc(struct clk *clk)
296{
297 unsigned long rate;
298
299 rate = sys_clk.rate;
300 rate /= 2;
301 clk->rate = rate;
302}
303
295static void half_clk_calc(struct clk *clk) 304static void half_clk_calc(struct clk *clk)
296{ 305{
297 clk->rate = clk->parent->rate / 2; 306 clk->rate = clk->parent->rate / 2;
@@ -412,6 +421,14 @@ static struct clk diu_clk = {
412 .calc = diu_clk_calc, 421 .calc = diu_clk_calc,
413}; 422};
414 423
424static struct clk viu_clk = {
425 .name = "viu_clk",
426 .flags = CLK_HAS_CTRL,
427 .reg = 1,
428 .bit = 18,
429 .calc = viu_clk_calc,
430};
431
415static struct clk axe_clk = { 432static struct clk axe_clk = {
416 .name = "axe_clk", 433 .name = "axe_clk",
417 .flags = CLK_HAS_CTRL, 434 .flags = CLK_HAS_CTRL,
@@ -535,6 +552,7 @@ struct clk *rate_clks[] = {
535 &ref_clk, 552 &ref_clk,
536 &sys_clk, 553 &sys_clk,
537 &diu_clk, 554 &diu_clk,
555 &viu_clk,
538 &csb_clk, 556 &csb_clk,
539 &e300_clk, 557 &e300_clk,
540 &ips_clk, 558 &ips_clk,
@@ -660,7 +678,7 @@ static void psc_clks_init(void)
660{ 678{
661 struct device_node *np; 679 struct device_node *np;
662 const u32 *cell_index; 680 const u32 *cell_index;
663 struct of_device *ofdev; 681 struct platform_device *ofdev;
664 682
665 for_each_compatible_node(np, NULL, "fsl,mpc5121-psc") { 683 for_each_compatible_node(np, NULL, "fsl,mpc5121-psc") {
666 cell_index = of_get_property(np, "cell-index", NULL); 684 cell_index = of_get_property(np, "cell-index", NULL);
diff --git a/arch/powerpc/platforms/512x/mpc5121_ads.c b/arch/powerpc/platforms/512x/mpc5121_ads.c
index ee6ae129c25c..dcef6ade48e1 100644
--- a/arch/powerpc/platforms/512x/mpc5121_ads.c
+++ b/arch/powerpc/platforms/512x/mpc5121_ads.c
@@ -42,6 +42,7 @@ static void __init mpc5121_ads_setup_arch(void)
42 for_each_compatible_node(np, "pci", "fsl,mpc5121-pci") 42 for_each_compatible_node(np, "pci", "fsl,mpc5121-pci")
43 mpc83xx_add_bridge(np); 43 mpc83xx_add_bridge(np);
44#endif 44#endif
45 mpc512x_setup_diu();
45} 46}
46 47
47static void __init mpc5121_ads_init_IRQ(void) 48static void __init mpc5121_ads_init_IRQ(void)
@@ -65,6 +66,7 @@ define_machine(mpc5121_ads) {
65 .probe = mpc5121_ads_probe, 66 .probe = mpc5121_ads_probe,
66 .setup_arch = mpc5121_ads_setup_arch, 67 .setup_arch = mpc5121_ads_setup_arch,
67 .init = mpc512x_init, 68 .init = mpc512x_init,
69 .init_early = mpc512x_init_diu,
68 .init_IRQ = mpc5121_ads_init_IRQ, 70 .init_IRQ = mpc5121_ads_init_IRQ,
69 .get_irq = ipic_get_irq, 71 .get_irq = ipic_get_irq,
70 .calibrate_decr = generic_calibrate_decr, 72 .calibrate_decr = generic_calibrate_decr,
diff --git a/arch/powerpc/platforms/512x/mpc5121_generic.c b/arch/powerpc/platforms/512x/mpc5121_generic.c
index a6c0e3a2615d..e487eb06ec6b 100644
--- a/arch/powerpc/platforms/512x/mpc5121_generic.c
+++ b/arch/powerpc/platforms/512x/mpc5121_generic.c
@@ -52,6 +52,8 @@ define_machine(mpc5121_generic) {
52 .name = "MPC5121 generic", 52 .name = "MPC5121 generic",
53 .probe = mpc5121_generic_probe, 53 .probe = mpc5121_generic_probe,
54 .init = mpc512x_init, 54 .init = mpc512x_init,
55 .init_early = mpc512x_init_diu,
56 .setup_arch = mpc512x_setup_diu,
55 .init_IRQ = mpc512x_init_IRQ, 57 .init_IRQ = mpc512x_init_IRQ,
56 .get_irq = ipic_get_irq, 58 .get_irq = ipic_get_irq,
57 .calibrate_decr = generic_calibrate_decr, 59 .calibrate_decr = generic_calibrate_decr,
diff --git a/arch/powerpc/platforms/512x/mpc512x.h b/arch/powerpc/platforms/512x/mpc512x.h
index b2daca0d1488..1ab6d11d0b19 100644
--- a/arch/powerpc/platforms/512x/mpc512x.h
+++ b/arch/powerpc/platforms/512x/mpc512x.h
@@ -16,4 +16,6 @@ extern void __init mpc512x_init(void);
16extern int __init mpc5121_clk_init(void); 16extern int __init mpc5121_clk_init(void);
17void __init mpc512x_declare_of_platform_devices(void); 17void __init mpc512x_declare_of_platform_devices(void);
18extern void mpc512x_restart(char *cmd); 18extern void mpc512x_restart(char *cmd);
19extern void mpc512x_init_diu(void);
20extern void mpc512x_setup_diu(void);
19#endif /* __MPC512X_H__ */ 21#endif /* __MPC512X_H__ */
diff --git a/arch/powerpc/platforms/512x/mpc512x_shared.c b/arch/powerpc/platforms/512x/mpc512x_shared.c
index 707e572b7c40..e41ebbdb3e12 100644
--- a/arch/powerpc/platforms/512x/mpc512x_shared.c
+++ b/arch/powerpc/platforms/512x/mpc512x_shared.c
@@ -16,7 +16,11 @@
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/irq.h> 17#include <linux/irq.h>
18#include <linux/of_platform.h> 18#include <linux/of_platform.h>
19#include <linux/fsl-diu-fb.h>
20#include <linux/bootmem.h>
21#include <sysdev/fsl_soc.h>
19 22
23#include <asm/cacheflush.h>
20#include <asm/machdep.h> 24#include <asm/machdep.h>
21#include <asm/ipic.h> 25#include <asm/ipic.h>
22#include <asm/prom.h> 26#include <asm/prom.h>
@@ -54,6 +58,286 @@ void mpc512x_restart(char *cmd)
54 ; 58 ;
55} 59}
56 60
61struct fsl_diu_shared_fb {
62 u8 gamma[0x300]; /* 32-bit aligned! */
63 struct diu_ad ad0; /* 32-bit aligned! */
64 phys_addr_t fb_phys;
65 size_t fb_len;
66 bool in_use;
67};
68
69unsigned int mpc512x_get_pixel_format(unsigned int bits_per_pixel,
70 int monitor_port)
71{
72 switch (bits_per_pixel) {
73 case 32:
74 return 0x88883316;
75 case 24:
76 return 0x88082219;
77 case 16:
78 return 0x65053118;
79 }
80 return 0x00000400;
81}
82
83void mpc512x_set_gamma_table(int monitor_port, char *gamma_table_base)
84{
85}
86
87void mpc512x_set_monitor_port(int monitor_port)
88{
89}
90
91#define DIU_DIV_MASK 0x000000ff
92void mpc512x_set_pixel_clock(unsigned int pixclock)
93{
94 unsigned long bestval, bestfreq, speed, busfreq;
95 unsigned long minpixclock, maxpixclock, pixval;
96 struct mpc512x_ccm __iomem *ccm;
97 struct device_node *np;
98 u32 temp;
99 long err;
100 int i;
101
102 np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-clock");
103 if (!np) {
104 pr_err("Can't find clock control module.\n");
105 return;
106 }
107
108 ccm = of_iomap(np, 0);
109 of_node_put(np);
110 if (!ccm) {
111 pr_err("Can't map clock control module reg.\n");
112 return;
113 }
114
115 np = of_find_node_by_type(NULL, "cpu");
116 if (np) {
117 const unsigned int *prop =
118 of_get_property(np, "bus-frequency", NULL);
119
120 of_node_put(np);
121 if (prop) {
122 busfreq = *prop;
123 } else {
124 pr_err("Can't get bus-frequency property\n");
125 return;
126 }
127 } else {
128 pr_err("Can't find 'cpu' node.\n");
129 return;
130 }
131
132 /* Pixel Clock configuration */
133 pr_debug("DIU: Bus Frequency = %lu\n", busfreq);
134 speed = busfreq * 4; /* DIU_DIV ratio is 4 * CSB_CLK / DIU_CLK */
135
136 /* Calculate the pixel clock with the smallest error */
137 /* calculate the following in steps to avoid overflow */
138 pr_debug("DIU pixclock in ps - %d\n", pixclock);
139 temp = (1000000000 / pixclock) * 1000;
140 pixclock = temp;
141 pr_debug("DIU pixclock freq - %u\n", pixclock);
142
143 temp = temp / 20; /* pixclock * 0.05 */
144 pr_debug("deviation = %d\n", temp);
145 minpixclock = pixclock - temp;
146 maxpixclock = pixclock + temp;
147 pr_debug("DIU minpixclock - %lu\n", minpixclock);
148 pr_debug("DIU maxpixclock - %lu\n", maxpixclock);
149 pixval = speed/pixclock;
150 pr_debug("DIU pixval = %lu\n", pixval);
151
152 err = LONG_MAX;
153 bestval = pixval;
154 pr_debug("DIU bestval = %lu\n", bestval);
155
156 bestfreq = 0;
157 for (i = -1; i <= 1; i++) {
158 temp = speed / (pixval+i);
159 pr_debug("DIU test pixval i=%d, pixval=%lu, temp freq. = %u\n",
160 i, pixval, temp);
161 if ((temp < minpixclock) || (temp > maxpixclock))
162 pr_debug("DIU exceeds monitor range (%lu to %lu)\n",
163 minpixclock, maxpixclock);
164 else if (abs(temp - pixclock) < err) {
165 pr_debug("Entered the else if block %d\n", i);
166 err = abs(temp - pixclock);
167 bestval = pixval + i;
168 bestfreq = temp;
169 }
170 }
171
172 pr_debug("DIU chose = %lx\n", bestval);
173 pr_debug("DIU error = %ld\n NomPixClk ", err);
174 pr_debug("DIU: Best Freq = %lx\n", bestfreq);
175 /* Modify DIU_DIV in CCM SCFR1 */
176 temp = in_be32(&ccm->scfr1);
177 pr_debug("DIU: Current value of SCFR1: 0x%08x\n", temp);
178 temp &= ~DIU_DIV_MASK;
179 temp |= (bestval & DIU_DIV_MASK);
180 out_be32(&ccm->scfr1, temp);
181 pr_debug("DIU: Modified value of SCFR1: 0x%08x\n", temp);
182 iounmap(ccm);
183}
184
185ssize_t mpc512x_show_monitor_port(int monitor_port, char *buf)
186{
187 return sprintf(buf, "0 - 5121 LCD\n");
188}
189
190int mpc512x_set_sysfs_monitor_port(int val)
191{
192 return 0;
193}
194
195static struct fsl_diu_shared_fb __attribute__ ((__aligned__(8))) diu_shared_fb;
196
197#if defined(CONFIG_FB_FSL_DIU) || \
198 defined(CONFIG_FB_FSL_DIU_MODULE)
199static inline void mpc512x_free_bootmem(struct page *page)
200{
201 __ClearPageReserved(page);
202 BUG_ON(PageTail(page));
203 BUG_ON(atomic_read(&page->_count) > 1);
204 atomic_set(&page->_count, 1);
205 __free_page(page);
206 totalram_pages++;
207}
208
209void mpc512x_release_bootmem(void)
210{
211 unsigned long addr = diu_shared_fb.fb_phys & PAGE_MASK;
212 unsigned long size = diu_shared_fb.fb_len;
213 unsigned long start, end;
214
215 if (diu_shared_fb.in_use) {
216 start = PFN_UP(addr);
217 end = PFN_DOWN(addr + size);
218
219 for (; start < end; start++)
220 mpc512x_free_bootmem(pfn_to_page(start));
221
222 diu_shared_fb.in_use = false;
223 }
224 diu_ops.release_bootmem = NULL;
225}
226#endif
227
228/*
229 * Check if DIU was pre-initialized. If so, perform steps
230 * needed to continue displaying through the whole boot process.
231 * Move area descriptor and gamma table elsewhere, they are
232 * destroyed by bootmem allocator otherwise. The frame buffer
233 * address range will be reserved in setup_arch() after bootmem
234 * allocator is up.
235 */
236void __init mpc512x_init_diu(void)
237{
238 struct device_node *np;
239 struct diu __iomem *diu_reg;
240 phys_addr_t desc;
241 void __iomem *vaddr;
242 unsigned long mode, pix_fmt, res, bpp;
243 unsigned long dst;
244
245 np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-diu");
246 if (!np) {
247 pr_err("No DIU node\n");
248 return;
249 }
250
251 diu_reg = of_iomap(np, 0);
252 of_node_put(np);
253 if (!diu_reg) {
254 pr_err("Can't map DIU\n");
255 return;
256 }
257
258 mode = in_be32(&diu_reg->diu_mode);
259 if (mode != MFB_MODE1) {
260 pr_info("%s: DIU OFF\n", __func__);
261 goto out;
262 }
263
264 desc = in_be32(&diu_reg->desc[0]);
265 vaddr = ioremap(desc, sizeof(struct diu_ad));
266 if (!vaddr) {
267 pr_err("Can't map DIU area desc.\n");
268 goto out;
269 }
270 memcpy(&diu_shared_fb.ad0, vaddr, sizeof(struct diu_ad));
271 /* flush fb area descriptor */
272 dst = (unsigned long)&diu_shared_fb.ad0;
273 flush_dcache_range(dst, dst + sizeof(struct diu_ad) - 1);
274
275 res = in_be32(&diu_reg->disp_size);
276 pix_fmt = in_le32(vaddr);
277 bpp = ((pix_fmt >> 16) & 0x3) + 1;
278 diu_shared_fb.fb_phys = in_le32(vaddr + 4);
279 diu_shared_fb.fb_len = ((res & 0xfff0000) >> 16) * (res & 0xfff) * bpp;
280 diu_shared_fb.in_use = true;
281 iounmap(vaddr);
282
283 desc = in_be32(&diu_reg->gamma);
284 vaddr = ioremap(desc, sizeof(diu_shared_fb.gamma));
285 if (!vaddr) {
286 pr_err("Can't map DIU area desc.\n");
287 diu_shared_fb.in_use = false;
288 goto out;
289 }
290 memcpy(&diu_shared_fb.gamma, vaddr, sizeof(diu_shared_fb.gamma));
291 /* flush gamma table */
292 dst = (unsigned long)&diu_shared_fb.gamma;
293 flush_dcache_range(dst, dst + sizeof(diu_shared_fb.gamma) - 1);
294
295 iounmap(vaddr);
296 out_be32(&diu_reg->gamma, virt_to_phys(&diu_shared_fb.gamma));
297 out_be32(&diu_reg->desc[1], 0);
298 out_be32(&diu_reg->desc[2], 0);
299 out_be32(&diu_reg->desc[0], virt_to_phys(&diu_shared_fb.ad0));
300
301out:
302 iounmap(diu_reg);
303}
304
305void __init mpc512x_setup_diu(void)
306{
307 int ret;
308
309 /*
310 * We do not allocate and configure new area for bitmap buffer
311 * because it would requere copying bitmap data (splash image)
312 * and so negatively affect boot time. Instead we reserve the
313 * already configured frame buffer area so that it won't be
314 * destroyed. The starting address of the area to reserve and
315 * also it's length is passed to reserve_bootmem(). It will be
316 * freed later on first open of fbdev, when splash image is not
317 * needed any more.
318 */
319 if (diu_shared_fb.in_use) {
320 ret = reserve_bootmem(diu_shared_fb.fb_phys,
321 diu_shared_fb.fb_len,
322 BOOTMEM_EXCLUSIVE);
323 if (ret) {
324 pr_err("%s: reserve bootmem failed\n", __func__);
325 diu_shared_fb.in_use = false;
326 }
327 }
328
329#if defined(CONFIG_FB_FSL_DIU) || \
330 defined(CONFIG_FB_FSL_DIU_MODULE)
331 diu_ops.get_pixel_format = mpc512x_get_pixel_format;
332 diu_ops.set_gamma_table = mpc512x_set_gamma_table;
333 diu_ops.set_monitor_port = mpc512x_set_monitor_port;
334 diu_ops.set_pixel_clock = mpc512x_set_pixel_clock;
335 diu_ops.show_monitor_port = mpc512x_show_monitor_port;
336 diu_ops.set_sysfs_monitor_port = mpc512x_set_sysfs_monitor_port;
337 diu_ops.release_bootmem = mpc512x_release_bootmem;
338#endif
339}
340
57void __init mpc512x_init_IRQ(void) 341void __init mpc512x_init_IRQ(void)
58{ 342{
59 struct device_node *np; 343 struct device_node *np;
diff --git a/arch/powerpc/platforms/512x/pdm360ng.c b/arch/powerpc/platforms/512x/pdm360ng.c
new file mode 100644
index 000000000000..0575e858291c
--- /dev/null
+++ b/arch/powerpc/platforms/512x/pdm360ng.c
@@ -0,0 +1,129 @@
1/*
2 * Copyright (C) 2010 DENX Software Engineering
3 *
4 * Anatolij Gustschin, <agust@denx.de>
5 *
6 * PDM360NG board setup
7 *
8 * This is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 */
14
15#include <linux/kernel.h>
16#include <linux/io.h>
17#include <linux/of_platform.h>
18
19#include <asm/machdep.h>
20#include <asm/ipic.h>
21
22#include "mpc512x.h"
23
24#if defined(CONFIG_TOUCHSCREEN_ADS7846) || \
25 defined(CONFIG_TOUCHSCREEN_ADS7846_MODULE)
26#include <linux/interrupt.h>
27#include <linux/spi/ads7846.h>
28#include <linux/spi/spi.h>
29#include <linux/notifier.h>
30
31static void *pdm360ng_gpio_base;
32
33static int pdm360ng_get_pendown_state(void)
34{
35 u32 reg;
36
37 reg = in_be32(pdm360ng_gpio_base + 0xc);
38 if (reg & 0x40)
39 setbits32(pdm360ng_gpio_base + 0xc, 0x40);
40
41 reg = in_be32(pdm360ng_gpio_base + 0x8);
42
43 /* return 1 if pen is down */
44 return (reg & 0x40) == 0;
45}
46
47static struct ads7846_platform_data pdm360ng_ads7846_pdata = {
48 .model = 7845,
49 .get_pendown_state = pdm360ng_get_pendown_state,
50 .irq_flags = IRQF_TRIGGER_LOW,
51};
52
53static int __init pdm360ng_penirq_init(void)
54{
55 struct device_node *np;
56
57 np = of_find_compatible_node(NULL, NULL, "fsl,mpc5121-gpio");
58 if (!np) {
59 pr_err("%s: Can't find 'mpc5121-gpio' node\n", __func__);
60 return -ENODEV;
61 }
62
63 pdm360ng_gpio_base = of_iomap(np, 0);
64 of_node_put(np);
65 if (!pdm360ng_gpio_base) {
66 pr_err("%s: Can't map gpio regs.\n", __func__);
67 return -ENODEV;
68 }
69 out_be32(pdm360ng_gpio_base + 0xc, 0xffffffff);
70 setbits32(pdm360ng_gpio_base + 0x18, 0x2000);
71 setbits32(pdm360ng_gpio_base + 0x10, 0x40);
72
73 return 0;
74}
75
76static int pdm360ng_touchscreen_notifier_call(struct notifier_block *nb,
77 unsigned long event, void *__dev)
78{
79 struct device *dev = __dev;
80
81 if ((event == BUS_NOTIFY_ADD_DEVICE) &&
82 of_device_is_compatible(dev->of_node, "ti,ads7846")) {
83 dev->platform_data = &pdm360ng_ads7846_pdata;
84 return NOTIFY_OK;
85 }
86 return NOTIFY_DONE;
87}
88
89static struct notifier_block pdm360ng_touchscreen_nb = {
90 .notifier_call = pdm360ng_touchscreen_notifier_call,
91};
92
93static void __init pdm360ng_touchscreen_init(void)
94{
95 if (pdm360ng_penirq_init())
96 return;
97
98 bus_register_notifier(&spi_bus_type, &pdm360ng_touchscreen_nb);
99}
100#else
101static inline void __init pdm360ng_touchscreen_init(void)
102{
103}
104#endif /* CONFIG_TOUCHSCREEN_ADS7846 */
105
106void __init pdm360ng_init(void)
107{
108 mpc512x_init();
109 pdm360ng_touchscreen_init();
110}
111
112static int __init pdm360ng_probe(void)
113{
114 unsigned long root = of_get_flat_dt_root();
115
116 return of_flat_dt_is_compatible(root, "ifm,pdm360ng");
117}
118
119define_machine(pdm360ng) {
120 .name = "PDM360NG",
121 .probe = pdm360ng_probe,
122 .setup_arch = mpc512x_setup_diu,
123 .init = pdm360ng_init,
124 .init_early = mpc512x_init_diu,
125 .init_IRQ = mpc512x_init_IRQ,
126 .get_irq = ipic_get_irq,
127 .calibrate_decr = generic_calibrate_decr,
128 .restart = mpc512x_restart,
129};
diff --git a/arch/powerpc/platforms/52xx/lite5200.c b/arch/powerpc/platforms/52xx/lite5200.c
index 6d584f4e3c9a..de55bc0584b5 100644
--- a/arch/powerpc/platforms/52xx/lite5200.c
+++ b/arch/powerpc/platforms/52xx/lite5200.c
@@ -18,6 +18,7 @@
18#include <linux/init.h> 18#include <linux/init.h>
19#include <linux/pci.h> 19#include <linux/pci.h>
20#include <linux/of.h> 20#include <linux/of.h>
21#include <linux/of_address.h>
21#include <linux/root_dev.h> 22#include <linux/root_dev.h>
22#include <linux/initrd.h> 23#include <linux/initrd.h>
23#include <asm/time.h> 24#include <asm/time.h>
diff --git a/arch/powerpc/platforms/52xx/lite5200_pm.c b/arch/powerpc/platforms/52xx/lite5200_pm.c
index b5c753db125e..80234e5921f5 100644
--- a/arch/powerpc/platforms/52xx/lite5200_pm.c
+++ b/arch/powerpc/platforms/52xx/lite5200_pm.c
@@ -216,9 +216,6 @@ static int lite5200_pm_enter(suspend_state_t state)
216 216
217 lite5200_restore_regs(); 217 lite5200_restore_regs();
218 218
219 /* restart jiffies */
220 wakeup_decrementer();
221
222 iounmap(mbar); 219 iounmap(mbar);
223 return 0; 220 return 0;
224} 221}
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpio.c b/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
index ca5305a5bd61..0dad9a935eb5 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_gpio.c
@@ -147,26 +147,25 @@ mpc52xx_wkup_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
147 return 0; 147 return 0;
148} 148}
149 149
150static int __devinit mpc52xx_wkup_gpiochip_probe(struct of_device *ofdev, 150static int __devinit mpc52xx_wkup_gpiochip_probe(struct platform_device *ofdev,
151 const struct of_device_id *match) 151 const struct of_device_id *match)
152{ 152{
153 struct mpc52xx_gpiochip *chip; 153 struct mpc52xx_gpiochip *chip;
154 struct mpc52xx_gpio_wkup __iomem *regs; 154 struct mpc52xx_gpio_wkup __iomem *regs;
155 struct of_gpio_chip *ofchip; 155 struct gpio_chip *gc;
156 int ret; 156 int ret;
157 157
158 chip = kzalloc(sizeof(*chip), GFP_KERNEL); 158 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
159 if (!chip) 159 if (!chip)
160 return -ENOMEM; 160 return -ENOMEM;
161 161
162 ofchip = &chip->mmchip.of_gc; 162 gc = &chip->mmchip.gc;
163 163
164 ofchip->gpio_cells = 2; 164 gc->ngpio = 8;
165 ofchip->gc.ngpio = 8; 165 gc->direction_input = mpc52xx_wkup_gpio_dir_in;
166 ofchip->gc.direction_input = mpc52xx_wkup_gpio_dir_in; 166 gc->direction_output = mpc52xx_wkup_gpio_dir_out;
167 ofchip->gc.direction_output = mpc52xx_wkup_gpio_dir_out; 167 gc->get = mpc52xx_wkup_gpio_get;
168 ofchip->gc.get = mpc52xx_wkup_gpio_get; 168 gc->set = mpc52xx_wkup_gpio_set;
169 ofchip->gc.set = mpc52xx_wkup_gpio_set;
170 169
171 ret = of_mm_gpiochip_add(ofdev->dev.of_node, &chip->mmchip); 170 ret = of_mm_gpiochip_add(ofdev->dev.of_node, &chip->mmchip);
172 if (ret) 171 if (ret)
@@ -180,7 +179,7 @@ static int __devinit mpc52xx_wkup_gpiochip_probe(struct of_device *ofdev,
180 return 0; 179 return 0;
181} 180}
182 181
183static int mpc52xx_gpiochip_remove(struct of_device *ofdev) 182static int mpc52xx_gpiochip_remove(struct platform_device *ofdev)
184{ 183{
185 return -EBUSY; 184 return -EBUSY;
186} 185}
@@ -311,11 +310,11 @@ mpc52xx_simple_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
311 return 0; 310 return 0;
312} 311}
313 312
314static int __devinit mpc52xx_simple_gpiochip_probe(struct of_device *ofdev, 313static int __devinit mpc52xx_simple_gpiochip_probe(struct platform_device *ofdev,
315 const struct of_device_id *match) 314 const struct of_device_id *match)
316{ 315{
317 struct mpc52xx_gpiochip *chip; 316 struct mpc52xx_gpiochip *chip;
318 struct of_gpio_chip *ofchip; 317 struct gpio_chip *gc;
319 struct mpc52xx_gpio __iomem *regs; 318 struct mpc52xx_gpio __iomem *regs;
320 int ret; 319 int ret;
321 320
@@ -323,14 +322,13 @@ static int __devinit mpc52xx_simple_gpiochip_probe(struct of_device *ofdev,
323 if (!chip) 322 if (!chip)
324 return -ENOMEM; 323 return -ENOMEM;
325 324
326 ofchip = &chip->mmchip.of_gc; 325 gc = &chip->mmchip.gc;
327 326
328 ofchip->gpio_cells = 2; 327 gc->ngpio = 32;
329 ofchip->gc.ngpio = 32; 328 gc->direction_input = mpc52xx_simple_gpio_dir_in;
330 ofchip->gc.direction_input = mpc52xx_simple_gpio_dir_in; 329 gc->direction_output = mpc52xx_simple_gpio_dir_out;
331 ofchip->gc.direction_output = mpc52xx_simple_gpio_dir_out; 330 gc->get = mpc52xx_simple_gpio_get;
332 ofchip->gc.get = mpc52xx_simple_gpio_get; 331 gc->set = mpc52xx_simple_gpio_set;
333 ofchip->gc.set = mpc52xx_simple_gpio_set;
334 332
335 ret = of_mm_gpiochip_add(ofdev->dev.of_node, &chip->mmchip); 333 ret = of_mm_gpiochip_add(ofdev->dev.of_node, &chip->mmchip);
336 if (ret) 334 if (ret)
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
index 46c93578cbf0..fea833e18ad5 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_gpt.c
@@ -78,7 +78,7 @@ MODULE_LICENSE("GPL");
78 * @dev: pointer to device structure 78 * @dev: pointer to device structure
79 * @regs: virtual address of GPT registers 79 * @regs: virtual address of GPT registers
80 * @lock: spinlock to coordinate between different functions. 80 * @lock: spinlock to coordinate between different functions.
81 * @of_gc: of_gpio_chip instance structure; used when GPIO is enabled 81 * @gc: gpio_chip instance structure; used when GPIO is enabled
82 * @irqhost: Pointer to irq_host instance; used when IRQ mode is supported 82 * @irqhost: Pointer to irq_host instance; used when IRQ mode is supported
83 * @wdt_mode: only relevant for gpt0: bit 0 (MPC52xx_GPT_CAN_WDT) indicates 83 * @wdt_mode: only relevant for gpt0: bit 0 (MPC52xx_GPT_CAN_WDT) indicates
84 * if the gpt may be used as wdt, bit 1 (MPC52xx_GPT_IS_WDT) indicates 84 * if the gpt may be used as wdt, bit 1 (MPC52xx_GPT_IS_WDT) indicates
@@ -94,7 +94,7 @@ struct mpc52xx_gpt_priv {
94 u8 wdt_mode; 94 u8 wdt_mode;
95 95
96#if defined(CONFIG_GPIOLIB) 96#if defined(CONFIG_GPIOLIB)
97 struct of_gpio_chip of_gc; 97 struct gpio_chip gc;
98#endif 98#endif
99}; 99};
100 100
@@ -280,7 +280,7 @@ mpc52xx_gpt_irq_setup(struct mpc52xx_gpt_priv *gpt, struct device_node *node)
280#if defined(CONFIG_GPIOLIB) 280#if defined(CONFIG_GPIOLIB)
281static inline struct mpc52xx_gpt_priv *gc_to_mpc52xx_gpt(struct gpio_chip *gc) 281static inline struct mpc52xx_gpt_priv *gc_to_mpc52xx_gpt(struct gpio_chip *gc)
282{ 282{
283 return container_of(to_of_gpio_chip(gc), struct mpc52xx_gpt_priv,of_gc); 283 return container_of(gc, struct mpc52xx_gpt_priv, gc);
284} 284}
285 285
286static int mpc52xx_gpt_gpio_get(struct gpio_chip *gc, unsigned int gpio) 286static int mpc52xx_gpt_gpio_get(struct gpio_chip *gc, unsigned int gpio)
@@ -336,28 +336,25 @@ mpc52xx_gpt_gpio_setup(struct mpc52xx_gpt_priv *gpt, struct device_node *node)
336 if (!of_find_property(node, "gpio-controller", NULL)) 336 if (!of_find_property(node, "gpio-controller", NULL))
337 return; 337 return;
338 338
339 gpt->of_gc.gc.label = kstrdup(node->full_name, GFP_KERNEL); 339 gpt->gc.label = kstrdup(node->full_name, GFP_KERNEL);
340 if (!gpt->of_gc.gc.label) { 340 if (!gpt->gc.label) {
341 dev_err(gpt->dev, "out of memory\n"); 341 dev_err(gpt->dev, "out of memory\n");
342 return; 342 return;
343 } 343 }
344 344
345 gpt->of_gc.gpio_cells = 2; 345 gpt->gc.ngpio = 1;
346 gpt->of_gc.gc.ngpio = 1; 346 gpt->gc.direction_input = mpc52xx_gpt_gpio_dir_in;
347 gpt->of_gc.gc.direction_input = mpc52xx_gpt_gpio_dir_in; 347 gpt->gc.direction_output = mpc52xx_gpt_gpio_dir_out;
348 gpt->of_gc.gc.direction_output = mpc52xx_gpt_gpio_dir_out; 348 gpt->gc.get = mpc52xx_gpt_gpio_get;
349 gpt->of_gc.gc.get = mpc52xx_gpt_gpio_get; 349 gpt->gc.set = mpc52xx_gpt_gpio_set;
350 gpt->of_gc.gc.set = mpc52xx_gpt_gpio_set; 350 gpt->gc.base = -1;
351 gpt->of_gc.gc.base = -1; 351 gpt->gc.of_node = node;
352 gpt->of_gc.xlate = of_gpio_simple_xlate;
353 node->data = &gpt->of_gc;
354 of_node_get(node);
355 352
356 /* Setup external pin in GPIO mode */ 353 /* Setup external pin in GPIO mode */
357 clrsetbits_be32(&gpt->regs->mode, MPC52xx_GPT_MODE_MS_MASK, 354 clrsetbits_be32(&gpt->regs->mode, MPC52xx_GPT_MODE_MS_MASK,
358 MPC52xx_GPT_MODE_MS_GPIO); 355 MPC52xx_GPT_MODE_MS_GPIO);
359 356
360 rc = gpiochip_add(&gpt->of_gc.gc); 357 rc = gpiochip_add(&gpt->gc);
361 if (rc) 358 if (rc)
362 dev_err(gpt->dev, "gpiochip_add() failed; rc=%i\n", rc); 359 dev_err(gpt->dev, "gpiochip_add() failed; rc=%i\n", rc);
363 360
@@ -723,7 +720,7 @@ static inline int mpc52xx_gpt_wdt_setup(struct mpc52xx_gpt_priv *gpt,
723/* --------------------------------------------------------------------- 720/* ---------------------------------------------------------------------
724 * of_platform bus binding code 721 * of_platform bus binding code
725 */ 722 */
726static int __devinit mpc52xx_gpt_probe(struct of_device *ofdev, 723static int __devinit mpc52xx_gpt_probe(struct platform_device *ofdev,
727 const struct of_device_id *match) 724 const struct of_device_id *match)
728{ 725{
729 struct mpc52xx_gpt_priv *gpt; 726 struct mpc52xx_gpt_priv *gpt;
@@ -769,7 +766,7 @@ static int __devinit mpc52xx_gpt_probe(struct of_device *ofdev,
769 return 0; 766 return 0;
770} 767}
771 768
772static int mpc52xx_gpt_remove(struct of_device *ofdev) 769static int mpc52xx_gpt_remove(struct platform_device *ofdev)
773{ 770{
774 return -EBUSY; 771 return -EBUSY;
775} 772}
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
index e86aec644501..f4ac213c89c0 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_lpbfifo.c
@@ -436,8 +436,8 @@ void mpc52xx_lpbfifo_abort(struct mpc52xx_lpbfifo_request *req)
436} 436}
437EXPORT_SYMBOL(mpc52xx_lpbfifo_abort); 437EXPORT_SYMBOL(mpc52xx_lpbfifo_abort);
438 438
439static int __devinit 439static int __devinit mpc52xx_lpbfifo_probe(struct platform_device *op,
440mpc52xx_lpbfifo_probe(struct of_device *op, const struct of_device_id *match) 440 const struct of_device_id *match)
441{ 441{
442 struct resource res; 442 struct resource res;
443 int rc = -ENOMEM; 443 int rc = -ENOMEM;
@@ -507,7 +507,7 @@ mpc52xx_lpbfifo_probe(struct of_device *op, const struct of_device_id *match)
507} 507}
508 508
509 509
510static int __devexit mpc52xx_lpbfifo_remove(struct of_device *op) 510static int __devexit mpc52xx_lpbfifo_remove(struct platform_device *op)
511{ 511{
512 if (lpbfifo.dev != &op->dev) 512 if (lpbfifo.dev != &op->dev)
513 return 0; 513 return 0;
diff --git a/arch/powerpc/platforms/52xx/mpc52xx_pm.c b/arch/powerpc/platforms/52xx/mpc52xx_pm.c
index 76722532bd95..568cef636275 100644
--- a/arch/powerpc/platforms/52xx/mpc52xx_pm.c
+++ b/arch/powerpc/platforms/52xx/mpc52xx_pm.c
@@ -171,9 +171,6 @@ int mpc52xx_pm_enter(suspend_state_t state)
171 /* restore SRAM */ 171 /* restore SRAM */
172 memcpy(sram, saved_sram, sram_size); 172 memcpy(sram, saved_sram, sram_size);
173 173
174 /* restart jiffies */
175 wakeup_decrementer();
176
177 /* reenable interrupts in PIC */ 174 /* reenable interrupts in PIC */
178 out_be32(&intr->main_mask, intr_main_mask); 175 out_be32(&intr->main_mask, intr_main_mask);
179 176
diff --git a/arch/powerpc/platforms/82xx/ep8248e.c b/arch/powerpc/platforms/82xx/ep8248e.c
index 9f2e52b36f91..1565e0446dc8 100644
--- a/arch/powerpc/platforms/82xx/ep8248e.c
+++ b/arch/powerpc/platforms/82xx/ep8248e.c
@@ -111,7 +111,7 @@ static struct mdiobb_ctrl ep8248e_mdio_ctrl = {
111 .ops = &ep8248e_mdio_ops, 111 .ops = &ep8248e_mdio_ops,
112}; 112};
113 113
114static int __devinit ep8248e_mdio_probe(struct of_device *ofdev, 114static int __devinit ep8248e_mdio_probe(struct platform_device *ofdev,
115 const struct of_device_id *match) 115 const struct of_device_id *match)
116{ 116{
117 struct mii_bus *bus; 117 struct mii_bus *bus;
@@ -154,7 +154,7 @@ err_free_bus:
154 return ret; 154 return ret;
155} 155}
156 156
157static int ep8248e_mdio_remove(struct of_device *ofdev) 157static int ep8248e_mdio_remove(struct platform_device *ofdev)
158{ 158{
159 BUG(); 159 BUG();
160 return 0; 160 return 0;
diff --git a/arch/powerpc/platforms/83xx/Kconfig b/arch/powerpc/platforms/83xx/Kconfig
index f49a2548c5ff..021763a32c2f 100644
--- a/arch/powerpc/platforms/83xx/Kconfig
+++ b/arch/powerpc/platforms/83xx/Kconfig
@@ -9,6 +9,14 @@ menuconfig PPC_83xx
9 9
10if PPC_83xx 10if PPC_83xx
11 11
12config MPC830x_RDB
13 bool "Freescale MPC830x RDB"
14 select DEFAULT_UIMAGE
15 select PPC_MPC831x
16 select FSL_GTM
17 help
18 This option enables support for the MPC8308 RDB board.
19
12config MPC831x_RDB 20config MPC831x_RDB
13 bool "Freescale MPC831x RDB" 21 bool "Freescale MPC831x RDB"
14 select DEFAULT_UIMAGE 22 select DEFAULT_UIMAGE
diff --git a/arch/powerpc/platforms/83xx/Makefile b/arch/powerpc/platforms/83xx/Makefile
index e139c36572ec..6e8bbbbcfdf8 100644
--- a/arch/powerpc/platforms/83xx/Makefile
+++ b/arch/powerpc/platforms/83xx/Makefile
@@ -4,6 +4,7 @@
4obj-y := misc.o usb.o 4obj-y := misc.o usb.o
5obj-$(CONFIG_SUSPEND) += suspend.o suspend-asm.o 5obj-$(CONFIG_SUSPEND) += suspend.o suspend-asm.o
6obj-$(CONFIG_MCU_MPC8349EMITX) += mcu_mpc8349emitx.o 6obj-$(CONFIG_MCU_MPC8349EMITX) += mcu_mpc8349emitx.o
7obj-$(CONFIG_MPC830x_RDB) += mpc830x_rdb.o
7obj-$(CONFIG_MPC831x_RDB) += mpc831x_rdb.o 8obj-$(CONFIG_MPC831x_RDB) += mpc831x_rdb.o
8obj-$(CONFIG_MPC832x_RDB) += mpc832x_rdb.o 9obj-$(CONFIG_MPC832x_RDB) += mpc832x_rdb.o
9obj-$(CONFIG_MPC834x_MDS) += mpc834x_mds.o 10obj-$(CONFIG_MPC834x_MDS) += mpc834x_mds.o
diff --git a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
index d119a7c1c17a..70798ac911ef 100644
--- a/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
+++ b/arch/powerpc/platforms/83xx/mcu_mpc8349emitx.c
@@ -35,9 +35,8 @@
35 35
36struct mcu { 36struct mcu {
37 struct mutex lock; 37 struct mutex lock;
38 struct device_node *np;
39 struct i2c_client *client; 38 struct i2c_client *client;
40 struct of_gpio_chip of_gc; 39 struct gpio_chip gc;
41 u8 reg_ctrl; 40 u8 reg_ctrl;
42}; 41};
43 42
@@ -56,8 +55,7 @@ static void mcu_power_off(void)
56 55
57static void mcu_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val) 56static void mcu_gpio_set(struct gpio_chip *gc, unsigned int gpio, int val)
58{ 57{
59 struct of_gpio_chip *of_gc = to_of_gpio_chip(gc); 58 struct mcu *mcu = container_of(gc, struct mcu, gc);
60 struct mcu *mcu = container_of(of_gc, struct mcu, of_gc);
61 u8 bit = 1 << (4 + gpio); 59 u8 bit = 1 << (4 + gpio);
62 60
63 mutex_lock(&mcu->lock); 61 mutex_lock(&mcu->lock);
@@ -79,9 +77,7 @@ static int mcu_gpio_dir_out(struct gpio_chip *gc, unsigned int gpio, int val)
79static int mcu_gpiochip_add(struct mcu *mcu) 77static int mcu_gpiochip_add(struct mcu *mcu)
80{ 78{
81 struct device_node *np; 79 struct device_node *np;
82 struct of_gpio_chip *of_gc = &mcu->of_gc; 80 struct gpio_chip *gc = &mcu->gc;
83 struct gpio_chip *gc = &of_gc->gc;
84 int ret;
85 81
86 np = of_find_compatible_node(NULL, NULL, "fsl,mcu-mpc8349emitx"); 82 np = of_find_compatible_node(NULL, NULL, "fsl,mcu-mpc8349emitx");
87 if (!np) 83 if (!np)
@@ -94,32 +90,14 @@ static int mcu_gpiochip_add(struct mcu *mcu)
94 gc->base = -1; 90 gc->base = -1;
95 gc->set = mcu_gpio_set; 91 gc->set = mcu_gpio_set;
96 gc->direction_output = mcu_gpio_dir_out; 92 gc->direction_output = mcu_gpio_dir_out;
97 of_gc->gpio_cells = 2; 93 gc->of_node = np;
98 of_gc->xlate = of_gpio_simple_xlate;
99 94
100 np->data = of_gc; 95 return gpiochip_add(gc);
101 mcu->np = np;
102
103 /*
104 * We don't want to lose the node, its ->data and ->full_name...
105 * So, if succeeded, we don't put the node here.
106 */
107 ret = gpiochip_add(gc);
108 if (ret)
109 of_node_put(np);
110 return ret;
111} 96}
112 97
113static int mcu_gpiochip_remove(struct mcu *mcu) 98static int mcu_gpiochip_remove(struct mcu *mcu)
114{ 99{
115 int ret; 100 return gpiochip_remove(&mcu->gc);
116
117 ret = gpiochip_remove(&mcu->of_gc.gc);
118 if (ret)
119 return ret;
120 of_node_put(mcu->np);
121
122 return 0;
123} 101}
124 102
125static int __devinit mcu_probe(struct i2c_client *client, 103static int __devinit mcu_probe(struct i2c_client *client,
@@ -182,10 +160,16 @@ static const struct i2c_device_id mcu_ids[] = {
182}; 160};
183MODULE_DEVICE_TABLE(i2c, mcu_ids); 161MODULE_DEVICE_TABLE(i2c, mcu_ids);
184 162
163static struct of_device_id mcu_of_match_table[] __devinitdata = {
164 { .compatible = "fsl,mcu-mpc8349emitx", },
165 { },
166};
167
185static struct i2c_driver mcu_driver = { 168static struct i2c_driver mcu_driver = {
186 .driver = { 169 .driver = {
187 .name = "mcu-mpc8349emitx", 170 .name = "mcu-mpc8349emitx",
188 .owner = THIS_MODULE, 171 .owner = THIS_MODULE,
172 .of_match_table = mcu_of_match_table,
189 }, 173 },
190 .probe = mcu_probe, 174 .probe = mcu_probe,
191 .remove = __devexit_p(mcu_remove), 175 .remove = __devexit_p(mcu_remove),
diff --git a/arch/powerpc/platforms/83xx/mpc830x_rdb.c b/arch/powerpc/platforms/83xx/mpc830x_rdb.c
new file mode 100644
index 000000000000..ac102ee9abe8
--- /dev/null
+++ b/arch/powerpc/platforms/83xx/mpc830x_rdb.c
@@ -0,0 +1,94 @@
1/*
2 * arch/powerpc/platforms/83xx/mpc830x_rdb.c
3 *
4 * Description: MPC830x RDB board specific routines.
5 * This file is based on mpc831x_rdb.c
6 *
7 * Copyright (C) Freescale Semiconductor, Inc. 2009. All rights reserved.
8 * Copyright (C) 2010. Ilya Yanok, Emcraft Systems, yanok@emcraft.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 */
15
16#include <linux/pci.h>
17#include <linux/of_platform.h>
18#include <asm/time.h>
19#include <asm/ipic.h>
20#include <asm/udbg.h>
21#include <sysdev/fsl_pci.h>
22#include <sysdev/fsl_soc.h>
23#include "mpc83xx.h"
24
25/*
26 * Setup the architecture
27 */
28static void __init mpc830x_rdb_setup_arch(void)
29{
30#ifdef CONFIG_PCI
31 struct device_node *np;
32#endif
33
34 if (ppc_md.progress)
35 ppc_md.progress("mpc830x_rdb_setup_arch()", 0);
36
37#ifdef CONFIG_PCI
38 for_each_compatible_node(np, "pci", "fsl,mpc8308-pcie")
39 mpc83xx_add_bridge(np);
40#endif
41 mpc831x_usb_cfg();
42}
43
44static void __init mpc830x_rdb_init_IRQ(void)
45{
46 struct device_node *np;
47
48 np = of_find_node_by_type(NULL, "ipic");
49 if (!np)
50 return;
51
52 ipic_init(np, 0);
53
54 /* Initialize the default interrupt mapping priorities,
55 * in case the boot rom changed something on us.
56 */
57 ipic_set_default_priority();
58}
59
60/*
61 * Called very early, MMU is off, device-tree isn't unflattened
62 */
63static int __init mpc830x_rdb_probe(void)
64{
65 unsigned long root = of_get_flat_dt_root();
66
67 return of_flat_dt_is_compatible(root, "MPC8308RDB") ||
68 of_flat_dt_is_compatible(root, "fsl,mpc8308rdb");
69}
70
71static struct of_device_id __initdata of_bus_ids[] = {
72 { .compatible = "simple-bus" },
73 { .compatible = "gianfar" },
74 {},
75};
76
77static int __init declare_of_platform_devices(void)
78{
79 of_platform_bus_probe(NULL, of_bus_ids, NULL);
80 return 0;
81}
82machine_device_initcall(mpc830x_rdb, declare_of_platform_devices);
83
84define_machine(mpc830x_rdb) {
85 .name = "MPC830x RDB",
86 .probe = mpc830x_rdb_probe,
87 .setup_arch = mpc830x_rdb_setup_arch,
88 .init_IRQ = mpc830x_rdb_init_IRQ,
89 .get_irq = ipic_get_irq,
90 .restart = mpc83xx_restart,
91 .time_init = mpc83xx_time_init,
92 .calibrate_decr = generic_calibrate_decr,
93 .progress = udbg_progress,
94};
diff --git a/arch/powerpc/platforms/83xx/suspend.c b/arch/powerpc/platforms/83xx/suspend.c
index ebe6c3537209..75ae77f1af6a 100644
--- a/arch/powerpc/platforms/83xx/suspend.c
+++ b/arch/powerpc/platforms/83xx/suspend.c
@@ -99,7 +99,7 @@ struct pmc_type {
99 int has_deep_sleep; 99 int has_deep_sleep;
100}; 100};
101 101
102static struct of_device *pmc_dev; 102static struct platform_device *pmc_dev;
103static int has_deep_sleep, deep_sleeping; 103static int has_deep_sleep, deep_sleeping;
104static int pmc_irq; 104static int pmc_irq;
105static struct mpc83xx_pmc __iomem *pmc_regs; 105static struct mpc83xx_pmc __iomem *pmc_regs;
@@ -318,7 +318,7 @@ static struct platform_suspend_ops mpc83xx_suspend_ops = {
318 .end = mpc83xx_suspend_end, 318 .end = mpc83xx_suspend_end,
319}; 319};
320 320
321static int pmc_probe(struct of_device *ofdev, 321static int pmc_probe(struct platform_device *ofdev,
322 const struct of_device_id *match) 322 const struct of_device_id *match)
323{ 323{
324 struct device_node *np = ofdev->dev.of_node; 324 struct device_node *np = ofdev->dev.of_node;
@@ -396,7 +396,7 @@ out:
396 return ret; 396 return ret;
397} 397}
398 398
399static int pmc_remove(struct of_device *ofdev) 399static int pmc_remove(struct platform_device *ofdev)
400{ 400{
401 return -EPERM; 401 return -EPERM;
402}; 402};
diff --git a/arch/powerpc/platforms/85xx/Kconfig b/arch/powerpc/platforms/85xx/Kconfig
index 3a2ade2e443f..bea1f5905ad4 100644
--- a/arch/powerpc/platforms/85xx/Kconfig
+++ b/arch/powerpc/platforms/85xx/Kconfig
@@ -65,6 +65,14 @@ config MPC85xx_RDB
65 help 65 help
66 This option enables support for the MPC85xx RDB (P2020 RDB) board 66 This option enables support for the MPC85xx RDB (P2020 RDB) board
67 67
68config P1022_DS
69 bool "Freescale P1022 DS"
70 select DEFAULT_UIMAGE
71 select CONFIG_PHYS_64BIT # The DTS has 36-bit addresses
72 select SWIOTLB
73 help
74 This option enables support for the Freescale P1022DS reference board.
75
68config SOCRATES 76config SOCRATES
69 bool "Socrates" 77 bool "Socrates"
70 select DEFAULT_UIMAGE 78 select DEFAULT_UIMAGE
diff --git a/arch/powerpc/platforms/85xx/Makefile b/arch/powerpc/platforms/85xx/Makefile
index 387c128f2c8c..a2ec3f8f4d06 100644
--- a/arch/powerpc/platforms/85xx/Makefile
+++ b/arch/powerpc/platforms/85xx/Makefile
@@ -10,6 +10,7 @@ obj-$(CONFIG_MPC8536_DS) += mpc8536_ds.o
10obj-$(CONFIG_MPC85xx_DS) += mpc85xx_ds.o 10obj-$(CONFIG_MPC85xx_DS) += mpc85xx_ds.o
11obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o 11obj-$(CONFIG_MPC85xx_MDS) += mpc85xx_mds.o
12obj-$(CONFIG_MPC85xx_RDB) += mpc85xx_rdb.o 12obj-$(CONFIG_MPC85xx_RDB) += mpc85xx_rdb.o
13obj-$(CONFIG_P1022_DS) += p1022_ds.o
13obj-$(CONFIG_P4080_DS) += p4080_ds.o corenet_ds.o 14obj-$(CONFIG_P4080_DS) += p4080_ds.o corenet_ds.o
14obj-$(CONFIG_STX_GP3) += stx_gp3.o 15obj-$(CONFIG_STX_GP3) += stx_gp3.o
15obj-$(CONFIG_TQM85xx) += tqm85xx.o 16obj-$(CONFIG_TQM85xx) += tqm85xx.o
diff --git a/arch/powerpc/platforms/85xx/mpc85xx_mds.c b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
index 494513682d70..da64be19d099 100644
--- a/arch/powerpc/platforms/85xx/mpc85xx_mds.c
+++ b/arch/powerpc/platforms/85xx/mpc85xx_mds.c
@@ -158,51 +158,108 @@ static int mpc8568_mds_phy_fixups(struct phy_device *phydev)
158extern void __init mpc85xx_smp_init(void); 158extern void __init mpc85xx_smp_init(void);
159#endif 159#endif
160 160
161static void __init mpc85xx_mds_setup_arch(void) 161#ifdef CONFIG_QUICC_ENGINE
162static struct of_device_id mpc85xx_qe_ids[] __initdata = {
163 { .type = "qe", },
164 { .compatible = "fsl,qe", },
165 { },
166};
167
168static void __init mpc85xx_publish_qe_devices(void)
162{ 169{
163 struct device_node *np; 170 struct device_node *np;
164 static u8 __iomem *bcsr_regs = NULL;
165#ifdef CONFIG_PCI
166 struct pci_controller *hose;
167#endif
168 dma_addr_t max = 0xffffffff;
169 171
170 if (ppc_md.progress) 172 np = of_find_compatible_node(NULL, NULL, "fsl,qe");
171 ppc_md.progress("mpc85xx_mds_setup_arch()", 0); 173 if (!of_device_is_available(np)) {
174 of_node_put(np);
175 return;
176 }
177
178 of_platform_bus_probe(NULL, mpc85xx_qe_ids, NULL);
179}
180
181static void __init mpc85xx_mds_reset_ucc_phys(void)
182{
183 struct device_node *np;
184 static u8 __iomem *bcsr_regs;
172 185
173 /* Map BCSR area */ 186 /* Map BCSR area */
174 np = of_find_node_by_name(NULL, "bcsr"); 187 np = of_find_node_by_name(NULL, "bcsr");
175 if (np != NULL) { 188 if (!np)
176 struct resource res; 189 return;
177 190
178 of_address_to_resource(np, 0, &res); 191 bcsr_regs = of_iomap(np, 0);
179 bcsr_regs = ioremap(res.start, res.end - res.start +1); 192 of_node_put(np);
180 of_node_put(np); 193 if (!bcsr_regs)
181 } 194 return;
182 195
183#ifdef CONFIG_PCI 196 if (machine_is(mpc8568_mds)) {
184 for_each_node_by_type(np, "pci") { 197#define BCSR_UCC1_GETH_EN (0x1 << 7)
185 if (of_device_is_compatible(np, "fsl,mpc8540-pci") || 198#define BCSR_UCC2_GETH_EN (0x1 << 7)
186 of_device_is_compatible(np, "fsl,mpc8548-pcie")) { 199#define BCSR_UCC1_MODE_MSK (0x3 << 4)
187 struct resource rsrc; 200#define BCSR_UCC2_MODE_MSK (0x3 << 0)
188 of_address_to_resource(np, 0, &rsrc);
189 if ((rsrc.start & 0xfffff) == 0x8000)
190 fsl_add_bridge(np, 1);
191 else
192 fsl_add_bridge(np, 0);
193 201
194 hose = pci_find_hose_for_OF_device(np); 202 /* Turn off UCC1 & UCC2 */
195 max = min(max, hose->dma_window_base_cur + 203 clrbits8(&bcsr_regs[8], BCSR_UCC1_GETH_EN);
196 hose->dma_window_size); 204 clrbits8(&bcsr_regs[9], BCSR_UCC2_GETH_EN);
205
206 /* Mode is RGMII, all bits clear */
207 clrbits8(&bcsr_regs[11], BCSR_UCC1_MODE_MSK |
208 BCSR_UCC2_MODE_MSK);
209
210 /* Turn UCC1 & UCC2 on */
211 setbits8(&bcsr_regs[8], BCSR_UCC1_GETH_EN);
212 setbits8(&bcsr_regs[9], BCSR_UCC2_GETH_EN);
213 } else if (machine_is(mpc8569_mds)) {
214#define BCSR7_UCC12_GETHnRST (0x1 << 2)
215#define BCSR8_UEM_MARVELL_RST (0x1 << 1)
216#define BCSR_UCC_RGMII (0x1 << 6)
217#define BCSR_UCC_RTBI (0x1 << 5)
218 /*
219 * U-Boot mangles interrupt polarity for Marvell PHYs,
220 * so reset built-in and UEM Marvell PHYs, this puts
221 * the PHYs into their normal state.
222 */
223 clrbits8(&bcsr_regs[7], BCSR7_UCC12_GETHnRST);
224 setbits8(&bcsr_regs[8], BCSR8_UEM_MARVELL_RST);
225
226 setbits8(&bcsr_regs[7], BCSR7_UCC12_GETHnRST);
227 clrbits8(&bcsr_regs[8], BCSR8_UEM_MARVELL_RST);
228
229 for (np = NULL; (np = of_find_compatible_node(np,
230 "network",
231 "ucc_geth")) != NULL;) {
232 const unsigned int *prop;
233 int ucc_num;
234
235 prop = of_get_property(np, "cell-index", NULL);
236 if (prop == NULL)
237 continue;
238
239 ucc_num = *prop - 1;
240
241 prop = of_get_property(np, "phy-connection-type", NULL);
242 if (prop == NULL)
243 continue;
244
245 if (strcmp("rtbi", (const char *)prop) == 0)
246 clrsetbits_8(&bcsr_regs[7 + ucc_num],
247 BCSR_UCC_RGMII, BCSR_UCC_RTBI);
197 } 248 }
249 } else if (machine_is(p1021_mds)) {
250#define BCSR11_ENET_MICRST (0x1 << 5)
251 /* Reset Micrel PHY */
252 clrbits8(&bcsr_regs[11], BCSR11_ENET_MICRST);
253 setbits8(&bcsr_regs[11], BCSR11_ENET_MICRST);
198 } 254 }
199#endif
200 255
201#ifdef CONFIG_SMP 256 iounmap(bcsr_regs);
202 mpc85xx_smp_init(); 257}
203#endif 258
259static void __init mpc85xx_mds_qe_init(void)
260{
261 struct device_node *np;
204 262
205#ifdef CONFIG_QUICC_ENGINE
206 np = of_find_compatible_node(NULL, NULL, "fsl,qe"); 263 np = of_find_compatible_node(NULL, NULL, "fsl,qe");
207 if (!np) { 264 if (!np) {
208 np = of_find_node_by_name(NULL, "qe"); 265 np = of_find_node_by_name(NULL, "qe");
@@ -210,6 +267,11 @@ static void __init mpc85xx_mds_setup_arch(void)
210 return; 267 return;
211 } 268 }
212 269
270 if (!of_device_is_available(np)) {
271 of_node_put(np);
272 return;
273 }
274
213 qe_reset(); 275 qe_reset();
214 of_node_put(np); 276 of_node_put(np);
215 277
@@ -224,70 +286,7 @@ static void __init mpc85xx_mds_setup_arch(void)
224 par_io_of_config(ucc); 286 par_io_of_config(ucc);
225 } 287 }
226 288
227 if (bcsr_regs) { 289 mpc85xx_mds_reset_ucc_phys();
228 if (machine_is(mpc8568_mds)) {
229#define BCSR_UCC1_GETH_EN (0x1 << 7)
230#define BCSR_UCC2_GETH_EN (0x1 << 7)
231#define BCSR_UCC1_MODE_MSK (0x3 << 4)
232#define BCSR_UCC2_MODE_MSK (0x3 << 0)
233
234 /* Turn off UCC1 & UCC2 */
235 clrbits8(&bcsr_regs[8], BCSR_UCC1_GETH_EN);
236 clrbits8(&bcsr_regs[9], BCSR_UCC2_GETH_EN);
237
238 /* Mode is RGMII, all bits clear */
239 clrbits8(&bcsr_regs[11], BCSR_UCC1_MODE_MSK |
240 BCSR_UCC2_MODE_MSK);
241
242 /* Turn UCC1 & UCC2 on */
243 setbits8(&bcsr_regs[8], BCSR_UCC1_GETH_EN);
244 setbits8(&bcsr_regs[9], BCSR_UCC2_GETH_EN);
245 } else if (machine_is(mpc8569_mds)) {
246#define BCSR7_UCC12_GETHnRST (0x1 << 2)
247#define BCSR8_UEM_MARVELL_RST (0x1 << 1)
248#define BCSR_UCC_RGMII (0x1 << 6)
249#define BCSR_UCC_RTBI (0x1 << 5)
250 /*
251 * U-Boot mangles interrupt polarity for Marvell PHYs,
252 * so reset built-in and UEM Marvell PHYs, this puts
253 * the PHYs into their normal state.
254 */
255 clrbits8(&bcsr_regs[7], BCSR7_UCC12_GETHnRST);
256 setbits8(&bcsr_regs[8], BCSR8_UEM_MARVELL_RST);
257
258 setbits8(&bcsr_regs[7], BCSR7_UCC12_GETHnRST);
259 clrbits8(&bcsr_regs[8], BCSR8_UEM_MARVELL_RST);
260
261 for (np = NULL; (np = of_find_compatible_node(np,
262 "network",
263 "ucc_geth")) != NULL;) {
264 const unsigned int *prop;
265 int ucc_num;
266
267 prop = of_get_property(np, "cell-index", NULL);
268 if (prop == NULL)
269 continue;
270
271 ucc_num = *prop - 1;
272
273 prop = of_get_property(np, "phy-connection-type", NULL);
274 if (prop == NULL)
275 continue;
276
277 if (strcmp("rtbi", (const char *)prop) == 0)
278 clrsetbits_8(&bcsr_regs[7 + ucc_num],
279 BCSR_UCC_RGMII, BCSR_UCC_RTBI);
280 }
281
282 } else if (machine_is(p1021_mds)) {
283#define BCSR11_ENET_MICRST (0x1 << 5)
284 /* Reset Micrel PHY */
285 clrbits8(&bcsr_regs[11], BCSR11_ENET_MICRST);
286 setbits8(&bcsr_regs[11], BCSR11_ENET_MICRST);
287 }
288
289 iounmap(bcsr_regs);
290 }
291 290
292 if (machine_is(p1021_mds)) { 291 if (machine_is(p1021_mds)) {
293#define MPC85xx_PMUXCR_OFFSET 0x60 292#define MPC85xx_PMUXCR_OFFSET 0x60
@@ -322,8 +321,72 @@ static void __init mpc85xx_mds_setup_arch(void)
322 } 321 }
323 322
324 } 323 }
324}
325
326static void __init mpc85xx_mds_qeic_init(void)
327{
328 struct device_node *np;
329
330 np = of_find_compatible_node(NULL, NULL, "fsl,qe");
331 if (!of_device_is_available(np)) {
332 of_node_put(np);
333 return;
334 }
335
336 np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
337 if (!np) {
338 np = of_find_node_by_type(NULL, "qeic");
339 if (!np)
340 return;
341 }
342
343 if (machine_is(p1021_mds))
344 qe_ic_init(np, 0, qe_ic_cascade_low_mpic,
345 qe_ic_cascade_high_mpic);
346 else
347 qe_ic_init(np, 0, qe_ic_cascade_muxed_mpic, NULL);
348 of_node_put(np);
349}
350#else
351static void __init mpc85xx_publish_qe_devices(void) { }
352static void __init mpc85xx_mds_qe_init(void) { }
353static void __init mpc85xx_mds_qeic_init(void) { }
325#endif /* CONFIG_QUICC_ENGINE */ 354#endif /* CONFIG_QUICC_ENGINE */
326 355
356static void __init mpc85xx_mds_setup_arch(void)
357{
358#ifdef CONFIG_PCI
359 struct pci_controller *hose;
360#endif
361 dma_addr_t max = 0xffffffff;
362
363 if (ppc_md.progress)
364 ppc_md.progress("mpc85xx_mds_setup_arch()", 0);
365
366#ifdef CONFIG_PCI
367 for_each_node_by_type(np, "pci") {
368 if (of_device_is_compatible(np, "fsl,mpc8540-pci") ||
369 of_device_is_compatible(np, "fsl,mpc8548-pcie")) {
370 struct resource rsrc;
371 of_address_to_resource(np, 0, &rsrc);
372 if ((rsrc.start & 0xfffff) == 0x8000)
373 fsl_add_bridge(np, 1);
374 else
375 fsl_add_bridge(np, 0);
376
377 hose = pci_find_hose_for_OF_device(np);
378 max = min(max, hose->dma_window_base_cur +
379 hose->dma_window_size);
380 }
381 }
382#endif
383
384#ifdef CONFIG_SMP
385 mpc85xx_smp_init();
386#endif
387
388 mpc85xx_mds_qe_init();
389
327#ifdef CONFIG_SWIOTLB 390#ifdef CONFIG_SWIOTLB
328 if (memblock_end_of_DRAM() > max) { 391 if (memblock_end_of_DRAM() > max) {
329 ppc_swiotlb_enable = 1; 392 ppc_swiotlb_enable = 1;
@@ -369,8 +432,6 @@ static struct of_device_id mpc85xx_ids[] = {
369 { .type = "soc", }, 432 { .type = "soc", },
370 { .compatible = "soc", }, 433 { .compatible = "soc", },
371 { .compatible = "simple-bus", }, 434 { .compatible = "simple-bus", },
372 { .type = "qe", },
373 { .compatible = "fsl,qe", },
374 { .compatible = "gianfar", }, 435 { .compatible = "gianfar", },
375 { .compatible = "fsl,rapidio-delta", }, 436 { .compatible = "fsl,rapidio-delta", },
376 { .compatible = "fsl,mpc8548-guts", }, 437 { .compatible = "fsl,mpc8548-guts", },
@@ -382,8 +443,6 @@ static struct of_device_id p1021_ids[] = {
382 { .type = "soc", }, 443 { .type = "soc", },
383 { .compatible = "soc", }, 444 { .compatible = "soc", },
384 { .compatible = "simple-bus", }, 445 { .compatible = "simple-bus", },
385 { .type = "qe", },
386 { .compatible = "fsl,qe", },
387 { .compatible = "gianfar", }, 446 { .compatible = "gianfar", },
388 {}, 447 {},
389}; 448};
@@ -395,16 +454,16 @@ static int __init mpc85xx_publish_devices(void)
395 if (machine_is(mpc8569_mds)) 454 if (machine_is(mpc8569_mds))
396 simple_gpiochip_init("fsl,mpc8569mds-bcsr-gpio"); 455 simple_gpiochip_init("fsl,mpc8569mds-bcsr-gpio");
397 456
398 /* Publish the QE devices */
399 of_platform_bus_probe(NULL, mpc85xx_ids, NULL); 457 of_platform_bus_probe(NULL, mpc85xx_ids, NULL);
458 mpc85xx_publish_qe_devices();
400 459
401 return 0; 460 return 0;
402} 461}
403 462
404static int __init p1021_publish_devices(void) 463static int __init p1021_publish_devices(void)
405{ 464{
406 /* Publish the QE devices */
407 of_platform_bus_probe(NULL, p1021_ids, NULL); 465 of_platform_bus_probe(NULL, p1021_ids, NULL);
466 mpc85xx_publish_qe_devices();
408 467
409 return 0; 468 return 0;
410} 469}
@@ -441,21 +500,7 @@ static void __init mpc85xx_mds_pic_init(void)
441 of_node_put(np); 500 of_node_put(np);
442 501
443 mpic_init(mpic); 502 mpic_init(mpic);
444 503 mpc85xx_mds_qeic_init();
445#ifdef CONFIG_QUICC_ENGINE
446 np = of_find_compatible_node(NULL, NULL, "fsl,qe-ic");
447 if (!np) {
448 np = of_find_node_by_type(NULL, "qeic");
449 if (!np)
450 return;
451 }
452 if (machine_is(p1021_mds))
453 qe_ic_init(np, 0, qe_ic_cascade_low_mpic,
454 qe_ic_cascade_high_mpic);
455 else
456 qe_ic_init(np, 0, qe_ic_cascade_muxed_mpic, NULL);
457 of_node_put(np);
458#endif /* CONFIG_QUICC_ENGINE */
459} 504}
460 505
461static int __init mpc85xx_mds_probe(void) 506static int __init mpc85xx_mds_probe(void)
diff --git a/arch/powerpc/platforms/85xx/p1022_ds.c b/arch/powerpc/platforms/85xx/p1022_ds.c
new file mode 100644
index 000000000000..e1467c937450
--- /dev/null
+++ b/arch/powerpc/platforms/85xx/p1022_ds.c
@@ -0,0 +1,148 @@
1/*
2 * P1022DS board specific routines
3 *
4 * Authors: Travis Wheatley <travis.wheatley@freescale.com>
5 * Dave Liu <daveliu@freescale.com>
6 * Timur Tabi <timur@freescale.com>
7 *
8 * Copyright 2010 Freescale Semiconductor, Inc.
9 *
10 * This file is taken from the Freescale P1022DS BSP, with modifications:
11 * 1) No DIU support (pending rewrite of DIU code)
12 * 2) No AMP support
13 * 3) No PCI endpoint support
14 *
15 * This file is licensed under the terms of the GNU General Public License
16 * version 2. This program is licensed "as is" without any warranty of any
17 * kind, whether express or implied.
18 */
19
20#include <linux/pci.h>
21#include <linux/of_platform.h>
22#include <linux/lmb.h>
23
24#include <asm/mpic.h>
25#include <asm/swiotlb.h>
26
27#include <sysdev/fsl_soc.h>
28#include <sysdev/fsl_pci.h>
29
30void __init p1022_ds_pic_init(void)
31{
32 struct mpic *mpic;
33 struct resource r;
34 struct device_node *np;
35
36 np = of_find_node_by_type(NULL, "open-pic");
37 if (!np) {
38 pr_err("Could not find open-pic node\n");
39 return;
40 }
41
42 if (of_address_to_resource(np, 0, &r)) {
43 pr_err("Failed to map mpic register space\n");
44 of_node_put(np);
45 return;
46 }
47
48 mpic = mpic_alloc(np, r.start,
49 MPIC_PRIMARY | MPIC_WANTS_RESET |
50 MPIC_BIG_ENDIAN | MPIC_BROKEN_FRR_NIRQS |
51 MPIC_SINGLE_DEST_CPU,
52 0, 256, " OpenPIC ");
53
54 BUG_ON(mpic == NULL);
55 of_node_put(np);
56
57 mpic_init(mpic);
58}
59
60#ifdef CONFIG_SMP
61void __init mpc85xx_smp_init(void);
62#endif
63
64/*
65 * Setup the architecture
66 */
67static void __init p1022_ds_setup_arch(void)
68{
69#ifdef CONFIG_PCI
70 struct device_node *np;
71#endif
72 dma_addr_t max = 0xffffffff;
73
74 if (ppc_md.progress)
75 ppc_md.progress("p1022_ds_setup_arch()", 0);
76
77#ifdef CONFIG_PCI
78 for_each_compatible_node(np, "pci", "fsl,p1022-pcie") {
79 struct resource rsrc;
80 struct pci_controller *hose;
81
82 of_address_to_resource(np, 0, &rsrc);
83
84 if ((rsrc.start & 0xfffff) == 0x8000)
85 fsl_add_bridge(np, 1);
86 else
87 fsl_add_bridge(np, 0);
88
89 hose = pci_find_hose_for_OF_device(np);
90 max = min(max, hose->dma_window_base_cur +
91 hose->dma_window_size);
92 }
93#endif
94
95#ifdef CONFIG_SMP
96 mpc85xx_smp_init();
97#endif
98
99#ifdef CONFIG_SWIOTLB
100 if (lmb_end_of_DRAM() > max) {
101 ppc_swiotlb_enable = 1;
102 set_pci_dma_ops(&swiotlb_dma_ops);
103 ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
104 }
105#endif
106
107 pr_info("Freescale P1022 DS reference board\n");
108}
109
110static struct of_device_id __initdata p1022_ds_ids[] = {
111 { .type = "soc", },
112 { .compatible = "soc", },
113 { .compatible = "simple-bus", },
114 { .compatible = "gianfar", },
115 {},
116};
117
118static int __init p1022_ds_publish_devices(void)
119{
120 return of_platform_bus_probe(NULL, p1022_ds_ids, NULL);
121}
122machine_device_initcall(p1022_ds, p1022_ds_publish_devices);
123
124machine_arch_initcall(p1022_ds, swiotlb_setup_bus_notifier);
125
126/*
127 * Called very early, device-tree isn't unflattened
128 */
129static int __init p1022_ds_probe(void)
130{
131 unsigned long root = of_get_flat_dt_root();
132
133 return of_flat_dt_is_compatible(root, "fsl,p1022ds");
134}
135
136define_machine(p1022_ds) {
137 .name = "P1022 DS",
138 .probe = p1022_ds_probe,
139 .setup_arch = p1022_ds_setup_arch,
140 .init_IRQ = p1022_ds_pic_init,
141#ifdef CONFIG_PCI
142 .pcibios_fixup_bus = fsl_pcibios_fixup_bus,
143#endif
144 .get_irq = mpic_get_irq,
145 .restart = fsl_rstcr_restart,
146 .calibrate_decr = generic_calibrate_decr,
147 .progress = udbg_progress,
148};
diff --git a/arch/powerpc/platforms/85xx/smp.c b/arch/powerpc/platforms/85xx/smp.c
index a15f582300d8..a6b106557be4 100644
--- a/arch/powerpc/platforms/85xx/smp.c
+++ b/arch/powerpc/platforms/85xx/smp.c
@@ -15,6 +15,7 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/of.h> 17#include <linux/of.h>
18#include <linux/kexec.h>
18 19
19#include <asm/machdep.h> 20#include <asm/machdep.h>
20#include <asm/pgtable.h> 21#include <asm/pgtable.h>
@@ -24,6 +25,7 @@
24#include <asm/dbell.h> 25#include <asm/dbell.h>
25 26
26#include <sysdev/fsl_soc.h> 27#include <sysdev/fsl_soc.h>
28#include <sysdev/mpic.h>
27 29
28extern void __early_start(void); 30extern void __early_start(void);
29 31
@@ -99,12 +101,70 @@ static void __init
99smp_85xx_setup_cpu(int cpu_nr) 101smp_85xx_setup_cpu(int cpu_nr)
100{ 102{
101 mpic_setup_this_cpu(); 103 mpic_setup_this_cpu();
104 if (cpu_has_feature(CPU_FTR_DBELL))
105 doorbell_setup_this_cpu();
102} 106}
103 107
104struct smp_ops_t smp_85xx_ops = { 108struct smp_ops_t smp_85xx_ops = {
105 .kick_cpu = smp_85xx_kick_cpu, 109 .kick_cpu = smp_85xx_kick_cpu,
110#ifdef CONFIG_KEXEC
111 .give_timebase = smp_generic_give_timebase,
112 .take_timebase = smp_generic_take_timebase,
113#endif
106}; 114};
107 115
116#ifdef CONFIG_KEXEC
117static int kexec_down_cpus = 0;
118
119void mpc85xx_smp_kexec_cpu_down(int crash_shutdown, int secondary)
120{
121 mpic_teardown_this_cpu(1);
122
123 /* When crashing, this gets called on all CPU's we only
124 * take down the non-boot cpus */
125 if (smp_processor_id() != boot_cpuid)
126 {
127 local_irq_disable();
128 kexec_down_cpus++;
129
130 while (1);
131 }
132}
133
134static void mpc85xx_smp_kexec_down(void *arg)
135{
136 if (ppc_md.kexec_cpu_down)
137 ppc_md.kexec_cpu_down(0,1);
138}
139
140static void mpc85xx_smp_machine_kexec(struct kimage *image)
141{
142 int timeout = 2000;
143 int i;
144
145 set_cpus_allowed(current, cpumask_of_cpu(boot_cpuid));
146
147 smp_call_function(mpc85xx_smp_kexec_down, NULL, 0);
148
149 while ( (kexec_down_cpus != (num_online_cpus() - 1)) &&
150 ( timeout > 0 ) )
151 {
152 timeout--;
153 }
154
155 if ( !timeout )
156 printk(KERN_ERR "Unable to bring down secondary cpu(s)");
157
158 for (i = 0; i < num_present_cpus(); i++)
159 {
160 if ( i == smp_processor_id() ) continue;
161 mpic_reset_core(i);
162 }
163
164 default_machine_kexec(image);
165}
166#endif /* CONFIG_KEXEC */
167
108void __init mpc85xx_smp_init(void) 168void __init mpc85xx_smp_init(void)
109{ 169{
110 struct device_node *np; 170 struct device_node *np;
@@ -117,9 +177,14 @@ void __init mpc85xx_smp_init(void)
117 } 177 }
118 178
119 if (cpu_has_feature(CPU_FTR_DBELL)) 179 if (cpu_has_feature(CPU_FTR_DBELL))
120 smp_85xx_ops.message_pass = smp_dbell_message_pass; 180 smp_85xx_ops.message_pass = doorbell_message_pass;
121 181
122 BUG_ON(!smp_85xx_ops.message_pass); 182 BUG_ON(!smp_85xx_ops.message_pass);
123 183
124 smp_ops = &smp_85xx_ops; 184 smp_ops = &smp_85xx_ops;
185
186#ifdef CONFIG_KEXEC
187 ppc_md.kexec_cpu_down = mpc85xx_smp_kexec_cpu_down;
188 ppc_md.machine_kexec = mpc85xx_smp_machine_kexec;
189#endif
125} 190}
diff --git a/arch/powerpc/platforms/85xx/tqm85xx.c b/arch/powerpc/platforms/85xx/tqm85xx.c
index 5b0ab9966e90..8f29bbce5360 100644
--- a/arch/powerpc/platforms/85xx/tqm85xx.c
+++ b/arch/powerpc/platforms/85xx/tqm85xx.c
@@ -151,6 +151,27 @@ static void tqm85xx_show_cpuinfo(struct seq_file *m)
151 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f)); 151 seq_printf(m, "PLL setting\t: 0x%x\n", ((phid1 >> 24) & 0x3f));
152} 152}
153 153
154static void __init tqm85xx_ti1520_fixup(struct pci_dev *pdev)
155{
156 unsigned int val;
157
158 /* Do not do the fixup on other platforms! */
159 if (!machine_is(tqm85xx))
160 return;
161
162 dev_info(&pdev->dev, "Using TI 1520 fixup on TQM85xx\n");
163
164 /*
165 * Enable P2CCLK bit in system control register
166 * to enable CLOCK output to power chip
167 */
168 pci_read_config_dword(pdev, 0x80, &val);
169 pci_write_config_dword(pdev, 0x80, val | (1 << 27));
170
171}
172DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_TI, PCI_DEVICE_ID_TI_1520,
173 tqm85xx_ti1520_fixup);
174
154static struct of_device_id __initdata of_bus_ids[] = { 175static struct of_device_id __initdata of_bus_ids[] = {
155 { .compatible = "simple-bus", }, 176 { .compatible = "simple-bus", },
156 { .compatible = "gianfar", }, 177 { .compatible = "gianfar", },
diff --git a/arch/powerpc/platforms/86xx/gef_gpio.c b/arch/powerpc/platforms/86xx/gef_gpio.c
index b8cb08dbd89c..4ff7b1e7bbad 100644
--- a/arch/powerpc/platforms/86xx/gef_gpio.c
+++ b/arch/powerpc/platforms/86xx/gef_gpio.c
@@ -118,12 +118,12 @@ static int __init gef_gpio_init(void)
118 } 118 }
119 119
120 /* Setup pointers to chip functions */ 120 /* Setup pointers to chip functions */
121 gef_gpio_chip->of_gc.gpio_cells = 2; 121 gef_gpio_chip->gc.of_gpio_n_cells = 2;
122 gef_gpio_chip->of_gc.gc.ngpio = 19; 122 gef_gpio_chip->gc.ngpio = 19;
123 gef_gpio_chip->of_gc.gc.direction_input = gef_gpio_dir_in; 123 gef_gpio_chip->gc.direction_input = gef_gpio_dir_in;
124 gef_gpio_chip->of_gc.gc.direction_output = gef_gpio_dir_out; 124 gef_gpio_chip->gc.direction_output = gef_gpio_dir_out;
125 gef_gpio_chip->of_gc.gc.get = gef_gpio_get; 125 gef_gpio_chip->gc.get = gef_gpio_get;
126 gef_gpio_chip->of_gc.gc.set = gef_gpio_set; 126 gef_gpio_chip->gc.set = gef_gpio_set;
127 127
128 /* This function adds a memory mapped GPIO chip */ 128 /* This function adds a memory mapped GPIO chip */
129 retval = of_mm_gpiochip_add(np, gef_gpio_chip); 129 retval = of_mm_gpiochip_add(np, gef_gpio_chip);
@@ -146,12 +146,12 @@ static int __init gef_gpio_init(void)
146 } 146 }
147 147
148 /* Setup pointers to chip functions */ 148 /* Setup pointers to chip functions */
149 gef_gpio_chip->of_gc.gpio_cells = 2; 149 gef_gpio_chip->gc.of_gpio_n_cells = 2;
150 gef_gpio_chip->of_gc.gc.ngpio = 6; 150 gef_gpio_chip->gc.ngpio = 6;
151 gef_gpio_chip->of_gc.gc.direction_input = gef_gpio_dir_in; 151 gef_gpio_chip->gc.direction_input = gef_gpio_dir_in;
152 gef_gpio_chip->of_gc.gc.direction_output = gef_gpio_dir_out; 152 gef_gpio_chip->gc.direction_output = gef_gpio_dir_out;
153 gef_gpio_chip->of_gc.gc.get = gef_gpio_get; 153 gef_gpio_chip->gc.get = gef_gpio_get;
154 gef_gpio_chip->of_gc.gc.set = gef_gpio_set; 154 gef_gpio_chip->gc.set = gef_gpio_set;
155 155
156 /* This function adds a memory mapped GPIO chip */ 156 /* This function adds a memory mapped GPIO chip */
157 retval = of_mm_gpiochip_add(np, gef_gpio_chip); 157 retval = of_mm_gpiochip_add(np, gef_gpio_chip);
diff --git a/arch/powerpc/platforms/8xx/Kconfig b/arch/powerpc/platforms/8xx/Kconfig
index 48a920a98e7b..dd35ce081cff 100644
--- a/arch/powerpc/platforms/8xx/Kconfig
+++ b/arch/powerpc/platforms/8xx/Kconfig
@@ -55,6 +55,12 @@ config PPC_MGSUVD
55 help 55 help
56 This enables support for the Keymile MGSUVD board. 56 This enables support for the Keymile MGSUVD board.
57 57
58config TQM8XX
59 bool "TQM8XX"
60 select CPM1
61 help
62 support for the mpc8xx based boards from TQM.
63
58endchoice 64endchoice
59 65
60menu "Freescale Ethernet driver platform-specific options" 66menu "Freescale Ethernet driver platform-specific options"
diff --git a/arch/powerpc/platforms/8xx/Makefile b/arch/powerpc/platforms/8xx/Makefile
index bdbfd7496018..a491fe6b94fc 100644
--- a/arch/powerpc/platforms/8xx/Makefile
+++ b/arch/powerpc/platforms/8xx/Makefile
@@ -7,3 +7,4 @@ obj-$(CONFIG_MPC86XADS) += mpc86xads_setup.o
7obj-$(CONFIG_PPC_EP88XC) += ep88xc.o 7obj-$(CONFIG_PPC_EP88XC) += ep88xc.o
8obj-$(CONFIG_PPC_ADDER875) += adder875.o 8obj-$(CONFIG_PPC_ADDER875) += adder875.o
9obj-$(CONFIG_PPC_MGSUVD) += mgsuvd.o 9obj-$(CONFIG_PPC_MGSUVD) += mgsuvd.o
10obj-$(CONFIG_TQM8XX) += tqm8xx_setup.o
diff --git a/arch/powerpc/platforms/8xx/tqm8xx_setup.c b/arch/powerpc/platforms/8xx/tqm8xx_setup.c
new file mode 100644
index 000000000000..b71c650fbb11
--- /dev/null
+++ b/arch/powerpc/platforms/8xx/tqm8xx_setup.c
@@ -0,0 +1,156 @@
1/*
2 * Platform setup for the MPC8xx based boards from TQM.
3 *
4 * Heiko Schocher <hs@denx.de>
5 * Copyright 2010 DENX Software Engineering GmbH
6 *
7 * based on:
8 * Vitaly Bordug <vbordug@ru.mvista.com>
9 *
10 * Copyright 2005 MontaVista Software Inc.
11 *
12 * Heavily modified by Scott Wood <scottwood@freescale.com>
13 * Copyright 2007 Freescale Semiconductor, Inc.
14 *
15 * This file is licensed under the terms of the GNU General Public License
16 * version 2. This program is licensed "as is" without any warranty of any
17 * kind, whether express or implied.
18 */
19
20#include <linux/init.h>
21#include <linux/module.h>
22#include <linux/param.h>
23#include <linux/string.h>
24#include <linux/ioport.h>
25#include <linux/device.h>
26#include <linux/delay.h>
27
28#include <linux/fs_enet_pd.h>
29#include <linux/fs_uart_pd.h>
30#include <linux/fsl_devices.h>
31#include <linux/mii.h>
32#include <linux/of_platform.h>
33
34#include <asm/delay.h>
35#include <asm/io.h>
36#include <asm/machdep.h>
37#include <asm/page.h>
38#include <asm/processor.h>
39#include <asm/system.h>
40#include <asm/time.h>
41#include <asm/mpc8xx.h>
42#include <asm/8xx_immap.h>
43#include <asm/cpm1.h>
44#include <asm/fs_pd.h>
45#include <asm/udbg.h>
46
47#include "mpc8xx.h"
48
49struct cpm_pin {
50 int port, pin, flags;
51};
52
53static struct __initdata cpm_pin tqm8xx_pins[] = {
54 /* SMC1 */
55 {CPM_PORTB, 24, CPM_PIN_INPUT}, /* RX */
56 {CPM_PORTB, 25, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TX */
57
58 /* SCC1 */
59 {CPM_PORTA, 5, CPM_PIN_INPUT}, /* CLK1 */
60 {CPM_PORTA, 7, CPM_PIN_INPUT}, /* CLK2 */
61 {CPM_PORTA, 14, CPM_PIN_INPUT}, /* TX */
62 {CPM_PORTA, 15, CPM_PIN_INPUT}, /* RX */
63 {CPM_PORTC, 15, CPM_PIN_INPUT | CPM_PIN_SECONDARY}, /* TENA */
64 {CPM_PORTC, 10, CPM_PIN_INPUT | CPM_PIN_SECONDARY | CPM_PIN_GPIO},
65 {CPM_PORTC, 11, CPM_PIN_INPUT | CPM_PIN_SECONDARY | CPM_PIN_GPIO},
66};
67
68static struct __initdata cpm_pin tqm8xx_fec_pins[] = {
69 /* MII */
70 {CPM_PORTD, 3, CPM_PIN_OUTPUT},
71 {CPM_PORTD, 4, CPM_PIN_OUTPUT},
72 {CPM_PORTD, 5, CPM_PIN_OUTPUT},
73 {CPM_PORTD, 6, CPM_PIN_OUTPUT},
74 {CPM_PORTD, 7, CPM_PIN_OUTPUT},
75 {CPM_PORTD, 8, CPM_PIN_OUTPUT},
76 {CPM_PORTD, 9, CPM_PIN_OUTPUT},
77 {CPM_PORTD, 10, CPM_PIN_OUTPUT},
78 {CPM_PORTD, 11, CPM_PIN_OUTPUT},
79 {CPM_PORTD, 12, CPM_PIN_OUTPUT},
80 {CPM_PORTD, 13, CPM_PIN_OUTPUT},
81 {CPM_PORTD, 14, CPM_PIN_OUTPUT},
82 {CPM_PORTD, 15, CPM_PIN_OUTPUT},
83};
84
85static void __init init_pins(int n, struct cpm_pin *pin)
86{
87 int i;
88
89 for (i = 0; i < n; i++) {
90 cpm1_set_pin(pin->port, pin->pin, pin->flags);
91 pin++;
92 }
93}
94
95static void __init init_ioports(void)
96{
97 struct device_node *dnode;
98 struct property *prop;
99 int len;
100
101 init_pins(ARRAY_SIZE(tqm8xx_pins), &tqm8xx_pins[0]);
102
103 cpm1_clk_setup(CPM_CLK_SMC1, CPM_BRG1, CPM_CLK_RTX);
104
105 dnode = of_find_node_by_name(NULL, "aliases");
106 if (dnode == NULL)
107 return;
108 prop = of_find_property(dnode, "ethernet1", &len);
109 if (prop == NULL)
110 return;
111
112 /* init FEC pins */
113 init_pins(ARRAY_SIZE(tqm8xx_fec_pins), &tqm8xx_fec_pins[0]);
114}
115
116static void __init tqm8xx_setup_arch(void)
117{
118 cpm_reset();
119 init_ioports();
120}
121
122static int __init tqm8xx_probe(void)
123{
124 unsigned long node = of_get_flat_dt_root();
125
126 return of_flat_dt_is_compatible(node, "tqc,tqm8xx");
127}
128
129static struct of_device_id __initdata of_bus_ids[] = {
130 { .name = "soc", },
131 { .name = "cpm", },
132 { .name = "localbus", },
133 { .compatible = "simple-bus" },
134 {},
135};
136
137static int __init declare_of_platform_devices(void)
138{
139 of_platform_bus_probe(NULL, of_bus_ids, NULL);
140
141 return 0;
142}
143machine_device_initcall(tqm8xx, declare_of_platform_devices);
144
145define_machine(tqm8xx) {
146 .name = "TQM8xx",
147 .probe = tqm8xx_probe,
148 .setup_arch = tqm8xx_setup_arch,
149 .init_IRQ = mpc8xx_pics_init,
150 .get_irq = mpc8xx_get_irq,
151 .restart = mpc8xx_restart,
152 .calibrate_decr = mpc8xx_calibrate_decr,
153 .set_rtc_time = mpc8xx_set_rtc_time,
154 .get_rtc_time = mpc8xx_get_rtc_time,
155 .progress = udbg_progress,
156};
diff --git a/arch/powerpc/platforms/amigaone/setup.c b/arch/powerpc/platforms/amigaone/setup.c
index fb4eb0df054c..03aabc0e16ac 100644
--- a/arch/powerpc/platforms/amigaone/setup.c
+++ b/arch/powerpc/platforms/amigaone/setup.c
@@ -13,12 +13,13 @@
13 */ 13 */
14 14
15#include <linux/kernel.h> 15#include <linux/kernel.h>
16#include <linux/of.h>
17#include <linux/of_address.h>
16#include <linux/seq_file.h> 18#include <linux/seq_file.h>
17#include <generated/utsrelease.h> 19#include <generated/utsrelease.h>
18 20
19#include <asm/machdep.h> 21#include <asm/machdep.h>
20#include <asm/cputable.h> 22#include <asm/cputable.h>
21#include <asm/prom.h>
22#include <asm/pci-bridge.h> 23#include <asm/pci-bridge.h>
23#include <asm/i8259.h> 24#include <asm/i8259.h>
24#include <asm/time.h> 25#include <asm/time.h>
diff --git a/arch/powerpc/platforms/cell/axon_msi.c b/arch/powerpc/platforms/cell/axon_msi.c
index 6257e5378615..97085530aa63 100644
--- a/arch/powerpc/platforms/cell/axon_msi.c
+++ b/arch/powerpc/platforms/cell/axon_msi.c
@@ -328,7 +328,7 @@ static struct irq_host_ops msic_host_ops = {
328 .map = msic_host_map, 328 .map = msic_host_map,
329}; 329};
330 330
331static int axon_msi_shutdown(struct of_device *device) 331static int axon_msi_shutdown(struct platform_device *device)
332{ 332{
333 struct axon_msic *msic = dev_get_drvdata(&device->dev); 333 struct axon_msic *msic = dev_get_drvdata(&device->dev);
334 u32 tmp; 334 u32 tmp;
@@ -342,7 +342,7 @@ static int axon_msi_shutdown(struct of_device *device)
342 return 0; 342 return 0;
343} 343}
344 344
345static int axon_msi_probe(struct of_device *device, 345static int axon_msi_probe(struct platform_device *device,
346 const struct of_device_id *device_id) 346 const struct of_device_id *device_id)
347{ 347{
348 struct device_node *dn = device->dev.of_node; 348 struct device_node *dn = device->dev.of_node;
diff --git a/arch/powerpc/platforms/cell/beat_iommu.c b/arch/powerpc/platforms/cell/beat_iommu.c
index 39d361c5c6d2..beec405eb6f8 100644
--- a/arch/powerpc/platforms/cell/beat_iommu.c
+++ b/arch/powerpc/platforms/cell/beat_iommu.c
@@ -108,7 +108,7 @@ static int __init celleb_init_iommu(void)
108 celleb_init_direct_mapping(); 108 celleb_init_direct_mapping();
109 set_pci_dma_ops(&dma_direct_ops); 109 set_pci_dma_ops(&dma_direct_ops);
110 ppc_md.pci_dma_dev_setup = celleb_pci_dma_dev_setup; 110 ppc_md.pci_dma_dev_setup = celleb_pci_dma_dev_setup;
111 bus_register_notifier(&of_platform_bus_type, &celleb_of_bus_notifier); 111 bus_register_notifier(&platform_bus_type, &celleb_of_bus_notifier);
112 112
113 return 0; 113 return 0;
114} 114}
diff --git a/arch/powerpc/platforms/cell/iommu.c b/arch/powerpc/platforms/cell/iommu.c
index 3712900471ba..58b13ce3847e 100644
--- a/arch/powerpc/platforms/cell/iommu.c
+++ b/arch/powerpc/platforms/cell/iommu.c
@@ -1204,7 +1204,7 @@ static int __init cell_iommu_init(void)
1204 /* Register callbacks on OF platform device addition/removal 1204 /* Register callbacks on OF platform device addition/removal
1205 * to handle linking them to the right DMA operations 1205 * to handle linking them to the right DMA operations
1206 */ 1206 */
1207 bus_register_notifier(&of_platform_bus_type, &cell_of_bus_notifier); 1207 bus_register_notifier(&platform_bus_type, &cell_of_bus_notifier);
1208 1208
1209 return 0; 1209 return 0;
1210} 1210}
diff --git a/arch/powerpc/platforms/cell/qpace_setup.c b/arch/powerpc/platforms/cell/qpace_setup.c
index c5ce02e84c8e..1b5749042756 100644
--- a/arch/powerpc/platforms/cell/qpace_setup.c
+++ b/arch/powerpc/platforms/cell/qpace_setup.c
@@ -61,12 +61,24 @@ static void qpace_progress(char *s, unsigned short hex)
61 printk("*** %04x : %s\n", hex, s ? s : ""); 61 printk("*** %04x : %s\n", hex, s ? s : "");
62} 62}
63 63
64static const struct of_device_id qpace_bus_ids[] __initdata = {
65 { .type = "soc", },
66 { .compatible = "soc", },
67 { .type = "spider", },
68 { .type = "axon", },
69 { .type = "plb5", },
70 { .type = "plb4", },
71 { .type = "opb", },
72 { .type = "ebc", },
73 {},
74};
75
64static int __init qpace_publish_devices(void) 76static int __init qpace_publish_devices(void)
65{ 77{
66 int node; 78 int node;
67 79
68 /* Publish OF platform devices for southbridge IOs */ 80 /* Publish OF platform devices for southbridge IOs */
69 of_platform_bus_probe(NULL, NULL, NULL); 81 of_platform_bus_probe(NULL, qpace_bus_ids, NULL);
70 82
71 /* There is no device for the MIC memory controller, thus we create 83 /* There is no device for the MIC memory controller, thus we create
72 * a platform device for it to attach the EDAC driver to. 84 * a platform device for it to attach the EDAC driver to.
diff --git a/arch/powerpc/platforms/cell/setup.c b/arch/powerpc/platforms/cell/setup.c
index 50385db586bd..691995761b3d 100644
--- a/arch/powerpc/platforms/cell/setup.c
+++ b/arch/powerpc/platforms/cell/setup.c
@@ -141,6 +141,18 @@ static int __devinit cell_setup_phb(struct pci_controller *phb)
141 return 0; 141 return 0;
142} 142}
143 143
144static const struct of_device_id cell_bus_ids[] __initdata = {
145 { .type = "soc", },
146 { .compatible = "soc", },
147 { .type = "spider", },
148 { .type = "axon", },
149 { .type = "plb5", },
150 { .type = "plb4", },
151 { .type = "opb", },
152 { .type = "ebc", },
153 {},
154};
155
144static int __init cell_publish_devices(void) 156static int __init cell_publish_devices(void)
145{ 157{
146 struct device_node *root = of_find_node_by_path("/"); 158 struct device_node *root = of_find_node_by_path("/");
@@ -148,7 +160,7 @@ static int __init cell_publish_devices(void)
148 int node; 160 int node;
149 161
150 /* Publish OF platform devices for southbridge IOs */ 162 /* Publish OF platform devices for southbridge IOs */
151 of_platform_bus_probe(NULL, NULL, NULL); 163 of_platform_bus_probe(NULL, cell_bus_ids, NULL);
152 164
153 /* On spider based blades, we need to manually create the OF 165 /* On spider based blades, we need to manually create the OF
154 * platform devices for the PCI host bridges 166 * platform devices for the PCI host bridges
diff --git a/arch/powerpc/platforms/iseries/mf.c b/arch/powerpc/platforms/iseries/mf.c
index d2c1d497846e..33e5fc7334fc 100644
--- a/arch/powerpc/platforms/iseries/mf.c
+++ b/arch/powerpc/platforms/iseries/mf.c
@@ -30,6 +30,7 @@
30#include <linux/init.h> 30#include <linux/init.h>
31#include <linux/completion.h> 31#include <linux/completion.h>
32#include <linux/delay.h> 32#include <linux/delay.h>
33#include <linux/proc_fs.h>
33#include <linux/dma-mapping.h> 34#include <linux/dma-mapping.h>
34#include <linux/bcd.h> 35#include <linux/bcd.h>
35#include <linux/rtc.h> 36#include <linux/rtc.h>
diff --git a/arch/powerpc/platforms/iseries/vio.c b/arch/powerpc/platforms/iseries/vio.c
index 00b6730bc48f..b6db7cef83b4 100644
--- a/arch/powerpc/platforms/iseries/vio.c
+++ b/arch/powerpc/platforms/iseries/vio.c
@@ -87,12 +87,11 @@ static struct device_node *new_node(const char *path,
87 87
88 if (!np) 88 if (!np)
89 return NULL; 89 return NULL;
90 np->full_name = kmalloc(strlen(path) + 1, GFP_KERNEL); 90 np->full_name = kstrdup(path, GFP_KERNEL);
91 if (!np->full_name) { 91 if (!np->full_name) {
92 kfree(np); 92 kfree(np);
93 return NULL; 93 return NULL;
94 } 94 }
95 strcpy(np->full_name, path);
96 of_node_set_flag(np, OF_DYNAMIC); 95 of_node_set_flag(np, OF_DYNAMIC);
97 kref_init(&np->kref); 96 kref_init(&np->kref);
98 np->parent = of_node_get(parent); 97 np->parent = of_node_get(parent);
diff --git a/arch/powerpc/platforms/pasemi/gpio_mdio.c b/arch/powerpc/platforms/pasemi/gpio_mdio.c
index 627ee089e75d..a5d907b5a4c2 100644
--- a/arch/powerpc/platforms/pasemi/gpio_mdio.c
+++ b/arch/powerpc/platforms/pasemi/gpio_mdio.c
@@ -216,7 +216,7 @@ static int gpio_mdio_reset(struct mii_bus *bus)
216} 216}
217 217
218 218
219static int __devinit gpio_mdio_probe(struct of_device *ofdev, 219static int __devinit gpio_mdio_probe(struct platform_device *ofdev,
220 const struct of_device_id *match) 220 const struct of_device_id *match)
221{ 221{
222 struct device *dev = &ofdev->dev; 222 struct device *dev = &ofdev->dev;
@@ -275,7 +275,7 @@ out:
275} 275}
276 276
277 277
278static int gpio_mdio_remove(struct of_device *dev) 278static int gpio_mdio_remove(struct platform_device *dev)
279{ 279{
280 struct mii_bus *bus = dev_get_drvdata(&dev->dev); 280 struct mii_bus *bus = dev_get_drvdata(&dev->dev);
281 281
diff --git a/arch/powerpc/platforms/powermac/cpufreq_32.c b/arch/powerpc/platforms/powermac/cpufreq_32.c
index 1e9eba175ff0..415ca6d6b273 100644
--- a/arch/powerpc/platforms/powermac/cpufreq_32.c
+++ b/arch/powerpc/platforms/powermac/cpufreq_32.c
@@ -310,8 +310,12 @@ static int pmu_set_cpu_speed(int low_speed)
310 /* Restore low level PMU operations */ 310 /* Restore low level PMU operations */
311 pmu_unlock(); 311 pmu_unlock();
312 312
313 /* Restore decrementer */ 313 /*
314 wakeup_decrementer(); 314 * Restore decrementer; we'll take a decrementer interrupt
315 * as soon as interrupts are re-enabled and the generic
316 * clockevents code will reprogram it with the right value.
317 */
318 set_dec(1);
315 319
316 /* Restore interrupts */ 320 /* Restore interrupts */
317 mpic_cpu_set_priority(pic_prio); 321 mpic_cpu_set_priority(pic_prio);
diff --git a/arch/powerpc/platforms/powermac/feature.c b/arch/powerpc/platforms/powermac/feature.c
index 9e1b9fd75206..39df6ab1735a 100644
--- a/arch/powerpc/platforms/powermac/feature.c
+++ b/arch/powerpc/platforms/powermac/feature.c
@@ -21,6 +21,8 @@
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/kernel.h> 22#include <linux/kernel.h>
23#include <linux/sched.h> 23#include <linux/sched.h>
24#include <linux/of.h>
25#include <linux/of_address.h>
24#include <linux/spinlock.h> 26#include <linux/spinlock.h>
25#include <linux/adb.h> 27#include <linux/adb.h>
26#include <linux/pmu.h> 28#include <linux/pmu.h>
@@ -2191,7 +2193,11 @@ static struct pmac_mb_def pmac_mb_defs[] = {
2191 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features, 2193 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2192 PMAC_MB_MAY_SLEEP, 2194 PMAC_MB_MAY_SLEEP,
2193 }, 2195 },
2194 { "iMac,1", "iMac (first generation)", 2196 { "PowerMac10,2", "Mac mini (Late 2005)",
2197 PMAC_TYPE_UNKNOWN_INTREPID, intrepid_features,
2198 PMAC_MB_MAY_SLEEP,
2199 },
2200 { "iMac,1", "iMac (first generation)",
2195 PMAC_TYPE_ORIG_IMAC, paddington_features, 2201 PMAC_TYPE_ORIG_IMAC, paddington_features,
2196 0 2202 0
2197 }, 2203 },
diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c
index 630a533d0e59..890d5f72b198 100644
--- a/arch/powerpc/platforms/powermac/pic.c
+++ b/arch/powerpc/platforms/powermac/pic.c
@@ -46,6 +46,10 @@ struct pmac_irq_hw {
46 unsigned int level; 46 unsigned int level;
47}; 47};
48 48
49/* Workaround flags for 32bit powermac machines */
50unsigned int of_irq_workarounds;
51struct device_node *of_irq_dflt_pic;
52
49/* Default addresses */ 53/* Default addresses */
50static volatile struct pmac_irq_hw __iomem *pmac_irq_hw[4]; 54static volatile struct pmac_irq_hw __iomem *pmac_irq_hw[4];
51 55
@@ -428,6 +432,42 @@ static void __init pmac_pic_probe_oldstyle(void)
428 setup_irq(irq_create_mapping(NULL, 20), &xmon_action); 432 setup_irq(irq_create_mapping(NULL, 20), &xmon_action);
429#endif 433#endif
430} 434}
435
436int of_irq_map_oldworld(struct device_node *device, int index,
437 struct of_irq *out_irq)
438{
439 const u32 *ints = NULL;
440 int intlen;
441
442 /*
443 * Old machines just have a list of interrupt numbers
444 * and no interrupt-controller nodes. We also have dodgy
445 * cases where the APPL,interrupts property is completely
446 * missing behind pci-pci bridges and we have to get it
447 * from the parent (the bridge itself, as apple just wired
448 * everything together on these)
449 */
450 while (device) {
451 ints = of_get_property(device, "AAPL,interrupts", &intlen);
452 if (ints != NULL)
453 break;
454 device = device->parent;
455 if (device && strcmp(device->type, "pci") != 0)
456 break;
457 }
458 if (ints == NULL)
459 return -EINVAL;
460 intlen /= sizeof(u32);
461
462 if (index >= intlen)
463 return -EINVAL;
464
465 out_irq->controller = NULL;
466 out_irq->specifier[0] = ints[index];
467 out_irq->size = 1;
468
469 return 0;
470}
431#endif /* CONFIG_PPC32 */ 471#endif /* CONFIG_PPC32 */
432 472
433static void pmac_u3_cascade(unsigned int irq, struct irq_desc *desc) 473static void pmac_u3_cascade(unsigned int irq, struct irq_desc *desc)
@@ -559,19 +599,39 @@ static int __init pmac_pic_probe_mpic(void)
559 599
560void __init pmac_pic_init(void) 600void __init pmac_pic_init(void)
561{ 601{
562 unsigned int flags = 0;
563
564 /* We configure the OF parsing based on our oldworld vs. newworld 602 /* We configure the OF parsing based on our oldworld vs. newworld
565 * platform type and wether we were booted by BootX. 603 * platform type and wether we were booted by BootX.
566 */ 604 */
567#ifdef CONFIG_PPC32 605#ifdef CONFIG_PPC32
568 if (!pmac_newworld) 606 if (!pmac_newworld)
569 flags |= OF_IMAP_OLDWORLD_MAC; 607 of_irq_workarounds |= OF_IMAP_OLDWORLD_MAC;
570 if (of_get_property(of_chosen, "linux,bootx", NULL) != NULL) 608 if (of_get_property(of_chosen, "linux,bootx", NULL) != NULL)
571 flags |= OF_IMAP_NO_PHANDLE; 609 of_irq_workarounds |= OF_IMAP_NO_PHANDLE;
572#endif /* CONFIG_PPC_32 */
573 610
574 of_irq_map_init(flags); 611 /* If we don't have phandles on a newworld, then try to locate a
612 * default interrupt controller (happens when booting with BootX).
613 * We do a first match here, hopefully, that only ever happens on
614 * machines with one controller.
615 */
616 if (pmac_newworld && (of_irq_workarounds & OF_IMAP_NO_PHANDLE)) {
617 struct device_node *np;
618
619 for_each_node_with_property(np, "interrupt-controller") {
620 /* Skip /chosen/interrupt-controller */
621 if (strcmp(np->name, "chosen") == 0)
622 continue;
623 /* It seems like at least one person wants
624 * to use BootX on a machine with an AppleKiwi
625 * controller which happens to pretend to be an
626 * interrupt controller too. */
627 if (strcmp(np->name, "AppleKiwi") == 0)
628 continue;
629 /* I think we found one ! */
630 of_irq_dflt_pic = np;
631 break;
632 }
633 }
634#endif /* CONFIG_PPC32 */
575 635
576 /* We first try to detect Apple's new Core99 chipset, since mac-io 636 /* We first try to detect Apple's new Core99 chipset, since mac-io
577 * is quite different on those machines and contains an IBM MPIC2. 637 * is quite different on those machines and contains an IBM MPIC2.
diff --git a/arch/powerpc/platforms/ps3/htab.c b/arch/powerpc/platforms/ps3/htab.c
index 2c0ed87f2024..3124cf791ebb 100644
--- a/arch/powerpc/platforms/ps3/htab.c
+++ b/arch/powerpc/platforms/ps3/htab.c
@@ -136,7 +136,7 @@ static long ps3_hpte_updatepp(unsigned long slot, unsigned long newpp,
136 * As lv1_read_htab_entries() does not give us the RPN, we can 136 * As lv1_read_htab_entries() does not give us the RPN, we can
137 * not synthesize the new hpte_r value here, and therefore can 137 * not synthesize the new hpte_r value here, and therefore can
138 * not update the hpte with lv1_insert_htab_entry(), so we 138 * not update the hpte with lv1_insert_htab_entry(), so we
139 * insted invalidate it and ask the caller to update it via 139 * instead invalidate it and ask the caller to update it via
140 * ps3_hpte_insert() by returning a -1 value. 140 * ps3_hpte_insert() by returning a -1 value.
141 */ 141 */
142 if (!HPTE_V_COMPARE(hpte_v, want_v) || !(hpte_v & HPTE_V_VALID)) { 142 if (!HPTE_V_COMPARE(hpte_v, want_v) || !(hpte_v & HPTE_V_VALID)) {
diff --git a/arch/powerpc/platforms/pseries/Makefile b/arch/powerpc/platforms/pseries/Makefile
index 3dbef309bc8d..046ace9c4381 100644
--- a/arch/powerpc/platforms/pseries/Makefile
+++ b/arch/powerpc/platforms/pseries/Makefile
@@ -26,3 +26,7 @@ obj-$(CONFIG_HCALL_STATS) += hvCall_inst.o
26obj-$(CONFIG_PHYP_DUMP) += phyp_dump.o 26obj-$(CONFIG_PHYP_DUMP) += phyp_dump.o
27obj-$(CONFIG_CMM) += cmm.o 27obj-$(CONFIG_CMM) += cmm.o
28obj-$(CONFIG_DTL) += dtl.o 28obj-$(CONFIG_DTL) += dtl.o
29
30ifeq ($(CONFIG_PPC_PSERIES),y)
31obj-$(CONFIG_SUSPEND) += suspend.o
32endif
diff --git a/arch/powerpc/platforms/pseries/dlpar.c b/arch/powerpc/platforms/pseries/dlpar.c
index d71e58584086..227c1c3d585e 100644
--- a/arch/powerpc/platforms/pseries/dlpar.c
+++ b/arch/powerpc/platforms/pseries/dlpar.c
@@ -463,6 +463,7 @@ static int dlpar_offline_cpu(struct device_node *dn)
463 break; 463 break;
464 464
465 if (get_cpu_current_state(cpu) == CPU_STATE_ONLINE) { 465 if (get_cpu_current_state(cpu) == CPU_STATE_ONLINE) {
466 set_preferred_offline_state(cpu, CPU_STATE_OFFLINE);
466 cpu_maps_update_done(); 467 cpu_maps_update_done();
467 rc = cpu_down(cpu); 468 rc = cpu_down(cpu);
468 if (rc) 469 if (rc)
diff --git a/arch/powerpc/platforms/pseries/eeh_cache.c b/arch/powerpc/platforms/pseries/eeh_cache.c
index 30b987b73c20..8ed0d2d0e1b5 100644
--- a/arch/powerpc/platforms/pseries/eeh_cache.c
+++ b/arch/powerpc/platforms/pseries/eeh_cache.c
@@ -288,8 +288,7 @@ void __init pci_addr_cache_build(void)
288 288
289 spin_lock_init(&pci_io_addr_cache_root.piar_lock); 289 spin_lock_init(&pci_io_addr_cache_root.piar_lock);
290 290
291 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { 291 for_each_pci_dev(dev) {
292
293 pci_addr_cache_insert_device(dev); 292 pci_addr_cache_insert_device(dev);
294 293
295 dn = pci_device_to_OF_node(dev); 294 dn = pci_device_to_OF_node(dev);
diff --git a/arch/powerpc/platforms/pseries/event_sources.c b/arch/powerpc/platforms/pseries/event_sources.c
index e889c9d9586a..2605c310166a 100644
--- a/arch/powerpc/platforms/pseries/event_sources.c
+++ b/arch/powerpc/platforms/pseries/event_sources.c
@@ -41,9 +41,12 @@ void request_event_sources_irqs(struct device_node *np,
41 if (count > 15) 41 if (count > 15)
42 break; 42 break;
43 virqs[count] = irq_create_mapping(NULL, *(opicprop++)); 43 virqs[count] = irq_create_mapping(NULL, *(opicprop++));
44 if (virqs[count] == NO_IRQ) 44 if (virqs[count] == NO_IRQ) {
45 printk(KERN_ERR "Unable to allocate interrupt " 45 pr_err("event-sources: Unable to allocate "
46 "number for %s\n", np->full_name); 46 "interrupt number for %s\n",
47 np->full_name);
48 WARN_ON(1);
49 }
47 else 50 else
48 count++; 51 count++;
49 52
@@ -59,9 +62,12 @@ void request_event_sources_irqs(struct device_node *np,
59 virqs[count] = irq_create_of_mapping(oirq.controller, 62 virqs[count] = irq_create_of_mapping(oirq.controller,
60 oirq.specifier, 63 oirq.specifier,
61 oirq.size); 64 oirq.size);
62 if (virqs[count] == NO_IRQ) 65 if (virqs[count] == NO_IRQ) {
63 printk(KERN_ERR "Unable to allocate interrupt " 66 pr_err("event-sources: Unable to allocate "
64 "number for %s\n", np->full_name); 67 "interrupt number for %s\n",
68 np->full_name);
69 WARN_ON(1);
70 }
65 else 71 else
66 count++; 72 count++;
67 } 73 }
@@ -70,8 +76,9 @@ void request_event_sources_irqs(struct device_node *np,
70 /* Now request them */ 76 /* Now request them */
71 for (i = 0; i < count; i++) { 77 for (i = 0; i < count; i++) {
72 if (request_irq(virqs[i], handler, 0, name, NULL)) { 78 if (request_irq(virqs[i], handler, 0, name, NULL)) {
73 printk(KERN_ERR "Unable to request interrupt %d for " 79 pr_err("event-sources: Unable to request interrupt "
74 "%s\n", virqs[i], np->full_name); 80 "%d for %s\n", virqs[i], np->full_name);
81 WARN_ON(1);
75 return; 82 return;
76 } 83 }
77 } 84 }
diff --git a/arch/powerpc/platforms/pseries/hotplug-cpu.c b/arch/powerpc/platforms/pseries/hotplug-cpu.c
index 8f85f399ab9f..fd50ccd4bac1 100644
--- a/arch/powerpc/platforms/pseries/hotplug-cpu.c
+++ b/arch/powerpc/platforms/pseries/hotplug-cpu.c
@@ -116,6 +116,9 @@ static void pseries_mach_cpu_die(void)
116 116
117 if (get_preferred_offline_state(cpu) == CPU_STATE_INACTIVE) { 117 if (get_preferred_offline_state(cpu) == CPU_STATE_INACTIVE) {
118 set_cpu_current_state(cpu, CPU_STATE_INACTIVE); 118 set_cpu_current_state(cpu, CPU_STATE_INACTIVE);
119 if (ppc_md.suspend_disable_cpu)
120 ppc_md.suspend_disable_cpu();
121
119 cede_latency_hint = 2; 122 cede_latency_hint = 2;
120 123
121 get_lppaca()->idle = 1; 124 get_lppaca()->idle = 1;
@@ -190,12 +193,12 @@ static void pseries_cpu_die(unsigned int cpu)
190 193
191 if (get_preferred_offline_state(cpu) == CPU_STATE_INACTIVE) { 194 if (get_preferred_offline_state(cpu) == CPU_STATE_INACTIVE) {
192 cpu_status = 1; 195 cpu_status = 1;
193 for (tries = 0; tries < 1000; tries++) { 196 for (tries = 0; tries < 5000; tries++) {
194 if (get_cpu_current_state(cpu) == CPU_STATE_INACTIVE) { 197 if (get_cpu_current_state(cpu) == CPU_STATE_INACTIVE) {
195 cpu_status = 0; 198 cpu_status = 0;
196 break; 199 break;
197 } 200 }
198 cpu_relax(); 201 msleep(1);
199 } 202 }
200 } else if (get_preferred_offline_state(cpu) == CPU_STATE_OFFLINE) { 203 } else if (get_preferred_offline_state(cpu) == CPU_STATE_OFFLINE) {
201 204
diff --git a/arch/powerpc/platforms/pseries/ras.c b/arch/powerpc/platforms/pseries/ras.c
index 41a3e9a039ed..a4fc6da87c2e 100644
--- a/arch/powerpc/platforms/pseries/ras.c
+++ b/arch/powerpc/platforms/pseries/ras.c
@@ -61,7 +61,6 @@ static int ras_check_exception_token;
61 61
62#define EPOW_SENSOR_TOKEN 9 62#define EPOW_SENSOR_TOKEN 9
63#define EPOW_SENSOR_INDEX 0 63#define EPOW_SENSOR_INDEX 0
64#define RAS_VECTOR_OFFSET 0x500
65 64
66static irqreturn_t ras_epow_interrupt(int irq, void *dev_id); 65static irqreturn_t ras_epow_interrupt(int irq, void *dev_id);
67static irqreturn_t ras_error_interrupt(int irq, void *dev_id); 66static irqreturn_t ras_error_interrupt(int irq, void *dev_id);
@@ -121,7 +120,7 @@ static irqreturn_t ras_epow_interrupt(int irq, void *dev_id)
121 spin_lock(&ras_log_buf_lock); 120 spin_lock(&ras_log_buf_lock);
122 121
123 status = rtas_call(ras_check_exception_token, 6, 1, NULL, 122 status = rtas_call(ras_check_exception_token, 6, 1, NULL,
124 RAS_VECTOR_OFFSET, 123 RTAS_VECTOR_EXTERNAL_INTERRUPT,
125 irq_map[irq].hwirq, 124 irq_map[irq].hwirq,
126 RTAS_EPOW_WARNING | RTAS_POWERMGM_EVENTS, 125 RTAS_EPOW_WARNING | RTAS_POWERMGM_EVENTS,
127 critical, __pa(&ras_log_buf), 126 critical, __pa(&ras_log_buf),
@@ -156,7 +155,7 @@ static irqreturn_t ras_error_interrupt(int irq, void *dev_id)
156 spin_lock(&ras_log_buf_lock); 155 spin_lock(&ras_log_buf_lock);
157 156
158 status = rtas_call(ras_check_exception_token, 6, 1, NULL, 157 status = rtas_call(ras_check_exception_token, 6, 1, NULL,
159 RAS_VECTOR_OFFSET, 158 RTAS_VECTOR_EXTERNAL_INTERRUPT,
160 irq_map[irq].hwirq, 159 irq_map[irq].hwirq,
161 RTAS_INTERNAL_ERROR, 1 /*Time Critical */, 160 RTAS_INTERNAL_ERROR, 1 /*Time Critical */,
162 __pa(&ras_log_buf), 161 __pa(&ras_log_buf),
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index 1a58637bcea5..57ddbb43b33a 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -118,12 +118,10 @@ static int pSeries_reconfig_add_node(const char *path, struct property *proplist
118 if (!np) 118 if (!np)
119 goto out_err; 119 goto out_err;
120 120
121 np->full_name = kmalloc(strlen(path) + 1, GFP_KERNEL); 121 np->full_name = kstrdup(path, GFP_KERNEL);
122 if (!np->full_name) 122 if (!np->full_name)
123 goto out_err; 123 goto out_err;
124 124
125 strcpy(np->full_name, path);
126
127 np->properties = proplist; 125 np->properties = proplist;
128 of_node_set_flag(np, OF_DYNAMIC); 126 of_node_set_flag(np, OF_DYNAMIC);
129 kref_init(&np->kref); 127 kref_init(&np->kref);
diff --git a/arch/powerpc/platforms/pseries/suspend.c b/arch/powerpc/platforms/pseries/suspend.c
new file mode 100644
index 000000000000..ed72098bb4e3
--- /dev/null
+++ b/arch/powerpc/platforms/pseries/suspend.c
@@ -0,0 +1,214 @@
1/*
2 * Copyright (C) 2010 Brian King IBM Corporation
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18
19#include <linux/delay.h>
20#include <linux/suspend.h>
21#include <asm/firmware.h>
22#include <asm/hvcall.h>
23#include <asm/machdep.h>
24#include <asm/mmu.h>
25#include <asm/rtas.h>
26
27static u64 stream_id;
28static struct sys_device suspend_sysdev;
29static DECLARE_COMPLETION(suspend_work);
30static struct rtas_suspend_me_data suspend_data;
31static atomic_t suspending;
32
33/**
34 * pseries_suspend_begin - First phase of hibernation
35 *
36 * Check to ensure we are in a valid state to hibernate
37 *
38 * Return value:
39 * 0 on success / other on failure
40 **/
41static int pseries_suspend_begin(suspend_state_t state)
42{
43 long vasi_state, rc;
44 unsigned long retbuf[PLPAR_HCALL_BUFSIZE];
45
46 /* Make sure the state is valid */
47 rc = plpar_hcall(H_VASI_STATE, retbuf, stream_id);
48
49 vasi_state = retbuf[0];
50
51 if (rc) {
52 pr_err("pseries_suspend_begin: vasi_state returned %ld\n",rc);
53 return rc;
54 } else if (vasi_state == H_VASI_ENABLED) {
55 return -EAGAIN;
56 } else if (vasi_state != H_VASI_SUSPENDING) {
57 pr_err("pseries_suspend_begin: vasi_state returned state %ld\n",
58 vasi_state);
59 return -EIO;
60 }
61
62 return 0;
63}
64
65/**
66 * pseries_suspend_cpu - Suspend a single CPU
67 *
68 * Makes the H_JOIN call to suspend the CPU
69 *
70 **/
71static int pseries_suspend_cpu(void)
72{
73 if (atomic_read(&suspending))
74 return rtas_suspend_cpu(&suspend_data);
75 return 0;
76}
77
78/**
79 * pseries_suspend_enter - Final phase of hibernation
80 *
81 * Return value:
82 * 0 on success / other on failure
83 **/
84static int pseries_suspend_enter(suspend_state_t state)
85{
86 int rc = rtas_suspend_last_cpu(&suspend_data);
87
88 atomic_set(&suspending, 0);
89 atomic_set(&suspend_data.done, 1);
90 return rc;
91}
92
93/**
94 * pseries_prepare_late - Prepare to suspend all other CPUs
95 *
96 * Return value:
97 * 0 on success / other on failure
98 **/
99static int pseries_prepare_late(void)
100{
101 atomic_set(&suspending, 1);
102 atomic_set(&suspend_data.working, 0);
103 atomic_set(&suspend_data.done, 0);
104 atomic_set(&suspend_data.error, 0);
105 suspend_data.complete = &suspend_work;
106 INIT_COMPLETION(suspend_work);
107 return 0;
108}
109
110/**
111 * store_hibernate - Initiate partition hibernation
112 * @classdev: sysdev class struct
113 * @attr: class device attribute struct
114 * @buf: buffer
115 * @count: buffer size
116 *
117 * Write the stream ID received from the HMC to this file
118 * to trigger hibernating the partition
119 *
120 * Return value:
121 * number of bytes printed to buffer / other on failure
122 **/
123static ssize_t store_hibernate(struct sysdev_class *classdev,
124 struct sysdev_class_attribute *attr,
125 const char *buf, size_t count)
126{
127 int rc;
128
129 if (!capable(CAP_SYS_ADMIN))
130 return -EPERM;
131
132 stream_id = simple_strtoul(buf, NULL, 16);
133
134 do {
135 rc = pseries_suspend_begin(PM_SUSPEND_MEM);
136 if (rc == -EAGAIN)
137 ssleep(1);
138 } while (rc == -EAGAIN);
139
140 if (!rc)
141 rc = pm_suspend(PM_SUSPEND_MEM);
142
143 stream_id = 0;
144
145 if (!rc)
146 rc = count;
147 return rc;
148}
149
150static SYSDEV_CLASS_ATTR(hibernate, S_IWUSR, NULL, store_hibernate);
151
152static struct sysdev_class suspend_sysdev_class = {
153 .name = "power",
154};
155
156static struct platform_suspend_ops pseries_suspend_ops = {
157 .valid = suspend_valid_only_mem,
158 .begin = pseries_suspend_begin,
159 .prepare_late = pseries_prepare_late,
160 .enter = pseries_suspend_enter,
161};
162
163/**
164 * pseries_suspend_sysfs_register - Register with sysfs
165 *
166 * Return value:
167 * 0 on success / other on failure
168 **/
169static int pseries_suspend_sysfs_register(struct sys_device *sysdev)
170{
171 int rc;
172
173 if ((rc = sysdev_class_register(&suspend_sysdev_class)))
174 return rc;
175
176 sysdev->id = 0;
177 sysdev->cls = &suspend_sysdev_class;
178
179 if ((rc = sysdev_class_create_file(&suspend_sysdev_class, &attr_hibernate)))
180 goto class_unregister;
181
182 return 0;
183
184class_unregister:
185 sysdev_class_unregister(&suspend_sysdev_class);
186 return rc;
187}
188
189/**
190 * pseries_suspend_init - initcall for pSeries suspend
191 *
192 * Return value:
193 * 0 on success / other on failure
194 **/
195static int __init pseries_suspend_init(void)
196{
197 int rc;
198
199 if (!machine_is(pseries) || !firmware_has_feature(FW_FEATURE_LPAR))
200 return 0;
201
202 suspend_data.token = rtas_token("ibm,suspend-me");
203 if (suspend_data.token == RTAS_UNKNOWN_SERVICE)
204 return 0;
205
206 if ((rc = pseries_suspend_sysfs_register(&suspend_sysdev)))
207 return rc;
208
209 ppc_md.suspend_disable_cpu = pseries_suspend_cpu;
210 suspend_set_ops(&pseries_suspend_ops);
211 return 0;
212}
213
214__initcall(pseries_suspend_init);
diff --git a/arch/powerpc/platforms/pseries/xics.c b/arch/powerpc/platforms/pseries/xics.c
index f19d19468393..5b22b07c8f67 100644
--- a/arch/powerpc/platforms/pseries/xics.c
+++ b/arch/powerpc/platforms/pseries/xics.c
@@ -549,8 +549,6 @@ static irqreturn_t xics_ipi_dispatch(int cpu)
549{ 549{
550 unsigned long *tgt = &per_cpu(xics_ipi_message, cpu); 550 unsigned long *tgt = &per_cpu(xics_ipi_message, cpu);
551 551
552 WARN_ON(cpu_is_offline(cpu));
553
554 mb(); /* order mmio clearing qirr */ 552 mb(); /* order mmio clearing qirr */
555 while (*tgt) { 553 while (*tgt) {
556 if (test_and_clear_bit(PPC_MSG_CALL_FUNCTION, tgt)) { 554 if (test_and_clear_bit(PPC_MSG_CALL_FUNCTION, tgt)) {
diff --git a/arch/powerpc/sysdev/axonram.c b/arch/powerpc/sysdev/axonram.c
index 402d2212162f..2659a60bd7b8 100644
--- a/arch/powerpc/sysdev/axonram.c
+++ b/arch/powerpc/sysdev/axonram.c
@@ -60,7 +60,7 @@
60static int azfs_major, azfs_minor; 60static int azfs_major, azfs_minor;
61 61
62struct axon_ram_bank { 62struct axon_ram_bank {
63 struct of_device *device; 63 struct platform_device *device;
64 struct gendisk *disk; 64 struct gendisk *disk;
65 unsigned int irq_id; 65 unsigned int irq_id;
66 unsigned long ph_addr; 66 unsigned long ph_addr;
@@ -72,7 +72,7 @@ struct axon_ram_bank {
72static ssize_t 72static ssize_t
73axon_ram_sysfs_ecc(struct device *dev, struct device_attribute *attr, char *buf) 73axon_ram_sysfs_ecc(struct device *dev, struct device_attribute *attr, char *buf)
74{ 74{
75 struct of_device *device = to_of_device(dev); 75 struct platform_device *device = to_platform_device(dev);
76 struct axon_ram_bank *bank = device->dev.platform_data; 76 struct axon_ram_bank *bank = device->dev.platform_data;
77 77
78 BUG_ON(!bank); 78 BUG_ON(!bank);
@@ -90,7 +90,7 @@ static DEVICE_ATTR(ecc, S_IRUGO, axon_ram_sysfs_ecc, NULL);
90static irqreturn_t 90static irqreturn_t
91axon_ram_irq_handler(int irq, void *dev) 91axon_ram_irq_handler(int irq, void *dev)
92{ 92{
93 struct of_device *device = dev; 93 struct platform_device *device = dev;
94 struct axon_ram_bank *bank = device->dev.platform_data; 94 struct axon_ram_bank *bank = device->dev.platform_data;
95 95
96 BUG_ON(!bank); 96 BUG_ON(!bank);
@@ -174,8 +174,8 @@ static const struct block_device_operations axon_ram_devops = {
174 * axon_ram_probe - probe() method for platform driver 174 * axon_ram_probe - probe() method for platform driver
175 * @device, @device_id: see of_platform_driver method 175 * @device, @device_id: see of_platform_driver method
176 */ 176 */
177static int 177static int axon_ram_probe(struct platform_device *device,
178axon_ram_probe(struct of_device *device, const struct of_device_id *device_id) 178 const struct of_device_id *device_id)
179{ 179{
180 static int axon_ram_bank_id = -1; 180 static int axon_ram_bank_id = -1;
181 struct axon_ram_bank *bank; 181 struct axon_ram_bank *bank;
@@ -304,7 +304,7 @@ failed:
304 * @device: see of_platform_driver method 304 * @device: see of_platform_driver method
305 */ 305 */
306static int 306static int
307axon_ram_remove(struct of_device *device) 307axon_ram_remove(struct platform_device *device)
308{ 308{
309 struct axon_ram_bank *bank = device->dev.platform_data; 309 struct axon_ram_bank *bank = device->dev.platform_data;
310 310
diff --git a/arch/powerpc/sysdev/bestcomm/bestcomm.c b/arch/powerpc/sysdev/bestcomm/bestcomm.c
index a7c5c470af14..650256115064 100644
--- a/arch/powerpc/sysdev/bestcomm/bestcomm.c
+++ b/arch/powerpc/sysdev/bestcomm/bestcomm.c
@@ -365,8 +365,8 @@ bcom_engine_cleanup(void)
365/* OF platform driver */ 365/* OF platform driver */
366/* ======================================================================== */ 366/* ======================================================================== */
367 367
368static int __devinit 368static int __devinit mpc52xx_bcom_probe(struct platform_device *op,
369mpc52xx_bcom_probe(struct of_device *op, const struct of_device_id *match) 369 const struct of_device_id *match)
370{ 370{
371 struct device_node *ofn_sram; 371 struct device_node *ofn_sram;
372 struct resource res_bcom; 372 struct resource res_bcom;
@@ -461,8 +461,7 @@ error_ofput:
461} 461}
462 462
463 463
464static int 464static int mpc52xx_bcom_remove(struct platform_device *op)
465mpc52xx_bcom_remove(struct of_device *op)
466{ 465{
467 /* Clean up the engine */ 466 /* Clean up the engine */
468 bcom_engine_cleanup(); 467 bcom_engine_cleanup();
diff --git a/arch/powerpc/sysdev/bestcomm/sram.c b/arch/powerpc/sysdev/bestcomm/sram.c
index 5d74ef7a651f..1225012a681a 100644
--- a/arch/powerpc/sysdev/bestcomm/sram.c
+++ b/arch/powerpc/sysdev/bestcomm/sram.c
@@ -11,6 +11,7 @@
11 * kind, whether express or implied. 11 * kind, whether express or implied.
12 */ 12 */
13 13
14#include <linux/err.h>
14#include <linux/kernel.h> 15#include <linux/kernel.h>
15#include <linux/module.h> 16#include <linux/module.h>
16#include <linux/slab.h> 17#include <linux/slab.h>
diff --git a/arch/powerpc/sysdev/cpm1.c b/arch/powerpc/sysdev/cpm1.c
index 8d103ca6d6ab..00852124ff4a 100644
--- a/arch/powerpc/sysdev/cpm1.c
+++ b/arch/powerpc/sysdev/cpm1.c
@@ -621,7 +621,6 @@ int cpm1_gpiochip_add16(struct device_node *np)
621{ 621{
622 struct cpm1_gpio16_chip *cpm1_gc; 622 struct cpm1_gpio16_chip *cpm1_gc;
623 struct of_mm_gpio_chip *mm_gc; 623 struct of_mm_gpio_chip *mm_gc;
624 struct of_gpio_chip *of_gc;
625 struct gpio_chip *gc; 624 struct gpio_chip *gc;
626 625
627 cpm1_gc = kzalloc(sizeof(*cpm1_gc), GFP_KERNEL); 626 cpm1_gc = kzalloc(sizeof(*cpm1_gc), GFP_KERNEL);
@@ -631,11 +630,9 @@ int cpm1_gpiochip_add16(struct device_node *np)
631 spin_lock_init(&cpm1_gc->lock); 630 spin_lock_init(&cpm1_gc->lock);
632 631
633 mm_gc = &cpm1_gc->mm_gc; 632 mm_gc = &cpm1_gc->mm_gc;
634 of_gc = &mm_gc->of_gc; 633 gc = &mm_gc->gc;
635 gc = &of_gc->gc;
636 634
637 mm_gc->save_regs = cpm1_gpio16_save_regs; 635 mm_gc->save_regs = cpm1_gpio16_save_regs;
638 of_gc->gpio_cells = 2;
639 gc->ngpio = 16; 636 gc->ngpio = 16;
640 gc->direction_input = cpm1_gpio16_dir_in; 637 gc->direction_input = cpm1_gpio16_dir_in;
641 gc->direction_output = cpm1_gpio16_dir_out; 638 gc->direction_output = cpm1_gpio16_dir_out;
@@ -745,7 +742,6 @@ int cpm1_gpiochip_add32(struct device_node *np)
745{ 742{
746 struct cpm1_gpio32_chip *cpm1_gc; 743 struct cpm1_gpio32_chip *cpm1_gc;
747 struct of_mm_gpio_chip *mm_gc; 744 struct of_mm_gpio_chip *mm_gc;
748 struct of_gpio_chip *of_gc;
749 struct gpio_chip *gc; 745 struct gpio_chip *gc;
750 746
751 cpm1_gc = kzalloc(sizeof(*cpm1_gc), GFP_KERNEL); 747 cpm1_gc = kzalloc(sizeof(*cpm1_gc), GFP_KERNEL);
@@ -755,11 +751,9 @@ int cpm1_gpiochip_add32(struct device_node *np)
755 spin_lock_init(&cpm1_gc->lock); 751 spin_lock_init(&cpm1_gc->lock);
756 752
757 mm_gc = &cpm1_gc->mm_gc; 753 mm_gc = &cpm1_gc->mm_gc;
758 of_gc = &mm_gc->of_gc; 754 gc = &mm_gc->gc;
759 gc = &of_gc->gc;
760 755
761 mm_gc->save_regs = cpm1_gpio32_save_regs; 756 mm_gc->save_regs = cpm1_gpio32_save_regs;
762 of_gc->gpio_cells = 2;
763 gc->ngpio = 32; 757 gc->ngpio = 32;
764 gc->direction_input = cpm1_gpio32_dir_in; 758 gc->direction_input = cpm1_gpio32_dir_in;
765 gc->direction_output = cpm1_gpio32_dir_out; 759 gc->direction_output = cpm1_gpio32_dir_out;
diff --git a/arch/powerpc/sysdev/cpm_common.c b/arch/powerpc/sysdev/cpm_common.c
index 88b9812c854f..2b69aa0315b3 100644
--- a/arch/powerpc/sysdev/cpm_common.c
+++ b/arch/powerpc/sysdev/cpm_common.c
@@ -325,7 +325,6 @@ int cpm2_gpiochip_add32(struct device_node *np)
325{ 325{
326 struct cpm2_gpio32_chip *cpm2_gc; 326 struct cpm2_gpio32_chip *cpm2_gc;
327 struct of_mm_gpio_chip *mm_gc; 327 struct of_mm_gpio_chip *mm_gc;
328 struct of_gpio_chip *of_gc;
329 struct gpio_chip *gc; 328 struct gpio_chip *gc;
330 329
331 cpm2_gc = kzalloc(sizeof(*cpm2_gc), GFP_KERNEL); 330 cpm2_gc = kzalloc(sizeof(*cpm2_gc), GFP_KERNEL);
@@ -335,11 +334,9 @@ int cpm2_gpiochip_add32(struct device_node *np)
335 spin_lock_init(&cpm2_gc->lock); 334 spin_lock_init(&cpm2_gc->lock);
336 335
337 mm_gc = &cpm2_gc->mm_gc; 336 mm_gc = &cpm2_gc->mm_gc;
338 of_gc = &mm_gc->of_gc; 337 gc = &mm_gc->gc;
339 gc = &of_gc->gc;
340 338
341 mm_gc->save_regs = cpm2_gpio32_save_regs; 339 mm_gc->save_regs = cpm2_gpio32_save_regs;
342 of_gc->gpio_cells = 2;
343 gc->ngpio = 32; 340 gc->ngpio = 32;
344 gc->direction_input = cpm2_gpio32_dir_in; 341 gc->direction_input = cpm2_gpio32_dir_in;
345 gc->direction_output = cpm2_gpio32_dir_out; 342 gc->direction_output = cpm2_gpio32_dir_out;
diff --git a/arch/powerpc/sysdev/fsl_gtm.c b/arch/powerpc/sysdev/fsl_gtm.c
index eca4545dd52e..7dd2885321ad 100644
--- a/arch/powerpc/sysdev/fsl_gtm.c
+++ b/arch/powerpc/sysdev/fsl_gtm.c
@@ -14,6 +14,7 @@
14 */ 14 */
15 15
16#include <linux/kernel.h> 16#include <linux/kernel.h>
17#include <linux/err.h>
17#include <linux/errno.h> 18#include <linux/errno.h>
18#include <linux/list.h> 19#include <linux/list.h>
19#include <linux/io.h> 20#include <linux/io.h>
diff --git a/arch/powerpc/sysdev/fsl_msi.c b/arch/powerpc/sysdev/fsl_msi.c
index 962c2d8dd8d9..87991d3abbab 100644
--- a/arch/powerpc/sysdev/fsl_msi.c
+++ b/arch/powerpc/sysdev/fsl_msi.c
@@ -250,7 +250,7 @@ unlock:
250 raw_spin_unlock(&desc->lock); 250 raw_spin_unlock(&desc->lock);
251} 251}
252 252
253static int fsl_of_msi_remove(struct of_device *ofdev) 253static int fsl_of_msi_remove(struct platform_device *ofdev)
254{ 254{
255 struct fsl_msi *msi = ofdev->dev.platform_data; 255 struct fsl_msi *msi = ofdev->dev.platform_data;
256 int virq, i; 256 int virq, i;
@@ -274,7 +274,7 @@ static int fsl_of_msi_remove(struct of_device *ofdev)
274 return 0; 274 return 0;
275} 275}
276 276
277static int __devinit fsl_of_msi_probe(struct of_device *dev, 277static int __devinit fsl_of_msi_probe(struct platform_device *dev,
278 const struct of_device_id *match) 278 const struct of_device_id *match)
279{ 279{
280 struct fsl_msi *msi; 280 struct fsl_msi *msi;
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 356c6a0e1b23..209384b6e039 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -412,6 +412,7 @@ DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_P4080, quirk_fsl_pcie_header);
412#endif /* CONFIG_FSL_SOC_BOOKE || CONFIG_PPC_86xx */ 412#endif /* CONFIG_FSL_SOC_BOOKE || CONFIG_PPC_86xx */
413 413
414#if defined(CONFIG_PPC_83xx) || defined(CONFIG_PPC_MPC512x) 414#if defined(CONFIG_PPC_83xx) || defined(CONFIG_PPC_MPC512x)
415DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8308, quirk_fsl_pcie_header);
415DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8314E, quirk_fsl_pcie_header); 416DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8314E, quirk_fsl_pcie_header);
416DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8314, quirk_fsl_pcie_header); 417DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8314, quirk_fsl_pcie_header);
417DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8315E, quirk_fsl_pcie_header); 418DECLARE_PCI_FIXUP_HEADER(0x1957, PCI_DEVICE_ID_MPC8315E, quirk_fsl_pcie_header);
diff --git a/arch/powerpc/sysdev/fsl_pmc.c b/arch/powerpc/sysdev/fsl_pmc.c
index 9082eb921ad9..44de8559c975 100644
--- a/arch/powerpc/sysdev/fsl_pmc.c
+++ b/arch/powerpc/sysdev/fsl_pmc.c
@@ -58,7 +58,8 @@ static struct platform_suspend_ops pmc_suspend_ops = {
58 .enter = pmc_suspend_enter, 58 .enter = pmc_suspend_enter,
59}; 59};
60 60
61static int pmc_probe(struct of_device *ofdev, const struct of_device_id *id) 61static int pmc_probe(struct platform_device *ofdev,
62 const struct of_device_id *id)
62{ 63{
63 pmc_regs = of_iomap(ofdev->dev.of_node, 0); 64 pmc_regs = of_iomap(ofdev->dev.of_node, 0);
64 if (!pmc_regs) 65 if (!pmc_regs)
diff --git a/arch/powerpc/sysdev/fsl_rio.c b/arch/powerpc/sysdev/fsl_rio.c
index 30e1626b2e85..8bd86530ee25 100644
--- a/arch/powerpc/sysdev/fsl_rio.c
+++ b/arch/powerpc/sysdev/fsl_rio.c
@@ -1338,7 +1338,7 @@ static inline void fsl_rio_info(struct device *dev, u32 ccsr)
1338 * master port with system-specific info, and registers the 1338 * master port with system-specific info, and registers the
1339 * master port with the RapidIO subsystem. 1339 * master port with the RapidIO subsystem.
1340 */ 1340 */
1341int fsl_rio_setup(struct of_device *dev) 1341int fsl_rio_setup(struct platform_device *dev)
1342{ 1342{
1343 struct rio_ops *ops; 1343 struct rio_ops *ops;
1344 struct rio_mport *port; 1344 struct rio_mport *port;
@@ -1536,7 +1536,7 @@ err_ops:
1536 1536
1537/* The probe function for RapidIO peer-to-peer network. 1537/* The probe function for RapidIO peer-to-peer network.
1538 */ 1538 */
1539static int __devinit fsl_of_rio_rpn_probe(struct of_device *dev, 1539static int __devinit fsl_of_rio_rpn_probe(struct platform_device *dev,
1540 const struct of_device_id *match) 1540 const struct of_device_id *match)
1541{ 1541{
1542 int rc; 1542 int rc;
diff --git a/arch/powerpc/sysdev/fsl_soc.h b/arch/powerpc/sysdev/fsl_soc.h
index 42381bb6cd51..53609489a62b 100644
--- a/arch/powerpc/sysdev/fsl_soc.h
+++ b/arch/powerpc/sysdev/fsl_soc.h
@@ -30,6 +30,7 @@ struct platform_diu_data_ops {
30 void (*set_pixel_clock) (unsigned int pixclock); 30 void (*set_pixel_clock) (unsigned int pixclock);
31 ssize_t (*show_monitor_port) (int monitor_port, char *buf); 31 ssize_t (*show_monitor_port) (int monitor_port, char *buf);
32 int (*set_sysfs_monitor_port) (int val); 32 int (*set_sysfs_monitor_port) (int val);
33 void (*release_bootmem) (void);
33}; 34};
34 35
35extern struct platform_diu_data_ops diu_ops; 36extern struct platform_diu_data_ops diu_ops;
diff --git a/arch/powerpc/sysdev/mpc8xxx_gpio.c b/arch/powerpc/sysdev/mpc8xxx_gpio.c
index 83f519655fac..2b69084d0f0c 100644
--- a/arch/powerpc/sysdev/mpc8xxx_gpio.c
+++ b/arch/powerpc/sysdev/mpc8xxx_gpio.c
@@ -257,7 +257,6 @@ static void __init mpc8xxx_add_controller(struct device_node *np)
257{ 257{
258 struct mpc8xxx_gpio_chip *mpc8xxx_gc; 258 struct mpc8xxx_gpio_chip *mpc8xxx_gc;
259 struct of_mm_gpio_chip *mm_gc; 259 struct of_mm_gpio_chip *mm_gc;
260 struct of_gpio_chip *of_gc;
261 struct gpio_chip *gc; 260 struct gpio_chip *gc;
262 unsigned hwirq; 261 unsigned hwirq;
263 int ret; 262 int ret;
@@ -271,11 +270,9 @@ static void __init mpc8xxx_add_controller(struct device_node *np)
271 spin_lock_init(&mpc8xxx_gc->lock); 270 spin_lock_init(&mpc8xxx_gc->lock);
272 271
273 mm_gc = &mpc8xxx_gc->mm_gc; 272 mm_gc = &mpc8xxx_gc->mm_gc;
274 of_gc = &mm_gc->of_gc; 273 gc = &mm_gc->gc;
275 gc = &of_gc->gc;
276 274
277 mm_gc->save_regs = mpc8xxx_gpio_save_regs; 275 mm_gc->save_regs = mpc8xxx_gpio_save_regs;
278 of_gc->gpio_cells = 2;
279 gc->ngpio = MPC8XXX_GPIO_PINS; 276 gc->ngpio = MPC8XXX_GPIO_PINS;
280 gc->direction_input = mpc8xxx_gpio_dir_in; 277 gc->direction_input = mpc8xxx_gpio_dir_in;
281 gc->direction_output = mpc8xxx_gpio_dir_out; 278 gc->direction_output = mpc8xxx_gpio_dir_out;
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index 20b73c025a45..7c1342618a30 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -1636,6 +1636,24 @@ void __devinit smp_mpic_setup_cpu(int cpu)
1636{ 1636{
1637 mpic_setup_this_cpu(); 1637 mpic_setup_this_cpu();
1638} 1638}
1639
1640void mpic_reset_core(int cpu)
1641{
1642 struct mpic *mpic = mpic_primary;
1643 u32 pir;
1644 int cpuid = get_hard_smp_processor_id(cpu);
1645
1646 /* Set target bit for core reset */
1647 pir = mpic_read(mpic->gregs, MPIC_INFO(GREG_PROCESSOR_INIT));
1648 pir |= (1 << cpuid);
1649 mpic_write(mpic->gregs, MPIC_INFO(GREG_PROCESSOR_INIT), pir);
1650 mpic_read(mpic->gregs, MPIC_INFO(GREG_PROCESSOR_INIT));
1651
1652 /* Restore target bit after reset complete */
1653 pir &= ~(1 << cpuid);
1654 mpic_write(mpic->gregs, MPIC_INFO(GREG_PROCESSOR_INIT), pir);
1655 mpic_read(mpic->gregs, MPIC_INFO(GREG_PROCESSOR_INIT));
1656}
1639#endif /* CONFIG_SMP */ 1657#endif /* CONFIG_SMP */
1640 1658
1641#ifdef CONFIG_PM 1659#ifdef CONFIG_PM
diff --git a/arch/powerpc/sysdev/mpic.h b/arch/powerpc/sysdev/mpic.h
index eff433c322a0..e4a6df77b8d7 100644
--- a/arch/powerpc/sysdev/mpic.h
+++ b/arch/powerpc/sysdev/mpic.h
@@ -37,5 +37,6 @@ static inline int mpic_pasemi_msi_init(struct mpic *mpic)
37extern int mpic_set_irq_type(unsigned int virq, unsigned int flow_type); 37extern int mpic_set_irq_type(unsigned int virq, unsigned int flow_type);
38extern void mpic_set_vector(unsigned int virq, unsigned int vector); 38extern void mpic_set_vector(unsigned int virq, unsigned int vector);
39extern int mpic_set_affinity(unsigned int irq, const struct cpumask *cpumask); 39extern int mpic_set_affinity(unsigned int irq, const struct cpumask *cpumask);
40extern void mpic_reset_core(int cpu);
40 41
41#endif /* _POWERPC_SYSDEV_MPIC_H */ 42#endif /* _POWERPC_SYSDEV_MPIC_H */
diff --git a/arch/powerpc/sysdev/mv64x60_dev.c b/arch/powerpc/sysdev/mv64x60_dev.c
index 31acd3b1718b..1398bc454999 100644
--- a/arch/powerpc/sysdev/mv64x60_dev.c
+++ b/arch/powerpc/sysdev/mv64x60_dev.c
@@ -20,12 +20,7 @@
20 20
21#include <asm/prom.h> 21#include <asm/prom.h>
22 22
23/* 23/* These functions provide the necessary setup for the mv64x60 drivers. */
24 * These functions provide the necessary setup for the mv64x60 drivers.
25 * These drivers are unusual in that they work on both the MIPS and PowerPC
26 * architectures. Because of that, the drivers do not support the normal
27 * PowerPC of_platform_bus_type. They support platform_bus_type instead.
28 */
29 24
30static struct of_device_id __initdata of_mv64x60_devices[] = { 25static struct of_device_id __initdata of_mv64x60_devices[] = {
31 { .compatible = "marvell,mv64306-devctrl", }, 26 { .compatible = "marvell,mv64306-devctrl", },
diff --git a/arch/powerpc/sysdev/mv64x60_pci.c b/arch/powerpc/sysdev/mv64x60_pci.c
index 198f288570cc..77bb3f4d530a 100644
--- a/arch/powerpc/sysdev/mv64x60_pci.c
+++ b/arch/powerpc/sysdev/mv64x60_pci.c
@@ -73,7 +73,6 @@ static struct bin_attribute mv64x60_hs_reg_attr = { /* Hotswap register */
73 .attr = { 73 .attr = {
74 .name = "hs_reg", 74 .name = "hs_reg",
75 .mode = S_IRUGO | S_IWUSR, 75 .mode = S_IRUGO | S_IWUSR,
76 .owner = THIS_MODULE,
77 }, 76 },
78 .size = MV64X60_VAL_LEN_MAX, 77 .size = MV64X60_VAL_LEN_MAX,
79 .read = mv64x60_hs_reg_read, 78 .read = mv64x60_hs_reg_read,
diff --git a/arch/powerpc/sysdev/pmi.c b/arch/powerpc/sysdev/pmi.c
index d07137a07d75..24a0bb955b18 100644
--- a/arch/powerpc/sysdev/pmi.c
+++ b/arch/powerpc/sysdev/pmi.c
@@ -43,7 +43,7 @@ struct pmi_data {
43 struct mutex msg_mutex; 43 struct mutex msg_mutex;
44 pmi_message_t msg; 44 pmi_message_t msg;
45 struct completion *completion; 45 struct completion *completion;
46 struct of_device *dev; 46 struct platform_device *dev;
47 int irq; 47 int irq;
48 u8 __iomem *pmi_reg; 48 u8 __iomem *pmi_reg;
49 struct work_struct work; 49 struct work_struct work;
@@ -121,7 +121,7 @@ static void pmi_notify_handlers(struct work_struct *work)
121 spin_unlock(&data->handler_spinlock); 121 spin_unlock(&data->handler_spinlock);
122} 122}
123 123
124static int pmi_of_probe(struct of_device *dev, 124static int pmi_of_probe(struct platform_device *dev,
125 const struct of_device_id *match) 125 const struct of_device_id *match)
126{ 126{
127 struct device_node *np = dev->dev.of_node; 127 struct device_node *np = dev->dev.of_node;
@@ -185,7 +185,7 @@ out:
185 return rc; 185 return rc;
186} 186}
187 187
188static int pmi_of_remove(struct of_device *dev) 188static int pmi_of_remove(struct platform_device *dev)
189{ 189{
190 struct pmi_handler *handler, *tmp; 190 struct pmi_handler *handler, *tmp;
191 191
diff --git a/arch/powerpc/sysdev/ppc4xx_gpio.c b/arch/powerpc/sysdev/ppc4xx_gpio.c
index 3812fc366bec..fc65ad1b3293 100644
--- a/arch/powerpc/sysdev/ppc4xx_gpio.c
+++ b/arch/powerpc/sysdev/ppc4xx_gpio.c
@@ -181,7 +181,6 @@ static int __init ppc4xx_add_gpiochips(void)
181 int ret; 181 int ret;
182 struct ppc4xx_gpio_chip *ppc4xx_gc; 182 struct ppc4xx_gpio_chip *ppc4xx_gc;
183 struct of_mm_gpio_chip *mm_gc; 183 struct of_mm_gpio_chip *mm_gc;
184 struct of_gpio_chip *of_gc;
185 struct gpio_chip *gc; 184 struct gpio_chip *gc;
186 185
187 ppc4xx_gc = kzalloc(sizeof(*ppc4xx_gc), GFP_KERNEL); 186 ppc4xx_gc = kzalloc(sizeof(*ppc4xx_gc), GFP_KERNEL);
@@ -193,10 +192,8 @@ static int __init ppc4xx_add_gpiochips(void)
193 spin_lock_init(&ppc4xx_gc->lock); 192 spin_lock_init(&ppc4xx_gc->lock);
194 193
195 mm_gc = &ppc4xx_gc->mm_gc; 194 mm_gc = &ppc4xx_gc->mm_gc;
196 of_gc = &mm_gc->of_gc; 195 gc = &mm_gc->gc;
197 gc = &of_gc->gc;
198 196
199 of_gc->gpio_cells = 2;
200 gc->ngpio = 32; 197 gc->ngpio = 32;
201 gc->direction_input = ppc4xx_gpio_dir_in; 198 gc->direction_input = ppc4xx_gpio_dir_in;
202 gc->direction_output = ppc4xx_gpio_dir_out; 199 gc->direction_output = ppc4xx_gpio_dir_out;
diff --git a/arch/powerpc/sysdev/qe_lib/gpio.c b/arch/powerpc/sysdev/qe_lib/gpio.c
index dc8f8d618074..36bf845df127 100644
--- a/arch/powerpc/sysdev/qe_lib/gpio.c
+++ b/arch/powerpc/sysdev/qe_lib/gpio.c
@@ -138,8 +138,8 @@ struct qe_pin {
138struct qe_pin *qe_pin_request(struct device_node *np, int index) 138struct qe_pin *qe_pin_request(struct device_node *np, int index)
139{ 139{
140 struct qe_pin *qe_pin; 140 struct qe_pin *qe_pin;
141 struct device_node *gc; 141 struct device_node *gpio_np;
142 struct of_gpio_chip *of_gc = NULL; 142 struct gpio_chip *gc;
143 struct of_mm_gpio_chip *mm_gc; 143 struct of_mm_gpio_chip *mm_gc;
144 struct qe_gpio_chip *qe_gc; 144 struct qe_gpio_chip *qe_gc;
145 int err; 145 int err;
@@ -155,40 +155,40 @@ struct qe_pin *qe_pin_request(struct device_node *np, int index)
155 } 155 }
156 156
157 err = of_parse_phandles_with_args(np, "gpios", "#gpio-cells", index, 157 err = of_parse_phandles_with_args(np, "gpios", "#gpio-cells", index,
158 &gc, &gpio_spec); 158 &gpio_np, &gpio_spec);
159 if (err) { 159 if (err) {
160 pr_debug("%s: can't parse gpios property\n", __func__); 160 pr_debug("%s: can't parse gpios property\n", __func__);
161 goto err0; 161 goto err0;
162 } 162 }
163 163
164 if (!of_device_is_compatible(gc, "fsl,mpc8323-qe-pario-bank")) { 164 if (!of_device_is_compatible(gpio_np, "fsl,mpc8323-qe-pario-bank")) {
165 pr_debug("%s: tried to get a non-qe pin\n", __func__); 165 pr_debug("%s: tried to get a non-qe pin\n", __func__);
166 err = -EINVAL; 166 err = -EINVAL;
167 goto err1; 167 goto err1;
168 } 168 }
169 169
170 of_gc = gc->data; 170 gc = of_node_to_gpiochip(gpio_np);
171 if (!of_gc) { 171 if (!gc) {
172 pr_debug("%s: gpio controller %s isn't registered\n", 172 pr_debug("%s: gpio controller %s isn't registered\n",
173 np->full_name, gc->full_name); 173 np->full_name, gpio_np->full_name);
174 err = -ENODEV; 174 err = -ENODEV;
175 goto err1; 175 goto err1;
176 } 176 }
177 177
178 gpio_cells = of_get_property(gc, "#gpio-cells", &size); 178 gpio_cells = of_get_property(gpio_np, "#gpio-cells", &size);
179 if (!gpio_cells || size != sizeof(*gpio_cells) || 179 if (!gpio_cells || size != sizeof(*gpio_cells) ||
180 *gpio_cells != of_gc->gpio_cells) { 180 *gpio_cells != gc->of_gpio_n_cells) {
181 pr_debug("%s: wrong #gpio-cells for %s\n", 181 pr_debug("%s: wrong #gpio-cells for %s\n",
182 np->full_name, gc->full_name); 182 np->full_name, gpio_np->full_name);
183 err = -EINVAL; 183 err = -EINVAL;
184 goto err1; 184 goto err1;
185 } 185 }
186 186
187 err = of_gc->xlate(of_gc, np, gpio_spec, NULL); 187 err = gc->of_xlate(gc, np, gpio_spec, NULL);
188 if (err < 0) 188 if (err < 0)
189 goto err1; 189 goto err1;
190 190
191 mm_gc = to_of_mm_gpio_chip(&of_gc->gc); 191 mm_gc = to_of_mm_gpio_chip(gc);
192 qe_gc = to_qe_gpio_chip(mm_gc); 192 qe_gc = to_qe_gpio_chip(mm_gc);
193 193
194 spin_lock_irqsave(&qe_gc->lock, flags); 194 spin_lock_irqsave(&qe_gc->lock, flags);
@@ -206,7 +206,7 @@ struct qe_pin *qe_pin_request(struct device_node *np, int index)
206 if (!err) 206 if (!err)
207 return qe_pin; 207 return qe_pin;
208err1: 208err1:
209 of_node_put(gc); 209 of_node_put(gpio_np);
210err0: 210err0:
211 kfree(qe_pin); 211 kfree(qe_pin);
212 pr_debug("%s failed with status %d\n", __func__, err); 212 pr_debug("%s failed with status %d\n", __func__, err);
@@ -307,7 +307,6 @@ static int __init qe_add_gpiochips(void)
307 int ret; 307 int ret;
308 struct qe_gpio_chip *qe_gc; 308 struct qe_gpio_chip *qe_gc;
309 struct of_mm_gpio_chip *mm_gc; 309 struct of_mm_gpio_chip *mm_gc;
310 struct of_gpio_chip *of_gc;
311 struct gpio_chip *gc; 310 struct gpio_chip *gc;
312 311
313 qe_gc = kzalloc(sizeof(*qe_gc), GFP_KERNEL); 312 qe_gc = kzalloc(sizeof(*qe_gc), GFP_KERNEL);
@@ -319,11 +318,9 @@ static int __init qe_add_gpiochips(void)
319 spin_lock_init(&qe_gc->lock); 318 spin_lock_init(&qe_gc->lock);
320 319
321 mm_gc = &qe_gc->mm_gc; 320 mm_gc = &qe_gc->mm_gc;
322 of_gc = &mm_gc->of_gc; 321 gc = &mm_gc->gc;
323 gc = &of_gc->gc;
324 322
325 mm_gc->save_regs = qe_gpio_save_regs; 323 mm_gc->save_regs = qe_gpio_save_regs;
326 of_gc->gpio_cells = 2;
327 gc->ngpio = QE_PIO_PINS; 324 gc->ngpio = QE_PIO_PINS;
328 gc->direction_input = qe_gpio_dir_in; 325 gc->direction_input = qe_gpio_dir_in;
329 gc->direction_output = qe_gpio_dir_out; 326 gc->direction_output = qe_gpio_dir_out;
diff --git a/arch/powerpc/sysdev/qe_lib/qe.c b/arch/powerpc/sysdev/qe_lib/qe.c
index 093e0ae1a941..3da8014931c9 100644
--- a/arch/powerpc/sysdev/qe_lib/qe.c
+++ b/arch/powerpc/sysdev/qe_lib/qe.c
@@ -651,14 +651,15 @@ unsigned int qe_get_num_of_snums(void)
651EXPORT_SYMBOL(qe_get_num_of_snums); 651EXPORT_SYMBOL(qe_get_num_of_snums);
652 652
653#if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC_85xx) 653#if defined(CONFIG_SUSPEND) && defined(CONFIG_PPC_85xx)
654static int qe_resume(struct of_device *ofdev) 654static int qe_resume(struct platform_device *ofdev)
655{ 655{
656 if (!qe_alive_during_sleep()) 656 if (!qe_alive_during_sleep())
657 qe_reset(); 657 qe_reset();
658 return 0; 658 return 0;
659} 659}
660 660
661static int qe_probe(struct of_device *ofdev, const struct of_device_id *id) 661static int qe_probe(struct platform_device *ofdev,
662 const struct of_device_id *id)
662{ 663{
663 return 0; 664 return 0;
664} 665}
diff --git a/arch/powerpc/sysdev/simple_gpio.c b/arch/powerpc/sysdev/simple_gpio.c
index d5fb173e588c..b6defda5ccc9 100644
--- a/arch/powerpc/sysdev/simple_gpio.c
+++ b/arch/powerpc/sysdev/simple_gpio.c
@@ -91,7 +91,6 @@ static int __init u8_simple_gpiochip_add(struct device_node *np)
91 int ret; 91 int ret;
92 struct u8_gpio_chip *u8_gc; 92 struct u8_gpio_chip *u8_gc;
93 struct of_mm_gpio_chip *mm_gc; 93 struct of_mm_gpio_chip *mm_gc;
94 struct of_gpio_chip *of_gc;
95 struct gpio_chip *gc; 94 struct gpio_chip *gc;
96 95
97 u8_gc = kzalloc(sizeof(*u8_gc), GFP_KERNEL); 96 u8_gc = kzalloc(sizeof(*u8_gc), GFP_KERNEL);
@@ -101,11 +100,9 @@ static int __init u8_simple_gpiochip_add(struct device_node *np)
101 spin_lock_init(&u8_gc->lock); 100 spin_lock_init(&u8_gc->lock);
102 101
103 mm_gc = &u8_gc->mm_gc; 102 mm_gc = &u8_gc->mm_gc;
104 of_gc = &mm_gc->of_gc; 103 gc = &mm_gc->gc;
105 gc = &of_gc->gc;
106 104
107 mm_gc->save_regs = u8_gpio_save_regs; 105 mm_gc->save_regs = u8_gpio_save_regs;
108 of_gc->gpio_cells = 2;
109 gc->ngpio = 8; 106 gc->ngpio = 8;
110 gc->direction_input = u8_gpio_dir_in; 107 gc->direction_input = u8_gpio_dir_in;
111 gc->direction_output = u8_gpio_dir_out; 108 gc->direction_output = u8_gpio_dir_out;
diff --git a/arch/powerpc/xmon/xmon.c b/arch/powerpc/xmon/xmon.c
index 8bad7d5f32af..0554445200bf 100644
--- a/arch/powerpc/xmon/xmon.c
+++ b/arch/powerpc/xmon/xmon.c
@@ -155,6 +155,9 @@ static int do_spu_cmd(void);
155#ifdef CONFIG_44x 155#ifdef CONFIG_44x
156static void dump_tlb_44x(void); 156static void dump_tlb_44x(void);
157#endif 157#endif
158#ifdef CONFIG_PPC_BOOK3E
159static void dump_tlb_book3e(void);
160#endif
158 161
159static int xmon_no_auto_backtrace; 162static int xmon_no_auto_backtrace;
160 163
@@ -888,6 +891,11 @@ cmds(struct pt_regs *excp)
888 dump_tlb_44x(); 891 dump_tlb_44x();
889 break; 892 break;
890#endif 893#endif
894#ifdef CONFIG_PPC_BOOK3E
895 case 'u':
896 dump_tlb_book3e();
897 break;
898#endif
891 default: 899 default:
892 printf("Unrecognized command: "); 900 printf("Unrecognized command: ");
893 do { 901 do {
@@ -2701,6 +2709,150 @@ static void dump_tlb_44x(void)
2701} 2709}
2702#endif /* CONFIG_44x */ 2710#endif /* CONFIG_44x */
2703 2711
2712#ifdef CONFIG_PPC_BOOK3E
2713static void dump_tlb_book3e(void)
2714{
2715 u32 mmucfg, pidmask, lpidmask;
2716 u64 ramask;
2717 int i, tlb, ntlbs, pidsz, lpidsz, rasz, lrat = 0;
2718 int mmu_version;
2719 static const char *pgsz_names[] = {
2720 " 1K",
2721 " 2K",
2722 " 4K",
2723 " 8K",
2724 " 16K",
2725 " 32K",
2726 " 64K",
2727 "128K",
2728 "256K",
2729 "512K",
2730 " 1M",
2731 " 2M",
2732 " 4M",
2733 " 8M",
2734 " 16M",
2735 " 32M",
2736 " 64M",
2737 "128M",
2738 "256M",
2739 "512M",
2740 " 1G",
2741 " 2G",
2742 " 4G",
2743 " 8G",
2744 " 16G",
2745 " 32G",
2746 " 64G",
2747 "128G",
2748 "256G",
2749 "512G",
2750 " 1T",
2751 " 2T",
2752 };
2753
2754 /* Gather some infos about the MMU */
2755 mmucfg = mfspr(SPRN_MMUCFG);
2756 mmu_version = (mmucfg & 3) + 1;
2757 ntlbs = ((mmucfg >> 2) & 3) + 1;
2758 pidsz = ((mmucfg >> 6) & 0x1f) + 1;
2759 lpidsz = (mmucfg >> 24) & 0xf;
2760 rasz = (mmucfg >> 16) & 0x7f;
2761 if ((mmu_version > 1) && (mmucfg & 0x10000))
2762 lrat = 1;
2763 printf("Book3E MMU MAV=%d.0,%d TLBs,%d-bit PID,%d-bit LPID,%d-bit RA\n",
2764 mmu_version, ntlbs, pidsz, lpidsz, rasz);
2765 pidmask = (1ul << pidsz) - 1;
2766 lpidmask = (1ul << lpidsz) - 1;
2767 ramask = (1ull << rasz) - 1;
2768
2769 for (tlb = 0; tlb < ntlbs; tlb++) {
2770 u32 tlbcfg;
2771 int nent, assoc, new_cc = 1;
2772 printf("TLB %d:\n------\n", tlb);
2773 switch(tlb) {
2774 case 0:
2775 tlbcfg = mfspr(SPRN_TLB0CFG);
2776 break;
2777 case 1:
2778 tlbcfg = mfspr(SPRN_TLB1CFG);
2779 break;
2780 case 2:
2781 tlbcfg = mfspr(SPRN_TLB2CFG);
2782 break;
2783 case 3:
2784 tlbcfg = mfspr(SPRN_TLB3CFG);
2785 break;
2786 default:
2787 printf("Unsupported TLB number !\n");
2788 continue;
2789 }
2790 nent = tlbcfg & 0xfff;
2791 assoc = (tlbcfg >> 24) & 0xff;
2792 for (i = 0; i < nent; i++) {
2793 u32 mas0 = MAS0_TLBSEL(tlb);
2794 u32 mas1 = MAS1_TSIZE(BOOK3E_PAGESZ_4K);
2795 u64 mas2 = 0;
2796 u64 mas7_mas3;
2797 int esel = i, cc = i;
2798
2799 if (assoc != 0) {
2800 cc = i / assoc;
2801 esel = i % assoc;
2802 mas2 = cc * 0x1000;
2803 }
2804
2805 mas0 |= MAS0_ESEL(esel);
2806 mtspr(SPRN_MAS0, mas0);
2807 mtspr(SPRN_MAS1, mas1);
2808 mtspr(SPRN_MAS2, mas2);
2809 asm volatile("tlbre 0,0,0" : : : "memory");
2810 mas1 = mfspr(SPRN_MAS1);
2811 mas2 = mfspr(SPRN_MAS2);
2812 mas7_mas3 = mfspr(SPRN_MAS7_MAS3);
2813 if (assoc && (i % assoc) == 0)
2814 new_cc = 1;
2815 if (!(mas1 & MAS1_VALID))
2816 continue;
2817 if (assoc == 0)
2818 printf("%04x- ", i);
2819 else if (new_cc)
2820 printf("%04x-%c", cc, 'A' + esel);
2821 else
2822 printf(" |%c", 'A' + esel);
2823 new_cc = 0;
2824 printf(" %016llx %04x %s %c%c AS%c",
2825 mas2 & ~0x3ffull,
2826 (mas1 >> 16) & 0x3fff,
2827 pgsz_names[(mas1 >> 7) & 0x1f],
2828 mas1 & MAS1_IND ? 'I' : ' ',
2829 mas1 & MAS1_IPROT ? 'P' : ' ',
2830 mas1 & MAS1_TS ? '1' : '0');
2831 printf(" %c%c%c%c%c%c%c",
2832 mas2 & MAS2_X0 ? 'a' : ' ',
2833 mas2 & MAS2_X1 ? 'v' : ' ',
2834 mas2 & MAS2_W ? 'w' : ' ',
2835 mas2 & MAS2_I ? 'i' : ' ',
2836 mas2 & MAS2_M ? 'm' : ' ',
2837 mas2 & MAS2_G ? 'g' : ' ',
2838 mas2 & MAS2_E ? 'e' : ' ');
2839 printf(" %016llx", mas7_mas3 & ramask & ~0x7ffull);
2840 if (mas1 & MAS1_IND)
2841 printf(" %s\n",
2842 pgsz_names[(mas7_mas3 >> 1) & 0x1f]);
2843 else
2844 printf(" U%c%c%c S%c%c%c\n",
2845 mas7_mas3 & MAS3_UX ? 'x' : ' ',
2846 mas7_mas3 & MAS3_UW ? 'w' : ' ',
2847 mas7_mas3 & MAS3_UR ? 'r' : ' ',
2848 mas7_mas3 & MAS3_SX ? 'x' : ' ',
2849 mas7_mas3 & MAS3_SW ? 'w' : ' ',
2850 mas7_mas3 & MAS3_SR ? 'r' : ' ');
2851 }
2852 }
2853}
2854#endif /* CONFIG_PPC_BOOK3E */
2855
2704static void xmon_init(int enable) 2856static void xmon_init(int enable)
2705{ 2857{
2706#ifdef CONFIG_PPC_ISERIES 2858#ifdef CONFIG_PPC_ISERIES
diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig
index bee1c0f794cf..f0777a47e3a5 100644
--- a/arch/s390/Kconfig
+++ b/arch/s390/Kconfig
@@ -40,9 +40,6 @@ config ARCH_HAS_ILOG2_U64
40config GENERIC_HWEIGHT 40config GENERIC_HWEIGHT
41 def_bool y 41 def_bool y
42 42
43config GENERIC_TIME
44 def_bool y
45
46config GENERIC_TIME_VSYSCALL 43config GENERIC_TIME_VSYSCALL
47 def_bool y 44 def_bool y
48 45
diff --git a/arch/s390/Makefile b/arch/s390/Makefile
index 30c5f01f93b0..0c9e6c6d2a64 100644
--- a/arch/s390/Makefile
+++ b/arch/s390/Makefile
@@ -24,7 +24,8 @@ CHECKFLAGS += -D__s390__ -msize-long
24else 24else
25LD_BFD := elf64-s390 25LD_BFD := elf64-s390
26LDFLAGS := -m elf64_s390 26LDFLAGS := -m elf64_s390
27MODFLAGS += -fpic -D__PIC__ 27KBUILD_AFLAGS_MODULE += -fpic -D__PIC__
28KBUILD_CFLAGS_MODULE += -fpic -D__PIC__
28KBUILD_CFLAGS += -m64 29KBUILD_CFLAGS += -m64
29KBUILD_AFLAGS += -m64 30KBUILD_AFLAGS += -m64
30UTS_MACHINE := s390x 31UTS_MACHINE := s390x
diff --git a/arch/s390/appldata/appldata_net_sum.c b/arch/s390/appldata/appldata_net_sum.c
index 9a9586f4103f..f02e89ce4df1 100644
--- a/arch/s390/appldata/appldata_net_sum.c
+++ b/arch/s390/appldata/appldata_net_sum.c
@@ -85,7 +85,8 @@ static void appldata_get_net_sum_data(void *data)
85 85
86 rcu_read_lock(); 86 rcu_read_lock();
87 for_each_netdev_rcu(&init_net, dev) { 87 for_each_netdev_rcu(&init_net, dev) {
88 const struct net_device_stats *stats = dev_get_stats(dev); 88 struct rtnl_link_stats64 temp;
89 const struct net_device_stats *stats = dev_get_stats(dev, &temp);
89 90
90 rx_packets += stats->rx_packets; 91 rx_packets += stats->rx_packets;
91 tx_packets += stats->tx_packets; 92 tx_packets += stats->tx_packets;
diff --git a/arch/s390/crypto/Makefile b/arch/s390/crypto/Makefile
index 6a1157fa4f98..1cf81d77c5a5 100644
--- a/arch/s390/crypto/Makefile
+++ b/arch/s390/crypto/Makefile
@@ -5,6 +5,6 @@
5obj-$(CONFIG_CRYPTO_SHA1_S390) += sha1_s390.o sha_common.o 5obj-$(CONFIG_CRYPTO_SHA1_S390) += sha1_s390.o sha_common.o
6obj-$(CONFIG_CRYPTO_SHA256_S390) += sha256_s390.o sha_common.o 6obj-$(CONFIG_CRYPTO_SHA256_S390) += sha256_s390.o sha_common.o
7obj-$(CONFIG_CRYPTO_SHA512_S390) += sha512_s390.o sha_common.o 7obj-$(CONFIG_CRYPTO_SHA512_S390) += sha512_s390.o sha_common.o
8obj-$(CONFIG_CRYPTO_DES_S390) += des_s390.o des_check_key.o 8obj-$(CONFIG_CRYPTO_DES_S390) += des_s390.o
9obj-$(CONFIG_CRYPTO_AES_S390) += aes_s390.o 9obj-$(CONFIG_CRYPTO_AES_S390) += aes_s390.o
10obj-$(CONFIG_S390_PRNG) += prng.o 10obj-$(CONFIG_S390_PRNG) += prng.o
diff --git a/arch/s390/crypto/crypto_des.h b/arch/s390/crypto/crypto_des.h
index c964b64111dd..6210457ceebb 100644
--- a/arch/s390/crypto/crypto_des.h
+++ b/arch/s390/crypto/crypto_des.h
@@ -15,4 +15,4 @@
15 15
16extern int crypto_des_check_key(const u8*, unsigned int, u32*); 16extern int crypto_des_check_key(const u8*, unsigned int, u32*);
17 17
18#endif //__CRYPTO_DES_H__ 18#endif /*__CRYPTO_DES_H__*/
diff --git a/arch/s390/crypto/des_s390.c b/arch/s390/crypto/des_s390.c
index 2bc479ab3a66..cc5420118393 100644
--- a/arch/s390/crypto/des_s390.c
+++ b/arch/s390/crypto/des_s390.c
@@ -14,32 +14,21 @@
14 * 14 *
15 */ 15 */
16 16
17#include <crypto/algapi.h>
18#include <linux/init.h> 17#include <linux/init.h>
19#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/crypto.h>
20#include <crypto/algapi.h>
21#include <crypto/des.h>
20 22
21#include "crypt_s390.h" 23#include "crypt_s390.h"
22#include "crypto_des.h"
23
24#define DES_BLOCK_SIZE 8
25#define DES_KEY_SIZE 8
26
27#define DES3_128_KEY_SIZE (2 * DES_KEY_SIZE)
28#define DES3_128_BLOCK_SIZE DES_BLOCK_SIZE
29 24
30#define DES3_192_KEY_SIZE (3 * DES_KEY_SIZE) 25#define DES3_192_KEY_SIZE (3 * DES_KEY_SIZE)
31#define DES3_192_BLOCK_SIZE DES_BLOCK_SIZE
32 26
33struct crypt_s390_des_ctx { 27struct crypt_s390_des_ctx {
34 u8 iv[DES_BLOCK_SIZE]; 28 u8 iv[DES_BLOCK_SIZE];
35 u8 key[DES_KEY_SIZE]; 29 u8 key[DES_KEY_SIZE];
36}; 30};
37 31
38struct crypt_s390_des3_128_ctx {
39 u8 iv[DES_BLOCK_SIZE];
40 u8 key[DES3_128_KEY_SIZE];
41};
42
43struct crypt_s390_des3_192_ctx { 32struct crypt_s390_des3_192_ctx {
44 u8 iv[DES_BLOCK_SIZE]; 33 u8 iv[DES_BLOCK_SIZE];
45 u8 key[DES3_192_KEY_SIZE]; 34 u8 key[DES3_192_KEY_SIZE];
@@ -50,13 +39,16 @@ static int des_setkey(struct crypto_tfm *tfm, const u8 *key,
50{ 39{
51 struct crypt_s390_des_ctx *dctx = crypto_tfm_ctx(tfm); 40 struct crypt_s390_des_ctx *dctx = crypto_tfm_ctx(tfm);
52 u32 *flags = &tfm->crt_flags; 41 u32 *flags = &tfm->crt_flags;
53 int ret; 42 u32 tmp[DES_EXPKEY_WORDS];
54 43
55 /* test if key is valid (not a weak key) */ 44 /* check for weak keys */
56 ret = crypto_des_check_key(key, keylen, flags); 45 if (!des_ekey(tmp, key) && (*flags & CRYPTO_TFM_REQ_WEAK_KEY)) {
57 if (ret == 0) 46 *flags |= CRYPTO_TFM_RES_WEAK_KEY;
58 memcpy(dctx->key, key, keylen); 47 return -EINVAL;
59 return ret; 48 }
49
50 memcpy(dctx->key, key, keylen);
51 return 0;
60} 52}
61 53
62static void des_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) 54static void des_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in)
@@ -237,165 +229,6 @@ static struct crypto_alg cbc_des_alg = {
237 * complementation keys. Any weakness is obviated by the use of 229 * complementation keys. Any weakness is obviated by the use of
238 * multiple keys. 230 * multiple keys.
239 * 231 *
240 * However, if the two independent 64-bit keys are equal,
241 * then the DES3 operation is simply the same as DES.
242 * Implementers MUST reject keys that exhibit this property.
243 *
244 */
245static int des3_128_setkey(struct crypto_tfm *tfm, const u8 *key,
246 unsigned int keylen)
247{
248 int i, ret;
249 struct crypt_s390_des3_128_ctx *dctx = crypto_tfm_ctx(tfm);
250 const u8 *temp_key = key;
251 u32 *flags = &tfm->crt_flags;
252
253 if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE)) &&
254 (*flags & CRYPTO_TFM_REQ_WEAK_KEY)) {
255 *flags |= CRYPTO_TFM_RES_WEAK_KEY;
256 return -EINVAL;
257 }
258 for (i = 0; i < 2; i++, temp_key += DES_KEY_SIZE) {
259 ret = crypto_des_check_key(temp_key, DES_KEY_SIZE, flags);
260 if (ret < 0)
261 return ret;
262 }
263 memcpy(dctx->key, key, keylen);
264 return 0;
265}
266
267static void des3_128_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
268{
269 struct crypt_s390_des3_128_ctx *dctx = crypto_tfm_ctx(tfm);
270
271 crypt_s390_km(KM_TDEA_128_ENCRYPT, dctx->key, dst, (void*)src,
272 DES3_128_BLOCK_SIZE);
273}
274
275static void des3_128_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
276{
277 struct crypt_s390_des3_128_ctx *dctx = crypto_tfm_ctx(tfm);
278
279 crypt_s390_km(KM_TDEA_128_DECRYPT, dctx->key, dst, (void*)src,
280 DES3_128_BLOCK_SIZE);
281}
282
283static struct crypto_alg des3_128_alg = {
284 .cra_name = "des3_ede128",
285 .cra_driver_name = "des3_ede128-s390",
286 .cra_priority = CRYPT_S390_PRIORITY,
287 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
288 .cra_blocksize = DES3_128_BLOCK_SIZE,
289 .cra_ctxsize = sizeof(struct crypt_s390_des3_128_ctx),
290 .cra_module = THIS_MODULE,
291 .cra_list = LIST_HEAD_INIT(des3_128_alg.cra_list),
292 .cra_u = {
293 .cipher = {
294 .cia_min_keysize = DES3_128_KEY_SIZE,
295 .cia_max_keysize = DES3_128_KEY_SIZE,
296 .cia_setkey = des3_128_setkey,
297 .cia_encrypt = des3_128_encrypt,
298 .cia_decrypt = des3_128_decrypt,
299 }
300 }
301};
302
303static int ecb_des3_128_encrypt(struct blkcipher_desc *desc,
304 struct scatterlist *dst,
305 struct scatterlist *src, unsigned int nbytes)
306{
307 struct crypt_s390_des3_128_ctx *sctx = crypto_blkcipher_ctx(desc->tfm);
308 struct blkcipher_walk walk;
309
310 blkcipher_walk_init(&walk, dst, src, nbytes);
311 return ecb_desall_crypt(desc, KM_TDEA_128_ENCRYPT, sctx->key, &walk);
312}
313
314static int ecb_des3_128_decrypt(struct blkcipher_desc *desc,
315 struct scatterlist *dst,
316 struct scatterlist *src, unsigned int nbytes)
317{
318 struct crypt_s390_des3_128_ctx *sctx = crypto_blkcipher_ctx(desc->tfm);
319 struct blkcipher_walk walk;
320
321 blkcipher_walk_init(&walk, dst, src, nbytes);
322 return ecb_desall_crypt(desc, KM_TDEA_128_DECRYPT, sctx->key, &walk);
323}
324
325static struct crypto_alg ecb_des3_128_alg = {
326 .cra_name = "ecb(des3_ede128)",
327 .cra_driver_name = "ecb-des3_ede128-s390",
328 .cra_priority = CRYPT_S390_COMPOSITE_PRIORITY,
329 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
330 .cra_blocksize = DES3_128_BLOCK_SIZE,
331 .cra_ctxsize = sizeof(struct crypt_s390_des3_128_ctx),
332 .cra_type = &crypto_blkcipher_type,
333 .cra_module = THIS_MODULE,
334 .cra_list = LIST_HEAD_INIT(
335 ecb_des3_128_alg.cra_list),
336 .cra_u = {
337 .blkcipher = {
338 .min_keysize = DES3_128_KEY_SIZE,
339 .max_keysize = DES3_128_KEY_SIZE,
340 .setkey = des3_128_setkey,
341 .encrypt = ecb_des3_128_encrypt,
342 .decrypt = ecb_des3_128_decrypt,
343 }
344 }
345};
346
347static int cbc_des3_128_encrypt(struct blkcipher_desc *desc,
348 struct scatterlist *dst,
349 struct scatterlist *src, unsigned int nbytes)
350{
351 struct crypt_s390_des3_128_ctx *sctx = crypto_blkcipher_ctx(desc->tfm);
352 struct blkcipher_walk walk;
353
354 blkcipher_walk_init(&walk, dst, src, nbytes);
355 return cbc_desall_crypt(desc, KMC_TDEA_128_ENCRYPT, sctx->iv, &walk);
356}
357
358static int cbc_des3_128_decrypt(struct blkcipher_desc *desc,
359 struct scatterlist *dst,
360 struct scatterlist *src, unsigned int nbytes)
361{
362 struct crypt_s390_des3_128_ctx *sctx = crypto_blkcipher_ctx(desc->tfm);
363 struct blkcipher_walk walk;
364
365 blkcipher_walk_init(&walk, dst, src, nbytes);
366 return cbc_desall_crypt(desc, KMC_TDEA_128_DECRYPT, sctx->iv, &walk);
367}
368
369static struct crypto_alg cbc_des3_128_alg = {
370 .cra_name = "cbc(des3_ede128)",
371 .cra_driver_name = "cbc-des3_ede128-s390",
372 .cra_priority = CRYPT_S390_COMPOSITE_PRIORITY,
373 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
374 .cra_blocksize = DES3_128_BLOCK_SIZE,
375 .cra_ctxsize = sizeof(struct crypt_s390_des3_128_ctx),
376 .cra_type = &crypto_blkcipher_type,
377 .cra_module = THIS_MODULE,
378 .cra_list = LIST_HEAD_INIT(
379 cbc_des3_128_alg.cra_list),
380 .cra_u = {
381 .blkcipher = {
382 .min_keysize = DES3_128_KEY_SIZE,
383 .max_keysize = DES3_128_KEY_SIZE,
384 .ivsize = DES3_128_BLOCK_SIZE,
385 .setkey = des3_128_setkey,
386 .encrypt = cbc_des3_128_encrypt,
387 .decrypt = cbc_des3_128_decrypt,
388 }
389 }
390};
391
392/*
393 * RFC2451:
394 *
395 * For DES-EDE3, there is no known need to reject weak or
396 * complementation keys. Any weakness is obviated by the use of
397 * multiple keys.
398 *
399 * However, if the first two or last two independent 64-bit keys are 232 * However, if the first two or last two independent 64-bit keys are
400 * equal (k1 == k2 or k2 == k3), then the DES3 operation is simply the 233 * equal (k1 == k2 or k2 == k3), then the DES3 operation is simply the
401 * same as DES. Implementers MUST reject keys that exhibit this 234 * same as DES. Implementers MUST reject keys that exhibit this
@@ -405,9 +238,7 @@ static struct crypto_alg cbc_des3_128_alg = {
405static int des3_192_setkey(struct crypto_tfm *tfm, const u8 *key, 238static int des3_192_setkey(struct crypto_tfm *tfm, const u8 *key,
406 unsigned int keylen) 239 unsigned int keylen)
407{ 240{
408 int i, ret;
409 struct crypt_s390_des3_192_ctx *dctx = crypto_tfm_ctx(tfm); 241 struct crypt_s390_des3_192_ctx *dctx = crypto_tfm_ctx(tfm);
410 const u8 *temp_key = key;
411 u32 *flags = &tfm->crt_flags; 242 u32 *flags = &tfm->crt_flags;
412 243
413 if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE) && 244 if (!(memcmp(key, &key[DES_KEY_SIZE], DES_KEY_SIZE) &&
@@ -417,11 +248,6 @@ static int des3_192_setkey(struct crypto_tfm *tfm, const u8 *key,
417 *flags |= CRYPTO_TFM_RES_WEAK_KEY; 248 *flags |= CRYPTO_TFM_RES_WEAK_KEY;
418 return -EINVAL; 249 return -EINVAL;
419 } 250 }
420 for (i = 0; i < 3; i++, temp_key += DES_KEY_SIZE) {
421 ret = crypto_des_check_key(temp_key, DES_KEY_SIZE, flags);
422 if (ret < 0)
423 return ret;
424 }
425 memcpy(dctx->key, key, keylen); 251 memcpy(dctx->key, key, keylen);
426 return 0; 252 return 0;
427} 253}
@@ -431,7 +257,7 @@ static void des3_192_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
431 struct crypt_s390_des3_192_ctx *dctx = crypto_tfm_ctx(tfm); 257 struct crypt_s390_des3_192_ctx *dctx = crypto_tfm_ctx(tfm);
432 258
433 crypt_s390_km(KM_TDEA_192_ENCRYPT, dctx->key, dst, (void*)src, 259 crypt_s390_km(KM_TDEA_192_ENCRYPT, dctx->key, dst, (void*)src,
434 DES3_192_BLOCK_SIZE); 260 DES_BLOCK_SIZE);
435} 261}
436 262
437static void des3_192_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) 263static void des3_192_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
@@ -439,7 +265,7 @@ static void des3_192_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src)
439 struct crypt_s390_des3_192_ctx *dctx = crypto_tfm_ctx(tfm); 265 struct crypt_s390_des3_192_ctx *dctx = crypto_tfm_ctx(tfm);
440 266
441 crypt_s390_km(KM_TDEA_192_DECRYPT, dctx->key, dst, (void*)src, 267 crypt_s390_km(KM_TDEA_192_DECRYPT, dctx->key, dst, (void*)src,
442 DES3_192_BLOCK_SIZE); 268 DES_BLOCK_SIZE);
443} 269}
444 270
445static struct crypto_alg des3_192_alg = { 271static struct crypto_alg des3_192_alg = {
@@ -447,7 +273,7 @@ static struct crypto_alg des3_192_alg = {
447 .cra_driver_name = "des3_ede-s390", 273 .cra_driver_name = "des3_ede-s390",
448 .cra_priority = CRYPT_S390_PRIORITY, 274 .cra_priority = CRYPT_S390_PRIORITY,
449 .cra_flags = CRYPTO_ALG_TYPE_CIPHER, 275 .cra_flags = CRYPTO_ALG_TYPE_CIPHER,
450 .cra_blocksize = DES3_192_BLOCK_SIZE, 276 .cra_blocksize = DES_BLOCK_SIZE,
451 .cra_ctxsize = sizeof(struct crypt_s390_des3_192_ctx), 277 .cra_ctxsize = sizeof(struct crypt_s390_des3_192_ctx),
452 .cra_module = THIS_MODULE, 278 .cra_module = THIS_MODULE,
453 .cra_list = LIST_HEAD_INIT(des3_192_alg.cra_list), 279 .cra_list = LIST_HEAD_INIT(des3_192_alg.cra_list),
@@ -489,7 +315,7 @@ static struct crypto_alg ecb_des3_192_alg = {
489 .cra_driver_name = "ecb-des3_ede-s390", 315 .cra_driver_name = "ecb-des3_ede-s390",
490 .cra_priority = CRYPT_S390_COMPOSITE_PRIORITY, 316 .cra_priority = CRYPT_S390_COMPOSITE_PRIORITY,
491 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, 317 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
492 .cra_blocksize = DES3_192_BLOCK_SIZE, 318 .cra_blocksize = DES_BLOCK_SIZE,
493 .cra_ctxsize = sizeof(struct crypt_s390_des3_192_ctx), 319 .cra_ctxsize = sizeof(struct crypt_s390_des3_192_ctx),
494 .cra_type = &crypto_blkcipher_type, 320 .cra_type = &crypto_blkcipher_type,
495 .cra_module = THIS_MODULE, 321 .cra_module = THIS_MODULE,
@@ -533,7 +359,7 @@ static struct crypto_alg cbc_des3_192_alg = {
533 .cra_driver_name = "cbc-des3_ede-s390", 359 .cra_driver_name = "cbc-des3_ede-s390",
534 .cra_priority = CRYPT_S390_COMPOSITE_PRIORITY, 360 .cra_priority = CRYPT_S390_COMPOSITE_PRIORITY,
535 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER, 361 .cra_flags = CRYPTO_ALG_TYPE_BLKCIPHER,
536 .cra_blocksize = DES3_192_BLOCK_SIZE, 362 .cra_blocksize = DES_BLOCK_SIZE,
537 .cra_ctxsize = sizeof(struct crypt_s390_des3_192_ctx), 363 .cra_ctxsize = sizeof(struct crypt_s390_des3_192_ctx),
538 .cra_type = &crypto_blkcipher_type, 364 .cra_type = &crypto_blkcipher_type,
539 .cra_module = THIS_MODULE, 365 .cra_module = THIS_MODULE,
@@ -543,7 +369,7 @@ static struct crypto_alg cbc_des3_192_alg = {
543 .blkcipher = { 369 .blkcipher = {
544 .min_keysize = DES3_192_KEY_SIZE, 370 .min_keysize = DES3_192_KEY_SIZE,
545 .max_keysize = DES3_192_KEY_SIZE, 371 .max_keysize = DES3_192_KEY_SIZE,
546 .ivsize = DES3_192_BLOCK_SIZE, 372 .ivsize = DES_BLOCK_SIZE,
547 .setkey = des3_192_setkey, 373 .setkey = des3_192_setkey,
548 .encrypt = cbc_des3_192_encrypt, 374 .encrypt = cbc_des3_192_encrypt,
549 .decrypt = cbc_des3_192_decrypt, 375 .decrypt = cbc_des3_192_decrypt,
@@ -553,10 +379,9 @@ static struct crypto_alg cbc_des3_192_alg = {
553 379
554static int des_s390_init(void) 380static int des_s390_init(void)
555{ 381{
556 int ret = 0; 382 int ret;
557 383
558 if (!crypt_s390_func_available(KM_DEA_ENCRYPT) || 384 if (!crypt_s390_func_available(KM_DEA_ENCRYPT) ||
559 !crypt_s390_func_available(KM_TDEA_128_ENCRYPT) ||
560 !crypt_s390_func_available(KM_TDEA_192_ENCRYPT)) 385 !crypt_s390_func_available(KM_TDEA_192_ENCRYPT))
561 return -EOPNOTSUPP; 386 return -EOPNOTSUPP;
562 387
@@ -569,17 +394,6 @@ static int des_s390_init(void)
569 ret = crypto_register_alg(&cbc_des_alg); 394 ret = crypto_register_alg(&cbc_des_alg);
570 if (ret) 395 if (ret)
571 goto cbc_des_err; 396 goto cbc_des_err;
572
573 ret = crypto_register_alg(&des3_128_alg);
574 if (ret)
575 goto des3_128_err;
576 ret = crypto_register_alg(&ecb_des3_128_alg);
577 if (ret)
578 goto ecb_des3_128_err;
579 ret = crypto_register_alg(&cbc_des3_128_alg);
580 if (ret)
581 goto cbc_des3_128_err;
582
583 ret = crypto_register_alg(&des3_192_alg); 397 ret = crypto_register_alg(&des3_192_alg);
584 if (ret) 398 if (ret)
585 goto des3_192_err; 399 goto des3_192_err;
@@ -589,7 +403,6 @@ static int des_s390_init(void)
589 ret = crypto_register_alg(&cbc_des3_192_alg); 403 ret = crypto_register_alg(&cbc_des3_192_alg);
590 if (ret) 404 if (ret)
591 goto cbc_des3_192_err; 405 goto cbc_des3_192_err;
592
593out: 406out:
594 return ret; 407 return ret;
595 408
@@ -598,12 +411,6 @@ cbc_des3_192_err:
598ecb_des3_192_err: 411ecb_des3_192_err:
599 crypto_unregister_alg(&des3_192_alg); 412 crypto_unregister_alg(&des3_192_alg);
600des3_192_err: 413des3_192_err:
601 crypto_unregister_alg(&cbc_des3_128_alg);
602cbc_des3_128_err:
603 crypto_unregister_alg(&ecb_des3_128_alg);
604ecb_des3_128_err:
605 crypto_unregister_alg(&des3_128_alg);
606des3_128_err:
607 crypto_unregister_alg(&cbc_des_alg); 414 crypto_unregister_alg(&cbc_des_alg);
608cbc_des_err: 415cbc_des_err:
609 crypto_unregister_alg(&ecb_des_alg); 416 crypto_unregister_alg(&ecb_des_alg);
@@ -613,21 +420,18 @@ des_err:
613 goto out; 420 goto out;
614} 421}
615 422
616static void __exit des_s390_fini(void) 423static void __exit des_s390_exit(void)
617{ 424{
618 crypto_unregister_alg(&cbc_des3_192_alg); 425 crypto_unregister_alg(&cbc_des3_192_alg);
619 crypto_unregister_alg(&ecb_des3_192_alg); 426 crypto_unregister_alg(&ecb_des3_192_alg);
620 crypto_unregister_alg(&des3_192_alg); 427 crypto_unregister_alg(&des3_192_alg);
621 crypto_unregister_alg(&cbc_des3_128_alg);
622 crypto_unregister_alg(&ecb_des3_128_alg);
623 crypto_unregister_alg(&des3_128_alg);
624 crypto_unregister_alg(&cbc_des_alg); 428 crypto_unregister_alg(&cbc_des_alg);
625 crypto_unregister_alg(&ecb_des_alg); 429 crypto_unregister_alg(&ecb_des_alg);
626 crypto_unregister_alg(&des_alg); 430 crypto_unregister_alg(&des_alg);
627} 431}
628 432
629module_init(des_s390_init); 433module_init(des_s390_init);
630module_exit(des_s390_fini); 434module_exit(des_s390_exit);
631 435
632MODULE_ALIAS("des"); 436MODULE_ALIAS("des");
633MODULE_ALIAS("des3_ede"); 437MODULE_ALIAS("des3_ede");
diff --git a/arch/s390/include/asm/kvm_host.h b/arch/s390/include/asm/kvm_host.h
index 27605b62b980..cef7dbf69dfc 100644
--- a/arch/s390/include/asm/kvm_host.h
+++ b/arch/s390/include/asm/kvm_host.h
@@ -26,7 +26,7 @@
26 26
27struct sca_entry { 27struct sca_entry {
28 atomic_t scn; 28 atomic_t scn;
29 __u64 reserved; 29 __u32 reserved;
30 __u64 sda; 30 __u64 sda;
31 __u64 reserved2[2]; 31 __u64 reserved2[2];
32} __attribute__((packed)); 32} __attribute__((packed));
@@ -41,7 +41,8 @@ struct sca_block {
41} __attribute__((packed)); 41} __attribute__((packed));
42 42
43#define KVM_NR_PAGE_SIZES 2 43#define KVM_NR_PAGE_SIZES 2
44#define KVM_HPAGE_SHIFT(x) (PAGE_SHIFT + ((x) - 1) * 8) 44#define KVM_HPAGE_GFN_SHIFT(x) (((x) - 1) * 8)
45#define KVM_HPAGE_SHIFT(x) (PAGE_SHIFT + KVM_HPAGE_GFN_SHIFT(x))
45#define KVM_HPAGE_SIZE(x) (1UL << KVM_HPAGE_SHIFT(x)) 46#define KVM_HPAGE_SIZE(x) (1UL << KVM_HPAGE_SHIFT(x))
46#define KVM_HPAGE_MASK(x) (~(KVM_HPAGE_SIZE(x) - 1)) 47#define KVM_HPAGE_MASK(x) (~(KVM_HPAGE_SIZE(x) - 1))
47#define KVM_PAGES_PER_HPAGE(x) (KVM_HPAGE_SIZE(x) / PAGE_SIZE) 48#define KVM_PAGES_PER_HPAGE(x) (KVM_HPAGE_SIZE(x) / PAGE_SIZE)
diff --git a/arch/s390/include/asm/local64.h b/arch/s390/include/asm/local64.h
new file mode 100644
index 000000000000..36c93b5cc239
--- /dev/null
+++ b/arch/s390/include/asm/local64.h
@@ -0,0 +1 @@
#include <asm-generic/local64.h>
diff --git a/arch/s390/include/asm/qdio.h b/arch/s390/include/asm/qdio.h
index 0eaae6260274..2ba630276295 100644
--- a/arch/s390/include/asm/qdio.h
+++ b/arch/s390/include/asm/qdio.h
@@ -84,6 +84,7 @@ struct qdr {
84 84
85#define QIB_AC_OUTBOUND_PCI_SUPPORTED 0x40 85#define QIB_AC_OUTBOUND_PCI_SUPPORTED 0x40
86#define QIB_RFLAGS_ENABLE_QEBSM 0x80 86#define QIB_RFLAGS_ENABLE_QEBSM 0x80
87#define QIB_RFLAGS_ENABLE_DATA_DIV 0x02
87 88
88/** 89/**
89 * struct qib - queue information block (QIB) 90 * struct qib - queue information block (QIB)
@@ -284,6 +285,9 @@ struct slsb {
284 u8 val[QDIO_MAX_BUFFERS_PER_Q]; 285 u8 val[QDIO_MAX_BUFFERS_PER_Q];
285} __attribute__ ((packed, aligned(256))); 286} __attribute__ ((packed, aligned(256)));
286 287
288#define CHSC_AC2_DATA_DIV_AVAILABLE 0x0010
289#define CHSC_AC2_DATA_DIV_ENABLED 0x0002
290
287struct qdio_ssqd_desc { 291struct qdio_ssqd_desc {
288 u8 flags; 292 u8 flags;
289 u8:8; 293 u8:8;
@@ -332,6 +336,7 @@ typedef void qdio_handler_t(struct ccw_device *, unsigned int, int,
332 * @adapter_name: name for the adapter 336 * @adapter_name: name for the adapter
333 * @qib_param_field_format: format for qib_parm_field 337 * @qib_param_field_format: format for qib_parm_field
334 * @qib_param_field: pointer to 128 bytes or NULL, if no param field 338 * @qib_param_field: pointer to 128 bytes or NULL, if no param field
339 * @qib_rflags: rflags to set
335 * @input_slib_elements: pointer to no_input_qs * 128 words of data or NULL 340 * @input_slib_elements: pointer to no_input_qs * 128 words of data or NULL
336 * @output_slib_elements: pointer to no_output_qs * 128 words of data or NULL 341 * @output_slib_elements: pointer to no_output_qs * 128 words of data or NULL
337 * @no_input_qs: number of input queues 342 * @no_input_qs: number of input queues
@@ -348,6 +353,7 @@ struct qdio_initialize {
348 unsigned char adapter_name[8]; 353 unsigned char adapter_name[8];
349 unsigned int qib_param_field_format; 354 unsigned int qib_param_field_format;
350 unsigned char *qib_param_field; 355 unsigned char *qib_param_field;
356 unsigned char qib_rflags;
351 unsigned long *input_slib_elements; 357 unsigned long *input_slib_elements;
352 unsigned long *output_slib_elements; 358 unsigned long *output_slib_elements;
353 unsigned int no_input_qs; 359 unsigned int no_input_qs;
diff --git a/arch/s390/kernel/entry.S b/arch/s390/kernel/entry.S
index d5e3e6007447..bea9ee37ac9d 100644
--- a/arch/s390/kernel/entry.S
+++ b/arch/s390/kernel/entry.S
@@ -535,8 +535,16 @@ pgm_no_vtime2:
535 l %r3,__LC_PGM_ILC # load program interruption code 535 l %r3,__LC_PGM_ILC # load program interruption code
536 la %r8,0x7f 536 la %r8,0x7f
537 nr %r8,%r3 # clear per-event-bit and ilc 537 nr %r8,%r3 # clear per-event-bit and ilc
538 be BASED(pgm_exit) # only per or per+check ? 538 be BASED(pgm_exit2) # only per or per+check ?
539 b BASED(pgm_do_call) 539 l %r7,BASED(.Ljump_table)
540 sll %r8,2
541 l %r7,0(%r8,%r7) # load address of handler routine
542 la %r2,SP_PTREGS(%r15) # address of register-save area
543 basr %r14,%r7 # branch to interrupt-handler
544pgm_exit2:
545 TRACE_IRQS_ON
546 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts
547 b BASED(sysc_return)
540 548
541# 549#
542# it was a single stepped SVC that is causing all the trouble 550# it was a single stepped SVC that is causing all the trouble
diff --git a/arch/s390/kernel/entry64.S b/arch/s390/kernel/entry64.S
index e7192e1cb678..8bccec15ea90 100644
--- a/arch/s390/kernel/entry64.S
+++ b/arch/s390/kernel/entry64.S
@@ -544,8 +544,16 @@ pgm_no_vtime2:
544 lgf %r3,__LC_PGM_ILC # load program interruption code 544 lgf %r3,__LC_PGM_ILC # load program interruption code
545 lghi %r8,0x7f 545 lghi %r8,0x7f
546 ngr %r8,%r3 # clear per-event-bit and ilc 546 ngr %r8,%r3 # clear per-event-bit and ilc
547 je pgm_exit 547 je pgm_exit2
548 j pgm_do_call 548 sll %r8,3
549 larl %r1,pgm_check_table
550 lg %r1,0(%r8,%r1) # load address of handler routine
551 la %r2,SP_PTREGS(%r15) # address of register-save area
552 basr %r14,%r1 # branch to interrupt-handler
553pgm_exit2:
554 TRACE_IRQS_ON
555 stosm __SF_EMPTY(%r15),0x03 # reenable interrupts
556 j sysc_return
549 557
550# 558#
551# it was a single stepped SVC that is causing all the trouble 559# it was a single stepped SVC that is causing all the trouble
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index a2163c95eb98..2896cac9c14a 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -207,8 +207,8 @@ struct clocksource * __init clocksource_default_clock(void)
207 return &clocksource_tod; 207 return &clocksource_tod;
208} 208}
209 209
210void update_vsyscall(struct timespec *wall_time, struct clocksource *clock, 210void update_vsyscall(struct timespec *wall_time, struct timespec *wtm,
211 u32 mult) 211 struct clocksource *clock, u32 mult)
212{ 212{
213 if (clock != &clocksource_tod) 213 if (clock != &clocksource_tod)
214 return; 214 return;
@@ -219,8 +219,8 @@ void update_vsyscall(struct timespec *wall_time, struct clocksource *clock,
219 vdso_data->xtime_tod_stamp = clock->cycle_last; 219 vdso_data->xtime_tod_stamp = clock->cycle_last;
220 vdso_data->xtime_clock_sec = wall_time->tv_sec; 220 vdso_data->xtime_clock_sec = wall_time->tv_sec;
221 vdso_data->xtime_clock_nsec = wall_time->tv_nsec; 221 vdso_data->xtime_clock_nsec = wall_time->tv_nsec;
222 vdso_data->wtom_clock_sec = wall_to_monotonic.tv_sec; 222 vdso_data->wtom_clock_sec = wtm->tv_sec;
223 vdso_data->wtom_clock_nsec = wall_to_monotonic.tv_nsec; 223 vdso_data->wtom_clock_nsec = wtm->tv_nsec;
224 vdso_data->ntp_mult = mult; 224 vdso_data->ntp_mult = mult;
225 smp_wmb(); 225 smp_wmb();
226 ++vdso_data->tb_update_count; 226 ++vdso_data->tb_update_count;
@@ -524,8 +524,11 @@ void etr_switch_to_local(void)
524 if (!etr_eacr.sl) 524 if (!etr_eacr.sl)
525 return; 525 return;
526 disable_sync_clock(NULL); 526 disable_sync_clock(NULL);
527 set_bit(ETR_EVENT_SWITCH_LOCAL, &etr_events); 527 if (!test_and_set_bit(ETR_EVENT_SWITCH_LOCAL, &etr_events)) {
528 queue_work(time_sync_wq, &etr_work); 528 etr_eacr.es = etr_eacr.sl = 0;
529 etr_setr(&etr_eacr);
530 queue_work(time_sync_wq, &etr_work);
531 }
529} 532}
530 533
531/* 534/*
@@ -539,8 +542,11 @@ void etr_sync_check(void)
539 if (!etr_eacr.es) 542 if (!etr_eacr.es)
540 return; 543 return;
541 disable_sync_clock(NULL); 544 disable_sync_clock(NULL);
542 set_bit(ETR_EVENT_SYNC_CHECK, &etr_events); 545 if (!test_and_set_bit(ETR_EVENT_SYNC_CHECK, &etr_events)) {
543 queue_work(time_sync_wq, &etr_work); 546 etr_eacr.es = 0;
547 etr_setr(&etr_eacr);
548 queue_work(time_sync_wq, &etr_work);
549 }
544} 550}
545 551
546/* 552/*
@@ -902,7 +908,7 @@ static struct etr_eacr etr_handle_update(struct etr_aib *aib,
902 * Do not try to get the alternate port aib if the clock 908 * Do not try to get the alternate port aib if the clock
903 * is not in sync yet. 909 * is not in sync yet.
904 */ 910 */
905 if (!check_sync_clock()) 911 if (!eacr.es || !check_sync_clock())
906 return eacr; 912 return eacr;
907 913
908 /* 914 /*
@@ -1064,7 +1070,7 @@ static void etr_work_fn(struct work_struct *work)
1064 * If the clock is in sync just update the eacr and return. 1070 * If the clock is in sync just update the eacr and return.
1065 * If there is no valid sync port wait for a port update. 1071 * If there is no valid sync port wait for a port update.
1066 */ 1072 */
1067 if (check_sync_clock() || sync_port < 0) { 1073 if ((eacr.es && check_sync_clock()) || sync_port < 0) {
1068 etr_update_eacr(eacr); 1074 etr_update_eacr(eacr);
1069 etr_set_tolec_timeout(now); 1075 etr_set_tolec_timeout(now);
1070 goto out_unlock; 1076 goto out_unlock;
diff --git a/arch/s390/kvm/intercept.c b/arch/s390/kvm/intercept.c
index 3ddc30895e31..f7b6df45d8be 100644
--- a/arch/s390/kvm/intercept.c
+++ b/arch/s390/kvm/intercept.c
@@ -135,7 +135,7 @@ static int handle_stop(struct kvm_vcpu *vcpu)
135 spin_lock_bh(&vcpu->arch.local_int.lock); 135 spin_lock_bh(&vcpu->arch.local_int.lock);
136 if (vcpu->arch.local_int.action_bits & ACTION_STORE_ON_STOP) { 136 if (vcpu->arch.local_int.action_bits & ACTION_STORE_ON_STOP) {
137 vcpu->arch.local_int.action_bits &= ~ACTION_STORE_ON_STOP; 137 vcpu->arch.local_int.action_bits &= ~ACTION_STORE_ON_STOP;
138 rc = __kvm_s390_vcpu_store_status(vcpu, 138 rc = kvm_s390_vcpu_store_status(vcpu,
139 KVM_S390_STORE_STATUS_NOADDR); 139 KVM_S390_STORE_STATUS_NOADDR);
140 if (rc >= 0) 140 if (rc >= 0)
141 rc = -EOPNOTSUPP; 141 rc = -EOPNOTSUPP;
diff --git a/arch/s390/kvm/kvm-s390.c b/arch/s390/kvm/kvm-s390.c
index ae3705816878..4fe68650535c 100644
--- a/arch/s390/kvm/kvm-s390.c
+++ b/arch/s390/kvm/kvm-s390.c
@@ -207,6 +207,7 @@ out_nokvm:
207void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu) 207void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
208{ 208{
209 VCPU_EVENT(vcpu, 3, "%s", "free cpu"); 209 VCPU_EVENT(vcpu, 3, "%s", "free cpu");
210 clear_bit(63 - vcpu->vcpu_id, (unsigned long *) &vcpu->kvm->arch.sca->mcn);
210 if (vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda == 211 if (vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda ==
211 (__u64) vcpu->arch.sie_block) 212 (__u64) vcpu->arch.sie_block)
212 vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda = 0; 213 vcpu->kvm->arch.sca->cpu[vcpu->vcpu_id].sda = 0;
@@ -296,7 +297,7 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
296{ 297{
297 atomic_set(&vcpu->arch.sie_block->cpuflags, CPUSTAT_ZARCH); 298 atomic_set(&vcpu->arch.sie_block->cpuflags, CPUSTAT_ZARCH);
298 set_bit(KVM_REQ_MMU_RELOAD, &vcpu->requests); 299 set_bit(KVM_REQ_MMU_RELOAD, &vcpu->requests);
299 vcpu->arch.sie_block->ecb = 2; 300 vcpu->arch.sie_block->ecb = 6;
300 vcpu->arch.sie_block->eca = 0xC1002001U; 301 vcpu->arch.sie_block->eca = 0xC1002001U;
301 vcpu->arch.sie_block->fac = (int) (long) facilities; 302 vcpu->arch.sie_block->fac = (int) (long) facilities;
302 hrtimer_init(&vcpu->arch.ckc_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS); 303 hrtimer_init(&vcpu->arch.ckc_timer, CLOCK_REALTIME, HRTIMER_MODE_ABS);
@@ -329,6 +330,7 @@ struct kvm_vcpu *kvm_arch_vcpu_create(struct kvm *kvm,
329 kvm->arch.sca->cpu[id].sda = (__u64) vcpu->arch.sie_block; 330 kvm->arch.sca->cpu[id].sda = (__u64) vcpu->arch.sie_block;
330 vcpu->arch.sie_block->scaoh = (__u32)(((__u64)kvm->arch.sca) >> 32); 331 vcpu->arch.sie_block->scaoh = (__u32)(((__u64)kvm->arch.sca) >> 32);
331 vcpu->arch.sie_block->scaol = (__u32)(__u64)kvm->arch.sca; 332 vcpu->arch.sie_block->scaol = (__u32)(__u64)kvm->arch.sca;
333 set_bit(63 - id, (unsigned long *) &kvm->arch.sca->mcn);
332 334
333 spin_lock_init(&vcpu->arch.local_int.lock); 335 spin_lock_init(&vcpu->arch.local_int.lock);
334 INIT_LIST_HEAD(&vcpu->arch.local_int.list); 336 INIT_LIST_HEAD(&vcpu->arch.local_int.list);
@@ -363,63 +365,49 @@ int kvm_arch_vcpu_runnable(struct kvm_vcpu *vcpu)
363 365
364static int kvm_arch_vcpu_ioctl_initial_reset(struct kvm_vcpu *vcpu) 366static int kvm_arch_vcpu_ioctl_initial_reset(struct kvm_vcpu *vcpu)
365{ 367{
366 vcpu_load(vcpu);
367 kvm_s390_vcpu_initial_reset(vcpu); 368 kvm_s390_vcpu_initial_reset(vcpu);
368 vcpu_put(vcpu);
369 return 0; 369 return 0;
370} 370}
371 371
372int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) 372int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
373{ 373{
374 vcpu_load(vcpu);
375 memcpy(&vcpu->arch.guest_gprs, &regs->gprs, sizeof(regs->gprs)); 374 memcpy(&vcpu->arch.guest_gprs, &regs->gprs, sizeof(regs->gprs));
376 vcpu_put(vcpu);
377 return 0; 375 return 0;
378} 376}
379 377
380int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) 378int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
381{ 379{
382 vcpu_load(vcpu);
383 memcpy(&regs->gprs, &vcpu->arch.guest_gprs, sizeof(regs->gprs)); 380 memcpy(&regs->gprs, &vcpu->arch.guest_gprs, sizeof(regs->gprs));
384 vcpu_put(vcpu);
385 return 0; 381 return 0;
386} 382}
387 383
388int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, 384int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
389 struct kvm_sregs *sregs) 385 struct kvm_sregs *sregs)
390{ 386{
391 vcpu_load(vcpu);
392 memcpy(&vcpu->arch.guest_acrs, &sregs->acrs, sizeof(sregs->acrs)); 387 memcpy(&vcpu->arch.guest_acrs, &sregs->acrs, sizeof(sregs->acrs));
393 memcpy(&vcpu->arch.sie_block->gcr, &sregs->crs, sizeof(sregs->crs)); 388 memcpy(&vcpu->arch.sie_block->gcr, &sregs->crs, sizeof(sregs->crs));
394 vcpu_put(vcpu);
395 return 0; 389 return 0;
396} 390}
397 391
398int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu, 392int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
399 struct kvm_sregs *sregs) 393 struct kvm_sregs *sregs)
400{ 394{
401 vcpu_load(vcpu);
402 memcpy(&sregs->acrs, &vcpu->arch.guest_acrs, sizeof(sregs->acrs)); 395 memcpy(&sregs->acrs, &vcpu->arch.guest_acrs, sizeof(sregs->acrs));
403 memcpy(&sregs->crs, &vcpu->arch.sie_block->gcr, sizeof(sregs->crs)); 396 memcpy(&sregs->crs, &vcpu->arch.sie_block->gcr, sizeof(sregs->crs));
404 vcpu_put(vcpu);
405 return 0; 397 return 0;
406} 398}
407 399
408int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) 400int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
409{ 401{
410 vcpu_load(vcpu);
411 memcpy(&vcpu->arch.guest_fpregs.fprs, &fpu->fprs, sizeof(fpu->fprs)); 402 memcpy(&vcpu->arch.guest_fpregs.fprs, &fpu->fprs, sizeof(fpu->fprs));
412 vcpu->arch.guest_fpregs.fpc = fpu->fpc; 403 vcpu->arch.guest_fpregs.fpc = fpu->fpc;
413 vcpu_put(vcpu);
414 return 0; 404 return 0;
415} 405}
416 406
417int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) 407int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
418{ 408{
419 vcpu_load(vcpu);
420 memcpy(&fpu->fprs, &vcpu->arch.guest_fpregs.fprs, sizeof(fpu->fprs)); 409 memcpy(&fpu->fprs, &vcpu->arch.guest_fpregs.fprs, sizeof(fpu->fprs));
421 fpu->fpc = vcpu->arch.guest_fpregs.fpc; 410 fpu->fpc = vcpu->arch.guest_fpregs.fpc;
422 vcpu_put(vcpu);
423 return 0; 411 return 0;
424} 412}
425 413
@@ -427,14 +415,12 @@ static int kvm_arch_vcpu_ioctl_set_initial_psw(struct kvm_vcpu *vcpu, psw_t psw)
427{ 415{
428 int rc = 0; 416 int rc = 0;
429 417
430 vcpu_load(vcpu);
431 if (atomic_read(&vcpu->arch.sie_block->cpuflags) & CPUSTAT_RUNNING) 418 if (atomic_read(&vcpu->arch.sie_block->cpuflags) & CPUSTAT_RUNNING)
432 rc = -EBUSY; 419 rc = -EBUSY;
433 else { 420 else {
434 vcpu->run->psw_mask = psw.mask; 421 vcpu->run->psw_mask = psw.mask;
435 vcpu->run->psw_addr = psw.addr; 422 vcpu->run->psw_addr = psw.addr;
436 } 423 }
437 vcpu_put(vcpu);
438 return rc; 424 return rc;
439} 425}
440 426
@@ -498,8 +484,6 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
498 int rc; 484 int rc;
499 sigset_t sigsaved; 485 sigset_t sigsaved;
500 486
501 vcpu_load(vcpu);
502
503rerun_vcpu: 487rerun_vcpu:
504 if (vcpu->requests) 488 if (vcpu->requests)
505 if (test_and_clear_bit(KVM_REQ_MMU_RELOAD, &vcpu->requests)) 489 if (test_and_clear_bit(KVM_REQ_MMU_RELOAD, &vcpu->requests))
@@ -568,8 +552,6 @@ rerun_vcpu:
568 if (vcpu->sigset_active) 552 if (vcpu->sigset_active)
569 sigprocmask(SIG_SETMASK, &sigsaved, NULL); 553 sigprocmask(SIG_SETMASK, &sigsaved, NULL);
570 554
571 vcpu_put(vcpu);
572
573 vcpu->stat.exit_userspace++; 555 vcpu->stat.exit_userspace++;
574 return rc; 556 return rc;
575} 557}
@@ -589,7 +571,7 @@ static int __guestcopy(struct kvm_vcpu *vcpu, u64 guestdest, const void *from,
589 * KVM_S390_STORE_STATUS_NOADDR: -> 0x1200 on 64 bit 571 * KVM_S390_STORE_STATUS_NOADDR: -> 0x1200 on 64 bit
590 * KVM_S390_STORE_STATUS_PREFIXED: -> prefix 572 * KVM_S390_STORE_STATUS_PREFIXED: -> prefix
591 */ 573 */
592int __kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr) 574int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr)
593{ 575{
594 const unsigned char archmode = 1; 576 const unsigned char archmode = 1;
595 int prefix; 577 int prefix;
@@ -651,45 +633,42 @@ int __kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr)
651 return 0; 633 return 0;
652} 634}
653 635
654static int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, unsigned long addr)
655{
656 int rc;
657
658 vcpu_load(vcpu);
659 rc = __kvm_s390_vcpu_store_status(vcpu, addr);
660 vcpu_put(vcpu);
661 return rc;
662}
663
664long kvm_arch_vcpu_ioctl(struct file *filp, 636long kvm_arch_vcpu_ioctl(struct file *filp,
665 unsigned int ioctl, unsigned long arg) 637 unsigned int ioctl, unsigned long arg)
666{ 638{
667 struct kvm_vcpu *vcpu = filp->private_data; 639 struct kvm_vcpu *vcpu = filp->private_data;
668 void __user *argp = (void __user *)arg; 640 void __user *argp = (void __user *)arg;
641 long r;
669 642
670 switch (ioctl) { 643 switch (ioctl) {
671 case KVM_S390_INTERRUPT: { 644 case KVM_S390_INTERRUPT: {
672 struct kvm_s390_interrupt s390int; 645 struct kvm_s390_interrupt s390int;
673 646
647 r = -EFAULT;
674 if (copy_from_user(&s390int, argp, sizeof(s390int))) 648 if (copy_from_user(&s390int, argp, sizeof(s390int)))
675 return -EFAULT; 649 break;
676 return kvm_s390_inject_vcpu(vcpu, &s390int); 650 r = kvm_s390_inject_vcpu(vcpu, &s390int);
651 break;
677 } 652 }
678 case KVM_S390_STORE_STATUS: 653 case KVM_S390_STORE_STATUS:
679 return kvm_s390_vcpu_store_status(vcpu, arg); 654 r = kvm_s390_vcpu_store_status(vcpu, arg);
655 break;
680 case KVM_S390_SET_INITIAL_PSW: { 656 case KVM_S390_SET_INITIAL_PSW: {
681 psw_t psw; 657 psw_t psw;
682 658
659 r = -EFAULT;
683 if (copy_from_user(&psw, argp, sizeof(psw))) 660 if (copy_from_user(&psw, argp, sizeof(psw)))
684 return -EFAULT; 661 break;
685 return kvm_arch_vcpu_ioctl_set_initial_psw(vcpu, psw); 662 r = kvm_arch_vcpu_ioctl_set_initial_psw(vcpu, psw);
663 break;
686 } 664 }
687 case KVM_S390_INITIAL_RESET: 665 case KVM_S390_INITIAL_RESET:
688 return kvm_arch_vcpu_ioctl_initial_reset(vcpu); 666 r = kvm_arch_vcpu_ioctl_initial_reset(vcpu);
667 break;
689 default: 668 default:
690 ; 669 r = -EINVAL;
691 } 670 }
692 return -EINVAL; 671 return r;
693} 672}
694 673
695/* Section: memory related */ 674/* Section: memory related */
@@ -744,11 +723,6 @@ void kvm_arch_flush_shadow(struct kvm *kvm)
744{ 723{
745} 724}
746 725
747gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn)
748{
749 return gfn;
750}
751
752static int __init kvm_s390_init(void) 726static int __init kvm_s390_init(void)
753{ 727{
754 int ret; 728 int ret;
diff --git a/arch/s390/kvm/kvm-s390.h b/arch/s390/kvm/kvm-s390.h
index cfa9d1777457..a7b7586626db 100644
--- a/arch/s390/kvm/kvm-s390.h
+++ b/arch/s390/kvm/kvm-s390.h
@@ -92,7 +92,7 @@ int kvm_s390_handle_b2(struct kvm_vcpu *vcpu);
92int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu); 92int kvm_s390_handle_sigp(struct kvm_vcpu *vcpu);
93 93
94/* implemented in kvm-s390.c */ 94/* implemented in kvm-s390.c */
95int __kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu, 95int kvm_s390_vcpu_store_status(struct kvm_vcpu *vcpu,
96 unsigned long addr); 96 unsigned long addr);
97/* implemented in diag.c */ 97/* implemented in diag.c */
98int kvm_s390_handle_diag(struct kvm_vcpu *vcpu); 98int kvm_s390_handle_diag(struct kvm_vcpu *vcpu);
diff --git a/arch/score/Kconfig b/arch/score/Kconfig
index 55d413e6dcf2..be4a15584751 100644
--- a/arch/score/Kconfig
+++ b/arch/score/Kconfig
@@ -55,9 +55,6 @@ config GENERIC_CALIBRATE_DELAY
55config GENERIC_CLOCKEVENTS 55config GENERIC_CLOCKEVENTS
56 def_bool y 56 def_bool y
57 57
58config GENERIC_TIME
59 def_bool y
60
61config SCHED_NO_NO_OMIT_FRAME_POINTER 58config SCHED_NO_NO_OMIT_FRAME_POINTER
62 def_bool y 59 def_bool y
63 60
diff --git a/arch/score/Makefile b/arch/score/Makefile
index 68e0cd06d5c9..d77dc639d8e3 100644
--- a/arch/score/Makefile
+++ b/arch/score/Makefile
@@ -20,7 +20,8 @@ cflags-y += -G0 -pipe -mel -mnhwloop -D__SCOREEL__ \
20# 20#
21KBUILD_AFLAGS += $(cflags-y) 21KBUILD_AFLAGS += $(cflags-y)
22KBUILD_CFLAGS += $(cflags-y) 22KBUILD_CFLAGS += $(cflags-y)
23MODFLAGS += -mlong-calls 23KBUILD_AFLAGS_MODULE += -mlong-calls
24KBUILD_CFLAGS_MODULE += -mlong-calls
24LDFLAGS += --oformat elf32-littlescore 25LDFLAGS += --oformat elf32-littlescore
25LDFLAGS_vmlinux += -G0 -static -nostdlib 26LDFLAGS_vmlinux += -G0 -static -nostdlib
26 27
diff --git a/arch/score/include/asm/local64.h b/arch/score/include/asm/local64.h
new file mode 100644
index 000000000000..36c93b5cc239
--- /dev/null
+++ b/arch/score/include/asm/local64.h
@@ -0,0 +1 @@
#include <asm-generic/local64.h>
diff --git a/arch/sh/Kconfig b/arch/sh/Kconfig
index 82868fee21fd..33990fa95af0 100644
--- a/arch/sh/Kconfig
+++ b/arch/sh/Kconfig
@@ -98,9 +98,6 @@ config GENERIC_CALIBRATE_DELAY
98config GENERIC_IOMAP 98config GENERIC_IOMAP
99 bool 99 bool
100 100
101config GENERIC_TIME
102 def_bool y
103
104config GENERIC_CLOCKEVENTS 101config GENERIC_CLOCKEVENTS
105 def_bool y 102 def_bool y
106 103
diff --git a/arch/sh/boards/mach-ap325rxa/setup.c b/arch/sh/boards/mach-ap325rxa/setup.c
index 3a170bd3f3d0..de375b64e410 100644
--- a/arch/sh/boards/mach-ap325rxa/setup.c
+++ b/arch/sh/boards/mach-ap325rxa/setup.c
@@ -316,7 +316,7 @@ static struct soc_camera_platform_info camera_info = {
316 .format_name = "UYVY", 316 .format_name = "UYVY",
317 .format_depth = 16, 317 .format_depth = 16,
318 .format = { 318 .format = {
319 .code = V4L2_MBUS_FMT_YUYV8_2X8_BE, 319 .code = V4L2_MBUS_FMT_UYVY8_2X8,
320 .colorspace = V4L2_COLORSPACE_SMPTE170M, 320 .colorspace = V4L2_COLORSPACE_SMPTE170M,
321 .field = V4L2_FIELD_NONE, 321 .field = V4L2_FIELD_NONE,
322 .width = 640, 322 .width = 640,
diff --git a/arch/sh/include/asm/local64.h b/arch/sh/include/asm/local64.h
new file mode 100644
index 000000000000..36c93b5cc239
--- /dev/null
+++ b/arch/sh/include/asm/local64.h
@@ -0,0 +1 @@
#include <asm-generic/local64.h>
diff --git a/arch/sh/kernel/clkdev.c b/arch/sh/kernel/clkdev.c
index defdd6e30908..befc255830a4 100644
--- a/arch/sh/kernel/clkdev.c
+++ b/arch/sh/kernel/clkdev.c
@@ -36,7 +36,7 @@ static DEFINE_MUTEX(clocks_mutex);
36 * If an entry has a device ID, it must match 36 * If an entry has a device ID, it must match
37 * If an entry has a connection ID, it must match 37 * If an entry has a connection ID, it must match
38 * Then we take the most specific entry - with the following 38 * Then we take the most specific entry - with the following
39 * order of precidence: dev+con > dev only > con only. 39 * order of precedence: dev+con > dev only > con only.
40 */ 40 */
41static struct clk *clk_find(const char *dev_id, const char *con_id) 41static struct clk *clk_find(const char *dev_id, const char *con_id)
42{ 42{
diff --git a/arch/sh/kernel/perf_event.c b/arch/sh/kernel/perf_event.c
index 81b6de41ae5d..7a3dc3567258 100644
--- a/arch/sh/kernel/perf_event.c
+++ b/arch/sh/kernel/perf_event.c
@@ -185,10 +185,10 @@ static void sh_perf_event_update(struct perf_event *event,
185 * this is the simplest approach for maintaining consistency. 185 * this is the simplest approach for maintaining consistency.
186 */ 186 */
187again: 187again:
188 prev_raw_count = atomic64_read(&hwc->prev_count); 188 prev_raw_count = local64_read(&hwc->prev_count);
189 new_raw_count = sh_pmu->read(idx); 189 new_raw_count = sh_pmu->read(idx);
190 190
191 if (atomic64_cmpxchg(&hwc->prev_count, prev_raw_count, 191 if (local64_cmpxchg(&hwc->prev_count, prev_raw_count,
192 new_raw_count) != prev_raw_count) 192 new_raw_count) != prev_raw_count)
193 goto again; 193 goto again;
194 194
@@ -203,7 +203,7 @@ again:
203 delta = (new_raw_count << shift) - (prev_raw_count << shift); 203 delta = (new_raw_count << shift) - (prev_raw_count << shift);
204 delta >>= shift; 204 delta >>= shift;
205 205
206 atomic64_add(delta, &event->count); 206 local64_add(delta, &event->count);
207} 207}
208 208
209static void sh_pmu_disable(struct perf_event *event) 209static void sh_pmu_disable(struct perf_event *event)
diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig
index c0015db247ba..491e9d6de191 100644
--- a/arch/sparc/Kconfig
+++ b/arch/sparc/Kconfig
@@ -18,6 +18,7 @@ config 64BIT
18config SPARC 18config SPARC
19 bool 19 bool
20 default y 20 default y
21 select OF
21 select HAVE_IDE 22 select HAVE_IDE
22 select HAVE_OPROFILE 23 select HAVE_OPROFILE
23 select HAVE_ARCH_KGDB if !SMP || SPARC64 24 select HAVE_ARCH_KGDB if !SMP || SPARC64
@@ -66,9 +67,6 @@ config BITS
66 default 32 if SPARC32 67 default 32 if SPARC32
67 default 64 if SPARC64 68 default 64 if SPARC64
68 69
69config GENERIC_TIME
70 def_bool y
71
72config ARCH_USES_GETTIMEOFFSET 70config ARCH_USES_GETTIMEOFFSET
73 bool 71 bool
74 default y if SPARC32 72 default y if SPARC32
@@ -148,9 +146,6 @@ config GENERIC_GPIO
148config ARCH_NO_VIRT_TO_BUS 146config ARCH_NO_VIRT_TO_BUS
149 def_bool y 147 def_bool y
150 148
151config OF
152 def_bool y
153
154config ARCH_SUPPORTS_DEBUG_PAGEALLOC 149config ARCH_SUPPORTS_DEBUG_PAGEALLOC
155 def_bool y if SPARC64 150 def_bool y if SPARC64
156 151
diff --git a/arch/sparc/boot/btfixupprep.c b/arch/sparc/boot/btfixupprep.c
index e7f2940bd270..da031159e2b7 100644
--- a/arch/sparc/boot/btfixupprep.c
+++ b/arch/sparc/boot/btfixupprep.c
@@ -216,7 +216,7 @@ main1:
216 switch (buffer[nbase+3]) { 216 switch (buffer[nbase+3]) {
217 case 'f': 217 case 'f':
218 if (initval) { 218 if (initval) {
219 fprintf(stderr, "Cannot use pre-initalized fixups for calls\n%s\n", buffer); 219 fprintf(stderr, "Cannot use pre-initialized fixups for calls\n%s\n", buffer);
220 exit(1); 220 exit(1);
221 } 221 }
222 if (!strcmp (sect, "__ksymtab")) { 222 if (!strcmp (sect, "__ksymtab")) {
@@ -273,7 +273,7 @@ main1:
273 break; 273 break;
274 case 'i': 274 case 'i':
275 if (initval) { 275 if (initval) {
276 fprintf(stderr, "Cannot use pre-initalized fixups for INT\n%s\n", buffer); 276 fprintf(stderr, "Cannot use pre-initialized fixups for INT\n%s\n", buffer);
277 exit(1); 277 exit(1);
278 } 278 }
279 if (strncmp (buffer + mode+9, "HI22 ", 10) && strncmp (buffer + mode+9, "LO10 ", 10)) { 279 if (strncmp (buffer + mode+9, "HI22 ", 10) && strncmp (buffer + mode+9, "LO10 ", 10)) {
diff --git a/arch/sparc/include/asm/device.h b/arch/sparc/include/asm/device.h
index d4c452147412..daa6a8a5e9cd 100644
--- a/arch/sparc/include/asm/device.h
+++ b/arch/sparc/include/asm/device.h
@@ -6,18 +6,25 @@
6#ifndef _ASM_SPARC_DEVICE_H 6#ifndef _ASM_SPARC_DEVICE_H
7#define _ASM_SPARC_DEVICE_H 7#define _ASM_SPARC_DEVICE_H
8 8
9#include <asm/openprom.h>
10
9struct device_node; 11struct device_node;
10struct of_device; 12struct platform_device;
11 13
12struct dev_archdata { 14struct dev_archdata {
13 void *iommu; 15 void *iommu;
14 void *stc; 16 void *stc;
15 void *host_controller; 17 void *host_controller;
16 struct of_device *op; 18 struct platform_device *op;
17 int numa_node; 19 int numa_node;
18}; 20};
19 21
22extern void of_propagate_archdata(struct platform_device *bus);
23
20struct pdev_archdata { 24struct pdev_archdata {
25 struct resource resource[PROMREG_MAX];
26 unsigned int irqs[PROMINTR_MAX];
27 int num_irqs;
21}; 28};
22 29
23#endif /* _ASM_SPARC_DEVICE_H */ 30#endif /* _ASM_SPARC_DEVICE_H */
diff --git a/arch/sparc/include/asm/floppy_64.h b/arch/sparc/include/asm/floppy_64.h
index 8fac3ab22f36..6597ce874d78 100644
--- a/arch/sparc/include/asm/floppy_64.h
+++ b/arch/sparc/include/asm/floppy_64.h
@@ -43,7 +43,7 @@ struct sun_flpy_controller {
43/* You'll only ever find one controller on an Ultra anyways. */ 43/* You'll only ever find one controller on an Ultra anyways. */
44static struct sun_flpy_controller *sun_fdc = (struct sun_flpy_controller *)-1; 44static struct sun_flpy_controller *sun_fdc = (struct sun_flpy_controller *)-1;
45unsigned long fdc_status; 45unsigned long fdc_status;
46static struct of_device *floppy_op = NULL; 46static struct platform_device *floppy_op = NULL;
47 47
48struct sun_floppy_ops { 48struct sun_floppy_ops {
49 unsigned char (*fd_inb) (unsigned long port); 49 unsigned char (*fd_inb) (unsigned long port);
@@ -548,7 +548,7 @@ static unsigned long __init sun_floppy_init(void)
548{ 548{
549 static int initialized = 0; 549 static int initialized = 0;
550 struct device_node *dp; 550 struct device_node *dp;
551 struct of_device *op; 551 struct platform_device *op;
552 const char *prop; 552 const char *prop;
553 char state[128]; 553 char state[128];
554 554
@@ -567,7 +567,7 @@ static unsigned long __init sun_floppy_init(void)
567 } 567 }
568 if (op) { 568 if (op) {
569 floppy_op = op; 569 floppy_op = op;
570 FLOPPY_IRQ = op->irqs[0]; 570 FLOPPY_IRQ = op->archdata.irqs[0];
571 } else { 571 } else {
572 struct device_node *ebus_dp; 572 struct device_node *ebus_dp;
573 void __iomem *auxio_reg; 573 void __iomem *auxio_reg;
@@ -593,7 +593,7 @@ static unsigned long __init sun_floppy_init(void)
593 if (state_prop && !strncmp(state_prop, "disabled", 8)) 593 if (state_prop && !strncmp(state_prop, "disabled", 8))
594 return 0; 594 return 0;
595 595
596 FLOPPY_IRQ = op->irqs[0]; 596 FLOPPY_IRQ = op->archdata.irqs[0];
597 597
598 /* Make sure the high density bit is set, some systems 598 /* Make sure the high density bit is set, some systems
599 * (most notably Ultra5/Ultra10) come up with it clear. 599 * (most notably Ultra5/Ultra10) come up with it clear.
@@ -661,7 +661,7 @@ static unsigned long __init sun_floppy_init(void)
661 config = 0; 661 config = 0;
662 for (dp = ebus_dp->child; dp; dp = dp->sibling) { 662 for (dp = ebus_dp->child; dp; dp = dp->sibling) {
663 if (!strcmp(dp->name, "ecpp")) { 663 if (!strcmp(dp->name, "ecpp")) {
664 struct of_device *ecpp_op; 664 struct platform_device *ecpp_op;
665 665
666 ecpp_op = of_find_device_by_node(dp); 666 ecpp_op = of_find_device_by_node(dp);
667 if (ecpp_op) 667 if (ecpp_op)
diff --git a/arch/sparc/include/asm/local64.h b/arch/sparc/include/asm/local64.h
new file mode 100644
index 000000000000..36c93b5cc239
--- /dev/null
+++ b/arch/sparc/include/asm/local64.h
@@ -0,0 +1 @@
#include <asm-generic/local64.h>
diff --git a/arch/sparc/include/asm/of_device.h b/arch/sparc/include/asm/of_device.h
deleted file mode 100644
index f320246a0586..000000000000
--- a/arch/sparc/include/asm/of_device.h
+++ /dev/null
@@ -1,38 +0,0 @@
1#ifndef _ASM_SPARC_OF_DEVICE_H
2#define _ASM_SPARC_OF_DEVICE_H
3#ifdef __KERNEL__
4
5#include <linux/device.h>
6#include <linux/of.h>
7#include <linux/mod_devicetable.h>
8#include <asm/openprom.h>
9
10/*
11 * The of_device is a kind of "base class" that is a superset of
12 * struct device for use by devices attached to an OF node and
13 * probed using OF properties.
14 */
15struct of_device
16{
17 struct device dev;
18 struct resource resource[PROMREG_MAX];
19 unsigned int irqs[PROMINTR_MAX];
20 int num_irqs;
21
22 void *sysdata;
23
24 int slot;
25 int portid;
26 int clock_freq;
27};
28
29extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
30extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size);
31
32extern void of_propagate_archdata(struct of_device *bus);
33
34/* This is just here during the transition */
35#include <linux/of_platform.h>
36
37#endif /* __KERNEL__ */
38#endif /* _ASM_SPARC_OF_DEVICE_H */
diff --git a/arch/sparc/include/asm/of_platform.h b/arch/sparc/include/asm/of_platform.h
deleted file mode 100644
index 90da99059f83..000000000000
--- a/arch/sparc/include/asm/of_platform.h
+++ /dev/null
@@ -1,18 +0,0 @@
1#ifndef ___ASM_SPARC_OF_PLATFORM_H
2#define ___ASM_SPARC_OF_PLATFORM_H
3/*
4 * Copyright (C) 2006 Benjamin Herrenschmidt, IBM Corp.
5 * <benh@kernel.crashing.org>
6 * Modified for Sparc by merging parts of asm/of_device.h
7 * by Stephen Rothwell
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version
12 * 2 of the License, or (at your option) any later version.
13 *
14 */
15
16#define of_bus_type of_platform_bus_type /* for compatibility */
17
18#endif
diff --git a/arch/sparc/include/asm/parport.h b/arch/sparc/include/asm/parport.h
index c333b8d0949b..4f7afa01b2ae 100644
--- a/arch/sparc/include/asm/parport.h
+++ b/arch/sparc/include/asm/parport.h
@@ -103,7 +103,7 @@ static inline unsigned int get_dma_residue(unsigned int dmanr)
103 return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info); 103 return ebus_dma_residue(&sparc_ebus_dmas[dmanr].info);
104} 104}
105 105
106static int __devinit ecpp_probe(struct of_device *op, const struct of_device_id *match) 106static int __devinit ecpp_probe(struct platform_device *op, const struct of_device_id *match)
107{ 107{
108 unsigned long base = op->resource[0].start; 108 unsigned long base = op->resource[0].start;
109 unsigned long config = op->resource[1].start; 109 unsigned long config = op->resource[1].start;
@@ -116,7 +116,7 @@ static int __devinit ecpp_probe(struct of_device *op, const struct of_device_id
116 parent = op->dev.of_node->parent; 116 parent = op->dev.of_node->parent;
117 if (!strcmp(parent->name, "dma")) { 117 if (!strcmp(parent->name, "dma")) {
118 p = parport_pc_probe_port(base, base + 0x400, 118 p = parport_pc_probe_port(base, base + 0x400,
119 op->irqs[0], PARPORT_DMA_NOFIFO, 119 op->archdata.irqs[0], PARPORT_DMA_NOFIFO,
120 op->dev.parent->parent, 0); 120 op->dev.parent->parent, 0);
121 if (!p) 121 if (!p)
122 return -ENOMEM; 122 return -ENOMEM;
@@ -166,7 +166,7 @@ static int __devinit ecpp_probe(struct of_device *op, const struct of_device_id
166 0, PTR_LPT_REG_DIR); 166 0, PTR_LPT_REG_DIR);
167 167
168 p = parport_pc_probe_port(base, base + 0x400, 168 p = parport_pc_probe_port(base, base + 0x400,
169 op->irqs[0], 169 op->archdata.irqs[0],
170 slot, 170 slot,
171 op->dev.parent, 171 op->dev.parent,
172 0); 172 0);
@@ -192,7 +192,7 @@ out_err:
192 return err; 192 return err;
193} 193}
194 194
195static int __devexit ecpp_remove(struct of_device *op) 195static int __devexit ecpp_remove(struct platform_device *op)
196{ 196{
197 struct parport *p = dev_get_drvdata(&op->dev); 197 struct parport *p = dev_get_drvdata(&op->dev);
198 int slot = p->dma; 198 int slot = p->dma;
@@ -243,9 +243,7 @@ static struct of_platform_driver ecpp_driver = {
243 243
244static int parport_pc_find_nonpci_ports(int autoirq, int autodma) 244static int parport_pc_find_nonpci_ports(int autoirq, int autodma)
245{ 245{
246 of_register_driver(&ecpp_driver, &of_bus_type); 246 return of_register_platform_driver(&ecpp_driver);
247
248 return 0;
249} 247}
250 248
251#endif /* !(_ASM_SPARC64_PARPORT_H */ 249#endif /* !(_ASM_SPARC64_PARPORT_H */
diff --git a/arch/sparc/include/asm/perf_event.h b/arch/sparc/include/asm/perf_event.h
index 7e2669894ce8..74c4e0cd889c 100644
--- a/arch/sparc/include/asm/perf_event.h
+++ b/arch/sparc/include/asm/perf_event.h
@@ -6,7 +6,15 @@ extern void set_perf_event_pending(void);
6#define PERF_EVENT_INDEX_OFFSET 0 6#define PERF_EVENT_INDEX_OFFSET 0
7 7
8#ifdef CONFIG_PERF_EVENTS 8#ifdef CONFIG_PERF_EVENTS
9#include <asm/ptrace.h>
10
9extern void init_hw_perf_events(void); 11extern void init_hw_perf_events(void);
12
13extern void
14__perf_arch_fetch_caller_regs(struct pt_regs *regs, unsigned long ip, int skip);
15
16#define perf_arch_fetch_caller_regs(pt_regs, ip) \
17 __perf_arch_fetch_caller_regs(pt_regs, ip, 1);
10#else 18#else
11static inline void init_hw_perf_events(void) { } 19static inline void init_hw_perf_events(void) { }
12#endif 20#endif
diff --git a/arch/sparc/include/asm/prom.h b/arch/sparc/include/asm/prom.h
index f845828ca4c6..291f12575edd 100644
--- a/arch/sparc/include/asm/prom.h
+++ b/arch/sparc/include/asm/prom.h
@@ -43,20 +43,22 @@ extern int of_getintprop_default(struct device_node *np,
43extern int of_find_in_proplist(const char *list, const char *match, int len); 43extern int of_find_in_proplist(const char *list, const char *match, int len);
44#ifdef CONFIG_NUMA 44#ifdef CONFIG_NUMA
45extern int of_node_to_nid(struct device_node *dp); 45extern int of_node_to_nid(struct device_node *dp);
46#else 46#define of_node_to_nid of_node_to_nid
47#define of_node_to_nid(dp) (-1)
48#endif 47#endif
49 48
50extern void prom_build_devicetree(void); 49extern void prom_build_devicetree(void);
51extern void of_populate_present_mask(void); 50extern void of_populate_present_mask(void);
52extern void of_fill_in_cpu_data(void); 51extern void of_fill_in_cpu_data(void);
53 52
53struct resource;
54extern void __iomem *of_ioremap(struct resource *res, unsigned long offset, unsigned long size, char *name);
55extern void of_iounmap(struct resource *res, void __iomem *base, unsigned long size);
56
54/* These routines are here to provide compatibility with how powerpc 57/* These routines are here to provide compatibility with how powerpc
55 * handles IRQ mapping for OF device nodes. We precompute and permanently 58 * handles IRQ mapping for OF device nodes. We precompute and permanently
56 * register them in the of_device objects, whereas powerpc computes them 59 * register them in the platform_device objects, whereas powerpc computes them
57 * on request. 60 * on request.
58 */ 61 */
59extern unsigned int irq_of_parse_and_map(struct device_node *node, int index);
60static inline void irq_dispose_mapping(unsigned int virq) 62static inline void irq_dispose_mapping(unsigned int virq)
61{ 63{
62} 64}
diff --git a/arch/sparc/kernel/apc.c b/arch/sparc/kernel/apc.c
index b27476caa133..2c0046ecc715 100644
--- a/arch/sparc/kernel/apc.c
+++ b/arch/sparc/kernel/apc.c
@@ -68,7 +68,7 @@ static void apc_swift_idle(void)
68#endif 68#endif
69} 69}
70 70
71static inline void apc_free(struct of_device *op) 71static inline void apc_free(struct platform_device *op)
72{ 72{
73 of_iounmap(&op->resource[0], regs, resource_size(&op->resource[0])); 73 of_iounmap(&op->resource[0], regs, resource_size(&op->resource[0]));
74} 74}
@@ -136,7 +136,7 @@ static const struct file_operations apc_fops = {
136 136
137static struct miscdevice apc_miscdev = { APC_MINOR, APC_DEVNAME, &apc_fops }; 137static struct miscdevice apc_miscdev = { APC_MINOR, APC_DEVNAME, &apc_fops };
138 138
139static int __devinit apc_probe(struct of_device *op, 139static int __devinit apc_probe(struct platform_device *op,
140 const struct of_device_id *match) 140 const struct of_device_id *match)
141{ 141{
142 int err; 142 int err;
@@ -184,7 +184,7 @@ static struct of_platform_driver apc_driver = {
184 184
185static int __init apc_init(void) 185static int __init apc_init(void)
186{ 186{
187 return of_register_driver(&apc_driver, &of_bus_type); 187 return of_register_platform_driver(&apc_driver);
188} 188}
189 189
190/* This driver is not critical to the boot process 190/* This driver is not critical to the boot process
diff --git a/arch/sparc/kernel/auxio_64.c b/arch/sparc/kernel/auxio_64.c
index ddc84128b3c2..3efd3c5af6a9 100644
--- a/arch/sparc/kernel/auxio_64.c
+++ b/arch/sparc/kernel/auxio_64.c
@@ -102,7 +102,8 @@ static struct of_device_id __initdata auxio_match[] = {
102 102
103MODULE_DEVICE_TABLE(of, auxio_match); 103MODULE_DEVICE_TABLE(of, auxio_match);
104 104
105static int __devinit auxio_probe(struct of_device *dev, const struct of_device_id *match) 105static int __devinit auxio_probe(struct platform_device *dev,
106 const struct of_device_id *match)
106{ 107{
107 struct device_node *dp = dev->dev.of_node; 108 struct device_node *dp = dev->dev.of_node;
108 unsigned long size; 109 unsigned long size;
@@ -142,7 +143,7 @@ static struct of_platform_driver auxio_driver = {
142 143
143static int __init auxio_init(void) 144static int __init auxio_init(void)
144{ 145{
145 return of_register_driver(&auxio_driver, &of_platform_bus_type); 146 return of_register_platform_driver(&auxio_driver);
146} 147}
147 148
148/* Must be after subsys_initcall() so that busses are probed. Must 149/* Must be after subsys_initcall() so that busses are probed. Must
diff --git a/arch/sparc/kernel/central.c b/arch/sparc/kernel/central.c
index 434335f65823..cfa2624c5332 100644
--- a/arch/sparc/kernel/central.c
+++ b/arch/sparc/kernel/central.c
@@ -59,7 +59,7 @@ static int __devinit clock_board_calc_nslots(struct clock_board *p)
59 } 59 }
60} 60}
61 61
62static int __devinit clock_board_probe(struct of_device *op, 62static int __devinit clock_board_probe(struct platform_device *op,
63 const struct of_device_id *match) 63 const struct of_device_id *match)
64{ 64{
65 struct clock_board *p = kzalloc(sizeof(*p), GFP_KERNEL); 65 struct clock_board *p = kzalloc(sizeof(*p), GFP_KERNEL);
@@ -157,7 +157,7 @@ static struct of_platform_driver clock_board_driver = {
157 }, 157 },
158}; 158};
159 159
160static int __devinit fhc_probe(struct of_device *op, 160static int __devinit fhc_probe(struct platform_device *op,
161 const struct of_device_id *match) 161 const struct of_device_id *match)
162{ 162{
163 struct fhc *p = kzalloc(sizeof(*p), GFP_KERNEL); 163 struct fhc *p = kzalloc(sizeof(*p), GFP_KERNEL);
@@ -265,8 +265,8 @@ static struct of_platform_driver fhc_driver = {
265 265
266static int __init sunfire_init(void) 266static int __init sunfire_init(void)
267{ 267{
268 (void) of_register_driver(&fhc_driver, &of_platform_bus_type); 268 (void) of_register_platform_driver(&fhc_driver);
269 (void) of_register_driver(&clock_board_driver, &of_platform_bus_type); 269 (void) of_register_platform_driver(&clock_board_driver);
270 return 0; 270 return 0;
271} 271}
272 272
diff --git a/arch/sparc/kernel/chmc.c b/arch/sparc/kernel/chmc.c
index 870cb65b3f21..08c466ebb32b 100644
--- a/arch/sparc/kernel/chmc.c
+++ b/arch/sparc/kernel/chmc.c
@@ -392,7 +392,7 @@ static void __devinit jbusmc_construct_dimm_groups(struct jbusmc *p,
392 } 392 }
393} 393}
394 394
395static int __devinit jbusmc_probe(struct of_device *op, 395static int __devinit jbusmc_probe(struct platform_device *op,
396 const struct of_device_id *match) 396 const struct of_device_id *match)
397{ 397{
398 const struct linux_prom64_registers *mem_regs; 398 const struct linux_prom64_registers *mem_regs;
@@ -690,7 +690,7 @@ static void chmc_fetch_decode_regs(struct chmc *p)
690 chmc_read_mcreg(p, CHMCTRL_DECODE4)); 690 chmc_read_mcreg(p, CHMCTRL_DECODE4));
691} 691}
692 692
693static int __devinit chmc_probe(struct of_device *op, 693static int __devinit chmc_probe(struct platform_device *op,
694 const struct of_device_id *match) 694 const struct of_device_id *match)
695{ 695{
696 struct device_node *dp = op->dev.of_node; 696 struct device_node *dp = op->dev.of_node;
@@ -765,7 +765,7 @@ out_free:
765 goto out; 765 goto out;
766} 766}
767 767
768static int __devinit us3mc_probe(struct of_device *op, 768static int __devinit us3mc_probe(struct platform_device *op,
769 const struct of_device_id *match) 769 const struct of_device_id *match)
770{ 770{
771 if (mc_type == MC_TYPE_SAFARI) 771 if (mc_type == MC_TYPE_SAFARI)
@@ -775,21 +775,21 @@ static int __devinit us3mc_probe(struct of_device *op,
775 return -ENODEV; 775 return -ENODEV;
776} 776}
777 777
778static void __devexit chmc_destroy(struct of_device *op, struct chmc *p) 778static void __devexit chmc_destroy(struct platform_device *op, struct chmc *p)
779{ 779{
780 list_del(&p->list); 780 list_del(&p->list);
781 of_iounmap(&op->resource[0], p->regs, 0x48); 781 of_iounmap(&op->resource[0], p->regs, 0x48);
782 kfree(p); 782 kfree(p);
783} 783}
784 784
785static void __devexit jbusmc_destroy(struct of_device *op, struct jbusmc *p) 785static void __devexit jbusmc_destroy(struct platform_device *op, struct jbusmc *p)
786{ 786{
787 mc_list_del(&p->list); 787 mc_list_del(&p->list);
788 of_iounmap(&op->resource[0], p->regs, JBUSMC_REGS_SIZE); 788 of_iounmap(&op->resource[0], p->regs, JBUSMC_REGS_SIZE);
789 kfree(p); 789 kfree(p);
790} 790}
791 791
792static int __devexit us3mc_remove(struct of_device *op) 792static int __devexit us3mc_remove(struct platform_device *op)
793{ 793{
794 void *p = dev_get_drvdata(&op->dev); 794 void *p = dev_get_drvdata(&op->dev);
795 795
@@ -848,7 +848,7 @@ static int __init us3mc_init(void)
848 ret = register_dimm_printer(us3mc_dimm_printer); 848 ret = register_dimm_printer(us3mc_dimm_printer);
849 849
850 if (!ret) { 850 if (!ret) {
851 ret = of_register_driver(&us3mc_driver, &of_bus_type); 851 ret = of_register_platform_driver(&us3mc_driver);
852 if (ret) 852 if (ret)
853 unregister_dimm_printer(us3mc_dimm_printer); 853 unregister_dimm_printer(us3mc_dimm_printer);
854 } 854 }
@@ -859,7 +859,7 @@ static void __exit us3mc_cleanup(void)
859{ 859{
860 if (us3mc_platform()) { 860 if (us3mc_platform()) {
861 unregister_dimm_printer(us3mc_dimm_printer); 861 unregister_dimm_printer(us3mc_dimm_printer);
862 of_unregister_driver(&us3mc_driver); 862 of_unregister_platform_driver(&us3mc_driver);
863 } 863 }
864} 864}
865 865
diff --git a/arch/sparc/kernel/helpers.S b/arch/sparc/kernel/helpers.S
index 92090cc9e829..682fee06a16b 100644
--- a/arch/sparc/kernel/helpers.S
+++ b/arch/sparc/kernel/helpers.S
@@ -47,9 +47,9 @@ stack_trace_flush:
47 .size stack_trace_flush,.-stack_trace_flush 47 .size stack_trace_flush,.-stack_trace_flush
48 48
49#ifdef CONFIG_PERF_EVENTS 49#ifdef CONFIG_PERF_EVENTS
50 .globl perf_arch_fetch_caller_regs 50 .globl __perf_arch_fetch_caller_regs
51 .type perf_arch_fetch_caller_regs,#function 51 .type __perf_arch_fetch_caller_regs,#function
52perf_arch_fetch_caller_regs: 52__perf_arch_fetch_caller_regs:
53 /* We always read the %pstate into %o5 since we will use 53 /* We always read the %pstate into %o5 since we will use
54 * that to construct a fake %tstate to store into the regs. 54 * that to construct a fake %tstate to store into the regs.
55 */ 55 */
diff --git a/arch/sparc/kernel/ioport.c b/arch/sparc/kernel/ioport.c
index 703e4aa9bc38..41f7e4e0f72a 100644
--- a/arch/sparc/kernel/ioport.c
+++ b/arch/sparc/kernel/ioport.c
@@ -253,7 +253,7 @@ EXPORT_SYMBOL(sbus_set_sbus64);
253static void *sbus_alloc_coherent(struct device *dev, size_t len, 253static void *sbus_alloc_coherent(struct device *dev, size_t len,
254 dma_addr_t *dma_addrp, gfp_t gfp) 254 dma_addr_t *dma_addrp, gfp_t gfp)
255{ 255{
256 struct of_device *op = to_of_device(dev); 256 struct platform_device *op = to_platform_device(dev);
257 unsigned long len_total = (len + PAGE_SIZE-1) & PAGE_MASK; 257 unsigned long len_total = (len + PAGE_SIZE-1) & PAGE_MASK;
258 unsigned long va; 258 unsigned long va;
259 struct resource *res; 259 struct resource *res;
diff --git a/arch/sparc/kernel/of_device_32.c b/arch/sparc/kernel/of_device_32.c
index 47e63f1e719c..2d055a1e9cc2 100644
--- a/arch/sparc/kernel/of_device_32.c
+++ b/arch/sparc/kernel/of_device_32.c
@@ -241,10 +241,10 @@ static int __init use_1to1_mapping(struct device_node *pp)
241 241
242static int of_resource_verbose; 242static int of_resource_verbose;
243 243
244static void __init build_device_resources(struct of_device *op, 244static void __init build_device_resources(struct platform_device *op,
245 struct device *parent) 245 struct device *parent)
246{ 246{
247 struct of_device *p_op; 247 struct platform_device *p_op;
248 struct of_bus *bus; 248 struct of_bus *bus;
249 int na, ns; 249 int na, ns;
250 int index, num_reg; 250 int index, num_reg;
@@ -253,7 +253,7 @@ static void __init build_device_resources(struct of_device *op,
253 if (!parent) 253 if (!parent)
254 return; 254 return;
255 255
256 p_op = to_of_device(parent); 256 p_op = to_platform_device(parent);
257 bus = of_match_bus(p_op->dev.of_node); 257 bus = of_match_bus(p_op->dev.of_node);
258 bus->count_cells(op->dev.of_node, &na, &ns); 258 bus->count_cells(op->dev.of_node, &na, &ns);
259 259
@@ -267,6 +267,8 @@ static void __init build_device_resources(struct of_device *op,
267 /* Conver to num-entries. */ 267 /* Conver to num-entries. */
268 num_reg /= na + ns; 268 num_reg /= na + ns;
269 269
270 op->resource = op->archdata.resource;
271 op->num_resources = num_reg;
270 for (index = 0; index < num_reg; index++) { 272 for (index = 0; index < num_reg; index++) {
271 struct resource *r = &op->resource[index]; 273 struct resource *r = &op->resource[index];
272 u32 addr[OF_MAX_ADDR_CELLS]; 274 u32 addr[OF_MAX_ADDR_CELLS];
@@ -333,10 +335,10 @@ static void __init build_device_resources(struct of_device *op,
333 } 335 }
334} 336}
335 337
336static struct of_device * __init scan_one_device(struct device_node *dp, 338static struct platform_device * __init scan_one_device(struct device_node *dp,
337 struct device *parent) 339 struct device *parent)
338{ 340{
339 struct of_device *op = kzalloc(sizeof(*op), GFP_KERNEL); 341 struct platform_device *op = kzalloc(sizeof(*op), GFP_KERNEL);
340 const struct linux_prom_irqs *intr; 342 const struct linux_prom_irqs *intr;
341 struct dev_archdata *sd; 343 struct dev_archdata *sd;
342 int len, i; 344 int len, i;
@@ -349,27 +351,21 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
349 351
350 op->dev.of_node = dp; 352 op->dev.of_node = dp;
351 353
352 op->clock_freq = of_getintprop_default(dp, "clock-frequency",
353 (25*1000*1000));
354 op->portid = of_getintprop_default(dp, "upa-portid", -1);
355 if (op->portid == -1)
356 op->portid = of_getintprop_default(dp, "portid", -1);
357
358 intr = of_get_property(dp, "intr", &len); 354 intr = of_get_property(dp, "intr", &len);
359 if (intr) { 355 if (intr) {
360 op->num_irqs = len / sizeof(struct linux_prom_irqs); 356 op->archdata.num_irqs = len / sizeof(struct linux_prom_irqs);
361 for (i = 0; i < op->num_irqs; i++) 357 for (i = 0; i < op->archdata.num_irqs; i++)
362 op->irqs[i] = intr[i].pri; 358 op->archdata.irqs[i] = intr[i].pri;
363 } else { 359 } else {
364 const unsigned int *irq = 360 const unsigned int *irq =
365 of_get_property(dp, "interrupts", &len); 361 of_get_property(dp, "interrupts", &len);
366 362
367 if (irq) { 363 if (irq) {
368 op->num_irqs = len / sizeof(unsigned int); 364 op->archdata.num_irqs = len / sizeof(unsigned int);
369 for (i = 0; i < op->num_irqs; i++) 365 for (i = 0; i < op->archdata.num_irqs; i++)
370 op->irqs[i] = irq[i]; 366 op->archdata.irqs[i] = irq[i];
371 } else { 367 } else {
372 op->num_irqs = 0; 368 op->archdata.num_irqs = 0;
373 } 369 }
374 } 370 }
375 if (sparc_cpu_model == sun4d) { 371 if (sparc_cpu_model == sun4d) {
@@ -411,8 +407,8 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
411 goto build_resources; 407 goto build_resources;
412 } 408 }
413 409
414 for (i = 0; i < op->num_irqs; i++) { 410 for (i = 0; i < op->archdata.num_irqs; i++) {
415 int this_irq = op->irqs[i]; 411 int this_irq = op->archdata.irqs[i];
416 int sbusl = pil_to_sbus[this_irq]; 412 int sbusl = pil_to_sbus[this_irq];
417 413
418 if (sbusl) 414 if (sbusl)
@@ -420,7 +416,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
420 (sbusl << 2) + 416 (sbusl << 2) +
421 slot); 417 slot);
422 418
423 op->irqs[i] = this_irq; 419 op->archdata.irqs[i] = this_irq;
424 } 420 }
425 } 421 }
426 422
@@ -428,7 +424,7 @@ build_resources:
428 build_device_resources(op, parent); 424 build_device_resources(op, parent);
429 425
430 op->dev.parent = parent; 426 op->dev.parent = parent;
431 op->dev.bus = &of_platform_bus_type; 427 op->dev.bus = &platform_bus_type;
432 if (!parent) 428 if (!parent)
433 dev_set_name(&op->dev, "root"); 429 dev_set_name(&op->dev, "root");
434 else 430 else
@@ -447,7 +443,7 @@ build_resources:
447static void __init scan_tree(struct device_node *dp, struct device *parent) 443static void __init scan_tree(struct device_node *dp, struct device *parent)
448{ 444{
449 while (dp) { 445 while (dp) {
450 struct of_device *op = scan_one_device(dp, parent); 446 struct platform_device *op = scan_one_device(dp, parent);
451 447
452 if (op) 448 if (op)
453 scan_tree(dp->child, &op->dev); 449 scan_tree(dp->child, &op->dev);
@@ -456,30 +452,19 @@ static void __init scan_tree(struct device_node *dp, struct device *parent)
456 } 452 }
457} 453}
458 454
459static void __init scan_of_devices(void) 455static int __init scan_of_devices(void)
460{ 456{
461 struct device_node *root = of_find_node_by_path("/"); 457 struct device_node *root = of_find_node_by_path("/");
462 struct of_device *parent; 458 struct platform_device *parent;
463 459
464 parent = scan_one_device(root, NULL); 460 parent = scan_one_device(root, NULL);
465 if (!parent) 461 if (!parent)
466 return; 462 return 0;
467 463
468 scan_tree(root->child, &parent->dev); 464 scan_tree(root->child, &parent->dev);
465 return 0;
469} 466}
470 467postcore_initcall(scan_of_devices);
471static int __init of_bus_driver_init(void)
472{
473 int err;
474
475 err = of_bus_type_init(&of_platform_bus_type, "of");
476 if (!err)
477 scan_of_devices();
478
479 return err;
480}
481
482postcore_initcall(of_bus_driver_init);
483 468
484static int __init of_debug(char *str) 469static int __init of_debug(char *str)
485{ 470{
diff --git a/arch/sparc/kernel/of_device_64.c b/arch/sparc/kernel/of_device_64.c
index 1dae8079f728..63cd4e5d47c2 100644
--- a/arch/sparc/kernel/of_device_64.c
+++ b/arch/sparc/kernel/of_device_64.c
@@ -310,10 +310,10 @@ static int __init use_1to1_mapping(struct device_node *pp)
310 310
311static int of_resource_verbose; 311static int of_resource_verbose;
312 312
313static void __init build_device_resources(struct of_device *op, 313static void __init build_device_resources(struct platform_device *op,
314 struct device *parent) 314 struct device *parent)
315{ 315{
316 struct of_device *p_op; 316 struct platform_device *p_op;
317 struct of_bus *bus; 317 struct of_bus *bus;
318 int na, ns; 318 int na, ns;
319 int index, num_reg; 319 int index, num_reg;
@@ -322,7 +322,7 @@ static void __init build_device_resources(struct of_device *op,
322 if (!parent) 322 if (!parent)
323 return; 323 return;
324 324
325 p_op = to_of_device(parent); 325 p_op = to_platform_device(parent);
326 bus = of_match_bus(p_op->dev.of_node); 326 bus = of_match_bus(p_op->dev.of_node);
327 bus->count_cells(op->dev.of_node, &na, &ns); 327 bus->count_cells(op->dev.of_node, &na, &ns);
328 328
@@ -344,6 +344,8 @@ static void __init build_device_resources(struct of_device *op,
344 num_reg = PROMREG_MAX; 344 num_reg = PROMREG_MAX;
345 } 345 }
346 346
347 op->resource = op->archdata.resource;
348 op->num_resources = num_reg;
347 for (index = 0; index < num_reg; index++) { 349 for (index = 0; index < num_reg; index++) {
348 struct resource *r = &op->resource[index]; 350 struct resource *r = &op->resource[index];
349 u32 addr[OF_MAX_ADDR_CELLS]; 351 u32 addr[OF_MAX_ADDR_CELLS];
@@ -526,7 +528,7 @@ static unsigned int __init pci_irq_swizzle(struct device_node *dp,
526 528
527static int of_irq_verbose; 529static int of_irq_verbose;
528 530
529static unsigned int __init build_one_device_irq(struct of_device *op, 531static unsigned int __init build_one_device_irq(struct platform_device *op,
530 struct device *parent, 532 struct device *parent,
531 unsigned int irq) 533 unsigned int irq)
532{ 534{
@@ -628,10 +630,10 @@ out:
628 return irq; 630 return irq;
629} 631}
630 632
631static struct of_device * __init scan_one_device(struct device_node *dp, 633static struct platform_device * __init scan_one_device(struct device_node *dp,
632 struct device *parent) 634 struct device *parent)
633{ 635{
634 struct of_device *op = kzalloc(sizeof(*op), GFP_KERNEL); 636 struct platform_device *op = kzalloc(sizeof(*op), GFP_KERNEL);
635 const unsigned int *irq; 637 const unsigned int *irq;
636 struct dev_archdata *sd; 638 struct dev_archdata *sd;
637 int len, i; 639 int len, i;
@@ -644,34 +646,28 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
644 646
645 op->dev.of_node = dp; 647 op->dev.of_node = dp;
646 648
647 op->clock_freq = of_getintprop_default(dp, "clock-frequency",
648 (25*1000*1000));
649 op->portid = of_getintprop_default(dp, "upa-portid", -1);
650 if (op->portid == -1)
651 op->portid = of_getintprop_default(dp, "portid", -1);
652
653 irq = of_get_property(dp, "interrupts", &len); 649 irq = of_get_property(dp, "interrupts", &len);
654 if (irq) { 650 if (irq) {
655 op->num_irqs = len / 4; 651 op->archdata.num_irqs = len / 4;
656 652
657 /* Prevent overrunning the op->irqs[] array. */ 653 /* Prevent overrunning the op->irqs[] array. */
658 if (op->num_irqs > PROMINTR_MAX) { 654 if (op->archdata.num_irqs > PROMINTR_MAX) {
659 printk(KERN_WARNING "%s: Too many irqs (%d), " 655 printk(KERN_WARNING "%s: Too many irqs (%d), "
660 "limiting to %d.\n", 656 "limiting to %d.\n",
661 dp->full_name, op->num_irqs, PROMINTR_MAX); 657 dp->full_name, op->archdata.num_irqs, PROMINTR_MAX);
662 op->num_irqs = PROMINTR_MAX; 658 op->archdata.num_irqs = PROMINTR_MAX;
663 } 659 }
664 memcpy(op->irqs, irq, op->num_irqs * 4); 660 memcpy(op->archdata.irqs, irq, op->archdata.num_irqs * 4);
665 } else { 661 } else {
666 op->num_irqs = 0; 662 op->archdata.num_irqs = 0;
667 } 663 }
668 664
669 build_device_resources(op, parent); 665 build_device_resources(op, parent);
670 for (i = 0; i < op->num_irqs; i++) 666 for (i = 0; i < op->archdata.num_irqs; i++)
671 op->irqs[i] = build_one_device_irq(op, parent, op->irqs[i]); 667 op->archdata.irqs[i] = build_one_device_irq(op, parent, op->archdata.irqs[i]);
672 668
673 op->dev.parent = parent; 669 op->dev.parent = parent;
674 op->dev.bus = &of_platform_bus_type; 670 op->dev.bus = &platform_bus_type;
675 if (!parent) 671 if (!parent)
676 dev_set_name(&op->dev, "root"); 672 dev_set_name(&op->dev, "root");
677 else 673 else
@@ -690,7 +686,7 @@ static struct of_device * __init scan_one_device(struct device_node *dp,
690static void __init scan_tree(struct device_node *dp, struct device *parent) 686static void __init scan_tree(struct device_node *dp, struct device *parent)
691{ 687{
692 while (dp) { 688 while (dp) {
693 struct of_device *op = scan_one_device(dp, parent); 689 struct platform_device *op = scan_one_device(dp, parent);
694 690
695 if (op) 691 if (op)
696 scan_tree(dp->child, &op->dev); 692 scan_tree(dp->child, &op->dev);
@@ -699,30 +695,19 @@ static void __init scan_tree(struct device_node *dp, struct device *parent)
699 } 695 }
700} 696}
701 697
702static void __init scan_of_devices(void) 698static int __init scan_of_devices(void)
703{ 699{
704 struct device_node *root = of_find_node_by_path("/"); 700 struct device_node *root = of_find_node_by_path("/");
705 struct of_device *parent; 701 struct platform_device *parent;
706 702
707 parent = scan_one_device(root, NULL); 703 parent = scan_one_device(root, NULL);
708 if (!parent) 704 if (!parent)
709 return; 705 return 0;
710 706
711 scan_tree(root->child, &parent->dev); 707 scan_tree(root->child, &parent->dev);
708 return 0;
712} 709}
713 710postcore_initcall(scan_of_devices);
714static int __init of_bus_driver_init(void)
715{
716 int err;
717
718 err = of_bus_type_init(&of_platform_bus_type, "of");
719 if (!err)
720 scan_of_devices();
721
722 return err;
723}
724
725postcore_initcall(of_bus_driver_init);
726 711
727static int __init of_debug(char *str) 712static int __init of_debug(char *str)
728{ 713{
diff --git a/arch/sparc/kernel/of_device_common.c b/arch/sparc/kernel/of_device_common.c
index 10c6c36a6e75..49ddff56cb04 100644
--- a/arch/sparc/kernel/of_device_common.c
+++ b/arch/sparc/kernel/of_device_common.c
@@ -11,48 +11,28 @@
11 11
12#include "of_device_common.h" 12#include "of_device_common.h"
13 13
14static int node_match(struct device *dev, void *data)
15{
16 struct of_device *op = to_of_device(dev);
17 struct device_node *dp = data;
18
19 return (op->dev.of_node == dp);
20}
21
22struct of_device *of_find_device_by_node(struct device_node *dp)
23{
24 struct device *dev = bus_find_device(&of_platform_bus_type, NULL,
25 dp, node_match);
26
27 if (dev)
28 return to_of_device(dev);
29
30 return NULL;
31}
32EXPORT_SYMBOL(of_find_device_by_node);
33
34unsigned int irq_of_parse_and_map(struct device_node *node, int index) 14unsigned int irq_of_parse_and_map(struct device_node *node, int index)
35{ 15{
36 struct of_device *op = of_find_device_by_node(node); 16 struct platform_device *op = of_find_device_by_node(node);
37 17
38 if (!op || index >= op->num_irqs) 18 if (!op || index >= op->archdata.num_irqs)
39 return 0; 19 return 0;
40 20
41 return op->irqs[index]; 21 return op->archdata.irqs[index];
42} 22}
43EXPORT_SYMBOL(irq_of_parse_and_map); 23EXPORT_SYMBOL(irq_of_parse_and_map);
44 24
45/* Take the archdata values for IOMMU, STC, and HOSTDATA found in 25/* Take the archdata values for IOMMU, STC, and HOSTDATA found in
46 * BUS and propagate to all child of_device objects. 26 * BUS and propagate to all child platform_device objects.
47 */ 27 */
48void of_propagate_archdata(struct of_device *bus) 28void of_propagate_archdata(struct platform_device *bus)
49{ 29{
50 struct dev_archdata *bus_sd = &bus->dev.archdata; 30 struct dev_archdata *bus_sd = &bus->dev.archdata;
51 struct device_node *bus_dp = bus->dev.of_node; 31 struct device_node *bus_dp = bus->dev.of_node;
52 struct device_node *dp; 32 struct device_node *dp;
53 33
54 for (dp = bus_dp->child; dp; dp = dp->sibling) { 34 for (dp = bus_dp->child; dp; dp = dp->sibling) {
55 struct of_device *op = of_find_device_by_node(dp); 35 struct platform_device *op = of_find_device_by_node(dp);
56 36
57 op->dev.archdata.iommu = bus_sd->iommu; 37 op->dev.archdata.iommu = bus_sd->iommu;
58 op->dev.archdata.stc = bus_sd->stc; 38 op->dev.archdata.stc = bus_sd->stc;
@@ -64,9 +44,6 @@ void of_propagate_archdata(struct of_device *bus)
64 } 44 }
65} 45}
66 46
67struct bus_type of_platform_bus_type;
68EXPORT_SYMBOL(of_platform_bus_type);
69
70static void get_cells(struct device_node *dp, int *addrc, int *sizec) 47static void get_cells(struct device_node *dp, int *addrc, int *sizec)
71{ 48{
72 if (addrc) 49 if (addrc)
diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c
index 8a8363adb8bd..4137579d9adc 100644
--- a/arch/sparc/kernel/pci.c
+++ b/arch/sparc/kernel/pci.c
@@ -198,7 +198,7 @@ static unsigned long pci_parse_of_flags(u32 addr0)
198 * into physical address resources, we only have to figure out the register 198 * into physical address resources, we only have to figure out the register
199 * mapping. 199 * mapping.
200 */ 200 */
201static void pci_parse_of_addrs(struct of_device *op, 201static void pci_parse_of_addrs(struct platform_device *op,
202 struct device_node *node, 202 struct device_node *node,
203 struct pci_dev *dev) 203 struct pci_dev *dev)
204{ 204{
@@ -248,7 +248,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
248{ 248{
249 struct dev_archdata *sd; 249 struct dev_archdata *sd;
250 struct pci_slot *slot; 250 struct pci_slot *slot;
251 struct of_device *op; 251 struct platform_device *op;
252 struct pci_dev *dev; 252 struct pci_dev *dev;
253 const char *type; 253 const char *type;
254 u32 class; 254 u32 class;
@@ -340,7 +340,7 @@ static struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
340 dev->hdr_type = PCI_HEADER_TYPE_NORMAL; 340 dev->hdr_type = PCI_HEADER_TYPE_NORMAL;
341 dev->rom_base_reg = PCI_ROM_ADDRESS; 341 dev->rom_base_reg = PCI_ROM_ADDRESS;
342 342
343 dev->irq = sd->op->irqs[0]; 343 dev->irq = sd->op->archdata.irqs[0];
344 if (dev->irq == 0xffffffff) 344 if (dev->irq == 0xffffffff)
345 dev->irq = PCI_IRQ_NONE; 345 dev->irq = PCI_IRQ_NONE;
346 } 346 }
diff --git a/arch/sparc/kernel/pci_fire.c b/arch/sparc/kernel/pci_fire.c
index 51cfa09e392a..efb896d68754 100644
--- a/arch/sparc/kernel/pci_fire.c
+++ b/arch/sparc/kernel/pci_fire.c
@@ -410,7 +410,7 @@ static void pci_fire_hw_init(struct pci_pbm_info *pbm)
410} 410}
411 411
412static int __devinit pci_fire_pbm_init(struct pci_pbm_info *pbm, 412static int __devinit pci_fire_pbm_init(struct pci_pbm_info *pbm,
413 struct of_device *op, u32 portid) 413 struct platform_device *op, u32 portid)
414{ 414{
415 const struct linux_prom64_registers *regs; 415 const struct linux_prom64_registers *regs;
416 struct device_node *dp = op->dev.of_node; 416 struct device_node *dp = op->dev.of_node;
@@ -455,7 +455,7 @@ static int __devinit pci_fire_pbm_init(struct pci_pbm_info *pbm,
455 return 0; 455 return 0;
456} 456}
457 457
458static int __devinit fire_probe(struct of_device *op, 458static int __devinit fire_probe(struct platform_device *op,
459 const struct of_device_id *match) 459 const struct of_device_id *match)
460{ 460{
461 struct device_node *dp = op->dev.of_node; 461 struct device_node *dp = op->dev.of_node;
@@ -518,7 +518,7 @@ static struct of_platform_driver fire_driver = {
518 518
519static int __init fire_init(void) 519static int __init fire_init(void)
520{ 520{
521 return of_register_driver(&fire_driver, &of_bus_type); 521 return of_register_platform_driver(&fire_driver);
522} 522}
523 523
524subsys_initcall(fire_init); 524subsys_initcall(fire_init);
diff --git a/arch/sparc/kernel/pci_impl.h b/arch/sparc/kernel/pci_impl.h
index 03186824327e..e20ed5f06e9c 100644
--- a/arch/sparc/kernel/pci_impl.h
+++ b/arch/sparc/kernel/pci_impl.h
@@ -91,7 +91,7 @@ struct pci_pbm_info {
91 char *name; 91 char *name;
92 92
93 /* OBP specific information. */ 93 /* OBP specific information. */
94 struct of_device *op; 94 struct platform_device *op;
95 u64 ino_bitmap; 95 u64 ino_bitmap;
96 96
97 /* PBM I/O and Memory space resources. */ 97 /* PBM I/O and Memory space resources. */
diff --git a/arch/sparc/kernel/pci_psycho.c b/arch/sparc/kernel/pci_psycho.c
index 558a70512824..22eab7cf3b11 100644
--- a/arch/sparc/kernel/pci_psycho.c
+++ b/arch/sparc/kernel/pci_psycho.c
@@ -285,7 +285,7 @@ static irqreturn_t psycho_ce_intr(int irq, void *dev_id)
285#define PSYCHO_ECCCTRL_CE 0x2000000000000000UL /* Enable CE INterrupts */ 285#define PSYCHO_ECCCTRL_CE 0x2000000000000000UL /* Enable CE INterrupts */
286static void psycho_register_error_handlers(struct pci_pbm_info *pbm) 286static void psycho_register_error_handlers(struct pci_pbm_info *pbm)
287{ 287{
288 struct of_device *op = of_find_device_by_node(pbm->op->dev.of_node); 288 struct platform_device *op = of_find_device_by_node(pbm->op->dev.of_node);
289 unsigned long base = pbm->controller_regs; 289 unsigned long base = pbm->controller_regs;
290 u64 tmp; 290 u64 tmp;
291 int err; 291 int err;
@@ -302,23 +302,23 @@ static void psycho_register_error_handlers(struct pci_pbm_info *pbm)
302 * 5: POWER MANAGEMENT 302 * 5: POWER MANAGEMENT
303 */ 303 */
304 304
305 if (op->num_irqs < 6) 305 if (op->archdata.num_irqs < 6)
306 return; 306 return;
307 307
308 /* We really mean to ignore the return result here. Two 308 /* We really mean to ignore the return result here. Two
309 * PCI controller share the same interrupt numbers and 309 * PCI controller share the same interrupt numbers and
310 * drive the same front-end hardware. 310 * drive the same front-end hardware.
311 */ 311 */
312 err = request_irq(op->irqs[1], psycho_ue_intr, IRQF_SHARED, 312 err = request_irq(op->archdata.irqs[1], psycho_ue_intr, IRQF_SHARED,
313 "PSYCHO_UE", pbm); 313 "PSYCHO_UE", pbm);
314 err = request_irq(op->irqs[2], psycho_ce_intr, IRQF_SHARED, 314 err = request_irq(op->archdata.irqs[2], psycho_ce_intr, IRQF_SHARED,
315 "PSYCHO_CE", pbm); 315 "PSYCHO_CE", pbm);
316 316
317 /* This one, however, ought not to fail. We can just warn 317 /* This one, however, ought not to fail. We can just warn
318 * about it since the system can still operate properly even 318 * about it since the system can still operate properly even
319 * if this fails. 319 * if this fails.
320 */ 320 */
321 err = request_irq(op->irqs[0], psycho_pcierr_intr, IRQF_SHARED, 321 err = request_irq(op->archdata.irqs[0], psycho_pcierr_intr, IRQF_SHARED,
322 "PSYCHO_PCIERR", pbm); 322 "PSYCHO_PCIERR", pbm);
323 if (err) 323 if (err)
324 printk(KERN_WARNING "%s: Could not register PCIERR, " 324 printk(KERN_WARNING "%s: Could not register PCIERR, "
@@ -483,7 +483,7 @@ static void psycho_pbm_strbuf_init(struct pci_pbm_info *pbm,
483#define PSYCHO_MEMSPACE_SIZE 0x07fffffffUL 483#define PSYCHO_MEMSPACE_SIZE 0x07fffffffUL
484 484
485static void __devinit psycho_pbm_init(struct pci_pbm_info *pbm, 485static void __devinit psycho_pbm_init(struct pci_pbm_info *pbm,
486 struct of_device *op, int is_pbm_a) 486 struct platform_device *op, int is_pbm_a)
487{ 487{
488 psycho_pbm_init_common(pbm, op, "PSYCHO", PBM_CHIP_TYPE_PSYCHO); 488 psycho_pbm_init_common(pbm, op, "PSYCHO", PBM_CHIP_TYPE_PSYCHO);
489 psycho_pbm_strbuf_init(pbm, is_pbm_a); 489 psycho_pbm_strbuf_init(pbm, is_pbm_a);
@@ -503,7 +503,7 @@ static struct pci_pbm_info * __devinit psycho_find_sibling(u32 upa_portid)
503 503
504#define PSYCHO_CONFIGSPACE 0x001000000UL 504#define PSYCHO_CONFIGSPACE 0x001000000UL
505 505
506static int __devinit psycho_probe(struct of_device *op, 506static int __devinit psycho_probe(struct platform_device *op,
507 const struct of_device_id *match) 507 const struct of_device_id *match)
508{ 508{
509 const struct linux_prom64_registers *pr_regs; 509 const struct linux_prom64_registers *pr_regs;
@@ -612,7 +612,7 @@ static struct of_platform_driver psycho_driver = {
612 612
613static int __init psycho_init(void) 613static int __init psycho_init(void)
614{ 614{
615 return of_register_driver(&psycho_driver, &of_bus_type); 615 return of_register_platform_driver(&psycho_driver);
616} 616}
617 617
618subsys_initcall(psycho_init); 618subsys_initcall(psycho_init);
diff --git a/arch/sparc/kernel/pci_sabre.c b/arch/sparc/kernel/pci_sabre.c
index 6dad8e3b7506..5c3f5ec4cabc 100644
--- a/arch/sparc/kernel/pci_sabre.c
+++ b/arch/sparc/kernel/pci_sabre.c
@@ -311,7 +311,7 @@ static irqreturn_t sabre_ce_intr(int irq, void *dev_id)
311static void sabre_register_error_handlers(struct pci_pbm_info *pbm) 311static void sabre_register_error_handlers(struct pci_pbm_info *pbm)
312{ 312{
313 struct device_node *dp = pbm->op->dev.of_node; 313 struct device_node *dp = pbm->op->dev.of_node;
314 struct of_device *op; 314 struct platform_device *op;
315 unsigned long base = pbm->controller_regs; 315 unsigned long base = pbm->controller_regs;
316 u64 tmp; 316 u64 tmp;
317 int err; 317 int err;
@@ -329,7 +329,7 @@ static void sabre_register_error_handlers(struct pci_pbm_info *pbm)
329 * 2: CE ERR 329 * 2: CE ERR
330 * 3: POWER FAIL 330 * 3: POWER FAIL
331 */ 331 */
332 if (op->num_irqs < 4) 332 if (op->archdata.num_irqs < 4)
333 return; 333 return;
334 334
335 /* We clear the error bits in the appropriate AFSR before 335 /* We clear the error bits in the appropriate AFSR before
@@ -341,7 +341,7 @@ static void sabre_register_error_handlers(struct pci_pbm_info *pbm)
341 SABRE_UEAFSR_SDTE | SABRE_UEAFSR_PDTE), 341 SABRE_UEAFSR_SDTE | SABRE_UEAFSR_PDTE),
342 base + SABRE_UE_AFSR); 342 base + SABRE_UE_AFSR);
343 343
344 err = request_irq(op->irqs[1], sabre_ue_intr, 0, "SABRE_UE", pbm); 344 err = request_irq(op->archdata.irqs[1], sabre_ue_intr, 0, "SABRE_UE", pbm);
345 if (err) 345 if (err)
346 printk(KERN_WARNING "%s: Couldn't register UE, err=%d.\n", 346 printk(KERN_WARNING "%s: Couldn't register UE, err=%d.\n",
347 pbm->name, err); 347 pbm->name, err);
@@ -351,11 +351,11 @@ static void sabre_register_error_handlers(struct pci_pbm_info *pbm)
351 base + SABRE_CE_AFSR); 351 base + SABRE_CE_AFSR);
352 352
353 353
354 err = request_irq(op->irqs[2], sabre_ce_intr, 0, "SABRE_CE", pbm); 354 err = request_irq(op->archdata.irqs[2], sabre_ce_intr, 0, "SABRE_CE", pbm);
355 if (err) 355 if (err)
356 printk(KERN_WARNING "%s: Couldn't register CE, err=%d.\n", 356 printk(KERN_WARNING "%s: Couldn't register CE, err=%d.\n",
357 pbm->name, err); 357 pbm->name, err);
358 err = request_irq(op->irqs[0], psycho_pcierr_intr, 0, 358 err = request_irq(op->archdata.irqs[0], psycho_pcierr_intr, 0,
359 "SABRE_PCIERR", pbm); 359 "SABRE_PCIERR", pbm);
360 if (err) 360 if (err)
361 printk(KERN_WARNING "%s: Couldn't register PCIERR, err=%d.\n", 361 printk(KERN_WARNING "%s: Couldn't register PCIERR, err=%d.\n",
@@ -443,7 +443,7 @@ static void __devinit sabre_scan_bus(struct pci_pbm_info *pbm,
443} 443}
444 444
445static void __devinit sabre_pbm_init(struct pci_pbm_info *pbm, 445static void __devinit sabre_pbm_init(struct pci_pbm_info *pbm,
446 struct of_device *op) 446 struct platform_device *op)
447{ 447{
448 psycho_pbm_init_common(pbm, op, "SABRE", PBM_CHIP_TYPE_SABRE); 448 psycho_pbm_init_common(pbm, op, "SABRE", PBM_CHIP_TYPE_SABRE);
449 pbm->pci_afsr = pbm->controller_regs + SABRE_PIOAFSR; 449 pbm->pci_afsr = pbm->controller_regs + SABRE_PIOAFSR;
@@ -452,7 +452,7 @@ static void __devinit sabre_pbm_init(struct pci_pbm_info *pbm,
452 sabre_scan_bus(pbm, &op->dev); 452 sabre_scan_bus(pbm, &op->dev);
453} 453}
454 454
455static int __devinit sabre_probe(struct of_device *op, 455static int __devinit sabre_probe(struct platform_device *op,
456 const struct of_device_id *match) 456 const struct of_device_id *match)
457{ 457{
458 const struct linux_prom64_registers *pr_regs; 458 const struct linux_prom64_registers *pr_regs;
@@ -606,7 +606,7 @@ static struct of_platform_driver sabre_driver = {
606 606
607static int __init sabre_init(void) 607static int __init sabre_init(void)
608{ 608{
609 return of_register_driver(&sabre_driver, &of_bus_type); 609 return of_register_platform_driver(&sabre_driver);
610} 610}
611 611
612subsys_initcall(sabre_init); 612subsys_initcall(sabre_init);
diff --git a/arch/sparc/kernel/pci_schizo.c b/arch/sparc/kernel/pci_schizo.c
index 97a1ae2e1c02..445a47a2fb3d 100644
--- a/arch/sparc/kernel/pci_schizo.c
+++ b/arch/sparc/kernel/pci_schizo.c
@@ -844,7 +844,7 @@ static int pbm_routes_this_ino(struct pci_pbm_info *pbm, u32 ino)
844 */ 844 */
845static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm) 845static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm)
846{ 846{
847 struct of_device *op = of_find_device_by_node(pbm->op->dev.of_node); 847 struct platform_device *op = of_find_device_by_node(pbm->op->dev.of_node);
848 u64 tmp, err_mask, err_no_mask; 848 u64 tmp, err_mask, err_no_mask;
849 int err; 849 int err;
850 850
@@ -857,14 +857,14 @@ static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm)
857 */ 857 */
858 858
859 if (pbm_routes_this_ino(pbm, SCHIZO_UE_INO)) { 859 if (pbm_routes_this_ino(pbm, SCHIZO_UE_INO)) {
860 err = request_irq(op->irqs[1], schizo_ue_intr, 0, 860 err = request_irq(op->archdata.irqs[1], schizo_ue_intr, 0,
861 "TOMATILLO_UE", pbm); 861 "TOMATILLO_UE", pbm);
862 if (err) 862 if (err)
863 printk(KERN_WARNING "%s: Could not register UE, " 863 printk(KERN_WARNING "%s: Could not register UE, "
864 "err=%d\n", pbm->name, err); 864 "err=%d\n", pbm->name, err);
865 } 865 }
866 if (pbm_routes_this_ino(pbm, SCHIZO_CE_INO)) { 866 if (pbm_routes_this_ino(pbm, SCHIZO_CE_INO)) {
867 err = request_irq(op->irqs[2], schizo_ce_intr, 0, 867 err = request_irq(op->archdata.irqs[2], schizo_ce_intr, 0,
868 "TOMATILLO_CE", pbm); 868 "TOMATILLO_CE", pbm);
869 if (err) 869 if (err)
870 printk(KERN_WARNING "%s: Could not register CE, " 870 printk(KERN_WARNING "%s: Could not register CE, "
@@ -872,10 +872,10 @@ static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm)
872 } 872 }
873 err = 0; 873 err = 0;
874 if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_A_INO)) { 874 if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_A_INO)) {
875 err = request_irq(op->irqs[0], schizo_pcierr_intr, 0, 875 err = request_irq(op->archdata.irqs[0], schizo_pcierr_intr, 0,
876 "TOMATILLO_PCIERR", pbm); 876 "TOMATILLO_PCIERR", pbm);
877 } else if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_B_INO)) { 877 } else if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_B_INO)) {
878 err = request_irq(op->irqs[0], schizo_pcierr_intr, 0, 878 err = request_irq(op->archdata.irqs[0], schizo_pcierr_intr, 0,
879 "TOMATILLO_PCIERR", pbm); 879 "TOMATILLO_PCIERR", pbm);
880 } 880 }
881 if (err) 881 if (err)
@@ -883,7 +883,7 @@ static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm)
883 "err=%d\n", pbm->name, err); 883 "err=%d\n", pbm->name, err);
884 884
885 if (pbm_routes_this_ino(pbm, SCHIZO_SERR_INO)) { 885 if (pbm_routes_this_ino(pbm, SCHIZO_SERR_INO)) {
886 err = request_irq(op->irqs[3], schizo_safarierr_intr, 0, 886 err = request_irq(op->archdata.irqs[3], schizo_safarierr_intr, 0,
887 "TOMATILLO_SERR", pbm); 887 "TOMATILLO_SERR", pbm);
888 if (err) 888 if (err)
889 printk(KERN_WARNING "%s: Could not register SERR, " 889 printk(KERN_WARNING "%s: Could not register SERR, "
@@ -939,7 +939,7 @@ static void tomatillo_register_error_handlers(struct pci_pbm_info *pbm)
939 939
940static void schizo_register_error_handlers(struct pci_pbm_info *pbm) 940static void schizo_register_error_handlers(struct pci_pbm_info *pbm)
941{ 941{
942 struct of_device *op = of_find_device_by_node(pbm->op->dev.of_node); 942 struct platform_device *op = of_find_device_by_node(pbm->op->dev.of_node);
943 u64 tmp, err_mask, err_no_mask; 943 u64 tmp, err_mask, err_no_mask;
944 int err; 944 int err;
945 945
@@ -952,14 +952,14 @@ static void schizo_register_error_handlers(struct pci_pbm_info *pbm)
952 */ 952 */
953 953
954 if (pbm_routes_this_ino(pbm, SCHIZO_UE_INO)) { 954 if (pbm_routes_this_ino(pbm, SCHIZO_UE_INO)) {
955 err = request_irq(op->irqs[1], schizo_ue_intr, 0, 955 err = request_irq(op->archdata.irqs[1], schizo_ue_intr, 0,
956 "SCHIZO_UE", pbm); 956 "SCHIZO_UE", pbm);
957 if (err) 957 if (err)
958 printk(KERN_WARNING "%s: Could not register UE, " 958 printk(KERN_WARNING "%s: Could not register UE, "
959 "err=%d\n", pbm->name, err); 959 "err=%d\n", pbm->name, err);
960 } 960 }
961 if (pbm_routes_this_ino(pbm, SCHIZO_CE_INO)) { 961 if (pbm_routes_this_ino(pbm, SCHIZO_CE_INO)) {
962 err = request_irq(op->irqs[2], schizo_ce_intr, 0, 962 err = request_irq(op->archdata.irqs[2], schizo_ce_intr, 0,
963 "SCHIZO_CE", pbm); 963 "SCHIZO_CE", pbm);
964 if (err) 964 if (err)
965 printk(KERN_WARNING "%s: Could not register CE, " 965 printk(KERN_WARNING "%s: Could not register CE, "
@@ -967,10 +967,10 @@ static void schizo_register_error_handlers(struct pci_pbm_info *pbm)
967 } 967 }
968 err = 0; 968 err = 0;
969 if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_A_INO)) { 969 if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_A_INO)) {
970 err = request_irq(op->irqs[0], schizo_pcierr_intr, 0, 970 err = request_irq(op->archdata.irqs[0], schizo_pcierr_intr, 0,
971 "SCHIZO_PCIERR", pbm); 971 "SCHIZO_PCIERR", pbm);
972 } else if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_B_INO)) { 972 } else if (pbm_routes_this_ino(pbm, SCHIZO_PCIERR_B_INO)) {
973 err = request_irq(op->irqs[0], schizo_pcierr_intr, 0, 973 err = request_irq(op->archdata.irqs[0], schizo_pcierr_intr, 0,
974 "SCHIZO_PCIERR", pbm); 974 "SCHIZO_PCIERR", pbm);
975 } 975 }
976 if (err) 976 if (err)
@@ -978,7 +978,7 @@ static void schizo_register_error_handlers(struct pci_pbm_info *pbm)
978 "err=%d\n", pbm->name, err); 978 "err=%d\n", pbm->name, err);
979 979
980 if (pbm_routes_this_ino(pbm, SCHIZO_SERR_INO)) { 980 if (pbm_routes_this_ino(pbm, SCHIZO_SERR_INO)) {
981 err = request_irq(op->irqs[3], schizo_safarierr_intr, 0, 981 err = request_irq(op->archdata.irqs[3], schizo_safarierr_intr, 0,
982 "SCHIZO_SERR", pbm); 982 "SCHIZO_SERR", pbm);
983 if (err) 983 if (err)
984 printk(KERN_WARNING "%s: Could not register SERR, " 984 printk(KERN_WARNING "%s: Could not register SERR, "
@@ -1307,7 +1307,7 @@ static void schizo_pbm_hw_init(struct pci_pbm_info *pbm)
1307} 1307}
1308 1308
1309static int __devinit schizo_pbm_init(struct pci_pbm_info *pbm, 1309static int __devinit schizo_pbm_init(struct pci_pbm_info *pbm,
1310 struct of_device *op, u32 portid, 1310 struct platform_device *op, u32 portid,
1311 int chip_type) 1311 int chip_type)
1312{ 1312{
1313 const struct linux_prom64_registers *regs; 1313 const struct linux_prom64_registers *regs;
@@ -1413,7 +1413,7 @@ static struct pci_pbm_info * __devinit schizo_find_sibling(u32 portid,
1413 return NULL; 1413 return NULL;
1414} 1414}
1415 1415
1416static int __devinit __schizo_init(struct of_device *op, unsigned long chip_type) 1416static int __devinit __schizo_init(struct platform_device *op, unsigned long chip_type)
1417{ 1417{
1418 struct device_node *dp = op->dev.of_node; 1418 struct device_node *dp = op->dev.of_node;
1419 struct pci_pbm_info *pbm; 1419 struct pci_pbm_info *pbm;
@@ -1460,7 +1460,7 @@ out_err:
1460 return err; 1460 return err;
1461} 1461}
1462 1462
1463static int __devinit schizo_probe(struct of_device *op, 1463static int __devinit schizo_probe(struct platform_device *op,
1464 const struct of_device_id *match) 1464 const struct of_device_id *match)
1465{ 1465{
1466 return __schizo_init(op, (unsigned long) match->data); 1466 return __schizo_init(op, (unsigned long) match->data);
@@ -1501,7 +1501,7 @@ static struct of_platform_driver schizo_driver = {
1501 1501
1502static int __init schizo_init(void) 1502static int __init schizo_init(void)
1503{ 1503{
1504 return of_register_driver(&schizo_driver, &of_bus_type); 1504 return of_register_platform_driver(&schizo_driver);
1505} 1505}
1506 1506
1507subsys_initcall(schizo_init); 1507subsys_initcall(schizo_init);
diff --git a/arch/sparc/kernel/pci_sun4v.c b/arch/sparc/kernel/pci_sun4v.c
index a24af6f7e17f..743344aa6d8a 100644
--- a/arch/sparc/kernel/pci_sun4v.c
+++ b/arch/sparc/kernel/pci_sun4v.c
@@ -879,7 +879,7 @@ static void pci_sun4v_msi_init(struct pci_pbm_info *pbm)
879#endif /* !(CONFIG_PCI_MSI) */ 879#endif /* !(CONFIG_PCI_MSI) */
880 880
881static int __devinit pci_sun4v_pbm_init(struct pci_pbm_info *pbm, 881static int __devinit pci_sun4v_pbm_init(struct pci_pbm_info *pbm,
882 struct of_device *op, u32 devhandle) 882 struct platform_device *op, u32 devhandle)
883{ 883{
884 struct device_node *dp = op->dev.of_node; 884 struct device_node *dp = op->dev.of_node;
885 int err; 885 int err;
@@ -918,7 +918,7 @@ static int __devinit pci_sun4v_pbm_init(struct pci_pbm_info *pbm,
918 return 0; 918 return 0;
919} 919}
920 920
921static int __devinit pci_sun4v_probe(struct of_device *op, 921static int __devinit pci_sun4v_probe(struct platform_device *op,
922 const struct of_device_id *match) 922 const struct of_device_id *match)
923{ 923{
924 const struct linux_prom64_registers *regs; 924 const struct linux_prom64_registers *regs;
@@ -1019,7 +1019,7 @@ static struct of_platform_driver pci_sun4v_driver = {
1019 1019
1020static int __init pci_sun4v_init(void) 1020static int __init pci_sun4v_init(void)
1021{ 1021{
1022 return of_register_driver(&pci_sun4v_driver, &of_bus_type); 1022 return of_register_platform_driver(&pci_sun4v_driver);
1023} 1023}
1024 1024
1025subsys_initcall(pci_sun4v_init); 1025subsys_initcall(pci_sun4v_init);
diff --git a/arch/sparc/kernel/perf_event.c b/arch/sparc/kernel/perf_event.c
index 44faabc3c02c..357ced3c33ff 100644
--- a/arch/sparc/kernel/perf_event.c
+++ b/arch/sparc/kernel/perf_event.c
@@ -572,18 +572,18 @@ static u64 sparc_perf_event_update(struct perf_event *event,
572 s64 delta; 572 s64 delta;
573 573
574again: 574again:
575 prev_raw_count = atomic64_read(&hwc->prev_count); 575 prev_raw_count = local64_read(&hwc->prev_count);
576 new_raw_count = read_pmc(idx); 576 new_raw_count = read_pmc(idx);
577 577
578 if (atomic64_cmpxchg(&hwc->prev_count, prev_raw_count, 578 if (local64_cmpxchg(&hwc->prev_count, prev_raw_count,
579 new_raw_count) != prev_raw_count) 579 new_raw_count) != prev_raw_count)
580 goto again; 580 goto again;
581 581
582 delta = (new_raw_count << shift) - (prev_raw_count << shift); 582 delta = (new_raw_count << shift) - (prev_raw_count << shift);
583 delta >>= shift; 583 delta >>= shift;
584 584
585 atomic64_add(delta, &event->count); 585 local64_add(delta, &event->count);
586 atomic64_sub(delta, &hwc->period_left); 586 local64_sub(delta, &hwc->period_left);
587 587
588 return new_raw_count; 588 return new_raw_count;
589} 589}
@@ -591,27 +591,27 @@ again:
591static int sparc_perf_event_set_period(struct perf_event *event, 591static int sparc_perf_event_set_period(struct perf_event *event,
592 struct hw_perf_event *hwc, int idx) 592 struct hw_perf_event *hwc, int idx)
593{ 593{
594 s64 left = atomic64_read(&hwc->period_left); 594 s64 left = local64_read(&hwc->period_left);
595 s64 period = hwc->sample_period; 595 s64 period = hwc->sample_period;
596 int ret = 0; 596 int ret = 0;
597 597
598 if (unlikely(left <= -period)) { 598 if (unlikely(left <= -period)) {
599 left = period; 599 left = period;
600 atomic64_set(&hwc->period_left, left); 600 local64_set(&hwc->period_left, left);
601 hwc->last_period = period; 601 hwc->last_period = period;
602 ret = 1; 602 ret = 1;
603 } 603 }
604 604
605 if (unlikely(left <= 0)) { 605 if (unlikely(left <= 0)) {
606 left += period; 606 left += period;
607 atomic64_set(&hwc->period_left, left); 607 local64_set(&hwc->period_left, left);
608 hwc->last_period = period; 608 hwc->last_period = period;
609 ret = 1; 609 ret = 1;
610 } 610 }
611 if (left > MAX_PERIOD) 611 if (left > MAX_PERIOD)
612 left = MAX_PERIOD; 612 left = MAX_PERIOD;
613 613
614 atomic64_set(&hwc->prev_count, (u64)-left); 614 local64_set(&hwc->prev_count, (u64)-left);
615 615
616 write_pmc(idx, (u64)(-left) & 0xffffffff); 616 write_pmc(idx, (u64)(-left) & 0xffffffff);
617 617
@@ -1006,7 +1006,7 @@ static int sparc_pmu_enable(struct perf_event *event)
1006 * skip the schedulability test here, it will be peformed 1006 * skip the schedulability test here, it will be peformed
1007 * at commit time(->commit_txn) as a whole 1007 * at commit time(->commit_txn) as a whole
1008 */ 1008 */
1009 if (cpuc->group_flag & PERF_EVENT_TXN_STARTED) 1009 if (cpuc->group_flag & PERF_EVENT_TXN)
1010 goto nocheck; 1010 goto nocheck;
1011 1011
1012 if (check_excludes(cpuc->event, n0, 1)) 1012 if (check_excludes(cpuc->event, n0, 1))
@@ -1088,7 +1088,7 @@ static int __hw_perf_event_init(struct perf_event *event)
1088 if (!hwc->sample_period) { 1088 if (!hwc->sample_period) {
1089 hwc->sample_period = MAX_PERIOD; 1089 hwc->sample_period = MAX_PERIOD;
1090 hwc->last_period = hwc->sample_period; 1090 hwc->last_period = hwc->sample_period;
1091 atomic64_set(&hwc->period_left, hwc->sample_period); 1091 local64_set(&hwc->period_left, hwc->sample_period);
1092 } 1092 }
1093 1093
1094 return 0; 1094 return 0;
@@ -1103,7 +1103,7 @@ static void sparc_pmu_start_txn(const struct pmu *pmu)
1103{ 1103{
1104 struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events); 1104 struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
1105 1105
1106 cpuhw->group_flag |= PERF_EVENT_TXN_STARTED; 1106 cpuhw->group_flag |= PERF_EVENT_TXN;
1107} 1107}
1108 1108
1109/* 1109/*
@@ -1115,7 +1115,7 @@ static void sparc_pmu_cancel_txn(const struct pmu *pmu)
1115{ 1115{
1116 struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events); 1116 struct cpu_hw_events *cpuhw = &__get_cpu_var(cpu_hw_events);
1117 1117
1118 cpuhw->group_flag &= ~PERF_EVENT_TXN_STARTED; 1118 cpuhw->group_flag &= ~PERF_EVENT_TXN;
1119} 1119}
1120 1120
1121/* 1121/*
@@ -1138,6 +1138,7 @@ static int sparc_pmu_commit_txn(const struct pmu *pmu)
1138 if (sparc_check_constraints(cpuc->event, cpuc->events, n)) 1138 if (sparc_check_constraints(cpuc->event, cpuc->events, n))
1139 return -EAGAIN; 1139 return -EAGAIN;
1140 1140
1141 cpuc->group_flag &= ~PERF_EVENT_TXN;
1141 return 0; 1142 return 0;
1142} 1143}
1143 1144
diff --git a/arch/sparc/kernel/pmc.c b/arch/sparc/kernel/pmc.c
index 9589d8b9b0c1..94536a85f161 100644
--- a/arch/sparc/kernel/pmc.c
+++ b/arch/sparc/kernel/pmc.c
@@ -51,7 +51,7 @@ static void pmc_swift_idle(void)
51#endif 51#endif
52} 52}
53 53
54static int __devinit pmc_probe(struct of_device *op, 54static int __devinit pmc_probe(struct platform_device *op,
55 const struct of_device_id *match) 55 const struct of_device_id *match)
56{ 56{
57 regs = of_ioremap(&op->resource[0], 0, 57 regs = of_ioremap(&op->resource[0], 0,
@@ -89,7 +89,7 @@ static struct of_platform_driver pmc_driver = {
89 89
90static int __init pmc_init(void) 90static int __init pmc_init(void)
91{ 91{
92 return of_register_driver(&pmc_driver, &of_bus_type); 92 return of_register_platform_driver(&pmc_driver);
93} 93}
94 94
95/* This driver is not critical to the boot process 95/* This driver is not critical to the boot process
diff --git a/arch/sparc/kernel/power.c b/arch/sparc/kernel/power.c
index 168d4cb63f5b..2c59f4d387dd 100644
--- a/arch/sparc/kernel/power.c
+++ b/arch/sparc/kernel/power.c
@@ -33,10 +33,10 @@ static int __devinit has_button_interrupt(unsigned int irq, struct device_node *
33 return 1; 33 return 1;
34} 34}
35 35
36static int __devinit power_probe(struct of_device *op, const struct of_device_id *match) 36static int __devinit power_probe(struct platform_device *op, const struct of_device_id *match)
37{ 37{
38 struct resource *res = &op->resource[0]; 38 struct resource *res = &op->resource[0];
39 unsigned int irq= op->irqs[0]; 39 unsigned int irq = op->archdata.irqs[0];
40 40
41 power_reg = of_ioremap(res, 0, 0x4, "power"); 41 power_reg = of_ioremap(res, 0, 0x4, "power");
42 42
@@ -70,7 +70,7 @@ static struct of_platform_driver power_driver = {
70 70
71static int __init power_init(void) 71static int __init power_init(void)
72{ 72{
73 return of_register_driver(&power_driver, &of_platform_bus_type); 73 return of_register_platform_driver(&power_driver);
74} 74}
75 75
76device_initcall(power_init); 76device_initcall(power_init);
diff --git a/arch/sparc/kernel/prom.h b/arch/sparc/kernel/prom.h
index a8591ef2636d..eeb04a782ec8 100644
--- a/arch/sparc/kernel/prom.h
+++ b/arch/sparc/kernel/prom.h
@@ -9,14 +9,6 @@ extern void irq_trans_init(struct device_node *dp);
9 9
10extern unsigned int prom_unique_id; 10extern unsigned int prom_unique_id;
11 11
12static inline int is_root_node(const struct device_node *dp)
13{
14 if (!dp)
15 return 0;
16
17 return (dp->parent == NULL);
18}
19
20extern char *build_path_component(struct device_node *dp); 12extern char *build_path_component(struct device_node *dp);
21extern void of_console_init(void); 13extern void of_console_init(void);
22 14
diff --git a/arch/sparc/kernel/prom_64.c b/arch/sparc/kernel/prom_64.c
index 466a32763ea8..86597d9867fd 100644
--- a/arch/sparc/kernel/prom_64.c
+++ b/arch/sparc/kernel/prom_64.c
@@ -21,7 +21,7 @@
21#include <linux/mm.h> 21#include <linux/mm.h>
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/memblock.h> 23#include <linux/memblock.h>
24#include <linux/of_device.h> 24#include <linux/of.h>
25 25
26#include <asm/prom.h> 26#include <asm/prom.h>
27#include <asm/oplib.h> 27#include <asm/oplib.h>
@@ -81,7 +81,7 @@ static void __init sun4v_path_component(struct device_node *dp, char *tmp_buf)
81 return; 81 return;
82 82
83 regs = rprop->value; 83 regs = rprop->value;
84 if (!is_root_node(dp->parent)) { 84 if (!of_node_is_root(dp->parent)) {
85 sprintf(tmp_buf, "%s@%x,%x", 85 sprintf(tmp_buf, "%s@%x,%x",
86 dp->name, 86 dp->name,
87 (unsigned int) (regs->phys_addr >> 32UL), 87 (unsigned int) (regs->phys_addr >> 32UL),
@@ -121,7 +121,7 @@ static void __init sun4u_path_component(struct device_node *dp, char *tmp_buf)
121 return; 121 return;
122 122
123 regs = prop->value; 123 regs = prop->value;
124 if (!is_root_node(dp->parent)) { 124 if (!of_node_is_root(dp->parent)) {
125 sprintf(tmp_buf, "%s@%x,%x", 125 sprintf(tmp_buf, "%s@%x,%x",
126 dp->name, 126 dp->name,
127 (unsigned int) (regs->phys_addr >> 32UL), 127 (unsigned int) (regs->phys_addr >> 32UL),
diff --git a/arch/sparc/kernel/prom_common.c b/arch/sparc/kernel/prom_common.c
index 57ac9e28be0c..1f830da2ddf2 100644
--- a/arch/sparc/kernel/prom_common.c
+++ b/arch/sparc/kernel/prom_common.c
@@ -244,7 +244,7 @@ char * __init build_full_name(struct device_node *dp)
244 244
245 n = prom_early_alloc(len); 245 n = prom_early_alloc(len);
246 strcpy(n, dp->parent->full_name); 246 strcpy(n, dp->parent->full_name);
247 if (!is_root_node(dp->parent)) { 247 if (!of_node_is_root(dp->parent)) {
248 strcpy(n + plen, "/"); 248 strcpy(n + plen, "/");
249 plen++; 249 plen++;
250 } 250 }
diff --git a/arch/sparc/kernel/prom_irqtrans.c b/arch/sparc/kernel/prom_irqtrans.c
index 5702ad4710cb..ce651147fabc 100644
--- a/arch/sparc/kernel/prom_irqtrans.c
+++ b/arch/sparc/kernel/prom_irqtrans.c
@@ -719,7 +719,7 @@ static unsigned int central_build_irq(struct device_node *dp,
719 void *_data) 719 void *_data)
720{ 720{
721 struct device_node *central_dp = _data; 721 struct device_node *central_dp = _data;
722 struct of_device *central_op = of_find_device_by_node(central_dp); 722 struct platform_device *central_op = of_find_device_by_node(central_dp);
723 struct resource *res; 723 struct resource *res;
724 unsigned long imap, iclr; 724 unsigned long imap, iclr;
725 u32 tmp; 725 u32 tmp;
diff --git a/arch/sparc/kernel/psycho_common.c b/arch/sparc/kernel/psycho_common.c
index 3f34ac853931..fe2af66bb198 100644
--- a/arch/sparc/kernel/psycho_common.c
+++ b/arch/sparc/kernel/psycho_common.c
@@ -447,7 +447,7 @@ int psycho_iommu_init(struct pci_pbm_info *pbm, int tsbsize,
447 447
448} 448}
449 449
450void psycho_pbm_init_common(struct pci_pbm_info *pbm, struct of_device *op, 450void psycho_pbm_init_common(struct pci_pbm_info *pbm, struct platform_device *op,
451 const char *chip_name, int chip_type) 451 const char *chip_name, int chip_type)
452{ 452{
453 struct device_node *dp = op->dev.of_node; 453 struct device_node *dp = op->dev.of_node;
diff --git a/arch/sparc/kernel/psycho_common.h b/arch/sparc/kernel/psycho_common.h
index 092c278ef28d..590b4ed8ab5e 100644
--- a/arch/sparc/kernel/psycho_common.h
+++ b/arch/sparc/kernel/psycho_common.h
@@ -42,7 +42,7 @@ extern int psycho_iommu_init(struct pci_pbm_info *pbm, int tsbsize,
42 unsigned long write_complete_offset); 42 unsigned long write_complete_offset);
43 43
44extern void psycho_pbm_init_common(struct pci_pbm_info *pbm, 44extern void psycho_pbm_init_common(struct pci_pbm_info *pbm,
45 struct of_device *op, 45 struct platform_device *op,
46 const char *chip_name, int chip_type); 46 const char *chip_name, int chip_type);
47 47
48#endif /* _PSYCHO_COMMON_H */ 48#endif /* _PSYCHO_COMMON_H */
diff --git a/arch/sparc/kernel/sbus.c b/arch/sparc/kernel/sbus.c
index cfeaf04b9cdf..2ca32d13abcf 100644
--- a/arch/sparc/kernel/sbus.c
+++ b/arch/sparc/kernel/sbus.c
@@ -57,7 +57,7 @@
57void sbus_set_sbus64(struct device *dev, int bursts) 57void sbus_set_sbus64(struct device *dev, int bursts)
58{ 58{
59 struct iommu *iommu = dev->archdata.iommu; 59 struct iommu *iommu = dev->archdata.iommu;
60 struct of_device *op = to_of_device(dev); 60 struct platform_device *op = to_platform_device(dev);
61 const struct linux_prom_registers *regs; 61 const struct linux_prom_registers *regs;
62 unsigned long cfg_reg; 62 unsigned long cfg_reg;
63 int slot; 63 int slot;
@@ -204,7 +204,7 @@ static unsigned long sysio_imap_to_iclr(unsigned long imap)
204 return imap + diff; 204 return imap + diff;
205} 205}
206 206
207static unsigned int sbus_build_irq(struct of_device *op, unsigned int ino) 207static unsigned int sbus_build_irq(struct platform_device *op, unsigned int ino)
208{ 208{
209 struct iommu *iommu = op->dev.archdata.iommu; 209 struct iommu *iommu = op->dev.archdata.iommu;
210 unsigned long reg_base = iommu->write_complete_reg - 0x2000UL; 210 unsigned long reg_base = iommu->write_complete_reg - 0x2000UL;
@@ -267,7 +267,7 @@ static unsigned int sbus_build_irq(struct of_device *op, unsigned int ino)
267#define SYSIO_UEAFSR_RESV2 0x0000001fffffffffUL /* Reserved */ 267#define SYSIO_UEAFSR_RESV2 0x0000001fffffffffUL /* Reserved */
268static irqreturn_t sysio_ue_handler(int irq, void *dev_id) 268static irqreturn_t sysio_ue_handler(int irq, void *dev_id)
269{ 269{
270 struct of_device *op = dev_id; 270 struct platform_device *op = dev_id;
271 struct iommu *iommu = op->dev.archdata.iommu; 271 struct iommu *iommu = op->dev.archdata.iommu;
272 unsigned long reg_base = iommu->write_complete_reg - 0x2000UL; 272 unsigned long reg_base = iommu->write_complete_reg - 0x2000UL;
273 unsigned long afsr_reg, afar_reg; 273 unsigned long afsr_reg, afar_reg;
@@ -341,7 +341,7 @@ static irqreturn_t sysio_ue_handler(int irq, void *dev_id)
341#define SYSIO_CEAFSR_RESV2 0x0000001fffffffffUL /* Reserved */ 341#define SYSIO_CEAFSR_RESV2 0x0000001fffffffffUL /* Reserved */
342static irqreturn_t sysio_ce_handler(int irq, void *dev_id) 342static irqreturn_t sysio_ce_handler(int irq, void *dev_id)
343{ 343{
344 struct of_device *op = dev_id; 344 struct platform_device *op = dev_id;
345 struct iommu *iommu = op->dev.archdata.iommu; 345 struct iommu *iommu = op->dev.archdata.iommu;
346 unsigned long reg_base = iommu->write_complete_reg - 0x2000UL; 346 unsigned long reg_base = iommu->write_complete_reg - 0x2000UL;
347 unsigned long afsr_reg, afar_reg; 347 unsigned long afsr_reg, afar_reg;
@@ -420,7 +420,7 @@ static irqreturn_t sysio_ce_handler(int irq, void *dev_id)
420#define SYSIO_SBAFSR_RESV3 0x0000001fffffffffUL /* Reserved */ 420#define SYSIO_SBAFSR_RESV3 0x0000001fffffffffUL /* Reserved */
421static irqreturn_t sysio_sbus_error_handler(int irq, void *dev_id) 421static irqreturn_t sysio_sbus_error_handler(int irq, void *dev_id)
422{ 422{
423 struct of_device *op = dev_id; 423 struct platform_device *op = dev_id;
424 struct iommu *iommu = op->dev.archdata.iommu; 424 struct iommu *iommu = op->dev.archdata.iommu;
425 unsigned long afsr_reg, afar_reg, reg_base; 425 unsigned long afsr_reg, afar_reg, reg_base;
426 unsigned long afsr, afar, error_bits; 426 unsigned long afsr, afar, error_bits;
@@ -488,7 +488,7 @@ static irqreturn_t sysio_sbus_error_handler(int irq, void *dev_id)
488#define SYSIO_CE_INO 0x35 488#define SYSIO_CE_INO 0x35
489#define SYSIO_SBUSERR_INO 0x36 489#define SYSIO_SBUSERR_INO 0x36
490 490
491static void __init sysio_register_error_handlers(struct of_device *op) 491static void __init sysio_register_error_handlers(struct platform_device *op)
492{ 492{
493 struct iommu *iommu = op->dev.archdata.iommu; 493 struct iommu *iommu = op->dev.archdata.iommu;
494 unsigned long reg_base = iommu->write_complete_reg - 0x2000UL; 494 unsigned long reg_base = iommu->write_complete_reg - 0x2000UL;
@@ -534,7 +534,7 @@ static void __init sysio_register_error_handlers(struct of_device *op)
534} 534}
535 535
536/* Boot time initialization. */ 536/* Boot time initialization. */
537static void __init sbus_iommu_init(struct of_device *op) 537static void __init sbus_iommu_init(struct platform_device *op)
538{ 538{
539 const struct linux_prom64_registers *pr; 539 const struct linux_prom64_registers *pr;
540 struct device_node *dp = op->dev.of_node; 540 struct device_node *dp = op->dev.of_node;
@@ -663,7 +663,7 @@ static int __init sbus_init(void)
663 struct device_node *dp; 663 struct device_node *dp;
664 664
665 for_each_node_by_name(dp, "sbus") { 665 for_each_node_by_name(dp, "sbus") {
666 struct of_device *op = of_find_device_by_node(dp); 666 struct platform_device *op = of_find_device_by_node(dp);
667 667
668 sbus_iommu_init(op); 668 sbus_iommu_init(op);
669 of_propagate_archdata(op); 669 of_propagate_archdata(op);
diff --git a/arch/sparc/kernel/time_32.c b/arch/sparc/kernel/time_32.c
index e404b063be2c..9c743b1886ff 100644
--- a/arch/sparc/kernel/time_32.c
+++ b/arch/sparc/kernel/time_32.c
@@ -142,7 +142,7 @@ static struct platform_device m48t59_rtc = {
142 }, 142 },
143}; 143};
144 144
145static int __devinit clock_probe(struct of_device *op, const struct of_device_id *match) 145static int __devinit clock_probe(struct platform_device *op, const struct of_device_id *match)
146{ 146{
147 struct device_node *dp = op->dev.of_node; 147 struct device_node *dp = op->dev.of_node;
148 const char *model = of_get_property(dp, "model", NULL); 148 const char *model = of_get_property(dp, "model", NULL);
@@ -189,7 +189,7 @@ static struct of_platform_driver clock_driver = {
189/* Probe for the mostek real time clock chip. */ 189/* Probe for the mostek real time clock chip. */
190static int __init clock_init(void) 190static int __init clock_init(void)
191{ 191{
192 return of_register_driver(&clock_driver, &of_platform_bus_type); 192 return of_register_platform_driver(&clock_driver);
193} 193}
194/* Must be after subsys_initcall() so that busses are probed. Must 194/* Must be after subsys_initcall() so that busses are probed. Must
195 * be before device_initcall() because things like the RTC driver 195 * be before device_initcall() because things like the RTC driver
diff --git a/arch/sparc/kernel/time_64.c b/arch/sparc/kernel/time_64.c
index 21e9fcae0668..3bc9c9979b92 100644
--- a/arch/sparc/kernel/time_64.c
+++ b/arch/sparc/kernel/time_64.c
@@ -419,7 +419,7 @@ static struct platform_device rtc_cmos_device = {
419 .num_resources = 1, 419 .num_resources = 1,
420}; 420};
421 421
422static int __devinit rtc_probe(struct of_device *op, const struct of_device_id *match) 422static int __devinit rtc_probe(struct platform_device *op, const struct of_device_id *match)
423{ 423{
424 struct resource *r; 424 struct resource *r;
425 425
@@ -477,7 +477,7 @@ static struct platform_device rtc_bq4802_device = {
477 .num_resources = 1, 477 .num_resources = 1,
478}; 478};
479 479
480static int __devinit bq4802_probe(struct of_device *op, const struct of_device_id *match) 480static int __devinit bq4802_probe(struct platform_device *op, const struct of_device_id *match)
481{ 481{
482 482
483 printk(KERN_INFO "%s: BQ4802 regs at 0x%llx\n", 483 printk(KERN_INFO "%s: BQ4802 regs at 0x%llx\n",
@@ -534,7 +534,7 @@ static struct platform_device m48t59_rtc = {
534 }, 534 },
535}; 535};
536 536
537static int __devinit mostek_probe(struct of_device *op, const struct of_device_id *match) 537static int __devinit mostek_probe(struct platform_device *op, const struct of_device_id *match)
538{ 538{
539 struct device_node *dp = op->dev.of_node; 539 struct device_node *dp = op->dev.of_node;
540 540
@@ -586,9 +586,9 @@ static int __init clock_init(void)
586 if (tlb_type == hypervisor) 586 if (tlb_type == hypervisor)
587 return platform_device_register(&rtc_sun4v_device); 587 return platform_device_register(&rtc_sun4v_device);
588 588
589 (void) of_register_driver(&rtc_driver, &of_platform_bus_type); 589 (void) of_register_platform_driver(&rtc_driver);
590 (void) of_register_driver(&mostek_driver, &of_platform_bus_type); 590 (void) of_register_platform_driver(&mostek_driver);
591 (void) of_register_driver(&bq4802_driver, &of_platform_bus_type); 591 (void) of_register_platform_driver(&bq4802_driver);
592 592
593 return 0; 593 return 0;
594} 594}
diff --git a/arch/sparc/mm/io-unit.c b/arch/sparc/mm/io-unit.c
index 005e758a4db7..fc58c3e917df 100644
--- a/arch/sparc/mm/io-unit.c
+++ b/arch/sparc/mm/io-unit.c
@@ -35,7 +35,7 @@
35#define IOPERM (IOUPTE_CACHE | IOUPTE_WRITE | IOUPTE_VALID) 35#define IOPERM (IOUPTE_CACHE | IOUPTE_WRITE | IOUPTE_VALID)
36#define MKIOPTE(phys) __iopte((((phys)>>4) & IOUPTE_PAGE) | IOPERM) 36#define MKIOPTE(phys) __iopte((((phys)>>4) & IOUPTE_PAGE) | IOPERM)
37 37
38static void __init iounit_iommu_init(struct of_device *op) 38static void __init iounit_iommu_init(struct platform_device *op)
39{ 39{
40 struct iounit_struct *iounit; 40 struct iounit_struct *iounit;
41 iopte_t *xpt, *xptend; 41 iopte_t *xpt, *xptend;
@@ -74,7 +74,7 @@ static int __init iounit_init(void)
74 struct device_node *dp; 74 struct device_node *dp;
75 75
76 for_each_node_by_name(dp, "sbi") { 76 for_each_node_by_name(dp, "sbi") {
77 struct of_device *op = of_find_device_by_node(dp); 77 struct platform_device *op = of_find_device_by_node(dp);
78 78
79 iounit_iommu_init(op); 79 iounit_iommu_init(op);
80 of_propagate_archdata(op); 80 of_propagate_archdata(op);
diff --git a/arch/sparc/mm/iommu.c b/arch/sparc/mm/iommu.c
index b2e6e73888b5..07fc6a65d9b6 100644
--- a/arch/sparc/mm/iommu.c
+++ b/arch/sparc/mm/iommu.c
@@ -56,14 +56,14 @@ static pgprot_t dvma_prot; /* Consistent mapping pte flags */
56#define IOPERM (IOPTE_CACHE | IOPTE_WRITE | IOPTE_VALID) 56#define IOPERM (IOPTE_CACHE | IOPTE_WRITE | IOPTE_VALID)
57#define MKIOPTE(pfn, perm) (((((pfn)<<8) & IOPTE_PAGE) | (perm)) & ~IOPTE_WAZ) 57#define MKIOPTE(pfn, perm) (((((pfn)<<8) & IOPTE_PAGE) | (perm)) & ~IOPTE_WAZ)
58 58
59static void __init sbus_iommu_init(struct of_device *op) 59static void __init sbus_iommu_init(struct platform_device *op)
60{ 60{
61 struct iommu_struct *iommu; 61 struct iommu_struct *iommu;
62 unsigned int impl, vers; 62 unsigned int impl, vers;
63 unsigned long *bitmap; 63 unsigned long *bitmap;
64 unsigned long tmp; 64 unsigned long tmp;
65 65
66 iommu = kmalloc(sizeof(struct iommu_struct), GFP_ATOMIC); 66 iommu = kmalloc(sizeof(struct iommu_struct), GFP_KERNEL);
67 if (!iommu) { 67 if (!iommu) {
68 prom_printf("Unable to allocate iommu structure\n"); 68 prom_printf("Unable to allocate iommu structure\n");
69 prom_halt(); 69 prom_halt();
@@ -132,7 +132,7 @@ static int __init iommu_init(void)
132 struct device_node *dp; 132 struct device_node *dp;
133 133
134 for_each_node_by_name(dp, "iommu") { 134 for_each_node_by_name(dp, "iommu") {
135 struct of_device *op = of_find_device_by_node(dp); 135 struct platform_device *op = of_find_device_by_node(dp);
136 136
137 sbus_iommu_init(op); 137 sbus_iommu_init(op);
138 of_propagate_archdata(op); 138 of_propagate_archdata(op);
diff --git a/arch/um/Kconfig.common b/arch/um/Kconfig.common
index 0d207e73a758..7c8e277f6d34 100644
--- a/arch/um/Kconfig.common
+++ b/arch/um/Kconfig.common
@@ -55,10 +55,6 @@ config GENERIC_BUG
55 default y 55 default y
56 depends on BUG 56 depends on BUG
57 57
58config GENERIC_TIME
59 bool
60 default y
61
62config GENERIC_CLOCKEVENTS 58config GENERIC_CLOCKEVENTS
63 bool 59 bool
64 default y 60 default y
diff --git a/arch/um/drivers/net_kern.c b/arch/um/drivers/net_kern.c
index f05372694233..2ab233ba32c1 100644
--- a/arch/um/drivers/net_kern.c
+++ b/arch/um/drivers/net_kern.c
@@ -25,11 +25,6 @@
25#include "net_kern.h" 25#include "net_kern.h"
26#include "net_user.h" 26#include "net_user.h"
27 27
28static inline void set_ether_mac(struct net_device *dev, unsigned char *addr)
29{
30 memcpy(dev->dev_addr, addr, ETH_ALEN);
31}
32
33#define DRIVER_NAME "uml-netdev" 28#define DRIVER_NAME "uml-netdev"
34 29
35static DEFINE_SPINLOCK(opened_lock); 30static DEFINE_SPINLOCK(opened_lock);
@@ -266,7 +261,7 @@ static int uml_net_set_mac(struct net_device *dev, void *addr)
266 struct sockaddr *hwaddr = addr; 261 struct sockaddr *hwaddr = addr;
267 262
268 spin_lock_irq(&lp->lock); 263 spin_lock_irq(&lp->lock);
269 set_ether_mac(dev, hwaddr->sa_data); 264 eth_mac_addr(dev, hwaddr->sa_data);
270 spin_unlock_irq(&lp->lock); 265 spin_unlock_irq(&lp->lock);
271 266
272 return 0; 267 return 0;
@@ -380,7 +375,6 @@ static const struct net_device_ops uml_netdev_ops = {
380 .ndo_tx_timeout = uml_net_tx_timeout, 375 .ndo_tx_timeout = uml_net_tx_timeout,
381 .ndo_set_mac_address = uml_net_set_mac, 376 .ndo_set_mac_address = uml_net_set_mac,
382 .ndo_change_mtu = uml_net_change_mtu, 377 .ndo_change_mtu = uml_net_change_mtu,
383 .ndo_set_mac_address = eth_mac_addr,
384 .ndo_validate_addr = eth_validate_addr, 378 .ndo_validate_addr = eth_validate_addr,
385}; 379};
386 380
@@ -478,7 +472,7 @@ static void eth_configure(int n, void *init, char *mac,
478 ((*transport->user->init)(&lp->user, dev) != 0)) 472 ((*transport->user->init)(&lp->user, dev) != 0))
479 goto out_unregister; 473 goto out_unregister;
480 474
481 set_ether_mac(dev, device->mac); 475 eth_mac_addr(dev, device->mac);
482 dev->mtu = transport->user->mtu; 476 dev->mtu = transport->user->mtu;
483 dev->netdev_ops = &uml_netdev_ops; 477 dev->netdev_ops = &uml_netdev_ops;
484 dev->ethtool_ops = &uml_net_ethtool_ops; 478 dev->ethtool_ops = &uml_net_ethtool_ops;
diff --git a/arch/um/include/asm/pgtable-3level.h b/arch/um/include/asm/pgtable-3level.h
index 084de4a9fc70..0032f9212e74 100644
--- a/arch/um/include/asm/pgtable-3level.h
+++ b/arch/um/include/asm/pgtable-3level.h
@@ -60,7 +60,7 @@
60 set_pud(pud, __pud(_PAGE_TABLE + __pa(pmd))) 60 set_pud(pud, __pud(_PAGE_TABLE + __pa(pmd)))
61 61
62#ifdef CONFIG_64BIT 62#ifdef CONFIG_64BIT
63#define set_pud(pudptr, pudval) set_64bit((phys_t *) (pudptr), pud_val(pudval)) 63#define set_pud(pudptr, pudval) set_64bit((u64 *) (pudptr), pud_val(pudval))
64#else 64#else
65#define set_pud(pudptr, pudval) (*(pudptr) = (pudval)) 65#define set_pud(pudptr, pudval) (*(pudptr) = (pudval))
66#endif 66#endif
@@ -73,7 +73,7 @@ static inline int pgd_newpage(pgd_t pgd)
73static inline void pgd_mkuptodate(pgd_t pgd) { pgd_val(pgd) &= ~_PAGE_NEWPAGE; } 73static inline void pgd_mkuptodate(pgd_t pgd) { pgd_val(pgd) &= ~_PAGE_NEWPAGE; }
74 74
75#ifdef CONFIG_64BIT 75#ifdef CONFIG_64BIT
76#define set_pmd(pmdptr, pmdval) set_64bit((phys_t *) (pmdptr), pmd_val(pmdval)) 76#define set_pmd(pmdptr, pmdval) set_64bit((u64 *) (pmdptr), pmd_val(pmdval))
77#else 77#else
78#define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval)) 78#define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval))
79#endif 79#endif
diff --git a/arch/um/kernel/time.c b/arch/um/kernel/time.c
index c8b9c469fcd7..a08d9fab81f2 100644
--- a/arch/um/kernel/time.c
+++ b/arch/um/kernel/time.c
@@ -102,16 +102,16 @@ static void __init setup_itimer(void)
102 clockevents_register_device(&itimer_clockevent); 102 clockevents_register_device(&itimer_clockevent);
103} 103}
104 104
105void __init time_init(void) 105void read_persistent_clock(struct timespec *ts)
106{ 106{
107 long long nsecs; 107 long long nsecs = os_nsecs();
108
109 timer_init();
110 108
111 nsecs = os_nsecs(); 109 set_normalized_timespec(ts, nsecs / NSEC_PER_SEC,
112 set_normalized_timespec(&wall_to_monotonic, -nsecs / NSEC_PER_SEC,
113 -nsecs % NSEC_PER_SEC);
114 set_normalized_timespec(&xtime, nsecs / NSEC_PER_SEC,
115 nsecs % NSEC_PER_SEC); 110 nsecs % NSEC_PER_SEC);
111}
112
113void __init time_init(void)
114{
115 timer_init();
116 late_time_init = setup_itimer; 116 late_time_init = setup_itimer;
117} 117}
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index dcb0593b4a66..baa34e510222 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -55,6 +55,7 @@ config X86
55 select HAVE_HW_BREAKPOINT 55 select HAVE_HW_BREAKPOINT
56 select HAVE_MIXED_BREAKPOINTS_REGS 56 select HAVE_MIXED_BREAKPOINTS_REGS
57 select PERF_EVENTS 57 select PERF_EVENTS
58 select HAVE_PERF_EVENTS_NMI
58 select ANON_INODES 59 select ANON_INODES
59 select HAVE_ARCH_KMEMCHECK 60 select HAVE_ARCH_KMEMCHECK
60 select HAVE_USER_RETURN_NOTIFIER 61 select HAVE_USER_RETURN_NOTIFIER
@@ -72,9 +73,6 @@ config ARCH_DEFCONFIG
72 default "arch/x86/configs/i386_defconfig" if X86_32 73 default "arch/x86/configs/i386_defconfig" if X86_32
73 default "arch/x86/configs/x86_64_defconfig" if X86_64 74 default "arch/x86/configs/x86_64_defconfig" if X86_64
74 75
75config GENERIC_TIME
76 def_bool y
77
78config GENERIC_CMOS_UPDATE 76config GENERIC_CMOS_UPDATE
79 def_bool y 77 def_bool y
80 78
@@ -2046,7 +2044,7 @@ config SCx200
2046 2044
2047config SCx200HR_TIMER 2045config SCx200HR_TIMER
2048 tristate "NatSemi SCx200 27MHz High-Resolution Timer Support" 2046 tristate "NatSemi SCx200 27MHz High-Resolution Timer Support"
2049 depends on SCx200 && GENERIC_TIME 2047 depends on SCx200
2050 default y 2048 default y
2051 ---help--- 2049 ---help---
2052 This driver provides a clocksource built upon the on-chip 2050 This driver provides a clocksource built upon the on-chip
diff --git a/arch/x86/boot/Makefile b/arch/x86/boot/Makefile
index ec749c2bfdd7..f7cb086b4add 100644
--- a/arch/x86/boot/Makefile
+++ b/arch/x86/boot/Makefile
@@ -26,10 +26,10 @@ targets := vmlinux.bin setup.bin setup.elf bzImage
26targets += fdimage fdimage144 fdimage288 image.iso mtools.conf 26targets += fdimage fdimage144 fdimage288 image.iso mtools.conf
27subdir- := compressed 27subdir- := compressed
28 28
29setup-y += a20.o bioscall.o cmdline.o copy.o cpu.o cpucheck.o edd.o 29setup-y += a20.o bioscall.o cmdline.o copy.o cpu.o cpucheck.o
30setup-y += header.o main.o mca.o memory.o pm.o pmjump.o 30setup-y += early_serial_console.o edd.o header.o main.o mca.o memory.o
31setup-y += printf.o regs.o string.o tty.o video.o video-mode.o 31setup-y += pm.o pmjump.o printf.o regs.o string.o tty.o video.o
32setup-y += version.o 32setup-y += video-mode.o version.o
33setup-$(CONFIG_X86_APM_BOOT) += apm.o 33setup-$(CONFIG_X86_APM_BOOT) += apm.o
34 34
35# The link order of the video-*.o modules can matter. In particular, 35# The link order of the video-*.o modules can matter. In particular,
diff --git a/arch/x86/boot/boot.h b/arch/x86/boot/boot.h
index 98239d2658f2..c7093bd9f2d3 100644
--- a/arch/x86/boot/boot.h
+++ b/arch/x86/boot/boot.h
@@ -28,6 +28,7 @@
28#include "bitops.h" 28#include "bitops.h"
29#include <asm/cpufeature.h> 29#include <asm/cpufeature.h>
30#include <asm/processor-flags.h> 30#include <asm/processor-flags.h>
31#include "ctype.h"
31 32
32/* Useful macros */ 33/* Useful macros */
33#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)])) 34#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
@@ -37,6 +38,8 @@
37extern struct setup_header hdr; 38extern struct setup_header hdr;
38extern struct boot_params boot_params; 39extern struct boot_params boot_params;
39 40
41#define cpu_relax() asm volatile("rep; nop")
42
40/* Basic port I/O */ 43/* Basic port I/O */
41static inline void outb(u8 v, u16 port) 44static inline void outb(u8 v, u16 port)
42{ 45{
@@ -198,11 +201,6 @@ static inline int memcmp_gs(const void *s1, addr_t s2, size_t len)
198 return diff; 201 return diff;
199} 202}
200 203
201static inline int isdigit(int ch)
202{
203 return (ch >= '0') && (ch <= '9');
204}
205
206/* Heap -- available for dynamic lists. */ 204/* Heap -- available for dynamic lists. */
207extern char _end[]; 205extern char _end[];
208extern char *HEAP; 206extern char *HEAP;
@@ -287,8 +285,18 @@ struct biosregs {
287void intcall(u8 int_no, const struct biosregs *ireg, struct biosregs *oreg); 285void intcall(u8 int_no, const struct biosregs *ireg, struct biosregs *oreg);
288 286
289/* cmdline.c */ 287/* cmdline.c */
290int cmdline_find_option(const char *option, char *buffer, int bufsize); 288int __cmdline_find_option(u32 cmdline_ptr, const char *option, char *buffer, int bufsize);
291int cmdline_find_option_bool(const char *option); 289int __cmdline_find_option_bool(u32 cmdline_ptr, const char *option);
290static inline int cmdline_find_option(const char *option, char *buffer, int bufsize)
291{
292 return __cmdline_find_option(boot_params.hdr.cmd_line_ptr, option, buffer, bufsize);
293}
294
295static inline int cmdline_find_option_bool(const char *option)
296{
297 return __cmdline_find_option_bool(boot_params.hdr.cmd_line_ptr, option);
298}
299
292 300
293/* cpu.c, cpucheck.c */ 301/* cpu.c, cpucheck.c */
294struct cpu_features { 302struct cpu_features {
@@ -300,6 +308,10 @@ extern struct cpu_features cpu;
300int check_cpu(int *cpu_level_ptr, int *req_level_ptr, u32 **err_flags_ptr); 308int check_cpu(int *cpu_level_ptr, int *req_level_ptr, u32 **err_flags_ptr);
301int validate_cpu(void); 309int validate_cpu(void);
302 310
311/* early_serial_console.c */
312extern int early_serial_base;
313void console_init(void);
314
303/* edd.c */ 315/* edd.c */
304void query_edd(void); 316void query_edd(void);
305 317
@@ -329,8 +341,10 @@ void initregs(struct biosregs *regs);
329 341
330/* string.c */ 342/* string.c */
331int strcmp(const char *str1, const char *str2); 343int strcmp(const char *str1, const char *str2);
344int strncmp(const char *cs, const char *ct, size_t count);
332size_t strnlen(const char *s, size_t maxlen); 345size_t strnlen(const char *s, size_t maxlen);
333unsigned int atou(const char *s); 346unsigned int atou(const char *s);
347unsigned long long simple_strtoull(const char *cp, char **endp, unsigned int base);
334 348
335/* tty.c */ 349/* tty.c */
336void puts(const char *); 350void puts(const char *);
diff --git a/arch/x86/boot/cmdline.c b/arch/x86/boot/cmdline.c
index a1d35634bce0..6b3b6f708c04 100644
--- a/arch/x86/boot/cmdline.c
+++ b/arch/x86/boot/cmdline.c
@@ -27,9 +27,8 @@ static inline int myisspace(u8 c)
27 * Returns the length of the argument (regardless of if it was 27 * Returns the length of the argument (regardless of if it was
28 * truncated to fit in the buffer), or -1 on not found. 28 * truncated to fit in the buffer), or -1 on not found.
29 */ 29 */
30int cmdline_find_option(const char *option, char *buffer, int bufsize) 30int __cmdline_find_option(u32 cmdline_ptr, const char *option, char *buffer, int bufsize)
31{ 31{
32 u32 cmdline_ptr = boot_params.hdr.cmd_line_ptr;
33 addr_t cptr; 32 addr_t cptr;
34 char c; 33 char c;
35 int len = -1; 34 int len = -1;
@@ -100,9 +99,8 @@ int cmdline_find_option(const char *option, char *buffer, int bufsize)
100 * Returns the position of that option (starts counting with 1) 99 * Returns the position of that option (starts counting with 1)
101 * or 0 on not found 100 * or 0 on not found
102 */ 101 */
103int cmdline_find_option_bool(const char *option) 102int __cmdline_find_option_bool(u32 cmdline_ptr, const char *option)
104{ 103{
105 u32 cmdline_ptr = boot_params.hdr.cmd_line_ptr;
106 addr_t cptr; 104 addr_t cptr;
107 char c; 105 char c;
108 int pos = 0, wstart = 0; 106 int pos = 0, wstart = 0;
diff --git a/arch/x86/boot/compressed/Makefile b/arch/x86/boot/compressed/Makefile
index fbb47daf2459..0c229551eead 100644
--- a/arch/x86/boot/compressed/Makefile
+++ b/arch/x86/boot/compressed/Makefile
@@ -4,7 +4,7 @@
4# create a compressed vmlinux image from the original vmlinux 4# create a compressed vmlinux image from the original vmlinux
5# 5#
6 6
7targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.lzo head_$(BITS).o misc.o piggy.o 7targets := vmlinux.lds vmlinux vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.lzo head_$(BITS).o misc.o string.o cmdline.o early_serial_console.o piggy.o
8 8
9KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2 9KBUILD_CFLAGS := -m$(BITS) -D__KERNEL__ $(LINUX_INCLUDE) -O2
10KBUILD_CFLAGS += -fno-strict-aliasing -fPIC 10KBUILD_CFLAGS += -fno-strict-aliasing -fPIC
@@ -23,7 +23,7 @@ LDFLAGS_vmlinux := -T
23 23
24hostprogs-y := mkpiggy 24hostprogs-y := mkpiggy
25 25
26$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o $(obj)/piggy.o FORCE 26$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/head_$(BITS).o $(obj)/misc.o $(obj)/string.o $(obj)/cmdline.o $(obj)/early_serial_console.o $(obj)/piggy.o FORCE
27 $(call if_changed,ld) 27 $(call if_changed,ld)
28 @: 28 @:
29 29
diff --git a/arch/x86/boot/compressed/cmdline.c b/arch/x86/boot/compressed/cmdline.c
new file mode 100644
index 000000000000..cb62f786990d
--- /dev/null
+++ b/arch/x86/boot/compressed/cmdline.c
@@ -0,0 +1,21 @@
1#include "misc.h"
2
3static unsigned long fs;
4static inline void set_fs(unsigned long seg)
5{
6 fs = seg << 4; /* shift it back */
7}
8typedef unsigned long addr_t;
9static inline char rdfs8(addr_t addr)
10{
11 return *((char *)(fs + addr));
12}
13#include "../cmdline.c"
14int cmdline_find_option(const char *option, char *buffer, int bufsize)
15{
16 return __cmdline_find_option(real_mode->hdr.cmd_line_ptr, option, buffer, bufsize);
17}
18int cmdline_find_option_bool(const char *option)
19{
20 return __cmdline_find_option_bool(real_mode->hdr.cmd_line_ptr, option);
21}
diff --git a/arch/x86/boot/compressed/early_serial_console.c b/arch/x86/boot/compressed/early_serial_console.c
new file mode 100644
index 000000000000..261e81fb9582
--- /dev/null
+++ b/arch/x86/boot/compressed/early_serial_console.c
@@ -0,0 +1,5 @@
1#include "misc.h"
2
3int early_serial_base;
4
5#include "../early_serial_console.c"
diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S
index f543b70ffae2..67a655a39ce4 100644
--- a/arch/x86/boot/compressed/head_32.S
+++ b/arch/x86/boot/compressed/head_32.S
@@ -124,6 +124,19 @@ relocated:
124 rep stosl 124 rep stosl
125 125
126/* 126/*
127 * Adjust our own GOT
128 */
129 leal _got(%ebx), %edx
130 leal _egot(%ebx), %ecx
1311:
132 cmpl %ecx, %edx
133 jae 2f
134 addl %ebx, (%edx)
135 addl $4, %edx
136 jmp 1b
1372:
138
139/*
127 * Do the decompression, and jump to the new kernel.. 140 * Do the decompression, and jump to the new kernel..
128 */ 141 */
129 leal z_extract_offset_negative(%ebx), %ebp 142 leal z_extract_offset_negative(%ebx), %ebp
diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
index faff0dc9c06a..52f85a196fa0 100644
--- a/arch/x86/boot/compressed/head_64.S
+++ b/arch/x86/boot/compressed/head_64.S
@@ -280,6 +280,19 @@ relocated:
280 rep stosq 280 rep stosq
281 281
282/* 282/*
283 * Adjust our own GOT
284 */
285 leaq _got(%rip), %rdx
286 leaq _egot(%rip), %rcx
2871:
288 cmpq %rcx, %rdx
289 jae 2f
290 addq %rbx, (%rdx)
291 addq $8, %rdx
292 jmp 1b
2932:
294
295/*
283 * Do the decompression, and jump to the new kernel.. 296 * Do the decompression, and jump to the new kernel..
284 */ 297 */
285 pushq %rsi /* Save the real mode argument */ 298 pushq %rsi /* Save the real mode argument */
diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c
index 51e240779a44..8f7bef8e9fff 100644
--- a/arch/x86/boot/compressed/misc.c
+++ b/arch/x86/boot/compressed/misc.c
@@ -9,23 +9,7 @@
9 * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996 9 * High loaded stuff by Hans Lermen & Werner Almesberger, Feb. 1996
10 */ 10 */
11 11
12/* 12#include "misc.h"
13 * we have to be careful, because no indirections are allowed here, and
14 * paravirt_ops is a kind of one. As it will only run in baremetal anyway,
15 * we just keep it from happening
16 */
17#undef CONFIG_PARAVIRT
18#ifdef CONFIG_X86_32
19#define _ASM_X86_DESC_H 1
20#endif
21
22#include <linux/linkage.h>
23#include <linux/screen_info.h>
24#include <linux/elf.h>
25#include <linux/io.h>
26#include <asm/page.h>
27#include <asm/boot.h>
28#include <asm/bootparam.h>
29 13
30/* WARNING!! 14/* WARNING!!
31 * This code is compiled with -fPIC and it is relocated dynamically 15 * This code is compiled with -fPIC and it is relocated dynamically
@@ -123,15 +107,13 @@ static void error(char *m);
123/* 107/*
124 * This is set up by the setup-routine at boot-time 108 * This is set up by the setup-routine at boot-time
125 */ 109 */
126static struct boot_params *real_mode; /* Pointer to real-mode data */ 110struct boot_params *real_mode; /* Pointer to real-mode data */
127static int quiet; 111static int quiet;
112static int debug;
128 113
129void *memset(void *s, int c, size_t n); 114void *memset(void *s, int c, size_t n);
130void *memcpy(void *dest, const void *src, size_t n); 115void *memcpy(void *dest, const void *src, size_t n);
131 116
132static void __putstr(int, const char *);
133#define putstr(__x) __putstr(0, __x)
134
135#ifdef CONFIG_X86_64 117#ifdef CONFIG_X86_64
136#define memptr long 118#define memptr long
137#else 119#else
@@ -170,7 +152,21 @@ static void scroll(void)
170 vidmem[i] = ' '; 152 vidmem[i] = ' ';
171} 153}
172 154
173static void __putstr(int error, const char *s) 155#define XMTRDY 0x20
156
157#define TXR 0 /* Transmit register (WRITE) */
158#define LSR 5 /* Line Status */
159static void serial_putchar(int ch)
160{
161 unsigned timeout = 0xffff;
162
163 while ((inb(early_serial_base + LSR) & XMTRDY) == 0 && --timeout)
164 cpu_relax();
165
166 outb(ch, early_serial_base + TXR);
167}
168
169void __putstr(int error, const char *s)
174{ 170{
175 int x, y, pos; 171 int x, y, pos;
176 char c; 172 char c;
@@ -179,6 +175,14 @@ static void __putstr(int error, const char *s)
179 if (!error) 175 if (!error)
180 return; 176 return;
181#endif 177#endif
178 if (early_serial_base) {
179 const char *str = s;
180 while (*str) {
181 if (*str == '\n')
182 serial_putchar('\r');
183 serial_putchar(*str++);
184 }
185 }
182 186
183 if (real_mode->screen_info.orig_video_mode == 0 && 187 if (real_mode->screen_info.orig_video_mode == 0 &&
184 lines == 0 && cols == 0) 188 lines == 0 && cols == 0)
@@ -305,8 +309,10 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
305{ 309{
306 real_mode = rmode; 310 real_mode = rmode;
307 311
308 if (real_mode->hdr.loadflags & QUIET_FLAG) 312 if (cmdline_find_option_bool("quiet"))
309 quiet = 1; 313 quiet = 1;
314 if (cmdline_find_option_bool("debug"))
315 debug = 1;
310 316
311 if (real_mode->screen_info.orig_video_mode == 7) { 317 if (real_mode->screen_info.orig_video_mode == 7) {
312 vidmem = (char *) 0xb0000; 318 vidmem = (char *) 0xb0000;
@@ -319,6 +325,10 @@ asmlinkage void decompress_kernel(void *rmode, memptr heap,
319 lines = real_mode->screen_info.orig_video_lines; 325 lines = real_mode->screen_info.orig_video_lines;
320 cols = real_mode->screen_info.orig_video_cols; 326 cols = real_mode->screen_info.orig_video_cols;
321 327
328 console_init();
329 if (debug)
330 putstr("early console in decompress_kernel\n");
331
322 free_mem_ptr = heap; /* Heap */ 332 free_mem_ptr = heap; /* Heap */
323 free_mem_end_ptr = heap + BOOT_HEAP_SIZE; 333 free_mem_end_ptr = heap + BOOT_HEAP_SIZE;
324 334
diff --git a/arch/x86/boot/compressed/misc.h b/arch/x86/boot/compressed/misc.h
new file mode 100644
index 000000000000..3f19c81a6203
--- /dev/null
+++ b/arch/x86/boot/compressed/misc.h
@@ -0,0 +1,39 @@
1#ifndef BOOT_COMPRESSED_MISC_H
2#define BOOT_COMPRESSED_MISC_H
3
4/*
5 * we have to be careful, because no indirections are allowed here, and
6 * paravirt_ops is a kind of one. As it will only run in baremetal anyway,
7 * we just keep it from happening
8 */
9#undef CONFIG_PARAVIRT
10#ifdef CONFIG_X86_32
11#define _ASM_X86_DESC_H 1
12#endif
13
14#include <linux/linkage.h>
15#include <linux/screen_info.h>
16#include <linux/elf.h>
17#include <linux/io.h>
18#include <asm/page.h>
19#include <asm/boot.h>
20#include <asm/bootparam.h>
21
22#define BOOT_BOOT_H
23#include "../ctype.h"
24
25/* misc.c */
26extern struct boot_params *real_mode; /* Pointer to real-mode data */
27void __putstr(int error, const char *s);
28#define putstr(__x) __putstr(0, __x)
29#define puts(__x) __putstr(0, __x)
30
31/* cmdline.c */
32int cmdline_find_option(const char *option, char *buffer, int bufsize);
33int cmdline_find_option_bool(const char *option);
34
35/* early_serial_console.c */
36extern int early_serial_base;
37void console_init(void);
38
39#endif
diff --git a/arch/x86/boot/compressed/string.c b/arch/x86/boot/compressed/string.c
new file mode 100644
index 000000000000..19b3e693cd72
--- /dev/null
+++ b/arch/x86/boot/compressed/string.c
@@ -0,0 +1,2 @@
1#include "misc.h"
2#include "../string.c"
diff --git a/arch/x86/boot/compressed/vmlinux.lds.S b/arch/x86/boot/compressed/vmlinux.lds.S
index 5ddabceee124..34d047c98284 100644
--- a/arch/x86/boot/compressed/vmlinux.lds.S
+++ b/arch/x86/boot/compressed/vmlinux.lds.S
@@ -41,6 +41,12 @@ SECTIONS
41 *(.rodata.*) 41 *(.rodata.*)
42 _erodata = . ; 42 _erodata = . ;
43 } 43 }
44 .got : {
45 _got = .;
46 KEEP(*(.got.plt))
47 KEEP(*(.got))
48 _egot = .;
49 }
44 .data : { 50 .data : {
45 _data = . ; 51 _data = . ;
46 *(.data) 52 *(.data)
diff --git a/arch/x86/boot/ctype.h b/arch/x86/boot/ctype.h
new file mode 100644
index 000000000000..25e13403193c
--- /dev/null
+++ b/arch/x86/boot/ctype.h
@@ -0,0 +1,21 @@
1#ifndef BOOT_ISDIGIT_H
2
3#define BOOT_ISDIGIT_H
4
5static inline int isdigit(int ch)
6{
7 return (ch >= '0') && (ch <= '9');
8}
9
10static inline int isxdigit(int ch)
11{
12 if (isdigit(ch))
13 return true;
14
15 if ((ch >= 'a') && (ch <= 'f'))
16 return true;
17
18 return (ch >= 'A') && (ch <= 'F');
19}
20
21#endif
diff --git a/arch/x86/boot/early_serial_console.c b/arch/x86/boot/early_serial_console.c
new file mode 100644
index 000000000000..030f4b93e255
--- /dev/null
+++ b/arch/x86/boot/early_serial_console.c
@@ -0,0 +1,139 @@
1#include "boot.h"
2
3#define DEFAULT_SERIAL_PORT 0x3f8 /* ttyS0 */
4
5#define XMTRDY 0x20
6
7#define DLAB 0x80
8
9#define TXR 0 /* Transmit register (WRITE) */
10#define RXR 0 /* Receive register (READ) */
11#define IER 1 /* Interrupt Enable */
12#define IIR 2 /* Interrupt ID */
13#define FCR 2 /* FIFO control */
14#define LCR 3 /* Line control */
15#define MCR 4 /* Modem control */
16#define LSR 5 /* Line Status */
17#define MSR 6 /* Modem Status */
18#define DLL 0 /* Divisor Latch Low */
19#define DLH 1 /* Divisor latch High */
20
21#define DEFAULT_BAUD 9600
22
23static void early_serial_init(int port, int baud)
24{
25 unsigned char c;
26 unsigned divisor;
27
28 outb(0x3, port + LCR); /* 8n1 */
29 outb(0, port + IER); /* no interrupt */
30 outb(0, port + FCR); /* no fifo */
31 outb(0x3, port + MCR); /* DTR + RTS */
32
33 divisor = 115200 / baud;
34 c = inb(port + LCR);
35 outb(c | DLAB, port + LCR);
36 outb(divisor & 0xff, port + DLL);
37 outb((divisor >> 8) & 0xff, port + DLH);
38 outb(c & ~DLAB, port + LCR);
39
40 early_serial_base = port;
41}
42
43static void parse_earlyprintk(void)
44{
45 int baud = DEFAULT_BAUD;
46 char arg[32];
47 int pos = 0;
48 int port = 0;
49
50 if (cmdline_find_option("earlyprintk", arg, sizeof arg) > 0) {
51 char *e;
52
53 if (!strncmp(arg, "serial", 6)) {
54 port = DEFAULT_SERIAL_PORT;
55 pos += 6;
56 }
57
58 if (arg[pos] == ',')
59 pos++;
60
61 if (!strncmp(arg, "ttyS", 4)) {
62 static const int bases[] = { 0x3f8, 0x2f8 };
63 int idx = 0;
64
65 if (!strncmp(arg + pos, "ttyS", 4))
66 pos += 4;
67
68 if (arg[pos++] == '1')
69 idx = 1;
70
71 port = bases[idx];
72 }
73
74 if (arg[pos] == ',')
75 pos++;
76
77 baud = simple_strtoull(arg + pos, &e, 0);
78 if (baud == 0 || arg + pos == e)
79 baud = DEFAULT_BAUD;
80 }
81
82 if (port)
83 early_serial_init(port, baud);
84}
85
86#define BASE_BAUD (1843200/16)
87static unsigned int probe_baud(int port)
88{
89 unsigned char lcr, dll, dlh;
90 unsigned int quot;
91
92 lcr = inb(port + LCR);
93 outb(lcr | DLAB, port + LCR);
94 dll = inb(port + DLL);
95 dlh = inb(port + DLH);
96 outb(lcr, port + LCR);
97 quot = (dlh << 8) | dll;
98
99 return BASE_BAUD / quot;
100}
101
102static void parse_console_uart8250(void)
103{
104 char optstr[64], *options;
105 int baud = DEFAULT_BAUD;
106 int port = 0;
107
108 /*
109 * console=uart8250,io,0x3f8,115200n8
110 * need to make sure it is last one console !
111 */
112 if (cmdline_find_option("console", optstr, sizeof optstr) <= 0)
113 return;
114
115 options = optstr;
116
117 if (!strncmp(options, "uart8250,io,", 12))
118 port = simple_strtoull(options + 12, &options, 0);
119 else if (!strncmp(options, "uart,io,", 8))
120 port = simple_strtoull(options + 8, &options, 0);
121 else
122 return;
123
124 if (options && (options[0] == ','))
125 baud = simple_strtoull(options + 1, &options, 0);
126 else
127 baud = probe_baud(port);
128
129 if (port)
130 early_serial_init(port, baud);
131}
132
133void console_init(void)
134{
135 parse_earlyprintk();
136
137 if (!early_serial_base)
138 parse_console_uart8250();
139}
diff --git a/arch/x86/boot/main.c b/arch/x86/boot/main.c
index 140172b895bd..40358c8905be 100644
--- a/arch/x86/boot/main.c
+++ b/arch/x86/boot/main.c
@@ -130,6 +130,11 @@ void main(void)
130 /* First, copy the boot header into the "zeropage" */ 130 /* First, copy the boot header into the "zeropage" */
131 copy_boot_params(); 131 copy_boot_params();
132 132
133 /* Initialize the early-boot console */
134 console_init();
135 if (cmdline_find_option_bool("debug"))
136 puts("early console in setup code\n");
137
133 /* End of heap check */ 138 /* End of heap check */
134 init_heap(); 139 init_heap();
135 140
@@ -168,10 +173,6 @@ void main(void)
168 /* Set the video mode */ 173 /* Set the video mode */
169 set_video(); 174 set_video();
170 175
171 /* Parse command line for 'quiet' and pass it to decompressor. */
172 if (cmdline_find_option_bool("quiet"))
173 boot_params.hdr.loadflags |= QUIET_FLAG;
174
175 /* Do the last things and invoke protected mode */ 176 /* Do the last things and invoke protected mode */
176 go_to_protected_mode(); 177 go_to_protected_mode();
177} 178}
diff --git a/arch/x86/boot/printf.c b/arch/x86/boot/printf.c
index 50e47cdbdddd..cdac91ca55d3 100644
--- a/arch/x86/boot/printf.c
+++ b/arch/x86/boot/printf.c
@@ -34,7 +34,7 @@ static int skip_atoi(const char **s)
34#define SMALL 32 /* Must be 32 == 0x20 */ 34#define SMALL 32 /* Must be 32 == 0x20 */
35#define SPECIAL 64 /* 0x */ 35#define SPECIAL 64 /* 0x */
36 36
37#define do_div(n,base) ({ \ 37#define __do_div(n, base) ({ \
38int __res; \ 38int __res; \
39__res = ((unsigned long) n) % (unsigned) base; \ 39__res = ((unsigned long) n) % (unsigned) base; \
40n = ((unsigned long) n) / (unsigned) base; \ 40n = ((unsigned long) n) / (unsigned) base; \
@@ -83,7 +83,7 @@ static char *number(char *str, long num, int base, int size, int precision,
83 tmp[i++] = '0'; 83 tmp[i++] = '0';
84 else 84 else
85 while (num != 0) 85 while (num != 0)
86 tmp[i++] = (digits[do_div(num, base)] | locase); 86 tmp[i++] = (digits[__do_div(num, base)] | locase);
87 if (i > precision) 87 if (i > precision)
88 precision = i; 88 precision = i;
89 size -= precision; 89 size -= precision;
diff --git a/arch/x86/boot/string.c b/arch/x86/boot/string.c
index f94b7a0c2abf..3cbc4058dd26 100644
--- a/arch/x86/boot/string.c
+++ b/arch/x86/boot/string.c
@@ -30,6 +30,22 @@ int strcmp(const char *str1, const char *str2)
30 return 0; 30 return 0;
31} 31}
32 32
33int strncmp(const char *cs, const char *ct, size_t count)
34{
35 unsigned char c1, c2;
36
37 while (count) {
38 c1 = *cs++;
39 c2 = *ct++;
40 if (c1 != c2)
41 return c1 < c2 ? -1 : 1;
42 if (!c1)
43 break;
44 count--;
45 }
46 return 0;
47}
48
33size_t strnlen(const char *s, size_t maxlen) 49size_t strnlen(const char *s, size_t maxlen)
34{ 50{
35 const char *es = s; 51 const char *es = s;
@@ -48,3 +64,50 @@ unsigned int atou(const char *s)
48 i = i * 10 + (*s++ - '0'); 64 i = i * 10 + (*s++ - '0');
49 return i; 65 return i;
50} 66}
67
68/* Works only for digits and letters, but small and fast */
69#define TOLOWER(x) ((x) | 0x20)
70
71static unsigned int simple_guess_base(const char *cp)
72{
73 if (cp[0] == '0') {
74 if (TOLOWER(cp[1]) == 'x' && isxdigit(cp[2]))
75 return 16;
76 else
77 return 8;
78 } else {
79 return 10;
80 }
81}
82
83/**
84 * simple_strtoull - convert a string to an unsigned long long
85 * @cp: The start of the string
86 * @endp: A pointer to the end of the parsed string will be placed here
87 * @base: The number base to use
88 */
89
90unsigned long long simple_strtoull(const char *cp, char **endp, unsigned int base)
91{
92 unsigned long long result = 0;
93
94 if (!base)
95 base = simple_guess_base(cp);
96
97 if (base == 16 && cp[0] == '0' && TOLOWER(cp[1]) == 'x')
98 cp += 2;
99
100 while (isxdigit(*cp)) {
101 unsigned int value;
102
103 value = isdigit(*cp) ? *cp - '0' : TOLOWER(*cp) - 'a' + 10;
104 if (value >= base)
105 break;
106 result = result * base + value;
107 cp++;
108 }
109 if (endp)
110 *endp = (char *)cp;
111
112 return result;
113}
diff --git a/arch/x86/boot/tty.c b/arch/x86/boot/tty.c
index 01ec69c901c7..def2451f46ae 100644
--- a/arch/x86/boot/tty.c
+++ b/arch/x86/boot/tty.c
@@ -10,23 +10,36 @@
10 * ----------------------------------------------------------------------- */ 10 * ----------------------------------------------------------------------- */
11 11
12/* 12/*
13 * Very simple screen I/O 13 * Very simple screen and serial I/O
14 * XXX: Probably should add very simple serial I/O?
15 */ 14 */
16 15
17#include "boot.h" 16#include "boot.h"
18 17
18int early_serial_base;
19
20#define XMTRDY 0x20
21
22#define TXR 0 /* Transmit register (WRITE) */
23#define LSR 5 /* Line Status */
24
19/* 25/*
20 * These functions are in .inittext so they can be used to signal 26 * These functions are in .inittext so they can be used to signal
21 * error during initialization. 27 * error during initialization.
22 */ 28 */
23 29
24void __attribute__((section(".inittext"))) putchar(int ch) 30static void __attribute__((section(".inittext"))) serial_putchar(int ch)
25{ 31{
26 struct biosregs ireg; 32 unsigned timeout = 0xffff;
27 33
28 if (ch == '\n') 34 while ((inb(early_serial_base + LSR) & XMTRDY) == 0 && --timeout)
29 putchar('\r'); /* \n -> \r\n */ 35 cpu_relax();
36
37 outb(ch, early_serial_base + TXR);
38}
39
40static void __attribute__((section(".inittext"))) bios_putchar(int ch)
41{
42 struct biosregs ireg;
30 43
31 initregs(&ireg); 44 initregs(&ireg);
32 ireg.bx = 0x0007; 45 ireg.bx = 0x0007;
@@ -36,6 +49,17 @@ void __attribute__((section(".inittext"))) putchar(int ch)
36 intcall(0x10, &ireg, NULL); 49 intcall(0x10, &ireg, NULL);
37} 50}
38 51
52void __attribute__((section(".inittext"))) putchar(int ch)
53{
54 if (ch == '\n')
55 putchar('\r'); /* \n -> \r\n */
56
57 bios_putchar(ch);
58
59 if (early_serial_base != 0)
60 serial_putchar(ch);
61}
62
39void __attribute__((section(".inittext"))) puts(const char *str) 63void __attribute__((section(".inittext"))) puts(const char *str)
40{ 64{
41 while (*str) 65 while (*str)
@@ -112,3 +136,4 @@ int getchar_timeout(void)
112 136
113 return 0; /* Timeout! */ 137 return 0; /* Timeout! */
114} 138}
139
diff --git a/arch/x86/configs/i386_defconfig b/arch/x86/configs/i386_defconfig
index d28fad19654a..e3a32431ca1e 100644
--- a/arch/x86/configs/i386_defconfig
+++ b/arch/x86/configs/i386_defconfig
@@ -1471,6 +1471,7 @@ CONFIG_HWMON=y
1471# CONFIG_SENSORS_GL518SM is not set 1471# CONFIG_SENSORS_GL518SM is not set
1472# CONFIG_SENSORS_GL520SM is not set 1472# CONFIG_SENSORS_GL520SM is not set
1473# CONFIG_SENSORS_CORETEMP is not set 1473# CONFIG_SENSORS_CORETEMP is not set
1474# CONFIG_SENSORS_PKGTEMP is not set
1474# CONFIG_SENSORS_IT87 is not set 1475# CONFIG_SENSORS_IT87 is not set
1475# CONFIG_SENSORS_LM63 is not set 1476# CONFIG_SENSORS_LM63 is not set
1476# CONFIG_SENSORS_LM75 is not set 1477# CONFIG_SENSORS_LM75 is not set
diff --git a/arch/x86/configs/x86_64_defconfig b/arch/x86/configs/x86_64_defconfig
index 6c86acd847a4..4251f8372050 100644
--- a/arch/x86/configs/x86_64_defconfig
+++ b/arch/x86/configs/x86_64_defconfig
@@ -1456,6 +1456,7 @@ CONFIG_HWMON=y
1456# CONFIG_SENSORS_GL518SM is not set 1456# CONFIG_SENSORS_GL518SM is not set
1457# CONFIG_SENSORS_GL520SM is not set 1457# CONFIG_SENSORS_GL520SM is not set
1458# CONFIG_SENSORS_CORETEMP is not set 1458# CONFIG_SENSORS_CORETEMP is not set
1459# CONFIG_SENSORS_PKGTEMP is not set
1459# CONFIG_SENSORS_IT87 is not set 1460# CONFIG_SENSORS_IT87 is not set
1460# CONFIG_SENSORS_LM63 is not set 1461# CONFIG_SENSORS_LM63 is not set
1461# CONFIG_SENSORS_LM75 is not set 1462# CONFIG_SENSORS_LM75 is not set
diff --git a/arch/x86/include/asm/acpi.h b/arch/x86/include/asm/acpi.h
index aa2c39d968fc..92091de11113 100644
--- a/arch/x86/include/asm/acpi.h
+++ b/arch/x86/include/asm/acpi.h
@@ -134,7 +134,7 @@ static inline unsigned int acpi_processor_cstate_check(unsigned int max_cstate)
134 boot_cpu_data.x86_model <= 0x05 && 134 boot_cpu_data.x86_model <= 0x05 &&
135 boot_cpu_data.x86_mask < 0x0A) 135 boot_cpu_data.x86_mask < 0x0A)
136 return 1; 136 return 1;
137 else if (boot_cpu_has(X86_FEATURE_AMDC1E)) 137 else if (c1e_detected)
138 return 1; 138 return 1;
139 else 139 else
140 return max_cstate; 140 return max_cstate;
diff --git a/arch/x86/include/asm/apb_timer.h b/arch/x86/include/asm/apb_timer.h
index c74a2eebe570..a69b1ac9eaf8 100644
--- a/arch/x86/include/asm/apb_timer.h
+++ b/arch/x86/include/asm/apb_timer.h
@@ -55,7 +55,6 @@ extern unsigned long apbt_quick_calibrate(void);
55extern int arch_setup_apbt_irqs(int irq, int trigger, int mask, int cpu); 55extern int arch_setup_apbt_irqs(int irq, int trigger, int mask, int cpu);
56extern void apbt_setup_secondary_clock(void); 56extern void apbt_setup_secondary_clock(void);
57extern unsigned int boot_cpu_id; 57extern unsigned int boot_cpu_id;
58extern int disable_apbt_percpu;
59 58
60extern struct sfi_timer_table_entry *sfi_get_mtmr(int hint); 59extern struct sfi_timer_table_entry *sfi_get_mtmr(int hint);
61extern void sfi_free_mtmr(struct sfi_timer_table_entry *mtmr); 60extern void sfi_free_mtmr(struct sfi_timer_table_entry *mtmr);
diff --git a/arch/x86/include/asm/cmpxchg_32.h b/arch/x86/include/asm/cmpxchg_32.h
index 8859e12dd3cf..284a6e8f7ce1 100644
--- a/arch/x86/include/asm/cmpxchg_32.h
+++ b/arch/x86/include/asm/cmpxchg_32.h
@@ -11,38 +11,42 @@
11extern void __xchg_wrong_size(void); 11extern void __xchg_wrong_size(void);
12 12
13/* 13/*
14 * Note: no "lock" prefix even on SMP: xchg always implies lock anyway 14 * Note: no "lock" prefix even on SMP: xchg always implies lock anyway.
15 * Note 2: xchg has side effect, so that attribute volatile is necessary, 15 * Since this is generally used to protect other memory information, we
16 * but generally the primitive is invalid, *ptr is output argument. --ANK 16 * use "asm volatile" and "memory" clobbers to prevent gcc from moving
17 * information around.
17 */ 18 */
18
19struct __xchg_dummy {
20 unsigned long a[100];
21};
22#define __xg(x) ((struct __xchg_dummy *)(x))
23
24#define __xchg(x, ptr, size) \ 19#define __xchg(x, ptr, size) \
25({ \ 20({ \
26 __typeof(*(ptr)) __x = (x); \ 21 __typeof(*(ptr)) __x = (x); \
27 switch (size) { \ 22 switch (size) { \
28 case 1: \ 23 case 1: \
29 asm volatile("xchgb %b0,%1" \ 24 { \
30 : "=q" (__x) \ 25 volatile u8 *__ptr = (volatile u8 *)(ptr); \
31 : "m" (*__xg(ptr)), "0" (__x) \ 26 asm volatile("xchgb %0,%1" \
27 : "=q" (__x), "+m" (*__ptr) \
28 : "0" (__x) \
32 : "memory"); \ 29 : "memory"); \
33 break; \ 30 break; \
31 } \
34 case 2: \ 32 case 2: \
35 asm volatile("xchgw %w0,%1" \ 33 { \
36 : "=r" (__x) \ 34 volatile u16 *__ptr = (volatile u16 *)(ptr); \
37 : "m" (*__xg(ptr)), "0" (__x) \ 35 asm volatile("xchgw %0,%1" \
36 : "=r" (__x), "+m" (*__ptr) \
37 : "0" (__x) \
38 : "memory"); \ 38 : "memory"); \
39 break; \ 39 break; \
40 } \
40 case 4: \ 41 case 4: \
42 { \
43 volatile u32 *__ptr = (volatile u32 *)(ptr); \
41 asm volatile("xchgl %0,%1" \ 44 asm volatile("xchgl %0,%1" \
42 : "=r" (__x) \ 45 : "=r" (__x), "+m" (*__ptr) \
43 : "m" (*__xg(ptr)), "0" (__x) \ 46 : "0" (__x) \
44 : "memory"); \ 47 : "memory"); \
45 break; \ 48 break; \
49 } \
46 default: \ 50 default: \
47 __xchg_wrong_size(); \ 51 __xchg_wrong_size(); \
48 } \ 52 } \
@@ -53,60 +57,33 @@ struct __xchg_dummy {
53 __xchg((v), (ptr), sizeof(*ptr)) 57 __xchg((v), (ptr), sizeof(*ptr))
54 58
55/* 59/*
56 * The semantics of XCHGCMP8B are a bit strange, this is why 60 * CMPXCHG8B only writes to the target if we had the previous
57 * there is a loop and the loading of %%eax and %%edx has to 61 * value in registers, otherwise it acts as a read and gives us the
58 * be inside. This inlines well in most cases, the cached 62 * "new previous" value. That is why there is a loop. Preloading
59 * cost is around ~38 cycles. (in the future we might want 63 * EDX:EAX is a performance optimization: in the common case it means
60 * to do an SIMD/3DNOW!/MMX/FPU 64-bit store here, but that 64 * we need only one locked operation.
61 * might have an implicit FPU-save as a cost, so it's not
62 * clear which path to go.)
63 * 65 *
64 * cmpxchg8b must be used with the lock prefix here to allow 66 * A SIMD/3DNOW!/MMX/FPU 64-bit store here would require at the very
65 * the instruction to be executed atomically, see page 3-102 67 * least an FPU save and/or %cr0.ts manipulation.
66 * of the instruction set reference 24319102.pdf. We need 68 *
67 * the reader side to see the coherent 64bit value. 69 * cmpxchg8b must be used with the lock prefix here to allow the
70 * instruction to be executed atomically. We need to have the reader
71 * side to see the coherent 64bit value.
68 */ 72 */
69static inline void __set_64bit(unsigned long long *ptr, 73static inline void set_64bit(volatile u64 *ptr, u64 value)
70 unsigned int low, unsigned int high)
71{ 74{
75 u32 low = value;
76 u32 high = value >> 32;
77 u64 prev = *ptr;
78
72 asm volatile("\n1:\t" 79 asm volatile("\n1:\t"
73 "movl (%0), %%eax\n\t" 80 LOCK_PREFIX "cmpxchg8b %0\n\t"
74 "movl 4(%0), %%edx\n\t"
75 LOCK_PREFIX "cmpxchg8b (%0)\n\t"
76 "jnz 1b" 81 "jnz 1b"
77 : /* no outputs */ 82 : "=m" (*ptr), "+A" (prev)
78 : "D"(ptr), 83 : "b" (low), "c" (high)
79 "b"(low), 84 : "memory");
80 "c"(high)
81 : "ax", "dx", "memory");
82}
83
84static inline void __set_64bit_constant(unsigned long long *ptr,
85 unsigned long long value)
86{
87 __set_64bit(ptr, (unsigned int)value, (unsigned int)(value >> 32));
88}
89
90#define ll_low(x) *(((unsigned int *)&(x)) + 0)
91#define ll_high(x) *(((unsigned int *)&(x)) + 1)
92
93static inline void __set_64bit_var(unsigned long long *ptr,
94 unsigned long long value)
95{
96 __set_64bit(ptr, ll_low(value), ll_high(value));
97} 85}
98 86
99#define set_64bit(ptr, value) \
100 (__builtin_constant_p((value)) \
101 ? __set_64bit_constant((ptr), (value)) \
102 : __set_64bit_var((ptr), (value)))
103
104#define _set_64bit(ptr, value) \
105 (__builtin_constant_p(value) \
106 ? __set_64bit(ptr, (unsigned int)(value), \
107 (unsigned int)((value) >> 32)) \
108 : __set_64bit(ptr, ll_low((value)), ll_high((value))))
109
110extern void __cmpxchg_wrong_size(void); 87extern void __cmpxchg_wrong_size(void);
111 88
112/* 89/*
@@ -121,23 +98,32 @@ extern void __cmpxchg_wrong_size(void);
121 __typeof__(*(ptr)) __new = (new); \ 98 __typeof__(*(ptr)) __new = (new); \
122 switch (size) { \ 99 switch (size) { \
123 case 1: \ 100 case 1: \
124 asm volatile(lock "cmpxchgb %b1,%2" \ 101 { \
125 : "=a"(__ret) \ 102 volatile u8 *__ptr = (volatile u8 *)(ptr); \
126 : "q"(__new), "m"(*__xg(ptr)), "0"(__old) \ 103 asm volatile(lock "cmpxchgb %2,%1" \
104 : "=a" (__ret), "+m" (*__ptr) \
105 : "q" (__new), "0" (__old) \
127 : "memory"); \ 106 : "memory"); \
128 break; \ 107 break; \
108 } \
129 case 2: \ 109 case 2: \
130 asm volatile(lock "cmpxchgw %w1,%2" \ 110 { \
131 : "=a"(__ret) \ 111 volatile u16 *__ptr = (volatile u16 *)(ptr); \
132 : "r"(__new), "m"(*__xg(ptr)), "0"(__old) \ 112 asm volatile(lock "cmpxchgw %2,%1" \
113 : "=a" (__ret), "+m" (*__ptr) \
114 : "r" (__new), "0" (__old) \
133 : "memory"); \ 115 : "memory"); \
134 break; \ 116 break; \
117 } \
135 case 4: \ 118 case 4: \
136 asm volatile(lock "cmpxchgl %1,%2" \ 119 { \
137 : "=a"(__ret) \ 120 volatile u32 *__ptr = (volatile u32 *)(ptr); \
138 : "r"(__new), "m"(*__xg(ptr)), "0"(__old) \ 121 asm volatile(lock "cmpxchgl %2,%1" \
122 : "=a" (__ret), "+m" (*__ptr) \
123 : "r" (__new), "0" (__old) \
139 : "memory"); \ 124 : "memory"); \
140 break; \ 125 break; \
126 } \
141 default: \ 127 default: \
142 __cmpxchg_wrong_size(); \ 128 __cmpxchg_wrong_size(); \
143 } \ 129 } \
@@ -175,32 +161,28 @@ extern void __cmpxchg_wrong_size(void);
175 (unsigned long long)(n))) 161 (unsigned long long)(n)))
176#endif 162#endif
177 163
178static inline unsigned long long __cmpxchg64(volatile void *ptr, 164static inline u64 __cmpxchg64(volatile u64 *ptr, u64 old, u64 new)
179 unsigned long long old,
180 unsigned long long new)
181{ 165{
182 unsigned long long prev; 166 u64 prev;
183 asm volatile(LOCK_PREFIX "cmpxchg8b %3" 167 asm volatile(LOCK_PREFIX "cmpxchg8b %1"
184 : "=A"(prev) 168 : "=A" (prev),
185 : "b"((unsigned long)new), 169 "+m" (*ptr)
186 "c"((unsigned long)(new >> 32)), 170 : "b" ((u32)new),
187 "m"(*__xg(ptr)), 171 "c" ((u32)(new >> 32)),
188 "0"(old) 172 "0" (old)
189 : "memory"); 173 : "memory");
190 return prev; 174 return prev;
191} 175}
192 176
193static inline unsigned long long __cmpxchg64_local(volatile void *ptr, 177static inline u64 __cmpxchg64_local(volatile u64 *ptr, u64 old, u64 new)
194 unsigned long long old,
195 unsigned long long new)
196{ 178{
197 unsigned long long prev; 179 u64 prev;
198 asm volatile("cmpxchg8b %3" 180 asm volatile("cmpxchg8b %1"
199 : "=A"(prev) 181 : "=A" (prev),
200 : "b"((unsigned long)new), 182 "+m" (*ptr)
201 "c"((unsigned long)(new >> 32)), 183 : "b" ((u32)new),
202 "m"(*__xg(ptr)), 184 "c" ((u32)(new >> 32)),
203 "0"(old) 185 "0" (old)
204 : "memory"); 186 : "memory");
205 return prev; 187 return prev;
206} 188}
@@ -264,8 +246,6 @@ static inline unsigned long cmpxchg_386(volatile void *ptr, unsigned long old,
264 * to simulate the cmpxchg8b on the 80386 and 80486 CPU. 246 * to simulate the cmpxchg8b on the 80386 and 80486 CPU.
265 */ 247 */
266 248
267extern unsigned long long cmpxchg_486_u64(volatile void *, u64, u64);
268
269#define cmpxchg64(ptr, o, n) \ 249#define cmpxchg64(ptr, o, n) \
270({ \ 250({ \
271 __typeof__(*(ptr)) __ret; \ 251 __typeof__(*(ptr)) __ret; \
@@ -283,20 +263,20 @@ extern unsigned long long cmpxchg_486_u64(volatile void *, u64, u64);
283 __ret; }) 263 __ret; })
284 264
285 265
286 266#define cmpxchg64_local(ptr, o, n) \
287#define cmpxchg64_local(ptr, o, n) \ 267({ \
288({ \ 268 __typeof__(*(ptr)) __ret; \
289 __typeof__(*(ptr)) __ret; \ 269 __typeof__(*(ptr)) __old = (o); \
290 if (likely(boot_cpu_data.x86 > 4)) \ 270 __typeof__(*(ptr)) __new = (n); \
291 __ret = (__typeof__(*(ptr)))__cmpxchg64_local((ptr), \ 271 alternative_io("call cmpxchg8b_emu", \
292 (unsigned long long)(o), \ 272 "cmpxchg8b (%%esi)" , \
293 (unsigned long long)(n)); \ 273 X86_FEATURE_CX8, \
294 else \ 274 "=A" (__ret), \
295 __ret = (__typeof__(*(ptr)))cmpxchg_486_u64((ptr), \ 275 "S" ((ptr)), "0" (__old), \
296 (unsigned long long)(o), \ 276 "b" ((unsigned int)__new), \
297 (unsigned long long)(n)); \ 277 "c" ((unsigned int)(__new>>32)) \
298 __ret; \ 278 : "memory"); \
299}) 279 __ret; })
300 280
301#endif 281#endif
302 282
diff --git a/arch/x86/include/asm/cmpxchg_64.h b/arch/x86/include/asm/cmpxchg_64.h
index 485ae415faec..423ae58aa020 100644
--- a/arch/x86/include/asm/cmpxchg_64.h
+++ b/arch/x86/include/asm/cmpxchg_64.h
@@ -3,51 +3,60 @@
3 3
4#include <asm/alternative.h> /* Provides LOCK_PREFIX */ 4#include <asm/alternative.h> /* Provides LOCK_PREFIX */
5 5
6#define __xg(x) ((volatile long *)(x)) 6static inline void set_64bit(volatile u64 *ptr, u64 val)
7
8static inline void set_64bit(volatile unsigned long *ptr, unsigned long val)
9{ 7{
10 *ptr = val; 8 *ptr = val;
11} 9}
12 10
13#define _set_64bit set_64bit
14
15extern void __xchg_wrong_size(void); 11extern void __xchg_wrong_size(void);
16extern void __cmpxchg_wrong_size(void); 12extern void __cmpxchg_wrong_size(void);
17 13
18/* 14/*
19 * Note: no "lock" prefix even on SMP: xchg always implies lock anyway 15 * Note: no "lock" prefix even on SMP: xchg always implies lock anyway.
20 * Note 2: xchg has side effect, so that attribute volatile is necessary, 16 * Since this is generally used to protect other memory information, we
21 * but generally the primitive is invalid, *ptr is output argument. --ANK 17 * use "asm volatile" and "memory" clobbers to prevent gcc from moving
18 * information around.
22 */ 19 */
23#define __xchg(x, ptr, size) \ 20#define __xchg(x, ptr, size) \
24({ \ 21({ \
25 __typeof(*(ptr)) __x = (x); \ 22 __typeof(*(ptr)) __x = (x); \
26 switch (size) { \ 23 switch (size) { \
27 case 1: \ 24 case 1: \
28 asm volatile("xchgb %b0,%1" \ 25 { \
29 : "=q" (__x) \ 26 volatile u8 *__ptr = (volatile u8 *)(ptr); \
30 : "m" (*__xg(ptr)), "0" (__x) \ 27 asm volatile("xchgb %0,%1" \
28 : "=q" (__x), "+m" (*__ptr) \
29 : "0" (__x) \
31 : "memory"); \ 30 : "memory"); \
32 break; \ 31 break; \
32 } \
33 case 2: \ 33 case 2: \
34 asm volatile("xchgw %w0,%1" \ 34 { \
35 : "=r" (__x) \ 35 volatile u16 *__ptr = (volatile u16 *)(ptr); \
36 : "m" (*__xg(ptr)), "0" (__x) \ 36 asm volatile("xchgw %0,%1" \
37 : "=r" (__x), "+m" (*__ptr) \
38 : "0" (__x) \
37 : "memory"); \ 39 : "memory"); \
38 break; \ 40 break; \
41 } \
39 case 4: \ 42 case 4: \
40 asm volatile("xchgl %k0,%1" \ 43 { \
41 : "=r" (__x) \ 44 volatile u32 *__ptr = (volatile u32 *)(ptr); \
42 : "m" (*__xg(ptr)), "0" (__x) \ 45 asm volatile("xchgl %0,%1" \
46 : "=r" (__x), "+m" (*__ptr) \
47 : "0" (__x) \
43 : "memory"); \ 48 : "memory"); \
44 break; \ 49 break; \
50 } \
45 case 8: \ 51 case 8: \
52 { \
53 volatile u64 *__ptr = (volatile u64 *)(ptr); \
46 asm volatile("xchgq %0,%1" \ 54 asm volatile("xchgq %0,%1" \
47 : "=r" (__x) \ 55 : "=r" (__x), "+m" (*__ptr) \
48 : "m" (*__xg(ptr)), "0" (__x) \ 56 : "0" (__x) \
49 : "memory"); \ 57 : "memory"); \
50 break; \ 58 break; \
59 } \
51 default: \ 60 default: \
52 __xchg_wrong_size(); \ 61 __xchg_wrong_size(); \
53 } \ 62 } \
@@ -71,29 +80,41 @@ extern void __cmpxchg_wrong_size(void);
71 __typeof__(*(ptr)) __new = (new); \ 80 __typeof__(*(ptr)) __new = (new); \
72 switch (size) { \ 81 switch (size) { \
73 case 1: \ 82 case 1: \
74 asm volatile(lock "cmpxchgb %b1,%2" \ 83 { \
75 : "=a"(__ret) \ 84 volatile u8 *__ptr = (volatile u8 *)(ptr); \
76 : "q"(__new), "m"(*__xg(ptr)), "0"(__old) \ 85 asm volatile(lock "cmpxchgb %2,%1" \
86 : "=a" (__ret), "+m" (*__ptr) \
87 : "q" (__new), "0" (__old) \
77 : "memory"); \ 88 : "memory"); \
78 break; \ 89 break; \
90 } \
79 case 2: \ 91 case 2: \
80 asm volatile(lock "cmpxchgw %w1,%2" \ 92 { \
81 : "=a"(__ret) \ 93 volatile u16 *__ptr = (volatile u16 *)(ptr); \
82 : "r"(__new), "m"(*__xg(ptr)), "0"(__old) \ 94 asm volatile(lock "cmpxchgw %2,%1" \
95 : "=a" (__ret), "+m" (*__ptr) \
96 : "r" (__new), "0" (__old) \
83 : "memory"); \ 97 : "memory"); \
84 break; \ 98 break; \
99 } \
85 case 4: \ 100 case 4: \
86 asm volatile(lock "cmpxchgl %k1,%2" \ 101 { \
87 : "=a"(__ret) \ 102 volatile u32 *__ptr = (volatile u32 *)(ptr); \
88 : "r"(__new), "m"(*__xg(ptr)), "0"(__old) \ 103 asm volatile(lock "cmpxchgl %2,%1" \
104 : "=a" (__ret), "+m" (*__ptr) \
105 : "r" (__new), "0" (__old) \
89 : "memory"); \ 106 : "memory"); \
90 break; \ 107 break; \
108 } \
91 case 8: \ 109 case 8: \
92 asm volatile(lock "cmpxchgq %1,%2" \ 110 { \
93 : "=a"(__ret) \ 111 volatile u64 *__ptr = (volatile u64 *)(ptr); \
94 : "r"(__new), "m"(*__xg(ptr)), "0"(__old) \ 112 asm volatile(lock "cmpxchgq %2,%1" \
113 : "=a" (__ret), "+m" (*__ptr) \
114 : "r" (__new), "0" (__old) \
95 : "memory"); \ 115 : "memory"); \
96 break; \ 116 break; \
117 } \
97 default: \ 118 default: \
98 __cmpxchg_wrong_size(); \ 119 __cmpxchg_wrong_size(); \
99 } \ 120 } \
diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h
index 468145914389..0b205b8a4308 100644
--- a/arch/x86/include/asm/cpufeature.h
+++ b/arch/x86/include/asm/cpufeature.h
@@ -6,7 +6,7 @@
6 6
7#include <asm/required-features.h> 7#include <asm/required-features.h>
8 8
9#define NCAPINTS 9 /* N 32-bit words worth of info */ 9#define NCAPINTS 10 /* N 32-bit words worth of info */
10 10
11/* 11/*
12 * Note: If the comment begins with a quoted string, that string is used 12 * Note: If the comment begins with a quoted string, that string is used
@@ -89,7 +89,7 @@
89#define X86_FEATURE_LFENCE_RDTSC (3*32+18) /* "" Lfence synchronizes RDTSC */ 89#define X86_FEATURE_LFENCE_RDTSC (3*32+18) /* "" Lfence synchronizes RDTSC */
90#define X86_FEATURE_11AP (3*32+19) /* "" Bad local APIC aka 11AP */ 90#define X86_FEATURE_11AP (3*32+19) /* "" Bad local APIC aka 11AP */
91#define X86_FEATURE_NOPL (3*32+20) /* The NOPL (0F 1F) instructions */ 91#define X86_FEATURE_NOPL (3*32+20) /* The NOPL (0F 1F) instructions */
92#define X86_FEATURE_AMDC1E (3*32+21) /* AMD C1E detected */ 92 /* 21 available, was AMD_C1E */
93#define X86_FEATURE_XTOPOLOGY (3*32+22) /* cpu topology enum extensions */ 93#define X86_FEATURE_XTOPOLOGY (3*32+22) /* cpu topology enum extensions */
94#define X86_FEATURE_TSC_RELIABLE (3*32+23) /* TSC is known to be reliable */ 94#define X86_FEATURE_TSC_RELIABLE (3*32+23) /* TSC is known to be reliable */
95#define X86_FEATURE_NONSTOP_TSC (3*32+24) /* TSC does not stop in C states */ 95#define X86_FEATURE_NONSTOP_TSC (3*32+24) /* TSC does not stop in C states */
@@ -124,6 +124,8 @@
124#define X86_FEATURE_XSAVE (4*32+26) /* XSAVE/XRSTOR/XSETBV/XGETBV */ 124#define X86_FEATURE_XSAVE (4*32+26) /* XSAVE/XRSTOR/XSETBV/XGETBV */
125#define X86_FEATURE_OSXSAVE (4*32+27) /* "" XSAVE enabled in the OS */ 125#define X86_FEATURE_OSXSAVE (4*32+27) /* "" XSAVE enabled in the OS */
126#define X86_FEATURE_AVX (4*32+28) /* Advanced Vector Extensions */ 126#define X86_FEATURE_AVX (4*32+28) /* Advanced Vector Extensions */
127#define X86_FEATURE_F16C (4*32+29) /* 16-bit fp conversions */
128#define X86_FEATURE_RDRND (4*32+30) /* The RDRAND instruction */
127#define X86_FEATURE_HYPERVISOR (4*32+31) /* Running on a hypervisor */ 129#define X86_FEATURE_HYPERVISOR (4*32+31) /* Running on a hypervisor */
128 130
129/* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */ 131/* VIA/Cyrix/Centaur-defined CPU features, CPUID level 0xC0000001, word 5 */
@@ -157,22 +159,29 @@
157 159
158/* 160/*
159 * Auxiliary flags: Linux defined - For features scattered in various 161 * Auxiliary flags: Linux defined - For features scattered in various
160 * CPUID levels like 0x6, 0xA etc 162 * CPUID levels like 0x6, 0xA etc, word 7
161 */ 163 */
162#define X86_FEATURE_IDA (7*32+ 0) /* Intel Dynamic Acceleration */ 164#define X86_FEATURE_IDA (7*32+ 0) /* Intel Dynamic Acceleration */
163#define X86_FEATURE_ARAT (7*32+ 1) /* Always Running APIC Timer */ 165#define X86_FEATURE_ARAT (7*32+ 1) /* Always Running APIC Timer */
164#define X86_FEATURE_CPB (7*32+ 2) /* AMD Core Performance Boost */ 166#define X86_FEATURE_CPB (7*32+ 2) /* AMD Core Performance Boost */
167#define X86_FEATURE_EPB (7*32+ 3) /* IA32_ENERGY_PERF_BIAS support */
168#define X86_FEATURE_XSAVEOPT (7*32+ 4) /* Optimized Xsave */
169#define X86_FEATURE_PLN (7*32+ 5) /* Intel Power Limit Notification */
170#define X86_FEATURE_PTS (7*32+ 6) /* Intel Package Thermal Status */
165 171
166/* Virtualization flags: Linux defined */ 172/* Virtualization flags: Linux defined, word 8 */
167#define X86_FEATURE_TPR_SHADOW (8*32+ 0) /* Intel TPR Shadow */ 173#define X86_FEATURE_TPR_SHADOW (8*32+ 0) /* Intel TPR Shadow */
168#define X86_FEATURE_VNMI (8*32+ 1) /* Intel Virtual NMI */ 174#define X86_FEATURE_VNMI (8*32+ 1) /* Intel Virtual NMI */
169#define X86_FEATURE_FLEXPRIORITY (8*32+ 2) /* Intel FlexPriority */ 175#define X86_FEATURE_FLEXPRIORITY (8*32+ 2) /* Intel FlexPriority */
170#define X86_FEATURE_EPT (8*32+ 3) /* Intel Extended Page Table */ 176#define X86_FEATURE_EPT (8*32+ 3) /* Intel Extended Page Table */
171#define X86_FEATURE_VPID (8*32+ 4) /* Intel Virtual Processor ID */ 177#define X86_FEATURE_VPID (8*32+ 4) /* Intel Virtual Processor ID */
172#define X86_FEATURE_NPT (8*32+5) /* AMD Nested Page Table support */ 178#define X86_FEATURE_NPT (8*32+ 5) /* AMD Nested Page Table support */
173#define X86_FEATURE_LBRV (8*32+6) /* AMD LBR Virtualization support */ 179#define X86_FEATURE_LBRV (8*32+ 6) /* AMD LBR Virtualization support */
174#define X86_FEATURE_SVML (8*32+7) /* "svm_lock" AMD SVM locking MSR */ 180#define X86_FEATURE_SVML (8*32+ 7) /* "svm_lock" AMD SVM locking MSR */
175#define X86_FEATURE_NRIPS (8*32+8) /* "nrip_save" AMD SVM next_rip save */ 181#define X86_FEATURE_NRIPS (8*32+ 8) /* "nrip_save" AMD SVM next_rip save */
182
183/* Intel-defined CPU features, CPUID level 0x00000007:0 (ebx), word 9 */
184#define X86_FEATURE_FSGSBASE (9*32+ 0) /* {RD/WR}{FS/GS}BASE instructions*/
176 185
177#if defined(__KERNEL__) && !defined(__ASSEMBLY__) 186#if defined(__KERNEL__) && !defined(__ASSEMBLY__)
178 187
@@ -194,7 +203,9 @@ extern const char * const x86_power_flags[32];
194 (((bit)>>5)==4 && (1UL<<((bit)&31) & REQUIRED_MASK4)) || \ 203 (((bit)>>5)==4 && (1UL<<((bit)&31) & REQUIRED_MASK4)) || \
195 (((bit)>>5)==5 && (1UL<<((bit)&31) & REQUIRED_MASK5)) || \ 204 (((bit)>>5)==5 && (1UL<<((bit)&31) & REQUIRED_MASK5)) || \
196 (((bit)>>5)==6 && (1UL<<((bit)&31) & REQUIRED_MASK6)) || \ 205 (((bit)>>5)==6 && (1UL<<((bit)&31) & REQUIRED_MASK6)) || \
197 (((bit)>>5)==7 && (1UL<<((bit)&31) & REQUIRED_MASK7)) ) \ 206 (((bit)>>5)==7 && (1UL<<((bit)&31) & REQUIRED_MASK7)) || \
207 (((bit)>>5)==8 && (1UL<<((bit)&31) & REQUIRED_MASK8)) || \
208 (((bit)>>5)==9 && (1UL<<((bit)&31) & REQUIRED_MASK9)) ) \
198 ? 1 : \ 209 ? 1 : \
199 test_cpu_cap(c, bit)) 210 test_cpu_cap(c, bit))
200 211
diff --git a/arch/x86/include/asm/hw_breakpoint.h b/arch/x86/include/asm/hw_breakpoint.h
index 942255310e6a..528a11e8d3e3 100644
--- a/arch/x86/include/asm/hw_breakpoint.h
+++ b/arch/x86/include/asm/hw_breakpoint.h
@@ -20,10 +20,10 @@ struct arch_hw_breakpoint {
20#include <linux/list.h> 20#include <linux/list.h>
21 21
22/* Available HW breakpoint length encodings */ 22/* Available HW breakpoint length encodings */
23#define X86_BREAKPOINT_LEN_X 0x00
23#define X86_BREAKPOINT_LEN_1 0x40 24#define X86_BREAKPOINT_LEN_1 0x40
24#define X86_BREAKPOINT_LEN_2 0x44 25#define X86_BREAKPOINT_LEN_2 0x44
25#define X86_BREAKPOINT_LEN_4 0x4c 26#define X86_BREAKPOINT_LEN_4 0x4c
26#define X86_BREAKPOINT_LEN_EXECUTE 0x40
27 27
28#ifdef CONFIG_X86_64 28#ifdef CONFIG_X86_64
29#define X86_BREAKPOINT_LEN_8 0x48 29#define X86_BREAKPOINT_LEN_8 0x48
diff --git a/arch/x86/include/asm/hypervisor.h b/arch/x86/include/asm/hypervisor.h
index 70abda7058c8..ff2546ce7178 100644
--- a/arch/x86/include/asm/hypervisor.h
+++ b/arch/x86/include/asm/hypervisor.h
@@ -45,5 +45,6 @@ extern const struct hypervisor_x86 *x86_hyper;
45/* Recognized hypervisors */ 45/* Recognized hypervisors */
46extern const struct hypervisor_x86 x86_hyper_vmware; 46extern const struct hypervisor_x86 x86_hyper_vmware;
47extern const struct hypervisor_x86 x86_hyper_ms_hyperv; 47extern const struct hypervisor_x86 x86_hyper_ms_hyperv;
48extern const struct hypervisor_x86 x86_hyper_xen_hvm;
48 49
49#endif 50#endif
diff --git a/arch/x86/include/asm/i387.h b/arch/x86/include/asm/i387.h
index c991b3a7b904..815c5b2b9f57 100644
--- a/arch/x86/include/asm/i387.h
+++ b/arch/x86/include/asm/i387.h
@@ -482,6 +482,8 @@ static inline void fpu_copy(struct fpu *dst, struct fpu *src)
482 memcpy(dst->state, src->state, xstate_size); 482 memcpy(dst->state, src->state, xstate_size);
483} 483}
484 484
485extern void fpu_finit(struct fpu *fpu);
486
485#endif /* __ASSEMBLY__ */ 487#endif /* __ASSEMBLY__ */
486 488
487#define PSHUFB_XMM5_XMM0 .byte 0x66, 0x0f, 0x38, 0x00, 0xc5 489#define PSHUFB_XMM5_XMM0 .byte 0x66, 0x0f, 0x38, 0x00, 0xc5
diff --git a/arch/x86/include/asm/intel_scu_ipc.h b/arch/x86/include/asm/intel_scu_ipc.h
index 4470c9ad4a3e..29f66793cc55 100644
--- a/arch/x86/include/asm/intel_scu_ipc.h
+++ b/arch/x86/include/asm/intel_scu_ipc.h
@@ -1,6 +1,12 @@
1#ifndef _ASM_X86_INTEL_SCU_IPC_H_ 1#ifndef _ASM_X86_INTEL_SCU_IPC_H_
2#define _ASM_X86_INTEL_SCU_IPC_H_ 2#define _ASM_X86_INTEL_SCU_IPC_H_
3 3
4#define IPCMSG_VRTC 0xFA /* Set vRTC device */
5
6/* Command id associated with message IPCMSG_VRTC */
7#define IPC_CMD_VRTC_SETTIME 1 /* Set time */
8#define IPC_CMD_VRTC_SETALARM 2 /* Set alarm */
9
4/* Read single register */ 10/* Read single register */
5int intel_scu_ipc_ioread8(u16 addr, u8 *data); 11int intel_scu_ipc_ioread8(u16 addr, u8 *data);
6 12
@@ -28,20 +34,6 @@ int intel_scu_ipc_writev(u16 *addr, u8 *data, int len);
28/* Update single register based on the mask */ 34/* Update single register based on the mask */
29int intel_scu_ipc_update_register(u16 addr, u8 data, u8 mask); 35int intel_scu_ipc_update_register(u16 addr, u8 data, u8 mask);
30 36
31/*
32 * Indirect register read
33 * Can be used when SCCB(System Controller Configuration Block) register
34 * HRIM(Honor Restricted IPC Messages) is set (bit 23)
35 */
36int intel_scu_ipc_register_read(u32 addr, u32 *data);
37
38/*
39 * Indirect register write
40 * Can be used when SCCB(System Controller Configuration Block) register
41 * HRIM(Honor Restricted IPC Messages) is set (bit 23)
42 */
43int intel_scu_ipc_register_write(u32 addr, u32 data);
44
45/* Issue commands to the SCU with or without data */ 37/* Issue commands to the SCU with or without data */
46int intel_scu_ipc_simple_command(int cmd, int sub); 38int intel_scu_ipc_simple_command(int cmd, int sub);
47int intel_scu_ipc_command(int cmd, int sub, u32 *in, int inlen, 39int intel_scu_ipc_command(int cmd, int sub, u32 *in, int inlen,
diff --git a/arch/x86/include/asm/irq_vectors.h b/arch/x86/include/asm/irq_vectors.h
index 8767d99c4f64..e2ca30092557 100644
--- a/arch/x86/include/asm/irq_vectors.h
+++ b/arch/x86/include/asm/irq_vectors.h
@@ -125,6 +125,9 @@
125 */ 125 */
126#define MCE_SELF_VECTOR 0xeb 126#define MCE_SELF_VECTOR 0xeb
127 127
128/* Xen vector callback to receive events in a HVM domain */
129#define XEN_HVM_EVTCHN_CALLBACK 0xe9
130
128#define NR_VECTORS 256 131#define NR_VECTORS 256
129 132
130#define FPU_IRQ 13 133#define FPU_IRQ 13
diff --git a/arch/x86/include/asm/kgdb.h b/arch/x86/include/asm/kgdb.h
index 006da3687cdc..396f5b5fc4d7 100644
--- a/arch/x86/include/asm/kgdb.h
+++ b/arch/x86/include/asm/kgdb.h
@@ -39,9 +39,11 @@ enum regnames {
39 GDB_FS, /* 14 */ 39 GDB_FS, /* 14 */
40 GDB_GS, /* 15 */ 40 GDB_GS, /* 15 */
41}; 41};
42#define GDB_ORIG_AX 41
43#define DBG_MAX_REG_NUM 16
42#define NUMREGBYTES ((GDB_GS+1)*4) 44#define NUMREGBYTES ((GDB_GS+1)*4)
43#else /* ! CONFIG_X86_32 */ 45#else /* ! CONFIG_X86_32 */
44enum regnames64 { 46enum regnames {
45 GDB_AX, /* 0 */ 47 GDB_AX, /* 0 */
46 GDB_BX, /* 1 */ 48 GDB_BX, /* 1 */
47 GDB_CX, /* 2 */ 49 GDB_CX, /* 2 */
@@ -59,15 +61,15 @@ enum regnames64 {
59 GDB_R14, /* 14 */ 61 GDB_R14, /* 14 */
60 GDB_R15, /* 15 */ 62 GDB_R15, /* 15 */
61 GDB_PC, /* 16 */ 63 GDB_PC, /* 16 */
64 GDB_PS, /* 17 */
65 GDB_CS, /* 18 */
66 GDB_SS, /* 19 */
62}; 67};
63 68#define GDB_ORIG_AX 57
64enum regnames32 { 69#define DBG_MAX_REG_NUM 20
65 GDB_PS = 34, 70/* 17 64 bit regs and 3 32 bit regs */
66 GDB_CS, 71#define NUMREGBYTES ((17 * 8) + (3 * 4))
67 GDB_SS, 72#endif /* ! CONFIG_X86_32 */
68};
69#define NUMREGBYTES ((GDB_SS+1)*4)
70#endif /* CONFIG_X86_32 */
71 73
72static inline void arch_kgdb_breakpoint(void) 74static inline void arch_kgdb_breakpoint(void)
73{ 75{
diff --git a/arch/x86/include/asm/kvm.h b/arch/x86/include/asm/kvm.h
index ff90055c7f0b..4d8dcbdfc120 100644
--- a/arch/x86/include/asm/kvm.h
+++ b/arch/x86/include/asm/kvm.h
@@ -22,6 +22,8 @@
22#define __KVM_HAVE_XEN_HVM 22#define __KVM_HAVE_XEN_HVM
23#define __KVM_HAVE_VCPU_EVENTS 23#define __KVM_HAVE_VCPU_EVENTS
24#define __KVM_HAVE_DEBUGREGS 24#define __KVM_HAVE_DEBUGREGS
25#define __KVM_HAVE_XSAVE
26#define __KVM_HAVE_XCRS
25 27
26/* Architectural interrupt line count. */ 28/* Architectural interrupt line count. */
27#define KVM_NR_INTERRUPTS 256 29#define KVM_NR_INTERRUPTS 256
@@ -299,4 +301,24 @@ struct kvm_debugregs {
299 __u64 reserved[9]; 301 __u64 reserved[9];
300}; 302};
301 303
304/* for KVM_CAP_XSAVE */
305struct kvm_xsave {
306 __u32 region[1024];
307};
308
309#define KVM_MAX_XCRS 16
310
311struct kvm_xcr {
312 __u32 xcr;
313 __u32 reserved;
314 __u64 value;
315};
316
317struct kvm_xcrs {
318 __u32 nr_xcrs;
319 __u32 flags;
320 struct kvm_xcr xcrs[KVM_MAX_XCRS];
321 __u64 padding[16];
322};
323
302#endif /* _ASM_X86_KVM_H */ 324#endif /* _ASM_X86_KVM_H */
diff --git a/arch/x86/include/asm/kvm_emulate.h b/arch/x86/include/asm/kvm_emulate.h
index 0b2729bf2070..51cfd730ac5d 100644
--- a/arch/x86/include/asm/kvm_emulate.h
+++ b/arch/x86/include/asm/kvm_emulate.h
@@ -51,8 +51,10 @@ struct x86_emulate_ctxt;
51#define X86EMUL_UNHANDLEABLE 1 51#define X86EMUL_UNHANDLEABLE 1
52/* Terminate emulation but return success to the caller. */ 52/* Terminate emulation but return success to the caller. */
53#define X86EMUL_PROPAGATE_FAULT 2 /* propagate a generated fault to guest */ 53#define X86EMUL_PROPAGATE_FAULT 2 /* propagate a generated fault to guest */
54#define X86EMUL_RETRY_INSTR 2 /* retry the instruction for some reason */ 54#define X86EMUL_RETRY_INSTR 3 /* retry the instruction for some reason */
55#define X86EMUL_CMPXCHG_FAILED 2 /* cmpxchg did not see expected value */ 55#define X86EMUL_CMPXCHG_FAILED 4 /* cmpxchg did not see expected value */
56#define X86EMUL_IO_NEEDED 5 /* IO is needed to complete emulation */
57
56struct x86_emulate_ops { 58struct x86_emulate_ops {
57 /* 59 /*
58 * read_std: Read bytes of standard (non-emulated/special) memory. 60 * read_std: Read bytes of standard (non-emulated/special) memory.
@@ -92,6 +94,7 @@ struct x86_emulate_ops {
92 int (*read_emulated)(unsigned long addr, 94 int (*read_emulated)(unsigned long addr,
93 void *val, 95 void *val,
94 unsigned int bytes, 96 unsigned int bytes,
97 unsigned int *error,
95 struct kvm_vcpu *vcpu); 98 struct kvm_vcpu *vcpu);
96 99
97 /* 100 /*
@@ -104,6 +107,7 @@ struct x86_emulate_ops {
104 int (*write_emulated)(unsigned long addr, 107 int (*write_emulated)(unsigned long addr,
105 const void *val, 108 const void *val,
106 unsigned int bytes, 109 unsigned int bytes,
110 unsigned int *error,
107 struct kvm_vcpu *vcpu); 111 struct kvm_vcpu *vcpu);
108 112
109 /* 113 /*
@@ -118,6 +122,7 @@ struct x86_emulate_ops {
118 const void *old, 122 const void *old,
119 const void *new, 123 const void *new,
120 unsigned int bytes, 124 unsigned int bytes,
125 unsigned int *error,
121 struct kvm_vcpu *vcpu); 126 struct kvm_vcpu *vcpu);
122 127
123 int (*pio_in_emulated)(int size, unsigned short port, void *val, 128 int (*pio_in_emulated)(int size, unsigned short port, void *val,
@@ -132,18 +137,26 @@ struct x86_emulate_ops {
132 int seg, struct kvm_vcpu *vcpu); 137 int seg, struct kvm_vcpu *vcpu);
133 u16 (*get_segment_selector)(int seg, struct kvm_vcpu *vcpu); 138 u16 (*get_segment_selector)(int seg, struct kvm_vcpu *vcpu);
134 void (*set_segment_selector)(u16 sel, int seg, struct kvm_vcpu *vcpu); 139 void (*set_segment_selector)(u16 sel, int seg, struct kvm_vcpu *vcpu);
140 unsigned long (*get_cached_segment_base)(int seg, struct kvm_vcpu *vcpu);
135 void (*get_gdt)(struct desc_ptr *dt, struct kvm_vcpu *vcpu); 141 void (*get_gdt)(struct desc_ptr *dt, struct kvm_vcpu *vcpu);
136 ulong (*get_cr)(int cr, struct kvm_vcpu *vcpu); 142 ulong (*get_cr)(int cr, struct kvm_vcpu *vcpu);
137 void (*set_cr)(int cr, ulong val, struct kvm_vcpu *vcpu); 143 int (*set_cr)(int cr, ulong val, struct kvm_vcpu *vcpu);
138 int (*cpl)(struct kvm_vcpu *vcpu); 144 int (*cpl)(struct kvm_vcpu *vcpu);
139 void (*set_rflags)(struct kvm_vcpu *vcpu, unsigned long rflags); 145 int (*get_dr)(int dr, unsigned long *dest, struct kvm_vcpu *vcpu);
146 int (*set_dr)(int dr, unsigned long value, struct kvm_vcpu *vcpu);
147 int (*set_msr)(struct kvm_vcpu *vcpu, u32 msr_index, u64 data);
148 int (*get_msr)(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata);
140}; 149};
141 150
142/* Type, address-of, and value of an instruction's operand. */ 151/* Type, address-of, and value of an instruction's operand. */
143struct operand { 152struct operand {
144 enum { OP_REG, OP_MEM, OP_IMM, OP_NONE } type; 153 enum { OP_REG, OP_MEM, OP_IMM, OP_NONE } type;
145 unsigned int bytes; 154 unsigned int bytes;
146 unsigned long val, orig_val, *ptr; 155 unsigned long orig_val, *ptr;
156 union {
157 unsigned long val;
158 char valptr[sizeof(unsigned long) + 2];
159 };
147}; 160};
148 161
149struct fetch_cache { 162struct fetch_cache {
@@ -186,6 +199,7 @@ struct decode_cache {
186 unsigned long modrm_val; 199 unsigned long modrm_val;
187 struct fetch_cache fetch; 200 struct fetch_cache fetch;
188 struct read_cache io_read; 201 struct read_cache io_read;
202 struct read_cache mem_read;
189}; 203};
190 204
191struct x86_emulate_ctxt { 205struct x86_emulate_ctxt {
@@ -202,6 +216,12 @@ struct x86_emulate_ctxt {
202 int interruptibility; 216 int interruptibility;
203 217
204 bool restart; /* restart string instruction after writeback */ 218 bool restart; /* restart string instruction after writeback */
219
220 int exception; /* exception that happens during emulation or -1 */
221 u32 error_code; /* error code for exception */
222 bool error_code_valid;
223 unsigned long cr2; /* faulted address in case of #PF */
224
205 /* decode cache */ 225 /* decode cache */
206 struct decode_cache decode; 226 struct decode_cache decode;
207}; 227};
diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index 76f5483cffec..502e53f999cf 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -15,6 +15,7 @@
15#include <linux/mm.h> 15#include <linux/mm.h>
16#include <linux/mmu_notifier.h> 16#include <linux/mmu_notifier.h>
17#include <linux/tracepoint.h> 17#include <linux/tracepoint.h>
18#include <linux/cpumask.h>
18 19
19#include <linux/kvm.h> 20#include <linux/kvm.h>
20#include <linux/kvm_para.h> 21#include <linux/kvm_para.h>
@@ -39,11 +40,14 @@
39 0xFFFFFF0000000000ULL) 40 0xFFFFFF0000000000ULL)
40 41
41#define INVALID_PAGE (~(hpa_t)0) 42#define INVALID_PAGE (~(hpa_t)0)
43#define VALID_PAGE(x) ((x) != INVALID_PAGE)
44
42#define UNMAPPED_GVA (~(gpa_t)0) 45#define UNMAPPED_GVA (~(gpa_t)0)
43 46
44/* KVM Hugepage definitions for x86 */ 47/* KVM Hugepage definitions for x86 */
45#define KVM_NR_PAGE_SIZES 3 48#define KVM_NR_PAGE_SIZES 3
46#define KVM_HPAGE_SHIFT(x) (PAGE_SHIFT + (((x) - 1) * 9)) 49#define KVM_HPAGE_GFN_SHIFT(x) (((x) - 1) * 9)
50#define KVM_HPAGE_SHIFT(x) (PAGE_SHIFT + KVM_HPAGE_GFN_SHIFT(x))
47#define KVM_HPAGE_SIZE(x) (1UL << KVM_HPAGE_SHIFT(x)) 51#define KVM_HPAGE_SIZE(x) (1UL << KVM_HPAGE_SHIFT(x))
48#define KVM_HPAGE_MASK(x) (~(KVM_HPAGE_SIZE(x) - 1)) 52#define KVM_HPAGE_MASK(x) (~(KVM_HPAGE_SIZE(x) - 1))
49#define KVM_PAGES_PER_HPAGE(x) (KVM_HPAGE_SIZE(x) / PAGE_SIZE) 53#define KVM_PAGES_PER_HPAGE(x) (KVM_HPAGE_SIZE(x) / PAGE_SIZE)
@@ -69,8 +73,6 @@
69 73
70#define IOPL_SHIFT 12 74#define IOPL_SHIFT 12
71 75
72#define KVM_ALIAS_SLOTS 4
73
74#define KVM_PERMILLE_MMU_PAGES 20 76#define KVM_PERMILLE_MMU_PAGES 20
75#define KVM_MIN_ALLOC_MMU_PAGES 64 77#define KVM_MIN_ALLOC_MMU_PAGES 64
76#define KVM_MMU_HASH_SHIFT 10 78#define KVM_MMU_HASH_SHIFT 10
@@ -241,7 +243,7 @@ struct kvm_mmu {
241 void (*prefetch_page)(struct kvm_vcpu *vcpu, 243 void (*prefetch_page)(struct kvm_vcpu *vcpu,
242 struct kvm_mmu_page *page); 244 struct kvm_mmu_page *page);
243 int (*sync_page)(struct kvm_vcpu *vcpu, 245 int (*sync_page)(struct kvm_vcpu *vcpu,
244 struct kvm_mmu_page *sp); 246 struct kvm_mmu_page *sp, bool clear_unsync);
245 void (*invlpg)(struct kvm_vcpu *vcpu, gva_t gva); 247 void (*invlpg)(struct kvm_vcpu *vcpu, gva_t gva);
246 hpa_t root_hpa; 248 hpa_t root_hpa;
247 int root_level; 249 int root_level;
@@ -301,8 +303,8 @@ struct kvm_vcpu_arch {
301 unsigned long mmu_seq; 303 unsigned long mmu_seq;
302 } update_pte; 304 } update_pte;
303 305
304 struct i387_fxsave_struct host_fx_image; 306 struct fpu guest_fpu;
305 struct i387_fxsave_struct guest_fx_image; 307 u64 xcr0;
306 308
307 gva_t mmio_fault_cr2; 309 gva_t mmio_fault_cr2;
308 struct kvm_pio_request pio; 310 struct kvm_pio_request pio;
@@ -360,26 +362,11 @@ struct kvm_vcpu_arch {
360 362
361 /* fields used by HYPER-V emulation */ 363 /* fields used by HYPER-V emulation */
362 u64 hv_vapic; 364 u64 hv_vapic;
363};
364
365struct kvm_mem_alias {
366 gfn_t base_gfn;
367 unsigned long npages;
368 gfn_t target_gfn;
369#define KVM_ALIAS_INVALID 1UL
370 unsigned long flags;
371};
372 365
373#define KVM_ARCH_HAS_UNALIAS_INSTANTIATION 366 cpumask_var_t wbinvd_dirty_mask;
374
375struct kvm_mem_aliases {
376 struct kvm_mem_alias aliases[KVM_ALIAS_SLOTS];
377 int naliases;
378}; 367};
379 368
380struct kvm_arch { 369struct kvm_arch {
381 struct kvm_mem_aliases *aliases;
382
383 unsigned int n_free_mmu_pages; 370 unsigned int n_free_mmu_pages;
384 unsigned int n_requested_mmu_pages; 371 unsigned int n_requested_mmu_pages;
385 unsigned int n_alloc_mmu_pages; 372 unsigned int n_alloc_mmu_pages;
@@ -533,6 +520,8 @@ struct kvm_x86_ops {
533 520
534 void (*set_supported_cpuid)(u32 func, struct kvm_cpuid_entry2 *entry); 521 void (*set_supported_cpuid)(u32 func, struct kvm_cpuid_entry2 *entry);
535 522
523 bool (*has_wbinvd_exit)(void);
524
536 const struct trace_print_flags *exit_reasons_str; 525 const struct trace_print_flags *exit_reasons_str;
537}; 526};
538 527
@@ -576,7 +565,6 @@ enum emulation_result {
576#define EMULTYPE_SKIP (1 << 2) 565#define EMULTYPE_SKIP (1 << 2)
577int emulate_instruction(struct kvm_vcpu *vcpu, 566int emulate_instruction(struct kvm_vcpu *vcpu,
578 unsigned long cr2, u16 error_code, int emulation_type); 567 unsigned long cr2, u16 error_code, int emulation_type);
579void kvm_report_emulation_failure(struct kvm_vcpu *cvpu, const char *context);
580void realmode_lgdt(struct kvm_vcpu *vcpu, u16 size, unsigned long address); 568void realmode_lgdt(struct kvm_vcpu *vcpu, u16 size, unsigned long address);
581void realmode_lidt(struct kvm_vcpu *vcpu, u16 size, unsigned long address); 569void realmode_lidt(struct kvm_vcpu *vcpu, u16 size, unsigned long address);
582 570
@@ -591,10 +579,7 @@ void kvm_emulate_cpuid(struct kvm_vcpu *vcpu);
591int kvm_emulate_halt(struct kvm_vcpu *vcpu); 579int kvm_emulate_halt(struct kvm_vcpu *vcpu);
592int emulate_invlpg(struct kvm_vcpu *vcpu, gva_t address); 580int emulate_invlpg(struct kvm_vcpu *vcpu, gva_t address);
593int emulate_clts(struct kvm_vcpu *vcpu); 581int emulate_clts(struct kvm_vcpu *vcpu);
594int emulator_get_dr(struct x86_emulate_ctxt *ctxt, int dr, 582int kvm_emulate_wbinvd(struct kvm_vcpu *vcpu);
595 unsigned long *dest);
596int emulator_set_dr(struct x86_emulate_ctxt *ctxt, int dr,
597 unsigned long value);
598 583
599void kvm_get_segment(struct kvm_vcpu *vcpu, struct kvm_segment *var, int seg); 584void kvm_get_segment(struct kvm_vcpu *vcpu, struct kvm_segment *var, int seg);
600int kvm_load_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, int seg); 585int kvm_load_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, int seg);
@@ -602,15 +587,16 @@ int kvm_load_segment_descriptor(struct kvm_vcpu *vcpu, u16 selector, int seg);
602int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason, 587int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason,
603 bool has_error_code, u32 error_code); 588 bool has_error_code, u32 error_code);
604 589
605void kvm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0); 590int kvm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0);
606void kvm_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3); 591int kvm_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3);
607void kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4); 592int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4);
608void kvm_set_cr8(struct kvm_vcpu *vcpu, unsigned long cr8); 593void kvm_set_cr8(struct kvm_vcpu *vcpu, unsigned long cr8);
609int kvm_set_dr(struct kvm_vcpu *vcpu, int dr, unsigned long val); 594int kvm_set_dr(struct kvm_vcpu *vcpu, int dr, unsigned long val);
610int kvm_get_dr(struct kvm_vcpu *vcpu, int dr, unsigned long *val); 595int kvm_get_dr(struct kvm_vcpu *vcpu, int dr, unsigned long *val);
611unsigned long kvm_get_cr8(struct kvm_vcpu *vcpu); 596unsigned long kvm_get_cr8(struct kvm_vcpu *vcpu);
612void kvm_lmsw(struct kvm_vcpu *vcpu, unsigned long msw); 597void kvm_lmsw(struct kvm_vcpu *vcpu, unsigned long msw);
613void kvm_get_cs_db_l_bits(struct kvm_vcpu *vcpu, int *db, int *l); 598void kvm_get_cs_db_l_bits(struct kvm_vcpu *vcpu, int *db, int *l);
599int kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr);
614 600
615int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata); 601int kvm_get_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 *pdata);
616int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data); 602int kvm_set_msr_common(struct kvm_vcpu *vcpu, u32 msr, u64 data);
@@ -630,12 +616,7 @@ int kvm_pic_set_irq(void *opaque, int irq, int level);
630 616
631void kvm_inject_nmi(struct kvm_vcpu *vcpu); 617void kvm_inject_nmi(struct kvm_vcpu *vcpu);
632 618
633void fx_init(struct kvm_vcpu *vcpu); 619int fx_init(struct kvm_vcpu *vcpu);
634
635int emulator_write_emulated(unsigned long addr,
636 const void *val,
637 unsigned int bytes,
638 struct kvm_vcpu *vcpu);
639 620
640void kvm_mmu_flush_tlb(struct kvm_vcpu *vcpu); 621void kvm_mmu_flush_tlb(struct kvm_vcpu *vcpu);
641void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa, 622void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
@@ -664,8 +645,6 @@ void kvm_disable_tdp(void);
664int complete_pio(struct kvm_vcpu *vcpu); 645int complete_pio(struct kvm_vcpu *vcpu);
665bool kvm_check_iopl(struct kvm_vcpu *vcpu); 646bool kvm_check_iopl(struct kvm_vcpu *vcpu);
666 647
667struct kvm_memory_slot *gfn_to_memslot_unaliased(struct kvm *kvm, gfn_t gfn);
668
669static inline struct kvm_mmu_page *page_header(hpa_t shadow_page) 648static inline struct kvm_mmu_page *page_header(hpa_t shadow_page)
670{ 649{
671 struct page *page = pfn_to_page(shadow_page >> PAGE_SHIFT); 650 struct page *page = pfn_to_page(shadow_page >> PAGE_SHIFT);
@@ -719,21 +698,6 @@ static inline unsigned long read_msr(unsigned long msr)
719} 698}
720#endif 699#endif
721 700
722static inline void kvm_fx_save(struct i387_fxsave_struct *image)
723{
724 asm("fxsave (%0)":: "r" (image));
725}
726
727static inline void kvm_fx_restore(struct i387_fxsave_struct *image)
728{
729 asm("fxrstor (%0)":: "r" (image));
730}
731
732static inline void kvm_fx_finit(void)
733{
734 asm("finit");
735}
736
737static inline u32 get_rdx_init_val(void) 701static inline u32 get_rdx_init_val(void)
738{ 702{
739 return 0x600; /* P6 family */ 703 return 0x600; /* P6 family */
diff --git a/arch/x86/include/asm/local64.h b/arch/x86/include/asm/local64.h
new file mode 100644
index 000000000000..36c93b5cc239
--- /dev/null
+++ b/arch/x86/include/asm/local64.h
@@ -0,0 +1 @@
#include <asm-generic/local64.h>
diff --git a/arch/x86/include/asm/mrst.h b/arch/x86/include/asm/mrst.h
index 451d30e7f62d..16350740edf6 100644
--- a/arch/x86/include/asm/mrst.h
+++ b/arch/x86/include/asm/mrst.h
@@ -13,6 +13,32 @@
13extern int pci_mrst_init(void); 13extern int pci_mrst_init(void);
14int __init sfi_parse_mrtc(struct sfi_table_header *table); 14int __init sfi_parse_mrtc(struct sfi_table_header *table);
15 15
16/*
17 * Medfield is the follow-up of Moorestown, it combines two chip solution into
18 * one. Other than that it also added always-on and constant tsc and lapic
19 * timers. Medfield is the platform name, and the chip name is called Penwell
20 * we treat Medfield/Penwell as a variant of Moorestown. Penwell can be
21 * identified via MSRs.
22 */
23enum mrst_cpu_type {
24 MRST_CPU_CHIP_LINCROFT = 1,
25 MRST_CPU_CHIP_PENWELL,
26};
27
28extern enum mrst_cpu_type __mrst_cpu_chip;
29static enum mrst_cpu_type mrst_identify_cpu(void)
30{
31 return __mrst_cpu_chip;
32}
33
34enum mrst_timer_options {
35 MRST_TIMER_DEFAULT,
36 MRST_TIMER_APBT_ONLY,
37 MRST_TIMER_LAPIC_APBT,
38};
39
40extern enum mrst_timer_options mrst_timer_options;
41
16#define SFI_MTMR_MAX_NUM 8 42#define SFI_MTMR_MAX_NUM 8
17#define SFI_MRTC_MAX 8 43#define SFI_MRTC_MAX 8
18 44
diff --git a/arch/x86/include/asm/msr-index.h b/arch/x86/include/asm/msr-index.h
index 8c7ae4318629..65bbec2093aa 100644
--- a/arch/x86/include/asm/msr-index.h
+++ b/arch/x86/include/asm/msr-index.h
@@ -20,6 +20,7 @@
20#define _EFER_LMA 10 /* Long mode active (read-only) */ 20#define _EFER_LMA 10 /* Long mode active (read-only) */
21#define _EFER_NX 11 /* No execute enable */ 21#define _EFER_NX 11 /* No execute enable */
22#define _EFER_SVME 12 /* Enable virtualization */ 22#define _EFER_SVME 12 /* Enable virtualization */
23#define _EFER_LMSLE 13 /* Long Mode Segment Limit Enable */
23#define _EFER_FFXSR 14 /* Enable Fast FXSAVE/FXRSTOR */ 24#define _EFER_FFXSR 14 /* Enable Fast FXSAVE/FXRSTOR */
24 25
25#define EFER_SCE (1<<_EFER_SCE) 26#define EFER_SCE (1<<_EFER_SCE)
@@ -27,6 +28,7 @@
27#define EFER_LMA (1<<_EFER_LMA) 28#define EFER_LMA (1<<_EFER_LMA)
28#define EFER_NX (1<<_EFER_NX) 29#define EFER_NX (1<<_EFER_NX)
29#define EFER_SVME (1<<_EFER_SVME) 30#define EFER_SVME (1<<_EFER_SVME)
31#define EFER_LMSLE (1<<_EFER_LMSLE)
30#define EFER_FFXSR (1<<_EFER_FFXSR) 32#define EFER_FFXSR (1<<_EFER_FFXSR)
31 33
32/* Intel MSRs. Some also available on other CPUs */ 34/* Intel MSRs. Some also available on other CPUs */
@@ -159,8 +161,6 @@
159#define MSR_K7_FID_VID_STATUS 0xc0010042 161#define MSR_K7_FID_VID_STATUS 0xc0010042
160 162
161/* K6 MSRs */ 163/* K6 MSRs */
162#define MSR_K6_EFER 0xc0000080
163#define MSR_K6_STAR 0xc0000081
164#define MSR_K6_WHCR 0xc0000082 164#define MSR_K6_WHCR 0xc0000082
165#define MSR_K6_UWCCR 0xc0000085 165#define MSR_K6_UWCCR 0xc0000085
166#define MSR_K6_EPMR 0xc0000086 166#define MSR_K6_EPMR 0xc0000086
@@ -224,12 +224,14 @@
224#define MSR_IA32_THERM_CONTROL 0x0000019a 224#define MSR_IA32_THERM_CONTROL 0x0000019a
225#define MSR_IA32_THERM_INTERRUPT 0x0000019b 225#define MSR_IA32_THERM_INTERRUPT 0x0000019b
226 226
227#define THERM_INT_LOW_ENABLE (1 << 0) 227#define THERM_INT_HIGH_ENABLE (1 << 0)
228#define THERM_INT_HIGH_ENABLE (1 << 1) 228#define THERM_INT_LOW_ENABLE (1 << 1)
229#define THERM_INT_PLN_ENABLE (1 << 24)
229 230
230#define MSR_IA32_THERM_STATUS 0x0000019c 231#define MSR_IA32_THERM_STATUS 0x0000019c
231 232
232#define THERM_STATUS_PROCHOT (1 << 0) 233#define THERM_STATUS_PROCHOT (1 << 0)
234#define THERM_STATUS_POWER_LIMIT (1 << 10)
233 235
234#define MSR_THERM2_CTL 0x0000019d 236#define MSR_THERM2_CTL 0x0000019d
235 237
@@ -239,6 +241,19 @@
239 241
240#define MSR_IA32_TEMPERATURE_TARGET 0x000001a2 242#define MSR_IA32_TEMPERATURE_TARGET 0x000001a2
241 243
244#define MSR_IA32_ENERGY_PERF_BIAS 0x000001b0
245
246#define MSR_IA32_PACKAGE_THERM_STATUS 0x000001b1
247
248#define PACKAGE_THERM_STATUS_PROCHOT (1 << 0)
249#define PACKAGE_THERM_STATUS_POWER_LIMIT (1 << 10)
250
251#define MSR_IA32_PACKAGE_THERM_INTERRUPT 0x000001b2
252
253#define PACKAGE_THERM_INT_HIGH_ENABLE (1 << 0)
254#define PACKAGE_THERM_INT_LOW_ENABLE (1 << 1)
255#define PACKAGE_THERM_INT_PLN_ENABLE (1 << 24)
256
242/* MISC_ENABLE bits: architectural */ 257/* MISC_ENABLE bits: architectural */
243#define MSR_IA32_MISC_ENABLE_FAST_STRING (1ULL << 0) 258#define MSR_IA32_MISC_ENABLE_FAST_STRING (1ULL << 0)
244#define MSR_IA32_MISC_ENABLE_TCC (1ULL << 1) 259#define MSR_IA32_MISC_ENABLE_TCC (1ULL << 1)
diff --git a/arch/x86/include/asm/msr.h b/arch/x86/include/asm/msr.h
index c5bc4c2d33f5..084ef95274cd 100644
--- a/arch/x86/include/asm/msr.h
+++ b/arch/x86/include/asm/msr.h
@@ -148,8 +148,8 @@ static inline unsigned long long native_read_pmc(int counter)
148#define rdmsr(msr, val1, val2) \ 148#define rdmsr(msr, val1, val2) \
149do { \ 149do { \
150 u64 __val = native_read_msr((msr)); \ 150 u64 __val = native_read_msr((msr)); \
151 (val1) = (u32)__val; \ 151 (void)((val1) = (u32)__val); \
152 (val2) = (u32)(__val >> 32); \ 152 (void)((val2) = (u32)(__val >> 32)); \
153} while (0) 153} while (0)
154 154
155static inline void wrmsr(unsigned msr, unsigned low, unsigned high) 155static inline void wrmsr(unsigned msr, unsigned low, unsigned high)
diff --git a/arch/x86/include/asm/nmi.h b/arch/x86/include/asm/nmi.h
index 93da9c3f3341..932f0f86b4b7 100644
--- a/arch/x86/include/asm/nmi.h
+++ b/arch/x86/include/asm/nmi.h
@@ -17,7 +17,9 @@ int do_nmi_callback(struct pt_regs *regs, int cpu);
17 17
18extern void die_nmi(char *str, struct pt_regs *regs, int do_panic); 18extern void die_nmi(char *str, struct pt_regs *regs, int do_panic);
19extern int check_nmi_watchdog(void); 19extern int check_nmi_watchdog(void);
20#if !defined(CONFIG_LOCKUP_DETECTOR)
20extern int nmi_watchdog_enabled; 21extern int nmi_watchdog_enabled;
22#endif
21extern int avail_to_resrv_perfctr_nmi_bit(unsigned int); 23extern int avail_to_resrv_perfctr_nmi_bit(unsigned int);
22extern int reserve_perfctr_nmi(unsigned int); 24extern int reserve_perfctr_nmi(unsigned int);
23extern void release_perfctr_nmi(unsigned int); 25extern void release_perfctr_nmi(unsigned int);
diff --git a/arch/x86/include/asm/pci_x86.h b/arch/x86/include/asm/pci_x86.h
index cd2a31dc5fb8..49c7219826f9 100644
--- a/arch/x86/include/asm/pci_x86.h
+++ b/arch/x86/include/asm/pci_x86.h
@@ -30,6 +30,7 @@
30#define PCI_HAS_IO_ECS 0x40000 30#define PCI_HAS_IO_ECS 0x40000
31#define PCI_NOASSIGN_ROMS 0x80000 31#define PCI_NOASSIGN_ROMS 0x80000
32#define PCI_ROOT_NO_CRS 0x100000 32#define PCI_ROOT_NO_CRS 0x100000
33#define PCI_NOASSIGN_BARS 0x200000
33 34
34extern unsigned int pci_probe; 35extern unsigned int pci_probe;
35extern unsigned long pirq_table_addr; 36extern unsigned long pirq_table_addr;
diff --git a/arch/x86/include/asm/perf_event.h b/arch/x86/include/asm/perf_event.h
index 254883d0c7e0..6e742cc4251b 100644
--- a/arch/x86/include/asm/perf_event.h
+++ b/arch/x86/include/asm/perf_event.h
@@ -68,8 +68,9 @@ union cpuid10_eax {
68 68
69union cpuid10_edx { 69union cpuid10_edx {
70 struct { 70 struct {
71 unsigned int num_counters_fixed:4; 71 unsigned int num_counters_fixed:5;
72 unsigned int reserved:28; 72 unsigned int bit_width_fixed:8;
73 unsigned int reserved:19;
73 } split; 74 } split;
74 unsigned int full; 75 unsigned int full;
75}; 76};
@@ -140,6 +141,19 @@ extern unsigned long perf_instruction_pointer(struct pt_regs *regs);
140extern unsigned long perf_misc_flags(struct pt_regs *regs); 141extern unsigned long perf_misc_flags(struct pt_regs *regs);
141#define perf_misc_flags(regs) perf_misc_flags(regs) 142#define perf_misc_flags(regs) perf_misc_flags(regs)
142 143
144#include <asm/stacktrace.h>
145
146/*
147 * We abuse bit 3 from flags to pass exact information, see perf_misc_flags
148 * and the comment with PERF_EFLAGS_EXACT.
149 */
150#define perf_arch_fetch_caller_regs(regs, __ip) { \
151 (regs)->ip = (__ip); \
152 (regs)->bp = caller_frame_pointer(); \
153 (regs)->cs = __KERNEL_CS; \
154 regs->flags = 0; \
155}
156
143#else 157#else
144static inline void init_hw_perf_events(void) { } 158static inline void init_hw_perf_events(void) { }
145static inline void perf_events_lapic_init(void) { } 159static inline void perf_events_lapic_init(void) { }
diff --git a/arch/x86/include/asm/perf_event_p4.h b/arch/x86/include/asm/perf_event_p4.h
index 64a8ebff06fc..def500776b16 100644
--- a/arch/x86/include/asm/perf_event_p4.h
+++ b/arch/x86/include/asm/perf_event_p4.h
@@ -19,7 +19,6 @@
19#define ARCH_P4_RESERVED_ESCR (2) /* IQ_ESCR(0,1) not always present */ 19#define ARCH_P4_RESERVED_ESCR (2) /* IQ_ESCR(0,1) not always present */
20#define ARCH_P4_MAX_ESCR (ARCH_P4_TOTAL_ESCR - ARCH_P4_RESERVED_ESCR) 20#define ARCH_P4_MAX_ESCR (ARCH_P4_TOTAL_ESCR - ARCH_P4_RESERVED_ESCR)
21#define ARCH_P4_MAX_CCCR (18) 21#define ARCH_P4_MAX_CCCR (18)
22#define ARCH_P4_MAX_COUNTER (ARCH_P4_MAX_CCCR / 2)
23 22
24#define P4_ESCR_EVENT_MASK 0x7e000000U 23#define P4_ESCR_EVENT_MASK 0x7e000000U
25#define P4_ESCR_EVENT_SHIFT 25 24#define P4_ESCR_EVENT_SHIFT 25
@@ -71,10 +70,6 @@
71#define P4_CCCR_THRESHOLD(v) ((v) << P4_CCCR_THRESHOLD_SHIFT) 70#define P4_CCCR_THRESHOLD(v) ((v) << P4_CCCR_THRESHOLD_SHIFT)
72#define P4_CCCR_ESEL(v) ((v) << P4_CCCR_ESCR_SELECT_SHIFT) 71#define P4_CCCR_ESEL(v) ((v) << P4_CCCR_ESCR_SELECT_SHIFT)
73 72
74/* Custom bits in reerved CCCR area */
75#define P4_CCCR_CACHE_OPS_MASK 0x0000003fU
76
77
78/* Non HT mask */ 73/* Non HT mask */
79#define P4_CCCR_MASK \ 74#define P4_CCCR_MASK \
80 (P4_CCCR_OVF | \ 75 (P4_CCCR_OVF | \
@@ -106,8 +101,7 @@
106 * ESCR and CCCR but rather an only packed value should 101 * ESCR and CCCR but rather an only packed value should
107 * be unpacked and written to a proper addresses 102 * be unpacked and written to a proper addresses
108 * 103 *
109 * the base idea is to pack as much info as 104 * the base idea is to pack as much info as possible
110 * possible
111 */ 105 */
112#define p4_config_pack_escr(v) (((u64)(v)) << 32) 106#define p4_config_pack_escr(v) (((u64)(v)) << 32)
113#define p4_config_pack_cccr(v) (((u64)(v)) & 0xffffffffULL) 107#define p4_config_pack_cccr(v) (((u64)(v)) & 0xffffffffULL)
@@ -130,8 +124,6 @@
130 t; \ 124 t; \
131 }) 125 })
132 126
133#define p4_config_unpack_cache_event(v) (((u64)(v)) & P4_CCCR_CACHE_OPS_MASK)
134
135#define P4_CONFIG_HT_SHIFT 63 127#define P4_CONFIG_HT_SHIFT 63
136#define P4_CONFIG_HT (1ULL << P4_CONFIG_HT_SHIFT) 128#define P4_CONFIG_HT (1ULL << P4_CONFIG_HT_SHIFT)
137 129
@@ -214,6 +206,12 @@ static inline u32 p4_default_escr_conf(int cpu, int exclude_os, int exclude_usr)
214 return escr; 206 return escr;
215} 207}
216 208
209/*
210 * This are the events which should be used in "Event Select"
211 * field of ESCR register, they are like unique keys which allow
212 * the kernel to determinate which CCCR and COUNTER should be
213 * used to track an event
214 */
217enum P4_EVENTS { 215enum P4_EVENTS {
218 P4_EVENT_TC_DELIVER_MODE, 216 P4_EVENT_TC_DELIVER_MODE,
219 P4_EVENT_BPU_FETCH_REQUEST, 217 P4_EVENT_BPU_FETCH_REQUEST,
@@ -561,7 +559,7 @@ enum P4_EVENT_OPCODES {
561 * a caller should use P4_ESCR_EMASK_NAME helper to 559 * a caller should use P4_ESCR_EMASK_NAME helper to
562 * pick the EventMask needed, for example 560 * pick the EventMask needed, for example
563 * 561 *
564 * P4_ESCR_EMASK_NAME(P4_EVENT_TC_DELIVER_MODE, DD) 562 * P4_ESCR_EMASK_BIT(P4_EVENT_TC_DELIVER_MODE, DD)
565 */ 563 */
566enum P4_ESCR_EMASKS { 564enum P4_ESCR_EMASKS {
567 P4_GEN_ESCR_EMASK(P4_EVENT_TC_DELIVER_MODE, DD, 0), 565 P4_GEN_ESCR_EMASK(P4_EVENT_TC_DELIVER_MODE, DD, 0),
@@ -753,43 +751,50 @@ enum P4_ESCR_EMASKS {
753 P4_GEN_ESCR_EMASK(P4_EVENT_INSTR_COMPLETED, BOGUS, 1), 751 P4_GEN_ESCR_EMASK(P4_EVENT_INSTR_COMPLETED, BOGUS, 1),
754}; 752};
755 753
756/* P4 PEBS: stale for a while */ 754/*
757#define P4_PEBS_METRIC_MASK 0x00001fffU 755 * P4 PEBS specifics (Replay Event only)
758#define P4_PEBS_UOB_TAG 0x01000000U 756 *
759#define P4_PEBS_ENABLE 0x02000000U 757 * Format (bits):
760 758 * 0-6: metric from P4_PEBS_METRIC enum
761/* Replay metrics for MSR_IA32_PEBS_ENABLE and MSR_P4_PEBS_MATRIX_VERT */ 759 * 7 : reserved
762#define P4_PEBS__1stl_cache_load_miss_retired 0x3000001 760 * 8 : reserved
763#define P4_PEBS__2ndl_cache_load_miss_retired 0x3000002 761 * 9-11 : reserved
764#define P4_PEBS__dtlb_load_miss_retired 0x3000004 762 *
765#define P4_PEBS__dtlb_store_miss_retired 0x3000004 763 * Note we have UOP and PEBS bits reserved for now
766#define P4_PEBS__dtlb_all_miss_retired 0x3000004 764 * just in case if we will need them once
767#define P4_PEBS__tagged_mispred_branch 0x3018000 765 */
768#define P4_PEBS__mob_load_replay_retired 0x3000200 766#define P4_PEBS_CONFIG_ENABLE (1 << 7)
769#define P4_PEBS__split_load_retired 0x3000400 767#define P4_PEBS_CONFIG_UOP_TAG (1 << 8)
770#define P4_PEBS__split_store_retired 0x3000400 768#define P4_PEBS_CONFIG_METRIC_MASK 0x3f
771 769#define P4_PEBS_CONFIG_MASK 0xff
772#define P4_VERT__1stl_cache_load_miss_retired 0x0000001 770
773#define P4_VERT__2ndl_cache_load_miss_retired 0x0000001 771/*
774#define P4_VERT__dtlb_load_miss_retired 0x0000001 772 * mem: Only counters MSR_IQ_COUNTER4 (16) and
775#define P4_VERT__dtlb_store_miss_retired 0x0000002 773 * MSR_IQ_COUNTER5 (17) are allowed for PEBS sampling
776#define P4_VERT__dtlb_all_miss_retired 0x0000003 774 */
777#define P4_VERT__tagged_mispred_branch 0x0000010 775#define P4_PEBS_ENABLE 0x02000000U
778#define P4_VERT__mob_load_replay_retired 0x0000001 776#define P4_PEBS_ENABLE_UOP_TAG 0x01000000U
779#define P4_VERT__split_load_retired 0x0000001 777
780#define P4_VERT__split_store_retired 0x0000002 778#define p4_config_unpack_metric(v) (((u64)(v)) & P4_PEBS_CONFIG_METRIC_MASK)
781 779#define p4_config_unpack_pebs(v) (((u64)(v)) & P4_PEBS_CONFIG_MASK)
782enum P4_CACHE_EVENTS { 780
783 P4_CACHE__NONE, 781#define p4_config_pebs_has(v, mask) (p4_config_unpack_pebs(v) & (mask))
784 782
785 P4_CACHE__1stl_cache_load_miss_retired, 783enum P4_PEBS_METRIC {
786 P4_CACHE__2ndl_cache_load_miss_retired, 784 P4_PEBS_METRIC__none,
787 P4_CACHE__dtlb_load_miss_retired, 785
788 P4_CACHE__dtlb_store_miss_retired, 786 P4_PEBS_METRIC__1stl_cache_load_miss_retired,
789 P4_CACHE__itlb_reference_hit, 787 P4_PEBS_METRIC__2ndl_cache_load_miss_retired,
790 P4_CACHE__itlb_reference_miss, 788 P4_PEBS_METRIC__dtlb_load_miss_retired,
791 789 P4_PEBS_METRIC__dtlb_store_miss_retired,
792 P4_CACHE__MAX 790 P4_PEBS_METRIC__dtlb_all_miss_retired,
791 P4_PEBS_METRIC__tagged_mispred_branch,
792 P4_PEBS_METRIC__mob_load_replay_retired,
793 P4_PEBS_METRIC__split_load_retired,
794 P4_PEBS_METRIC__split_store_retired,
795
796 P4_PEBS_METRIC__max
793}; 797};
794 798
795#endif /* PERF_EVENT_P4_H */ 799#endif /* PERF_EVENT_P4_H */
800
diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
index 7e5c6a60b8ee..325b7bdbebaa 100644
--- a/arch/x86/include/asm/processor.h
+++ b/arch/x86/include/asm/processor.h
@@ -762,6 +762,7 @@ extern void init_c1e_mask(void);
762extern unsigned long boot_option_idle_override; 762extern unsigned long boot_option_idle_override;
763extern unsigned long idle_halt; 763extern unsigned long idle_halt;
764extern unsigned long idle_nomwait; 764extern unsigned long idle_nomwait;
765extern bool c1e_detected;
765 766
766/* 767/*
767 * on systems with caches, caches must be flashed as the absolute 768 * on systems with caches, caches must be flashed as the absolute
@@ -1025,4 +1026,24 @@ unsigned long calc_aperfmperf_ratio(struct aperfmperf *old,
1025 return ratio; 1026 return ratio;
1026} 1027}
1027 1028
1029/*
1030 * AMD errata checking
1031 */
1032#ifdef CONFIG_CPU_SUP_AMD
1033extern const int amd_erratum_383[];
1034extern const int amd_erratum_400[];
1035extern bool cpu_has_amd_erratum(const int *);
1036
1037#define AMD_LEGACY_ERRATUM(...) { -1, __VA_ARGS__, 0 }
1038#define AMD_OSVW_ERRATUM(osvw_id, ...) { osvw_id, __VA_ARGS__, 0 }
1039#define AMD_MODEL_RANGE(f, m_start, s_start, m_end, s_end) \
1040 ((f << 24) | (m_start << 16) | (s_start << 12) | (m_end << 4) | (s_end))
1041#define AMD_MODEL_RANGE_FAMILY(range) (((range) >> 24) & 0xff)
1042#define AMD_MODEL_RANGE_START(range) (((range) >> 12) & 0xfff)
1043#define AMD_MODEL_RANGE_END(range) ((range) & 0xfff)
1044
1045#else
1046#define cpu_has_amd_erratum(x) (false)
1047#endif /* CONFIG_CPU_SUP_AMD */
1048
1028#endif /* _ASM_X86_PROCESSOR_H */ 1049#endif /* _ASM_X86_PROCESSOR_H */
diff --git a/arch/x86/include/asm/required-features.h b/arch/x86/include/asm/required-features.h
index 64cf2d24fad1..6c7fc25f2c34 100644
--- a/arch/x86/include/asm/required-features.h
+++ b/arch/x86/include/asm/required-features.h
@@ -84,5 +84,7 @@
84#define REQUIRED_MASK5 0 84#define REQUIRED_MASK5 0
85#define REQUIRED_MASK6 0 85#define REQUIRED_MASK6 0
86#define REQUIRED_MASK7 0 86#define REQUIRED_MASK7 0
87#define REQUIRED_MASK8 0
88#define REQUIRED_MASK9 0
87 89
88#endif /* _ASM_X86_REQUIRED_FEATURES_H */ 90#endif /* _ASM_X86_REQUIRED_FEATURES_H */
diff --git a/arch/x86/include/asm/rwsem.h b/arch/x86/include/asm/rwsem.h
index 606ede126972..d1e41b0f9b60 100644
--- a/arch/x86/include/asm/rwsem.h
+++ b/arch/x86/include/asm/rwsem.h
@@ -118,7 +118,7 @@ static inline void __down_read(struct rw_semaphore *sem)
118{ 118{
119 asm volatile("# beginning down_read\n\t" 119 asm volatile("# beginning down_read\n\t"
120 LOCK_PREFIX _ASM_INC "(%1)\n\t" 120 LOCK_PREFIX _ASM_INC "(%1)\n\t"
121 /* adds 0x00000001, returns the old value */ 121 /* adds 0x00000001 */
122 " jns 1f\n" 122 " jns 1f\n"
123 " call call_rwsem_down_read_failed\n" 123 " call call_rwsem_down_read_failed\n"
124 "1:\n\t" 124 "1:\n\t"
@@ -156,11 +156,9 @@ static inline int __down_read_trylock(struct rw_semaphore *sem)
156static inline void __down_write_nested(struct rw_semaphore *sem, int subclass) 156static inline void __down_write_nested(struct rw_semaphore *sem, int subclass)
157{ 157{
158 rwsem_count_t tmp; 158 rwsem_count_t tmp;
159
160 tmp = RWSEM_ACTIVE_WRITE_BIAS;
161 asm volatile("# beginning down_write\n\t" 159 asm volatile("# beginning down_write\n\t"
162 LOCK_PREFIX " xadd %1,(%2)\n\t" 160 LOCK_PREFIX " xadd %1,(%2)\n\t"
163 /* subtract 0x0000ffff, returns the old value */ 161 /* adds 0xffff0001, returns the old value */
164 " test %1,%1\n\t" 162 " test %1,%1\n\t"
165 /* was the count 0 before? */ 163 /* was the count 0 before? */
166 " jz 1f\n" 164 " jz 1f\n"
@@ -168,7 +166,7 @@ static inline void __down_write_nested(struct rw_semaphore *sem, int subclass)
168 "1:\n" 166 "1:\n"
169 "# ending down_write" 167 "# ending down_write"
170 : "+m" (sem->count), "=d" (tmp) 168 : "+m" (sem->count), "=d" (tmp)
171 : "a" (sem), "1" (tmp) 169 : "a" (sem), "1" (RWSEM_ACTIVE_WRITE_BIAS)
172 : "memory", "cc"); 170 : "memory", "cc");
173} 171}
174 172
@@ -195,16 +193,16 @@ static inline int __down_write_trylock(struct rw_semaphore *sem)
195 */ 193 */
196static inline void __up_read(struct rw_semaphore *sem) 194static inline void __up_read(struct rw_semaphore *sem)
197{ 195{
198 rwsem_count_t tmp = -RWSEM_ACTIVE_READ_BIAS; 196 rwsem_count_t tmp;
199 asm volatile("# beginning __up_read\n\t" 197 asm volatile("# beginning __up_read\n\t"
200 LOCK_PREFIX " xadd %1,(%2)\n\t" 198 LOCK_PREFIX " xadd %1,(%2)\n\t"
201 /* subtracts 1, returns the old value */ 199 /* subtracts 1, returns the old value */
202 " jns 1f\n\t" 200 " jns 1f\n\t"
203 " call call_rwsem_wake\n" 201 " call call_rwsem_wake\n" /* expects old value in %edx */
204 "1:\n" 202 "1:\n"
205 "# ending __up_read\n" 203 "# ending __up_read\n"
206 : "+m" (sem->count), "=d" (tmp) 204 : "+m" (sem->count), "=d" (tmp)
207 : "a" (sem), "1" (tmp) 205 : "a" (sem), "1" (-RWSEM_ACTIVE_READ_BIAS)
208 : "memory", "cc"); 206 : "memory", "cc");
209} 207}
210 208
@@ -216,10 +214,9 @@ static inline void __up_write(struct rw_semaphore *sem)
216 rwsem_count_t tmp; 214 rwsem_count_t tmp;
217 asm volatile("# beginning __up_write\n\t" 215 asm volatile("# beginning __up_write\n\t"
218 LOCK_PREFIX " xadd %1,(%2)\n\t" 216 LOCK_PREFIX " xadd %1,(%2)\n\t"
219 /* tries to transition 217 /* subtracts 0xffff0001, returns the old value */
220 0xffff0001 -> 0x00000000 */ 218 " jns 1f\n\t"
221 " jz 1f\n" 219 " call call_rwsem_wake\n" /* expects old value in %edx */
222 " call call_rwsem_wake\n"
223 "1:\n\t" 220 "1:\n\t"
224 "# ending __up_write\n" 221 "# ending __up_write\n"
225 : "+m" (sem->count), "=d" (tmp) 222 : "+m" (sem->count), "=d" (tmp)
diff --git a/arch/x86/include/asm/setup.h b/arch/x86/include/asm/setup.h
index 86b1506f4179..ef292c792d74 100644
--- a/arch/x86/include/asm/setup.h
+++ b/arch/x86/include/asm/setup.h
@@ -82,7 +82,7 @@ void *extend_brk(size_t size, size_t align);
82 * executable.) 82 * executable.)
83 */ 83 */
84#define RESERVE_BRK(name,sz) \ 84#define RESERVE_BRK(name,sz) \
85 static void __section(.discard) __used \ 85 static void __section(.discard.text) __used \
86 __brk_reservation_fn_##name##__(void) { \ 86 __brk_reservation_fn_##name##__(void) { \
87 asm volatile ( \ 87 asm volatile ( \
88 ".pushsection .brk_reservation,\"aw\",@nobits;" \ 88 ".pushsection .brk_reservation,\"aw\",@nobits;" \
diff --git a/arch/x86/include/asm/stacktrace.h b/arch/x86/include/asm/stacktrace.h
index 4dab78edbad9..2b16a2ad23dc 100644
--- a/arch/x86/include/asm/stacktrace.h
+++ b/arch/x86/include/asm/stacktrace.h
@@ -1,6 +1,13 @@
1/*
2 * Copyright (C) 1991, 1992 Linus Torvalds
3 * Copyright (C) 2000, 2001, 2002 Andi Kleen, SuSE Labs
4 */
5
1#ifndef _ASM_X86_STACKTRACE_H 6#ifndef _ASM_X86_STACKTRACE_H
2#define _ASM_X86_STACKTRACE_H 7#define _ASM_X86_STACKTRACE_H
3 8
9#include <linux/uaccess.h>
10
4extern int kstack_depth_to_print; 11extern int kstack_depth_to_print;
5 12
6struct thread_info; 13struct thread_info;
@@ -42,4 +49,46 @@ void dump_trace(struct task_struct *tsk, struct pt_regs *regs,
42 unsigned long *stack, unsigned long bp, 49 unsigned long *stack, unsigned long bp,
43 const struct stacktrace_ops *ops, void *data); 50 const struct stacktrace_ops *ops, void *data);
44 51
52#ifdef CONFIG_X86_32
53#define STACKSLOTS_PER_LINE 8
54#define get_bp(bp) asm("movl %%ebp, %0" : "=r" (bp) :)
55#else
56#define STACKSLOTS_PER_LINE 4
57#define get_bp(bp) asm("movq %%rbp, %0" : "=r" (bp) :)
58#endif
59
60extern void
61show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
62 unsigned long *stack, unsigned long bp, char *log_lvl);
63
64extern void
65show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
66 unsigned long *sp, unsigned long bp, char *log_lvl);
67
68extern unsigned int code_bytes;
69
70/* The form of the top of the frame on the stack */
71struct stack_frame {
72 struct stack_frame *next_frame;
73 unsigned long return_address;
74};
75
76struct stack_frame_ia32 {
77 u32 next_frame;
78 u32 return_address;
79};
80
81static inline unsigned long caller_frame_pointer(void)
82{
83 struct stack_frame *frame;
84
85 get_bp(frame);
86
87#ifdef CONFIG_FRAME_POINTER
88 frame = frame->next_frame;
89#endif
90
91 return (unsigned long)frame;
92}
93
45#endif /* _ASM_X86_STACKTRACE_H */ 94#endif /* _ASM_X86_STACKTRACE_H */
diff --git a/arch/x86/include/asm/system.h b/arch/x86/include/asm/system.h
index e7f4d33c55ed..33ecc3ea8782 100644
--- a/arch/x86/include/asm/system.h
+++ b/arch/x86/include/asm/system.h
@@ -457,4 +457,11 @@ static __always_inline void rdtsc_barrier(void)
457 alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC); 457 alternative(ASM_NOP3, "lfence", X86_FEATURE_LFENCE_RDTSC);
458} 458}
459 459
460/*
461 * We handle most unaligned accesses in hardware. On the other hand
462 * unaligned DMA can be quite expensive on some Nehalem processors.
463 *
464 * Based on this we disable the IP header alignment in network drivers.
465 */
466#define NET_IP_ALIGN 0
460#endif /* _ASM_X86_SYSTEM_H */ 467#endif /* _ASM_X86_SYSTEM_H */
diff --git a/arch/x86/include/asm/vmx.h b/arch/x86/include/asm/vmx.h
index 9e6779f7cf2d..9f0cbd987d50 100644
--- a/arch/x86/include/asm/vmx.h
+++ b/arch/x86/include/asm/vmx.h
@@ -257,6 +257,7 @@ enum vmcs_field {
257#define EXIT_REASON_IO_INSTRUCTION 30 257#define EXIT_REASON_IO_INSTRUCTION 30
258#define EXIT_REASON_MSR_READ 31 258#define EXIT_REASON_MSR_READ 31
259#define EXIT_REASON_MSR_WRITE 32 259#define EXIT_REASON_MSR_WRITE 32
260#define EXIT_REASON_INVALID_STATE 33
260#define EXIT_REASON_MWAIT_INSTRUCTION 36 261#define EXIT_REASON_MWAIT_INSTRUCTION 36
261#define EXIT_REASON_MONITOR_INSTRUCTION 39 262#define EXIT_REASON_MONITOR_INSTRUCTION 39
262#define EXIT_REASON_PAUSE_INSTRUCTION 40 263#define EXIT_REASON_PAUSE_INSTRUCTION 40
@@ -266,6 +267,7 @@ enum vmcs_field {
266#define EXIT_REASON_EPT_VIOLATION 48 267#define EXIT_REASON_EPT_VIOLATION 48
267#define EXIT_REASON_EPT_MISCONFIG 49 268#define EXIT_REASON_EPT_MISCONFIG 49
268#define EXIT_REASON_WBINVD 54 269#define EXIT_REASON_WBINVD 54
270#define EXIT_REASON_XSETBV 55
269 271
270/* 272/*
271 * Interruption-information format 273 * Interruption-information format
@@ -375,6 +377,9 @@ enum vmcs_field {
375#define VMX_EPT_EXTENT_CONTEXT_BIT (1ull << 25) 377#define VMX_EPT_EXTENT_CONTEXT_BIT (1ull << 25)
376#define VMX_EPT_EXTENT_GLOBAL_BIT (1ull << 26) 378#define VMX_EPT_EXTENT_GLOBAL_BIT (1ull << 26)
377 379
380#define VMX_VPID_EXTENT_SINGLE_CONTEXT_BIT (1ull << 9) /* (41 - 32) */
381#define VMX_VPID_EXTENT_GLOBAL_CONTEXT_BIT (1ull << 10) /* (42 - 32) */
382
378#define VMX_EPT_DEFAULT_GAW 3 383#define VMX_EPT_DEFAULT_GAW 3
379#define VMX_EPT_MAX_GAW 0x4 384#define VMX_EPT_MAX_GAW 0x4
380#define VMX_EPT_MT_EPTE_SHIFT 3 385#define VMX_EPT_MT_EPTE_SHIFT 3
diff --git a/arch/x86/include/asm/xen/hypercall.h b/arch/x86/include/asm/xen/hypercall.h
index 9c371e4a9fa6..7fda040a76cd 100644
--- a/arch/x86/include/asm/xen/hypercall.h
+++ b/arch/x86/include/asm/xen/hypercall.h
@@ -417,6 +417,12 @@ HYPERVISOR_nmi_op(unsigned long op, unsigned long arg)
417 return _hypercall2(int, nmi_op, op, arg); 417 return _hypercall2(int, nmi_op, op, arg);
418} 418}
419 419
420static inline unsigned long __must_check
421HYPERVISOR_hvm_op(int op, void *arg)
422{
423 return _hypercall2(unsigned long, hvm_op, op, arg);
424}
425
420static inline void 426static inline void
421MULTI_fpu_taskswitch(struct multicall_entry *mcl, int set) 427MULTI_fpu_taskswitch(struct multicall_entry *mcl, int set)
422{ 428{
diff --git a/arch/x86/include/asm/xsave.h b/arch/x86/include/asm/xsave.h
index 2c4390cae228..32c36668fa7b 100644
--- a/arch/x86/include/asm/xsave.h
+++ b/arch/x86/include/asm/xsave.h
@@ -13,6 +13,12 @@
13 13
14#define FXSAVE_SIZE 512 14#define FXSAVE_SIZE 512
15 15
16#define XSAVE_HDR_SIZE 64
17#define XSAVE_HDR_OFFSET FXSAVE_SIZE
18
19#define XSAVE_YMM_SIZE 256
20#define XSAVE_YMM_OFFSET (XSAVE_HDR_SIZE + XSAVE_HDR_OFFSET)
21
16/* 22/*
17 * These are the features that the OS can handle currently. 23 * These are the features that the OS can handle currently.
18 */ 24 */
diff --git a/arch/x86/kernel/acpi/realmode/wakeup.S b/arch/x86/kernel/acpi/realmode/wakeup.S
index 580b4e296010..28595d6df47c 100644
--- a/arch/x86/kernel/acpi/realmode/wakeup.S
+++ b/arch/x86/kernel/acpi/realmode/wakeup.S
@@ -104,7 +104,7 @@ _start:
104 movl %eax, %ecx 104 movl %eax, %ecx
105 orl %edx, %ecx 105 orl %edx, %ecx
106 jz 1f 106 jz 1f
107 movl $0xc0000080, %ecx 107 movl $MSR_EFER, %ecx
108 wrmsr 108 wrmsr
1091: 1091:
110 110
diff --git a/arch/x86/kernel/acpi/sleep.c b/arch/x86/kernel/acpi/sleep.c
index fcc3c61fdecc..33cec152070d 100644
--- a/arch/x86/kernel/acpi/sleep.c
+++ b/arch/x86/kernel/acpi/sleep.c
@@ -2,7 +2,7 @@
2 * sleep.c - x86-specific ACPI sleep support. 2 * sleep.c - x86-specific ACPI sleep support.
3 * 3 *
4 * Copyright (C) 2001-2003 Patrick Mochel 4 * Copyright (C) 2001-2003 Patrick Mochel
5 * Copyright (C) 2001-2003 Pavel Machek <pavel@suse.cz> 5 * Copyright (C) 2001-2003 Pavel Machek <pavel@ucw.cz>
6 */ 6 */
7 7
8#include <linux/acpi.h> 8#include <linux/acpi.h>
diff --git a/arch/x86/kernel/amd_iommu.c b/arch/x86/kernel/amd_iommu.c
index 0d20286d78c6..fa044e1e30a2 100644
--- a/arch/x86/kernel/amd_iommu.c
+++ b/arch/x86/kernel/amd_iommu.c
@@ -2572,6 +2572,11 @@ static phys_addr_t amd_iommu_iova_to_phys(struct iommu_domain *dom,
2572static int amd_iommu_domain_has_cap(struct iommu_domain *domain, 2572static int amd_iommu_domain_has_cap(struct iommu_domain *domain,
2573 unsigned long cap) 2573 unsigned long cap)
2574{ 2574{
2575 switch (cap) {
2576 case IOMMU_CAP_CACHE_COHERENCY:
2577 return 1;
2578 }
2579
2575 return 0; 2580 return 0;
2576} 2581}
2577 2582
@@ -2609,8 +2614,7 @@ int __init amd_iommu_init_passthrough(void)
2609 2614
2610 pt_domain->mode |= PAGE_MODE_NONE; 2615 pt_domain->mode |= PAGE_MODE_NONE;
2611 2616
2612 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { 2617 for_each_pci_dev(dev) {
2613
2614 if (!check_device(&dev->dev)) 2618 if (!check_device(&dev->dev))
2615 continue; 2619 continue;
2616 2620
diff --git a/arch/x86/kernel/apb_timer.c b/arch/x86/kernel/apb_timer.c
index a35347501d36..8dd77800ff5d 100644
--- a/arch/x86/kernel/apb_timer.c
+++ b/arch/x86/kernel/apb_timer.c
@@ -43,10 +43,11 @@
43 43
44#include <asm/fixmap.h> 44#include <asm/fixmap.h>
45#include <asm/apb_timer.h> 45#include <asm/apb_timer.h>
46#include <asm/mrst.h>
46 47
47#define APBT_MASK CLOCKSOURCE_MASK(32) 48#define APBT_MASK CLOCKSOURCE_MASK(32)
48#define APBT_SHIFT 22 49#define APBT_SHIFT 22
49#define APBT_CLOCKEVENT_RATING 150 50#define APBT_CLOCKEVENT_RATING 110
50#define APBT_CLOCKSOURCE_RATING 250 51#define APBT_CLOCKSOURCE_RATING 250
51#define APBT_MIN_DELTA_USEC 200 52#define APBT_MIN_DELTA_USEC 200
52 53
@@ -83,8 +84,6 @@ struct apbt_dev {
83 char name[10]; 84 char name[10];
84}; 85};
85 86
86int disable_apbt_percpu __cpuinitdata;
87
88static DEFINE_PER_CPU(struct apbt_dev, cpu_apbt_dev); 87static DEFINE_PER_CPU(struct apbt_dev, cpu_apbt_dev);
89 88
90#ifdef CONFIG_SMP 89#ifdef CONFIG_SMP
@@ -195,29 +194,6 @@ static struct clock_event_device apbt_clockevent = {
195}; 194};
196 195
197/* 196/*
198 * if user does not want to use per CPU apb timer, just give it a lower rating
199 * than local apic timer and skip the late per cpu timer init.
200 */
201static inline int __init setup_x86_mrst_timer(char *arg)
202{
203 if (!arg)
204 return -EINVAL;
205
206 if (strcmp("apbt_only", arg) == 0)
207 disable_apbt_percpu = 0;
208 else if (strcmp("lapic_and_apbt", arg) == 0)
209 disable_apbt_percpu = 1;
210 else {
211 pr_warning("X86 MRST timer option %s not recognised"
212 " use x86_mrst_timer=apbt_only or lapic_and_apbt\n",
213 arg);
214 return -EINVAL;
215 }
216 return 0;
217}
218__setup("x86_mrst_timer=", setup_x86_mrst_timer);
219
220/*
221 * start count down from 0xffff_ffff. this is done by toggling the enable bit 197 * start count down from 0xffff_ffff. this is done by toggling the enable bit
222 * then load initial load count to ~0. 198 * then load initial load count to ~0.
223 */ 199 */
@@ -335,7 +311,7 @@ static int __init apbt_clockevent_register(void)
335 adev->num = smp_processor_id(); 311 adev->num = smp_processor_id();
336 memcpy(&adev->evt, &apbt_clockevent, sizeof(struct clock_event_device)); 312 memcpy(&adev->evt, &apbt_clockevent, sizeof(struct clock_event_device));
337 313
338 if (disable_apbt_percpu) { 314 if (mrst_timer_options == MRST_TIMER_LAPIC_APBT) {
339 apbt_clockevent.rating = APBT_CLOCKEVENT_RATING - 100; 315 apbt_clockevent.rating = APBT_CLOCKEVENT_RATING - 100;
340 global_clock_event = &adev->evt; 316 global_clock_event = &adev->evt;
341 printk(KERN_DEBUG "%s clockevent registered as global\n", 317 printk(KERN_DEBUG "%s clockevent registered as global\n",
@@ -429,7 +405,8 @@ static int apbt_cpuhp_notify(struct notifier_block *n,
429 405
430static __init int apbt_late_init(void) 406static __init int apbt_late_init(void)
431{ 407{
432 if (disable_apbt_percpu || !apb_timer_block_enabled) 408 if (mrst_timer_options == MRST_TIMER_LAPIC_APBT ||
409 !apb_timer_block_enabled)
433 return 0; 410 return 0;
434 /* This notifier should be called after workqueue is ready */ 411 /* This notifier should be called after workqueue is ready */
435 hotcpu_notifier(apbt_cpuhp_notify, -20); 412 hotcpu_notifier(apbt_cpuhp_notify, -20);
@@ -450,6 +427,8 @@ static void apbt_set_mode(enum clock_event_mode mode,
450 int timer_num; 427 int timer_num;
451 struct apbt_dev *adev = EVT_TO_APBT_DEV(evt); 428 struct apbt_dev *adev = EVT_TO_APBT_DEV(evt);
452 429
430 BUG_ON(!apbt_virt_address);
431
453 timer_num = adev->num; 432 timer_num = adev->num;
454 pr_debug("%s CPU %d timer %d mode=%d\n", 433 pr_debug("%s CPU %d timer %d mode=%d\n",
455 __func__, first_cpu(*evt->cpumask), timer_num, mode); 434 __func__, first_cpu(*evt->cpumask), timer_num, mode);
@@ -676,7 +655,7 @@ void __init apbt_time_init(void)
676 } 655 }
677#ifdef CONFIG_SMP 656#ifdef CONFIG_SMP
678 /* kernel cmdline disable apb timer, so we will use lapic timers */ 657 /* kernel cmdline disable apb timer, so we will use lapic timers */
679 if (disable_apbt_percpu) { 658 if (mrst_timer_options == MRST_TIMER_LAPIC_APBT) {
680 printk(KERN_INFO "apbt: disabled per cpu timer\n"); 659 printk(KERN_INFO "apbt: disabled per cpu timer\n");
681 return; 660 return;
682 } 661 }
diff --git a/arch/x86/kernel/aperture_64.c b/arch/x86/kernel/aperture_64.c
index b5d8b0bcf235..a2e0caf26e17 100644
--- a/arch/x86/kernel/aperture_64.c
+++ b/arch/x86/kernel/aperture_64.c
@@ -280,7 +280,7 @@ void __init early_gart_iommu_check(void)
280 * or BIOS forget to put that in reserved. 280 * or BIOS forget to put that in reserved.
281 * try to update e820 to make that region as reserved. 281 * try to update e820 to make that region as reserved.
282 */ 282 */
283 u32 agp_aper_base = 0, agp_aper_order = 0; 283 u32 agp_aper_order = 0;
284 int i, fix, slot, valid_agp = 0; 284 int i, fix, slot, valid_agp = 0;
285 u32 ctl; 285 u32 ctl;
286 u32 aper_size = 0, aper_order = 0, last_aper_order = 0; 286 u32 aper_size = 0, aper_order = 0, last_aper_order = 0;
@@ -291,7 +291,7 @@ void __init early_gart_iommu_check(void)
291 return; 291 return;
292 292
293 /* This is mostly duplicate of iommu_hole_init */ 293 /* This is mostly duplicate of iommu_hole_init */
294 agp_aper_base = search_agp_bridge(&agp_aper_order, &valid_agp); 294 search_agp_bridge(&agp_aper_order, &valid_agp);
295 295
296 fix = 0; 296 fix = 0;
297 for (i = 0; i < ARRAY_SIZE(bus_dev_ranges); i++) { 297 for (i = 0; i < ARRAY_SIZE(bus_dev_ranges); i++) {
diff --git a/arch/x86/kernel/apic/Makefile b/arch/x86/kernel/apic/Makefile
index 565c1bfc507d..910f20b457c4 100644
--- a/arch/x86/kernel/apic/Makefile
+++ b/arch/x86/kernel/apic/Makefile
@@ -2,7 +2,12 @@
2# Makefile for local APIC drivers and for the IO-APIC code 2# Makefile for local APIC drivers and for the IO-APIC code
3# 3#
4 4
5obj-$(CONFIG_X86_LOCAL_APIC) += apic.o apic_noop.o probe_$(BITS).o ipi.o nmi.o 5obj-$(CONFIG_X86_LOCAL_APIC) += apic.o apic_noop.o probe_$(BITS).o ipi.o
6ifneq ($(CONFIG_HARDLOCKUP_DETECTOR),y)
7obj-$(CONFIG_X86_LOCAL_APIC) += nmi.o
8endif
9obj-$(CONFIG_HARDLOCKUP_DETECTOR) += hw_nmi.o
10
6obj-$(CONFIG_X86_IO_APIC) += io_apic.o 11obj-$(CONFIG_X86_IO_APIC) += io_apic.o
7obj-$(CONFIG_SMP) += ipi.o 12obj-$(CONFIG_SMP) += ipi.o
8 13
diff --git a/arch/x86/kernel/apic/apic.c b/arch/x86/kernel/apic/apic.c
index a96489ee6cab..980508c79082 100644
--- a/arch/x86/kernel/apic/apic.c
+++ b/arch/x86/kernel/apic/apic.c
@@ -460,7 +460,7 @@ static void lapic_timer_broadcast(const struct cpumask *mask)
460} 460}
461 461
462/* 462/*
463 * Setup the local APIC timer for this CPU. Copy the initilized values 463 * Setup the local APIC timer for this CPU. Copy the initialized values
464 * of the boot CPU and register the clock event in the framework. 464 * of the boot CPU and register the clock event in the framework.
465 */ 465 */
466static void __cpuinit setup_APIC_timer(void) 466static void __cpuinit setup_APIC_timer(void)
diff --git a/arch/x86/kernel/apic/hw_nmi.c b/arch/x86/kernel/apic/hw_nmi.c
new file mode 100644
index 000000000000..cefd6942f0e9
--- /dev/null
+++ b/arch/x86/kernel/apic/hw_nmi.c
@@ -0,0 +1,107 @@
1/*
2 * HW NMI watchdog support
3 *
4 * started by Don Zickus, Copyright (C) 2010 Red Hat, Inc.
5 *
6 * Arch specific calls to support NMI watchdog
7 *
8 * Bits copied from original nmi.c file
9 *
10 */
11#include <asm/apic.h>
12
13#include <linux/cpumask.h>
14#include <linux/kdebug.h>
15#include <linux/notifier.h>
16#include <linux/kprobes.h>
17#include <linux/nmi.h>
18#include <linux/module.h>
19
20/* For reliability, we're prepared to waste bits here. */
21static DECLARE_BITMAP(backtrace_mask, NR_CPUS) __read_mostly;
22
23u64 hw_nmi_get_sample_period(void)
24{
25 return (u64)(cpu_khz) * 1000 * 60;
26}
27
28#ifdef ARCH_HAS_NMI_WATCHDOG
29void arch_trigger_all_cpu_backtrace(void)
30{
31 int i;
32
33 cpumask_copy(to_cpumask(backtrace_mask), cpu_online_mask);
34
35 printk(KERN_INFO "sending NMI to all CPUs:\n");
36 apic->send_IPI_all(NMI_VECTOR);
37
38 /* Wait for up to 10 seconds for all CPUs to do the backtrace */
39 for (i = 0; i < 10 * 1000; i++) {
40 if (cpumask_empty(to_cpumask(backtrace_mask)))
41 break;
42 mdelay(1);
43 }
44}
45
46static int __kprobes
47arch_trigger_all_cpu_backtrace_handler(struct notifier_block *self,
48 unsigned long cmd, void *__args)
49{
50 struct die_args *args = __args;
51 struct pt_regs *regs;
52 int cpu = smp_processor_id();
53
54 switch (cmd) {
55 case DIE_NMI:
56 case DIE_NMI_IPI:
57 break;
58
59 default:
60 return NOTIFY_DONE;
61 }
62
63 regs = args->regs;
64
65 if (cpumask_test_cpu(cpu, to_cpumask(backtrace_mask))) {
66 static arch_spinlock_t lock = __ARCH_SPIN_LOCK_UNLOCKED;
67
68 arch_spin_lock(&lock);
69 printk(KERN_WARNING "NMI backtrace for cpu %d\n", cpu);
70 show_regs(regs);
71 dump_stack();
72 arch_spin_unlock(&lock);
73 cpumask_clear_cpu(cpu, to_cpumask(backtrace_mask));
74 return NOTIFY_STOP;
75 }
76
77 return NOTIFY_DONE;
78}
79
80static __read_mostly struct notifier_block backtrace_notifier = {
81 .notifier_call = arch_trigger_all_cpu_backtrace_handler,
82 .next = NULL,
83 .priority = 1
84};
85
86static int __init register_trigger_all_cpu_backtrace(void)
87{
88 register_die_notifier(&backtrace_notifier);
89 return 0;
90}
91early_initcall(register_trigger_all_cpu_backtrace);
92#endif
93
94/* STUB calls to mimic old nmi_watchdog behaviour */
95#if defined(CONFIG_X86_LOCAL_APIC)
96unsigned int nmi_watchdog = NMI_NONE;
97EXPORT_SYMBOL(nmi_watchdog);
98void acpi_nmi_enable(void) { return; }
99void acpi_nmi_disable(void) { return; }
100#endif
101atomic_t nmi_active = ATOMIC_INIT(0); /* oprofile uses this */
102EXPORT_SYMBOL(nmi_active);
103int unknown_nmi_panic;
104void cpu_nmi_set_wd_enabled(void) { return; }
105void stop_apic_nmi_watchdog(void *unused) { return; }
106void setup_apic_nmi_watchdog(void *unused) { return; }
107int __init check_nmi_watchdog(void) { return 0; }
diff --git a/arch/x86/kernel/apic/io_apic.c b/arch/x86/kernel/apic/io_apic.c
index e41ed24ab26d..4dc0084ec1b1 100644
--- a/arch/x86/kernel/apic/io_apic.c
+++ b/arch/x86/kernel/apic/io_apic.c
@@ -3397,7 +3397,7 @@ static int set_msi_irq_affinity(unsigned int irq, const struct cpumask *mask)
3397 3397
3398 cfg = desc->chip_data; 3398 cfg = desc->chip_data;
3399 3399
3400 read_msi_msg_desc(desc, &msg); 3400 get_cached_msi_msg_desc(desc, &msg);
3401 3401
3402 msg.data &= ~MSI_DATA_VECTOR_MASK; 3402 msg.data &= ~MSI_DATA_VECTOR_MASK;
3403 msg.data |= MSI_DATA_VECTOR(cfg->vector); 3403 msg.data |= MSI_DATA_VECTOR(cfg->vector);
diff --git a/arch/x86/kernel/apic/nmi.c b/arch/x86/kernel/apic/nmi.c
index 1edaf15c0b8e..a43f71cb30f8 100644
--- a/arch/x86/kernel/apic/nmi.c
+++ b/arch/x86/kernel/apic/nmi.c
@@ -401,13 +401,6 @@ nmi_watchdog_tick(struct pt_regs *regs, unsigned reason)
401 int cpu = smp_processor_id(); 401 int cpu = smp_processor_id();
402 int rc = 0; 402 int rc = 0;
403 403
404 /* check for other users first */
405 if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT)
406 == NOTIFY_STOP) {
407 rc = 1;
408 touched = 1;
409 }
410
411 sum = get_timer_irqs(cpu); 404 sum = get_timer_irqs(cpu);
412 405
413 if (__get_cpu_var(nmi_touch)) { 406 if (__get_cpu_var(nmi_touch)) {
diff --git a/arch/x86/kernel/apm_32.c b/arch/x86/kernel/apm_32.c
index c4f9182ca3ac..4c9c67bf09b7 100644
--- a/arch/x86/kernel/apm_32.c
+++ b/arch/x86/kernel/apm_32.c
@@ -140,7 +140,7 @@
140 * is now the way life works). 140 * is now the way life works).
141 * Fix thinko in suspend() (wrong return). 141 * Fix thinko in suspend() (wrong return).
142 * Notify drivers on critical suspend. 142 * Notify drivers on critical suspend.
143 * Make kapmd absorb more idle time (Pavel Machek <pavel@suse.cz> 143 * Make kapmd absorb more idle time (Pavel Machek <pavel@ucw.cz>
144 * modified by sfr). 144 * modified by sfr).
145 * Disable interrupts while we are suspended (Andy Henroid 145 * Disable interrupts while we are suspended (Andy Henroid
146 * <andy_henroid@yahoo.com> fixed by sfr). 146 * <andy_henroid@yahoo.com> fixed by sfr).
diff --git a/arch/x86/kernel/cpu/Makefile b/arch/x86/kernel/cpu/Makefile
index 3a785da34b6f..3f0ebe429a01 100644
--- a/arch/x86/kernel/cpu/Makefile
+++ b/arch/x86/kernel/cpu/Makefile
@@ -12,11 +12,11 @@ endif
12nostackp := $(call cc-option, -fno-stack-protector) 12nostackp := $(call cc-option, -fno-stack-protector)
13CFLAGS_common.o := $(nostackp) 13CFLAGS_common.o := $(nostackp)
14 14
15obj-y := intel_cacheinfo.o addon_cpuid_features.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
18 18
19obj-$(CONFIG_X86_32) += bugs.o cmpxchg.o 19obj-$(CONFIG_X86_32) += bugs.o
20obj-$(CONFIG_X86_64) += bugs_64.o 20obj-$(CONFIG_X86_64) += bugs_64.o
21 21
22obj-$(CONFIG_CPU_SUP_INTEL) += intel.o 22obj-$(CONFIG_CPU_SUP_INTEL) += intel.o
diff --git a/arch/x86/kernel/cpu/amd.c b/arch/x86/kernel/cpu/amd.c
index e485825130d2..60a57b13082d 100644
--- a/arch/x86/kernel/cpu/amd.c
+++ b/arch/x86/kernel/cpu/amd.c
@@ -466,7 +466,7 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
466 } 466 }
467 467
468 } 468 }
469 if (c->x86 == 0x10 || c->x86 == 0x11) 469 if (c->x86 >= 0x10)
470 set_cpu_cap(c, X86_FEATURE_REP_GOOD); 470 set_cpu_cap(c, X86_FEATURE_REP_GOOD);
471 471
472 /* get apicid instead of initial apic id from cpuid */ 472 /* get apicid instead of initial apic id from cpuid */
@@ -529,7 +529,7 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
529 num_cache_leaves = 3; 529 num_cache_leaves = 3;
530 } 530 }
531 531
532 if (c->x86 >= 0xf && c->x86 <= 0x11) 532 if (c->x86 >= 0xf)
533 set_cpu_cap(c, X86_FEATURE_K8); 533 set_cpu_cap(c, X86_FEATURE_K8);
534 534
535 if (cpu_has_xmm2) { 535 if (cpu_has_xmm2) {
@@ -546,7 +546,7 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
546 fam10h_check_enable_mmcfg(); 546 fam10h_check_enable_mmcfg();
547 } 547 }
548 548
549 if (c == &boot_cpu_data && c->x86 >= 0xf && c->x86 <= 0x11) { 549 if (c == &boot_cpu_data && c->x86 >= 0xf) {
550 unsigned long long tseg; 550 unsigned long long tseg;
551 551
552 /* 552 /*
@@ -609,3 +609,74 @@ static const struct cpu_dev __cpuinitconst amd_cpu_dev = {
609}; 609};
610 610
611cpu_dev_register(amd_cpu_dev); 611cpu_dev_register(amd_cpu_dev);
612
613/*
614 * AMD errata checking
615 *
616 * Errata are defined as arrays of ints using the AMD_LEGACY_ERRATUM() or
617 * AMD_OSVW_ERRATUM() macros. The latter is intended for newer errata that
618 * have an OSVW id assigned, which it takes as first argument. Both take a
619 * variable number of family-specific model-stepping ranges created by
620 * AMD_MODEL_RANGE(). Each erratum also has to be declared as extern const
621 * int[] in arch/x86/include/asm/processor.h.
622 *
623 * Example:
624 *
625 * const int amd_erratum_319[] =
626 * AMD_LEGACY_ERRATUM(AMD_MODEL_RANGE(0x10, 0x2, 0x1, 0x4, 0x2),
627 * AMD_MODEL_RANGE(0x10, 0x8, 0x0, 0x8, 0x0),
628 * AMD_MODEL_RANGE(0x10, 0x9, 0x0, 0x9, 0x0));
629 */
630
631const int amd_erratum_400[] =
632 AMD_OSVW_ERRATUM(1, AMD_MODEL_RANGE(0xf, 0x41, 0x2, 0xff, 0xf),
633 AMD_MODEL_RANGE(0x10, 0x2, 0x1, 0xff, 0xf));
634EXPORT_SYMBOL_GPL(amd_erratum_400);
635
636const int amd_erratum_383[] =
637 AMD_OSVW_ERRATUM(3, AMD_MODEL_RANGE(0x10, 0, 0, 0xff, 0xf));
638EXPORT_SYMBOL_GPL(amd_erratum_383);
639
640bool cpu_has_amd_erratum(const int *erratum)
641{
642 struct cpuinfo_x86 *cpu = &current_cpu_data;
643 int osvw_id = *erratum++;
644 u32 range;
645 u32 ms;
646
647 /*
648 * If called early enough that current_cpu_data hasn't been initialized
649 * yet, fall back to boot_cpu_data.
650 */
651 if (cpu->x86 == 0)
652 cpu = &boot_cpu_data;
653
654 if (cpu->x86_vendor != X86_VENDOR_AMD)
655 return false;
656
657 if (osvw_id >= 0 && osvw_id < 65536 &&
658 cpu_has(cpu, X86_FEATURE_OSVW)) {
659 u64 osvw_len;
660
661 rdmsrl(MSR_AMD64_OSVW_ID_LENGTH, osvw_len);
662 if (osvw_id < osvw_len) {
663 u64 osvw_bits;
664
665 rdmsrl(MSR_AMD64_OSVW_STATUS + (osvw_id >> 6),
666 osvw_bits);
667 return osvw_bits & (1ULL << (osvw_id & 0x3f));
668 }
669 }
670
671 /* OSVW unavailable or ID unknown, match family-model-stepping range */
672 ms = (cpu->x86_model << 8) | cpu->x86_mask;
673 while ((range = *erratum++))
674 if ((cpu->x86 == AMD_MODEL_RANGE_FAMILY(range)) &&
675 (ms >= AMD_MODEL_RANGE_START(range)) &&
676 (ms <= AMD_MODEL_RANGE_END(range)))
677 return true;
678
679 return false;
680}
681
682EXPORT_SYMBOL_GPL(cpu_has_amd_erratum);
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 68e4a6f2211e..f10273138382 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -551,6 +551,16 @@ static void __cpuinit get_cpu_cap(struct cpuinfo_x86 *c)
551 c->x86_capability[4] = excap; 551 c->x86_capability[4] = excap;
552 } 552 }
553 553
554 /* Additional Intel-defined flags: level 0x00000007 */
555 if (c->cpuid_level >= 0x00000007) {
556 u32 eax, ebx, ecx, edx;
557
558 cpuid_count(0x00000007, 0, &eax, &ebx, &ecx, &edx);
559
560 if (eax > 0)
561 c->x86_capability[9] = ebx;
562 }
563
554 /* AMD-defined flags: level 0x80000001 */ 564 /* AMD-defined flags: level 0x80000001 */
555 xlvl = cpuid_eax(0x80000000); 565 xlvl = cpuid_eax(0x80000000);
556 c->extended_cpuid_level = xlvl; 566 c->extended_cpuid_level = xlvl;
@@ -576,6 +586,7 @@ static void __cpuinit get_cpu_cap(struct cpuinfo_x86 *c)
576 if (c->extended_cpuid_level >= 0x80000007) 586 if (c->extended_cpuid_level >= 0x80000007)
577 c->x86_power = cpuid_edx(0x80000007); 587 c->x86_power = cpuid_edx(0x80000007);
578 588
589 init_scattered_cpuid_features(c);
579} 590}
580 591
581static void __cpuinit identify_cpu_without_cpuid(struct cpuinfo_x86 *c) 592static void __cpuinit identify_cpu_without_cpuid(struct cpuinfo_x86 *c)
@@ -731,7 +742,6 @@ static void __cpuinit generic_identify(struct cpuinfo_x86 *c)
731 742
732 get_model_name(c); /* Default name */ 743 get_model_name(c); /* Default name */
733 744
734 init_scattered_cpuid_features(c);
735 detect_nopl(c); 745 detect_nopl(c);
736} 746}
737 747
diff --git a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
index 1d3cddaa40ee..246cd3afbb5f 100644
--- a/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
+++ b/arch/x86/kernel/cpu/cpufreq/acpi-cpufreq.c
@@ -34,7 +34,6 @@
34#include <linux/compiler.h> 34#include <linux/compiler.h>
35#include <linux/dmi.h> 35#include <linux/dmi.h>
36#include <linux/slab.h> 36#include <linux/slab.h>
37#include <trace/events/power.h>
38 37
39#include <linux/acpi.h> 38#include <linux/acpi.h>
40#include <linux/io.h> 39#include <linux/io.h>
@@ -324,8 +323,6 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy,
324 } 323 }
325 } 324 }
326 325
327 trace_power_frequency(POWER_PSTATE, data->freq_table[next_state].frequency);
328
329 switch (data->cpu_feature) { 326 switch (data->cpu_feature) {
330 case SYSTEM_INTEL_MSR_CAPABLE: 327 case SYSTEM_INTEL_MSR_CAPABLE:
331 cmd.type = SYSTEM_INTEL_MSR_CAPABLE; 328 cmd.type = SYSTEM_INTEL_MSR_CAPABLE;
@@ -351,7 +348,7 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy,
351 348
352 freqs.old = perf->states[perf->state].core_frequency * 1000; 349 freqs.old = perf->states[perf->state].core_frequency * 1000;
353 freqs.new = data->freq_table[next_state].frequency; 350 freqs.new = data->freq_table[next_state].frequency;
354 for_each_cpu(i, cmd.mask) { 351 for_each_cpu(i, policy->cpus) {
355 freqs.cpu = i; 352 freqs.cpu = i;
356 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE); 353 cpufreq_notify_transition(&freqs, CPUFREQ_PRECHANGE);
357 } 354 }
@@ -367,7 +364,7 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy,
367 } 364 }
368 } 365 }
369 366
370 for_each_cpu(i, cmd.mask) { 367 for_each_cpu(i, policy->cpus) {
371 freqs.cpu = i; 368 freqs.cpu = i;
372 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE); 369 cpufreq_notify_transition(&freqs, CPUFREQ_POSTCHANGE);
373 } 370 }
diff --git a/arch/x86/kernel/cpu/cpufreq/gx-suspmod.c b/arch/x86/kernel/cpu/cpufreq/gx-suspmod.c
index 16e3483be9e3..32974cf84232 100644
--- a/arch/x86/kernel/cpu/cpufreq/gx-suspmod.c
+++ b/arch/x86/kernel/cpu/cpufreq/gx-suspmod.c
@@ -169,12 +169,9 @@ static int gx_freq_mult[16] = {
169 * Low Level chipset interface * 169 * Low Level chipset interface *
170 ****************************************************************/ 170 ****************************************************************/
171static struct pci_device_id gx_chipset_tbl[] __initdata = { 171static struct pci_device_id gx_chipset_tbl[] __initdata = {
172 { PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY, 172 { PCI_VDEVICE(CYRIX, PCI_DEVICE_ID_CYRIX_5530_LEGACY), },
173 PCI_ANY_ID, PCI_ANY_ID }, 173 { PCI_VDEVICE(CYRIX, PCI_DEVICE_ID_CYRIX_5520), },
174 { PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5520, 174 { PCI_VDEVICE(CYRIX, PCI_DEVICE_ID_CYRIX_5510), },
175 PCI_ANY_ID, PCI_ANY_ID },
176 { PCI_VENDOR_ID_CYRIX, PCI_DEVICE_ID_CYRIX_5510,
177 PCI_ANY_ID, PCI_ANY_ID },
178 { 0, }, 175 { 0, },
179}; 176};
180 177
@@ -199,7 +196,7 @@ static __init struct pci_dev *gx_detect_chipset(void)
199 } 196 }
200 197
201 /* detect which companion chip is used */ 198 /* detect which companion chip is used */
202 while ((gx_pci = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, gx_pci)) != NULL) { 199 for_each_pci_dev(gx_pci) {
203 if ((pci_match_id(gx_chipset_tbl, gx_pci)) != NULL) 200 if ((pci_match_id(gx_chipset_tbl, gx_pci)) != NULL)
204 return gx_pci; 201 return gx_pci;
205 } 202 }
diff --git a/arch/x86/kernel/cpu/cpufreq/longhaul.c b/arch/x86/kernel/cpu/cpufreq/longhaul.c
index 7e7eea4f8261..03162dac6271 100644
--- a/arch/x86/kernel/cpu/cpufreq/longhaul.c
+++ b/arch/x86/kernel/cpu/cpufreq/longhaul.c
@@ -426,7 +426,7 @@ static int guess_fsb(int mult)
426} 426}
427 427
428 428
429static int __init longhaul_get_ranges(void) 429static int __cpuinit longhaul_get_ranges(void)
430{ 430{
431 unsigned int i, j, k = 0; 431 unsigned int i, j, k = 0;
432 unsigned int ratio; 432 unsigned int ratio;
@@ -530,7 +530,7 @@ static int __init longhaul_get_ranges(void)
530} 530}
531 531
532 532
533static void __init longhaul_setup_voltagescaling(void) 533static void __cpuinit longhaul_setup_voltagescaling(void)
534{ 534{
535 union msr_longhaul longhaul; 535 union msr_longhaul longhaul;
536 struct mV_pos minvid, maxvid, vid; 536 struct mV_pos minvid, maxvid, vid;
@@ -784,7 +784,7 @@ static int longhaul_setup_southbridge(void)
784 return 0; 784 return 0;
785} 785}
786 786
787static int __init longhaul_cpu_init(struct cpufreq_policy *policy) 787static int __cpuinit longhaul_cpu_init(struct cpufreq_policy *policy)
788{ 788{
789 struct cpuinfo_x86 *c = &cpu_data(0); 789 struct cpuinfo_x86 *c = &cpu_data(0);
790 char *cpuname = NULL; 790 char *cpuname = NULL;
diff --git a/arch/x86/kernel/cpu/cpufreq/longhaul.h b/arch/x86/kernel/cpu/cpufreq/longhaul.h
index e2360a469f79..cbf48fbca881 100644
--- a/arch/x86/kernel/cpu/cpufreq/longhaul.h
+++ b/arch/x86/kernel/cpu/cpufreq/longhaul.h
@@ -56,7 +56,7 @@ union msr_longhaul {
56/* 56/*
57 * VIA C3 Samuel 1 & Samuel 2 (stepping 0) 57 * VIA C3 Samuel 1 & Samuel 2 (stepping 0)
58 */ 58 */
59static const int __initdata samuel1_mults[16] = { 59static const int __cpuinitdata samuel1_mults[16] = {
60 -1, /* 0000 -> RESERVED */ 60 -1, /* 0000 -> RESERVED */
61 30, /* 0001 -> 3.0x */ 61 30, /* 0001 -> 3.0x */
62 40, /* 0010 -> 4.0x */ 62 40, /* 0010 -> 4.0x */
@@ -75,7 +75,7 @@ static const int __initdata samuel1_mults[16] = {
75 -1, /* 1111 -> RESERVED */ 75 -1, /* 1111 -> RESERVED */
76}; 76};
77 77
78static const int __initdata samuel1_eblcr[16] = { 78static const int __cpuinitdata samuel1_eblcr[16] = {
79 50, /* 0000 -> RESERVED */ 79 50, /* 0000 -> RESERVED */
80 30, /* 0001 -> 3.0x */ 80 30, /* 0001 -> 3.0x */
81 40, /* 0010 -> 4.0x */ 81 40, /* 0010 -> 4.0x */
@@ -97,7 +97,7 @@ static const int __initdata samuel1_eblcr[16] = {
97/* 97/*
98 * VIA C3 Samuel2 Stepping 1->15 98 * VIA C3 Samuel2 Stepping 1->15
99 */ 99 */
100static const int __initdata samuel2_eblcr[16] = { 100static const int __cpuinitdata samuel2_eblcr[16] = {
101 50, /* 0000 -> 5.0x */ 101 50, /* 0000 -> 5.0x */
102 30, /* 0001 -> 3.0x */ 102 30, /* 0001 -> 3.0x */
103 40, /* 0010 -> 4.0x */ 103 40, /* 0010 -> 4.0x */
@@ -119,7 +119,7 @@ static const int __initdata samuel2_eblcr[16] = {
119/* 119/*
120 * VIA C3 Ezra 120 * VIA C3 Ezra
121 */ 121 */
122static const int __initdata ezra_mults[16] = { 122static const int __cpuinitdata ezra_mults[16] = {
123 100, /* 0000 -> 10.0x */ 123 100, /* 0000 -> 10.0x */
124 30, /* 0001 -> 3.0x */ 124 30, /* 0001 -> 3.0x */
125 40, /* 0010 -> 4.0x */ 125 40, /* 0010 -> 4.0x */
@@ -138,7 +138,7 @@ static const int __initdata ezra_mults[16] = {
138 120, /* 1111 -> 12.0x */ 138 120, /* 1111 -> 12.0x */
139}; 139};
140 140
141static const int __initdata ezra_eblcr[16] = { 141static const int __cpuinitdata ezra_eblcr[16] = {
142 50, /* 0000 -> 5.0x */ 142 50, /* 0000 -> 5.0x */
143 30, /* 0001 -> 3.0x */ 143 30, /* 0001 -> 3.0x */
144 40, /* 0010 -> 4.0x */ 144 40, /* 0010 -> 4.0x */
@@ -160,7 +160,7 @@ static const int __initdata ezra_eblcr[16] = {
160/* 160/*
161 * VIA C3 (Ezra-T) [C5M]. 161 * VIA C3 (Ezra-T) [C5M].
162 */ 162 */
163static const int __initdata ezrat_mults[32] = { 163static const int __cpuinitdata ezrat_mults[32] = {
164 100, /* 0000 -> 10.0x */ 164 100, /* 0000 -> 10.0x */
165 30, /* 0001 -> 3.0x */ 165 30, /* 0001 -> 3.0x */
166 40, /* 0010 -> 4.0x */ 166 40, /* 0010 -> 4.0x */
@@ -196,7 +196,7 @@ static const int __initdata ezrat_mults[32] = {
196 -1, /* 1111 -> RESERVED (12.0x) */ 196 -1, /* 1111 -> RESERVED (12.0x) */
197}; 197};
198 198
199static const int __initdata ezrat_eblcr[32] = { 199static const int __cpuinitdata ezrat_eblcr[32] = {
200 50, /* 0000 -> 5.0x */ 200 50, /* 0000 -> 5.0x */
201 30, /* 0001 -> 3.0x */ 201 30, /* 0001 -> 3.0x */
202 40, /* 0010 -> 4.0x */ 202 40, /* 0010 -> 4.0x */
@@ -235,7 +235,7 @@ static const int __initdata ezrat_eblcr[32] = {
235/* 235/*
236 * VIA C3 Nehemiah */ 236 * VIA C3 Nehemiah */
237 237
238static const int __initdata nehemiah_mults[32] = { 238static const int __cpuinitdata nehemiah_mults[32] = {
239 100, /* 0000 -> 10.0x */ 239 100, /* 0000 -> 10.0x */
240 -1, /* 0001 -> 16.0x */ 240 -1, /* 0001 -> 16.0x */
241 40, /* 0010 -> 4.0x */ 241 40, /* 0010 -> 4.0x */
@@ -270,7 +270,7 @@ static const int __initdata nehemiah_mults[32] = {
270 -1, /* 1111 -> 12.0x */ 270 -1, /* 1111 -> 12.0x */
271}; 271};
272 272
273static const int __initdata nehemiah_eblcr[32] = { 273static const int __cpuinitdata nehemiah_eblcr[32] = {
274 50, /* 0000 -> 5.0x */ 274 50, /* 0000 -> 5.0x */
275 160, /* 0001 -> 16.0x */ 275 160, /* 0001 -> 16.0x */
276 40, /* 0010 -> 4.0x */ 276 40, /* 0010 -> 4.0x */
@@ -315,7 +315,7 @@ struct mV_pos {
315 unsigned short pos; 315 unsigned short pos;
316}; 316};
317 317
318static const struct mV_pos __initdata vrm85_mV[32] = { 318static const struct mV_pos __cpuinitdata vrm85_mV[32] = {
319 {1250, 8}, {1200, 6}, {1150, 4}, {1100, 2}, 319 {1250, 8}, {1200, 6}, {1150, 4}, {1100, 2},
320 {1050, 0}, {1800, 30}, {1750, 28}, {1700, 26}, 320 {1050, 0}, {1800, 30}, {1750, 28}, {1700, 26},
321 {1650, 24}, {1600, 22}, {1550, 20}, {1500, 18}, 321 {1650, 24}, {1600, 22}, {1550, 20}, {1500, 18},
@@ -326,14 +326,14 @@ static const struct mV_pos __initdata vrm85_mV[32] = {
326 {1475, 17}, {1425, 15}, {1375, 13}, {1325, 11} 326 {1475, 17}, {1425, 15}, {1375, 13}, {1325, 11}
327}; 327};
328 328
329static const unsigned char __initdata mV_vrm85[32] = { 329static const unsigned char __cpuinitdata mV_vrm85[32] = {
330 0x04, 0x14, 0x03, 0x13, 0x02, 0x12, 0x01, 0x11, 330 0x04, 0x14, 0x03, 0x13, 0x02, 0x12, 0x01, 0x11,
331 0x00, 0x10, 0x0f, 0x1f, 0x0e, 0x1e, 0x0d, 0x1d, 331 0x00, 0x10, 0x0f, 0x1f, 0x0e, 0x1e, 0x0d, 0x1d,
332 0x0c, 0x1c, 0x0b, 0x1b, 0x0a, 0x1a, 0x09, 0x19, 332 0x0c, 0x1c, 0x0b, 0x1b, 0x0a, 0x1a, 0x09, 0x19,
333 0x08, 0x18, 0x07, 0x17, 0x06, 0x16, 0x05, 0x15 333 0x08, 0x18, 0x07, 0x17, 0x06, 0x16, 0x05, 0x15
334}; 334};
335 335
336static const struct mV_pos __initdata mobilevrm_mV[32] = { 336static const struct mV_pos __cpuinitdata mobilevrm_mV[32] = {
337 {1750, 31}, {1700, 30}, {1650, 29}, {1600, 28}, 337 {1750, 31}, {1700, 30}, {1650, 29}, {1600, 28},
338 {1550, 27}, {1500, 26}, {1450, 25}, {1400, 24}, 338 {1550, 27}, {1500, 26}, {1450, 25}, {1400, 24},
339 {1350, 23}, {1300, 22}, {1250, 21}, {1200, 20}, 339 {1350, 23}, {1300, 22}, {1250, 21}, {1200, 20},
@@ -344,7 +344,7 @@ static const struct mV_pos __initdata mobilevrm_mV[32] = {
344 {675, 3}, {650, 2}, {625, 1}, {600, 0} 344 {675, 3}, {650, 2}, {625, 1}, {600, 0}
345}; 345};
346 346
347static const unsigned char __initdata mV_mobilevrm[32] = { 347static const unsigned char __cpuinitdata mV_mobilevrm[32] = {
348 0x1f, 0x1e, 0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18, 348 0x1f, 0x1e, 0x1d, 0x1c, 0x1b, 0x1a, 0x19, 0x18,
349 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10, 349 0x17, 0x16, 0x15, 0x14, 0x13, 0x12, 0x11, 0x10,
350 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08, 350 0x0f, 0x0e, 0x0d, 0x0c, 0x0b, 0x0a, 0x09, 0x08,
diff --git a/arch/x86/kernel/cpu/cpufreq/longrun.c b/arch/x86/kernel/cpu/cpufreq/longrun.c
index e7b559d74c52..fc09f142d94d 100644
--- a/arch/x86/kernel/cpu/cpufreq/longrun.c
+++ b/arch/x86/kernel/cpu/cpufreq/longrun.c
@@ -165,8 +165,8 @@ static unsigned int longrun_get(unsigned int cpu)
165 * TMTA rules: 165 * TMTA rules:
166 * performance_pctg = (target_freq - low_freq)/(high_freq - low_freq) 166 * performance_pctg = (target_freq - low_freq)/(high_freq - low_freq)
167 */ 167 */
168static unsigned int __init longrun_determine_freqs(unsigned int *low_freq, 168static unsigned int __cpuinit longrun_determine_freqs(unsigned int *low_freq,
169 unsigned int *high_freq) 169 unsigned int *high_freq)
170{ 170{
171 u32 msr_lo, msr_hi; 171 u32 msr_lo, msr_hi;
172 u32 save_lo, save_hi; 172 u32 save_lo, save_hi;
@@ -258,7 +258,7 @@ static unsigned int __init longrun_determine_freqs(unsigned int *low_freq,
258} 258}
259 259
260 260
261static int __init longrun_cpu_init(struct cpufreq_policy *policy) 261static int __cpuinit longrun_cpu_init(struct cpufreq_policy *policy)
262{ 262{
263 int result = 0; 263 int result = 0;
264 264
diff --git a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
index 7b8a8ba67b07..bd1cac747f67 100644
--- a/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
+++ b/arch/x86/kernel/cpu/cpufreq/p4-clockmod.c
@@ -178,13 +178,8 @@ static unsigned int cpufreq_p4_get_frequency(struct cpuinfo_x86 *c)
178 } 178 }
179 } 179 }
180 180
181 if (c->x86 != 0xF) { 181 if (c->x86 != 0xF)
182 if (!cpu_has(c, X86_FEATURE_EST))
183 printk(KERN_WARNING PFX "Unknown CPU. "
184 "Please send an e-mail to "
185 "<cpufreq@vger.kernel.org>\n");
186 return 0; 182 return 0;
187 }
188 183
189 /* on P-4s, the TSC runs with constant frequency independent whether 184 /* on P-4s, the TSC runs with constant frequency independent whether
190 * throttling is active or not. */ 185 * throttling is active or not. */
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k7.c b/arch/x86/kernel/cpu/cpufreq/powernow-k7.c
index 9a97116f89e5..4a45fd6e41ba 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k7.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k7.c
@@ -569,7 +569,7 @@ static int powernow_verify(struct cpufreq_policy *policy)
569 * We will then get the same kind of behaviour already tested under 569 * We will then get the same kind of behaviour already tested under
570 * the "well-known" other OS. 570 * the "well-known" other OS.
571 */ 571 */
572static int __init fixup_sgtc(void) 572static int __cpuinit fixup_sgtc(void)
573{ 573{
574 unsigned int sgtc; 574 unsigned int sgtc;
575 unsigned int m; 575 unsigned int m;
@@ -603,7 +603,7 @@ static unsigned int powernow_get(unsigned int cpu)
603} 603}
604 604
605 605
606static int __init acer_cpufreq_pst(const struct dmi_system_id *d) 606static int __cpuinit acer_cpufreq_pst(const struct dmi_system_id *d)
607{ 607{
608 printk(KERN_WARNING PFX 608 printk(KERN_WARNING PFX
609 "%s laptop with broken PST tables in BIOS detected.\n", 609 "%s laptop with broken PST tables in BIOS detected.\n",
@@ -621,7 +621,7 @@ static int __init acer_cpufreq_pst(const struct dmi_system_id *d)
621 * A BIOS update is all that can save them. 621 * A BIOS update is all that can save them.
622 * Mention this, and disable cpufreq. 622 * Mention this, and disable cpufreq.
623 */ 623 */
624static struct dmi_system_id __initdata powernow_dmi_table[] = { 624static struct dmi_system_id __cpuinitdata powernow_dmi_table[] = {
625 { 625 {
626 .callback = acer_cpufreq_pst, 626 .callback = acer_cpufreq_pst,
627 .ident = "Acer Aspire", 627 .ident = "Acer Aspire",
@@ -633,7 +633,7 @@ static struct dmi_system_id __initdata powernow_dmi_table[] = {
633 { } 633 { }
634}; 634};
635 635
636static int __init powernow_cpu_init(struct cpufreq_policy *policy) 636static int __cpuinit powernow_cpu_init(struct cpufreq_policy *policy)
637{ 637{
638 union msr_fidvidstatus fidvidstatus; 638 union msr_fidvidstatus fidvidstatus;
639 int result; 639 int result;
diff --git a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
index 3e90cce3dc8b..491977baf6c0 100644
--- a/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
+++ b/arch/x86/kernel/cpu/cpufreq/powernow-k8.c
@@ -9,7 +9,7 @@
9 * Based on the powernow-k7.c module written by Dave Jones. 9 * Based on the powernow-k7.c module written by Dave Jones.
10 * (C) 2003 Dave Jones on behalf of SuSE Labs 10 * (C) 2003 Dave Jones on behalf of SuSE Labs
11 * (C) 2004 Dominik Brodowski <linux@brodo.de> 11 * (C) 2004 Dominik Brodowski <linux@brodo.de>
12 * (C) 2004 Pavel Machek <pavel@suse.cz> 12 * (C) 2004 Pavel Machek <pavel@ucw.cz>
13 * Licensed under the terms of the GNU GPL License version 2. 13 * Licensed under the terms of the GNU GPL License version 2.
14 * Based upon datasheets & sample CPUs kindly provided by AMD. 14 * Based upon datasheets & sample CPUs kindly provided by AMD.
15 * 15 *
@@ -806,6 +806,8 @@ static int find_psb_table(struct powernow_k8_data *data)
806 * www.amd.com 806 * www.amd.com
807 */ 807 */
808 printk(KERN_ERR FW_BUG PFX "No PSB or ACPI _PSS objects\n"); 808 printk(KERN_ERR FW_BUG PFX "No PSB or ACPI _PSS objects\n");
809 printk(KERN_ERR PFX "Make sure that your BIOS is up to date"
810 " and Cool'N'Quiet support is enabled in BIOS setup\n");
809 return -ENODEV; 811 return -ENODEV;
810} 812}
811 813
@@ -910,8 +912,8 @@ static int fill_powernow_table_pstate(struct powernow_k8_data *data,
910{ 912{
911 int i; 913 int i;
912 u32 hi = 0, lo = 0; 914 u32 hi = 0, lo = 0;
913 rdmsr(MSR_PSTATE_CUR_LIMIT, hi, lo); 915 rdmsr(MSR_PSTATE_CUR_LIMIT, lo, hi);
914 data->max_hw_pstate = (hi & HW_PSTATE_MAX_MASK) >> HW_PSTATE_MAX_SHIFT; 916 data->max_hw_pstate = (lo & HW_PSTATE_MAX_MASK) >> HW_PSTATE_MAX_SHIFT;
915 917
916 for (i = 0; i < data->acpi_data.state_count; i++) { 918 for (i = 0; i < data->acpi_data.state_count; i++) {
917 u32 index; 919 u32 index;
diff --git a/arch/x86/kernel/cpu/hypervisor.c b/arch/x86/kernel/cpu/hypervisor.c
index dd531cc56a8f..8095f8611f8a 100644
--- a/arch/x86/kernel/cpu/hypervisor.c
+++ b/arch/x86/kernel/cpu/hypervisor.c
@@ -34,6 +34,9 @@ static const __initconst struct hypervisor_x86 * const hypervisors[] =
34{ 34{
35 &x86_hyper_vmware, 35 &x86_hyper_vmware,
36 &x86_hyper_ms_hyperv, 36 &x86_hyper_ms_hyperv,
37#ifdef CONFIG_XEN_PVHVM
38 &x86_hyper_xen_hvm,
39#endif
37}; 40};
38 41
39const struct hypervisor_x86 *x86_hyper; 42const struct hypervisor_x86 *x86_hyper;
diff --git a/arch/x86/kernel/cpu/intel_cacheinfo.c b/arch/x86/kernel/cpu/intel_cacheinfo.c
index 33eae2062cf5..898c2f4eab88 100644
--- a/arch/x86/kernel/cpu/intel_cacheinfo.c
+++ b/arch/x86/kernel/cpu/intel_cacheinfo.c
@@ -347,8 +347,8 @@ static struct amd_l3_cache * __cpuinit amd_init_l3_cache(int node)
347 return l3; 347 return l3;
348} 348}
349 349
350static void __cpuinit 350static void __cpuinit amd_check_l3_disable(struct _cpuid4_info_regs *this_leaf,
351amd_check_l3_disable(int index, struct _cpuid4_info_regs *this_leaf) 351 int index)
352{ 352{
353 int node; 353 int node;
354 354
@@ -396,20 +396,39 @@ amd_check_l3_disable(int index, struct _cpuid4_info_regs *this_leaf)
396 this_leaf->l3 = l3_caches[node]; 396 this_leaf->l3 = l3_caches[node];
397} 397}
398 398
399/*
400 * check whether a slot used for disabling an L3 index is occupied.
401 * @l3: L3 cache descriptor
402 * @slot: slot number (0..1)
403 *
404 * @returns: the disabled index if used or negative value if slot free.
405 */
406int amd_get_l3_disable_slot(struct amd_l3_cache *l3, unsigned slot)
407{
408 unsigned int reg = 0;
409
410 pci_read_config_dword(l3->dev, 0x1BC + slot * 4, &reg);
411
412 /* check whether this slot is activated already */
413 if (reg & (3UL << 30))
414 return reg & 0xfff;
415
416 return -1;
417}
418
399static ssize_t show_cache_disable(struct _cpuid4_info *this_leaf, char *buf, 419static ssize_t show_cache_disable(struct _cpuid4_info *this_leaf, char *buf,
400 unsigned int slot) 420 unsigned int slot)
401{ 421{
402 struct pci_dev *dev = this_leaf->l3->dev; 422 int index;
403 unsigned int reg = 0;
404 423
405 if (!this_leaf->l3 || !this_leaf->l3->can_disable) 424 if (!this_leaf->l3 || !this_leaf->l3->can_disable)
406 return -EINVAL; 425 return -EINVAL;
407 426
408 if (!dev) 427 index = amd_get_l3_disable_slot(this_leaf->l3, slot);
409 return -EINVAL; 428 if (index >= 0)
429 return sprintf(buf, "%d\n", index);
410 430
411 pci_read_config_dword(dev, 0x1BC + slot * 4, &reg); 431 return sprintf(buf, "FREE\n");
412 return sprintf(buf, "0x%08x\n", reg);
413} 432}
414 433
415#define SHOW_CACHE_DISABLE(slot) \ 434#define SHOW_CACHE_DISABLE(slot) \
@@ -451,37 +470,74 @@ static void amd_l3_disable_index(struct amd_l3_cache *l3, int cpu,
451 } 470 }
452} 471}
453 472
454 473/*
455static ssize_t store_cache_disable(struct _cpuid4_info *this_leaf, 474 * disable a L3 cache index by using a disable-slot
456 const char *buf, size_t count, 475 *
457 unsigned int slot) 476 * @l3: L3 cache descriptor
477 * @cpu: A CPU on the node containing the L3 cache
478 * @slot: slot number (0..1)
479 * @index: index to disable
480 *
481 * @return: 0 on success, error status on failure
482 */
483int amd_set_l3_disable_slot(struct amd_l3_cache *l3, int cpu, unsigned slot,
484 unsigned long index)
458{ 485{
459 struct pci_dev *dev = this_leaf->l3->dev; 486 int ret = 0;
460 int cpu = cpumask_first(to_cpumask(this_leaf->shared_cpu_map));
461 unsigned long val = 0;
462 487
463#define SUBCACHE_MASK (3UL << 20) 488#define SUBCACHE_MASK (3UL << 20)
464#define SUBCACHE_INDEX 0xfff 489#define SUBCACHE_INDEX 0xfff
465 490
466 if (!this_leaf->l3 || !this_leaf->l3->can_disable) 491 /*
492 * check whether this slot is already used or
493 * the index is already disabled
494 */
495 ret = amd_get_l3_disable_slot(l3, slot);
496 if (ret >= 0)
467 return -EINVAL; 497 return -EINVAL;
468 498
499 /*
500 * check whether the other slot has disabled the
501 * same index already
502 */
503 if (index == amd_get_l3_disable_slot(l3, !slot))
504 return -EINVAL;
505
506 /* do not allow writes outside of allowed bits */
507 if ((index & ~(SUBCACHE_MASK | SUBCACHE_INDEX)) ||
508 ((index & SUBCACHE_INDEX) > l3->indices))
509 return -EINVAL;
510
511 amd_l3_disable_index(l3, cpu, slot, index);
512
513 return 0;
514}
515
516static ssize_t store_cache_disable(struct _cpuid4_info *this_leaf,
517 const char *buf, size_t count,
518 unsigned int slot)
519{
520 unsigned long val = 0;
521 int cpu, err = 0;
522
469 if (!capable(CAP_SYS_ADMIN)) 523 if (!capable(CAP_SYS_ADMIN))
470 return -EPERM; 524 return -EPERM;
471 525
472 if (!dev) 526 if (!this_leaf->l3 || !this_leaf->l3->can_disable)
473 return -EINVAL; 527 return -EINVAL;
474 528
475 if (strict_strtoul(buf, 10, &val) < 0) 529 cpu = cpumask_first(to_cpumask(this_leaf->shared_cpu_map));
476 return -EINVAL;
477 530
478 /* do not allow writes outside of allowed bits */ 531 if (strict_strtoul(buf, 10, &val) < 0)
479 if ((val & ~(SUBCACHE_MASK | SUBCACHE_INDEX)) ||
480 ((val & SUBCACHE_INDEX) > this_leaf->l3->indices))
481 return -EINVAL; 532 return -EINVAL;
482 533
483 amd_l3_disable_index(this_leaf->l3, cpu, slot, val); 534 err = amd_set_l3_disable_slot(this_leaf->l3, cpu, slot, val);
484 535 if (err) {
536 if (err == -EEXIST)
537 printk(KERN_WARNING "L3 disable slot %d in use!\n",
538 slot);
539 return err;
540 }
485 return count; 541 return count;
486} 542}
487 543
@@ -502,7 +558,7 @@ static struct _cache_attr cache_disable_1 = __ATTR(cache_disable_1, 0644,
502 558
503#else /* CONFIG_CPU_SUP_AMD */ 559#else /* CONFIG_CPU_SUP_AMD */
504static void __cpuinit 560static void __cpuinit
505amd_check_l3_disable(int index, struct _cpuid4_info_regs *this_leaf) 561amd_check_l3_disable(struct _cpuid4_info_regs *this_leaf, int index)
506{ 562{
507}; 563};
508#endif /* CONFIG_CPU_SUP_AMD */ 564#endif /* CONFIG_CPU_SUP_AMD */
@@ -518,7 +574,7 @@ __cpuinit cpuid4_cache_lookup_regs(int index,
518 574
519 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) { 575 if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD) {
520 amd_cpuid4(index, &eax, &ebx, &ecx); 576 amd_cpuid4(index, &eax, &ebx, &ecx);
521 amd_check_l3_disable(index, this_leaf); 577 amd_check_l3_disable(this_leaf, index);
522 } else { 578 } else {
523 cpuid_count(4, index, &eax.full, &ebx.full, &ecx.full, &edx); 579 cpuid_count(4, index, &eax.full, &ebx.full, &ecx.full, &edx);
524 } 580 }
diff --git a/arch/x86/kernel/cpu/mcheck/mce.c b/arch/x86/kernel/cpu/mcheck/mce.c
index 18cc42562250..e1269d62c569 100644
--- a/arch/x86/kernel/cpu/mcheck/mce.c
+++ b/arch/x86/kernel/cpu/mcheck/mce.c
@@ -51,7 +51,7 @@
51static DEFINE_MUTEX(mce_read_mutex); 51static DEFINE_MUTEX(mce_read_mutex);
52 52
53#define rcu_dereference_check_mce(p) \ 53#define rcu_dereference_check_mce(p) \
54 rcu_dereference_check((p), \ 54 rcu_dereference_index_check((p), \
55 rcu_read_lock_sched_held() || \ 55 rcu_read_lock_sched_held() || \
56 lockdep_is_held(&mce_read_mutex)) 56 lockdep_is_held(&mce_read_mutex))
57 57
@@ -600,6 +600,7 @@ void machine_check_poll(enum mcp_flags flags, mce_banks_t *b)
600 */ 600 */
601 if (!(flags & MCP_DONTLOG) && !mce_dont_log_ce) { 601 if (!(flags & MCP_DONTLOG) && !mce_dont_log_ce) {
602 mce_log(&m); 602 mce_log(&m);
603 atomic_notifier_call_chain(&x86_mce_decoder_chain, 0, &m);
603 add_taint(TAINT_MACHINE_CHECK); 604 add_taint(TAINT_MACHINE_CHECK);
604 } 605 }
605 606
diff --git a/arch/x86/kernel/cpu/mcheck/therm_throt.c b/arch/x86/kernel/cpu/mcheck/therm_throt.c
index e1a0a3bf9716..c2a8b26d4fea 100644
--- a/arch/x86/kernel/cpu/mcheck/therm_throt.c
+++ b/arch/x86/kernel/cpu/mcheck/therm_throt.c
@@ -34,15 +34,25 @@
34/* How long to wait between reporting thermal events */ 34/* How long to wait between reporting thermal events */
35#define CHECK_INTERVAL (300 * HZ) 35#define CHECK_INTERVAL (300 * HZ)
36 36
37#define THERMAL_THROTTLING_EVENT 0
38#define POWER_LIMIT_EVENT 1
39
37/* 40/*
38 * Current thermal throttling state: 41 * Current thermal event state:
39 */ 42 */
40struct thermal_state { 43struct _thermal_state {
41 bool is_throttled; 44 bool new_event;
42 45 int event;
43 u64 next_check; 46 u64 next_check;
44 unsigned long throttle_count; 47 unsigned long count;
45 unsigned long last_throttle_count; 48 unsigned long last_count;
49};
50
51struct thermal_state {
52 struct _thermal_state core_throttle;
53 struct _thermal_state core_power_limit;
54 struct _thermal_state package_throttle;
55 struct _thermal_state package_power_limit;
46}; 56};
47 57
48static DEFINE_PER_CPU(struct thermal_state, thermal_state); 58static DEFINE_PER_CPU(struct thermal_state, thermal_state);
@@ -53,11 +63,13 @@ static u32 lvtthmr_init __read_mostly;
53 63
54#ifdef CONFIG_SYSFS 64#ifdef CONFIG_SYSFS
55#define define_therm_throt_sysdev_one_ro(_name) \ 65#define define_therm_throt_sysdev_one_ro(_name) \
56 static SYSDEV_ATTR(_name, 0444, therm_throt_sysdev_show_##_name, NULL) 66 static SYSDEV_ATTR(_name, 0444, \
67 therm_throt_sysdev_show_##_name, \
68 NULL) \
57 69
58#define define_therm_throt_sysdev_show_func(name) \ 70#define define_therm_throt_sysdev_show_func(event, name) \
59 \ 71 \
60static ssize_t therm_throt_sysdev_show_##name( \ 72static ssize_t therm_throt_sysdev_show_##event##_##name( \
61 struct sys_device *dev, \ 73 struct sys_device *dev, \
62 struct sysdev_attribute *attr, \ 74 struct sysdev_attribute *attr, \
63 char *buf) \ 75 char *buf) \
@@ -66,30 +78,42 @@ static ssize_t therm_throt_sysdev_show_##name( \
66 ssize_t ret; \ 78 ssize_t ret; \
67 \ 79 \
68 preempt_disable(); /* CPU hotplug */ \ 80 preempt_disable(); /* CPU hotplug */ \
69 if (cpu_online(cpu)) \ 81 if (cpu_online(cpu)) { \
70 ret = sprintf(buf, "%lu\n", \ 82 ret = sprintf(buf, "%lu\n", \
71 per_cpu(thermal_state, cpu).name); \ 83 per_cpu(thermal_state, cpu).event.name); \
72 else \ 84 } else \
73 ret = 0; \ 85 ret = 0; \
74 preempt_enable(); \ 86 preempt_enable(); \
75 \ 87 \
76 return ret; \ 88 return ret; \
77} 89}
78 90
79define_therm_throt_sysdev_show_func(throttle_count); 91define_therm_throt_sysdev_show_func(core_throttle, count);
80define_therm_throt_sysdev_one_ro(throttle_count); 92define_therm_throt_sysdev_one_ro(core_throttle_count);
93
94define_therm_throt_sysdev_show_func(core_power_limit, count);
95define_therm_throt_sysdev_one_ro(core_power_limit_count);
96
97define_therm_throt_sysdev_show_func(package_throttle, count);
98define_therm_throt_sysdev_one_ro(package_throttle_count);
99
100define_therm_throt_sysdev_show_func(package_power_limit, count);
101define_therm_throt_sysdev_one_ro(package_power_limit_count);
81 102
82static struct attribute *thermal_throttle_attrs[] = { 103static struct attribute *thermal_throttle_attrs[] = {
83 &attr_throttle_count.attr, 104 &attr_core_throttle_count.attr,
84 NULL 105 NULL
85}; 106};
86 107
87static struct attribute_group thermal_throttle_attr_group = { 108static struct attribute_group thermal_attr_group = {
88 .attrs = thermal_throttle_attrs, 109 .attrs = thermal_throttle_attrs,
89 .name = "thermal_throttle" 110 .name = "thermal_throttle"
90}; 111};
91#endif /* CONFIG_SYSFS */ 112#endif /* CONFIG_SYSFS */
92 113
114#define CORE_LEVEL 0
115#define PACKAGE_LEVEL 1
116
93/*** 117/***
94 * therm_throt_process - Process thermal throttling event from interrupt 118 * therm_throt_process - Process thermal throttling event from interrupt
95 * @curr: Whether the condition is current or not (boolean), since the 119 * @curr: Whether the condition is current or not (boolean), since the
@@ -106,39 +130,70 @@ static struct attribute_group thermal_throttle_attr_group = {
106 * 1 : Event should be logged further, and a message has been 130 * 1 : Event should be logged further, and a message has been
107 * printed to the syslog. 131 * printed to the syslog.
108 */ 132 */
109static int therm_throt_process(bool is_throttled) 133static int therm_throt_process(bool new_event, int event, int level)
110{ 134{
111 struct thermal_state *state; 135 struct _thermal_state *state;
112 unsigned int this_cpu; 136 unsigned int this_cpu = smp_processor_id();
113 bool was_throttled; 137 bool old_event;
114 u64 now; 138 u64 now;
139 struct thermal_state *pstate = &per_cpu(thermal_state, this_cpu);
115 140
116 this_cpu = smp_processor_id();
117 now = get_jiffies_64(); 141 now = get_jiffies_64();
118 state = &per_cpu(thermal_state, this_cpu); 142 if (level == CORE_LEVEL) {
143 if (event == THERMAL_THROTTLING_EVENT)
144 state = &pstate->core_throttle;
145 else if (event == POWER_LIMIT_EVENT)
146 state = &pstate->core_power_limit;
147 else
148 return 0;
149 } else if (level == PACKAGE_LEVEL) {
150 if (event == THERMAL_THROTTLING_EVENT)
151 state = &pstate->package_throttle;
152 else if (event == POWER_LIMIT_EVENT)
153 state = &pstate->package_power_limit;
154 else
155 return 0;
156 } else
157 return 0;
119 158
120 was_throttled = state->is_throttled; 159 old_event = state->new_event;
121 state->is_throttled = is_throttled; 160 state->new_event = new_event;
122 161
123 if (is_throttled) 162 if (new_event)
124 state->throttle_count++; 163 state->count++;
125 164
126 if (time_before64(now, state->next_check) && 165 if (time_before64(now, state->next_check) &&
127 state->throttle_count != state->last_throttle_count) 166 state->count != state->last_count)
128 return 0; 167 return 0;
129 168
130 state->next_check = now + CHECK_INTERVAL; 169 state->next_check = now + CHECK_INTERVAL;
131 state->last_throttle_count = state->throttle_count; 170 state->last_count = state->count;
132 171
133 /* if we just entered the thermal event */ 172 /* if we just entered the thermal event */
134 if (is_throttled) { 173 if (new_event) {
135 printk(KERN_CRIT "CPU%d: Temperature above threshold, cpu clock throttled (total events = %lu)\n", this_cpu, state->throttle_count); 174 if (event == THERMAL_THROTTLING_EVENT)
175 printk(KERN_CRIT "CPU%d: %s temperature above threshold, cpu clock throttled (total events = %lu)\n",
176 this_cpu,
177 level == CORE_LEVEL ? "Core" : "Package",
178 state->count);
179 else
180 printk(KERN_CRIT "CPU%d: %s power limit notification (total events = %lu)\n",
181 this_cpu,
182 level == CORE_LEVEL ? "Core" : "Package",
183 state->count);
136 184
137 add_taint(TAINT_MACHINE_CHECK); 185 add_taint(TAINT_MACHINE_CHECK);
138 return 1; 186 return 1;
139 } 187 }
140 if (was_throttled) { 188 if (old_event) {
141 printk(KERN_INFO "CPU%d: Temperature/speed normal\n", this_cpu); 189 if (event == THERMAL_THROTTLING_EVENT)
190 printk(KERN_INFO "CPU%d: %s temperature/speed normal\n",
191 this_cpu,
192 level == CORE_LEVEL ? "Core" : "Package");
193 else
194 printk(KERN_INFO "CPU%d: %s power limit normal\n",
195 this_cpu,
196 level == CORE_LEVEL ? "Core" : "Package");
142 return 1; 197 return 1;
143 } 198 }
144 199
@@ -149,13 +204,32 @@ static int therm_throt_process(bool is_throttled)
149/* Add/Remove thermal_throttle interface for CPU device: */ 204/* Add/Remove thermal_throttle interface for CPU device: */
150static __cpuinit int thermal_throttle_add_dev(struct sys_device *sys_dev) 205static __cpuinit int thermal_throttle_add_dev(struct sys_device *sys_dev)
151{ 206{
152 return sysfs_create_group(&sys_dev->kobj, 207 int err;
153 &thermal_throttle_attr_group); 208 struct cpuinfo_x86 *c = &cpu_data(smp_processor_id());
209
210 err = sysfs_create_group(&sys_dev->kobj, &thermal_attr_group);
211 if (err)
212 return err;
213
214 if (cpu_has(c, X86_FEATURE_PLN))
215 err = sysfs_add_file_to_group(&sys_dev->kobj,
216 &attr_core_power_limit_count.attr,
217 thermal_attr_group.name);
218 if (cpu_has(c, X86_FEATURE_PTS))
219 err = sysfs_add_file_to_group(&sys_dev->kobj,
220 &attr_package_throttle_count.attr,
221 thermal_attr_group.name);
222 if (cpu_has(c, X86_FEATURE_PLN))
223 err = sysfs_add_file_to_group(&sys_dev->kobj,
224 &attr_package_power_limit_count.attr,
225 thermal_attr_group.name);
226
227 return err;
154} 228}
155 229
156static __cpuinit void thermal_throttle_remove_dev(struct sys_device *sys_dev) 230static __cpuinit void thermal_throttle_remove_dev(struct sys_device *sys_dev)
157{ 231{
158 sysfs_remove_group(&sys_dev->kobj, &thermal_throttle_attr_group); 232 sysfs_remove_group(&sys_dev->kobj, &thermal_attr_group);
159} 233}
160 234
161/* Mutex protecting device creation against CPU hotplug: */ 235/* Mutex protecting device creation against CPU hotplug: */
@@ -226,14 +300,50 @@ device_initcall(thermal_throttle_init_device);
226 300
227#endif /* CONFIG_SYSFS */ 301#endif /* CONFIG_SYSFS */
228 302
303/*
304 * Set up the most two significant bit to notify mce log that this thermal
305 * event type.
306 * This is a temp solution. May be changed in the future with mce log
307 * infrasture.
308 */
309#define CORE_THROTTLED (0)
310#define CORE_POWER_LIMIT ((__u64)1 << 62)
311#define PACKAGE_THROTTLED ((__u64)2 << 62)
312#define PACKAGE_POWER_LIMIT ((__u64)3 << 62)
313
229/* Thermal transition interrupt handler */ 314/* Thermal transition interrupt handler */
230static void intel_thermal_interrupt(void) 315static void intel_thermal_interrupt(void)
231{ 316{
232 __u64 msr_val; 317 __u64 msr_val;
318 struct cpuinfo_x86 *c = &cpu_data(smp_processor_id());
233 319
234 rdmsrl(MSR_IA32_THERM_STATUS, msr_val); 320 rdmsrl(MSR_IA32_THERM_STATUS, msr_val);
235 if (therm_throt_process((msr_val & THERM_STATUS_PROCHOT) != 0)) 321
236 mce_log_therm_throt_event(msr_val); 322 if (therm_throt_process(msr_val & THERM_STATUS_PROCHOT,
323 THERMAL_THROTTLING_EVENT,
324 CORE_LEVEL) != 0)
325 mce_log_therm_throt_event(CORE_THROTTLED | msr_val);
326
327 if (cpu_has(c, X86_FEATURE_PLN))
328 if (therm_throt_process(msr_val & THERM_STATUS_POWER_LIMIT,
329 POWER_LIMIT_EVENT,
330 CORE_LEVEL) != 0)
331 mce_log_therm_throt_event(CORE_POWER_LIMIT | msr_val);
332
333 if (cpu_has(c, X86_FEATURE_PTS)) {
334 rdmsrl(MSR_IA32_PACKAGE_THERM_STATUS, msr_val);
335 if (therm_throt_process(msr_val & PACKAGE_THERM_STATUS_PROCHOT,
336 THERMAL_THROTTLING_EVENT,
337 PACKAGE_LEVEL) != 0)
338 mce_log_therm_throt_event(PACKAGE_THROTTLED | msr_val);
339 if (cpu_has(c, X86_FEATURE_PLN))
340 if (therm_throt_process(msr_val &
341 PACKAGE_THERM_STATUS_POWER_LIMIT,
342 POWER_LIMIT_EVENT,
343 PACKAGE_LEVEL) != 0)
344 mce_log_therm_throt_event(PACKAGE_POWER_LIMIT
345 | msr_val);
346 }
237} 347}
238 348
239static void unexpected_thermal_interrupt(void) 349static void unexpected_thermal_interrupt(void)
@@ -335,8 +445,26 @@ void intel_init_thermal(struct cpuinfo_x86 *c)
335 apic_write(APIC_LVTTHMR, h); 445 apic_write(APIC_LVTTHMR, h);
336 446
337 rdmsr(MSR_IA32_THERM_INTERRUPT, l, h); 447 rdmsr(MSR_IA32_THERM_INTERRUPT, l, h);
338 wrmsr(MSR_IA32_THERM_INTERRUPT, 448 if (cpu_has(c, X86_FEATURE_PLN))
339 l | (THERM_INT_LOW_ENABLE | THERM_INT_HIGH_ENABLE), h); 449 wrmsr(MSR_IA32_THERM_INTERRUPT,
450 l | (THERM_INT_LOW_ENABLE
451 | THERM_INT_HIGH_ENABLE | THERM_INT_PLN_ENABLE), h);
452 else
453 wrmsr(MSR_IA32_THERM_INTERRUPT,
454 l | (THERM_INT_LOW_ENABLE | THERM_INT_HIGH_ENABLE), h);
455
456 if (cpu_has(c, X86_FEATURE_PTS)) {
457 rdmsr(MSR_IA32_PACKAGE_THERM_INTERRUPT, l, h);
458 if (cpu_has(c, X86_FEATURE_PLN))
459 wrmsr(MSR_IA32_PACKAGE_THERM_INTERRUPT,
460 l | (PACKAGE_THERM_INT_LOW_ENABLE
461 | PACKAGE_THERM_INT_HIGH_ENABLE
462 | PACKAGE_THERM_INT_PLN_ENABLE), h);
463 else
464 wrmsr(MSR_IA32_PACKAGE_THERM_INTERRUPT,
465 l | (PACKAGE_THERM_INT_LOW_ENABLE
466 | PACKAGE_THERM_INT_HIGH_ENABLE), h);
467 }
340 468
341 smp_thermal_vector = intel_thermal_interrupt; 469 smp_thermal_vector = intel_thermal_interrupt;
342 470
diff --git a/arch/x86/kernel/cpu/mshyperv.c b/arch/x86/kernel/cpu/mshyperv.c
index 16f41bbe46b6..d944bf6c50e9 100644
--- a/arch/x86/kernel/cpu/mshyperv.c
+++ b/arch/x86/kernel/cpu/mshyperv.c
@@ -18,6 +18,7 @@
18#include <asm/mshyperv.h> 18#include <asm/mshyperv.h>
19 19
20struct ms_hyperv_info ms_hyperv; 20struct ms_hyperv_info ms_hyperv;
21EXPORT_SYMBOL_GPL(ms_hyperv);
21 22
22static bool __init ms_hyperv_platform(void) 23static bool __init ms_hyperv_platform(void)
23{ 24{
diff --git a/arch/x86/kernel/cpu/mtrr/generic.c b/arch/x86/kernel/cpu/mtrr/generic.c
index fd31a441c61c..7d28d7d03885 100644
--- a/arch/x86/kernel/cpu/mtrr/generic.c
+++ b/arch/x86/kernel/cpu/mtrr/generic.c
@@ -433,13 +433,12 @@ static void generic_get_mtrr(unsigned int reg, unsigned long *base,
433{ 433{
434 unsigned int mask_lo, mask_hi, base_lo, base_hi; 434 unsigned int mask_lo, mask_hi, base_lo, base_hi;
435 unsigned int tmp, hi; 435 unsigned int tmp, hi;
436 int cpu;
437 436
438 /* 437 /*
439 * get_mtrr doesn't need to update mtrr_state, also it could be called 438 * get_mtrr doesn't need to update mtrr_state, also it could be called
440 * from any cpu, so try to print it out directly. 439 * from any cpu, so try to print it out directly.
441 */ 440 */
442 cpu = get_cpu(); 441 get_cpu();
443 442
444 rdmsr(MTRRphysMask_MSR(reg), mask_lo, mask_hi); 443 rdmsr(MTRRphysMask_MSR(reg), mask_lo, mask_hi);
445 444
diff --git a/arch/x86/kernel/cpu/perf_event.c b/arch/x86/kernel/cpu/perf_event.c
index 5db5b7d65a18..f2da20fda02d 100644
--- a/arch/x86/kernel/cpu/perf_event.c
+++ b/arch/x86/kernel/cpu/perf_event.c
@@ -220,6 +220,7 @@ struct x86_pmu {
220 struct perf_event *event); 220 struct perf_event *event);
221 struct event_constraint *event_constraints; 221 struct event_constraint *event_constraints;
222 void (*quirks)(void); 222 void (*quirks)(void);
223 int perfctr_second_write;
223 224
224 int (*cpu_prepare)(int cpu); 225 int (*cpu_prepare)(int cpu);
225 void (*cpu_starting)(int cpu); 226 void (*cpu_starting)(int cpu);
@@ -295,10 +296,10 @@ x86_perf_event_update(struct perf_event *event)
295 * count to the generic event atomically: 296 * count to the generic event atomically:
296 */ 297 */
297again: 298again:
298 prev_raw_count = atomic64_read(&hwc->prev_count); 299 prev_raw_count = local64_read(&hwc->prev_count);
299 rdmsrl(hwc->event_base + idx, new_raw_count); 300 rdmsrl(hwc->event_base + idx, new_raw_count);
300 301
301 if (atomic64_cmpxchg(&hwc->prev_count, prev_raw_count, 302 if (local64_cmpxchg(&hwc->prev_count, prev_raw_count,
302 new_raw_count) != prev_raw_count) 303 new_raw_count) != prev_raw_count)
303 goto again; 304 goto again;
304 305
@@ -313,8 +314,8 @@ again:
313 delta = (new_raw_count << shift) - (prev_raw_count << shift); 314 delta = (new_raw_count << shift) - (prev_raw_count << shift);
314 delta >>= shift; 315 delta >>= shift;
315 316
316 atomic64_add(delta, &event->count); 317 local64_add(delta, &event->count);
317 atomic64_sub(delta, &hwc->period_left); 318 local64_sub(delta, &hwc->period_left);
318 319
319 return new_raw_count; 320 return new_raw_count;
320} 321}
@@ -438,7 +439,7 @@ static int x86_setup_perfctr(struct perf_event *event)
438 if (!hwc->sample_period) { 439 if (!hwc->sample_period) {
439 hwc->sample_period = x86_pmu.max_period; 440 hwc->sample_period = x86_pmu.max_period;
440 hwc->last_period = hwc->sample_period; 441 hwc->last_period = hwc->sample_period;
441 atomic64_set(&hwc->period_left, hwc->sample_period); 442 local64_set(&hwc->period_left, hwc->sample_period);
442 } else { 443 } else {
443 /* 444 /*
444 * If we have a PMU initialized but no APIC 445 * If we have a PMU initialized but no APIC
@@ -885,7 +886,7 @@ static int
885x86_perf_event_set_period(struct perf_event *event) 886x86_perf_event_set_period(struct perf_event *event)
886{ 887{
887 struct hw_perf_event *hwc = &event->hw; 888 struct hw_perf_event *hwc = &event->hw;
888 s64 left = atomic64_read(&hwc->period_left); 889 s64 left = local64_read(&hwc->period_left);
889 s64 period = hwc->sample_period; 890 s64 period = hwc->sample_period;
890 int ret = 0, idx = hwc->idx; 891 int ret = 0, idx = hwc->idx;
891 892
@@ -897,14 +898,14 @@ x86_perf_event_set_period(struct perf_event *event)
897 */ 898 */
898 if (unlikely(left <= -period)) { 899 if (unlikely(left <= -period)) {
899 left = period; 900 left = period;
900 atomic64_set(&hwc->period_left, left); 901 local64_set(&hwc->period_left, left);
901 hwc->last_period = period; 902 hwc->last_period = period;
902 ret = 1; 903 ret = 1;
903 } 904 }
904 905
905 if (unlikely(left <= 0)) { 906 if (unlikely(left <= 0)) {
906 left += period; 907 left += period;
907 atomic64_set(&hwc->period_left, left); 908 local64_set(&hwc->period_left, left);
908 hwc->last_period = period; 909 hwc->last_period = period;
909 ret = 1; 910 ret = 1;
910 } 911 }
@@ -923,10 +924,19 @@ x86_perf_event_set_period(struct perf_event *event)
923 * The hw event starts counting from this event offset, 924 * The hw event starts counting from this event offset,
924 * mark it to be able to extra future deltas: 925 * mark it to be able to extra future deltas:
925 */ 926 */
926 atomic64_set(&hwc->prev_count, (u64)-left); 927 local64_set(&hwc->prev_count, (u64)-left);
927 928
928 wrmsrl(hwc->event_base + idx, 929 wrmsrl(hwc->event_base + idx, (u64)(-left) & x86_pmu.cntval_mask);
930
931 /*
932 * Due to erratum on certan cpu we need
933 * a second write to be sure the register
934 * is updated properly
935 */
936 if (x86_pmu.perfctr_second_write) {
937 wrmsrl(hwc->event_base + idx,
929 (u64)(-left) & x86_pmu.cntval_mask); 938 (u64)(-left) & x86_pmu.cntval_mask);
939 }
930 940
931 perf_event_update_userpage(event); 941 perf_event_update_userpage(event);
932 942
@@ -969,7 +979,7 @@ static int x86_pmu_enable(struct perf_event *event)
969 * skip the schedulability test here, it will be peformed 979 * skip the schedulability test here, it will be peformed
970 * at commit time(->commit_txn) as a whole 980 * at commit time(->commit_txn) as a whole
971 */ 981 */
972 if (cpuc->group_flag & PERF_EVENT_TXN_STARTED) 982 if (cpuc->group_flag & PERF_EVENT_TXN)
973 goto out; 983 goto out;
974 984
975 ret = x86_pmu.schedule_events(cpuc, n, assign); 985 ret = x86_pmu.schedule_events(cpuc, n, assign);
@@ -1096,7 +1106,7 @@ static void x86_pmu_disable(struct perf_event *event)
1096 * The events never got scheduled and ->cancel_txn will truncate 1106 * The events never got scheduled and ->cancel_txn will truncate
1097 * the event_list. 1107 * the event_list.
1098 */ 1108 */
1099 if (cpuc->group_flag & PERF_EVENT_TXN_STARTED) 1109 if (cpuc->group_flag & PERF_EVENT_TXN)
1100 return; 1110 return;
1101 1111
1102 x86_pmu_stop(event); 1112 x86_pmu_stop(event);
@@ -1388,7 +1398,7 @@ static void x86_pmu_start_txn(const struct pmu *pmu)
1388{ 1398{
1389 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 1399 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
1390 1400
1391 cpuc->group_flag |= PERF_EVENT_TXN_STARTED; 1401 cpuc->group_flag |= PERF_EVENT_TXN;
1392 cpuc->n_txn = 0; 1402 cpuc->n_txn = 0;
1393} 1403}
1394 1404
@@ -1401,7 +1411,7 @@ static void x86_pmu_cancel_txn(const struct pmu *pmu)
1401{ 1411{
1402 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); 1412 struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events);
1403 1413
1404 cpuc->group_flag &= ~PERF_EVENT_TXN_STARTED; 1414 cpuc->group_flag &= ~PERF_EVENT_TXN;
1405 /* 1415 /*
1406 * Truncate the collected events. 1416 * Truncate the collected events.
1407 */ 1417 */
@@ -1435,11 +1445,7 @@ static int x86_pmu_commit_txn(const struct pmu *pmu)
1435 */ 1445 */
1436 memcpy(cpuc->assign, assign, n*sizeof(int)); 1446 memcpy(cpuc->assign, assign, n*sizeof(int));
1437 1447
1438 /* 1448 cpuc->group_flag &= ~PERF_EVENT_TXN;
1439 * Clear out the txn count so that ->cancel_txn() which gets
1440 * run after ->commit_txn() doesn't undo things.
1441 */
1442 cpuc->n_txn = 0;
1443 1449
1444 return 0; 1450 return 0;
1445} 1451}
@@ -1607,8 +1613,6 @@ static const struct stacktrace_ops backtrace_ops = {
1607 .walk_stack = print_context_stack_bp, 1613 .walk_stack = print_context_stack_bp,
1608}; 1614};
1609 1615
1610#include "../dumpstack.h"
1611
1612static void 1616static void
1613perf_callchain_kernel(struct pt_regs *regs, struct perf_callchain_entry *entry) 1617perf_callchain_kernel(struct pt_regs *regs, struct perf_callchain_entry *entry)
1614{ 1618{
@@ -1730,22 +1734,6 @@ struct perf_callchain_entry *perf_callchain(struct pt_regs *regs)
1730 return entry; 1734 return entry;
1731} 1735}
1732 1736
1733void perf_arch_fetch_caller_regs(struct pt_regs *regs, unsigned long ip, int skip)
1734{
1735 regs->ip = ip;
1736 /*
1737 * perf_arch_fetch_caller_regs adds another call, we need to increment
1738 * the skip level
1739 */
1740 regs->bp = rewind_frame_pointer(skip + 1);
1741 regs->cs = __KERNEL_CS;
1742 /*
1743 * We abuse bit 3 to pass exact information, see perf_misc_flags
1744 * and the comment with PERF_EFLAGS_EXACT.
1745 */
1746 regs->flags = 0;
1747}
1748
1749unsigned long perf_instruction_pointer(struct pt_regs *regs) 1737unsigned long perf_instruction_pointer(struct pt_regs *regs)
1750{ 1738{
1751 unsigned long ip; 1739 unsigned long ip;
diff --git a/arch/x86/kernel/cpu/perf_event_p4.c b/arch/x86/kernel/cpu/perf_event_p4.c
index ae85d69644d1..107711bf0ee8 100644
--- a/arch/x86/kernel/cpu/perf_event_p4.c
+++ b/arch/x86/kernel/cpu/perf_event_p4.c
@@ -21,22 +21,36 @@ struct p4_event_bind {
21 char cntr[2][P4_CNTR_LIMIT]; /* counter index (offset), -1 on abscence */ 21 char cntr[2][P4_CNTR_LIMIT]; /* counter index (offset), -1 on abscence */
22}; 22};
23 23
24struct p4_cache_event_bind { 24struct p4_pebs_bind {
25 unsigned int metric_pebs; 25 unsigned int metric_pebs;
26 unsigned int metric_vert; 26 unsigned int metric_vert;
27}; 27};
28 28
29#define P4_GEN_CACHE_EVENT_BIND(name) \ 29/* it sets P4_PEBS_ENABLE_UOP_TAG as well */
30 [P4_CACHE__##name] = { \ 30#define P4_GEN_PEBS_BIND(name, pebs, vert) \
31 .metric_pebs = P4_PEBS__##name, \ 31 [P4_PEBS_METRIC__##name] = { \
32 .metric_vert = P4_VERT__##name, \ 32 .metric_pebs = pebs | P4_PEBS_ENABLE_UOP_TAG, \
33 .metric_vert = vert, \
33 } 34 }
34 35
35static struct p4_cache_event_bind p4_cache_event_bind_map[] = { 36/*
36 P4_GEN_CACHE_EVENT_BIND(1stl_cache_load_miss_retired), 37 * note we have P4_PEBS_ENABLE_UOP_TAG always set here
37 P4_GEN_CACHE_EVENT_BIND(2ndl_cache_load_miss_retired), 38 *
38 P4_GEN_CACHE_EVENT_BIND(dtlb_load_miss_retired), 39 * it's needed for mapping P4_PEBS_CONFIG_METRIC_MASK bits of
39 P4_GEN_CACHE_EVENT_BIND(dtlb_store_miss_retired), 40 * event configuration to find out which values are to be
41 * written into MSR_IA32_PEBS_ENABLE and MSR_P4_PEBS_MATRIX_VERT
42 * resgisters
43 */
44static struct p4_pebs_bind p4_pebs_bind_map[] = {
45 P4_GEN_PEBS_BIND(1stl_cache_load_miss_retired, 0x0000001, 0x0000001),
46 P4_GEN_PEBS_BIND(2ndl_cache_load_miss_retired, 0x0000002, 0x0000001),
47 P4_GEN_PEBS_BIND(dtlb_load_miss_retired, 0x0000004, 0x0000001),
48 P4_GEN_PEBS_BIND(dtlb_store_miss_retired, 0x0000004, 0x0000002),
49 P4_GEN_PEBS_BIND(dtlb_all_miss_retired, 0x0000004, 0x0000003),
50 P4_GEN_PEBS_BIND(tagged_mispred_branch, 0x0018000, 0x0000010),
51 P4_GEN_PEBS_BIND(mob_load_replay_retired, 0x0000200, 0x0000001),
52 P4_GEN_PEBS_BIND(split_load_retired, 0x0000400, 0x0000001),
53 P4_GEN_PEBS_BIND(split_store_retired, 0x0000400, 0x0000002),
40}; 54};
41 55
42/* 56/*
@@ -281,10 +295,10 @@ static struct p4_event_bind p4_event_bind_map[] = {
281 }, 295 },
282}; 296};
283 297
284#define P4_GEN_CACHE_EVENT(event, bit, cache_event) \ 298#define P4_GEN_CACHE_EVENT(event, bit, metric) \
285 p4_config_pack_escr(P4_ESCR_EVENT(event) | \ 299 p4_config_pack_escr(P4_ESCR_EVENT(event) | \
286 P4_ESCR_EMASK_BIT(event, bit)) | \ 300 P4_ESCR_EMASK_BIT(event, bit)) | \
287 p4_config_pack_cccr(cache_event | \ 301 p4_config_pack_cccr(metric | \
288 P4_CCCR_ESEL(P4_OPCODE_ESEL(P4_OPCODE(event)))) 302 P4_CCCR_ESEL(P4_OPCODE_ESEL(P4_OPCODE(event))))
289 303
290static __initconst const u64 p4_hw_cache_event_ids 304static __initconst const u64 p4_hw_cache_event_ids
@@ -296,34 +310,34 @@ static __initconst const u64 p4_hw_cache_event_ids
296 [ C(OP_READ) ] = { 310 [ C(OP_READ) ] = {
297 [ C(RESULT_ACCESS) ] = 0x0, 311 [ C(RESULT_ACCESS) ] = 0x0,
298 [ C(RESULT_MISS) ] = P4_GEN_CACHE_EVENT(P4_EVENT_REPLAY_EVENT, NBOGUS, 312 [ C(RESULT_MISS) ] = P4_GEN_CACHE_EVENT(P4_EVENT_REPLAY_EVENT, NBOGUS,
299 P4_CACHE__1stl_cache_load_miss_retired), 313 P4_PEBS_METRIC__1stl_cache_load_miss_retired),
300 }, 314 },
301 }, 315 },
302 [ C(LL ) ] = { 316 [ C(LL ) ] = {
303 [ C(OP_READ) ] = { 317 [ C(OP_READ) ] = {
304 [ C(RESULT_ACCESS) ] = 0x0, 318 [ C(RESULT_ACCESS) ] = 0x0,
305 [ C(RESULT_MISS) ] = P4_GEN_CACHE_EVENT(P4_EVENT_REPLAY_EVENT, NBOGUS, 319 [ C(RESULT_MISS) ] = P4_GEN_CACHE_EVENT(P4_EVENT_REPLAY_EVENT, NBOGUS,
306 P4_CACHE__2ndl_cache_load_miss_retired), 320 P4_PEBS_METRIC__2ndl_cache_load_miss_retired),
307 }, 321 },
308}, 322},
309 [ C(DTLB) ] = { 323 [ C(DTLB) ] = {
310 [ C(OP_READ) ] = { 324 [ C(OP_READ) ] = {
311 [ C(RESULT_ACCESS) ] = 0x0, 325 [ C(RESULT_ACCESS) ] = 0x0,
312 [ C(RESULT_MISS) ] = P4_GEN_CACHE_EVENT(P4_EVENT_REPLAY_EVENT, NBOGUS, 326 [ C(RESULT_MISS) ] = P4_GEN_CACHE_EVENT(P4_EVENT_REPLAY_EVENT, NBOGUS,
313 P4_CACHE__dtlb_load_miss_retired), 327 P4_PEBS_METRIC__dtlb_load_miss_retired),
314 }, 328 },
315 [ C(OP_WRITE) ] = { 329 [ C(OP_WRITE) ] = {
316 [ C(RESULT_ACCESS) ] = 0x0, 330 [ C(RESULT_ACCESS) ] = 0x0,
317 [ C(RESULT_MISS) ] = P4_GEN_CACHE_EVENT(P4_EVENT_REPLAY_EVENT, NBOGUS, 331 [ C(RESULT_MISS) ] = P4_GEN_CACHE_EVENT(P4_EVENT_REPLAY_EVENT, NBOGUS,
318 P4_CACHE__dtlb_store_miss_retired), 332 P4_PEBS_METRIC__dtlb_store_miss_retired),
319 }, 333 },
320 }, 334 },
321 [ C(ITLB) ] = { 335 [ C(ITLB) ] = {
322 [ C(OP_READ) ] = { 336 [ C(OP_READ) ] = {
323 [ C(RESULT_ACCESS) ] = P4_GEN_CACHE_EVENT(P4_EVENT_ITLB_REFERENCE, HIT, 337 [ C(RESULT_ACCESS) ] = P4_GEN_CACHE_EVENT(P4_EVENT_ITLB_REFERENCE, HIT,
324 P4_CACHE__itlb_reference_hit), 338 P4_PEBS_METRIC__none),
325 [ C(RESULT_MISS) ] = P4_GEN_CACHE_EVENT(P4_EVENT_ITLB_REFERENCE, MISS, 339 [ C(RESULT_MISS) ] = P4_GEN_CACHE_EVENT(P4_EVENT_ITLB_REFERENCE, MISS,
326 P4_CACHE__itlb_reference_miss), 340 P4_PEBS_METRIC__none),
327 }, 341 },
328 [ C(OP_WRITE) ] = { 342 [ C(OP_WRITE) ] = {
329 [ C(RESULT_ACCESS) ] = -1, 343 [ C(RESULT_ACCESS) ] = -1,
@@ -414,11 +428,37 @@ static u64 p4_pmu_event_map(int hw_event)
414 return config; 428 return config;
415} 429}
416 430
431static int p4_validate_raw_event(struct perf_event *event)
432{
433 unsigned int v;
434
435 /* user data may have out-of-bound event index */
436 v = p4_config_unpack_event(event->attr.config);
437 if (v >= ARRAY_SIZE(p4_event_bind_map)) {
438 pr_warning("P4 PMU: Unknown event code: %d\n", v);
439 return -EINVAL;
440 }
441
442 /*
443 * it may have some screwed PEBS bits
444 */
445 if (p4_config_pebs_has(event->attr.config, P4_PEBS_CONFIG_ENABLE)) {
446 pr_warning("P4 PMU: PEBS are not supported yet\n");
447 return -EINVAL;
448 }
449 v = p4_config_unpack_metric(event->attr.config);
450 if (v >= ARRAY_SIZE(p4_pebs_bind_map)) {
451 pr_warning("P4 PMU: Unknown metric code: %d\n", v);
452 return -EINVAL;
453 }
454
455 return 0;
456}
457
417static int p4_hw_config(struct perf_event *event) 458static int p4_hw_config(struct perf_event *event)
418{ 459{
419 int cpu = get_cpu(); 460 int cpu = get_cpu();
420 int rc = 0; 461 int rc = 0;
421 unsigned int evnt;
422 u32 escr, cccr; 462 u32 escr, cccr;
423 463
424 /* 464 /*
@@ -438,12 +478,9 @@ static int p4_hw_config(struct perf_event *event)
438 478
439 if (event->attr.type == PERF_TYPE_RAW) { 479 if (event->attr.type == PERF_TYPE_RAW) {
440 480
441 /* user data may have out-of-bound event index */ 481 rc = p4_validate_raw_event(event);
442 evnt = p4_config_unpack_event(event->attr.config); 482 if (rc)
443 if (evnt >= ARRAY_SIZE(p4_event_bind_map)) {
444 rc = -EINVAL;
445 goto out; 483 goto out;
446 }
447 484
448 /* 485 /*
449 * We don't control raw events so it's up to the caller 486 * We don't control raw events so it's up to the caller
@@ -451,12 +488,15 @@ static int p4_hw_config(struct perf_event *event)
451 * on HT machine but allow HT-compatible specifics to be 488 * on HT machine but allow HT-compatible specifics to be
452 * passed on) 489 * passed on)
453 * 490 *
491 * Note that for RAW events we allow user to use P4_CCCR_RESERVED
492 * bits since we keep additional info here (for cache events and etc)
493 *
454 * XXX: HT wide things should check perf_paranoid_cpu() && 494 * XXX: HT wide things should check perf_paranoid_cpu() &&
455 * CAP_SYS_ADMIN 495 * CAP_SYS_ADMIN
456 */ 496 */
457 event->hw.config |= event->attr.config & 497 event->hw.config |= event->attr.config &
458 (p4_config_pack_escr(P4_ESCR_MASK_HT) | 498 (p4_config_pack_escr(P4_ESCR_MASK_HT) |
459 p4_config_pack_cccr(P4_CCCR_MASK_HT)); 499 p4_config_pack_cccr(P4_CCCR_MASK_HT | P4_CCCR_RESERVED));
460 } 500 }
461 501
462 rc = x86_setup_perfctr(event); 502 rc = x86_setup_perfctr(event);
@@ -482,6 +522,29 @@ static inline int p4_pmu_clear_cccr_ovf(struct hw_perf_event *hwc)
482 return overflow; 522 return overflow;
483} 523}
484 524
525static void p4_pmu_disable_pebs(void)
526{
527 /*
528 * FIXME
529 *
530 * It's still allowed that two threads setup same cache
531 * events so we can't simply clear metrics until we knew
532 * noone is depending on us, so we need kind of counter
533 * for "ReplayEvent" users.
534 *
535 * What is more complex -- RAW events, if user (for some
536 * reason) will pass some cache event metric with improper
537 * event opcode -- it's fine from hardware point of view
538 * but completely nonsence from "meaning" of such action.
539 *
540 * So at moment let leave metrics turned on forever -- it's
541 * ok for now but need to be revisited!
542 *
543 * (void)checking_wrmsrl(MSR_IA32_PEBS_ENABLE, (u64)0);
544 * (void)checking_wrmsrl(MSR_P4_PEBS_MATRIX_VERT, (u64)0);
545 */
546}
547
485static inline void p4_pmu_disable_event(struct perf_event *event) 548static inline void p4_pmu_disable_event(struct perf_event *event)
486{ 549{
487 struct hw_perf_event *hwc = &event->hw; 550 struct hw_perf_event *hwc = &event->hw;
@@ -507,6 +570,26 @@ static void p4_pmu_disable_all(void)
507 continue; 570 continue;
508 p4_pmu_disable_event(event); 571 p4_pmu_disable_event(event);
509 } 572 }
573
574 p4_pmu_disable_pebs();
575}
576
577/* configuration must be valid */
578static void p4_pmu_enable_pebs(u64 config)
579{
580 struct p4_pebs_bind *bind;
581 unsigned int idx;
582
583 BUILD_BUG_ON(P4_PEBS_METRIC__max > P4_PEBS_CONFIG_METRIC_MASK);
584
585 idx = p4_config_unpack_metric(config);
586 if (idx == P4_PEBS_METRIC__none)
587 return;
588
589 bind = &p4_pebs_bind_map[idx];
590
591 (void)checking_wrmsrl(MSR_IA32_PEBS_ENABLE, (u64)bind->metric_pebs);
592 (void)checking_wrmsrl(MSR_P4_PEBS_MATRIX_VERT, (u64)bind->metric_vert);
510} 593}
511 594
512static void p4_pmu_enable_event(struct perf_event *event) 595static void p4_pmu_enable_event(struct perf_event *event)
@@ -515,9 +598,7 @@ static void p4_pmu_enable_event(struct perf_event *event)
515 int thread = p4_ht_config_thread(hwc->config); 598 int thread = p4_ht_config_thread(hwc->config);
516 u64 escr_conf = p4_config_unpack_escr(p4_clear_ht_bit(hwc->config)); 599 u64 escr_conf = p4_config_unpack_escr(p4_clear_ht_bit(hwc->config));
517 unsigned int idx = p4_config_unpack_event(hwc->config); 600 unsigned int idx = p4_config_unpack_event(hwc->config);
518 unsigned int idx_cache = p4_config_unpack_cache_event(hwc->config);
519 struct p4_event_bind *bind; 601 struct p4_event_bind *bind;
520 struct p4_cache_event_bind *bind_cache;
521 u64 escr_addr, cccr; 602 u64 escr_addr, cccr;
522 603
523 bind = &p4_event_bind_map[idx]; 604 bind = &p4_event_bind_map[idx];
@@ -537,16 +618,10 @@ static void p4_pmu_enable_event(struct perf_event *event)
537 cccr = p4_config_unpack_cccr(hwc->config); 618 cccr = p4_config_unpack_cccr(hwc->config);
538 619
539 /* 620 /*
540 * it could be Cache event so that we need to 621 * it could be Cache event so we need to write metrics
541 * set metrics into additional MSRs 622 * into additional MSRs
542 */ 623 */
543 BUILD_BUG_ON(P4_CACHE__MAX > P4_CCCR_CACHE_OPS_MASK); 624 p4_pmu_enable_pebs(hwc->config);
544 if (idx_cache > P4_CACHE__NONE &&
545 idx_cache < ARRAY_SIZE(p4_cache_event_bind_map)) {
546 bind_cache = &p4_cache_event_bind_map[idx_cache];
547 (void)checking_wrmsrl(MSR_IA32_PEBS_ENABLE, (u64)bind_cache->metric_pebs);
548 (void)checking_wrmsrl(MSR_P4_PEBS_MATRIX_VERT, (u64)bind_cache->metric_vert);
549 }
550 625
551 (void)checking_wrmsrl(escr_addr, escr_conf); 626 (void)checking_wrmsrl(escr_addr, escr_conf);
552 (void)checking_wrmsrl(hwc->config_base + hwc->idx, 627 (void)checking_wrmsrl(hwc->config_base + hwc->idx,
@@ -829,6 +904,15 @@ static __initconst const struct x86_pmu p4_pmu = {
829 .max_period = (1ULL << 39) - 1, 904 .max_period = (1ULL << 39) - 1,
830 .hw_config = p4_hw_config, 905 .hw_config = p4_hw_config,
831 .schedule_events = p4_pmu_schedule_events, 906 .schedule_events = p4_pmu_schedule_events,
907 /*
908 * This handles erratum N15 in intel doc 249199-029,
909 * the counter may not be updated correctly on write
910 * so we need a second write operation to do the trick
911 * (the official workaround didn't work)
912 *
913 * the former idea is taken from OProfile code
914 */
915 .perfctr_second_write = 1,
832}; 916};
833 917
834static __init int p4_pmu_init(void) 918static __init int p4_pmu_init(void)
diff --git a/arch/x86/kernel/cpu/scattered.c b/arch/x86/kernel/cpu/scattered.c
new file mode 100644
index 000000000000..34b4dad6f0b8
--- /dev/null
+++ b/arch/x86/kernel/cpu/scattered.c
@@ -0,0 +1,63 @@
1/*
2 * Routines to indentify additional cpu features that are scattered in
3 * cpuid space.
4 */
5#include <linux/cpu.h>
6
7#include <asm/pat.h>
8#include <asm/processor.h>
9
10#include <asm/apic.h>
11
12struct cpuid_bit {
13 u16 feature;
14 u8 reg;
15 u8 bit;
16 u32 level;
17 u32 sub_leaf;
18};
19
20enum cpuid_regs {
21 CR_EAX = 0,
22 CR_ECX,
23 CR_EDX,
24 CR_EBX
25};
26
27void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c)
28{
29 u32 max_level;
30 u32 regs[4];
31 const struct cpuid_bit *cb;
32
33 static const struct cpuid_bit __cpuinitconst cpuid_bits[] = {
34 { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006, 0 },
35 { X86_FEATURE_ARAT, CR_EAX, 2, 0x00000006, 0 },
36 { X86_FEATURE_PLN, CR_EAX, 4, 0x00000006, 0 },
37 { X86_FEATURE_PTS, CR_EAX, 6, 0x00000006, 0 },
38 { X86_FEATURE_APERFMPERF, CR_ECX, 0, 0x00000006, 0 },
39 { X86_FEATURE_EPB, CR_ECX, 3, 0x00000006, 0 },
40 { X86_FEATURE_XSAVEOPT, CR_EAX, 0, 0x0000000d, 1 },
41 { X86_FEATURE_CPB, CR_EDX, 9, 0x80000007, 0 },
42 { X86_FEATURE_NPT, CR_EDX, 0, 0x8000000a, 0 },
43 { X86_FEATURE_LBRV, CR_EDX, 1, 0x8000000a, 0 },
44 { X86_FEATURE_SVML, CR_EDX, 2, 0x8000000a, 0 },
45 { X86_FEATURE_NRIPS, CR_EDX, 3, 0x8000000a, 0 },
46 { 0, 0, 0, 0, 0 }
47 };
48
49 for (cb = cpuid_bits; cb->feature; cb++) {
50
51 /* Verify that the level is valid */
52 max_level = cpuid_eax(cb->level & 0xffff0000);
53 if (max_level < cb->level ||
54 max_level > (cb->level | 0xffff))
55 continue;
56
57 cpuid_count(cb->level, cb->sub_leaf, &regs[CR_EAX],
58 &regs[CR_EBX], &regs[CR_ECX], &regs[CR_EDX]);
59
60 if (regs[cb->reg] & (1 << cb->bit))
61 set_cpu_cap(c, cb->feature);
62 }
63}
diff --git a/arch/x86/kernel/cpu/addon_cpuid_features.c b/arch/x86/kernel/cpu/topology.c
index 10fa5684a662..4397e987a1cf 100644
--- a/arch/x86/kernel/cpu/addon_cpuid_features.c
+++ b/arch/x86/kernel/cpu/topology.c
@@ -1,62 +1,14 @@
1/* 1/*
2 * Routines to indentify additional cpu features that are scattered in 2 * Check for extended topology enumeration cpuid leaf 0xb and if it
3 * cpuid space. 3 * exists, use it for populating initial_apicid and cpu topology
4 * detection.
4 */ 5 */
5#include <linux/cpu.h>
6 6
7#include <linux/cpu.h>
8#include <asm/apic.h>
7#include <asm/pat.h> 9#include <asm/pat.h>
8#include <asm/processor.h> 10#include <asm/processor.h>
9 11
10#include <asm/apic.h>
11
12struct cpuid_bit {
13 u16 feature;
14 u8 reg;
15 u8 bit;
16 u32 level;
17};
18
19enum cpuid_regs {
20 CR_EAX = 0,
21 CR_ECX,
22 CR_EDX,
23 CR_EBX
24};
25
26void __cpuinit init_scattered_cpuid_features(struct cpuinfo_x86 *c)
27{
28 u32 max_level;
29 u32 regs[4];
30 const struct cpuid_bit *cb;
31
32 static const struct cpuid_bit __cpuinitconst cpuid_bits[] = {
33 { X86_FEATURE_IDA, CR_EAX, 1, 0x00000006 },
34 { X86_FEATURE_ARAT, CR_EAX, 2, 0x00000006 },
35 { X86_FEATURE_APERFMPERF, CR_ECX, 0, 0x00000006 },
36 { X86_FEATURE_CPB, CR_EDX, 9, 0x80000007 },
37 { X86_FEATURE_NPT, CR_EDX, 0, 0x8000000a },
38 { X86_FEATURE_LBRV, CR_EDX, 1, 0x8000000a },
39 { X86_FEATURE_SVML, CR_EDX, 2, 0x8000000a },
40 { X86_FEATURE_NRIPS, CR_EDX, 3, 0x8000000a },
41 { 0, 0, 0, 0 }
42 };
43
44 for (cb = cpuid_bits; cb->feature; cb++) {
45
46 /* Verify that the level is valid */
47 max_level = cpuid_eax(cb->level & 0xffff0000);
48 if (max_level < cb->level ||
49 max_level > (cb->level | 0xffff))
50 continue;
51
52 cpuid(cb->level, &regs[CR_EAX], &regs[CR_EBX],
53 &regs[CR_ECX], &regs[CR_EDX]);
54
55 if (regs[cb->reg] & (1 << cb->bit))
56 set_cpu_cap(c, cb->feature);
57 }
58}
59
60/* leaf 0xb SMT level */ 12/* leaf 0xb SMT level */
61#define SMT_LEVEL 0 13#define SMT_LEVEL 0
62 14
diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
index c89a386930b7..6e8752c1bd52 100644
--- a/arch/x86/kernel/dumpstack.c
+++ b/arch/x86/kernel/dumpstack.c
@@ -18,7 +18,6 @@
18 18
19#include <asm/stacktrace.h> 19#include <asm/stacktrace.h>
20 20
21#include "dumpstack.h"
22 21
23int panic_on_unrecovered_nmi; 22int panic_on_unrecovered_nmi;
24int panic_on_io_nmi; 23int panic_on_io_nmi;
diff --git a/arch/x86/kernel/dumpstack.h b/arch/x86/kernel/dumpstack.h
deleted file mode 100644
index e1a93be4fd44..000000000000
--- a/arch/x86/kernel/dumpstack.h
+++ /dev/null
@@ -1,56 +0,0 @@
1/*
2 * Copyright (C) 1991, 1992 Linus Torvalds
3 * Copyright (C) 2000, 2001, 2002 Andi Kleen, SuSE Labs
4 */
5
6#ifndef DUMPSTACK_H
7#define DUMPSTACK_H
8
9#ifdef CONFIG_X86_32
10#define STACKSLOTS_PER_LINE 8
11#define get_bp(bp) asm("movl %%ebp, %0" : "=r" (bp) :)
12#else
13#define STACKSLOTS_PER_LINE 4
14#define get_bp(bp) asm("movq %%rbp, %0" : "=r" (bp) :)
15#endif
16
17#include <linux/uaccess.h>
18
19extern void
20show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
21 unsigned long *stack, unsigned long bp, char *log_lvl);
22
23extern void
24show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
25 unsigned long *sp, unsigned long bp, char *log_lvl);
26
27extern unsigned int code_bytes;
28
29/* The form of the top of the frame on the stack */
30struct stack_frame {
31 struct stack_frame *next_frame;
32 unsigned long return_address;
33};
34
35struct stack_frame_ia32 {
36 u32 next_frame;
37 u32 return_address;
38};
39
40static inline unsigned long rewind_frame_pointer(int n)
41{
42 struct stack_frame *frame;
43
44 get_bp(frame);
45
46#ifdef CONFIG_FRAME_POINTER
47 while (n--) {
48 if (probe_kernel_address(&frame->next_frame, frame))
49 break;
50 }
51#endif
52
53 return (unsigned long)frame;
54}
55
56#endif /* DUMPSTACK_H */
diff --git a/arch/x86/kernel/dumpstack_32.c b/arch/x86/kernel/dumpstack_32.c
index 11540a189d93..0f6376ffa2d9 100644
--- a/arch/x86/kernel/dumpstack_32.c
+++ b/arch/x86/kernel/dumpstack_32.c
@@ -16,8 +16,6 @@
16 16
17#include <asm/stacktrace.h> 17#include <asm/stacktrace.h>
18 18
19#include "dumpstack.h"
20
21 19
22void dump_trace(struct task_struct *task, struct pt_regs *regs, 20void dump_trace(struct task_struct *task, struct pt_regs *regs,
23 unsigned long *stack, unsigned long bp, 21 unsigned long *stack, unsigned long bp,
diff --git a/arch/x86/kernel/dumpstack_64.c b/arch/x86/kernel/dumpstack_64.c
index 272c9f1f05f3..57a21f11c791 100644
--- a/arch/x86/kernel/dumpstack_64.c
+++ b/arch/x86/kernel/dumpstack_64.c
@@ -16,7 +16,6 @@
16 16
17#include <asm/stacktrace.h> 17#include <asm/stacktrace.h>
18 18
19#include "dumpstack.h"
20 19
21#define N_EXCEPTION_STACKS_END \ 20#define N_EXCEPTION_STACKS_END \
22 (N_EXCEPTION_STACKS + DEBUG_STKSZ/EXCEPTION_STKSZ - 2) 21 (N_EXCEPTION_STACKS + DEBUG_STKSZ/EXCEPTION_STKSZ - 2)
diff --git a/arch/x86/kernel/entry_32.S b/arch/x86/kernel/entry_32.S
index cd49141cf153..258e93fa2630 100644
--- a/arch/x86/kernel/entry_32.S
+++ b/arch/x86/kernel/entry_32.S
@@ -611,14 +611,14 @@ ldt_ss:
611 * compensating for the offset by changing to the ESPFIX segment with 611 * compensating for the offset by changing to the ESPFIX segment with
612 * a base address that matches for the difference. 612 * a base address that matches for the difference.
613 */ 613 */
614#define GDT_ESPFIX_SS PER_CPU_VAR(gdt_page) + (GDT_ENTRY_ESPFIX_SS * 8)
614 mov %esp, %edx /* load kernel esp */ 615 mov %esp, %edx /* load kernel esp */
615 mov PT_OLDESP(%esp), %eax /* load userspace esp */ 616 mov PT_OLDESP(%esp), %eax /* load userspace esp */
616 mov %dx, %ax /* eax: new kernel esp */ 617 mov %dx, %ax /* eax: new kernel esp */
617 sub %eax, %edx /* offset (low word is 0) */ 618 sub %eax, %edx /* offset (low word is 0) */
618 PER_CPU(gdt_page, %ebx)
619 shr $16, %edx 619 shr $16, %edx
620 mov %dl, GDT_ENTRY_ESPFIX_SS * 8 + 4(%ebx) /* bits 16..23 */ 620 mov %dl, GDT_ESPFIX_SS + 4 /* bits 16..23 */
621 mov %dh, GDT_ENTRY_ESPFIX_SS * 8 + 7(%ebx) /* bits 24..31 */ 621 mov %dh, GDT_ESPFIX_SS + 7 /* bits 24..31 */
622 pushl $__ESPFIX_SS 622 pushl $__ESPFIX_SS
623 CFI_ADJUST_CFA_OFFSET 4 623 CFI_ADJUST_CFA_OFFSET 4
624 push %eax /* new kernel esp */ 624 push %eax /* new kernel esp */
@@ -791,9 +791,8 @@ ptregs_clone:
791 * normal stack and adjusts ESP with the matching offset. 791 * normal stack and adjusts ESP with the matching offset.
792 */ 792 */
793 /* fixup the stack */ 793 /* fixup the stack */
794 PER_CPU(gdt_page, %ebx) 794 mov GDT_ESPFIX_SS + 4, %al /* bits 16..23 */
795 mov GDT_ENTRY_ESPFIX_SS * 8 + 4(%ebx), %al /* bits 16..23 */ 795 mov GDT_ESPFIX_SS + 7, %ah /* bits 24..31 */
796 mov GDT_ENTRY_ESPFIX_SS * 8 + 7(%ebx), %ah /* bits 24..31 */
797 shl $16, %eax 796 shl $16, %eax
798 addl %esp, %eax /* the adjusted stack pointer */ 797 addl %esp, %eax /* the adjusted stack pointer */
799 pushl $__KERNEL_DS 798 pushl $__KERNEL_DS
@@ -1166,6 +1165,9 @@ ENTRY(xen_failsafe_callback)
1166.previous 1165.previous
1167ENDPROC(xen_failsafe_callback) 1166ENDPROC(xen_failsafe_callback)
1168 1167
1168BUILD_INTERRUPT3(xen_hvm_callback_vector, XEN_HVM_EVTCHN_CALLBACK,
1169 xen_evtchn_do_upcall)
1170
1169#endif /* CONFIG_XEN */ 1171#endif /* CONFIG_XEN */
1170 1172
1171#ifdef CONFIG_FUNCTION_TRACER 1173#ifdef CONFIG_FUNCTION_TRACER
diff --git a/arch/x86/kernel/entry_64.S b/arch/x86/kernel/entry_64.S
index 4db7c4d12ffa..c5ea5cdbe7b3 100644
--- a/arch/x86/kernel/entry_64.S
+++ b/arch/x86/kernel/entry_64.S
@@ -1065,6 +1065,7 @@ ENTRY(\sym)
1065END(\sym) 1065END(\sym)
1066.endm 1066.endm
1067 1067
1068#define INIT_TSS_IST(x) PER_CPU_VAR(init_tss) + (TSS_ist + ((x) - 1) * 8)
1068.macro paranoidzeroentry_ist sym do_sym ist 1069.macro paranoidzeroentry_ist sym do_sym ist
1069ENTRY(\sym) 1070ENTRY(\sym)
1070 INTR_FRAME 1071 INTR_FRAME
@@ -1076,10 +1077,9 @@ ENTRY(\sym)
1076 TRACE_IRQS_OFF 1077 TRACE_IRQS_OFF
1077 movq %rsp,%rdi /* pt_regs pointer */ 1078 movq %rsp,%rdi /* pt_regs pointer */
1078 xorl %esi,%esi /* no error code */ 1079 xorl %esi,%esi /* no error code */
1079 PER_CPU(init_tss, %r12) 1080 subq $EXCEPTION_STKSZ, INIT_TSS_IST(\ist)
1080 subq $EXCEPTION_STKSZ, TSS_ist + (\ist - 1) * 8(%r12)
1081 call \do_sym 1081 call \do_sym
1082 addq $EXCEPTION_STKSZ, TSS_ist + (\ist - 1) * 8(%r12) 1082 addq $EXCEPTION_STKSZ, INIT_TSS_IST(\ist)
1083 jmp paranoid_exit /* %ebx: no swapgs flag */ 1083 jmp paranoid_exit /* %ebx: no swapgs flag */
1084 CFI_ENDPROC 1084 CFI_ENDPROC
1085END(\sym) 1085END(\sym)
@@ -1329,6 +1329,9 @@ ENTRY(xen_failsafe_callback)
1329 CFI_ENDPROC 1329 CFI_ENDPROC
1330END(xen_failsafe_callback) 1330END(xen_failsafe_callback)
1331 1331
1332apicinterrupt XEN_HVM_EVTCHN_CALLBACK \
1333 xen_hvm_callback_vector xen_evtchn_do_upcall
1334
1332#endif /* CONFIG_XEN */ 1335#endif /* CONFIG_XEN */
1333 1336
1334/* 1337/*
diff --git a/arch/x86/kernel/head32.c b/arch/x86/kernel/head32.c
index b2e246037392..784360c0625c 100644
--- a/arch/x86/kernel/head32.c
+++ b/arch/x86/kernel/head32.c
@@ -20,7 +20,7 @@
20 20
21static void __init i386_default_early_setup(void) 21static void __init i386_default_early_setup(void)
22{ 22{
23 /* Initilize 32bit specific setup functions */ 23 /* Initialize 32bit specific setup functions */
24 x86_init.resources.probe_roms = probe_roms; 24 x86_init.resources.probe_roms = probe_roms;
25 x86_init.resources.reserve_resources = i386_reserve_resources; 25 x86_init.resources.reserve_resources = i386_reserve_resources;
26 x86_init.mpparse.setup_ioapic_ids = setup_ioapic_ids_from_mpc; 26 x86_init.mpparse.setup_ioapic_ids = setup_ioapic_ids_from_mpc;
diff --git a/arch/x86/kernel/head_64.S b/arch/x86/kernel/head_64.S
index 3d1e6f16b7a6..239046bd447f 100644
--- a/arch/x86/kernel/head_64.S
+++ b/arch/x86/kernel/head_64.S
@@ -234,9 +234,8 @@ ENTRY(secondary_startup_64)
234 * init data section till per cpu areas are set up. 234 * init data section till per cpu areas are set up.
235 */ 235 */
236 movl $MSR_GS_BASE,%ecx 236 movl $MSR_GS_BASE,%ecx
237 movq initial_gs(%rip),%rax 237 movl initial_gs(%rip),%eax
238 movq %rax,%rdx 238 movl initial_gs+4(%rip),%edx
239 shrq $32,%rdx
240 wrmsr 239 wrmsr
241 240
242 /* esi is pointer to real mode structure with interesting info. 241 /* esi is pointer to real mode structure with interesting info.
diff --git a/arch/x86/kernel/hpet.c b/arch/x86/kernel/hpet.c
index ba390d731175..33dbcc4ec5ff 100644
--- a/arch/x86/kernel/hpet.c
+++ b/arch/x86/kernel/hpet.c
@@ -16,7 +16,6 @@
16#include <asm/hpet.h> 16#include <asm/hpet.h>
17 17
18#define HPET_MASK CLOCKSOURCE_MASK(32) 18#define HPET_MASK CLOCKSOURCE_MASK(32)
19#define HPET_SHIFT 22
20 19
21/* FSEC = 10^-15 20/* FSEC = 10^-15
22 NSEC = 10^-9 */ 21 NSEC = 10^-9 */
@@ -787,7 +786,6 @@ static struct clocksource clocksource_hpet = {
787 .rating = 250, 786 .rating = 250,
788 .read = read_hpet, 787 .read = read_hpet,
789 .mask = HPET_MASK, 788 .mask = HPET_MASK,
790 .shift = HPET_SHIFT,
791 .flags = CLOCK_SOURCE_IS_CONTINUOUS, 789 .flags = CLOCK_SOURCE_IS_CONTINUOUS,
792 .resume = hpet_resume_counter, 790 .resume = hpet_resume_counter,
793#ifdef CONFIG_X86_64 791#ifdef CONFIG_X86_64
@@ -798,6 +796,7 @@ static struct clocksource clocksource_hpet = {
798static int hpet_clocksource_register(void) 796static int hpet_clocksource_register(void)
799{ 797{
800 u64 start, now; 798 u64 start, now;
799 u64 hpet_freq;
801 cycle_t t1; 800 cycle_t t1;
802 801
803 /* Start the counter */ 802 /* Start the counter */
@@ -832,9 +831,15 @@ static int hpet_clocksource_register(void)
832 * mult = (hpet_period * 2^shift)/10^6 831 * mult = (hpet_period * 2^shift)/10^6
833 * mult = (hpet_period << shift)/FSEC_PER_NSEC 832 * mult = (hpet_period << shift)/FSEC_PER_NSEC
834 */ 833 */
835 clocksource_hpet.mult = div_sc(hpet_period, FSEC_PER_NSEC, HPET_SHIFT);
836 834
837 clocksource_register(&clocksource_hpet); 835 /* Need to convert hpet_period (fsec/cyc) to cyc/sec:
836 *
837 * cyc/sec = FSEC_PER_SEC/hpet_period(fsec/cyc)
838 * cyc/sec = (FSEC_PER_NSEC * NSEC_PER_SEC)/hpet_period
839 */
840 hpet_freq = FSEC_PER_NSEC * NSEC_PER_SEC;
841 do_div(hpet_freq, hpet_period);
842 clocksource_register_hz(&clocksource_hpet, (u32)hpet_freq);
838 843
839 return 0; 844 return 0;
840} 845}
diff --git a/arch/x86/kernel/hw_breakpoint.c b/arch/x86/kernel/hw_breakpoint.c
index a8f1b803d2fd..a474ec37c32f 100644
--- a/arch/x86/kernel/hw_breakpoint.c
+++ b/arch/x86/kernel/hw_breakpoint.c
@@ -208,6 +208,9 @@ int arch_bp_generic_fields(int x86_len, int x86_type,
208{ 208{
209 /* Len */ 209 /* Len */
210 switch (x86_len) { 210 switch (x86_len) {
211 case X86_BREAKPOINT_LEN_X:
212 *gen_len = sizeof(long);
213 break;
211 case X86_BREAKPOINT_LEN_1: 214 case X86_BREAKPOINT_LEN_1:
212 *gen_len = HW_BREAKPOINT_LEN_1; 215 *gen_len = HW_BREAKPOINT_LEN_1;
213 break; 216 break;
@@ -251,6 +254,29 @@ static int arch_build_bp_info(struct perf_event *bp)
251 254
252 info->address = bp->attr.bp_addr; 255 info->address = bp->attr.bp_addr;
253 256
257 /* Type */
258 switch (bp->attr.bp_type) {
259 case HW_BREAKPOINT_W:
260 info->type = X86_BREAKPOINT_WRITE;
261 break;
262 case HW_BREAKPOINT_W | HW_BREAKPOINT_R:
263 info->type = X86_BREAKPOINT_RW;
264 break;
265 case HW_BREAKPOINT_X:
266 info->type = X86_BREAKPOINT_EXECUTE;
267 /*
268 * x86 inst breakpoints need to have a specific undefined len.
269 * But we still need to check userspace is not trying to setup
270 * an unsupported length, to get a range breakpoint for example.
271 */
272 if (bp->attr.bp_len == sizeof(long)) {
273 info->len = X86_BREAKPOINT_LEN_X;
274 return 0;
275 }
276 default:
277 return -EINVAL;
278 }
279
254 /* Len */ 280 /* Len */
255 switch (bp->attr.bp_len) { 281 switch (bp->attr.bp_len) {
256 case HW_BREAKPOINT_LEN_1: 282 case HW_BREAKPOINT_LEN_1:
@@ -271,21 +297,6 @@ static int arch_build_bp_info(struct perf_event *bp)
271 return -EINVAL; 297 return -EINVAL;
272 } 298 }
273 299
274 /* Type */
275 switch (bp->attr.bp_type) {
276 case HW_BREAKPOINT_W:
277 info->type = X86_BREAKPOINT_WRITE;
278 break;
279 case HW_BREAKPOINT_W | HW_BREAKPOINT_R:
280 info->type = X86_BREAKPOINT_RW;
281 break;
282 case HW_BREAKPOINT_X:
283 info->type = X86_BREAKPOINT_EXECUTE;
284 break;
285 default:
286 return -EINVAL;
287 }
288
289 return 0; 300 return 0;
290} 301}
291/* 302/*
@@ -305,6 +316,9 @@ int arch_validate_hwbkpt_settings(struct perf_event *bp)
305 ret = -EINVAL; 316 ret = -EINVAL;
306 317
307 switch (info->len) { 318 switch (info->len) {
319 case X86_BREAKPOINT_LEN_X:
320 align = sizeof(long) -1;
321 break;
308 case X86_BREAKPOINT_LEN_1: 322 case X86_BREAKPOINT_LEN_1:
309 align = 0; 323 align = 0;
310 break; 324 break;
@@ -466,6 +480,13 @@ static int __kprobes hw_breakpoint_handler(struct die_args *args)
466 480
467 perf_bp_event(bp, args->regs); 481 perf_bp_event(bp, args->regs);
468 482
483 /*
484 * Set up resume flag to avoid breakpoint recursion when
485 * returning back to origin.
486 */
487 if (bp->hw.info.type == X86_BREAKPOINT_EXECUTE)
488 args->regs->flags |= X86_EFLAGS_RF;
489
469 rcu_read_unlock(); 490 rcu_read_unlock();
470 } 491 }
471 /* 492 /*
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c
index 86cef6b32253..c4444bce8469 100644
--- a/arch/x86/kernel/i387.c
+++ b/arch/x86/kernel/i387.c
@@ -107,7 +107,7 @@ void __cpuinit fpu_init(void)
107} 107}
108#endif /* CONFIG_X86_64 */ 108#endif /* CONFIG_X86_64 */
109 109
110static void fpu_finit(struct fpu *fpu) 110void fpu_finit(struct fpu *fpu)
111{ 111{
112#ifdef CONFIG_X86_32 112#ifdef CONFIG_X86_32
113 if (!HAVE_HWFP) { 113 if (!HAVE_HWFP) {
@@ -132,6 +132,7 @@ static void fpu_finit(struct fpu *fpu)
132 fp->fos = 0xffff0000u; 132 fp->fos = 0xffff0000u;
133 } 133 }
134} 134}
135EXPORT_SYMBOL_GPL(fpu_finit);
135 136
136/* 137/*
137 * The _current_ task is using the FPU for the first time 138 * The _current_ task is using the FPU for the first time
diff --git a/arch/x86/kernel/kgdb.c b/arch/x86/kernel/kgdb.c
index 4f4af75b9482..ef10940e1af0 100644
--- a/arch/x86/kernel/kgdb.c
+++ b/arch/x86/kernel/kgdb.c
@@ -49,55 +49,94 @@
49#include <asm/system.h> 49#include <asm/system.h>
50#include <asm/apic.h> 50#include <asm/apic.h>
51 51
52/** 52struct dbg_reg_def_t dbg_reg_def[DBG_MAX_REG_NUM] =
53 * pt_regs_to_gdb_regs - Convert ptrace regs to GDB regs
54 * @gdb_regs: A pointer to hold the registers in the order GDB wants.
55 * @regs: The &struct pt_regs of the current process.
56 *
57 * Convert the pt_regs in @regs into the format for registers that
58 * GDB expects, stored in @gdb_regs.
59 */
60void pt_regs_to_gdb_regs(unsigned long *gdb_regs, struct pt_regs *regs)
61{ 53{
62#ifndef CONFIG_X86_32 54#ifdef CONFIG_X86_32
63 u32 *gdb_regs32 = (u32 *)gdb_regs; 55 { "ax", 4, offsetof(struct pt_regs, ax) },
56 { "cx", 4, offsetof(struct pt_regs, cx) },
57 { "dx", 4, offsetof(struct pt_regs, dx) },
58 { "bx", 4, offsetof(struct pt_regs, bx) },
59 { "sp", 4, offsetof(struct pt_regs, sp) },
60 { "bp", 4, offsetof(struct pt_regs, bp) },
61 { "si", 4, offsetof(struct pt_regs, si) },
62 { "di", 4, offsetof(struct pt_regs, di) },
63 { "ip", 4, offsetof(struct pt_regs, ip) },
64 { "flags", 4, offsetof(struct pt_regs, flags) },
65 { "cs", 4, offsetof(struct pt_regs, cs) },
66 { "ss", 4, offsetof(struct pt_regs, ss) },
67 { "ds", 4, offsetof(struct pt_regs, ds) },
68 { "es", 4, offsetof(struct pt_regs, es) },
69 { "fs", 4, -1 },
70 { "gs", 4, -1 },
71#else
72 { "ax", 8, offsetof(struct pt_regs, ax) },
73 { "bx", 8, offsetof(struct pt_regs, bx) },
74 { "cx", 8, offsetof(struct pt_regs, cx) },
75 { "dx", 8, offsetof(struct pt_regs, dx) },
76 { "si", 8, offsetof(struct pt_regs, dx) },
77 { "di", 8, offsetof(struct pt_regs, di) },
78 { "bp", 8, offsetof(struct pt_regs, bp) },
79 { "sp", 8, offsetof(struct pt_regs, sp) },
80 { "r8", 8, offsetof(struct pt_regs, r8) },
81 { "r9", 8, offsetof(struct pt_regs, r9) },
82 { "r10", 8, offsetof(struct pt_regs, r10) },
83 { "r11", 8, offsetof(struct pt_regs, r11) },
84 { "r12", 8, offsetof(struct pt_regs, r12) },
85 { "r13", 8, offsetof(struct pt_regs, r13) },
86 { "r14", 8, offsetof(struct pt_regs, r14) },
87 { "r15", 8, offsetof(struct pt_regs, r15) },
88 { "ip", 8, offsetof(struct pt_regs, ip) },
89 { "flags", 4, offsetof(struct pt_regs, flags) },
90 { "cs", 4, offsetof(struct pt_regs, cs) },
91 { "ss", 4, offsetof(struct pt_regs, ss) },
64#endif 92#endif
65 gdb_regs[GDB_AX] = regs->ax; 93};
66 gdb_regs[GDB_BX] = regs->bx; 94
67 gdb_regs[GDB_CX] = regs->cx; 95int dbg_set_reg(int regno, void *mem, struct pt_regs *regs)
68 gdb_regs[GDB_DX] = regs->dx; 96{
69 gdb_regs[GDB_SI] = regs->si; 97 if (
70 gdb_regs[GDB_DI] = regs->di;
71 gdb_regs[GDB_BP] = regs->bp;
72 gdb_regs[GDB_PC] = regs->ip;
73#ifdef CONFIG_X86_32 98#ifdef CONFIG_X86_32
74 gdb_regs[GDB_PS] = regs->flags; 99 regno == GDB_SS || regno == GDB_FS || regno == GDB_GS ||
75 gdb_regs[GDB_DS] = regs->ds; 100#endif
76 gdb_regs[GDB_ES] = regs->es; 101 regno == GDB_SP || regno == GDB_ORIG_AX)
77 gdb_regs[GDB_CS] = regs->cs; 102 return 0;
78 gdb_regs[GDB_FS] = 0xFFFF; 103
79 gdb_regs[GDB_GS] = 0xFFFF; 104 if (dbg_reg_def[regno].offset != -1)
80 if (user_mode_vm(regs)) { 105 memcpy((void *)regs + dbg_reg_def[regno].offset, mem,
81 gdb_regs[GDB_SS] = regs->ss; 106 dbg_reg_def[regno].size);
82 gdb_regs[GDB_SP] = regs->sp; 107 return 0;
83 } else { 108}
84 gdb_regs[GDB_SS] = __KERNEL_DS; 109
85 gdb_regs[GDB_SP] = kernel_stack_pointer(regs); 110char *dbg_get_reg(int regno, void *mem, struct pt_regs *regs)
111{
112 if (regno == GDB_ORIG_AX) {
113 memcpy(mem, &regs->orig_ax, sizeof(regs->orig_ax));
114 return "orig_ax";
86 } 115 }
87#else 116 if (regno >= DBG_MAX_REG_NUM || regno < 0)
88 gdb_regs[GDB_R8] = regs->r8; 117 return NULL;
89 gdb_regs[GDB_R9] = regs->r9; 118
90 gdb_regs[GDB_R10] = regs->r10; 119 if (dbg_reg_def[regno].offset != -1)
91 gdb_regs[GDB_R11] = regs->r11; 120 memcpy(mem, (void *)regs + dbg_reg_def[regno].offset,
92 gdb_regs[GDB_R12] = regs->r12; 121 dbg_reg_def[regno].size);
93 gdb_regs[GDB_R13] = regs->r13; 122
94 gdb_regs[GDB_R14] = regs->r14; 123 switch (regno) {
95 gdb_regs[GDB_R15] = regs->r15; 124#ifdef CONFIG_X86_32
96 gdb_regs32[GDB_PS] = regs->flags; 125 case GDB_SS:
97 gdb_regs32[GDB_CS] = regs->cs; 126 if (!user_mode_vm(regs))
98 gdb_regs32[GDB_SS] = regs->ss; 127 *(unsigned long *)mem = __KERNEL_DS;
99 gdb_regs[GDB_SP] = kernel_stack_pointer(regs); 128 break;
129 case GDB_SP:
130 if (!user_mode_vm(regs))
131 *(unsigned long *)mem = kernel_stack_pointer(regs);
132 break;
133 case GDB_GS:
134 case GDB_FS:
135 *(unsigned long *)mem = 0xFFFF;
136 break;
100#endif 137#endif
138 }
139 return dbg_reg_def[regno].name;
101} 140}
102 141
103/** 142/**
@@ -150,54 +189,13 @@ void sleeping_thread_to_gdb_regs(unsigned long *gdb_regs, struct task_struct *p)
150 gdb_regs[GDB_SP] = p->thread.sp; 189 gdb_regs[GDB_SP] = p->thread.sp;
151} 190}
152 191
153/**
154 * gdb_regs_to_pt_regs - Convert GDB regs to ptrace regs.
155 * @gdb_regs: A pointer to hold the registers we've received from GDB.
156 * @regs: A pointer to a &struct pt_regs to hold these values in.
157 *
158 * Convert the GDB regs in @gdb_regs into the pt_regs, and store them
159 * in @regs.
160 */
161void gdb_regs_to_pt_regs(unsigned long *gdb_regs, struct pt_regs *regs)
162{
163#ifndef CONFIG_X86_32
164 u32 *gdb_regs32 = (u32 *)gdb_regs;
165#endif
166 regs->ax = gdb_regs[GDB_AX];
167 regs->bx = gdb_regs[GDB_BX];
168 regs->cx = gdb_regs[GDB_CX];
169 regs->dx = gdb_regs[GDB_DX];
170 regs->si = gdb_regs[GDB_SI];
171 regs->di = gdb_regs[GDB_DI];
172 regs->bp = gdb_regs[GDB_BP];
173 regs->ip = gdb_regs[GDB_PC];
174#ifdef CONFIG_X86_32
175 regs->flags = gdb_regs[GDB_PS];
176 regs->ds = gdb_regs[GDB_DS];
177 regs->es = gdb_regs[GDB_ES];
178 regs->cs = gdb_regs[GDB_CS];
179#else
180 regs->r8 = gdb_regs[GDB_R8];
181 regs->r9 = gdb_regs[GDB_R9];
182 regs->r10 = gdb_regs[GDB_R10];
183 regs->r11 = gdb_regs[GDB_R11];
184 regs->r12 = gdb_regs[GDB_R12];
185 regs->r13 = gdb_regs[GDB_R13];
186 regs->r14 = gdb_regs[GDB_R14];
187 regs->r15 = gdb_regs[GDB_R15];
188 regs->flags = gdb_regs32[GDB_PS];
189 regs->cs = gdb_regs32[GDB_CS];
190 regs->ss = gdb_regs32[GDB_SS];
191#endif
192}
193
194static struct hw_breakpoint { 192static struct hw_breakpoint {
195 unsigned enabled; 193 unsigned enabled;
196 unsigned long addr; 194 unsigned long addr;
197 int len; 195 int len;
198 int type; 196 int type;
199 struct perf_event **pev; 197 struct perf_event **pev;
200} breakinfo[4]; 198} breakinfo[HBP_NUM];
201 199
202static unsigned long early_dr7; 200static unsigned long early_dr7;
203 201
@@ -205,7 +203,7 @@ static void kgdb_correct_hw_break(void)
205{ 203{
206 int breakno; 204 int breakno;
207 205
208 for (breakno = 0; breakno < 4; breakno++) { 206 for (breakno = 0; breakno < HBP_NUM; breakno++) {
209 struct perf_event *bp; 207 struct perf_event *bp;
210 struct arch_hw_breakpoint *info; 208 struct arch_hw_breakpoint *info;
211 int val; 209 int val;
@@ -292,10 +290,10 @@ kgdb_remove_hw_break(unsigned long addr, int len, enum kgdb_bptype bptype)
292{ 290{
293 int i; 291 int i;
294 292
295 for (i = 0; i < 4; i++) 293 for (i = 0; i < HBP_NUM; i++)
296 if (breakinfo[i].addr == addr && breakinfo[i].enabled) 294 if (breakinfo[i].addr == addr && breakinfo[i].enabled)
297 break; 295 break;
298 if (i == 4) 296 if (i == HBP_NUM)
299 return -1; 297 return -1;
300 298
301 if (hw_break_release_slot(i)) { 299 if (hw_break_release_slot(i)) {
@@ -313,7 +311,7 @@ static void kgdb_remove_all_hw_break(void)
313 int cpu = raw_smp_processor_id(); 311 int cpu = raw_smp_processor_id();
314 struct perf_event *bp; 312 struct perf_event *bp;
315 313
316 for (i = 0; i < 4; i++) { 314 for (i = 0; i < HBP_NUM; i++) {
317 if (!breakinfo[i].enabled) 315 if (!breakinfo[i].enabled)
318 continue; 316 continue;
319 bp = *per_cpu_ptr(breakinfo[i].pev, cpu); 317 bp = *per_cpu_ptr(breakinfo[i].pev, cpu);
@@ -333,10 +331,10 @@ kgdb_set_hw_break(unsigned long addr, int len, enum kgdb_bptype bptype)
333{ 331{
334 int i; 332 int i;
335 333
336 for (i = 0; i < 4; i++) 334 for (i = 0; i < HBP_NUM; i++)
337 if (!breakinfo[i].enabled) 335 if (!breakinfo[i].enabled)
338 break; 336 break;
339 if (i == 4) 337 if (i == HBP_NUM)
340 return -1; 338 return -1;
341 339
342 switch (bptype) { 340 switch (bptype) {
@@ -397,7 +395,7 @@ void kgdb_disable_hw_debug(struct pt_regs *regs)
397 395
398 /* Disable hardware debugging while we are in kgdb: */ 396 /* Disable hardware debugging while we are in kgdb: */
399 set_debugreg(0UL, 7); 397 set_debugreg(0UL, 7);
400 for (i = 0; i < 4; i++) { 398 for (i = 0; i < HBP_NUM; i++) {
401 if (!breakinfo[i].enabled) 399 if (!breakinfo[i].enabled)
402 continue; 400 continue;
403 if (dbg_is_early) { 401 if (dbg_is_early) {
@@ -458,7 +456,6 @@ int kgdb_arch_handle_exception(int e_vector, int signo, int err_code,
458{ 456{
459 unsigned long addr; 457 unsigned long addr;
460 char *ptr; 458 char *ptr;
461 int newPC;
462 459
463 switch (remcomInBuffer[0]) { 460 switch (remcomInBuffer[0]) {
464 case 'c': 461 case 'c':
@@ -469,8 +466,6 @@ int kgdb_arch_handle_exception(int e_vector, int signo, int err_code,
469 linux_regs->ip = addr; 466 linux_regs->ip = addr;
470 case 'D': 467 case 'D':
471 case 'k': 468 case 'k':
472 newPC = linux_regs->ip;
473
474 /* clear the trace bit */ 469 /* clear the trace bit */
475 linux_regs->flags &= ~X86_EFLAGS_TF; 470 linux_regs->flags &= ~X86_EFLAGS_TF;
476 atomic_set(&kgdb_cpu_doing_single_step, -1); 471 atomic_set(&kgdb_cpu_doing_single_step, -1);
@@ -572,7 +567,6 @@ static int __kgdb_notify(struct die_args *args, unsigned long cmd)
572 return NOTIFY_STOP; 567 return NOTIFY_STOP;
573} 568}
574 569
575#ifdef CONFIG_KGDB_LOW_LEVEL_TRAP
576int kgdb_ll_trap(int cmd, const char *str, 570int kgdb_ll_trap(int cmd, const char *str,
577 struct pt_regs *regs, long err, int trap, int sig) 571 struct pt_regs *regs, long err, int trap, int sig)
578{ 572{
@@ -590,7 +584,6 @@ int kgdb_ll_trap(int cmd, const char *str,
590 584
591 return __kgdb_notify(&args, cmd); 585 return __kgdb_notify(&args, cmd);
592} 586}
593#endif /* CONFIG_KGDB_LOW_LEVEL_TRAP */
594 587
595static int 588static int
596kgdb_notify(struct notifier_block *self, unsigned long cmd, void *ptr) 589kgdb_notify(struct notifier_block *self, unsigned long cmd, void *ptr)
@@ -625,6 +618,12 @@ int kgdb_arch_init(void)
625 return register_die_notifier(&kgdb_notifier); 618 return register_die_notifier(&kgdb_notifier);
626} 619}
627 620
621static void kgdb_hw_overflow_handler(struct perf_event *event, int nmi,
622 struct perf_sample_data *data, struct pt_regs *regs)
623{
624 kgdb_ll_trap(DIE_DEBUG, "debug", regs, 0, 0, SIGTRAP);
625}
626
628void kgdb_arch_late(void) 627void kgdb_arch_late(void)
629{ 628{
630 int i, cpu; 629 int i, cpu;
@@ -641,7 +640,7 @@ void kgdb_arch_late(void)
641 attr.bp_len = HW_BREAKPOINT_LEN_1; 640 attr.bp_len = HW_BREAKPOINT_LEN_1;
642 attr.bp_type = HW_BREAKPOINT_W; 641 attr.bp_type = HW_BREAKPOINT_W;
643 attr.disabled = 1; 642 attr.disabled = 1;
644 for (i = 0; i < 4; i++) { 643 for (i = 0; i < HBP_NUM; i++) {
645 if (breakinfo[i].pev) 644 if (breakinfo[i].pev)
646 continue; 645 continue;
647 breakinfo[i].pev = register_wide_hw_breakpoint(&attr, NULL); 646 breakinfo[i].pev = register_wide_hw_breakpoint(&attr, NULL);
@@ -655,6 +654,7 @@ void kgdb_arch_late(void)
655 for_each_online_cpu(cpu) { 654 for_each_online_cpu(cpu) {
656 pevent = per_cpu_ptr(breakinfo[i].pev, cpu); 655 pevent = per_cpu_ptr(breakinfo[i].pev, cpu);
657 pevent[0]->hw.sample_period = 1; 656 pevent[0]->hw.sample_period = 1;
657 pevent[0]->overflow_handler = kgdb_hw_overflow_handler;
658 if (pevent[0]->destroy != NULL) { 658 if (pevent[0]->destroy != NULL) {
659 pevent[0]->destroy = NULL; 659 pevent[0]->destroy = NULL;
660 release_bp_slot(*pevent); 660 release_bp_slot(*pevent);
diff --git a/arch/x86/kernel/kprobes.c b/arch/x86/kernel/kprobes.c
index 675879b65ce6..1bfb6cf4dd55 100644
--- a/arch/x86/kernel/kprobes.c
+++ b/arch/x86/kernel/kprobes.c
@@ -126,16 +126,22 @@ static void __kprobes synthesize_reljump(void *from, void *to)
126} 126}
127 127
128/* 128/*
129 * Check for the REX prefix which can only exist on X86_64 129 * Skip the prefixes of the instruction.
130 * X86_32 always returns 0
131 */ 130 */
132static int __kprobes is_REX_prefix(kprobe_opcode_t *insn) 131static kprobe_opcode_t *__kprobes skip_prefixes(kprobe_opcode_t *insn)
133{ 132{
133 insn_attr_t attr;
134
135 attr = inat_get_opcode_attribute((insn_byte_t)*insn);
136 while (inat_is_legacy_prefix(attr)) {
137 insn++;
138 attr = inat_get_opcode_attribute((insn_byte_t)*insn);
139 }
134#ifdef CONFIG_X86_64 140#ifdef CONFIG_X86_64
135 if ((*insn & 0xf0) == 0x40) 141 if (inat_is_rex_prefix(attr))
136 return 1; 142 insn++;
137#endif 143#endif
138 return 0; 144 return insn;
139} 145}
140 146
141/* 147/*
@@ -272,6 +278,9 @@ static int __kprobes can_probe(unsigned long paddr)
272 */ 278 */
273static int __kprobes is_IF_modifier(kprobe_opcode_t *insn) 279static int __kprobes is_IF_modifier(kprobe_opcode_t *insn)
274{ 280{
281 /* Skip prefixes */
282 insn = skip_prefixes(insn);
283
275 switch (*insn) { 284 switch (*insn) {
276 case 0xfa: /* cli */ 285 case 0xfa: /* cli */
277 case 0xfb: /* sti */ 286 case 0xfb: /* sti */
@@ -280,13 +289,6 @@ static int __kprobes is_IF_modifier(kprobe_opcode_t *insn)
280 return 1; 289 return 1;
281 } 290 }
282 291
283 /*
284 * on X86_64, 0x40-0x4f are REX prefixes so we need to look
285 * at the next byte instead.. but of course not recurse infinitely
286 */
287 if (is_REX_prefix(insn))
288 return is_IF_modifier(++insn);
289
290 return 0; 292 return 0;
291} 293}
292 294
@@ -803,9 +805,8 @@ static void __kprobes resume_execution(struct kprobe *p,
803 unsigned long orig_ip = (unsigned long)p->addr; 805 unsigned long orig_ip = (unsigned long)p->addr;
804 kprobe_opcode_t *insn = p->ainsn.insn; 806 kprobe_opcode_t *insn = p->ainsn.insn;
805 807
806 /*skip the REX prefix*/ 808 /* Skip prefixes */
807 if (is_REX_prefix(insn)) 809 insn = skip_prefixes(insn);
808 insn++;
809 810
810 regs->flags &= ~X86_EFLAGS_TF; 811 regs->flags &= ~X86_EFLAGS_TF;
811 switch (*insn) { 812 switch (*insn) {
diff --git a/arch/x86/kernel/mrst.c b/arch/x86/kernel/mrst.c
index 5915e0b33303..79ae68154e87 100644
--- a/arch/x86/kernel/mrst.c
+++ b/arch/x86/kernel/mrst.c
@@ -25,8 +25,34 @@
25#include <asm/i8259.h> 25#include <asm/i8259.h>
26#include <asm/apb_timer.h> 26#include <asm/apb_timer.h>
27 27
28/*
29 * the clockevent devices on Moorestown/Medfield can be APBT or LAPIC clock,
30 * cmdline option x86_mrst_timer can be used to override the configuration
31 * to prefer one or the other.
32 * at runtime, there are basically three timer configurations:
33 * 1. per cpu apbt clock only
34 * 2. per cpu always-on lapic clocks only, this is Penwell/Medfield only
35 * 3. per cpu lapic clock (C3STOP) and one apbt clock, with broadcast.
36 *
37 * by default (without cmdline option), platform code first detects cpu type
38 * to see if we are on lincroft or penwell, then set up both lapic or apbt
39 * clocks accordingly.
40 * i.e. by default, medfield uses configuration #2, moorestown uses #1.
41 * config #3 is supported but not recommended on medfield.
42 *
43 * rating and feature summary:
44 * lapic (with C3STOP) --------- 100
45 * apbt (always-on) ------------ 110
46 * lapic (always-on,ARAT) ------ 150
47 */
48
49__cpuinitdata enum mrst_timer_options mrst_timer_options;
50
28static u32 sfi_mtimer_usage[SFI_MTMR_MAX_NUM]; 51static u32 sfi_mtimer_usage[SFI_MTMR_MAX_NUM];
29static struct sfi_timer_table_entry sfi_mtimer_array[SFI_MTMR_MAX_NUM]; 52static struct sfi_timer_table_entry sfi_mtimer_array[SFI_MTMR_MAX_NUM];
53enum mrst_cpu_type __mrst_cpu_chip;
54EXPORT_SYMBOL_GPL(__mrst_cpu_chip);
55
30int sfi_mtimer_num; 56int sfi_mtimer_num;
31 57
32struct sfi_rtc_table_entry sfi_mrtc_array[SFI_MRTC_MAX]; 58struct sfi_rtc_table_entry sfi_mrtc_array[SFI_MRTC_MAX];
@@ -167,18 +193,6 @@ int __init sfi_parse_mrtc(struct sfi_table_header *table)
167 return 0; 193 return 0;
168} 194}
169 195
170/*
171 * the secondary clock in Moorestown can be APBT or LAPIC clock, default to
172 * APBT but cmdline option can also override it.
173 */
174static void __cpuinit mrst_setup_secondary_clock(void)
175{
176 /* restore default lapic clock if disabled by cmdline */
177 if (disable_apbt_percpu)
178 return setup_secondary_APIC_clock();
179 apbt_setup_secondary_clock();
180}
181
182static unsigned long __init mrst_calibrate_tsc(void) 196static unsigned long __init mrst_calibrate_tsc(void)
183{ 197{
184 unsigned long flags, fast_calibrate; 198 unsigned long flags, fast_calibrate;
@@ -195,6 +209,21 @@ static unsigned long __init mrst_calibrate_tsc(void)
195 209
196void __init mrst_time_init(void) 210void __init mrst_time_init(void)
197{ 211{
212 switch (mrst_timer_options) {
213 case MRST_TIMER_APBT_ONLY:
214 break;
215 case MRST_TIMER_LAPIC_APBT:
216 x86_init.timers.setup_percpu_clockev = setup_boot_APIC_clock;
217 x86_cpuinit.setup_percpu_clockev = setup_secondary_APIC_clock;
218 break;
219 default:
220 if (!boot_cpu_has(X86_FEATURE_ARAT))
221 break;
222 x86_init.timers.setup_percpu_clockev = setup_boot_APIC_clock;
223 x86_cpuinit.setup_percpu_clockev = setup_secondary_APIC_clock;
224 return;
225 }
226 /* we need at least one APB timer */
198 sfi_table_parse(SFI_SIG_MTMR, NULL, NULL, sfi_parse_mtmr); 227 sfi_table_parse(SFI_SIG_MTMR, NULL, NULL, sfi_parse_mtmr);
199 pre_init_apic_IRQ0(); 228 pre_init_apic_IRQ0();
200 apbt_time_init(); 229 apbt_time_init();
@@ -205,16 +234,21 @@ void __init mrst_rtc_init(void)
205 sfi_table_parse(SFI_SIG_MRTC, NULL, NULL, sfi_parse_mrtc); 234 sfi_table_parse(SFI_SIG_MRTC, NULL, NULL, sfi_parse_mrtc);
206} 235}
207 236
208/* 237void __cpuinit mrst_arch_setup(void)
209 * if we use per cpu apb timer, the bootclock already setup. if we use lapic
210 * timer and one apbt timer for broadcast, we need to set up lapic boot clock.
211 */
212static void __init mrst_setup_boot_clock(void)
213{ 238{
214 pr_info("%s: per cpu apbt flag %d \n", __func__, disable_apbt_percpu); 239 if (boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 0x27)
215 if (disable_apbt_percpu) 240 __mrst_cpu_chip = MRST_CPU_CHIP_PENWELL;
216 setup_boot_APIC_clock(); 241 else if (boot_cpu_data.x86 == 6 && boot_cpu_data.x86_model == 0x26)
217}; 242 __mrst_cpu_chip = MRST_CPU_CHIP_LINCROFT;
243 else {
244 pr_err("Unknown Moorestown CPU (%d:%d), default to Lincroft\n",
245 boot_cpu_data.x86, boot_cpu_data.x86_model);
246 __mrst_cpu_chip = MRST_CPU_CHIP_LINCROFT;
247 }
248 pr_debug("Moorestown CPU %s identified\n",
249 (__mrst_cpu_chip == MRST_CPU_CHIP_LINCROFT) ?
250 "Lincroft" : "Penwell");
251}
218 252
219/* MID systems don't have i8042 controller */ 253/* MID systems don't have i8042 controller */
220static int mrst_i8042_detect(void) 254static int mrst_i8042_detect(void)
@@ -232,11 +266,13 @@ void __init x86_mrst_early_setup(void)
232 x86_init.resources.reserve_resources = x86_init_noop; 266 x86_init.resources.reserve_resources = x86_init_noop;
233 267
234 x86_init.timers.timer_init = mrst_time_init; 268 x86_init.timers.timer_init = mrst_time_init;
235 x86_init.timers.setup_percpu_clockev = mrst_setup_boot_clock; 269 x86_init.timers.setup_percpu_clockev = x86_init_noop;
236 270
237 x86_init.irqs.pre_vector_init = x86_init_noop; 271 x86_init.irqs.pre_vector_init = x86_init_noop;
238 272
239 x86_cpuinit.setup_percpu_clockev = mrst_setup_secondary_clock; 273 x86_init.oem.arch_setup = mrst_arch_setup;
274
275 x86_cpuinit.setup_percpu_clockev = apbt_setup_secondary_clock;
240 276
241 x86_platform.calibrate_tsc = mrst_calibrate_tsc; 277 x86_platform.calibrate_tsc = mrst_calibrate_tsc;
242 x86_platform.i8042_detect = mrst_i8042_detect; 278 x86_platform.i8042_detect = mrst_i8042_detect;
@@ -250,3 +286,26 @@ void __init x86_mrst_early_setup(void)
250 x86_init.mpparse.get_smp_config = x86_init_uint_noop; 286 x86_init.mpparse.get_smp_config = x86_init_uint_noop;
251 287
252} 288}
289
290/*
291 * if user does not want to use per CPU apb timer, just give it a lower rating
292 * than local apic timer and skip the late per cpu timer init.
293 */
294static inline int __init setup_x86_mrst_timer(char *arg)
295{
296 if (!arg)
297 return -EINVAL;
298
299 if (strcmp("apbt_only", arg) == 0)
300 mrst_timer_options = MRST_TIMER_APBT_ONLY;
301 else if (strcmp("lapic_and_apbt", arg) == 0)
302 mrst_timer_options = MRST_TIMER_LAPIC_APBT;
303 else {
304 pr_warning("X86 MRST timer option %s not recognised"
305 " use x86_mrst_timer=apbt_only or lapic_and_apbt\n",
306 arg);
307 return -EINVAL;
308 }
309 return 0;
310}
311__setup("x86_mrst_timer=", setup_x86_mrst_timer);
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c
index e7e35219b32f..d401f1d2d06e 100644
--- a/arch/x86/kernel/process.c
+++ b/arch/x86/kernel/process.c
@@ -28,6 +28,7 @@ unsigned long idle_nomwait;
28EXPORT_SYMBOL(idle_nomwait); 28EXPORT_SYMBOL(idle_nomwait);
29 29
30struct kmem_cache *task_xstate_cachep; 30struct kmem_cache *task_xstate_cachep;
31EXPORT_SYMBOL_GPL(task_xstate_cachep);
31 32
32int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src) 33int arch_dup_task_struct(struct task_struct *dst, struct task_struct *src)
33{ 34{
@@ -371,7 +372,7 @@ static inline int hlt_use_halt(void)
371void default_idle(void) 372void default_idle(void)
372{ 373{
373 if (hlt_use_halt()) { 374 if (hlt_use_halt()) {
374 trace_power_start(POWER_CSTATE, 1); 375 trace_power_start(POWER_CSTATE, 1, smp_processor_id());
375 current_thread_info()->status &= ~TS_POLLING; 376 current_thread_info()->status &= ~TS_POLLING;
376 /* 377 /*
377 * TS_POLLING-cleared state must be visible before we 378 * TS_POLLING-cleared state must be visible before we
@@ -441,7 +442,7 @@ EXPORT_SYMBOL_GPL(cpu_idle_wait);
441 */ 442 */
442void mwait_idle_with_hints(unsigned long ax, unsigned long cx) 443void mwait_idle_with_hints(unsigned long ax, unsigned long cx)
443{ 444{
444 trace_power_start(POWER_CSTATE, (ax>>4)+1); 445 trace_power_start(POWER_CSTATE, (ax>>4)+1, smp_processor_id());
445 if (!need_resched()) { 446 if (!need_resched()) {
446 if (cpu_has(&current_cpu_data, X86_FEATURE_CLFLUSH_MONITOR)) 447 if (cpu_has(&current_cpu_data, X86_FEATURE_CLFLUSH_MONITOR))
447 clflush((void *)&current_thread_info()->flags); 448 clflush((void *)&current_thread_info()->flags);
@@ -457,7 +458,7 @@ void mwait_idle_with_hints(unsigned long ax, unsigned long cx)
457static void mwait_idle(void) 458static void mwait_idle(void)
458{ 459{
459 if (!need_resched()) { 460 if (!need_resched()) {
460 trace_power_start(POWER_CSTATE, 1); 461 trace_power_start(POWER_CSTATE, 1, smp_processor_id());
461 if (cpu_has(&current_cpu_data, X86_FEATURE_CLFLUSH_MONITOR)) 462 if (cpu_has(&current_cpu_data, X86_FEATURE_CLFLUSH_MONITOR))
462 clflush((void *)&current_thread_info()->flags); 463 clflush((void *)&current_thread_info()->flags);
463 464
@@ -478,7 +479,7 @@ static void mwait_idle(void)
478 */ 479 */
479static void poll_idle(void) 480static void poll_idle(void)
480{ 481{
481 trace_power_start(POWER_CSTATE, 0); 482 trace_power_start(POWER_CSTATE, 0, smp_processor_id());
482 local_irq_enable(); 483 local_irq_enable();
483 while (!need_resched()) 484 while (!need_resched())
484 cpu_relax(); 485 cpu_relax();
@@ -525,44 +526,10 @@ static int __cpuinit mwait_usable(const struct cpuinfo_x86 *c)
525 return (edx & MWAIT_EDX_C1); 526 return (edx & MWAIT_EDX_C1);
526} 527}
527 528
528/* 529bool c1e_detected;
529 * Check for AMD CPUs, where APIC timer interrupt does not wake up CPU from C1e. 530EXPORT_SYMBOL(c1e_detected);
530 * For more information see
531 * - Erratum #400 for NPT family 0xf and family 0x10 CPUs
532 * - Erratum #365 for family 0x11 (not affected because C1e not in use)
533 */
534static int __cpuinit check_c1e_idle(const struct cpuinfo_x86 *c)
535{
536 u64 val;
537 if (c->x86_vendor != X86_VENDOR_AMD)
538 goto no_c1e_idle;
539
540 /* Family 0x0f models < rev F do not have C1E */
541 if (c->x86 == 0x0F && c->x86_model >= 0x40)
542 return 1;
543
544 if (c->x86 == 0x10) {
545 /*
546 * check OSVW bit for CPUs that are not affected
547 * by erratum #400
548 */
549 if (cpu_has(c, X86_FEATURE_OSVW)) {
550 rdmsrl(MSR_AMD64_OSVW_ID_LENGTH, val);
551 if (val >= 2) {
552 rdmsrl(MSR_AMD64_OSVW_STATUS, val);
553 if (!(val & BIT(1)))
554 goto no_c1e_idle;
555 }
556 }
557 return 1;
558 }
559
560no_c1e_idle:
561 return 0;
562}
563 531
564static cpumask_var_t c1e_mask; 532static cpumask_var_t c1e_mask;
565static int c1e_detected;
566 533
567void c1e_remove_cpu(int cpu) 534void c1e_remove_cpu(int cpu)
568{ 535{
@@ -584,12 +551,12 @@ static void c1e_idle(void)
584 u32 lo, hi; 551 u32 lo, hi;
585 552
586 rdmsr(MSR_K8_INT_PENDING_MSG, lo, hi); 553 rdmsr(MSR_K8_INT_PENDING_MSG, lo, hi);
554
587 if (lo & K8_INTP_C1E_ACTIVE_MASK) { 555 if (lo & K8_INTP_C1E_ACTIVE_MASK) {
588 c1e_detected = 1; 556 c1e_detected = true;
589 if (!boot_cpu_has(X86_FEATURE_NONSTOP_TSC)) 557 if (!boot_cpu_has(X86_FEATURE_NONSTOP_TSC))
590 mark_tsc_unstable("TSC halt in AMD C1E"); 558 mark_tsc_unstable("TSC halt in AMD C1E");
591 printk(KERN_INFO "System has AMD C1E enabled\n"); 559 printk(KERN_INFO "System has AMD C1E enabled\n");
592 set_cpu_cap(&boot_cpu_data, X86_FEATURE_AMDC1E);
593 } 560 }
594 } 561 }
595 562
@@ -638,7 +605,8 @@ void __cpuinit select_idle_routine(const struct cpuinfo_x86 *c)
638 */ 605 */
639 printk(KERN_INFO "using mwait in idle threads.\n"); 606 printk(KERN_INFO "using mwait in idle threads.\n");
640 pm_idle = mwait_idle; 607 pm_idle = mwait_idle;
641 } else if (check_c1e_idle(c)) { 608 } else if (cpu_has_amd_erratum(amd_erratum_400)) {
609 /* E400: APIC timer interrupt does not wake up CPU from C1e */
642 printk(KERN_INFO "using C1E aware idle routine\n"); 610 printk(KERN_INFO "using C1E aware idle routine\n");
643 pm_idle = c1e_idle; 611 pm_idle = c1e_idle;
644 } else 612 } else
diff --git a/arch/x86/kernel/process_32.c b/arch/x86/kernel/process_32.c
index 8d128783af47..96586c3cbbbf 100644
--- a/arch/x86/kernel/process_32.c
+++ b/arch/x86/kernel/process_32.c
@@ -57,6 +57,8 @@
57#include <asm/syscalls.h> 57#include <asm/syscalls.h>
58#include <asm/debugreg.h> 58#include <asm/debugreg.h>
59 59
60#include <trace/events/power.h>
61
60asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); 62asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
61 63
62/* 64/*
@@ -111,6 +113,8 @@ void cpu_idle(void)
111 stop_critical_timings(); 113 stop_critical_timings();
112 pm_idle(); 114 pm_idle();
113 start_critical_timings(); 115 start_critical_timings();
116
117 trace_power_end(smp_processor_id());
114 } 118 }
115 tick_nohz_restart_sched_tick(); 119 tick_nohz_restart_sched_tick();
116 preempt_enable_no_resched(); 120 preempt_enable_no_resched();
diff --git a/arch/x86/kernel/process_64.c b/arch/x86/kernel/process_64.c
index 3c2422a99f1f..3d9ea531ddd1 100644
--- a/arch/x86/kernel/process_64.c
+++ b/arch/x86/kernel/process_64.c
@@ -51,6 +51,8 @@
51#include <asm/syscalls.h> 51#include <asm/syscalls.h>
52#include <asm/debugreg.h> 52#include <asm/debugreg.h>
53 53
54#include <trace/events/power.h>
55
54asmlinkage extern void ret_from_fork(void); 56asmlinkage extern void ret_from_fork(void);
55 57
56DEFINE_PER_CPU(unsigned long, old_rsp); 58DEFINE_PER_CPU(unsigned long, old_rsp);
@@ -138,6 +140,9 @@ void cpu_idle(void)
138 stop_critical_timings(); 140 stop_critical_timings();
139 pm_idle(); 141 pm_idle();
140 start_critical_timings(); 142 start_critical_timings();
143
144 trace_power_end(smp_processor_id());
145
141 /* In many cases the interrupt that ended idle 146 /* In many cases the interrupt that ended idle
142 has already called exit_idle. But some idle 147 has already called exit_idle. But some idle
143 loops can be woken up without interrupt. */ 148 loops can be woken up without interrupt. */
diff --git a/arch/x86/kernel/stacktrace.c b/arch/x86/kernel/stacktrace.c
index 922eefbb3f6c..b53c525368a7 100644
--- a/arch/x86/kernel/stacktrace.c
+++ b/arch/x86/kernel/stacktrace.c
@@ -23,11 +23,16 @@ static int save_stack_stack(void *data, char *name)
23 return 0; 23 return 0;
24} 24}
25 25
26static void save_stack_address(void *data, unsigned long addr, int reliable) 26static void
27__save_stack_address(void *data, unsigned long addr, bool reliable, bool nosched)
27{ 28{
28 struct stack_trace *trace = data; 29 struct stack_trace *trace = data;
30#ifdef CONFIG_FRAME_POINTER
29 if (!reliable) 31 if (!reliable)
30 return; 32 return;
33#endif
34 if (nosched && in_sched_functions(addr))
35 return;
31 if (trace->skip > 0) { 36 if (trace->skip > 0) {
32 trace->skip--; 37 trace->skip--;
33 return; 38 return;
@@ -36,20 +41,15 @@ static void save_stack_address(void *data, unsigned long addr, int reliable)
36 trace->entries[trace->nr_entries++] = addr; 41 trace->entries[trace->nr_entries++] = addr;
37} 42}
38 43
44static void save_stack_address(void *data, unsigned long addr, int reliable)
45{
46 return __save_stack_address(data, addr, reliable, false);
47}
48
39static void 49static void
40save_stack_address_nosched(void *data, unsigned long addr, int reliable) 50save_stack_address_nosched(void *data, unsigned long addr, int reliable)
41{ 51{
42 struct stack_trace *trace = (struct stack_trace *)data; 52 return __save_stack_address(data, addr, reliable, true);
43 if (!reliable)
44 return;
45 if (in_sched_functions(addr))
46 return;
47 if (trace->skip > 0) {
48 trace->skip--;
49 return;
50 }
51 if (trace->nr_entries < trace->max_entries)
52 trace->entries[trace->nr_entries++] = addr;
53} 53}
54 54
55static const struct stacktrace_ops save_stack_ops = { 55static const struct stacktrace_ops save_stack_ops = {
@@ -96,12 +96,13 @@ EXPORT_SYMBOL_GPL(save_stack_trace_tsk);
96 96
97/* Userspace stacktrace - based on kernel/trace/trace_sysprof.c */ 97/* Userspace stacktrace - based on kernel/trace/trace_sysprof.c */
98 98
99struct stack_frame { 99struct stack_frame_user {
100 const void __user *next_fp; 100 const void __user *next_fp;
101 unsigned long ret_addr; 101 unsigned long ret_addr;
102}; 102};
103 103
104static int copy_stack_frame(const void __user *fp, struct stack_frame *frame) 104static int
105copy_stack_frame(const void __user *fp, struct stack_frame_user *frame)
105{ 106{
106 int ret; 107 int ret;
107 108
@@ -126,7 +127,7 @@ static inline void __save_stack_trace_user(struct stack_trace *trace)
126 trace->entries[trace->nr_entries++] = regs->ip; 127 trace->entries[trace->nr_entries++] = regs->ip;
127 128
128 while (trace->nr_entries < trace->max_entries) { 129 while (trace->nr_entries < trace->max_entries) {
129 struct stack_frame frame; 130 struct stack_frame_user frame;
130 131
131 frame.next_fp = NULL; 132 frame.next_fp = NULL;
132 frame.ret_addr = 0; 133 frame.ret_addr = 0;
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index 725ef4d17cd5..60788dee0f8a 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -392,7 +392,13 @@ static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
392 if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 2, SIGINT) 392 if (notify_die(DIE_NMI_IPI, "nmi_ipi", regs, reason, 2, SIGINT)
393 == NOTIFY_STOP) 393 == NOTIFY_STOP)
394 return; 394 return;
395
395#ifdef CONFIG_X86_LOCAL_APIC 396#ifdef CONFIG_X86_LOCAL_APIC
397 if (notify_die(DIE_NMI, "nmi", regs, reason, 2, SIGINT)
398 == NOTIFY_STOP)
399 return;
400
401#ifndef CONFIG_LOCKUP_DETECTOR
396 /* 402 /*
397 * Ok, so this is none of the documented NMI sources, 403 * Ok, so this is none of the documented NMI sources,
398 * so it must be the NMI watchdog. 404 * so it must be the NMI watchdog.
@@ -400,6 +406,7 @@ static notrace __kprobes void default_do_nmi(struct pt_regs *regs)
400 if (nmi_watchdog_tick(regs, reason)) 406 if (nmi_watchdog_tick(regs, reason))
401 return; 407 return;
402 if (!do_nmi_callback(regs, cpu)) 408 if (!do_nmi_callback(regs, cpu))
409#endif /* !CONFIG_LOCKUP_DETECTOR */
403 unknown_nmi_error(reason, regs); 410 unknown_nmi_error(reason, regs);
404#else 411#else
405 unknown_nmi_error(reason, regs); 412 unknown_nmi_error(reason, regs);
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 9faf91ae1841..ce8e50239332 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -751,7 +751,6 @@ static struct clocksource clocksource_tsc = {
751 .read = read_tsc, 751 .read = read_tsc,
752 .resume = resume_tsc, 752 .resume = resume_tsc,
753 .mask = CLOCKSOURCE_MASK(64), 753 .mask = CLOCKSOURCE_MASK(64),
754 .shift = 22,
755 .flags = CLOCK_SOURCE_IS_CONTINUOUS | 754 .flags = CLOCK_SOURCE_IS_CONTINUOUS |
756 CLOCK_SOURCE_MUST_VERIFY, 755 CLOCK_SOURCE_MUST_VERIFY,
757#ifdef CONFIG_X86_64 756#ifdef CONFIG_X86_64
@@ -845,8 +844,6 @@ __cpuinit int unsynchronized_tsc(void)
845 844
846static void __init init_tsc_clocksource(void) 845static void __init init_tsc_clocksource(void)
847{ 846{
848 clocksource_tsc.mult = clocksource_khz2mult(tsc_khz,
849 clocksource_tsc.shift);
850 if (tsc_clocksource_reliable) 847 if (tsc_clocksource_reliable)
851 clocksource_tsc.flags &= ~CLOCK_SOURCE_MUST_VERIFY; 848 clocksource_tsc.flags &= ~CLOCK_SOURCE_MUST_VERIFY;
852 /* lower the rating if we already know its unstable: */ 849 /* lower the rating if we already know its unstable: */
@@ -854,7 +851,7 @@ static void __init init_tsc_clocksource(void)
854 clocksource_tsc.rating = 0; 851 clocksource_tsc.rating = 0;
855 clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS; 852 clocksource_tsc.flags &= ~CLOCK_SOURCE_IS_CONTINUOUS;
856 } 853 }
857 clocksource_register(&clocksource_tsc); 854 clocksource_register_khz(&clocksource_tsc, tsc_khz);
858} 855}
859 856
860#ifdef CONFIG_X86_64 857#ifdef CONFIG_X86_64
diff --git a/arch/x86/kernel/verify_cpu_64.S b/arch/x86/kernel/verify_cpu_64.S
index 45b6f8a975a1..56a8c2a867d9 100644
--- a/arch/x86/kernel/verify_cpu_64.S
+++ b/arch/x86/kernel/verify_cpu_64.S
@@ -31,6 +31,7 @@
31 */ 31 */
32 32
33#include <asm/cpufeature.h> 33#include <asm/cpufeature.h>
34#include <asm/msr-index.h>
34 35
35verify_cpu: 36verify_cpu:
36 pushfl # Save caller passed flags 37 pushfl # Save caller passed flags
@@ -88,7 +89,7 @@ verify_cpu_sse_test:
88 je verify_cpu_sse_ok 89 je verify_cpu_sse_ok
89 test %di,%di 90 test %di,%di
90 jz verify_cpu_no_longmode # only try to force SSE on AMD 91 jz verify_cpu_no_longmode # only try to force SSE on AMD
91 movl $0xc0010015,%ecx # HWCR 92 movl $MSR_K7_HWCR,%ecx
92 rdmsr 93 rdmsr
93 btr $15,%eax # enable SSE 94 btr $15,%eax # enable SSE
94 wrmsr 95 wrmsr
diff --git a/arch/x86/kernel/vsyscall_64.c b/arch/x86/kernel/vsyscall_64.c
index 1c0c6ab9c60f..dcbb28c4b694 100644
--- a/arch/x86/kernel/vsyscall_64.c
+++ b/arch/x86/kernel/vsyscall_64.c
@@ -73,8 +73,8 @@ void update_vsyscall_tz(void)
73 write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags); 73 write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags);
74} 74}
75 75
76void update_vsyscall(struct timespec *wall_time, struct clocksource *clock, 76void update_vsyscall(struct timespec *wall_time, struct timespec *wtm,
77 u32 mult) 77 struct clocksource *clock, u32 mult)
78{ 78{
79 unsigned long flags; 79 unsigned long flags;
80 80
@@ -87,7 +87,7 @@ void update_vsyscall(struct timespec *wall_time, struct clocksource *clock,
87 vsyscall_gtod_data.clock.shift = clock->shift; 87 vsyscall_gtod_data.clock.shift = clock->shift;
88 vsyscall_gtod_data.wall_time_sec = wall_time->tv_sec; 88 vsyscall_gtod_data.wall_time_sec = wall_time->tv_sec;
89 vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec; 89 vsyscall_gtod_data.wall_time_nsec = wall_time->tv_nsec;
90 vsyscall_gtod_data.wall_to_monotonic = wall_to_monotonic; 90 vsyscall_gtod_data.wall_to_monotonic = *wtm;
91 vsyscall_gtod_data.wall_time_coarse = __current_kernel_time(); 91 vsyscall_gtod_data.wall_time_coarse = __current_kernel_time();
92 write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags); 92 write_sequnlock_irqrestore(&vsyscall_gtod_data.lock, flags);
93} 93}
@@ -169,13 +169,18 @@ int __vsyscall(0) vgettimeofday(struct timeval * tv, struct timezone * tz)
169 * unlikely */ 169 * unlikely */
170time_t __vsyscall(1) vtime(time_t *t) 170time_t __vsyscall(1) vtime(time_t *t)
171{ 171{
172 struct timeval tv; 172 unsigned seq;
173 time_t result; 173 time_t result;
174 if (unlikely(!__vsyscall_gtod_data.sysctl_enabled)) 174 if (unlikely(!__vsyscall_gtod_data.sysctl_enabled))
175 return time_syscall(t); 175 return time_syscall(t);
176 176
177 vgettimeofday(&tv, NULL); 177 do {
178 result = tv.tv_sec; 178 seq = read_seqbegin(&__vsyscall_gtod_data.lock);
179
180 result = __vsyscall_gtod_data.wall_time_sec;
181
182 } while (read_seqretry(&__vsyscall_gtod_data.lock, seq));
183
179 if (t) 184 if (t)
180 *t = result; 185 *t = result;
181 return result; 186 return result;
diff --git a/arch/x86/kernel/xsave.c b/arch/x86/kernel/xsave.c
index 37e68fc5e24a..980149867a19 100644
--- a/arch/x86/kernel/xsave.c
+++ b/arch/x86/kernel/xsave.c
@@ -36,15 +36,14 @@ int check_for_xstate(struct i387_fxsave_struct __user *buf,
36 36
37 err = __copy_from_user(fx_sw_user, &buf->sw_reserved[0], 37 err = __copy_from_user(fx_sw_user, &buf->sw_reserved[0],
38 sizeof(struct _fpx_sw_bytes)); 38 sizeof(struct _fpx_sw_bytes));
39
40 if (err) 39 if (err)
41 return err; 40 return -EFAULT;
42 41
43 /* 42 /*
44 * First Magic check failed. 43 * First Magic check failed.
45 */ 44 */
46 if (fx_sw_user->magic1 != FP_XSTATE_MAGIC1) 45 if (fx_sw_user->magic1 != FP_XSTATE_MAGIC1)
47 return -1; 46 return -EINVAL;
48 47
49 /* 48 /*
50 * Check for error scenarios. 49 * Check for error scenarios.
@@ -52,19 +51,21 @@ int check_for_xstate(struct i387_fxsave_struct __user *buf,
52 if (fx_sw_user->xstate_size < min_xstate_size || 51 if (fx_sw_user->xstate_size < min_xstate_size ||
53 fx_sw_user->xstate_size > xstate_size || 52 fx_sw_user->xstate_size > xstate_size ||
54 fx_sw_user->xstate_size > fx_sw_user->extended_size) 53 fx_sw_user->xstate_size > fx_sw_user->extended_size)
55 return -1; 54 return -EINVAL;
56 55
57 err = __get_user(magic2, (__u32 *) (((void *)fpstate) + 56 err = __get_user(magic2, (__u32 *) (((void *)fpstate) +
58 fx_sw_user->extended_size - 57 fx_sw_user->extended_size -
59 FP_XSTATE_MAGIC2_SIZE)); 58 FP_XSTATE_MAGIC2_SIZE));
59 if (err)
60 return err;
60 /* 61 /*
61 * Check for the presence of second magic word at the end of memory 62 * Check for the presence of second magic word at the end of memory
62 * layout. This detects the case where the user just copied the legacy 63 * layout. This detects the case where the user just copied the legacy
63 * fpstate layout with out copying the extended state information 64 * fpstate layout with out copying the extended state information
64 * in the memory layout. 65 * in the memory layout.
65 */ 66 */
66 if (err || magic2 != FP_XSTATE_MAGIC2) 67 if (magic2 != FP_XSTATE_MAGIC2)
67 return -1; 68 return -EFAULT;
68 69
69 return 0; 70 return 0;
70} 71}
diff --git a/arch/x86/kvm/emulate.c b/arch/x86/kvm/emulate.c
index 5ac0bb465ed6..b38bd8b92aa6 100644
--- a/arch/x86/kvm/emulate.c
+++ b/arch/x86/kvm/emulate.c
@@ -9,6 +9,7 @@
9 * privileged instructions: 9 * privileged instructions:
10 * 10 *
11 * Copyright (C) 2006 Qumranet 11 * Copyright (C) 2006 Qumranet
12 * Copyright 2010 Red Hat, Inc. and/or its affilates.
12 * 13 *
13 * Avi Kivity <avi@qumranet.com> 14 * Avi Kivity <avi@qumranet.com>
14 * Yaniv Kamay <yaniv@qumranet.com> 15 * Yaniv Kamay <yaniv@qumranet.com>
@@ -67,6 +68,9 @@
67#define SrcImmUByte (8<<4) /* 8-bit unsigned immediate operand. */ 68#define SrcImmUByte (8<<4) /* 8-bit unsigned immediate operand. */
68#define SrcImmU (9<<4) /* Immediate operand, unsigned */ 69#define SrcImmU (9<<4) /* Immediate operand, unsigned */
69#define SrcSI (0xa<<4) /* Source is in the DS:RSI */ 70#define SrcSI (0xa<<4) /* Source is in the DS:RSI */
71#define SrcImmFAddr (0xb<<4) /* Source is immediate far address */
72#define SrcMemFAddr (0xc<<4) /* Source is far address in memory */
73#define SrcAcc (0xd<<4) /* Source Accumulator */
70#define SrcMask (0xf<<4) 74#define SrcMask (0xf<<4)
71/* Generic ModRM decode. */ 75/* Generic ModRM decode. */
72#define ModRM (1<<8) 76#define ModRM (1<<8)
@@ -88,10 +92,6 @@
88#define Src2CL (1<<29) 92#define Src2CL (1<<29)
89#define Src2ImmByte (2<<29) 93#define Src2ImmByte (2<<29)
90#define Src2One (3<<29) 94#define Src2One (3<<29)
91#define Src2Imm16 (4<<29)
92#define Src2Mem16 (5<<29) /* Used for Ep encoding. First argument has to be
93 in memory and second argument is located
94 immediately after the first one in memory. */
95#define Src2Mask (7<<29) 95#define Src2Mask (7<<29)
96 96
97enum { 97enum {
@@ -124,15 +124,15 @@ static u32 opcode_table[256] = {
124 /* 0x20 - 0x27 */ 124 /* 0x20 - 0x27 */
125 ByteOp | DstMem | SrcReg | ModRM | Lock, DstMem | SrcReg | ModRM | Lock, 125 ByteOp | DstMem | SrcReg | ModRM | Lock, DstMem | SrcReg | ModRM | Lock,
126 ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM, 126 ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM,
127 DstAcc | SrcImmByte, DstAcc | SrcImm, 0, 0, 127 ByteOp | DstAcc | SrcImmByte, DstAcc | SrcImm, 0, 0,
128 /* 0x28 - 0x2F */ 128 /* 0x28 - 0x2F */
129 ByteOp | DstMem | SrcReg | ModRM | Lock, DstMem | SrcReg | ModRM | Lock, 129 ByteOp | DstMem | SrcReg | ModRM | Lock, DstMem | SrcReg | ModRM | Lock,
130 ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM, 130 ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM,
131 0, 0, 0, 0, 131 ByteOp | DstAcc | SrcImmByte, DstAcc | SrcImm, 0, 0,
132 /* 0x30 - 0x37 */ 132 /* 0x30 - 0x37 */
133 ByteOp | DstMem | SrcReg | ModRM | Lock, DstMem | SrcReg | ModRM | Lock, 133 ByteOp | DstMem | SrcReg | ModRM | Lock, DstMem | SrcReg | ModRM | Lock,
134 ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM, 134 ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM,
135 0, 0, 0, 0, 135 ByteOp | DstAcc | SrcImmByte, DstAcc | SrcImm, 0, 0,
136 /* 0x38 - 0x3F */ 136 /* 0x38 - 0x3F */
137 ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM, 137 ByteOp | DstMem | SrcReg | ModRM, DstMem | SrcReg | ModRM,
138 ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM, 138 ByteOp | DstReg | SrcMem | ModRM, DstReg | SrcMem | ModRM,
@@ -170,20 +170,20 @@ static u32 opcode_table[256] = {
170 /* 0x88 - 0x8F */ 170 /* 0x88 - 0x8F */
171 ByteOp | DstMem | SrcReg | ModRM | Mov, DstMem | SrcReg | ModRM | Mov, 171 ByteOp | DstMem | SrcReg | ModRM | Mov, DstMem | SrcReg | ModRM | Mov,
172 ByteOp | DstReg | SrcMem | ModRM | Mov, DstReg | SrcMem | ModRM | Mov, 172 ByteOp | DstReg | SrcMem | ModRM | Mov, DstReg | SrcMem | ModRM | Mov,
173 DstMem | SrcReg | ModRM | Mov, ModRM | DstReg, 173 DstMem | SrcNone | ModRM | Mov, ModRM | DstReg,
174 DstReg | SrcMem | ModRM | Mov, Group | Group1A, 174 ImplicitOps | SrcMem16 | ModRM, Group | Group1A,
175 /* 0x90 - 0x97 */ 175 /* 0x90 - 0x97 */
176 DstReg, DstReg, DstReg, DstReg, DstReg, DstReg, DstReg, DstReg, 176 DstReg, DstReg, DstReg, DstReg, DstReg, DstReg, DstReg, DstReg,
177 /* 0x98 - 0x9F */ 177 /* 0x98 - 0x9F */
178 0, 0, SrcImm | Src2Imm16 | No64, 0, 178 0, 0, SrcImmFAddr | No64, 0,
179 ImplicitOps | Stack, ImplicitOps | Stack, 0, 0, 179 ImplicitOps | Stack, ImplicitOps | Stack, 0, 0,
180 /* 0xA0 - 0xA7 */ 180 /* 0xA0 - 0xA7 */
181 ByteOp | DstReg | SrcMem | Mov | MemAbs, DstReg | SrcMem | Mov | MemAbs, 181 ByteOp | DstAcc | SrcMem | Mov | MemAbs, DstAcc | SrcMem | Mov | MemAbs,
182 ByteOp | DstMem | SrcReg | Mov | MemAbs, DstMem | SrcReg | Mov | MemAbs, 182 ByteOp | DstMem | SrcAcc | Mov | MemAbs, DstMem | SrcAcc | Mov | MemAbs,
183 ByteOp | SrcSI | DstDI | Mov | String, SrcSI | DstDI | Mov | String, 183 ByteOp | SrcSI | DstDI | Mov | String, SrcSI | DstDI | Mov | String,
184 ByteOp | SrcSI | DstDI | String, SrcSI | DstDI | String, 184 ByteOp | SrcSI | DstDI | String, SrcSI | DstDI | String,
185 /* 0xA8 - 0xAF */ 185 /* 0xA8 - 0xAF */
186 0, 0, ByteOp | DstDI | Mov | String, DstDI | Mov | String, 186 DstAcc | SrcImmByte | ByteOp, DstAcc | SrcImm, ByteOp | DstDI | Mov | String, DstDI | Mov | String,
187 ByteOp | SrcSI | DstAcc | Mov | String, SrcSI | DstAcc | Mov | String, 187 ByteOp | SrcSI | DstAcc | Mov | String, SrcSI | DstAcc | Mov | String,
188 ByteOp | DstDI | String, DstDI | String, 188 ByteOp | DstDI | String, DstDI | String,
189 /* 0xB0 - 0xB7 */ 189 /* 0xB0 - 0xB7 */
@@ -215,7 +215,7 @@ static u32 opcode_table[256] = {
215 ByteOp | SrcImmUByte | DstAcc, SrcImmUByte | DstAcc, 215 ByteOp | SrcImmUByte | DstAcc, SrcImmUByte | DstAcc,
216 /* 0xE8 - 0xEF */ 216 /* 0xE8 - 0xEF */
217 SrcImm | Stack, SrcImm | ImplicitOps, 217 SrcImm | Stack, SrcImm | ImplicitOps,
218 SrcImmU | Src2Imm16 | No64, SrcImmByte | ImplicitOps, 218 SrcImmFAddr | No64, SrcImmByte | ImplicitOps,
219 SrcNone | ByteOp | DstAcc, SrcNone | DstAcc, 219 SrcNone | ByteOp | DstAcc, SrcNone | DstAcc,
220 SrcNone | ByteOp | DstAcc, SrcNone | DstAcc, 220 SrcNone | ByteOp | DstAcc, SrcNone | DstAcc,
221 /* 0xF0 - 0xF7 */ 221 /* 0xF0 - 0xF7 */
@@ -337,20 +337,20 @@ static u32 group_table[] = {
337 [Group1A*8] = 337 [Group1A*8] =
338 DstMem | SrcNone | ModRM | Mov | Stack, 0, 0, 0, 0, 0, 0, 0, 338 DstMem | SrcNone | ModRM | Mov | Stack, 0, 0, 0, 0, 0, 0, 0,
339 [Group3_Byte*8] = 339 [Group3_Byte*8] =
340 ByteOp | SrcImm | DstMem | ModRM, 0, 340 ByteOp | SrcImm | DstMem | ModRM, ByteOp | SrcImm | DstMem | ModRM,
341 ByteOp | DstMem | SrcNone | ModRM, ByteOp | DstMem | SrcNone | ModRM, 341 ByteOp | DstMem | SrcNone | ModRM, ByteOp | DstMem | SrcNone | ModRM,
342 0, 0, 0, 0, 342 0, 0, 0, 0,
343 [Group3*8] = 343 [Group3*8] =
344 DstMem | SrcImm | ModRM, 0, 344 DstMem | SrcImm | ModRM, DstMem | SrcImm | ModRM,
345 DstMem | SrcNone | ModRM, DstMem | SrcNone | ModRM, 345 DstMem | SrcNone | ModRM, DstMem | SrcNone | ModRM,
346 0, 0, 0, 0, 346 0, 0, 0, 0,
347 [Group4*8] = 347 [Group4*8] =
348 ByteOp | DstMem | SrcNone | ModRM, ByteOp | DstMem | SrcNone | ModRM, 348 ByteOp | DstMem | SrcNone | ModRM | Lock, ByteOp | DstMem | SrcNone | ModRM | Lock,
349 0, 0, 0, 0, 0, 0, 349 0, 0, 0, 0, 0, 0,
350 [Group5*8] = 350 [Group5*8] =
351 DstMem | SrcNone | ModRM, DstMem | SrcNone | ModRM, 351 DstMem | SrcNone | ModRM | Lock, DstMem | SrcNone | ModRM | Lock,
352 SrcMem | ModRM | Stack, 0, 352 SrcMem | ModRM | Stack, 0,
353 SrcMem | ModRM | Stack, SrcMem | ModRM | Src2Mem16 | ImplicitOps, 353 SrcMem | ModRM | Stack, SrcMemFAddr | ModRM | ImplicitOps,
354 SrcMem | ModRM | Stack, 0, 354 SrcMem | ModRM | Stack, 0,
355 [Group7*8] = 355 [Group7*8] =
356 0, 0, ModRM | SrcMem | Priv, ModRM | SrcMem | Priv, 356 0, 0, ModRM | SrcMem | Priv, ModRM | SrcMem | Priv,
@@ -576,6 +576,13 @@ static u32 group2_table[] = {
576 (_type)_x; \ 576 (_type)_x; \
577}) 577})
578 578
579#define insn_fetch_arr(_arr, _size, _eip) \
580({ rc = do_insn_fetch(ctxt, ops, (_eip), _arr, (_size)); \
581 if (rc != X86EMUL_CONTINUE) \
582 goto done; \
583 (_eip) += (_size); \
584})
585
579static inline unsigned long ad_mask(struct decode_cache *c) 586static inline unsigned long ad_mask(struct decode_cache *c)
580{ 587{
581 return (1UL << (c->ad_bytes << 3)) - 1; 588 return (1UL << (c->ad_bytes << 3)) - 1;
@@ -617,31 +624,66 @@ static void set_seg_override(struct decode_cache *c, int seg)
617 c->seg_override = seg; 624 c->seg_override = seg;
618} 625}
619 626
620static unsigned long seg_base(struct x86_emulate_ctxt *ctxt, int seg) 627static unsigned long seg_base(struct x86_emulate_ctxt *ctxt,
628 struct x86_emulate_ops *ops, int seg)
621{ 629{
622 if (ctxt->mode == X86EMUL_MODE_PROT64 && seg < VCPU_SREG_FS) 630 if (ctxt->mode == X86EMUL_MODE_PROT64 && seg < VCPU_SREG_FS)
623 return 0; 631 return 0;
624 632
625 return kvm_x86_ops->get_segment_base(ctxt->vcpu, seg); 633 return ops->get_cached_segment_base(seg, ctxt->vcpu);
626} 634}
627 635
628static unsigned long seg_override_base(struct x86_emulate_ctxt *ctxt, 636static unsigned long seg_override_base(struct x86_emulate_ctxt *ctxt,
637 struct x86_emulate_ops *ops,
629 struct decode_cache *c) 638 struct decode_cache *c)
630{ 639{
631 if (!c->has_seg_override) 640 if (!c->has_seg_override)
632 return 0; 641 return 0;
633 642
634 return seg_base(ctxt, c->seg_override); 643 return seg_base(ctxt, ops, c->seg_override);
644}
645
646static unsigned long es_base(struct x86_emulate_ctxt *ctxt,
647 struct x86_emulate_ops *ops)
648{
649 return seg_base(ctxt, ops, VCPU_SREG_ES);
650}
651
652static unsigned long ss_base(struct x86_emulate_ctxt *ctxt,
653 struct x86_emulate_ops *ops)
654{
655 return seg_base(ctxt, ops, VCPU_SREG_SS);
656}
657
658static void emulate_exception(struct x86_emulate_ctxt *ctxt, int vec,
659 u32 error, bool valid)
660{
661 ctxt->exception = vec;
662 ctxt->error_code = error;
663 ctxt->error_code_valid = valid;
664 ctxt->restart = false;
665}
666
667static void emulate_gp(struct x86_emulate_ctxt *ctxt, int err)
668{
669 emulate_exception(ctxt, GP_VECTOR, err, true);
635} 670}
636 671
637static unsigned long es_base(struct x86_emulate_ctxt *ctxt) 672static void emulate_pf(struct x86_emulate_ctxt *ctxt, unsigned long addr,
673 int err)
638{ 674{
639 return seg_base(ctxt, VCPU_SREG_ES); 675 ctxt->cr2 = addr;
676 emulate_exception(ctxt, PF_VECTOR, err, true);
640} 677}
641 678
642static unsigned long ss_base(struct x86_emulate_ctxt *ctxt) 679static void emulate_ud(struct x86_emulate_ctxt *ctxt)
643{ 680{
644 return seg_base(ctxt, VCPU_SREG_SS); 681 emulate_exception(ctxt, UD_VECTOR, 0, false);
682}
683
684static void emulate_ts(struct x86_emulate_ctxt *ctxt, int err)
685{
686 emulate_exception(ctxt, TS_VECTOR, err, true);
645} 687}
646 688
647static int do_fetch_insn_byte(struct x86_emulate_ctxt *ctxt, 689static int do_fetch_insn_byte(struct x86_emulate_ctxt *ctxt,
@@ -932,12 +974,9 @@ x86_decode_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
932 /* we cannot decode insn before we complete previous rep insn */ 974 /* we cannot decode insn before we complete previous rep insn */
933 WARN_ON(ctxt->restart); 975 WARN_ON(ctxt->restart);
934 976
935 /* Shadow copy of register state. Committed on successful emulation. */
936 memset(c, 0, sizeof(struct decode_cache));
937 c->eip = ctxt->eip; 977 c->eip = ctxt->eip;
938 c->fetch.start = c->fetch.end = c->eip; 978 c->fetch.start = c->fetch.end = c->eip;
939 ctxt->cs_base = seg_base(ctxt, VCPU_SREG_CS); 979 ctxt->cs_base = seg_base(ctxt, ops, VCPU_SREG_CS);
940 memcpy(c->regs, ctxt->vcpu->arch.regs, sizeof c->regs);
941 980
942 switch (mode) { 981 switch (mode) {
943 case X86EMUL_MODE_REAL: 982 case X86EMUL_MODE_REAL:
@@ -1060,7 +1099,7 @@ done_prefixes:
1060 set_seg_override(c, VCPU_SREG_DS); 1099 set_seg_override(c, VCPU_SREG_DS);
1061 1100
1062 if (!(!c->twobyte && c->b == 0x8d)) 1101 if (!(!c->twobyte && c->b == 0x8d))
1063 c->modrm_ea += seg_override_base(ctxt, c); 1102 c->modrm_ea += seg_override_base(ctxt, ops, c);
1064 1103
1065 if (c->ad_bytes != 8) 1104 if (c->ad_bytes != 8)
1066 c->modrm_ea = (u32)c->modrm_ea; 1105 c->modrm_ea = (u32)c->modrm_ea;
@@ -1148,6 +1187,25 @@ done_prefixes:
1148 else 1187 else
1149 c->src.val = insn_fetch(u8, 1, c->eip); 1188 c->src.val = insn_fetch(u8, 1, c->eip);
1150 break; 1189 break;
1190 case SrcAcc:
1191 c->src.type = OP_REG;
1192 c->src.bytes = (c->d & ByteOp) ? 1 : c->op_bytes;
1193 c->src.ptr = &c->regs[VCPU_REGS_RAX];
1194 switch (c->src.bytes) {
1195 case 1:
1196 c->src.val = *(u8 *)c->src.ptr;
1197 break;
1198 case 2:
1199 c->src.val = *(u16 *)c->src.ptr;
1200 break;
1201 case 4:
1202 c->src.val = *(u32 *)c->src.ptr;
1203 break;
1204 case 8:
1205 c->src.val = *(u64 *)c->src.ptr;
1206 break;
1207 }
1208 break;
1151 case SrcOne: 1209 case SrcOne:
1152 c->src.bytes = 1; 1210 c->src.bytes = 1;
1153 c->src.val = 1; 1211 c->src.val = 1;
@@ -1156,10 +1214,21 @@ done_prefixes:
1156 c->src.type = OP_MEM; 1214 c->src.type = OP_MEM;
1157 c->src.bytes = (c->d & ByteOp) ? 1 : c->op_bytes; 1215 c->src.bytes = (c->d & ByteOp) ? 1 : c->op_bytes;
1158 c->src.ptr = (unsigned long *) 1216 c->src.ptr = (unsigned long *)
1159 register_address(c, seg_override_base(ctxt, c), 1217 register_address(c, seg_override_base(ctxt, ops, c),
1160 c->regs[VCPU_REGS_RSI]); 1218 c->regs[VCPU_REGS_RSI]);
1161 c->src.val = 0; 1219 c->src.val = 0;
1162 break; 1220 break;
1221 case SrcImmFAddr:
1222 c->src.type = OP_IMM;
1223 c->src.ptr = (unsigned long *)c->eip;
1224 c->src.bytes = c->op_bytes + 2;
1225 insn_fetch_arr(c->src.valptr, c->src.bytes, c->eip);
1226 break;
1227 case SrcMemFAddr:
1228 c->src.type = OP_MEM;
1229 c->src.ptr = (unsigned long *)c->modrm_ea;
1230 c->src.bytes = c->op_bytes + 2;
1231 break;
1163 } 1232 }
1164 1233
1165 /* 1234 /*
@@ -1179,22 +1248,10 @@ done_prefixes:
1179 c->src2.bytes = 1; 1248 c->src2.bytes = 1;
1180 c->src2.val = insn_fetch(u8, 1, c->eip); 1249 c->src2.val = insn_fetch(u8, 1, c->eip);
1181 break; 1250 break;
1182 case Src2Imm16:
1183 c->src2.type = OP_IMM;
1184 c->src2.ptr = (unsigned long *)c->eip;
1185 c->src2.bytes = 2;
1186 c->src2.val = insn_fetch(u16, 2, c->eip);
1187 break;
1188 case Src2One: 1251 case Src2One:
1189 c->src2.bytes = 1; 1252 c->src2.bytes = 1;
1190 c->src2.val = 1; 1253 c->src2.val = 1;
1191 break; 1254 break;
1192 case Src2Mem16:
1193 c->src2.type = OP_MEM;
1194 c->src2.bytes = 2;
1195 c->src2.ptr = (unsigned long *)(c->modrm_ea + c->src.bytes);
1196 c->src2.val = 0;
1197 break;
1198 } 1255 }
1199 1256
1200 /* Decode and fetch the destination operand: register or memory. */ 1257 /* Decode and fetch the destination operand: register or memory. */
@@ -1253,7 +1310,7 @@ done_prefixes:
1253 c->dst.type = OP_MEM; 1310 c->dst.type = OP_MEM;
1254 c->dst.bytes = (c->d & ByteOp) ? 1 : c->op_bytes; 1311 c->dst.bytes = (c->d & ByteOp) ? 1 : c->op_bytes;
1255 c->dst.ptr = (unsigned long *) 1312 c->dst.ptr = (unsigned long *)
1256 register_address(c, es_base(ctxt), 1313 register_address(c, es_base(ctxt, ops),
1257 c->regs[VCPU_REGS_RDI]); 1314 c->regs[VCPU_REGS_RDI]);
1258 c->dst.val = 0; 1315 c->dst.val = 0;
1259 break; 1316 break;
@@ -1263,6 +1320,37 @@ done:
1263 return (rc == X86EMUL_UNHANDLEABLE) ? -1 : 0; 1320 return (rc == X86EMUL_UNHANDLEABLE) ? -1 : 0;
1264} 1321}
1265 1322
1323static int read_emulated(struct x86_emulate_ctxt *ctxt,
1324 struct x86_emulate_ops *ops,
1325 unsigned long addr, void *dest, unsigned size)
1326{
1327 int rc;
1328 struct read_cache *mc = &ctxt->decode.mem_read;
1329 u32 err;
1330
1331 while (size) {
1332 int n = min(size, 8u);
1333 size -= n;
1334 if (mc->pos < mc->end)
1335 goto read_cached;
1336
1337 rc = ops->read_emulated(addr, mc->data + mc->end, n, &err,
1338 ctxt->vcpu);
1339 if (rc == X86EMUL_PROPAGATE_FAULT)
1340 emulate_pf(ctxt, addr, err);
1341 if (rc != X86EMUL_CONTINUE)
1342 return rc;
1343 mc->end += n;
1344
1345 read_cached:
1346 memcpy(dest, mc->data + mc->pos, n);
1347 mc->pos += n;
1348 dest += n;
1349 addr += n;
1350 }
1351 return X86EMUL_CONTINUE;
1352}
1353
1266static int pio_in_emulated(struct x86_emulate_ctxt *ctxt, 1354static int pio_in_emulated(struct x86_emulate_ctxt *ctxt,
1267 struct x86_emulate_ops *ops, 1355 struct x86_emulate_ops *ops,
1268 unsigned int size, unsigned short port, 1356 unsigned int size, unsigned short port,
@@ -1330,13 +1418,13 @@ static int read_segment_descriptor(struct x86_emulate_ctxt *ctxt,
1330 get_descriptor_table_ptr(ctxt, ops, selector, &dt); 1418 get_descriptor_table_ptr(ctxt, ops, selector, &dt);
1331 1419
1332 if (dt.size < index * 8 + 7) { 1420 if (dt.size < index * 8 + 7) {
1333 kvm_inject_gp(ctxt->vcpu, selector & 0xfffc); 1421 emulate_gp(ctxt, selector & 0xfffc);
1334 return X86EMUL_PROPAGATE_FAULT; 1422 return X86EMUL_PROPAGATE_FAULT;
1335 } 1423 }
1336 addr = dt.address + index * 8; 1424 addr = dt.address + index * 8;
1337 ret = ops->read_std(addr, desc, sizeof *desc, ctxt->vcpu, &err); 1425 ret = ops->read_std(addr, desc, sizeof *desc, ctxt->vcpu, &err);
1338 if (ret == X86EMUL_PROPAGATE_FAULT) 1426 if (ret == X86EMUL_PROPAGATE_FAULT)
1339 kvm_inject_page_fault(ctxt->vcpu, addr, err); 1427 emulate_pf(ctxt, addr, err);
1340 1428
1341 return ret; 1429 return ret;
1342} 1430}
@@ -1355,14 +1443,14 @@ static int write_segment_descriptor(struct x86_emulate_ctxt *ctxt,
1355 get_descriptor_table_ptr(ctxt, ops, selector, &dt); 1443 get_descriptor_table_ptr(ctxt, ops, selector, &dt);
1356 1444
1357 if (dt.size < index * 8 + 7) { 1445 if (dt.size < index * 8 + 7) {
1358 kvm_inject_gp(ctxt->vcpu, selector & 0xfffc); 1446 emulate_gp(ctxt, selector & 0xfffc);
1359 return X86EMUL_PROPAGATE_FAULT; 1447 return X86EMUL_PROPAGATE_FAULT;
1360 } 1448 }
1361 1449
1362 addr = dt.address + index * 8; 1450 addr = dt.address + index * 8;
1363 ret = ops->write_std(addr, desc, sizeof *desc, ctxt->vcpu, &err); 1451 ret = ops->write_std(addr, desc, sizeof *desc, ctxt->vcpu, &err);
1364 if (ret == X86EMUL_PROPAGATE_FAULT) 1452 if (ret == X86EMUL_PROPAGATE_FAULT)
1365 kvm_inject_page_fault(ctxt->vcpu, addr, err); 1453 emulate_pf(ctxt, addr, err);
1366 1454
1367 return ret; 1455 return ret;
1368} 1456}
@@ -1481,11 +1569,70 @@ load:
1481 ops->set_cached_descriptor(&seg_desc, seg, ctxt->vcpu); 1569 ops->set_cached_descriptor(&seg_desc, seg, ctxt->vcpu);
1482 return X86EMUL_CONTINUE; 1570 return X86EMUL_CONTINUE;
1483exception: 1571exception:
1484 kvm_queue_exception_e(ctxt->vcpu, err_vec, err_code); 1572 emulate_exception(ctxt, err_vec, err_code, true);
1485 return X86EMUL_PROPAGATE_FAULT; 1573 return X86EMUL_PROPAGATE_FAULT;
1486} 1574}
1487 1575
1488static inline void emulate_push(struct x86_emulate_ctxt *ctxt) 1576static inline int writeback(struct x86_emulate_ctxt *ctxt,
1577 struct x86_emulate_ops *ops)
1578{
1579 int rc;
1580 struct decode_cache *c = &ctxt->decode;
1581 u32 err;
1582
1583 switch (c->dst.type) {
1584 case OP_REG:
1585 /* The 4-byte case *is* correct:
1586 * in 64-bit mode we zero-extend.
1587 */
1588 switch (c->dst.bytes) {
1589 case 1:
1590 *(u8 *)c->dst.ptr = (u8)c->dst.val;
1591 break;
1592 case 2:
1593 *(u16 *)c->dst.ptr = (u16)c->dst.val;
1594 break;
1595 case 4:
1596 *c->dst.ptr = (u32)c->dst.val;
1597 break; /* 64b: zero-ext */
1598 case 8:
1599 *c->dst.ptr = c->dst.val;
1600 break;
1601 }
1602 break;
1603 case OP_MEM:
1604 if (c->lock_prefix)
1605 rc = ops->cmpxchg_emulated(
1606 (unsigned long)c->dst.ptr,
1607 &c->dst.orig_val,
1608 &c->dst.val,
1609 c->dst.bytes,
1610 &err,
1611 ctxt->vcpu);
1612 else
1613 rc = ops->write_emulated(
1614 (unsigned long)c->dst.ptr,
1615 &c->dst.val,
1616 c->dst.bytes,
1617 &err,
1618 ctxt->vcpu);
1619 if (rc == X86EMUL_PROPAGATE_FAULT)
1620 emulate_pf(ctxt,
1621 (unsigned long)c->dst.ptr, err);
1622 if (rc != X86EMUL_CONTINUE)
1623 return rc;
1624 break;
1625 case OP_NONE:
1626 /* no writeback */
1627 break;
1628 default:
1629 break;
1630 }
1631 return X86EMUL_CONTINUE;
1632}
1633
1634static inline void emulate_push(struct x86_emulate_ctxt *ctxt,
1635 struct x86_emulate_ops *ops)
1489{ 1636{
1490 struct decode_cache *c = &ctxt->decode; 1637 struct decode_cache *c = &ctxt->decode;
1491 1638
@@ -1493,7 +1640,7 @@ static inline void emulate_push(struct x86_emulate_ctxt *ctxt)
1493 c->dst.bytes = c->op_bytes; 1640 c->dst.bytes = c->op_bytes;
1494 c->dst.val = c->src.val; 1641 c->dst.val = c->src.val;
1495 register_address_increment(c, &c->regs[VCPU_REGS_RSP], -c->op_bytes); 1642 register_address_increment(c, &c->regs[VCPU_REGS_RSP], -c->op_bytes);
1496 c->dst.ptr = (void *) register_address(c, ss_base(ctxt), 1643 c->dst.ptr = (void *) register_address(c, ss_base(ctxt, ops),
1497 c->regs[VCPU_REGS_RSP]); 1644 c->regs[VCPU_REGS_RSP]);
1498} 1645}
1499 1646
@@ -1504,9 +1651,9 @@ static int emulate_pop(struct x86_emulate_ctxt *ctxt,
1504 struct decode_cache *c = &ctxt->decode; 1651 struct decode_cache *c = &ctxt->decode;
1505 int rc; 1652 int rc;
1506 1653
1507 rc = ops->read_emulated(register_address(c, ss_base(ctxt), 1654 rc = read_emulated(ctxt, ops, register_address(c, ss_base(ctxt, ops),
1508 c->regs[VCPU_REGS_RSP]), 1655 c->regs[VCPU_REGS_RSP]),
1509 dest, len, ctxt->vcpu); 1656 dest, len);
1510 if (rc != X86EMUL_CONTINUE) 1657 if (rc != X86EMUL_CONTINUE)
1511 return rc; 1658 return rc;
1512 1659
@@ -1541,7 +1688,7 @@ static int emulate_popf(struct x86_emulate_ctxt *ctxt,
1541 break; 1688 break;
1542 case X86EMUL_MODE_VM86: 1689 case X86EMUL_MODE_VM86:
1543 if (iopl < 3) { 1690 if (iopl < 3) {
1544 kvm_inject_gp(ctxt->vcpu, 0); 1691 emulate_gp(ctxt, 0);
1545 return X86EMUL_PROPAGATE_FAULT; 1692 return X86EMUL_PROPAGATE_FAULT;
1546 } 1693 }
1547 change_mask |= EFLG_IF; 1694 change_mask |= EFLG_IF;
@@ -1557,15 +1704,14 @@ static int emulate_popf(struct x86_emulate_ctxt *ctxt,
1557 return rc; 1704 return rc;
1558} 1705}
1559 1706
1560static void emulate_push_sreg(struct x86_emulate_ctxt *ctxt, int seg) 1707static void emulate_push_sreg(struct x86_emulate_ctxt *ctxt,
1708 struct x86_emulate_ops *ops, int seg)
1561{ 1709{
1562 struct decode_cache *c = &ctxt->decode; 1710 struct decode_cache *c = &ctxt->decode;
1563 struct kvm_segment segment;
1564 1711
1565 kvm_x86_ops->get_segment(ctxt->vcpu, &segment, seg); 1712 c->src.val = ops->get_segment_selector(seg, ctxt->vcpu);
1566 1713
1567 c->src.val = segment.selector; 1714 emulate_push(ctxt, ops);
1568 emulate_push(ctxt);
1569} 1715}
1570 1716
1571static int emulate_pop_sreg(struct x86_emulate_ctxt *ctxt, 1717static int emulate_pop_sreg(struct x86_emulate_ctxt *ctxt,
@@ -1583,19 +1729,31 @@ static int emulate_pop_sreg(struct x86_emulate_ctxt *ctxt,
1583 return rc; 1729 return rc;
1584} 1730}
1585 1731
1586static void emulate_pusha(struct x86_emulate_ctxt *ctxt) 1732static int emulate_pusha(struct x86_emulate_ctxt *ctxt,
1733 struct x86_emulate_ops *ops)
1587{ 1734{
1588 struct decode_cache *c = &ctxt->decode; 1735 struct decode_cache *c = &ctxt->decode;
1589 unsigned long old_esp = c->regs[VCPU_REGS_RSP]; 1736 unsigned long old_esp = c->regs[VCPU_REGS_RSP];
1737 int rc = X86EMUL_CONTINUE;
1590 int reg = VCPU_REGS_RAX; 1738 int reg = VCPU_REGS_RAX;
1591 1739
1592 while (reg <= VCPU_REGS_RDI) { 1740 while (reg <= VCPU_REGS_RDI) {
1593 (reg == VCPU_REGS_RSP) ? 1741 (reg == VCPU_REGS_RSP) ?
1594 (c->src.val = old_esp) : (c->src.val = c->regs[reg]); 1742 (c->src.val = old_esp) : (c->src.val = c->regs[reg]);
1595 1743
1596 emulate_push(ctxt); 1744 emulate_push(ctxt, ops);
1745
1746 rc = writeback(ctxt, ops);
1747 if (rc != X86EMUL_CONTINUE)
1748 return rc;
1749
1597 ++reg; 1750 ++reg;
1598 } 1751 }
1752
1753 /* Disable writeback. */
1754 c->dst.type = OP_NONE;
1755
1756 return rc;
1599} 1757}
1600 1758
1601static int emulate_popa(struct x86_emulate_ctxt *ctxt, 1759static int emulate_popa(struct x86_emulate_ctxt *ctxt,
@@ -1695,14 +1853,14 @@ static inline int emulate_grp45(struct x86_emulate_ctxt *ctxt,
1695 old_eip = c->eip; 1853 old_eip = c->eip;
1696 c->eip = c->src.val; 1854 c->eip = c->src.val;
1697 c->src.val = old_eip; 1855 c->src.val = old_eip;
1698 emulate_push(ctxt); 1856 emulate_push(ctxt, ops);
1699 break; 1857 break;
1700 } 1858 }
1701 case 4: /* jmp abs */ 1859 case 4: /* jmp abs */
1702 c->eip = c->src.val; 1860 c->eip = c->src.val;
1703 break; 1861 break;
1704 case 6: /* push */ 1862 case 6: /* push */
1705 emulate_push(ctxt); 1863 emulate_push(ctxt, ops);
1706 break; 1864 break;
1707 } 1865 }
1708 return X86EMUL_CONTINUE; 1866 return X86EMUL_CONTINUE;
@@ -1748,145 +1906,82 @@ static int emulate_ret_far(struct x86_emulate_ctxt *ctxt,
1748 return rc; 1906 return rc;
1749} 1907}
1750 1908
1751static inline int writeback(struct x86_emulate_ctxt *ctxt,
1752 struct x86_emulate_ops *ops)
1753{
1754 int rc;
1755 struct decode_cache *c = &ctxt->decode;
1756
1757 switch (c->dst.type) {
1758 case OP_REG:
1759 /* The 4-byte case *is* correct:
1760 * in 64-bit mode we zero-extend.
1761 */
1762 switch (c->dst.bytes) {
1763 case 1:
1764 *(u8 *)c->dst.ptr = (u8)c->dst.val;
1765 break;
1766 case 2:
1767 *(u16 *)c->dst.ptr = (u16)c->dst.val;
1768 break;
1769 case 4:
1770 *c->dst.ptr = (u32)c->dst.val;
1771 break; /* 64b: zero-ext */
1772 case 8:
1773 *c->dst.ptr = c->dst.val;
1774 break;
1775 }
1776 break;
1777 case OP_MEM:
1778 if (c->lock_prefix)
1779 rc = ops->cmpxchg_emulated(
1780 (unsigned long)c->dst.ptr,
1781 &c->dst.orig_val,
1782 &c->dst.val,
1783 c->dst.bytes,
1784 ctxt->vcpu);
1785 else
1786 rc = ops->write_emulated(
1787 (unsigned long)c->dst.ptr,
1788 &c->dst.val,
1789 c->dst.bytes,
1790 ctxt->vcpu);
1791 if (rc != X86EMUL_CONTINUE)
1792 return rc;
1793 break;
1794 case OP_NONE:
1795 /* no writeback */
1796 break;
1797 default:
1798 break;
1799 }
1800 return X86EMUL_CONTINUE;
1801}
1802
1803static void toggle_interruptibility(struct x86_emulate_ctxt *ctxt, u32 mask)
1804{
1805 u32 int_shadow = kvm_x86_ops->get_interrupt_shadow(ctxt->vcpu, mask);
1806 /*
1807 * an sti; sti; sequence only disable interrupts for the first
1808 * instruction. So, if the last instruction, be it emulated or
1809 * not, left the system with the INT_STI flag enabled, it
1810 * means that the last instruction is an sti. We should not
1811 * leave the flag on in this case. The same goes for mov ss
1812 */
1813 if (!(int_shadow & mask))
1814 ctxt->interruptibility = mask;
1815}
1816
1817static inline void 1909static inline void
1818setup_syscalls_segments(struct x86_emulate_ctxt *ctxt, 1910setup_syscalls_segments(struct x86_emulate_ctxt *ctxt,
1819 struct kvm_segment *cs, struct kvm_segment *ss) 1911 struct x86_emulate_ops *ops, struct desc_struct *cs,
1912 struct desc_struct *ss)
1820{ 1913{
1821 memset(cs, 0, sizeof(struct kvm_segment)); 1914 memset(cs, 0, sizeof(struct desc_struct));
1822 kvm_x86_ops->get_segment(ctxt->vcpu, cs, VCPU_SREG_CS); 1915 ops->get_cached_descriptor(cs, VCPU_SREG_CS, ctxt->vcpu);
1823 memset(ss, 0, sizeof(struct kvm_segment)); 1916 memset(ss, 0, sizeof(struct desc_struct));
1824 1917
1825 cs->l = 0; /* will be adjusted later */ 1918 cs->l = 0; /* will be adjusted later */
1826 cs->base = 0; /* flat segment */ 1919 set_desc_base(cs, 0); /* flat segment */
1827 cs->g = 1; /* 4kb granularity */ 1920 cs->g = 1; /* 4kb granularity */
1828 cs->limit = 0xffffffff; /* 4GB limit */ 1921 set_desc_limit(cs, 0xfffff); /* 4GB limit */
1829 cs->type = 0x0b; /* Read, Execute, Accessed */ 1922 cs->type = 0x0b; /* Read, Execute, Accessed */
1830 cs->s = 1; 1923 cs->s = 1;
1831 cs->dpl = 0; /* will be adjusted later */ 1924 cs->dpl = 0; /* will be adjusted later */
1832 cs->present = 1; 1925 cs->p = 1;
1833 cs->db = 1; 1926 cs->d = 1;
1834 1927
1835 ss->unusable = 0; 1928 set_desc_base(ss, 0); /* flat segment */
1836 ss->base = 0; /* flat segment */ 1929 set_desc_limit(ss, 0xfffff); /* 4GB limit */
1837 ss->limit = 0xffffffff; /* 4GB limit */
1838 ss->g = 1; /* 4kb granularity */ 1930 ss->g = 1; /* 4kb granularity */
1839 ss->s = 1; 1931 ss->s = 1;
1840 ss->type = 0x03; /* Read/Write, Accessed */ 1932 ss->type = 0x03; /* Read/Write, Accessed */
1841 ss->db = 1; /* 32bit stack segment */ 1933 ss->d = 1; /* 32bit stack segment */
1842 ss->dpl = 0; 1934 ss->dpl = 0;
1843 ss->present = 1; 1935 ss->p = 1;
1844} 1936}
1845 1937
1846static int 1938static int
1847emulate_syscall(struct x86_emulate_ctxt *ctxt) 1939emulate_syscall(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
1848{ 1940{
1849 struct decode_cache *c = &ctxt->decode; 1941 struct decode_cache *c = &ctxt->decode;
1850 struct kvm_segment cs, ss; 1942 struct desc_struct cs, ss;
1851 u64 msr_data; 1943 u64 msr_data;
1944 u16 cs_sel, ss_sel;
1852 1945
1853 /* syscall is not available in real mode */ 1946 /* syscall is not available in real mode */
1854 if (ctxt->mode == X86EMUL_MODE_REAL || 1947 if (ctxt->mode == X86EMUL_MODE_REAL ||
1855 ctxt->mode == X86EMUL_MODE_VM86) { 1948 ctxt->mode == X86EMUL_MODE_VM86) {
1856 kvm_queue_exception(ctxt->vcpu, UD_VECTOR); 1949 emulate_ud(ctxt);
1857 return X86EMUL_PROPAGATE_FAULT; 1950 return X86EMUL_PROPAGATE_FAULT;
1858 } 1951 }
1859 1952
1860 setup_syscalls_segments(ctxt, &cs, &ss); 1953 setup_syscalls_segments(ctxt, ops, &cs, &ss);
1861 1954
1862 kvm_x86_ops->get_msr(ctxt->vcpu, MSR_STAR, &msr_data); 1955 ops->get_msr(ctxt->vcpu, MSR_STAR, &msr_data);
1863 msr_data >>= 32; 1956 msr_data >>= 32;
1864 cs.selector = (u16)(msr_data & 0xfffc); 1957 cs_sel = (u16)(msr_data & 0xfffc);
1865 ss.selector = (u16)(msr_data + 8); 1958 ss_sel = (u16)(msr_data + 8);
1866 1959
1867 if (is_long_mode(ctxt->vcpu)) { 1960 if (is_long_mode(ctxt->vcpu)) {
1868 cs.db = 0; 1961 cs.d = 0;
1869 cs.l = 1; 1962 cs.l = 1;
1870 } 1963 }
1871 kvm_x86_ops->set_segment(ctxt->vcpu, &cs, VCPU_SREG_CS); 1964 ops->set_cached_descriptor(&cs, VCPU_SREG_CS, ctxt->vcpu);
1872 kvm_x86_ops->set_segment(ctxt->vcpu, &ss, VCPU_SREG_SS); 1965 ops->set_segment_selector(cs_sel, VCPU_SREG_CS, ctxt->vcpu);
1966 ops->set_cached_descriptor(&ss, VCPU_SREG_SS, ctxt->vcpu);
1967 ops->set_segment_selector(ss_sel, VCPU_SREG_SS, ctxt->vcpu);
1873 1968
1874 c->regs[VCPU_REGS_RCX] = c->eip; 1969 c->regs[VCPU_REGS_RCX] = c->eip;
1875 if (is_long_mode(ctxt->vcpu)) { 1970 if (is_long_mode(ctxt->vcpu)) {
1876#ifdef CONFIG_X86_64 1971#ifdef CONFIG_X86_64
1877 c->regs[VCPU_REGS_R11] = ctxt->eflags & ~EFLG_RF; 1972 c->regs[VCPU_REGS_R11] = ctxt->eflags & ~EFLG_RF;
1878 1973
1879 kvm_x86_ops->get_msr(ctxt->vcpu, 1974 ops->get_msr(ctxt->vcpu,
1880 ctxt->mode == X86EMUL_MODE_PROT64 ? 1975 ctxt->mode == X86EMUL_MODE_PROT64 ?
1881 MSR_LSTAR : MSR_CSTAR, &msr_data); 1976 MSR_LSTAR : MSR_CSTAR, &msr_data);
1882 c->eip = msr_data; 1977 c->eip = msr_data;
1883 1978
1884 kvm_x86_ops->get_msr(ctxt->vcpu, MSR_SYSCALL_MASK, &msr_data); 1979 ops->get_msr(ctxt->vcpu, MSR_SYSCALL_MASK, &msr_data);
1885 ctxt->eflags &= ~(msr_data | EFLG_RF); 1980 ctxt->eflags &= ~(msr_data | EFLG_RF);
1886#endif 1981#endif
1887 } else { 1982 } else {
1888 /* legacy mode */ 1983 /* legacy mode */
1889 kvm_x86_ops->get_msr(ctxt->vcpu, MSR_STAR, &msr_data); 1984 ops->get_msr(ctxt->vcpu, MSR_STAR, &msr_data);
1890 c->eip = (u32)msr_data; 1985 c->eip = (u32)msr_data;
1891 1986
1892 ctxt->eflags &= ~(EFLG_VM | EFLG_IF | EFLG_RF); 1987 ctxt->eflags &= ~(EFLG_VM | EFLG_IF | EFLG_RF);
@@ -1896,15 +1991,16 @@ emulate_syscall(struct x86_emulate_ctxt *ctxt)
1896} 1991}
1897 1992
1898static int 1993static int
1899emulate_sysenter(struct x86_emulate_ctxt *ctxt) 1994emulate_sysenter(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
1900{ 1995{
1901 struct decode_cache *c = &ctxt->decode; 1996 struct decode_cache *c = &ctxt->decode;
1902 struct kvm_segment cs, ss; 1997 struct desc_struct cs, ss;
1903 u64 msr_data; 1998 u64 msr_data;
1999 u16 cs_sel, ss_sel;
1904 2000
1905 /* inject #GP if in real mode */ 2001 /* inject #GP if in real mode */
1906 if (ctxt->mode == X86EMUL_MODE_REAL) { 2002 if (ctxt->mode == X86EMUL_MODE_REAL) {
1907 kvm_inject_gp(ctxt->vcpu, 0); 2003 emulate_gp(ctxt, 0);
1908 return X86EMUL_PROPAGATE_FAULT; 2004 return X86EMUL_PROPAGATE_FAULT;
1909 } 2005 }
1910 2006
@@ -1912,67 +2008,70 @@ emulate_sysenter(struct x86_emulate_ctxt *ctxt)
1912 * Therefore, we inject an #UD. 2008 * Therefore, we inject an #UD.
1913 */ 2009 */
1914 if (ctxt->mode == X86EMUL_MODE_PROT64) { 2010 if (ctxt->mode == X86EMUL_MODE_PROT64) {
1915 kvm_queue_exception(ctxt->vcpu, UD_VECTOR); 2011 emulate_ud(ctxt);
1916 return X86EMUL_PROPAGATE_FAULT; 2012 return X86EMUL_PROPAGATE_FAULT;
1917 } 2013 }
1918 2014
1919 setup_syscalls_segments(ctxt, &cs, &ss); 2015 setup_syscalls_segments(ctxt, ops, &cs, &ss);
1920 2016
1921 kvm_x86_ops->get_msr(ctxt->vcpu, MSR_IA32_SYSENTER_CS, &msr_data); 2017 ops->get_msr(ctxt->vcpu, MSR_IA32_SYSENTER_CS, &msr_data);
1922 switch (ctxt->mode) { 2018 switch (ctxt->mode) {
1923 case X86EMUL_MODE_PROT32: 2019 case X86EMUL_MODE_PROT32:
1924 if ((msr_data & 0xfffc) == 0x0) { 2020 if ((msr_data & 0xfffc) == 0x0) {
1925 kvm_inject_gp(ctxt->vcpu, 0); 2021 emulate_gp(ctxt, 0);
1926 return X86EMUL_PROPAGATE_FAULT; 2022 return X86EMUL_PROPAGATE_FAULT;
1927 } 2023 }
1928 break; 2024 break;
1929 case X86EMUL_MODE_PROT64: 2025 case X86EMUL_MODE_PROT64:
1930 if (msr_data == 0x0) { 2026 if (msr_data == 0x0) {
1931 kvm_inject_gp(ctxt->vcpu, 0); 2027 emulate_gp(ctxt, 0);
1932 return X86EMUL_PROPAGATE_FAULT; 2028 return X86EMUL_PROPAGATE_FAULT;
1933 } 2029 }
1934 break; 2030 break;
1935 } 2031 }
1936 2032
1937 ctxt->eflags &= ~(EFLG_VM | EFLG_IF | EFLG_RF); 2033 ctxt->eflags &= ~(EFLG_VM | EFLG_IF | EFLG_RF);
1938 cs.selector = (u16)msr_data; 2034 cs_sel = (u16)msr_data;
1939 cs.selector &= ~SELECTOR_RPL_MASK; 2035 cs_sel &= ~SELECTOR_RPL_MASK;
1940 ss.selector = cs.selector + 8; 2036 ss_sel = cs_sel + 8;
1941 ss.selector &= ~SELECTOR_RPL_MASK; 2037 ss_sel &= ~SELECTOR_RPL_MASK;
1942 if (ctxt->mode == X86EMUL_MODE_PROT64 2038 if (ctxt->mode == X86EMUL_MODE_PROT64
1943 || is_long_mode(ctxt->vcpu)) { 2039 || is_long_mode(ctxt->vcpu)) {
1944 cs.db = 0; 2040 cs.d = 0;
1945 cs.l = 1; 2041 cs.l = 1;
1946 } 2042 }
1947 2043
1948 kvm_x86_ops->set_segment(ctxt->vcpu, &cs, VCPU_SREG_CS); 2044 ops->set_cached_descriptor(&cs, VCPU_SREG_CS, ctxt->vcpu);
1949 kvm_x86_ops->set_segment(ctxt->vcpu, &ss, VCPU_SREG_SS); 2045 ops->set_segment_selector(cs_sel, VCPU_SREG_CS, ctxt->vcpu);
2046 ops->set_cached_descriptor(&ss, VCPU_SREG_SS, ctxt->vcpu);
2047 ops->set_segment_selector(ss_sel, VCPU_SREG_SS, ctxt->vcpu);
1950 2048
1951 kvm_x86_ops->get_msr(ctxt->vcpu, MSR_IA32_SYSENTER_EIP, &msr_data); 2049 ops->get_msr(ctxt->vcpu, MSR_IA32_SYSENTER_EIP, &msr_data);
1952 c->eip = msr_data; 2050 c->eip = msr_data;
1953 2051
1954 kvm_x86_ops->get_msr(ctxt->vcpu, MSR_IA32_SYSENTER_ESP, &msr_data); 2052 ops->get_msr(ctxt->vcpu, MSR_IA32_SYSENTER_ESP, &msr_data);
1955 c->regs[VCPU_REGS_RSP] = msr_data; 2053 c->regs[VCPU_REGS_RSP] = msr_data;
1956 2054
1957 return X86EMUL_CONTINUE; 2055 return X86EMUL_CONTINUE;
1958} 2056}
1959 2057
1960static int 2058static int
1961emulate_sysexit(struct x86_emulate_ctxt *ctxt) 2059emulate_sysexit(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
1962{ 2060{
1963 struct decode_cache *c = &ctxt->decode; 2061 struct decode_cache *c = &ctxt->decode;
1964 struct kvm_segment cs, ss; 2062 struct desc_struct cs, ss;
1965 u64 msr_data; 2063 u64 msr_data;
1966 int usermode; 2064 int usermode;
2065 u16 cs_sel, ss_sel;
1967 2066
1968 /* inject #GP if in real mode or Virtual 8086 mode */ 2067 /* inject #GP if in real mode or Virtual 8086 mode */
1969 if (ctxt->mode == X86EMUL_MODE_REAL || 2068 if (ctxt->mode == X86EMUL_MODE_REAL ||
1970 ctxt->mode == X86EMUL_MODE_VM86) { 2069 ctxt->mode == X86EMUL_MODE_VM86) {
1971 kvm_inject_gp(ctxt->vcpu, 0); 2070 emulate_gp(ctxt, 0);
1972 return X86EMUL_PROPAGATE_FAULT; 2071 return X86EMUL_PROPAGATE_FAULT;
1973 } 2072 }
1974 2073
1975 setup_syscalls_segments(ctxt, &cs, &ss); 2074 setup_syscalls_segments(ctxt, ops, &cs, &ss);
1976 2075
1977 if ((c->rex_prefix & 0x8) != 0x0) 2076 if ((c->rex_prefix & 0x8) != 0x0)
1978 usermode = X86EMUL_MODE_PROT64; 2077 usermode = X86EMUL_MODE_PROT64;
@@ -1981,35 +2080,37 @@ emulate_sysexit(struct x86_emulate_ctxt *ctxt)
1981 2080
1982 cs.dpl = 3; 2081 cs.dpl = 3;
1983 ss.dpl = 3; 2082 ss.dpl = 3;
1984 kvm_x86_ops->get_msr(ctxt->vcpu, MSR_IA32_SYSENTER_CS, &msr_data); 2083 ops->get_msr(ctxt->vcpu, MSR_IA32_SYSENTER_CS, &msr_data);
1985 switch (usermode) { 2084 switch (usermode) {
1986 case X86EMUL_MODE_PROT32: 2085 case X86EMUL_MODE_PROT32:
1987 cs.selector = (u16)(msr_data + 16); 2086 cs_sel = (u16)(msr_data + 16);
1988 if ((msr_data & 0xfffc) == 0x0) { 2087 if ((msr_data & 0xfffc) == 0x0) {
1989 kvm_inject_gp(ctxt->vcpu, 0); 2088 emulate_gp(ctxt, 0);
1990 return X86EMUL_PROPAGATE_FAULT; 2089 return X86EMUL_PROPAGATE_FAULT;
1991 } 2090 }
1992 ss.selector = (u16)(msr_data + 24); 2091 ss_sel = (u16)(msr_data + 24);
1993 break; 2092 break;
1994 case X86EMUL_MODE_PROT64: 2093 case X86EMUL_MODE_PROT64:
1995 cs.selector = (u16)(msr_data + 32); 2094 cs_sel = (u16)(msr_data + 32);
1996 if (msr_data == 0x0) { 2095 if (msr_data == 0x0) {
1997 kvm_inject_gp(ctxt->vcpu, 0); 2096 emulate_gp(ctxt, 0);
1998 return X86EMUL_PROPAGATE_FAULT; 2097 return X86EMUL_PROPAGATE_FAULT;
1999 } 2098 }
2000 ss.selector = cs.selector + 8; 2099 ss_sel = cs_sel + 8;
2001 cs.db = 0; 2100 cs.d = 0;
2002 cs.l = 1; 2101 cs.l = 1;
2003 break; 2102 break;
2004 } 2103 }
2005 cs.selector |= SELECTOR_RPL_MASK; 2104 cs_sel |= SELECTOR_RPL_MASK;
2006 ss.selector |= SELECTOR_RPL_MASK; 2105 ss_sel |= SELECTOR_RPL_MASK;
2007 2106
2008 kvm_x86_ops->set_segment(ctxt->vcpu, &cs, VCPU_SREG_CS); 2107 ops->set_cached_descriptor(&cs, VCPU_SREG_CS, ctxt->vcpu);
2009 kvm_x86_ops->set_segment(ctxt->vcpu, &ss, VCPU_SREG_SS); 2108 ops->set_segment_selector(cs_sel, VCPU_SREG_CS, ctxt->vcpu);
2109 ops->set_cached_descriptor(&ss, VCPU_SREG_SS, ctxt->vcpu);
2110 ops->set_segment_selector(ss_sel, VCPU_SREG_SS, ctxt->vcpu);
2010 2111
2011 c->eip = ctxt->vcpu->arch.regs[VCPU_REGS_RDX]; 2112 c->eip = c->regs[VCPU_REGS_RDX];
2012 c->regs[VCPU_REGS_RSP] = ctxt->vcpu->arch.regs[VCPU_REGS_RCX]; 2113 c->regs[VCPU_REGS_RSP] = c->regs[VCPU_REGS_RCX];
2013 2114
2014 return X86EMUL_CONTINUE; 2115 return X86EMUL_CONTINUE;
2015} 2116}
@@ -2030,25 +2131,25 @@ static bool emulator_io_port_access_allowed(struct x86_emulate_ctxt *ctxt,
2030 struct x86_emulate_ops *ops, 2131 struct x86_emulate_ops *ops,
2031 u16 port, u16 len) 2132 u16 port, u16 len)
2032{ 2133{
2033 struct kvm_segment tr_seg; 2134 struct desc_struct tr_seg;
2034 int r; 2135 int r;
2035 u16 io_bitmap_ptr; 2136 u16 io_bitmap_ptr;
2036 u8 perm, bit_idx = port & 0x7; 2137 u8 perm, bit_idx = port & 0x7;
2037 unsigned mask = (1 << len) - 1; 2138 unsigned mask = (1 << len) - 1;
2038 2139
2039 kvm_get_segment(ctxt->vcpu, &tr_seg, VCPU_SREG_TR); 2140 ops->get_cached_descriptor(&tr_seg, VCPU_SREG_TR, ctxt->vcpu);
2040 if (tr_seg.unusable) 2141 if (!tr_seg.p)
2041 return false; 2142 return false;
2042 if (tr_seg.limit < 103) 2143 if (desc_limit_scaled(&tr_seg) < 103)
2043 return false; 2144 return false;
2044 r = ops->read_std(tr_seg.base + 102, &io_bitmap_ptr, 2, ctxt->vcpu, 2145 r = ops->read_std(get_desc_base(&tr_seg) + 102, &io_bitmap_ptr, 2,
2045 NULL); 2146 ctxt->vcpu, NULL);
2046 if (r != X86EMUL_CONTINUE) 2147 if (r != X86EMUL_CONTINUE)
2047 return false; 2148 return false;
2048 if (io_bitmap_ptr + port/8 > tr_seg.limit) 2149 if (io_bitmap_ptr + port/8 > desc_limit_scaled(&tr_seg))
2049 return false; 2150 return false;
2050 r = ops->read_std(tr_seg.base + io_bitmap_ptr + port/8, &perm, 1, 2151 r = ops->read_std(get_desc_base(&tr_seg) + io_bitmap_ptr + port/8,
2051 ctxt->vcpu, NULL); 2152 &perm, 1, ctxt->vcpu, NULL);
2052 if (r != X86EMUL_CONTINUE) 2153 if (r != X86EMUL_CONTINUE)
2053 return false; 2154 return false;
2054 if ((perm >> bit_idx) & mask) 2155 if ((perm >> bit_idx) & mask)
@@ -2066,17 +2167,6 @@ static bool emulator_io_permited(struct x86_emulate_ctxt *ctxt,
2066 return true; 2167 return true;
2067} 2168}
2068 2169
2069static u32 get_cached_descriptor_base(struct x86_emulate_ctxt *ctxt,
2070 struct x86_emulate_ops *ops,
2071 int seg)
2072{
2073 struct desc_struct desc;
2074 if (ops->get_cached_descriptor(&desc, seg, ctxt->vcpu))
2075 return get_desc_base(&desc);
2076 else
2077 return ~0;
2078}
2079
2080static void save_state_to_tss16(struct x86_emulate_ctxt *ctxt, 2170static void save_state_to_tss16(struct x86_emulate_ctxt *ctxt,
2081 struct x86_emulate_ops *ops, 2171 struct x86_emulate_ops *ops,
2082 struct tss_segment_16 *tss) 2172 struct tss_segment_16 *tss)
@@ -2165,7 +2255,7 @@ static int task_switch_16(struct x86_emulate_ctxt *ctxt,
2165 &err); 2255 &err);
2166 if (ret == X86EMUL_PROPAGATE_FAULT) { 2256 if (ret == X86EMUL_PROPAGATE_FAULT) {
2167 /* FIXME: need to provide precise fault address */ 2257 /* FIXME: need to provide precise fault address */
2168 kvm_inject_page_fault(ctxt->vcpu, old_tss_base, err); 2258 emulate_pf(ctxt, old_tss_base, err);
2169 return ret; 2259 return ret;
2170 } 2260 }
2171 2261
@@ -2175,7 +2265,7 @@ static int task_switch_16(struct x86_emulate_ctxt *ctxt,
2175 &err); 2265 &err);
2176 if (ret == X86EMUL_PROPAGATE_FAULT) { 2266 if (ret == X86EMUL_PROPAGATE_FAULT) {
2177 /* FIXME: need to provide precise fault address */ 2267 /* FIXME: need to provide precise fault address */
2178 kvm_inject_page_fault(ctxt->vcpu, old_tss_base, err); 2268 emulate_pf(ctxt, old_tss_base, err);
2179 return ret; 2269 return ret;
2180 } 2270 }
2181 2271
@@ -2183,7 +2273,7 @@ static int task_switch_16(struct x86_emulate_ctxt *ctxt,
2183 &err); 2273 &err);
2184 if (ret == X86EMUL_PROPAGATE_FAULT) { 2274 if (ret == X86EMUL_PROPAGATE_FAULT) {
2185 /* FIXME: need to provide precise fault address */ 2275 /* FIXME: need to provide precise fault address */
2186 kvm_inject_page_fault(ctxt->vcpu, new_tss_base, err); 2276 emulate_pf(ctxt, new_tss_base, err);
2187 return ret; 2277 return ret;
2188 } 2278 }
2189 2279
@@ -2196,7 +2286,7 @@ static int task_switch_16(struct x86_emulate_ctxt *ctxt,
2196 ctxt->vcpu, &err); 2286 ctxt->vcpu, &err);
2197 if (ret == X86EMUL_PROPAGATE_FAULT) { 2287 if (ret == X86EMUL_PROPAGATE_FAULT) {
2198 /* FIXME: need to provide precise fault address */ 2288 /* FIXME: need to provide precise fault address */
2199 kvm_inject_page_fault(ctxt->vcpu, new_tss_base, err); 2289 emulate_pf(ctxt, new_tss_base, err);
2200 return ret; 2290 return ret;
2201 } 2291 }
2202 } 2292 }
@@ -2238,7 +2328,10 @@ static int load_state_from_tss32(struct x86_emulate_ctxt *ctxt,
2238 struct decode_cache *c = &ctxt->decode; 2328 struct decode_cache *c = &ctxt->decode;
2239 int ret; 2329 int ret;
2240 2330
2241 ops->set_cr(3, tss->cr3, ctxt->vcpu); 2331 if (ops->set_cr(3, tss->cr3, ctxt->vcpu)) {
2332 emulate_gp(ctxt, 0);
2333 return X86EMUL_PROPAGATE_FAULT;
2334 }
2242 c->eip = tss->eip; 2335 c->eip = tss->eip;
2243 ctxt->eflags = tss->eflags | 2; 2336 ctxt->eflags = tss->eflags | 2;
2244 c->regs[VCPU_REGS_RAX] = tss->eax; 2337 c->regs[VCPU_REGS_RAX] = tss->eax;
@@ -2304,7 +2397,7 @@ static int task_switch_32(struct x86_emulate_ctxt *ctxt,
2304 &err); 2397 &err);
2305 if (ret == X86EMUL_PROPAGATE_FAULT) { 2398 if (ret == X86EMUL_PROPAGATE_FAULT) {
2306 /* FIXME: need to provide precise fault address */ 2399 /* FIXME: need to provide precise fault address */
2307 kvm_inject_page_fault(ctxt->vcpu, old_tss_base, err); 2400 emulate_pf(ctxt, old_tss_base, err);
2308 return ret; 2401 return ret;
2309 } 2402 }
2310 2403
@@ -2314,7 +2407,7 @@ static int task_switch_32(struct x86_emulate_ctxt *ctxt,
2314 &err); 2407 &err);
2315 if (ret == X86EMUL_PROPAGATE_FAULT) { 2408 if (ret == X86EMUL_PROPAGATE_FAULT) {
2316 /* FIXME: need to provide precise fault address */ 2409 /* FIXME: need to provide precise fault address */
2317 kvm_inject_page_fault(ctxt->vcpu, old_tss_base, err); 2410 emulate_pf(ctxt, old_tss_base, err);
2318 return ret; 2411 return ret;
2319 } 2412 }
2320 2413
@@ -2322,7 +2415,7 @@ static int task_switch_32(struct x86_emulate_ctxt *ctxt,
2322 &err); 2415 &err);
2323 if (ret == X86EMUL_PROPAGATE_FAULT) { 2416 if (ret == X86EMUL_PROPAGATE_FAULT) {
2324 /* FIXME: need to provide precise fault address */ 2417 /* FIXME: need to provide precise fault address */
2325 kvm_inject_page_fault(ctxt->vcpu, new_tss_base, err); 2418 emulate_pf(ctxt, new_tss_base, err);
2326 return ret; 2419 return ret;
2327 } 2420 }
2328 2421
@@ -2335,7 +2428,7 @@ static int task_switch_32(struct x86_emulate_ctxt *ctxt,
2335 ctxt->vcpu, &err); 2428 ctxt->vcpu, &err);
2336 if (ret == X86EMUL_PROPAGATE_FAULT) { 2429 if (ret == X86EMUL_PROPAGATE_FAULT) {
2337 /* FIXME: need to provide precise fault address */ 2430 /* FIXME: need to provide precise fault address */
2338 kvm_inject_page_fault(ctxt->vcpu, new_tss_base, err); 2431 emulate_pf(ctxt, new_tss_base, err);
2339 return ret; 2432 return ret;
2340 } 2433 }
2341 } 2434 }
@@ -2352,7 +2445,7 @@ static int emulator_do_task_switch(struct x86_emulate_ctxt *ctxt,
2352 int ret; 2445 int ret;
2353 u16 old_tss_sel = ops->get_segment_selector(VCPU_SREG_TR, ctxt->vcpu); 2446 u16 old_tss_sel = ops->get_segment_selector(VCPU_SREG_TR, ctxt->vcpu);
2354 ulong old_tss_base = 2447 ulong old_tss_base =
2355 get_cached_descriptor_base(ctxt, ops, VCPU_SREG_TR); 2448 ops->get_cached_segment_base(VCPU_SREG_TR, ctxt->vcpu);
2356 u32 desc_limit; 2449 u32 desc_limit;
2357 2450
2358 /* FIXME: old_tss_base == ~0 ? */ 2451 /* FIXME: old_tss_base == ~0 ? */
@@ -2369,7 +2462,7 @@ static int emulator_do_task_switch(struct x86_emulate_ctxt *ctxt,
2369 if (reason != TASK_SWITCH_IRET) { 2462 if (reason != TASK_SWITCH_IRET) {
2370 if ((tss_selector & 3) > next_tss_desc.dpl || 2463 if ((tss_selector & 3) > next_tss_desc.dpl ||
2371 ops->cpl(ctxt->vcpu) > next_tss_desc.dpl) { 2464 ops->cpl(ctxt->vcpu) > next_tss_desc.dpl) {
2372 kvm_inject_gp(ctxt->vcpu, 0); 2465 emulate_gp(ctxt, 0);
2373 return X86EMUL_PROPAGATE_FAULT; 2466 return X86EMUL_PROPAGATE_FAULT;
2374 } 2467 }
2375 } 2468 }
@@ -2378,8 +2471,7 @@ static int emulator_do_task_switch(struct x86_emulate_ctxt *ctxt,
2378 if (!next_tss_desc.p || 2471 if (!next_tss_desc.p ||
2379 ((desc_limit < 0x67 && (next_tss_desc.type & 8)) || 2472 ((desc_limit < 0x67 && (next_tss_desc.type & 8)) ||
2380 desc_limit < 0x2b)) { 2473 desc_limit < 0x2b)) {
2381 kvm_queue_exception_e(ctxt->vcpu, TS_VECTOR, 2474 emulate_ts(ctxt, tss_selector & 0xfffc);
2382 tss_selector & 0xfffc);
2383 return X86EMUL_PROPAGATE_FAULT; 2475 return X86EMUL_PROPAGATE_FAULT;
2384 } 2476 }
2385 2477
@@ -2425,7 +2517,7 @@ static int emulator_do_task_switch(struct x86_emulate_ctxt *ctxt,
2425 c->op_bytes = c->ad_bytes = (next_tss_desc.type & 8) ? 4 : 2; 2517 c->op_bytes = c->ad_bytes = (next_tss_desc.type & 8) ? 4 : 2;
2426 c->lock_prefix = 0; 2518 c->lock_prefix = 0;
2427 c->src.val = (unsigned long) error_code; 2519 c->src.val = (unsigned long) error_code;
2428 emulate_push(ctxt); 2520 emulate_push(ctxt, ops);
2429 } 2521 }
2430 2522
2431 return ret; 2523 return ret;
@@ -2439,18 +2531,16 @@ int emulator_task_switch(struct x86_emulate_ctxt *ctxt,
2439 struct decode_cache *c = &ctxt->decode; 2531 struct decode_cache *c = &ctxt->decode;
2440 int rc; 2532 int rc;
2441 2533
2442 memset(c, 0, sizeof(struct decode_cache));
2443 c->eip = ctxt->eip; 2534 c->eip = ctxt->eip;
2444 memcpy(c->regs, ctxt->vcpu->arch.regs, sizeof c->regs);
2445 c->dst.type = OP_NONE; 2535 c->dst.type = OP_NONE;
2446 2536
2447 rc = emulator_do_task_switch(ctxt, ops, tss_selector, reason, 2537 rc = emulator_do_task_switch(ctxt, ops, tss_selector, reason,
2448 has_error_code, error_code); 2538 has_error_code, error_code);
2449 2539
2450 if (rc == X86EMUL_CONTINUE) { 2540 if (rc == X86EMUL_CONTINUE) {
2451 memcpy(ctxt->vcpu->arch.regs, c->regs, sizeof c->regs);
2452 kvm_rip_write(ctxt->vcpu, c->eip);
2453 rc = writeback(ctxt, ops); 2541 rc = writeback(ctxt, ops);
2542 if (rc == X86EMUL_CONTINUE)
2543 ctxt->eip = c->eip;
2454 } 2544 }
2455 2545
2456 return (rc == X86EMUL_UNHANDLEABLE) ? -1 : 0; 2546 return (rc == X86EMUL_UNHANDLEABLE) ? -1 : 0;
@@ -2474,29 +2564,22 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
2474 int rc = X86EMUL_CONTINUE; 2564 int rc = X86EMUL_CONTINUE;
2475 int saved_dst_type = c->dst.type; 2565 int saved_dst_type = c->dst.type;
2476 2566
2477 ctxt->interruptibility = 0; 2567 ctxt->decode.mem_read.pos = 0;
2478
2479 /* Shadow copy of register state. Committed on successful emulation.
2480 * NOTE: we can copy them from vcpu as x86_decode_insn() doesn't
2481 * modify them.
2482 */
2483
2484 memcpy(c->regs, ctxt->vcpu->arch.regs, sizeof c->regs);
2485 2568
2486 if (ctxt->mode == X86EMUL_MODE_PROT64 && (c->d & No64)) { 2569 if (ctxt->mode == X86EMUL_MODE_PROT64 && (c->d & No64)) {
2487 kvm_queue_exception(ctxt->vcpu, UD_VECTOR); 2570 emulate_ud(ctxt);
2488 goto done; 2571 goto done;
2489 } 2572 }
2490 2573
2491 /* LOCK prefix is allowed only with some instructions */ 2574 /* LOCK prefix is allowed only with some instructions */
2492 if (c->lock_prefix && (!(c->d & Lock) || c->dst.type != OP_MEM)) { 2575 if (c->lock_prefix && (!(c->d & Lock) || c->dst.type != OP_MEM)) {
2493 kvm_queue_exception(ctxt->vcpu, UD_VECTOR); 2576 emulate_ud(ctxt);
2494 goto done; 2577 goto done;
2495 } 2578 }
2496 2579
2497 /* Privileged instruction can be executed only in CPL=0 */ 2580 /* Privileged instruction can be executed only in CPL=0 */
2498 if ((c->d & Priv) && ops->cpl(ctxt->vcpu)) { 2581 if ((c->d & Priv) && ops->cpl(ctxt->vcpu)) {
2499 kvm_inject_gp(ctxt->vcpu, 0); 2582 emulate_gp(ctxt, 0);
2500 goto done; 2583 goto done;
2501 } 2584 }
2502 2585
@@ -2506,7 +2589,7 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
2506 if (address_mask(c, c->regs[VCPU_REGS_RCX]) == 0) { 2589 if (address_mask(c, c->regs[VCPU_REGS_RCX]) == 0) {
2507 string_done: 2590 string_done:
2508 ctxt->restart = false; 2591 ctxt->restart = false;
2509 kvm_rip_write(ctxt->vcpu, c->eip); 2592 ctxt->eip = c->eip;
2510 goto done; 2593 goto done;
2511 } 2594 }
2512 /* The second termination condition only applies for REPE 2595 /* The second termination condition only applies for REPE
@@ -2529,20 +2612,16 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
2529 } 2612 }
2530 2613
2531 if (c->src.type == OP_MEM) { 2614 if (c->src.type == OP_MEM) {
2532 rc = ops->read_emulated((unsigned long)c->src.ptr, 2615 rc = read_emulated(ctxt, ops, (unsigned long)c->src.ptr,
2533 &c->src.val, 2616 c->src.valptr, c->src.bytes);
2534 c->src.bytes,
2535 ctxt->vcpu);
2536 if (rc != X86EMUL_CONTINUE) 2617 if (rc != X86EMUL_CONTINUE)
2537 goto done; 2618 goto done;
2538 c->src.orig_val = c->src.val; 2619 c->src.orig_val = c->src.val;
2539 } 2620 }
2540 2621
2541 if (c->src2.type == OP_MEM) { 2622 if (c->src2.type == OP_MEM) {
2542 rc = ops->read_emulated((unsigned long)c->src2.ptr, 2623 rc = read_emulated(ctxt, ops, (unsigned long)c->src2.ptr,
2543 &c->src2.val, 2624 &c->src2.val, c->src2.bytes);
2544 c->src2.bytes,
2545 ctxt->vcpu);
2546 if (rc != X86EMUL_CONTINUE) 2625 if (rc != X86EMUL_CONTINUE)
2547 goto done; 2626 goto done;
2548 } 2627 }
@@ -2553,8 +2632,8 @@ x86_emulate_insn(struct x86_emulate_ctxt *ctxt, struct x86_emulate_ops *ops)
2553 2632
2554 if ((c->dst.type == OP_MEM) && !(c->d & Mov)) { 2633 if ((c->dst.type == OP_MEM) && !(c->d & Mov)) {
2555 /* optimisation - avoid slow emulated read if Mov */ 2634 /* optimisation - avoid slow emulated read if Mov */
2556 rc = ops->read_emulated((unsigned long)c->dst.ptr, &c->dst.val, 2635 rc = read_emulated(ctxt, ops, (unsigned long)c->dst.ptr,
2557 c->dst.bytes, ctxt->vcpu); 2636 &c->dst.val, c->dst.bytes);
2558 if (rc != X86EMUL_CONTINUE) 2637 if (rc != X86EMUL_CONTINUE)
2559 goto done; 2638 goto done;
2560 } 2639 }
@@ -2571,7 +2650,7 @@ special_insn:
2571 emulate_2op_SrcV("add", c->src, c->dst, ctxt->eflags); 2650 emulate_2op_SrcV("add", c->src, c->dst, ctxt->eflags);
2572 break; 2651 break;
2573 case 0x06: /* push es */ 2652 case 0x06: /* push es */
2574 emulate_push_sreg(ctxt, VCPU_SREG_ES); 2653 emulate_push_sreg(ctxt, ops, VCPU_SREG_ES);
2575 break; 2654 break;
2576 case 0x07: /* pop es */ 2655 case 0x07: /* pop es */
2577 rc = emulate_pop_sreg(ctxt, ops, VCPU_SREG_ES); 2656 rc = emulate_pop_sreg(ctxt, ops, VCPU_SREG_ES);
@@ -2583,14 +2662,14 @@ special_insn:
2583 emulate_2op_SrcV("or", c->src, c->dst, ctxt->eflags); 2662 emulate_2op_SrcV("or", c->src, c->dst, ctxt->eflags);
2584 break; 2663 break;
2585 case 0x0e: /* push cs */ 2664 case 0x0e: /* push cs */
2586 emulate_push_sreg(ctxt, VCPU_SREG_CS); 2665 emulate_push_sreg(ctxt, ops, VCPU_SREG_CS);
2587 break; 2666 break;
2588 case 0x10 ... 0x15: 2667 case 0x10 ... 0x15:
2589 adc: /* adc */ 2668 adc: /* adc */
2590 emulate_2op_SrcV("adc", c->src, c->dst, ctxt->eflags); 2669 emulate_2op_SrcV("adc", c->src, c->dst, ctxt->eflags);
2591 break; 2670 break;
2592 case 0x16: /* push ss */ 2671 case 0x16: /* push ss */
2593 emulate_push_sreg(ctxt, VCPU_SREG_SS); 2672 emulate_push_sreg(ctxt, ops, VCPU_SREG_SS);
2594 break; 2673 break;
2595 case 0x17: /* pop ss */ 2674 case 0x17: /* pop ss */
2596 rc = emulate_pop_sreg(ctxt, ops, VCPU_SREG_SS); 2675 rc = emulate_pop_sreg(ctxt, ops, VCPU_SREG_SS);
@@ -2602,7 +2681,7 @@ special_insn:
2602 emulate_2op_SrcV("sbb", c->src, c->dst, ctxt->eflags); 2681 emulate_2op_SrcV("sbb", c->src, c->dst, ctxt->eflags);
2603 break; 2682 break;
2604 case 0x1e: /* push ds */ 2683 case 0x1e: /* push ds */
2605 emulate_push_sreg(ctxt, VCPU_SREG_DS); 2684 emulate_push_sreg(ctxt, ops, VCPU_SREG_DS);
2606 break; 2685 break;
2607 case 0x1f: /* pop ds */ 2686 case 0x1f: /* pop ds */
2608 rc = emulate_pop_sreg(ctxt, ops, VCPU_SREG_DS); 2687 rc = emulate_pop_sreg(ctxt, ops, VCPU_SREG_DS);
@@ -2632,7 +2711,7 @@ special_insn:
2632 emulate_1op("dec", c->dst, ctxt->eflags); 2711 emulate_1op("dec", c->dst, ctxt->eflags);
2633 break; 2712 break;
2634 case 0x50 ... 0x57: /* push reg */ 2713 case 0x50 ... 0x57: /* push reg */
2635 emulate_push(ctxt); 2714 emulate_push(ctxt, ops);
2636 break; 2715 break;
2637 case 0x58 ... 0x5f: /* pop reg */ 2716 case 0x58 ... 0x5f: /* pop reg */
2638 pop_instruction: 2717 pop_instruction:
@@ -2641,7 +2720,9 @@ special_insn:
2641 goto done; 2720 goto done;
2642 break; 2721 break;
2643 case 0x60: /* pusha */ 2722 case 0x60: /* pusha */
2644 emulate_pusha(ctxt); 2723 rc = emulate_pusha(ctxt, ops);
2724 if (rc != X86EMUL_CONTINUE)
2725 goto done;
2645 break; 2726 break;
2646 case 0x61: /* popa */ 2727 case 0x61: /* popa */
2647 rc = emulate_popa(ctxt, ops); 2728 rc = emulate_popa(ctxt, ops);
@@ -2655,14 +2736,14 @@ special_insn:
2655 break; 2736 break;
2656 case 0x68: /* push imm */ 2737 case 0x68: /* push imm */
2657 case 0x6a: /* push imm8 */ 2738 case 0x6a: /* push imm8 */
2658 emulate_push(ctxt); 2739 emulate_push(ctxt, ops);
2659 break; 2740 break;
2660 case 0x6c: /* insb */ 2741 case 0x6c: /* insb */
2661 case 0x6d: /* insw/insd */ 2742 case 0x6d: /* insw/insd */
2662 c->dst.bytes = min(c->dst.bytes, 4u); 2743 c->dst.bytes = min(c->dst.bytes, 4u);
2663 if (!emulator_io_permited(ctxt, ops, c->regs[VCPU_REGS_RDX], 2744 if (!emulator_io_permited(ctxt, ops, c->regs[VCPU_REGS_RDX],
2664 c->dst.bytes)) { 2745 c->dst.bytes)) {
2665 kvm_inject_gp(ctxt->vcpu, 0); 2746 emulate_gp(ctxt, 0);
2666 goto done; 2747 goto done;
2667 } 2748 }
2668 if (!pio_in_emulated(ctxt, ops, c->dst.bytes, 2749 if (!pio_in_emulated(ctxt, ops, c->dst.bytes,
@@ -2674,7 +2755,7 @@ special_insn:
2674 c->src.bytes = min(c->src.bytes, 4u); 2755 c->src.bytes = min(c->src.bytes, 4u);
2675 if (!emulator_io_permited(ctxt, ops, c->regs[VCPU_REGS_RDX], 2756 if (!emulator_io_permited(ctxt, ops, c->regs[VCPU_REGS_RDX],
2676 c->src.bytes)) { 2757 c->src.bytes)) {
2677 kvm_inject_gp(ctxt->vcpu, 0); 2758 emulate_gp(ctxt, 0);
2678 goto done; 2759 goto done;
2679 } 2760 }
2680 ops->pio_out_emulated(c->src.bytes, c->regs[VCPU_REGS_RDX], 2761 ops->pio_out_emulated(c->src.bytes, c->regs[VCPU_REGS_RDX],
@@ -2707,6 +2788,7 @@ special_insn:
2707 } 2788 }
2708 break; 2789 break;
2709 case 0x84 ... 0x85: 2790 case 0x84 ... 0x85:
2791 test:
2710 emulate_2op_SrcV("test", c->src, c->dst, ctxt->eflags); 2792 emulate_2op_SrcV("test", c->src, c->dst, ctxt->eflags);
2711 break; 2793 break;
2712 case 0x86 ... 0x87: /* xchg */ 2794 case 0x86 ... 0x87: /* xchg */
@@ -2735,18 +2817,13 @@ special_insn:
2735 break; 2817 break;
2736 case 0x88 ... 0x8b: /* mov */ 2818 case 0x88 ... 0x8b: /* mov */
2737 goto mov; 2819 goto mov;
2738 case 0x8c: { /* mov r/m, sreg */ 2820 case 0x8c: /* mov r/m, sreg */
2739 struct kvm_segment segreg; 2821 if (c->modrm_reg > VCPU_SREG_GS) {
2740 2822 emulate_ud(ctxt);
2741 if (c->modrm_reg <= VCPU_SREG_GS)
2742 kvm_get_segment(ctxt->vcpu, &segreg, c->modrm_reg);
2743 else {
2744 kvm_queue_exception(ctxt->vcpu, UD_VECTOR);
2745 goto done; 2823 goto done;
2746 } 2824 }
2747 c->dst.val = segreg.selector; 2825 c->dst.val = ops->get_segment_selector(c->modrm_reg, ctxt->vcpu);
2748 break; 2826 break;
2749 }
2750 case 0x8d: /* lea r16/r32, m */ 2827 case 0x8d: /* lea r16/r32, m */
2751 c->dst.val = c->modrm_ea; 2828 c->dst.val = c->modrm_ea;
2752 break; 2829 break;
@@ -2757,12 +2834,12 @@ special_insn:
2757 2834
2758 if (c->modrm_reg == VCPU_SREG_CS || 2835 if (c->modrm_reg == VCPU_SREG_CS ||
2759 c->modrm_reg > VCPU_SREG_GS) { 2836 c->modrm_reg > VCPU_SREG_GS) {
2760 kvm_queue_exception(ctxt->vcpu, UD_VECTOR); 2837 emulate_ud(ctxt);
2761 goto done; 2838 goto done;
2762 } 2839 }
2763 2840
2764 if (c->modrm_reg == VCPU_SREG_SS) 2841 if (c->modrm_reg == VCPU_SREG_SS)
2765 toggle_interruptibility(ctxt, KVM_X86_SHADOW_INT_MOV_SS); 2842 ctxt->interruptibility = KVM_X86_SHADOW_INT_MOV_SS;
2766 2843
2767 rc = load_segment_descriptor(ctxt, ops, sel, c->modrm_reg); 2844 rc = load_segment_descriptor(ctxt, ops, sel, c->modrm_reg);
2768 2845
@@ -2775,19 +2852,19 @@ special_insn:
2775 goto done; 2852 goto done;
2776 break; 2853 break;
2777 case 0x90: /* nop / xchg r8,rax */ 2854 case 0x90: /* nop / xchg r8,rax */
2778 if (!(c->rex_prefix & 1)) { /* nop */ 2855 if (c->dst.ptr == (unsigned long *)&c->regs[VCPU_REGS_RAX]) {
2779 c->dst.type = OP_NONE; 2856 c->dst.type = OP_NONE; /* nop */
2780 break; 2857 break;
2781 } 2858 }
2782 case 0x91 ... 0x97: /* xchg reg,rax */ 2859 case 0x91 ... 0x97: /* xchg reg,rax */
2783 c->src.type = c->dst.type = OP_REG; 2860 c->src.type = OP_REG;
2784 c->src.bytes = c->dst.bytes = c->op_bytes; 2861 c->src.bytes = c->op_bytes;
2785 c->src.ptr = (unsigned long *) &c->regs[VCPU_REGS_RAX]; 2862 c->src.ptr = (unsigned long *) &c->regs[VCPU_REGS_RAX];
2786 c->src.val = *(c->src.ptr); 2863 c->src.val = *(c->src.ptr);
2787 goto xchg; 2864 goto xchg;
2788 case 0x9c: /* pushf */ 2865 case 0x9c: /* pushf */
2789 c->src.val = (unsigned long) ctxt->eflags; 2866 c->src.val = (unsigned long) ctxt->eflags;
2790 emulate_push(ctxt); 2867 emulate_push(ctxt, ops);
2791 break; 2868 break;
2792 case 0x9d: /* popf */ 2869 case 0x9d: /* popf */
2793 c->dst.type = OP_REG; 2870 c->dst.type = OP_REG;
@@ -2797,19 +2874,15 @@ special_insn:
2797 if (rc != X86EMUL_CONTINUE) 2874 if (rc != X86EMUL_CONTINUE)
2798 goto done; 2875 goto done;
2799 break; 2876 break;
2800 case 0xa0 ... 0xa1: /* mov */ 2877 case 0xa0 ... 0xa3: /* mov */
2801 c->dst.ptr = (unsigned long *)&c->regs[VCPU_REGS_RAX];
2802 c->dst.val = c->src.val;
2803 break;
2804 case 0xa2 ... 0xa3: /* mov */
2805 c->dst.val = (unsigned long)c->regs[VCPU_REGS_RAX];
2806 break;
2807 case 0xa4 ... 0xa5: /* movs */ 2878 case 0xa4 ... 0xa5: /* movs */
2808 goto mov; 2879 goto mov;
2809 case 0xa6 ... 0xa7: /* cmps */ 2880 case 0xa6 ... 0xa7: /* cmps */
2810 c->dst.type = OP_NONE; /* Disable writeback. */ 2881 c->dst.type = OP_NONE; /* Disable writeback. */
2811 DPRINTF("cmps: mem1=0x%p mem2=0x%p\n", c->src.ptr, c->dst.ptr); 2882 DPRINTF("cmps: mem1=0x%p mem2=0x%p\n", c->src.ptr, c->dst.ptr);
2812 goto cmp; 2883 goto cmp;
2884 case 0xa8 ... 0xa9: /* test ax, imm */
2885 goto test;
2813 case 0xaa ... 0xab: /* stos */ 2886 case 0xaa ... 0xab: /* stos */
2814 c->dst.val = c->regs[VCPU_REGS_RAX]; 2887 c->dst.val = c->regs[VCPU_REGS_RAX];
2815 break; 2888 break;
@@ -2855,19 +2928,23 @@ special_insn:
2855 long int rel = c->src.val; 2928 long int rel = c->src.val;
2856 c->src.val = (unsigned long) c->eip; 2929 c->src.val = (unsigned long) c->eip;
2857 jmp_rel(c, rel); 2930 jmp_rel(c, rel);
2858 emulate_push(ctxt); 2931 emulate_push(ctxt, ops);
2859 break; 2932 break;
2860 } 2933 }
2861 case 0xe9: /* jmp rel */ 2934 case 0xe9: /* jmp rel */
2862 goto jmp; 2935 goto jmp;
2863 case 0xea: /* jmp far */ 2936 case 0xea: { /* jmp far */
2937 unsigned short sel;
2864 jump_far: 2938 jump_far:
2865 if (load_segment_descriptor(ctxt, ops, c->src2.val, 2939 memcpy(&sel, c->src.valptr + c->op_bytes, 2);
2866 VCPU_SREG_CS)) 2940
2941 if (load_segment_descriptor(ctxt, ops, sel, VCPU_SREG_CS))
2867 goto done; 2942 goto done;
2868 2943
2869 c->eip = c->src.val; 2944 c->eip = 0;
2945 memcpy(&c->eip, c->src.valptr, c->op_bytes);
2870 break; 2946 break;
2947 }
2871 case 0xeb: 2948 case 0xeb:
2872 jmp: /* jmp rel short */ 2949 jmp: /* jmp rel short */
2873 jmp_rel(c, c->src.val); 2950 jmp_rel(c, c->src.val);
@@ -2879,20 +2956,20 @@ special_insn:
2879 do_io_in: 2956 do_io_in:
2880 c->dst.bytes = min(c->dst.bytes, 4u); 2957 c->dst.bytes = min(c->dst.bytes, 4u);
2881 if (!emulator_io_permited(ctxt, ops, c->src.val, c->dst.bytes)) { 2958 if (!emulator_io_permited(ctxt, ops, c->src.val, c->dst.bytes)) {
2882 kvm_inject_gp(ctxt->vcpu, 0); 2959 emulate_gp(ctxt, 0);
2883 goto done; 2960 goto done;
2884 } 2961 }
2885 if (!pio_in_emulated(ctxt, ops, c->dst.bytes, c->src.val, 2962 if (!pio_in_emulated(ctxt, ops, c->dst.bytes, c->src.val,
2886 &c->dst.val)) 2963 &c->dst.val))
2887 goto done; /* IO is needed */ 2964 goto done; /* IO is needed */
2888 break; 2965 break;
2889 case 0xee: /* out al,dx */ 2966 case 0xee: /* out dx,al */
2890 case 0xef: /* out (e/r)ax,dx */ 2967 case 0xef: /* out dx,(e/r)ax */
2891 c->src.val = c->regs[VCPU_REGS_RDX]; 2968 c->src.val = c->regs[VCPU_REGS_RDX];
2892 do_io_out: 2969 do_io_out:
2893 c->dst.bytes = min(c->dst.bytes, 4u); 2970 c->dst.bytes = min(c->dst.bytes, 4u);
2894 if (!emulator_io_permited(ctxt, ops, c->src.val, c->dst.bytes)) { 2971 if (!emulator_io_permited(ctxt, ops, c->src.val, c->dst.bytes)) {
2895 kvm_inject_gp(ctxt->vcpu, 0); 2972 emulate_gp(ctxt, 0);
2896 goto done; 2973 goto done;
2897 } 2974 }
2898 ops->pio_out_emulated(c->dst.bytes, c->src.val, &c->dst.val, 1, 2975 ops->pio_out_emulated(c->dst.bytes, c->src.val, &c->dst.val, 1,
@@ -2916,18 +2993,20 @@ special_insn:
2916 c->dst.type = OP_NONE; /* Disable writeback. */ 2993 c->dst.type = OP_NONE; /* Disable writeback. */
2917 break; 2994 break;
2918 case 0xfa: /* cli */ 2995 case 0xfa: /* cli */
2919 if (emulator_bad_iopl(ctxt, ops)) 2996 if (emulator_bad_iopl(ctxt, ops)) {
2920 kvm_inject_gp(ctxt->vcpu, 0); 2997 emulate_gp(ctxt, 0);
2921 else { 2998 goto done;
2999 } else {
2922 ctxt->eflags &= ~X86_EFLAGS_IF; 3000 ctxt->eflags &= ~X86_EFLAGS_IF;
2923 c->dst.type = OP_NONE; /* Disable writeback. */ 3001 c->dst.type = OP_NONE; /* Disable writeback. */
2924 } 3002 }
2925 break; 3003 break;
2926 case 0xfb: /* sti */ 3004 case 0xfb: /* sti */
2927 if (emulator_bad_iopl(ctxt, ops)) 3005 if (emulator_bad_iopl(ctxt, ops)) {
2928 kvm_inject_gp(ctxt->vcpu, 0); 3006 emulate_gp(ctxt, 0);
2929 else { 3007 goto done;
2930 toggle_interruptibility(ctxt, KVM_X86_SHADOW_INT_STI); 3008 } else {
3009 ctxt->interruptibility = KVM_X86_SHADOW_INT_STI;
2931 ctxt->eflags |= X86_EFLAGS_IF; 3010 ctxt->eflags |= X86_EFLAGS_IF;
2932 c->dst.type = OP_NONE; /* Disable writeback. */ 3011 c->dst.type = OP_NONE; /* Disable writeback. */
2933 } 3012 }
@@ -2964,11 +3043,12 @@ writeback:
2964 c->dst.type = saved_dst_type; 3043 c->dst.type = saved_dst_type;
2965 3044
2966 if ((c->d & SrcMask) == SrcSI) 3045 if ((c->d & SrcMask) == SrcSI)
2967 string_addr_inc(ctxt, seg_override_base(ctxt, c), VCPU_REGS_RSI, 3046 string_addr_inc(ctxt, seg_override_base(ctxt, ops, c),
2968 &c->src); 3047 VCPU_REGS_RSI, &c->src);
2969 3048
2970 if ((c->d & DstMask) == DstDI) 3049 if ((c->d & DstMask) == DstDI)
2971 string_addr_inc(ctxt, es_base(ctxt), VCPU_REGS_RDI, &c->dst); 3050 string_addr_inc(ctxt, es_base(ctxt, ops), VCPU_REGS_RDI,
3051 &c->dst);
2972 3052
2973 if (c->rep_prefix && (c->d & String)) { 3053 if (c->rep_prefix && (c->d & String)) {
2974 struct read_cache *rc = &ctxt->decode.io_read; 3054 struct read_cache *rc = &ctxt->decode.io_read;
@@ -2981,11 +3061,12 @@ writeback:
2981 (rc->end != 0 && rc->end == rc->pos)) 3061 (rc->end != 0 && rc->end == rc->pos))
2982 ctxt->restart = false; 3062 ctxt->restart = false;
2983 } 3063 }
2984 3064 /*
2985 /* Commit shadow register state. */ 3065 * reset read cache here in case string instruction is restared
2986 memcpy(ctxt->vcpu->arch.regs, c->regs, sizeof c->regs); 3066 * without decoding
2987 kvm_rip_write(ctxt->vcpu, c->eip); 3067 */
2988 ops->set_rflags(ctxt->vcpu, ctxt->eflags); 3068 ctxt->decode.mem_read.end = 0;
3069 ctxt->eip = c->eip;
2989 3070
2990done: 3071done:
2991 return (rc == X86EMUL_UNHANDLEABLE) ? -1 : 0; 3072 return (rc == X86EMUL_UNHANDLEABLE) ? -1 : 0;
@@ -3051,7 +3132,7 @@ twobyte_insn:
3051 c->dst.type = OP_NONE; 3132 c->dst.type = OP_NONE;
3052 break; 3133 break;
3053 case 5: /* not defined */ 3134 case 5: /* not defined */
3054 kvm_queue_exception(ctxt->vcpu, UD_VECTOR); 3135 emulate_ud(ctxt);
3055 goto done; 3136 goto done;
3056 case 7: /* invlpg*/ 3137 case 7: /* invlpg*/
3057 emulate_invlpg(ctxt->vcpu, c->modrm_ea); 3138 emulate_invlpg(ctxt->vcpu, c->modrm_ea);
@@ -3063,7 +3144,7 @@ twobyte_insn:
3063 } 3144 }
3064 break; 3145 break;
3065 case 0x05: /* syscall */ 3146 case 0x05: /* syscall */
3066 rc = emulate_syscall(ctxt); 3147 rc = emulate_syscall(ctxt, ops);
3067 if (rc != X86EMUL_CONTINUE) 3148 if (rc != X86EMUL_CONTINUE)
3068 goto done; 3149 goto done;
3069 else 3150 else
@@ -3073,8 +3154,11 @@ twobyte_insn:
3073 emulate_clts(ctxt->vcpu); 3154 emulate_clts(ctxt->vcpu);
3074 c->dst.type = OP_NONE; 3155 c->dst.type = OP_NONE;
3075 break; 3156 break;
3076 case 0x08: /* invd */
3077 case 0x09: /* wbinvd */ 3157 case 0x09: /* wbinvd */
3158 kvm_emulate_wbinvd(ctxt->vcpu);
3159 c->dst.type = OP_NONE;
3160 break;
3161 case 0x08: /* invd */
3078 case 0x0d: /* GrpP (prefetch) */ 3162 case 0x0d: /* GrpP (prefetch) */
3079 case 0x18: /* Grp16 (prefetch/nop) */ 3163 case 0x18: /* Grp16 (prefetch/nop) */
3080 c->dst.type = OP_NONE; 3164 c->dst.type = OP_NONE;
@@ -3084,7 +3168,7 @@ twobyte_insn:
3084 case 1: 3168 case 1:
3085 case 5 ... 7: 3169 case 5 ... 7:
3086 case 9 ... 15: 3170 case 9 ... 15:
3087 kvm_queue_exception(ctxt->vcpu, UD_VECTOR); 3171 emulate_ud(ctxt);
3088 goto done; 3172 goto done;
3089 } 3173 }
3090 c->regs[c->modrm_rm] = ops->get_cr(c->modrm_reg, ctxt->vcpu); 3174 c->regs[c->modrm_rm] = ops->get_cr(c->modrm_reg, ctxt->vcpu);
@@ -3093,31 +3177,42 @@ twobyte_insn:
3093 case 0x21: /* mov from dr to reg */ 3177 case 0x21: /* mov from dr to reg */
3094 if ((ops->get_cr(4, ctxt->vcpu) & X86_CR4_DE) && 3178 if ((ops->get_cr(4, ctxt->vcpu) & X86_CR4_DE) &&
3095 (c->modrm_reg == 4 || c->modrm_reg == 5)) { 3179 (c->modrm_reg == 4 || c->modrm_reg == 5)) {
3096 kvm_queue_exception(ctxt->vcpu, UD_VECTOR); 3180 emulate_ud(ctxt);
3097 goto done; 3181 goto done;
3098 } 3182 }
3099 emulator_get_dr(ctxt, c->modrm_reg, &c->regs[c->modrm_rm]); 3183 ops->get_dr(c->modrm_reg, &c->regs[c->modrm_rm], ctxt->vcpu);
3100 c->dst.type = OP_NONE; /* no writeback */ 3184 c->dst.type = OP_NONE; /* no writeback */
3101 break; 3185 break;
3102 case 0x22: /* mov reg, cr */ 3186 case 0x22: /* mov reg, cr */
3103 ops->set_cr(c->modrm_reg, c->modrm_val, ctxt->vcpu); 3187 if (ops->set_cr(c->modrm_reg, c->modrm_val, ctxt->vcpu)) {
3188 emulate_gp(ctxt, 0);
3189 goto done;
3190 }
3104 c->dst.type = OP_NONE; 3191 c->dst.type = OP_NONE;
3105 break; 3192 break;
3106 case 0x23: /* mov from reg to dr */ 3193 case 0x23: /* mov from reg to dr */
3107 if ((ops->get_cr(4, ctxt->vcpu) & X86_CR4_DE) && 3194 if ((ops->get_cr(4, ctxt->vcpu) & X86_CR4_DE) &&
3108 (c->modrm_reg == 4 || c->modrm_reg == 5)) { 3195 (c->modrm_reg == 4 || c->modrm_reg == 5)) {
3109 kvm_queue_exception(ctxt->vcpu, UD_VECTOR); 3196 emulate_ud(ctxt);
3197 goto done;
3198 }
3199
3200 if (ops->set_dr(c->modrm_reg, c->regs[c->modrm_rm] &
3201 ((ctxt->mode == X86EMUL_MODE_PROT64) ?
3202 ~0ULL : ~0U), ctxt->vcpu) < 0) {
3203 /* #UD condition is already handled by the code above */
3204 emulate_gp(ctxt, 0);
3110 goto done; 3205 goto done;
3111 } 3206 }
3112 emulator_set_dr(ctxt, c->modrm_reg, c->regs[c->modrm_rm]); 3207
3113 c->dst.type = OP_NONE; /* no writeback */ 3208 c->dst.type = OP_NONE; /* no writeback */
3114 break; 3209 break;
3115 case 0x30: 3210 case 0x30:
3116 /* wrmsr */ 3211 /* wrmsr */
3117 msr_data = (u32)c->regs[VCPU_REGS_RAX] 3212 msr_data = (u32)c->regs[VCPU_REGS_RAX]
3118 | ((u64)c->regs[VCPU_REGS_RDX] << 32); 3213 | ((u64)c->regs[VCPU_REGS_RDX] << 32);
3119 if (kvm_set_msr(ctxt->vcpu, c->regs[VCPU_REGS_RCX], msr_data)) { 3214 if (ops->set_msr(ctxt->vcpu, c->regs[VCPU_REGS_RCX], msr_data)) {
3120 kvm_inject_gp(ctxt->vcpu, 0); 3215 emulate_gp(ctxt, 0);
3121 goto done; 3216 goto done;
3122 } 3217 }
3123 rc = X86EMUL_CONTINUE; 3218 rc = X86EMUL_CONTINUE;
@@ -3125,8 +3220,8 @@ twobyte_insn:
3125 break; 3220 break;
3126 case 0x32: 3221 case 0x32:
3127 /* rdmsr */ 3222 /* rdmsr */
3128 if (kvm_get_msr(ctxt->vcpu, c->regs[VCPU_REGS_RCX], &msr_data)) { 3223 if (ops->get_msr(ctxt->vcpu, c->regs[VCPU_REGS_RCX], &msr_data)) {
3129 kvm_inject_gp(ctxt->vcpu, 0); 3224 emulate_gp(ctxt, 0);
3130 goto done; 3225 goto done;
3131 } else { 3226 } else {
3132 c->regs[VCPU_REGS_RAX] = (u32)msr_data; 3227 c->regs[VCPU_REGS_RAX] = (u32)msr_data;
@@ -3136,14 +3231,14 @@ twobyte_insn:
3136 c->dst.type = OP_NONE; 3231 c->dst.type = OP_NONE;
3137 break; 3232 break;
3138 case 0x34: /* sysenter */ 3233 case 0x34: /* sysenter */
3139 rc = emulate_sysenter(ctxt); 3234 rc = emulate_sysenter(ctxt, ops);
3140 if (rc != X86EMUL_CONTINUE) 3235 if (rc != X86EMUL_CONTINUE)
3141 goto done; 3236 goto done;
3142 else 3237 else
3143 goto writeback; 3238 goto writeback;
3144 break; 3239 break;
3145 case 0x35: /* sysexit */ 3240 case 0x35: /* sysexit */
3146 rc = emulate_sysexit(ctxt); 3241 rc = emulate_sysexit(ctxt, ops);
3147 if (rc != X86EMUL_CONTINUE) 3242 if (rc != X86EMUL_CONTINUE)
3148 goto done; 3243 goto done;
3149 else 3244 else
@@ -3160,7 +3255,7 @@ twobyte_insn:
3160 c->dst.type = OP_NONE; 3255 c->dst.type = OP_NONE;
3161 break; 3256 break;
3162 case 0xa0: /* push fs */ 3257 case 0xa0: /* push fs */
3163 emulate_push_sreg(ctxt, VCPU_SREG_FS); 3258 emulate_push_sreg(ctxt, ops, VCPU_SREG_FS);
3164 break; 3259 break;
3165 case 0xa1: /* pop fs */ 3260 case 0xa1: /* pop fs */
3166 rc = emulate_pop_sreg(ctxt, ops, VCPU_SREG_FS); 3261 rc = emulate_pop_sreg(ctxt, ops, VCPU_SREG_FS);
@@ -3179,7 +3274,7 @@ twobyte_insn:
3179 emulate_2op_cl("shld", c->src2, c->src, c->dst, ctxt->eflags); 3274 emulate_2op_cl("shld", c->src2, c->src, c->dst, ctxt->eflags);
3180 break; 3275 break;
3181 case 0xa8: /* push gs */ 3276 case 0xa8: /* push gs */
3182 emulate_push_sreg(ctxt, VCPU_SREG_GS); 3277 emulate_push_sreg(ctxt, ops, VCPU_SREG_GS);
3183 break; 3278 break;
3184 case 0xa9: /* pop gs */ 3279 case 0xa9: /* pop gs */
3185 rc = emulate_pop_sreg(ctxt, ops, VCPU_SREG_GS); 3280 rc = emulate_pop_sreg(ctxt, ops, VCPU_SREG_GS);
diff --git a/arch/x86/kvm/i8254.c b/arch/x86/kvm/i8254.c
index 0150affad25d..0fd6378981f4 100644
--- a/arch/x86/kvm/i8254.c
+++ b/arch/x86/kvm/i8254.c
@@ -5,6 +5,7 @@
5 * Copyright (c) 2006 Intel Corporation 5 * Copyright (c) 2006 Intel Corporation
6 * Copyright (c) 2007 Keir Fraser, XenSource Inc 6 * Copyright (c) 2007 Keir Fraser, XenSource Inc
7 * Copyright (c) 2008 Intel Corporation 7 * Copyright (c) 2008 Intel Corporation
8 * Copyright 2009 Red Hat, Inc. and/or its affilates.
8 * 9 *
9 * Permission is hereby granted, free of charge, to any person obtaining a copy 10 * Permission is hereby granted, free of charge, to any person obtaining a copy
10 * of this software and associated documentation files (the "Software"), to deal 11 * of this software and associated documentation files (the "Software"), to deal
@@ -33,6 +34,7 @@
33 34
34#include <linux/kvm_host.h> 35#include <linux/kvm_host.h>
35#include <linux/slab.h> 36#include <linux/slab.h>
37#include <linux/workqueue.h>
36 38
37#include "irq.h" 39#include "irq.h"
38#include "i8254.h" 40#include "i8254.h"
@@ -243,11 +245,22 @@ static void kvm_pit_ack_irq(struct kvm_irq_ack_notifier *kian)
243{ 245{
244 struct kvm_kpit_state *ps = container_of(kian, struct kvm_kpit_state, 246 struct kvm_kpit_state *ps = container_of(kian, struct kvm_kpit_state,
245 irq_ack_notifier); 247 irq_ack_notifier);
246 raw_spin_lock(&ps->inject_lock); 248 int value;
247 if (atomic_dec_return(&ps->pit_timer.pending) < 0) 249
250 spin_lock(&ps->inject_lock);
251 value = atomic_dec_return(&ps->pit_timer.pending);
252 if (value < 0)
253 /* spurious acks can be generated if, for example, the
254 * PIC is being reset. Handle it gracefully here
255 */
248 atomic_inc(&ps->pit_timer.pending); 256 atomic_inc(&ps->pit_timer.pending);
257 else if (value > 0)
258 /* in this case, we had multiple outstanding pit interrupts
259 * that we needed to inject. Reinject
260 */
261 queue_work(ps->pit->wq, &ps->pit->expired);
249 ps->irq_ack = 1; 262 ps->irq_ack = 1;
250 raw_spin_unlock(&ps->inject_lock); 263 spin_unlock(&ps->inject_lock);
251} 264}
252 265
253void __kvm_migrate_pit_timer(struct kvm_vcpu *vcpu) 266void __kvm_migrate_pit_timer(struct kvm_vcpu *vcpu)
@@ -263,10 +276,10 @@ void __kvm_migrate_pit_timer(struct kvm_vcpu *vcpu)
263 hrtimer_start_expires(timer, HRTIMER_MODE_ABS); 276 hrtimer_start_expires(timer, HRTIMER_MODE_ABS);
264} 277}
265 278
266static void destroy_pit_timer(struct kvm_timer *pt) 279static void destroy_pit_timer(struct kvm_pit *pit)
267{ 280{
268 pr_debug("execute del timer!\n"); 281 hrtimer_cancel(&pit->pit_state.pit_timer.timer);
269 hrtimer_cancel(&pt->timer); 282 cancel_work_sync(&pit->expired);
270} 283}
271 284
272static bool kpit_is_periodic(struct kvm_timer *ktimer) 285static bool kpit_is_periodic(struct kvm_timer *ktimer)
@@ -280,6 +293,60 @@ static struct kvm_timer_ops kpit_ops = {
280 .is_periodic = kpit_is_periodic, 293 .is_periodic = kpit_is_periodic,
281}; 294};
282 295
296static void pit_do_work(struct work_struct *work)
297{
298 struct kvm_pit *pit = container_of(work, struct kvm_pit, expired);
299 struct kvm *kvm = pit->kvm;
300 struct kvm_vcpu *vcpu;
301 int i;
302 struct kvm_kpit_state *ps = &pit->pit_state;
303 int inject = 0;
304
305 /* Try to inject pending interrupts when
306 * last one has been acked.
307 */
308 spin_lock(&ps->inject_lock);
309 if (ps->irq_ack) {
310 ps->irq_ack = 0;
311 inject = 1;
312 }
313 spin_unlock(&ps->inject_lock);
314 if (inject) {
315 kvm_set_irq(kvm, kvm->arch.vpit->irq_source_id, 0, 1);
316 kvm_set_irq(kvm, kvm->arch.vpit->irq_source_id, 0, 0);
317
318 /*
319 * Provides NMI watchdog support via Virtual Wire mode.
320 * The route is: PIT -> PIC -> LVT0 in NMI mode.
321 *
322 * Note: Our Virtual Wire implementation is simplified, only
323 * propagating PIT interrupts to all VCPUs when they have set
324 * LVT0 to NMI delivery. Other PIC interrupts are just sent to
325 * VCPU0, and only if its LVT0 is in EXTINT mode.
326 */
327 if (kvm->arch.vapics_in_nmi_mode > 0)
328 kvm_for_each_vcpu(i, vcpu, kvm)
329 kvm_apic_nmi_wd_deliver(vcpu);
330 }
331}
332
333static enum hrtimer_restart pit_timer_fn(struct hrtimer *data)
334{
335 struct kvm_timer *ktimer = container_of(data, struct kvm_timer, timer);
336 struct kvm_pit *pt = ktimer->kvm->arch.vpit;
337
338 if (ktimer->reinject || !atomic_read(&ktimer->pending)) {
339 atomic_inc(&ktimer->pending);
340 queue_work(pt->wq, &pt->expired);
341 }
342
343 if (ktimer->t_ops->is_periodic(ktimer)) {
344 hrtimer_add_expires_ns(&ktimer->timer, ktimer->period);
345 return HRTIMER_RESTART;
346 } else
347 return HRTIMER_NORESTART;
348}
349
283static void create_pit_timer(struct kvm_kpit_state *ps, u32 val, int is_period) 350static void create_pit_timer(struct kvm_kpit_state *ps, u32 val, int is_period)
284{ 351{
285 struct kvm_timer *pt = &ps->pit_timer; 352 struct kvm_timer *pt = &ps->pit_timer;
@@ -291,13 +358,13 @@ static void create_pit_timer(struct kvm_kpit_state *ps, u32 val, int is_period)
291 358
292 /* TODO The new value only affected after the retriggered */ 359 /* TODO The new value only affected after the retriggered */
293 hrtimer_cancel(&pt->timer); 360 hrtimer_cancel(&pt->timer);
361 cancel_work_sync(&ps->pit->expired);
294 pt->period = interval; 362 pt->period = interval;
295 ps->is_periodic = is_period; 363 ps->is_periodic = is_period;
296 364
297 pt->timer.function = kvm_timer_fn; 365 pt->timer.function = pit_timer_fn;
298 pt->t_ops = &kpit_ops; 366 pt->t_ops = &kpit_ops;
299 pt->kvm = ps->pit->kvm; 367 pt->kvm = ps->pit->kvm;
300 pt->vcpu = pt->kvm->bsp_vcpu;
301 368
302 atomic_set(&pt->pending, 0); 369 atomic_set(&pt->pending, 0);
303 ps->irq_ack = 1; 370 ps->irq_ack = 1;
@@ -346,7 +413,7 @@ static void pit_load_count(struct kvm *kvm, int channel, u32 val)
346 } 413 }
347 break; 414 break;
348 default: 415 default:
349 destroy_pit_timer(&ps->pit_timer); 416 destroy_pit_timer(kvm->arch.vpit);
350 } 417 }
351} 418}
352 419
@@ -625,7 +692,15 @@ struct kvm_pit *kvm_create_pit(struct kvm *kvm, u32 flags)
625 692
626 mutex_init(&pit->pit_state.lock); 693 mutex_init(&pit->pit_state.lock);
627 mutex_lock(&pit->pit_state.lock); 694 mutex_lock(&pit->pit_state.lock);
628 raw_spin_lock_init(&pit->pit_state.inject_lock); 695 spin_lock_init(&pit->pit_state.inject_lock);
696
697 pit->wq = create_singlethread_workqueue("kvm-pit-wq");
698 if (!pit->wq) {
699 mutex_unlock(&pit->pit_state.lock);
700 kfree(pit);
701 return NULL;
702 }
703 INIT_WORK(&pit->expired, pit_do_work);
629 704
630 kvm->arch.vpit = pit; 705 kvm->arch.vpit = pit;
631 pit->kvm = kvm; 706 pit->kvm = kvm;
@@ -677,6 +752,9 @@ void kvm_free_pit(struct kvm *kvm)
677 struct hrtimer *timer; 752 struct hrtimer *timer;
678 753
679 if (kvm->arch.vpit) { 754 if (kvm->arch.vpit) {
755 kvm_io_bus_unregister_dev(kvm, KVM_PIO_BUS, &kvm->arch.vpit->dev);
756 kvm_io_bus_unregister_dev(kvm, KVM_PIO_BUS,
757 &kvm->arch.vpit->speaker_dev);
680 kvm_unregister_irq_mask_notifier(kvm, 0, 758 kvm_unregister_irq_mask_notifier(kvm, 0,
681 &kvm->arch.vpit->mask_notifier); 759 &kvm->arch.vpit->mask_notifier);
682 kvm_unregister_irq_ack_notifier(kvm, 760 kvm_unregister_irq_ack_notifier(kvm,
@@ -684,54 +762,10 @@ void kvm_free_pit(struct kvm *kvm)
684 mutex_lock(&kvm->arch.vpit->pit_state.lock); 762 mutex_lock(&kvm->arch.vpit->pit_state.lock);
685 timer = &kvm->arch.vpit->pit_state.pit_timer.timer; 763 timer = &kvm->arch.vpit->pit_state.pit_timer.timer;
686 hrtimer_cancel(timer); 764 hrtimer_cancel(timer);
765 cancel_work_sync(&kvm->arch.vpit->expired);
687 kvm_free_irq_source_id(kvm, kvm->arch.vpit->irq_source_id); 766 kvm_free_irq_source_id(kvm, kvm->arch.vpit->irq_source_id);
688 mutex_unlock(&kvm->arch.vpit->pit_state.lock); 767 mutex_unlock(&kvm->arch.vpit->pit_state.lock);
768 destroy_workqueue(kvm->arch.vpit->wq);
689 kfree(kvm->arch.vpit); 769 kfree(kvm->arch.vpit);
690 } 770 }
691} 771}
692
693static void __inject_pit_timer_intr(struct kvm *kvm)
694{
695 struct kvm_vcpu *vcpu;
696 int i;
697
698 kvm_set_irq(kvm, kvm->arch.vpit->irq_source_id, 0, 1);
699 kvm_set_irq(kvm, kvm->arch.vpit->irq_source_id, 0, 0);
700
701 /*
702 * Provides NMI watchdog support via Virtual Wire mode.
703 * The route is: PIT -> PIC -> LVT0 in NMI mode.
704 *
705 * Note: Our Virtual Wire implementation is simplified, only
706 * propagating PIT interrupts to all VCPUs when they have set
707 * LVT0 to NMI delivery. Other PIC interrupts are just sent to
708 * VCPU0, and only if its LVT0 is in EXTINT mode.
709 */
710 if (kvm->arch.vapics_in_nmi_mode > 0)
711 kvm_for_each_vcpu(i, vcpu, kvm)
712 kvm_apic_nmi_wd_deliver(vcpu);
713}
714
715void kvm_inject_pit_timer_irqs(struct kvm_vcpu *vcpu)
716{
717 struct kvm_pit *pit = vcpu->kvm->arch.vpit;
718 struct kvm *kvm = vcpu->kvm;
719 struct kvm_kpit_state *ps;
720
721 if (pit) {
722 int inject = 0;
723 ps = &pit->pit_state;
724
725 /* Try to inject pending interrupts when
726 * last one has been acked.
727 */
728 raw_spin_lock(&ps->inject_lock);
729 if (atomic_read(&ps->pit_timer.pending) && ps->irq_ack) {
730 ps->irq_ack = 0;
731 inject = 1;
732 }
733 raw_spin_unlock(&ps->inject_lock);
734 if (inject)
735 __inject_pit_timer_intr(kvm);
736 }
737}
diff --git a/arch/x86/kvm/i8254.h b/arch/x86/kvm/i8254.h
index 900d6b0ba7c2..46d08ca0b48f 100644
--- a/arch/x86/kvm/i8254.h
+++ b/arch/x86/kvm/i8254.h
@@ -27,7 +27,7 @@ struct kvm_kpit_state {
27 u32 speaker_data_on; 27 u32 speaker_data_on;
28 struct mutex lock; 28 struct mutex lock;
29 struct kvm_pit *pit; 29 struct kvm_pit *pit;
30 raw_spinlock_t inject_lock; 30 spinlock_t inject_lock;
31 unsigned long irq_ack; 31 unsigned long irq_ack;
32 struct kvm_irq_ack_notifier irq_ack_notifier; 32 struct kvm_irq_ack_notifier irq_ack_notifier;
33}; 33};
@@ -40,6 +40,8 @@ struct kvm_pit {
40 struct kvm_kpit_state pit_state; 40 struct kvm_kpit_state pit_state;
41 int irq_source_id; 41 int irq_source_id;
42 struct kvm_irq_mask_notifier mask_notifier; 42 struct kvm_irq_mask_notifier mask_notifier;
43 struct workqueue_struct *wq;
44 struct work_struct expired;
43}; 45};
44 46
45#define KVM_PIT_BASE_ADDRESS 0x40 47#define KVM_PIT_BASE_ADDRESS 0x40
diff --git a/arch/x86/kvm/i8259.c b/arch/x86/kvm/i8259.c
index 93825ff3338f..8d10c063d7f2 100644
--- a/arch/x86/kvm/i8259.c
+++ b/arch/x86/kvm/i8259.c
@@ -3,6 +3,7 @@
3 * 3 *
4 * Copyright (c) 2003-2004 Fabrice Bellard 4 * Copyright (c) 2003-2004 Fabrice Bellard
5 * Copyright (c) 2007 Intel Corporation 5 * Copyright (c) 2007 Intel Corporation
6 * Copyright 2009 Red Hat, Inc. and/or its affilates.
6 * 7 *
7 * Permission is hereby granted, free of charge, to any person obtaining a copy 8 * Permission is hereby granted, free of charge, to any person obtaining a copy
8 * of this software and associated documentation files (the "Software"), to deal 9 * of this software and associated documentation files (the "Software"), to deal
@@ -33,6 +34,8 @@
33#include <linux/kvm_host.h> 34#include <linux/kvm_host.h>
34#include "trace.h" 35#include "trace.h"
35 36
37static void pic_irq_request(struct kvm *kvm, int level);
38
36static void pic_lock(struct kvm_pic *s) 39static void pic_lock(struct kvm_pic *s)
37 __acquires(&s->lock) 40 __acquires(&s->lock)
38{ 41{
@@ -43,16 +46,25 @@ static void pic_unlock(struct kvm_pic *s)
43 __releases(&s->lock) 46 __releases(&s->lock)
44{ 47{
45 bool wakeup = s->wakeup_needed; 48 bool wakeup = s->wakeup_needed;
46 struct kvm_vcpu *vcpu; 49 struct kvm_vcpu *vcpu, *found = NULL;
50 int i;
47 51
48 s->wakeup_needed = false; 52 s->wakeup_needed = false;
49 53
50 raw_spin_unlock(&s->lock); 54 raw_spin_unlock(&s->lock);
51 55
52 if (wakeup) { 56 if (wakeup) {
53 vcpu = s->kvm->bsp_vcpu; 57 kvm_for_each_vcpu(i, vcpu, s->kvm) {
54 if (vcpu) 58 if (kvm_apic_accept_pic_intr(vcpu)) {
55 kvm_vcpu_kick(vcpu); 59 found = vcpu;
60 break;
61 }
62 }
63
64 if (!found)
65 found = s->kvm->bsp_vcpu;
66
67 kvm_vcpu_kick(found);
56 } 68 }
57} 69}
58 70
@@ -173,10 +185,7 @@ static void pic_update_irq(struct kvm_pic *s)
173 pic_set_irq1(&s->pics[0], 2, 0); 185 pic_set_irq1(&s->pics[0], 2, 0);
174 } 186 }
175 irq = pic_get_irq(&s->pics[0]); 187 irq = pic_get_irq(&s->pics[0]);
176 if (irq >= 0) 188 pic_irq_request(s->kvm, irq >= 0);
177 s->irq_request(s->irq_request_opaque, 1);
178 else
179 s->irq_request(s->irq_request_opaque, 0);
180} 189}
181 190
182void kvm_pic_update_irq(struct kvm_pic *s) 191void kvm_pic_update_irq(struct kvm_pic *s)
@@ -261,8 +270,7 @@ int kvm_pic_read_irq(struct kvm *kvm)
261void kvm_pic_reset(struct kvm_kpic_state *s) 270void kvm_pic_reset(struct kvm_kpic_state *s)
262{ 271{
263 int irq; 272 int irq;
264 struct kvm *kvm = s->pics_state->irq_request_opaque; 273 struct kvm_vcpu *vcpu0 = s->pics_state->kvm->bsp_vcpu;
265 struct kvm_vcpu *vcpu0 = kvm->bsp_vcpu;
266 u8 irr = s->irr, isr = s->imr; 274 u8 irr = s->irr, isr = s->imr;
267 275
268 s->last_irr = 0; 276 s->last_irr = 0;
@@ -301,8 +309,7 @@ static void pic_ioport_write(void *opaque, u32 addr, u32 val)
301 /* 309 /*
302 * deassert a pending interrupt 310 * deassert a pending interrupt
303 */ 311 */
304 s->pics_state->irq_request(s->pics_state-> 312 pic_irq_request(s->pics_state->kvm, 0);
305 irq_request_opaque, 0);
306 s->init_state = 1; 313 s->init_state = 1;
307 s->init4 = val & 1; 314 s->init4 = val & 1;
308 if (val & 0x02) 315 if (val & 0x02)
@@ -356,10 +363,20 @@ static void pic_ioport_write(void *opaque, u32 addr, u32 val)
356 } 363 }
357 } else 364 } else
358 switch (s->init_state) { 365 switch (s->init_state) {
359 case 0: /* normal mode */ 366 case 0: { /* normal mode */
367 u8 imr_diff = s->imr ^ val,
368 off = (s == &s->pics_state->pics[0]) ? 0 : 8;
360 s->imr = val; 369 s->imr = val;
370 for (irq = 0; irq < PIC_NUM_PINS/2; irq++)
371 if (imr_diff & (1 << irq))
372 kvm_fire_mask_notifiers(
373 s->pics_state->kvm,
374 SELECT_PIC(irq + off),
375 irq + off,
376 !!(s->imr & (1 << irq)));
361 pic_update_irq(s->pics_state); 377 pic_update_irq(s->pics_state);
362 break; 378 break;
379 }
363 case 1: 380 case 1:
364 s->irq_base = val & 0xf8; 381 s->irq_base = val & 0xf8;
365 s->init_state = 2; 382 s->init_state = 2;
@@ -518,9 +535,8 @@ static int picdev_read(struct kvm_io_device *this,
518/* 535/*
519 * callback when PIC0 irq status changed 536 * callback when PIC0 irq status changed
520 */ 537 */
521static void pic_irq_request(void *opaque, int level) 538static void pic_irq_request(struct kvm *kvm, int level)
522{ 539{
523 struct kvm *kvm = opaque;
524 struct kvm_vcpu *vcpu = kvm->bsp_vcpu; 540 struct kvm_vcpu *vcpu = kvm->bsp_vcpu;
525 struct kvm_pic *s = pic_irqchip(kvm); 541 struct kvm_pic *s = pic_irqchip(kvm);
526 int irq = pic_get_irq(&s->pics[0]); 542 int irq = pic_get_irq(&s->pics[0]);
@@ -549,8 +565,6 @@ struct kvm_pic *kvm_create_pic(struct kvm *kvm)
549 s->kvm = kvm; 565 s->kvm = kvm;
550 s->pics[0].elcr_mask = 0xf8; 566 s->pics[0].elcr_mask = 0xf8;
551 s->pics[1].elcr_mask = 0xde; 567 s->pics[1].elcr_mask = 0xde;
552 s->irq_request = pic_irq_request;
553 s->irq_request_opaque = kvm;
554 s->pics[0].pics_state = s; 568 s->pics[0].pics_state = s;
555 s->pics[1].pics_state = s; 569 s->pics[1].pics_state = s;
556 570
diff --git a/arch/x86/kvm/irq.c b/arch/x86/kvm/irq.c
index 96dfbb6ad2a9..2095a049835e 100644
--- a/arch/x86/kvm/irq.c
+++ b/arch/x86/kvm/irq.c
@@ -1,6 +1,7 @@
1/* 1/*
2 * irq.c: API for in kernel interrupt controller 2 * irq.c: API for in kernel interrupt controller
3 * Copyright (c) 2007, Intel Corporation. 3 * Copyright (c) 2007, Intel Corporation.
4 * Copyright 2009 Red Hat, Inc. and/or its affilates.
4 * 5 *
5 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License, 7 * under the terms and conditions of the GNU General Public License,
@@ -89,7 +90,6 @@ EXPORT_SYMBOL_GPL(kvm_cpu_get_interrupt);
89void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu) 90void kvm_inject_pending_timer_irqs(struct kvm_vcpu *vcpu)
90{ 91{
91 kvm_inject_apic_timer_irqs(vcpu); 92 kvm_inject_apic_timer_irqs(vcpu);
92 kvm_inject_pit_timer_irqs(vcpu);
93 /* TODO: PIT, RTC etc. */ 93 /* TODO: PIT, RTC etc. */
94} 94}
95EXPORT_SYMBOL_GPL(kvm_inject_pending_timer_irqs); 95EXPORT_SYMBOL_GPL(kvm_inject_pending_timer_irqs);
diff --git a/arch/x86/kvm/irq.h b/arch/x86/kvm/irq.h
index cd1f362f413d..ffed06871c5c 100644
--- a/arch/x86/kvm/irq.h
+++ b/arch/x86/kvm/irq.h
@@ -38,8 +38,6 @@
38struct kvm; 38struct kvm;
39struct kvm_vcpu; 39struct kvm_vcpu;
40 40
41typedef void irq_request_func(void *opaque, int level);
42
43struct kvm_kpic_state { 41struct kvm_kpic_state {
44 u8 last_irr; /* edge detection */ 42 u8 last_irr; /* edge detection */
45 u8 irr; /* interrupt request register */ 43 u8 irr; /* interrupt request register */
@@ -67,8 +65,6 @@ struct kvm_pic {
67 unsigned pending_acks; 65 unsigned pending_acks;
68 struct kvm *kvm; 66 struct kvm *kvm;
69 struct kvm_kpic_state pics[2]; /* 0 is master pic, 1 is slave pic */ 67 struct kvm_kpic_state pics[2]; /* 0 is master pic, 1 is slave pic */
70 irq_request_func *irq_request;
71 void *irq_request_opaque;
72 int output; /* intr from master PIC */ 68 int output; /* intr from master PIC */
73 struct kvm_io_device dev; 69 struct kvm_io_device dev;
74 void (*ack_notifier)(void *opaque, int irq); 70 void (*ack_notifier)(void *opaque, int irq);
diff --git a/arch/x86/kvm/kvm_cache_regs.h b/arch/x86/kvm/kvm_cache_regs.h
index cff851cf5322..6491ac8e755b 100644
--- a/arch/x86/kvm/kvm_cache_regs.h
+++ b/arch/x86/kvm/kvm_cache_regs.h
@@ -36,6 +36,8 @@ static inline void kvm_rip_write(struct kvm_vcpu *vcpu, unsigned long val)
36 36
37static inline u64 kvm_pdptr_read(struct kvm_vcpu *vcpu, int index) 37static inline u64 kvm_pdptr_read(struct kvm_vcpu *vcpu, int index)
38{ 38{
39 might_sleep(); /* on svm */
40
39 if (!test_bit(VCPU_EXREG_PDPTR, 41 if (!test_bit(VCPU_EXREG_PDPTR,
40 (unsigned long *)&vcpu->arch.regs_avail)) 42 (unsigned long *)&vcpu->arch.regs_avail))
41 kvm_x86_ops->cache_reg(vcpu, VCPU_EXREG_PDPTR); 43 kvm_x86_ops->cache_reg(vcpu, VCPU_EXREG_PDPTR);
@@ -69,4 +71,10 @@ static inline ulong kvm_read_cr4(struct kvm_vcpu *vcpu)
69 return kvm_read_cr4_bits(vcpu, ~0UL); 71 return kvm_read_cr4_bits(vcpu, ~0UL);
70} 72}
71 73
74static inline u64 kvm_read_edx_eax(struct kvm_vcpu *vcpu)
75{
76 return (kvm_register_read(vcpu, VCPU_REGS_RAX) & -1u)
77 | ((u64)(kvm_register_read(vcpu, VCPU_REGS_RDX) & -1u) << 32);
78}
79
72#endif 80#endif
diff --git a/arch/x86/kvm/lapic.c b/arch/x86/kvm/lapic.c
index 1eb7a4ae0c9c..77d8c0f4817d 100644
--- a/arch/x86/kvm/lapic.c
+++ b/arch/x86/kvm/lapic.c
@@ -5,6 +5,7 @@
5 * Copyright (C) 2006 Qumranet, Inc. 5 * Copyright (C) 2006 Qumranet, Inc.
6 * Copyright (C) 2007 Novell 6 * Copyright (C) 2007 Novell
7 * Copyright (C) 2007 Intel 7 * Copyright (C) 2007 Intel
8 * Copyright 2009 Red Hat, Inc. and/or its affilates.
8 * 9 *
9 * Authors: 10 * Authors:
10 * Dor Laor <dor.laor@qumranet.com> 11 * Dor Laor <dor.laor@qumranet.com>
@@ -328,7 +329,7 @@ int kvm_apic_match_dest(struct kvm_vcpu *vcpu, struct kvm_lapic *source,
328 "dest_mode 0x%x, short_hand 0x%x\n", 329 "dest_mode 0x%x, short_hand 0x%x\n",
329 target, source, dest, dest_mode, short_hand); 330 target, source, dest, dest_mode, short_hand);
330 331
331 ASSERT(!target); 332 ASSERT(target);
332 switch (short_hand) { 333 switch (short_hand) {
333 case APIC_DEST_NOSHORT: 334 case APIC_DEST_NOSHORT:
334 if (dest_mode == 0) 335 if (dest_mode == 0)
@@ -533,7 +534,7 @@ static void __report_tpr_access(struct kvm_lapic *apic, bool write)
533 struct kvm_vcpu *vcpu = apic->vcpu; 534 struct kvm_vcpu *vcpu = apic->vcpu;
534 struct kvm_run *run = vcpu->run; 535 struct kvm_run *run = vcpu->run;
535 536
536 set_bit(KVM_REQ_REPORT_TPR_ACCESS, &vcpu->requests); 537 kvm_make_request(KVM_REQ_REPORT_TPR_ACCESS, vcpu);
537 run->tpr_access.rip = kvm_rip_read(vcpu); 538 run->tpr_access.rip = kvm_rip_read(vcpu);
538 run->tpr_access.is_write = write; 539 run->tpr_access.is_write = write;
539} 540}
@@ -1106,13 +1107,11 @@ int kvm_apic_accept_pic_intr(struct kvm_vcpu *vcpu)
1106 u32 lvt0 = apic_get_reg(vcpu->arch.apic, APIC_LVT0); 1107 u32 lvt0 = apic_get_reg(vcpu->arch.apic, APIC_LVT0);
1107 int r = 0; 1108 int r = 0;
1108 1109
1109 if (kvm_vcpu_is_bsp(vcpu)) { 1110 if (!apic_hw_enabled(vcpu->arch.apic))
1110 if (!apic_hw_enabled(vcpu->arch.apic)) 1111 r = 1;
1111 r = 1; 1112 if ((lvt0 & APIC_LVT_MASKED) == 0 &&
1112 if ((lvt0 & APIC_LVT_MASKED) == 0 && 1113 GET_APIC_DELIVERY_MODE(lvt0) == APIC_MODE_EXTINT)
1113 GET_APIC_DELIVERY_MODE(lvt0) == APIC_MODE_EXTINT) 1114 r = 1;
1114 r = 1;
1115 }
1116 return r; 1115 return r;
1117} 1116}
1118 1117
diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index b1ed0a1a5913..311f6dad8951 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -7,6 +7,7 @@
7 * MMU support 7 * MMU support
8 * 8 *
9 * Copyright (C) 2006 Qumranet, Inc. 9 * Copyright (C) 2006 Qumranet, Inc.
10 * Copyright 2010 Red Hat, Inc. and/or its affilates.
10 * 11 *
11 * Authors: 12 * Authors:
12 * Yaniv Kamay <yaniv@qumranet.com> 13 * Yaniv Kamay <yaniv@qumranet.com>
@@ -32,6 +33,7 @@
32#include <linux/compiler.h> 33#include <linux/compiler.h>
33#include <linux/srcu.h> 34#include <linux/srcu.h>
34#include <linux/slab.h> 35#include <linux/slab.h>
36#include <linux/uaccess.h>
35 37
36#include <asm/page.h> 38#include <asm/page.h>
37#include <asm/cmpxchg.h> 39#include <asm/cmpxchg.h>
@@ -90,8 +92,6 @@ module_param(oos_shadow, bool, 0644);
90#define PT_FIRST_AVAIL_BITS_SHIFT 9 92#define PT_FIRST_AVAIL_BITS_SHIFT 9
91#define PT64_SECOND_AVAIL_BITS_SHIFT 52 93#define PT64_SECOND_AVAIL_BITS_SHIFT 52
92 94
93#define VALID_PAGE(x) ((x) != INVALID_PAGE)
94
95#define PT64_LEVEL_BITS 9 95#define PT64_LEVEL_BITS 9
96 96
97#define PT64_LEVEL_SHIFT(level) \ 97#define PT64_LEVEL_SHIFT(level) \
@@ -173,7 +173,7 @@ struct kvm_shadow_walk_iterator {
173 shadow_walk_okay(&(_walker)); \ 173 shadow_walk_okay(&(_walker)); \
174 shadow_walk_next(&(_walker))) 174 shadow_walk_next(&(_walker)))
175 175
176typedef int (*mmu_parent_walk_fn) (struct kvm_mmu_page *sp); 176typedef void (*mmu_parent_walk_fn) (struct kvm_mmu_page *sp, u64 *spte);
177 177
178static struct kmem_cache *pte_chain_cache; 178static struct kmem_cache *pte_chain_cache;
179static struct kmem_cache *rmap_desc_cache; 179static struct kmem_cache *rmap_desc_cache;
@@ -281,13 +281,38 @@ static gfn_t pse36_gfn_delta(u32 gpte)
281 281
282static void __set_spte(u64 *sptep, u64 spte) 282static void __set_spte(u64 *sptep, u64 spte)
283{ 283{
284 set_64bit(sptep, spte);
285}
286
287static u64 __xchg_spte(u64 *sptep, u64 new_spte)
288{
284#ifdef CONFIG_X86_64 289#ifdef CONFIG_X86_64
285 set_64bit((unsigned long *)sptep, spte); 290 return xchg(sptep, new_spte);
286#else 291#else
287 set_64bit((unsigned long long *)sptep, spte); 292 u64 old_spte;
293
294 do {
295 old_spte = *sptep;
296 } while (cmpxchg64(sptep, old_spte, new_spte) != old_spte);
297
298 return old_spte;
288#endif 299#endif
289} 300}
290 301
302static void update_spte(u64 *sptep, u64 new_spte)
303{
304 u64 old_spte;
305
306 if (!shadow_accessed_mask || (new_spte & shadow_accessed_mask) ||
307 !is_rmap_spte(*sptep))
308 __set_spte(sptep, new_spte);
309 else {
310 old_spte = __xchg_spte(sptep, new_spte);
311 if (old_spte & shadow_accessed_mask)
312 mark_page_accessed(pfn_to_page(spte_to_pfn(old_spte)));
313 }
314}
315
291static int mmu_topup_memory_cache(struct kvm_mmu_memory_cache *cache, 316static int mmu_topup_memory_cache(struct kvm_mmu_memory_cache *cache,
292 struct kmem_cache *base_cache, int min) 317 struct kmem_cache *base_cache, int min)
293{ 318{
@@ -304,10 +329,11 @@ static int mmu_topup_memory_cache(struct kvm_mmu_memory_cache *cache,
304 return 0; 329 return 0;
305} 330}
306 331
307static void mmu_free_memory_cache(struct kvm_mmu_memory_cache *mc) 332static void mmu_free_memory_cache(struct kvm_mmu_memory_cache *mc,
333 struct kmem_cache *cache)
308{ 334{
309 while (mc->nobjs) 335 while (mc->nobjs)
310 kfree(mc->objects[--mc->nobjs]); 336 kmem_cache_free(cache, mc->objects[--mc->nobjs]);
311} 337}
312 338
313static int mmu_topup_memory_cache_page(struct kvm_mmu_memory_cache *cache, 339static int mmu_topup_memory_cache_page(struct kvm_mmu_memory_cache *cache,
@@ -355,10 +381,11 @@ out:
355 381
356static void mmu_free_memory_caches(struct kvm_vcpu *vcpu) 382static void mmu_free_memory_caches(struct kvm_vcpu *vcpu)
357{ 383{
358 mmu_free_memory_cache(&vcpu->arch.mmu_pte_chain_cache); 384 mmu_free_memory_cache(&vcpu->arch.mmu_pte_chain_cache, pte_chain_cache);
359 mmu_free_memory_cache(&vcpu->arch.mmu_rmap_desc_cache); 385 mmu_free_memory_cache(&vcpu->arch.mmu_rmap_desc_cache, rmap_desc_cache);
360 mmu_free_memory_cache_page(&vcpu->arch.mmu_page_cache); 386 mmu_free_memory_cache_page(&vcpu->arch.mmu_page_cache);
361 mmu_free_memory_cache(&vcpu->arch.mmu_page_header_cache); 387 mmu_free_memory_cache(&vcpu->arch.mmu_page_header_cache,
388 mmu_page_header_cache);
362} 389}
363 390
364static void *mmu_memory_cache_alloc(struct kvm_mmu_memory_cache *mc, 391static void *mmu_memory_cache_alloc(struct kvm_mmu_memory_cache *mc,
@@ -379,7 +406,7 @@ static struct kvm_pte_chain *mmu_alloc_pte_chain(struct kvm_vcpu *vcpu)
379 406
380static void mmu_free_pte_chain(struct kvm_pte_chain *pc) 407static void mmu_free_pte_chain(struct kvm_pte_chain *pc)
381{ 408{
382 kfree(pc); 409 kmem_cache_free(pte_chain_cache, pc);
383} 410}
384 411
385static struct kvm_rmap_desc *mmu_alloc_rmap_desc(struct kvm_vcpu *vcpu) 412static struct kvm_rmap_desc *mmu_alloc_rmap_desc(struct kvm_vcpu *vcpu)
@@ -390,7 +417,23 @@ static struct kvm_rmap_desc *mmu_alloc_rmap_desc(struct kvm_vcpu *vcpu)
390 417
391static void mmu_free_rmap_desc(struct kvm_rmap_desc *rd) 418static void mmu_free_rmap_desc(struct kvm_rmap_desc *rd)
392{ 419{
393 kfree(rd); 420 kmem_cache_free(rmap_desc_cache, rd);
421}
422
423static gfn_t kvm_mmu_page_get_gfn(struct kvm_mmu_page *sp, int index)
424{
425 if (!sp->role.direct)
426 return sp->gfns[index];
427
428 return sp->gfn + (index << ((sp->role.level - 1) * PT64_LEVEL_BITS));
429}
430
431static void kvm_mmu_page_set_gfn(struct kvm_mmu_page *sp, int index, gfn_t gfn)
432{
433 if (sp->role.direct)
434 BUG_ON(gfn != kvm_mmu_page_get_gfn(sp, index));
435 else
436 sp->gfns[index] = gfn;
394} 437}
395 438
396/* 439/*
@@ -403,8 +446,8 @@ static int *slot_largepage_idx(gfn_t gfn,
403{ 446{
404 unsigned long idx; 447 unsigned long idx;
405 448
406 idx = (gfn / KVM_PAGES_PER_HPAGE(level)) - 449 idx = (gfn >> KVM_HPAGE_GFN_SHIFT(level)) -
407 (slot->base_gfn / KVM_PAGES_PER_HPAGE(level)); 450 (slot->base_gfn >> KVM_HPAGE_GFN_SHIFT(level));
408 return &slot->lpage_info[level - 2][idx].write_count; 451 return &slot->lpage_info[level - 2][idx].write_count;
409} 452}
410 453
@@ -414,9 +457,7 @@ static void account_shadowed(struct kvm *kvm, gfn_t gfn)
414 int *write_count; 457 int *write_count;
415 int i; 458 int i;
416 459
417 gfn = unalias_gfn(kvm, gfn); 460 slot = gfn_to_memslot(kvm, gfn);
418
419 slot = gfn_to_memslot_unaliased(kvm, gfn);
420 for (i = PT_DIRECTORY_LEVEL; 461 for (i = PT_DIRECTORY_LEVEL;
421 i < PT_PAGE_TABLE_LEVEL + KVM_NR_PAGE_SIZES; ++i) { 462 i < PT_PAGE_TABLE_LEVEL + KVM_NR_PAGE_SIZES; ++i) {
422 write_count = slot_largepage_idx(gfn, slot, i); 463 write_count = slot_largepage_idx(gfn, slot, i);
@@ -430,8 +471,7 @@ static void unaccount_shadowed(struct kvm *kvm, gfn_t gfn)
430 int *write_count; 471 int *write_count;
431 int i; 472 int i;
432 473
433 gfn = unalias_gfn(kvm, gfn); 474 slot = gfn_to_memslot(kvm, gfn);
434 slot = gfn_to_memslot_unaliased(kvm, gfn);
435 for (i = PT_DIRECTORY_LEVEL; 475 for (i = PT_DIRECTORY_LEVEL;
436 i < PT_PAGE_TABLE_LEVEL + KVM_NR_PAGE_SIZES; ++i) { 476 i < PT_PAGE_TABLE_LEVEL + KVM_NR_PAGE_SIZES; ++i) {
437 write_count = slot_largepage_idx(gfn, slot, i); 477 write_count = slot_largepage_idx(gfn, slot, i);
@@ -447,8 +487,7 @@ static int has_wrprotected_page(struct kvm *kvm,
447 struct kvm_memory_slot *slot; 487 struct kvm_memory_slot *slot;
448 int *largepage_idx; 488 int *largepage_idx;
449 489
450 gfn = unalias_gfn(kvm, gfn); 490 slot = gfn_to_memslot(kvm, gfn);
451 slot = gfn_to_memslot_unaliased(kvm, gfn);
452 if (slot) { 491 if (slot) {
453 largepage_idx = slot_largepage_idx(gfn, slot, level); 492 largepage_idx = slot_largepage_idx(gfn, slot, level);
454 return *largepage_idx; 493 return *largepage_idx;
@@ -501,7 +540,6 @@ static int mapping_level(struct kvm_vcpu *vcpu, gfn_t large_gfn)
501 540
502/* 541/*
503 * Take gfn and return the reverse mapping to it. 542 * Take gfn and return the reverse mapping to it.
504 * Note: gfn must be unaliased before this function get called
505 */ 543 */
506 544
507static unsigned long *gfn_to_rmap(struct kvm *kvm, gfn_t gfn, int level) 545static unsigned long *gfn_to_rmap(struct kvm *kvm, gfn_t gfn, int level)
@@ -513,8 +551,8 @@ static unsigned long *gfn_to_rmap(struct kvm *kvm, gfn_t gfn, int level)
513 if (likely(level == PT_PAGE_TABLE_LEVEL)) 551 if (likely(level == PT_PAGE_TABLE_LEVEL))
514 return &slot->rmap[gfn - slot->base_gfn]; 552 return &slot->rmap[gfn - slot->base_gfn];
515 553
516 idx = (gfn / KVM_PAGES_PER_HPAGE(level)) - 554 idx = (gfn >> KVM_HPAGE_GFN_SHIFT(level)) -
517 (slot->base_gfn / KVM_PAGES_PER_HPAGE(level)); 555 (slot->base_gfn >> KVM_HPAGE_GFN_SHIFT(level));
518 556
519 return &slot->lpage_info[level - 2][idx].rmap_pde; 557 return &slot->lpage_info[level - 2][idx].rmap_pde;
520} 558}
@@ -541,9 +579,8 @@ static int rmap_add(struct kvm_vcpu *vcpu, u64 *spte, gfn_t gfn)
541 579
542 if (!is_rmap_spte(*spte)) 580 if (!is_rmap_spte(*spte))
543 return count; 581 return count;
544 gfn = unalias_gfn(vcpu->kvm, gfn);
545 sp = page_header(__pa(spte)); 582 sp = page_header(__pa(spte));
546 sp->gfns[spte - sp->spt] = gfn; 583 kvm_mmu_page_set_gfn(sp, spte - sp->spt, gfn);
547 rmapp = gfn_to_rmap(vcpu->kvm, gfn, sp->role.level); 584 rmapp = gfn_to_rmap(vcpu->kvm, gfn, sp->role.level);
548 if (!*rmapp) { 585 if (!*rmapp) {
549 rmap_printk("rmap_add: %p %llx 0->1\n", spte, *spte); 586 rmap_printk("rmap_add: %p %llx 0->1\n", spte, *spte);
@@ -600,19 +637,13 @@ static void rmap_remove(struct kvm *kvm, u64 *spte)
600 struct kvm_rmap_desc *desc; 637 struct kvm_rmap_desc *desc;
601 struct kvm_rmap_desc *prev_desc; 638 struct kvm_rmap_desc *prev_desc;
602 struct kvm_mmu_page *sp; 639 struct kvm_mmu_page *sp;
603 pfn_t pfn; 640 gfn_t gfn;
604 unsigned long *rmapp; 641 unsigned long *rmapp;
605 int i; 642 int i;
606 643
607 if (!is_rmap_spte(*spte))
608 return;
609 sp = page_header(__pa(spte)); 644 sp = page_header(__pa(spte));
610 pfn = spte_to_pfn(*spte); 645 gfn = kvm_mmu_page_get_gfn(sp, spte - sp->spt);
611 if (*spte & shadow_accessed_mask) 646 rmapp = gfn_to_rmap(kvm, gfn, sp->role.level);
612 kvm_set_pfn_accessed(pfn);
613 if (is_writable_pte(*spte))
614 kvm_set_pfn_dirty(pfn);
615 rmapp = gfn_to_rmap(kvm, sp->gfns[spte - sp->spt], sp->role.level);
616 if (!*rmapp) { 647 if (!*rmapp) {
617 printk(KERN_ERR "rmap_remove: %p %llx 0->BUG\n", spte, *spte); 648 printk(KERN_ERR "rmap_remove: %p %llx 0->BUG\n", spte, *spte);
618 BUG(); 649 BUG();
@@ -644,6 +675,32 @@ static void rmap_remove(struct kvm *kvm, u64 *spte)
644 } 675 }
645} 676}
646 677
678static void set_spte_track_bits(u64 *sptep, u64 new_spte)
679{
680 pfn_t pfn;
681 u64 old_spte = *sptep;
682
683 if (!shadow_accessed_mask || !is_shadow_present_pte(old_spte) ||
684 old_spte & shadow_accessed_mask) {
685 __set_spte(sptep, new_spte);
686 } else
687 old_spte = __xchg_spte(sptep, new_spte);
688
689 if (!is_rmap_spte(old_spte))
690 return;
691 pfn = spte_to_pfn(old_spte);
692 if (!shadow_accessed_mask || old_spte & shadow_accessed_mask)
693 kvm_set_pfn_accessed(pfn);
694 if (is_writable_pte(old_spte))
695 kvm_set_pfn_dirty(pfn);
696}
697
698static void drop_spte(struct kvm *kvm, u64 *sptep, u64 new_spte)
699{
700 set_spte_track_bits(sptep, new_spte);
701 rmap_remove(kvm, sptep);
702}
703
647static u64 *rmap_next(struct kvm *kvm, unsigned long *rmapp, u64 *spte) 704static u64 *rmap_next(struct kvm *kvm, unsigned long *rmapp, u64 *spte)
648{ 705{
649 struct kvm_rmap_desc *desc; 706 struct kvm_rmap_desc *desc;
@@ -676,7 +733,6 @@ static int rmap_write_protect(struct kvm *kvm, u64 gfn)
676 u64 *spte; 733 u64 *spte;
677 int i, write_protected = 0; 734 int i, write_protected = 0;
678 735
679 gfn = unalias_gfn(kvm, gfn);
680 rmapp = gfn_to_rmap(kvm, gfn, PT_PAGE_TABLE_LEVEL); 736 rmapp = gfn_to_rmap(kvm, gfn, PT_PAGE_TABLE_LEVEL);
681 737
682 spte = rmap_next(kvm, rmapp, NULL); 738 spte = rmap_next(kvm, rmapp, NULL);
@@ -685,7 +741,7 @@ static int rmap_write_protect(struct kvm *kvm, u64 gfn)
685 BUG_ON(!(*spte & PT_PRESENT_MASK)); 741 BUG_ON(!(*spte & PT_PRESENT_MASK));
686 rmap_printk("rmap_write_protect: spte %p %llx\n", spte, *spte); 742 rmap_printk("rmap_write_protect: spte %p %llx\n", spte, *spte);
687 if (is_writable_pte(*spte)) { 743 if (is_writable_pte(*spte)) {
688 __set_spte(spte, *spte & ~PT_WRITABLE_MASK); 744 update_spte(spte, *spte & ~PT_WRITABLE_MASK);
689 write_protected = 1; 745 write_protected = 1;
690 } 746 }
691 spte = rmap_next(kvm, rmapp, spte); 747 spte = rmap_next(kvm, rmapp, spte);
@@ -709,9 +765,9 @@ static int rmap_write_protect(struct kvm *kvm, u64 gfn)
709 BUG_ON((*spte & (PT_PAGE_SIZE_MASK|PT_PRESENT_MASK)) != (PT_PAGE_SIZE_MASK|PT_PRESENT_MASK)); 765 BUG_ON((*spte & (PT_PAGE_SIZE_MASK|PT_PRESENT_MASK)) != (PT_PAGE_SIZE_MASK|PT_PRESENT_MASK));
710 pgprintk("rmap_write_protect(large): spte %p %llx %lld\n", spte, *spte, gfn); 766 pgprintk("rmap_write_protect(large): spte %p %llx %lld\n", spte, *spte, gfn);
711 if (is_writable_pte(*spte)) { 767 if (is_writable_pte(*spte)) {
712 rmap_remove(kvm, spte); 768 drop_spte(kvm, spte,
769 shadow_trap_nonpresent_pte);
713 --kvm->stat.lpages; 770 --kvm->stat.lpages;
714 __set_spte(spte, shadow_trap_nonpresent_pte);
715 spte = NULL; 771 spte = NULL;
716 write_protected = 1; 772 write_protected = 1;
717 } 773 }
@@ -731,8 +787,7 @@ static int kvm_unmap_rmapp(struct kvm *kvm, unsigned long *rmapp,
731 while ((spte = rmap_next(kvm, rmapp, NULL))) { 787 while ((spte = rmap_next(kvm, rmapp, NULL))) {
732 BUG_ON(!(*spte & PT_PRESENT_MASK)); 788 BUG_ON(!(*spte & PT_PRESENT_MASK));
733 rmap_printk("kvm_rmap_unmap_hva: spte %p %llx\n", spte, *spte); 789 rmap_printk("kvm_rmap_unmap_hva: spte %p %llx\n", spte, *spte);
734 rmap_remove(kvm, spte); 790 drop_spte(kvm, spte, shadow_trap_nonpresent_pte);
735 __set_spte(spte, shadow_trap_nonpresent_pte);
736 need_tlb_flush = 1; 791 need_tlb_flush = 1;
737 } 792 }
738 return need_tlb_flush; 793 return need_tlb_flush;
@@ -754,8 +809,7 @@ static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp,
754 rmap_printk("kvm_set_pte_rmapp: spte %p %llx\n", spte, *spte); 809 rmap_printk("kvm_set_pte_rmapp: spte %p %llx\n", spte, *spte);
755 need_flush = 1; 810 need_flush = 1;
756 if (pte_write(*ptep)) { 811 if (pte_write(*ptep)) {
757 rmap_remove(kvm, spte); 812 drop_spte(kvm, spte, shadow_trap_nonpresent_pte);
758 __set_spte(spte, shadow_trap_nonpresent_pte);
759 spte = rmap_next(kvm, rmapp, NULL); 813 spte = rmap_next(kvm, rmapp, NULL);
760 } else { 814 } else {
761 new_spte = *spte &~ (PT64_BASE_ADDR_MASK); 815 new_spte = *spte &~ (PT64_BASE_ADDR_MASK);
@@ -763,9 +817,8 @@ static int kvm_set_pte_rmapp(struct kvm *kvm, unsigned long *rmapp,
763 817
764 new_spte &= ~PT_WRITABLE_MASK; 818 new_spte &= ~PT_WRITABLE_MASK;
765 new_spte &= ~SPTE_HOST_WRITEABLE; 819 new_spte &= ~SPTE_HOST_WRITEABLE;
766 if (is_writable_pte(*spte)) 820 new_spte &= ~shadow_accessed_mask;
767 kvm_set_pfn_dirty(spte_to_pfn(*spte)); 821 set_spte_track_bits(spte, new_spte);
768 __set_spte(spte, new_spte);
769 spte = rmap_next(kvm, rmapp, spte); 822 spte = rmap_next(kvm, rmapp, spte);
770 } 823 }
771 } 824 }
@@ -799,8 +852,12 @@ static int kvm_handle_hva(struct kvm *kvm, unsigned long hva,
799 ret = handler(kvm, &memslot->rmap[gfn_offset], data); 852 ret = handler(kvm, &memslot->rmap[gfn_offset], data);
800 853
801 for (j = 0; j < KVM_NR_PAGE_SIZES - 1; ++j) { 854 for (j = 0; j < KVM_NR_PAGE_SIZES - 1; ++j) {
802 int idx = gfn_offset; 855 unsigned long idx;
803 idx /= KVM_PAGES_PER_HPAGE(PT_DIRECTORY_LEVEL + j); 856 int sh;
857
858 sh = KVM_HPAGE_GFN_SHIFT(PT_DIRECTORY_LEVEL+j);
859 idx = ((memslot->base_gfn+gfn_offset) >> sh) -
860 (memslot->base_gfn >> sh);
804 ret |= handler(kvm, 861 ret |= handler(kvm,
805 &memslot->lpage_info[j][idx].rmap_pde, 862 &memslot->lpage_info[j][idx].rmap_pde,
806 data); 863 data);
@@ -863,7 +920,6 @@ static void rmap_recycle(struct kvm_vcpu *vcpu, u64 *spte, gfn_t gfn)
863 920
864 sp = page_header(__pa(spte)); 921 sp = page_header(__pa(spte));
865 922
866 gfn = unalias_gfn(vcpu->kvm, gfn);
867 rmapp = gfn_to_rmap(vcpu->kvm, gfn, sp->role.level); 923 rmapp = gfn_to_rmap(vcpu->kvm, gfn, sp->role.level);
868 924
869 kvm_unmap_rmapp(vcpu->kvm, rmapp, 0); 925 kvm_unmap_rmapp(vcpu->kvm, rmapp, 0);
@@ -894,10 +950,12 @@ static int is_empty_shadow_page(u64 *spt)
894static void kvm_mmu_free_page(struct kvm *kvm, struct kvm_mmu_page *sp) 950static void kvm_mmu_free_page(struct kvm *kvm, struct kvm_mmu_page *sp)
895{ 951{
896 ASSERT(is_empty_shadow_page(sp->spt)); 952 ASSERT(is_empty_shadow_page(sp->spt));
953 hlist_del(&sp->hash_link);
897 list_del(&sp->link); 954 list_del(&sp->link);
898 __free_page(virt_to_page(sp->spt)); 955 __free_page(virt_to_page(sp->spt));
899 __free_page(virt_to_page(sp->gfns)); 956 if (!sp->role.direct)
900 kfree(sp); 957 __free_page(virt_to_page(sp->gfns));
958 kmem_cache_free(mmu_page_header_cache, sp);
901 ++kvm->arch.n_free_mmu_pages; 959 ++kvm->arch.n_free_mmu_pages;
902} 960}
903 961
@@ -907,13 +965,15 @@ static unsigned kvm_page_table_hashfn(gfn_t gfn)
907} 965}
908 966
909static struct kvm_mmu_page *kvm_mmu_alloc_page(struct kvm_vcpu *vcpu, 967static struct kvm_mmu_page *kvm_mmu_alloc_page(struct kvm_vcpu *vcpu,
910 u64 *parent_pte) 968 u64 *parent_pte, int direct)
911{ 969{
912 struct kvm_mmu_page *sp; 970 struct kvm_mmu_page *sp;
913 971
914 sp = mmu_memory_cache_alloc(&vcpu->arch.mmu_page_header_cache, sizeof *sp); 972 sp = mmu_memory_cache_alloc(&vcpu->arch.mmu_page_header_cache, sizeof *sp);
915 sp->spt = mmu_memory_cache_alloc(&vcpu->arch.mmu_page_cache, PAGE_SIZE); 973 sp->spt = mmu_memory_cache_alloc(&vcpu->arch.mmu_page_cache, PAGE_SIZE);
916 sp->gfns = mmu_memory_cache_alloc(&vcpu->arch.mmu_page_cache, PAGE_SIZE); 974 if (!direct)
975 sp->gfns = mmu_memory_cache_alloc(&vcpu->arch.mmu_page_cache,
976 PAGE_SIZE);
917 set_page_private(virt_to_page(sp->spt), (unsigned long)sp); 977 set_page_private(virt_to_page(sp->spt), (unsigned long)sp);
918 list_add(&sp->link, &vcpu->kvm->arch.active_mmu_pages); 978 list_add(&sp->link, &vcpu->kvm->arch.active_mmu_pages);
919 bitmap_zero(sp->slot_bitmap, KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS); 979 bitmap_zero(sp->slot_bitmap, KVM_MEMORY_SLOTS + KVM_PRIVATE_MEM_SLOTS);
@@ -998,7 +1058,6 @@ static void mmu_page_remove_parent_pte(struct kvm_mmu_page *sp,
998 BUG(); 1058 BUG();
999} 1059}
1000 1060
1001
1002static void mmu_parent_walk(struct kvm_mmu_page *sp, mmu_parent_walk_fn fn) 1061static void mmu_parent_walk(struct kvm_mmu_page *sp, mmu_parent_walk_fn fn)
1003{ 1062{
1004 struct kvm_pte_chain *pte_chain; 1063 struct kvm_pte_chain *pte_chain;
@@ -1008,63 +1067,37 @@ static void mmu_parent_walk(struct kvm_mmu_page *sp, mmu_parent_walk_fn fn)
1008 1067
1009 if (!sp->multimapped && sp->parent_pte) { 1068 if (!sp->multimapped && sp->parent_pte) {
1010 parent_sp = page_header(__pa(sp->parent_pte)); 1069 parent_sp = page_header(__pa(sp->parent_pte));
1011 fn(parent_sp); 1070 fn(parent_sp, sp->parent_pte);
1012 mmu_parent_walk(parent_sp, fn);
1013 return; 1071 return;
1014 } 1072 }
1073
1015 hlist_for_each_entry(pte_chain, node, &sp->parent_ptes, link) 1074 hlist_for_each_entry(pte_chain, node, &sp->parent_ptes, link)
1016 for (i = 0; i < NR_PTE_CHAIN_ENTRIES; ++i) { 1075 for (i = 0; i < NR_PTE_CHAIN_ENTRIES; ++i) {
1017 if (!pte_chain->parent_ptes[i]) 1076 u64 *spte = pte_chain->parent_ptes[i];
1077
1078 if (!spte)
1018 break; 1079 break;
1019 parent_sp = page_header(__pa(pte_chain->parent_ptes[i])); 1080 parent_sp = page_header(__pa(spte));
1020 fn(parent_sp); 1081 fn(parent_sp, spte);
1021 mmu_parent_walk(parent_sp, fn);
1022 } 1082 }
1023} 1083}
1024 1084
1025static void kvm_mmu_update_unsync_bitmap(u64 *spte) 1085static void mark_unsync(struct kvm_mmu_page *sp, u64 *spte);
1086static void kvm_mmu_mark_parents_unsync(struct kvm_mmu_page *sp)
1026{ 1087{
1027 unsigned int index; 1088 mmu_parent_walk(sp, mark_unsync);
1028 struct kvm_mmu_page *sp = page_header(__pa(spte));
1029
1030 index = spte - sp->spt;
1031 if (!__test_and_set_bit(index, sp->unsync_child_bitmap))
1032 sp->unsync_children++;
1033 WARN_ON(!sp->unsync_children);
1034} 1089}
1035 1090
1036static void kvm_mmu_update_parents_unsync(struct kvm_mmu_page *sp) 1091static void mark_unsync(struct kvm_mmu_page *sp, u64 *spte)
1037{ 1092{
1038 struct kvm_pte_chain *pte_chain; 1093 unsigned int index;
1039 struct hlist_node *node;
1040 int i;
1041 1094
1042 if (!sp->parent_pte) 1095 index = spte - sp->spt;
1096 if (__test_and_set_bit(index, sp->unsync_child_bitmap))
1043 return; 1097 return;
1044 1098 if (sp->unsync_children++)
1045 if (!sp->multimapped) {
1046 kvm_mmu_update_unsync_bitmap(sp->parent_pte);
1047 return; 1099 return;
1048 } 1100 kvm_mmu_mark_parents_unsync(sp);
1049
1050 hlist_for_each_entry(pte_chain, node, &sp->parent_ptes, link)
1051 for (i = 0; i < NR_PTE_CHAIN_ENTRIES; ++i) {
1052 if (!pte_chain->parent_ptes[i])
1053 break;
1054 kvm_mmu_update_unsync_bitmap(pte_chain->parent_ptes[i]);
1055 }
1056}
1057
1058static int unsync_walk_fn(struct kvm_mmu_page *sp)
1059{
1060 kvm_mmu_update_parents_unsync(sp);
1061 return 1;
1062}
1063
1064static void kvm_mmu_mark_parents_unsync(struct kvm_mmu_page *sp)
1065{
1066 mmu_parent_walk(sp, unsync_walk_fn);
1067 kvm_mmu_update_parents_unsync(sp);
1068} 1101}
1069 1102
1070static void nonpaging_prefetch_page(struct kvm_vcpu *vcpu, 1103static void nonpaging_prefetch_page(struct kvm_vcpu *vcpu,
@@ -1077,7 +1110,7 @@ static void nonpaging_prefetch_page(struct kvm_vcpu *vcpu,
1077} 1110}
1078 1111
1079static int nonpaging_sync_page(struct kvm_vcpu *vcpu, 1112static int nonpaging_sync_page(struct kvm_vcpu *vcpu,
1080 struct kvm_mmu_page *sp) 1113 struct kvm_mmu_page *sp, bool clear_unsync)
1081{ 1114{
1082 return 1; 1115 return 1;
1083} 1116}
@@ -1123,35 +1156,40 @@ static int __mmu_unsync_walk(struct kvm_mmu_page *sp,
1123 int i, ret, nr_unsync_leaf = 0; 1156 int i, ret, nr_unsync_leaf = 0;
1124 1157
1125 for_each_unsync_children(sp->unsync_child_bitmap, i) { 1158 for_each_unsync_children(sp->unsync_child_bitmap, i) {
1159 struct kvm_mmu_page *child;
1126 u64 ent = sp->spt[i]; 1160 u64 ent = sp->spt[i];
1127 1161
1128 if (is_shadow_present_pte(ent) && !is_large_pte(ent)) { 1162 if (!is_shadow_present_pte(ent) || is_large_pte(ent))
1129 struct kvm_mmu_page *child; 1163 goto clear_child_bitmap;
1130 child = page_header(ent & PT64_BASE_ADDR_MASK); 1164
1131 1165 child = page_header(ent & PT64_BASE_ADDR_MASK);
1132 if (child->unsync_children) { 1166
1133 if (mmu_pages_add(pvec, child, i)) 1167 if (child->unsync_children) {
1134 return -ENOSPC; 1168 if (mmu_pages_add(pvec, child, i))
1135 1169 return -ENOSPC;
1136 ret = __mmu_unsync_walk(child, pvec); 1170
1137 if (!ret) 1171 ret = __mmu_unsync_walk(child, pvec);
1138 __clear_bit(i, sp->unsync_child_bitmap); 1172 if (!ret)
1139 else if (ret > 0) 1173 goto clear_child_bitmap;
1140 nr_unsync_leaf += ret; 1174 else if (ret > 0)
1141 else 1175 nr_unsync_leaf += ret;
1142 return ret; 1176 else
1143 } 1177 return ret;
1178 } else if (child->unsync) {
1179 nr_unsync_leaf++;
1180 if (mmu_pages_add(pvec, child, i))
1181 return -ENOSPC;
1182 } else
1183 goto clear_child_bitmap;
1144 1184
1145 if (child->unsync) { 1185 continue;
1146 nr_unsync_leaf++; 1186
1147 if (mmu_pages_add(pvec, child, i)) 1187clear_child_bitmap:
1148 return -ENOSPC; 1188 __clear_bit(i, sp->unsync_child_bitmap);
1149 } 1189 sp->unsync_children--;
1150 } 1190 WARN_ON((int)sp->unsync_children < 0);
1151 } 1191 }
1152 1192
1153 if (find_first_bit(sp->unsync_child_bitmap, 512) == 512)
1154 sp->unsync_children = 0;
1155 1193
1156 return nr_unsync_leaf; 1194 return nr_unsync_leaf;
1157} 1195}
@@ -1166,26 +1204,6 @@ static int mmu_unsync_walk(struct kvm_mmu_page *sp,
1166 return __mmu_unsync_walk(sp, pvec); 1204 return __mmu_unsync_walk(sp, pvec);
1167} 1205}
1168 1206
1169static struct kvm_mmu_page *kvm_mmu_lookup_page(struct kvm *kvm, gfn_t gfn)
1170{
1171 unsigned index;
1172 struct hlist_head *bucket;
1173 struct kvm_mmu_page *sp;
1174 struct hlist_node *node;
1175
1176 pgprintk("%s: looking for gfn %lx\n", __func__, gfn);
1177 index = kvm_page_table_hashfn(gfn);
1178 bucket = &kvm->arch.mmu_page_hash[index];
1179 hlist_for_each_entry(sp, node, bucket, hash_link)
1180 if (sp->gfn == gfn && !sp->role.direct
1181 && !sp->role.invalid) {
1182 pgprintk("%s: found role %x\n",
1183 __func__, sp->role.word);
1184 return sp;
1185 }
1186 return NULL;
1187}
1188
1189static void kvm_unlink_unsync_page(struct kvm *kvm, struct kvm_mmu_page *sp) 1207static void kvm_unlink_unsync_page(struct kvm *kvm, struct kvm_mmu_page *sp)
1190{ 1208{
1191 WARN_ON(!sp->unsync); 1209 WARN_ON(!sp->unsync);
@@ -1194,20 +1212,36 @@ static void kvm_unlink_unsync_page(struct kvm *kvm, struct kvm_mmu_page *sp)
1194 --kvm->stat.mmu_unsync; 1212 --kvm->stat.mmu_unsync;
1195} 1213}
1196 1214
1197static int kvm_mmu_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp); 1215static int kvm_mmu_prepare_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp,
1216 struct list_head *invalid_list);
1217static void kvm_mmu_commit_zap_page(struct kvm *kvm,
1218 struct list_head *invalid_list);
1198 1219
1199static int kvm_sync_page(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp) 1220#define for_each_gfn_sp(kvm, sp, gfn, pos) \
1221 hlist_for_each_entry(sp, pos, \
1222 &(kvm)->arch.mmu_page_hash[kvm_page_table_hashfn(gfn)], hash_link) \
1223 if ((sp)->gfn != (gfn)) {} else
1224
1225#define for_each_gfn_indirect_valid_sp(kvm, sp, gfn, pos) \
1226 hlist_for_each_entry(sp, pos, \
1227 &(kvm)->arch.mmu_page_hash[kvm_page_table_hashfn(gfn)], hash_link) \
1228 if ((sp)->gfn != (gfn) || (sp)->role.direct || \
1229 (sp)->role.invalid) {} else
1230
1231/* @sp->gfn should be write-protected at the call site */
1232static int __kvm_sync_page(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp,
1233 struct list_head *invalid_list, bool clear_unsync)
1200{ 1234{
1201 if (sp->role.cr4_pae != !!is_pae(vcpu)) { 1235 if (sp->role.cr4_pae != !!is_pae(vcpu)) {
1202 kvm_mmu_zap_page(vcpu->kvm, sp); 1236 kvm_mmu_prepare_zap_page(vcpu->kvm, sp, invalid_list);
1203 return 1; 1237 return 1;
1204 } 1238 }
1205 1239
1206 if (rmap_write_protect(vcpu->kvm, sp->gfn)) 1240 if (clear_unsync)
1207 kvm_flush_remote_tlbs(vcpu->kvm); 1241 kvm_unlink_unsync_page(vcpu->kvm, sp);
1208 kvm_unlink_unsync_page(vcpu->kvm, sp); 1242
1209 if (vcpu->arch.mmu.sync_page(vcpu, sp)) { 1243 if (vcpu->arch.mmu.sync_page(vcpu, sp, clear_unsync)) {
1210 kvm_mmu_zap_page(vcpu->kvm, sp); 1244 kvm_mmu_prepare_zap_page(vcpu->kvm, sp, invalid_list);
1211 return 1; 1245 return 1;
1212 } 1246 }
1213 1247
@@ -1215,6 +1249,52 @@ static int kvm_sync_page(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
1215 return 0; 1249 return 0;
1216} 1250}
1217 1251
1252static int kvm_sync_page_transient(struct kvm_vcpu *vcpu,
1253 struct kvm_mmu_page *sp)
1254{
1255 LIST_HEAD(invalid_list);
1256 int ret;
1257
1258 ret = __kvm_sync_page(vcpu, sp, &invalid_list, false);
1259 if (ret)
1260 kvm_mmu_commit_zap_page(vcpu->kvm, &invalid_list);
1261
1262 return ret;
1263}
1264
1265static int kvm_sync_page(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp,
1266 struct list_head *invalid_list)
1267{
1268 return __kvm_sync_page(vcpu, sp, invalid_list, true);
1269}
1270
1271/* @gfn should be write-protected at the call site */
1272static void kvm_sync_pages(struct kvm_vcpu *vcpu, gfn_t gfn)
1273{
1274 struct kvm_mmu_page *s;
1275 struct hlist_node *node;
1276 LIST_HEAD(invalid_list);
1277 bool flush = false;
1278
1279 for_each_gfn_indirect_valid_sp(vcpu->kvm, s, gfn, node) {
1280 if (!s->unsync)
1281 continue;
1282
1283 WARN_ON(s->role.level != PT_PAGE_TABLE_LEVEL);
1284 if ((s->role.cr4_pae != !!is_pae(vcpu)) ||
1285 (vcpu->arch.mmu.sync_page(vcpu, s, true))) {
1286 kvm_mmu_prepare_zap_page(vcpu->kvm, s, &invalid_list);
1287 continue;
1288 }
1289 kvm_unlink_unsync_page(vcpu->kvm, s);
1290 flush = true;
1291 }
1292
1293 kvm_mmu_commit_zap_page(vcpu->kvm, &invalid_list);
1294 if (flush)
1295 kvm_mmu_flush_tlb(vcpu);
1296}
1297
1218struct mmu_page_path { 1298struct mmu_page_path {
1219 struct kvm_mmu_page *parent[PT64_ROOT_LEVEL-1]; 1299 struct kvm_mmu_page *parent[PT64_ROOT_LEVEL-1];
1220 unsigned int idx[PT64_ROOT_LEVEL-1]; 1300 unsigned int idx[PT64_ROOT_LEVEL-1];
@@ -1281,6 +1361,7 @@ static void mmu_sync_children(struct kvm_vcpu *vcpu,
1281 struct kvm_mmu_page *sp; 1361 struct kvm_mmu_page *sp;
1282 struct mmu_page_path parents; 1362 struct mmu_page_path parents;
1283 struct kvm_mmu_pages pages; 1363 struct kvm_mmu_pages pages;
1364 LIST_HEAD(invalid_list);
1284 1365
1285 kvm_mmu_pages_init(parent, &parents, &pages); 1366 kvm_mmu_pages_init(parent, &parents, &pages);
1286 while (mmu_unsync_walk(parent, &pages)) { 1367 while (mmu_unsync_walk(parent, &pages)) {
@@ -1293,9 +1374,10 @@ static void mmu_sync_children(struct kvm_vcpu *vcpu,
1293 kvm_flush_remote_tlbs(vcpu->kvm); 1374 kvm_flush_remote_tlbs(vcpu->kvm);
1294 1375
1295 for_each_sp(pages, sp, parents, i) { 1376 for_each_sp(pages, sp, parents, i) {
1296 kvm_sync_page(vcpu, sp); 1377 kvm_sync_page(vcpu, sp, &invalid_list);
1297 mmu_pages_clear_parents(&parents); 1378 mmu_pages_clear_parents(&parents);
1298 } 1379 }
1380 kvm_mmu_commit_zap_page(vcpu->kvm, &invalid_list);
1299 cond_resched_lock(&vcpu->kvm->mmu_lock); 1381 cond_resched_lock(&vcpu->kvm->mmu_lock);
1300 kvm_mmu_pages_init(parent, &parents, &pages); 1382 kvm_mmu_pages_init(parent, &parents, &pages);
1301 } 1383 }
@@ -1310,11 +1392,10 @@ static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu,
1310 u64 *parent_pte) 1392 u64 *parent_pte)
1311{ 1393{
1312 union kvm_mmu_page_role role; 1394 union kvm_mmu_page_role role;
1313 unsigned index;
1314 unsigned quadrant; 1395 unsigned quadrant;
1315 struct hlist_head *bucket;
1316 struct kvm_mmu_page *sp; 1396 struct kvm_mmu_page *sp;
1317 struct hlist_node *node, *tmp; 1397 struct hlist_node *node;
1398 bool need_sync = false;
1318 1399
1319 role = vcpu->arch.mmu.base_role; 1400 role = vcpu->arch.mmu.base_role;
1320 role.level = level; 1401 role.level = level;
@@ -1322,40 +1403,45 @@ static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu,
1322 if (role.direct) 1403 if (role.direct)
1323 role.cr4_pae = 0; 1404 role.cr4_pae = 0;
1324 role.access = access; 1405 role.access = access;
1325 if (vcpu->arch.mmu.root_level <= PT32_ROOT_LEVEL) { 1406 if (!tdp_enabled && vcpu->arch.mmu.root_level <= PT32_ROOT_LEVEL) {
1326 quadrant = gaddr >> (PAGE_SHIFT + (PT64_PT_BITS * level)); 1407 quadrant = gaddr >> (PAGE_SHIFT + (PT64_PT_BITS * level));
1327 quadrant &= (1 << ((PT32_PT_BITS - PT64_PT_BITS) * level)) - 1; 1408 quadrant &= (1 << ((PT32_PT_BITS - PT64_PT_BITS) * level)) - 1;
1328 role.quadrant = quadrant; 1409 role.quadrant = quadrant;
1329 } 1410 }
1330 index = kvm_page_table_hashfn(gfn); 1411 for_each_gfn_sp(vcpu->kvm, sp, gfn, node) {
1331 bucket = &vcpu->kvm->arch.mmu_page_hash[index]; 1412 if (!need_sync && sp->unsync)
1332 hlist_for_each_entry_safe(sp, node, tmp, bucket, hash_link) 1413 need_sync = true;
1333 if (sp->gfn == gfn) {
1334 if (sp->unsync)
1335 if (kvm_sync_page(vcpu, sp))
1336 continue;
1337 1414
1338 if (sp->role.word != role.word) 1415 if (sp->role.word != role.word)
1339 continue; 1416 continue;
1340 1417
1341 mmu_page_add_parent_pte(vcpu, sp, parent_pte); 1418 if (sp->unsync && kvm_sync_page_transient(vcpu, sp))
1342 if (sp->unsync_children) { 1419 break;
1343 set_bit(KVM_REQ_MMU_SYNC, &vcpu->requests); 1420
1344 kvm_mmu_mark_parents_unsync(sp); 1421 mmu_page_add_parent_pte(vcpu, sp, parent_pte);
1345 } 1422 if (sp->unsync_children) {
1346 trace_kvm_mmu_get_page(sp, false); 1423 kvm_make_request(KVM_REQ_MMU_SYNC, vcpu);
1347 return sp; 1424 kvm_mmu_mark_parents_unsync(sp);
1348 } 1425 } else if (sp->unsync)
1426 kvm_mmu_mark_parents_unsync(sp);
1427
1428 trace_kvm_mmu_get_page(sp, false);
1429 return sp;
1430 }
1349 ++vcpu->kvm->stat.mmu_cache_miss; 1431 ++vcpu->kvm->stat.mmu_cache_miss;
1350 sp = kvm_mmu_alloc_page(vcpu, parent_pte); 1432 sp = kvm_mmu_alloc_page(vcpu, parent_pte, direct);
1351 if (!sp) 1433 if (!sp)
1352 return sp; 1434 return sp;
1353 sp->gfn = gfn; 1435 sp->gfn = gfn;
1354 sp->role = role; 1436 sp->role = role;
1355 hlist_add_head(&sp->hash_link, bucket); 1437 hlist_add_head(&sp->hash_link,
1438 &vcpu->kvm->arch.mmu_page_hash[kvm_page_table_hashfn(gfn)]);
1356 if (!direct) { 1439 if (!direct) {
1357 if (rmap_write_protect(vcpu->kvm, gfn)) 1440 if (rmap_write_protect(vcpu->kvm, gfn))
1358 kvm_flush_remote_tlbs(vcpu->kvm); 1441 kvm_flush_remote_tlbs(vcpu->kvm);
1442 if (level > PT_PAGE_TABLE_LEVEL && need_sync)
1443 kvm_sync_pages(vcpu, gfn);
1444
1359 account_shadowed(vcpu->kvm, gfn); 1445 account_shadowed(vcpu->kvm, gfn);
1360 } 1446 }
1361 if (shadow_trap_nonpresent_pte != shadow_notrap_nonpresent_pte) 1447 if (shadow_trap_nonpresent_pte != shadow_notrap_nonpresent_pte)
@@ -1402,6 +1488,47 @@ static void shadow_walk_next(struct kvm_shadow_walk_iterator *iterator)
1402 --iterator->level; 1488 --iterator->level;
1403} 1489}
1404 1490
1491static void link_shadow_page(u64 *sptep, struct kvm_mmu_page *sp)
1492{
1493 u64 spte;
1494
1495 spte = __pa(sp->spt)
1496 | PT_PRESENT_MASK | PT_ACCESSED_MASK
1497 | PT_WRITABLE_MASK | PT_USER_MASK;
1498 __set_spte(sptep, spte);
1499}
1500
1501static void drop_large_spte(struct kvm_vcpu *vcpu, u64 *sptep)
1502{
1503 if (is_large_pte(*sptep)) {
1504 drop_spte(vcpu->kvm, sptep, shadow_trap_nonpresent_pte);
1505 kvm_flush_remote_tlbs(vcpu->kvm);
1506 }
1507}
1508
1509static void validate_direct_spte(struct kvm_vcpu *vcpu, u64 *sptep,
1510 unsigned direct_access)
1511{
1512 if (is_shadow_present_pte(*sptep) && !is_large_pte(*sptep)) {
1513 struct kvm_mmu_page *child;
1514
1515 /*
1516 * For the direct sp, if the guest pte's dirty bit
1517 * changed form clean to dirty, it will corrupt the
1518 * sp's access: allow writable in the read-only sp,
1519 * so we should update the spte at this point to get
1520 * a new sp with the correct access.
1521 */
1522 child = page_header(*sptep & PT64_BASE_ADDR_MASK);
1523 if (child->role.access == direct_access)
1524 return;
1525
1526 mmu_page_remove_parent_pte(child, sptep);
1527 __set_spte(sptep, shadow_trap_nonpresent_pte);
1528 kvm_flush_remote_tlbs(vcpu->kvm);
1529 }
1530}
1531
1405static void kvm_mmu_page_unlink_children(struct kvm *kvm, 1532static void kvm_mmu_page_unlink_children(struct kvm *kvm,
1406 struct kvm_mmu_page *sp) 1533 struct kvm_mmu_page *sp)
1407{ 1534{
@@ -1422,7 +1549,8 @@ static void kvm_mmu_page_unlink_children(struct kvm *kvm,
1422 } else { 1549 } else {
1423 if (is_large_pte(ent)) 1550 if (is_large_pte(ent))
1424 --kvm->stat.lpages; 1551 --kvm->stat.lpages;
1425 rmap_remove(kvm, &pt[i]); 1552 drop_spte(kvm, &pt[i],
1553 shadow_trap_nonpresent_pte);
1426 } 1554 }
1427 } 1555 }
1428 pt[i] = shadow_trap_nonpresent_pte; 1556 pt[i] = shadow_trap_nonpresent_pte;
@@ -1464,7 +1592,8 @@ static void kvm_mmu_unlink_parents(struct kvm *kvm, struct kvm_mmu_page *sp)
1464} 1592}
1465 1593
1466static int mmu_zap_unsync_children(struct kvm *kvm, 1594static int mmu_zap_unsync_children(struct kvm *kvm,
1467 struct kvm_mmu_page *parent) 1595 struct kvm_mmu_page *parent,
1596 struct list_head *invalid_list)
1468{ 1597{
1469 int i, zapped = 0; 1598 int i, zapped = 0;
1470 struct mmu_page_path parents; 1599 struct mmu_page_path parents;
@@ -1478,7 +1607,7 @@ static int mmu_zap_unsync_children(struct kvm *kvm,
1478 struct kvm_mmu_page *sp; 1607 struct kvm_mmu_page *sp;
1479 1608
1480 for_each_sp(pages, sp, parents, i) { 1609 for_each_sp(pages, sp, parents, i) {
1481 kvm_mmu_zap_page(kvm, sp); 1610 kvm_mmu_prepare_zap_page(kvm, sp, invalid_list);
1482 mmu_pages_clear_parents(&parents); 1611 mmu_pages_clear_parents(&parents);
1483 zapped++; 1612 zapped++;
1484 } 1613 }
@@ -1488,32 +1617,52 @@ static int mmu_zap_unsync_children(struct kvm *kvm,
1488 return zapped; 1617 return zapped;
1489} 1618}
1490 1619
1491static int kvm_mmu_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp) 1620static int kvm_mmu_prepare_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp,
1621 struct list_head *invalid_list)
1492{ 1622{
1493 int ret; 1623 int ret;
1494 1624
1495 trace_kvm_mmu_zap_page(sp); 1625 trace_kvm_mmu_prepare_zap_page(sp);
1496 ++kvm->stat.mmu_shadow_zapped; 1626 ++kvm->stat.mmu_shadow_zapped;
1497 ret = mmu_zap_unsync_children(kvm, sp); 1627 ret = mmu_zap_unsync_children(kvm, sp, invalid_list);
1498 kvm_mmu_page_unlink_children(kvm, sp); 1628 kvm_mmu_page_unlink_children(kvm, sp);
1499 kvm_mmu_unlink_parents(kvm, sp); 1629 kvm_mmu_unlink_parents(kvm, sp);
1500 kvm_flush_remote_tlbs(kvm);
1501 if (!sp->role.invalid && !sp->role.direct) 1630 if (!sp->role.invalid && !sp->role.direct)
1502 unaccount_shadowed(kvm, sp->gfn); 1631 unaccount_shadowed(kvm, sp->gfn);
1503 if (sp->unsync) 1632 if (sp->unsync)
1504 kvm_unlink_unsync_page(kvm, sp); 1633 kvm_unlink_unsync_page(kvm, sp);
1505 if (!sp->root_count) { 1634 if (!sp->root_count) {
1506 hlist_del(&sp->hash_link); 1635 /* Count self */
1507 kvm_mmu_free_page(kvm, sp); 1636 ret++;
1637 list_move(&sp->link, invalid_list);
1508 } else { 1638 } else {
1509 sp->role.invalid = 1;
1510 list_move(&sp->link, &kvm->arch.active_mmu_pages); 1639 list_move(&sp->link, &kvm->arch.active_mmu_pages);
1511 kvm_reload_remote_mmus(kvm); 1640 kvm_reload_remote_mmus(kvm);
1512 } 1641 }
1642
1643 sp->role.invalid = 1;
1513 kvm_mmu_reset_last_pte_updated(kvm); 1644 kvm_mmu_reset_last_pte_updated(kvm);
1514 return ret; 1645 return ret;
1515} 1646}
1516 1647
1648static void kvm_mmu_commit_zap_page(struct kvm *kvm,
1649 struct list_head *invalid_list)
1650{
1651 struct kvm_mmu_page *sp;
1652
1653 if (list_empty(invalid_list))
1654 return;
1655
1656 kvm_flush_remote_tlbs(kvm);
1657
1658 do {
1659 sp = list_first_entry(invalid_list, struct kvm_mmu_page, link);
1660 WARN_ON(!sp->role.invalid || sp->root_count);
1661 kvm_mmu_free_page(kvm, sp);
1662 } while (!list_empty(invalid_list));
1663
1664}
1665
1517/* 1666/*
1518 * Changing the number of mmu pages allocated to the vm 1667 * Changing the number of mmu pages allocated to the vm
1519 * Note: if kvm_nr_mmu_pages is too small, you will get dead lock 1668 * Note: if kvm_nr_mmu_pages is too small, you will get dead lock
@@ -1521,6 +1670,7 @@ static int kvm_mmu_zap_page(struct kvm *kvm, struct kvm_mmu_page *sp)
1521void kvm_mmu_change_mmu_pages(struct kvm *kvm, unsigned int kvm_nr_mmu_pages) 1670void kvm_mmu_change_mmu_pages(struct kvm *kvm, unsigned int kvm_nr_mmu_pages)
1522{ 1671{
1523 int used_pages; 1672 int used_pages;
1673 LIST_HEAD(invalid_list);
1524 1674
1525 used_pages = kvm->arch.n_alloc_mmu_pages - kvm->arch.n_free_mmu_pages; 1675 used_pages = kvm->arch.n_alloc_mmu_pages - kvm->arch.n_free_mmu_pages;
1526 used_pages = max(0, used_pages); 1676 used_pages = max(0, used_pages);
@@ -1538,9 +1688,10 @@ void kvm_mmu_change_mmu_pages(struct kvm *kvm, unsigned int kvm_nr_mmu_pages)
1538 1688
1539 page = container_of(kvm->arch.active_mmu_pages.prev, 1689 page = container_of(kvm->arch.active_mmu_pages.prev,
1540 struct kvm_mmu_page, link); 1690 struct kvm_mmu_page, link);
1541 used_pages -= kvm_mmu_zap_page(kvm, page); 1691 used_pages -= kvm_mmu_prepare_zap_page(kvm, page,
1542 used_pages--; 1692 &invalid_list);
1543 } 1693 }
1694 kvm_mmu_commit_zap_page(kvm, &invalid_list);
1544 kvm_nr_mmu_pages = used_pages; 1695 kvm_nr_mmu_pages = used_pages;
1545 kvm->arch.n_free_mmu_pages = 0; 1696 kvm->arch.n_free_mmu_pages = 0;
1546 } 1697 }
@@ -1553,47 +1704,36 @@ void kvm_mmu_change_mmu_pages(struct kvm *kvm, unsigned int kvm_nr_mmu_pages)
1553 1704
1554static int kvm_mmu_unprotect_page(struct kvm *kvm, gfn_t gfn) 1705static int kvm_mmu_unprotect_page(struct kvm *kvm, gfn_t gfn)
1555{ 1706{
1556 unsigned index;
1557 struct hlist_head *bucket;
1558 struct kvm_mmu_page *sp; 1707 struct kvm_mmu_page *sp;
1559 struct hlist_node *node, *n; 1708 struct hlist_node *node;
1709 LIST_HEAD(invalid_list);
1560 int r; 1710 int r;
1561 1711
1562 pgprintk("%s: looking for gfn %lx\n", __func__, gfn); 1712 pgprintk("%s: looking for gfn %lx\n", __func__, gfn);
1563 r = 0; 1713 r = 0;
1564 index = kvm_page_table_hashfn(gfn); 1714
1565 bucket = &kvm->arch.mmu_page_hash[index]; 1715 for_each_gfn_indirect_valid_sp(kvm, sp, gfn, node) {
1566restart: 1716 pgprintk("%s: gfn %lx role %x\n", __func__, gfn,
1567 hlist_for_each_entry_safe(sp, node, n, bucket, hash_link) 1717 sp->role.word);
1568 if (sp->gfn == gfn && !sp->role.direct) { 1718 r = 1;
1569 pgprintk("%s: gfn %lx role %x\n", __func__, gfn, 1719 kvm_mmu_prepare_zap_page(kvm, sp, &invalid_list);
1570 sp->role.word); 1720 }
1571 r = 1; 1721 kvm_mmu_commit_zap_page(kvm, &invalid_list);
1572 if (kvm_mmu_zap_page(kvm, sp))
1573 goto restart;
1574 }
1575 return r; 1722 return r;
1576} 1723}
1577 1724
1578static void mmu_unshadow(struct kvm *kvm, gfn_t gfn) 1725static void mmu_unshadow(struct kvm *kvm, gfn_t gfn)
1579{ 1726{
1580 unsigned index;
1581 struct hlist_head *bucket;
1582 struct kvm_mmu_page *sp; 1727 struct kvm_mmu_page *sp;
1583 struct hlist_node *node, *nn; 1728 struct hlist_node *node;
1729 LIST_HEAD(invalid_list);
1584 1730
1585 index = kvm_page_table_hashfn(gfn); 1731 for_each_gfn_indirect_valid_sp(kvm, sp, gfn, node) {
1586 bucket = &kvm->arch.mmu_page_hash[index]; 1732 pgprintk("%s: zap %lx %x\n",
1587restart: 1733 __func__, gfn, sp->role.word);
1588 hlist_for_each_entry_safe(sp, node, nn, bucket, hash_link) { 1734 kvm_mmu_prepare_zap_page(kvm, sp, &invalid_list);
1589 if (sp->gfn == gfn && !sp->role.direct
1590 && !sp->role.invalid) {
1591 pgprintk("%s: zap %lx %x\n",
1592 __func__, gfn, sp->role.word);
1593 if (kvm_mmu_zap_page(kvm, sp))
1594 goto restart;
1595 }
1596 } 1735 }
1736 kvm_mmu_commit_zap_page(kvm, &invalid_list);
1597} 1737}
1598 1738
1599static void page_header_update_slot(struct kvm *kvm, void *pte, gfn_t gfn) 1739static void page_header_update_slot(struct kvm *kvm, void *pte, gfn_t gfn)
@@ -1723,47 +1863,51 @@ u8 kvm_get_guest_memory_type(struct kvm_vcpu *vcpu, gfn_t gfn)
1723} 1863}
1724EXPORT_SYMBOL_GPL(kvm_get_guest_memory_type); 1864EXPORT_SYMBOL_GPL(kvm_get_guest_memory_type);
1725 1865
1726static int kvm_unsync_page(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp) 1866static void __kvm_unsync_page(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
1727{ 1867{
1728 unsigned index;
1729 struct hlist_head *bucket;
1730 struct kvm_mmu_page *s;
1731 struct hlist_node *node, *n;
1732
1733 index = kvm_page_table_hashfn(sp->gfn);
1734 bucket = &vcpu->kvm->arch.mmu_page_hash[index];
1735 /* don't unsync if pagetable is shadowed with multiple roles */
1736 hlist_for_each_entry_safe(s, node, n, bucket, hash_link) {
1737 if (s->gfn != sp->gfn || s->role.direct)
1738 continue;
1739 if (s->role.word != sp->role.word)
1740 return 1;
1741 }
1742 trace_kvm_mmu_unsync_page(sp); 1868 trace_kvm_mmu_unsync_page(sp);
1743 ++vcpu->kvm->stat.mmu_unsync; 1869 ++vcpu->kvm->stat.mmu_unsync;
1744 sp->unsync = 1; 1870 sp->unsync = 1;
1745 1871
1746 kvm_mmu_mark_parents_unsync(sp); 1872 kvm_mmu_mark_parents_unsync(sp);
1747
1748 mmu_convert_notrap(sp); 1873 mmu_convert_notrap(sp);
1749 return 0; 1874}
1875
1876static void kvm_unsync_pages(struct kvm_vcpu *vcpu, gfn_t gfn)
1877{
1878 struct kvm_mmu_page *s;
1879 struct hlist_node *node;
1880
1881 for_each_gfn_indirect_valid_sp(vcpu->kvm, s, gfn, node) {
1882 if (s->unsync)
1883 continue;
1884 WARN_ON(s->role.level != PT_PAGE_TABLE_LEVEL);
1885 __kvm_unsync_page(vcpu, s);
1886 }
1750} 1887}
1751 1888
1752static int mmu_need_write_protect(struct kvm_vcpu *vcpu, gfn_t gfn, 1889static int mmu_need_write_protect(struct kvm_vcpu *vcpu, gfn_t gfn,
1753 bool can_unsync) 1890 bool can_unsync)
1754{ 1891{
1755 struct kvm_mmu_page *shadow; 1892 struct kvm_mmu_page *s;
1893 struct hlist_node *node;
1894 bool need_unsync = false;
1756 1895
1757 shadow = kvm_mmu_lookup_page(vcpu->kvm, gfn); 1896 for_each_gfn_indirect_valid_sp(vcpu->kvm, s, gfn, node) {
1758 if (shadow) { 1897 if (!can_unsync)
1759 if (shadow->role.level != PT_PAGE_TABLE_LEVEL)
1760 return 1; 1898 return 1;
1761 if (shadow->unsync) 1899
1762 return 0; 1900 if (s->role.level != PT_PAGE_TABLE_LEVEL)
1763 if (can_unsync && oos_shadow) 1901 return 1;
1764 return kvm_unsync_page(vcpu, shadow); 1902
1765 return 1; 1903 if (!need_unsync && !s->unsync) {
1904 if (!oos_shadow)
1905 return 1;
1906 need_unsync = true;
1907 }
1766 } 1908 }
1909 if (need_unsync)
1910 kvm_unsync_pages(vcpu, gfn);
1767 return 0; 1911 return 0;
1768} 1912}
1769 1913
@@ -1804,13 +1948,14 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep,
1804 spte |= (u64)pfn << PAGE_SHIFT; 1948 spte |= (u64)pfn << PAGE_SHIFT;
1805 1949
1806 if ((pte_access & ACC_WRITE_MASK) 1950 if ((pte_access & ACC_WRITE_MASK)
1807 || (write_fault && !is_write_protection(vcpu) && !user_fault)) { 1951 || (!tdp_enabled && write_fault && !is_write_protection(vcpu)
1952 && !user_fault)) {
1808 1953
1809 if (level > PT_PAGE_TABLE_LEVEL && 1954 if (level > PT_PAGE_TABLE_LEVEL &&
1810 has_wrprotected_page(vcpu->kvm, gfn, level)) { 1955 has_wrprotected_page(vcpu->kvm, gfn, level)) {
1811 ret = 1; 1956 ret = 1;
1812 spte = shadow_trap_nonpresent_pte; 1957 drop_spte(vcpu->kvm, sptep, shadow_trap_nonpresent_pte);
1813 goto set_pte; 1958 goto done;
1814 } 1959 }
1815 1960
1816 spte |= PT_WRITABLE_MASK; 1961 spte |= PT_WRITABLE_MASK;
@@ -1841,7 +1986,10 @@ static int set_spte(struct kvm_vcpu *vcpu, u64 *sptep,
1841 mark_page_dirty(vcpu->kvm, gfn); 1986 mark_page_dirty(vcpu->kvm, gfn);
1842 1987
1843set_pte: 1988set_pte:
1844 __set_spte(sptep, spte); 1989 if (is_writable_pte(*sptep) && !is_writable_pte(spte))
1990 kvm_set_pfn_dirty(pfn);
1991 update_spte(sptep, spte);
1992done:
1845 return ret; 1993 return ret;
1846} 1994}
1847 1995
@@ -1853,7 +2001,6 @@ static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *sptep,
1853 bool reset_host_protection) 2001 bool reset_host_protection)
1854{ 2002{
1855 int was_rmapped = 0; 2003 int was_rmapped = 0;
1856 int was_writable = is_writable_pte(*sptep);
1857 int rmap_count; 2004 int rmap_count;
1858 2005
1859 pgprintk("%s: spte %llx access %x write_fault %d" 2006 pgprintk("%s: spte %llx access %x write_fault %d"
@@ -1878,8 +2025,7 @@ static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *sptep,
1878 } else if (pfn != spte_to_pfn(*sptep)) { 2025 } else if (pfn != spte_to_pfn(*sptep)) {
1879 pgprintk("hfn old %lx new %lx\n", 2026 pgprintk("hfn old %lx new %lx\n",
1880 spte_to_pfn(*sptep), pfn); 2027 spte_to_pfn(*sptep), pfn);
1881 rmap_remove(vcpu->kvm, sptep); 2028 drop_spte(vcpu->kvm, sptep, shadow_trap_nonpresent_pte);
1882 __set_spte(sptep, shadow_trap_nonpresent_pte);
1883 kvm_flush_remote_tlbs(vcpu->kvm); 2029 kvm_flush_remote_tlbs(vcpu->kvm);
1884 } else 2030 } else
1885 was_rmapped = 1; 2031 was_rmapped = 1;
@@ -1890,7 +2036,7 @@ static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *sptep,
1890 reset_host_protection)) { 2036 reset_host_protection)) {
1891 if (write_fault) 2037 if (write_fault)
1892 *ptwrite = 1; 2038 *ptwrite = 1;
1893 kvm_x86_ops->tlb_flush(vcpu); 2039 kvm_mmu_flush_tlb(vcpu);
1894 } 2040 }
1895 2041
1896 pgprintk("%s: setting spte %llx\n", __func__, *sptep); 2042 pgprintk("%s: setting spte %llx\n", __func__, *sptep);
@@ -1904,15 +2050,10 @@ static void mmu_set_spte(struct kvm_vcpu *vcpu, u64 *sptep,
1904 page_header_update_slot(vcpu->kvm, sptep, gfn); 2050 page_header_update_slot(vcpu->kvm, sptep, gfn);
1905 if (!was_rmapped) { 2051 if (!was_rmapped) {
1906 rmap_count = rmap_add(vcpu, sptep, gfn); 2052 rmap_count = rmap_add(vcpu, sptep, gfn);
1907 kvm_release_pfn_clean(pfn);
1908 if (rmap_count > RMAP_RECYCLE_THRESHOLD) 2053 if (rmap_count > RMAP_RECYCLE_THRESHOLD)
1909 rmap_recycle(vcpu, sptep, gfn); 2054 rmap_recycle(vcpu, sptep, gfn);
1910 } else {
1911 if (was_writable)
1912 kvm_release_pfn_dirty(pfn);
1913 else
1914 kvm_release_pfn_clean(pfn);
1915 } 2055 }
2056 kvm_release_pfn_clean(pfn);
1916 if (speculative) { 2057 if (speculative) {
1917 vcpu->arch.last_pte_updated = sptep; 2058 vcpu->arch.last_pte_updated = sptep;
1918 vcpu->arch.last_pte_gfn = gfn; 2059 vcpu->arch.last_pte_gfn = gfn;
@@ -1941,7 +2082,10 @@ static int __direct_map(struct kvm_vcpu *vcpu, gpa_t v, int write,
1941 } 2082 }
1942 2083
1943 if (*iterator.sptep == shadow_trap_nonpresent_pte) { 2084 if (*iterator.sptep == shadow_trap_nonpresent_pte) {
1944 pseudo_gfn = (iterator.addr & PT64_DIR_BASE_ADDR_MASK) >> PAGE_SHIFT; 2085 u64 base_addr = iterator.addr;
2086
2087 base_addr &= PT64_LVL_ADDR_MASK(iterator.level);
2088 pseudo_gfn = base_addr >> PAGE_SHIFT;
1945 sp = kvm_mmu_get_page(vcpu, pseudo_gfn, iterator.addr, 2089 sp = kvm_mmu_get_page(vcpu, pseudo_gfn, iterator.addr,
1946 iterator.level - 1, 2090 iterator.level - 1,
1947 1, ACC_ALL, iterator.sptep); 2091 1, ACC_ALL, iterator.sptep);
@@ -1960,6 +2104,29 @@ static int __direct_map(struct kvm_vcpu *vcpu, gpa_t v, int write,
1960 return pt_write; 2104 return pt_write;
1961} 2105}
1962 2106
2107static void kvm_send_hwpoison_signal(struct kvm *kvm, gfn_t gfn)
2108{
2109 char buf[1];
2110 void __user *hva;
2111 int r;
2112
2113 /* Touch the page, so send SIGBUS */
2114 hva = (void __user *)gfn_to_hva(kvm, gfn);
2115 r = copy_from_user(buf, hva, 1);
2116}
2117
2118static int kvm_handle_bad_page(struct kvm *kvm, gfn_t gfn, pfn_t pfn)
2119{
2120 kvm_release_pfn_clean(pfn);
2121 if (is_hwpoison_pfn(pfn)) {
2122 kvm_send_hwpoison_signal(kvm, gfn);
2123 return 0;
2124 } else if (is_fault_pfn(pfn))
2125 return -EFAULT;
2126
2127 return 1;
2128}
2129
1963static int nonpaging_map(struct kvm_vcpu *vcpu, gva_t v, int write, gfn_t gfn) 2130static int nonpaging_map(struct kvm_vcpu *vcpu, gva_t v, int write, gfn_t gfn)
1964{ 2131{
1965 int r; 2132 int r;
@@ -1983,10 +2150,8 @@ static int nonpaging_map(struct kvm_vcpu *vcpu, gva_t v, int write, gfn_t gfn)
1983 pfn = gfn_to_pfn(vcpu->kvm, gfn); 2150 pfn = gfn_to_pfn(vcpu->kvm, gfn);
1984 2151
1985 /* mmio */ 2152 /* mmio */
1986 if (is_error_pfn(pfn)) { 2153 if (is_error_pfn(pfn))
1987 kvm_release_pfn_clean(pfn); 2154 return kvm_handle_bad_page(vcpu->kvm, gfn, pfn);
1988 return 1;
1989 }
1990 2155
1991 spin_lock(&vcpu->kvm->mmu_lock); 2156 spin_lock(&vcpu->kvm->mmu_lock);
1992 if (mmu_notifier_retry(vcpu, mmu_seq)) 2157 if (mmu_notifier_retry(vcpu, mmu_seq))
@@ -2009,6 +2174,7 @@ static void mmu_free_roots(struct kvm_vcpu *vcpu)
2009{ 2174{
2010 int i; 2175 int i;
2011 struct kvm_mmu_page *sp; 2176 struct kvm_mmu_page *sp;
2177 LIST_HEAD(invalid_list);
2012 2178
2013 if (!VALID_PAGE(vcpu->arch.mmu.root_hpa)) 2179 if (!VALID_PAGE(vcpu->arch.mmu.root_hpa))
2014 return; 2180 return;
@@ -2018,8 +2184,10 @@ static void mmu_free_roots(struct kvm_vcpu *vcpu)
2018 2184
2019 sp = page_header(root); 2185 sp = page_header(root);
2020 --sp->root_count; 2186 --sp->root_count;
2021 if (!sp->root_count && sp->role.invalid) 2187 if (!sp->root_count && sp->role.invalid) {
2022 kvm_mmu_zap_page(vcpu->kvm, sp); 2188 kvm_mmu_prepare_zap_page(vcpu->kvm, sp, &invalid_list);
2189 kvm_mmu_commit_zap_page(vcpu->kvm, &invalid_list);
2190 }
2023 vcpu->arch.mmu.root_hpa = INVALID_PAGE; 2191 vcpu->arch.mmu.root_hpa = INVALID_PAGE;
2024 spin_unlock(&vcpu->kvm->mmu_lock); 2192 spin_unlock(&vcpu->kvm->mmu_lock);
2025 return; 2193 return;
@@ -2032,10 +2200,12 @@ static void mmu_free_roots(struct kvm_vcpu *vcpu)
2032 sp = page_header(root); 2200 sp = page_header(root);
2033 --sp->root_count; 2201 --sp->root_count;
2034 if (!sp->root_count && sp->role.invalid) 2202 if (!sp->root_count && sp->role.invalid)
2035 kvm_mmu_zap_page(vcpu->kvm, sp); 2203 kvm_mmu_prepare_zap_page(vcpu->kvm, sp,
2204 &invalid_list);
2036 } 2205 }
2037 vcpu->arch.mmu.pae_root[i] = INVALID_PAGE; 2206 vcpu->arch.mmu.pae_root[i] = INVALID_PAGE;
2038 } 2207 }
2208 kvm_mmu_commit_zap_page(vcpu->kvm, &invalid_list);
2039 spin_unlock(&vcpu->kvm->mmu_lock); 2209 spin_unlock(&vcpu->kvm->mmu_lock);
2040 vcpu->arch.mmu.root_hpa = INVALID_PAGE; 2210 vcpu->arch.mmu.root_hpa = INVALID_PAGE;
2041} 2211}
@@ -2045,7 +2215,7 @@ static int mmu_check_root(struct kvm_vcpu *vcpu, gfn_t root_gfn)
2045 int ret = 0; 2215 int ret = 0;
2046 2216
2047 if (!kvm_is_visible_gfn(vcpu->kvm, root_gfn)) { 2217 if (!kvm_is_visible_gfn(vcpu->kvm, root_gfn)) {
2048 set_bit(KVM_REQ_TRIPLE_FAULT, &vcpu->requests); 2218 kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu);
2049 ret = 1; 2219 ret = 1;
2050 } 2220 }
2051 2221
@@ -2073,6 +2243,7 @@ static int mmu_alloc_roots(struct kvm_vcpu *vcpu)
2073 root_gfn = 0; 2243 root_gfn = 0;
2074 } 2244 }
2075 spin_lock(&vcpu->kvm->mmu_lock); 2245 spin_lock(&vcpu->kvm->mmu_lock);
2246 kvm_mmu_free_some_pages(vcpu);
2076 sp = kvm_mmu_get_page(vcpu, root_gfn, 0, 2247 sp = kvm_mmu_get_page(vcpu, root_gfn, 0,
2077 PT64_ROOT_LEVEL, direct, 2248 PT64_ROOT_LEVEL, direct,
2078 ACC_ALL, NULL); 2249 ACC_ALL, NULL);
@@ -2103,6 +2274,7 @@ static int mmu_alloc_roots(struct kvm_vcpu *vcpu)
2103 root_gfn = i << 30; 2274 root_gfn = i << 30;
2104 } 2275 }
2105 spin_lock(&vcpu->kvm->mmu_lock); 2276 spin_lock(&vcpu->kvm->mmu_lock);
2277 kvm_mmu_free_some_pages(vcpu);
2106 sp = kvm_mmu_get_page(vcpu, root_gfn, i << 30, 2278 sp = kvm_mmu_get_page(vcpu, root_gfn, i << 30,
2107 PT32_ROOT_LEVEL, direct, 2279 PT32_ROOT_LEVEL, direct,
2108 ACC_ALL, NULL); 2280 ACC_ALL, NULL);
@@ -2198,10 +2370,8 @@ static int tdp_page_fault(struct kvm_vcpu *vcpu, gva_t gpa,
2198 mmu_seq = vcpu->kvm->mmu_notifier_seq; 2370 mmu_seq = vcpu->kvm->mmu_notifier_seq;
2199 smp_rmb(); 2371 smp_rmb();
2200 pfn = gfn_to_pfn(vcpu->kvm, gfn); 2372 pfn = gfn_to_pfn(vcpu->kvm, gfn);
2201 if (is_error_pfn(pfn)) { 2373 if (is_error_pfn(pfn))
2202 kvm_release_pfn_clean(pfn); 2374 return kvm_handle_bad_page(vcpu->kvm, gfn, pfn);
2203 return 1;
2204 }
2205 spin_lock(&vcpu->kvm->mmu_lock); 2375 spin_lock(&vcpu->kvm->mmu_lock);
2206 if (mmu_notifier_retry(vcpu, mmu_seq)) 2376 if (mmu_notifier_retry(vcpu, mmu_seq))
2207 goto out_unlock; 2377 goto out_unlock;
@@ -2243,7 +2413,7 @@ static int nonpaging_init_context(struct kvm_vcpu *vcpu)
2243void kvm_mmu_flush_tlb(struct kvm_vcpu *vcpu) 2413void kvm_mmu_flush_tlb(struct kvm_vcpu *vcpu)
2244{ 2414{
2245 ++vcpu->stat.tlb_flush; 2415 ++vcpu->stat.tlb_flush;
2246 kvm_x86_ops->tlb_flush(vcpu); 2416 kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu);
2247} 2417}
2248 2418
2249static void paging_new_cr3(struct kvm_vcpu *vcpu) 2419static void paging_new_cr3(struct kvm_vcpu *vcpu)
@@ -2457,10 +2627,9 @@ static int init_kvm_mmu(struct kvm_vcpu *vcpu)
2457static void destroy_kvm_mmu(struct kvm_vcpu *vcpu) 2627static void destroy_kvm_mmu(struct kvm_vcpu *vcpu)
2458{ 2628{
2459 ASSERT(vcpu); 2629 ASSERT(vcpu);
2460 if (VALID_PAGE(vcpu->arch.mmu.root_hpa)) { 2630 if (VALID_PAGE(vcpu->arch.mmu.root_hpa))
2631 /* mmu.free() should set root_hpa = INVALID_PAGE */
2461 vcpu->arch.mmu.free(vcpu); 2632 vcpu->arch.mmu.free(vcpu);
2462 vcpu->arch.mmu.root_hpa = INVALID_PAGE;
2463 }
2464} 2633}
2465 2634
2466int kvm_mmu_reset_context(struct kvm_vcpu *vcpu) 2635int kvm_mmu_reset_context(struct kvm_vcpu *vcpu)
@@ -2477,9 +2646,6 @@ int kvm_mmu_load(struct kvm_vcpu *vcpu)
2477 r = mmu_topup_memory_caches(vcpu); 2646 r = mmu_topup_memory_caches(vcpu);
2478 if (r) 2647 if (r)
2479 goto out; 2648 goto out;
2480 spin_lock(&vcpu->kvm->mmu_lock);
2481 kvm_mmu_free_some_pages(vcpu);
2482 spin_unlock(&vcpu->kvm->mmu_lock);
2483 r = mmu_alloc_roots(vcpu); 2649 r = mmu_alloc_roots(vcpu);
2484 spin_lock(&vcpu->kvm->mmu_lock); 2650 spin_lock(&vcpu->kvm->mmu_lock);
2485 mmu_sync_roots(vcpu); 2651 mmu_sync_roots(vcpu);
@@ -2508,7 +2674,7 @@ static void mmu_pte_write_zap_pte(struct kvm_vcpu *vcpu,
2508 pte = *spte; 2674 pte = *spte;
2509 if (is_shadow_present_pte(pte)) { 2675 if (is_shadow_present_pte(pte)) {
2510 if (is_last_spte(pte, sp->role.level)) 2676 if (is_last_spte(pte, sp->role.level))
2511 rmap_remove(vcpu->kvm, spte); 2677 drop_spte(vcpu->kvm, spte, shadow_trap_nonpresent_pte);
2512 else { 2678 else {
2513 child = page_header(pte & PT64_BASE_ADDR_MASK); 2679 child = page_header(pte & PT64_BASE_ADDR_MASK);
2514 mmu_page_remove_parent_pte(child, spte); 2680 mmu_page_remove_parent_pte(child, spte);
@@ -2529,6 +2695,9 @@ static void mmu_pte_write_new_pte(struct kvm_vcpu *vcpu,
2529 return; 2695 return;
2530 } 2696 }
2531 2697
2698 if (is_rsvd_bits_set(vcpu, *(u64 *)new, PT_PAGE_TABLE_LEVEL))
2699 return;
2700
2532 ++vcpu->kvm->stat.mmu_pte_updated; 2701 ++vcpu->kvm->stat.mmu_pte_updated;
2533 if (!sp->role.cr4_pae) 2702 if (!sp->role.cr4_pae)
2534 paging32_update_pte(vcpu, sp, spte, new); 2703 paging32_update_pte(vcpu, sp, spte, new);
@@ -2549,11 +2718,15 @@ static bool need_remote_flush(u64 old, u64 new)
2549 return (old & ~new & PT64_PERM_MASK) != 0; 2718 return (old & ~new & PT64_PERM_MASK) != 0;
2550} 2719}
2551 2720
2552static void mmu_pte_write_flush_tlb(struct kvm_vcpu *vcpu, u64 old, u64 new) 2721static void mmu_pte_write_flush_tlb(struct kvm_vcpu *vcpu, bool zap_page,
2722 bool remote_flush, bool local_flush)
2553{ 2723{
2554 if (need_remote_flush(old, new)) 2724 if (zap_page)
2725 return;
2726
2727 if (remote_flush)
2555 kvm_flush_remote_tlbs(vcpu->kvm); 2728 kvm_flush_remote_tlbs(vcpu->kvm);
2556 else 2729 else if (local_flush)
2557 kvm_mmu_flush_tlb(vcpu); 2730 kvm_mmu_flush_tlb(vcpu);
2558} 2731}
2559 2732
@@ -2603,10 +2776,10 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
2603 bool guest_initiated) 2776 bool guest_initiated)
2604{ 2777{
2605 gfn_t gfn = gpa >> PAGE_SHIFT; 2778 gfn_t gfn = gpa >> PAGE_SHIFT;
2779 union kvm_mmu_page_role mask = { .word = 0 };
2606 struct kvm_mmu_page *sp; 2780 struct kvm_mmu_page *sp;
2607 struct hlist_node *node, *n; 2781 struct hlist_node *node;
2608 struct hlist_head *bucket; 2782 LIST_HEAD(invalid_list);
2609 unsigned index;
2610 u64 entry, gentry; 2783 u64 entry, gentry;
2611 u64 *spte; 2784 u64 *spte;
2612 unsigned offset = offset_in_page(gpa); 2785 unsigned offset = offset_in_page(gpa);
@@ -2619,6 +2792,9 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
2619 int npte; 2792 int npte;
2620 int r; 2793 int r;
2621 int invlpg_counter; 2794 int invlpg_counter;
2795 bool remote_flush, local_flush, zap_page;
2796
2797 zap_page = remote_flush = local_flush = false;
2622 2798
2623 pgprintk("%s: gpa %llx bytes %d\n", __func__, gpa, bytes); 2799 pgprintk("%s: gpa %llx bytes %d\n", __func__, gpa, bytes);
2624 2800
@@ -2674,13 +2850,9 @@ void kvm_mmu_pte_write(struct kvm_vcpu *vcpu, gpa_t gpa,
2674 vcpu->arch.last_pte_updated = NULL; 2850 vcpu->arch.last_pte_updated = NULL;
2675 } 2851 }
2676 } 2852 }
2677 index = kvm_page_table_hashfn(gfn);
2678 bucket = &vcpu->kvm->arch.mmu_page_hash[index];
2679 2853
2680restart: 2854 mask.cr0_wp = mask.cr4_pae = mask.nxe = 1;
2681 hlist_for_each_entry_safe(sp, node, n, bucket, hash_link) { 2855 for_each_gfn_indirect_valid_sp(vcpu->kvm, sp, gfn, node) {
2682 if (sp->gfn != gfn || sp->role.direct || sp->role.invalid)
2683 continue;
2684 pte_size = sp->role.cr4_pae ? 8 : 4; 2856 pte_size = sp->role.cr4_pae ? 8 : 4;
2685 misaligned = (offset ^ (offset + bytes - 1)) & ~(pte_size - 1); 2857 misaligned = (offset ^ (offset + bytes - 1)) & ~(pte_size - 1);
2686 misaligned |= bytes < 4; 2858 misaligned |= bytes < 4;
@@ -2697,8 +2869,8 @@ restart:
2697 */ 2869 */
2698 pgprintk("misaligned: gpa %llx bytes %d role %x\n", 2870 pgprintk("misaligned: gpa %llx bytes %d role %x\n",
2699 gpa, bytes, sp->role.word); 2871 gpa, bytes, sp->role.word);
2700 if (kvm_mmu_zap_page(vcpu->kvm, sp)) 2872 zap_page |= !!kvm_mmu_prepare_zap_page(vcpu->kvm, sp,
2701 goto restart; 2873 &invalid_list);
2702 ++vcpu->kvm->stat.mmu_flooded; 2874 ++vcpu->kvm->stat.mmu_flooded;
2703 continue; 2875 continue;
2704 } 2876 }
@@ -2722,16 +2894,22 @@ restart:
2722 if (quadrant != sp->role.quadrant) 2894 if (quadrant != sp->role.quadrant)
2723 continue; 2895 continue;
2724 } 2896 }
2897 local_flush = true;
2725 spte = &sp->spt[page_offset / sizeof(*spte)]; 2898 spte = &sp->spt[page_offset / sizeof(*spte)];
2726 while (npte--) { 2899 while (npte--) {
2727 entry = *spte; 2900 entry = *spte;
2728 mmu_pte_write_zap_pte(vcpu, sp, spte); 2901 mmu_pte_write_zap_pte(vcpu, sp, spte);
2729 if (gentry) 2902 if (gentry &&
2903 !((sp->role.word ^ vcpu->arch.mmu.base_role.word)
2904 & mask.word))
2730 mmu_pte_write_new_pte(vcpu, sp, spte, &gentry); 2905 mmu_pte_write_new_pte(vcpu, sp, spte, &gentry);
2731 mmu_pte_write_flush_tlb(vcpu, entry, *spte); 2906 if (!remote_flush && need_remote_flush(entry, *spte))
2907 remote_flush = true;
2732 ++spte; 2908 ++spte;
2733 } 2909 }
2734 } 2910 }
2911 mmu_pte_write_flush_tlb(vcpu, zap_page, remote_flush, local_flush);
2912 kvm_mmu_commit_zap_page(vcpu->kvm, &invalid_list);
2735 kvm_mmu_audit(vcpu, "post pte write"); 2913 kvm_mmu_audit(vcpu, "post pte write");
2736 spin_unlock(&vcpu->kvm->mmu_lock); 2914 spin_unlock(&vcpu->kvm->mmu_lock);
2737 if (!is_error_pfn(vcpu->arch.update_pte.pfn)) { 2915 if (!is_error_pfn(vcpu->arch.update_pte.pfn)) {
@@ -2759,15 +2937,21 @@ EXPORT_SYMBOL_GPL(kvm_mmu_unprotect_page_virt);
2759 2937
2760void __kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu) 2938void __kvm_mmu_free_some_pages(struct kvm_vcpu *vcpu)
2761{ 2939{
2762 while (vcpu->kvm->arch.n_free_mmu_pages < KVM_REFILL_PAGES && 2940 int free_pages;
2941 LIST_HEAD(invalid_list);
2942
2943 free_pages = vcpu->kvm->arch.n_free_mmu_pages;
2944 while (free_pages < KVM_REFILL_PAGES &&
2763 !list_empty(&vcpu->kvm->arch.active_mmu_pages)) { 2945 !list_empty(&vcpu->kvm->arch.active_mmu_pages)) {
2764 struct kvm_mmu_page *sp; 2946 struct kvm_mmu_page *sp;
2765 2947
2766 sp = container_of(vcpu->kvm->arch.active_mmu_pages.prev, 2948 sp = container_of(vcpu->kvm->arch.active_mmu_pages.prev,
2767 struct kvm_mmu_page, link); 2949 struct kvm_mmu_page, link);
2768 kvm_mmu_zap_page(vcpu->kvm, sp); 2950 free_pages += kvm_mmu_prepare_zap_page(vcpu->kvm, sp,
2951 &invalid_list);
2769 ++vcpu->kvm->stat.mmu_recycled; 2952 ++vcpu->kvm->stat.mmu_recycled;
2770 } 2953 }
2954 kvm_mmu_commit_zap_page(vcpu->kvm, &invalid_list);
2771} 2955}
2772 2956
2773int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t cr2, u32 error_code) 2957int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t cr2, u32 error_code)
@@ -2795,11 +2979,8 @@ int kvm_mmu_page_fault(struct kvm_vcpu *vcpu, gva_t cr2, u32 error_code)
2795 return 1; 2979 return 1;
2796 case EMULATE_DO_MMIO: 2980 case EMULATE_DO_MMIO:
2797 ++vcpu->stat.mmio_exits; 2981 ++vcpu->stat.mmio_exits;
2798 return 0; 2982 /* fall through */
2799 case EMULATE_FAIL: 2983 case EMULATE_FAIL:
2800 vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
2801 vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION;
2802 vcpu->run->internal.ndata = 0;
2803 return 0; 2984 return 0;
2804 default: 2985 default:
2805 BUG(); 2986 BUG();
@@ -2896,7 +3077,7 @@ void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot)
2896 pt = sp->spt; 3077 pt = sp->spt;
2897 for (i = 0; i < PT64_ENT_PER_PAGE; ++i) 3078 for (i = 0; i < PT64_ENT_PER_PAGE; ++i)
2898 /* avoid RMW */ 3079 /* avoid RMW */
2899 if (pt[i] & PT_WRITABLE_MASK) 3080 if (is_writable_pte(pt[i]))
2900 pt[i] &= ~PT_WRITABLE_MASK; 3081 pt[i] &= ~PT_WRITABLE_MASK;
2901 } 3082 }
2902 kvm_flush_remote_tlbs(kvm); 3083 kvm_flush_remote_tlbs(kvm);
@@ -2905,25 +3086,26 @@ void kvm_mmu_slot_remove_write_access(struct kvm *kvm, int slot)
2905void kvm_mmu_zap_all(struct kvm *kvm) 3086void kvm_mmu_zap_all(struct kvm *kvm)
2906{ 3087{
2907 struct kvm_mmu_page *sp, *node; 3088 struct kvm_mmu_page *sp, *node;
3089 LIST_HEAD(invalid_list);
2908 3090
2909 spin_lock(&kvm->mmu_lock); 3091 spin_lock(&kvm->mmu_lock);
2910restart: 3092restart:
2911 list_for_each_entry_safe(sp, node, &kvm->arch.active_mmu_pages, link) 3093 list_for_each_entry_safe(sp, node, &kvm->arch.active_mmu_pages, link)
2912 if (kvm_mmu_zap_page(kvm, sp)) 3094 if (kvm_mmu_prepare_zap_page(kvm, sp, &invalid_list))
2913 goto restart; 3095 goto restart;
2914 3096
3097 kvm_mmu_commit_zap_page(kvm, &invalid_list);
2915 spin_unlock(&kvm->mmu_lock); 3098 spin_unlock(&kvm->mmu_lock);
2916
2917 kvm_flush_remote_tlbs(kvm);
2918} 3099}
2919 3100
2920static int kvm_mmu_remove_some_alloc_mmu_pages(struct kvm *kvm) 3101static int kvm_mmu_remove_some_alloc_mmu_pages(struct kvm *kvm,
3102 struct list_head *invalid_list)
2921{ 3103{
2922 struct kvm_mmu_page *page; 3104 struct kvm_mmu_page *page;
2923 3105
2924 page = container_of(kvm->arch.active_mmu_pages.prev, 3106 page = container_of(kvm->arch.active_mmu_pages.prev,
2925 struct kvm_mmu_page, link); 3107 struct kvm_mmu_page, link);
2926 return kvm_mmu_zap_page(kvm, page) + 1; 3108 return kvm_mmu_prepare_zap_page(kvm, page, invalid_list);
2927} 3109}
2928 3110
2929static int mmu_shrink(struct shrinker *shrink, int nr_to_scan, gfp_t gfp_mask) 3111static int mmu_shrink(struct shrinker *shrink, int nr_to_scan, gfp_t gfp_mask)
@@ -2936,6 +3118,7 @@ static int mmu_shrink(struct shrinker *shrink, int nr_to_scan, gfp_t gfp_mask)
2936 3118
2937 list_for_each_entry(kvm, &vm_list, vm_list) { 3119 list_for_each_entry(kvm, &vm_list, vm_list) {
2938 int npages, idx, freed_pages; 3120 int npages, idx, freed_pages;
3121 LIST_HEAD(invalid_list);
2939 3122
2940 idx = srcu_read_lock(&kvm->srcu); 3123 idx = srcu_read_lock(&kvm->srcu);
2941 spin_lock(&kvm->mmu_lock); 3124 spin_lock(&kvm->mmu_lock);
@@ -2943,12 +3126,14 @@ static int mmu_shrink(struct shrinker *shrink, int nr_to_scan, gfp_t gfp_mask)
2943 kvm->arch.n_free_mmu_pages; 3126 kvm->arch.n_free_mmu_pages;
2944 cache_count += npages; 3127 cache_count += npages;
2945 if (!kvm_freed && nr_to_scan > 0 && npages > 0) { 3128 if (!kvm_freed && nr_to_scan > 0 && npages > 0) {
2946 freed_pages = kvm_mmu_remove_some_alloc_mmu_pages(kvm); 3129 freed_pages = kvm_mmu_remove_some_alloc_mmu_pages(kvm,
3130 &invalid_list);
2947 cache_count -= freed_pages; 3131 cache_count -= freed_pages;
2948 kvm_freed = kvm; 3132 kvm_freed = kvm;
2949 } 3133 }
2950 nr_to_scan--; 3134 nr_to_scan--;
2951 3135
3136 kvm_mmu_commit_zap_page(kvm, &invalid_list);
2952 spin_unlock(&kvm->mmu_lock); 3137 spin_unlock(&kvm->mmu_lock);
2953 srcu_read_unlock(&kvm->srcu, idx); 3138 srcu_read_unlock(&kvm->srcu, idx);
2954 } 3139 }
@@ -3074,7 +3259,7 @@ static int kvm_pv_mmu_write(struct kvm_vcpu *vcpu,
3074 3259
3075static int kvm_pv_mmu_flush_tlb(struct kvm_vcpu *vcpu) 3260static int kvm_pv_mmu_flush_tlb(struct kvm_vcpu *vcpu)
3076{ 3261{
3077 kvm_set_cr3(vcpu, vcpu->arch.cr3); 3262 (void)kvm_set_cr3(vcpu, vcpu->arch.cr3);
3078 return 1; 3263 return 1;
3079} 3264}
3080 3265
@@ -3331,9 +3516,9 @@ void inspect_spte_has_rmap(struct kvm *kvm, u64 *sptep)
3331 struct kvm_mmu_page *rev_sp; 3516 struct kvm_mmu_page *rev_sp;
3332 gfn_t gfn; 3517 gfn_t gfn;
3333 3518
3334 if (*sptep & PT_WRITABLE_MASK) { 3519 if (is_writable_pte(*sptep)) {
3335 rev_sp = page_header(__pa(sptep)); 3520 rev_sp = page_header(__pa(sptep));
3336 gfn = rev_sp->gfns[sptep - rev_sp->spt]; 3521 gfn = kvm_mmu_page_get_gfn(rev_sp, sptep - rev_sp->spt);
3337 3522
3338 if (!gfn_to_memslot(kvm, gfn)) { 3523 if (!gfn_to_memslot(kvm, gfn)) {
3339 if (!printk_ratelimit()) 3524 if (!printk_ratelimit())
@@ -3347,8 +3532,7 @@ void inspect_spte_has_rmap(struct kvm *kvm, u64 *sptep)
3347 return; 3532 return;
3348 } 3533 }
3349 3534
3350 rmapp = gfn_to_rmap(kvm, rev_sp->gfns[sptep - rev_sp->spt], 3535 rmapp = gfn_to_rmap(kvm, gfn, rev_sp->role.level);
3351 rev_sp->role.level);
3352 if (!*rmapp) { 3536 if (!*rmapp) {
3353 if (!printk_ratelimit()) 3537 if (!printk_ratelimit())
3354 return; 3538 return;
@@ -3381,7 +3565,7 @@ static void check_writable_mappings_rmap(struct kvm_vcpu *vcpu)
3381 3565
3382 if (!(ent & PT_PRESENT_MASK)) 3566 if (!(ent & PT_PRESENT_MASK))
3383 continue; 3567 continue;
3384 if (!(ent & PT_WRITABLE_MASK)) 3568 if (!is_writable_pte(ent))
3385 continue; 3569 continue;
3386 inspect_spte_has_rmap(vcpu->kvm, &pt[i]); 3570 inspect_spte_has_rmap(vcpu->kvm, &pt[i]);
3387 } 3571 }
@@ -3409,13 +3593,12 @@ static void audit_write_protection(struct kvm_vcpu *vcpu)
3409 if (sp->unsync) 3593 if (sp->unsync)
3410 continue; 3594 continue;
3411 3595
3412 gfn = unalias_gfn(vcpu->kvm, sp->gfn); 3596 slot = gfn_to_memslot(vcpu->kvm, sp->gfn);
3413 slot = gfn_to_memslot_unaliased(vcpu->kvm, sp->gfn);
3414 rmapp = &slot->rmap[gfn - slot->base_gfn]; 3597 rmapp = &slot->rmap[gfn - slot->base_gfn];
3415 3598
3416 spte = rmap_next(vcpu->kvm, rmapp, NULL); 3599 spte = rmap_next(vcpu->kvm, rmapp, NULL);
3417 while (spte) { 3600 while (spte) {
3418 if (*spte & PT_WRITABLE_MASK) 3601 if (is_writable_pte(*spte))
3419 printk(KERN_ERR "%s: (%s) shadow page has " 3602 printk(KERN_ERR "%s: (%s) shadow page has "
3420 "writable mappings: gfn %lx role %x\n", 3603 "writable mappings: gfn %lx role %x\n",
3421 __func__, audit_msg, sp->gfn, 3604 __func__, audit_msg, sp->gfn,
diff --git a/arch/x86/kvm/mmutrace.h b/arch/x86/kvm/mmutrace.h
index 42f07b1bfbc9..3aab0f0930ef 100644
--- a/arch/x86/kvm/mmutrace.h
+++ b/arch/x86/kvm/mmutrace.h
@@ -190,7 +190,7 @@ DEFINE_EVENT(kvm_mmu_page_class, kvm_mmu_unsync_page,
190 TP_ARGS(sp) 190 TP_ARGS(sp)
191); 191);
192 192
193DEFINE_EVENT(kvm_mmu_page_class, kvm_mmu_zap_page, 193DEFINE_EVENT(kvm_mmu_page_class, kvm_mmu_prepare_zap_page,
194 TP_PROTO(struct kvm_mmu_page *sp), 194 TP_PROTO(struct kvm_mmu_page *sp),
195 195
196 TP_ARGS(sp) 196 TP_ARGS(sp)
diff --git a/arch/x86/kvm/paging_tmpl.h b/arch/x86/kvm/paging_tmpl.h
index 2331bdc2b549..51ef9097960d 100644
--- a/arch/x86/kvm/paging_tmpl.h
+++ b/arch/x86/kvm/paging_tmpl.h
@@ -7,6 +7,7 @@
7 * MMU support 7 * MMU support
8 * 8 *
9 * Copyright (C) 2006 Qumranet, Inc. 9 * Copyright (C) 2006 Qumranet, Inc.
10 * Copyright 2010 Red Hat, Inc. and/or its affilates.
10 * 11 *
11 * Authors: 12 * Authors:
12 * Yaniv Kamay <yaniv@qumranet.com> 13 * Yaniv Kamay <yaniv@qumranet.com>
@@ -118,21 +119,25 @@ static int FNAME(walk_addr)(struct guest_walker *walker,
118{ 119{
119 pt_element_t pte; 120 pt_element_t pte;
120 gfn_t table_gfn; 121 gfn_t table_gfn;
121 unsigned index, pt_access, pte_access; 122 unsigned index, pt_access, uninitialized_var(pte_access);
122 gpa_t pte_gpa; 123 gpa_t pte_gpa;
123 int rsvd_fault = 0; 124 bool eperm, present, rsvd_fault;
124 125
125 trace_kvm_mmu_pagetable_walk(addr, write_fault, user_fault, 126 trace_kvm_mmu_pagetable_walk(addr, write_fault, user_fault,
126 fetch_fault); 127 fetch_fault);
127walk: 128walk:
129 present = true;
130 eperm = rsvd_fault = false;
128 walker->level = vcpu->arch.mmu.root_level; 131 walker->level = vcpu->arch.mmu.root_level;
129 pte = vcpu->arch.cr3; 132 pte = vcpu->arch.cr3;
130#if PTTYPE == 64 133#if PTTYPE == 64
131 if (!is_long_mode(vcpu)) { 134 if (!is_long_mode(vcpu)) {
132 pte = kvm_pdptr_read(vcpu, (addr >> 30) & 3); 135 pte = kvm_pdptr_read(vcpu, (addr >> 30) & 3);
133 trace_kvm_mmu_paging_element(pte, walker->level); 136 trace_kvm_mmu_paging_element(pte, walker->level);
134 if (!is_present_gpte(pte)) 137 if (!is_present_gpte(pte)) {
135 goto not_present; 138 present = false;
139 goto error;
140 }
136 --walker->level; 141 --walker->level;
137 } 142 }
138#endif 143#endif
@@ -150,37 +155,42 @@ walk:
150 walker->table_gfn[walker->level - 1] = table_gfn; 155 walker->table_gfn[walker->level - 1] = table_gfn;
151 walker->pte_gpa[walker->level - 1] = pte_gpa; 156 walker->pte_gpa[walker->level - 1] = pte_gpa;
152 157
153 if (kvm_read_guest(vcpu->kvm, pte_gpa, &pte, sizeof(pte))) 158 if (kvm_read_guest(vcpu->kvm, pte_gpa, &pte, sizeof(pte))) {
154 goto not_present; 159 present = false;
160 break;
161 }
155 162
156 trace_kvm_mmu_paging_element(pte, walker->level); 163 trace_kvm_mmu_paging_element(pte, walker->level);
157 164
158 if (!is_present_gpte(pte)) 165 if (!is_present_gpte(pte)) {
159 goto not_present; 166 present = false;
167 break;
168 }
160 169
161 rsvd_fault = is_rsvd_bits_set(vcpu, pte, walker->level); 170 if (is_rsvd_bits_set(vcpu, pte, walker->level)) {
162 if (rsvd_fault) 171 rsvd_fault = true;
163 goto access_error; 172 break;
173 }
164 174
165 if (write_fault && !is_writable_pte(pte)) 175 if (write_fault && !is_writable_pte(pte))
166 if (user_fault || is_write_protection(vcpu)) 176 if (user_fault || is_write_protection(vcpu))
167 goto access_error; 177 eperm = true;
168 178
169 if (user_fault && !(pte & PT_USER_MASK)) 179 if (user_fault && !(pte & PT_USER_MASK))
170 goto access_error; 180 eperm = true;
171 181
172#if PTTYPE == 64 182#if PTTYPE == 64
173 if (fetch_fault && (pte & PT64_NX_MASK)) 183 if (fetch_fault && (pte & PT64_NX_MASK))
174 goto access_error; 184 eperm = true;
175#endif 185#endif
176 186
177 if (!(pte & PT_ACCESSED_MASK)) { 187 if (!eperm && !rsvd_fault && !(pte & PT_ACCESSED_MASK)) {
178 trace_kvm_mmu_set_accessed_bit(table_gfn, index, 188 trace_kvm_mmu_set_accessed_bit(table_gfn, index,
179 sizeof(pte)); 189 sizeof(pte));
180 mark_page_dirty(vcpu->kvm, table_gfn);
181 if (FNAME(cmpxchg_gpte)(vcpu->kvm, table_gfn, 190 if (FNAME(cmpxchg_gpte)(vcpu->kvm, table_gfn,
182 index, pte, pte|PT_ACCESSED_MASK)) 191 index, pte, pte|PT_ACCESSED_MASK))
183 goto walk; 192 goto walk;
193 mark_page_dirty(vcpu->kvm, table_gfn);
184 pte |= PT_ACCESSED_MASK; 194 pte |= PT_ACCESSED_MASK;
185 } 195 }
186 196
@@ -213,15 +223,18 @@ walk:
213 --walker->level; 223 --walker->level;
214 } 224 }
215 225
226 if (!present || eperm || rsvd_fault)
227 goto error;
228
216 if (write_fault && !is_dirty_gpte(pte)) { 229 if (write_fault && !is_dirty_gpte(pte)) {
217 bool ret; 230 bool ret;
218 231
219 trace_kvm_mmu_set_dirty_bit(table_gfn, index, sizeof(pte)); 232 trace_kvm_mmu_set_dirty_bit(table_gfn, index, sizeof(pte));
220 mark_page_dirty(vcpu->kvm, table_gfn);
221 ret = FNAME(cmpxchg_gpte)(vcpu->kvm, table_gfn, index, pte, 233 ret = FNAME(cmpxchg_gpte)(vcpu->kvm, table_gfn, index, pte,
222 pte|PT_DIRTY_MASK); 234 pte|PT_DIRTY_MASK);
223 if (ret) 235 if (ret)
224 goto walk; 236 goto walk;
237 mark_page_dirty(vcpu->kvm, table_gfn);
225 pte |= PT_DIRTY_MASK; 238 pte |= PT_DIRTY_MASK;
226 walker->ptes[walker->level - 1] = pte; 239 walker->ptes[walker->level - 1] = pte;
227 } 240 }
@@ -229,22 +242,18 @@ walk:
229 walker->pt_access = pt_access; 242 walker->pt_access = pt_access;
230 walker->pte_access = pte_access; 243 walker->pte_access = pte_access;
231 pgprintk("%s: pte %llx pte_access %x pt_access %x\n", 244 pgprintk("%s: pte %llx pte_access %x pt_access %x\n",
232 __func__, (u64)pte, pt_access, pte_access); 245 __func__, (u64)pte, pte_access, pt_access);
233 return 1; 246 return 1;
234 247
235not_present: 248error:
236 walker->error_code = 0; 249 walker->error_code = 0;
237 goto err; 250 if (present)
238 251 walker->error_code |= PFERR_PRESENT_MASK;
239access_error:
240 walker->error_code = PFERR_PRESENT_MASK;
241
242err:
243 if (write_fault) 252 if (write_fault)
244 walker->error_code |= PFERR_WRITE_MASK; 253 walker->error_code |= PFERR_WRITE_MASK;
245 if (user_fault) 254 if (user_fault)
246 walker->error_code |= PFERR_USER_MASK; 255 walker->error_code |= PFERR_USER_MASK;
247 if (fetch_fault) 256 if (fetch_fault && is_nx(vcpu))
248 walker->error_code |= PFERR_FETCH_MASK; 257 walker->error_code |= PFERR_FETCH_MASK;
249 if (rsvd_fault) 258 if (rsvd_fault)
250 walker->error_code |= PFERR_RSVD_MASK; 259 walker->error_code |= PFERR_RSVD_MASK;
@@ -252,7 +261,7 @@ err:
252 return 0; 261 return 0;
253} 262}
254 263
255static void FNAME(update_pte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *page, 264static void FNAME(update_pte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp,
256 u64 *spte, const void *pte) 265 u64 *spte, const void *pte)
257{ 266{
258 pt_element_t gpte; 267 pt_element_t gpte;
@@ -263,7 +272,7 @@ static void FNAME(update_pte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *page,
263 gpte = *(const pt_element_t *)pte; 272 gpte = *(const pt_element_t *)pte;
264 if (~gpte & (PT_PRESENT_MASK | PT_ACCESSED_MASK)) { 273 if (~gpte & (PT_PRESENT_MASK | PT_ACCESSED_MASK)) {
265 if (!is_present_gpte(gpte)) { 274 if (!is_present_gpte(gpte)) {
266 if (page->unsync) 275 if (sp->unsync)
267 new_spte = shadow_trap_nonpresent_pte; 276 new_spte = shadow_trap_nonpresent_pte;
268 else 277 else
269 new_spte = shadow_notrap_nonpresent_pte; 278 new_spte = shadow_notrap_nonpresent_pte;
@@ -272,7 +281,7 @@ static void FNAME(update_pte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *page,
272 return; 281 return;
273 } 282 }
274 pgprintk("%s: gpte %llx spte %p\n", __func__, (u64)gpte, spte); 283 pgprintk("%s: gpte %llx spte %p\n", __func__, (u64)gpte, spte);
275 pte_access = page->role.access & FNAME(gpte_access)(vcpu, gpte); 284 pte_access = sp->role.access & FNAME(gpte_access)(vcpu, gpte);
276 if (gpte_to_gfn(gpte) != vcpu->arch.update_pte.gfn) 285 if (gpte_to_gfn(gpte) != vcpu->arch.update_pte.gfn)
277 return; 286 return;
278 pfn = vcpu->arch.update_pte.pfn; 287 pfn = vcpu->arch.update_pte.pfn;
@@ -285,11 +294,22 @@ static void FNAME(update_pte)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *page,
285 * we call mmu_set_spte() with reset_host_protection = true beacuse that 294 * we call mmu_set_spte() with reset_host_protection = true beacuse that
286 * vcpu->arch.update_pte.pfn was fetched from get_user_pages(write = 1). 295 * vcpu->arch.update_pte.pfn was fetched from get_user_pages(write = 1).
287 */ 296 */
288 mmu_set_spte(vcpu, spte, page->role.access, pte_access, 0, 0, 297 mmu_set_spte(vcpu, spte, sp->role.access, pte_access, 0, 0,
289 gpte & PT_DIRTY_MASK, NULL, PT_PAGE_TABLE_LEVEL, 298 is_dirty_gpte(gpte), NULL, PT_PAGE_TABLE_LEVEL,
290 gpte_to_gfn(gpte), pfn, true, true); 299 gpte_to_gfn(gpte), pfn, true, true);
291} 300}
292 301
302static bool FNAME(gpte_changed)(struct kvm_vcpu *vcpu,
303 struct guest_walker *gw, int level)
304{
305 int r;
306 pt_element_t curr_pte;
307
308 r = kvm_read_guest_atomic(vcpu->kvm, gw->pte_gpa[level - 1],
309 &curr_pte, sizeof(curr_pte));
310 return r || curr_pte != gw->ptes[level - 1];
311}
312
293/* 313/*
294 * Fetch a shadow pte for a specific level in the paging hierarchy. 314 * Fetch a shadow pte for a specific level in the paging hierarchy.
295 */ 315 */
@@ -299,75 +319,86 @@ static u64 *FNAME(fetch)(struct kvm_vcpu *vcpu, gva_t addr,
299 int *ptwrite, pfn_t pfn) 319 int *ptwrite, pfn_t pfn)
300{ 320{
301 unsigned access = gw->pt_access; 321 unsigned access = gw->pt_access;
302 struct kvm_mmu_page *shadow_page; 322 struct kvm_mmu_page *sp = NULL;
303 u64 spte, *sptep = NULL; 323 bool dirty = is_dirty_gpte(gw->ptes[gw->level - 1]);
304 int direct; 324 int top_level;
305 gfn_t table_gfn; 325 unsigned direct_access;
306 int r; 326 struct kvm_shadow_walk_iterator it;
307 int level;
308 pt_element_t curr_pte;
309 struct kvm_shadow_walk_iterator iterator;
310 327
311 if (!is_present_gpte(gw->ptes[gw->level - 1])) 328 if (!is_present_gpte(gw->ptes[gw->level - 1]))
312 return NULL; 329 return NULL;
313 330
314 for_each_shadow_entry(vcpu, addr, iterator) { 331 direct_access = gw->pt_access & gw->pte_access;
315 level = iterator.level; 332 if (!dirty)
316 sptep = iterator.sptep; 333 direct_access &= ~ACC_WRITE_MASK;
317 if (iterator.level == hlevel) {
318 mmu_set_spte(vcpu, sptep, access,
319 gw->pte_access & access,
320 user_fault, write_fault,
321 gw->ptes[gw->level-1] & PT_DIRTY_MASK,
322 ptwrite, level,
323 gw->gfn, pfn, false, true);
324 break;
325 }
326 334
327 if (is_shadow_present_pte(*sptep) && !is_large_pte(*sptep)) 335 top_level = vcpu->arch.mmu.root_level;
328 continue; 336 if (top_level == PT32E_ROOT_LEVEL)
337 top_level = PT32_ROOT_LEVEL;
338 /*
339 * Verify that the top-level gpte is still there. Since the page
340 * is a root page, it is either write protected (and cannot be
341 * changed from now on) or it is invalid (in which case, we don't
342 * really care if it changes underneath us after this point).
343 */
344 if (FNAME(gpte_changed)(vcpu, gw, top_level))
345 goto out_gpte_changed;
329 346
330 if (is_large_pte(*sptep)) { 347 for (shadow_walk_init(&it, vcpu, addr);
331 rmap_remove(vcpu->kvm, sptep); 348 shadow_walk_okay(&it) && it.level > gw->level;
332 __set_spte(sptep, shadow_trap_nonpresent_pte); 349 shadow_walk_next(&it)) {
333 kvm_flush_remote_tlbs(vcpu->kvm); 350 gfn_t table_gfn;
334 }
335 351
336 if (level <= gw->level) { 352 drop_large_spte(vcpu, it.sptep);
337 int delta = level - gw->level + 1; 353
338 direct = 1; 354 sp = NULL;
339 if (!is_dirty_gpte(gw->ptes[level - delta])) 355 if (!is_shadow_present_pte(*it.sptep)) {
340 access &= ~ACC_WRITE_MASK; 356 table_gfn = gw->table_gfn[it.level - 2];
341 table_gfn = gpte_to_gfn(gw->ptes[level - delta]); 357 sp = kvm_mmu_get_page(vcpu, table_gfn, addr, it.level-1,
342 /* advance table_gfn when emulating 1gb pages with 4k */ 358 false, access, it.sptep);
343 if (delta == 0)
344 table_gfn += PT_INDEX(addr, level);
345 access &= gw->pte_access;
346 } else {
347 direct = 0;
348 table_gfn = gw->table_gfn[level - 2];
349 }
350 shadow_page = kvm_mmu_get_page(vcpu, table_gfn, addr, level-1,
351 direct, access, sptep);
352 if (!direct) {
353 r = kvm_read_guest_atomic(vcpu->kvm,
354 gw->pte_gpa[level - 2],
355 &curr_pte, sizeof(curr_pte));
356 if (r || curr_pte != gw->ptes[level - 2]) {
357 kvm_mmu_put_page(shadow_page, sptep);
358 kvm_release_pfn_clean(pfn);
359 sptep = NULL;
360 break;
361 }
362 } 359 }
363 360
364 spte = __pa(shadow_page->spt) 361 /*
365 | PT_PRESENT_MASK | PT_ACCESSED_MASK 362 * Verify that the gpte in the page we've just write
366 | PT_WRITABLE_MASK | PT_USER_MASK; 363 * protected is still there.
367 *sptep = spte; 364 */
365 if (FNAME(gpte_changed)(vcpu, gw, it.level - 1))
366 goto out_gpte_changed;
367
368 if (sp)
369 link_shadow_page(it.sptep, sp);
368 } 370 }
369 371
370 return sptep; 372 for (;
373 shadow_walk_okay(&it) && it.level > hlevel;
374 shadow_walk_next(&it)) {
375 gfn_t direct_gfn;
376
377 validate_direct_spte(vcpu, it.sptep, direct_access);
378
379 drop_large_spte(vcpu, it.sptep);
380
381 if (is_shadow_present_pte(*it.sptep))
382 continue;
383
384 direct_gfn = gw->gfn & ~(KVM_PAGES_PER_HPAGE(it.level) - 1);
385
386 sp = kvm_mmu_get_page(vcpu, direct_gfn, addr, it.level-1,
387 true, direct_access, it.sptep);
388 link_shadow_page(it.sptep, sp);
389 }
390
391 mmu_set_spte(vcpu, it.sptep, access, gw->pte_access & access,
392 user_fault, write_fault, dirty, ptwrite, it.level,
393 gw->gfn, pfn, false, true);
394
395 return it.sptep;
396
397out_gpte_changed:
398 if (sp)
399 kvm_mmu_put_page(sp, it.sptep);
400 kvm_release_pfn_clean(pfn);
401 return NULL;
371} 402}
372 403
373/* 404/*
@@ -431,11 +462,8 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr,
431 pfn = gfn_to_pfn(vcpu->kvm, walker.gfn); 462 pfn = gfn_to_pfn(vcpu->kvm, walker.gfn);
432 463
433 /* mmio */ 464 /* mmio */
434 if (is_error_pfn(pfn)) { 465 if (is_error_pfn(pfn))
435 pgprintk("gfn %lx is mmio\n", walker.gfn); 466 return kvm_handle_bad_page(vcpu->kvm, walker.gfn, pfn);
436 kvm_release_pfn_clean(pfn);
437 return 1;
438 }
439 467
440 spin_lock(&vcpu->kvm->mmu_lock); 468 spin_lock(&vcpu->kvm->mmu_lock);
441 if (mmu_notifier_retry(vcpu, mmu_seq)) 469 if (mmu_notifier_retry(vcpu, mmu_seq))
@@ -443,6 +471,7 @@ static int FNAME(page_fault)(struct kvm_vcpu *vcpu, gva_t addr,
443 kvm_mmu_free_some_pages(vcpu); 471 kvm_mmu_free_some_pages(vcpu);
444 sptep = FNAME(fetch)(vcpu, addr, &walker, user_fault, write_fault, 472 sptep = FNAME(fetch)(vcpu, addr, &walker, user_fault, write_fault,
445 level, &write_pt, pfn); 473 level, &write_pt, pfn);
474 (void)sptep;
446 pgprintk("%s: shadow pte %p %llx ptwrite %d\n", __func__, 475 pgprintk("%s: shadow pte %p %llx ptwrite %d\n", __func__,
447 sptep, *sptep, write_pt); 476 sptep, *sptep, write_pt);
448 477
@@ -464,6 +493,7 @@ out_unlock:
464static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva) 493static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva)
465{ 494{
466 struct kvm_shadow_walk_iterator iterator; 495 struct kvm_shadow_walk_iterator iterator;
496 struct kvm_mmu_page *sp;
467 gpa_t pte_gpa = -1; 497 gpa_t pte_gpa = -1;
468 int level; 498 int level;
469 u64 *sptep; 499 u64 *sptep;
@@ -475,10 +505,13 @@ static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva)
475 level = iterator.level; 505 level = iterator.level;
476 sptep = iterator.sptep; 506 sptep = iterator.sptep;
477 507
508 sp = page_header(__pa(sptep));
478 if (is_last_spte(*sptep, level)) { 509 if (is_last_spte(*sptep, level)) {
479 struct kvm_mmu_page *sp = page_header(__pa(sptep));
480 int offset, shift; 510 int offset, shift;
481 511
512 if (!sp->unsync)
513 break;
514
482 shift = PAGE_SHIFT - 515 shift = PAGE_SHIFT -
483 (PT_LEVEL_BITS - PT64_LEVEL_BITS) * level; 516 (PT_LEVEL_BITS - PT64_LEVEL_BITS) * level;
484 offset = sp->role.quadrant << shift; 517 offset = sp->role.quadrant << shift;
@@ -487,16 +520,17 @@ static void FNAME(invlpg)(struct kvm_vcpu *vcpu, gva_t gva)
487 pte_gpa += (sptep - sp->spt) * sizeof(pt_element_t); 520 pte_gpa += (sptep - sp->spt) * sizeof(pt_element_t);
488 521
489 if (is_shadow_present_pte(*sptep)) { 522 if (is_shadow_present_pte(*sptep)) {
490 rmap_remove(vcpu->kvm, sptep);
491 if (is_large_pte(*sptep)) 523 if (is_large_pte(*sptep))
492 --vcpu->kvm->stat.lpages; 524 --vcpu->kvm->stat.lpages;
525 drop_spte(vcpu->kvm, sptep,
526 shadow_trap_nonpresent_pte);
493 need_flush = 1; 527 need_flush = 1;
494 } 528 } else
495 __set_spte(sptep, shadow_trap_nonpresent_pte); 529 __set_spte(sptep, shadow_trap_nonpresent_pte);
496 break; 530 break;
497 } 531 }
498 532
499 if (!is_shadow_present_pte(*sptep)) 533 if (!is_shadow_present_pte(*sptep) || !sp->unsync_children)
500 break; 534 break;
501 } 535 }
502 536
@@ -570,9 +604,9 @@ static void FNAME(prefetch_page)(struct kvm_vcpu *vcpu,
570 * Using the cached information from sp->gfns is safe because: 604 * Using the cached information from sp->gfns is safe because:
571 * - The spte has a reference to the struct page, so the pfn for a given gfn 605 * - The spte has a reference to the struct page, so the pfn for a given gfn
572 * can't change unless all sptes pointing to it are nuked first. 606 * can't change unless all sptes pointing to it are nuked first.
573 * - Alias changes zap the entire shadow cache.
574 */ 607 */
575static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp) 608static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp,
609 bool clear_unsync)
576{ 610{
577 int i, offset, nr_present; 611 int i, offset, nr_present;
578 bool reset_host_protection; 612 bool reset_host_protection;
@@ -580,6 +614,9 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
580 614
581 offset = nr_present = 0; 615 offset = nr_present = 0;
582 616
617 /* direct kvm_mmu_page can not be unsync. */
618 BUG_ON(sp->role.direct);
619
583 if (PTTYPE == 32) 620 if (PTTYPE == 32)
584 offset = sp->role.quadrant << PT64_LEVEL_BITS; 621 offset = sp->role.quadrant << PT64_LEVEL_BITS;
585 622
@@ -589,7 +626,7 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
589 unsigned pte_access; 626 unsigned pte_access;
590 pt_element_t gpte; 627 pt_element_t gpte;
591 gpa_t pte_gpa; 628 gpa_t pte_gpa;
592 gfn_t gfn = sp->gfns[i]; 629 gfn_t gfn;
593 630
594 if (!is_shadow_present_pte(sp->spt[i])) 631 if (!is_shadow_present_pte(sp->spt[i]))
595 continue; 632 continue;
@@ -600,16 +637,17 @@ static int FNAME(sync_page)(struct kvm_vcpu *vcpu, struct kvm_mmu_page *sp)
600 sizeof(pt_element_t))) 637 sizeof(pt_element_t)))
601 return -EINVAL; 638 return -EINVAL;
602 639
603 if (gpte_to_gfn(gpte) != gfn || !is_present_gpte(gpte) || 640 gfn = gpte_to_gfn(gpte);
604 !(gpte & PT_ACCESSED_MASK)) { 641 if (is_rsvd_bits_set(vcpu, gpte, PT_PAGE_TABLE_LEVEL)
642 || gfn != sp->gfns[i] || !is_present_gpte(gpte)
643 || !(gpte & PT_ACCESSED_MASK)) {
605 u64 nonpresent; 644 u64 nonpresent;
606 645
607 rmap_remove(vcpu->kvm, &sp->spt[i]); 646 if (is_present_gpte(gpte) || !clear_unsync)
608 if (is_present_gpte(gpte))
609 nonpresent = shadow_trap_nonpresent_pte; 647 nonpresent = shadow_trap_nonpresent_pte;
610 else 648 else
611 nonpresent = shadow_notrap_nonpresent_pte; 649 nonpresent = shadow_notrap_nonpresent_pte;
612 __set_spte(&sp->spt[i], nonpresent); 650 drop_spte(vcpu->kvm, &sp->spt[i], nonpresent);
613 continue; 651 continue;
614 } 652 }
615 653
diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index ce438e0fdd26..bc5b9b8d4a33 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -4,6 +4,7 @@
4 * AMD SVM support 4 * AMD SVM support
5 * 5 *
6 * Copyright (C) 2006 Qumranet, Inc. 6 * Copyright (C) 2006 Qumranet, Inc.
7 * Copyright 2010 Red Hat, Inc. and/or its affilates.
7 * 8 *
8 * Authors: 9 * Authors:
9 * Yaniv Kamay <yaniv@qumranet.com> 10 * Yaniv Kamay <yaniv@qumranet.com>
@@ -130,7 +131,7 @@ static struct svm_direct_access_msrs {
130 u32 index; /* Index of the MSR */ 131 u32 index; /* Index of the MSR */
131 bool always; /* True if intercept is always on */ 132 bool always; /* True if intercept is always on */
132} direct_access_msrs[] = { 133} direct_access_msrs[] = {
133 { .index = MSR_K6_STAR, .always = true }, 134 { .index = MSR_STAR, .always = true },
134 { .index = MSR_IA32_SYSENTER_CS, .always = true }, 135 { .index = MSR_IA32_SYSENTER_CS, .always = true },
135#ifdef CONFIG_X86_64 136#ifdef CONFIG_X86_64
136 { .index = MSR_GS_BASE, .always = true }, 137 { .index = MSR_GS_BASE, .always = true },
@@ -285,11 +286,11 @@ static inline void flush_guest_tlb(struct kvm_vcpu *vcpu)
285 286
286static void svm_set_efer(struct kvm_vcpu *vcpu, u64 efer) 287static void svm_set_efer(struct kvm_vcpu *vcpu, u64 efer)
287{ 288{
289 vcpu->arch.efer = efer;
288 if (!npt_enabled && !(efer & EFER_LMA)) 290 if (!npt_enabled && !(efer & EFER_LMA))
289 efer &= ~EFER_LME; 291 efer &= ~EFER_LME;
290 292
291 to_svm(vcpu)->vmcb->save.efer = efer | EFER_SVME; 293 to_svm(vcpu)->vmcb->save.efer = efer | EFER_SVME;
292 vcpu->arch.efer = efer;
293} 294}
294 295
295static int is_external_interrupt(u32 info) 296static int is_external_interrupt(u32 info)
@@ -383,8 +384,7 @@ static void svm_init_erratum_383(void)
383 int err; 384 int err;
384 u64 val; 385 u64 val;
385 386
386 /* Only Fam10h is affected */ 387 if (!cpu_has_amd_erratum(amd_erratum_383))
387 if (boot_cpu_data.x86 != 0x10)
388 return; 388 return;
389 389
390 /* Use _safe variants to not break nested virtualization */ 390 /* Use _safe variants to not break nested virtualization */
@@ -640,7 +640,7 @@ static __init int svm_hardware_setup(void)
640 640
641 if (nested) { 641 if (nested) {
642 printk(KERN_INFO "kvm: Nested Virtualization enabled\n"); 642 printk(KERN_INFO "kvm: Nested Virtualization enabled\n");
643 kvm_enable_efer_bits(EFER_SVME); 643 kvm_enable_efer_bits(EFER_SVME | EFER_LMSLE);
644 } 644 }
645 645
646 for_each_possible_cpu(cpu) { 646 for_each_possible_cpu(cpu) {
@@ -806,7 +806,7 @@ static void init_vmcb(struct vcpu_svm *svm)
806 * svm_set_cr0() sets PG and WP and clears NW and CD on save->cr0. 806 * svm_set_cr0() sets PG and WP and clears NW and CD on save->cr0.
807 */ 807 */
808 svm->vcpu.arch.cr0 = X86_CR0_NW | X86_CR0_CD | X86_CR0_ET; 808 svm->vcpu.arch.cr0 = X86_CR0_NW | X86_CR0_CD | X86_CR0_ET;
809 kvm_set_cr0(&svm->vcpu, svm->vcpu.arch.cr0); 809 (void)kvm_set_cr0(&svm->vcpu, svm->vcpu.arch.cr0);
810 810
811 save->cr4 = X86_CR4_PAE; 811 save->cr4 = X86_CR4_PAE;
812 /* rdx = ?? */ 812 /* rdx = ?? */
@@ -903,13 +903,18 @@ static struct kvm_vcpu *svm_create_vcpu(struct kvm *kvm, unsigned int id)
903 svm->asid_generation = 0; 903 svm->asid_generation = 0;
904 init_vmcb(svm); 904 init_vmcb(svm);
905 905
906 fx_init(&svm->vcpu); 906 err = fx_init(&svm->vcpu);
907 if (err)
908 goto free_page4;
909
907 svm->vcpu.arch.apic_base = 0xfee00000 | MSR_IA32_APICBASE_ENABLE; 910 svm->vcpu.arch.apic_base = 0xfee00000 | MSR_IA32_APICBASE_ENABLE;
908 if (kvm_vcpu_is_bsp(&svm->vcpu)) 911 if (kvm_vcpu_is_bsp(&svm->vcpu))
909 svm->vcpu.arch.apic_base |= MSR_IA32_APICBASE_BSP; 912 svm->vcpu.arch.apic_base |= MSR_IA32_APICBASE_BSP;
910 913
911 return &svm->vcpu; 914 return &svm->vcpu;
912 915
916free_page4:
917 __free_page(hsave_page);
913free_page3: 918free_page3:
914 __free_pages(nested_msrpm_pages, MSRPM_ALLOC_ORDER); 919 __free_pages(nested_msrpm_pages, MSRPM_ALLOC_ORDER);
915free_page2: 920free_page2:
@@ -1488,7 +1493,7 @@ static void svm_handle_mce(struct vcpu_svm *svm)
1488 */ 1493 */
1489 pr_err("KVM: Guest triggered AMD Erratum 383\n"); 1494 pr_err("KVM: Guest triggered AMD Erratum 383\n");
1490 1495
1491 set_bit(KVM_REQ_TRIPLE_FAULT, &svm->vcpu.requests); 1496 kvm_make_request(KVM_REQ_TRIPLE_FAULT, &svm->vcpu);
1492 1497
1493 return; 1498 return;
1494 } 1499 }
@@ -1535,7 +1540,7 @@ static int io_interception(struct vcpu_svm *svm)
1535 string = (io_info & SVM_IOIO_STR_MASK) != 0; 1540 string = (io_info & SVM_IOIO_STR_MASK) != 0;
1536 in = (io_info & SVM_IOIO_TYPE_MASK) != 0; 1541 in = (io_info & SVM_IOIO_TYPE_MASK) != 0;
1537 if (string || in) 1542 if (string || in)
1538 return !(emulate_instruction(vcpu, 0, 0, 0) == EMULATE_DO_MMIO); 1543 return emulate_instruction(vcpu, 0, 0, 0) == EMULATE_DONE;
1539 1544
1540 port = io_info >> 16; 1545 port = io_info >> 16;
1541 size = (io_info & SVM_IOIO_SIZE_MASK) >> SVM_IOIO_SIZE_SHIFT; 1546 size = (io_info & SVM_IOIO_SIZE_MASK) >> SVM_IOIO_SIZE_SHIFT;
@@ -1957,7 +1962,7 @@ static int nested_svm_vmexit(struct vcpu_svm *svm)
1957 svm->vmcb->save.cr3 = hsave->save.cr3; 1962 svm->vmcb->save.cr3 = hsave->save.cr3;
1958 svm->vcpu.arch.cr3 = hsave->save.cr3; 1963 svm->vcpu.arch.cr3 = hsave->save.cr3;
1959 } else { 1964 } else {
1960 kvm_set_cr3(&svm->vcpu, hsave->save.cr3); 1965 (void)kvm_set_cr3(&svm->vcpu, hsave->save.cr3);
1961 } 1966 }
1962 kvm_register_write(&svm->vcpu, VCPU_REGS_RAX, hsave->save.rax); 1967 kvm_register_write(&svm->vcpu, VCPU_REGS_RAX, hsave->save.rax);
1963 kvm_register_write(&svm->vcpu, VCPU_REGS_RSP, hsave->save.rsp); 1968 kvm_register_write(&svm->vcpu, VCPU_REGS_RSP, hsave->save.rsp);
@@ -2080,7 +2085,7 @@ static bool nested_svm_vmrun(struct vcpu_svm *svm)
2080 svm->vmcb->save.cr3 = nested_vmcb->save.cr3; 2085 svm->vmcb->save.cr3 = nested_vmcb->save.cr3;
2081 svm->vcpu.arch.cr3 = nested_vmcb->save.cr3; 2086 svm->vcpu.arch.cr3 = nested_vmcb->save.cr3;
2082 } else 2087 } else
2083 kvm_set_cr3(&svm->vcpu, nested_vmcb->save.cr3); 2088 (void)kvm_set_cr3(&svm->vcpu, nested_vmcb->save.cr3);
2084 2089
2085 /* Guest paging mode is active - reset mmu */ 2090 /* Guest paging mode is active - reset mmu */
2086 kvm_mmu_reset_context(&svm->vcpu); 2091 kvm_mmu_reset_context(&svm->vcpu);
@@ -2386,16 +2391,12 @@ static int iret_interception(struct vcpu_svm *svm)
2386 2391
2387static int invlpg_interception(struct vcpu_svm *svm) 2392static int invlpg_interception(struct vcpu_svm *svm)
2388{ 2393{
2389 if (emulate_instruction(&svm->vcpu, 0, 0, 0) != EMULATE_DONE) 2394 return emulate_instruction(&svm->vcpu, 0, 0, 0) == EMULATE_DONE;
2390 pr_unimpl(&svm->vcpu, "%s: failed\n", __func__);
2391 return 1;
2392} 2395}
2393 2396
2394static int emulate_on_interception(struct vcpu_svm *svm) 2397static int emulate_on_interception(struct vcpu_svm *svm)
2395{ 2398{
2396 if (emulate_instruction(&svm->vcpu, 0, 0, 0) != EMULATE_DONE) 2399 return emulate_instruction(&svm->vcpu, 0, 0, 0) == EMULATE_DONE;
2397 pr_unimpl(&svm->vcpu, "%s: failed\n", __func__);
2398 return 1;
2399} 2400}
2400 2401
2401static int cr8_write_interception(struct vcpu_svm *svm) 2402static int cr8_write_interception(struct vcpu_svm *svm)
@@ -2431,7 +2432,7 @@ static int svm_get_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 *data)
2431 *data = tsc_offset + native_read_tsc(); 2432 *data = tsc_offset + native_read_tsc();
2432 break; 2433 break;
2433 } 2434 }
2434 case MSR_K6_STAR: 2435 case MSR_STAR:
2435 *data = svm->vmcb->save.star; 2436 *data = svm->vmcb->save.star;
2436 break; 2437 break;
2437#ifdef CONFIG_X86_64 2438#ifdef CONFIG_X86_64
@@ -2555,7 +2556,7 @@ static int svm_set_msr(struct kvm_vcpu *vcpu, unsigned ecx, u64 data)
2555 2556
2556 break; 2557 break;
2557 } 2558 }
2558 case MSR_K6_STAR: 2559 case MSR_STAR:
2559 svm->vmcb->save.star = data; 2560 svm->vmcb->save.star = data;
2560 break; 2561 break;
2561#ifdef CONFIG_X86_64 2562#ifdef CONFIG_X86_64
@@ -2726,6 +2727,99 @@ static int (*svm_exit_handlers[])(struct vcpu_svm *svm) = {
2726 [SVM_EXIT_NPF] = pf_interception, 2727 [SVM_EXIT_NPF] = pf_interception,
2727}; 2728};
2728 2729
2730void dump_vmcb(struct kvm_vcpu *vcpu)
2731{
2732 struct vcpu_svm *svm = to_svm(vcpu);
2733 struct vmcb_control_area *control = &svm->vmcb->control;
2734 struct vmcb_save_area *save = &svm->vmcb->save;
2735
2736 pr_err("VMCB Control Area:\n");
2737 pr_err("cr_read: %04x\n", control->intercept_cr_read);
2738 pr_err("cr_write: %04x\n", control->intercept_cr_write);
2739 pr_err("dr_read: %04x\n", control->intercept_dr_read);
2740 pr_err("dr_write: %04x\n", control->intercept_dr_write);
2741 pr_err("exceptions: %08x\n", control->intercept_exceptions);
2742 pr_err("intercepts: %016llx\n", control->intercept);
2743 pr_err("pause filter count: %d\n", control->pause_filter_count);
2744 pr_err("iopm_base_pa: %016llx\n", control->iopm_base_pa);
2745 pr_err("msrpm_base_pa: %016llx\n", control->msrpm_base_pa);
2746 pr_err("tsc_offset: %016llx\n", control->tsc_offset);
2747 pr_err("asid: %d\n", control->asid);
2748 pr_err("tlb_ctl: %d\n", control->tlb_ctl);
2749 pr_err("int_ctl: %08x\n", control->int_ctl);
2750 pr_err("int_vector: %08x\n", control->int_vector);
2751 pr_err("int_state: %08x\n", control->int_state);
2752 pr_err("exit_code: %08x\n", control->exit_code);
2753 pr_err("exit_info1: %016llx\n", control->exit_info_1);
2754 pr_err("exit_info2: %016llx\n", control->exit_info_2);
2755 pr_err("exit_int_info: %08x\n", control->exit_int_info);
2756 pr_err("exit_int_info_err: %08x\n", control->exit_int_info_err);
2757 pr_err("nested_ctl: %lld\n", control->nested_ctl);
2758 pr_err("nested_cr3: %016llx\n", control->nested_cr3);
2759 pr_err("event_inj: %08x\n", control->event_inj);
2760 pr_err("event_inj_err: %08x\n", control->event_inj_err);
2761 pr_err("lbr_ctl: %lld\n", control->lbr_ctl);
2762 pr_err("next_rip: %016llx\n", control->next_rip);
2763 pr_err("VMCB State Save Area:\n");
2764 pr_err("es: s: %04x a: %04x l: %08x b: %016llx\n",
2765 save->es.selector, save->es.attrib,
2766 save->es.limit, save->es.base);
2767 pr_err("cs: s: %04x a: %04x l: %08x b: %016llx\n",
2768 save->cs.selector, save->cs.attrib,
2769 save->cs.limit, save->cs.base);
2770 pr_err("ss: s: %04x a: %04x l: %08x b: %016llx\n",
2771 save->ss.selector, save->ss.attrib,
2772 save->ss.limit, save->ss.base);
2773 pr_err("ds: s: %04x a: %04x l: %08x b: %016llx\n",
2774 save->ds.selector, save->ds.attrib,
2775 save->ds.limit, save->ds.base);
2776 pr_err("fs: s: %04x a: %04x l: %08x b: %016llx\n",
2777 save->fs.selector, save->fs.attrib,
2778 save->fs.limit, save->fs.base);
2779 pr_err("gs: s: %04x a: %04x l: %08x b: %016llx\n",
2780 save->gs.selector, save->gs.attrib,
2781 save->gs.limit, save->gs.base);
2782 pr_err("gdtr: s: %04x a: %04x l: %08x b: %016llx\n",
2783 save->gdtr.selector, save->gdtr.attrib,
2784 save->gdtr.limit, save->gdtr.base);
2785 pr_err("ldtr: s: %04x a: %04x l: %08x b: %016llx\n",
2786 save->ldtr.selector, save->ldtr.attrib,
2787 save->ldtr.limit, save->ldtr.base);
2788 pr_err("idtr: s: %04x a: %04x l: %08x b: %016llx\n",
2789 save->idtr.selector, save->idtr.attrib,
2790 save->idtr.limit, save->idtr.base);
2791 pr_err("tr: s: %04x a: %04x l: %08x b: %016llx\n",
2792 save->tr.selector, save->tr.attrib,
2793 save->tr.limit, save->tr.base);
2794 pr_err("cpl: %d efer: %016llx\n",
2795 save->cpl, save->efer);
2796 pr_err("cr0: %016llx cr2: %016llx\n",
2797 save->cr0, save->cr2);
2798 pr_err("cr3: %016llx cr4: %016llx\n",
2799 save->cr3, save->cr4);
2800 pr_err("dr6: %016llx dr7: %016llx\n",
2801 save->dr6, save->dr7);
2802 pr_err("rip: %016llx rflags: %016llx\n",
2803 save->rip, save->rflags);
2804 pr_err("rsp: %016llx rax: %016llx\n",
2805 save->rsp, save->rax);
2806 pr_err("star: %016llx lstar: %016llx\n",
2807 save->star, save->lstar);
2808 pr_err("cstar: %016llx sfmask: %016llx\n",
2809 save->cstar, save->sfmask);
2810 pr_err("kernel_gs_base: %016llx sysenter_cs: %016llx\n",
2811 save->kernel_gs_base, save->sysenter_cs);
2812 pr_err("sysenter_esp: %016llx sysenter_eip: %016llx\n",
2813 save->sysenter_esp, save->sysenter_eip);
2814 pr_err("gpat: %016llx dbgctl: %016llx\n",
2815 save->g_pat, save->dbgctl);
2816 pr_err("br_from: %016llx br_to: %016llx\n",
2817 save->br_from, save->br_to);
2818 pr_err("excp_from: %016llx excp_to: %016llx\n",
2819 save->last_excp_from, save->last_excp_to);
2820
2821}
2822
2729static int handle_exit(struct kvm_vcpu *vcpu) 2823static int handle_exit(struct kvm_vcpu *vcpu)
2730{ 2824{
2731 struct vcpu_svm *svm = to_svm(vcpu); 2825 struct vcpu_svm *svm = to_svm(vcpu);
@@ -2770,6 +2864,8 @@ static int handle_exit(struct kvm_vcpu *vcpu)
2770 kvm_run->exit_reason = KVM_EXIT_FAIL_ENTRY; 2864 kvm_run->exit_reason = KVM_EXIT_FAIL_ENTRY;
2771 kvm_run->fail_entry.hardware_entry_failure_reason 2865 kvm_run->fail_entry.hardware_entry_failure_reason
2772 = svm->vmcb->control.exit_code; 2866 = svm->vmcb->control.exit_code;
2867 pr_err("KVM: FAILED VMRUN WITH VMCB:\n");
2868 dump_vmcb(vcpu);
2773 return 0; 2869 return 0;
2774 } 2870 }
2775 2871
@@ -2826,9 +2922,6 @@ static inline void svm_inject_irq(struct vcpu_svm *svm, int irq)
2826{ 2922{
2827 struct vmcb_control_area *control; 2923 struct vmcb_control_area *control;
2828 2924
2829 trace_kvm_inj_virq(irq);
2830
2831 ++svm->vcpu.stat.irq_injections;
2832 control = &svm->vmcb->control; 2925 control = &svm->vmcb->control;
2833 control->int_vector = irq; 2926 control->int_vector = irq;
2834 control->int_ctl &= ~V_INTR_PRIO_MASK; 2927 control->int_ctl &= ~V_INTR_PRIO_MASK;
@@ -2842,6 +2935,9 @@ static void svm_set_irq(struct kvm_vcpu *vcpu)
2842 2935
2843 BUG_ON(!(gif_set(svm))); 2936 BUG_ON(!(gif_set(svm)));
2844 2937
2938 trace_kvm_inj_virq(vcpu->arch.interrupt.nr);
2939 ++vcpu->stat.irq_injections;
2940
2845 svm->vmcb->control.event_inj = vcpu->arch.interrupt.nr | 2941 svm->vmcb->control.event_inj = vcpu->arch.interrupt.nr |
2846 SVM_EVTINJ_VALID | SVM_EVTINJ_TYPE_INTR; 2942 SVM_EVTINJ_VALID | SVM_EVTINJ_TYPE_INTR;
2847} 2943}
@@ -3327,6 +3423,11 @@ static bool svm_rdtscp_supported(void)
3327 return false; 3423 return false;
3328} 3424}
3329 3425
3426static bool svm_has_wbinvd_exit(void)
3427{
3428 return true;
3429}
3430
3330static void svm_fpu_deactivate(struct kvm_vcpu *vcpu) 3431static void svm_fpu_deactivate(struct kvm_vcpu *vcpu)
3331{ 3432{
3332 struct vcpu_svm *svm = to_svm(vcpu); 3433 struct vcpu_svm *svm = to_svm(vcpu);
@@ -3411,6 +3512,8 @@ static struct kvm_x86_ops svm_x86_ops = {
3411 .rdtscp_supported = svm_rdtscp_supported, 3512 .rdtscp_supported = svm_rdtscp_supported,
3412 3513
3413 .set_supported_cpuid = svm_set_supported_cpuid, 3514 .set_supported_cpuid = svm_set_supported_cpuid,
3515
3516 .has_wbinvd_exit = svm_has_wbinvd_exit,
3414}; 3517};
3415 3518
3416static int __init svm_init(void) 3519static int __init svm_init(void)
diff --git a/arch/x86/kvm/timer.c b/arch/x86/kvm/timer.c
index 4ddadb1a5ffe..e16a0dbe74d8 100644
--- a/arch/x86/kvm/timer.c
+++ b/arch/x86/kvm/timer.c
@@ -1,3 +1,17 @@
1/*
2 * Kernel-based Virtual Machine driver for Linux
3 *
4 * This module enables machines with Intel VT-x extensions to run virtual
5 * machines without emulation or binary translation.
6 *
7 * timer support
8 *
9 * Copyright 2010 Red Hat, Inc. and/or its affilates.
10 *
11 * This work is licensed under the terms of the GNU GPL, version 2. See
12 * the COPYING file in the top-level directory.
13 */
14
1#include <linux/kvm_host.h> 15#include <linux/kvm_host.h>
2#include <linux/kvm.h> 16#include <linux/kvm.h>
3#include <linux/hrtimer.h> 17#include <linux/hrtimer.h>
@@ -18,7 +32,7 @@ static int __kvm_timer_fn(struct kvm_vcpu *vcpu, struct kvm_timer *ktimer)
18 if (ktimer->reinject || !atomic_read(&ktimer->pending)) { 32 if (ktimer->reinject || !atomic_read(&ktimer->pending)) {
19 atomic_inc(&ktimer->pending); 33 atomic_inc(&ktimer->pending);
20 /* FIXME: this code should not know anything about vcpus */ 34 /* FIXME: this code should not know anything about vcpus */
21 set_bit(KVM_REQ_PENDING_TIMER, &vcpu->requests); 35 kvm_make_request(KVM_REQ_PENDING_TIMER, vcpu);
22 } 36 }
23 37
24 if (waitqueue_active(q)) 38 if (waitqueue_active(q))
diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
index ee03679efe78..49b25eee25ac 100644
--- a/arch/x86/kvm/vmx.c
+++ b/arch/x86/kvm/vmx.c
@@ -5,6 +5,7 @@
5 * machines without emulation or binary translation. 5 * machines without emulation or binary translation.
6 * 6 *
7 * Copyright (C) 2006 Qumranet, Inc. 7 * Copyright (C) 2006 Qumranet, Inc.
8 * Copyright 2010 Red Hat, Inc. and/or its affilates.
8 * 9 *
9 * Authors: 10 * Authors:
10 * Avi Kivity <avi@qumranet.com> 11 * Avi Kivity <avi@qumranet.com>
@@ -36,6 +37,8 @@
36#include <asm/vmx.h> 37#include <asm/vmx.h>
37#include <asm/virtext.h> 38#include <asm/virtext.h>
38#include <asm/mce.h> 39#include <asm/mce.h>
40#include <asm/i387.h>
41#include <asm/xcr.h>
39 42
40#include "trace.h" 43#include "trace.h"
41 44
@@ -63,6 +66,9 @@ module_param_named(unrestricted_guest,
63static int __read_mostly emulate_invalid_guest_state = 0; 66static int __read_mostly emulate_invalid_guest_state = 0;
64module_param(emulate_invalid_guest_state, bool, S_IRUGO); 67module_param(emulate_invalid_guest_state, bool, S_IRUGO);
65 68
69static int __read_mostly vmm_exclusive = 1;
70module_param(vmm_exclusive, bool, S_IRUGO);
71
66#define KVM_GUEST_CR0_MASK_UNRESTRICTED_GUEST \ 72#define KVM_GUEST_CR0_MASK_UNRESTRICTED_GUEST \
67 (X86_CR0_WP | X86_CR0_NE | X86_CR0_NW | X86_CR0_CD) 73 (X86_CR0_WP | X86_CR0_NE | X86_CR0_NW | X86_CR0_CD)
68#define KVM_GUEST_CR0_MASK \ 74#define KVM_GUEST_CR0_MASK \
@@ -173,10 +179,13 @@ static inline struct vcpu_vmx *to_vmx(struct kvm_vcpu *vcpu)
173 179
174static int init_rmode(struct kvm *kvm); 180static int init_rmode(struct kvm *kvm);
175static u64 construct_eptp(unsigned long root_hpa); 181static u64 construct_eptp(unsigned long root_hpa);
182static void kvm_cpu_vmxon(u64 addr);
183static void kvm_cpu_vmxoff(void);
176 184
177static DEFINE_PER_CPU(struct vmcs *, vmxarea); 185static DEFINE_PER_CPU(struct vmcs *, vmxarea);
178static DEFINE_PER_CPU(struct vmcs *, current_vmcs); 186static DEFINE_PER_CPU(struct vmcs *, current_vmcs);
179static DEFINE_PER_CPU(struct list_head, vcpus_on_cpu); 187static DEFINE_PER_CPU(struct list_head, vcpus_on_cpu);
188static DEFINE_PER_CPU(struct desc_ptr, host_gdt);
180 189
181static unsigned long *vmx_io_bitmap_a; 190static unsigned long *vmx_io_bitmap_a;
182static unsigned long *vmx_io_bitmap_b; 191static unsigned long *vmx_io_bitmap_b;
@@ -231,14 +240,14 @@ static u64 host_efer;
231static void ept_save_pdptrs(struct kvm_vcpu *vcpu); 240static void ept_save_pdptrs(struct kvm_vcpu *vcpu);
232 241
233/* 242/*
234 * Keep MSR_K6_STAR at the end, as setup_msrs() will try to optimize it 243 * Keep MSR_STAR at the end, as setup_msrs() will try to optimize it
235 * away by decrementing the array size. 244 * away by decrementing the array size.
236 */ 245 */
237static const u32 vmx_msr_index[] = { 246static const u32 vmx_msr_index[] = {
238#ifdef CONFIG_X86_64 247#ifdef CONFIG_X86_64
239 MSR_SYSCALL_MASK, MSR_LSTAR, MSR_CSTAR, 248 MSR_SYSCALL_MASK, MSR_LSTAR, MSR_CSTAR,
240#endif 249#endif
241 MSR_EFER, MSR_TSC_AUX, MSR_K6_STAR, 250 MSR_EFER, MSR_TSC_AUX, MSR_STAR,
242}; 251};
243#define NR_VMX_MSR ARRAY_SIZE(vmx_msr_index) 252#define NR_VMX_MSR ARRAY_SIZE(vmx_msr_index)
244 253
@@ -334,6 +343,11 @@ static inline bool cpu_has_vmx_ept_1g_page(void)
334 return vmx_capability.ept & VMX_EPT_1GB_PAGE_BIT; 343 return vmx_capability.ept & VMX_EPT_1GB_PAGE_BIT;
335} 344}
336 345
346static inline bool cpu_has_vmx_ept_4levels(void)
347{
348 return vmx_capability.ept & VMX_EPT_PAGE_WALK_4_BIT;
349}
350
337static inline bool cpu_has_vmx_invept_individual_addr(void) 351static inline bool cpu_has_vmx_invept_individual_addr(void)
338{ 352{
339 return vmx_capability.ept & VMX_EPT_EXTENT_INDIVIDUAL_BIT; 353 return vmx_capability.ept & VMX_EPT_EXTENT_INDIVIDUAL_BIT;
@@ -349,6 +363,16 @@ static inline bool cpu_has_vmx_invept_global(void)
349 return vmx_capability.ept & VMX_EPT_EXTENT_GLOBAL_BIT; 363 return vmx_capability.ept & VMX_EPT_EXTENT_GLOBAL_BIT;
350} 364}
351 365
366static inline bool cpu_has_vmx_invvpid_single(void)
367{
368 return vmx_capability.vpid & VMX_VPID_EXTENT_SINGLE_CONTEXT_BIT;
369}
370
371static inline bool cpu_has_vmx_invvpid_global(void)
372{
373 return vmx_capability.vpid & VMX_VPID_EXTENT_GLOBAL_CONTEXT_BIT;
374}
375
352static inline bool cpu_has_vmx_ept(void) 376static inline bool cpu_has_vmx_ept(void)
353{ 377{
354 return vmcs_config.cpu_based_2nd_exec_ctrl & 378 return vmcs_config.cpu_based_2nd_exec_ctrl &
@@ -389,6 +413,12 @@ static inline bool cpu_has_virtual_nmis(void)
389 return vmcs_config.pin_based_exec_ctrl & PIN_BASED_VIRTUAL_NMIS; 413 return vmcs_config.pin_based_exec_ctrl & PIN_BASED_VIRTUAL_NMIS;
390} 414}
391 415
416static inline bool cpu_has_vmx_wbinvd_exit(void)
417{
418 return vmcs_config.cpu_based_2nd_exec_ctrl &
419 SECONDARY_EXEC_WBINVD_EXITING;
420}
421
392static inline bool report_flexpriority(void) 422static inline bool report_flexpriority(void)
393{ 423{
394 return flexpriority_enabled; 424 return flexpriority_enabled;
@@ -453,6 +483,19 @@ static void vmcs_clear(struct vmcs *vmcs)
453 vmcs, phys_addr); 483 vmcs, phys_addr);
454} 484}
455 485
486static void vmcs_load(struct vmcs *vmcs)
487{
488 u64 phys_addr = __pa(vmcs);
489 u8 error;
490
491 asm volatile (__ex(ASM_VMX_VMPTRLD_RAX) "; setna %0"
492 : "=g"(error) : "a"(&phys_addr), "m"(phys_addr)
493 : "cc", "memory");
494 if (error)
495 printk(KERN_ERR "kvm: vmptrld %p/%llx fail\n",
496 vmcs, phys_addr);
497}
498
456static void __vcpu_clear(void *arg) 499static void __vcpu_clear(void *arg)
457{ 500{
458 struct vcpu_vmx *vmx = arg; 501 struct vcpu_vmx *vmx = arg;
@@ -475,12 +518,27 @@ static void vcpu_clear(struct vcpu_vmx *vmx)
475 smp_call_function_single(vmx->vcpu.cpu, __vcpu_clear, vmx, 1); 518 smp_call_function_single(vmx->vcpu.cpu, __vcpu_clear, vmx, 1);
476} 519}
477 520
478static inline void vpid_sync_vcpu_all(struct vcpu_vmx *vmx) 521static inline void vpid_sync_vcpu_single(struct vcpu_vmx *vmx)
479{ 522{
480 if (vmx->vpid == 0) 523 if (vmx->vpid == 0)
481 return; 524 return;
482 525
483 __invvpid(VMX_VPID_EXTENT_SINGLE_CONTEXT, vmx->vpid, 0); 526 if (cpu_has_vmx_invvpid_single())
527 __invvpid(VMX_VPID_EXTENT_SINGLE_CONTEXT, vmx->vpid, 0);
528}
529
530static inline void vpid_sync_vcpu_global(void)
531{
532 if (cpu_has_vmx_invvpid_global())
533 __invvpid(VMX_VPID_EXTENT_ALL_CONTEXT, 0, 0);
534}
535
536static inline void vpid_sync_context(struct vcpu_vmx *vmx)
537{
538 if (cpu_has_vmx_invvpid_single())
539 vpid_sync_vcpu_single(vmx);
540 else
541 vpid_sync_vcpu_global();
484} 542}
485 543
486static inline void ept_sync_global(void) 544static inline void ept_sync_global(void)
@@ -812,6 +870,9 @@ static void __vmx_load_host_state(struct vcpu_vmx *vmx)
812 wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_host_kernel_gs_base); 870 wrmsrl(MSR_KERNEL_GS_BASE, vmx->msr_host_kernel_gs_base);
813 } 871 }
814#endif 872#endif
873 if (current_thread_info()->status & TS_USEDFPU)
874 clts();
875 load_gdt(&__get_cpu_var(host_gdt));
815} 876}
816 877
817static void vmx_load_host_state(struct vcpu_vmx *vmx) 878static void vmx_load_host_state(struct vcpu_vmx *vmx)
@@ -828,35 +889,30 @@ static void vmx_load_host_state(struct vcpu_vmx *vmx)
828static void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu) 889static void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
829{ 890{
830 struct vcpu_vmx *vmx = to_vmx(vcpu); 891 struct vcpu_vmx *vmx = to_vmx(vcpu);
831 u64 phys_addr = __pa(vmx->vmcs);
832 u64 tsc_this, delta, new_offset; 892 u64 tsc_this, delta, new_offset;
893 u64 phys_addr = __pa(per_cpu(vmxarea, cpu));
833 894
834 if (vcpu->cpu != cpu) { 895 if (!vmm_exclusive)
896 kvm_cpu_vmxon(phys_addr);
897 else if (vcpu->cpu != cpu)
835 vcpu_clear(vmx); 898 vcpu_clear(vmx);
836 kvm_migrate_timers(vcpu);
837 set_bit(KVM_REQ_TLB_FLUSH, &vcpu->requests);
838 local_irq_disable();
839 list_add(&vmx->local_vcpus_link,
840 &per_cpu(vcpus_on_cpu, cpu));
841 local_irq_enable();
842 }
843 899
844 if (per_cpu(current_vmcs, cpu) != vmx->vmcs) { 900 if (per_cpu(current_vmcs, cpu) != vmx->vmcs) {
845 u8 error;
846
847 per_cpu(current_vmcs, cpu) = vmx->vmcs; 901 per_cpu(current_vmcs, cpu) = vmx->vmcs;
848 asm volatile (__ex(ASM_VMX_VMPTRLD_RAX) "; setna %0" 902 vmcs_load(vmx->vmcs);
849 : "=g"(error) : "a"(&phys_addr), "m"(phys_addr)
850 : "cc");
851 if (error)
852 printk(KERN_ERR "kvm: vmptrld %p/%llx fail\n",
853 vmx->vmcs, phys_addr);
854 } 903 }
855 904
856 if (vcpu->cpu != cpu) { 905 if (vcpu->cpu != cpu) {
857 struct desc_ptr dt; 906 struct desc_ptr dt;
858 unsigned long sysenter_esp; 907 unsigned long sysenter_esp;
859 908
909 kvm_migrate_timers(vcpu);
910 kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu);
911 local_irq_disable();
912 list_add(&vmx->local_vcpus_link,
913 &per_cpu(vcpus_on_cpu, cpu));
914 local_irq_enable();
915
860 vcpu->cpu = cpu; 916 vcpu->cpu = cpu;
861 /* 917 /*
862 * Linux uses per-cpu TSS and GDT, so set these when switching 918 * Linux uses per-cpu TSS and GDT, so set these when switching
@@ -884,6 +940,10 @@ static void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
884static void vmx_vcpu_put(struct kvm_vcpu *vcpu) 940static void vmx_vcpu_put(struct kvm_vcpu *vcpu)
885{ 941{
886 __vmx_load_host_state(to_vmx(vcpu)); 942 __vmx_load_host_state(to_vmx(vcpu));
943 if (!vmm_exclusive) {
944 __vcpu_clear(to_vmx(vcpu));
945 kvm_cpu_vmxoff();
946 }
887} 947}
888 948
889static void vmx_fpu_activate(struct kvm_vcpu *vcpu) 949static void vmx_fpu_activate(struct kvm_vcpu *vcpu)
@@ -1057,10 +1117,10 @@ static void setup_msrs(struct vcpu_vmx *vmx)
1057 if (index >= 0 && vmx->rdtscp_enabled) 1117 if (index >= 0 && vmx->rdtscp_enabled)
1058 move_msr_up(vmx, index, save_nmsrs++); 1118 move_msr_up(vmx, index, save_nmsrs++);
1059 /* 1119 /*
1060 * MSR_K6_STAR is only needed on long mode guests, and only 1120 * MSR_STAR is only needed on long mode guests, and only
1061 * if efer.sce is enabled. 1121 * if efer.sce is enabled.
1062 */ 1122 */
1063 index = __find_msr_index(vmx, MSR_K6_STAR); 1123 index = __find_msr_index(vmx, MSR_STAR);
1064 if ((index >= 0) && (vmx->vcpu.arch.efer & EFER_SCE)) 1124 if ((index >= 0) && (vmx->vcpu.arch.efer & EFER_SCE))
1065 move_msr_up(vmx, index, save_nmsrs++); 1125 move_msr_up(vmx, index, save_nmsrs++);
1066 } 1126 }
@@ -1286,6 +1346,13 @@ static __init int vmx_disabled_by_bios(void)
1286 /* locked but not enabled */ 1346 /* locked but not enabled */
1287} 1347}
1288 1348
1349static void kvm_cpu_vmxon(u64 addr)
1350{
1351 asm volatile (ASM_VMX_VMXON_RAX
1352 : : "a"(&addr), "m"(addr)
1353 : "memory", "cc");
1354}
1355
1289static int hardware_enable(void *garbage) 1356static int hardware_enable(void *garbage)
1290{ 1357{
1291 int cpu = raw_smp_processor_id(); 1358 int cpu = raw_smp_processor_id();
@@ -1308,11 +1375,13 @@ static int hardware_enable(void *garbage)
1308 wrmsrl(MSR_IA32_FEATURE_CONTROL, old | test_bits); 1375 wrmsrl(MSR_IA32_FEATURE_CONTROL, old | test_bits);
1309 } 1376 }
1310 write_cr4(read_cr4() | X86_CR4_VMXE); /* FIXME: not cpu hotplug safe */ 1377 write_cr4(read_cr4() | X86_CR4_VMXE); /* FIXME: not cpu hotplug safe */
1311 asm volatile (ASM_VMX_VMXON_RAX
1312 : : "a"(&phys_addr), "m"(phys_addr)
1313 : "memory", "cc");
1314 1378
1315 ept_sync_global(); 1379 if (vmm_exclusive) {
1380 kvm_cpu_vmxon(phys_addr);
1381 ept_sync_global();
1382 }
1383
1384 store_gdt(&__get_cpu_var(host_gdt));
1316 1385
1317 return 0; 1386 return 0;
1318} 1387}
@@ -1334,13 +1403,15 @@ static void vmclear_local_vcpus(void)
1334static void kvm_cpu_vmxoff(void) 1403static void kvm_cpu_vmxoff(void)
1335{ 1404{
1336 asm volatile (__ex(ASM_VMX_VMXOFF) : : : "cc"); 1405 asm volatile (__ex(ASM_VMX_VMXOFF) : : : "cc");
1337 write_cr4(read_cr4() & ~X86_CR4_VMXE);
1338} 1406}
1339 1407
1340static void hardware_disable(void *garbage) 1408static void hardware_disable(void *garbage)
1341{ 1409{
1342 vmclear_local_vcpus(); 1410 if (vmm_exclusive) {
1343 kvm_cpu_vmxoff(); 1411 vmclear_local_vcpus();
1412 kvm_cpu_vmxoff();
1413 }
1414 write_cr4(read_cr4() & ~X86_CR4_VMXE);
1344} 1415}
1345 1416
1346static __init int adjust_vmx_controls(u32 ctl_min, u32 ctl_opt, 1417static __init int adjust_vmx_controls(u32 ctl_min, u32 ctl_opt,
@@ -1539,7 +1610,8 @@ static __init int hardware_setup(void)
1539 if (!cpu_has_vmx_vpid()) 1610 if (!cpu_has_vmx_vpid())
1540 enable_vpid = 0; 1611 enable_vpid = 0;
1541 1612
1542 if (!cpu_has_vmx_ept()) { 1613 if (!cpu_has_vmx_ept() ||
1614 !cpu_has_vmx_ept_4levels()) {
1543 enable_ept = 0; 1615 enable_ept = 0;
1544 enable_unrestricted_guest = 0; 1616 enable_unrestricted_guest = 0;
1545 } 1617 }
@@ -1628,7 +1700,7 @@ static gva_t rmode_tss_base(struct kvm *kvm)
1628 gfn_t base_gfn; 1700 gfn_t base_gfn;
1629 1701
1630 slots = kvm_memslots(kvm); 1702 slots = kvm_memslots(kvm);
1631 base_gfn = kvm->memslots->memslots[0].base_gfn + 1703 base_gfn = slots->memslots[0].base_gfn +
1632 kvm->memslots->memslots[0].npages - 3; 1704 kvm->memslots->memslots[0].npages - 3;
1633 return base_gfn << PAGE_SHIFT; 1705 return base_gfn << PAGE_SHIFT;
1634 } 1706 }
@@ -1759,9 +1831,12 @@ static void exit_lmode(struct kvm_vcpu *vcpu)
1759 1831
1760static void vmx_flush_tlb(struct kvm_vcpu *vcpu) 1832static void vmx_flush_tlb(struct kvm_vcpu *vcpu)
1761{ 1833{
1762 vpid_sync_vcpu_all(to_vmx(vcpu)); 1834 vpid_sync_context(to_vmx(vcpu));
1763 if (enable_ept) 1835 if (enable_ept) {
1836 if (!VALID_PAGE(vcpu->arch.mmu.root_hpa))
1837 return;
1764 ept_sync_context(construct_eptp(vcpu->arch.mmu.root_hpa)); 1838 ept_sync_context(construct_eptp(vcpu->arch.mmu.root_hpa));
1839 }
1765} 1840}
1766 1841
1767static void vmx_decache_cr0_guest_bits(struct kvm_vcpu *vcpu) 1842static void vmx_decache_cr0_guest_bits(struct kvm_vcpu *vcpu)
@@ -2507,7 +2582,7 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)
2507 vmcs_write32(PAGE_FAULT_ERROR_CODE_MATCH, !!bypass_guest_pf); 2582 vmcs_write32(PAGE_FAULT_ERROR_CODE_MATCH, !!bypass_guest_pf);
2508 vmcs_write32(CR3_TARGET_COUNT, 0); /* 22.2.1 */ 2583 vmcs_write32(CR3_TARGET_COUNT, 0); /* 22.2.1 */
2509 2584
2510 vmcs_writel(HOST_CR0, read_cr0()); /* 22.2.3 */ 2585 vmcs_writel(HOST_CR0, read_cr0() | X86_CR0_TS); /* 22.2.3 */
2511 vmcs_writel(HOST_CR4, read_cr4()); /* 22.2.3, 22.2.5 */ 2586 vmcs_writel(HOST_CR4, read_cr4()); /* 22.2.3, 22.2.5 */
2512 vmcs_writel(HOST_CR3, read_cr3()); /* 22.2.3 FIXME: shadow tables */ 2587 vmcs_writel(HOST_CR3, read_cr3()); /* 22.2.3 FIXME: shadow tables */
2513 2588
@@ -2599,21 +2674,27 @@ static int vmx_vcpu_setup(struct vcpu_vmx *vmx)
2599 2674
2600static int init_rmode(struct kvm *kvm) 2675static int init_rmode(struct kvm *kvm)
2601{ 2676{
2677 int idx, ret = 0;
2678
2679 idx = srcu_read_lock(&kvm->srcu);
2602 if (!init_rmode_tss(kvm)) 2680 if (!init_rmode_tss(kvm))
2603 return 0; 2681 goto exit;
2604 if (!init_rmode_identity_map(kvm)) 2682 if (!init_rmode_identity_map(kvm))
2605 return 0; 2683 goto exit;
2606 return 1; 2684
2685 ret = 1;
2686exit:
2687 srcu_read_unlock(&kvm->srcu, idx);
2688 return ret;
2607} 2689}
2608 2690
2609static int vmx_vcpu_reset(struct kvm_vcpu *vcpu) 2691static int vmx_vcpu_reset(struct kvm_vcpu *vcpu)
2610{ 2692{
2611 struct vcpu_vmx *vmx = to_vmx(vcpu); 2693 struct vcpu_vmx *vmx = to_vmx(vcpu);
2612 u64 msr; 2694 u64 msr;
2613 int ret, idx; 2695 int ret;
2614 2696
2615 vcpu->arch.regs_avail = ~((1 << VCPU_REGS_RIP) | (1 << VCPU_REGS_RSP)); 2697 vcpu->arch.regs_avail = ~((1 << VCPU_REGS_RIP) | (1 << VCPU_REGS_RSP));
2616 idx = srcu_read_lock(&vcpu->kvm->srcu);
2617 if (!init_rmode(vmx->vcpu.kvm)) { 2698 if (!init_rmode(vmx->vcpu.kvm)) {
2618 ret = -ENOMEM; 2699 ret = -ENOMEM;
2619 goto out; 2700 goto out;
@@ -2630,7 +2711,9 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu)
2630 msr |= MSR_IA32_APICBASE_BSP; 2711 msr |= MSR_IA32_APICBASE_BSP;
2631 kvm_set_apic_base(&vmx->vcpu, msr); 2712 kvm_set_apic_base(&vmx->vcpu, msr);
2632 2713
2633 fx_init(&vmx->vcpu); 2714 ret = fx_init(&vmx->vcpu);
2715 if (ret != 0)
2716 goto out;
2634 2717
2635 seg_setup(VCPU_SREG_CS); 2718 seg_setup(VCPU_SREG_CS);
2636 /* 2719 /*
@@ -2713,7 +2796,7 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu)
2713 vmx_fpu_activate(&vmx->vcpu); 2796 vmx_fpu_activate(&vmx->vcpu);
2714 update_exception_bitmap(&vmx->vcpu); 2797 update_exception_bitmap(&vmx->vcpu);
2715 2798
2716 vpid_sync_vcpu_all(vmx); 2799 vpid_sync_context(vmx);
2717 2800
2718 ret = 0; 2801 ret = 0;
2719 2802
@@ -2721,7 +2804,6 @@ static int vmx_vcpu_reset(struct kvm_vcpu *vcpu)
2721 vmx->emulation_required = 0; 2804 vmx->emulation_required = 0;
2722 2805
2723out: 2806out:
2724 srcu_read_unlock(&vcpu->kvm->srcu, idx);
2725 return ret; 2807 return ret;
2726} 2808}
2727 2809
@@ -2826,9 +2908,7 @@ static bool vmx_get_nmi_mask(struct kvm_vcpu *vcpu)
2826{ 2908{
2827 if (!cpu_has_virtual_nmis()) 2909 if (!cpu_has_virtual_nmis())
2828 return to_vmx(vcpu)->soft_vnmi_blocked; 2910 return to_vmx(vcpu)->soft_vnmi_blocked;
2829 else 2911 return vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & GUEST_INTR_STATE_NMI;
2830 return !!(vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) &
2831 GUEST_INTR_STATE_NMI);
2832} 2912}
2833 2913
2834static void vmx_set_nmi_mask(struct kvm_vcpu *vcpu, bool masked) 2914static void vmx_set_nmi_mask(struct kvm_vcpu *vcpu, bool masked)
@@ -3070,7 +3150,7 @@ static int handle_io(struct kvm_vcpu *vcpu)
3070 ++vcpu->stat.io_exits; 3150 ++vcpu->stat.io_exits;
3071 3151
3072 if (string || in) 3152 if (string || in)
3073 return !(emulate_instruction(vcpu, 0, 0, 0) == EMULATE_DO_MMIO); 3153 return emulate_instruction(vcpu, 0, 0, 0) == EMULATE_DONE;
3074 3154
3075 port = exit_qualification >> 16; 3155 port = exit_qualification >> 16;
3076 size = (exit_qualification & 7) + 1; 3156 size = (exit_qualification & 7) + 1;
@@ -3090,11 +3170,20 @@ vmx_patch_hypercall(struct kvm_vcpu *vcpu, unsigned char *hypercall)
3090 hypercall[2] = 0xc1; 3170 hypercall[2] = 0xc1;
3091} 3171}
3092 3172
3173static void complete_insn_gp(struct kvm_vcpu *vcpu, int err)
3174{
3175 if (err)
3176 kvm_inject_gp(vcpu, 0);
3177 else
3178 skip_emulated_instruction(vcpu);
3179}
3180
3093static int handle_cr(struct kvm_vcpu *vcpu) 3181static int handle_cr(struct kvm_vcpu *vcpu)
3094{ 3182{
3095 unsigned long exit_qualification, val; 3183 unsigned long exit_qualification, val;
3096 int cr; 3184 int cr;
3097 int reg; 3185 int reg;
3186 int err;
3098 3187
3099 exit_qualification = vmcs_readl(EXIT_QUALIFICATION); 3188 exit_qualification = vmcs_readl(EXIT_QUALIFICATION);
3100 cr = exit_qualification & 15; 3189 cr = exit_qualification & 15;
@@ -3105,16 +3194,16 @@ static int handle_cr(struct kvm_vcpu *vcpu)
3105 trace_kvm_cr_write(cr, val); 3194 trace_kvm_cr_write(cr, val);
3106 switch (cr) { 3195 switch (cr) {
3107 case 0: 3196 case 0:
3108 kvm_set_cr0(vcpu, val); 3197 err = kvm_set_cr0(vcpu, val);
3109 skip_emulated_instruction(vcpu); 3198 complete_insn_gp(vcpu, err);
3110 return 1; 3199 return 1;
3111 case 3: 3200 case 3:
3112 kvm_set_cr3(vcpu, val); 3201 err = kvm_set_cr3(vcpu, val);
3113 skip_emulated_instruction(vcpu); 3202 complete_insn_gp(vcpu, err);
3114 return 1; 3203 return 1;
3115 case 4: 3204 case 4:
3116 kvm_set_cr4(vcpu, val); 3205 err = kvm_set_cr4(vcpu, val);
3117 skip_emulated_instruction(vcpu); 3206 complete_insn_gp(vcpu, err);
3118 return 1; 3207 return 1;
3119 case 8: { 3208 case 8: {
3120 u8 cr8_prev = kvm_get_cr8(vcpu); 3209 u8 cr8_prev = kvm_get_cr8(vcpu);
@@ -3321,30 +3410,25 @@ static int handle_invlpg(struct kvm_vcpu *vcpu)
3321static int handle_wbinvd(struct kvm_vcpu *vcpu) 3410static int handle_wbinvd(struct kvm_vcpu *vcpu)
3322{ 3411{
3323 skip_emulated_instruction(vcpu); 3412 skip_emulated_instruction(vcpu);
3324 /* TODO: Add support for VT-d/pass-through device */ 3413 kvm_emulate_wbinvd(vcpu);
3325 return 1; 3414 return 1;
3326} 3415}
3327 3416
3328static int handle_apic_access(struct kvm_vcpu *vcpu) 3417static int handle_xsetbv(struct kvm_vcpu *vcpu)
3329{ 3418{
3330 unsigned long exit_qualification; 3419 u64 new_bv = kvm_read_edx_eax(vcpu);
3331 enum emulation_result er; 3420 u32 index = kvm_register_read(vcpu, VCPU_REGS_RCX);
3332 unsigned long offset;
3333 3421
3334 exit_qualification = vmcs_readl(EXIT_QUALIFICATION); 3422 if (kvm_set_xcr(vcpu, index, new_bv) == 0)
3335 offset = exit_qualification & 0xffful; 3423 skip_emulated_instruction(vcpu);
3336
3337 er = emulate_instruction(vcpu, 0, 0, 0);
3338
3339 if (er != EMULATE_DONE) {
3340 printk(KERN_ERR
3341 "Fail to handle apic access vmexit! Offset is 0x%lx\n",
3342 offset);
3343 return -ENOEXEC;
3344 }
3345 return 1; 3424 return 1;
3346} 3425}
3347 3426
3427static int handle_apic_access(struct kvm_vcpu *vcpu)
3428{
3429 return emulate_instruction(vcpu, 0, 0, 0) == EMULATE_DONE;
3430}
3431
3348static int handle_task_switch(struct kvm_vcpu *vcpu) 3432static int handle_task_switch(struct kvm_vcpu *vcpu)
3349{ 3433{
3350 struct vcpu_vmx *vmx = to_vmx(vcpu); 3434 struct vcpu_vmx *vmx = to_vmx(vcpu);
@@ -3554,13 +3638,8 @@ static int handle_invalid_guest_state(struct kvm_vcpu *vcpu)
3554 goto out; 3638 goto out;
3555 } 3639 }
3556 3640
3557 if (err != EMULATE_DONE) { 3641 if (err != EMULATE_DONE)
3558 vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR; 3642 return 0;
3559 vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION;
3560 vcpu->run->internal.ndata = 0;
3561 ret = 0;
3562 goto out;
3563 }
3564 3643
3565 if (signal_pending(current)) 3644 if (signal_pending(current))
3566 goto out; 3645 goto out;
@@ -3623,6 +3702,7 @@ static int (*kvm_vmx_exit_handlers[])(struct kvm_vcpu *vcpu) = {
3623 [EXIT_REASON_TPR_BELOW_THRESHOLD] = handle_tpr_below_threshold, 3702 [EXIT_REASON_TPR_BELOW_THRESHOLD] = handle_tpr_below_threshold,
3624 [EXIT_REASON_APIC_ACCESS] = handle_apic_access, 3703 [EXIT_REASON_APIC_ACCESS] = handle_apic_access,
3625 [EXIT_REASON_WBINVD] = handle_wbinvd, 3704 [EXIT_REASON_WBINVD] = handle_wbinvd,
3705 [EXIT_REASON_XSETBV] = handle_xsetbv,
3626 [EXIT_REASON_TASK_SWITCH] = handle_task_switch, 3706 [EXIT_REASON_TASK_SWITCH] = handle_task_switch,
3627 [EXIT_REASON_MCE_DURING_VMENTRY] = handle_machine_check, 3707 [EXIT_REASON_MCE_DURING_VMENTRY] = handle_machine_check,
3628 [EXIT_REASON_EPT_VIOLATION] = handle_ept_violation, 3708 [EXIT_REASON_EPT_VIOLATION] = handle_ept_violation,
@@ -3656,6 +3736,13 @@ static int vmx_handle_exit(struct kvm_vcpu *vcpu)
3656 if (enable_ept && is_paging(vcpu)) 3736 if (enable_ept && is_paging(vcpu))
3657 vcpu->arch.cr3 = vmcs_readl(GUEST_CR3); 3737 vcpu->arch.cr3 = vmcs_readl(GUEST_CR3);
3658 3738
3739 if (exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY) {
3740 vcpu->run->exit_reason = KVM_EXIT_FAIL_ENTRY;
3741 vcpu->run->fail_entry.hardware_entry_failure_reason
3742 = exit_reason;
3743 return 0;
3744 }
3745
3659 if (unlikely(vmx->fail)) { 3746 if (unlikely(vmx->fail)) {
3660 vcpu->run->exit_reason = KVM_EXIT_FAIL_ENTRY; 3747 vcpu->run->exit_reason = KVM_EXIT_FAIL_ENTRY;
3661 vcpu->run->fail_entry.hardware_entry_failure_reason 3748 vcpu->run->fail_entry.hardware_entry_failure_reason
@@ -3861,11 +3948,6 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu)
3861 if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) 3948 if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP)
3862 vmx_set_interrupt_shadow(vcpu, 0); 3949 vmx_set_interrupt_shadow(vcpu, 0);
3863 3950
3864 /*
3865 * Loading guest fpu may have cleared host cr0.ts
3866 */
3867 vmcs_writel(HOST_CR0, read_cr0());
3868
3869 asm( 3951 asm(
3870 /* Store host registers */ 3952 /* Store host registers */
3871 "push %%"R"dx; push %%"R"bp;" 3953 "push %%"R"dx; push %%"R"bp;"
@@ -4001,6 +4083,19 @@ static void vmx_free_vcpu(struct kvm_vcpu *vcpu)
4001 kmem_cache_free(kvm_vcpu_cache, vmx); 4083 kmem_cache_free(kvm_vcpu_cache, vmx);
4002} 4084}
4003 4085
4086static inline void vmcs_init(struct vmcs *vmcs)
4087{
4088 u64 phys_addr = __pa(per_cpu(vmxarea, raw_smp_processor_id()));
4089
4090 if (!vmm_exclusive)
4091 kvm_cpu_vmxon(phys_addr);
4092
4093 vmcs_clear(vmcs);
4094
4095 if (!vmm_exclusive)
4096 kvm_cpu_vmxoff();
4097}
4098
4004static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id) 4099static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id)
4005{ 4100{
4006 int err; 4101 int err;
@@ -4026,7 +4121,7 @@ static struct kvm_vcpu *vmx_create_vcpu(struct kvm *kvm, unsigned int id)
4026 if (!vmx->vmcs) 4121 if (!vmx->vmcs)
4027 goto free_msrs; 4122 goto free_msrs;
4028 4123
4029 vmcs_clear(vmx->vmcs); 4124 vmcs_init(vmx->vmcs);
4030 4125
4031 cpu = get_cpu(); 4126 cpu = get_cpu();
4032 vmx_vcpu_load(&vmx->vcpu, cpu); 4127 vmx_vcpu_load(&vmx->vcpu, cpu);
@@ -4265,6 +4360,8 @@ static struct kvm_x86_ops vmx_x86_ops = {
4265 .rdtscp_supported = vmx_rdtscp_supported, 4360 .rdtscp_supported = vmx_rdtscp_supported,
4266 4361
4267 .set_supported_cpuid = vmx_set_supported_cpuid, 4362 .set_supported_cpuid = vmx_set_supported_cpuid,
4363
4364 .has_wbinvd_exit = cpu_has_vmx_wbinvd_exit,
4268}; 4365};
4269 4366
4270static int __init vmx_init(void) 4367static int __init vmx_init(void)
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 7fa89c39c64f..25f19078b321 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6,6 +6,7 @@
6 * Copyright (C) 2006 Qumranet, Inc. 6 * Copyright (C) 2006 Qumranet, Inc.
7 * Copyright (C) 2008 Qumranet, Inc. 7 * Copyright (C) 2008 Qumranet, Inc.
8 * Copyright IBM Corporation, 2008 8 * Copyright IBM Corporation, 2008
9 * Copyright 2010 Red Hat, Inc. and/or its affilates.
9 * 10 *
10 * Authors: 11 * Authors:
11 * Avi Kivity <avi@qumranet.com> 12 * Avi Kivity <avi@qumranet.com>
@@ -41,17 +42,19 @@
41#include <linux/srcu.h> 42#include <linux/srcu.h>
42#include <linux/slab.h> 43#include <linux/slab.h>
43#include <linux/perf_event.h> 44#include <linux/perf_event.h>
45#include <linux/uaccess.h>
44#include <trace/events/kvm.h> 46#include <trace/events/kvm.h>
45 47
46#define CREATE_TRACE_POINTS 48#define CREATE_TRACE_POINTS
47#include "trace.h" 49#include "trace.h"
48 50
49#include <asm/debugreg.h> 51#include <asm/debugreg.h>
50#include <asm/uaccess.h>
51#include <asm/msr.h> 52#include <asm/msr.h>
52#include <asm/desc.h> 53#include <asm/desc.h>
53#include <asm/mtrr.h> 54#include <asm/mtrr.h>
54#include <asm/mce.h> 55#include <asm/mce.h>
56#include <asm/i387.h>
57#include <asm/xcr.h>
55 58
56#define MAX_IO_MSRS 256 59#define MAX_IO_MSRS 256
57#define CR0_RESERVED_BITS \ 60#define CR0_RESERVED_BITS \
@@ -62,6 +65,7 @@
62 (~(unsigned long)(X86_CR4_VME | X86_CR4_PVI | X86_CR4_TSD | X86_CR4_DE\ 65 (~(unsigned long)(X86_CR4_VME | X86_CR4_PVI | X86_CR4_TSD | X86_CR4_DE\
63 | X86_CR4_PSE | X86_CR4_PAE | X86_CR4_MCE \ 66 | X86_CR4_PSE | X86_CR4_PAE | X86_CR4_MCE \
64 | X86_CR4_PGE | X86_CR4_PCE | X86_CR4_OSFXSR \ 67 | X86_CR4_PGE | X86_CR4_PCE | X86_CR4_OSFXSR \
68 | X86_CR4_OSXSAVE \
65 | X86_CR4_OSXMMEXCPT | X86_CR4_VMXE)) 69 | X86_CR4_OSXMMEXCPT | X86_CR4_VMXE))
66 70
67#define CR8_RESERVED_BITS (~(unsigned long)X86_CR8_TPR) 71#define CR8_RESERVED_BITS (~(unsigned long)X86_CR8_TPR)
@@ -147,6 +151,13 @@ struct kvm_stats_debugfs_item debugfs_entries[] = {
147 { NULL } 151 { NULL }
148}; 152};
149 153
154u64 __read_mostly host_xcr0;
155
156static inline u32 bit(int bitno)
157{
158 return 1 << (bitno & 31);
159}
160
150static void kvm_on_user_return(struct user_return_notifier *urn) 161static void kvm_on_user_return(struct user_return_notifier *urn)
151{ 162{
152 unsigned slot; 163 unsigned slot;
@@ -285,7 +296,7 @@ static void kvm_multiple_exception(struct kvm_vcpu *vcpu,
285 prev_nr = vcpu->arch.exception.nr; 296 prev_nr = vcpu->arch.exception.nr;
286 if (prev_nr == DF_VECTOR) { 297 if (prev_nr == DF_VECTOR) {
287 /* triple fault -> shutdown */ 298 /* triple fault -> shutdown */
288 set_bit(KVM_REQ_TRIPLE_FAULT, &vcpu->requests); 299 kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu);
289 return; 300 return;
290 } 301 }
291 class1 = exception_class(prev_nr); 302 class1 = exception_class(prev_nr);
@@ -414,121 +425,163 @@ out:
414 return changed; 425 return changed;
415} 426}
416 427
417void kvm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) 428int kvm_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0)
418{ 429{
430 unsigned long old_cr0 = kvm_read_cr0(vcpu);
431 unsigned long update_bits = X86_CR0_PG | X86_CR0_WP |
432 X86_CR0_CD | X86_CR0_NW;
433
419 cr0 |= X86_CR0_ET; 434 cr0 |= X86_CR0_ET;
420 435
421#ifdef CONFIG_X86_64 436#ifdef CONFIG_X86_64
422 if (cr0 & 0xffffffff00000000UL) { 437 if (cr0 & 0xffffffff00000000UL)
423 kvm_inject_gp(vcpu, 0); 438 return 1;
424 return;
425 }
426#endif 439#endif
427 440
428 cr0 &= ~CR0_RESERVED_BITS; 441 cr0 &= ~CR0_RESERVED_BITS;
429 442
430 if ((cr0 & X86_CR0_NW) && !(cr0 & X86_CR0_CD)) { 443 if ((cr0 & X86_CR0_NW) && !(cr0 & X86_CR0_CD))
431 kvm_inject_gp(vcpu, 0); 444 return 1;
432 return;
433 }
434 445
435 if ((cr0 & X86_CR0_PG) && !(cr0 & X86_CR0_PE)) { 446 if ((cr0 & X86_CR0_PG) && !(cr0 & X86_CR0_PE))
436 kvm_inject_gp(vcpu, 0); 447 return 1;
437 return;
438 }
439 448
440 if (!is_paging(vcpu) && (cr0 & X86_CR0_PG)) { 449 if (!is_paging(vcpu) && (cr0 & X86_CR0_PG)) {
441#ifdef CONFIG_X86_64 450#ifdef CONFIG_X86_64
442 if ((vcpu->arch.efer & EFER_LME)) { 451 if ((vcpu->arch.efer & EFER_LME)) {
443 int cs_db, cs_l; 452 int cs_db, cs_l;
444 453
445 if (!is_pae(vcpu)) { 454 if (!is_pae(vcpu))
446 kvm_inject_gp(vcpu, 0); 455 return 1;
447 return;
448 }
449 kvm_x86_ops->get_cs_db_l_bits(vcpu, &cs_db, &cs_l); 456 kvm_x86_ops->get_cs_db_l_bits(vcpu, &cs_db, &cs_l);
450 if (cs_l) { 457 if (cs_l)
451 kvm_inject_gp(vcpu, 0); 458 return 1;
452 return;
453
454 }
455 } else 459 } else
456#endif 460#endif
457 if (is_pae(vcpu) && !load_pdptrs(vcpu, vcpu->arch.cr3)) { 461 if (is_pae(vcpu) && !load_pdptrs(vcpu, vcpu->arch.cr3))
458 kvm_inject_gp(vcpu, 0); 462 return 1;
459 return;
460 }
461
462 } 463 }
463 464
464 kvm_x86_ops->set_cr0(vcpu, cr0); 465 kvm_x86_ops->set_cr0(vcpu, cr0);
465 466
466 kvm_mmu_reset_context(vcpu); 467 if ((cr0 ^ old_cr0) & update_bits)
467 return; 468 kvm_mmu_reset_context(vcpu);
469 return 0;
468} 470}
469EXPORT_SYMBOL_GPL(kvm_set_cr0); 471EXPORT_SYMBOL_GPL(kvm_set_cr0);
470 472
471void kvm_lmsw(struct kvm_vcpu *vcpu, unsigned long msw) 473void kvm_lmsw(struct kvm_vcpu *vcpu, unsigned long msw)
472{ 474{
473 kvm_set_cr0(vcpu, kvm_read_cr0_bits(vcpu, ~0x0eul) | (msw & 0x0f)); 475 (void)kvm_set_cr0(vcpu, kvm_read_cr0_bits(vcpu, ~0x0eul) | (msw & 0x0f));
474} 476}
475EXPORT_SYMBOL_GPL(kvm_lmsw); 477EXPORT_SYMBOL_GPL(kvm_lmsw);
476 478
477void kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) 479int __kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)
478{ 480{
479 unsigned long old_cr4 = kvm_read_cr4(vcpu); 481 u64 xcr0;
480 unsigned long pdptr_bits = X86_CR4_PGE | X86_CR4_PSE | X86_CR4_PAE;
481 482
482 if (cr4 & CR4_RESERVED_BITS) { 483 /* Only support XCR_XFEATURE_ENABLED_MASK(xcr0) now */
484 if (index != XCR_XFEATURE_ENABLED_MASK)
485 return 1;
486 xcr0 = xcr;
487 if (kvm_x86_ops->get_cpl(vcpu) != 0)
488 return 1;
489 if (!(xcr0 & XSTATE_FP))
490 return 1;
491 if ((xcr0 & XSTATE_YMM) && !(xcr0 & XSTATE_SSE))
492 return 1;
493 if (xcr0 & ~host_xcr0)
494 return 1;
495 vcpu->arch.xcr0 = xcr0;
496 vcpu->guest_xcr0_loaded = 0;
497 return 0;
498}
499
500int kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, u64 xcr)
501{
502 if (__kvm_set_xcr(vcpu, index, xcr)) {
483 kvm_inject_gp(vcpu, 0); 503 kvm_inject_gp(vcpu, 0);
504 return 1;
505 }
506 return 0;
507}
508EXPORT_SYMBOL_GPL(kvm_set_xcr);
509
510static bool guest_cpuid_has_xsave(struct kvm_vcpu *vcpu)
511{
512 struct kvm_cpuid_entry2 *best;
513
514 best = kvm_find_cpuid_entry(vcpu, 1, 0);
515 return best && (best->ecx & bit(X86_FEATURE_XSAVE));
516}
517
518static void update_cpuid(struct kvm_vcpu *vcpu)
519{
520 struct kvm_cpuid_entry2 *best;
521
522 best = kvm_find_cpuid_entry(vcpu, 1, 0);
523 if (!best)
484 return; 524 return;
525
526 /* Update OSXSAVE bit */
527 if (cpu_has_xsave && best->function == 0x1) {
528 best->ecx &= ~(bit(X86_FEATURE_OSXSAVE));
529 if (kvm_read_cr4_bits(vcpu, X86_CR4_OSXSAVE))
530 best->ecx |= bit(X86_FEATURE_OSXSAVE);
485 } 531 }
532}
533
534int kvm_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4)
535{
536 unsigned long old_cr4 = kvm_read_cr4(vcpu);
537 unsigned long pdptr_bits = X86_CR4_PGE | X86_CR4_PSE | X86_CR4_PAE;
538
539 if (cr4 & CR4_RESERVED_BITS)
540 return 1;
541
542 if (!guest_cpuid_has_xsave(vcpu) && (cr4 & X86_CR4_OSXSAVE))
543 return 1;
486 544
487 if (is_long_mode(vcpu)) { 545 if (is_long_mode(vcpu)) {
488 if (!(cr4 & X86_CR4_PAE)) { 546 if (!(cr4 & X86_CR4_PAE))
489 kvm_inject_gp(vcpu, 0); 547 return 1;
490 return;
491 }
492 } else if (is_paging(vcpu) && (cr4 & X86_CR4_PAE) 548 } else if (is_paging(vcpu) && (cr4 & X86_CR4_PAE)
493 && ((cr4 ^ old_cr4) & pdptr_bits) 549 && ((cr4 ^ old_cr4) & pdptr_bits)
494 && !load_pdptrs(vcpu, vcpu->arch.cr3)) { 550 && !load_pdptrs(vcpu, vcpu->arch.cr3))
495 kvm_inject_gp(vcpu, 0); 551 return 1;
496 return; 552
497 } 553 if (cr4 & X86_CR4_VMXE)
554 return 1;
498 555
499 if (cr4 & X86_CR4_VMXE) {
500 kvm_inject_gp(vcpu, 0);
501 return;
502 }
503 kvm_x86_ops->set_cr4(vcpu, cr4); 556 kvm_x86_ops->set_cr4(vcpu, cr4);
504 vcpu->arch.cr4 = cr4; 557
505 kvm_mmu_reset_context(vcpu); 558 if ((cr4 ^ old_cr4) & pdptr_bits)
559 kvm_mmu_reset_context(vcpu);
560
561 if ((cr4 ^ old_cr4) & X86_CR4_OSXSAVE)
562 update_cpuid(vcpu);
563
564 return 0;
506} 565}
507EXPORT_SYMBOL_GPL(kvm_set_cr4); 566EXPORT_SYMBOL_GPL(kvm_set_cr4);
508 567
509void kvm_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3) 568int kvm_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3)
510{ 569{
511 if (cr3 == vcpu->arch.cr3 && !pdptrs_changed(vcpu)) { 570 if (cr3 == vcpu->arch.cr3 && !pdptrs_changed(vcpu)) {
512 kvm_mmu_sync_roots(vcpu); 571 kvm_mmu_sync_roots(vcpu);
513 kvm_mmu_flush_tlb(vcpu); 572 kvm_mmu_flush_tlb(vcpu);
514 return; 573 return 0;
515 } 574 }
516 575
517 if (is_long_mode(vcpu)) { 576 if (is_long_mode(vcpu)) {
518 if (cr3 & CR3_L_MODE_RESERVED_BITS) { 577 if (cr3 & CR3_L_MODE_RESERVED_BITS)
519 kvm_inject_gp(vcpu, 0); 578 return 1;
520 return;
521 }
522 } else { 579 } else {
523 if (is_pae(vcpu)) { 580 if (is_pae(vcpu)) {
524 if (cr3 & CR3_PAE_RESERVED_BITS) { 581 if (cr3 & CR3_PAE_RESERVED_BITS)
525 kvm_inject_gp(vcpu, 0); 582 return 1;
526 return; 583 if (is_paging(vcpu) && !load_pdptrs(vcpu, cr3))
527 } 584 return 1;
528 if (is_paging(vcpu) && !load_pdptrs(vcpu, cr3)) {
529 kvm_inject_gp(vcpu, 0);
530 return;
531 }
532 } 585 }
533 /* 586 /*
534 * We don't check reserved bits in nonpae mode, because 587 * We don't check reserved bits in nonpae mode, because
@@ -546,24 +599,28 @@ void kvm_set_cr3(struct kvm_vcpu *vcpu, unsigned long cr3)
546 * to debug) behavior on the guest side. 599 * to debug) behavior on the guest side.
547 */ 600 */
548 if (unlikely(!gfn_to_memslot(vcpu->kvm, cr3 >> PAGE_SHIFT))) 601 if (unlikely(!gfn_to_memslot(vcpu->kvm, cr3 >> PAGE_SHIFT)))
549 kvm_inject_gp(vcpu, 0); 602 return 1;
550 else { 603 vcpu->arch.cr3 = cr3;
551 vcpu->arch.cr3 = cr3; 604 vcpu->arch.mmu.new_cr3(vcpu);
552 vcpu->arch.mmu.new_cr3(vcpu); 605 return 0;
553 }
554} 606}
555EXPORT_SYMBOL_GPL(kvm_set_cr3); 607EXPORT_SYMBOL_GPL(kvm_set_cr3);
556 608
557void kvm_set_cr8(struct kvm_vcpu *vcpu, unsigned long cr8) 609int __kvm_set_cr8(struct kvm_vcpu *vcpu, unsigned long cr8)
558{ 610{
559 if (cr8 & CR8_RESERVED_BITS) { 611 if (cr8 & CR8_RESERVED_BITS)
560 kvm_inject_gp(vcpu, 0); 612 return 1;
561 return;
562 }
563 if (irqchip_in_kernel(vcpu->kvm)) 613 if (irqchip_in_kernel(vcpu->kvm))
564 kvm_lapic_set_tpr(vcpu, cr8); 614 kvm_lapic_set_tpr(vcpu, cr8);
565 else 615 else
566 vcpu->arch.cr8 = cr8; 616 vcpu->arch.cr8 = cr8;
617 return 0;
618}
619
620void kvm_set_cr8(struct kvm_vcpu *vcpu, unsigned long cr8)
621{
622 if (__kvm_set_cr8(vcpu, cr8))
623 kvm_inject_gp(vcpu, 0);
567} 624}
568EXPORT_SYMBOL_GPL(kvm_set_cr8); 625EXPORT_SYMBOL_GPL(kvm_set_cr8);
569 626
@@ -576,7 +633,7 @@ unsigned long kvm_get_cr8(struct kvm_vcpu *vcpu)
576} 633}
577EXPORT_SYMBOL_GPL(kvm_get_cr8); 634EXPORT_SYMBOL_GPL(kvm_get_cr8);
578 635
579int kvm_set_dr(struct kvm_vcpu *vcpu, int dr, unsigned long val) 636static int __kvm_set_dr(struct kvm_vcpu *vcpu, int dr, unsigned long val)
580{ 637{
581 switch (dr) { 638 switch (dr) {
582 case 0 ... 3: 639 case 0 ... 3:
@@ -585,29 +642,21 @@ int kvm_set_dr(struct kvm_vcpu *vcpu, int dr, unsigned long val)
585 vcpu->arch.eff_db[dr] = val; 642 vcpu->arch.eff_db[dr] = val;
586 break; 643 break;
587 case 4: 644 case 4:
588 if (kvm_read_cr4_bits(vcpu, X86_CR4_DE)) { 645 if (kvm_read_cr4_bits(vcpu, X86_CR4_DE))
589 kvm_queue_exception(vcpu, UD_VECTOR); 646 return 1; /* #UD */
590 return 1;
591 }
592 /* fall through */ 647 /* fall through */
593 case 6: 648 case 6:
594 if (val & 0xffffffff00000000ULL) { 649 if (val & 0xffffffff00000000ULL)
595 kvm_inject_gp(vcpu, 0); 650 return -1; /* #GP */
596 return 1;
597 }
598 vcpu->arch.dr6 = (val & DR6_VOLATILE) | DR6_FIXED_1; 651 vcpu->arch.dr6 = (val & DR6_VOLATILE) | DR6_FIXED_1;
599 break; 652 break;
600 case 5: 653 case 5:
601 if (kvm_read_cr4_bits(vcpu, X86_CR4_DE)) { 654 if (kvm_read_cr4_bits(vcpu, X86_CR4_DE))
602 kvm_queue_exception(vcpu, UD_VECTOR); 655 return 1; /* #UD */
603 return 1;
604 }
605 /* fall through */ 656 /* fall through */
606 default: /* 7 */ 657 default: /* 7 */
607 if (val & 0xffffffff00000000ULL) { 658 if (val & 0xffffffff00000000ULL)
608 kvm_inject_gp(vcpu, 0); 659 return -1; /* #GP */
609 return 1;
610 }
611 vcpu->arch.dr7 = (val & DR7_VOLATILE) | DR7_FIXED_1; 660 vcpu->arch.dr7 = (val & DR7_VOLATILE) | DR7_FIXED_1;
612 if (!(vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP)) { 661 if (!(vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP)) {
613 kvm_x86_ops->set_dr7(vcpu, vcpu->arch.dr7); 662 kvm_x86_ops->set_dr7(vcpu, vcpu->arch.dr7);
@@ -618,28 +667,37 @@ int kvm_set_dr(struct kvm_vcpu *vcpu, int dr, unsigned long val)
618 667
619 return 0; 668 return 0;
620} 669}
670
671int kvm_set_dr(struct kvm_vcpu *vcpu, int dr, unsigned long val)
672{
673 int res;
674
675 res = __kvm_set_dr(vcpu, dr, val);
676 if (res > 0)
677 kvm_queue_exception(vcpu, UD_VECTOR);
678 else if (res < 0)
679 kvm_inject_gp(vcpu, 0);
680
681 return res;
682}
621EXPORT_SYMBOL_GPL(kvm_set_dr); 683EXPORT_SYMBOL_GPL(kvm_set_dr);
622 684
623int kvm_get_dr(struct kvm_vcpu *vcpu, int dr, unsigned long *val) 685static int _kvm_get_dr(struct kvm_vcpu *vcpu, int dr, unsigned long *val)
624{ 686{
625 switch (dr) { 687 switch (dr) {
626 case 0 ... 3: 688 case 0 ... 3:
627 *val = vcpu->arch.db[dr]; 689 *val = vcpu->arch.db[dr];
628 break; 690 break;
629 case 4: 691 case 4:
630 if (kvm_read_cr4_bits(vcpu, X86_CR4_DE)) { 692 if (kvm_read_cr4_bits(vcpu, X86_CR4_DE))
631 kvm_queue_exception(vcpu, UD_VECTOR);
632 return 1; 693 return 1;
633 }
634 /* fall through */ 694 /* fall through */
635 case 6: 695 case 6:
636 *val = vcpu->arch.dr6; 696 *val = vcpu->arch.dr6;
637 break; 697 break;
638 case 5: 698 case 5:
639 if (kvm_read_cr4_bits(vcpu, X86_CR4_DE)) { 699 if (kvm_read_cr4_bits(vcpu, X86_CR4_DE))
640 kvm_queue_exception(vcpu, UD_VECTOR);
641 return 1; 700 return 1;
642 }
643 /* fall through */ 701 /* fall through */
644 default: /* 7 */ 702 default: /* 7 */
645 *val = vcpu->arch.dr7; 703 *val = vcpu->arch.dr7;
@@ -648,12 +706,16 @@ int kvm_get_dr(struct kvm_vcpu *vcpu, int dr, unsigned long *val)
648 706
649 return 0; 707 return 0;
650} 708}
651EXPORT_SYMBOL_GPL(kvm_get_dr);
652 709
653static inline u32 bit(int bitno) 710int kvm_get_dr(struct kvm_vcpu *vcpu, int dr, unsigned long *val)
654{ 711{
655 return 1 << (bitno & 31); 712 if (_kvm_get_dr(vcpu, dr, val)) {
713 kvm_queue_exception(vcpu, UD_VECTOR);
714 return 1;
715 }
716 return 0;
656} 717}
718EXPORT_SYMBOL_GPL(kvm_get_dr);
657 719
658/* 720/*
659 * List of msr numbers which we expose to userspace through KVM_GET_MSRS 721 * List of msr numbers which we expose to userspace through KVM_GET_MSRS
@@ -671,7 +733,7 @@ static u32 msrs_to_save[] = {
671 HV_X64_MSR_GUEST_OS_ID, HV_X64_MSR_HYPERCALL, 733 HV_X64_MSR_GUEST_OS_ID, HV_X64_MSR_HYPERCALL,
672 HV_X64_MSR_APIC_ASSIST_PAGE, 734 HV_X64_MSR_APIC_ASSIST_PAGE,
673 MSR_IA32_SYSENTER_CS, MSR_IA32_SYSENTER_ESP, MSR_IA32_SYSENTER_EIP, 735 MSR_IA32_SYSENTER_CS, MSR_IA32_SYSENTER_ESP, MSR_IA32_SYSENTER_EIP,
674 MSR_K6_STAR, 736 MSR_STAR,
675#ifdef CONFIG_X86_64 737#ifdef CONFIG_X86_64
676 MSR_CSTAR, MSR_KERNEL_GS_BASE, MSR_SYSCALL_MASK, MSR_LSTAR, 738 MSR_CSTAR, MSR_KERNEL_GS_BASE, MSR_SYSCALL_MASK, MSR_LSTAR,
677#endif 739#endif
@@ -682,10 +744,14 @@ static unsigned num_msrs_to_save;
682 744
683static u32 emulated_msrs[] = { 745static u32 emulated_msrs[] = {
684 MSR_IA32_MISC_ENABLE, 746 MSR_IA32_MISC_ENABLE,
747 MSR_IA32_MCG_STATUS,
748 MSR_IA32_MCG_CTL,
685}; 749};
686 750
687static int set_efer(struct kvm_vcpu *vcpu, u64 efer) 751static int set_efer(struct kvm_vcpu *vcpu, u64 efer)
688{ 752{
753 u64 old_efer = vcpu->arch.efer;
754
689 if (efer & efer_reserved_bits) 755 if (efer & efer_reserved_bits)
690 return 1; 756 return 1;
691 757
@@ -714,11 +780,13 @@ static int set_efer(struct kvm_vcpu *vcpu, u64 efer)
714 780
715 kvm_x86_ops->set_efer(vcpu, efer); 781 kvm_x86_ops->set_efer(vcpu, efer);
716 782
717 vcpu->arch.efer = efer;
718
719 vcpu->arch.mmu.base_role.nxe = (efer & EFER_NX) && !tdp_enabled; 783 vcpu->arch.mmu.base_role.nxe = (efer & EFER_NX) && !tdp_enabled;
720 kvm_mmu_reset_context(vcpu); 784 kvm_mmu_reset_context(vcpu);
721 785
786 /* Update reserved bits */
787 if ((efer ^ old_efer) & EFER_NX)
788 kvm_mmu_reset_context(vcpu);
789
722 return 0; 790 return 0;
723} 791}
724 792
@@ -882,7 +950,7 @@ static int kvm_request_guest_time_update(struct kvm_vcpu *v)
882 950
883 if (!vcpu->time_page) 951 if (!vcpu->time_page)
884 return 0; 952 return 0;
885 set_bit(KVM_REQ_KVMCLOCK_UPDATE, &v->requests); 953 kvm_make_request(KVM_REQ_KVMCLOCK_UPDATE, v);
886 return 1; 954 return 1;
887} 955}
888 956
@@ -1524,16 +1592,12 @@ static int __msr_io(struct kvm_vcpu *vcpu, struct kvm_msrs *msrs,
1524{ 1592{
1525 int i, idx; 1593 int i, idx;
1526 1594
1527 vcpu_load(vcpu);
1528
1529 idx = srcu_read_lock(&vcpu->kvm->srcu); 1595 idx = srcu_read_lock(&vcpu->kvm->srcu);
1530 for (i = 0; i < msrs->nmsrs; ++i) 1596 for (i = 0; i < msrs->nmsrs; ++i)
1531 if (do_msr(vcpu, entries[i].index, &entries[i].data)) 1597 if (do_msr(vcpu, entries[i].index, &entries[i].data))
1532 break; 1598 break;
1533 srcu_read_unlock(&vcpu->kvm->srcu, idx); 1599 srcu_read_unlock(&vcpu->kvm->srcu, idx);
1534 1600
1535 vcpu_put(vcpu);
1536
1537 return i; 1601 return i;
1538} 1602}
1539 1603
@@ -1618,6 +1682,7 @@ int kvm_dev_ioctl_check_extension(long ext)
1618 case KVM_CAP_PCI_SEGMENT: 1682 case KVM_CAP_PCI_SEGMENT:
1619 case KVM_CAP_DEBUGREGS: 1683 case KVM_CAP_DEBUGREGS:
1620 case KVM_CAP_X86_ROBUST_SINGLESTEP: 1684 case KVM_CAP_X86_ROBUST_SINGLESTEP:
1685 case KVM_CAP_XSAVE:
1621 r = 1; 1686 r = 1;
1622 break; 1687 break;
1623 case KVM_CAP_COALESCED_MMIO: 1688 case KVM_CAP_COALESCED_MMIO:
@@ -1641,6 +1706,9 @@ int kvm_dev_ioctl_check_extension(long ext)
1641 case KVM_CAP_MCE: 1706 case KVM_CAP_MCE:
1642 r = KVM_MAX_MCE_BANKS; 1707 r = KVM_MAX_MCE_BANKS;
1643 break; 1708 break;
1709 case KVM_CAP_XCRS:
1710 r = cpu_has_xsave;
1711 break;
1644 default: 1712 default:
1645 r = 0; 1713 r = 0;
1646 break; 1714 break;
@@ -1717,8 +1785,28 @@ out:
1717 return r; 1785 return r;
1718} 1786}
1719 1787
1788static void wbinvd_ipi(void *garbage)
1789{
1790 wbinvd();
1791}
1792
1793static bool need_emulate_wbinvd(struct kvm_vcpu *vcpu)
1794{
1795 return vcpu->kvm->arch.iommu_domain &&
1796 !(vcpu->kvm->arch.iommu_flags & KVM_IOMMU_CACHE_COHERENCY);
1797}
1798
1720void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu) 1799void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
1721{ 1800{
1801 /* Address WBINVD may be executed by guest */
1802 if (need_emulate_wbinvd(vcpu)) {
1803 if (kvm_x86_ops->has_wbinvd_exit())
1804 cpumask_set_cpu(cpu, vcpu->arch.wbinvd_dirty_mask);
1805 else if (vcpu->cpu != -1 && vcpu->cpu != cpu)
1806 smp_call_function_single(vcpu->cpu,
1807 wbinvd_ipi, NULL, 1);
1808 }
1809
1722 kvm_x86_ops->vcpu_load(vcpu, cpu); 1810 kvm_x86_ops->vcpu_load(vcpu, cpu);
1723 if (unlikely(per_cpu(cpu_tsc_khz, cpu) == 0)) { 1811 if (unlikely(per_cpu(cpu_tsc_khz, cpu) == 0)) {
1724 unsigned long khz = cpufreq_quick_get(cpu); 1812 unsigned long khz = cpufreq_quick_get(cpu);
@@ -1731,8 +1819,8 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
1731 1819
1732void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) 1820void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu)
1733{ 1821{
1734 kvm_put_guest_fpu(vcpu);
1735 kvm_x86_ops->vcpu_put(vcpu); 1822 kvm_x86_ops->vcpu_put(vcpu);
1823 kvm_put_guest_fpu(vcpu);
1736} 1824}
1737 1825
1738static int is_efer_nx(void) 1826static int is_efer_nx(void)
@@ -1781,7 +1869,6 @@ static int kvm_vcpu_ioctl_set_cpuid(struct kvm_vcpu *vcpu,
1781 if (copy_from_user(cpuid_entries, entries, 1869 if (copy_from_user(cpuid_entries, entries,
1782 cpuid->nent * sizeof(struct kvm_cpuid_entry))) 1870 cpuid->nent * sizeof(struct kvm_cpuid_entry)))
1783 goto out_free; 1871 goto out_free;
1784 vcpu_load(vcpu);
1785 for (i = 0; i < cpuid->nent; i++) { 1872 for (i = 0; i < cpuid->nent; i++) {
1786 vcpu->arch.cpuid_entries[i].function = cpuid_entries[i].function; 1873 vcpu->arch.cpuid_entries[i].function = cpuid_entries[i].function;
1787 vcpu->arch.cpuid_entries[i].eax = cpuid_entries[i].eax; 1874 vcpu->arch.cpuid_entries[i].eax = cpuid_entries[i].eax;
@@ -1799,7 +1886,7 @@ static int kvm_vcpu_ioctl_set_cpuid(struct kvm_vcpu *vcpu,
1799 r = 0; 1886 r = 0;
1800 kvm_apic_set_version(vcpu); 1887 kvm_apic_set_version(vcpu);
1801 kvm_x86_ops->cpuid_update(vcpu); 1888 kvm_x86_ops->cpuid_update(vcpu);
1802 vcpu_put(vcpu); 1889 update_cpuid(vcpu);
1803 1890
1804out_free: 1891out_free:
1805 vfree(cpuid_entries); 1892 vfree(cpuid_entries);
@@ -1820,11 +1907,10 @@ static int kvm_vcpu_ioctl_set_cpuid2(struct kvm_vcpu *vcpu,
1820 if (copy_from_user(&vcpu->arch.cpuid_entries, entries, 1907 if (copy_from_user(&vcpu->arch.cpuid_entries, entries,
1821 cpuid->nent * sizeof(struct kvm_cpuid_entry2))) 1908 cpuid->nent * sizeof(struct kvm_cpuid_entry2)))
1822 goto out; 1909 goto out;
1823 vcpu_load(vcpu);
1824 vcpu->arch.cpuid_nent = cpuid->nent; 1910 vcpu->arch.cpuid_nent = cpuid->nent;
1825 kvm_apic_set_version(vcpu); 1911 kvm_apic_set_version(vcpu);
1826 kvm_x86_ops->cpuid_update(vcpu); 1912 kvm_x86_ops->cpuid_update(vcpu);
1827 vcpu_put(vcpu); 1913 update_cpuid(vcpu);
1828 return 0; 1914 return 0;
1829 1915
1830out: 1916out:
@@ -1837,7 +1923,6 @@ static int kvm_vcpu_ioctl_get_cpuid2(struct kvm_vcpu *vcpu,
1837{ 1923{
1838 int r; 1924 int r;
1839 1925
1840 vcpu_load(vcpu);
1841 r = -E2BIG; 1926 r = -E2BIG;
1842 if (cpuid->nent < vcpu->arch.cpuid_nent) 1927 if (cpuid->nent < vcpu->arch.cpuid_nent)
1843 goto out; 1928 goto out;
@@ -1849,7 +1934,6 @@ static int kvm_vcpu_ioctl_get_cpuid2(struct kvm_vcpu *vcpu,
1849 1934
1850out: 1935out:
1851 cpuid->nent = vcpu->arch.cpuid_nent; 1936 cpuid->nent = vcpu->arch.cpuid_nent;
1852 vcpu_put(vcpu);
1853 return r; 1937 return r;
1854} 1938}
1855 1939
@@ -1901,13 +1985,13 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
1901 0 /* Reserved */ | f_lm | F(3DNOWEXT) | F(3DNOW); 1985 0 /* Reserved */ | f_lm | F(3DNOWEXT) | F(3DNOW);
1902 /* cpuid 1.ecx */ 1986 /* cpuid 1.ecx */
1903 const u32 kvm_supported_word4_x86_features = 1987 const u32 kvm_supported_word4_x86_features =
1904 F(XMM3) | 0 /* Reserved, DTES64, MONITOR */ | 1988 F(XMM3) | F(PCLMULQDQ) | 0 /* DTES64, MONITOR */ |
1905 0 /* DS-CPL, VMX, SMX, EST */ | 1989 0 /* DS-CPL, VMX, SMX, EST */ |
1906 0 /* TM2 */ | F(SSSE3) | 0 /* CNXT-ID */ | 0 /* Reserved */ | 1990 0 /* TM2 */ | F(SSSE3) | 0 /* CNXT-ID */ | 0 /* Reserved */ |
1907 0 /* Reserved */ | F(CX16) | 0 /* xTPR Update, PDCM */ | 1991 0 /* Reserved */ | F(CX16) | 0 /* xTPR Update, PDCM */ |
1908 0 /* Reserved, DCA */ | F(XMM4_1) | 1992 0 /* Reserved, DCA */ | F(XMM4_1) |
1909 F(XMM4_2) | F(X2APIC) | F(MOVBE) | F(POPCNT) | 1993 F(XMM4_2) | F(X2APIC) | F(MOVBE) | F(POPCNT) |
1910 0 /* Reserved, XSAVE, OSXSAVE */; 1994 0 /* Reserved, AES */ | F(XSAVE) | 0 /* OSXSAVE */ | F(AVX);
1911 /* cpuid 0x80000001.ecx */ 1995 /* cpuid 0x80000001.ecx */
1912 const u32 kvm_supported_word6_x86_features = 1996 const u32 kvm_supported_word6_x86_features =
1913 F(LAHF_LM) | F(CMP_LEGACY) | F(SVM) | 0 /* ExtApicSpace */ | 1997 F(LAHF_LM) | F(CMP_LEGACY) | F(SVM) | 0 /* ExtApicSpace */ |
@@ -1922,7 +2006,7 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
1922 2006
1923 switch (function) { 2007 switch (function) {
1924 case 0: 2008 case 0:
1925 entry->eax = min(entry->eax, (u32)0xb); 2009 entry->eax = min(entry->eax, (u32)0xd);
1926 break; 2010 break;
1927 case 1: 2011 case 1:
1928 entry->edx &= kvm_supported_word0_x86_features; 2012 entry->edx &= kvm_supported_word0_x86_features;
@@ -1980,6 +2064,20 @@ static void do_cpuid_ent(struct kvm_cpuid_entry2 *entry, u32 function,
1980 } 2064 }
1981 break; 2065 break;
1982 } 2066 }
2067 case 0xd: {
2068 int i;
2069
2070 entry->flags |= KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
2071 for (i = 1; *nent < maxnent; ++i) {
2072 if (entry[i - 1].eax == 0 && i != 2)
2073 break;
2074 do_cpuid_1_ent(&entry[i], function, i);
2075 entry[i].flags |=
2076 KVM_CPUID_FLAG_SIGNIFCANT_INDEX;
2077 ++*nent;
2078 }
2079 break;
2080 }
1983 case KVM_CPUID_SIGNATURE: { 2081 case KVM_CPUID_SIGNATURE: {
1984 char signature[12] = "KVMKVMKVM\0\0"; 2082 char signature[12] = "KVMKVMKVM\0\0";
1985 u32 *sigptr = (u32 *)signature; 2083 u32 *sigptr = (u32 *)signature;
@@ -2081,9 +2179,7 @@ out:
2081static int kvm_vcpu_ioctl_get_lapic(struct kvm_vcpu *vcpu, 2179static int kvm_vcpu_ioctl_get_lapic(struct kvm_vcpu *vcpu,
2082 struct kvm_lapic_state *s) 2180 struct kvm_lapic_state *s)
2083{ 2181{
2084 vcpu_load(vcpu);
2085 memcpy(s->regs, vcpu->arch.apic->regs, sizeof *s); 2182 memcpy(s->regs, vcpu->arch.apic->regs, sizeof *s);
2086 vcpu_put(vcpu);
2087 2183
2088 return 0; 2184 return 0;
2089} 2185}
@@ -2091,11 +2187,9 @@ static int kvm_vcpu_ioctl_get_lapic(struct kvm_vcpu *vcpu,
2091static int kvm_vcpu_ioctl_set_lapic(struct kvm_vcpu *vcpu, 2187static int kvm_vcpu_ioctl_set_lapic(struct kvm_vcpu *vcpu,
2092 struct kvm_lapic_state *s) 2188 struct kvm_lapic_state *s)
2093{ 2189{
2094 vcpu_load(vcpu);
2095 memcpy(vcpu->arch.apic->regs, s->regs, sizeof *s); 2190 memcpy(vcpu->arch.apic->regs, s->regs, sizeof *s);
2096 kvm_apic_post_state_restore(vcpu); 2191 kvm_apic_post_state_restore(vcpu);
2097 update_cr8_intercept(vcpu); 2192 update_cr8_intercept(vcpu);
2098 vcpu_put(vcpu);
2099 2193
2100 return 0; 2194 return 0;
2101} 2195}
@@ -2107,20 +2201,15 @@ static int kvm_vcpu_ioctl_interrupt(struct kvm_vcpu *vcpu,
2107 return -EINVAL; 2201 return -EINVAL;
2108 if (irqchip_in_kernel(vcpu->kvm)) 2202 if (irqchip_in_kernel(vcpu->kvm))
2109 return -ENXIO; 2203 return -ENXIO;
2110 vcpu_load(vcpu);
2111 2204
2112 kvm_queue_interrupt(vcpu, irq->irq, false); 2205 kvm_queue_interrupt(vcpu, irq->irq, false);
2113 2206
2114 vcpu_put(vcpu);
2115
2116 return 0; 2207 return 0;
2117} 2208}
2118 2209
2119static int kvm_vcpu_ioctl_nmi(struct kvm_vcpu *vcpu) 2210static int kvm_vcpu_ioctl_nmi(struct kvm_vcpu *vcpu)
2120{ 2211{
2121 vcpu_load(vcpu);
2122 kvm_inject_nmi(vcpu); 2212 kvm_inject_nmi(vcpu);
2123 vcpu_put(vcpu);
2124 2213
2125 return 0; 2214 return 0;
2126} 2215}
@@ -2140,7 +2229,6 @@ static int kvm_vcpu_ioctl_x86_setup_mce(struct kvm_vcpu *vcpu,
2140 int r; 2229 int r;
2141 unsigned bank_num = mcg_cap & 0xff, bank; 2230 unsigned bank_num = mcg_cap & 0xff, bank;
2142 2231
2143 vcpu_load(vcpu);
2144 r = -EINVAL; 2232 r = -EINVAL;
2145 if (!bank_num || bank_num >= KVM_MAX_MCE_BANKS) 2233 if (!bank_num || bank_num >= KVM_MAX_MCE_BANKS)
2146 goto out; 2234 goto out;
@@ -2155,7 +2243,6 @@ static int kvm_vcpu_ioctl_x86_setup_mce(struct kvm_vcpu *vcpu,
2155 for (bank = 0; bank < bank_num; bank++) 2243 for (bank = 0; bank < bank_num; bank++)
2156 vcpu->arch.mce_banks[bank*4] = ~(u64)0; 2244 vcpu->arch.mce_banks[bank*4] = ~(u64)0;
2157out: 2245out:
2158 vcpu_put(vcpu);
2159 return r; 2246 return r;
2160} 2247}
2161 2248
@@ -2188,7 +2275,7 @@ static int kvm_vcpu_ioctl_x86_set_mce(struct kvm_vcpu *vcpu,
2188 printk(KERN_DEBUG "kvm: set_mce: " 2275 printk(KERN_DEBUG "kvm: set_mce: "
2189 "injects mce exception while " 2276 "injects mce exception while "
2190 "previous one is in progress!\n"); 2277 "previous one is in progress!\n");
2191 set_bit(KVM_REQ_TRIPLE_FAULT, &vcpu->requests); 2278 kvm_make_request(KVM_REQ_TRIPLE_FAULT, vcpu);
2192 return 0; 2279 return 0;
2193 } 2280 }
2194 if (banks[1] & MCI_STATUS_VAL) 2281 if (banks[1] & MCI_STATUS_VAL)
@@ -2213,8 +2300,6 @@ static int kvm_vcpu_ioctl_x86_set_mce(struct kvm_vcpu *vcpu,
2213static void kvm_vcpu_ioctl_x86_get_vcpu_events(struct kvm_vcpu *vcpu, 2300static void kvm_vcpu_ioctl_x86_get_vcpu_events(struct kvm_vcpu *vcpu,
2214 struct kvm_vcpu_events *events) 2301 struct kvm_vcpu_events *events)
2215{ 2302{
2216 vcpu_load(vcpu);
2217
2218 events->exception.injected = 2303 events->exception.injected =
2219 vcpu->arch.exception.pending && 2304 vcpu->arch.exception.pending &&
2220 !kvm_exception_is_soft(vcpu->arch.exception.nr); 2305 !kvm_exception_is_soft(vcpu->arch.exception.nr);
@@ -2239,8 +2324,6 @@ static void kvm_vcpu_ioctl_x86_get_vcpu_events(struct kvm_vcpu *vcpu,
2239 events->flags = (KVM_VCPUEVENT_VALID_NMI_PENDING 2324 events->flags = (KVM_VCPUEVENT_VALID_NMI_PENDING
2240 | KVM_VCPUEVENT_VALID_SIPI_VECTOR 2325 | KVM_VCPUEVENT_VALID_SIPI_VECTOR
2241 | KVM_VCPUEVENT_VALID_SHADOW); 2326 | KVM_VCPUEVENT_VALID_SHADOW);
2242
2243 vcpu_put(vcpu);
2244} 2327}
2245 2328
2246static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu, 2329static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu,
@@ -2251,8 +2334,6 @@ static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu,
2251 | KVM_VCPUEVENT_VALID_SHADOW)) 2334 | KVM_VCPUEVENT_VALID_SHADOW))
2252 return -EINVAL; 2335 return -EINVAL;
2253 2336
2254 vcpu_load(vcpu);
2255
2256 vcpu->arch.exception.pending = events->exception.injected; 2337 vcpu->arch.exception.pending = events->exception.injected;
2257 vcpu->arch.exception.nr = events->exception.nr; 2338 vcpu->arch.exception.nr = events->exception.nr;
2258 vcpu->arch.exception.has_error_code = events->exception.has_error_code; 2339 vcpu->arch.exception.has_error_code = events->exception.has_error_code;
@@ -2275,22 +2356,16 @@ static int kvm_vcpu_ioctl_x86_set_vcpu_events(struct kvm_vcpu *vcpu,
2275 if (events->flags & KVM_VCPUEVENT_VALID_SIPI_VECTOR) 2356 if (events->flags & KVM_VCPUEVENT_VALID_SIPI_VECTOR)
2276 vcpu->arch.sipi_vector = events->sipi_vector; 2357 vcpu->arch.sipi_vector = events->sipi_vector;
2277 2358
2278 vcpu_put(vcpu);
2279
2280 return 0; 2359 return 0;
2281} 2360}
2282 2361
2283static void kvm_vcpu_ioctl_x86_get_debugregs(struct kvm_vcpu *vcpu, 2362static void kvm_vcpu_ioctl_x86_get_debugregs(struct kvm_vcpu *vcpu,
2284 struct kvm_debugregs *dbgregs) 2363 struct kvm_debugregs *dbgregs)
2285{ 2364{
2286 vcpu_load(vcpu);
2287
2288 memcpy(dbgregs->db, vcpu->arch.db, sizeof(vcpu->arch.db)); 2365 memcpy(dbgregs->db, vcpu->arch.db, sizeof(vcpu->arch.db));
2289 dbgregs->dr6 = vcpu->arch.dr6; 2366 dbgregs->dr6 = vcpu->arch.dr6;
2290 dbgregs->dr7 = vcpu->arch.dr7; 2367 dbgregs->dr7 = vcpu->arch.dr7;
2291 dbgregs->flags = 0; 2368 dbgregs->flags = 0;
2292
2293 vcpu_put(vcpu);
2294} 2369}
2295 2370
2296static int kvm_vcpu_ioctl_x86_set_debugregs(struct kvm_vcpu *vcpu, 2371static int kvm_vcpu_ioctl_x86_set_debugregs(struct kvm_vcpu *vcpu,
@@ -2299,40 +2374,113 @@ static int kvm_vcpu_ioctl_x86_set_debugregs(struct kvm_vcpu *vcpu,
2299 if (dbgregs->flags) 2374 if (dbgregs->flags)
2300 return -EINVAL; 2375 return -EINVAL;
2301 2376
2302 vcpu_load(vcpu);
2303
2304 memcpy(vcpu->arch.db, dbgregs->db, sizeof(vcpu->arch.db)); 2377 memcpy(vcpu->arch.db, dbgregs->db, sizeof(vcpu->arch.db));
2305 vcpu->arch.dr6 = dbgregs->dr6; 2378 vcpu->arch.dr6 = dbgregs->dr6;
2306 vcpu->arch.dr7 = dbgregs->dr7; 2379 vcpu->arch.dr7 = dbgregs->dr7;
2307 2380
2308 vcpu_put(vcpu); 2381 return 0;
2382}
2383
2384static void kvm_vcpu_ioctl_x86_get_xsave(struct kvm_vcpu *vcpu,
2385 struct kvm_xsave *guest_xsave)
2386{
2387 if (cpu_has_xsave)
2388 memcpy(guest_xsave->region,
2389 &vcpu->arch.guest_fpu.state->xsave,
2390 sizeof(struct xsave_struct));
2391 else {
2392 memcpy(guest_xsave->region,
2393 &vcpu->arch.guest_fpu.state->fxsave,
2394 sizeof(struct i387_fxsave_struct));
2395 *(u64 *)&guest_xsave->region[XSAVE_HDR_OFFSET / sizeof(u32)] =
2396 XSTATE_FPSSE;
2397 }
2398}
2399
2400static int kvm_vcpu_ioctl_x86_set_xsave(struct kvm_vcpu *vcpu,
2401 struct kvm_xsave *guest_xsave)
2402{
2403 u64 xstate_bv =
2404 *(u64 *)&guest_xsave->region[XSAVE_HDR_OFFSET / sizeof(u32)];
2309 2405
2406 if (cpu_has_xsave)
2407 memcpy(&vcpu->arch.guest_fpu.state->xsave,
2408 guest_xsave->region, sizeof(struct xsave_struct));
2409 else {
2410 if (xstate_bv & ~XSTATE_FPSSE)
2411 return -EINVAL;
2412 memcpy(&vcpu->arch.guest_fpu.state->fxsave,
2413 guest_xsave->region, sizeof(struct i387_fxsave_struct));
2414 }
2310 return 0; 2415 return 0;
2311} 2416}
2312 2417
2418static void kvm_vcpu_ioctl_x86_get_xcrs(struct kvm_vcpu *vcpu,
2419 struct kvm_xcrs *guest_xcrs)
2420{
2421 if (!cpu_has_xsave) {
2422 guest_xcrs->nr_xcrs = 0;
2423 return;
2424 }
2425
2426 guest_xcrs->nr_xcrs = 1;
2427 guest_xcrs->flags = 0;
2428 guest_xcrs->xcrs[0].xcr = XCR_XFEATURE_ENABLED_MASK;
2429 guest_xcrs->xcrs[0].value = vcpu->arch.xcr0;
2430}
2431
2432static int kvm_vcpu_ioctl_x86_set_xcrs(struct kvm_vcpu *vcpu,
2433 struct kvm_xcrs *guest_xcrs)
2434{
2435 int i, r = 0;
2436
2437 if (!cpu_has_xsave)
2438 return -EINVAL;
2439
2440 if (guest_xcrs->nr_xcrs > KVM_MAX_XCRS || guest_xcrs->flags)
2441 return -EINVAL;
2442
2443 for (i = 0; i < guest_xcrs->nr_xcrs; i++)
2444 /* Only support XCR0 currently */
2445 if (guest_xcrs->xcrs[0].xcr == XCR_XFEATURE_ENABLED_MASK) {
2446 r = __kvm_set_xcr(vcpu, XCR_XFEATURE_ENABLED_MASK,
2447 guest_xcrs->xcrs[0].value);
2448 break;
2449 }
2450 if (r)
2451 r = -EINVAL;
2452 return r;
2453}
2454
2313long kvm_arch_vcpu_ioctl(struct file *filp, 2455long kvm_arch_vcpu_ioctl(struct file *filp,
2314 unsigned int ioctl, unsigned long arg) 2456 unsigned int ioctl, unsigned long arg)
2315{ 2457{
2316 struct kvm_vcpu *vcpu = filp->private_data; 2458 struct kvm_vcpu *vcpu = filp->private_data;
2317 void __user *argp = (void __user *)arg; 2459 void __user *argp = (void __user *)arg;
2318 int r; 2460 int r;
2319 struct kvm_lapic_state *lapic = NULL; 2461 union {
2462 struct kvm_lapic_state *lapic;
2463 struct kvm_xsave *xsave;
2464 struct kvm_xcrs *xcrs;
2465 void *buffer;
2466 } u;
2320 2467
2468 u.buffer = NULL;
2321 switch (ioctl) { 2469 switch (ioctl) {
2322 case KVM_GET_LAPIC: { 2470 case KVM_GET_LAPIC: {
2323 r = -EINVAL; 2471 r = -EINVAL;
2324 if (!vcpu->arch.apic) 2472 if (!vcpu->arch.apic)
2325 goto out; 2473 goto out;
2326 lapic = kzalloc(sizeof(struct kvm_lapic_state), GFP_KERNEL); 2474 u.lapic = kzalloc(sizeof(struct kvm_lapic_state), GFP_KERNEL);
2327 2475
2328 r = -ENOMEM; 2476 r = -ENOMEM;
2329 if (!lapic) 2477 if (!u.lapic)
2330 goto out; 2478 goto out;
2331 r = kvm_vcpu_ioctl_get_lapic(vcpu, lapic); 2479 r = kvm_vcpu_ioctl_get_lapic(vcpu, u.lapic);
2332 if (r) 2480 if (r)
2333 goto out; 2481 goto out;
2334 r = -EFAULT; 2482 r = -EFAULT;
2335 if (copy_to_user(argp, lapic, sizeof(struct kvm_lapic_state))) 2483 if (copy_to_user(argp, u.lapic, sizeof(struct kvm_lapic_state)))
2336 goto out; 2484 goto out;
2337 r = 0; 2485 r = 0;
2338 break; 2486 break;
@@ -2341,14 +2489,14 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
2341 r = -EINVAL; 2489 r = -EINVAL;
2342 if (!vcpu->arch.apic) 2490 if (!vcpu->arch.apic)
2343 goto out; 2491 goto out;
2344 lapic = kmalloc(sizeof(struct kvm_lapic_state), GFP_KERNEL); 2492 u.lapic = kmalloc(sizeof(struct kvm_lapic_state), GFP_KERNEL);
2345 r = -ENOMEM; 2493 r = -ENOMEM;
2346 if (!lapic) 2494 if (!u.lapic)
2347 goto out; 2495 goto out;
2348 r = -EFAULT; 2496 r = -EFAULT;
2349 if (copy_from_user(lapic, argp, sizeof(struct kvm_lapic_state))) 2497 if (copy_from_user(u.lapic, argp, sizeof(struct kvm_lapic_state)))
2350 goto out; 2498 goto out;
2351 r = kvm_vcpu_ioctl_set_lapic(vcpu, lapic); 2499 r = kvm_vcpu_ioctl_set_lapic(vcpu, u.lapic);
2352 if (r) 2500 if (r)
2353 goto out; 2501 goto out;
2354 r = 0; 2502 r = 0;
@@ -2464,9 +2612,7 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
2464 r = -EFAULT; 2612 r = -EFAULT;
2465 if (copy_from_user(&mce, argp, sizeof mce)) 2613 if (copy_from_user(&mce, argp, sizeof mce))
2466 goto out; 2614 goto out;
2467 vcpu_load(vcpu);
2468 r = kvm_vcpu_ioctl_x86_set_mce(vcpu, &mce); 2615 r = kvm_vcpu_ioctl_x86_set_mce(vcpu, &mce);
2469 vcpu_put(vcpu);
2470 break; 2616 break;
2471 } 2617 }
2472 case KVM_GET_VCPU_EVENTS: { 2618 case KVM_GET_VCPU_EVENTS: {
@@ -2513,11 +2659,67 @@ long kvm_arch_vcpu_ioctl(struct file *filp,
2513 r = kvm_vcpu_ioctl_x86_set_debugregs(vcpu, &dbgregs); 2659 r = kvm_vcpu_ioctl_x86_set_debugregs(vcpu, &dbgregs);
2514 break; 2660 break;
2515 } 2661 }
2662 case KVM_GET_XSAVE: {
2663 u.xsave = kzalloc(sizeof(struct kvm_xsave), GFP_KERNEL);
2664 r = -ENOMEM;
2665 if (!u.xsave)
2666 break;
2667
2668 kvm_vcpu_ioctl_x86_get_xsave(vcpu, u.xsave);
2669
2670 r = -EFAULT;
2671 if (copy_to_user(argp, u.xsave, sizeof(struct kvm_xsave)))
2672 break;
2673 r = 0;
2674 break;
2675 }
2676 case KVM_SET_XSAVE: {
2677 u.xsave = kzalloc(sizeof(struct kvm_xsave), GFP_KERNEL);
2678 r = -ENOMEM;
2679 if (!u.xsave)
2680 break;
2681
2682 r = -EFAULT;
2683 if (copy_from_user(u.xsave, argp, sizeof(struct kvm_xsave)))
2684 break;
2685
2686 r = kvm_vcpu_ioctl_x86_set_xsave(vcpu, u.xsave);
2687 break;
2688 }
2689 case KVM_GET_XCRS: {
2690 u.xcrs = kzalloc(sizeof(struct kvm_xcrs), GFP_KERNEL);
2691 r = -ENOMEM;
2692 if (!u.xcrs)
2693 break;
2694
2695 kvm_vcpu_ioctl_x86_get_xcrs(vcpu, u.xcrs);
2696
2697 r = -EFAULT;
2698 if (copy_to_user(argp, u.xcrs,
2699 sizeof(struct kvm_xcrs)))
2700 break;
2701 r = 0;
2702 break;
2703 }
2704 case KVM_SET_XCRS: {
2705 u.xcrs = kzalloc(sizeof(struct kvm_xcrs), GFP_KERNEL);
2706 r = -ENOMEM;
2707 if (!u.xcrs)
2708 break;
2709
2710 r = -EFAULT;
2711 if (copy_from_user(u.xcrs, argp,
2712 sizeof(struct kvm_xcrs)))
2713 break;
2714
2715 r = kvm_vcpu_ioctl_x86_set_xcrs(vcpu, u.xcrs);
2716 break;
2717 }
2516 default: 2718 default:
2517 r = -EINVAL; 2719 r = -EINVAL;
2518 } 2720 }
2519out: 2721out:
2520 kfree(lapic); 2722 kfree(u.buffer);
2521 return r; 2723 return r;
2522} 2724}
2523 2725
@@ -2560,115 +2762,6 @@ static int kvm_vm_ioctl_get_nr_mmu_pages(struct kvm *kvm)
2560 return kvm->arch.n_alloc_mmu_pages; 2762 return kvm->arch.n_alloc_mmu_pages;
2561} 2763}
2562 2764
2563gfn_t unalias_gfn_instantiation(struct kvm *kvm, gfn_t gfn)
2564{
2565 int i;
2566 struct kvm_mem_alias *alias;
2567 struct kvm_mem_aliases *aliases;
2568
2569 aliases = kvm_aliases(kvm);
2570
2571 for (i = 0; i < aliases->naliases; ++i) {
2572 alias = &aliases->aliases[i];
2573 if (alias->flags & KVM_ALIAS_INVALID)
2574 continue;
2575 if (gfn >= alias->base_gfn
2576 && gfn < alias->base_gfn + alias->npages)
2577 return alias->target_gfn + gfn - alias->base_gfn;
2578 }
2579 return gfn;
2580}
2581
2582gfn_t unalias_gfn(struct kvm *kvm, gfn_t gfn)
2583{
2584 int i;
2585 struct kvm_mem_alias *alias;
2586 struct kvm_mem_aliases *aliases;
2587
2588 aliases = kvm_aliases(kvm);
2589
2590 for (i = 0; i < aliases->naliases; ++i) {
2591 alias = &aliases->aliases[i];
2592 if (gfn >= alias->base_gfn
2593 && gfn < alias->base_gfn + alias->npages)
2594 return alias->target_gfn + gfn - alias->base_gfn;
2595 }
2596 return gfn;
2597}
2598
2599/*
2600 * Set a new alias region. Aliases map a portion of physical memory into
2601 * another portion. This is useful for memory windows, for example the PC
2602 * VGA region.
2603 */
2604static int kvm_vm_ioctl_set_memory_alias(struct kvm *kvm,
2605 struct kvm_memory_alias *alias)
2606{
2607 int r, n;
2608 struct kvm_mem_alias *p;
2609 struct kvm_mem_aliases *aliases, *old_aliases;
2610
2611 r = -EINVAL;
2612 /* General sanity checks */
2613 if (alias->memory_size & (PAGE_SIZE - 1))
2614 goto out;
2615 if (alias->guest_phys_addr & (PAGE_SIZE - 1))
2616 goto out;
2617 if (alias->slot >= KVM_ALIAS_SLOTS)
2618 goto out;
2619 if (alias->guest_phys_addr + alias->memory_size
2620 < alias->guest_phys_addr)
2621 goto out;
2622 if (alias->target_phys_addr + alias->memory_size
2623 < alias->target_phys_addr)
2624 goto out;
2625
2626 r = -ENOMEM;
2627 aliases = kzalloc(sizeof(struct kvm_mem_aliases), GFP_KERNEL);
2628 if (!aliases)
2629 goto out;
2630
2631 mutex_lock(&kvm->slots_lock);
2632
2633 /* invalidate any gfn reference in case of deletion/shrinking */
2634 memcpy(aliases, kvm->arch.aliases, sizeof(struct kvm_mem_aliases));
2635 aliases->aliases[alias->slot].flags |= KVM_ALIAS_INVALID;
2636 old_aliases = kvm->arch.aliases;
2637 rcu_assign_pointer(kvm->arch.aliases, aliases);
2638 synchronize_srcu_expedited(&kvm->srcu);
2639 kvm_mmu_zap_all(kvm);
2640 kfree(old_aliases);
2641
2642 r = -ENOMEM;
2643 aliases = kzalloc(sizeof(struct kvm_mem_aliases), GFP_KERNEL);
2644 if (!aliases)
2645 goto out_unlock;
2646
2647 memcpy(aliases, kvm->arch.aliases, sizeof(struct kvm_mem_aliases));
2648
2649 p = &aliases->aliases[alias->slot];
2650 p->base_gfn = alias->guest_phys_addr >> PAGE_SHIFT;
2651 p->npages = alias->memory_size >> PAGE_SHIFT;
2652 p->target_gfn = alias->target_phys_addr >> PAGE_SHIFT;
2653 p->flags &= ~(KVM_ALIAS_INVALID);
2654
2655 for (n = KVM_ALIAS_SLOTS; n > 0; --n)
2656 if (aliases->aliases[n - 1].npages)
2657 break;
2658 aliases->naliases = n;
2659
2660 old_aliases = kvm->arch.aliases;
2661 rcu_assign_pointer(kvm->arch.aliases, aliases);
2662 synchronize_srcu_expedited(&kvm->srcu);
2663 kfree(old_aliases);
2664 r = 0;
2665
2666out_unlock:
2667 mutex_unlock(&kvm->slots_lock);
2668out:
2669 return r;
2670}
2671
2672static int kvm_vm_ioctl_get_irqchip(struct kvm *kvm, struct kvm_irqchip *chip) 2765static int kvm_vm_ioctl_get_irqchip(struct kvm *kvm, struct kvm_irqchip *chip)
2673{ 2766{
2674 int r; 2767 int r;
@@ -2797,7 +2890,6 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
2797 struct kvm_memory_slot *memslot; 2890 struct kvm_memory_slot *memslot;
2798 unsigned long n; 2891 unsigned long n;
2799 unsigned long is_dirty = 0; 2892 unsigned long is_dirty = 0;
2800 unsigned long *dirty_bitmap = NULL;
2801 2893
2802 mutex_lock(&kvm->slots_lock); 2894 mutex_lock(&kvm->slots_lock);
2803 2895
@@ -2812,27 +2904,30 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
2812 2904
2813 n = kvm_dirty_bitmap_bytes(memslot); 2905 n = kvm_dirty_bitmap_bytes(memslot);
2814 2906
2815 r = -ENOMEM;
2816 dirty_bitmap = vmalloc(n);
2817 if (!dirty_bitmap)
2818 goto out;
2819 memset(dirty_bitmap, 0, n);
2820
2821 for (i = 0; !is_dirty && i < n/sizeof(long); i++) 2907 for (i = 0; !is_dirty && i < n/sizeof(long); i++)
2822 is_dirty = memslot->dirty_bitmap[i]; 2908 is_dirty = memslot->dirty_bitmap[i];
2823 2909
2824 /* If nothing is dirty, don't bother messing with page tables. */ 2910 /* If nothing is dirty, don't bother messing with page tables. */
2825 if (is_dirty) { 2911 if (is_dirty) {
2826 struct kvm_memslots *slots, *old_slots; 2912 struct kvm_memslots *slots, *old_slots;
2913 unsigned long *dirty_bitmap;
2827 2914
2828 spin_lock(&kvm->mmu_lock); 2915 spin_lock(&kvm->mmu_lock);
2829 kvm_mmu_slot_remove_write_access(kvm, log->slot); 2916 kvm_mmu_slot_remove_write_access(kvm, log->slot);
2830 spin_unlock(&kvm->mmu_lock); 2917 spin_unlock(&kvm->mmu_lock);
2831 2918
2832 slots = kzalloc(sizeof(struct kvm_memslots), GFP_KERNEL); 2919 r = -ENOMEM;
2833 if (!slots) 2920 dirty_bitmap = vmalloc(n);
2834 goto out_free; 2921 if (!dirty_bitmap)
2922 goto out;
2923 memset(dirty_bitmap, 0, n);
2835 2924
2925 r = -ENOMEM;
2926 slots = kzalloc(sizeof(struct kvm_memslots), GFP_KERNEL);
2927 if (!slots) {
2928 vfree(dirty_bitmap);
2929 goto out;
2930 }
2836 memcpy(slots, kvm->memslots, sizeof(struct kvm_memslots)); 2931 memcpy(slots, kvm->memslots, sizeof(struct kvm_memslots));
2837 slots->memslots[log->slot].dirty_bitmap = dirty_bitmap; 2932 slots->memslots[log->slot].dirty_bitmap = dirty_bitmap;
2838 2933
@@ -2841,13 +2936,20 @@ int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm,
2841 synchronize_srcu_expedited(&kvm->srcu); 2936 synchronize_srcu_expedited(&kvm->srcu);
2842 dirty_bitmap = old_slots->memslots[log->slot].dirty_bitmap; 2937 dirty_bitmap = old_slots->memslots[log->slot].dirty_bitmap;
2843 kfree(old_slots); 2938 kfree(old_slots);
2939
2940 r = -EFAULT;
2941 if (copy_to_user(log->dirty_bitmap, dirty_bitmap, n)) {
2942 vfree(dirty_bitmap);
2943 goto out;
2944 }
2945 vfree(dirty_bitmap);
2946 } else {
2947 r = -EFAULT;
2948 if (clear_user(log->dirty_bitmap, n))
2949 goto out;
2844 } 2950 }
2845 2951
2846 r = 0; 2952 r = 0;
2847 if (copy_to_user(log->dirty_bitmap, dirty_bitmap, n))
2848 r = -EFAULT;
2849out_free:
2850 vfree(dirty_bitmap);
2851out: 2953out:
2852 mutex_unlock(&kvm->slots_lock); 2954 mutex_unlock(&kvm->slots_lock);
2853 return r; 2955 return r;
@@ -2867,7 +2969,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
2867 union { 2969 union {
2868 struct kvm_pit_state ps; 2970 struct kvm_pit_state ps;
2869 struct kvm_pit_state2 ps2; 2971 struct kvm_pit_state2 ps2;
2870 struct kvm_memory_alias alias;
2871 struct kvm_pit_config pit_config; 2972 struct kvm_pit_config pit_config;
2872 } u; 2973 } u;
2873 2974
@@ -2888,22 +2989,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
2888 goto out; 2989 goto out;
2889 break; 2990 break;
2890 } 2991 }
2891 case KVM_SET_MEMORY_REGION: {
2892 struct kvm_memory_region kvm_mem;
2893 struct kvm_userspace_memory_region kvm_userspace_mem;
2894
2895 r = -EFAULT;
2896 if (copy_from_user(&kvm_mem, argp, sizeof kvm_mem))
2897 goto out;
2898 kvm_userspace_mem.slot = kvm_mem.slot;
2899 kvm_userspace_mem.flags = kvm_mem.flags;
2900 kvm_userspace_mem.guest_phys_addr = kvm_mem.guest_phys_addr;
2901 kvm_userspace_mem.memory_size = kvm_mem.memory_size;
2902 r = kvm_vm_ioctl_set_memory_region(kvm, &kvm_userspace_mem, 0);
2903 if (r)
2904 goto out;
2905 break;
2906 }
2907 case KVM_SET_NR_MMU_PAGES: 2992 case KVM_SET_NR_MMU_PAGES:
2908 r = kvm_vm_ioctl_set_nr_mmu_pages(kvm, arg); 2993 r = kvm_vm_ioctl_set_nr_mmu_pages(kvm, arg);
2909 if (r) 2994 if (r)
@@ -2912,14 +2997,6 @@ long kvm_arch_vm_ioctl(struct file *filp,
2912 case KVM_GET_NR_MMU_PAGES: 2997 case KVM_GET_NR_MMU_PAGES:
2913 r = kvm_vm_ioctl_get_nr_mmu_pages(kvm); 2998 r = kvm_vm_ioctl_get_nr_mmu_pages(kvm);
2914 break; 2999 break;
2915 case KVM_SET_MEMORY_ALIAS:
2916 r = -EFAULT;
2917 if (copy_from_user(&u.alias, argp, sizeof(struct kvm_memory_alias)))
2918 goto out;
2919 r = kvm_vm_ioctl_set_memory_alias(kvm, &u.alias);
2920 if (r)
2921 goto out;
2922 break;
2923 case KVM_CREATE_IRQCHIP: { 3000 case KVM_CREATE_IRQCHIP: {
2924 struct kvm_pic *vpic; 3001 struct kvm_pic *vpic;
2925 3002
@@ -3259,7 +3336,7 @@ static int kvm_read_guest_virt_helper(gva_t addr, void *val, unsigned int bytes,
3259 } 3336 }
3260 ret = kvm_read_guest(vcpu->kvm, gpa, data, toread); 3337 ret = kvm_read_guest(vcpu->kvm, gpa, data, toread);
3261 if (ret < 0) { 3338 if (ret < 0) {
3262 r = X86EMUL_UNHANDLEABLE; 3339 r = X86EMUL_IO_NEEDED;
3263 goto out; 3340 goto out;
3264 } 3341 }
3265 3342
@@ -3315,7 +3392,7 @@ static int kvm_write_guest_virt_system(gva_t addr, void *val,
3315 } 3392 }
3316 ret = kvm_write_guest(vcpu->kvm, gpa, data, towrite); 3393 ret = kvm_write_guest(vcpu->kvm, gpa, data, towrite);
3317 if (ret < 0) { 3394 if (ret < 0) {
3318 r = X86EMUL_UNHANDLEABLE; 3395 r = X86EMUL_IO_NEEDED;
3319 goto out; 3396 goto out;
3320 } 3397 }
3321 3398
@@ -3330,10 +3407,10 @@ out:
3330static int emulator_read_emulated(unsigned long addr, 3407static int emulator_read_emulated(unsigned long addr,
3331 void *val, 3408 void *val,
3332 unsigned int bytes, 3409 unsigned int bytes,
3410 unsigned int *error_code,
3333 struct kvm_vcpu *vcpu) 3411 struct kvm_vcpu *vcpu)
3334{ 3412{
3335 gpa_t gpa; 3413 gpa_t gpa;
3336 u32 error_code;
3337 3414
3338 if (vcpu->mmio_read_completed) { 3415 if (vcpu->mmio_read_completed) {
3339 memcpy(val, vcpu->mmio_data, bytes); 3416 memcpy(val, vcpu->mmio_data, bytes);
@@ -3343,12 +3420,10 @@ static int emulator_read_emulated(unsigned long addr,
3343 return X86EMUL_CONTINUE; 3420 return X86EMUL_CONTINUE;
3344 } 3421 }
3345 3422
3346 gpa = kvm_mmu_gva_to_gpa_read(vcpu, addr, &error_code); 3423 gpa = kvm_mmu_gva_to_gpa_read(vcpu, addr, error_code);
3347 3424
3348 if (gpa == UNMAPPED_GVA) { 3425 if (gpa == UNMAPPED_GVA)
3349 kvm_inject_page_fault(vcpu, addr, error_code);
3350 return X86EMUL_PROPAGATE_FAULT; 3426 return X86EMUL_PROPAGATE_FAULT;
3351 }
3352 3427
3353 /* For APIC access vmexit */ 3428 /* For APIC access vmexit */
3354 if ((gpa & PAGE_MASK) == APIC_DEFAULT_PHYS_BASE) 3429 if ((gpa & PAGE_MASK) == APIC_DEFAULT_PHYS_BASE)
@@ -3370,11 +3445,12 @@ mmio:
3370 trace_kvm_mmio(KVM_TRACE_MMIO_READ_UNSATISFIED, bytes, gpa, 0); 3445 trace_kvm_mmio(KVM_TRACE_MMIO_READ_UNSATISFIED, bytes, gpa, 0);
3371 3446
3372 vcpu->mmio_needed = 1; 3447 vcpu->mmio_needed = 1;
3373 vcpu->mmio_phys_addr = gpa; 3448 vcpu->run->exit_reason = KVM_EXIT_MMIO;
3374 vcpu->mmio_size = bytes; 3449 vcpu->run->mmio.phys_addr = vcpu->mmio_phys_addr = gpa;
3375 vcpu->mmio_is_write = 0; 3450 vcpu->run->mmio.len = vcpu->mmio_size = bytes;
3451 vcpu->run->mmio.is_write = vcpu->mmio_is_write = 0;
3376 3452
3377 return X86EMUL_UNHANDLEABLE; 3453 return X86EMUL_IO_NEEDED;
3378} 3454}
3379 3455
3380int emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa, 3456int emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa,
@@ -3392,17 +3468,15 @@ int emulator_write_phys(struct kvm_vcpu *vcpu, gpa_t gpa,
3392static int emulator_write_emulated_onepage(unsigned long addr, 3468static int emulator_write_emulated_onepage(unsigned long addr,
3393 const void *val, 3469 const void *val,
3394 unsigned int bytes, 3470 unsigned int bytes,
3471 unsigned int *error_code,
3395 struct kvm_vcpu *vcpu) 3472 struct kvm_vcpu *vcpu)
3396{ 3473{
3397 gpa_t gpa; 3474 gpa_t gpa;
3398 u32 error_code;
3399 3475
3400 gpa = kvm_mmu_gva_to_gpa_write(vcpu, addr, &error_code); 3476 gpa = kvm_mmu_gva_to_gpa_write(vcpu, addr, error_code);
3401 3477
3402 if (gpa == UNMAPPED_GVA) { 3478 if (gpa == UNMAPPED_GVA)
3403 kvm_inject_page_fault(vcpu, addr, error_code);
3404 return X86EMUL_PROPAGATE_FAULT; 3479 return X86EMUL_PROPAGATE_FAULT;
3405 }
3406 3480
3407 /* For APIC access vmexit */ 3481 /* For APIC access vmexit */
3408 if ((gpa & PAGE_MASK) == APIC_DEFAULT_PHYS_BASE) 3482 if ((gpa & PAGE_MASK) == APIC_DEFAULT_PHYS_BASE)
@@ -3420,10 +3494,11 @@ mmio:
3420 return X86EMUL_CONTINUE; 3494 return X86EMUL_CONTINUE;
3421 3495
3422 vcpu->mmio_needed = 1; 3496 vcpu->mmio_needed = 1;
3423 vcpu->mmio_phys_addr = gpa; 3497 vcpu->run->exit_reason = KVM_EXIT_MMIO;
3424 vcpu->mmio_size = bytes; 3498 vcpu->run->mmio.phys_addr = vcpu->mmio_phys_addr = gpa;
3425 vcpu->mmio_is_write = 1; 3499 vcpu->run->mmio.len = vcpu->mmio_size = bytes;
3426 memcpy(vcpu->mmio_data, val, bytes); 3500 vcpu->run->mmio.is_write = vcpu->mmio_is_write = 1;
3501 memcpy(vcpu->run->mmio.data, val, bytes);
3427 3502
3428 return X86EMUL_CONTINUE; 3503 return X86EMUL_CONTINUE;
3429} 3504}
@@ -3431,6 +3506,7 @@ mmio:
3431int emulator_write_emulated(unsigned long addr, 3506int emulator_write_emulated(unsigned long addr,
3432 const void *val, 3507 const void *val,
3433 unsigned int bytes, 3508 unsigned int bytes,
3509 unsigned int *error_code,
3434 struct kvm_vcpu *vcpu) 3510 struct kvm_vcpu *vcpu)
3435{ 3511{
3436 /* Crossing a page boundary? */ 3512 /* Crossing a page boundary? */
@@ -3438,16 +3514,17 @@ int emulator_write_emulated(unsigned long addr,
3438 int rc, now; 3514 int rc, now;
3439 3515
3440 now = -addr & ~PAGE_MASK; 3516 now = -addr & ~PAGE_MASK;
3441 rc = emulator_write_emulated_onepage(addr, val, now, vcpu); 3517 rc = emulator_write_emulated_onepage(addr, val, now, error_code,
3518 vcpu);
3442 if (rc != X86EMUL_CONTINUE) 3519 if (rc != X86EMUL_CONTINUE)
3443 return rc; 3520 return rc;
3444 addr += now; 3521 addr += now;
3445 val += now; 3522 val += now;
3446 bytes -= now; 3523 bytes -= now;
3447 } 3524 }
3448 return emulator_write_emulated_onepage(addr, val, bytes, vcpu); 3525 return emulator_write_emulated_onepage(addr, val, bytes, error_code,
3526 vcpu);
3449} 3527}
3450EXPORT_SYMBOL_GPL(emulator_write_emulated);
3451 3528
3452#define CMPXCHG_TYPE(t, ptr, old, new) \ 3529#define CMPXCHG_TYPE(t, ptr, old, new) \
3453 (cmpxchg((t *)(ptr), *(t *)(old), *(t *)(new)) == *(t *)(old)) 3530 (cmpxchg((t *)(ptr), *(t *)(old), *(t *)(new)) == *(t *)(old))
@@ -3463,6 +3540,7 @@ static int emulator_cmpxchg_emulated(unsigned long addr,
3463 const void *old, 3540 const void *old,
3464 const void *new, 3541 const void *new,
3465 unsigned int bytes, 3542 unsigned int bytes,
3543 unsigned int *error_code,
3466 struct kvm_vcpu *vcpu) 3544 struct kvm_vcpu *vcpu)
3467{ 3545{
3468 gpa_t gpa; 3546 gpa_t gpa;
@@ -3484,6 +3562,10 @@ static int emulator_cmpxchg_emulated(unsigned long addr,
3484 goto emul_write; 3562 goto emul_write;
3485 3563
3486 page = gfn_to_page(vcpu->kvm, gpa >> PAGE_SHIFT); 3564 page = gfn_to_page(vcpu->kvm, gpa >> PAGE_SHIFT);
3565 if (is_error_page(page)) {
3566 kvm_release_page_clean(page);
3567 goto emul_write;
3568 }
3487 3569
3488 kaddr = kmap_atomic(page, KM_USER0); 3570 kaddr = kmap_atomic(page, KM_USER0);
3489 kaddr += offset_in_page(gpa); 3571 kaddr += offset_in_page(gpa);
@@ -3516,7 +3598,7 @@ static int emulator_cmpxchg_emulated(unsigned long addr,
3516emul_write: 3598emul_write:
3517 printk_once(KERN_WARNING "kvm: emulating exchange as write\n"); 3599 printk_once(KERN_WARNING "kvm: emulating exchange as write\n");
3518 3600
3519 return emulator_write_emulated(addr, new, bytes, vcpu); 3601 return emulator_write_emulated(addr, new, bytes, error_code, vcpu);
3520} 3602}
3521 3603
3522static int kernel_pio(struct kvm_vcpu *vcpu, void *pd) 3604static int kernel_pio(struct kvm_vcpu *vcpu, void *pd)
@@ -3604,42 +3686,38 @@ int emulate_invlpg(struct kvm_vcpu *vcpu, gva_t address)
3604 return X86EMUL_CONTINUE; 3686 return X86EMUL_CONTINUE;
3605} 3687}
3606 3688
3607int emulate_clts(struct kvm_vcpu *vcpu) 3689int kvm_emulate_wbinvd(struct kvm_vcpu *vcpu)
3608{ 3690{
3609 kvm_x86_ops->set_cr0(vcpu, kvm_read_cr0_bits(vcpu, ~X86_CR0_TS)); 3691 if (!need_emulate_wbinvd(vcpu))
3610 kvm_x86_ops->fpu_activate(vcpu); 3692 return X86EMUL_CONTINUE;
3693
3694 if (kvm_x86_ops->has_wbinvd_exit()) {
3695 smp_call_function_many(vcpu->arch.wbinvd_dirty_mask,
3696 wbinvd_ipi, NULL, 1);
3697 cpumask_clear(vcpu->arch.wbinvd_dirty_mask);
3698 }
3699 wbinvd();
3611 return X86EMUL_CONTINUE; 3700 return X86EMUL_CONTINUE;
3612} 3701}
3702EXPORT_SYMBOL_GPL(kvm_emulate_wbinvd);
3613 3703
3614int emulator_get_dr(struct x86_emulate_ctxt *ctxt, int dr, unsigned long *dest) 3704int emulate_clts(struct kvm_vcpu *vcpu)
3615{ 3705{
3616 return kvm_get_dr(ctxt->vcpu, dr, dest); 3706 kvm_x86_ops->set_cr0(vcpu, kvm_read_cr0_bits(vcpu, ~X86_CR0_TS));
3707 kvm_x86_ops->fpu_activate(vcpu);
3708 return X86EMUL_CONTINUE;
3617} 3709}
3618 3710
3619int emulator_set_dr(struct x86_emulate_ctxt *ctxt, int dr, unsigned long value) 3711int emulator_get_dr(int dr, unsigned long *dest, struct kvm_vcpu *vcpu)
3620{ 3712{
3621 unsigned long mask = (ctxt->mode == X86EMUL_MODE_PROT64) ? ~0ULL : ~0U; 3713 return _kvm_get_dr(vcpu, dr, dest);
3622
3623 return kvm_set_dr(ctxt->vcpu, dr, value & mask);
3624} 3714}
3625 3715
3626void kvm_report_emulation_failure(struct kvm_vcpu *vcpu, const char *context) 3716int emulator_set_dr(int dr, unsigned long value, struct kvm_vcpu *vcpu)
3627{ 3717{
3628 u8 opcodes[4];
3629 unsigned long rip = kvm_rip_read(vcpu);
3630 unsigned long rip_linear;
3631
3632 if (!printk_ratelimit())
3633 return;
3634 3718
3635 rip_linear = rip + get_segment_base(vcpu, VCPU_SREG_CS); 3719 return __kvm_set_dr(vcpu, dr, value);
3636
3637 kvm_read_guest_virt(rip_linear, (void *)opcodes, 4, vcpu, NULL);
3638
3639 printk(KERN_ERR "emulation failed (%s) rip %lx %02x %02x %02x %02x\n",
3640 context, rip, opcodes[0], opcodes[1], opcodes[2], opcodes[3]);
3641} 3720}
3642EXPORT_SYMBOL_GPL(kvm_report_emulation_failure);
3643 3721
3644static u64 mk_cr_64(u64 curr_cr, u32 new_val) 3722static u64 mk_cr_64(u64 curr_cr, u32 new_val)
3645{ 3723{
@@ -3674,27 +3752,32 @@ static unsigned long emulator_get_cr(int cr, struct kvm_vcpu *vcpu)
3674 return value; 3752 return value;
3675} 3753}
3676 3754
3677static void emulator_set_cr(int cr, unsigned long val, struct kvm_vcpu *vcpu) 3755static int emulator_set_cr(int cr, unsigned long val, struct kvm_vcpu *vcpu)
3678{ 3756{
3757 int res = 0;
3758
3679 switch (cr) { 3759 switch (cr) {
3680 case 0: 3760 case 0:
3681 kvm_set_cr0(vcpu, mk_cr_64(kvm_read_cr0(vcpu), val)); 3761 res = kvm_set_cr0(vcpu, mk_cr_64(kvm_read_cr0(vcpu), val));
3682 break; 3762 break;
3683 case 2: 3763 case 2:
3684 vcpu->arch.cr2 = val; 3764 vcpu->arch.cr2 = val;
3685 break; 3765 break;
3686 case 3: 3766 case 3:
3687 kvm_set_cr3(vcpu, val); 3767 res = kvm_set_cr3(vcpu, val);
3688 break; 3768 break;
3689 case 4: 3769 case 4:
3690 kvm_set_cr4(vcpu, mk_cr_64(kvm_read_cr4(vcpu), val)); 3770 res = kvm_set_cr4(vcpu, mk_cr_64(kvm_read_cr4(vcpu), val));
3691 break; 3771 break;
3692 case 8: 3772 case 8:
3693 kvm_set_cr8(vcpu, val & 0xfUL); 3773 res = __kvm_set_cr8(vcpu, val & 0xfUL);
3694 break; 3774 break;
3695 default: 3775 default:
3696 vcpu_printf(vcpu, "%s: unexpected cr %u\n", __func__, cr); 3776 vcpu_printf(vcpu, "%s: unexpected cr %u\n", __func__, cr);
3777 res = -1;
3697 } 3778 }
3779
3780 return res;
3698} 3781}
3699 3782
3700static int emulator_get_cpl(struct kvm_vcpu *vcpu) 3783static int emulator_get_cpl(struct kvm_vcpu *vcpu)
@@ -3707,6 +3790,12 @@ static void emulator_get_gdt(struct desc_ptr *dt, struct kvm_vcpu *vcpu)
3707 kvm_x86_ops->get_gdt(vcpu, dt); 3790 kvm_x86_ops->get_gdt(vcpu, dt);
3708} 3791}
3709 3792
3793static unsigned long emulator_get_cached_segment_base(int seg,
3794 struct kvm_vcpu *vcpu)
3795{
3796 return get_segment_base(vcpu, seg);
3797}
3798
3710static bool emulator_get_cached_descriptor(struct desc_struct *desc, int seg, 3799static bool emulator_get_cached_descriptor(struct desc_struct *desc, int seg,
3711 struct kvm_vcpu *vcpu) 3800 struct kvm_vcpu *vcpu)
3712{ 3801{
@@ -3779,11 +3868,6 @@ static void emulator_set_segment_selector(u16 sel, int seg,
3779 kvm_set_segment(vcpu, &kvm_seg, seg); 3868 kvm_set_segment(vcpu, &kvm_seg, seg);
3780} 3869}
3781 3870
3782static void emulator_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags)
3783{
3784 kvm_x86_ops->set_rflags(vcpu, rflags);
3785}
3786
3787static struct x86_emulate_ops emulate_ops = { 3871static struct x86_emulate_ops emulate_ops = {
3788 .read_std = kvm_read_guest_virt_system, 3872 .read_std = kvm_read_guest_virt_system,
3789 .write_std = kvm_write_guest_virt_system, 3873 .write_std = kvm_write_guest_virt_system,
@@ -3797,11 +3881,15 @@ static struct x86_emulate_ops emulate_ops = {
3797 .set_cached_descriptor = emulator_set_cached_descriptor, 3881 .set_cached_descriptor = emulator_set_cached_descriptor,
3798 .get_segment_selector = emulator_get_segment_selector, 3882 .get_segment_selector = emulator_get_segment_selector,
3799 .set_segment_selector = emulator_set_segment_selector, 3883 .set_segment_selector = emulator_set_segment_selector,
3884 .get_cached_segment_base = emulator_get_cached_segment_base,
3800 .get_gdt = emulator_get_gdt, 3885 .get_gdt = emulator_get_gdt,
3801 .get_cr = emulator_get_cr, 3886 .get_cr = emulator_get_cr,
3802 .set_cr = emulator_set_cr, 3887 .set_cr = emulator_set_cr,
3803 .cpl = emulator_get_cpl, 3888 .cpl = emulator_get_cpl,
3804 .set_rflags = emulator_set_rflags, 3889 .get_dr = emulator_get_dr,
3890 .set_dr = emulator_set_dr,
3891 .set_msr = kvm_set_msr,
3892 .get_msr = kvm_get_msr,
3805}; 3893};
3806 3894
3807static void cache_all_regs(struct kvm_vcpu *vcpu) 3895static void cache_all_regs(struct kvm_vcpu *vcpu)
@@ -3812,14 +3900,75 @@ static void cache_all_regs(struct kvm_vcpu *vcpu)
3812 vcpu->arch.regs_dirty = ~0; 3900 vcpu->arch.regs_dirty = ~0;
3813} 3901}
3814 3902
3903static void toggle_interruptibility(struct kvm_vcpu *vcpu, u32 mask)
3904{
3905 u32 int_shadow = kvm_x86_ops->get_interrupt_shadow(vcpu, mask);
3906 /*
3907 * an sti; sti; sequence only disable interrupts for the first
3908 * instruction. So, if the last instruction, be it emulated or
3909 * not, left the system with the INT_STI flag enabled, it
3910 * means that the last instruction is an sti. We should not
3911 * leave the flag on in this case. The same goes for mov ss
3912 */
3913 if (!(int_shadow & mask))
3914 kvm_x86_ops->set_interrupt_shadow(vcpu, mask);
3915}
3916
3917static void inject_emulated_exception(struct kvm_vcpu *vcpu)
3918{
3919 struct x86_emulate_ctxt *ctxt = &vcpu->arch.emulate_ctxt;
3920 if (ctxt->exception == PF_VECTOR)
3921 kvm_inject_page_fault(vcpu, ctxt->cr2, ctxt->error_code);
3922 else if (ctxt->error_code_valid)
3923 kvm_queue_exception_e(vcpu, ctxt->exception, ctxt->error_code);
3924 else
3925 kvm_queue_exception(vcpu, ctxt->exception);
3926}
3927
3928static int handle_emulation_failure(struct kvm_vcpu *vcpu)
3929{
3930 ++vcpu->stat.insn_emulation_fail;
3931 trace_kvm_emulate_insn_failed(vcpu);
3932 vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR;
3933 vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_EMULATION;
3934 vcpu->run->internal.ndata = 0;
3935 kvm_queue_exception(vcpu, UD_VECTOR);
3936 return EMULATE_FAIL;
3937}
3938
3939static bool reexecute_instruction(struct kvm_vcpu *vcpu, gva_t gva)
3940{
3941 gpa_t gpa;
3942
3943 if (tdp_enabled)
3944 return false;
3945
3946 /*
3947 * if emulation was due to access to shadowed page table
3948 * and it failed try to unshadow page and re-entetr the
3949 * guest to let CPU execute the instruction.
3950 */
3951 if (kvm_mmu_unprotect_page_virt(vcpu, gva))
3952 return true;
3953
3954 gpa = kvm_mmu_gva_to_gpa_system(vcpu, gva, NULL);
3955
3956 if (gpa == UNMAPPED_GVA)
3957 return true; /* let cpu generate fault */
3958
3959 if (!kvm_is_error_hva(gfn_to_hva(vcpu->kvm, gpa >> PAGE_SHIFT)))
3960 return true;
3961
3962 return false;
3963}
3964
3815int emulate_instruction(struct kvm_vcpu *vcpu, 3965int emulate_instruction(struct kvm_vcpu *vcpu,
3816 unsigned long cr2, 3966 unsigned long cr2,
3817 u16 error_code, 3967 u16 error_code,
3818 int emulation_type) 3968 int emulation_type)
3819{ 3969{
3820 int r, shadow_mask; 3970 int r;
3821 struct decode_cache *c; 3971 struct decode_cache *c = &vcpu->arch.emulate_ctxt.decode;
3822 struct kvm_run *run = vcpu->run;
3823 3972
3824 kvm_clear_exception_queue(vcpu); 3973 kvm_clear_exception_queue(vcpu);
3825 vcpu->arch.mmio_fault_cr2 = cr2; 3974 vcpu->arch.mmio_fault_cr2 = cr2;
@@ -3831,8 +3980,6 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
3831 */ 3980 */
3832 cache_all_regs(vcpu); 3981 cache_all_regs(vcpu);
3833 3982
3834 vcpu->mmio_is_write = 0;
3835
3836 if (!(emulation_type & EMULTYPE_NO_DECODE)) { 3983 if (!(emulation_type & EMULTYPE_NO_DECODE)) {
3837 int cs_db, cs_l; 3984 int cs_db, cs_l;
3838 kvm_x86_ops->get_cs_db_l_bits(vcpu, &cs_db, &cs_l); 3985 kvm_x86_ops->get_cs_db_l_bits(vcpu, &cs_db, &cs_l);
@@ -3846,13 +3993,16 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
3846 ? X86EMUL_MODE_VM86 : cs_l 3993 ? X86EMUL_MODE_VM86 : cs_l
3847 ? X86EMUL_MODE_PROT64 : cs_db 3994 ? X86EMUL_MODE_PROT64 : cs_db
3848 ? X86EMUL_MODE_PROT32 : X86EMUL_MODE_PROT16; 3995 ? X86EMUL_MODE_PROT32 : X86EMUL_MODE_PROT16;
3996 memset(c, 0, sizeof(struct decode_cache));
3997 memcpy(c->regs, vcpu->arch.regs, sizeof c->regs);
3998 vcpu->arch.emulate_ctxt.interruptibility = 0;
3999 vcpu->arch.emulate_ctxt.exception = -1;
3849 4000
3850 r = x86_decode_insn(&vcpu->arch.emulate_ctxt, &emulate_ops); 4001 r = x86_decode_insn(&vcpu->arch.emulate_ctxt, &emulate_ops);
3851 trace_kvm_emulate_insn_start(vcpu); 4002 trace_kvm_emulate_insn_start(vcpu);
3852 4003
3853 /* Only allow emulation of specific instructions on #UD 4004 /* Only allow emulation of specific instructions on #UD
3854 * (namely VMMCALL, sysenter, sysexit, syscall)*/ 4005 * (namely VMMCALL, sysenter, sysexit, syscall)*/
3855 c = &vcpu->arch.emulate_ctxt.decode;
3856 if (emulation_type & EMULTYPE_TRAP_UD) { 4006 if (emulation_type & EMULTYPE_TRAP_UD) {
3857 if (!c->twobyte) 4007 if (!c->twobyte)
3858 return EMULATE_FAIL; 4008 return EMULATE_FAIL;
@@ -3880,11 +4030,11 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
3880 4030
3881 ++vcpu->stat.insn_emulation; 4031 ++vcpu->stat.insn_emulation;
3882 if (r) { 4032 if (r) {
3883 ++vcpu->stat.insn_emulation_fail; 4033 if (reexecute_instruction(vcpu, cr2))
3884 trace_kvm_emulate_insn_failed(vcpu);
3885 if (kvm_mmu_unprotect_page_virt(vcpu, cr2))
3886 return EMULATE_DONE; 4034 return EMULATE_DONE;
3887 return EMULATE_FAIL; 4035 if (emulation_type & EMULTYPE_SKIP)
4036 return EMULATE_FAIL;
4037 return handle_emulation_failure(vcpu);
3888 } 4038 }
3889 } 4039 }
3890 4040
@@ -3893,48 +4043,42 @@ int emulate_instruction(struct kvm_vcpu *vcpu,
3893 return EMULATE_DONE; 4043 return EMULATE_DONE;
3894 } 4044 }
3895 4045
4046 /* this is needed for vmware backdor interface to work since it
4047 changes registers values during IO operation */
4048 memcpy(c->regs, vcpu->arch.regs, sizeof c->regs);
4049
3896restart: 4050restart:
3897 r = x86_emulate_insn(&vcpu->arch.emulate_ctxt, &emulate_ops); 4051 r = x86_emulate_insn(&vcpu->arch.emulate_ctxt, &emulate_ops);
3898 shadow_mask = vcpu->arch.emulate_ctxt.interruptibility;
3899 4052
3900 if (r == 0) 4053 if (r) { /* emulation failed */
3901 kvm_x86_ops->set_interrupt_shadow(vcpu, shadow_mask); 4054 if (reexecute_instruction(vcpu, cr2))
4055 return EMULATE_DONE;
3902 4056
3903 if (vcpu->arch.pio.count) { 4057 return handle_emulation_failure(vcpu);
3904 if (!vcpu->arch.pio.in)
3905 vcpu->arch.pio.count = 0;
3906 return EMULATE_DO_MMIO;
3907 } 4058 }
3908 4059
3909 if (r || vcpu->mmio_is_write) { 4060 toggle_interruptibility(vcpu, vcpu->arch.emulate_ctxt.interruptibility);
3910 run->exit_reason = KVM_EXIT_MMIO; 4061 kvm_x86_ops->set_rflags(vcpu, vcpu->arch.emulate_ctxt.eflags);
3911 run->mmio.phys_addr = vcpu->mmio_phys_addr; 4062 memcpy(vcpu->arch.regs, c->regs, sizeof c->regs);
3912 memcpy(run->mmio.data, vcpu->mmio_data, 8); 4063 kvm_rip_write(vcpu, vcpu->arch.emulate_ctxt.eip);
3913 run->mmio.len = vcpu->mmio_size; 4064
3914 run->mmio.is_write = vcpu->mmio_is_write; 4065 if (vcpu->arch.emulate_ctxt.exception >= 0) {
4066 inject_emulated_exception(vcpu);
4067 return EMULATE_DONE;
3915 } 4068 }
3916 4069
3917 if (r) { 4070 if (vcpu->arch.pio.count) {
3918 if (kvm_mmu_unprotect_page_virt(vcpu, cr2)) 4071 if (!vcpu->arch.pio.in)
3919 goto done; 4072 vcpu->arch.pio.count = 0;
3920 if (!vcpu->mmio_needed) {
3921 ++vcpu->stat.insn_emulation_fail;
3922 trace_kvm_emulate_insn_failed(vcpu);
3923 kvm_report_emulation_failure(vcpu, "mmio");
3924 return EMULATE_FAIL;
3925 }
3926 return EMULATE_DO_MMIO; 4073 return EMULATE_DO_MMIO;
3927 } 4074 }
3928 4075
3929 if (vcpu->mmio_is_write) { 4076 if (vcpu->mmio_needed) {
3930 vcpu->mmio_needed = 0; 4077 if (vcpu->mmio_is_write)
4078 vcpu->mmio_needed = 0;
3931 return EMULATE_DO_MMIO; 4079 return EMULATE_DO_MMIO;
3932 } 4080 }
3933 4081
3934done:
3935 if (vcpu->arch.exception.pending)
3936 vcpu->arch.emulate_ctxt.restart = false;
3937
3938 if (vcpu->arch.emulate_ctxt.restart) 4082 if (vcpu->arch.emulate_ctxt.restart)
3939 goto restart; 4083 goto restart;
3940 4084
@@ -4108,6 +4252,9 @@ int kvm_arch_init(void *opaque)
4108 4252
4109 perf_register_guest_info_callbacks(&kvm_guest_cbs); 4253 perf_register_guest_info_callbacks(&kvm_guest_cbs);
4110 4254
4255 if (cpu_has_xsave)
4256 host_xcr0 = xgetbv(XCR_XFEATURE_ENABLED_MASK);
4257
4111 return 0; 4258 return 0;
4112 4259
4113out: 4260out:
@@ -4270,7 +4417,7 @@ int kvm_fix_hypercall(struct kvm_vcpu *vcpu)
4270 4417
4271 kvm_x86_ops->patch_hypercall(vcpu, instruction); 4418 kvm_x86_ops->patch_hypercall(vcpu, instruction);
4272 4419
4273 return emulator_write_emulated(rip, instruction, 3, vcpu); 4420 return emulator_write_emulated(rip, instruction, 3, NULL, vcpu);
4274} 4421}
4275 4422
4276void realmode_lgdt(struct kvm_vcpu *vcpu, u16 limit, unsigned long base) 4423void realmode_lgdt(struct kvm_vcpu *vcpu, u16 limit, unsigned long base)
@@ -4506,59 +4653,78 @@ static void inject_pending_event(struct kvm_vcpu *vcpu)
4506 } 4653 }
4507} 4654}
4508 4655
4656static void kvm_load_guest_xcr0(struct kvm_vcpu *vcpu)
4657{
4658 if (kvm_read_cr4_bits(vcpu, X86_CR4_OSXSAVE) &&
4659 !vcpu->guest_xcr0_loaded) {
4660 /* kvm_set_xcr() also depends on this */
4661 xsetbv(XCR_XFEATURE_ENABLED_MASK, vcpu->arch.xcr0);
4662 vcpu->guest_xcr0_loaded = 1;
4663 }
4664}
4665
4666static void kvm_put_guest_xcr0(struct kvm_vcpu *vcpu)
4667{
4668 if (vcpu->guest_xcr0_loaded) {
4669 if (vcpu->arch.xcr0 != host_xcr0)
4670 xsetbv(XCR_XFEATURE_ENABLED_MASK, host_xcr0);
4671 vcpu->guest_xcr0_loaded = 0;
4672 }
4673}
4674
4509static int vcpu_enter_guest(struct kvm_vcpu *vcpu) 4675static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
4510{ 4676{
4511 int r; 4677 int r;
4512 bool req_int_win = !irqchip_in_kernel(vcpu->kvm) && 4678 bool req_int_win = !irqchip_in_kernel(vcpu->kvm) &&
4513 vcpu->run->request_interrupt_window; 4679 vcpu->run->request_interrupt_window;
4514 4680
4515 if (vcpu->requests)
4516 if (test_and_clear_bit(KVM_REQ_MMU_RELOAD, &vcpu->requests))
4517 kvm_mmu_unload(vcpu);
4518
4519 r = kvm_mmu_reload(vcpu);
4520 if (unlikely(r))
4521 goto out;
4522
4523 if (vcpu->requests) { 4681 if (vcpu->requests) {
4524 if (test_and_clear_bit(KVM_REQ_MIGRATE_TIMER, &vcpu->requests)) 4682 if (kvm_check_request(KVM_REQ_MMU_RELOAD, vcpu))
4683 kvm_mmu_unload(vcpu);
4684 if (kvm_check_request(KVM_REQ_MIGRATE_TIMER, vcpu))
4525 __kvm_migrate_timers(vcpu); 4685 __kvm_migrate_timers(vcpu);
4526 if (test_and_clear_bit(KVM_REQ_KVMCLOCK_UPDATE, &vcpu->requests)) 4686 if (kvm_check_request(KVM_REQ_KVMCLOCK_UPDATE, vcpu))
4527 kvm_write_guest_time(vcpu); 4687 kvm_write_guest_time(vcpu);
4528 if (test_and_clear_bit(KVM_REQ_MMU_SYNC, &vcpu->requests)) 4688 if (kvm_check_request(KVM_REQ_MMU_SYNC, vcpu))
4529 kvm_mmu_sync_roots(vcpu); 4689 kvm_mmu_sync_roots(vcpu);
4530 if (test_and_clear_bit(KVM_REQ_TLB_FLUSH, &vcpu->requests)) 4690 if (kvm_check_request(KVM_REQ_TLB_FLUSH, vcpu))
4531 kvm_x86_ops->tlb_flush(vcpu); 4691 kvm_x86_ops->tlb_flush(vcpu);
4532 if (test_and_clear_bit(KVM_REQ_REPORT_TPR_ACCESS, 4692 if (kvm_check_request(KVM_REQ_REPORT_TPR_ACCESS, vcpu)) {
4533 &vcpu->requests)) {
4534 vcpu->run->exit_reason = KVM_EXIT_TPR_ACCESS; 4693 vcpu->run->exit_reason = KVM_EXIT_TPR_ACCESS;
4535 r = 0; 4694 r = 0;
4536 goto out; 4695 goto out;
4537 } 4696 }
4538 if (test_and_clear_bit(KVM_REQ_TRIPLE_FAULT, &vcpu->requests)) { 4697 if (kvm_check_request(KVM_REQ_TRIPLE_FAULT, vcpu)) {
4539 vcpu->run->exit_reason = KVM_EXIT_SHUTDOWN; 4698 vcpu->run->exit_reason = KVM_EXIT_SHUTDOWN;
4540 r = 0; 4699 r = 0;
4541 goto out; 4700 goto out;
4542 } 4701 }
4543 if (test_and_clear_bit(KVM_REQ_DEACTIVATE_FPU, &vcpu->requests)) { 4702 if (kvm_check_request(KVM_REQ_DEACTIVATE_FPU, vcpu)) {
4544 vcpu->fpu_active = 0; 4703 vcpu->fpu_active = 0;
4545 kvm_x86_ops->fpu_deactivate(vcpu); 4704 kvm_x86_ops->fpu_deactivate(vcpu);
4546 } 4705 }
4547 } 4706 }
4548 4707
4708 r = kvm_mmu_reload(vcpu);
4709 if (unlikely(r))
4710 goto out;
4711
4549 preempt_disable(); 4712 preempt_disable();
4550 4713
4551 kvm_x86_ops->prepare_guest_switch(vcpu); 4714 kvm_x86_ops->prepare_guest_switch(vcpu);
4552 if (vcpu->fpu_active) 4715 if (vcpu->fpu_active)
4553 kvm_load_guest_fpu(vcpu); 4716 kvm_load_guest_fpu(vcpu);
4717 kvm_load_guest_xcr0(vcpu);
4554 4718
4555 local_irq_disable(); 4719 atomic_set(&vcpu->guest_mode, 1);
4720 smp_wmb();
4556 4721
4557 clear_bit(KVM_REQ_KICK, &vcpu->requests); 4722 local_irq_disable();
4558 smp_mb__after_clear_bit();
4559 4723
4560 if (vcpu->requests || need_resched() || signal_pending(current)) { 4724 if (!atomic_read(&vcpu->guest_mode) || vcpu->requests
4561 set_bit(KVM_REQ_KICK, &vcpu->requests); 4725 || need_resched() || signal_pending(current)) {
4726 atomic_set(&vcpu->guest_mode, 0);
4727 smp_wmb();
4562 local_irq_enable(); 4728 local_irq_enable();
4563 preempt_enable(); 4729 preempt_enable();
4564 r = 1; 4730 r = 1;
@@ -4603,7 +4769,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
4603 if (hw_breakpoint_active()) 4769 if (hw_breakpoint_active())
4604 hw_breakpoint_restore(); 4770 hw_breakpoint_restore();
4605 4771
4606 set_bit(KVM_REQ_KICK, &vcpu->requests); 4772 atomic_set(&vcpu->guest_mode, 0);
4773 smp_wmb();
4607 local_irq_enable(); 4774 local_irq_enable();
4608 4775
4609 ++vcpu->stat.exits; 4776 ++vcpu->stat.exits;
@@ -4665,7 +4832,7 @@ static int __vcpu_run(struct kvm_vcpu *vcpu)
4665 srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx); 4832 srcu_read_unlock(&kvm->srcu, vcpu->srcu_idx);
4666 kvm_vcpu_block(vcpu); 4833 kvm_vcpu_block(vcpu);
4667 vcpu->srcu_idx = srcu_read_lock(&kvm->srcu); 4834 vcpu->srcu_idx = srcu_read_lock(&kvm->srcu);
4668 if (test_and_clear_bit(KVM_REQ_UNHALT, &vcpu->requests)) 4835 if (kvm_check_request(KVM_REQ_UNHALT, vcpu))
4669 { 4836 {
4670 switch(vcpu->arch.mp_state) { 4837 switch(vcpu->arch.mp_state) {
4671 case KVM_MP_STATE_HALTED: 4838 case KVM_MP_STATE_HALTED:
@@ -4717,8 +4884,6 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
4717 int r; 4884 int r;
4718 sigset_t sigsaved; 4885 sigset_t sigsaved;
4719 4886
4720 vcpu_load(vcpu);
4721
4722 if (vcpu->sigset_active) 4887 if (vcpu->sigset_active)
4723 sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved); 4888 sigprocmask(SIG_SETMASK, &vcpu->sigset, &sigsaved);
4724 4889
@@ -4743,7 +4908,7 @@ int kvm_arch_vcpu_ioctl_run(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run)
4743 vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu); 4908 vcpu->srcu_idx = srcu_read_lock(&vcpu->kvm->srcu);
4744 r = emulate_instruction(vcpu, 0, 0, EMULTYPE_NO_DECODE); 4909 r = emulate_instruction(vcpu, 0, 0, EMULTYPE_NO_DECODE);
4745 srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx); 4910 srcu_read_unlock(&vcpu->kvm->srcu, vcpu->srcu_idx);
4746 if (r == EMULATE_DO_MMIO) { 4911 if (r != EMULATE_DONE) {
4747 r = 0; 4912 r = 0;
4748 goto out; 4913 goto out;
4749 } 4914 }
@@ -4759,14 +4924,11 @@ out:
4759 if (vcpu->sigset_active) 4924 if (vcpu->sigset_active)
4760 sigprocmask(SIG_SETMASK, &sigsaved, NULL); 4925 sigprocmask(SIG_SETMASK, &sigsaved, NULL);
4761 4926
4762 vcpu_put(vcpu);
4763 return r; 4927 return r;
4764} 4928}
4765 4929
4766int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) 4930int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
4767{ 4931{
4768 vcpu_load(vcpu);
4769
4770 regs->rax = kvm_register_read(vcpu, VCPU_REGS_RAX); 4932 regs->rax = kvm_register_read(vcpu, VCPU_REGS_RAX);
4771 regs->rbx = kvm_register_read(vcpu, VCPU_REGS_RBX); 4933 regs->rbx = kvm_register_read(vcpu, VCPU_REGS_RBX);
4772 regs->rcx = kvm_register_read(vcpu, VCPU_REGS_RCX); 4934 regs->rcx = kvm_register_read(vcpu, VCPU_REGS_RCX);
@@ -4789,15 +4951,11 @@ int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
4789 regs->rip = kvm_rip_read(vcpu); 4951 regs->rip = kvm_rip_read(vcpu);
4790 regs->rflags = kvm_get_rflags(vcpu); 4952 regs->rflags = kvm_get_rflags(vcpu);
4791 4953
4792 vcpu_put(vcpu);
4793
4794 return 0; 4954 return 0;
4795} 4955}
4796 4956
4797int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) 4957int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
4798{ 4958{
4799 vcpu_load(vcpu);
4800
4801 kvm_register_write(vcpu, VCPU_REGS_RAX, regs->rax); 4959 kvm_register_write(vcpu, VCPU_REGS_RAX, regs->rax);
4802 kvm_register_write(vcpu, VCPU_REGS_RBX, regs->rbx); 4960 kvm_register_write(vcpu, VCPU_REGS_RBX, regs->rbx);
4803 kvm_register_write(vcpu, VCPU_REGS_RCX, regs->rcx); 4961 kvm_register_write(vcpu, VCPU_REGS_RCX, regs->rcx);
@@ -4822,8 +4980,6 @@ int kvm_arch_vcpu_ioctl_set_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs)
4822 4980
4823 vcpu->arch.exception.pending = false; 4981 vcpu->arch.exception.pending = false;
4824 4982
4825 vcpu_put(vcpu);
4826
4827 return 0; 4983 return 0;
4828} 4984}
4829 4985
@@ -4842,8 +4998,6 @@ int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
4842{ 4998{
4843 struct desc_ptr dt; 4999 struct desc_ptr dt;
4844 5000
4845 vcpu_load(vcpu);
4846
4847 kvm_get_segment(vcpu, &sregs->cs, VCPU_SREG_CS); 5001 kvm_get_segment(vcpu, &sregs->cs, VCPU_SREG_CS);
4848 kvm_get_segment(vcpu, &sregs->ds, VCPU_SREG_DS); 5002 kvm_get_segment(vcpu, &sregs->ds, VCPU_SREG_DS);
4849 kvm_get_segment(vcpu, &sregs->es, VCPU_SREG_ES); 5003 kvm_get_segment(vcpu, &sregs->es, VCPU_SREG_ES);
@@ -4875,32 +5029,27 @@ int kvm_arch_vcpu_ioctl_get_sregs(struct kvm_vcpu *vcpu,
4875 set_bit(vcpu->arch.interrupt.nr, 5029 set_bit(vcpu->arch.interrupt.nr,
4876 (unsigned long *)sregs->interrupt_bitmap); 5030 (unsigned long *)sregs->interrupt_bitmap);
4877 5031
4878 vcpu_put(vcpu);
4879
4880 return 0; 5032 return 0;
4881} 5033}
4882 5034
4883int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu, 5035int kvm_arch_vcpu_ioctl_get_mpstate(struct kvm_vcpu *vcpu,
4884 struct kvm_mp_state *mp_state) 5036 struct kvm_mp_state *mp_state)
4885{ 5037{
4886 vcpu_load(vcpu);
4887 mp_state->mp_state = vcpu->arch.mp_state; 5038 mp_state->mp_state = vcpu->arch.mp_state;
4888 vcpu_put(vcpu);
4889 return 0; 5039 return 0;
4890} 5040}
4891 5041
4892int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu, 5042int kvm_arch_vcpu_ioctl_set_mpstate(struct kvm_vcpu *vcpu,
4893 struct kvm_mp_state *mp_state) 5043 struct kvm_mp_state *mp_state)
4894{ 5044{
4895 vcpu_load(vcpu);
4896 vcpu->arch.mp_state = mp_state->mp_state; 5045 vcpu->arch.mp_state = mp_state->mp_state;
4897 vcpu_put(vcpu);
4898 return 0; 5046 return 0;
4899} 5047}
4900 5048
4901int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason, 5049int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason,
4902 bool has_error_code, u32 error_code) 5050 bool has_error_code, u32 error_code)
4903{ 5051{
5052 struct decode_cache *c = &vcpu->arch.emulate_ctxt.decode;
4904 int cs_db, cs_l, ret; 5053 int cs_db, cs_l, ret;
4905 cache_all_regs(vcpu); 5054 cache_all_regs(vcpu);
4906 5055
@@ -4915,6 +5064,8 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason,
4915 ? X86EMUL_MODE_VM86 : cs_l 5064 ? X86EMUL_MODE_VM86 : cs_l
4916 ? X86EMUL_MODE_PROT64 : cs_db 5065 ? X86EMUL_MODE_PROT64 : cs_db
4917 ? X86EMUL_MODE_PROT32 : X86EMUL_MODE_PROT16; 5066 ? X86EMUL_MODE_PROT32 : X86EMUL_MODE_PROT16;
5067 memset(c, 0, sizeof(struct decode_cache));
5068 memcpy(c->regs, vcpu->arch.regs, sizeof c->regs);
4918 5069
4919 ret = emulator_task_switch(&vcpu->arch.emulate_ctxt, &emulate_ops, 5070 ret = emulator_task_switch(&vcpu->arch.emulate_ctxt, &emulate_ops,
4920 tss_selector, reason, has_error_code, 5071 tss_selector, reason, has_error_code,
@@ -4923,6 +5074,8 @@ int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason,
4923 if (ret) 5074 if (ret)
4924 return EMULATE_FAIL; 5075 return EMULATE_FAIL;
4925 5076
5077 memcpy(vcpu->arch.regs, c->regs, sizeof c->regs);
5078 kvm_rip_write(vcpu, vcpu->arch.emulate_ctxt.eip);
4926 kvm_x86_ops->set_rflags(vcpu, vcpu->arch.emulate_ctxt.eflags); 5079 kvm_x86_ops->set_rflags(vcpu, vcpu->arch.emulate_ctxt.eflags);
4927 return EMULATE_DONE; 5080 return EMULATE_DONE;
4928} 5081}
@@ -4935,8 +5088,6 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
4935 int pending_vec, max_bits; 5088 int pending_vec, max_bits;
4936 struct desc_ptr dt; 5089 struct desc_ptr dt;
4937 5090
4938 vcpu_load(vcpu);
4939
4940 dt.size = sregs->idt.limit; 5091 dt.size = sregs->idt.limit;
4941 dt.address = sregs->idt.base; 5092 dt.address = sregs->idt.base;
4942 kvm_x86_ops->set_idt(vcpu, &dt); 5093 kvm_x86_ops->set_idt(vcpu, &dt);
@@ -4996,8 +5147,6 @@ int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu,
4996 !is_protmode(vcpu)) 5147 !is_protmode(vcpu))
4997 vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE; 5148 vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
4998 5149
4999 vcpu_put(vcpu);
5000
5001 return 0; 5150 return 0;
5002} 5151}
5003 5152
@@ -5007,12 +5156,10 @@ int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
5007 unsigned long rflags; 5156 unsigned long rflags;
5008 int i, r; 5157 int i, r;
5009 5158
5010 vcpu_load(vcpu);
5011
5012 if (dbg->control & (KVM_GUESTDBG_INJECT_DB | KVM_GUESTDBG_INJECT_BP)) { 5159 if (dbg->control & (KVM_GUESTDBG_INJECT_DB | KVM_GUESTDBG_INJECT_BP)) {
5013 r = -EBUSY; 5160 r = -EBUSY;
5014 if (vcpu->arch.exception.pending) 5161 if (vcpu->arch.exception.pending)
5015 goto unlock_out; 5162 goto out;
5016 if (dbg->control & KVM_GUESTDBG_INJECT_DB) 5163 if (dbg->control & KVM_GUESTDBG_INJECT_DB)
5017 kvm_queue_exception(vcpu, DB_VECTOR); 5164 kvm_queue_exception(vcpu, DB_VECTOR);
5018 else 5165 else
@@ -5054,34 +5201,12 @@ int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu,
5054 5201
5055 r = 0; 5202 r = 0;
5056 5203
5057unlock_out: 5204out:
5058 vcpu_put(vcpu);
5059 5205
5060 return r; 5206 return r;
5061} 5207}
5062 5208
5063/* 5209/*
5064 * fxsave fpu state. Taken from x86_64/processor.h. To be killed when
5065 * we have asm/x86/processor.h
5066 */
5067struct fxsave {
5068 u16 cwd;
5069 u16 swd;
5070 u16 twd;
5071 u16 fop;
5072 u64 rip;
5073 u64 rdp;
5074 u32 mxcsr;
5075 u32 mxcsr_mask;
5076 u32 st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */
5077#ifdef CONFIG_X86_64
5078 u32 xmm_space[64]; /* 16*16 bytes for each XMM-reg = 256 bytes */
5079#else
5080 u32 xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */
5081#endif
5082};
5083
5084/*
5085 * Translate a guest virtual address to a guest physical address. 5210 * Translate a guest virtual address to a guest physical address.
5086 */ 5211 */
5087int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu, 5212int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
@@ -5091,7 +5216,6 @@ int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
5091 gpa_t gpa; 5216 gpa_t gpa;
5092 int idx; 5217 int idx;
5093 5218
5094 vcpu_load(vcpu);
5095 idx = srcu_read_lock(&vcpu->kvm->srcu); 5219 idx = srcu_read_lock(&vcpu->kvm->srcu);
5096 gpa = kvm_mmu_gva_to_gpa_system(vcpu, vaddr, NULL); 5220 gpa = kvm_mmu_gva_to_gpa_system(vcpu, vaddr, NULL);
5097 srcu_read_unlock(&vcpu->kvm->srcu, idx); 5221 srcu_read_unlock(&vcpu->kvm->srcu, idx);
@@ -5099,16 +5223,14 @@ int kvm_arch_vcpu_ioctl_translate(struct kvm_vcpu *vcpu,
5099 tr->valid = gpa != UNMAPPED_GVA; 5223 tr->valid = gpa != UNMAPPED_GVA;
5100 tr->writeable = 1; 5224 tr->writeable = 1;
5101 tr->usermode = 0; 5225 tr->usermode = 0;
5102 vcpu_put(vcpu);
5103 5226
5104 return 0; 5227 return 0;
5105} 5228}
5106 5229
5107int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) 5230int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
5108{ 5231{
5109 struct fxsave *fxsave = (struct fxsave *)&vcpu->arch.guest_fx_image; 5232 struct i387_fxsave_struct *fxsave =
5110 5233 &vcpu->arch.guest_fpu.state->fxsave;
5111 vcpu_load(vcpu);
5112 5234
5113 memcpy(fpu->fpr, fxsave->st_space, 128); 5235 memcpy(fpu->fpr, fxsave->st_space, 128);
5114 fpu->fcw = fxsave->cwd; 5236 fpu->fcw = fxsave->cwd;
@@ -5119,16 +5241,13 @@ int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
5119 fpu->last_dp = fxsave->rdp; 5241 fpu->last_dp = fxsave->rdp;
5120 memcpy(fpu->xmm, fxsave->xmm_space, sizeof fxsave->xmm_space); 5242 memcpy(fpu->xmm, fxsave->xmm_space, sizeof fxsave->xmm_space);
5121 5243
5122 vcpu_put(vcpu);
5123
5124 return 0; 5244 return 0;
5125} 5245}
5126 5246
5127int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) 5247int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
5128{ 5248{
5129 struct fxsave *fxsave = (struct fxsave *)&vcpu->arch.guest_fx_image; 5249 struct i387_fxsave_struct *fxsave =
5130 5250 &vcpu->arch.guest_fpu.state->fxsave;
5131 vcpu_load(vcpu);
5132 5251
5133 memcpy(fxsave->st_space, fpu->fpr, 128); 5252 memcpy(fxsave->st_space, fpu->fpr, 128);
5134 fxsave->cwd = fpu->fcw; 5253 fxsave->cwd = fpu->fcw;
@@ -5139,61 +5258,63 @@ int kvm_arch_vcpu_ioctl_set_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu)
5139 fxsave->rdp = fpu->last_dp; 5258 fxsave->rdp = fpu->last_dp;
5140 memcpy(fxsave->xmm_space, fpu->xmm, sizeof fxsave->xmm_space); 5259 memcpy(fxsave->xmm_space, fpu->xmm, sizeof fxsave->xmm_space);
5141 5260
5142 vcpu_put(vcpu);
5143
5144 return 0; 5261 return 0;
5145} 5262}
5146 5263
5147void fx_init(struct kvm_vcpu *vcpu) 5264int fx_init(struct kvm_vcpu *vcpu)
5148{ 5265{
5149 unsigned after_mxcsr_mask; 5266 int err;
5267
5268 err = fpu_alloc(&vcpu->arch.guest_fpu);
5269 if (err)
5270 return err;
5271
5272 fpu_finit(&vcpu->arch.guest_fpu);
5150 5273
5151 /* 5274 /*
5152 * Touch the fpu the first time in non atomic context as if 5275 * Ensure guest xcr0 is valid for loading
5153 * this is the first fpu instruction the exception handler
5154 * will fire before the instruction returns and it'll have to
5155 * allocate ram with GFP_KERNEL.
5156 */ 5276 */
5157 if (!used_math()) 5277 vcpu->arch.xcr0 = XSTATE_FP;
5158 kvm_fx_save(&vcpu->arch.host_fx_image);
5159
5160 /* Initialize guest FPU by resetting ours and saving into guest's */
5161 preempt_disable();
5162 kvm_fx_save(&vcpu->arch.host_fx_image);
5163 kvm_fx_finit();
5164 kvm_fx_save(&vcpu->arch.guest_fx_image);
5165 kvm_fx_restore(&vcpu->arch.host_fx_image);
5166 preempt_enable();
5167 5278
5168 vcpu->arch.cr0 |= X86_CR0_ET; 5279 vcpu->arch.cr0 |= X86_CR0_ET;
5169 after_mxcsr_mask = offsetof(struct i387_fxsave_struct, st_space); 5280
5170 vcpu->arch.guest_fx_image.mxcsr = 0x1f80; 5281 return 0;
5171 memset((void *)&vcpu->arch.guest_fx_image + after_mxcsr_mask,
5172 0, sizeof(struct i387_fxsave_struct) - after_mxcsr_mask);
5173} 5282}
5174EXPORT_SYMBOL_GPL(fx_init); 5283EXPORT_SYMBOL_GPL(fx_init);
5175 5284
5285static void fx_free(struct kvm_vcpu *vcpu)
5286{
5287 fpu_free(&vcpu->arch.guest_fpu);
5288}
5289
5176void kvm_load_guest_fpu(struct kvm_vcpu *vcpu) 5290void kvm_load_guest_fpu(struct kvm_vcpu *vcpu)
5177{ 5291{
5178 if (vcpu->guest_fpu_loaded) 5292 if (vcpu->guest_fpu_loaded)
5179 return; 5293 return;
5180 5294
5295 /*
5296 * Restore all possible states in the guest,
5297 * and assume host would use all available bits.
5298 * Guest xcr0 would be loaded later.
5299 */
5300 kvm_put_guest_xcr0(vcpu);
5181 vcpu->guest_fpu_loaded = 1; 5301 vcpu->guest_fpu_loaded = 1;
5182 kvm_fx_save(&vcpu->arch.host_fx_image); 5302 unlazy_fpu(current);
5183 kvm_fx_restore(&vcpu->arch.guest_fx_image); 5303 fpu_restore_checking(&vcpu->arch.guest_fpu);
5184 trace_kvm_fpu(1); 5304 trace_kvm_fpu(1);
5185} 5305}
5186 5306
5187void kvm_put_guest_fpu(struct kvm_vcpu *vcpu) 5307void kvm_put_guest_fpu(struct kvm_vcpu *vcpu)
5188{ 5308{
5309 kvm_put_guest_xcr0(vcpu);
5310
5189 if (!vcpu->guest_fpu_loaded) 5311 if (!vcpu->guest_fpu_loaded)
5190 return; 5312 return;
5191 5313
5192 vcpu->guest_fpu_loaded = 0; 5314 vcpu->guest_fpu_loaded = 0;
5193 kvm_fx_save(&vcpu->arch.guest_fx_image); 5315 fpu_save_init(&vcpu->arch.guest_fpu);
5194 kvm_fx_restore(&vcpu->arch.host_fx_image);
5195 ++vcpu->stat.fpu_reload; 5316 ++vcpu->stat.fpu_reload;
5196 set_bit(KVM_REQ_DEACTIVATE_FPU, &vcpu->requests); 5317 kvm_make_request(KVM_REQ_DEACTIVATE_FPU, vcpu);
5197 trace_kvm_fpu(0); 5318 trace_kvm_fpu(0);
5198} 5319}
5199 5320
@@ -5204,6 +5325,8 @@ void kvm_arch_vcpu_free(struct kvm_vcpu *vcpu)
5204 vcpu->arch.time_page = NULL; 5325 vcpu->arch.time_page = NULL;
5205 } 5326 }
5206 5327
5328 free_cpumask_var(vcpu->arch.wbinvd_dirty_mask);
5329 fx_free(vcpu);
5207 kvm_x86_ops->vcpu_free(vcpu); 5330 kvm_x86_ops->vcpu_free(vcpu);
5208} 5331}
5209 5332
@@ -5217,9 +5340,6 @@ int kvm_arch_vcpu_setup(struct kvm_vcpu *vcpu)
5217{ 5340{
5218 int r; 5341 int r;
5219 5342
5220 /* We do fxsave: this must be aligned. */
5221 BUG_ON((unsigned long)&vcpu->arch.host_fx_image & 0xF);
5222
5223 vcpu->arch.mtrr_state.have_fixed = 1; 5343 vcpu->arch.mtrr_state.have_fixed = 1;
5224 vcpu_load(vcpu); 5344 vcpu_load(vcpu);
5225 r = kvm_arch_vcpu_reset(vcpu); 5345 r = kvm_arch_vcpu_reset(vcpu);
@@ -5241,6 +5361,7 @@ void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
5241 kvm_mmu_unload(vcpu); 5361 kvm_mmu_unload(vcpu);
5242 vcpu_put(vcpu); 5362 vcpu_put(vcpu);
5243 5363
5364 fx_free(vcpu);
5244 kvm_x86_ops->vcpu_free(vcpu); 5365 kvm_x86_ops->vcpu_free(vcpu);
5245} 5366}
5246 5367
@@ -5334,7 +5455,12 @@ int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu)
5334 } 5455 }
5335 vcpu->arch.mcg_cap = KVM_MAX_MCE_BANKS; 5456 vcpu->arch.mcg_cap = KVM_MAX_MCE_BANKS;
5336 5457
5458 if (!zalloc_cpumask_var(&vcpu->arch.wbinvd_dirty_mask, GFP_KERNEL))
5459 goto fail_free_mce_banks;
5460
5337 return 0; 5461 return 0;
5462fail_free_mce_banks:
5463 kfree(vcpu->arch.mce_banks);
5338fail_free_lapic: 5464fail_free_lapic:
5339 kvm_free_lapic(vcpu); 5465 kvm_free_lapic(vcpu);
5340fail_mmu_destroy: 5466fail_mmu_destroy:
@@ -5364,12 +5490,6 @@ struct kvm *kvm_arch_create_vm(void)
5364 if (!kvm) 5490 if (!kvm)
5365 return ERR_PTR(-ENOMEM); 5491 return ERR_PTR(-ENOMEM);
5366 5492
5367 kvm->arch.aliases = kzalloc(sizeof(struct kvm_mem_aliases), GFP_KERNEL);
5368 if (!kvm->arch.aliases) {
5369 kfree(kvm);
5370 return ERR_PTR(-ENOMEM);
5371 }
5372
5373 INIT_LIST_HEAD(&kvm->arch.active_mmu_pages); 5493 INIT_LIST_HEAD(&kvm->arch.active_mmu_pages);
5374 INIT_LIST_HEAD(&kvm->arch.assigned_dev_head); 5494 INIT_LIST_HEAD(&kvm->arch.assigned_dev_head);
5375 5495
@@ -5412,12 +5532,12 @@ static void kvm_free_vcpus(struct kvm *kvm)
5412void kvm_arch_sync_events(struct kvm *kvm) 5532void kvm_arch_sync_events(struct kvm *kvm)
5413{ 5533{
5414 kvm_free_all_assigned_devices(kvm); 5534 kvm_free_all_assigned_devices(kvm);
5535 kvm_free_pit(kvm);
5415} 5536}
5416 5537
5417void kvm_arch_destroy_vm(struct kvm *kvm) 5538void kvm_arch_destroy_vm(struct kvm *kvm)
5418{ 5539{
5419 kvm_iommu_unmap_guest(kvm); 5540 kvm_iommu_unmap_guest(kvm);
5420 kvm_free_pit(kvm);
5421 kfree(kvm->arch.vpic); 5541 kfree(kvm->arch.vpic);
5422 kfree(kvm->arch.vioapic); 5542 kfree(kvm->arch.vioapic);
5423 kvm_free_vcpus(kvm); 5543 kvm_free_vcpus(kvm);
@@ -5427,7 +5547,6 @@ void kvm_arch_destroy_vm(struct kvm *kvm)
5427 if (kvm->arch.ept_identity_pagetable) 5547 if (kvm->arch.ept_identity_pagetable)
5428 put_page(kvm->arch.ept_identity_pagetable); 5548 put_page(kvm->arch.ept_identity_pagetable);
5429 cleanup_srcu_struct(&kvm->srcu); 5549 cleanup_srcu_struct(&kvm->srcu);
5430 kfree(kvm->arch.aliases);
5431 kfree(kvm); 5550 kfree(kvm);
5432} 5551}
5433 5552
@@ -5438,6 +5557,11 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
5438 int user_alloc) 5557 int user_alloc)
5439{ 5558{
5440 int npages = memslot->npages; 5559 int npages = memslot->npages;
5560 int map_flags = MAP_PRIVATE | MAP_ANONYMOUS;
5561
5562 /* Prevent internal slot pages from being moved by fork()/COW. */
5563 if (memslot->id >= KVM_MEMORY_SLOTS)
5564 map_flags = MAP_SHARED | MAP_ANONYMOUS;
5441 5565
5442 /*To keep backward compatibility with older userspace, 5566 /*To keep backward compatibility with older userspace,
5443 *x86 needs to hanlde !user_alloc case. 5567 *x86 needs to hanlde !user_alloc case.
@@ -5450,7 +5574,7 @@ int kvm_arch_prepare_memory_region(struct kvm *kvm,
5450 userspace_addr = do_mmap(NULL, 0, 5574 userspace_addr = do_mmap(NULL, 0,
5451 npages * PAGE_SIZE, 5575 npages * PAGE_SIZE,
5452 PROT_READ | PROT_WRITE, 5576 PROT_READ | PROT_WRITE,
5453 MAP_PRIVATE | MAP_ANONYMOUS, 5577 map_flags,
5454 0); 5578 0);
5455 up_write(&current->mm->mmap_sem); 5579 up_write(&current->mm->mmap_sem);
5456 5580
@@ -5523,7 +5647,7 @@ void kvm_vcpu_kick(struct kvm_vcpu *vcpu)
5523 5647
5524 me = get_cpu(); 5648 me = get_cpu();
5525 if (cpu != me && (unsigned)cpu < nr_cpu_ids && cpu_online(cpu)) 5649 if (cpu != me && (unsigned)cpu < nr_cpu_ids && cpu_online(cpu))
5526 if (!test_and_set_bit(KVM_REQ_KICK, &vcpu->requests)) 5650 if (atomic_xchg(&vcpu->guest_mode, 0))
5527 smp_send_reschedule(cpu); 5651 smp_send_reschedule(cpu);
5528 put_cpu(); 5652 put_cpu();
5529} 5653}
diff --git a/arch/x86/kvm/x86.h b/arch/x86/kvm/x86.h
index f4b54458285b..b7a404722d2b 100644
--- a/arch/x86/kvm/x86.h
+++ b/arch/x86/kvm/x86.h
@@ -65,13 +65,6 @@ static inline int is_paging(struct kvm_vcpu *vcpu)
65 return kvm_read_cr0_bits(vcpu, X86_CR0_PG); 65 return kvm_read_cr0_bits(vcpu, X86_CR0_PG);
66} 66}
67 67
68static inline struct kvm_mem_aliases *kvm_aliases(struct kvm *kvm)
69{
70 return rcu_dereference_check(kvm->arch.aliases,
71 srcu_read_lock_held(&kvm->srcu)
72 || lockdep_is_held(&kvm->slots_lock));
73}
74
75void kvm_before_handle_nmi(struct kvm_vcpu *vcpu); 68void kvm_before_handle_nmi(struct kvm_vcpu *vcpu);
76void kvm_after_handle_nmi(struct kvm_vcpu *vcpu); 69void kvm_after_handle_nmi(struct kvm_vcpu *vcpu);
77 70
diff --git a/arch/x86/lib/Makefile b/arch/x86/lib/Makefile
index f871e04b6965..e10cf070ede0 100644
--- a/arch/x86/lib/Makefile
+++ b/arch/x86/lib/Makefile
@@ -30,6 +30,7 @@ ifeq ($(CONFIG_X86_32),y)
30 lib-y += checksum_32.o 30 lib-y += checksum_32.o
31 lib-y += strstr_32.o 31 lib-y += strstr_32.o
32 lib-y += semaphore_32.o string_32.o 32 lib-y += semaphore_32.o string_32.o
33 lib-y += cmpxchg.o
33ifneq ($(CONFIG_X86_CMPXCHG64),y) 34ifneq ($(CONFIG_X86_CMPXCHG64),y)
34 lib-y += cmpxchg8b_emu.o atomic64_386_32.o 35 lib-y += cmpxchg8b_emu.o atomic64_386_32.o
35endif 36endif
diff --git a/arch/x86/kernel/cpu/cmpxchg.c b/arch/x86/lib/cmpxchg.c
index 2056ccf572cc..5d619f6df3ee 100644
--- a/arch/x86/kernel/cpu/cmpxchg.c
+++ b/arch/x86/lib/cmpxchg.c
@@ -52,21 +52,3 @@ unsigned long cmpxchg_386_u32(volatile void *ptr, u32 old, u32 new)
52} 52}
53EXPORT_SYMBOL(cmpxchg_386_u32); 53EXPORT_SYMBOL(cmpxchg_386_u32);
54#endif 54#endif
55
56#ifndef CONFIG_X86_CMPXCHG64
57unsigned long long cmpxchg_486_u64(volatile void *ptr, u64 old, u64 new)
58{
59 u64 prev;
60 unsigned long flags;
61
62 /* Poor man's cmpxchg8b for 386 and 486. Unsuitable for SMP */
63 local_irq_save(flags);
64 prev = *(u64 *)ptr;
65 if (prev == old)
66 *(u64 *)ptr = new;
67 local_irq_restore(flags);
68 return prev;
69}
70EXPORT_SYMBOL(cmpxchg_486_u64);
71#endif
72
diff --git a/arch/x86/mm/dump_pagetables.c b/arch/x86/mm/dump_pagetables.c
index a725b7f760ae..0002a3a33081 100644
--- a/arch/x86/mm/dump_pagetables.c
+++ b/arch/x86/mm/dump_pagetables.c
@@ -37,6 +37,28 @@ struct addr_marker {
37 const char *name; 37 const char *name;
38}; 38};
39 39
40/* indices for address_markers; keep sync'd w/ address_markers below */
41enum address_markers_idx {
42 USER_SPACE_NR = 0,
43#ifdef CONFIG_X86_64
44 KERNEL_SPACE_NR,
45 LOW_KERNEL_NR,
46 VMALLOC_START_NR,
47 VMEMMAP_START_NR,
48 HIGH_KERNEL_NR,
49 MODULES_VADDR_NR,
50 MODULES_END_NR,
51#else
52 KERNEL_SPACE_NR,
53 VMALLOC_START_NR,
54 VMALLOC_END_NR,
55# ifdef CONFIG_HIGHMEM
56 PKMAP_BASE_NR,
57# endif
58 FIXADDR_START_NR,
59#endif
60};
61
40/* Address space markers hints */ 62/* Address space markers hints */
41static struct addr_marker address_markers[] = { 63static struct addr_marker address_markers[] = {
42 { 0, "User Space" }, 64 { 0, "User Space" },
@@ -331,14 +353,12 @@ static int pt_dump_init(void)
331 353
332#ifdef CONFIG_X86_32 354#ifdef CONFIG_X86_32
333 /* Not a compile-time constant on x86-32 */ 355 /* Not a compile-time constant on x86-32 */
334 address_markers[2].start_address = VMALLOC_START; 356 address_markers[VMALLOC_START_NR].start_address = VMALLOC_START;
335 address_markers[3].start_address = VMALLOC_END; 357 address_markers[VMALLOC_END_NR].start_address = VMALLOC_END;
336# ifdef CONFIG_HIGHMEM 358# ifdef CONFIG_HIGHMEM
337 address_markers[4].start_address = PKMAP_BASE; 359 address_markers[PKMAP_BASE_NR].start_address = PKMAP_BASE;
338 address_markers[5].start_address = FIXADDR_START;
339# else
340 address_markers[4].start_address = FIXADDR_START;
341# endif 360# endif
361 address_markers[FIXADDR_START_NR].start_address = FIXADDR_START;
342#endif 362#endif
343 363
344 pe = debugfs_create_file("kernel_page_tables", 0600, NULL, NULL, 364 pe = debugfs_create_file("kernel_page_tables", 0600, NULL, NULL,
diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index ee41bba315d1..9a6674689a20 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -2,7 +2,7 @@
2 * linux/arch/x86_64/mm/init.c 2 * linux/arch/x86_64/mm/init.c
3 * 3 *
4 * Copyright (C) 1995 Linus Torvalds 4 * Copyright (C) 1995 Linus Torvalds
5 * Copyright (C) 2000 Pavel Machek <pavel@suse.cz> 5 * Copyright (C) 2000 Pavel Machek <pavel@ucw.cz>
6 * Copyright (C) 2002,2003 Andi Kleen <ak@suse.de> 6 * Copyright (C) 2002,2003 Andi Kleen <ak@suse.de>
7 */ 7 */
8 8
diff --git a/arch/x86/mm/ioremap.c b/arch/x86/mm/ioremap.c
index 12e4d2d3c110..3ba6e0608c55 100644
--- a/arch/x86/mm/ioremap.c
+++ b/arch/x86/mm/ioremap.c
@@ -62,8 +62,8 @@ int ioremap_change_attr(unsigned long vaddr, unsigned long size,
62static void __iomem *__ioremap_caller(resource_size_t phys_addr, 62static void __iomem *__ioremap_caller(resource_size_t phys_addr,
63 unsigned long size, unsigned long prot_val, void *caller) 63 unsigned long size, unsigned long prot_val, void *caller)
64{ 64{
65 unsigned long pfn, offset, vaddr; 65 unsigned long offset, vaddr;
66 resource_size_t last_addr; 66 resource_size_t pfn, last_pfn, last_addr;
67 const resource_size_t unaligned_phys_addr = phys_addr; 67 const resource_size_t unaligned_phys_addr = phys_addr;
68 const unsigned long unaligned_size = size; 68 const unsigned long unaligned_size = size;
69 struct vm_struct *area; 69 struct vm_struct *area;
@@ -100,10 +100,8 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
100 /* 100 /*
101 * Don't allow anybody to remap normal RAM that we're using.. 101 * Don't allow anybody to remap normal RAM that we're using..
102 */ 102 */
103 for (pfn = phys_addr >> PAGE_SHIFT; 103 last_pfn = last_addr >> PAGE_SHIFT;
104 (pfn << PAGE_SHIFT) < (last_addr & PAGE_MASK); 104 for (pfn = phys_addr >> PAGE_SHIFT; pfn <= last_pfn; pfn++) {
105 pfn++) {
106
107 int is_ram = page_is_ram(pfn); 105 int is_ram = page_is_ram(pfn);
108 106
109 if (is_ram && pfn_valid(pfn) && !PageReserved(pfn_to_page(pfn))) 107 if (is_ram && pfn_valid(pfn) && !PageReserved(pfn_to_page(pfn)))
@@ -115,7 +113,7 @@ static void __iomem *__ioremap_caller(resource_size_t phys_addr,
115 * Mappings have to be page-aligned 113 * Mappings have to be page-aligned
116 */ 114 */
117 offset = phys_addr & ~PAGE_MASK; 115 offset = phys_addr & ~PAGE_MASK;
118 phys_addr &= PAGE_MASK; 116 phys_addr &= PHYSICAL_PAGE_MASK;
119 size = PAGE_ALIGN(last_addr+1) - phys_addr; 117 size = PAGE_ALIGN(last_addr+1) - phys_addr;
120 118
121 retval = reserve_memtype(phys_addr, (u64)phys_addr + size, 119 retval = reserve_memtype(phys_addr, (u64)phys_addr + size,
@@ -613,7 +611,7 @@ void __init early_iounmap(void __iomem *addr, unsigned long size)
613 return; 611 return;
614 } 612 }
615 offset = virt_addr & ~PAGE_MASK; 613 offset = virt_addr & ~PAGE_MASK;
616 nrpages = PAGE_ALIGN(offset + size - 1) >> PAGE_SHIFT; 614 nrpages = PAGE_ALIGN(offset + size) >> PAGE_SHIFT;
617 615
618 idx = FIX_BTMAP_BEGIN - NR_FIX_BTMAPS*slot; 616 idx = FIX_BTMAP_BEGIN - NR_FIX_BTMAPS*slot;
619 while (nrpages > 0) { 617 while (nrpages > 0) {
diff --git a/arch/x86/mm/kmmio.c b/arch/x86/mm/kmmio.c
index 5d0e67fff1a6..e5d5e2ce9f77 100644
--- a/arch/x86/mm/kmmio.c
+++ b/arch/x86/mm/kmmio.c
@@ -45,6 +45,8 @@ struct kmmio_fault_page {
45 * Protected by kmmio_lock, when linked into kmmio_page_table. 45 * Protected by kmmio_lock, when linked into kmmio_page_table.
46 */ 46 */
47 int count; 47 int count;
48
49 bool scheduled_for_release;
48}; 50};
49 51
50struct kmmio_delayed_release { 52struct kmmio_delayed_release {
@@ -398,8 +400,11 @@ static void release_kmmio_fault_page(unsigned long page,
398 BUG_ON(f->count < 0); 400 BUG_ON(f->count < 0);
399 if (!f->count) { 401 if (!f->count) {
400 disarm_kmmio_fault_page(f); 402 disarm_kmmio_fault_page(f);
401 f->release_next = *release_list; 403 if (!f->scheduled_for_release) {
402 *release_list = f; 404 f->release_next = *release_list;
405 *release_list = f;
406 f->scheduled_for_release = true;
407 }
403 } 408 }
404} 409}
405 410
@@ -471,8 +476,10 @@ static void remove_kmmio_fault_pages(struct rcu_head *head)
471 prevp = &f->release_next; 476 prevp = &f->release_next;
472 } else { 477 } else {
473 *prevp = f->release_next; 478 *prevp = f->release_next;
479 f->release_next = NULL;
480 f->scheduled_for_release = false;
474 } 481 }
475 f = f->release_next; 482 f = *prevp;
476 } 483 }
477 spin_unlock_irqrestore(&kmmio_lock, flags); 484 spin_unlock_irqrestore(&kmmio_lock, flags);
478 485
@@ -510,6 +517,9 @@ void unregister_kmmio_probe(struct kmmio_probe *p)
510 kmmio_count--; 517 kmmio_count--;
511 spin_unlock_irqrestore(&kmmio_lock, flags); 518 spin_unlock_irqrestore(&kmmio_lock, flags);
512 519
520 if (!release_list)
521 return;
522
513 drelease = kmalloc(sizeof(*drelease), GFP_ATOMIC); 523 drelease = kmalloc(sizeof(*drelease), GFP_ATOMIC);
514 if (!drelease) { 524 if (!drelease) {
515 pr_crit("leaking kmmio_fault_page objects.\n"); 525 pr_crit("leaking kmmio_fault_page objects.\n");
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index 64121a18b8cb..f6ff57b7efa5 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -158,7 +158,7 @@ static unsigned long pat_x_mtrr_type(u64 start, u64 end, unsigned long req_type)
158 return req_type; 158 return req_type;
159} 159}
160 160
161static int pat_pagerange_is_ram(unsigned long start, unsigned long end) 161static int pat_pagerange_is_ram(resource_size_t start, resource_size_t end)
162{ 162{
163 int ram_page = 0, not_rampage = 0; 163 int ram_page = 0, not_rampage = 0;
164 unsigned long page_nr; 164 unsigned long page_nr;
diff --git a/arch/x86/mm/pf_in.c b/arch/x86/mm/pf_in.c
index 308e32570d84..38e6d174c497 100644
--- a/arch/x86/mm/pf_in.c
+++ b/arch/x86/mm/pf_in.c
@@ -40,16 +40,16 @@ static unsigned char prefix_codes[] = {
40static unsigned int reg_rop[] = { 40static unsigned int reg_rop[] = {
41 0x8A, 0x8B, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F 41 0x8A, 0x8B, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F
42}; 42};
43static unsigned int reg_wop[] = { 0x88, 0x89 }; 43static unsigned int reg_wop[] = { 0x88, 0x89, 0xAA, 0xAB };
44static unsigned int imm_wop[] = { 0xC6, 0xC7 }; 44static unsigned int imm_wop[] = { 0xC6, 0xC7 };
45/* IA32 Manual 3, 3-432*/ 45/* IA32 Manual 3, 3-432*/
46static unsigned int rw8[] = { 0x88, 0x8A, 0xC6 }; 46static unsigned int rw8[] = { 0x88, 0x8A, 0xC6, 0xAA };
47static unsigned int rw32[] = { 47static unsigned int rw32[] = {
48 0x89, 0x8B, 0xC7, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F 48 0x89, 0x8B, 0xC7, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F, 0xAB
49}; 49};
50static unsigned int mw8[] = { 0x88, 0x8A, 0xC6, 0xB60F, 0xBE0F }; 50static unsigned int mw8[] = { 0x88, 0x8A, 0xC6, 0xB60F, 0xBE0F, 0xAA };
51static unsigned int mw16[] = { 0xB70F, 0xBF0F }; 51static unsigned int mw16[] = { 0xB70F, 0xBF0F };
52static unsigned int mw32[] = { 0x89, 0x8B, 0xC7 }; 52static unsigned int mw32[] = { 0x89, 0x8B, 0xC7, 0xAB };
53static unsigned int mw64[] = {}; 53static unsigned int mw64[] = {};
54#else /* not __i386__ */ 54#else /* not __i386__ */
55static unsigned char prefix_codes[] = { 55static unsigned char prefix_codes[] = {
@@ -63,20 +63,20 @@ static unsigned char prefix_codes[] = {
63static unsigned int reg_rop[] = { 63static unsigned int reg_rop[] = {
64 0x8A, 0x8B, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F 64 0x8A, 0x8B, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F
65}; 65};
66static unsigned int reg_wop[] = { 0x88, 0x89 }; 66static unsigned int reg_wop[] = { 0x88, 0x89, 0xAA, 0xAB };
67static unsigned int imm_wop[] = { 0xC6, 0xC7 }; 67static unsigned int imm_wop[] = { 0xC6, 0xC7 };
68static unsigned int rw8[] = { 0xC6, 0x88, 0x8A }; 68static unsigned int rw8[] = { 0xC6, 0x88, 0x8A, 0xAA };
69static unsigned int rw32[] = { 69static unsigned int rw32[] = {
70 0xC7, 0x89, 0x8B, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F 70 0xC7, 0x89, 0x8B, 0xB60F, 0xB70F, 0xBE0F, 0xBF0F, 0xAB
71}; 71};
72/* 8 bit only */ 72/* 8 bit only */
73static unsigned int mw8[] = { 0xC6, 0x88, 0x8A, 0xB60F, 0xBE0F }; 73static unsigned int mw8[] = { 0xC6, 0x88, 0x8A, 0xB60F, 0xBE0F, 0xAA };
74/* 16 bit only */ 74/* 16 bit only */
75static unsigned int mw16[] = { 0xB70F, 0xBF0F }; 75static unsigned int mw16[] = { 0xB70F, 0xBF0F };
76/* 16 or 32 bit */ 76/* 16 or 32 bit */
77static unsigned int mw32[] = { 0xC7 }; 77static unsigned int mw32[] = { 0xC7 };
78/* 16, 32 or 64 bit */ 78/* 16, 32 or 64 bit */
79static unsigned int mw64[] = { 0x89, 0x8B }; 79static unsigned int mw64[] = { 0x89, 0x8B, 0xAB };
80#endif /* not __i386__ */ 80#endif /* not __i386__ */
81 81
82struct prefix_bits { 82struct prefix_bits {
@@ -410,7 +410,6 @@ static unsigned long *get_reg_w32(int no, struct pt_regs *regs)
410unsigned long get_ins_reg_val(unsigned long ins_addr, struct pt_regs *regs) 410unsigned long get_ins_reg_val(unsigned long ins_addr, struct pt_regs *regs)
411{ 411{
412 unsigned int opcode; 412 unsigned int opcode;
413 unsigned char mod_rm;
414 int reg; 413 int reg;
415 unsigned char *p; 414 unsigned char *p;
416 struct prefix_bits prf; 415 struct prefix_bits prf;
@@ -437,8 +436,13 @@ unsigned long get_ins_reg_val(unsigned long ins_addr, struct pt_regs *regs)
437 goto err; 436 goto err;
438 437
439do_work: 438do_work:
440 mod_rm = *p; 439 /* for STOS, source register is fixed */
441 reg = ((mod_rm >> 3) & 0x7) | (prf.rexr << 3); 440 if (opcode == 0xAA || opcode == 0xAB) {
441 reg = arg_AX;
442 } else {
443 unsigned char mod_rm = *p;
444 reg = ((mod_rm >> 3) & 0x7) | (prf.rexr << 3);
445 }
442 switch (get_ins_reg_width(ins_addr)) { 446 switch (get_ins_reg_width(ins_addr)) {
443 case 1: 447 case 1:
444 return *get_reg_w8(reg, prf.rex, regs); 448 return *get_reg_w8(reg, prf.rex, regs);
diff --git a/arch/x86/mm/testmmiotrace.c b/arch/x86/mm/testmmiotrace.c
index 8565d944f7cf..38868adf07ea 100644
--- a/arch/x86/mm/testmmiotrace.c
+++ b/arch/x86/mm/testmmiotrace.c
@@ -90,6 +90,27 @@ static void do_test(unsigned long size)
90 iounmap(p); 90 iounmap(p);
91} 91}
92 92
93/*
94 * Tests how mmiotrace behaves in face of multiple ioremap / iounmaps in
95 * a short time. We had a bug in deferred freeing procedure which tried
96 * to free this region multiple times (ioremap can reuse the same address
97 * for many mappings).
98 */
99static void do_test_bulk_ioremapping(void)
100{
101 void __iomem *p;
102 int i;
103
104 for (i = 0; i < 10; ++i) {
105 p = ioremap_nocache(mmio_address, PAGE_SIZE);
106 if (p)
107 iounmap(p);
108 }
109
110 /* Force freeing. If it will crash we will know why. */
111 synchronize_rcu();
112}
113
93static int __init init(void) 114static int __init init(void)
94{ 115{
95 unsigned long size = (read_far) ? (8 << 20) : (16 << 10); 116 unsigned long size = (read_far) ? (8 << 20) : (16 << 10);
@@ -104,6 +125,7 @@ static int __init init(void)
104 "and writing 16 kB of rubbish in there.\n", 125 "and writing 16 kB of rubbish in there.\n",
105 size >> 10, mmio_address); 126 size >> 10, mmio_address);
106 do_test(size); 127 do_test(size);
128 do_test_bulk_ioremapping();
107 pr_info("All done.\n"); 129 pr_info("All done.\n");
108 return 0; 130 return 0;
109} 131}
diff --git a/arch/x86/mm/tlb.c b/arch/x86/mm/tlb.c
index 426f3a1a64d3..c03f14ab6667 100644
--- a/arch/x86/mm/tlb.c
+++ b/arch/x86/mm/tlb.c
@@ -278,11 +278,9 @@ void flush_tlb_page(struct vm_area_struct *vma, unsigned long va)
278 278
279static void do_flush_tlb_all(void *info) 279static void do_flush_tlb_all(void *info)
280{ 280{
281 unsigned long cpu = smp_processor_id();
282
283 __flush_tlb_all(); 281 __flush_tlb_all();
284 if (percpu_read(cpu_tlbstate.state) == TLBSTATE_LAZY) 282 if (percpu_read(cpu_tlbstate.state) == TLBSTATE_LAZY)
285 leave_mm(cpu); 283 leave_mm(smp_processor_id());
286} 284}
287 285
288void flush_tlb_all(void) 286void flush_tlb_all(void)
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
index b28d2f1253bb..1ba67dc8006a 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -634,6 +634,18 @@ static int __init ppro_init(char **cpu_type)
634 if (force_arch_perfmon && cpu_has_arch_perfmon) 634 if (force_arch_perfmon && cpu_has_arch_perfmon)
635 return 0; 635 return 0;
636 636
637 /*
638 * Documentation on identifying Intel processors by CPU family
639 * and model can be found in the Intel Software Developer's
640 * Manuals (SDM):
641 *
642 * http://www.intel.com/products/processor/manuals/
643 *
644 * As of May 2010 the documentation for this was in the:
645 * "Intel 64 and IA-32 Architectures Software Developer's
646 * Manual Volume 3B: System Programming Guide", "Table B-1
647 * CPUID Signature Values of DisplayFamily_DisplayModel".
648 */
637 switch (cpu_model) { 649 switch (cpu_model) {
638 case 0 ... 2: 650 case 0 ... 2:
639 *cpu_type = "i386/ppro"; 651 *cpu_type = "i386/ppro";
@@ -655,12 +667,12 @@ static int __init ppro_init(char **cpu_type)
655 case 15: case 23: 667 case 15: case 23:
656 *cpu_type = "i386/core_2"; 668 *cpu_type = "i386/core_2";
657 break; 669 break;
670 case 0x1a:
658 case 0x2e: 671 case 0x2e:
659 case 26:
660 spec = &op_arch_perfmon_spec; 672 spec = &op_arch_perfmon_spec;
661 *cpu_type = "i386/core_i7"; 673 *cpu_type = "i386/core_i7";
662 break; 674 break;
663 case 28: 675 case 0x1c:
664 *cpu_type = "i386/atom"; 676 *cpu_type = "i386/atom";
665 break; 677 break;
666 default: 678 default:
diff --git a/arch/x86/pci/acpi.c b/arch/x86/pci/acpi.c
index 2ec04c424a62..15466c096ba5 100644
--- a/arch/x86/pci/acpi.c
+++ b/arch/x86/pci/acpi.c
@@ -34,6 +34,15 @@ static const struct dmi_system_id pci_use_crs_table[] __initconst = {
34 DMI_MATCH(DMI_PRODUCT_NAME, "x3800"), 34 DMI_MATCH(DMI_PRODUCT_NAME, "x3800"),
35 }, 35 },
36 }, 36 },
37 /* https://bugzilla.kernel.org/show_bug.cgi?id=16007 */
38 /* 2006 AMD HT/VIA system with two host bridges */
39 {
40 .callback = set_use_crs,
41 .ident = "ASRock ALiveSATA2-GLAN",
42 .matches = {
43 DMI_MATCH(DMI_PRODUCT_NAME, "ALiveSATA2-GLAN"),
44 },
45 },
37 {} 46 {}
38}; 47};
39 48
diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c
index 215a27ae050d..a0772af64efb 100644
--- a/arch/x86/pci/common.c
+++ b/arch/x86/pci/common.c
@@ -125,6 +125,23 @@ void __init dmi_check_skip_isa_align(void)
125static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev) 125static void __devinit pcibios_fixup_device_resources(struct pci_dev *dev)
126{ 126{
127 struct resource *rom_r = &dev->resource[PCI_ROM_RESOURCE]; 127 struct resource *rom_r = &dev->resource[PCI_ROM_RESOURCE];
128 struct resource *bar_r;
129 int bar;
130
131 if (pci_probe & PCI_NOASSIGN_BARS) {
132 /*
133 * If the BIOS did not assign the BAR, zero out the
134 * resource so the kernel doesn't attmept to assign
135 * it later on in pci_assign_unassigned_resources
136 */
137 for (bar = 0; bar <= PCI_STD_RESOURCE_END; bar++) {
138 bar_r = &dev->resource[bar];
139 if (bar_r->start == 0 && bar_r->end != 0) {
140 bar_r->flags = 0;
141 bar_r->end = 0;
142 }
143 }
144 }
128 145
129 if (pci_probe & PCI_NOASSIGN_ROMS) { 146 if (pci_probe & PCI_NOASSIGN_ROMS) {
130 if (rom_r->parent) 147 if (rom_r->parent)
@@ -509,6 +526,9 @@ char * __devinit pcibios_setup(char *str)
509 } else if (!strcmp(str, "norom")) { 526 } else if (!strcmp(str, "norom")) {
510 pci_probe |= PCI_NOASSIGN_ROMS; 527 pci_probe |= PCI_NOASSIGN_ROMS;
511 return NULL; 528 return NULL;
529 } else if (!strcmp(str, "nobar")) {
530 pci_probe |= PCI_NOASSIGN_BARS;
531 return NULL;
512 } else if (!strcmp(str, "assign-busses")) { 532 } else if (!strcmp(str, "assign-busses")) {
513 pci_probe |= PCI_ASSIGN_ALL_BUSSES; 533 pci_probe |= PCI_ASSIGN_ALL_BUSSES;
514 return NULL; 534 return NULL;
diff --git a/arch/x86/pci/irq.c b/arch/x86/pci/irq.c
index 9810a0f76c91..f547ee05f715 100644
--- a/arch/x86/pci/irq.c
+++ b/arch/x86/pci/irq.c
@@ -989,7 +989,7 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
989 dev_info(&dev->dev, "%s PCI INT %c -> IRQ %d\n", msg, 'A' + pin - 1, irq); 989 dev_info(&dev->dev, "%s PCI INT %c -> IRQ %d\n", msg, 'A' + pin - 1, irq);
990 990
991 /* Update IRQ for all devices with the same pirq value */ 991 /* Update IRQ for all devices with the same pirq value */
992 while ((dev2 = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev2)) != NULL) { 992 for_each_pci_dev(dev2) {
993 pci_read_config_byte(dev2, PCI_INTERRUPT_PIN, &pin); 993 pci_read_config_byte(dev2, PCI_INTERRUPT_PIN, &pin);
994 if (!pin) 994 if (!pin)
995 continue; 995 continue;
@@ -1028,7 +1028,7 @@ void __init pcibios_fixup_irqs(void)
1028 u8 pin; 1028 u8 pin;
1029 1029
1030 DBG(KERN_DEBUG "PCI: IRQ fixup\n"); 1030 DBG(KERN_DEBUG "PCI: IRQ fixup\n");
1031 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { 1031 for_each_pci_dev(dev) {
1032 /* 1032 /*
1033 * If the BIOS has set an out of range IRQ number, just 1033 * If the BIOS has set an out of range IRQ number, just
1034 * ignore it. Also keep track of which IRQ's are 1034 * ignore it. Also keep track of which IRQ's are
@@ -1052,7 +1052,7 @@ void __init pcibios_fixup_irqs(void)
1052 return; 1052 return;
1053 1053
1054 dev = NULL; 1054 dev = NULL;
1055 while ((dev = pci_get_device(PCI_ANY_ID, PCI_ANY_ID, dev)) != NULL) { 1055 for_each_pci_dev(dev) {
1056 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin); 1056 pci_read_config_byte(dev, PCI_INTERRUPT_PIN, &pin);
1057 if (!pin) 1057 if (!pin)
1058 continue; 1058 continue;
diff --git a/arch/x86/pci/legacy.c b/arch/x86/pci/legacy.c
index 8d460eaf524f..c89266be6048 100644
--- a/arch/x86/pci/legacy.c
+++ b/arch/x86/pci/legacy.c
@@ -36,7 +36,7 @@ int __init pci_legacy_init(void)
36 return 0; 36 return 0;
37} 37}
38 38
39void pcibios_scan_specific_bus(int busn) 39void __devinit pcibios_scan_specific_bus(int busn)
40{ 40{
41 int devfn; 41 int devfn;
42 long node; 42 long node;
diff --git a/arch/x86/power/cpu.c b/arch/x86/power/cpu.c
index 1290ba54b350..e7e8c5f54956 100644
--- a/arch/x86/power/cpu.c
+++ b/arch/x86/power/cpu.c
@@ -4,7 +4,7 @@
4 * Distribute under GPLv2 4 * Distribute under GPLv2
5 * 5 *
6 * Copyright (c) 2007 Rafael J. Wysocki <rjw@sisk.pl> 6 * Copyright (c) 2007 Rafael J. Wysocki <rjw@sisk.pl>
7 * Copyright (c) 2002 Pavel Machek <pavel@suse.cz> 7 * Copyright (c) 2002 Pavel Machek <pavel@ucw.cz>
8 * Copyright (c) 2001 Patrick Mochel <mochel@osdl.org> 8 * Copyright (c) 2001 Patrick Mochel <mochel@osdl.org>
9 */ 9 */
10 10
diff --git a/arch/x86/power/hibernate_64.c b/arch/x86/power/hibernate_64.c
index d24f983ba1e5..460f314d13e5 100644
--- a/arch/x86/power/hibernate_64.c
+++ b/arch/x86/power/hibernate_64.c
@@ -4,7 +4,7 @@
4 * Distribute under GPLv2 4 * Distribute under GPLv2
5 * 5 *
6 * Copyright (c) 2007 Rafael J. Wysocki <rjw@sisk.pl> 6 * Copyright (c) 2007 Rafael J. Wysocki <rjw@sisk.pl>
7 * Copyright (c) 2002 Pavel Machek <pavel@suse.cz> 7 * Copyright (c) 2002 Pavel Machek <pavel@ucw.cz>
8 * Copyright (c) 2001 Patrick Mochel <mochel@osdl.org> 8 * Copyright (c) 2001 Patrick Mochel <mochel@osdl.org>
9 */ 9 */
10 10
diff --git a/arch/x86/vdso/Makefile b/arch/x86/vdso/Makefile
index 6b4ffedb93c9..4a2afa1bac51 100644
--- a/arch/x86/vdso/Makefile
+++ b/arch/x86/vdso/Makefile
@@ -120,7 +120,8 @@ $(obj)/vdso32-syms.lds: $(vdso32.so-y:%=$(obj)/vdso32-%-syms.lds) FORCE
120quiet_cmd_vdso = VDSO $@ 120quiet_cmd_vdso = VDSO $@
121 cmd_vdso = $(CC) -nostdlib -o $@ \ 121 cmd_vdso = $(CC) -nostdlib -o $@ \
122 $(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \ 122 $(VDSO_LDFLAGS) $(VDSO_LDFLAGS_$(filter %.lds,$(^F))) \
123 -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) 123 -Wl,-T,$(filter %.lds,$^) $(filter %.o,$^) && \
124 sh $(srctree)/$(src)/checkundef.sh '$(NM)' '$@'
124 125
125VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv) 126VDSO_LDFLAGS = -fPIC -shared $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
126GCOV_PROFILE := n 127GCOV_PROFILE := n
diff --git a/arch/x86/vdso/checkundef.sh b/arch/x86/vdso/checkundef.sh
new file mode 100755
index 000000000000..7ee90a9b549d
--- /dev/null
+++ b/arch/x86/vdso/checkundef.sh
@@ -0,0 +1,10 @@
1#!/bin/sh
2nm="$1"
3file="$2"
4$nm "$file" | grep '^ *U' > /dev/null 2>&1
5if [ $? -eq 1 ]; then
6 exit 0
7else
8 echo "$file: undefined symbols found" >&2
9 exit 1
10fi
diff --git a/arch/x86/vdso/vdso32-setup.c b/arch/x86/vdso/vdso32-setup.c
index 02b442e92007..36df991985b2 100644
--- a/arch/x86/vdso/vdso32-setup.c
+++ b/arch/x86/vdso/vdso32-setup.c
@@ -374,7 +374,7 @@ int arch_setup_additional_pages(struct linux_binprm *bprm, int uses_interp)
374 374
375#ifdef CONFIG_X86_64 375#ifdef CONFIG_X86_64
376 376
377__initcall(sysenter_setup); 377subsys_initcall(sysenter_setup);
378 378
379#ifdef CONFIG_SYSCTL 379#ifdef CONFIG_SYSCTL
380/* Register vsyscall32 into the ABI table */ 380/* Register vsyscall32 into the ABI table */
diff --git a/arch/x86/vdso/vma.c b/arch/x86/vdso/vma.c
index ac74869b8140..43456ee17692 100644
--- a/arch/x86/vdso/vma.c
+++ b/arch/x86/vdso/vma.c
@@ -74,7 +74,7 @@ static int __init init_vdso_vars(void)
74 vdso_enabled = 0; 74 vdso_enabled = 0;
75 return -ENOMEM; 75 return -ENOMEM;
76} 76}
77__initcall(init_vdso_vars); 77subsys_initcall(init_vdso_vars);
78 78
79struct linux_binprm; 79struct linux_binprm;
80 80
diff --git a/arch/x86/xen/Kconfig b/arch/x86/xen/Kconfig
index b83e119fbeb0..68128a1b401a 100644
--- a/arch/x86/xen/Kconfig
+++ b/arch/x86/xen/Kconfig
@@ -13,6 +13,11 @@ config XEN
13 kernel to boot in a paravirtualized environment under the 13 kernel to boot in a paravirtualized environment under the
14 Xen hypervisor. 14 Xen hypervisor.
15 15
16config XEN_PVHVM
17 def_bool y
18 depends on XEN
19 depends on X86_LOCAL_APIC
20
16config XEN_MAX_DOMAIN_MEMORY 21config XEN_MAX_DOMAIN_MEMORY
17 int "Maximum allowed size of a domain in gigabytes" 22 int "Maximum allowed size of a domain in gigabytes"
18 default 8 if X86_32 23 default 8 if X86_32
diff --git a/arch/x86/xen/Makefile b/arch/x86/xen/Makefile
index 3bb4fc21f4f2..930954685980 100644
--- a/arch/x86/xen/Makefile
+++ b/arch/x86/xen/Makefile
@@ -12,7 +12,7 @@ CFLAGS_mmu.o := $(nostackp)
12 12
13obj-y := enlighten.o setup.o multicalls.o mmu.o irq.o \ 13obj-y := enlighten.o setup.o multicalls.o mmu.o irq.o \
14 time.o xen-asm.o xen-asm_$(BITS).o \ 14 time.o xen-asm.o xen-asm_$(BITS).o \
15 grant-table.o suspend.o 15 grant-table.o suspend.o platform-pci-unplug.o
16 16
17obj-$(CONFIG_SMP) += smp.o 17obj-$(CONFIG_SMP) += smp.o
18obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o 18obj-$(CONFIG_PARAVIRT_SPINLOCKS)+= spinlock.o
diff --git a/arch/x86/xen/enlighten.c b/arch/x86/xen/enlighten.c
index 65d8d79b46a8..d4ff5e83621d 100644
--- a/arch/x86/xen/enlighten.c
+++ b/arch/x86/xen/enlighten.c
@@ -11,6 +11,7 @@
11 * Jeremy Fitzhardinge <jeremy@xensource.com>, XenSource Inc, 2007 11 * Jeremy Fitzhardinge <jeremy@xensource.com>, XenSource Inc, 2007
12 */ 12 */
13 13
14#include <linux/cpu.h>
14#include <linux/kernel.h> 15#include <linux/kernel.h>
15#include <linux/init.h> 16#include <linux/init.h>
16#include <linux/smp.h> 17#include <linux/smp.h>
@@ -35,8 +36,10 @@
35#include <xen/interface/version.h> 36#include <xen/interface/version.h>
36#include <xen/interface/physdev.h> 37#include <xen/interface/physdev.h>
37#include <xen/interface/vcpu.h> 38#include <xen/interface/vcpu.h>
39#include <xen/interface/memory.h>
38#include <xen/features.h> 40#include <xen/features.h>
39#include <xen/page.h> 41#include <xen/page.h>
42#include <xen/hvm.h>
40#include <xen/hvc-console.h> 43#include <xen/hvc-console.h>
41 44
42#include <asm/paravirt.h> 45#include <asm/paravirt.h>
@@ -55,7 +58,9 @@
55#include <asm/pgtable.h> 58#include <asm/pgtable.h>
56#include <asm/tlbflush.h> 59#include <asm/tlbflush.h>
57#include <asm/reboot.h> 60#include <asm/reboot.h>
61#include <asm/setup.h>
58#include <asm/stackprotector.h> 62#include <asm/stackprotector.h>
63#include <asm/hypervisor.h>
59 64
60#include "xen-ops.h" 65#include "xen-ops.h"
61#include "mmu.h" 66#include "mmu.h"
@@ -76,6 +81,10 @@ struct shared_info xen_dummy_shared_info;
76 81
77void *xen_initial_gdt; 82void *xen_initial_gdt;
78 83
84RESERVE_BRK(shared_info_page_brk, PAGE_SIZE);
85__read_mostly int xen_have_vector_callback;
86EXPORT_SYMBOL_GPL(xen_have_vector_callback);
87
79/* 88/*
80 * Point at some empty memory to start with. We map the real shared_info 89 * Point at some empty memory to start with. We map the real shared_info
81 * page as soon as fixmap is up and running. 90 * page as soon as fixmap is up and running.
@@ -97,6 +106,14 @@ struct shared_info *HYPERVISOR_shared_info = (void *)&xen_dummy_shared_info;
97 */ 106 */
98static int have_vcpu_info_placement = 1; 107static int have_vcpu_info_placement = 1;
99 108
109static void clamp_max_cpus(void)
110{
111#ifdef CONFIG_SMP
112 if (setup_max_cpus > MAX_VIRT_CPUS)
113 setup_max_cpus = MAX_VIRT_CPUS;
114#endif
115}
116
100static void xen_vcpu_setup(int cpu) 117static void xen_vcpu_setup(int cpu)
101{ 118{
102 struct vcpu_register_vcpu_info info; 119 struct vcpu_register_vcpu_info info;
@@ -104,13 +121,17 @@ static void xen_vcpu_setup(int cpu)
104 struct vcpu_info *vcpup; 121 struct vcpu_info *vcpup;
105 122
106 BUG_ON(HYPERVISOR_shared_info == &xen_dummy_shared_info); 123 BUG_ON(HYPERVISOR_shared_info == &xen_dummy_shared_info);
107 per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu];
108 124
109 if (!have_vcpu_info_placement) 125 if (cpu < MAX_VIRT_CPUS)
110 return; /* already tested, not available */ 126 per_cpu(xen_vcpu,cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu];
111 127
112 vcpup = &per_cpu(xen_vcpu_info, cpu); 128 if (!have_vcpu_info_placement) {
129 if (cpu >= MAX_VIRT_CPUS)
130 clamp_max_cpus();
131 return;
132 }
113 133
134 vcpup = &per_cpu(xen_vcpu_info, cpu);
114 info.mfn = arbitrary_virt_to_mfn(vcpup); 135 info.mfn = arbitrary_virt_to_mfn(vcpup);
115 info.offset = offset_in_page(vcpup); 136 info.offset = offset_in_page(vcpup);
116 137
@@ -125,6 +146,7 @@ static void xen_vcpu_setup(int cpu)
125 if (err) { 146 if (err) {
126 printk(KERN_DEBUG "register_vcpu_info failed: err=%d\n", err); 147 printk(KERN_DEBUG "register_vcpu_info failed: err=%d\n", err);
127 have_vcpu_info_placement = 0; 148 have_vcpu_info_placement = 0;
149 clamp_max_cpus();
128 } else { 150 } else {
129 /* This cpu is using the registered vcpu info, even if 151 /* This cpu is using the registered vcpu info, even if
130 later ones fail to. */ 152 later ones fail to. */
@@ -731,7 +753,6 @@ static void set_xen_basic_apic_ops(void)
731 753
732#endif 754#endif
733 755
734
735static void xen_clts(void) 756static void xen_clts(void)
736{ 757{
737 struct multicall_space mcs; 758 struct multicall_space mcs;
@@ -926,10 +947,6 @@ static const struct pv_init_ops xen_init_ops __initdata = {
926 .patch = xen_patch, 947 .patch = xen_patch,
927}; 948};
928 949
929static const struct pv_time_ops xen_time_ops __initdata = {
930 .sched_clock = xen_sched_clock,
931};
932
933static const struct pv_cpu_ops xen_cpu_ops __initdata = { 950static const struct pv_cpu_ops xen_cpu_ops __initdata = {
934 .cpuid = xen_cpuid, 951 .cpuid = xen_cpuid,
935 952
@@ -1028,6 +1045,23 @@ static void xen_crash_shutdown(struct pt_regs *regs)
1028 xen_reboot(SHUTDOWN_crash); 1045 xen_reboot(SHUTDOWN_crash);
1029} 1046}
1030 1047
1048static int
1049xen_panic_event(struct notifier_block *this, unsigned long event, void *ptr)
1050{
1051 xen_reboot(SHUTDOWN_crash);
1052 return NOTIFY_DONE;
1053}
1054
1055static struct notifier_block xen_panic_block = {
1056 .notifier_call= xen_panic_event,
1057};
1058
1059int xen_panic_handler_init(void)
1060{
1061 atomic_notifier_chain_register(&panic_notifier_list, &xen_panic_block);
1062 return 0;
1063}
1064
1031static const struct machine_ops __initdata xen_machine_ops = { 1065static const struct machine_ops __initdata xen_machine_ops = {
1032 .restart = xen_restart, 1066 .restart = xen_restart,
1033 .halt = xen_machine_halt, 1067 .halt = xen_machine_halt,
@@ -1067,7 +1101,6 @@ asmlinkage void __init xen_start_kernel(void)
1067 /* Install Xen paravirt ops */ 1101 /* Install Xen paravirt ops */
1068 pv_info = xen_info; 1102 pv_info = xen_info;
1069 pv_init_ops = xen_init_ops; 1103 pv_init_ops = xen_init_ops;
1070 pv_time_ops = xen_time_ops;
1071 pv_cpu_ops = xen_cpu_ops; 1104 pv_cpu_ops = xen_cpu_ops;
1072 pv_apic_ops = xen_apic_ops; 1105 pv_apic_ops = xen_apic_ops;
1073 1106
@@ -1075,13 +1108,7 @@ asmlinkage void __init xen_start_kernel(void)
1075 x86_init.oem.arch_setup = xen_arch_setup; 1108 x86_init.oem.arch_setup = xen_arch_setup;
1076 x86_init.oem.banner = xen_banner; 1109 x86_init.oem.banner = xen_banner;
1077 1110
1078 x86_init.timers.timer_init = xen_time_init; 1111 xen_init_time_ops();
1079 x86_init.timers.setup_percpu_clockev = x86_init_noop;
1080 x86_cpuinit.setup_percpu_clockev = x86_init_noop;
1081
1082 x86_platform.calibrate_tsc = xen_tsc_khz;
1083 x86_platform.get_wallclock = xen_get_wallclock;
1084 x86_platform.set_wallclock = xen_set_wallclock;
1085 1112
1086 /* 1113 /*
1087 * Set up some pagetable state before starting to set any ptes. 1114 * Set up some pagetable state before starting to set any ptes.
@@ -1206,3 +1233,139 @@ asmlinkage void __init xen_start_kernel(void)
1206 x86_64_start_reservations((char *)__pa_symbol(&boot_params)); 1233 x86_64_start_reservations((char *)__pa_symbol(&boot_params));
1207#endif 1234#endif
1208} 1235}
1236
1237static uint32_t xen_cpuid_base(void)
1238{
1239 uint32_t base, eax, ebx, ecx, edx;
1240 char signature[13];
1241
1242 for (base = 0x40000000; base < 0x40010000; base += 0x100) {
1243 cpuid(base, &eax, &ebx, &ecx, &edx);
1244 *(uint32_t *)(signature + 0) = ebx;
1245 *(uint32_t *)(signature + 4) = ecx;
1246 *(uint32_t *)(signature + 8) = edx;
1247 signature[12] = 0;
1248
1249 if (!strcmp("XenVMMXenVMM", signature) && ((eax - base) >= 2))
1250 return base;
1251 }
1252
1253 return 0;
1254}
1255
1256static int init_hvm_pv_info(int *major, int *minor)
1257{
1258 uint32_t eax, ebx, ecx, edx, pages, msr, base;
1259 u64 pfn;
1260
1261 base = xen_cpuid_base();
1262 cpuid(base + 1, &eax, &ebx, &ecx, &edx);
1263
1264 *major = eax >> 16;
1265 *minor = eax & 0xffff;
1266 printk(KERN_INFO "Xen version %d.%d.\n", *major, *minor);
1267
1268 cpuid(base + 2, &pages, &msr, &ecx, &edx);
1269
1270 pfn = __pa(hypercall_page);
1271 wrmsr_safe(msr, (u32)pfn, (u32)(pfn >> 32));
1272
1273 xen_setup_features();
1274
1275 pv_info = xen_info;
1276 pv_info.kernel_rpl = 0;
1277
1278 xen_domain_type = XEN_HVM_DOMAIN;
1279
1280 return 0;
1281}
1282
1283void xen_hvm_init_shared_info(void)
1284{
1285 int cpu;
1286 struct xen_add_to_physmap xatp;
1287 static struct shared_info *shared_info_page = 0;
1288
1289 if (!shared_info_page)
1290 shared_info_page = (struct shared_info *)
1291 extend_brk(PAGE_SIZE, PAGE_SIZE);
1292 xatp.domid = DOMID_SELF;
1293 xatp.idx = 0;
1294 xatp.space = XENMAPSPACE_shared_info;
1295 xatp.gpfn = __pa(shared_info_page) >> PAGE_SHIFT;
1296 if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp))
1297 BUG();
1298
1299 HYPERVISOR_shared_info = (struct shared_info *)shared_info_page;
1300
1301 /* xen_vcpu is a pointer to the vcpu_info struct in the shared_info
1302 * page, we use it in the event channel upcall and in some pvclock
1303 * related functions. We don't need the vcpu_info placement
1304 * optimizations because we don't use any pv_mmu or pv_irq op on
1305 * HVM.
1306 * When xen_hvm_init_shared_info is run at boot time only vcpu 0 is
1307 * online but xen_hvm_init_shared_info is run at resume time too and
1308 * in that case multiple vcpus might be online. */
1309 for_each_online_cpu(cpu) {
1310 per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu];
1311 }
1312}
1313
1314#ifdef CONFIG_XEN_PVHVM
1315static int __cpuinit xen_hvm_cpu_notify(struct notifier_block *self,
1316 unsigned long action, void *hcpu)
1317{
1318 int cpu = (long)hcpu;
1319 switch (action) {
1320 case CPU_UP_PREPARE:
1321 per_cpu(xen_vcpu, cpu) = &HYPERVISOR_shared_info->vcpu_info[cpu];
1322 break;
1323 default:
1324 break;
1325 }
1326 return NOTIFY_OK;
1327}
1328
1329static struct notifier_block __cpuinitdata xen_hvm_cpu_notifier = {
1330 .notifier_call = xen_hvm_cpu_notify,
1331};
1332
1333static void __init xen_hvm_guest_init(void)
1334{
1335 int r;
1336 int major, minor;
1337
1338 r = init_hvm_pv_info(&major, &minor);
1339 if (r < 0)
1340 return;
1341
1342 xen_hvm_init_shared_info();
1343
1344 if (xen_feature(XENFEAT_hvm_callback_vector))
1345 xen_have_vector_callback = 1;
1346 register_cpu_notifier(&xen_hvm_cpu_notifier);
1347 xen_unplug_emulated_devices();
1348 have_vcpu_info_placement = 0;
1349 x86_init.irqs.intr_init = xen_init_IRQ;
1350 xen_hvm_init_time_ops();
1351 xen_hvm_init_mmu_ops();
1352}
1353
1354static bool __init xen_hvm_platform(void)
1355{
1356 if (xen_pv_domain())
1357 return false;
1358
1359 if (!xen_cpuid_base())
1360 return false;
1361
1362 return true;
1363}
1364
1365const __refconst struct hypervisor_x86 x86_hyper_xen_hvm = {
1366 .name = "Xen HVM",
1367 .detect = xen_hvm_platform,
1368 .init_platform = xen_hvm_guest_init,
1369};
1370EXPORT_SYMBOL(x86_hyper_xen_hvm);
1371#endif
diff --git a/arch/x86/xen/mmu.c b/arch/x86/xen/mmu.c
index 914f04695ce5..413b19b3d0fe 100644
--- a/arch/x86/xen/mmu.c
+++ b/arch/x86/xen/mmu.c
@@ -58,6 +58,7 @@
58 58
59#include <xen/page.h> 59#include <xen/page.h>
60#include <xen/interface/xen.h> 60#include <xen/interface/xen.h>
61#include <xen/interface/hvm/hvm_op.h>
61#include <xen/interface/version.h> 62#include <xen/interface/version.h>
62#include <xen/hvc-console.h> 63#include <xen/hvc-console.h>
63 64
@@ -1941,6 +1942,40 @@ void __init xen_init_mmu_ops(void)
1941 pv_mmu_ops = xen_mmu_ops; 1942 pv_mmu_ops = xen_mmu_ops;
1942} 1943}
1943 1944
1945#ifdef CONFIG_XEN_PVHVM
1946static void xen_hvm_exit_mmap(struct mm_struct *mm)
1947{
1948 struct xen_hvm_pagetable_dying a;
1949 int rc;
1950
1951 a.domid = DOMID_SELF;
1952 a.gpa = __pa(mm->pgd);
1953 rc = HYPERVISOR_hvm_op(HVMOP_pagetable_dying, &a);
1954 WARN_ON_ONCE(rc < 0);
1955}
1956
1957static int is_pagetable_dying_supported(void)
1958{
1959 struct xen_hvm_pagetable_dying a;
1960 int rc = 0;
1961
1962 a.domid = DOMID_SELF;
1963 a.gpa = 0x00;
1964 rc = HYPERVISOR_hvm_op(HVMOP_pagetable_dying, &a);
1965 if (rc < 0) {
1966 printk(KERN_DEBUG "HVMOP_pagetable_dying not supported\n");
1967 return 0;
1968 }
1969 return 1;
1970}
1971
1972void __init xen_hvm_init_mmu_ops(void)
1973{
1974 if (is_pagetable_dying_supported())
1975 pv_mmu_ops.exit_mmap = xen_hvm_exit_mmap;
1976}
1977#endif
1978
1944#ifdef CONFIG_XEN_DEBUG_FS 1979#ifdef CONFIG_XEN_DEBUG_FS
1945 1980
1946static struct dentry *d_mmu_debug; 1981static struct dentry *d_mmu_debug;
diff --git a/arch/x86/xen/mmu.h b/arch/x86/xen/mmu.h
index 5fe6bc7f5ecf..fa938c4aa2f7 100644
--- a/arch/x86/xen/mmu.h
+++ b/arch/x86/xen/mmu.h
@@ -60,4 +60,5 @@ void xen_ptep_modify_prot_commit(struct mm_struct *mm, unsigned long addr,
60unsigned long xen_read_cr2_direct(void); 60unsigned long xen_read_cr2_direct(void);
61 61
62extern void xen_init_mmu_ops(void); 62extern void xen_init_mmu_ops(void);
63extern void xen_hvm_init_mmu_ops(void);
63#endif /* _XEN_MMU_H */ 64#endif /* _XEN_MMU_H */
diff --git a/arch/x86/xen/platform-pci-unplug.c b/arch/x86/xen/platform-pci-unplug.c
new file mode 100644
index 000000000000..554c002a1e1a
--- /dev/null
+++ b/arch/x86/xen/platform-pci-unplug.c
@@ -0,0 +1,137 @@
1/******************************************************************************
2 * platform-pci-unplug.c
3 *
4 * Xen platform PCI device driver
5 * Copyright (c) 2010, Citrix
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms and conditions of the GNU General Public License,
9 * version 2, as published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program; if not, write to the Free Software Foundation, Inc., 59 Temple
18 * Place - Suite 330, Boston, MA 02111-1307 USA.
19 *
20 */
21
22#include <linux/init.h>
23#include <linux/io.h>
24#include <linux/module.h>
25
26#include <xen/platform_pci.h>
27
28#define XEN_PLATFORM_ERR_MAGIC -1
29#define XEN_PLATFORM_ERR_PROTOCOL -2
30#define XEN_PLATFORM_ERR_BLACKLIST -3
31
32/* store the value of xen_emul_unplug after the unplug is done */
33int xen_platform_pci_unplug;
34EXPORT_SYMBOL_GPL(xen_platform_pci_unplug);
35#ifdef CONFIG_XEN_PVHVM
36static int xen_emul_unplug;
37
38static int __init check_platform_magic(void)
39{
40 short magic;
41 char protocol;
42
43 magic = inw(XEN_IOPORT_MAGIC);
44 if (magic != XEN_IOPORT_MAGIC_VAL) {
45 printk(KERN_ERR "Xen Platform PCI: unrecognised magic value\n");
46 return XEN_PLATFORM_ERR_MAGIC;
47 }
48
49 protocol = inb(XEN_IOPORT_PROTOVER);
50
51 printk(KERN_DEBUG "Xen Platform PCI: I/O protocol version %d\n",
52 protocol);
53
54 switch (protocol) {
55 case 1:
56 outw(XEN_IOPORT_LINUX_PRODNUM, XEN_IOPORT_PRODNUM);
57 outl(XEN_IOPORT_LINUX_DRVVER, XEN_IOPORT_DRVVER);
58 if (inw(XEN_IOPORT_MAGIC) != XEN_IOPORT_MAGIC_VAL) {
59 printk(KERN_ERR "Xen Platform: blacklisted by host\n");
60 return XEN_PLATFORM_ERR_BLACKLIST;
61 }
62 break;
63 default:
64 printk(KERN_WARNING "Xen Platform PCI: unknown I/O protocol version");
65 return XEN_PLATFORM_ERR_PROTOCOL;
66 }
67
68 return 0;
69}
70
71void __init xen_unplug_emulated_devices(void)
72{
73 int r;
74
75 /* check the version of the xen platform PCI device */
76 r = check_platform_magic();
77 /* If the version matches enable the Xen platform PCI driver.
78 * Also enable the Xen platform PCI driver if the version is really old
79 * and the user told us to ignore it. */
80 if (r && !(r == XEN_PLATFORM_ERR_MAGIC &&
81 (xen_emul_unplug & XEN_UNPLUG_IGNORE)))
82 return;
83 /* Set the default value of xen_emul_unplug depending on whether or
84 * not the Xen PV frontends and the Xen platform PCI driver have
85 * been compiled for this kernel (modules or built-in are both OK). */
86 if (!xen_emul_unplug) {
87 if (xen_must_unplug_nics()) {
88 printk(KERN_INFO "Netfront and the Xen platform PCI driver have "
89 "been compiled for this kernel: unplug emulated NICs.\n");
90 xen_emul_unplug |= XEN_UNPLUG_ALL_NICS;
91 }
92 if (xen_must_unplug_disks()) {
93 printk(KERN_INFO "Blkfront and the Xen platform PCI driver have "
94 "been compiled for this kernel: unplug emulated disks.\n"
95 "You might have to change the root device\n"
96 "from /dev/hd[a-d] to /dev/xvd[a-d]\n"
97 "in your root= kernel command line option\n");
98 xen_emul_unplug |= XEN_UNPLUG_ALL_IDE_DISKS;
99 }
100 }
101 /* Now unplug the emulated devices */
102 if (!(xen_emul_unplug & XEN_UNPLUG_IGNORE))
103 outw(xen_emul_unplug, XEN_IOPORT_UNPLUG);
104 xen_platform_pci_unplug = xen_emul_unplug;
105}
106
107static int __init parse_xen_emul_unplug(char *arg)
108{
109 char *p, *q;
110 int l;
111
112 for (p = arg; p; p = q) {
113 q = strchr(p, ',');
114 if (q) {
115 l = q - p;
116 q++;
117 } else {
118 l = strlen(p);
119 }
120 if (!strncmp(p, "all", l))
121 xen_emul_unplug |= XEN_UNPLUG_ALL;
122 else if (!strncmp(p, "ide-disks", l))
123 xen_emul_unplug |= XEN_UNPLUG_ALL_IDE_DISKS;
124 else if (!strncmp(p, "aux-ide-disks", l))
125 xen_emul_unplug |= XEN_UNPLUG_AUX_IDE_DISKS;
126 else if (!strncmp(p, "nics", l))
127 xen_emul_unplug |= XEN_UNPLUG_ALL_NICS;
128 else if (!strncmp(p, "ignore", l))
129 xen_emul_unplug |= XEN_UNPLUG_IGNORE;
130 else
131 printk(KERN_WARNING "unrecognised option '%s' "
132 "in parameter 'xen_emul_unplug'\n", p);
133 }
134 return 0;
135}
136early_param("xen_emul_unplug", parse_xen_emul_unplug);
137#endif
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index ad0047f47cd4..328b00305426 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -20,6 +20,7 @@
20#include <xen/page.h> 20#include <xen/page.h>
21#include <xen/interface/callback.h> 21#include <xen/interface/callback.h>
22#include <xen/interface/physdev.h> 22#include <xen/interface/physdev.h>
23#include <xen/interface/memory.h>
23#include <xen/features.h> 24#include <xen/features.h>
24 25
25#include "xen-ops.h" 26#include "xen-ops.h"
@@ -32,6 +33,73 @@ extern void xen_sysenter_target(void);
32extern void xen_syscall_target(void); 33extern void xen_syscall_target(void);
33extern void xen_syscall32_target(void); 34extern void xen_syscall32_target(void);
34 35
36static unsigned long __init xen_release_chunk(phys_addr_t start_addr,
37 phys_addr_t end_addr)
38{
39 struct xen_memory_reservation reservation = {
40 .address_bits = 0,
41 .extent_order = 0,
42 .domid = DOMID_SELF
43 };
44 unsigned long start, end;
45 unsigned long len = 0;
46 unsigned long pfn;
47 int ret;
48
49 start = PFN_UP(start_addr);
50 end = PFN_DOWN(end_addr);
51
52 if (end <= start)
53 return 0;
54
55 printk(KERN_INFO "xen_release_chunk: looking at area pfn %lx-%lx: ",
56 start, end);
57 for(pfn = start; pfn < end; pfn++) {
58 unsigned long mfn = pfn_to_mfn(pfn);
59
60 /* Make sure pfn exists to start with */
61 if (mfn == INVALID_P2M_ENTRY || mfn_to_pfn(mfn) != pfn)
62 continue;
63
64 set_xen_guest_handle(reservation.extent_start, &mfn);
65 reservation.nr_extents = 1;
66
67 ret = HYPERVISOR_memory_op(XENMEM_decrease_reservation,
68 &reservation);
69 WARN(ret != 1, "Failed to release memory %lx-%lx err=%d\n",
70 start, end, ret);
71 if (ret == 1) {
72 set_phys_to_machine(pfn, INVALID_P2M_ENTRY);
73 len++;
74 }
75 }
76 printk(KERN_CONT "%ld pages freed\n", len);
77
78 return len;
79}
80
81static unsigned long __init xen_return_unused_memory(unsigned long max_pfn,
82 const struct e820map *e820)
83{
84 phys_addr_t max_addr = PFN_PHYS(max_pfn);
85 phys_addr_t last_end = 0;
86 unsigned long released = 0;
87 int i;
88
89 for (i = 0; i < e820->nr_map && last_end < max_addr; i++) {
90 phys_addr_t end = e820->map[i].addr;
91 end = min(max_addr, end);
92
93 released += xen_release_chunk(last_end, end);
94 last_end = e820->map[i].addr + e820->map[i].size;
95 }
96
97 if (last_end < max_addr)
98 released += xen_release_chunk(last_end, max_addr);
99
100 printk(KERN_INFO "released %ld pages of unused memory\n", released);
101 return released;
102}
35 103
36/** 104/**
37 * machine_specific_memory_setup - Hook for machine specific memory setup. 105 * machine_specific_memory_setup - Hook for machine specific memory setup.
@@ -67,6 +135,8 @@ char * __init xen_memory_setup(void)
67 135
68 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); 136 sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map);
69 137
138 xen_return_unused_memory(xen_start_info->nr_pages, &e820);
139
70 return "Xen"; 140 return "Xen";
71} 141}
72 142
@@ -156,6 +226,8 @@ void __init xen_arch_setup(void)
156 struct physdev_set_iopl set_iopl; 226 struct physdev_set_iopl set_iopl;
157 int rc; 227 int rc;
158 228
229 xen_panic_handler_init();
230
159 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments); 231 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_4gb_segments);
160 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables); 232 HYPERVISOR_vm_assist(VMASST_CMD_enable, VMASST_TYPE_writable_pagetables);
161 233
diff --git a/arch/x86/xen/smp.c b/arch/x86/xen/smp.c
index a29693fd3138..25f232b18a82 100644
--- a/arch/x86/xen/smp.c
+++ b/arch/x86/xen/smp.c
@@ -394,6 +394,8 @@ static void stop_self(void *v)
394 load_cr3(swapper_pg_dir); 394 load_cr3(swapper_pg_dir);
395 /* should set up a minimal gdt */ 395 /* should set up a minimal gdt */
396 396
397 set_cpu_online(cpu, false);
398
397 HYPERVISOR_vcpu_op(VCPUOP_down, cpu, NULL); 399 HYPERVISOR_vcpu_op(VCPUOP_down, cpu, NULL);
398 BUG(); 400 BUG();
399} 401}
diff --git a/arch/x86/xen/suspend.c b/arch/x86/xen/suspend.c
index a9c661108034..1d789d56877c 100644
--- a/arch/x86/xen/suspend.c
+++ b/arch/x86/xen/suspend.c
@@ -26,6 +26,18 @@ void xen_pre_suspend(void)
26 BUG(); 26 BUG();
27} 27}
28 28
29void xen_hvm_post_suspend(int suspend_cancelled)
30{
31 int cpu;
32 xen_hvm_init_shared_info();
33 xen_callback_vector();
34 if (xen_feature(XENFEAT_hvm_safe_pvclock)) {
35 for_each_online_cpu(cpu) {
36 xen_setup_runstate_info(cpu);
37 }
38 }
39}
40
29void xen_post_suspend(int suspend_cancelled) 41void xen_post_suspend(int suspend_cancelled)
30{ 42{
31 xen_build_mfn_list_list(); 43 xen_build_mfn_list_list();
diff --git a/arch/x86/xen/time.c b/arch/x86/xen/time.c
index b3c6c59ed302..1a5353a753fc 100644
--- a/arch/x86/xen/time.c
+++ b/arch/x86/xen/time.c
@@ -20,6 +20,7 @@
20#include <asm/xen/hypercall.h> 20#include <asm/xen/hypercall.h>
21 21
22#include <xen/events.h> 22#include <xen/events.h>
23#include <xen/features.h>
23#include <xen/interface/xen.h> 24#include <xen/interface/xen.h>
24#include <xen/interface/vcpu.h> 25#include <xen/interface/vcpu.h>
25 26
@@ -155,47 +156,8 @@ static void do_stolen_accounting(void)
155 account_idle_ticks(ticks); 156 account_idle_ticks(ticks);
156} 157}
157 158
158/*
159 * Xen sched_clock implementation. Returns the number of unstolen
160 * nanoseconds, which is nanoseconds the VCPU spent in RUNNING+BLOCKED
161 * states.
162 */
163unsigned long long xen_sched_clock(void)
164{
165 struct vcpu_runstate_info state;
166 cycle_t now;
167 u64 ret;
168 s64 offset;
169
170 /*
171 * Ideally sched_clock should be called on a per-cpu basis
172 * anyway, so preempt should already be disabled, but that's
173 * not current practice at the moment.
174 */
175 preempt_disable();
176
177 now = xen_clocksource_read();
178
179 get_runstate_snapshot(&state);
180
181 WARN_ON(state.state != RUNSTATE_running);
182
183 offset = now - state.state_entry_time;
184 if (offset < 0)
185 offset = 0;
186
187 ret = state.time[RUNSTATE_blocked] +
188 state.time[RUNSTATE_running] +
189 offset;
190
191 preempt_enable();
192
193 return ret;
194}
195
196
197/* Get the TSC speed from Xen */ 159/* Get the TSC speed from Xen */
198unsigned long xen_tsc_khz(void) 160static unsigned long xen_tsc_khz(void)
199{ 161{
200 struct pvclock_vcpu_time_info *info = 162 struct pvclock_vcpu_time_info *info =
201 &HYPERVISOR_shared_info->vcpu_info[0].time; 163 &HYPERVISOR_shared_info->vcpu_info[0].time;
@@ -230,7 +192,7 @@ static void xen_read_wallclock(struct timespec *ts)
230 put_cpu_var(xen_vcpu); 192 put_cpu_var(xen_vcpu);
231} 193}
232 194
233unsigned long xen_get_wallclock(void) 195static unsigned long xen_get_wallclock(void)
234{ 196{
235 struct timespec ts; 197 struct timespec ts;
236 198
@@ -238,7 +200,7 @@ unsigned long xen_get_wallclock(void)
238 return ts.tv_sec; 200 return ts.tv_sec;
239} 201}
240 202
241int xen_set_wallclock(unsigned long now) 203static int xen_set_wallclock(unsigned long now)
242{ 204{
243 /* do nothing for domU */ 205 /* do nothing for domU */
244 return -1; 206 return -1;
@@ -473,7 +435,11 @@ void xen_timer_resume(void)
473 } 435 }
474} 436}
475 437
476__init void xen_time_init(void) 438static const struct pv_time_ops xen_time_ops __initdata = {
439 .sched_clock = xen_clocksource_read,
440};
441
442static __init void xen_time_init(void)
477{ 443{
478 int cpu = smp_processor_id(); 444 int cpu = smp_processor_id();
479 struct timespec tp; 445 struct timespec tp;
@@ -497,3 +463,47 @@ __init void xen_time_init(void)
497 xen_setup_timer(cpu); 463 xen_setup_timer(cpu);
498 xen_setup_cpu_clockevents(); 464 xen_setup_cpu_clockevents();
499} 465}
466
467__init void xen_init_time_ops(void)
468{
469 pv_time_ops = xen_time_ops;
470
471 x86_init.timers.timer_init = xen_time_init;
472 x86_init.timers.setup_percpu_clockev = x86_init_noop;
473 x86_cpuinit.setup_percpu_clockev = x86_init_noop;
474
475 x86_platform.calibrate_tsc = xen_tsc_khz;
476 x86_platform.get_wallclock = xen_get_wallclock;
477 x86_platform.set_wallclock = xen_set_wallclock;
478}
479
480#ifdef CONFIG_XEN_PVHVM
481static void xen_hvm_setup_cpu_clockevents(void)
482{
483 int cpu = smp_processor_id();
484 xen_setup_runstate_info(cpu);
485 xen_setup_timer(cpu);
486 xen_setup_cpu_clockevents();
487}
488
489__init void xen_hvm_init_time_ops(void)
490{
491 /* vector callback is needed otherwise we cannot receive interrupts
492 * on cpu > 0 */
493 if (!xen_have_vector_callback && num_present_cpus() > 1)
494 return;
495 if (!xen_feature(XENFEAT_hvm_safe_pvclock)) {
496 printk(KERN_INFO "Xen doesn't support pvclock on HVM,"
497 "disable pv timer\n");
498 return;
499 }
500
501 pv_time_ops = xen_time_ops;
502 x86_init.timers.setup_percpu_clockev = xen_time_init;
503 x86_cpuinit.setup_percpu_clockev = xen_hvm_setup_cpu_clockevents;
504
505 x86_platform.calibrate_tsc = xen_tsc_khz;
506 x86_platform.get_wallclock = xen_get_wallclock;
507 x86_platform.set_wallclock = xen_set_wallclock;
508}
509#endif
diff --git a/arch/x86/xen/xen-ops.h b/arch/x86/xen/xen-ops.h
index f9153a300bce..7c8ab86163e9 100644
--- a/arch/x86/xen/xen-ops.h
+++ b/arch/x86/xen/xen-ops.h
@@ -38,6 +38,10 @@ void xen_enable_sysenter(void);
38void xen_enable_syscall(void); 38void xen_enable_syscall(void);
39void xen_vcpu_restore(void); 39void xen_vcpu_restore(void);
40 40
41void xen_callback_vector(void);
42void xen_hvm_init_shared_info(void);
43void __init xen_unplug_emulated_devices(void);
44
41void __init xen_build_dynamic_phys_to_machine(void); 45void __init xen_build_dynamic_phys_to_machine(void);
42 46
43void xen_init_irq_ops(void); 47void xen_init_irq_ops(void);
@@ -46,11 +50,8 @@ void xen_setup_runstate_info(int cpu);
46void xen_teardown_timer(int cpu); 50void xen_teardown_timer(int cpu);
47cycle_t xen_clocksource_read(void); 51cycle_t xen_clocksource_read(void);
48void xen_setup_cpu_clockevents(void); 52void xen_setup_cpu_clockevents(void);
49unsigned long xen_tsc_khz(void); 53void __init xen_init_time_ops(void);
50void __init xen_time_init(void); 54void __init xen_hvm_init_time_ops(void);
51unsigned long xen_get_wallclock(void);
52int xen_set_wallclock(unsigned long time);
53unsigned long long xen_sched_clock(void);
54 55
55irqreturn_t xen_debug_interrupt(int irq, void *dev_id); 56irqreturn_t xen_debug_interrupt(int irq, void *dev_id);
56 57
@@ -101,4 +102,6 @@ void xen_sysret32(void);
101void xen_sysret64(void); 102void xen_sysret64(void);
102void xen_adjust_exception_frame(void); 103void xen_adjust_exception_frame(void);
103 104
105extern int xen_panic_handler_init(void);
106
104#endif /* XEN_OPS_H */ 107#endif /* XEN_OPS_H */
diff --git a/arch/xtensa/Kconfig b/arch/xtensa/Kconfig
index ebe228d02b08..0859bfd8ae93 100644
--- a/arch/xtensa/Kconfig
+++ b/arch/xtensa/Kconfig
@@ -48,9 +48,6 @@ config HZ
48 int 48 int
49 default 100 49 default 100
50 50
51config GENERIC_TIME
52 def_bool y
53
54source "init/Kconfig" 51source "init/Kconfig"
55source "kernel/Kconfig.freezer" 52source "kernel/Kconfig.freezer"
56 53
diff --git a/arch/xtensa/Makefile b/arch/xtensa/Makefile
index 4caffac3ca2e..7608559de93a 100644
--- a/arch/xtensa/Makefile
+++ b/arch/xtensa/Makefile
@@ -35,6 +35,8 @@ KBUILD_CFLAGS += -ffreestanding
35 35
36KBUILD_CFLAGS += -pipe -mlongcalls 36KBUILD_CFLAGS += -pipe -mlongcalls
37 37
38KBUILD_CFLAGS += $(call cc-option,-mforce-no-pic,)
39
38vardirs := $(patsubst %,arch/xtensa/variants/%/,$(variant-y)) 40vardirs := $(patsubst %,arch/xtensa/variants/%/,$(variant-y))
39plfdirs := $(patsubst %,arch/xtensa/platforms/%/,$(platform-y)) 41plfdirs := $(patsubst %,arch/xtensa/platforms/%/,$(platform-y))
40 42
diff --git a/arch/xtensa/configs/iss_defconfig b/arch/xtensa/configs/iss_defconfig
index f19854035e61..7368164843b9 100644
--- a/arch/xtensa/configs/iss_defconfig
+++ b/arch/xtensa/configs/iss_defconfig
@@ -1,193 +1,214 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.11-rc2 3# Linux kernel version: 2.6.34-rc6
4# Fri Feb 25 19:21:24 2005 4# Tue Aug 3 00:10:54 2010
5# 5#
6CONFIG_FRAME_POINTER=y 6# CONFIG_FRAME_POINTER is not set
7CONFIG_ZONE_DMA=y
7CONFIG_XTENSA=y 8CONFIG_XTENSA=y
8# CONFIG_UID16 is not set
9CONFIG_RWSEM_XCHGADD_ALGORITHM=y 9CONFIG_RWSEM_XCHGADD_ALGORITHM=y
10CONFIG_HAVE_DEC_LOCK=y 10CONFIG_GENERIC_FIND_NEXT_BIT=y
11CONFIG_GENERIC_HWEIGHT=y
11CONFIG_GENERIC_HARDIRQS=y 12CONFIG_GENERIC_HARDIRQS=y
13CONFIG_GENERIC_GPIO=y
14# CONFIG_ARCH_HAS_ILOG2_U32 is not set
15# CONFIG_ARCH_HAS_ILOG2_U64 is not set
16CONFIG_NO_IOPORT=y
17CONFIG_HZ=100
18CONFIG_GENERIC_TIME=y
19CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
20CONFIG_CONSTRUCTORS=y
12 21
13# 22#
14# Code maturity level options 23# General setup
15# 24#
16CONFIG_EXPERIMENTAL=y 25CONFIG_EXPERIMENTAL=y
17CONFIG_CLEAN_COMPILE=y
18CONFIG_BROKEN_ON_SMP=y 26CONFIG_BROKEN_ON_SMP=y
19 27CONFIG_INIT_ENV_ARG_LIMIT=32
20#
21# General setup
22#
23CONFIG_LOCALVERSION="" 28CONFIG_LOCALVERSION=""
29CONFIG_LOCALVERSION_AUTO=y
24CONFIG_SWAP=y 30CONFIG_SWAP=y
25CONFIG_SYSVIPC=y 31CONFIG_SYSVIPC=y
32CONFIG_SYSVIPC_SYSCTL=y
26# CONFIG_POSIX_MQUEUE is not set 33# CONFIG_POSIX_MQUEUE is not set
27# CONFIG_BSD_PROCESS_ACCT is not set 34# CONFIG_BSD_PROCESS_ACCT is not set
28CONFIG_SYSCTL=y 35# CONFIG_TASKSTATS is not set
29# CONFIG_AUDIT is not set 36# CONFIG_AUDIT is not set
30CONFIG_LOG_BUF_SHIFT=14 37
31# CONFIG_HOTPLUG is not set 38#
32# CONFIG_KOBJECT_UEVENT is not set 39# RCU Subsystem
40#
41CONFIG_TREE_RCU=y
42# CONFIG_TREE_PREEMPT_RCU is not set
43# CONFIG_TINY_RCU is not set
44# CONFIG_RCU_TRACE is not set
45CONFIG_RCU_FANOUT=32
46# CONFIG_RCU_FANOUT_EXACT is not set
47# CONFIG_TREE_RCU_TRACE is not set
33# CONFIG_IKCONFIG is not set 48# CONFIG_IKCONFIG is not set
49CONFIG_LOG_BUF_SHIFT=14
50# CONFIG_CGROUPS is not set
51# CONFIG_SYSFS_DEPRECATED_V2 is not set
52# CONFIG_RELAY is not set
53# CONFIG_NAMESPACES is not set
54# CONFIG_BLK_DEV_INITRD is not set
55# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
56CONFIG_SYSCTL=y
57CONFIG_ANON_INODES=y
34CONFIG_EMBEDDED=y 58CONFIG_EMBEDDED=y
59CONFIG_SYSCTL_SYSCALL=y
35CONFIG_KALLSYMS=y 60CONFIG_KALLSYMS=y
36# CONFIG_KALLSYMS_ALL is not set 61# CONFIG_KALLSYMS_ALL is not set
37# CONFIG_KALLSYMS_EXTRA_PASS is not set 62# CONFIG_KALLSYMS_EXTRA_PASS is not set
63# CONFIG_HOTPLUG is not set
64CONFIG_PRINTK=y
65CONFIG_BUG=y
66CONFIG_ELF_CORE=y
67CONFIG_BASE_FULL=y
38CONFIG_FUTEX=y 68CONFIG_FUTEX=y
39CONFIG_EPOLL=y 69CONFIG_EPOLL=y
40# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 70CONFIG_SIGNALFD=y
71CONFIG_TIMERFD=y
72CONFIG_EVENTFD=y
41CONFIG_SHMEM=y 73CONFIG_SHMEM=y
42CONFIG_CC_ALIGN_FUNCTIONS=0 74CONFIG_AIO=y
43CONFIG_CC_ALIGN_LABELS=0 75
44CONFIG_CC_ALIGN_LOOPS=0 76#
45CONFIG_CC_ALIGN_JUMPS=0 77# Kernel Performance Events And Counters
46# CONFIG_TINY_SHMEM is not set 78#
79CONFIG_VM_EVENT_COUNTERS=y
80CONFIG_SLUB_DEBUG=y
81CONFIG_COMPAT_BRK=y
82# CONFIG_SLAB is not set
83CONFIG_SLUB=y
84# CONFIG_SLOB is not set
85# CONFIG_PROFILING is not set
47 86
48# 87#
49# Loadable module support 88# GCOV-based kernel profiling
50# 89#
90# CONFIG_SLOW_WORK is not set
91# CONFIG_HAVE_GENERIC_DMA_COHERENT is not set
92CONFIG_SLABINFO=y
93CONFIG_RT_MUTEXES=y
94CONFIG_BASE_SMALL=0
51# CONFIG_MODULES is not set 95# CONFIG_MODULES is not set
96CONFIG_BLOCK=y
97CONFIG_LBDAF=y
98CONFIG_BLK_DEV_BSG=y
99# CONFIG_BLK_DEV_INTEGRITY is not set
100
101#
102# IO Schedulers
103#
104CONFIG_IOSCHED_NOOP=y
105# CONFIG_IOSCHED_DEADLINE is not set
106# CONFIG_IOSCHED_CFQ is not set
107# CONFIG_DEFAULT_DEADLINE is not set
108# CONFIG_DEFAULT_CFQ is not set
109CONFIG_DEFAULT_NOOP=y
110CONFIG_DEFAULT_IOSCHED="noop"
111# CONFIG_INLINE_SPIN_TRYLOCK is not set
112# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
113# CONFIG_INLINE_SPIN_LOCK is not set
114# CONFIG_INLINE_SPIN_LOCK_BH is not set
115# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
116# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
117CONFIG_INLINE_SPIN_UNLOCK=y
118# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
119CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
120# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
121# CONFIG_INLINE_READ_TRYLOCK is not set
122# CONFIG_INLINE_READ_LOCK is not set
123# CONFIG_INLINE_READ_LOCK_BH is not set
124# CONFIG_INLINE_READ_LOCK_IRQ is not set
125# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
126CONFIG_INLINE_READ_UNLOCK=y
127# CONFIG_INLINE_READ_UNLOCK_BH is not set
128CONFIG_INLINE_READ_UNLOCK_IRQ=y
129# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
130# CONFIG_INLINE_WRITE_TRYLOCK is not set
131# CONFIG_INLINE_WRITE_LOCK is not set
132# CONFIG_INLINE_WRITE_LOCK_BH is not set
133# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
134# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
135CONFIG_INLINE_WRITE_UNLOCK=y
136# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
137CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
138# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
139# CONFIG_MUTEX_SPIN_ON_OWNER is not set
140# CONFIG_FREEZER is not set
141CONFIG_MMU=y
142# CONFIG_VARIANT_IRQ_SWITCH is not set
52 143
53# 144#
54# Processor type and features 145# Processor type and features
55# 146#
56CONFIG_XTENSA_VARIANT_FSF=y 147CONFIG_XTENSA_VARIANT_FSF=y
57CONFIG_MMU=y 148# CONFIG_XTENSA_VARIANT_DC232B is not set
149# CONFIG_XTENSA_VARIANT_S6000 is not set
58# CONFIG_XTENSA_UNALIGNED_USER is not set 150# CONFIG_XTENSA_UNALIGNED_USER is not set
59# CONFIG_PREEMPT is not set 151# CONFIG_PREEMPT is not set
60# CONFIG_MATH_EMULATION is not set 152# CONFIG_MATH_EMULATION is not set
61# CONFIG_HIGHMEM is not set 153CONFIG_XTENSA_CALIBRATE_CCOUNT=y
62
63#
64# Platform options
65#
66CONFIG_XTENSA_PLATFORM_ISS=y
67# CONFIG_XTENSA_PLATFORM_XT2000 is not set
68# CONFIG_XTENSA_PLATFORM_ARUBA is not set
69# CONFIG_XTENSA_CALIBRATE_CCOUNT is not set
70CONFIG_XTENSA_CPU_CLOCK=10
71# CONFIG_GENERIC_CALIBRATE_DELAY is not set
72CONFIG_CMDLINE_BOOL=y
73CONFIG_CMDLINE="console=ttyS0,38400 eth0=tuntap,,tap0 ip=192.168.168.5:192.168.168.1 root=nfs nfsroot=192.168.168.1:/opt/montavista/pro/devkit/xtensa/linux_be/target"
74CONFIG_SERIAL_CONSOLE=y 154CONFIG_SERIAL_CONSOLE=y
75CONFIG_XTENSA_ISS_NETWORK=y 155CONFIG_XTENSA_ISS_NETWORK=y
76 156
77# 157#
78# Bus options 158# Bus options
79# 159#
160# CONFIG_PCI is not set
161# CONFIG_ARCH_SUPPORTS_MSI is not set
80 162
81# 163#
82# PCCARD (PCMCIA/CardBus) support 164# Platform options
83#
84# CONFIG_PCCARD is not set
85
86#
87# PC-card bridges
88#
89
90#
91# PCI Hotplug Support
92#
93
94# 165#
95# Exectuable file formats 166CONFIG_XTENSA_PLATFORM_ISS=y
167# CONFIG_XTENSA_PLATFORM_XT2000 is not set
168# CONFIG_XTENSA_PLATFORM_S6105 is not set
169# CONFIG_GENERIC_CALIBRATE_DELAY is not set
170CONFIG_CMDLINE_BOOL=y
171CONFIG_CMDLINE="console=ttyS0,38400 eth0=tuntap,,tap0 ip=192.168.168.5:192.168.168.1 root=nfs nfsroot=192.168.168.1:/opt/montavista/pro/devkit/xtensa/linux_be/target"
172CONFIG_SELECT_MEMORY_MODEL=y
173CONFIG_FLATMEM_MANUAL=y
174# CONFIG_DISCONTIGMEM_MANUAL is not set
175# CONFIG_SPARSEMEM_MANUAL is not set
176CONFIG_FLATMEM=y
177CONFIG_FLAT_NODE_MEM_MAP=y
178CONFIG_PAGEFLAGS_EXTENDED=y
179CONFIG_SPLIT_PTLOCK_CPUS=4
180# CONFIG_PHYS_ADDR_T_64BIT is not set
181CONFIG_ZONE_DMA_FLAG=1
182CONFIG_BOUNCE=y
183CONFIG_VIRT_TO_BUS=y
184# CONFIG_KSM is not set
185CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
186
187#
188# Executable file formats
96# 189#
97CONFIG_KCORE_ELF=y 190CONFIG_KCORE_ELF=y
98CONFIG_BINFMT_ELF=y 191CONFIG_BINFMT_ELF=y
192# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
193# CONFIG_HAVE_AOUT is not set
99# CONFIG_BINFMT_MISC is not set 194# CONFIG_BINFMT_MISC is not set
100
101#
102# Device Drivers
103#
104
105#
106# Generic Driver Options
107#
108# CONFIG_STANDALONE is not set
109CONFIG_PREVENT_FIRMWARE_BUILD=y
110# CONFIG_FW_LOADER is not set
111# CONFIG_DEBUG_DRIVER is not set
112
113#
114# Memory Technology Devices (MTD)
115#
116# CONFIG_MTD is not set
117
118#
119# Parallel port support
120#
121# CONFIG_PARPORT is not set
122
123#
124# Plug and Play support
125#
126
127#
128# Block devices
129#
130# CONFIG_BLK_DEV_FD is not set
131# CONFIG_BLK_DEV_COW_COMMON is not set
132# CONFIG_BLK_DEV_LOOP is not set
133# CONFIG_BLK_DEV_NBD is not set
134# CONFIG_BLK_DEV_RAM is not set
135CONFIG_BLK_DEV_RAM_COUNT=16
136CONFIG_INITRAMFS_SOURCE=""
137# CONFIG_CDROM_PKTCDVD is not set
138
139#
140# IO Schedulers
141#
142CONFIG_IOSCHED_NOOP=y
143# CONFIG_IOSCHED_AS is not set
144# CONFIG_IOSCHED_DEADLINE is not set
145# CONFIG_IOSCHED_CFQ is not set
146# CONFIG_ATA_OVER_ETH is not set
147
148#
149# ATA/ATAPI/MFM/RLL support
150#
151# CONFIG_IDE is not set
152
153#
154# SCSI device support
155#
156# CONFIG_SCSI is not set
157
158#
159# Multi-device support (RAID and LVM)
160#
161# CONFIG_MD is not set
162
163#
164# Fusion MPT device support
165#
166
167#
168# IEEE 1394 (FireWire) support
169#
170
171#
172# I2O device support
173#
174
175#
176# Networking support
177#
178CONFIG_NET=y 195CONFIG_NET=y
179 196
180# 197#
181# Networking options 198# Networking options
182# 199#
183CONFIG_PACKET=y 200CONFIG_PACKET=y
184# CONFIG_PACKET_MMAP is not set
185# CONFIG_NETLINK_DEV is not set
186CONFIG_UNIX=y 201CONFIG_UNIX=y
202CONFIG_XFRM=y
203# CONFIG_XFRM_USER is not set
204# CONFIG_XFRM_SUB_POLICY is not set
205# CONFIG_XFRM_MIGRATE is not set
206# CONFIG_XFRM_STATISTICS is not set
187# CONFIG_NET_KEY is not set 207# CONFIG_NET_KEY is not set
188CONFIG_INET=y 208CONFIG_INET=y
189# CONFIG_IP_MULTICAST is not set 209# CONFIG_IP_MULTICAST is not set
190# CONFIG_IP_ADVANCED_ROUTER is not set 210# CONFIG_IP_ADVANCED_ROUTER is not set
211CONFIG_IP_FIB_HASH=y
191CONFIG_IP_PNP=y 212CONFIG_IP_PNP=y
192CONFIG_IP_PNP_DHCP=y 213CONFIG_IP_PNP_DHCP=y
193CONFIG_IP_PNP_BOOTP=y 214CONFIG_IP_PNP_BOOTP=y
@@ -199,21 +220,28 @@ CONFIG_IP_PNP_RARP=y
199# CONFIG_INET_AH is not set 220# CONFIG_INET_AH is not set
200# CONFIG_INET_ESP is not set 221# CONFIG_INET_ESP is not set
201# CONFIG_INET_IPCOMP is not set 222# CONFIG_INET_IPCOMP is not set
223# CONFIG_INET_XFRM_TUNNEL is not set
202# CONFIG_INET_TUNNEL is not set 224# CONFIG_INET_TUNNEL is not set
203# CONFIG_IP_TCPDIAG is not set 225CONFIG_INET_XFRM_MODE_TRANSPORT=y
204# CONFIG_IP_TCPDIAG_IPV6 is not set 226CONFIG_INET_XFRM_MODE_TUNNEL=y
227CONFIG_INET_XFRM_MODE_BEET=y
228CONFIG_INET_LRO=y
229CONFIG_INET_DIAG=y
230CONFIG_INET_TCP_DIAG=y
231# CONFIG_TCP_CONG_ADVANCED is not set
232CONFIG_TCP_CONG_CUBIC=y
233CONFIG_DEFAULT_TCP_CONG="cubic"
234# CONFIG_TCP_MD5SIG is not set
205# CONFIG_IPV6 is not set 235# CONFIG_IPV6 is not set
236# CONFIG_NETWORK_SECMARK is not set
206# CONFIG_NETFILTER is not set 237# CONFIG_NETFILTER is not set
207 238# CONFIG_IP_DCCP is not set
208#
209# SCTP Configuration (EXPERIMENTAL)
210#
211# CONFIG_IP_SCTP is not set 239# CONFIG_IP_SCTP is not set
212# CONFIG_SCTP_HMAC_NONE is not set 240# CONFIG_RDS is not set
213# CONFIG_SCTP_HMAC_SHA1 is not set 241# CONFIG_TIPC is not set
214# CONFIG_SCTP_HMAC_MD5 is not set
215# CONFIG_ATM is not set 242# CONFIG_ATM is not set
216# CONFIG_BRIDGE is not set 243# CONFIG_BRIDGE is not set
244# CONFIG_NET_DSA is not set
217# CONFIG_VLAN_8021Q is not set 245# CONFIG_VLAN_8021Q is not set
218# CONFIG_DECNET is not set 246# CONFIG_DECNET is not set
219# CONFIG_LLC2 is not set 247# CONFIG_LLC2 is not set
@@ -221,77 +249,126 @@ CONFIG_IP_PNP_RARP=y
221# CONFIG_ATALK is not set 249# CONFIG_ATALK is not set
222# CONFIG_X25 is not set 250# CONFIG_X25 is not set
223# CONFIG_LAPB is not set 251# CONFIG_LAPB is not set
224# CONFIG_NET_DIVERT is not set
225# CONFIG_ECONET is not set 252# CONFIG_ECONET is not set
226# CONFIG_WAN_ROUTER is not set 253# CONFIG_WAN_ROUTER is not set
227 254# CONFIG_PHONET is not set
228# 255# CONFIG_IEEE802154 is not set
229# QoS and/or fair queueing
230#
231# CONFIG_NET_SCHED is not set 256# CONFIG_NET_SCHED is not set
232# CONFIG_NET_SCH_CLK_JIFFIES is not set 257# CONFIG_DCB is not set
233# CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set
234# CONFIG_NET_SCH_CLK_CPU is not set
235# CONFIG_NET_CLS_ROUTE is not set
236 258
237# 259#
238# Network testing 260# Network testing
239# 261#
240# CONFIG_NET_PKTGEN is not set 262# CONFIG_NET_PKTGEN is not set
241# CONFIG_NETPOLL is not set
242# CONFIG_NET_POLL_CONTROLLER is not set
243# CONFIG_HAMRADIO is not set 263# CONFIG_HAMRADIO is not set
264# CONFIG_CAN is not set
244# CONFIG_IRDA is not set 265# CONFIG_IRDA is not set
245# CONFIG_BT is not set 266# CONFIG_BT is not set
246# CONFIG_NETDEVICES is not set 267# CONFIG_AF_RXRPC is not set
268CONFIG_WIRELESS=y
269# CONFIG_CFG80211 is not set
270# CONFIG_LIB80211 is not set
247 271
248# 272#
249# ISDN subsystem 273# CFG80211 needs to be enabled for MAC80211
250# 274#
251# CONFIG_ISDN is not set 275# CONFIG_WIMAX is not set
276# CONFIG_RFKILL is not set
277# CONFIG_NET_9P is not set
278
279#
280# Device Drivers
281#
282
283#
284# Generic Driver Options
285#
286# CONFIG_STANDALONE is not set
287CONFIG_PREVENT_FIRMWARE_BUILD=y
288# CONFIG_DEBUG_DRIVER is not set
289# CONFIG_DEBUG_DEVRES is not set
290# CONFIG_SYS_HYPERVISOR is not set
291# CONFIG_CONNECTOR is not set
292# CONFIG_MTD is not set
293# CONFIG_PARPORT is not set
294CONFIG_BLK_DEV=y
295# CONFIG_BLK_DEV_COW_COMMON is not set
296# CONFIG_BLK_DEV_LOOP is not set
252 297
253# 298#
254# Telephony Support 299# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
300#
301# CONFIG_BLK_DEV_NBD is not set
302# CONFIG_BLK_DEV_RAM is not set
303# CONFIG_CDROM_PKTCDVD is not set
304# CONFIG_ATA_OVER_ETH is not set
305# CONFIG_BLK_DEV_HD is not set
306CONFIG_MISC_DEVICES=y
307# CONFIG_ENCLOSURE_SERVICES is not set
308# CONFIG_C2PORT is not set
309
310#
311# EEPROM support
312#
313# CONFIG_EEPROM_93CX6 is not set
314CONFIG_HAVE_IDE=y
315# CONFIG_IDE is not set
316
255# 317#
318# SCSI device support
319#
320CONFIG_SCSI_MOD=y
321# CONFIG_RAID_ATTRS is not set
322# CONFIG_SCSI is not set
323# CONFIG_SCSI_DMA is not set
324# CONFIG_SCSI_NETLINK is not set
325# CONFIG_ATA is not set
326# CONFIG_MD is not set
327# CONFIG_NETDEVICES is not set
328# CONFIG_ISDN is not set
256# CONFIG_PHONE is not set 329# CONFIG_PHONE is not set
257 330
258# 331#
259# Input device support 332# Input device support
260# 333#
261CONFIG_INPUT=y 334CONFIG_INPUT=y
335# CONFIG_INPUT_FF_MEMLESS is not set
336# CONFIG_INPUT_POLLDEV is not set
337# CONFIG_INPUT_SPARSEKMAP is not set
262 338
263# 339#
264# Userland interfaces 340# Userland interfaces
265# 341#
266# CONFIG_INPUT_MOUSEDEV is not set 342# CONFIG_INPUT_MOUSEDEV is not set
267# CONFIG_INPUT_JOYDEV is not set 343# CONFIG_INPUT_JOYDEV is not set
268# CONFIG_INPUT_TSDEV is not set
269# CONFIG_INPUT_EVDEV is not set 344# CONFIG_INPUT_EVDEV is not set
270# CONFIG_INPUT_EVBUG is not set 345# CONFIG_INPUT_EVBUG is not set
271 346
272# 347#
273# Input I/O drivers
274#
275# CONFIG_GAMEPORT is not set
276CONFIG_SOUND_GAMEPORT=y
277# CONFIG_SERIO is not set
278# CONFIG_SERIO_I8042 is not set
279
280#
281# Input Device Drivers 348# Input Device Drivers
282# 349#
283# CONFIG_INPUT_KEYBOARD is not set 350# CONFIG_INPUT_KEYBOARD is not set
284# CONFIG_INPUT_MOUSE is not set 351# CONFIG_INPUT_MOUSE is not set
285# CONFIG_INPUT_JOYSTICK is not set 352# CONFIG_INPUT_JOYSTICK is not set
353# CONFIG_INPUT_TABLET is not set
286# CONFIG_INPUT_TOUCHSCREEN is not set 354# CONFIG_INPUT_TOUCHSCREEN is not set
287# CONFIG_INPUT_MISC is not set 355# CONFIG_INPUT_MISC is not set
288 356
289# 357#
358# Hardware I/O ports
359#
360# CONFIG_SERIO is not set
361# CONFIG_GAMEPORT is not set
362
363#
290# Character devices 364# Character devices
291# 365#
292CONFIG_VT=y 366CONFIG_VT=y
367CONFIG_CONSOLE_TRANSLATIONS=y
293CONFIG_VT_CONSOLE=y 368CONFIG_VT_CONSOLE=y
294CONFIG_HW_CONSOLE=y 369CONFIG_HW_CONSOLE=y
370# CONFIG_VT_HW_CONSOLE_BINDING is not set
371CONFIG_DEVKMEM=y
295# CONFIG_SERIAL_NONSTANDARD is not set 372# CONFIG_SERIAL_NONSTANDARD is not set
296 373
297# 374#
@@ -302,117 +379,159 @@ CONFIG_HW_CONSOLE=y
302# 379#
303# Non-8250 serial port support 380# Non-8250 serial port support
304# 381#
382# CONFIG_SERIAL_TIMBERDALE is not set
305CONFIG_UNIX98_PTYS=y 383CONFIG_UNIX98_PTYS=y
384# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
306CONFIG_LEGACY_PTYS=y 385CONFIG_LEGACY_PTYS=y
307CONFIG_LEGACY_PTY_COUNT=256 386CONFIG_LEGACY_PTY_COUNT=256
308
309#
310# IPMI
311#
312# CONFIG_IPMI_HANDLER is not set 387# CONFIG_IPMI_HANDLER is not set
313 388CONFIG_HW_RANDOM=y
314# 389# CONFIG_HW_RANDOM_TIMERIOMEM is not set
315# Watchdog Cards
316#
317CONFIG_WATCHDOG=y
318CONFIG_WATCHDOG_NOWAYOUT=y
319
320#
321# Watchdog Device Drivers
322#
323CONFIG_SOFT_WATCHDOG=y
324# CONFIG_RTC is not set 390# CONFIG_RTC is not set
325# CONFIG_GEN_RTC is not set 391# CONFIG_GEN_RTC is not set
326# CONFIG_DTLK is not set
327# CONFIG_R3964 is not set 392# CONFIG_R3964 is not set
328
329#
330# Ftape, the floppy tape device driver
331#
332# CONFIG_DRM is not set
333# CONFIG_RAW_DRIVER is not set 393# CONFIG_RAW_DRIVER is not set
334 394# CONFIG_TCG_TPM is not set
335#
336# I2C support
337#
338# CONFIG_I2C is not set 395# CONFIG_I2C is not set
396# CONFIG_SPI is not set
339 397
340# 398#
341# Dallas's 1-wire bus 399# PPS support
342# 400#
401# CONFIG_PPS is not set
343# CONFIG_W1 is not set 402# CONFIG_W1 is not set
403# CONFIG_POWER_SUPPLY is not set
404CONFIG_HWMON=y
405# CONFIG_HWMON_VID is not set
406# CONFIG_HWMON_DEBUG_CHIP is not set
407
408#
409# Native drivers
410#
411# CONFIG_SENSORS_F71805F is not set
412# CONFIG_SENSORS_F71882FG is not set
413# CONFIG_SENSORS_IT87 is not set
414# CONFIG_SENSORS_PC87360 is not set
415# CONFIG_SENSORS_PC87427 is not set
416# CONFIG_SENSORS_SHT15 is not set
417# CONFIG_SENSORS_SMSC47M1 is not set
418# CONFIG_SENSORS_SMSC47B397 is not set
419# CONFIG_SENSORS_VT1211 is not set
420# CONFIG_SENSORS_W83627HF is not set
421# CONFIG_SENSORS_W83627EHF is not set
422# CONFIG_THERMAL is not set
423CONFIG_WATCHDOG=y
424CONFIG_WATCHDOG_NOWAYOUT=y
344 425
345# 426#
346# Misc devices 427# Watchdog Device Drivers
347# 428#
429CONFIG_SOFT_WATCHDOG=y
430CONFIG_SSB_POSSIBLE=y
348 431
349# 432#
350# Multimedia devices 433# Sonics Silicon Backplane
351# 434#
352# CONFIG_VIDEO_DEV is not set 435# CONFIG_SSB is not set
353 436
354# 437#
355# Digital Video Broadcasting Devices 438# Multifunction device drivers
356# 439#
357# CONFIG_DVB is not set 440# CONFIG_MFD_CORE is not set
441# CONFIG_MFD_SM501 is not set
442# CONFIG_HTC_PASIC3 is not set
443# CONFIG_MFD_TMIO is not set
444# CONFIG_REGULATOR is not set
445# CONFIG_MEDIA_SUPPORT is not set
358 446
359# 447#
360# Graphics support 448# Graphics support
361# 449#
450# CONFIG_VGASTATE is not set
451# CONFIG_VIDEO_OUTPUT_CONTROL is not set
362# CONFIG_FB is not set 452# CONFIG_FB is not set
453# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
363 454
364# 455#
365# Console display driver support 456# Display device support
366# 457#
367# CONFIG_VGA_CONSOLE is not set 458# CONFIG_DISPLAY_SUPPORT is not set
368CONFIG_DUMMY_CONSOLE=y
369# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
370 459
371# 460#
372# Sound 461# Console display driver support
373# 462#
463# CONFIG_VGA_CONSOLE is not set
464CONFIG_DUMMY_CONSOLE=y
374# CONFIG_SOUND is not set 465# CONFIG_SOUND is not set
466CONFIG_HID_SUPPORT=y
467CONFIG_HID=y
468# CONFIG_HIDRAW is not set
469# CONFIG_HID_PID is not set
375 470
376# 471#
377# USB support 472# Special HID drivers
378# 473#
474CONFIG_USB_SUPPORT=y
379# CONFIG_USB_ARCH_HAS_HCD is not set 475# CONFIG_USB_ARCH_HAS_HCD is not set
380# CONFIG_USB_ARCH_HAS_OHCI is not set 476# CONFIG_USB_ARCH_HAS_OHCI is not set
477# CONFIG_USB_ARCH_HAS_EHCI is not set
478# CONFIG_USB_OTG_WHITELIST is not set
479# CONFIG_USB_OTG_BLACKLIST_HUB is not set
381 480
382# 481#
383# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information 482# Enable Host or Gadget support to see Inventra options
384# 483#
385 484
386# 485#
387# USB Gadget Support 486# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
388# 487#
389# CONFIG_USB_GADGET is not set 488# CONFIG_USB_GADGET is not set
390 489
391# 490#
392# MMC/SD Card support 491# OTG and related infrastructure
393# 492#
394# CONFIG_MMC is not set 493# CONFIG_MMC is not set
494# CONFIG_MEMSTICK is not set
495# CONFIG_NEW_LEDS is not set
496# CONFIG_ACCESSIBILITY is not set
497# CONFIG_RTC_CLASS is not set
498# CONFIG_DMADEVICES is not set
499# CONFIG_AUXDISPLAY is not set
500# CONFIG_UIO is not set
395 501
396# 502#
397# InfiniBand support 503# TI VLYNQ
398# 504#
399# CONFIG_INFINIBAND is not set 505# CONFIG_STAGING is not set
400 506
401# 507#
402# File systems 508# File systems
403# 509#
404# CONFIG_EXT2_FS is not set 510# CONFIG_EXT2_FS is not set
405# CONFIG_EXT3_FS is not set 511# CONFIG_EXT3_FS is not set
406# CONFIG_JBD is not set 512# CONFIG_EXT4_FS is not set
407# CONFIG_REISERFS_FS is not set 513# CONFIG_REISERFS_FS is not set
408# CONFIG_JFS_FS is not set 514# CONFIG_JFS_FS is not set
515# CONFIG_FS_POSIX_ACL is not set
409# CONFIG_XFS_FS is not set 516# CONFIG_XFS_FS is not set
410# CONFIG_MINIX_FS is not set 517# CONFIG_GFS2_FS is not set
411# CONFIG_ROMFS_FS is not set 518# CONFIG_OCFS2_FS is not set
412# CONFIG_QUOTA is not set 519# CONFIG_BTRFS_FS is not set
520# CONFIG_NILFS2_FS is not set
521CONFIG_FILE_LOCKING=y
522CONFIG_FSNOTIFY=y
413# CONFIG_DNOTIFY is not set 523# CONFIG_DNOTIFY is not set
524# CONFIG_INOTIFY is not set
525CONFIG_INOTIFY_USER=y
526# CONFIG_QUOTA is not set
414# CONFIG_AUTOFS_FS is not set 527# CONFIG_AUTOFS_FS is not set
415# CONFIG_AUTOFS4_FS is not set 528# CONFIG_AUTOFS4_FS is not set
529# CONFIG_FUSE_FS is not set
530
531#
532# Caches
533#
534# CONFIG_FSCACHE is not set
416 535
417# 536#
418# CD-ROM/DVD Filesystems 537# CD-ROM/DVD Filesystems
@@ -432,19 +551,14 @@ CONFIG_DUMMY_CONSOLE=y
432# 551#
433CONFIG_PROC_FS=y 552CONFIG_PROC_FS=y
434CONFIG_PROC_KCORE=y 553CONFIG_PROC_KCORE=y
554CONFIG_PROC_SYSCTL=y
555CONFIG_PROC_PAGE_MONITOR=y
435CONFIG_SYSFS=y 556CONFIG_SYSFS=y
436CONFIG_DEVFS_FS=y
437CONFIG_DEVFS_MOUNT=y
438# CONFIG_DEVFS_DEBUG is not set
439# CONFIG_DEVPTS_FS_XATTR is not set
440CONFIG_TMPFS=y 557CONFIG_TMPFS=y
441# CONFIG_TMPFS_XATTR is not set 558# CONFIG_TMPFS_POSIX_ACL is not set
442# CONFIG_HUGETLB_PAGE is not set 559# CONFIG_HUGETLB_PAGE is not set
443CONFIG_RAMFS=y 560# CONFIG_CONFIGFS_FS is not set
444 561CONFIG_MISC_FILESYSTEMS=y
445#
446# Miscellaneous filesystems
447#
448# CONFIG_ADFS_FS is not set 562# CONFIG_ADFS_FS is not set
449# CONFIG_AFFS_FS is not set 563# CONFIG_AFFS_FS is not set
450# CONFIG_HFS_FS is not set 564# CONFIG_HFS_FS is not set
@@ -452,29 +566,22 @@ CONFIG_RAMFS=y
452# CONFIG_BEFS_FS is not set 566# CONFIG_BEFS_FS is not set
453# CONFIG_BFS_FS is not set 567# CONFIG_BFS_FS is not set
454# CONFIG_EFS_FS is not set 568# CONFIG_EFS_FS is not set
569# CONFIG_LOGFS is not set
455# CONFIG_CRAMFS is not set 570# CONFIG_CRAMFS is not set
571# CONFIG_SQUASHFS is not set
456# CONFIG_VXFS_FS is not set 572# CONFIG_VXFS_FS is not set
573# CONFIG_MINIX_FS is not set
574# CONFIG_OMFS_FS is not set
457# CONFIG_HPFS_FS is not set 575# CONFIG_HPFS_FS is not set
458# CONFIG_QNX4FS_FS is not set 576# CONFIG_QNX4FS_FS is not set
577# CONFIG_ROMFS_FS is not set
459# CONFIG_SYSV_FS is not set 578# CONFIG_SYSV_FS is not set
460# CONFIG_UFS_FS is not set 579# CONFIG_UFS_FS is not set
461 580CONFIG_NETWORK_FILESYSTEMS=y
462# 581# CONFIG_NFS_FS is not set
463# Network File Systems
464#
465CONFIG_NFS_FS=y
466CONFIG_NFS_V3=y
467# CONFIG_NFS_V4 is not set
468CONFIG_NFS_DIRECTIO=y
469# CONFIG_NFSD is not set 582# CONFIG_NFSD is not set
470CONFIG_ROOT_NFS=y
471CONFIG_LOCKD=y
472CONFIG_LOCKD_V4=y
473# CONFIG_EXPORTFS is not set
474CONFIG_SUNRPC=y
475# CONFIG_RPCSEC_GSS_KRB5 is not set
476# CONFIG_RPCSEC_GSS_SPKM3 is not set
477# CONFIG_SMB_FS is not set 583# CONFIG_SMB_FS is not set
584# CONFIG_CEPH_FS is not set
478# CONFIG_CIFS is not set 585# CONFIG_CIFS is not set
479# CONFIG_NCP_FS is not set 586# CONFIG_NCP_FS is not set
480# CONFIG_CODA_FS is not set 587# CONFIG_CODA_FS is not set
@@ -485,43 +592,175 @@ CONFIG_SUNRPC=y
485# 592#
486# CONFIG_PARTITION_ADVANCED is not set 593# CONFIG_PARTITION_ADVANCED is not set
487CONFIG_MSDOS_PARTITION=y 594CONFIG_MSDOS_PARTITION=y
488
489#
490# Native Language Support
491#
492# CONFIG_NLS is not set 595# CONFIG_NLS is not set
596# CONFIG_DLM is not set
493 597
494# 598#
495# Kernel hacking 599# Kernel hacking
496# 600#
497CONFIG_DEBUG_KERNEL=y 601# CONFIG_PRINTK_TIME is not set
498# CONFIG_DEBUG_STACKOVERFLOW is not set 602CONFIG_ENABLE_WARN_DEPRECATED=y
499# CONFIG_DEBUG_SLAB is not set 603CONFIG_ENABLE_MUST_CHECK=y
604CONFIG_FRAME_WARN=1024
500# CONFIG_MAGIC_SYSRQ is not set 605# CONFIG_MAGIC_SYSRQ is not set
606# CONFIG_STRIP_ASM_SYMS is not set
607# CONFIG_UNUSED_SYMBOLS is not set
608# CONFIG_DEBUG_FS is not set
609# CONFIG_HEADERS_CHECK is not set
610CONFIG_DEBUG_KERNEL=y
611# CONFIG_DEBUG_SHIRQ is not set
612CONFIG_DETECT_SOFTLOCKUP=y
613# CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC is not set
614CONFIG_BOOTPARAM_SOFTLOCKUP_PANIC_VALUE=0
615CONFIG_DETECT_HUNG_TASK=y
616# CONFIG_BOOTPARAM_HUNG_TASK_PANIC is not set
617CONFIG_BOOTPARAM_HUNG_TASK_PANIC_VALUE=0
618CONFIG_SCHED_DEBUG=y
619# CONFIG_SCHEDSTATS is not set
620# CONFIG_TIMER_STATS is not set
621# CONFIG_DEBUG_OBJECTS is not set
622# CONFIG_SLUB_DEBUG_ON is not set
623# CONFIG_SLUB_STATS is not set
624# CONFIG_DEBUG_RT_MUTEXES is not set
625# CONFIG_RT_MUTEX_TESTER is not set
501# CONFIG_DEBUG_SPINLOCK is not set 626# CONFIG_DEBUG_SPINLOCK is not set
502# CONFIG_DEBUG_PAGEALLOC is not set 627# CONFIG_DEBUG_MUTEXES is not set
503# CONFIG_DEBUG_INFO is not set
504# CONFIG_DEBUG_SPINLOCK_SLEEP is not set 628# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
505# CONFIG_KGDB is not set 629# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
630# CONFIG_DEBUG_KOBJECT is not set
631# CONFIG_DEBUG_INFO is not set
632# CONFIG_DEBUG_VM is not set
633# CONFIG_DEBUG_WRITECOUNT is not set
634# CONFIG_DEBUG_MEMORY_INIT is not set
635# CONFIG_DEBUG_LIST is not set
636# CONFIG_DEBUG_SG is not set
637# CONFIG_DEBUG_NOTIFIERS is not set
638# CONFIG_DEBUG_CREDENTIALS is not set
639# CONFIG_RCU_TORTURE_TEST is not set
640CONFIG_RCU_CPU_STALL_DETECTOR=y
641# CONFIG_BACKTRACE_SELF_TEST is not set
642# CONFIG_DEBUG_BLOCK_EXT_DEVT is not set
643# CONFIG_DEBUG_FORCE_WEAK_PER_CPU is not set
644# CONFIG_FAULT_INJECTION is not set
645# CONFIG_SYSCTL_SYSCALL_CHECK is not set
646# CONFIG_PAGE_POISONING is not set
647# CONFIG_SAMPLES is not set
506 648
507# 649#
508# Security options 650# Security options
509# 651#
510# CONFIG_KEYS is not set 652# CONFIG_KEYS is not set
511# CONFIG_SECURITY is not set 653# CONFIG_SECURITY is not set
654# CONFIG_SECURITYFS is not set
655# CONFIG_DEFAULT_SECURITY_SELINUX is not set
656# CONFIG_DEFAULT_SECURITY_SMACK is not set
657# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
658CONFIG_DEFAULT_SECURITY_DAC=y
659CONFIG_DEFAULT_SECURITY=""
660CONFIG_CRYPTO=y
661
662#
663# Crypto core or helper
664#
665# CONFIG_CRYPTO_FIPS is not set
666CONFIG_CRYPTO_ALGAPI=y
667CONFIG_CRYPTO_ALGAPI2=y
668CONFIG_CRYPTO_RNG=y
669CONFIG_CRYPTO_RNG2=y
670# CONFIG_CRYPTO_MANAGER is not set
671# CONFIG_CRYPTO_MANAGER2 is not set
672# CONFIG_CRYPTO_GF128MUL is not set
673# CONFIG_CRYPTO_NULL is not set
674# CONFIG_CRYPTO_CRYPTD is not set
675# CONFIG_CRYPTO_AUTHENC is not set
676
677#
678# Authenticated Encryption with Associated Data
679#
680# CONFIG_CRYPTO_CCM is not set
681# CONFIG_CRYPTO_GCM is not set
682# CONFIG_CRYPTO_SEQIV is not set
683
684#
685# Block modes
686#
687# CONFIG_CRYPTO_CBC is not set
688# CONFIG_CRYPTO_CTR is not set
689# CONFIG_CRYPTO_CTS is not set
690# CONFIG_CRYPTO_ECB is not set
691# CONFIG_CRYPTO_LRW is not set
692# CONFIG_CRYPTO_PCBC is not set
693# CONFIG_CRYPTO_XTS is not set
694
695#
696# Hash modes
697#
698# CONFIG_CRYPTO_HMAC is not set
699# CONFIG_CRYPTO_XCBC is not set
700# CONFIG_CRYPTO_VMAC is not set
701
702#
703# Digest
704#
705# CONFIG_CRYPTO_CRC32C is not set
706# CONFIG_CRYPTO_GHASH is not set
707# CONFIG_CRYPTO_MD4 is not set
708# CONFIG_CRYPTO_MD5 is not set
709# CONFIG_CRYPTO_MICHAEL_MIC is not set
710# CONFIG_CRYPTO_RMD128 is not set
711# CONFIG_CRYPTO_RMD160 is not set
712# CONFIG_CRYPTO_RMD256 is not set
713# CONFIG_CRYPTO_RMD320 is not set
714# CONFIG_CRYPTO_SHA1 is not set
715# CONFIG_CRYPTO_SHA256 is not set
716# CONFIG_CRYPTO_SHA512 is not set
717# CONFIG_CRYPTO_TGR192 is not set
718# CONFIG_CRYPTO_WP512 is not set
719
720#
721# Ciphers
722#
723CONFIG_CRYPTO_AES=y
724# CONFIG_CRYPTO_ANUBIS is not set
725# CONFIG_CRYPTO_ARC4 is not set
726# CONFIG_CRYPTO_BLOWFISH is not set
727# CONFIG_CRYPTO_CAMELLIA is not set
728# CONFIG_CRYPTO_CAST5 is not set
729# CONFIG_CRYPTO_CAST6 is not set
730# CONFIG_CRYPTO_DES is not set
731# CONFIG_CRYPTO_FCRYPT is not set
732# CONFIG_CRYPTO_KHAZAD is not set
733# CONFIG_CRYPTO_SALSA20 is not set
734# CONFIG_CRYPTO_SEED is not set
735# CONFIG_CRYPTO_SERPENT is not set
736# CONFIG_CRYPTO_TEA is not set
737# CONFIG_CRYPTO_TWOFISH is not set
512 738
513# 739#
514# Cryptographic options 740# Compression
515# 741#
516# CONFIG_CRYPTO is not set 742# CONFIG_CRYPTO_DEFLATE is not set
743# CONFIG_CRYPTO_ZLIB is not set
744# CONFIG_CRYPTO_LZO is not set
517 745
518# 746#
519# Hardware crypto devices 747# Random Number Generation
520# 748#
749CONFIG_CRYPTO_ANSI_CPRNG=y
750CONFIG_CRYPTO_HW=y
751# CONFIG_BINARY_PRINTF is not set
521 752
522# 753#
523# Library routines 754# Library routines
524# 755#
756CONFIG_GENERIC_FIND_LAST_BIT=y
525# CONFIG_CRC_CCITT is not set 757# CONFIG_CRC_CCITT is not set
758# CONFIG_CRC16 is not set
759# CONFIG_CRC_T10DIF is not set
760# CONFIG_CRC_ITU_T is not set
526# CONFIG_CRC32 is not set 761# CONFIG_CRC32 is not set
762# CONFIG_CRC7 is not set
527# CONFIG_LIBCRC32C is not set 763# CONFIG_LIBCRC32C is not set
764CONFIG_HAS_IOMEM=y
765CONFIG_HAS_DMA=y
766CONFIG_NLATTR=y
diff --git a/arch/xtensa/include/asm/cacheflush.h b/arch/xtensa/include/asm/cacheflush.h
index a508f2f73bd7..376cd9d5f455 100644
--- a/arch/xtensa/include/asm/cacheflush.h
+++ b/arch/xtensa/include/asm/cacheflush.h
@@ -115,6 +115,7 @@ extern void flush_cache_page(struct vm_area_struct*, unsigned long, unsigned lon
115#define flush_cache_vmap(start,end) do { } while (0) 115#define flush_cache_vmap(start,end) do { } while (0)
116#define flush_cache_vunmap(start,end) do { } while (0) 116#define flush_cache_vunmap(start,end) do { } while (0)
117 117
118#define ARCH_IMPLEMENTS_FLUSH_DCACHE_PAGE 0
118#define flush_dcache_page(page) do { } while (0) 119#define flush_dcache_page(page) do { } while (0)
119 120
120#define flush_cache_page(vma,addr,pfn) do { } while (0) 121#define flush_cache_page(vma,addr,pfn) do { } while (0)
diff --git a/arch/xtensa/include/asm/coprocessor.h b/arch/xtensa/include/asm/coprocessor.h
index 65a285d8d3fb..75c94a1658b0 100644
--- a/arch/xtensa/include/asm/coprocessor.h
+++ b/arch/xtensa/include/asm/coprocessor.h
@@ -13,6 +13,7 @@
13#define _XTENSA_COPROCESSOR_H 13#define _XTENSA_COPROCESSOR_H
14 14
15#include <linux/stringify.h> 15#include <linux/stringify.h>
16#include <variant/core.h>
16#include <variant/tie.h> 17#include <variant/tie.h>
17#include <asm/types.h> 18#include <asm/types.h>
18 19
diff --git a/arch/xtensa/include/asm/elf.h b/arch/xtensa/include/asm/elf.h
index 5eb6d695e987..6e65eadaae14 100644
--- a/arch/xtensa/include/asm/elf.h
+++ b/arch/xtensa/include/asm/elf.h
@@ -14,6 +14,7 @@
14#define _XTENSA_ELF_H 14#define _XTENSA_ELF_H
15 15
16#include <asm/ptrace.h> 16#include <asm/ptrace.h>
17#include <asm/coprocessor.h>
17 18
18/* Xtensa processor ELF architecture-magic number */ 19/* Xtensa processor ELF architecture-magic number */
19 20
diff --git a/arch/xtensa/include/asm/local64.h b/arch/xtensa/include/asm/local64.h
new file mode 100644
index 000000000000..36c93b5cc239
--- /dev/null
+++ b/arch/xtensa/include/asm/local64.h
@@ -0,0 +1 @@
#include <asm-generic/local64.h>
diff --git a/arch/xtensa/include/asm/pgalloc.h b/arch/xtensa/include/asm/pgalloc.h
index 4f4a7987eded..40cf9bceda2c 100644
--- a/arch/xtensa/include/asm/pgalloc.h
+++ b/arch/xtensa/include/asm/pgalloc.h
@@ -14,6 +14,7 @@
14#ifdef __KERNEL__ 14#ifdef __KERNEL__
15 15
16#include <linux/highmem.h> 16#include <linux/highmem.h>
17#include <linux/slab.h>
17 18
18/* 19/*
19 * Allocating and freeing a pmd is trivial: the 1-entry pmd is 20 * Allocating and freeing a pmd is trivial: the 1-entry pmd is
diff --git a/arch/xtensa/include/asm/processor.h b/arch/xtensa/include/asm/processor.h
index 0ea4937c0b61..3acb26e8dead 100644
--- a/arch/xtensa/include/asm/processor.h
+++ b/arch/xtensa/include/asm/processor.h
@@ -12,7 +12,6 @@
12#define _XTENSA_PROCESSOR_H 12#define _XTENSA_PROCESSOR_H
13 13
14#include <variant/core.h> 14#include <variant/core.h>
15#include <asm/coprocessor.h>
16#include <platform/hardware.h> 15#include <platform/hardware.h>
17 16
18#include <linux/compiler.h> 17#include <linux/compiler.h>
diff --git a/arch/xtensa/include/asm/ptrace.h b/arch/xtensa/include/asm/ptrace.h
index 3c549f798727..0d42c934b66f 100644
--- a/arch/xtensa/include/asm/ptrace.h
+++ b/arch/xtensa/include/asm/ptrace.h
@@ -77,6 +77,8 @@
77 77
78#ifndef __ASSEMBLY__ 78#ifndef __ASSEMBLY__
79 79
80#include <asm/coprocessor.h>
81
80/* 82/*
81 * This struct defines the way the registers are stored on the 83 * This struct defines the way the registers are stored on the
82 * kernel stack during a system call or other kernel entry. 84 * kernel stack during a system call or other kernel entry.
diff --git a/arch/xtensa/kernel/Makefile b/arch/xtensa/kernel/Makefile
index 6f56d95f2c1e..2d2728b3e862 100644
--- a/arch/xtensa/kernel/Makefile
+++ b/arch/xtensa/kernel/Makefile
@@ -23,8 +23,8 @@ obj-$(CONFIG_MODULES) += xtensa_ksyms.o module.o
23# 23#
24# Replicate rules in scripts/Makefile.build 24# Replicate rules in scripts/Makefile.build
25 25
26sed-y = -e 's/(\(\.[a-z]*it\|\.ref\|\)\.text)/(\1.literal \1.text)/g' \ 26sed-y = -e 's/\*(\(\.[a-z]*it\|\.ref\|\)\.text)/*(\1.literal \1.text)/g' \
27 -e 's/(\(\.text\.[a-z]*\))/(\1.literal \1)/g' 27 -e 's/\*(\(\.text\.[a-z]*\))/*(\1.literal \1)/g'
28 28
29quiet_cmd__cpp_lds_S = LDS $@ 29quiet_cmd__cpp_lds_S = LDS $@
30 cmd__cpp_lds_S = $(CPP) $(cpp_flags) -P -C -Uxtensa -D__ASSEMBLY__ $< \ 30 cmd__cpp_lds_S = $(CPP) $(cpp_flags) -P -C -Uxtensa -D__ASSEMBLY__ $< \
diff --git a/arch/xtensa/kernel/asm-offsets.c b/arch/xtensa/kernel/asm-offsets.c
index 070ff8af3a21..7dc3f9157185 100644
--- a/arch/xtensa/kernel/asm-offsets.c
+++ b/arch/xtensa/kernel/asm-offsets.c
@@ -13,6 +13,7 @@
13 */ 13 */
14 14
15#include <asm/processor.h> 15#include <asm/processor.h>
16#include <asm/coprocessor.h>
16 17
17#include <linux/types.h> 18#include <linux/types.h>
18#include <linux/stddef.h> 19#include <linux/stddef.h>
diff --git a/arch/xtensa/kernel/entry.S b/arch/xtensa/kernel/entry.S
index 77fc9f6dc016..5fd01f6aaf37 100644
--- a/arch/xtensa/kernel/entry.S
+++ b/arch/xtensa/kernel/entry.S
@@ -16,6 +16,7 @@
16#include <linux/linkage.h> 16#include <linux/linkage.h>
17#include <asm/asm-offsets.h> 17#include <asm/asm-offsets.h>
18#include <asm/processor.h> 18#include <asm/processor.h>
19#include <asm/coprocessor.h>
19#include <asm/thread_info.h> 20#include <asm/thread_info.h>
20#include <asm/uaccess.h> 21#include <asm/uaccess.h>
21#include <asm/unistd.h> 22#include <asm/unistd.h>
diff --git a/arch/xtensa/kernel/head.S b/arch/xtensa/kernel/head.S
index d215adcfd4ea..3ef91a73652d 100644
--- a/arch/xtensa/kernel/head.S
+++ b/arch/xtensa/kernel/head.S
@@ -184,8 +184,8 @@ _startup:
184 * Now clear the BSS segment. 184 * Now clear the BSS segment.
185 */ 185 */
186 186
187 movi a2, _bss_start # start of BSS 187 movi a2, __bss_start # start of BSS
188 movi a3, _bss_end # end of BSS 188 movi a3, __bss_stop # end of BSS
189 189
190 __loopt a2, a3, a4, 2 190 __loopt a2, a3, a4, 2
191 s32i a0, a2, 0 191 s32i a0, a2, 0
diff --git a/arch/xtensa/platforms/iss/network.c b/arch/xtensa/platforms/iss/network.c
index 87e218f98ef4..f717e20d961b 100644
--- a/arch/xtensa/platforms/iss/network.c
+++ b/arch/xtensa/platforms/iss/network.c
@@ -623,6 +623,19 @@ static struct platform_driver iss_net_driver = {
623 623
624static int driver_registered; 624static int driver_registered;
625 625
626static const struct net_device_ops iss_netdev_ops = {
627 .ndo_open = iss_net_open,
628 .ndo_stop = iss_net_close,
629 .ndo_get_stats = iss_net_get_stats,
630 .ndo_start_xmit = iss_net_start_xmit,
631 .ndo_validate_addr = eth_validate_addr,
632 .ndo_change_mtu = iss_net_change_mtu,
633 .ndo_set_mac_address = iss_net_set_mac,
634 //.ndo_do_ioctl = iss_net_ioctl,
635 .ndo_tx_timeout = iss_net_tx_timeout,
636 .ndo_set_multicast_list = iss_net_set_multicast_list,
637};
638
626static int iss_net_configure(int index, char *init) 639static int iss_net_configure(int index, char *init)
627{ 640{
628 struct net_device *dev; 641 struct net_device *dev;
@@ -686,15 +699,8 @@ static int iss_net_configure(int index, char *init)
686 */ 699 */
687 snprintf(dev->name, sizeof dev->name, "eth%d", index); 700 snprintf(dev->name, sizeof dev->name, "eth%d", index);
688 701
702 dev->netdev_ops = &iss_netdev_ops;
689 dev->mtu = lp->mtu; 703 dev->mtu = lp->mtu;
690 dev->open = iss_net_open;
691 dev->hard_start_xmit = iss_net_start_xmit;
692 dev->stop = iss_net_close;
693 dev->get_stats = iss_net_get_stats;
694 dev->set_multicast_list = iss_net_set_multicast_list;
695 dev->tx_timeout = iss_net_tx_timeout;
696 dev->set_mac_address = iss_net_set_mac;
697 dev->change_mtu = iss_net_change_mtu;
698 dev->watchdog_timeo = (HZ >> 1); 704 dev->watchdog_timeo = (HZ >> 1);
699 dev->irq = -1; 705 dev->irq = -1;
700 706